Prettying up code, Part Two. I think Ball's done. Hope I didn't break things.
authorparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Thu, 1 Jun 2006 19:52:17 +0000 (19:52 +0000)
committerparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Thu, 1 Jun 2006 19:52:17 +0000 (19:52 +0000)
git-svn-id: https://s.snth.net/svn/neverball/trunk@423 78b8d119-cf0a-0410-b17c-f493084dd1d7

ball/st_help.c
ball/st_level.c
ball/st_name.c
ball/st_play.c
ball/st_play_end.c
ball/st_save.c
ball/st_set.c
ball/st_shared.c
ball/st_start.c
ball/st_title.c
ball/util.c

index 6a604dd..564a5d0 100644 (file)
@@ -39,14 +39,14 @@ static int help_action(int i)
 {
     audio_play(AUD_MENU, 1.0f);
     
-    switch(i)
+    switch (i)
     {
-       case HELP_BACK: return goto_state(&st_title);
-       case HELP_RULE: return goto_state(&st_help);
-       case HELP_CONT: return goto_state(&st_help2);
-       case HELP_MODE: return goto_state(&st_help3);
-       case HELP_SECR: return goto_state(&st_help4);
-       case HELP_CRED: return goto_state(&st_help5);
+        case HELP_BACK: return goto_state(&st_title);
+        case HELP_RULE: return goto_state(&st_help);
+        case HELP_CONT: return goto_state(&st_help2);
+        case HELP_MODE: return goto_state(&st_help3);
+        case HELP_SECR: return goto_state(&st_help4);
+        case HELP_CRED: return goto_state(&st_help5);
     }
     return 1;
 }
@@ -55,7 +55,7 @@ static int help_button(int id, const char *text, int token, int atoken)
 {
     int kd = gui_state(id, text, GUI_SML, token, token == atoken);
     if (token == atoken)
-       gui_focus(kd);
+        gui_focus(kd);
     return kd;
 }
 
@@ -65,12 +65,12 @@ static int help_menu(int id, int i)
     gui_filler(id);
     if ((jd = gui_harray(id)))
     {
-       help_button(jd, _("Credits"),     HELP_CRED, i);
-       help_button(jd, _("Secrets"),     HELP_SECR, i);
-       help_button(jd, _("Modes"),       HELP_MODE, i);
-       help_button(jd, _("Controls"),    HELP_CONT, i);
-       help_button(jd, _("Rules"),       HELP_RULE, i);
-       help_button(jd, _("Back"),        HELP_BACK, i);
+        help_button(jd, _("Credits"),     HELP_CRED, i);
+        help_button(jd, _("Secrets"),     HELP_SECR, i);
+        help_button(jd, _("Modes"),       HELP_MODE, i);
+        help_button(jd, _("Controls"),    HELP_CONT, i);
+        help_button(jd, _("Rules"),       HELP_RULE, i);
+        help_button(jd, _("Back"),        HELP_BACK, i);
     }
     gui_filler(id);
     return jd;
@@ -79,15 +79,15 @@ static int help_menu(int id, int i)
 static int help1_enter(void)
 {
     const char *s0 = _(
-           "Move the mouse or joystick\\"
-           "or use keyboard arrows to\\"
-           "tilt the floor causing the\\"
-           "ball to roll.\\ ");
+            "Move the mouse or joystick\\"
+            "or use keyboard arrows to\\"
+            "tilt the floor causing the\\"
+            "ball to roll.\\ ");
     const char *s1 = _(
-           "Roll over coins to collect\\"
-           "them.  Collect coins to\\"
-           "unlock the goal and finish\\"
-           "the level.\\ ");
+            "Roll over coins to collect\\"
+            "them.  Collect coins to\\"
+            "unlock the goal and finish\\"
+            "the level.\\ ");
 
     int w = config_get_d(CONFIG_WIDTH);
     int h = config_get_d(CONFIG_HEIGHT);
@@ -96,21 +96,21 @@ static int help1_enter(void)
 
     if ((id = gui_vstack(0)))
     {
-       help_menu(id, HELP_RULE);
-       
-       if ((jd = gui_hstack(id)))
-       {
-           gui_image(jd, "gui/help1.jpg", 6 * w / 16, 6 * h / 16);
+        help_menu(id, HELP_RULE);
+        
+        if ((jd = gui_hstack(id)))
+        {
+            gui_image(jd, "gui/help1.jpg", 6 * w / 16, 6 * h / 16);
             gui_multi(jd, s0, GUI_SML, GUI_ALL, gui_wht, gui_wht);
-           gui_filler(jd);
-       }
-       gui_space(id);
-       if ((jd = gui_hstack(id)))
-       {
-           gui_filler(jd);
+            gui_filler(jd);
+        }
+        gui_space(id);
+        if ((jd = gui_hstack(id)))
+        {
+            gui_filler(jd);
             gui_multi(jd, s1, GUI_SML, GUI_ALL, gui_wht, gui_wht);
-           gui_image(jd, "gui/help2.jpg", 6 * w / 16, 6 * h / 16);
-       }
+            gui_image(jd, "gui/help2.jpg", 6 * w / 16, 6 * h / 16);
+        }
         gui_layout(id, 0, +1);
     }
     return id;
