From: Ryan Flegel Date: Thu, 12 Jun 2008 05:23:28 +0000 (+0000) Subject: Getting rid of nasty tabs X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=38105c22495d9439b30221732dd5d7b89f328a0c;p=supertux.git Getting rid of nasty tabs SVN-Revision: 5563 --- diff --git a/src/addon/addon_manager.cpp b/src/addon/addon_manager.cpp index 1ec5c5908..cf7ab809e 100644 --- a/src/addon/addon_manager.cpp +++ b/src/addon/addon_manager.cpp @@ -387,10 +387,10 @@ AddonManager::load_addons() // make sure it looks like an infoFile static const std::string infoExt = ".nfo"; if (potentialInfoFileName.length() <= infoExt.length()) - continue; + continue; if (potentialInfoFileName.compare(potentialInfoFileName.length()-infoExt.length(), infoExt.length(), infoExt) != 0) - continue; + continue; // make sure it's in the current archive std::string infoFileDir = PHYSFS_getRealDir(potentialInfoFileName.c_str()); diff --git a/src/audio/sound_file.cpp b/src/audio/sound_file.cpp index 63521109b..2af95ca78 100644 --- a/src/audio/sound_file.cpp +++ b/src/audio/sound_file.cpp @@ -400,11 +400,11 @@ SoundFile* load_sound_file(const std::string& filename) if(!file) { log_warning << "Couldn't open '" << filename << "': " << PHYSFS_getLastError() << ", using dummy sound file." << std::endl; file = PHYSFS_openRead("sounds/empty.wav"); - if (!file) { + if (!file) { std::stringstream msg; - msg << "Couldn't open dummy sound file '" << filename << "': " << PHYSFS_getLastError(); - throw std::runtime_error(msg.str()); - } + msg << "Couldn't open dummy sound file '" << filename << "': " << PHYSFS_getLastError(); + throw std::runtime_error(msg.str()); + } } try { diff --git a/src/audio/sound_manager.cpp b/src/audio/sound_manager.cpp index b2697c1ab..b8429036a 100644 --- a/src/audio/sound_manager.cpp +++ b/src/audio/sound_manager.cpp @@ -234,7 +234,7 @@ void SoundManager::remove_from_update( StreamSoundSource* sss ){ if( sss != NULL ){ StreamSoundSources::iterator i = update_list.begin(); - while( i != update_list.end() ){ + while( i != update_list.end() ){ if( *i == sss ){ i = update_list.erase(i); } else { diff --git a/src/audio/sound_manager.hpp b/src/audio/sound_manager.hpp index 12f19447c..290147a9b 100644 --- a/src/audio/sound_manager.hpp +++ b/src/audio/sound_manager.hpp @@ -75,7 +75,7 @@ public: bool is_sound_enabled() { return sound_enabled; } bool is_audio_enabled() { - return device != 0 && context != 0; + return device != 0 && context != 0; } void update(); diff --git a/src/badguy/angrystone.cpp b/src/badguy/angrystone.cpp index d44f9d8e7..34ea9c14f 100644 --- a/src/badguy/angrystone.cpp +++ b/src/badguy/angrystone.cpp @@ -29,7 +29,7 @@ static const float ATTACK_TIME = 1; static const float RECOVER_TIME = .5; AngryStone::AngryStone(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/angrystone/angrystone.sprite"), state(IDLE) + : BadGuy(reader, "images/creatures/angrystone/angrystone.sprite"), state(IDLE) { physic.set_velocity_x(0); physic.set_velocity_y(0); diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 0e9347e78..fd3ef266e 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -211,7 +211,7 @@ BadGuy::collision(GameObject& other, const CollisionHit& hit) // hit from above? if (badguy->get_bbox().p2.y < (bbox.p1.y + 16)) { if(collision_squished(*badguy)) { - return ABORT_MOVE; + return ABORT_MOVE; } } @@ -224,7 +224,7 @@ BadGuy::collision(GameObject& other, const CollisionHit& hit) // hit from above? if (player->get_bbox().p2.y < (bbox.p1.y + 16)) { if(collision_squished(*player)) { - return ABORT_MOVE; + return ABORT_MOVE; } } diff --git a/src/badguy/bomb.cpp b/src/badguy/bomb.cpp index cbc96c0a0..5327515ab 100644 --- a/src/badguy/bomb.cpp +++ b/src/badguy/bomb.cpp @@ -24,7 +24,7 @@ #include "object/explosion.hpp" Bomb::Bomb(const Vector& pos, Direction dir, std::string custom_sprite /*= "images/creatures/mr_bomb/mr_bomb.sprite"*/ ) - : BadGuy( pos, dir, custom_sprite ) + : BadGuy( pos, dir, custom_sprite ) { state = STATE_TICKING; set_action(dir == LEFT ? "ticking-left" : "ticking-right", 1); @@ -39,7 +39,7 @@ Bomb::Bomb(const Vector& pos, Direction dir, std::string custom_sprite /*= "imag } Bomb::Bomb(const Bomb& other) - : BadGuy(other), state(other.state) + : BadGuy(other), state(other.state) { if (state == STATE_TICKING) { ticking.reset(sound_manager->create_sound_source("sounds/fizz.wav")); diff --git a/src/badguy/bouncing_snowball.cpp b/src/badguy/bouncing_snowball.cpp index ae9e91d1b..2d9043353 100644 --- a/src/badguy/bouncing_snowball.cpp +++ b/src/badguy/bouncing_snowball.cpp @@ -25,7 +25,7 @@ static const float JUMPSPEED = -450; static const float WALKSPEED = 80; BouncingSnowball::BouncingSnowball(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/bouncing_snowball/bouncing_snowball.sprite") + : BadGuy(reader, "images/creatures/bouncing_snowball/bouncing_snowball.sprite") { } diff --git a/src/badguy/dart.cpp b/src/badguy/dart.cpp index f95249211..bfed64a6d 100644 --- a/src/badguy/dart.cpp +++ b/src/badguy/dart.cpp @@ -29,7 +29,7 @@ namespace { static const std::string SOUNDFILE = "sounds/flame.wav"; Dart::Dart(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/dart/dart.sprite"), parent(0) + : BadGuy(reader, "images/creatures/dart/dart.sprite"), parent(0) { physic.enable_gravity(false); countMe = false; @@ -39,7 +39,7 @@ Dart::Dart(const lisp::Lisp& reader) } Dart::Dart(const Vector& pos, Direction d, const BadGuy* parent = 0) - : BadGuy(pos, d, "images/creatures/dart/dart.sprite"), parent(parent) + : BadGuy(pos, d, "images/creatures/dart/dart.sprite"), parent(parent) { physic.enable_gravity(false); countMe = false; @@ -49,7 +49,7 @@ Dart::Dart(const Vector& pos, Direction d, const BadGuy* parent = 0) } Dart::Dart(const Dart& other) - : BadGuy(other), parent(other.parent) + : BadGuy(other), parent(other.parent) { sound_manager->preload(SOUNDFILE); sound_manager->preload("sounds/darthit.wav"); diff --git a/src/badguy/darttrap.cpp b/src/badguy/darttrap.cpp index 41cc5858a..b2e7f55e4 100644 --- a/src/badguy/darttrap.cpp +++ b/src/badguy/darttrap.cpp @@ -27,7 +27,7 @@ namespace { } DartTrap::DartTrap(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/darttrap/darttrap.sprite", LAYER_TILES-1), initial_delay(0), fire_delay(2), ammo(-1), state(IDLE) + : BadGuy(reader, "images/creatures/darttrap/darttrap.sprite", LAYER_TILES-1), initial_delay(0), fire_delay(2), ammo(-1), state(IDLE) { reader.get("initial-delay", initial_delay); reader.get("fire-delay", fire_delay); diff --git a/src/badguy/dispenser.cpp b/src/badguy/dispenser.cpp index 14615f4a3..3bbe81bb3 100644 --- a/src/badguy/dispenser.cpp +++ b/src/badguy/dispenser.cpp @@ -24,7 +24,7 @@ #include "random_generator.hpp" Dispenser::Dispenser(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/dispenser/dispenser.sprite") + : BadGuy(reader, "images/creatures/dispenser/dispenser.sprite") { set_colgroup_active(COLGROUP_MOVING_STATIC); sound_manager->preload("sounds/squish.wav"); diff --git a/src/badguy/fish.cpp b/src/badguy/fish.cpp index e34c4b69d..e83fbd4f2 100644 --- a/src/badguy/fish.cpp +++ b/src/badguy/fish.cpp @@ -28,13 +28,13 @@ static const float FISH_JUMP_POWER = -600; static const float FISH_WAIT_TIME = 1; Fish::Fish(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/fish/fish.sprite", LAYER_TILES-1), stop_y(0) + : BadGuy(reader, "images/creatures/fish/fish.sprite", LAYER_TILES-1), stop_y(0) { physic.enable_gravity(true); } Fish::Fish(const Vector& pos) - : BadGuy(pos, "images/creatures/fish/fish.sprite", LAYER_TILES-1), stop_y(0) + : BadGuy(pos, "images/creatures/fish/fish.sprite", LAYER_TILES-1), stop_y(0) { physic.enable_gravity(true); } diff --git a/src/badguy/flyingsnowball.cpp b/src/badguy/flyingsnowball.cpp index baeed3378..9b762611f 100644 --- a/src/badguy/flyingsnowball.cpp +++ b/src/badguy/flyingsnowball.cpp @@ -31,13 +31,13 @@ namespace { } FlyingSnowBall::FlyingSnowBall(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/flying_snowball/flying_snowball.sprite") + : BadGuy(reader, "images/creatures/flying_snowball/flying_snowball.sprite") { physic.enable_gravity(true); } FlyingSnowBall::FlyingSnowBall(const Vector& pos) - : BadGuy(pos, "images/creatures/flying_snowball/flying_snowball.sprite") + : BadGuy(pos, "images/creatures/flying_snowball/flying_snowball.sprite") { physic.enable_gravity(true); } diff --git a/src/badguy/ghosttree.cpp b/src/badguy/ghosttree.cpp index e3436215c..124712e04 100644 --- a/src/badguy/ghosttree.cpp +++ b/src/badguy/ghosttree.cpp @@ -83,13 +83,13 @@ GhostTree::active_update(float elapsed_time) Color col; switch(treecolor) { - case 0: col = Color(1, 0, 0); break; - case 1: col = Color(0, 1, 0); break; - case 2: col = Color(0, 0, 1); break; - case 3: col = Color(1, 1, 0); break; - case 4: col = Color(1, 0, 1); break; - case 5: col = Color(0, 1, 1); break; - default: assert(false); + case 0: col = Color(1, 0, 0); break; + case 1: col = Color(0, 1, 0); break; + case 2: col = Color(0, 0, 1); break; + case 3: col = Color(1, 1, 0); break; + case 4: col = Color(1, 0, 1); break; + case 5: col = Color(0, 1, 1); break; + default: assert(false); } glow_sprite->set_color(col); } @@ -99,50 +99,50 @@ GhostTree::active_update(float elapsed_time) sound_manager->play("sounds/tree_suck.ogg", get_pos()); std::vector::iterator iter; for(iter = willowisps.begin(); iter != willowisps.end(); ++iter) { - TreeWillOWisp *willo = *iter; - if(willo->get_color() == col) { - willo->start_sucking(get_bbox().get_middle() + SUCK_TARGET_OFFSET + Vector(systemRandom.randf(-SUCK_TARGET_SPREAD, SUCK_TARGET_SPREAD), systemRandom.randf(-SUCK_TARGET_SPREAD, SUCK_TARGET_SPREAD))); - } + TreeWillOWisp *willo = *iter; + if(willo->get_color() == col) { + willo->start_sucking(get_bbox().get_middle() + SUCK_TARGET_OFFSET + Vector(systemRandom.randf(-SUCK_TARGET_SPREAD, SUCK_TARGET_SPREAD), systemRandom.randf(-SUCK_TARGET_SPREAD, SUCK_TARGET_SPREAD))); + } } mystate = STATE_SUCKING; } if(willowisp_timer.check()) { if(willowisps.size() < WILLOWISP_COUNT) { - Vector pos = Vector(bbox.get_width() / 2, bbox.get_height() / 2 + willo_spawn_y + WILLOWISP_TOP_OFFSET); - TreeWillOWisp *willowisp - = new TreeWillOWisp(this, pos, 200 + willo_radius, willo_speed); + Vector pos = Vector(bbox.get_width() / 2, bbox.get_height() / 2 + willo_spawn_y + WILLOWISP_TOP_OFFSET); + TreeWillOWisp *willowisp + = new TreeWillOWisp(this, pos, 200 + willo_radius, willo_speed); - Sector::current()->add_object(willowisp); - willowisps.push_back(willowisp); + Sector::current()->add_object(willowisp); + willowisps.push_back(willowisp); - willo_spawn_y -= 40; - if(willo_spawn_y < -160) - willo_spawn_y = 0; + willo_spawn_y -= 40; + if(willo_spawn_y < -160) + willo_spawn_y = 0; - willo_radius += 20; - if(willo_radius > 120) - willo_radius = 0; + willo_radius += 20; + if(willo_radius > 120) + willo_radius = 0; - if(willo_speed == 1.8f) { - willo_speed = 1.5f; - } else { - willo_speed = 1.8f; - } + if(willo_speed == 1.8f) { + willo_speed = 1.5f; + } else { + willo_speed = 1.8f; + } - do { - willo_color = (willo_color + 1) % 3; - } while(willo_color == treecolor); + do { + willo_color = (willo_color + 1) % 3; + } while(willo_color == treecolor); - switch(willo_color) { - case 0: willowisp->set_color(Color(1, 0, 0)); break; - case 1: willowisp->set_color(Color(0, 1, 0)); break; - case 2: willowisp->set_color(Color(0, 0, 1)); break; - case 3: willowisp->set_color(Color(1, 1, 0)); break; - case 4: willowisp->set_color(Color(1, 0, 1)); break; - case 5: willowisp->set_color(Color(0, 1, 1)); break; - default: assert(false); - } + switch(willo_color) { + case 0: willowisp->set_color(Color(1, 0, 0)); break; + case 1: willowisp->set_color(Color(0, 1, 0)); break; + case 2: willowisp->set_color(Color(0, 0, 1)); break; + case 3: willowisp->set_color(Color(1, 1, 0)); break; + case 4: willowisp->set_color(Color(1, 0, 1)); break; + case 5: willowisp->set_color(Color(0, 1, 1)); break; + default: assert(false); + } } } diff --git a/src/badguy/kamikazesnowball.cpp b/src/badguy/kamikazesnowball.cpp index ebfdc3613..17ba0c9d6 100644 --- a/src/badguy/kamikazesnowball.cpp +++ b/src/badguy/kamikazesnowball.cpp @@ -31,13 +31,13 @@ namespace{ } KamikazeSnowball::KamikazeSnowball(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/snowball/kamikaze-snowball.sprite") + : BadGuy(reader, "images/creatures/snowball/kamikaze-snowball.sprite") { sound_manager->preload(SPLAT_SOUND); } KamikazeSnowball::KamikazeSnowball(const Vector& pos, Direction d) - : BadGuy(pos, d, "images/creatures/snowball/kamikaze-snowball.sprite") + : BadGuy(pos, d, "images/creatures/snowball/kamikaze-snowball.sprite") { sound_manager->preload(SPLAT_SOUND); } diff --git a/src/badguy/mole.cpp b/src/badguy/mole.cpp index 96d585ff2..7f1bb7eb2 100644 --- a/src/badguy/mole.cpp +++ b/src/badguy/mole.cpp @@ -33,7 +33,7 @@ static const float THROW_INTERVAL = 1; /**< time between two thrown rocks */ static const float THROW_VELOCITY = 400; /**< initial velocity of thrown rocks */ Mole::Mole(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/mole/mole.sprite", LAYER_TILES-1), state(PRE_THROWING) + : BadGuy(reader, "images/creatures/mole/mole.sprite", LAYER_TILES-1), state(PRE_THROWING) { physic.enable_gravity(false); sound_manager->preload("sounds/fall.wav"); @@ -42,7 +42,7 @@ Mole::Mole(const lisp::Lisp& reader) } Mole::Mole(const Vector& pos) - : BadGuy(pos, "images/creatures/mole/mole.sprite", LAYER_TILES-1), state(PRE_THROWING) + : BadGuy(pos, "images/creatures/mole/mole.sprite", LAYER_TILES-1), state(PRE_THROWING) { physic.enable_gravity(false); sound_manager->preload("sounds/fall.wav"); @@ -110,26 +110,26 @@ Mole::active_update(float elapsed_time) switch (state) { case PRE_THROWING: if (timer.check()) { - set_state(THROWING); + set_state(THROWING); } break; case THROWING: if (throw_timer.check()) { throw_rock(); - throw_timer.start(THROW_INTERVAL); + throw_timer.start(THROW_INTERVAL); } if (timer.check()) { - set_state(POST_THROWING); + set_state(POST_THROWING); } break; case POST_THROWING: if (timer.check()) { - set_state(PEEKING); + set_state(PEEKING); } break; case PEEKING: if (sprite->animation_done()) { - set_state(PRE_THROWING); + set_state(PRE_THROWING); } break; case DEAD: diff --git a/src/badguy/mole_rock.cpp b/src/badguy/mole_rock.cpp index 14529c997..bf918706a 100644 --- a/src/badguy/mole_rock.cpp +++ b/src/badguy/mole_rock.cpp @@ -23,7 +23,7 @@ #include "mole_rock.hpp" MoleRock::MoleRock(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/mole/mole_rock.sprite", LAYER_TILES - 2), parent(0), initial_velocity(Vector(0, -400)) + : BadGuy(reader, "images/creatures/mole/mole_rock.sprite", LAYER_TILES - 2), parent(0), initial_velocity(Vector(0, -400)) { physic.enable_gravity(true); countMe = false; @@ -32,7 +32,7 @@ MoleRock::MoleRock(const lisp::Lisp& reader) } MoleRock::MoleRock(const Vector& pos, const Vector& velocity, const BadGuy* parent = 0) - : BadGuy(pos, LEFT, "images/creatures/mole/mole_rock.sprite", LAYER_TILES - 2), parent(parent), initial_velocity(velocity) + : BadGuy(pos, LEFT, "images/creatures/mole/mole_rock.sprite", LAYER_TILES - 2), parent(parent), initial_velocity(velocity) { physic.enable_gravity(true); countMe = false; @@ -41,7 +41,7 @@ MoleRock::MoleRock(const Vector& pos, const Vector& velocity, const BadGuy* pare } MoleRock::MoleRock(const MoleRock& other) - : BadGuy(other), parent(other.parent), initial_velocity(Vector(0, -400)) + : BadGuy(other), parent(other.parent), initial_velocity(Vector(0, -400)) { sound_manager->preload("sounds/fall.wav"); sound_manager->preload("sounds/stomp.wav"); diff --git a/src/badguy/mrbomb.cpp b/src/badguy/mrbomb.cpp index fca87666e..1ed824001 100644 --- a/src/badguy/mrbomb.cpp +++ b/src/badguy/mrbomb.cpp @@ -26,7 +26,7 @@ #include "audio/sound_manager.hpp" MrBomb::MrBomb(const lisp::Lisp& reader) - : WalkingBadguy(reader, "images/creatures/mr_bomb/mr_bomb.sprite", "left", "right") + : WalkingBadguy(reader, "images/creatures/mr_bomb/mr_bomb.sprite", "left", "right") { walk_speed = 80; max_drop_height = 16; @@ -49,7 +49,7 @@ MrBomb::MrBomb(const lisp::Lisp& reader) /* MrBomb created by a dispenser always gets default sprite atm.*/ MrBomb::MrBomb(const Vector& pos, Direction d) - : WalkingBadguy(pos, d, "images/creatures/mr_bomb/mr_bomb.sprite", "left", "right") + : WalkingBadguy(pos, d, "images/creatures/mr_bomb/mr_bomb.sprite", "left", "right") { walk_speed = 80; max_drop_height = 16; diff --git a/src/badguy/mriceblock.cpp b/src/badguy/mriceblock.cpp index 7ab283788..d224537b4 100644 --- a/src/badguy/mriceblock.cpp +++ b/src/badguy/mriceblock.cpp @@ -185,7 +185,7 @@ MrIceBlock::collision_squished(GameObject& object) case ICESTATE_KICKED: case ICESTATE_NORMAL: { - Player* player = dynamic_cast(&object); + Player* player = dynamic_cast(&object); squishcount++; if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) { kill_fall(); @@ -198,12 +198,12 @@ MrIceBlock::collision_squished(GameObject& object) break; case ICESTATE_FLAT: { - MovingObject* movingobject = dynamic_cast(&object); - if (movingobject && (movingobject->get_pos().x < get_pos().x)) { - dir = RIGHT; - } else { - dir = LEFT; - } + MovingObject* movingobject = dynamic_cast(&object); + if (movingobject && (movingobject->get_pos().x < get_pos().x)) { + dir = RIGHT; + } else { + dir = LEFT; + } } if (nokick_timer.check()) set_state(ICESTATE_KICKED); break; diff --git a/src/badguy/mrrocket.cpp b/src/badguy/mrrocket.cpp index 33c60201a..618616063 100644 --- a/src/badguy/mrrocket.cpp +++ b/src/badguy/mrrocket.cpp @@ -25,12 +25,12 @@ static const float SPEED = 200; MrRocket::MrRocket(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/mr_rocket/mr_rocket.sprite") + : BadGuy(reader, "images/creatures/mr_rocket/mr_rocket.sprite") { } MrRocket::MrRocket(const Vector& pos, Direction d) - : BadGuy(pos, d, "images/creatures/mr_rocket/mr_rocket.sprite") + : BadGuy(pos, d, "images/creatures/mr_rocket/mr_rocket.sprite") { } diff --git a/src/badguy/plant.cpp b/src/badguy/plant.cpp index 27db59bcd..cebc0c527 100644 --- a/src/badguy/plant.cpp +++ b/src/badguy/plant.cpp @@ -25,7 +25,7 @@ static const float WALKSPEED = 80; static const float WAKE_TIME = .5; Plant::Plant(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/plant/plant.sprite") + : BadGuy(reader, "images/creatures/plant/plant.sprite") { state = PLANT_SLEEPING; } diff --git a/src/badguy/poisonivy.cpp b/src/badguy/poisonivy.cpp index 67b4c7f06..4d1d75a27 100644 --- a/src/badguy/poisonivy.cpp +++ b/src/badguy/poisonivy.cpp @@ -24,13 +24,13 @@ #include "object/sprite_particle.hpp" PoisonIvy::PoisonIvy(const lisp::Lisp& reader) - : WalkingBadguy(reader, "images/creatures/poison_ivy/poison_ivy.sprite", "left", "right") + : WalkingBadguy(reader, "images/creatures/poison_ivy/poison_ivy.sprite", "left", "right") { walk_speed = 80; } PoisonIvy::PoisonIvy(const Vector& pos, Direction d) - : WalkingBadguy(pos, d, "images/creatures/poison_ivy/poison_ivy.sprite", "left", "right") + : WalkingBadguy(pos, d, "images/creatures/poison_ivy/poison_ivy.sprite", "left", "right") { walk_speed = 80; } diff --git a/src/badguy/skullyhop.cpp b/src/badguy/skullyhop.cpp index 3c1fe3e21..6de656eda 100644 --- a/src/badguy/skullyhop.cpp +++ b/src/badguy/skullyhop.cpp @@ -31,13 +31,13 @@ namespace { } SkullyHop::SkullyHop(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/skullyhop/skullyhop.sprite") + : BadGuy(reader, "images/creatures/skullyhop/skullyhop.sprite") { sound_manager->preload( HOP_SOUND ); } SkullyHop::SkullyHop(const Vector& pos, Direction d) - : BadGuy(pos, d, "images/creatures/skullyhop/skullyhop.sprite") + : BadGuy(pos, d, "images/creatures/skullyhop/skullyhop.sprite") { sound_manager->preload( HOP_SOUND ); } diff --git a/src/badguy/smartball.cpp b/src/badguy/smartball.cpp index aaf433bb4..b8be2b965 100644 --- a/src/badguy/smartball.cpp +++ b/src/badguy/smartball.cpp @@ -22,14 +22,14 @@ #include "smartball.hpp" SmartBall::SmartBall(const lisp::Lisp& reader) - : WalkingBadguy(reader, "images/creatures/snowball/smart-snowball.sprite", "left", "right") + : WalkingBadguy(reader, "images/creatures/snowball/smart-snowball.sprite", "left", "right") { walk_speed = 80; max_drop_height = 16; } SmartBall::SmartBall(const Vector& pos, Direction d) - : WalkingBadguy(pos, d, "images/creatures/snowball/smart-snowball.sprite", "left", "right") + : WalkingBadguy(pos, d, "images/creatures/snowball/smart-snowball.sprite", "left", "right") { walk_speed = 80; max_drop_height = 16; diff --git a/src/badguy/snail.cpp b/src/badguy/snail.cpp index 8533d7d95..528ed5923 100644 --- a/src/badguy/snail.cpp +++ b/src/badguy/snail.cpp @@ -115,19 +115,19 @@ Snail::active_update(float elapsed_time) case STATE_FLAT: if (flat_timer.started()) { - sprite->set_fps(64 - 15 * flat_timer.get_timegone()); + sprite->set_fps(64 - 15 * flat_timer.get_timegone()); } if (flat_timer.check()) { - be_normal(); + be_normal(); } BadGuy::active_update(elapsed_time); break; case STATE_KICKED_DELAY: if (kicked_delay_timer.check()) { - physic.set_velocity_x(dir == LEFT ? -KICKSPEED : KICKSPEED); - physic.set_velocity_y(KICKSPEED_Y); - state = STATE_KICKED; + physic.set_velocity_x(dir == LEFT ? -KICKSPEED : KICKSPEED); + physic.set_velocity_y(KICKSPEED_Y); + state = STATE_KICKED; } BadGuy::active_update(elapsed_time); break; @@ -152,33 +152,33 @@ Snail::collision_solid(const CollisionHit& hit) break; case STATE_FLAT: if(hit.top || hit.bottom) { - physic.set_velocity_y(0); + physic.set_velocity_y(0); } if(hit.left || hit.right) { } break; case STATE_KICKED_DELAY: if(hit.top || hit.bottom) { - physic.set_velocity_y(0); + physic.set_velocity_y(0); } if(hit.left || hit.right) { - physic.set_velocity_x(0); + physic.set_velocity_x(0); } break; case STATE_KICKED: if(hit.top || hit.bottom) { - physic.set_velocity_y(0); + physic.set_velocity_y(0); } if(hit.left || hit.right) { - sound_manager->play("sounds/iceblock_bump.wav", get_pos()); + sound_manager->play("sounds/iceblock_bump.wav", get_pos()); - if( ( dir == LEFT && hit.left ) || ( dir == RIGHT && hit.right) ){ - dir = (dir == LEFT) ? RIGHT : LEFT; - sprite->set_action(dir == LEFT ? "flat-left" : "flat-right"); + if( ( dir == LEFT && hit.left ) || ( dir == RIGHT && hit.right) ){ + dir = (dir == LEFT) ? RIGHT : LEFT; + sprite->set_action(dir == LEFT ? "flat-left" : "flat-right"); - physic.set_velocity_x(-physic.get_velocity_x()*0.75); - if (fabsf(physic.get_velocity_x()) < walk_speed) be_normal(); - } + physic.set_velocity_x(-physic.get_velocity_x()*0.75); + if (fabsf(physic.get_velocity_x()) < walk_speed) be_normal(); + } } break; @@ -213,7 +213,7 @@ Snail::collision_squished(GameObject& object) case STATE_KICKED: case STATE_NORMAL: { - Player* player = dynamic_cast(&object); + Player* player = dynamic_cast(&object); squishcount++; if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) { kill_fall(); @@ -228,12 +228,12 @@ Snail::collision_squished(GameObject& object) case STATE_FLAT: sound_manager->play("sounds/kick.wav", get_pos()); { - MovingObject* movingobject = dynamic_cast(&object); - if (movingobject && (movingobject->get_pos().x < get_pos().x)) { - dir = RIGHT; - } else { - dir = LEFT; - } + MovingObject* movingobject = dynamic_cast(&object); + if (movingobject && (movingobject->get_pos().x < get_pos().x)) { + dir = RIGHT; + } else { + dir = LEFT; + } } be_kicked(); break; diff --git a/src/badguy/spidermite.cpp b/src/badguy/spidermite.cpp index 8ea7e74eb..28b4a802a 100644 --- a/src/badguy/spidermite.cpp +++ b/src/badguy/spidermite.cpp @@ -26,13 +26,13 @@ static const float FLYTIME = 1.2f; static const float FLYSPEED = -100.0f; SpiderMite::SpiderMite(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/spidermite/spidermite.sprite") + : BadGuy(reader, "images/creatures/spidermite/spidermite.sprite") { physic.enable_gravity(false); } SpiderMite::SpiderMite(const Vector& pos) - : BadGuy(pos, "images/creatures/spidermite/spidermite.sprite") + : BadGuy(pos, "images/creatures/spidermite/spidermite.sprite") { physic.enable_gravity(false); } diff --git a/src/badguy/spiky.cpp b/src/badguy/spiky.cpp index eebf19a1d..d27cdfa34 100644 --- a/src/badguy/spiky.cpp +++ b/src/badguy/spiky.cpp @@ -22,7 +22,7 @@ #include "spiky.hpp" Spiky::Spiky(const lisp::Lisp& reader) - : WalkingBadguy(reader, "images/creatures/spiky/spiky.sprite", "left", "right") + : WalkingBadguy(reader, "images/creatures/spiky/spiky.sprite", "left", "right") { walk_speed = 80; max_drop_height = 600; diff --git a/src/badguy/sspiky.cpp b/src/badguy/sspiky.cpp index 68ebaaa24..3980b9cca 100644 --- a/src/badguy/sspiky.cpp +++ b/src/badguy/sspiky.cpp @@ -24,7 +24,7 @@ static const float WALKSPEED = 80; SSpiky::SSpiky(const lisp::Lisp& reader) - : WalkingBadguy(reader, "images/creatures/spiky/sleepingspiky.sprite", "left", "right"), state(SSPIKY_SLEEPING) + : WalkingBadguy(reader, "images/creatures/spiky/sleepingspiky.sprite", "left", "right"), state(SSPIKY_SLEEPING) { walk_speed = WALKSPEED; max_drop_height = -1; diff --git a/src/badguy/stalactite.cpp b/src/badguy/stalactite.cpp index 8dc7f846f..dad7103b4 100644 --- a/src/badguy/stalactite.cpp +++ b/src/badguy/stalactite.cpp @@ -28,7 +28,7 @@ static const float SQUISH_TIME = 2; static const float SHAKE_RANGE_Y = 400; Stalactite::Stalactite(const lisp::Lisp& lisp) - : BadGuy(lisp, "images/creatures/stalactite/stalactite.sprite", LAYER_TILES - 1), state(STALACTITE_HANGING) + : BadGuy(lisp, "images/creatures/stalactite/stalactite.sprite", LAYER_TILES - 1), state(STALACTITE_HANGING) { countMe = false; } @@ -51,7 +51,7 @@ Stalactite::active_update(float elapsed_time) if(player->get_bbox().p2.x > bbox.p1.x - SHAKE_RANGE_X && player->get_bbox().p1.x < bbox.p2.x + SHAKE_RANGE_X && player->get_bbox().p2.y > bbox.p1.y - && player->get_bbox().p1.y < bbox.p2.y + SHAKE_RANGE_Y) { + && player->get_bbox().p1.y < bbox.p2.y + SHAKE_RANGE_Y) { timer.start(SHAKE_TIME); state = STALACTITE_SHAKING; } diff --git a/src/badguy/stumpy.cpp b/src/badguy/stumpy.cpp index 2cac026a1..73dfc6b19 100644 --- a/src/badguy/stumpy.cpp +++ b/src/badguy/stumpy.cpp @@ -74,7 +74,7 @@ Stumpy::active_update(float elapsed_time) switch (mystate) { case STATE_INVINCIBLE: if (invincible_timer.check()) { - mystate = STATE_NORMAL; + mystate = STATE_NORMAL; WalkingBadguy::initialize(); } BadGuy::active_update(elapsed_time); @@ -149,10 +149,10 @@ Stumpy::collision_badguy(BadGuy& badguy, const CollisionHit& hit) switch (mystate) { case STATE_INVINCIBLE: if(hit.top || hit.bottom) { - physic.set_velocity_y(0); + physic.set_velocity_y(0); } if(hit.left || hit.right) { - physic.set_velocity_x(0); + physic.set_velocity_x(0); } return CONTINUE; break; diff --git a/src/badguy/toad.cpp b/src/badguy/toad.cpp index 3df4901f2..0f0582b14 100644 --- a/src/badguy/toad.cpp +++ b/src/badguy/toad.cpp @@ -30,13 +30,13 @@ namespace { } Toad::Toad(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/toad/toad.sprite") + : BadGuy(reader, "images/creatures/toad/toad.sprite") { sound_manager->preload(HOP_SOUND); } Toad::Toad(const Vector& pos, Direction d) - : BadGuy(pos, d, "images/creatures/toad/toad.sprite") + : BadGuy(pos, d, "images/creatures/toad/toad.sprite") { sound_manager->preload(HOP_SOUND); } diff --git a/src/badguy/totem.cpp b/src/badguy/totem.cpp index cd4d975b4..6cca78c78 100644 --- a/src/badguy/totem.cpp +++ b/src/badguy/totem.cpp @@ -29,7 +29,7 @@ static const float JUMP_OFF_SPEED_Y = -500; static const std::string LAND_ON_TOTEM_SOUND = "sounds/totem.ogg"; Totem::Totem(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/totem/totem.sprite") + : BadGuy(reader, "images/creatures/totem/totem.sprite") { carrying = 0; carried_by = 0; @@ -37,7 +37,7 @@ Totem::Totem(const lisp::Lisp& reader) } Totem::Totem(const Totem& other) - : BadGuy(other), carrying(other.carrying), carried_by(other.carried_by) + : BadGuy(other), carrying(other.carrying), carried_by(other.carried_by) { sound_manager->preload( LAND_ON_TOTEM_SOUND ); } @@ -103,27 +103,27 @@ Totem::active_update(float elapsed_time) if (s) { // jump a bit if we find a suitable totem for (std::vector::iterator i = s->moving_objects.begin(); i != s->moving_objects.end(); i++) { - Totem* t = dynamic_cast(*i); - if (!t) continue; + Totem* t = dynamic_cast(*i); + if (!t) continue; - // skip if we are not approaching each other - if (!((this->dir == LEFT) && (t->dir == RIGHT))) continue; + // skip if we are not approaching each other + if (!((this->dir == LEFT) && (t->dir == RIGHT))) continue; - Vector p1 = this->get_pos(); - Vector p2 = t->get_pos(); + Vector p1 = this->get_pos(); + Vector p2 = t->get_pos(); - // skip if not on same height - float dy = (p1.y - p2.y); - if (fabsf(dy - 0) > 2) continue; + // skip if not on same height + float dy = (p1.y - p2.y); + if (fabsf(dy - 0) > 2) continue; - // skip if too far away - float dx = (p1.x - p2.x); - if (fabsf(dx - 128) > 2) continue; + // skip if too far away + float dx = (p1.x - p2.x); + if (fabsf(dx - 128) > 2) continue; - physic.set_velocity_y(JUMP_ON_SPEED_Y); - p1.y -= 1; - this->set_pos(p1); - break; + physic.set_velocity_y(JUMP_ON_SPEED_Y); + p1.y -= 1; + this->set_pos(p1); + break; } } } diff --git a/src/badguy/walking_badguy.cpp b/src/badguy/walking_badguy.cpp index fe57032bf..3ac8aa583 100644 --- a/src/badguy/walking_badguy.cpp +++ b/src/badguy/walking_badguy.cpp @@ -24,17 +24,17 @@ #include "timer.hpp" WalkingBadguy::WalkingBadguy(const Vector& pos, const std::string& sprite_name, const std::string& walk_left_action, const std::string& walk_right_action, int layer) - : BadGuy(pos, sprite_name, layer), walk_left_action(walk_left_action), walk_right_action(walk_right_action), walk_speed(80), max_drop_height(-1) + : BadGuy(pos, sprite_name, layer), walk_left_action(walk_left_action), walk_right_action(walk_right_action), walk_speed(80), max_drop_height(-1) { } WalkingBadguy::WalkingBadguy(const Vector& pos, Direction direction, const std::string& sprite_name, const std::string& walk_left_action, const std::string& walk_right_action, int layer) - : BadGuy(pos, direction, sprite_name, layer), walk_left_action(walk_left_action), walk_right_action(walk_right_action), walk_speed(80), max_drop_height(-1) + : BadGuy(pos, direction, sprite_name, layer), walk_left_action(walk_left_action), walk_right_action(walk_right_action), walk_speed(80), max_drop_height(-1) { } WalkingBadguy::WalkingBadguy(const lisp::Lisp& reader, const std::string& sprite_name, const std::string& walk_left_action, const std::string& walk_right_action, int layer) - : BadGuy(reader, sprite_name, layer), walk_left_action(walk_left_action), walk_right_action(walk_right_action), walk_speed(80), max_drop_height(-1) + : BadGuy(reader, sprite_name, layer), walk_left_action(walk_left_action), walk_right_action(walk_right_action), walk_speed(80), max_drop_height(-1) { } diff --git a/src/badguy/walkingleaf.cpp b/src/badguy/walkingleaf.cpp index a05744111..c487e0cb3 100644 --- a/src/badguy/walkingleaf.cpp +++ b/src/badguy/walkingleaf.cpp @@ -24,14 +24,14 @@ #include "object/sprite_particle.hpp" WalkingLeaf::WalkingLeaf(const lisp::Lisp& reader) - : WalkingBadguy(reader, "images/creatures/walkingleaf/walkingleaf.sprite", "left", "right") + : WalkingBadguy(reader, "images/creatures/walkingleaf/walkingleaf.sprite", "left", "right") { walk_speed = 60; max_drop_height = 16; } WalkingLeaf::WalkingLeaf(const Vector& pos, Direction d) - : WalkingBadguy(pos, d, "images/creatures/walkingleaf/walkingleaf.sprite", "left", "right") + : WalkingBadguy(pos, d, "images/creatures/walkingleaf/walkingleaf.sprite", "left", "right") { walk_speed = 60; max_drop_height = 16; diff --git a/src/badguy/willowisp.cpp b/src/badguy/willowisp.cpp index b0fe7c62d..eafe2874c 100644 --- a/src/badguy/willowisp.cpp +++ b/src/badguy/willowisp.cpp @@ -251,7 +251,7 @@ WillOWisp::set_state(const std::string& new_state) } else { std::ostringstream msg; msg << "Can't set unknown willowisp state '" << new_state << "', should " - "be stopped, move_path, move_path_track or normal"; + "be stopped, move_path, move_path_track or normal"; throw new std::runtime_error(msg.str()); } } diff --git a/src/badguy/yeti.cpp b/src/badguy/yeti.cpp index 1c039068e..2eca07e2c 100644 --- a/src/badguy/yeti.cpp +++ b/src/badguy/yeti.cpp @@ -53,7 +53,7 @@ namespace { } Yeti::Yeti(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/yeti/yeti.sprite") + : BadGuy(reader, "images/creatures/yeti/yeti.sprite") { hit_points = INITIAL_HITPOINTS; countMe = false; @@ -290,28 +290,28 @@ Yeti::collision_solid(const CollisionHit& hit) physic.set_velocity_y(0); switch (state) { case JUMP_DOWN: - run(); - break; + run(); + break; case RUN: - break; + break; case JUMP_UP: - break; + break; case BE_ANGRY: - // we just landed - if(!state_timer.started()) { - sprite->set_action((dir==RIGHT)?"stand-right":"stand-left"); - stomp_count++; - drop_stalactite(); - - // go to other side after 3 jumps - if(stomp_count == 3) { - jump_down(); - } else { - // jump again - state_timer.start(STOMP_WAIT); - } - } - break; + // we just landed + if(!state_timer.started()) { + sprite->set_action((dir==RIGHT)?"stand-right":"stand-left"); + stomp_count++; + drop_stalactite(); + + // go to other side after 3 jumps + if(stomp_count == 3) { + jump_down(); + } else { + // jump again + state_timer.start(STOMP_WAIT); + } + } + break; case SQUISHED: break; } diff --git a/src/badguy/zeekling.cpp b/src/badguy/zeekling.cpp index ffea907c0..83c6adfae 100644 --- a/src/badguy/zeekling.cpp +++ b/src/badguy/zeekling.cpp @@ -26,7 +26,7 @@ #include "random_generator.hpp" Zeekling::Zeekling(const lisp::Lisp& reader) - : BadGuy(reader, "images/creatures/zeekling/zeekling.sprite"), last_player(0) + : BadGuy(reader, "images/creatures/zeekling/zeekling.sprite"), last_player(0) { state = FLYING; speed = systemRandom.rand(130, 171); @@ -34,7 +34,7 @@ Zeekling::Zeekling(const lisp::Lisp& reader) } Zeekling::Zeekling(const Vector& pos, Direction d) - : BadGuy(pos, d, "images/creatures/zeekling/zeekling.sprite"), last_player(0) + : BadGuy(pos, d, "images/creatures/zeekling/zeekling.sprite"), last_player(0) { state = FLYING; speed = systemRandom.rand(130, 171); diff --git a/src/console.cpp b/src/console.cpp index 28ea36ce7..fb1f5f382 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -233,7 +233,7 @@ sq_insert_command(std::list& cmds, HSQUIRRELVM vm, std::string tabl key_string+="."; if (search_prefix.substr(0, key_string.length()) == key_string) { sq_getclass(vm, -1); - sq_insert_commands(cmds, vm, key_string, search_prefix); + sq_insert_commands(cmds, vm, key_string, search_prefix); sq_pop(vm, 1); } break; @@ -241,7 +241,7 @@ sq_insert_command(std::list& cmds, HSQUIRRELVM vm, std::string tabl case OT_CLASS: key_string+="."; if (search_prefix.substr(0, key_string.length()) == key_string) { - sq_insert_commands(cmds, vm, key_string, search_prefix); + sq_insert_commands(cmds, vm, key_string, search_prefix); } break; case OT_CLOSURE: diff --git a/src/control/joystickkeyboardcontroller.cpp b/src/control/joystickkeyboardcontroller.cpp index 3a0b7dadd..e3bba1be2 100644 --- a/src/control/joystickkeyboardcontroller.cpp +++ b/src/control/joystickkeyboardcontroller.cpp @@ -567,7 +567,7 @@ JoystickKeyboardController::process_console_key_event(const SDL_Event& event) default: int c = event.key.keysym.unicode; if ((c >= 32) && (c <= 126)) { - Console::instance->input((char)c); + Console::instance->input((char)c); } break; } diff --git a/src/game_session.cpp b/src/game_session.cpp index 26f65f1c4..ecf7f9275 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -476,7 +476,7 @@ GameSession::setup() current_ = this; if(currentsector != Sector::current()) { - currentsector->activate(currentsector->player->get_pos()); + currentsector->activate(currentsector->player->get_pos()); } currentsector->play_music(LEVEL_MUSIC); @@ -605,7 +605,7 @@ GameSession::start_sequence(const std::string& sequencename) // abort if a sequence is already playing if (end_sequence) - return; + return; if (sequencename == "endsequence") { if (currentsector->get_players()[0]->physic.get_velocity_x() < 0) { @@ -631,7 +631,7 @@ GameSession::start_sequence(const std::string& sequencename) // Stop all clocks. for(std::vector::iterator i = currentsector->gameobjects.begin(); - i != currentsector->gameobjects.end(); ++i) + i != currentsector->gameobjects.end(); ++i) { GameObject* obj = *i; diff --git a/src/gui/button.cpp b/src/gui/button.cpp index 6b16a130d..b41b1cb17 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -94,7 +94,7 @@ switch(event.type) state = BT_SELECTED; } break; - case SDL_KEYDOWN: // key pressed + case SDL_KEYDOWN: // key pressed if(event.key.keysym.sym == binding) state = BT_SELECTED; break; diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index 5338ba81d..6d6c2f6a8 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -310,11 +310,11 @@ Menu::add_label(const std::string& text) MenuItem* Menu::add_controlfield(int id, const std::string& text, - const std::string& mapping) + const std::string& mapping) { MenuItem* item = new MenuItem(MN_CONTROLFIELD, id); item->change_text(text); - item->change_input(mapping); + item->change_input(mapping); additem(item); return item; } @@ -561,7 +561,7 @@ Menu::update() { int i = items[active_item]->input.size(); - while(delete_character > 0) /* remove characters */ + while(delete_character > 0) /* remove characters */ { items[active_item]->input.resize(i-1); delete_character--; diff --git a/src/lisp/parser.cpp b/src/lisp/parser.cpp index a558adc1a..4f7697c42 100644 --- a/src/lisp/parser.cpp +++ b/src/lisp/parser.cpp @@ -107,7 +107,7 @@ Parser::parse_error(const char* msg) const { std::stringstream emsg; emsg << "Parse Error at '" << filename << "' line " << lexer->getLineNumber() - << ": " << msg; + << ": " << msg; throw std::runtime_error(emsg.str()); } @@ -117,7 +117,7 @@ Parser::read() Lisp* result; switch(token) { case Lexer::TOKEN_EOF: { - parse_error("Unexpected EOF."); + parse_error("Unexpected EOF."); } case Lexer::TOKEN_CLOSE_PAREN: { parse_error("Unexpected ')'."); @@ -137,7 +137,7 @@ Parser::read() // evaluate translation function (_ str) in place here token = lexer->getNextToken(); if(token != Lexer::TOKEN_STRING) - parse_error("Expected string after '(_'"); + parse_error("Expected string after '(_'"); result = new(obst) Lisp(Lisp::TYPE_STRING); if(dictionary) { @@ -151,7 +151,7 @@ Parser::read() } token = lexer->getNextToken(); if(token != Lexer::TOKEN_CLOSE_PAREN) - parse_error("Expected ')' after '(_ string'"); + parse_error("Expected ')' after '(_ string'"); break; } diff --git a/src/object/ambient_sound.cpp b/src/object/ambient_sound.cpp index d1169d287..8837f91d1 100644 --- a/src/object/ambient_sound.cpp +++ b/src/object/ambient_sound.cpp @@ -77,7 +77,7 @@ AmbientSound::AmbientSound(const lisp::Lisp& lisp) // set default silence_distance if (distance_factor == 0) - silence_distance = std::numeric_limits::max(); + silence_distance = std::numeric_limits::max(); else silence_distance = 1/distance_factor; @@ -104,7 +104,7 @@ AmbientSound::AmbientSound(Vector pos, float factor, float bias, float vol, std: // set default silence_distance if (distance_factor == 0) - silence_distance = std::numeric_limits::max(); + silence_distance = std::numeric_limits::max(); else silence_distance = 1/distance_factor; @@ -188,15 +188,15 @@ AmbientSound::update(float deltat) sound_source->set_gain(currentvolume*maximumvolume); if (sqrdistance>=silence_distance && currentvolume<1e-3) - stop_playing(); + stop_playing(); latency=0; } else { if (sqrdistancecenter), radius(master->radius), angle(master->angle + M_PI), angular_speed(0), momentum(0) + : MovingSprite(*master), + master(master), slave(this), center(master->center), radius(master->radius), angle(master->angle + M_PI), angular_speed(0), momentum(0) { set_pos(get_pos() + Vector(master->get_bbox().get_width(), 0)); master->master = master; diff --git a/src/object/candle.cpp b/src/object/candle.cpp index 98c48c195..614c42b04 100644 --- a/src/object/candle.cpp +++ b/src/object/candle.cpp @@ -28,9 +28,9 @@ #include "random_generator.hpp" Candle::Candle(const lisp::Lisp& lisp) - : MovingSprite(lisp, "images/objects/candle/candle.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_DISABLED), burning(true), - candle_light_1("images/objects/candle/candle-light-1.png"), - candle_light_2("images/objects/candle/candle-light-2.png") + : MovingSprite(lisp, "images/objects/candle/candle.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_DISABLED), burning(true), + candle_light_1("images/objects/candle/candle-light-1.png"), + candle_light_2("images/objects/candle/candle-light-2.png") { lisp.get("name", name); lisp.get("burning", burning); diff --git a/src/object/coin.cpp b/src/object/coin.cpp index c75312fb9..dd9c0bfe7 100644 --- a/src/object/coin.cpp +++ b/src/object/coin.cpp @@ -36,13 +36,13 @@ #include "timer.hpp" Coin::Coin(const Vector& pos) - : MovingSprite(pos, "images/objects/coin/coin.sprite", LAYER_TILES, COLGROUP_TOUCHABLE) + : MovingSprite(pos, "images/objects/coin/coin.sprite", LAYER_TILES, COLGROUP_TOUCHABLE) { sound_manager->preload("sounds/coin.wav"); } Coin::Coin(const lisp::Lisp& reader) - : MovingSprite(reader, "images/objects/coin/coin.sprite", LAYER_TILES, COLGROUP_TOUCHABLE) + : MovingSprite(reader, "images/objects/coin/coin.sprite", LAYER_TILES, COLGROUP_TOUCHABLE) { sound_manager->preload("sounds/coin.wav"); } @@ -71,44 +71,44 @@ Coin::collect() { switch ((pitch_one - tile) % 7) { case -6: - pitch = 1.0/2; - break; + pitch = 1.0/2; + break; case -5: - pitch = 5.0/8; - break; + pitch = 5.0/8; + break; case -4: - pitch = 4.0/6; - break; + pitch = 4.0/6; + break; case -3: - pitch = 3.0/4; - break; + pitch = 3.0/4; + break; case -2: - pitch = 5.0/6; - break; + pitch = 5.0/6; + break; case -1: - pitch = 9.0/10; - break; + pitch = 9.0/10; + break; case 0: - pitch = 1.0; - break; + pitch = 1.0; + break; case 1: - pitch = 9.0/8; - break; + pitch = 9.0/8; + break; case 2: - pitch = 5.0/4; - break; + pitch = 5.0/4; + break; case 3: - pitch = 4.0/3; - break; + pitch = 4.0/3; + break; case 4: - pitch = 3.0/2; - break; + pitch = 3.0/2; + break; case 5: - pitch = 5.0/3; - break; + pitch = 5.0/3; + break; case 6: - pitch = 9.0/5; - break; + pitch = 9.0/5; + break; } last_pitch = pitch; } diff --git a/src/object/explosion.cpp b/src/object/explosion.cpp index e840e9346..82866639a 100644 --- a/src/object/explosion.cpp +++ b/src/object/explosion.cpp @@ -25,14 +25,14 @@ #include "random_generator.hpp" Explosion::Explosion(const Vector& pos) - : MovingSprite(pos, "images/objects/explosion/explosion.sprite", LAYER_OBJECTS+40, COLGROUP_TOUCHABLE), state(STATE_WAITING) + : MovingSprite(pos, "images/objects/explosion/explosion.sprite", LAYER_OBJECTS+40, COLGROUP_TOUCHABLE), state(STATE_WAITING) { sound_manager->preload("sounds/explosion.wav"); set_pos(get_pos() - (get_bbox().get_middle() - get_pos())); } Explosion::Explosion(const lisp::Lisp& reader) - : MovingSprite(reader, "images/objects/explosion/explosion.sprite", LAYER_OBJECTS+40, COLGROUP_TOUCHABLE), state(STATE_WAITING) + : MovingSprite(reader, "images/objects/explosion/explosion.sprite", LAYER_OBJECTS+40, COLGROUP_TOUCHABLE), state(STATE_WAITING) { sound_manager->preload("sounds/explosion.wav"); } @@ -73,7 +73,7 @@ Explosion::update(float ) break; case STATE_EXPLODING: if(sprite->animation_done()) { - remove_me(); + remove_me(); } break; } diff --git a/src/object/firefly.cpp b/src/object/firefly.cpp index bd4f70a15..8dd4fe4d5 100644 --- a/src/object/firefly.cpp +++ b/src/object/firefly.cpp @@ -82,16 +82,16 @@ Firefly::collision(GameObject& other, const CollisionHit& ) activated = true; // spawn some particles // TODO: provide convenience function in MovingSprite or MovingObject? - for (int i = 0; i < 5; i++) { - Vector ppos = bbox.get_middle(); - float angle = systemRandom.randf(-M_PI_2, M_PI_2); - float velocity = systemRandom.randf(450, 900); - float vx = sin(angle)*velocity; - float vy = -cos(angle)*velocity; - Vector pspeed = Vector(vx, vy); - Vector paccel = Vector(0, 1000); - Sector::current()->add_object(new SpriteParticle("images/objects/particles/reset.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS-1)); - } + for (int i = 0; i < 5; i++) { + Vector ppos = bbox.get_middle(); + float angle = systemRandom.randf(-M_PI_2, M_PI_2); + float velocity = systemRandom.randf(450, 900); + float vx = sin(angle)*velocity; + float vy = -cos(angle)*velocity; + Vector pspeed = Vector(vx, vy); + Vector paccel = Vector(0, 1000); + Sector::current()->add_object(new SpriteParticle("images/objects/particles/reset.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS-1)); + } // TODO play sound sprite->set_action("ringing"); GameSession::current()->set_reset_point(Sector::current()->get_name(), diff --git a/src/object/growup.cpp b/src/object/growup.cpp index 1031a8361..d422c2a10 100644 --- a/src/object/growup.cpp +++ b/src/object/growup.cpp @@ -28,7 +28,7 @@ #include "audio/sound_manager.hpp" GrowUp::GrowUp(Direction direction) - : MovingSprite(Vector(0,0), "images/powerups/egg/egg.sprite", LAYER_OBJECTS, COLGROUP_MOVING) + : MovingSprite(Vector(0,0), "images/powerups/egg/egg.sprite", LAYER_OBJECTS, COLGROUP_MOVING) { physic.enable_gravity(true); physic.set_velocity_x((direction == LEFT)?-100:100); diff --git a/src/object/hurting_platform.cpp b/src/object/hurting_platform.cpp index 2c0a010c3..f03890c50 100644 --- a/src/object/hurting_platform.cpp +++ b/src/object/hurting_platform.cpp @@ -28,7 +28,7 @@ #include "object_factory.hpp" HurtingPlatform::HurtingPlatform(const lisp::Lisp& reader) - : Platform(reader) + : Platform(reader) { set_group(COLGROUP_TOUCHABLE); } diff --git a/src/object/icecrusher.cpp b/src/object/icecrusher.cpp index 421cef0e6..ffec5cf8a 100644 --- a/src/object/icecrusher.cpp +++ b/src/object/icecrusher.cpp @@ -38,16 +38,16 @@ namespace { } IceCrusher::IceCrusher(const lisp::Lisp& reader) - : MovingSprite(reader, "images/creatures/icecrusher/icecrusher.sprite", LAYER_OBJECTS, COLGROUP_STATIC), - state(IDLE), speed(Vector(0,0)) + : MovingSprite(reader, "images/creatures/icecrusher/icecrusher.sprite", LAYER_OBJECTS, COLGROUP_STATIC), + state(IDLE), speed(Vector(0,0)) { start_position = get_bbox().p1; set_state(state, true); } IceCrusher::IceCrusher(const IceCrusher& other) - : MovingSprite(other), - state(other.state), speed(other.speed) + : MovingSprite(other), + state(other.state), speed(other.speed) { start_position = get_bbox().p1; set_state(state, true); diff --git a/src/object/invisible_wall.cpp b/src/object/invisible_wall.cpp index 4416b23aa..83f9f6942 100644 --- a/src/object/invisible_wall.cpp +++ b/src/object/invisible_wall.cpp @@ -25,11 +25,11 @@ #include "sprite/sprite.hpp" InvisibleWall::InvisibleWall(const lisp::Lisp& lisp) - : MovingSprite(lisp, "images/objects/invisible/invisible.sprite", LAYER_TILES, COLGROUP_STATIC), width(32), height(32) + : MovingSprite(lisp, "images/objects/invisible/invisible.sprite", LAYER_TILES, COLGROUP_STATIC), width(32), height(32) { - lisp.get("width", width); - lisp.get("height", height); - bbox.set_size(width, height); + lisp.get("width", width); + lisp.get("height", height); + bbox.set_size(width, height); } HitResponse diff --git a/src/object/ispy.cpp b/src/object/ispy.cpp index fb268423d..09a7367a0 100644 --- a/src/object/ispy.cpp +++ b/src/object/ispy.cpp @@ -143,10 +143,10 @@ Ispy::free_line_of_sight(Vector line_start, Vector line_end, const MovingObject* for (float test_y = lsy; test_y <= ley; test_y += 16) { for(std::list::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; + const Tile* tile = solids->get_tile_at(Vector(test_x, test_y)); + if(!tile) continue; // FIXME: check collision with slope tiles - if((tile->getAttributes() & Tile::SOLID)) return false; + if((tile->getAttributes() & Tile::SOLID)) return false; } } } diff --git a/src/object/magicblock.cpp b/src/object/magicblock.cpp index 734186f88..99135de94 100644 --- a/src/object/magicblock.cpp +++ b/src/object/magicblock.cpp @@ -42,7 +42,7 @@ namespace { } MagicBlock::MagicBlock(const lisp::Lisp& lisp) - : MovingSprite(lisp, "images/objects/magicblock/magicblock.sprite"), + : MovingSprite(lisp, "images/objects/magicblock/magicblock.sprite"), is_solid(false), solid_time(0), switch_delay(0), light(1.0f,1.0f,1.0f) { set_group(COLGROUP_STATIC); diff --git a/src/object/moving_sprite.cpp b/src/object/moving_sprite.cpp index 0c746a5bd..56cf4202d 100644 --- a/src/object/moving_sprite.cpp +++ b/src/object/moving_sprite.cpp @@ -36,7 +36,7 @@ #include "timer.hpp" MovingSprite::MovingSprite(const Vector& pos, const std::string& sprite_name, int layer, CollisionGroup collision_group) - : sprite_name(sprite_name), layer(layer) + : sprite_name(sprite_name), layer(layer) { bbox.set_pos(pos); sprite = sprite_manager->create(sprite_name); @@ -45,7 +45,7 @@ MovingSprite::MovingSprite(const Vector& pos, const std::string& sprite_name, in } MovingSprite::MovingSprite(const lisp::Lisp& reader, const Vector& pos, int layer, CollisionGroup collision_group) - : layer(layer) + : layer(layer) { bbox.set_pos(pos); if (!reader.get("sprite", sprite_name)) @@ -57,7 +57,7 @@ MovingSprite::MovingSprite(const lisp::Lisp& reader, const Vector& pos, int laye } MovingSprite::MovingSprite(const lisp::Lisp& reader, const std::string& sprite_name, int layer, CollisionGroup collision_group) - : sprite_name(sprite_name), layer(layer) + : sprite_name(sprite_name), layer(layer) { if (!reader.get("x", bbox.p1.x)) throw std::runtime_error("no x position set"); @@ -70,7 +70,7 @@ MovingSprite::MovingSprite(const lisp::Lisp& reader, const std::string& sprite_n } MovingSprite::MovingSprite(const lisp::Lisp& reader, int layer, CollisionGroup collision_group) - : layer(layer) + : layer(layer) { if (!reader.get("x", bbox.p1.x)) throw std::runtime_error("no x position set"); @@ -85,7 +85,7 @@ MovingSprite::MovingSprite(const lisp::Lisp& reader, int layer, CollisionGroup c } MovingSprite::MovingSprite(const MovingSprite& other) - : MovingObject(other), layer(other.layer) + : MovingObject(other), layer(other.layer) { sprite = new Sprite(*other.sprite); } diff --git a/src/object/oneup.cpp b/src/object/oneup.cpp index 322cb23a2..a0dc07104 100644 --- a/src/object/oneup.cpp +++ b/src/object/oneup.cpp @@ -29,7 +29,7 @@ #include "video/drawing_context.hpp" OneUp::OneUp(const Vector& pos, Direction direction) - : MovingSprite(pos, "images/powerups/1up/1up.sprite", LAYER_FLOATINGOBJECTS, COLGROUP_TOUCHABLE) + : MovingSprite(pos, "images/powerups/1up/1up.sprite", LAYER_FLOATINGOBJECTS, COLGROUP_TOUCHABLE) { physic.set_velocity((direction == LEFT)?-100:100, -400); } diff --git a/src/object/particlesystem.cpp b/src/object/particlesystem.cpp index 1c446b141..fa435be83 100644 --- a/src/object/particlesystem.cpp +++ b/src/object/particlesystem.cpp @@ -33,7 +33,7 @@ #include "random_generator.hpp" ParticleSystem::ParticleSystem(float max_particle_size) - : max_particle_size(max_particle_size) + : max_particle_size(max_particle_size) { virtual_width = SCREEN_WIDTH + max_particle_size * 2; virtual_height = SCREEN_HEIGHT + max_particle_size *2; @@ -203,7 +203,7 @@ void GhostParticleSystem::update(float elapsed_time) } CloudParticleSystem::CloudParticleSystem() - : ParticleSystem(128) + : ParticleSystem(128) { cloudimage = new Surface("images/objects/particles/cloud.png"); diff --git a/src/object/particlesystem.hpp b/src/object/particlesystem.hpp index b3f49a5ad..d49506245 100644 --- a/src/object/particlesystem.hpp +++ b/src/object/particlesystem.hpp @@ -94,9 +94,9 @@ private: { public: float speed; - float wobble; - float anchorx; - float drift_speed; + float wobble; + float anchorx; + float drift_speed; }; Surface* snowimages[3]; diff --git a/src/object/particlesystem_interactive.cpp b/src/object/particlesystem_interactive.cpp index 2d4a3c2ee..de9038aba 100644 --- a/src/object/particlesystem_interactive.cpp +++ b/src/object/particlesystem_interactive.cpp @@ -99,31 +99,31 @@ ParticleSystem_Interactive::collision(Particle* object, Vector movement) TileMap* solids = *i; for(int x = starttilex; x*32 < max_x; ++x) { for(int y = starttiley; y*32 < max_y; ++y) { - const Tile* tile = solids->get_tile(x, y); - if(!tile) - continue; - // skip non-solid tiles, except water - if(! (tile->getAttributes() & (Tile::WATER | Tile::SOLID))) - continue; - - if(tile->getAttributes() & Tile::SLOPE) { // slope tile - AATriangle triangle; - Vector p1(x*32, y*32); - Vector p2((x+1)*32, (y+1)*32); - triangle = AATriangle(p1, p2, tile->getData()); - - if(rectangle_aatriangle(&constraints, dest, triangle)) { - if(tile->getAttributes() & Tile::WATER) - water = true; - } - } else { // normal rectangular tile - Rect rect(x*32, y*32, (x+1)*32, (y+1)*32); - if(intersects(dest, rect)) { - if(tile->getAttributes() & Tile::WATER) - water = true; - set_rectangle_rectangle_constraints(&constraints, dest, rect); - } - } + const Tile* tile = solids->get_tile(x, y); + if(!tile) + continue; + // skip non-solid tiles, except water + if(! (tile->getAttributes() & (Tile::WATER | Tile::SOLID))) + continue; + + if(tile->getAttributes() & Tile::SLOPE) { // slope tile + AATriangle triangle; + Vector p1(x*32, y*32); + Vector p2((x+1)*32, (y+1)*32); + triangle = AATriangle(p1, p2, tile->getData()); + + if(rectangle_aatriangle(&constraints, dest, triangle)) { + if(tile->getAttributes() & Tile::WATER) + water = true; + } + } else { // normal rectangular tile + Rect rect(x*32, y*32, (x+1)*32, (y+1)*32); + if(intersects(dest, rect)) { + if(tile->getAttributes() & Tile::WATER) + water = true; + set_rectangle_rectangle_constraints(&constraints, dest, rect); + } + } } } } diff --git a/src/object/platform.cpp b/src/object/platform.cpp index c6a2da656..4151cc541 100644 --- a/src/object/platform.cpp +++ b/src/object/platform.cpp @@ -36,9 +36,9 @@ #include "sector.hpp" Platform::Platform(const lisp::Lisp& reader) - : MovingSprite(reader, Vector(0,0), LAYER_OBJECTS, COLGROUP_STATIC), - speed(Vector(0,0)), - automatic(false), player_contact(false), last_player_contact(false) + : MovingSprite(reader, Vector(0,0), LAYER_OBJECTS, COLGROUP_STATIC), + speed(Vector(0,0)), + automatic(false), player_contact(false), last_player_contact(false) { bool running = true; reader.get("name", name); @@ -54,9 +54,9 @@ Platform::Platform(const lisp::Lisp& reader) } Platform::Platform(const Platform& other) - : MovingSprite(other), ScriptInterface(other), - speed(other.speed), - automatic(other.automatic), player_contact(false), last_player_contact(false) + : MovingSprite(other), ScriptInterface(other), + speed(other.speed), + automatic(other.automatic), player_contact(false), last_player_contact(false) { name = other.name; path.reset(new Path(*other.path)); @@ -85,13 +85,13 @@ Platform::update(float elapsed_time) Player* player = 0; std::vector players = Sector::current()->get_players(); for (std::vector::iterator playerIter = players.begin(); playerIter != players.end(); ++playerIter) { - player = *playerIter; + player = *playerIter; } if (player) { - int nearest_node_id = path->get_nearest_node_no(player->get_bbox().p2); - if (nearest_node_id != -1) { - goto_node(nearest_node_id); - } + int nearest_node_id = path->get_nearest_node_no(player->get_bbox().p2); + if (nearest_node_id != -1) { + goto_node(nearest_node_id); + } } } @@ -101,7 +101,7 @@ Platform::update(float elapsed_time) // Travel to node farthest from current position int farthest_node_id = path->get_farthest_node_no(get_pos()); if (farthest_node_id != -1) { - goto_node(farthest_node_id); + goto_node(farthest_node_id); } } diff --git a/src/object/player.cpp b/src/object/player.cpp index 7d9a572b3..63770ef80 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -345,12 +345,12 @@ Player::update(float elapsed_time) Vector paccel = Vector(0, 0); // draw bright sparkle when there is lots of time left, dark sparkle when invincibility is about to end if (invincible_timer.get_timeleft() > TUX_INVINCIBLE_TIME_WARNING) { - // make every other a longer sparkle to make trail a bit fuzzy - if (size_t(game_time*20)%2) { - Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "small", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5)); - } else { - Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "medium", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5)); - } + // make every other a longer sparkle to make trail a bit fuzzy + if (size_t(game_time*20)%2) { + Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "small", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5)); + } else { + Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "medium", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5)); + } } else { Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "dark", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5)); } diff --git a/src/object/pneumatic_platform.cpp b/src/object/pneumatic_platform.cpp index 79d319845..f50814f4e 100644 --- a/src/object/pneumatic_platform.cpp +++ b/src/object/pneumatic_platform.cpp @@ -35,15 +35,15 @@ #include "object/portable.hpp" PneumaticPlatform::PneumaticPlatform(const lisp::Lisp& reader) - : MovingSprite(reader, LAYER_OBJECTS, COLGROUP_STATIC), - master(0), slave(0), start_y(0), offset_y(0), speed_y(0) + : MovingSprite(reader, LAYER_OBJECTS, COLGROUP_STATIC), + master(0), slave(0), start_y(0), offset_y(0), speed_y(0) { start_y = get_pos().y; } PneumaticPlatform::PneumaticPlatform(PneumaticPlatform* master) - : MovingSprite(*master), - master(master), slave(this), start_y(master->start_y), offset_y(-master->offset_y), speed_y(0) + : MovingSprite(*master), + master(master), slave(this), start_y(master->start_y), offset_y(-master->offset_y), speed_y(0) { set_pos(get_pos() + Vector(master->get_bbox().get_width(), 0)); master->master = master; diff --git a/src/object/pulsing_light.cpp b/src/object/pulsing_light.cpp index c5d5872b2..b40427351 100644 --- a/src/object/pulsing_light.cpp +++ b/src/object/pulsing_light.cpp @@ -25,7 +25,7 @@ #include "random_generator.hpp" PulsingLight::PulsingLight(const Vector& center, float cycle_len, float min_alpha, float max_alpha, const Color& color) - : Light(center, color), min_alpha(min_alpha), max_alpha(max_alpha), cycle_len(cycle_len), t(0) + : Light(center, color), min_alpha(min_alpha), max_alpha(max_alpha), cycle_len(cycle_len), t(0) { assert(cycle_len > 0); diff --git a/src/object/pushbutton.cpp b/src/object/pushbutton.cpp index 30e364c40..0f1256c4b 100644 --- a/src/object/pushbutton.cpp +++ b/src/object/pushbutton.cpp @@ -34,7 +34,7 @@ namespace { } PushButton::PushButton(const lisp::Lisp& lisp) - : MovingSprite(lisp, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING), state(OFF) + : MovingSprite(lisp, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING), state(OFF) { sound_manager->preload(BUTTON_SOUND); set_action("off", -1); diff --git a/src/object/skull_tile.cpp b/src/object/skull_tile.cpp index ef2ead930..7721a5b64 100644 --- a/src/object/skull_tile.cpp +++ b/src/object/skull_tile.cpp @@ -32,7 +32,7 @@ static const float CRACKTIME = 0.3f; static const float FALLTIME = 0.8f; SkullTile::SkullTile(const lisp::Lisp& lisp) - : MovingSprite(lisp, "images/objects/skull_tile/skull_tile.sprite", LAYER_TILES, COLGROUP_STATIC), hit(false), falling(false) + : MovingSprite(lisp, "images/objects/skull_tile/skull_tile.sprite", LAYER_TILES, COLGROUP_STATIC), hit(false), falling(false) { } diff --git a/src/object/sprite_particle.cpp b/src/object/sprite_particle.cpp index e914c0ce2..f5434fdac 100644 --- a/src/object/sprite_particle.cpp +++ b/src/object/sprite_particle.cpp @@ -27,7 +27,7 @@ #include "log.hpp" SpriteParticle::SpriteParticle(std::string sprite_name, std::string action, Vector position, AnchorPoint anchor, Vector velocity, Vector acceleration, int drawing_layer) - : position(position), velocity(velocity), acceleration(acceleration), drawing_layer(drawing_layer) + : position(position), velocity(velocity), acceleration(acceleration), drawing_layer(drawing_layer) { sprite = sprite_manager->create(sprite_name); if (!sprite) throw std::runtime_error("Could not load sprite "+sprite_name); diff --git a/src/object/star.cpp b/src/object/star.cpp index 316f572d3..0af8d6f6a 100644 --- a/src/object/star.cpp +++ b/src/object/star.cpp @@ -31,7 +31,7 @@ static const float SPEED = 150; static const float JUMPSPEED = -300; Star::Star(const Vector& pos, Direction direction) - : MovingSprite(pos, "images/powerups/star/star.sprite", LAYER_OBJECTS, COLGROUP_MOVING) + : MovingSprite(pos, "images/powerups/star/star.sprite", LAYER_OBJECTS, COLGROUP_MOVING) { physic.set_velocity((direction == LEFT) ? -SPEED : SPEED, INITIALJUMP); } diff --git a/src/object/thunderstorm.cpp b/src/object/thunderstorm.cpp index 656bd0a14..f896f25b6 100644 --- a/src/object/thunderstorm.cpp +++ b/src/object/thunderstorm.cpp @@ -37,8 +37,8 @@ #include "log.hpp" namespace { - const float LIGHTNING_DELAY = 2.0f; - const float FLASH_DISPLAY_TIME = 0.1f; + const float LIGHTNING_DELAY = 2.0f; + const float FLASH_DISPLAY_TIME = 0.1f; } Thunderstorm::Thunderstorm(const lisp::Lisp& reader) diff --git a/src/object/trampoline.cpp b/src/object/trampoline.cpp index 4871cf639..8291072a3 100644 --- a/src/object/trampoline.cpp +++ b/src/object/trampoline.cpp @@ -35,7 +35,7 @@ namespace { } Trampoline::Trampoline(const lisp::Lisp& lisp) - : Rock(lisp, "images/objects/trampoline/trampoline.sprite") + : Rock(lisp, "images/objects/trampoline/trampoline.sprite") { sound_manager->preload(TRAMPOLINE_SOUND); @@ -73,15 +73,15 @@ Trampoline::collision(GameObject& other, const CollisionHit& hit) float vy = player->physic.get_velocity_y(); //player is falling down on trampoline if(hit.top && vy >= 0) { - if(player->get_controller()->hold(Controller::JUMP)) { - vy = VY_MIN; - } else { - vy = VY_INITIAL; - } - player->physic.set_velocity_y(vy); - sound_manager->play(TRAMPOLINE_SOUND); - sprite->set_action("swinging", 1); - return FORCE_MOVE; + if(player->get_controller()->hold(Controller::JUMP)) { + vy = VY_MIN; + } else { + vy = VY_INITIAL; + } + player->physic.set_velocity_y(vy); + sound_manager->play(TRAMPOLINE_SOUND); + sprite->set_action("swinging", 1); + return FORCE_MOVE; } } WalkingBadguy* walking_badguy = dynamic_cast (&other); @@ -90,11 +90,11 @@ Trampoline::collision(GameObject& other, const CollisionHit& hit) float vy = walking_badguy->get_velocity_y(); //walking_badguy is falling down on trampoline if(hit.top && vy >= 0) { - vy = VY_INITIAL; - walking_badguy->set_velocity_y(vy); - sound_manager->play(TRAMPOLINE_SOUND); - sprite->set_action("swinging", 1); - return FORCE_MOVE; + vy = VY_INITIAL; + walking_badguy->set_velocity_y(vy); + sound_manager->play(TRAMPOLINE_SOUND); + sprite->set_action("swinging", 1); + return FORCE_MOVE; } } } diff --git a/src/object/unstable_tile.cpp b/src/object/unstable_tile.cpp index 089a18d62..0faca94b1 100644 --- a/src/object/unstable_tile.cpp +++ b/src/object/unstable_tile.cpp @@ -70,8 +70,8 @@ UnstableTile::update(float elapsed_time) case STATE_DISINTEGRATING: movement = physic.get_movement(elapsed_time); if (sprite->animation_done()) { - remove_me(); - return; + remove_me(); + return; } break; } diff --git a/src/physfs/physfs_sdl.cpp b/src/physfs/physfs_sdl.cpp index 4ad2b6e34..9fa1ccda9 100644 --- a/src/physfs/physfs_sdl.cpp +++ b/src/physfs/physfs_sdl.cpp @@ -77,11 +77,11 @@ static int funcClose(struct SDL_RWops* context) SDL_RWops* get_physfs_SDLRWops(const std::string& filename) { - // check this as PHYSFS seems to be buggy and still returns a - // valid pointer in this case - if(filename == "") { - throw std::runtime_error("Couldn't open file: empty filename"); - } + // check this as PHYSFS seems to be buggy and still returns a + // valid pointer in this case + if(filename == "") { + throw std::runtime_error("Couldn't open file: empty filename"); + } PHYSFS_file* file = (PHYSFS_file*) PHYSFS_openRead(filename.c_str()); if(!file) { diff --git a/src/physfs/physfs_stream.cpp b/src/physfs/physfs_stream.cpp index c4347b244..28d92c567 100644 --- a/src/physfs/physfs_stream.cpp +++ b/src/physfs/physfs_stream.cpp @@ -28,11 +28,11 @@ IFileStreambuf::IFileStreambuf(const std::string& filename) { - // check this as PHYSFS seems to be buggy and still returns a - // valid pointer in this case - if(filename == "") { - throw std::runtime_error("Couldn't open file: empty filename"); - } + // check this as PHYSFS seems to be buggy and still returns a + // valid pointer in this case + if(filename == "") { + throw std::runtime_error("Couldn't open file: empty filename"); + } file = PHYSFS_openRead(filename.c_str()); if(file == 0) { std::stringstream msg; diff --git a/src/random_generator.cpp b/src/random_generator.cpp index ea03c413e..c3608e8b8 100644 --- a/src/random_generator.cpp +++ b/src/random_generator.cpp @@ -94,8 +94,8 @@ int RandomGenerator::rand(int u, int v) { double RandomGenerator::randf(double v) { float rv; do { - rv = ((double)RandomGenerator::random())/RandomGenerator::rand_max * v; - } while (rv >= v); // rounding might cause rv==v + rv = ((double)RandomGenerator::random())/RandomGenerator::rand_max * v; + } while (rv >= v); // rounding might cause rv==v if (debug > 0) printf("==== rand(): %f =====\n", rv); diff --git a/src/scripting/functions.cpp b/src/scripting/functions.cpp index e53a83723..4840ac986 100644 --- a/src/scripting/functions.cpp +++ b/src/scripting/functions.cpp @@ -194,13 +194,13 @@ bool validate_sector_player() if (Sector::current() == 0) { log_info << "No current sector." << std::endl; - return false; + return false; } if (Sector::current()->player == 0) { log_info << "No player." << std::endl; - return false; + return false; } return true; } diff --git a/src/scripting/thunderstorm.cpp b/src/scripting/thunderstorm.cpp index 26fed3a91..aed825aae 100644 --- a/src/scripting/thunderstorm.cpp +++ b/src/scripting/thunderstorm.cpp @@ -31,7 +31,7 @@ namespace Scripting { Thunderstorm::Thunderstorm(::Thunderstorm* thunderstorm) - : thunderstorm(thunderstorm) + : thunderstorm(thunderstorm) { } diff --git a/src/sector.cpp b/src/sector.cpp index 35f472eb8..a5fd7d4fb 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -404,27 +404,27 @@ Sector::fix_old_tiles() TileMap* solids = *i; for(size_t x=0; x < solids->get_width(); ++x) { for(size_t y=0; y < solids->get_height(); ++y) { - uint32_t id = solids->get_tile_id(x, y); - const Tile *tile = solids->get_tile(x, y); - Vector pos(solids->get_x_offset() + x*32, solids->get_y_offset() + y*32); - - if(id == 112) { - add_object(new InvisibleBlock(pos)); - solids->change(x, y, 0); - } else if(tile->getAttributes() & Tile::COIN) { - add_object(new Coin(pos)); - solids->change(x, y, 0); - } else if(tile->getAttributes() & Tile::FULLBOX) { - add_object(new BonusBlock(pos, tile->getData())); - solids->change(x, y, 0); - } else if(tile->getAttributes() & Tile::BRICK) { - add_object(new Brick(pos, tile->getData())); - solids->change(x, y, 0); - } else if(tile->getAttributes() & Tile::GOAL) { - std::string sequence = tile->getData() == 0 ? "endsequence" : "stoptux"; - add_object(new SequenceTrigger(pos, sequence)); - solids->change(x, y, 0); - } + uint32_t id = solids->get_tile_id(x, y); + const Tile *tile = solids->get_tile(x, y); + Vector pos(solids->get_x_offset() + x*32, solids->get_y_offset() + y*32); + + if(id == 112) { + add_object(new InvisibleBlock(pos)); + solids->change(x, y, 0); + } else if(tile->getAttributes() & Tile::COIN) { + add_object(new Coin(pos)); + solids->change(x, y, 0); + } else if(tile->getAttributes() & Tile::FULLBOX) { + add_object(new BonusBlock(pos, tile->getData())); + solids->change(x, y, 0); + } else if(tile->getAttributes() & Tile::BRICK) { + add_object(new Brick(pos, tile->getData())); + solids->change(x, y, 0); + } else if(tile->getAttributes() & Tile::GOAL) { + std::string sequence = tile->getData() == 0 ? "endsequence" : "stoptux"; + add_object(new SequenceTrigger(pos, sequence)); + solids->change(x, y, 0); + } } } } @@ -436,24 +436,24 @@ Sector::fix_old_tiles() for(size_t x=0; x < tm->get_width(); ++x) { for(size_t y=0; y < tm->get_height(); ++y) { uint32_t id = tm->get_tile_id(x, y); - Vector pos(tm->get_x_offset() + x*32, tm->get_y_offset() + y*32); - Vector center(pos.x + 16, pos.y + 16); - - // torch - if (id == 1517) { - float pseudo_rnd = (float)((int)pos.x % 10) / 10; - add_object(new PulsingLight(center, 1.0f + pseudo_rnd, 0.9f, 1.0f, Color(1.0f, 1.0f, 0.6f, 1.0f))); - } - // lava or lavaflow - if ((id == 173) || (id == 1700) || (id == 1705) || (id == 1706)) { - // space lights a bit - if ((((tm->get_tile_id(x-1, y)) != tm->get_tile_id(x,y)) - && (tm->get_tile_id(x, y-1) != tm->get_tile_id(x,y))) - || ((x % 3 == 0) && (y % 3 == 0))) { - float pseudo_rnd = (float)((int)pos.x % 10) / 10; - add_object(new PulsingLight(center, 1.0f + pseudo_rnd, 0.8f, 1.0f, Color(1.0f, 0.3f, 0.0f, 1.0f))); - } - } + Vector pos(tm->get_x_offset() + x*32, tm->get_y_offset() + y*32); + Vector center(pos.x + 16, pos.y + 16); + + // torch + if (id == 1517) { + float pseudo_rnd = (float)((int)pos.x % 10) / 10; + add_object(new PulsingLight(center, 1.0f + pseudo_rnd, 0.9f, 1.0f, Color(1.0f, 1.0f, 0.6f, 1.0f))); + } + // lava or lavaflow + if ((id == 173) || (id == 1700) || (id == 1705) || (id == 1706)) { + // space lights a bit + if ((((tm->get_tile_id(x-1, y)) != tm->get_tile_id(x,y)) + && (tm->get_tile_id(x, y-1) != tm->get_tile_id(x,y))) + || ((x % 3 == 0) && (y % 3 == 0))) { + float pseudo_rnd = (float)((int)pos.x % 10) / 10; + add_object(new PulsingLight(center, 1.0f + pseudo_rnd, 0.8f, 1.0f, Color(1.0f, 0.3f, 0.0f, 1.0f))); + } + } } } @@ -996,30 +996,30 @@ Sector::collision_tilemap(collision::Constraints* constraints, for(int x = starttilex; x*32 < max_x; ++x) { for(int y = starttiley; y*32 < max_y; ++y) { - const Tile* tile = solids->get_tile(x, y); - if(!tile) - continue; - // skip non-solid tiles - if((tile->getAttributes() & Tile::SOLID) == 0) - continue; - // only handle unisolid when the player is falling down and when he was - // above the tile before - if(tile->getAttributes() & Tile::UNISOLID) { - if(movement.y <= 0 || dest.get_bottom() - movement.y - SHIFT_DELTA > y*32) - continue; - } - - if(tile->getAttributes() & Tile::SLOPE) { // slope tile - AATriangle triangle; - Vector p1(x*32 + solids->get_x_offset(), y*32 + solids->get_y_offset()); - Vector p2((x+1)*32 + solids->get_x_offset(), (y+1)*32 + solids->get_y_offset()); - triangle = AATriangle(p1, p2, tile->getData()); - - collision::rectangle_aatriangle(constraints, dest, triangle, solids->get_movement()); - } else { // normal rectangular tile - Rect rect(x*32 + solids->get_x_offset(), y*32 + solids->get_y_offset(), (x+1)*32 + solids->get_x_offset(), (y+1)*32 + solids->get_y_offset()); - check_collisions(constraints, movement, dest, rect, NULL, NULL, solids->get_movement()); - } + const Tile* tile = solids->get_tile(x, y); + if(!tile) + continue; + // skip non-solid tiles + if((tile->getAttributes() & Tile::SOLID) == 0) + continue; + // only handle unisolid when the player is falling down and when he was + // above the tile before + if(tile->getAttributes() & Tile::UNISOLID) { + if(movement.y <= 0 || dest.get_bottom() - movement.y - SHIFT_DELTA > y*32) + continue; + } + + if(tile->getAttributes() & Tile::SLOPE) { // slope tile + AATriangle triangle; + Vector p1(x*32 + solids->get_x_offset(), y*32 + solids->get_y_offset()); + Vector p2((x+1)*32 + solids->get_x_offset(), (y+1)*32 + solids->get_y_offset()); + triangle = AATriangle(p1, p2, tile->getData()); + + collision::rectangle_aatriangle(constraints, dest, triangle, solids->get_movement()); + } else { // normal rectangular tile + Rect rect(x*32 + solids->get_x_offset(), y*32 + solids->get_y_offset(), (x+1)*32 + solids->get_x_offset(), (y+1)*32 + solids->get_y_offset()); + check_collisions(constraints, movement, dest, rect, NULL, NULL, solids->get_movement()); + } } } } @@ -1045,10 +1045,10 @@ Sector::collision_tile_attributes(const Rect& dest) const for(int x = starttilex; x*32 < max_x; ++x) { for(int y = starttiley; y*32 < max_y; ++y) { - const Tile* tile = solids->get_tile(x, y); - if(!tile) - continue; - result |= tile->getAttributes(); + const Tile* tile = solids->get_tile(x, y); + if(!tile) + continue; + result |= tile->getAttributes(); } } } @@ -1381,18 +1381,18 @@ Sector::is_free_of_tiles(const Rect& rect, const bool ignoreUnisolid) const for(int x = starttilex; x*32 <= max_x; ++x) { for(int y = starttiley; y*32 <= max_y; ++y) { - const Tile* tile = solids->get_tile(x, y); - if(!tile) continue; - if(tile->getAttributes() & Tile::SLOPE) { - AATriangle triangle; - Vector p1(x*32 + solids->get_x_offset(), y*32 + solids->get_y_offset()); - Vector p2((x+1)*32 + solids->get_x_offset(), (y+1)*32 + solids->get_y_offset()); - triangle = AATriangle(p1, p2, tile->getData()); - Constraints constraints; - return collision::rectangle_aatriangle(&constraints, rect, triangle); - } - if((tile->getAttributes() & Tile::SOLID) && !ignoreUnisolid) return false; - if((tile->getAttributes() & Tile::SOLID) && !(tile->getAttributes() & Tile::UNISOLID)) return false; + const Tile* tile = solids->get_tile(x, y); + if(!tile) continue; + if(tile->getAttributes() & Tile::SLOPE) { + AATriangle triangle; + Vector p1(x*32 + solids->get_x_offset(), y*32 + solids->get_y_offset()); + Vector p2((x+1)*32 + solids->get_x_offset(), (y+1)*32 + solids->get_y_offset()); + triangle = AATriangle(p1, p2, tile->getData()); + Constraints constraints; + return collision::rectangle_aatriangle(&constraints, rect, triangle); + } + if((tile->getAttributes() & Tile::SOLID) && !ignoreUnisolid) return false; + if((tile->getAttributes() & Tile::SOLID) && !(tile->getAttributes() & Tile::UNISOLID)) return false; } } } diff --git a/src/statistics.cpp b/src/statistics.cpp index 8f958bcfe..fbfa94d54 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -138,24 +138,24 @@ Statistics::draw_worldmap_info(DrawingContext& context) switch (stat_no) { case 0: - caption_buf = _("Max coins collected:"); - stat_buf = coins_to_string(coins, total_coins); - break; + caption_buf = _("Max coins collected:"); + stat_buf = coins_to_string(coins, total_coins); + break; case 1: - caption_buf = _("Max fragging:"); - stat_buf = frags_to_string(badguys, total_badguys); - break; + caption_buf = _("Max fragging:"); + stat_buf = frags_to_string(badguys, total_badguys); + break; case 2: - caption_buf = _("Min time needed:"); - stat_buf = time_to_string(time); - break; + caption_buf = _("Min time needed:"); + stat_buf = time_to_string(time); + break; case 3: - caption_buf = _("Max secrets found:"); - stat_buf = secrets_to_string(secrets, total_secrets); - break; + caption_buf = _("Max secrets found:"); + stat_buf = secrets_to_string(secrets, total_secrets); + break; default: - log_debug << "Invalid stat requested to be drawn" << std::endl; - break; + log_debug << "Invalid stat requested to be drawn" << std::endl; + break; } context.draw_text(white_small_text, caption_buf, Vector(WMAP_INFO_LEFT_X, posy), ALIGN_LEFT, LAYER_GUI); diff --git a/src/tile.hpp b/src/tile.hpp index d1c7fe76a..9518f4396 100644 --- a/src/tile.hpp +++ b/src/tile.hpp @@ -77,7 +77,7 @@ public: WORLDMAP_SOUTH = 0x0002, WORLDMAP_EAST = 0x0004, WORLDMAP_WEST = 0x0008, - WORLDMAP_DIR_MASK = 0x000f, + WORLDMAP_DIR_MASK = 0x000f, WORLDMAP_STOP = 0x0010, diff --git a/src/tile_set.cpp b/src/tile_set.cpp index 02e5bd4b0..679851c8c 100644 --- a/src/tile_set.cpp +++ b/src/tile_set.cpp @@ -142,7 +142,7 @@ void TileSet::merge(const TileSet *tileset, uint32_t start, uint32_t end, Tile *tile = tileset->tiles[id]; if(tile == NULL) - continue; + continue; if(tiles[dest_id] != NULL) { log_warning << "tileset merge resulted in multiple definitions for id " diff --git a/src/tinygettext/tinygettext.cpp b/src/tinygettext/tinygettext.cpp index 41e94b476..56cc065eb 100644 --- a/src/tinygettext/tinygettext.cpp +++ b/src/tinygettext/tinygettext.cpp @@ -288,22 +288,22 @@ DictionaryManager::get_dictionary(const std::string& spec) *filename != 0; filename++) { // check if filename matches requested language - std::string fname = std::string(*filename); - std::string load_from_file = ""; + std::string fname = std::string(*filename); + std::string load_from_file = ""; if(fname == lang + ".po") { - load_from_file = fname; - } else { + load_from_file = fname; + } else { std::string::size_type s = lang.find("_"); if(s != std::string::npos) { std::string lang_short = std::string(lang, 0, s); - if (fname == lang_short + ".po") { - load_from_file = lang_short; - } + if (fname == lang_short + ".po") { + load_from_file = lang_short; + } } - } + } - // if it matched, load dictionary - if (load_from_file != "") { + // if it matched, load dictionary + if (load_from_file != "") { //log_debug << "Loading dictionary for language \"" << lang << "\" from \"" << filename << "\"" << std::endl; std::string pofile = *p + "/" + *filename; try { diff --git a/src/title.cpp b/src/title.cpp index 47452afee..dfd577c96 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -149,7 +149,7 @@ TitleScreen::get_level_name(const std::string& filename) level->get("name", name); return name; } catch(std::exception& e) { - log_warning << "Problem getting name of '" << filename << "': " + log_warning << "Problem getting name of '" << filename << "': " << e.what() << std::endl; return ""; } @@ -451,7 +451,7 @@ TitleScreen::update(float elapsed_time) case MNID_QUITMAINMENU: main_loop->quit(new FadeOut(0.25)); - sound_manager->stop_music(0.25); + sound_manager->stop_music(0.25); break; } } else if(menu == contrib_menu.get()) { diff --git a/src/trigger/door.cpp b/src/trigger/door.cpp index 4f7e50b6a..970f16525 100644 --- a/src/trigger/door.cpp +++ b/src/trigger/door.cpp @@ -31,7 +31,7 @@ #include "audio/sound_manager.hpp" Door::Door(const lisp::Lisp& reader) - : state(CLOSED) + : state(CLOSED) { reader.get("x", bbox.p1.x); reader.get("y", bbox.p1.y); @@ -46,7 +46,7 @@ Door::Door(const lisp::Lisp& reader) } Door::Door(int x, int y, std::string sector, std::string spawnpoint) - : state(CLOSED) + : state(CLOSED) { bbox.set_pos(Vector(x, y)); target_sector = sector; @@ -89,23 +89,23 @@ Door::update(float ) case OPENING: // if door has finished opening, start timer and keep door open if(sprite->animation_done()) { - state = OPEN; - sprite->set_action("open"); + state = OPEN; + sprite->set_action("open"); stay_open_timer.start(1.0); } break; case OPEN: // if door was open long enough, start closing it if (stay_open_timer.check()) { - state = CLOSING; - sprite->set_action("closing", 1); + state = CLOSING; + sprite->set_action("closing", 1); } break; case CLOSING: // if door has finished closing, keep it shut if(sprite->animation_done()) { - state = CLOSED; - sprite->set_action("closed"); + state = CLOSED; + sprite->set_action("closed"); } break; } @@ -124,9 +124,9 @@ Door::event(Player& , EventType type) case CLOSED: // if door was activated, start opening it if (type == EVENT_ACTIVATE) { - state = OPENING; + state = OPENING; sound_manager->play("sounds/door.wav"); - sprite->set_action("opening", 1); + sprite->set_action("opening", 1); } break; case OPENING: @@ -149,12 +149,12 @@ Door::collision(GameObject& other, const CollisionHit& hit) case OPEN: { // if door is open and was touched by a player, teleport the player - Player* player = dynamic_cast (&other); - if (player) { - state = CLOSING; - sprite->set_action("closing", 1); - GameSession::current()->respawn(target_sector, target_spawnpoint); - } + Player* player = dynamic_cast (&other); + if (player) { + state = CLOSING; + sprite->set_action("closing", 1); + GameSession::current()->respawn(target_sector, target_spawnpoint); + } } break; case CLOSING: diff --git a/src/trigger/secretarea_trigger.cpp b/src/trigger/secretarea_trigger.cpp index 1c4649578..3debac045 100644 --- a/src/trigger/secretarea_trigger.cpp +++ b/src/trigger/secretarea_trigger.cpp @@ -33,7 +33,7 @@ static const float MESSAGE_TIME=3.5; SecretAreaTrigger::SecretAreaTrigger(const lisp::Lisp& reader) - : fade_tilemap("") + : fade_tilemap("") { reader.get("x", bbox.p1.x); reader.get("y", bbox.p1.y); @@ -47,7 +47,7 @@ SecretAreaTrigger::SecretAreaTrigger(const lisp::Lisp& reader) } SecretAreaTrigger::SecretAreaTrigger(const Rect& area, std::string fade_tilemap) - : fade_tilemap(fade_tilemap) + : fade_tilemap(fade_tilemap) { bbox = area; message_displayed = false; @@ -96,14 +96,14 @@ SecretAreaTrigger::event(Player& , EventType type) Sector::current()->get_level()->stats.secrets++; if (fade_tilemap != "") { - // fade away tilemaps - Sector& sector = *Sector::current(); - for(Sector::GameObjects::iterator i = sector.gameobjects.begin(); i != sector.gameobjects.end(); ++i) { - TileMap* tm = dynamic_cast(*i); - if (!tm) continue; - if (tm->get_name() != fade_tilemap) continue; - tm->fade(0.0, 1.0); - } + // fade away tilemaps + Sector& sector = *Sector::current(); + for(Sector::GameObjects::iterator i = sector.gameobjects.begin(); i != sector.gameobjects.end(); ++i) { + TileMap* tm = dynamic_cast(*i); + if (!tm) continue; + if (tm->get_name() != fade_tilemap) continue; + tm->fade(0.0, 1.0); + } } } diff --git a/src/trigger/switch.cpp b/src/trigger/switch.cpp index 23f5754f8..f260b4b65 100644 --- a/src/trigger/switch.cpp +++ b/src/trigger/switch.cpp @@ -32,7 +32,7 @@ namespace { } Switch::Switch(const lisp::Lisp& reader) - : state(OFF) + : state(OFF) { if (!reader.get("x", bbox.p1.x)) throw std::runtime_error("no x position set"); if (!reader.get("y", bbox.p1.y)) throw std::runtime_error("no y position set"); @@ -68,23 +68,23 @@ Switch::update(float ) break; case TURN_ON: if(sprite->animation_done()) { - std::istringstream stream(script); - Sector::current()->run_script(stream, "Switch"); + std::istringstream stream(script); + Sector::current()->run_script(stream, "Switch"); - sprite->set_action("on", 1); - state = ON; + sprite->set_action("on", 1); + state = ON; } break; case ON: if(sprite->animation_done()) { - sprite->set_action("turnoff", 1); - state = TURN_OFF; + sprite->set_action("turnoff", 1); + state = TURN_OFF; } break; case TURN_OFF: if(sprite->animation_done()) { - sprite->set_action("off"); - state = OFF; + sprite->set_action("off"); + state = OFF; } break; } @@ -103,9 +103,9 @@ Switch::event(Player& , EventType type) switch (state) { case OFF: - sprite->set_action("turnon", 1); + sprite->set_action("turnon", 1); sound_manager->play( SWITCH_SOUND ); - state = TURN_ON; + state = TURN_ON; break; case TURN_ON: break; diff --git a/src/video/gl_lightmap.cpp b/src/video/gl_lightmap.cpp index 012941567..b58f66a90 100644 --- a/src/video/gl_lightmap.cpp +++ b/src/video/gl_lightmap.cpp @@ -98,11 +98,11 @@ inline void intern_draw(float left, float top, float right, float bottom, bottom -= center_y; float vertices[] = { - left*ca - top*sa + center_x, left*sa + top*ca + center_y, - right*ca - top*sa + center_x, right*sa + top*ca + center_y, - right*ca - bottom*sa + center_x, right*sa + bottom*ca + center_y, - left*ca - bottom*sa + center_x, left*sa + bottom*ca + center_y - }; + left*ca - top*sa + center_x, left*sa + top*ca + center_y, + right*ca - top*sa + center_x, right*sa + top*ca + center_y, + right*ca - bottom*sa + center_x, right*sa + bottom*ca + center_y, + left*ca - bottom*sa + center_x, left*sa + bottom*ca + center_y + }; glVertexPointer(2, GL_FLOAT, 0, vertices); float uvs[] = { diff --git a/src/video/gl_renderer.cpp b/src/video/gl_renderer.cpp index 9621a4d21..c39744a9d 100644 --- a/src/video/gl_renderer.cpp +++ b/src/video/gl_renderer.cpp @@ -103,11 +103,11 @@ inline void intern_draw(float left, float top, float right, float bottom, bottom -= center_y; float vertices[] = { - left*ca - top*sa + center_x, left*sa + top*ca + center_y, - right*ca - top*sa + center_x, right*sa + top*ca + center_y, - right*ca - bottom*sa + center_x, right*sa + bottom*ca + center_y, - left*ca - bottom*sa + center_x, left*sa + bottom*ca + center_y - }; + left*ca - top*sa + center_x, left*sa + top*ca + center_y, + right*ca - top*sa + center_x, right*sa + top*ca + center_y, + right*ca - bottom*sa + center_x, right*sa + bottom*ca + center_y, + left*ca - bottom*sa + center_x, left*sa + bottom*ca + center_y + }; glVertexPointer(2, GL_FLOAT, 0, vertices); float uvs[] = { diff --git a/src/video/sdl_lightmap.cpp b/src/video/sdl_lightmap.cpp index 51e13b937..595da5398 100644 --- a/src/video/sdl_lightmap.cpp +++ b/src/video/sdl_lightmap.cpp @@ -476,7 +476,7 @@ namespace SDL if (transform == 0) { std::cerr << "Warning: Tried to draw NULL surface, skipped draw" << std::endl; return; - } + } SDL_Rect *src_rect = surface_data->get_src_rect(effect); int dstx = (int) request.pos.x * numerator / denominator; @@ -502,7 +502,7 @@ namespace SDL if (transform == 0) { std::cerr << "Warning: Tried to draw NULL surface, skipped draw" << std::endl; return; - } + } int ox, oy; if (effect == HORIZONTAL_FLIP) diff --git a/src/video/sdl_renderer.cpp b/src/video/sdl_renderer.cpp index 56cb6b899..33fee59cd 100644 --- a/src/video/sdl_renderer.cpp +++ b/src/video/sdl_renderer.cpp @@ -198,7 +198,7 @@ namespace SDL if (transform == 0) { std::cerr << "Warning: Tried to draw NULL surface, skipped draw" << std::endl; return; - } + } SDL_Rect *src_rect = surface_data->get_src_rect(effect); SDL_Rect dst_rect; @@ -266,7 +266,7 @@ namespace SDL if (transform == 0) { std::cerr << "Warning: Tried to draw NULL surface, skipped draw" << std::endl; return; - } + } int ox, oy; if (effect == HORIZONTAL_FLIP) diff --git a/src/worldmap/level.cpp b/src/worldmap/level.cpp index 2b61124c6..59984ffad 100644 --- a/src/worldmap/level.cpp +++ b/src/worldmap/level.cpp @@ -77,7 +77,7 @@ LevelTile::get_picture() picture_cached = true; std::string fname = FileSystem::strip_extension(basedir + name)+".jpg"; if (!PHYSFS_exists(fname.c_str())) { - return 0; + return 0; } picture = new Surface(fname); return picture; diff --git a/src/worldmap/tux.cpp b/src/worldmap/tux.cpp index 7fa35267f..f505fc263 100644 --- a/src/worldmap/tux.cpp +++ b/src/worldmap/tux.cpp @@ -149,9 +149,9 @@ bool Tux::canWalk(int tile_data, Direction dir) { return ((tile_data & Tile::WORLDMAP_NORTH && dir == D_NORTH) || - (tile_data & Tile::WORLDMAP_SOUTH && dir == D_SOUTH) || - (tile_data & Tile::WORLDMAP_EAST && dir == D_EAST) || - (tile_data & Tile::WORLDMAP_WEST && dir == D_WEST)); + (tile_data & Tile::WORLDMAP_SOUTH && dir == D_SOUTH) || + (tile_data & Tile::WORLDMAP_EAST && dir == D_EAST) || + (tile_data & Tile::WORLDMAP_WEST && dir == D_WEST)); } void @@ -182,9 +182,9 @@ Tux::tryContinueWalking(float elapsed_time) // direction and the apply_action_ are opposites, since they "see" // directions in a different way if((direction == D_NORTH && special_tile->apply_action_south) || - (direction == D_SOUTH && special_tile->apply_action_north) || - (direction == D_WEST && special_tile->apply_action_east) || - (direction == D_EAST && special_tile->apply_action_west)) + (direction == D_SOUTH && special_tile->apply_action_north) || + (direction == D_WEST && special_tile->apply_action_east) || + (direction == D_EAST && special_tile->apply_action_west)) { if(special_tile->passive_message) { worldmap->passive_message = special_tile->map_message; diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index 2ed378345..13602da1d 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -511,10 +511,10 @@ WorldMap::finished_level(Level* gamelevel) int dirdata = available_directions_at(tux->get_tile_pos()); // first, test for crossroads if (dirdata == Tile::WORLDMAP_CNSE || - dirdata == Tile::WORLDMAP_CNSW || - dirdata == Tile::WORLDMAP_CNEW || - dirdata == Tile::WORLDMAP_CSEW || - dirdata == Tile::WORLDMAP_CNSEW) + dirdata == Tile::WORLDMAP_CNSW || + dirdata == Tile::WORLDMAP_CNEW || + dirdata == Tile::WORLDMAP_CSEW || + dirdata == Tile::WORLDMAP_CNSEW) dir = D_NONE; else if (dirdata & Tile::WORLDMAP_NORTH && tux->back_direction != D_NORTH) @@ -662,8 +662,8 @@ WorldMap::update(float delta) || main_controller->pressed(Controller::MENU_SELECT)) { /* some people define UP and JUMP on the same key... */ if(!main_controller->pressed(Controller::UP)) - enter_level = true; - } + enter_level = true; + } if(main_controller->pressed(Controller::PAUSE_MENU)) on_escape_press(); @@ -1024,13 +1024,13 @@ WorldMap::save_state() for(LevelTiles::iterator i = levels.begin(); i != levels.end(); ++i) { LevelTile* level = *i; - sq_pushstring(vm, level->get_name().c_str(), -1); - sq_newtable(vm); + sq_pushstring(vm, level->get_name().c_str(), -1); + sq_newtable(vm); - store_bool(vm, "solved", level->solved); - level->statistics.serialize_to_squirrel(vm); + store_bool(vm, "solved", level->solved); + level->statistics.serialize_to_squirrel(vm); - sq_createslot(vm, -3); + sq_createslot(vm, -3); } sq_createslot(vm, -3);