/* Calculate the movement-factor */
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(!timer_check(&frame_timer))
{
}
if(debug_mode && debug_fps == YES)
- SDL_Delay(50);
+ SDL_Delay(60);
/*Draw the current scene to the screen */
/*If the machine running the game is too slow
if (fi == NULL)
{
- fprintf(stderr, "Warning: I could not open the high score file ");
+ fprintf(stderr, "Warning: Unable to open the high score file ");
if (strcmp(mode, "r") == 0)
fprintf(stderr, "for read!!!\n");
FILE * fi;
char temp[128];
int c, i, strl;
-
+
hs_score = 100;
strcpy(hs_name, "Grandma\0");
c = 0;
strl = strlen("name=");
for(c = strl, i = 0; c < strlen(temp); ++c, ++i)
hs_name[i] = temp[c];
- hs_name[i]= '\0';
+ hs_name[i]= '\0';
}
}
}
SDL_Event event;
FILE * fi;
-
+
texture_load(&bkgd, DATA_PREFIX "/images/highscore/highscore.png", IGNORE_ALPHA);
hs_score = score;
menu_set_current(&highscore_menu);
if(!highscore_menu.item[0].input)
- highscore_menu.item[0].input = (char*) malloc(strlen(hs_name) + 1);
-
+ highscore_menu.item[0].input = (char*) malloc(strlen(hs_name) + 1);
+
strcpy(highscore_menu.item[0].input,hs_name);
/* ask for player's name */
{
struct stat filestat;
if (stat(filename, &filestat) == -1)
- {
- return NO;
- }
- else
- {
- if(S_ISREG(filestat.st_mode))
- return YES;
+ {
+ return NO;
+ }
else
- return NO;
- }
+ {
+ if(S_ISREG(filestat.st_mode))
+ return YES;
+ else
+ return NO;
+ }
}
/* Can we write to this location? */
strlen("/.supertux") + 1));
strcpy(st_dir, home);
strcat(st_dir, "/.supertux");
-
+
/* Remove .supertux config-file from old SuperTux versions */
if(faccessible(st_dir))
- {
- remove(st_dir);
- }
+ {
+ remove
+ (st_dir);
+ }
st_save_dir = (char *) malloc(sizeof(char) * (strlen(st_dir) + strlen("/save") + 1));
else
{
if(game_started == NO)
- {
- gameloop("default",slot - 1,ST_GL_LOAD_GAME);
- show_menu = YES;
- menu_set_current(&main_menu);
- }
+ {
+ gameloop("default",slot - 1,ST_GL_LOAD_GAME);
+ show_menu = YES;
+ menu_set_current(&main_menu);
+ }
else
loadgame(slot - 1);
}
texture_free(&back);
texture_free(&arrow_left);
texture_free(&arrow_right);
-
+
/* Free menus */
menu_free(&main_menu);
use_sound = NO;
#else
- printf("Warning: Sounds feature is not compiled in \n");
+ printf("Warning: Sound capability has not been compiled into this build.\n");
#endif
}