#define MAX_RUN_XM 3.2
#define MAX_YM 20.0
#define MAX_JUMP_TIME 375
-#define MAX_LIVES 4.0
+#define MAX_LIVES 99
#define WALK_SPEED 1.0
#define RUN_SPEED 1.5
// Check End conditions
if (tux->is_dead())
{
-
+ player_status.lives -= 1;
+
if (player_status.lives < 0)
{ // No more lives!?
if(st_gl_mode != ST_GL_TEST)
if(st_gl_mode != ST_GL_TEST)
{
- if (player_status.score > hs_score)
- save_hs(player_status.score);
+ // FIXME: highscore soving doesn't make sense in its
+ // current form
+ //if (player_status.score > hs_score)
+ //save_hs(player_status.score);
}
exit_status = GAME_OVER;
case 2:
st_pause_ticks_stop();
break;
- case 3:
- // FIXME:
- //update_load_save_game_menu(save_game_menu);
- break;
- case 4:
- update_load_save_game_menu(load_game_menu);
- break;
- case 7:
+ case 5:
st_pause_ticks_stop();
exit_status = LEVEL_ABORT;
break;
// FIXME: Hack for restarting the level
std::string subset;
+ public:
enum ExitStatus { NONE, LEVEL_FINISHED, GAME_OVER, LEVEL_ABORT };
+ private:
ExitStatus exit_status;
public:
+
Timer time_left;
GameSession(const std::string& subset, int levelnb, int mode);
save_game_menu->additem(MN_HL,"",0,0);
save_game_menu->additem(MN_BACK,"Back",0,0);
- game_menu->additem(MN_LABEL,"InGame Menu",0,0);
+ game_menu->additem(MN_LABEL,"Pause",0,0);
game_menu->additem(MN_HL,"",0,0);
- game_menu->additem(MN_ACTION,"Return To Game",0,0);
- game_menu->additem(MN_GOTO,"Save Game",0,save_game_menu);
- game_menu->additem(MN_GOTO,"Load Game",0,load_game_menu);
+ game_menu->additem(MN_ACTION,"Continue",0,0);
game_menu->additem(MN_GOTO,"Options",0,options_menu);
game_menu->additem(MN_HL,"",0,0);
- game_menu->additem(MN_ACTION,"Quit Game",0,0);
+ game_menu->additem(MN_ACTION,"Abort Level",0,0);
- worldmap_menu->additem(MN_LABEL,"Worldmap Menu",0,0);
+ worldmap_menu->additem(MN_LABEL,"Pause",0,0);
worldmap_menu->additem(MN_HL,"",0,0);
- worldmap_menu->additem(MN_ACTION,"Return To Game",0,0);
+ worldmap_menu->additem(MN_ACTION,"Continue",0,0);
+ worldmap_menu->additem(MN_ACTION,"Save",0,0);
worldmap_menu->additem(MN_GOTO,"Options",0,options_menu);
worldmap_menu->additem(MN_HL,"",0,0);
worldmap_menu->additem(MN_ACTION,"Quit Game",0,0);
char slotfile[1024];
snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot-1);
-
+
+ // Load the game or at least set the savegame_file variable
worldmap.loadgame(slotfile);
worldmap.display();
{
if (enter_level && !tux->is_moving())
{
- for(Levels::iterator i = levels.begin(); i != levels.end(); ++i)
+ Level* level = at_level();
+ if (level)
{
- if (i->x == tux->get_tile_pos().x &&
- i->y == tux->get_tile_pos().y)
+ if (level->x == tux->get_tile_pos().x &&
+ level->y == tux->get_tile_pos().y)
{
- std::cout << "Enter the current level: " << i->name << std::endl;;
+ std::cout << "Enter the current level: " << level->name << std::endl;;
halt_music();
- GameSession session(datadir + "levels/" + i->name,
+
+ GameSession session(datadir + "levels/" + level->name,
1, ST_GL_LOAD_LEVEL_FILE);
- session.run();
- if (1) // FIXME: insert exit status checker here
- i->solved = true;
+ switch (session.run())
+ {
+ case GameSession::LEVEL_FINISHED:
+ level->solved = true;
+ break;
+ case GameSession::LEVEL_ABORT:
+ // Reseting the player_status might be a worthy
+ // consideration, but I don't think we need it
+ // 'cause only the bad players will use it to
+ // 'cheat' a few items and that isn't necesarry a
+ // bad thing (ie. better they continue that way,
+ // then stop playing the game all together since it
+ // is to hard)
+ break;
+ case GameSession::GAME_OVER:
+ quit = true;
+ break;
+ case GameSession::NONE:
+ // Should never be reached
+ break;
+ }
play_music(song, 1);
show_menu = 0;
return;
}
}
- std::cout << "Nothing to enter at: "
- << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << std::endl;
+ else
+ {
+ std::cout << "Nothing to enter at: "
+ << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << std::endl;
+ }
}
else
{
case 2: // Return to game
menu_reset();
break;
- case 5: // Quit Worldmap
+ case 3:
+ if (!savegame_file.empty())
+ savegame(savegame_file);
+ break;
+
+ case 6: // Quit Worldmap
quit = true;
break;
}
SDL_Delay(20);
}
+ halt_music();
free_music(song);
}
reader.read_int("score", &player_status.score);
reader.read_int("distros", &player_status.distros);
+ if (player_status.lives < 0)
+ player_status.lives = 3;
+
lisp_object_t* tux_cur = 0;
if (reader.read_lisp("tux", &tux_cur))
{
} // namespace WorldMapNS
-/* EOF */
+/* Local Variables: */
+/* mode:c++ */
+/* End: */
+