April 11, 2000 - March 15, 2004
*/
+#include <iostream>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
fps_timer.init(true);
frame_timer.init(true);
+ delete world;
+
if (st_gl_mode == ST_GL_LOAD_LEVEL_FILE)
{
world = new World(subset);
// 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;
if (exit_status == NONE)
{
- Player* tux = world->get_tux();
-
// Update Tux and the World
- tux->action(frame_ratio);
world->action(frame_ratio);
}
}
draw();
+ float overlap = 0.0f;
while (exit_status == NONE)
{
/* Calculate the movement-factor */
double frame_ratio = ((double)(update_time-last_update_time))/((double)FRAME_RATE);
- if(frame_ratio > 1.5) /* Quick hack to correct the unprecise CPU clocks a little bit. */
- frame_ratio = 1.5 + (frame_ratio - 1.5) * 0.85;
if(!frame_timer.check())
{
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;
// Handle actions:
if(!game_pause && !show_menu)
{
- action(frame_ratio);
+ frame_ratio *= game_speed;
+ frame_ratio += overlap;
+ while (frame_ratio > 0)
+ {
+ action(1.0f);
+ frame_ratio -= 1.0f;
+ }
+ overlap = frame_ratio;
+
if (exit_status != NONE)
return exit_status;
}