Attempt to avoid framerate bug when paused

This commit is contained in:
Rob Pearce 2008-12-03 00:38:14 +00:00
parent 1c04cc5be7
commit f2a4863425
1 changed files with 14 additions and 8 deletions

22
rc.c
View File

@ -952,7 +952,9 @@ int main (int argc, char **argv) {
void tick(void) { void tick(void) {
sprite_t *s; sprite_t *s;
SDL_framerateDelay(&manager); if (!paused) {
SDL_framerateDelay(&manager);
}
if (paused) return; if (paused) return;
@ -5263,7 +5265,9 @@ void drawlevel(void) {
// update screen // update screen
//SDL_GL_SwapBuffers(); //SDL_GL_SwapBuffers();
SDL_UpdateRect(screen, 0,0,640,480); SDL_UpdateRect(screen, 0,0,640,480);
SDL_framerateDelay(&manager); if (!paused) {
SDL_framerateDelay(&manager);
}
// remove players // remove players
if (curlevelnum != INTRO_LEVELNUM) { if (curlevelnum != INTRO_LEVELNUM) {
@ -5362,7 +5366,7 @@ void drawlevel(void) {
// update screen // update screen
//SDL_GL_SwapBuffers(); //SDL_GL_SwapBuffers();
SDL_UpdateRect(screen, 0,0,640,480); SDL_UpdateRect(screen, 0,0,640,480);
SDL_framerateDelay(&manager); if (!paused) SDL_framerateDelay(&manager);
// remove players // remove players
if (curlevelnum != INTRO_LEVELNUM) { if (curlevelnum != INTRO_LEVELNUM) {
@ -5460,7 +5464,7 @@ void drawlevel(void) {
// update screen // update screen
//SDL_GL_SwapBuffers(); //SDL_GL_SwapBuffers();
SDL_UpdateRect(screen, 0,0,640,480); SDL_UpdateRect(screen, 0,0,640,480);
SDL_framerateDelay(&manager); if (!paused) SDL_framerateDelay(&manager);
// remove players // remove players
@ -5559,7 +5563,7 @@ void drawlevel(void) {
// update screen // update screen
//SDL_GL_SwapBuffers(); //SDL_GL_SwapBuffers();
SDL_UpdateRect(screen, 0,0,640,480); SDL_UpdateRect(screen, 0,0,640,480);
SDL_framerateDelay(&manager); if (!paused) SDL_framerateDelay(&manager);
// remove players // remove players
if (curlevelnum != INTRO_LEVELNUM) { if (curlevelnum != INTRO_LEVELNUM) {
@ -8921,8 +8925,10 @@ void togglefullscreen(void) {
// redraw background // redraw background
SDL_BlitSurface(temps, NULL, screen, NULL); SDL_BlitSurface(temps, NULL, screen, NULL);
/* redo framerate manager */ if (!paused) {
SDL_setFramerate(&manager, WANTFPS); /* redo framerate manager */
SDL_setFramerate(&manager, WANTFPS);
}
} }
void initsdl(void) { void initsdl(void) {
@ -11543,7 +11549,7 @@ void checkhiscores(sprite_t *who){
} }
} }
SDL_framerateDelay(&manager); if (!paused) SDL_framerateDelay(&manager);
SDL_UpdateRect(screen, 0,0,640,480); SDL_UpdateRect(screen, 0,0,640,480);
} }