From 4eab056837b0f26d0163a7ab2d0cc1addedcb0af Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Sun, 25 Apr 2004 23:46:30 +0000 Subject: [PATCH] - tweaked bullet and endsequence SVN-Revision: 727 --- src/gameloop.cpp | 14 +++++++------- src/gameloop.h | 2 +- src/level.cpp | 2 +- src/special.cpp | 5 ++++- src/special.h | 1 + 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/gameloop.cpp b/src/gameloop.cpp index d956b227e..c12d9da2a 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -58,7 +58,7 @@ GameSession* GameSession::current_ = 0; GameSession::GameSession(const std::string& subset_, int levelnb_, int mode) - : world(0), st_gl_mode(mode), levelnb(levelnb_), end_sequenze(false), + : world(0), st_gl_mode(mode), levelnb(levelnb_), end_sequence(false), subset(subset_) { current_ = this; @@ -77,7 +77,7 @@ GameSession::restart_level() { game_pause = false; exit_status = NONE; - end_sequenze = false; + end_sequence = false; fps_timer.init(true); frame_timer.init(true); @@ -195,7 +195,7 @@ GameSession::on_escape_press() void GameSession::process_events() { - if (end_sequenze) + if (end_sequence) { Player& tux = *world->get_tux(); @@ -378,13 +378,13 @@ GameSession::check_end_conditions() Player* tux = world->get_tux(); /* End of level? */ - if (tux->base.x >= World::current()->get_level()->endpos + 320) + if (tux->base.x >= World::current()->get_level()->endpos + 32 * (get_level()->use_endsequence ? 22 : 10)) { exit_status = LEVEL_FINISHED; } - else if (tux->base.x >= World::current()->get_level()->endpos && !end_sequenze) + else if (tux->base.x >= World::current()->get_level()->endpos && !end_sequence) { - end_sequenze = true; + end_sequence = true; last_x_pos = -1; music_manager->halt_music(); } @@ -528,7 +528,7 @@ GameSession::run() while (frame_ratio > 0) { // Update the world - if (end_sequenze) + if (end_sequence) action(.5f); else action(1.0f); diff --git a/src/gameloop.h b/src/gameloop.h index 43f8ef114..7f25998e9 100644 --- a/src/gameloop.h +++ b/src/gameloop.h @@ -58,7 +58,7 @@ class GameSession /** If true the end_sequence will be played, user input will be ignored while doing that */ - bool end_sequenze; + bool end_sequence; float last_x_pos; bool game_pause; diff --git a/src/level.cpp b/src/level.cpp index 4bdf1b40a..9cb8dda27 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -499,7 +499,7 @@ Level::load(const std::string& filename) // FIXME: -10 is a rather random value, we still need some kind of // real levelend gola if (use_endsequence) - endpos = 32*(width-20); + endpos = 32*(width-30); else endpos = 32*(width-15); diff --git a/src/special.cpp b/src/special.cpp index 4eed30420..fe559fb38 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -45,6 +45,7 @@ Sprite* img_1up; void Bullet::init(float x, float y, float xm, Direction dir) { + life_count = 3; base.width = 4; base.height = 4; @@ -99,6 +100,7 @@ Bullet::action(double frame_ratio) base.ym = 9; else if (base.ym < -9) base.ym = -9; + life_count -= 1; } base.ym = base.ym + 0.5 * frame_ratio; @@ -108,7 +110,8 @@ Bullet::action(double frame_ratio) base.y < 0 || base.y > screen->h || issolid(base.x + 4, base.y + 2) || - issolid(base.x, base.y + 2)) + issolid(base.x, base.y + 2) || + life_count <= 0) { remove_me(); } diff --git a/src/special.h b/src/special.h index 1cdbc4cea..a29794490 100644 --- a/src/special.h +++ b/src/special.h @@ -65,6 +65,7 @@ private: class Bullet { public: + int life_count; base_type base; base_type old_base; -- 2.11.0