fix #63
authormrtout <mrtout@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sat, 11 Mar 2006 00:45:47 +0000 (00:45 +0000)
committermrtout <mrtout@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Sat, 11 Mar 2006 00:45:47 +0000 (00:45 +0000)
git-svn-id: https://s.snth.net/svn/neverball/trunk@320 78b8d119-cf0a-0410-b17c-f493084dd1d7

ball/level.h
ball/levels.c
ball/set.c
ball/st_goal.c

index e0a901e..9ab5457 100644 (file)
@@ -85,9 +85,6 @@ struct level_game
     int timer;         /* time elapsed */
     int state_value;   /* more precision about the state: skip for goal */
 
-    int dead;          /* Is the game over and lost? */
-    int win;           /* Is the game over and win? */
-    
     /* rank = 3  => unclassed */
     int coin_rank;     /* rank in the level high-scores */
     int goal_rank;     /* rank in the level high-scores */
@@ -95,6 +92,10 @@ struct level_game
     int score_rank;    /* rank in the set high-scores */
     int times_rank;    /* rank in the set high-scores */
 
+    /* What about the game and the set? */
+    int dead;          /* Is the game over and lost? */
+    int win;           /* Is the game over and win? */
+    int unlock;        /* Is the next level newly unlocked */
     const struct level *next_level; /* next level (NULL no next level) */
 };
 
index 58e1c3a..0ea9270 100644 (file)
@@ -57,7 +57,7 @@ int level_play_go(void)
     lg->timer = lg->time;
     lg->coin_rank = lg->goal_rank = lg->time_rank = 
            lg->score_rank = lg-> times_rank = 3;
-    lg->win = lg->dead = 0;
+    lg->win = lg->dead = lg->unlock = 0;
     lg->next_level = NULL;
     
     return demo_play_init(USER_REPLAY_FILE, l, lg);
index 6900ade..6f81a45 100644 (file)
@@ -591,6 +591,7 @@ void set_finish_level(struct level_game *lg, const char *player)
     {
        if (lg->mode == MODE_CHALLENGE || lg->mode == MODE_NORMAL)
        {
+           lg->unlock = 1;
            nl->is_locked = 0;
            s->locked -= 1;
            dirty = 1;
index f86d8d9..3fe55e9 100644 (file)
@@ -153,10 +153,11 @@ static int goal_init(int * gidp)
 
         if ((jd = gui_harray(id)))
         {
+           int nlid = 0;
            if (lg->win)
                 gui_start(jd, _("Finish"),      GUI_SML, GOAL_DONE, 0);
            else if (lg->next_level != NULL)
-                gui_state(jd, _("Next Level"),  GUI_SML, GOAL_NEXT, 0);
+                nlid = gui_start(jd, _("Next Level"),  GUI_SML, GOAL_NEXT, 0);
             else if (mode != MODE_SINGLE)
                 gui_label(jd, _("Next Level"),  GUI_SML, GUI_ALL, gui_blk, gui_blk);
            
@@ -170,7 +171,10 @@ static int goal_init(int * gidp)
                 gui_state(jd, _("Save Replay"), GUI_SML, GOAL_SAVE, 0);
            else
                 gui_label(jd, _("Save Replay"), GUI_SML, GUI_ALL, gui_blk, gui_blk);
-           
+
+           /* default is next if the next level is newly unkocked */
+           if (nlid != 0 && lg->unlock)
+                gui_focus(nlid);
         }
 
         if (high)