@@ -142,8 +142,8 @@ static int help2_enter(void)
     
     if ((id = gui_vstack(0)))
     {
-       help_menu(id, HELP_CONT);
-       
+        help_menu(id, HELP_CONT);
+        
         if ((jd = gui_harray(id)))
         {
             gui_label(jd, s6, GUI_SML, GUI_NE, gui_wht, gui_wht);
@@ -200,29 +200,28 @@ static int help3_enter(void)
     
     if ((id = gui_vstack(0)))
     {
-       help_menu(id, HELP_MODE);
-       
-       gui_label(id, _("Normal"), GUI_SML, GUI_TOP, 0, 0);
-       gui_multi(id, 
-       "Finish a level before the time run out.\\"
-       "You need to collect coins in order to open the goal.",
-       GUI_SML, GUI_BOT, gui_wht, gui_wht);
-       
+        help_menu(id, HELP_MODE);
+        
+        gui_label(id, _("Normal"), GUI_SML, GUI_TOP, 0, 0);
+        gui_multi(id, 
+                  "Finish a level before the time run out.\\"
+                  "You need to collect coins in order to open the goal.",
+                  GUI_SML, GUI_BOT, gui_wht, gui_wht);
+        
         gui_space(id);
-       
-       gui_label(id, _("Practice"), GUI_SML, GUI_TOP, 0, 0);
-       gui_multi(id, 
-       "Play a level without time or coin constraint.",
-       GUI_SML, GUI_BOT, gui_wht, gui_wht);
-       
+        
+        gui_label(id, _("Practice"), GUI_SML, GUI_TOP, 0, 0);
+        gui_multi(id, "Play a level without time or coin constraint.",
+                  GUI_SML, GUI_BOT, gui_wht, gui_wht);
+        
         gui_space(id);
-       
-       gui_label(id, _("Challenge"), GUI_SML, GUI_TOP, 0, 0);
-       gui_multi(id, 
-       "Start playing from the first level of the level set.\\"
-       "You start with only four balls, do not lose them.\\"
-        "Earn an extra ball for each 100 coins collected.",
-       GUI_SML, GUI_BOT, gui_wht, gui_wht);
+        
+        gui_label(id, _("Challenge"), GUI_SML, GUI_TOP, 0, 0);
+        gui_multi(id, 
+                  "Start playing from the first level of the level set.\\"
+                  "You start with only four balls, do not lose them.\\"
+                  "Earn an extra ball for each 100 coins collected.",
+                  GUI_SML, GUI_BOT, gui_wht, gui_wht);
 
         gui_layout(id, 0, +1);
     }
@@ -233,15 +232,15 @@ static int help3_enter(void)
 static int help4_enter(void)
 {
     const char *s0 = _(
-           " \\"
-           " \\"
-           " \\"
-           " \\ ");
+            " \\"
+            " \\"
+            " \\"
+            " \\ ");
     const char *s1 = _(
-           " \\"
-           " \\"
-           " \\"
-           " \\ ");
+            " \\"
+            " \\"
+            " \\"
+            " \\ ");
 
     int w = config_get_d(CONFIG_WIDTH);
     int h = config_get_d(CONFIG_HEIGHT);
@@ -250,21 +249,21 @@ static int help4_enter(void)
 
     if ((id = gui_vstack(0)))
     {
-       help_menu(id, HELP_SECR);
-       
-       if ((jd = gui_hstack(id)))
-       {
-           gui_filler(jd);
+        help_menu(id, HELP_SECR);
+        
+        if ((jd = gui_hstack(id)))
+        {
+            gui_filler(jd);
             gui_multi(jd, s0, GUI_SML, GUI_ALL, gui_wht, gui_wht);
-           gui_image(jd, "gui/help3.jpg", 6 * w / 16, 6 * h / 16);
-       }
-       gui_space(id);
-       if ((jd = gui_hstack(id)))
-       {
-           gui_image(jd, "gui/help4.jpg", 6 * w / 16, 6 * h / 16);
+            gui_image(jd, "gui/help3.jpg", 6 * w / 16, 6 * h / 16);
+        }
+        gui_space(id);
+        if ((jd = gui_hstack(id)))
+        {
+            gui_image(jd, "gui/help4.jpg", 6 * w / 16, 6 * h / 16);
             gui_multi(jd, s1, GUI_SML, GUI_ALL, gui_wht, gui_wht);
-           gui_filler(jd);
-       }
+            gui_filler(jd);
+        }
         gui_layout(id, 0, +1);
     }
     return id;
@@ -276,27 +275,34 @@ static int help5_enter(void)
     
     if ((id = gui_vstack(0)))
     {
-       help_menu(id, HELP_CRED);
-       
-       gui_label(id, _("Lead Maintainer"), GUI_SML, GUI_TOP, 0, 0);
-       gui_label(id, "Robert Kooima <robert.kooima@gmail.com>", GUI_SML, GUI_BOT , gui_wht, gui_wht);
-       
+        help_menu(id, HELP_CRED);
+        
+        gui_label(id, _("Lead Maintainer"), GUI_SML, GUI_TOP, 0, 0);
+        gui_label(id, "Robert Kooima <robert.kooima@gmail.com>",
+                  GUI_SML, GUI_BOT , gui_wht, gui_wht);
+        
         gui_space(id);
-       
-       gui_label(id, _("Developers"), GUI_SML, GUI_TOP, 0, 0);
-       gui_label(id, "Robert Kooima, Jean Privat", GUI_SML, GUI_BOT , gui_wht, gui_wht);
-       
+        
+        gui_label(id, _("Developers"), GUI_SML, GUI_TOP, 0, 0);
+        gui_label(id, "Robert Kooima, Jean Privat",
+                  GUI_SML, GUI_BOT , gui_wht, gui_wht);
+        
         gui_space(id);
-       
-       gui_label(id, _("Level Contribution"), GUI_SML, GUI_TOP, 0, 0);
-       gui_multi(id, "Robert Kooima, Jean Privat, Jānis Rūcis,\\Paul Tompkins, Mehdi Yousfi-Monod", GUI_SML, GUI_BOT , gui_wht, gui_wht);
-       
+        
+        gui_label(id, _("Level Contribution"), GUI_SML, GUI_TOP, 0, 0);
+        gui_multi(id,
+                  "Robert Kooima, Jean Privat, Jānis Rūcis,\\"
+                  "Paul Tompkins, Mehdi Yousfi-Monod",
+                  GUI_SML, GUI_BOT , gui_wht, gui_wht);
+        
         gui_space(id);
-       
-       gui_label(id, _("Translation"), GUI_SML, GUI_TOP, 0, 0);
-       gui_multi(id, "French: Jean Privat, Mehdi Yousfi-Monod;\\"
-               "German: Georg Wachter; Latvian: Jānis Rūcis", GUI_SML, GUI_BOT , gui_wht, gui_wht);
-       
+        
+        gui_label(id, _("Translation"), GUI_SML, GUI_TOP, 0, 0);
+        gui_multi(id,
+                  "French: Jean Privat, Mehdi Yousfi-Monod;\\"
+                  "German: Georg Wachter; Latvian: Jānis Rūcis",
+                  GUI_SML, GUI_BOT , gui_wht, gui_wht);
+        
         gui_layout(id, 0, +1);
     }
     return id;
index c0f9d79..f558bc0 100644 (file)
@@ -31,8 +31,8 @@ static int level_ok;
 static int level_enter(void)
 {
     int id, jd, kd, ld;
-    const char * ln;
-    const struct level_game * lg = curr_lg();
+    const char *ln;
+    const struct level_game *lg = curr_lg();
     int b;
 
     /* Load the level */
@@ -41,44 +41,49 @@ static int level_enter(void)
 
     if ((id = gui_vstack(0)))
     {
-       if (lg->mode == MODE_SINGLE)
-       {
-           gui_label(id, _("Single Level"),  GUI_LRG, GUI_TOP, 0, 0);
-       }
-       else if ((jd = gui_hstack(id)))
+        if (lg->mode == MODE_SINGLE)
         {
-           ln = lg->level->numbername;
-           b  = lg->level->is_bonus;
+            gui_label(id, _("Single Level"), GUI_LRG, GUI_TOP, 0, 0);
+        }
+        else if ((jd = gui_hstack(id)))
+        {
+            ln = lg->level->numbername;
+            b = lg->level->is_bonus;
 
             gui_filler(jd);
-           if ((kd = gui_vstack(jd)))
-           {
-               if (b)
-                   gui_label(kd, _("*** BONUS ***"),  GUI_MED, GUI_TOP, gui_wht, gui_grn);
-               if ((ld = gui_hstack(kd)))
-               {
-                   if (b)
-                   {
-                       gui_label(ld, ln,          GUI_LRG, 0, gui_wht, gui_grn);
-                       gui_label(ld, _("Level "), GUI_LRG, 0, gui_wht, gui_grn);
-                   }
-                   else
-                   {
-                       gui_label(ld, ln,          GUI_LRG, GUI_NE, 0, 0);
-                       gui_label(ld, _("Level "), GUI_LRG, GUI_NW, 0, 0);
-                   }
-               }
-
-               gui_label(kd, _(curr_set()->name),  GUI_SML, GUI_BOT, gui_wht, gui_wht);
-           }
-           gui_filler(jd);
+            if ((kd = gui_vstack(jd)))
+            {
+                if (b)
+                    gui_label(kd, _("*** BONUS ***"), GUI_MED, GUI_TOP, gui_wht,
+                              gui_grn);
+                if ((ld = gui_hstack(kd)))
+                {
+                    if (b)
+                    {
+                        gui_label(ld, ln, GUI_LRG, 0, gui_wht, gui_grn);
+                        gui_label(ld, _("Level "), GUI_LRG, 0, gui_wht,
+                                  gui_grn);
+                    }
+                    else
+                    {
+                        gui_label(ld, ln, GUI_LRG, GUI_NE, 0, 0);
+                        gui_label(ld, _("Level "), GUI_LRG, GUI_NW, 0, 0);
+                    }
+                }
+
+                gui_label(kd, _(curr_set()->name), GUI_SML, GUI_BOT, gui_wht,
+                          gui_wht);
+            }
+            gui_filler(jd);
         }
         gui_space(id);
-       
-       if (! level_ok)
-           gui_label(id, _("Cannot load the level file."), GUI_SML, GUI_ALL, gui_red, gui_red);
-       else if (lg->level->message[0] != '\0')
-           gui_multi(id, _(lg->level->message), GUI_SML, GUI_ALL, gui_wht, gui_wht);
+
+        if (!level_ok)
+            gui_label(id, _("Cannot load the level file."), GUI_SML, GUI_ALL,
+                      gui_red, gui_red);
+        else if (lg->level->message[0] != '\0')
+            gui_multi(id, _(lg->level->message), GUI_SML, GUI_ALL, gui_wht,
+                      gui_wht);
 
         gui_layout(id, 0, 0);
     }
@@ -98,10 +103,10 @@ static int level_click(int b, int d)
 {
     if (b < 0 && d == 1)
     {
-       if (level_ok)
-           return goto_state(&st_play_ready);
-       else
-           return goto_end_level();
+        if (level_ok)
+            return goto_state(&st_play_ready);
+        else
+            return goto_end_level();
     }
     else
        return 1;
@@ -119,14 +124,14 @@ static int level_buttn(int b, int d)
     if (d)
     {
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
-       {
-           if (level_ok)
-               return goto_state(&st_play_ready);
-           else
-               return goto_end_level();
-       }
+        {
+            if (level_ok)
+                return goto_state(&st_play_ready);
+            else
+                return goto_end_level();
+        }
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
-           return goto_end_level();
+            return goto_end_level();
     }
     return 1;
 }
index 5af1cc4..76e51d8 100644 (file)
 
 extern struct state st_name;
 
-static struct state * ok_state, * cancel_state;
+static struct state *ok_state, *cancel_state;
 static char player[MAXNAM];
 
 void name_default(void)
 {
-    char * login = getenv("LOGNAME");
+    char *login = getenv("LOGNAME");
+
     if (login == NULL || login[0] == '\0')
-       login =  _("Player");
+        login = _("Player");
     
     strncpy(player, login, MAXNAM);
     player[MAXNAM-1] = '\0';
     player[0] = toupper(player[0]);
 }
 
-int goto_name(struct state * ok, struct state * cancel)
+int goto_name(struct state *ok, struct state *cancel)
 {
     config_get_s(CONFIG_PLAYER, player, MAXNAM);
     if (player[0] == '\0')
-       name_default();
+        name_default();
     
     ok_state     = ok;
     cancel_state = cancel;
@@ -71,15 +72,15 @@ static int name_action(int i)
     switch (i)
     {
     case NAME_OK:
-       if (l == 0)
-          return 1;
+        if (l == 0)
+           return 1;
         config_set_s(CONFIG_PLAYER, player);
-       return goto_state(ok_state);
-       
+        return goto_state(ok_state);
+        
     case NAME_BACK:
     case NAME_CANCEL:
-       return goto_state(cancel_state);
-       
+        return goto_state(cancel_state);
+        
     case GUI_BS:
         if (l > 0)
         {
@@ -107,23 +108,23 @@ static int name_enter(void)
 
     if ((id = gui_vstack(0)))
     {
-       gui_label(id, _("Player Name"), GUI_MED, GUI_ALL, 0, 0);
+        gui_label(id, _("Player Name"), GUI_MED, GUI_ALL, 0, 0);
 
-       gui_space(id);
         gui_space(id);
-       
-       name_id = gui_label(id, player, GUI_MED, GUI_ALL, gui_yel, gui_yel);
+        gui_space(id);
+        
+        name_id = gui_label(id, player, GUI_MED, GUI_ALL, gui_yel, gui_yel);
 
         gui_space(id);
 
-       gui_keyboard(id);
-       if ((jd = gui_harray(id)))
-       {
-           enter_id = gui_start(jd, _("OK"),     GUI_SML, NAME_OK,     0);
-           gui_state(jd, _("Cancel"), GUI_SML, NAME_CANCEL, 0);
-       }
+        gui_keyboard(id);
+        if ((jd = gui_harray(id)))
+        {
+            enter_id = gui_start(jd, _("OK"), GUI_SML, NAME_OK, 0);
+            gui_state(jd, _("Cancel"), GUI_SML, NAME_CANCEL, 0);
+        }
 
-       gui_layout(id, 0, 0);
+        gui_layout(id, 0, 0);
     }
     
     SDL_EnableUNICODE(1);
@@ -140,15 +141,15 @@ static void name_leave(int id)
 static int name_keybd(int c, int d)
 {
     if (d)
-       if ((c & 0xFF80) == 0)
-       {
-           gui_focus(enter_id);
-           c &= 0x7F;
-           if (c == '\b' || c == 0x7F)
-               return name_action(GUI_BS);
-           else if (c > ' ')
-               return name_action(c);
-       }
+        if ((c & 0xFF80) == 0)
+        {
+            gui_focus(enter_id);
+            c &= 0x7F;
+            if (c == '\b' || c == 0x7F)
+                return name_action(GUI_BS);
+            else if (c > ' ')
+                return name_action(c);
+        }
     return 1;
 }
 
@@ -159,7 +160,7 @@ static int name_buttn(int b, int d)
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
             return name_action(gui_token(gui_click()));
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
-           name_action(NAME_BACK);
+            name_action(NAME_BACK);
     }
     return 1;
 }
index 69f61ff..5dd6b67 100644 (file)
@@ -198,8 +198,8 @@ static void play_loop_timer(int id, float dt)
     state = game_step(g, at, &state_value);
     if (state)
     {
-       level_stop(state, state_value, curr_clock(), curr_coins());
-       goto_state(&st_play_end);
+        level_stop(state, state_value, curr_clock(), curr_coins());
+        goto_state(&st_play_end);
     }
 
     game_step_fade(dt);
@@ -279,10 +279,10 @@ static int play_loop_buttn(int b, int d)
     if (d == 1)
     {
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
-       {
-           level_stop(GAME_NONE, 0, curr_clock(), curr_coins());
+        {
+            level_stop(GAME_NONE, 0, curr_clock(), curr_coins());
             return abort_play();
-       }
+        }
 
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_R, b))
             view_rotate = +1;
@@ -353,7 +353,7 @@ static void look_point(int id, int x, int y, int dx, int dy)
 static int look_keybd(int c, int d)
 {
     if (d && c == SDLK_F12)
-       return goto_state(&st_play_loop);
+        return goto_state(&st_play_loop);
 
     return 1;
 }
@@ -361,7 +361,7 @@ static int look_keybd(int c, int d)
 static int look_buttn(int b, int d)
 {
     if (d && config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
-       return goto_state(&st_play_loop);
+        return goto_state(&st_play_loop);
 
     return 1;
 }
index a01ab76..216f2c8 100644 (file)
@@ -78,7 +78,7 @@ static int play_end_action(int i)
     return 1;
 }
 
-static int play_end_init(int * gidp)
+static int play_end_init(int *gidp)
 {
     const struct level_game *lg = curr_lg();
     int mode  = lg->mode;
@@ -113,7 +113,7 @@ static int play_end_init(int * gidp)
         gui_space(id);
 
         if (mode == MODE_CHALLENGE && 
-                (lg->state == GAME_GOAL || lg->state == GAME_SPEC || l->is_bonus))
+            (lg->state == GAME_GOAL || lg->state == GAME_SPEC || l->is_bonus))
         {
             int coins = lg->coins;
             int score = lg->score - coins;
@@ -162,17 +162,18 @@ static int play_end_init(int * gidp)
         {
             int nlid = 0, rlid = 0;
             int b = 0;
+
             if (lg->win)
-                gui_start(jd, _("Finish"),      GUI_SML, PLAY_END_DONE, 0);
+                gui_start(jd, _("Finish"), GUI_SML, PLAY_END_DONE, 0);
             else
-                nlid = gui_maybe(jd, _("Next Level"),  PLAY_END_NEXT, lg->next_level != NULL);
-            
+                nlid = gui_maybe(jd, _("Next Level"),  PLAY_END_NEXT,
+                                 lg->next_level != NULL);
+
             if (lg->dead)
                 gui_start(jd, _("Game Over"), GUI_SML, PLAY_END_OVER, 0);
             else
             {
-                b = mode != MODE_CHALLENGE || 
-                    ((state == GAME_FALL || state == GAME_TIME) && !lg->dead && !l->is_bonus);
+                b = mode != MODE_CHALLENGE || ((state == GAME_FALL || state == GAME_TIME) && !lg->dead && !l->is_bonus);
                 rlid = gui_maybe(jd, _("Retry Level"), PLAY_END_SAME, b);
             }
             
@@ -181,7 +182,7 @@ static int play_end_init(int * gidp)
             /* default is next if the next level is newly unkocked */
             if (nlid != 0 && lg->unlock)
                  gui_focus(nlid);
-            else if(b)
+            else if (b)
                  gui_focus(rlid);
         }
 
@@ -250,7 +251,8 @@ static void play_end_timer(int id, float dt)
             
             gui_set_count(score_id, score + 1);
             gui_pulse(score_id, 1.1f);
-            if ((score+1) % 100 == 0)
+
+            if ((score + 1) % 100 == 0)
             {
                 gui_set_count(balls_id, balls + 1);
                 gui_pulse(balls_id, 2.0f);
index bb8f9e8..80113d4 100644 (file)
@@ -30,10 +30,10 @@ static char filename[MAXNAM];
 
 /*---------------------------------------------------------------------------*/
 
-static struct state * ok_state;
-static struct state * cancel_state;
+static struct state *ok_state;
+static struct state *cancel_state;
 
-int goto_save(struct state * ok, struct state * cancel)
+int goto_save(struct state *ok, struct state *cancel)
 {
     demo_unique(filename);
     ok_state     = ok;
@@ -57,18 +57,18 @@ static int save_action(int i)
     switch (i)
     {
     case SAVE_SAVE:
-       if (strcmp(filename, "") == 0)
-           return 1;
+        if (strcmp(filename, "") == 0)
+            return 1;
         if (demo_exists(filename))
             return goto_state(&st_clobber);
         else
         {
-           demo_play_save(filename);
-           return goto_state(ok_state);
+            demo_play_save(filename);
+            return goto_state(ok_state);
         }
 
     case SAVE_CANCEL:
-       return goto_state(cancel_state);
+        return goto_state(cancel_state);
 
     case GUI_BS:
         if (l > 0)
@@ -97,19 +97,19 @@ static int save_enter(void)
 
     if ((id = gui_vstack(0)))
     {
-       gui_label(id, _("Replay Name"), GUI_MED, GUI_ALL, 0, 0);
+        gui_label(id, _("Replay Name"), GUI_MED, GUI_ALL, 0, 0);
         
-       gui_space(id);
         gui_space(id);
-       
+        gui_space(id);
+        
         file_id = gui_label(id, filename, GUI_MED, GUI_ALL, gui_yel, gui_yel);
-       
+        
         gui_space(id);
 
         gui_keyboard(id);
         if ((jd = gui_harray(id)))
         {
-            enter_id = gui_start(jd, _("Save"),   GUI_SML, SAVE_SAVE,   0);
+            enter_id = gui_start(jd, _("Save"), GUI_SML, SAVE_SAVE, 0);
             gui_state(jd, _("Cancel"), GUI_SML, SAVE_CANCEL, 0);
         }
         
@@ -130,15 +130,15 @@ static void save_leave(int id)
 static int save_keybd(int c, int d)
 {
     if (d)
-       if ((c & 0xFF80) == 0)
-       {
-           gui_focus(enter_id);
-           c &= 0x7F;
-           if (c == '\b')
-               return save_action(GUI_BS);
-           else if (c > ' ')
-               return save_action(c);
-       }
+        if ((c & 0xFF80) == 0)
+        {
+            gui_focus(enter_id);
+            c &= 0x7F;
+            if (c == '\b')
+                return save_action(GUI_BS);
+            else if (c > ' ')
+                return save_action(c);
+        }
     return 1;
 }
 
@@ -149,7 +149,7 @@ static int save_buttn(int b, int d)
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_A, b))
             return save_action(gui_token(gui_click()));
         if (config_tst_d(CONFIG_JOYSTICK_BUTTON_EXIT, b))
-           return save_action(SAVE_CANCEL);
+            return save_action(SAVE_CANCEL);
     }
     return 1;
 }
@@ -162,8 +162,8 @@ static int clobber_action(int i)
 
     if (i == SAVE_SAVE)
     {
-       demo_play_save(filename);
-       return goto_state(ok_state);    
+        demo_play_save(filename);
+        return goto_state(ok_state);    
     }
     return goto_state(&st_save);
 }
index 5816d85..440a299 100644 (file)
@@ -41,29 +41,31 @@ static int set_action(int i)
 {
     audio_play(AUD_MENU, 1.0f);
 
-    switch(i)
+    switch (i)
     {
     case GUI_BACK:
         return goto_state(&st_title);
 
     case GUI_PREV:
-       config_set_d(CONFIG_LAST_SET, ((config_get_d(CONFIG_LAST_SET)/SET_GROUP)-1)*SET_GROUP);
-       return goto_state(&st_set);
+        config_set_d(CONFIG_LAST_SET,
+                     ((config_get_d(CONFIG_LAST_SET) / SET_GROUP) - 1) * SET_GROUP);
+        return goto_state(&st_set);
     
     case GUI_NEXT:
-       config_set_d(CONFIG_LAST_SET, ((config_get_d(CONFIG_LAST_SET)/SET_GROUP)+1)*SET_GROUP);
-       return goto_state(&st_set);
+        config_set_d(CONFIG_LAST_SET,
+                     ((config_get_d(CONFIG_LAST_SET) / SET_GROUP) + 1) * SET_GROUP);
+        return goto_state(&st_set);
 
     case GUI_NULL:
-       return 1;
+        return 1;
     
     default:
-       if (set_exists(i))
-       {
-           config_set_d(CONFIG_LAST_SET, i);
-           set_goto(i);
-           return goto_state(&st_start);
-       }
+        if (set_exists(i))
+        {
+            config_set_d(CONFIG_LAST_SET, i);
+            set_goto(i);
+            return goto_state(&st_start);
+        }
     }
     return 1;
 }
@@ -74,11 +76,11 @@ static void gui_set(int id, int i)
     int jd;
     
     if (set_completed(s)) 
-       jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_yel, gui_wht);
+        jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_yel, gui_wht);
     else if (set_unlocked(s)) 
