#include <sstream>
Ispy::Ispy(const Reader& reader) :
- MovingSprite(reader, "images/objects/ispy/ispy.sprite", LAYER_TILES+5, COLGROUP_DISABLED),
- state(ISPYSTATE_IDLE),
+ MovingSprite(reader, "images/objects/ispy/ispy.sprite", LAYER_TILES+5, COLGROUP_DISABLED),
+ state(ISPYSTATE_IDLE),
script(),
dir(AUTO)
{
if( dir_str == "right" ) dir = RIGHT;
reader.get("facing-down", facing_down);
if (facing_down) dir = DOWN;
- if (dir == AUTO) log_warning << "Setting an Ispy's direction to AUTO is no good idea" << std::endl;
+ if (dir == AUTO) { log_warning << "Setting an Ispy's direction to AUTO is no good idea" << std::endl; }
// set initial sprite action
sprite->set_action((dir == DOWN) ? "idle-down" : ((dir == LEFT) ? "idle-left" : "idle-right"));
float den2 = (d2-b2)*(a1-a2) + (a2-c2)*(b1-b2);
// normalize to positive numerator
- if (num < 0) {
- num =- num;
- den1 =- den1;
- den2 =- den2;
+ if (num < 0) {
+ num = -num;
+ den1 = -den1;
+ den2 = -den2;
}
// numerator is zero -> Check for parallel or coinciding lines
if (num == 0) {
if ((b1-b2)*(c1-a2) != (a1-a2)*(d1-b2)) return false;
- if (a1 == a2) {
- std::swap(a1, b1);
- std::swap(a2, b2);
- std::swap(c1, d1);
- std::swap(c2, d2);
+ if (a1 == a2) {
+ std::swap(a1, b1);
+ std::swap(a2, b2);
+ std::swap(c1, d1);
+ std::swap(c2, d2);
}
if (a1 > a2) std::swap(a1, a2);
if (c1 > c2) std::swap(c1, c2);
std::list<TileMap*> solid_tilemaps = Sector::current()->solid_tilemaps;
for (float test_x = lsx; test_x <= lex; test_x += 16) {
for (float test_y = lsy; test_y <= ley; test_y += 16) {
- for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); i++) {
+ for(std::list<TileMap*>::const_iterator i = solid_tilemaps.begin(); i != solid_tilemaps.end(); ++i) {
TileMap* solids = *i;
const Tile* tile = solids->get_tile_at(Vector(test_x, test_y));
if(!tile) continue;
return true;
}
-void
+void
Ispy::update(float )
{