moved savelevel() code to level.h/c where it belongs to. :)
[supertux.git] / src / title.c
index 0c66575..39a99b9 100644 (file)
@@ -30,7 +30,8 @@
 #include "screen.h"
 #include "high_scores.h"
 #include "menu.h"
-#include "type.h"
+#include "texture.h"
+#include "timer.h"
 
 
 /* --- TITLE SCREEN --- */
@@ -40,7 +41,7 @@ int title(void)
   texture_type title, anim1, anim2;
   SDL_Event event;
   SDLKey key;
-  int done, quit, frame, pict, last_highscore;
+  int done, quit, frame, pict;
   char str[80];
 
   game_started = 0;
@@ -73,9 +74,11 @@ int title(void)
 
 
   /* Draw the high score: */
-  last_highscore = load_hs();
-  sprintf(str, "High score: %d", last_highscore);
-  drawcenteredtext(str, 460, letters_red, NO_UPDATE, 1);
+  load_hs();
+  sprintf(str, "High score: %d", hs_score);
+  text_drawf(&gold_text, str, 0, -40, A_HMIDDLE, A_BOTTOM, 1, NO_UPDATE);
+  sprintf(str, "by %s", hs_name);
+  text_drawf(&gold_text, str, 0, -20, A_HMIDDLE, A_BOTTOM, 1, NO_UPDATE);
 
   while (!done && !quit)
     {
@@ -99,7 +102,7 @@ int title(void)
               key = event.key.keysym.sym;
 
               /* Check for menu events */
-              menu_event(key);
+              menu_event(&event.key.keysym);
 
               if (key == SDLK_ESCAPE)
                 {
@@ -109,11 +112,11 @@ int title(void)
                 }
             }
 #ifdef JOY_YES
-          else if (event.type == SDL_JOYAXISMOTION)
+          else if (event.type == SDL_JOYAXISMOTION && event.jaxis.axis == JOY_Y)
             {
-              if (event.jaxis.value > 256)
+              if (event.jaxis.value > 1024)
                 menuaction = MN_DOWN;
-              else
+              else if (event.jaxis.value < -1024)
                 menuaction = MN_UP;
             }
           else if (event.type == SDL_JOYBUTTONDOWN)
@@ -134,8 +137,11 @@ int title(void)
           texture_draw_bg(&title, NO_UPDATE);
 
           /* Draw the high score: */
-          sprintf(str, "High score: %d", last_highscore);
-          drawcenteredtext(str, 460, letters_red, NO_UPDATE, 1);
+          sprintf(str, "High score: %d", hs_score);
+           text_drawf(&gold_text, str, 0, -40, A_HMIDDLE, A_BOTTOM, 1, NO_UPDATE);
+  sprintf(str, "by %s", hs_name);
+  text_drawf(&gold_text, str, 0, -20, A_HMIDDLE, A_BOTTOM, 1, NO_UPDATE);
+  
         }
 
       /* Don't draw menu, if quit is true */
@@ -150,12 +156,12 @@ int title(void)
       pict = (frame / 5) % 3;
 
       if (pict == 0)
-        texture_draw_part(&title, 560, 270, 80, 75, NO_UPDATE);
+        texture_draw_part(&title, 560, 270, 560, 270, 80, 75, NO_UPDATE);
       else if (pict == 1)
         texture_draw(&anim1, 560, 270, NO_UPDATE);
       else if (pict == 2)
         texture_draw(&anim2, 560, 270, NO_UPDATE);
-
+       
       flipscreen();
 
       /* Pause: */