April 11, 2000 - March 15, 2004
*/
+#include <iostream>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
while (SDL_PollEvent(&event))
{
/* Check for menu-events, if the menu is shown */
- if(show_menu)
- current_menu->event(event);
+ current_menu->event(event);
switch(event.type)
{
{
exit_status = LEVEL_ABORT;
}
- else if(show_menu)
+ else if(!show_menu)
{
Menu::set_current(game_menu);
show_menu = 0;
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())
{
// 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;
}