enemy.h -> badguy.h
[supertux.git] / src / gameloop.c
index 86ae816..f8ed6e5 100644 (file)
@@ -31,7 +31,9 @@
 #include "setup.h"
 #include "high_scores.h"
 #include "menu.h"
-
+#include "badguy.h"
+#include "world.h"
+#include "player.h"
 
 /* Sound files: */
 
@@ -249,15 +251,15 @@ void game_event(void)
                     game_pause = 1;
                 }
             }
-          else if (key == SDLK_TAB)
+          else if (key == SDLK_TAB && debug_mode == YES)
             {
               tux_size = !tux_size;
             }
-          else if (key == SDLK_END)
+          else if (key == SDLK_END && debug_mode == YES)
             {
               distros += 50;
             }
-          else if (key == SDLK_SPACE)
+          else if (key == SDLK_SPACE && debug_mode == YES)
             {
               next_level = 1;
             }
@@ -579,10 +581,18 @@ int game_action(void)
 
 
   /* Keep tux in bounds: */
-
   if (tux_x < 0)
     tux_x = 0;
-  else if (tux_x > 320 && scroll_x < ((level_width * 32) - 640))
+    else if (tux_x < 160 && scroll_x > 0 && debug_mode == YES)
+    {
+    scroll_x = scroll_x - ( 160 - tux_x);
+    tux_x = 160;
+    
+    if(scroll_x < 0)
+     scroll_x = 0;
+   
+    }
+    else if (tux_x > 320 && scroll_x < ((level_width * 32) - 640))
     {
       /* Scroll the screen in past center: */
 
@@ -2157,8 +2167,7 @@ void game_draw()
     {
       drawimage(tux_life,565+(18*i),20,NO_UPDATE);
     }
-  /*drawtext(str, 608, 0, letters_gold, NO_UPDATE);*/
-
+    
   if(game_pause)
     drawcenteredtext("PAUSE",230,letters_red, NO_UPDATE);
 
@@ -2265,7 +2274,7 @@ int gameloop(void)
 
       now_time = SDL_GetTicks();
       if (now_time < last_time + FPS)
-        SDL_Delay(last_time + FPS - now_time);
+       SDL_Delay(last_time + FPS - now_time);
 
 
       /* Handle time: */
@@ -2903,10 +2912,13 @@ void loadshared(void)
 
   /* Sound effects: */
 
-  /*  if (use_sound) // this can help speeding up a little, but
-     we shouldn't take care about "use_sound" here, it's load_sound's job
-     / Send a mail to neoneurone@users.sf.net, if you have another opinion. :)
-     */
+  /* if (use_sound) // this will introduce SERIOUS bugs here ! because "load_sound"
+                    // initialize sounds[i] with the correct pointer's value:
+                    // NULL or something else. And it will be dangerous to
+                    // play with not-initialized pointers.
+                    // This is also true with if (use_music)
+     Send a mail to me: neoneurone@users.sf.net, if you have another opinion. :)
+  */
   for (i = 0; i < NUM_SOUNDS; i++)
     sounds[i] = load_sound(soundfilenames[i]);