[Super-tux-commit] supertux/src world.cpp,1.40,1.41 world.h,1.30,1.31 worldmap.cpp,1.50,1.51
Brought to you by:
wkendrick
From: Ingo R. <gr...@us...> - 2004-04-26 10:46:55
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10768 Modified Files: world.cpp world.h worldmap.cpp Log Message: - added bonus loading Index: world.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- world.h 22 Apr 2004 19:15:22 -0000 1.30 +++ world.h 26 Apr 2004 10:46:45 -0000 1.31 @@ -111,6 +111,10 @@ /** Try to bumb a badguy that might we walking above Tux, thus shaking the tile which the badguy is walking on an killing him this way */ void trybumpbadguy(float x, float y); + + /** Apply bonuses active in the player status, used to reactivate + bonuses from former levels */ + void apply_bonuses(); }; /** FIMXE: Workaround for the leveleditor mainly */ Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- worldmap.cpp 26 Apr 2004 10:03:34 -0000 1.50 +++ worldmap.cpp 26 Apr 2004 10:46:45 -0000 1.51 @@ -615,6 +615,7 @@ break; case GameSession::GAME_OVER: quit = true; + player_status.bonus = PlayerStatus::NO_BONUS; break; case GameSession::NONE: // Should never be reached @@ -863,12 +864,15 @@ { Point p; std::string back_str = "none"; + std::string bonus_str = "none"; LispReader tux_reader(tux_cur); tux_reader.read_int("x", &p.x); tux_reader.read_int("y", &p.y); tux_reader.read_string("back", &back_str); + tux_reader.read_string("bonus", &bonus_str); + player_status.bonus = string_to_bonus(bonus_str); tux->back_direction = string_to_direction(back_str); tux->set_tile_pos(p); } Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- world.cpp 24 Apr 2004 14:49:04 -0000 1.40 +++ world.cpp 26 Apr 2004 10:46:42 -0000 1.41 @@ -52,6 +52,8 @@ activate_bad_guys(); activate_particle_systems(); get_level()->load_song(); + + apply_bonuses(); } World::World(const std::string& subset, int level_nr) @@ -69,6 +71,32 @@ activate_bad_guys(); activate_particle_systems(); get_level()->load_song(); + + apply_bonuses(); +} + +void +World::apply_bonuses() +{ + std::cout << "Bonus: " << player_status.bonus << std::endl; + + // Apply bonuses from former levels + switch (player_status.bonus) + { + case PlayerStatus::NO_BONUS: + break; + + case PlayerStatus::FLOWER_BONUS: + tux.got_coffee = true; + // fall through + + case PlayerStatus::GROWUP_BONUS: + // FIXME: Move this to Player class + tux.size = BIG; + tux.base.height = 64; + tux.base.y -= 32; + break; + } } World::~World() |