Fixed a help font bug (was using normal fonts, instead of the small ones).
[supertux.git] / src / leveleditor.cpp
index 836158e..db70458 100644 (file)
@@ -38,9 +38,7 @@
 #include "resources.h"
 
 /* definitions to aid development */
-#define DONE_LEVELEDITOR 1
-#define DONE_QUIT        2
-#define DONE_CHANGELEVEL 3
+
 
 /* definitions that affect gameplay */
 #define KEY_CURSOR_SPEED 32
@@ -224,7 +222,7 @@ int leveleditor(int levelnb)
                   update_subset_settings_menu();
                   break;
                 case 7:
-                  done = DONE_LEVELEDITOR;
+                  done = 1;
                   break;
                 }
             }
@@ -334,18 +332,15 @@ int leveleditor(int levelnb)
 
       mouse_cursor->draw();
 
+printf("done: %i\n", done);
+
       if(done)
         {
+printf("done\n");
           le_quit();
           return 0;
         }
 
-      if(done == DONE_QUIT)
-        {
-          le_quit();
-          return 1;
-        }
-
       ++global_frame_counter;
        
       SDL_Delay(25);
@@ -791,9 +786,8 @@ void le_checkevents()
 
   while(SDL_PollEvent(&event))
     {
-      if(show_menu)
-        current_menu->event(event);
-      else
+      current_menu->event(event);
+      if(!show_menu)
         mouse_cursor->set_state(MC_NORMAL);
 
       /* testing SDL_KEYDOWN, SDL_KEYUP and SDL_QUIT events*/
@@ -802,25 +796,14 @@ void le_checkevents()
         {
           switch(event.type)
             {
+            case SDL_QUIT:     // window closed
+printf("window closed\n");
+              done = -1;
+              break;
             case SDL_KEYDOWN:  // key pressed
               key = event.key.keysym.sym;
-              if(show_menu)
-                {
-                  if(key == SDLK_ESCAPE)
-                    {
-                      show_menu = false;
-                      Menu::set_current(leveleditor_menu);
-                    }
-                  break;
-                }
               switch(key)
                 {
-                case SDLK_ESCAPE:
-                  if(!show_menu)
-                    show_menu = true;
-                  else
-                    show_menu = false;
-                  break;
                 case SDLK_LEFT:
                   if(fire == DOWN)
                     cursor_x -= KEY_CURSOR_SPEED;
@@ -932,9 +915,6 @@ void le_checkevents()
                     }
                 }
               break;
-            case SDL_QUIT:     // window closed
-              done = DONE_QUIT;
-              break;
             default:
               break;
             }
@@ -1162,7 +1142,7 @@ void le_change(float x, float y, int tm, unsigned int c)
           /* if there is a bad guy over there, remove it */
           for(i = 0; i < le_world.bad_guys.size(); ++i)
             if(xx == le_world.bad_guys[i].base.x/32 && yy == le_world.bad_guys[i].base.y/32)
-              le_world.bad_guys.erase(static_cast<std::vector<BadGuy>::iterator>(&le_world.bad_guys[i]));
+              le_world.bad_guys.erase(le_world.bad_guys.begin() + i);
 
           if(c == '0')  /* if it's a bad guy */
             le_world.add_bad_guy(xx*32, yy*32, BAD_BSOD);
@@ -1240,7 +1220,7 @@ void le_testlevel()
 void le_showhelp()
 {
   SDL_Event event;
-  unsigned int i, done;
+  unsigned int i, done_;
   char *text[] = {
                    "  - This is SuperTux's built-in level editor -",
                    "It has been designed to be light and easy to use from the start.",
@@ -1276,17 +1256,17 @@ void le_showhelp()
   blue_text->drawf("- Help -", 0, 30, A_HMIDDLE, A_TOP, 2);
 
   for(i = 0; i < sizeof(text)/sizeof(char *); i++)
-    white_text->draw(text[i], 5, 80+(i*18), 1);
+    white_small_text->draw(text[i], 5, 80+(i*white_small_text->h), 1);
 
   gold_text->drawf("Press Any Key to Continue", 0, 440, A_HMIDDLE, A_TOP, 1);
 
   flipscreen();
 
-  done = 0;
+  done_ = 0;
 
-  while(done == 0)
+  while(done_ == 0)
     {
-      done = wait_for_event(event);
+      done_ = wait_for_event(event);
       SDL_Delay(50);
     }
 }