-       jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_grn, gui_wht);
+        jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_grn, gui_wht);
     else
-       jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_wht, gui_wht);
+        jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_wht, gui_wht);
     
     gui_active(jd, i, 0);
 }
@@ -99,9 +101,9 @@ static int set_enter(void)
     /* Reset last set if it do not exists */
     if (!set_exists(last_set))
     {
-       b = 0;
-       last_set = 0;
-       config_set_d(CONFIG_LAST_SET, 0);
+        b = 0;
+        last_set = 0;
+        config_set_d(CONFIG_LAST_SET, 0);
     }
 
     audio_music_fade_to(0.5f, "bgm/inter.ogg");
@@ -113,23 +115,24 @@ static int set_enter(void)
         {
             gui_label(jd, _("Level Set"), GUI_SML, GUI_ALL, gui_yel, gui_red);
             gui_filler(jd);
-           gui_back_prev_next(jd, b>0, set_exists((b+1)*SET_GROUP));
+            gui_back_prev_next(jd, b > 0, set_exists((b + 1) * SET_GROUP));
         }
 
         if ((jd = gui_harray(id)))
         {
-            shot_id = gui_image(jd, get_set(last_set)->shot, 7 * w / 16, 7 * h / 16);
+            shot_id = gui_image(jd, get_set(last_set)->shot, 7 * w / 16,
+                                7 * h / 16);
 
             if ((kd = gui_varray(jd)))
-           {
-               /* Display levels */
-               for(i=b*SET_GROUP; i<(b+1)*SET_GROUP && set_exists(i); i++)
-                   gui_set(kd, i);
-               
-               /* Display empty slots */
-               for(; i<(b+1)*SET_GROUP; i++)
-                   gui_filler(kd);
-           }          
+            {
+                /* Display levels */
+                for (i = b * SET_GROUP; i < (b + 1) * SET_GROUP && set_exists(i); i++)
+                    gui_set(kd, i);
+                
+                /* Display empty slots */
+                for(; i < (b + 1) * SET_GROUP; i++)
+                    gui_filler(kd);
+            }          
         }
 
         gui_space(id);
