Cleanups in credits:
authorRicardo Cruz <rick2@aeiou.pt>
Sat, 13 Mar 2004 18:51:29 +0000 (18:51 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Sat, 13 Mar 2004 18:51:29 +0000 (18:51 +0000)
made defines, instead of hard coded values
and made a max velocity.

SVN-Revision: 204

src/title.c

index f687a89..3407a45 100644 (file)
@@ -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();