rnd-20060203-1-src
[rocksndiamonds.git] / src / screens.c
index b3732972293429add837ad45c1b2fa1725ac9e59..c7382d07776c28afce6541d4000f12c99e030dae 100644 (file)
@@ -285,8 +285,10 @@ void DrawMainMenu()
   SetDrawtoField(DRAW_BACKBUFFER);
 #endif
 
+#if 0
   /* map gadgets for main menu screen */
   MapTapeButtons();
+#endif
 
   /* level_nr may have been set to value over handicap with level editor */
   if (setup.handicap && level_nr > leveldir_current->handicap_level)
@@ -390,6 +392,11 @@ void DrawMainMenu()
   PlayMenuMusic();
 
   OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
+
+#if 1
+  /* map gadgets for main menu screen */
+  MapTapeButtons();
+#endif
 }
 
 #if 0
@@ -880,7 +887,7 @@ static char *getHelpText(int element, int action, int direction)
     strcat(token, element_action_info[action].suffix);
 
   if (direction != -1)
-    strcat(token, element_direction_info[MV_DIR_BIT(direction)].suffix);
+    strcat(token, element_direction_info[MV_DIR_TO_BIT(direction)].suffix);
 
   return getHashEntry(helptext_info, token);
 }
@@ -2043,14 +2050,18 @@ static struct TokenInfo setup_info_editor[] =
 #if 0
   { TYPE_STRING,       NULL,                   "Offer Special Elements:"},
 #endif
+
+#if 0
+#else
   { TYPE_SWITCH,       &setup.editor.el_boulderdash,   "BoulderDash:"  },
   { TYPE_SWITCH,       &setup.editor.el_emerald_mine,  "Emerald Mine:" },
-  { TYPE_SWITCH,       &setup.editor.el_emerald_mine_club,"E.M. Club:" },
-  { TYPE_SWITCH,       &setup.editor.el_more,          "More:"         },
+  { TYPE_SWITCH,       &setup.editor.el_emerald_mine_club,"E.M.C.:"    },
+  { TYPE_SWITCH,       &setup.editor.el_more,          "R'n'D:"        },
   { TYPE_SWITCH,       &setup.editor.el_sokoban,       "Sokoban:"      },
   { TYPE_SWITCH,       &setup.editor.el_supaplex,      "Supaplex:"     },
-  { TYPE_SWITCH,       &setup.editor.el_diamond_caves, "Diamd. Caves:" },
-  { TYPE_SWITCH,       &setup.editor.el_dx_boulderdash,"DX Boulderd.:" },
+  { TYPE_SWITCH,       &setup.editor.el_diamond_caves, "DC II:"        },
+  { TYPE_SWITCH,       &setup.editor.el_dx_boulderdash,"DX BD:"        },
+#endif
   { TYPE_SWITCH,       &setup.editor.el_chars,         "Characters:"   },
   { TYPE_SWITCH,       &setup.editor.el_custom,        "Custom:"       },
   { TYPE_SWITCH,       &setup.editor.el_headlines,     "Headlines:"    },
@@ -2503,6 +2514,8 @@ static void drawPlayerSetupInputInfo(int player_nr)
     "Joystick4"
   };
 
+  InitJoysticks();
+
   custom_key = setup.input[player_nr].key;
 
   DrawText(mSX + 11 * 32, mSY + 2 * 32, int2str(player_nr + 1, 1),
@@ -2516,10 +2529,10 @@ static void drawPlayerSetupInputInfo(int player_nr)
   if (setup.input[player_nr].use_joystick)
   {
     char *device_name = setup.input[player_nr].joy.device_name;
+    char *text = joystick_name[getJoystickNrFromDeviceName(device_name)];
+    int font_nr = (joystick.fd[player_nr] < 0 ? FONT_VALUE_OLD : FONT_VALUE_1);
 
-    DrawText(mSX + 8 * 32, mSY + 3 * 32,
-            joystick_name[getJoystickNrFromDeviceName(device_name)],
-            FONT_VALUE_1);
+    DrawText(mSX + 8 * 32, mSY + 3 * 32, text, font_nr);
     DrawText(mSX + 32, mSY + 4 * 32, "Calibrate", FONT_MENU_1);
   }
   else
@@ -2971,7 +2984,9 @@ static boolean CalibrateJoystickMain(int player_nr)
 
   StopAnimation();
 
+#if 0
   DrawSetupScreen_Input();
+#endif
 
   /* wait until the last pressed button was released */
   while (Joystick(player_nr) & JOY_BUTTON)
@@ -2994,13 +3009,25 @@ void CalibrateJoystick(int player_nr)
 {
   if (!CalibrateJoystickMain(player_nr))
   {
+    char *device_name = setup.input[player_nr].joy.device_name;
+    int nr = getJoystickNrFromDeviceName(device_name) + 1;
+    int xpos = mSX - SX;
+    int ypos = mSY - SY;
+
     ClearWindow();
 
-    DrawText(mSX + 16, mSY + 6 * 32, "  JOYSTICK NOT  ",  FONT_TITLE_1);
-    DrawText(mSX,      mSY + 7 * 32, "    AVAILABLE    ", FONT_TITLE_1);
+    DrawTextF(xpos + 16, ypos + 6 * 32, FONT_TITLE_1, "   JOYSTICK %d   ", nr);
+    DrawTextF(xpos + 16, ypos + 7 * 32, FONT_TITLE_1, " NOT AVAILABLE! ");
     BackToFront();
-    Delay(2000);       /* show error message for two seconds */
+
+    Delay(2000);               /* show error message for a short time */
+
+    ClearEventQueue();
   }
+
+#if 1
+  DrawSetupScreen_Input();
+#endif
 }
 
 void DrawSetupScreen()
@@ -3119,7 +3146,18 @@ void HandleGameActions()
     if (tape.recording)
       TapeRecordAction(tape_action);
 
+#if 1
+    {
+      byte effective_action[MAX_PLAYERS];
+
+      for (i = 0; i < MAX_PLAYERS; i++)
+       effective_action[i] = stored_player[i].effective_action;
+
+      GameActions_EM(effective_action);
+    }
+#else
     GameActions_EM(local_player->effective_action);
+#endif
 
     if (TimeFrames >= FRAMES_PER_SECOND)
     {