@@ -151,7 +154,7 @@ static void set_point(int id, int x, int y, int dx, int dy)
     int jd = shared_point_basic(id, x, y);
     int i  = gui_token(jd);
     if (jd && set_exists(i))
-       set_over(i);
+        set_over(i);
 }
 
 static void set_stick(int id, int a, int v)
@@ -159,7 +162,7 @@ static void set_stick(int id, int a, int v)
     int jd = shared_stick_basic(id, a, v);
     int i  = gui_token(jd);
     if (jd && set_exists(i))
-       set_over(i);
+        set_over(i);
 }
 
 static int set_buttn(int b, int d)
index 560a2c0..a2844fa 100644 (file)
@@ -73,8 +73,8 @@ void shared_stick(int id, int a, int v)
 int shared_click(int b, int d)
 {
     if (b < 0 && d == 1)
-       return st_buttn(config_get_d(CONFIG_JOYSTICK_BUTTON_A), 1);
+        return st_buttn(config_get_d(CONFIG_JOYSTICK_BUTTON_A), 1);
     else 
-       return 1;
+        return 1;
 }
 
index b20adcb..ce5e7a6 100644 (file)
@@ -34,11 +34,11 @@ int goto_end_level(void)
 {
     int mode = curr_lg()->mode;
     if (mode == MODE_SINGLE)
-       return 0;
+        return 0;
     else if (mode == MODE_CHALLENGE)
-       return goto_state(&st_over);
+        return goto_state(&st_over);
     else
-       return goto_state(&st_start);
+        return goto_state(&st_start);
 }
 
 
