Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2607
Modified Files:
gameloop.cpp player.cpp scene.cpp scene.h worldmap.cpp
Log Message:
- added saving of bonuses on worldmap, no loading yet
Index: scene.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/scene.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- scene.cpp 22 Apr 2004 20:41:40 -0000 1.24
+++ scene.cpp 26 Apr 2004 10:03:34 -0000 1.25
@@ -27,8 +27,34 @@
: score(0),
distros(0),
lives(START_LIVES),
- score_multiplier(1)
+ score_multiplier(1),
+ bonus(NO_BONUS)
+{
+}
+
+std::string bonus_to_string(PlayerStatus::BonusType b)
+{
+ switch (b)
+ {
+ case PlayerStatus::NO_BONUS:
+ return "none";
+ case PlayerStatus::GROWUP_BONUS:
+ return "growup";
+ case PlayerStatus::FLOWER_BONUS:
+ return "icflower";
+ }
+}
+
+PlayerStatus::BonusType string_to_bonus(const std::string& str)
{
+ if (str == "none")
+ return PlayerStatus::NO_BONUS;
+ else if (str == "growup")
+ return PlayerStatus::GROWUP_BONUS;
+ else if (str == "iceflower")
+ return PlayerStatus::FLOWER_BONUS;
+ else
+ return PlayerStatus::NO_BONUS;
}
// FIXME: Move this into a view class
Index: player.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- player.cpp 25 Apr 2004 22:10:30 -0000 1.65
+++ player.cpp 26 Apr 2004 10:03:34 -0000 1.66
@@ -440,7 +440,7 @@
}
/* Duck! */
- if (input.down == DOWN && size == BIG && !duck && physic.get_velocity_y() == 0)
+ if (input.down == DOWN && size == BIG && !duck && physic.get_velocity_y() == 0 && on_ground())
{
duck = true;
base.height = 32;
Index: worldmap.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- worldmap.cpp 25 Apr 2004 21:55:39 -0000 1.49
+++ worldmap.cpp 26 Apr 2004 10:03:34 -0000 1.50
@@ -597,6 +597,12 @@
{
case GameSession::LEVEL_FINISHED:
level->solved = true;
+ if (session.get_world()->get_tux()->got_coffee)
+ player_status.bonus = PlayerStatus::FLOWER_BONUS;
+ else if (session.get_world()->get_tux()->size == BIG)
+ player_status.bonus = PlayerStatus::GROWUP_BONUS;
+ else
+ player_status.bonus = PlayerStatus::NO_BONUS;
break;
case GameSession::LEVEL_ABORT:
// Reseting the player_status might be a worthy
@@ -809,8 +815,9 @@
<< " (lives " << player_status.lives << ")\n"
<< " (score " << player_status.score << ")\n"
<< " (distros " << player_status.distros << ")\n"
- << " (tux (x " << tux->get_tile_pos().x << ") (y " << tux->get_tile_pos().y << ")"
- << " (back \"" << direction_to_string(tux->back_direction) << "\"))\n"
+ << " (tux (x " << tux->get_tile_pos().x << ") (y " << tux->get_tile_pos().y << ")\n"
+ << " (back \"" << direction_to_string(tux->back_direction) << "\")\n"
+ << " (bonus \"" << bonus_to_string(player_status.bonus) << "\"))\n"
<< " (levels\n";
for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
Index: scene.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/scene.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- scene.h 20 Apr 2004 11:09:34 -0000 1.26
+++ scene.h 26 Apr 2004 10:03:34 -0000 1.27
@@ -31,12 +31,17 @@
int score;
int distros;
int lives;
+ enum BonusType { NO_BONUS, GROWUP_BONUS, FLOWER_BONUS };
+ BonusType bonus;
int score_multiplier;
PlayerStatus();
};
+std::string bonus_to_string(PlayerStatus::BonusType b);
+PlayerStatus::BonusType string_to_bonus(const std::string& str);
+
extern PlayerStatus player_status;
extern float scroll_x;
Index: gameloop.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- gameloop.cpp 25 Apr 2004 23:46:29 -0000 1.103
+++ gameloop.cpp 26 Apr 2004 10:03:33 -0000 1.104
@@ -599,9 +599,6 @@
}
}
- delete world;
- world = 0;
-
return exit_status;
}
|