added definitions for upcoming new name selection screen
[rocksndiamonds.git] / src / screens.c
index 4d5c8b18cbf992b9fa4f516fffccb433c8628c83..f0fca35b2ee9cf9c38feb9a2cf458b321fa068b5 100644 (file)
@@ -252,6 +252,7 @@ static void DrawChooseLevelSet(void);
 static void DrawChooseLevelNr(void);
 static void DrawInfoScreen(void);
 static void DrawSetupScreen(void);
+static void DrawTypeName(void);
 
 static void DrawInfoScreen_NotAvailable(char *, char *);
 static void DrawInfoScreen_HelpAnim(int, int, boolean);
@@ -540,7 +541,9 @@ static int align_yoffset = 0;
 #define DRAW_MODE(s)           ((s) >= GAME_MODE_MAIN &&               \
                                 (s) <= GAME_MODE_SETUP ? (s) :         \
                                 (s) == GAME_MODE_PSEUDO_TYPENAME ?     \
-                                GAME_MODE_MAIN : GAME_MODE_DEFAULT)
+                                GAME_MODE_MAIN :                       \
+                                (s) == GAME_MODE_PSEUDO_TYPENAMES ?    \
+                                GAME_MODE_NAMES : GAME_MODE_DEFAULT)
 
 // (there are no draw offset definitions needed for INFO_MODE_TITLE)
 #define DRAW_MODE_INFO(i)      ((i) >= INFO_MODE_TITLE &&              \
@@ -2080,7 +2083,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
        {
          SetGameStatus(GAME_MODE_PSEUDO_TYPENAME);
 
-         HandleTypeName(strlen(setup.player_name), 0);
+         DrawTypeName();
        }
       }
       else if (pos == MAIN_CONTROL_LEVELS)
@@ -3960,7 +3963,7 @@ void HandleInfoScreen(int mx, int my, int dx, int dy, int button)
 // type name functions
 // ============================================================================
 
-void HandleTypeName(int newxpos, Key key)
+static void HandleTypeNameExt(boolean initialize, Key key)
 {
   static char last_player_name[MAX_PLAYER_NAME_LEN + 1];
   struct MainControlInfo *mci = getMainControlInfo(MAIN_CONTROL_NAME);
@@ -3977,11 +3980,11 @@ void HandleTypeName(int newxpos, Key key)
 
   DrawBackgroundForFont(startx,starty, pos->width, pos->height, font_active_nr);
 
-  if (newxpos)
+  if (initialize)
   {
     strcpy(last_player_name, setup.player_name);
 
-    xpos = newxpos;
+    xpos = strlen(setup.player_name);
 
     StartTextInput(startx, starty, pos->width, pos->height);
   }
@@ -4034,6 +4037,16 @@ void HandleTypeName(int newxpos, Key key)
   }
 }
 
+static void DrawTypeName(void)
+{
+  HandleTypeNameExt(TRUE, 0);
+}
+
+void HandleTypeName(Key key)
+{
+  HandleTypeNameExt(FALSE, key);
+}
+
 
 // ============================================================================
 // tree menu functions