@@ -63,18 +63,18 @@ static void gui_level(int id, int i)
     int jd = 0;
     const GLfloat *fore, *back;
     
-    if (! set_level_exists(s, i))
+    if (!set_level_exists(s, i))
     {
-       gui_space(id);
-       return;
+        gui_space(id);
+        return;
     }
     
     l = get_level(i);
     
-    if (! l->is_locked)
+    if (!l->is_locked)
     {
-       fore =  l->is_bonus ? gui_grn : gui_wht;
-       back = l->is_completed ? fore : gui_yel;
+        fore =  l->is_bonus ? gui_grn : gui_wht;
+        back = l->is_completed ? fore : gui_yel;
     }
     else
         fore = back = gui_gry;
@@ -85,46 +85,52 @@ static void gui_level(int id, int i)
 static void start_over_level(i)
 {
     const struct level *l = get_level(i);
-    if (! l->is_locked || config_get_d(CONFIG_CHEAT))
+    if (!l->is_locked || config_get_d(CONFIG_CHEAT))
     {
         gui_set_image(shot_id, l->shot);
 
         set_most_coins(&l->coin_score, -1);
 
-       if (config_get_d(CONFIG_MODE) == MODE_PRACTICE)
-       {
-           set_best_times(&l->time_score, -1, 0);
-           if (l->is_bonus)
-               gui_set_label(status_id, _("Play this bonus level in practice mode"));
-           else
-               gui_set_label(status_id, _("Play this level in practice mode"));
-       }
-       else
-       {
-           set_best_times(&l->goal_score, -1, 1);
-           if (l->is_bonus)
-               gui_set_label(status_id, _("Play this bonus level in normal mode"));
-           else
-               gui_set_label(status_id, _("Play this level in normal mode"));
-       }
-       if (config_get_d(CONFIG_CHEAT))
-       {
-           gui_set_label(status_id, l->file);
-       }
-       return;
+        if (config_get_d(CONFIG_MODE) == MODE_PRACTICE)
+        {
+            set_best_times(&l->time_score, -1, 0);
+            if (l->is_bonus)
+                gui_set_label(status_id,
+                              _("Play this bonus level in practice mode"));
+            else
+                gui_set_label(status_id,
+                              _("Play this level in practice mode"));
+        }
+        else
+        {
+            set_best_times(&l->goal_score, -1, 1);
+            if (l->is_bonus)
+                gui_set_label(status_id,
+                              _("Play this bonus level in normal mode"));
+            else
+                gui_set_label(status_id, _("Play this level in normal mode"));
+        }
+        if (config_get_d(CONFIG_CHEAT))
+        {
+            gui_set_label(status_id, l->file);
+        }
+        return;
     }
     else if (l->is_bonus)
-       gui_set_label(status_id, _("Play in challenge mode to unlock extra bonus levels"));
+        gui_set_label(status_id,
+                      _("Play in challenge mode to unlock extra bonus levels"));
     else
-       gui_set_label(status_id, _("Finish previous levels to unlock this level"));
+        gui_set_label(status_id,
+                      _("Finish previous levels to unlock this level"));
 }
 
 static void start_over(id)
 {
     int i;
+
     gui_pulse(id, 1.2f);
     if (id == 0)
-       return;
+        return;
     
     i = gui_token(id);
     
@@ -134,17 +140,17 @@ static void start_over(id)
     case START_CHALLENGE:
         gui_set_image(shot_id, curr_set()->shot);
         set_most_coins(&curr_set()->coin_score, -1);
-       set_best_times(&curr_set()->time_score, -1, 0);
-       gui_set_label(status_id, _("Challenge all levels from the first one"));
-       break;
-       
+        set_best_times(&curr_set()->time_score, -1, 0);
+        gui_set_label(status_id, _("Challenge all levels from the first one"));
+        break;
+        
     case START_NORMAL:
-       gui_set_label(status_id, _("Collect coins and unlock next level"));
-       break;
-       
+        gui_set_label(status_id, _("Collect coins and unlock next level"));
+        break;
+        
     case START_PRACTICE:
-       gui_set_label(status_id, _("Train yourself without time nor coin"));
-       break;
+        gui_set_label(status_id, _("Train yourself without time nor coin"));
+        break;
     }
     
     if (i >= 0)
