From 00a42dab21441c02d7d98c23284c479dae7f743b Mon Sep 17 00:00:00 2001 From: bruhmoent Date: Wed, 19 Jul 2023 12:56:22 +0200 Subject: [PATCH] Comment consistency and touch-ups. --- src/badguy/igel.cpp | 2 +- src/badguy/jumpy.cpp | 14 ++--- src/badguy/kamikazesnowball.cpp | 4 +- src/badguy/kugelblitz.cpp | 18 +++--- src/badguy/livefire.cpp | 18 +++--- src/badguy/mole.cpp | 8 +-- src/badguy/mole_rock.cpp | 2 +- src/badguy/mrbomb.cpp | 6 +- src/badguy/mriceblock.cpp | 12 ++-- src/badguy/mrtree.cpp | 14 ++--- src/badguy/plant.cpp | 4 +- src/badguy/rcrystallo.cpp | 12 ++-- src/badguy/root.cpp | 6 +- src/badguy/scrystallo.cpp | 8 +-- src/badguy/short_fuse.cpp | 4 +- src/badguy/skullyhop.cpp | 24 +++---- src/badguy/skydive.cpp | 8 +-- src/badguy/snail.cpp | 18 +++--- src/badguy/snowman.cpp | 22 +++---- src/badguy/spidermite.cpp | 2 +- src/badguy/sspiky.cpp | 6 +- src/badguy/stalactite.cpp | 2 +- src/badguy/stumpy.cpp | 10 +-- src/badguy/toad.cpp | 28 ++++----- src/badguy/totem.cpp | 24 +++---- src/badguy/treewillowisp.cpp | 6 +- src/badguy/viciousivy.cpp | 2 +- src/badguy/walkingleaf.cpp | 2 +- src/badguy/willowisp.cpp | 6 +- src/badguy/yeti.cpp | 63 ++++++++++--------- .../menu/editor_levelset_select_menu.cpp | 2 +- 31 files changed, 179 insertions(+), 178 deletions(-) diff --git a/src/badguy/igel.cpp b/src/badguy/igel.cpp index ee10a1a3c53..6e76f76e46d 100644 --- a/src/badguy/igel.cpp +++ b/src/badguy/igel.cpp @@ -107,7 +107,7 @@ Igel::is_freezable() const /**bool Igel::collision_squished(GameObject& ) { - // this will hurt + // This will hurt. return false; }*/ // Enable this and the igle will no longer be butt-jumpable. diff --git a/src/badguy/jumpy.cpp b/src/badguy/jumpy.cpp index 05e9f94c213..1a1f9f8a18a 100644 --- a/src/badguy/jumpy.cpp +++ b/src/badguy/jumpy.cpp @@ -21,9 +21,9 @@ #include "object/player.hpp" #include "sprite/sprite.hpp" -static const float JUMPYSPEED=-600; -static const float JUMPY_MID_TOLERANCE=4; -static const float JUMPY_LOW_TOLERANCE=2; +static const float JUMPYSPEED =- 600; +static const float JUMPY_MID_TOLERANCE = 4; +static const float JUMPY_LOW_TOLERANCE = 2; Jumpy::Jumpy(const ReaderMapping& reader) : BadGuy(reader, "images/creatures/jumpy/snowjumpy.sprite"), @@ -31,8 +31,8 @@ Jumpy::Jumpy(const ReaderMapping& reader) : groundhit_pos_set(false) { set_action(m_dir, "middle"); - // TODO create a nice sound for this... - //SoundManager::current()->preload("sounds/skid.wav"); + // TODO: Create a suitable sound for this... + // SoundManager::current()->preload("sounds/skid.wav"); } void @@ -60,8 +60,8 @@ Jumpy::hit(const CollisionHit& chit) } m_physic.set_velocity_y((m_frozen || get_state() != STATE_ACTIVE) ? 0 : JUMPYSPEED); - // TODO create a nice sound for this... - //SoundManager::current()->play("sounds/skid.wav", get_pos()); + // TODO: Create a suitable sound for this... + // SoundManager::current()->play("sounds/skid.wav", get_pos()); update_on_ground_flag(chit); } else if (chit.top) { m_physic.set_velocity_y(0); diff --git a/src/badguy/kamikazesnowball.cpp b/src/badguy/kamikazesnowball.cpp index 307b0a2a3c1..293d60c5340 100644 --- a/src/badguy/kamikazesnowball.cpp +++ b/src/badguy/kamikazesnowball.cpp @@ -83,7 +83,7 @@ KamikazeSnowball::kill_collision() HitResponse KamikazeSnowball::collision_player(Player& player, const CollisionHit& hit) { - //Hack to tell if we should die + // Methodology to determine necessity of death. if (!m_frozen) { HitResponse response = BadGuy::collision_player(player, hit); @@ -141,7 +141,7 @@ LeafShot::collision_squished(GameObject& object) if (m_frozen) return BadGuy::collision_squished(object); set_action("squished", m_dir); - // Spawn death particles + // Spawn death particles. spawn_explosion_sprites(3, "images/particles/leafshot.sprite"); kill_squished(object); return true; diff --git a/src/badguy/kugelblitz.cpp b/src/badguy/kugelblitz.cpp index 50bc6c1daf8..4400896369e 100644 --- a/src/badguy/kugelblitz.cpp +++ b/src/badguy/kugelblitz.cpp @@ -60,7 +60,7 @@ void Kugelblitz::initialize() { m_physic.set_velocity_y(300); - m_physic.set_velocity_x(-20); //fall a little to the left + m_physic.set_velocity_x(-20); // Fall a little to the left. direction = 1; dying = false; } @@ -78,10 +78,10 @@ Kugelblitz::collision_player(Player& player, const CollisionHit& ) explode(); return ABORT_MOVE; } - // hit from above? + // Did the collision occur from above? if (player.get_movement().y - get_movement().y > 0 && player.get_bbox().get_bottom() < (m_col.m_bbox.get_top() + m_col.m_bbox.get_bottom()) / 2) { - // if it's not is it possible to squish us, then this will hurt + // If not, and if it's possible for the player to squish us, then this collision will hurt. if (!collision_squished(player)) player.kill(false); explode(); @@ -95,8 +95,8 @@ Kugelblitz::collision_player(Player& player, const CollisionHit& ) HitResponse Kugelblitz::collision_badguy(BadGuy& other , const CollisionHit& chit) { - //Let the Kugelblitz explode, too? The problem with that is that - //two Kugelblitzes would cancel each other out on contact... + // Should the Kugelblitz explode as well? The concern is that + // two Kugelblitzes would cancel each other out on contact. other.kill_fall(); return hit(chit); } @@ -104,7 +104,7 @@ Kugelblitz::collision_badguy(BadGuy& other , const CollisionHit& chit) HitResponse Kugelblitz::hit(const CollisionHit& hit_) { - // hit floor? + // Did the collision occur with the floor? if (hit_.bottom) { if (!groundhit_pos_set) { @@ -113,7 +113,7 @@ Kugelblitz::hit(const CollisionHit& hit_) } set_action("flying"); m_physic.set_velocity_y(0); - //Set random initial speed and direction + // Set random initial speed and direction. direction = gameRandom.rand(2)? 1: -1; int speed = (BASE_SPEED + (gameRandom.rand(RAND_SPEED))) * direction; m_physic.set_velocity_x(static_cast(speed)); @@ -177,7 +177,7 @@ Kugelblitz::explode() void Kugelblitz::try_activate() { - // Much smaller offscreen distances to pop out of nowhere and surprise Tux + // Define much smaller offscreen distances to appear unexpectedly and surprise Tux. float X_OFFSCREEN_DISTANCE = 400; float Y_OFFSCREEN_DISTANCE = 600; @@ -188,7 +188,7 @@ Kugelblitz::try_activate() set_state(STATE_ACTIVE); if (!m_is_initialized) { - // if starting direction was set to AUTO, this is our chance to re-orient the badguy + // If the starting direction was set to AUTO, this is our chance to re-orient the badguy. if (m_start_dir == Direction::AUTO) { Player* player__ = get_nearest_player(); if (player__ && (player__->get_bbox().get_left() > m_col.m_bbox.get_right())) { diff --git a/src/badguy/livefire.cpp b/src/badguy/livefire.cpp index ccb612486e9..9d0a7d46974 100644 --- a/src/badguy/livefire.cpp +++ b/src/badguy/livefire.cpp @@ -56,7 +56,7 @@ LiveFire::collision_badguy(BadGuy& badguy, const CollisionHit& hit) void LiveFire::active_update(float dt_sec) { - // Remove when extinguish animation is done + // Remove when extinguish animation is done. if ((m_sprite->get_action() == "extinguish-left" || m_sprite->get_action() == "extinguish-right" ) && m_sprite->animation_done()) remove_me(); @@ -77,7 +77,7 @@ LiveFire::active_update(float dt_sec) { bool inReach_bottom = (pb.get_top() <= m_col.m_bbox.get_bottom()); if (inReach_left && inReach_right && inReach_top && inReach_bottom) { - // wake up + // Wake up. set_action("waking", m_dir, 1); state = STATE_WAKING; } @@ -85,7 +85,7 @@ LiveFire::active_update(float dt_sec) { } else if (state == STATE_WAKING) { if (m_sprite->animation_done()) { - // start walking + // Start walking. state = STATE_WALKING; WalkingBadguy::initialize(); } @@ -97,7 +97,7 @@ LiveFire::active_update(float dt_sec) { void LiveFire::freeze() { - // attempting to freeze a flame causes it to go out + // Attempting to freeze a flame causes it to go out. death_sound = "sounds/sizzle.ogg"; kill_fall(); } @@ -118,7 +118,7 @@ void LiveFire::kill_fall() { SoundManager::current()->play(death_sound, get_pos()); - // throw a puff of smoke + // Emit a puff of smoke. Vector ppos = m_col.m_bbox.get_middle(); Vector pspeed = Vector(0, -150); Vector paccel = Vector(0,0); @@ -126,7 +126,7 @@ LiveFire::kill_fall() "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_BACKGROUNDTILES+2); - // extinguish the flame + // Extinguish the flame. set_action("extinguish", m_dir, 1); m_physic.set_velocity_y(0); m_physic.set_acceleration_y(0); @@ -136,11 +136,11 @@ LiveFire::kill_fall() set_group(COLGROUP_DISABLED); state = STATE_DEAD; - // start dead-script + // Start the dead-script. run_dead_script(); } -/* The following defines a sleeping version */ +/* The following defines a sleeping version. */ LiveFireAsleep::LiveFireAsleep(const ReaderMapping& reader) : LiveFire(reader) @@ -166,7 +166,7 @@ LiveFireAsleep::initialize() set_action("sleeping", m_dir); } -/* The following defines a dormant version that never wakes */ +/* The following defines a dormant version that remains inactive. */ LiveFireDormant::LiveFireDormant(const ReaderMapping& reader) : LiveFire(reader) { diff --git a/src/badguy/mole.cpp b/src/badguy/mole.cpp index 610d5d6b7c3..68723607fd5 100644 --- a/src/badguy/mole.cpp +++ b/src/badguy/mole.cpp @@ -26,10 +26,10 @@ #include "supertux/flip_level_transformer.hpp" #include "supertux/sector.hpp" -static const float MOLE_WAIT_TIME = 0.2f; /**< time to wait before and after throwing */ -static const float THROW_TIME = 4.6f; /**< time to spend throwing */ -static const float THROW_INTERVAL = 1; /**< time between two thrown rocks */ -static const float THROW_VELOCITY = 400; /**< initial velocity of thrown rocks */ +static const float MOLE_WAIT_TIME = 0.2f; /**< Time to wait before and after throwing. */ +static const float THROW_TIME = 4.6f; /**< Time to spend throwing. */ +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 ReaderMapping& reader) : BadGuy(reader, "images/creatures/mole/mole.sprite", LAYER_TILES-1), diff --git a/src/badguy/mole_rock.cpp b/src/badguy/mole_rock.cpp index 17bb09be8f1..57cf27d567f 100644 --- a/src/badguy/mole_rock.cpp +++ b/src/badguy/mole_rock.cpp @@ -85,7 +85,7 @@ MoleRock::collision_solid(const CollisionHit& ) HitResponse MoleRock::collision_badguy(BadGuy& badguy, const CollisionHit& ) { - // ignore collisions with parent + // Ignore collisions with parent. if (&badguy == parent) { return FORCE_MOVE; } diff --git a/src/badguy/mrbomb.cpp b/src/badguy/mrbomb.cpp index 255b5229b7b..fa9929438df 100644 --- a/src/badguy/mrbomb.cpp +++ b/src/badguy/mrbomb.cpp @@ -34,10 +34,10 @@ MrBomb::MrBomb(const ReaderMapping& reader) : walk_speed = 80; max_drop_height = 16; - //Prevent stutter when Tux jumps on Mr Bomb + // Prevent stutter when Tux jumps on Mr Bomb. SoundManager::current()->preload("sounds/explosion.wav"); - //Check if we need another sprite + // Check if we need another sprite. if ( !reader.get( "sprite", m_sprite_name ) ){ return; } @@ -45,7 +45,7 @@ MrBomb::MrBomb(const ReaderMapping& reader) : m_sprite_name = "images/creatures/mr_bomb/mr_bomb.sprite"; return; } - //Replace sprite + // Replace the sprite. m_sprite = SpriteManager::current()->create( m_sprite_name ); } diff --git a/src/badguy/mriceblock.cpp b/src/badguy/mriceblock.cpp index aff55f08c53..b0ce64581f5 100644 --- a/src/badguy/mriceblock.cpp +++ b/src/badguy/mriceblock.cpp @@ -84,11 +84,11 @@ MrIceBlock::collision_solid(const CollisionHit& hit) { update_on_ground_flag(hit); - if (hit.top || hit.bottom) { // floor or roof + if (hit.top || hit.bottom) { // Floor or roof. m_physic.set_velocity_y(0); } - // hit left or right + // Hit left or right. switch (ice_state) { case ICESTATE_NORMAL: WalkingBadguy::collision_solid(hit); @@ -125,7 +125,7 @@ MrIceBlock::collision(GameObject& object, const CollisionHit& hit) HitResponse MrIceBlock::collision_player(Player& player, const CollisionHit& hit) { - // handle kicks from left or right side + // Handle kicks from left or right side. if ((ice_state == ICESTATE_WAKING || ice_state == ICESTATE_FLAT) && get_state() == STATE_ACTIVE) { if (hit.left) { m_dir = Direction::RIGHT; @@ -244,7 +244,7 @@ MrIceBlock::set_state(IceState state_) m_physic.set_velocity_x(m_dir == Direction::LEFT ? -KICKSPEED : KICKSPEED); set_action(m_dir == Direction::LEFT ? "flat-left" : "flat-right", /* loops = */ -1); - // we should slide above 1 block holes now... + // We should slide above 1 block holes now. m_col.m_bbox.set_size(34, 31.8f); break; case ICESTATE_GRABBED: @@ -276,7 +276,7 @@ MrIceBlock::ungrab(MovingObject& object, Direction dir_) auto player = dynamic_cast (&object); if (player && (player->is_swimming() || player->is_water_jumping())) { - //move icecube a little bit away as to not insta-kill Tux + // Move the ice cube slightly away to avoid instantly killing Tux. float swimangle = player->get_swimming_angle(); m_col.m_bbox.move(Vector(std::cos(swimangle) * 48.f, std::sin(swimangle) * 48.f)); } @@ -287,7 +287,7 @@ MrIceBlock::ungrab(MovingObject& object, Direction dir_) else if (dir_ == Direction::DOWN) { Vector mov(0, 32); if (Sector::get().is_free_of_statics(get_bbox().moved(mov), this)) { - // There is free space, so throw it down + // There is free space, so throw it down. SoundManager::current()->play("sounds/kick.wav", get_pos()); m_physic.set_velocity_y(KICKSPEED); } diff --git a/src/badguy/mrtree.cpp b/src/badguy/mrtree.cpp index b84b01158b0..000ec2ef261 100644 --- a/src/badguy/mrtree.cpp +++ b/src/badguy/mrtree.cpp @@ -91,19 +91,19 @@ MrTree::collision_squished(GameObject& object) return true; } - // replace with Stumpy + // Replace with Stumpy. Vector stumpy_pos = get_pos(); stumpy_pos.x += 8; stumpy_pos.y += 28; auto& stumpy = Sector::get().add(stumpy_pos, m_dir); remove_me(); - // give Feedback + // Give Feedback. SoundManager::current()->play("sounds/mr_tree.ogg", get_pos()); if (player) player->bounce(*this); - // spawn some particles - // TODO: provide convenience function in MovingSprite or MovingObject? + // Spawn some particles. + // TODO: Provide convenience function in MovingSprite or MovingObject? for (int px = static_cast(stumpy.get_bbox().get_left()); px < static_cast(stumpy.get_bbox().get_right()); px+=10) { Vector ppos = Vector(static_cast(px), static_cast(stumpy.get_bbox().get_top()) - 5.0f); @@ -120,8 +120,8 @@ MrTree::collision_squished(GameObject& object) LAYER_OBJECTS-1); } - if (!m_frozen) { //Frozen Mr.Trees don't spawn any ViciousIvys. - // spawn ViciousIvy + if (!m_frozen) { // Mr.Trees that are frozen don't spawn any Vicious Ivys. + // Spawn ViciousIvy. Vector leaf1_pos(stumpy_pos.x - VICIOUSIVY_WIDTH - 1, stumpy_pos.y - VICIOUSIVY_Y_OFFSET); Rectf leaf1_bbox(leaf1_pos.x, leaf1_pos.y, leaf1_pos.x + VICIOUSIVY_WIDTH, leaf1_pos.y + VICIOUSIVY_HEIGHT); if (Sector::get().is_free_of_movingstatics(leaf1_bbox, this)) { @@ -129,7 +129,7 @@ MrTree::collision_squished(GameObject& object) leaf1.m_countMe = false; } - // spawn ViciousIvy + // Spawn ViciousIvy. Vector leaf2_pos(stumpy_pos.x + m_sprite->get_current_hitbox_width() + 1, stumpy_pos.y - VICIOUSIVY_Y_OFFSET); Rectf leaf2_bbox(leaf2_pos.x, leaf2_pos.y, leaf2_pos.x + VICIOUSIVY_WIDTH, leaf2_pos.y + VICIOUSIVY_HEIGHT); if (Sector::get().is_free_of_movingstatics(leaf2_bbox, this)) { diff --git a/src/badguy/plant.cpp b/src/badguy/plant.cpp index 9dde7a072a6..e52ac123fd3 100644 --- a/src/badguy/plant.cpp +++ b/src/badguy/plant.cpp @@ -32,7 +32,7 @@ Plant::Plant(const ReaderMapping& reader) : void Plant::initialize() { - //FIXME: turns plant around for debugging + // FIXME: Turns plant around for debugging. m_dir = m_dir == Direction::LEFT ? Direction::RIGHT : Direction::LEFT; state = PLANT_SLEEPING; @@ -92,7 +92,7 @@ Plant::active_update(float dt_sec) { if (state == PLANT_WAKING) { if (timer.check()) { - // start walking + // Start walking. set_action(m_dir); m_physic.set_velocity_x(m_dir == Direction::LEFT ? -PLANT_SPEED : PLANT_SPEED); state = PLANT_WALKING; diff --git a/src/badguy/rcrystallo.cpp b/src/badguy/rcrystallo.cpp index 962e797c3a1..702fb81dfff 100644 --- a/src/badguy/rcrystallo.cpp +++ b/src/badguy/rcrystallo.cpp @@ -55,7 +55,7 @@ RCrystallo::get_settings() void RCrystallo::active_update(float dt_sec) { - //initialization of certain events prior to going into cases + // Initialization of certain events prior to going into cases. auto player = get_nearest_player(); float targetwalk = m_dir == Direction::LEFT ? -80.f : 80.f; Rectf reversefallbox = get_bbox(); @@ -64,7 +64,7 @@ RCrystallo::active_update(float dt_sec) { case RCRYSTALLO_ROOF: m_physic.set_gravity_modifier(-1.f); - //walking and turning properly + // Walking and turning properly. if (m_dir != Direction::LEFT && get_pos().x > (m_start_position.x + m_radius - 20.f)) targetwalk = -80.f; if (m_dir != Direction::RIGHT && get_pos().x < (m_start_position.x - m_radius + 20.f)) @@ -72,20 +72,20 @@ RCrystallo::active_update(float dt_sec) set_action(std::abs(m_physic.get_velocity_x()) < 80.f ? m_dir == Direction::LEFT ? "slowdown-left" : "slowdown-right" : m_dir == Direction::LEFT ? "left" : "right", -1); - //turn at holes + // Turn at holes. reversefallbox.set_top(m_col.m_bbox.get_top() - 33.f); reversefallbox.set_left(m_col.m_bbox.get_left() + (m_dir == Direction::LEFT ? -5.f : 34.f)); reversefallbox.set_right(m_col.m_bbox.get_right() + (m_dir == Direction::LEFT ? -34.f : 5.f)); if (Sector::get().is_free_of_statics(reversefallbox)) turn_around(); - //detect player and fall when it is time + // Detect player and fall when it is time. if (player && player->get_bbox().get_right() > m_col.m_bbox.get_left() - 192.f && player->get_bbox().get_left() < m_col.m_bbox.get_right() + 192.f && player->get_bbox().get_bottom() > m_col.m_bbox.get_top() && Sector::get().free_line_of_sight(m_col.m_bbox.get_middle() + Vector(0, 20), player->get_bbox().get_middle() - Vector(0, 40), false, player)) { - //center enemy, begin falling + // Center enemy, begin falling. m_col.m_bbox.move(Vector(3.f, 0.f)); set_action(m_dir == Direction::LEFT ? "detected-left" : "detected-right", 1, ANCHOR_TOP); state = RCRYSTALLO_DETECT; @@ -162,7 +162,7 @@ RCrystallo::kill_fall() if (is_valid()) { remove_me(); - //create 4 shards that the enemy splits into, which serve as an additional threat + // Create 4 shards that the enemy splits into, which serve as an additional threat. Sector::get().add(m_col.m_bbox.get_middle(), Vector(100.f, -500.f)); Sector::get().add(m_col.m_bbox.get_middle(), Vector(270.f, -350.f)); Sector::get().add(m_col.m_bbox.get_middle(), Vector(-100.f, -500.f)); diff --git a/src/badguy/root.cpp b/src/badguy/root.cpp index 7be4c5d32a5..51511057d3f 100644 --- a/src/badguy/root.cpp +++ b/src/badguy/root.cpp @@ -31,7 +31,7 @@ Root::Root(const Vector& pos, Flip flip) : hatch_timer() { base_sprite->set_action("appearing", 1); - base_sprite->set_animation_loops(1); // TODO: necessary because set_action ignores loops for default action + base_sprite->set_animation_loops(1); // TODO: Necessary because set_action ignores loops for default actions. m_physic.enable_gravity(false); set_colgroup_active(COLGROUP_TOUCHABLE); m_flip = flip; @@ -45,7 +45,7 @@ void Root::deactivate() { remove_me(); - //no dead script + // No dead-script required for deactivation. } void @@ -74,7 +74,7 @@ Root::active_update(float dt_sec) offset_y = 0; mystate = STATE_VANISHING; base_sprite->set_action("vanishing", 2); - base_sprite->set_animation_loops(2); // TODO: doesn't seem to work for loops=1 + base_sprite->set_animation_loops(2); // TODO: Verify if setting loops to 1 works as intended. } set_pos(m_start_position + Vector(0, (m_flip == NO_FLIP ? offset_y : -offset_y))); } diff --git a/src/badguy/scrystallo.cpp b/src/badguy/scrystallo.cpp index d3394164d9a..2f4e01f7d78 100644 --- a/src/badguy/scrystallo.cpp +++ b/src/badguy/scrystallo.cpp @@ -88,7 +88,7 @@ SCrystallo::active_update(float dt_sec) case SCRYSTALLO_SLEEPING: m_physic.set_velocity(0.f, 0.f); m_physic.set_acceleration(0.f, 0.f); - // is sleeping peacefully + // The entity is sleeping peacefully. if (player) { Vector p1 = m_col.m_bbox.get_middle(); @@ -105,7 +105,7 @@ SCrystallo::active_update(float dt_sec) case SCRYSTALLO_WAKING: m_physic.set_velocity(0.f, 0.f); m_physic.set_acceleration(0.f, 0.f); - //wake up, acknowledge surroundings + // Wake up and acknowledge surroundings once the animation is done. if (m_sprite->animation_done()) { SoundManager::current()->play("sounds/crystallo-pop.ogg", get_pos()); @@ -118,7 +118,7 @@ SCrystallo::active_update(float dt_sec) BadGuy::active_update(dt_sec); break; case SCRYSTALLO_JUMPING: - //popping out of the hole, ends when near ground + // Popping out of the hole, ends when near the ground. downbox.set_bottom(get_bbox().get_bottom() + 10.f); if (!Sector::get().is_free_of_statics(downbox)) { @@ -128,7 +128,7 @@ SCrystallo::active_update(float dt_sec) WalkingBadguy::active_update(dt_sec); break; case SCRYSTALLO_WALKING: - //walking and turning properly + // Walking and turning properly. float targetwalk = m_dir == Direction::LEFT ? -80.f : 80.f; if (m_dir != Direction::LEFT && get_pos().x > (m_radius_anchor.x + m_radius - 20.f)) targetwalk = -80.f; diff --git a/src/badguy/short_fuse.cpp b/src/badguy/short_fuse.cpp index 3c17cb56808..0f0a42d0ff8 100644 --- a/src/badguy/short_fuse.cpp +++ b/src/badguy/short_fuse.cpp @@ -31,7 +31,7 @@ ShortFuse::ShortFuse(const ReaderMapping& reader) : walk_speed = 100; max_drop_height = 16; - //Check if we need another sprite + // Check if we need another sprite. if ( !reader.get( "sprite", m_sprite_name ) ){ return; } @@ -39,7 +39,7 @@ ShortFuse::ShortFuse(const ReaderMapping& reader) : m_sprite_name = "images/creatures/short_fuse/short_fuse.sprite"; return; } - //Replace sprite + // Replace the sprite. m_sprite = SpriteManager::current()->create( m_sprite_name ); SoundManager::current()->preload("sounds/firecracker.ogg"); diff --git a/src/badguy/skullyhop.cpp b/src/badguy/skullyhop.cpp index 7dce7df8c1f..d8a5c1f9702 100644 --- a/src/badguy/skullyhop.cpp +++ b/src/badguy/skullyhop.cpp @@ -34,7 +34,7 @@ SkullyHop::SkullyHop(const ReaderMapping& reader) : void SkullyHop::initialize() { - // initial state is JUMPING, because we might start airborne + // The initial state is JUMPING, because we might start airborne. state = JUMPING; set_action("jumping", m_dir); } @@ -54,9 +54,9 @@ SkullyHop::set_state(SkullyHopState newState) } else if (newState == JUMPING) { set_action("jumping", m_dir); -const float HORIZONTAL_SPEED = 220; /**< x-speed when jumping */ +const float HORIZONTAL_SPEED = 220; /**< X-speed when jumping. */ m_physic.set_velocity_x(m_dir == Direction::LEFT ? -HORIZONTAL_SPEED : HORIZONTAL_SPEED); -const float VERTICAL_SPEED = -450; /**< y-speed when jumping */ +const float VERTICAL_SPEED = -450; /**< Y-speed when jumping. */ m_physic.set_velocity_y(VERTICAL_SPEED); SoundManager::current()->play( SKULLYHOP_SOUND, get_pos()); } @@ -84,25 +84,25 @@ SkullyHop::collision_solid(const CollisionHit& hit) return; } - // just default behaviour (i.e. stop at floor/walls) when squished + // Default behaviour (i.e. stop at floor/walls) when squished. if (BadGuy::get_state() == STATE_SQUISHED) { BadGuy::collision_solid(hit); } - // ignore collisions while standing still + // Ignore collisions while standing still. if (state != JUMPING) return; - // check if we hit the floor while falling + // Check if we hit the floor while falling. if (hit.bottom && m_physic.get_velocity_y() > 0 ) { set_state(STANDING); } - // check if we hit the roof while climbing + // Check if we hit the roof while climbing. if (hit.top) { m_physic.set_velocity_y(0); } - // check if we hit left or right while moving in either direction + // Check if we hit left or right while moving in either direction. if (hit.left || hit.right) { m_dir = m_dir == Direction::LEFT ? Direction::RIGHT : Direction::LEFT; set_action("jumping", m_dir); @@ -113,7 +113,7 @@ SkullyHop::collision_solid(const CollisionHit& hit) HitResponse SkullyHop::collision_badguy(BadGuy& , const CollisionHit& hit) { - // behaviour for badguy collisions is the same as for collisions with solids + // Behaviour for badguy collisions is the same as for collisions with solids. collision_solid(hit); return CONTINUE; @@ -124,17 +124,17 @@ SkullyHop::active_update(float dt_sec) { BadGuy::active_update(dt_sec); - // no change if frozen + // No change if frozen. if (m_frozen) return; - // charge when fully recovered + // Charge when fully recovered. if ((state == STANDING) && (recover_timer.check())) { set_state(CHARGING); return; } - // jump as soon as charging animation completed + // Jump as soon as charging animation completed. if ((state == CHARGING) && (m_sprite->animation_done())) { set_state(JUMPING); return; diff --git a/src/badguy/skydive.cpp b/src/badguy/skydive.cpp index efd9e8973e1..d5b5e95903f 100644 --- a/src/badguy/skydive.cpp +++ b/src/badguy/skydive.cpp @@ -84,7 +84,7 @@ void SkyDive::ungrab(MovingObject& object, Direction dir_) { auto player = dynamic_cast (&object); - //handle swimming + // Handle swimming state of the player. if (player) { if (player->is_swimming() || player->is_water_jumping()) @@ -93,10 +93,10 @@ SkyDive::ungrab(MovingObject& object, Direction dir_) m_physic.set_velocity(Vector(std::cos(swimangle) * 40.f, std::sin(swimangle) * 40.f) + player->get_physic().get_velocity()); } - //handle non-swimming + // Handle non-swimming. else { - //handle x-movement + // Handle x-movement based on the player's direction and velocity. if (fabsf(player->get_physic().get_velocity_x()) < 1.0f) m_physic.set_velocity_x(0.f); else if ((player->m_dir == Direction::LEFT && player->get_physic().get_velocity_x() <= -1.0f) @@ -106,7 +106,7 @@ SkyDive::ungrab(MovingObject& object, Direction dir_) else m_physic.set_velocity_x(player->get_physic().get_velocity_x() + (player->m_dir == Direction::LEFT ? -330.f : 330.f)); - //handle y-movement + // Handle y-movement based on the player's direction and velocity. m_physic.set_velocity_y(dir_ == Direction::UP ? -500.f : dir_ == Direction::DOWN ? 500.f : player->get_physic().get_velocity_x() != 0.f ? -200.f : 0.f); diff --git a/src/badguy/snail.cpp b/src/badguy/snail.cpp index 02eb5b56b31..107e0fe7289 100644 --- a/src/badguy/snail.cpp +++ b/src/badguy/snail.cpp @@ -29,10 +29,10 @@ namespace { const float SNAIL_KICK_SPEED = 500; const int MAX_SNAIL_SQUISHES = 10; -const float SNAIL_KICK_SPEED_Y = -500; /**< y-velocity gained when kicked */ +const float SNAIL_KICK_SPEED_Y = -500; /**< Y-velocity gained when kicked. */ -const float SNAIL_GUARD_DELAY = 5.f; /**< Time in-between corrupted snail guard states (seconds) */ -const float SNAIL_GUARD_TIME = 3.f; /**< Duration of corrupted snail guard states (seconds) */ +const float SNAIL_GUARD_DELAY = 5.f; /**< Time in-between corrupted snail guard states (seconds). */ +const float SNAIL_GUARD_TIME = 3.f; /**< Duration of corrupted snail guard states (seconds). */ } // namespace @@ -53,7 +53,7 @@ Snail::Snail(const ReaderMapping& reader) : SoundManager::current()->preload("sounds/iceblock_bump.wav"); SoundManager::current()->preload("sounds/stomp.wav"); SoundManager::current()->preload("sounds/kick.wav"); - SoundManager::current()->preload("sounds/dartfire.wav"); // TODO: Specific sounds for snail guard state + SoundManager::current()->preload("sounds/dartfire.wav"); // TODO: Specific sounds for snail guard state. } void @@ -132,7 +132,7 @@ Snail::be_kicked(bool upwards) m_physic.set_velocity_x(m_dir == Direction::LEFT ? -SNAIL_KICK_SPEED : SNAIL_KICK_SPEED); m_physic.set_velocity_y(0); - // start a timer to delay addition of upward movement until we are (hopefully) out from under the player + // Start a timer to delay addition of upward movement until we are (hopefully) out from under the player. if (upwards) kicked_delay_timer.start(0.05f); } @@ -176,7 +176,7 @@ Snail::active_update(float dt_sec) { state = STATE_GUARD; set_action("guard", m_dir); - SoundManager::current()->play("sounds/dartfire.wav", get_pos()); // TODO: Specific sounds for snail guard state + SoundManager::current()->play("sounds/dartfire.wav", get_pos()); // TODO: Specific sounds for snail guard state. m_guard_end_timer.start(SNAIL_GUARD_TIME); } break; @@ -186,7 +186,7 @@ Snail::active_update(float dt_sec) { state = STATE_GUARD_RETRACT; set_action("retract", m_dir, /* loops = */ 1); - SoundManager::current()->play("sounds/dartfire.wav", get_pos()); // TODO: Specific sounds for snail guard state + SoundManager::current()->play("sounds/dartfire.wav", get_pos()); // TODO: Specific sounds for snail guard state. } break; @@ -316,9 +316,9 @@ Snail::collision_player(Player& player, const CollisionHit& hit) return BadGuy::collision_player(player, hit); if (state == STATE_GUARD) - return WalkingBadguy::collision_player(player, hit); // Hurt player on collision + return WalkingBadguy::collision_player(player, hit); // Hurt player on collision. - // handle kicks from left or right side + // Handle kicks from left or right side. if ((state == STATE_WAKING || state == STATE_FLAT) && (hit.left || hit.right)) { if (hit.left) { m_dir = Direction::RIGHT; diff --git a/src/badguy/snowman.cpp b/src/badguy/snowman.cpp index b20b6e82dda..803a6144d31 100644 --- a/src/badguy/snowman.cpp +++ b/src/badguy/snowman.cpp @@ -32,22 +32,22 @@ Snowman::Snowman(const ReaderMapping& reader) : void Snowman::loose_head() { - // replace with Snowball + // Replace with Snowball. Vector snowball_pos = get_pos(); - // Hard-coded values from sprites + // Hard-coded values from sprites. snowball_pos.x += 5; snowball_pos.y += 1; - /* Create death animation for the (now headless) snowman. */ + /* Create a death animation for the (now headless) snowman. */ set_action (m_dir == Direction::LEFT ? "headless-left" : "headless-right", /* loops = */ -1); - set_pos (get_pos () + Vector (-4.0, 19.0)); /* difference in the sprite offsets */ + set_pos (get_pos () + Vector (-4.0, 19.0)); /* Difference in the sprite offsets. */ m_physic.set_velocity_y(0); m_physic.set_acceleration_y(0); m_physic.enable_gravity(true); set_state (STATE_FALLING); m_countMe = false; - /* Create a new snowball where the snowman's head was */ + /* Create a new snowball where the snowman's head was. */ Sector::get().add(snowball_pos, m_dir, m_dead_script); } @@ -55,24 +55,24 @@ HitResponse Snowman::collision_bullet(Bullet& bullet, const CollisionHit& hit) { if (bullet.get_type() == FIRE_BONUS) { - // fire bullets destroy snowman's body + // Fire bullets destroy snowman's body. Vector snowball_pos = get_pos(); - // Hard-coded values from sprites + // Hard-coded values from sprites. snowball_pos.x += 5; snowball_pos.y += 1; - /* Create a new snowball where the snowman's head was */ + /* Create a new snowball where the snowman's head was. */ Sector::get().add(snowball_pos, m_dir, m_dead_script); m_countMe = false; - SoundManager::current()->play("sounds/pop.ogg", get_pos()); // this could be a different sound + SoundManager::current()->play("sounds/pop.ogg", get_pos()); // This could be a different sound. bullet.remove_me(); ignite(); return ABORT_MOVE; } else { - // in all other cases, bullets ricochet + // In all other cases, bullets ricochet. bullet.ricochet(*this, hit); return FORCE_MOVE; } @@ -88,7 +88,7 @@ Snowman::collision_squished(GameObject& object) return true; } - // bounce + // Bounce. if (player) player->bounce(*this); diff --git a/src/badguy/spidermite.cpp b/src/badguy/spidermite.cpp index f6099a955db..d53a3f01c3f 100644 --- a/src/badguy/spidermite.cpp +++ b/src/badguy/spidermite.cpp @@ -53,7 +53,7 @@ SpiderMite::collision_squished(GameObject& object) void SpiderMite::collision_solid(const CollisionHit& hit) { - if (hit.top || hit.bottom) { // hit floor or roof? + if (hit.top || hit.bottom) { // Hit floor or roof? m_physic.set_velocity_y(0); } if (m_frozen) diff --git a/src/badguy/sspiky.cpp b/src/badguy/sspiky.cpp index 01476b74b2c..bca6a086acf 100644 --- a/src/badguy/sspiky.cpp +++ b/src/badguy/sspiky.cpp @@ -73,7 +73,7 @@ SSpiky::active_update(float dt_sec) { bool inReach_bottom = (pb.get_top() <= m_col.m_bbox.get_bottom()); if (inReach_left && inReach_right && inReach_top && inReach_bottom) { - // wake up + // Wake up. set_action("waking", m_dir, 1); state = SSPIKY_WAKING; } @@ -84,7 +84,7 @@ SSpiky::active_update(float dt_sec) { if (state == SSPIKY_WAKING) { if (m_sprite->animation_done()) { - // start walking + // Start walking. state = SSPIKY_WALKING; WalkingBadguy::initialize(); } @@ -97,7 +97,7 @@ void SSpiky::freeze() { WalkingBadguy::freeze(); - state = SSPIKY_WALKING; // if we get hit while sleeping, wake up :) + state = SSPIKY_WALKING; // If we get hit while sleeping, wake up. } bool diff --git a/src/badguy/stalactite.cpp b/src/badguy/stalactite.cpp index ff66d1d50ce..84fe1927c89 100644 --- a/src/badguy/stalactite.cpp +++ b/src/badguy/stalactite.cpp @@ -116,7 +116,7 @@ Stalactite::collision_badguy(BadGuy& other, const CollisionHit& hit) { if (state == STALACTITE_SQUISHED) return FORCE_MOVE; - // ignore other Stalactites + // Ignore other Stalactites. if (dynamic_cast(&other)) return FORCE_MOVE; if (state != STALACTITE_FALLING) return BadGuy::collision_badguy(other, hit); diff --git a/src/badguy/stumpy.cpp b/src/badguy/stumpy.cpp index ffe4c6ce851..25bdf156ada 100644 --- a/src/badguy/stumpy.cpp +++ b/src/badguy/stumpy.cpp @@ -89,7 +89,7 @@ Stumpy::collision_squished(GameObject& object) if (m_frozen) return WalkingBadguy::collision_squished(object); - // if we're still invincible, we ignore the hit + // If we're still invincible, we ignore the hit. if (mystate == STATE_INVINCIBLE) { SoundManager::current()->play("sounds/mr_treehit.ogg", get_pos()); auto player = dynamic_cast(&object); @@ -97,13 +97,13 @@ Stumpy::collision_squished(GameObject& object) return true; } - // if we can die, we do + // If we can die, we do. if (mystate == STATE_NORMAL) { set_action("squished", m_dir); m_col.set_size(m_sprite->get_current_hitbox_width(), m_sprite->get_current_hitbox_height()); kill_squished(object); - // spawn some particles - // TODO: provide convenience function in MovingSprite or MovingObject? + // Spawn some particles. + // TODO: Provide convenience function in MovingSprite or MovingObject? for (int i = 0; i < 25; i++) { Vector ppos = m_col.m_bbox.get_middle(); float angle = graphicsRandom.randf(-math::PI_2, math::PI_2); @@ -123,7 +123,7 @@ Stumpy::collision_squished(GameObject& object) } - //TODO: exception? + // TODO: Handle exception or add relevant logic here. return true; } diff --git a/src/badguy/toad.cpp b/src/badguy/toad.cpp index 81136b23f4f..4fa6ac3ce64 100644 --- a/src/badguy/toad.cpp +++ b/src/badguy/toad.cpp @@ -21,9 +21,9 @@ #include "sprite/sprite.hpp" namespace { -const float VERTICAL_SPEED = -450; /**< y-speed when jumping */ -const float HORIZONTAL_SPEED = 320; /**< x-speed when jumping */ -const float TOAD_RECOVER_TIME = 0.5; /**< time to stand still before starting a (new) jump */ +const float VERTICAL_SPEED = -450; /**< Vertical speed when jumping. */ +const float HORIZONTAL_SPEED = 320; /**< Horizontal speed when jumping. */ +const float TOAD_RECOVER_TIME = 0.5; /**< Time to stand still before starting a (new) jump. */ static const std::string HOP_SOUND = "sounds/hop.ogg"; } @@ -38,7 +38,7 @@ Toad::Toad(const ReaderMapping& reader) : void Toad::initialize() { - // initial state is JUMPING, because we might start airborne + // The initial state is JUMPING, because we might start airborne. state = JUMPING; set_action("jumping", m_dir); } @@ -62,7 +62,7 @@ Toad::set_state(ToadState newState) } else if (newState == FALLING) { Player* player = get_nearest_player(); - // face player + // Face the player. if (player && (player->get_bbox().get_right() < m_col.m_bbox.get_left()) && (m_dir == Direction::RIGHT)) m_dir = Direction::LEFT; if (player && (player->get_bbox().get_left() > m_col.m_bbox.get_right()) && (m_dir == Direction::LEFT)) m_dir = Direction::RIGHT; set_action("idle", m_dir); @@ -84,25 +84,25 @@ Toad::collision_squished(GameObject& object) void Toad::collision_solid(const CollisionHit& hit) { - // default behavior when frozen + // Default behavior when frozen. if (m_frozen || BadGuy::get_state() == STATE_BURNING) { BadGuy::collision_solid(hit); return; } - // just default behaviour (i.e. stop at floor/walls) when squished + // Default behaviour (i.e. stop at floor/walls) when squished. if (BadGuy::get_state() == STATE_SQUISHED) { BadGuy::collision_solid(hit); return; } - // ignore collisions while standing still + // Ignore collisions while standing still. if (state == IDLE) { return; } - // check if we hit left or right while moving in either direction + // Check if we hit left or right while moving in either direction. if (((m_physic.get_velocity_x() < 0) && hit.left) || ((m_physic.get_velocity_x() > 0) && hit.right)) { /* dir = dir == LEFT ? RIGHT : LEFT; @@ -115,13 +115,13 @@ Toad::collision_solid(const CollisionHit& hit) m_physic.set_velocity_x(-0.25f*m_physic.get_velocity_x()); } - // check if we hit the floor while falling + // Check if we hit the floor while falling. if ((state == FALLING) && hit.bottom) { set_state(IDLE); return; } - // check if we hit the roof while climbing + // Check if we hit the roof while climbing. if ((state == JUMPING) && hit.top) { m_physic.set_velocity_y(0); } @@ -131,7 +131,7 @@ Toad::collision_solid(const CollisionHit& hit) HitResponse Toad::collision_badguy(BadGuy& , const CollisionHit& hit) { - // behaviour for badguy collisions is the same as for collisions with solids + // Behaviour for badguy collisions is the same as for collisions with solids. collision_solid(hit); return CONTINUE; @@ -143,13 +143,13 @@ Toad::active_update(float dt_sec) BadGuy::active_update(dt_sec); - // change sprite when we are falling and not frozen + // Change sprite when we are falling and not frozen. if ((state == JUMPING) && (m_physic.get_velocity_y() > 0) && !m_frozen) { set_state(FALLING); return; } - // jump when fully recovered and if not frozen + // Jump when fully recovered and if not frozen. if ((state == IDLE) && (recover_timer.check() && !m_frozen)) { set_state(JUMPING); return; diff --git a/src/badguy/totem.cpp b/src/badguy/totem.cpp index c3b5e42696e..4f2ef48abc2 100644 --- a/src/badguy/totem.cpp +++ b/src/badguy/totem.cpp @@ -82,22 +82,22 @@ Totem::active_update(float dt_sec) initialize(); } - // jump a bit if we find a suitable totem + // Jump slightly if we encounter a suitable totem.// Jump slightly if we encounter a suitable totem. for (auto& obj : Sector::get().get_objects_by_type()) { auto t = dynamic_cast(&obj); if (!t) continue; - // skip if we are not approaching each other + // Skip if we are not approaching each other. if (!((m_dir == Direction::LEFT) && (t->m_dir == Direction::RIGHT))) continue; Vector p1 = m_col.m_bbox.p1(); Vector p2 = t->get_pos(); - // skip if not on same height + // Skip if we are not on the same height. float dy = (p1.y - p2.y); if (fabsf(dy - 0) > 2) continue; - // skip if too far away + // Skip if the totem is too far away. float dx = (p1.x - p2.x); if (fabsf(dx - 128) > 2) continue; @@ -145,18 +145,18 @@ Totem::collision_solid(const CollisionHit& hit) { update_on_ground_flag(hit); - // if we are being carried around, pass event to bottom of stack and ignore it + // If we are being carried around: pass event to bottom of stack and ignore it. if (carried_by) { carried_by->collision_solid(hit); return; } - // If we hit something from above or below: stop moving in this direction + // If we hit something from above or below: stop moving in this direction. if (hit.top || hit.bottom) { m_physic.set_velocity_y(0); } - // If we are hit from the direction we are facing: turn around + // If we are hit from the direction we are facing: turn around. if (hit.left && (m_dir == Direction::LEFT)) { m_dir = Direction::RIGHT; initialize(); @@ -170,13 +170,13 @@ Totem::collision_solid(const CollisionHit& hit) HitResponse Totem::collision_badguy(BadGuy& badguy, const CollisionHit& hit) { - // if we are being carried around, pass event to bottom of stack and ignore it + // If we are being carried around: pass event to bottom of stack and ignore it. if (carried_by) { carried_by->collision_badguy(badguy, hit); return CONTINUE; } - // if we hit a Totem that is not from our stack: have our base jump on its top + // If we hit a Totem that is not from our stack: have our base jump on its top. auto totem = dynamic_cast(&badguy); if (totem) { auto thisBase = this; while (thisBase->carried_by) thisBase=thisBase->carried_by; @@ -187,7 +187,7 @@ Totem::collision_badguy(BadGuy& badguy, const CollisionHit& hit) } } - // If we are hit from the direction we are facing: turn around + // If we are hit from the direction we are facing: turn around. if (hit.left && (m_dir == Direction::LEFT)) { m_dir = Direction::RIGHT; initialize(); @@ -213,7 +213,7 @@ void Totem::jump_on(Totem* target) { if (target->carrying) { - log_warning << "target is already carrying someone" << std::endl; + log_warning << "Target is already carrying someone." << std::endl; return; } @@ -231,7 +231,7 @@ Totem::jump_on(Totem* target) void Totem::jump_off() { if (!carried_by) { - log_warning << "not carried by anyone" << std::endl; + log_warning << "Not carried by anyone." << std::endl; return; } diff --git a/src/badguy/treewillowisp.cpp b/src/badguy/treewillowisp.cpp index 6541e31cd48..b147d881f2c 100644 --- a/src/badguy/treewillowisp.cpp +++ b/src/badguy/treewillowisp.cpp @@ -86,7 +86,7 @@ TreeWillOWisp::start_sucking(const Vector& suck_target_) HitResponse TreeWillOWisp::collision_player(Player& player, const CollisionHit& hit) { - //TODO: basically a no-op. Remove if this doesn't change. + // TODO: This function is essentially a no-op. Remove if it doesn't change the behavior. return BadGuy::collision_player(player, hit); } @@ -112,7 +112,7 @@ TreeWillOWisp::draw(DrawingContext& context) void TreeWillOWisp::active_update(float dt_sec) { - // remove TreeWillOWisp if it has completely vanished + // Remove the TreeWillOWisp if it has completely vanished. if (mystate == STATE_VANISHING) { if (m_sprite->animation_done()) { remove_me(); @@ -136,7 +136,7 @@ TreeWillOWisp::active_update(float dt_sec) Vector newpos(m_start_position + Vector(sinf(angle) * radius, 0)); m_col.set_movement(newpos - get_pos()); float sizemod = cosf(angle) * 0.8f; - /* TODO: modify sprite size */ + /* TODO: Modify sprite size using the 'sizeMod' value. */ sound_source->set_position(get_pos()); diff --git a/src/badguy/viciousivy.cpp b/src/badguy/viciousivy.cpp index 644fc97fcf1..15ddff13fc6 100644 --- a/src/badguy/viciousivy.cpp +++ b/src/badguy/viciousivy.cpp @@ -104,7 +104,7 @@ ViciousIvy::collision_squished(GameObject& object) return WalkingBadguy::collision_squished(object); set_action("squished", m_dir); - // Spawn death particles + // Spawn death particles. spawn_explosion_sprites(3, "images/particles/viciousivy.sprite"); kill_squished(object); return true; diff --git a/src/badguy/walkingleaf.cpp b/src/badguy/walkingleaf.cpp index ab2e60e76ca..b34144fa8d1 100644 --- a/src/badguy/walkingleaf.cpp +++ b/src/badguy/walkingleaf.cpp @@ -89,7 +89,7 @@ WalkingLeaf::collision_squished(GameObject& object) return WalkingBadguy::collision_squished(object); set_action("squished", m_dir); - // Spawn death particles + // Spawn death particles. spawn_explosion_sprites(3, "images/particles/walkingleaf.sprite"); kill_squished(object); return true; diff --git a/src/badguy/willowisp.cpp b/src/badguy/willowisp.cpp index 83a36c40544..9c0debd76c4 100644 --- a/src/badguy/willowisp.cpp +++ b/src/badguy/willowisp.cpp @@ -28,9 +28,9 @@ #include "util/reader_mapping.hpp" #include "util/writer.hpp" -static const float FLYSPEED = 64.0f; /**< speed in px per second */ -static const float TRACK_RANGE = 384.0f; /**< at what distance to start tracking the player */ -static const float VANISH_RANGE = 512.0f; /**< at what distance to stop tracking and vanish */ +static const float FLYSPEED = 64.0f; /**< Speed in pixels per second. */ +static const float TRACK_RANGE = 384.0f; /**< Distance at which to start tracking the player. */ +static const float VANISH_RANGE = 512.0f; /**< Distance at which to stop tracking and vanish. */ static const std::string SOUNDFILE = "sounds/willowisp.wav"; WillOWisp::WillOWisp(const ReaderMapping& reader) : diff --git a/src/badguy/yeti.cpp b/src/badguy/yeti.cpp index 319ef588e42..f3a6b553c85 100644 --- a/src/badguy/yeti.cpp +++ b/src/badguy/yeti.cpp @@ -29,29 +29,30 @@ #include "util/reader_mapping.hpp" #include "video/surface.hpp" -namespace { -const float JUMP_DOWN_VX = 250; /**< horizontal speed while jumping off the dais */ -const float JUMP_DOWN_VY = -250; /**< vertical speed while jumping off the dais */ +namespace +{ +const float JUMP_DOWN_VX = 250; /**< Horizontal speed while jumping off the dais. */ +const float JUMP_DOWN_VY = -250; /**< Vertical speed while jumping off the dais. */ -const float RUN_VX = 350; /**< horizontal speed while running */ +const float RUN_VX = 350; /**< Horizontal speed while running. */ -const float JUMP_UP_VX = 350; /**< horizontal speed while jumping on the dais */ -const float JUMP_UP_VY = -700; /**< vertical speed while jumping on the dais */ +const float JUMP_UP_VX = 350; /**< Horizontal speed while jumping on the dais. */ +const float JUMP_UP_VY = -700; /**< Vertical speed while jumping on the dais. */ -const float STOMP_VY = -300; /** vertical speed while stomping on the dais */ +const float STOMP_VY = -300; /**< Vertical speed while stomping on the dais. */ -const float RUN_DISTANCE = 1060; /** Distance between the x-coordinates of left and right end positions */ -const float JUMP_SPACE = 448; /** Distance between jump position and stand position */ -const float STOMP_WAIT = .5; /**< time we stay on the dais before jumping again */ -const float SAFE_TIME = .5; /**< the time we are safe when tux just hit us */ -const int INITIAL_HITPOINTS = 5; /**< number of hits we can take */ +const float RUN_DISTANCE = 1060; /**< Distance between the x-coordinates of left and right end positions. */ +const float JUMP_SPACE = 448; /**< Distance between the jump position and the stand position. */ +const float STOMP_WAIT = 0.5; /**< Time we stay on the dais before jumping again. */ +const float SAFE_TIME = 0.5; /**< The time we are safe when Tux just hit us. */ +const int INITIAL_HITPOINTS = 5; /**< Number of hits we can take. */ const float YETI_SQUISH_TIME = 3; -const float SNOW_EXPLOSIONS_FREQUENCY = 8; /**< number of snowball explosions per second */ -const int SNOW_EXPLOSIONS_COUNT = 5; /**< number of snowballs per explosion */ -const float SNOW_EXPLOSIONS_VX = 150; /**< Speed of snowballs */ -const float SNOW_EXPLOSIONS_VY = -200; /**< Speed of snowballs */ +const float SNOW_EXPLOSIONS_FREQUENCY = 8; /**< Number of snowball explosions per second. */ +const int SNOW_EXPLOSIONS_COUNT = 5; /**< Number of snowballs per explosion. */ +const float SNOW_EXPLOSIONS_VX = 150; /**< Speed of snowballs. */ +const float SNOW_EXPLOSIONS_VY = -200; /**< Speed of snowballs. */ } Yeti::Yeti(const ReaderMapping& reader) : @@ -115,7 +116,7 @@ Yeti::recalculate_pos() void Yeti::draw(DrawingContext& context) { - // we blink when we are safe + // We blink when we are safe. if (safe_timer.started() && size_t(g_game_time * 40) % 2) return; @@ -178,8 +179,8 @@ Yeti::active_update(float dt_sec) if (state_timer.check()) { BadGuy::kill_fall(); state = FALLING; - m_physic.set_velocity_y(JUMP_UP_VY / 2); // Move up a bit before falling - // Add some extra explosions + m_physic.set_velocity_y(JUMP_UP_VY / 2); // Move up a bit before falling. + // Add some extra explosions. for (int i = 0; i < 10; i++) { add_snow_explosions(); } @@ -223,7 +224,7 @@ Yeti::jump_up() void Yeti::be_angry() { - //turn around + // Turn around. m_dir = (m_dir==Direction::RIGHT) ? Direction::LEFT : Direction::RIGHT; set_action("stand", m_dir); @@ -260,7 +261,7 @@ void Yeti::take_hit(Player& ) hit_points--; if (hit_points <= 0) { - // We're dead + // We're dead. m_physic.set_velocity_x(((m_dir==Direction::RIGHT)?+RUN_VX:-RUN_VX)/5); m_physic.set_velocity_y(0); @@ -270,7 +271,7 @@ void Yeti::take_hit(Player& ) state = SQUISHED; state_timer.start(YETI_SQUISH_TIME); set_colgroup_active(COLGROUP_MOVING_ONLY_STATIC); - //sprite->set_action("dead"); // This sprite does not look very good + // sprite->setAction("dead"); } else { safe_timer.start(SAFE_TIME); @@ -280,13 +281,13 @@ void Yeti::take_hit(Player& ) void Yeti::kill_fall() { - // shooting bullets or being invincible won't work :) + // Shooting bullets or being invincible won't prevent this action. } void Yeti::drop_stalactite() { - // make a stalactite falling down and shake camera a bit + // Make a stalactite fall down and shake the camera a bit. Sector::get().get_camera().shake(.1f, 0, 20.f); auto player = get_nearest_player(); @@ -296,14 +297,14 @@ Yeti::drop_stalactite() { if (stalactite.is_hanging()) { if (hit_points >= 3) { - // drop stalactites within 3 of player, going out with each jump + // Drop stalactites within 3 units of player, going out with each jump. float distancex = fabsf(stalactite.get_bbox().get_middle().x - player->get_bbox().get_middle().x); if (distancex < static_cast(stomp_count) * 32.0f) { stalactite.start_shaking(); } } else { /* if (hitpoints < 3) */ - // drop every 3rd pair of stalactites + // Drop every 3rd pair of stalactites. if ((((static_cast(stalactite.get_pos().x) + 16) / 64) % 3) == (stomp_count % 3)) { stalactite.start_shaking(); } @@ -317,7 +318,7 @@ Yeti::collision_solid(const CollisionHit& hit) { update_on_ground_flag(hit); if (hit.top || hit.bottom) { - // hit floor or roof + // Hit floor or roof. m_physic.set_velocity_y(0); switch (state) { case JUMP_DOWN: @@ -328,17 +329,17 @@ Yeti::collision_solid(const CollisionHit& hit) case JUMP_UP: break; case BE_ANGRY: - // we just landed + // We just landed. if (!state_timer.started()) { set_action("stand", m_dir); stomp_count++; drop_stalactite(); - // go to other side after 3 jumps + // Go to the other side after 3 jumps. if (stomp_count == 3) { jump_down(); } else { - // jump again + // Jump again. state_timer.start(STOMP_WAIT); } } @@ -349,7 +350,7 @@ Yeti::collision_solid(const CollisionHit& hit) break; } } else if (hit.left || hit.right) { - // hit wall + // Hit wall. if(state != SQUISHED && state != FALLING) jump_up(); } diff --git a/src/supertux/menu/editor_levelset_select_menu.cpp b/src/supertux/menu/editor_levelset_select_menu.cpp index 52694405d66..a3c8aff6cdf 100644 --- a/src/supertux/menu/editor_levelset_select_menu.cpp +++ b/src/supertux/menu/editor_levelset_select_menu.cpp @@ -86,7 +86,7 @@ EditorLevelsetSelectMenu::initialize() } if (!world->is_levelset() && !world->is_worldmap()) { - log_warning << level_world << ": unknown World type" << std::endl; + log_warning << level_world << ": unknown World type." << std::endl; continue; } auto title = world->get_title();