From: Ricardo Cruz Date: Sat, 13 Mar 2004 18:51:29 +0000 (+0000) Subject: Cleanups in credits: X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5b57119a297d1420821a7060a0a8eed5f17f2314;p=supertux.git Cleanups in credits: made defines, instead of hard coded values and made a max velocity. SVN-Revision: 204 --- diff --git a/src/title.c b/src/title.c index f687a89b7..3407a4549 100644 --- a/src/title.c +++ b/src/title.c @@ -278,6 +278,10 @@ int title(void) return(quit); } +#define MAX_VEL 10 +#define SPEED 1 +#define SCROLL 60 + void display_credits() { int done; @@ -313,7 +317,7 @@ void display_credits() timer_start(&timer, 50); scroll = 0; - speed = 1; + speed = 2; done = 0; n = d = 0; @@ -331,16 +335,16 @@ void display_credits() case SDL_KEYDOWN: switch(event.key.keysym.sym) { - case SDLK_DOWN: - speed -= 1; - break; case SDLK_UP: - speed += 1; + speed -= SPEED; + break; + case SDLK_DOWN: + speed += SPEED; break; case SDLK_SPACE: case SDLK_RETURN: if(speed >= 0) - scroll += 60; + scroll += SCROLL; break; case SDLK_ESCAPE: done = 1; @@ -356,6 +360,11 @@ void display_credits() break; } + if(speed > MAX_VEL) + speed = MAX_VEL; + else if(speed < -MAX_VEL) + speed = -MAX_VEL; + /* draw the credits */ draw_background();