@@ -162,35 +168,35 @@ static int start_action(int i)
         return goto_state(&st_set);
     else if (i == START_NORMAL)
     {
-       config_set_d(CONFIG_MODE, MODE_NORMAL);
-       return goto_state(&st_start);
+        config_set_d(CONFIG_MODE, MODE_NORMAL);
+        return goto_state(&st_start);
     }
     else if (i == START_PRACTICE)
     {
-       config_set_d(CONFIG_MODE, MODE_PRACTICE);
-       return goto_state(&st_start);
+        config_set_d(CONFIG_MODE, MODE_PRACTICE);
+        return goto_state(&st_start);
     }
     
     if (i == START_CHALLENGE)
     {
-       /* On cheat, start challenge mode where you want */
-       if (config_get_d(CONFIG_CHEAT))
-       {
-           config_set_d(CONFIG_MODE, MODE_CHALLENGE);
-           return goto_state(&st_start);
-       }
-       i = 0;
-       mode = MODE_CHALLENGE;
+        /* On cheat, start challenge mode where you want */
+        if (config_get_d(CONFIG_CHEAT))
+        {
+            config_set_d(CONFIG_MODE, MODE_CHALLENGE);
+            return goto_state(&st_start);
+        }
+        i = 0;
+        mode = MODE_CHALLENGE;
     }
 
-    if (i>=0)
+    if (i >= 0)
     {
         const struct level *l = get_level(i);
-       if (!l->is_locked || config_get_d(CONFIG_CHEAT))
-       {
+        if (!l->is_locked || config_get_d(CONFIG_CHEAT))
+        {
             level_play(l, mode);
             return goto_state(&st_level);
-       }
+        }
     }
     return 1;
 }
@@ -207,26 +213,26 @@ static int start_enter(void)
     /* Desactivate cheat */
     if (m == MODE_CHALLENGE && !config_get_d(CONFIG_CHEAT))
     {
-       m = MODE_NORMAL;
-       config_set_d(CONFIG_MODE, m);
+        m = MODE_NORMAL;
+        config_set_d(CONFIG_MODE, m);
     }
     
     if ((id = gui_vstack(0)))
     {
         if ((jd = gui_hstack(id)))
         {
-           
-           gui_label(jd, _(curr_set()->name), GUI_SML, GUI_ALL, gui_yel, gui_red);
+            
+            gui_label(jd, _(curr_set()->name), GUI_SML, GUI_ALL, gui_yel, gui_red);
             gui_filler(jd);
-           if (set_completed(curr_set()))
-           {
-               gui_label(jd, _("Set Complete"), GUI_SML, GUI_ALL, gui_yel, gui_grn);
+            if (set_completed(curr_set()))
+            {
+                gui_label(jd, _("Set Complete"), GUI_SML, GUI_ALL, gui_yel, gui_grn);
                 gui_filler(jd);
-           }
+            }
             gui_start(jd, _("Back"),  GUI_SML, START_BACK, 0);
         }
 
-       
+        
         if ((jd = gui_harray(id)))
         {
             shot_id = gui_image(jd, curr_set()->shot, 7 * w / 16, 7 * h / 16);
@@ -235,14 +241,18 @@ static int start_enter(void)
             {
                 if ((ld = gui_harray(kd)))
                 {
-                   gui_state(ld, _("Practice"), GUI_SML, START_PRACTICE, m == MODE_PRACTICE);
-                   gui_state(ld, _("Normal"),   GUI_SML, START_NORMAL,   m == MODE_NORMAL);
-               }
-               for (i=0; i <5; i++)
+                    gui_state(ld, _("Practice"), GUI_SML, START_PRACTICE,
+                              m == MODE_PRACTICE);
+                    gui_state(ld, _("Normal"),   GUI_SML, START_NORMAL,
+                              m == MODE_NORMAL);
+                }
+                for (i = 0; i < 5; i++)
                     if ((ld = gui_harray(kd)))
-                        for (j=4; j>=0; j--)
-                            gui_level(ld, i*5 + j);
-               gui_state(kd, _("Challenge"), GUI_SML, START_CHALLENGE , m == MODE_CHALLENGE);
+                        for (j = 4; j >= 0; j--)
+                            gui_level(ld, i * 5 + j);
+
+                gui_state(kd, _("Challenge"), GUI_SML, START_CHALLENGE ,
+                          m == MODE_CHALLENGE);
             }
         }
         gui_space(id);
@@ -253,12 +263,13 @@ static int start_enter(void)
             gui_best_times(jd, 0);
         }
         
-       gui_space(id);
-       
-       status_id = gui_label(id, _("Choose a level to play"), GUI_SML, GUI_ALL, gui_yel, gui_wht);
-       
+        gui_space(id);
+        
+        status_id = gui_label(id, _("Choose a level to play"), GUI_SML, GUI_ALL,
+                              gui_yel, gui_wht);
+        
         gui_layout(id, 0, 0);
-       
+        
         set_most_coins(NULL, -1);
         set_best_times(NULL, -1, m != MODE_PRACTICE);
     }
@@ -283,10 +294,10 @@ static int start_keybd(int c, int d)
 {
     if (d && c == SDLK_c && config_get_d(CONFIG_CHEAT))
     {
-       set_cheat();
-       return goto_state(&st_start);
+        set_cheat();
+        return goto_state(&st_start);
     }
-                        
+                         
     if (d && c == SDLK_F12)
     {
         int i;
index bfc0719..d7d0656 100644 (file)
@@ -47,11 +47,13 @@ static int title_action(int i)
     switch (i)
     {
     case TITLE_PLAY: 
-       config_get_s(CONFIG_PLAYER, player, MAXNAM);
-       if (player[0] == '\0')
-           return goto_name(&st_set, &st_title);
-       else
-           return goto_state(&st_set);
+        config_get_s(CONFIG_PLAYER, player, MAXNAM);
+
+        if (player[0] == '\0')
+            return goto_name(&st_set, &st_title);
+        else
+            return goto_state(&st_set);
+
     case TITLE_HELP: return goto_state(&st_help);
     case TITLE_DEMO: return goto_state(&st_demo);
     case TITLE_CONF: return goto_state(&st_conf);
@@ -186,10 +188,10 @@ static void title_timer(int id, float dt)
 static int title_keybd(int c, int d)
 {
     if (d && c == SDLK_c && ALLOW_CHEAT)
-       config_tgl_d(CONFIG_CHEAT);
+        config_tgl_d(CONFIG_CHEAT);
     return 1; 
 }
-       
+        
 static int title_buttn(int b, int d)
 {
     if (d)
index d2e83f6..3777837 100644 (file)
 
 /*---------------------------------------------------------------------------*/
 
-static int is_special_name(const char * n)
+static int is_special_name(const char *n)
 {
-    return (strcmp(n, N_("Hard"))==0 || strcmp(n, N_("Medium"))==0 || strcmp(n, N_("Easy"))==0);
+    return (strcmp(n, N_("Hard")) == 0 || strcmp(n, N_("Medium")) == 0
+            || strcmp(n, N_("Easy")) == 0);
 }
 
 /*---------------------------------------------------------------------------*/
@@ -59,24 +60,24 @@ void gui_most_coins(int id, int e)
                         coin_c[j] = gui_count(md, 1000, GUI_SML, 0);
 
                     coin_c[j++] = gui_count(md, 1000, GUI_SML, GUI_SE);
-                   
-                   if (e)
-                   {
+                    
+                    if (e)
+                    {
                        gui_space(md);
                        coin_c[j++] = gui_count(md, 1000, GUI_SML, GUI_RGT);
-                   }
+                    }
                 }
 
                 if ((md = gui_vstack(ld)))
                 {
                     for (j = 0; j < NSCORE ; j++)
-                       coin_n[j] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
-                   
-                   if (e)
-                   {
-                       gui_space(md);
-                       coin_n[j++] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
-                   }
+                        coin_n[j] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
+                    
+                    if (e)
+                    {
+                        gui_space(md);
+                        coin_n[j++] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
+                    }
                 }
 
                 if ((md = gui_vstack(ld)))
@@ -86,11 +87,11 @@ void gui_most_coins(int id, int e)
 
                     coin_t[j++] = gui_clock(md, 359999,  GUI_SML, GUI_SW);
 
-                   if (e)
-                   {
+                    if (e)
+                    {
                        gui_space(md);
                        coin_t[j++] = gui_clock(md, 359999,  GUI_SML, GUI_LFT);
-                   }
+                    }
                 }
             }
         }
@@ -103,37 +104,37 @@ void gui_most_coins(int id, int e)
 void set_most_coins(const struct score *s, int hilight)
 {
     int j, spe;
-    const char * name;
+    const char *name;
 
     if (s == NULL)
     {
-       for (j = 0; j < NSCORE + coin_extrarow ; j++)
-       {
-           gui_set_count(coin_c[j], -1);
-           gui_set_label(coin_n[j], "");
-           gui_set_clock(coin_t[j], -1);
-       }
+        for (j = 0; j < NSCORE + coin_extrarow ; j++)
+        {
+            gui_set_count(coin_c[j], -1);
+            gui_set_label(coin_n[j], "");
+            gui_set_clock(coin_t[j], -1);
+        }
     }
     else
     {
-       for (j = 0; j < NSCORE + coin_extrarow; j++)
-       {
-           name = s->player[j];
-           spe = is_special_name(name);
-
-           if (spe)
-               gui_set_color(coin_n[j], 0, 0);
-           else if (j != hilight)
-               gui_set_color(coin_n[j], gui_yel, gui_wht);
-           else if (j>= NSCORE)
-               gui_set_color(coin_n[j], gui_red, gui_red);
-           else
-               gui_set_color(coin_n[j], gui_grn, gui_grn);
-
-           gui_set_count(coin_c[j], s->coins[j]);
-           gui_set_label(coin_n[j], spe ? _(name) : name);
-           gui_set_clock(coin_t[j], s->timer[j]);
-       }
+        for (j = 0; j < NSCORE + coin_extrarow; j++)
+        {
+            name = s->player[j];
+            spe = is_special_name(name);
+
+            if (spe)
+                gui_set_color(coin_n[j], 0, 0);
+            else if (j != hilight)
+                gui_set_color(coin_n[j], gui_yel, gui_wht);
+            else if (j>= NSCORE)
+                gui_set_color(coin_n[j], gui_red, gui_red);
+            else
+                gui_set_color(coin_n[j], gui_grn, gui_grn);
+
+            gui_set_count(coin_c[j], s->coins[j]);
+            gui_set_label(coin_n[j], spe ? _(name) : name);
+            gui_set_clock(coin_t[j], s->timer[j]);
+        }
     }
 }
 
@@ -171,12 +172,12 @@ void gui_best_times(int id, int e)
                         time_t2[j] = gui_clock(md, 359999, GUI_SML, 0);
 
                     time_t2[j++] = gui_clock(md, 359999, GUI_SML, GUI_SE);
-                   
-                   if (e)
-                   {
+                    
+                    if (e)
+                    {
                         gui_space(md);
-                       time_t2[j++] = gui_clock(md, 359999, GUI_SML, GUI_RGT);
-                   }
+                        time_t2[j++] = gui_clock(md, 359999, GUI_SML, GUI_RGT);
+                    }
                 }
 
                 if ((md = gui_vstack(ld)))
@@ -184,11 +185,11 @@ void gui_best_times(int id, int e)
                     for (j = 0; j < NSCORE; j++)
                         time_n[j] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
 
-                   if (e)
-                   {
-                       gui_space(md);
+                    if (e)
+                    {
+                        gui_space(md);
                         time_n[j++] = gui_label(md, s, GUI_SML, 0, gui_yel, gui_wht);
-                   }
+                    }
                 }
 
                 if ((md = gui_vstack(ld)))
@@ -197,12 +198,12 @@ void gui_best_times(int id, int e)
                         time_c[j] = gui_count(md, 1000, GUI_SML, 0);
 
                     time_c[j++] = gui_count(md, 1000, GUI_SML, GUI_SW);
-                   
-                   if (e)
-                   {
+                    
+                    if (e)
+                    {
                         gui_space(md);
-                       time_c[j++] = gui_count(md, 1000, GUI_SML, GUI_LFT);
-                   }
+                        time_c[j++] = gui_count(md, 1000, GUI_SML, GUI_LFT);
+                    }
                 }
             }
         }
@@ -215,42 +216,42 @@ void gui_best_times(int id, int e)
 void set_best_times(const struct score *s, int hilight, int goal)
 {
     int j, spe;
-    const char * name;
+    const char *name;
 
     if (goal)
-       gui_set_label(time_l, _("Unlock Goal"));
+        gui_set_label(time_l, _("Unlock Goal"));
     else
-       gui_set_label(time_l, _("Best Times"));
+        gui_set_label(time_l, _("Best Times"));
 
     if (s == NULL)
     {
-       for (j = 0; j < NSCORE + time_extrarow ; j++)
-       {
-           gui_set_clock(time_t2[j], -1);
-           gui_set_label(time_n[j], "");
-           gui_set_count(time_c[j], -1);
-       }
+        for (j = 0; j < NSCORE + time_extrarow ; j++)
+        {
+            gui_set_clock(time_t2[j], -1);
+            gui_set_label(time_n[j], "");
+            gui_set_count(time_c[j], -1);
+        }
     }
     else
     {
-       for (j = 0; j < NSCORE + time_extrarow ; j++)
-       {
-           name = s->player[j];
-           spe = is_special_name(name);
-
-           if (spe)
-               gui_set_color(time_n[j], 0, 0);
-           else if (j != hilight)
-               gui_set_color(time_n[j], gui_yel, gui_wht);
-           else if (j>= NSCORE)
-               gui_set_color(time_n[j], gui_red, gui_red);
-           else
-               gui_set_color(time_n[j], gui_grn, gui_grn);
-
-           gui_set_clock(time_t2[j], s->timer[j]);
-           gui_set_label(time_n[j], spe ? _(name) : name);
-           gui_set_count(time_c[j], s->coins[j]);
-       }
+        for (j = 0; j < NSCORE + time_extrarow; j++)
+        {
+            name = s->player[j];
+            spe = is_special_name(name);
+
+            if (spe)
+                gui_set_color(time_n[j], 0, 0);
+            else if (j != hilight)
+                gui_set_color(time_n[j], gui_yel, gui_wht);
+            else if (j>= NSCORE)
+                gui_set_color(time_n[j], gui_red, gui_red);
+            else
+                gui_set_color(time_n[j], gui_grn, gui_grn);
+
+            gui_set_clock(time_t2[j], s->timer[j]);
+            gui_set_label(time_n[j], spe ? _(name) : name);
+            gui_set_count(time_c[j], s->coins[j]);
+        }
     }
 }
 
@@ -259,14 +260,15 @@ void set_best_times(const struct score *s, int hilight, int goal)
 static int lock = 1;
 static int keyd[127]; 
 
-static void gui_fill(int id, char * line)
+static void gui_fill(int id, char *line)
 {
     char l[2];
     l[1] = '\0';
+
     while(*line)
     {
-       *l = *(line++);
-       keyd[(int)*l] = gui_state(id, l, GUI_SML, *l, 0);
+        *l = *(line++);
+        keyd[(int)*l] = gui_state(id, l, GUI_SML, *l, 0);
     }
 }
 
@@ -285,44 +287,44 @@ void gui_keyboard(int id)
             if ((ld = gui_harray(kd)))
             {
                 gui_filler(ld);
-               gui_fill(ld, "9876543210");
+                gui_fill(ld, "9876543210");
                 gui_filler(ld);
             }
             if ((ld = gui_harray(kd)))
             {
                 gui_filler(ld);
-               gui_fill(ld, "JIHGFEDCBA");
+                gui_fill(ld, "JIHGFEDCBA");
                 gui_filler(ld);
             }
             if ((ld = gui_harray(kd)))
             {
                 gui_filler(ld);
-               gui_fill(ld, "TSRQPONMLK");
+                gui_fill(ld, "TSRQPONMLK");
                 gui_filler(ld);
             }
             if ((ld = gui_harray(kd)))
             {
                 gui_filler(ld);
-               gui_fill(ld, "!.-_ZYXWVU");
+                gui_fill(ld, "!.-_ZYXWVU");
                 gui_filler(ld);
             }
             if ((ld = gui_harray(kd)))
             {
                 gui_filler(ld);
-               gui_fill(ld, "jihgfedcba");
+                gui_fill(ld, "jihgfedcba");
                 gui_filler(ld);
             }
             if ((ld = gui_harray(kd)))
             {
                 gui_filler(ld);
-               gui_fill(ld, "tsrqponmlk");
+                gui_fill(ld, "tsrqponmlk");
                 gui_filler(ld);
             }
             if ((ld = gui_hstack(kd)))
             {
                 gui_filler(ld);
                 gui_state(ld, _("del"), GUI_SML, GUI_BS, 0);
-               gui_fill(ld, "zyxwvu");
+                gui_fill(ld, "zyxwvu");
                 gui_filler(ld);
             }
         }
@@ -337,13 +339,13 @@ int gui_back_prev_next(int id, int prev, int next)
     int jd;
     if ((jd = gui_hstack(id)))
     {
-       if (next || prev)
-       {
-           gui_maybe(jd, _("Next"), GUI_NEXT, next);
-           gui_maybe(jd, _("Prev"), GUI_PREV, prev);
-       }
-       
-       gui_start(jd, _("Back"),  GUI_SML, GUI_BACK, 0);
+        if (next || prev)
+        {
+            gui_maybe(jd, _("Next"), GUI_NEXT, next);
+            gui_maybe(jd, _("Prev"), GUI_PREV, prev);
+        }
+        
+        gui_start(jd, _("Back"),  GUI_SML, GUI_BACK, 0);
     }
     return jd;
 }
@@ -352,11 +354,11 @@ int gui_maybe(int id, const char *label, int token, int enabled)
 {
     int bd;
     if (enabled)
-       bd = gui_state(id, label, GUI_SML, token,    0);
+        bd = gui_state(id, label, GUI_SML, token,    0);
     else
     {
-       bd = gui_state(id, label, GUI_SML, GUI_NULL, 0);
-       gui_set_color(bd, gui_gry, gui_gry);
+        bd = gui_state(id, label, GUI_SML, GUI_NULL, 0);
+        gui_set_color(bd, gui_gry, gui_gry);
     }
     return bd;
 }