rnd-20100310-1-src
authorHolger Schemel <info@artsoft.org>
Wed, 10 Mar 2010 21:27:23 +0000 (22:27 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:58:44 +0000 (10:58 +0200)
* added configurable key shortcuts for the tape recorder buttons

12 files changed:
ChangeLog
src/conf_gfx.c
src/conf_var.c
src/conftime.h
src/editor.c
src/events.c
src/files.c
src/libgame/system.h
src/main.h
src/screens.c
src/tape.c
src/tape.h

index 96a007d5980d9b9e24784672db2f71aa4bafe30e..60f21939eec49bced32f8b87e9e35bcffb3b18e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2010-03-10
+       * added configurable key shortcuts for the tape recorder buttons
+
 2010-03-09
        * added (hidden) function to save native Supaplex levels with tape as
          native *.sp file containing level with demo (saved with a file name
index 28fbd129bda4b8f4f8bf5de7be9aa9d9767e7f89..fdb49e3013fefa74b77438c1210c0c7a469e0c0c 100644 (file)
@@ -5407,10 +5407,14 @@ struct ConfigInfo image_config[] =
   { "menu.draw_yoffset.SETUP[ARTWORK]",                "0"                     },
   { "menu.draw_xoffset.SETUP[INPUT]",          "0"                     },
   { "menu.draw_yoffset.SETUP[INPUT]",          "0"                     },
+  { "menu.draw_xoffset.SETUP[SHORTCUTS]",      "0"                     },
+  { "menu.draw_yoffset.SETUP[SHORTCUTS]",      "0"                     },
   { "menu.draw_xoffset.SETUP[SHORTCUTS_1]",    "0"                     },
   { "menu.draw_yoffset.SETUP[SHORTCUTS_1]",    "0"                     },
   { "menu.draw_xoffset.SETUP[SHORTCUTS_2]",    "0"                     },
   { "menu.draw_yoffset.SETUP[SHORTCUTS_2]",    "0"                     },
+  { "menu.draw_xoffset.SETUP[SHORTCUTS_3]",    "0"                     },
+  { "menu.draw_yoffset.SETUP[SHORTCUTS_3]",    "0"                     },
   { "menu.draw_xoffset.SETUP[CHOOSE_ARTWORK]", "0"                     },
   { "menu.draw_yoffset.SETUP[CHOOSE_ARTWORK]", "0"                     },
   { "menu.draw_xoffset.SETUP[CHOOSE_OTHER]",   "0"                     },
index a965464da41776354647305495ce7375a6db11cb..90ed0b135c96075a1297a76bf1701d96cfe1054c 100644 (file)
@@ -1288,6 +1288,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "menu.draw_yoffset.SETUP[INPUT]",
     &menu.draw_yoffset_setup[GFX_SPECIAL_ARG_SETUP_INPUT]
   },
+  {
+    "menu.draw_xoffset.SETUP[SHORTCUTS]",
+    &menu.draw_xoffset_setup[GFX_SPECIAL_ARG_SETUP_SHORTCUTS]
+  },
+  {
+    "menu.draw_yoffset.SETUP[SHORTCUTS]",
+    &menu.draw_yoffset_setup[GFX_SPECIAL_ARG_SETUP_SHORTCUTS]
+  },
   {
     "menu.draw_xoffset.SETUP[SHORTCUTS_1]",
     &menu.draw_xoffset_setup[GFX_SPECIAL_ARG_SETUP_SHORTCUTS_1]
@@ -1304,6 +1312,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "menu.draw_yoffset.SETUP[SHORTCUTS_2]",
     &menu.draw_yoffset_setup[GFX_SPECIAL_ARG_SETUP_SHORTCUTS_2]
   },
+  {
+    "menu.draw_xoffset.SETUP[SHORTCUTS_3]",
+    &menu.draw_xoffset_setup[GFX_SPECIAL_ARG_SETUP_SHORTCUTS_3]
+  },
+  {
+    "menu.draw_yoffset.SETUP[SHORTCUTS_3]",
+    &menu.draw_yoffset_setup[GFX_SPECIAL_ARG_SETUP_SHORTCUTS_3]
+  },
   {
     "menu.draw_xoffset.SETUP[CHOOSE_ARTWORK]",
     &menu.draw_xoffset_setup[GFX_SPECIAL_ARG_SETUP_CHOOSE_ARTWORK]
index 0a5f28590397b68b19f9bbf5d06bc66f8d0d97c1..6467aafc3e399717c9563a2e97377a88b714dd31 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2010-03-09 23:35"
+#define COMPILE_DATE_STRING "2010-03-10 14:11"
index bbc863cae7e21318aad9f1ad2137a63187cd1c8b..9d5c42d2b9dd19ed3084ab734c5fa3e690158246 100644 (file)
@@ -11649,7 +11649,9 @@ void HandleLevelEditorKeyInput(Key key)
       ClickOnGadget(level_editor_gadget[id], button);
     else if (letter == '.')
       ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS], button);
-    else if (key == KSYM_Return || key == setup.shortcut.toggle_pause)
+    else if (key == KSYM_Return ||
+            key == KSYM_space ||
+            key == setup.shortcut.toggle_pause)
       ClickOnGadget(level_editor_gadget[GADGET_ID_TEST], button);
     else
       for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
index 2d9cbfcd159329dc24e59bf3e26092de59765c00..b9b5b8621ffde3e25c1d15a06c9f6543a1782bb2 100644 (file)
@@ -762,6 +762,8 @@ void HandleKey(Key key, int key_status)
       TapeQuickLoad();
     else if (key == setup.shortcut.toggle_pause)
       TapeTogglePause(TAPE_TOGGLE_MANUAL);
+
+    HandleTapeButtonKeys(key);
   }
 
   if (game_status == GAME_MODE_PLAYING && !network_playing)
index 124b1db04b05c7b8fce2925962392718e6f9f7bb..205c371ad71868f4ccca190d1900a0f5174ae25a 100644 (file)
@@ -9003,8 +9003,13 @@ void SaveScore(int nr)
 #define SETUP_TOKEN_SHORTCUT_FOCUS_PLAYER_3    5
 #define SETUP_TOKEN_SHORTCUT_FOCUS_PLAYER_4    6
 #define SETUP_TOKEN_SHORTCUT_FOCUS_PLAYER_ALL  7
+#define SETUP_TOKEN_SHORTCUT_TAPE_EJECT                8
+#define SETUP_TOKEN_SHORTCUT_TAPE_STOP         9
+#define SETUP_TOKEN_SHORTCUT_TAPE_PAUSE                10
+#define SETUP_TOKEN_SHORTCUT_TAPE_RECORD       11
+#define SETUP_TOKEN_SHORTCUT_TAPE_PLAY         12
 
-#define NUM_SHORTCUT_SETUP_TOKENS              8
+#define NUM_SHORTCUT_SETUP_TOKENS              13
 
 /* player setup */
 #define SETUP_TOKEN_PLAYER_USE_JOYSTICK                0
@@ -9149,6 +9154,11 @@ static struct TokenInfo shortcut_setup_tokens[] =
   { TYPE_KEY_X11, &ssi.focus_player[2],        "shortcut.focus_player_3"       },
   { TYPE_KEY_X11, &ssi.focus_player[3],        "shortcut.focus_player_4"       },
   { TYPE_KEY_X11, &ssi.focus_player_all,"shortcut.focus_player_all"    },
+  { TYPE_KEY_X11, &ssi.tape_eject,     "shortcut.tape_eject"           },
+  { TYPE_KEY_X11, &ssi.tape_stop,      "shortcut.tape_stop"            },
+  { TYPE_KEY_X11, &ssi.tape_pause,     "shortcut.tape_pause"           },
+  { TYPE_KEY_X11, &ssi.tape_record,    "shortcut.tape_record"          },
+  { TYPE_KEY_X11, &ssi.tape_play,      "shortcut.tape_play"            },
 };
 
 static struct TokenInfo player_setup_tokens[] =
@@ -9265,6 +9275,12 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->shortcut.focus_player[3] = DEFAULT_KEY_FOCUS_PLAYER_4;
   si->shortcut.focus_player_all        = DEFAULT_KEY_FOCUS_PLAYER_ALL;
 
+  si->shortcut.tape_eject      = DEFAULT_KEY_TAPE_EJECT;
+  si->shortcut.tape_stop       = DEFAULT_KEY_TAPE_STOP;
+  si->shortcut.tape_pause      = DEFAULT_KEY_TAPE_PAUSE;
+  si->shortcut.tape_record     = DEFAULT_KEY_TAPE_RECORD;
+  si->shortcut.tape_play       = DEFAULT_KEY_TAPE_PLAY;
+
   for (i = 0; i < MAX_PLAYERS; i++)
   {
     si->input[i].use_joystick = FALSE;
index 26d192e396054a31b6341b8813328c0bf6e72bbe..aeab9c23cd3b737240c53fd2a4bc88f8a65961e5 100644 (file)
 #define DEFAULT_KEY_FOCUS_PLAYER_3     KSYM_F7
 #define DEFAULT_KEY_FOCUS_PLAYER_4     KSYM_F8
 #define DEFAULT_KEY_FOCUS_PLAYER_ALL   KSYM_F9
+#define DEFAULT_KEY_TAPE_EJECT         KSYM_UNDEFINED
+#define DEFAULT_KEY_TAPE_STOP          KSYM_UNDEFINED
+#define DEFAULT_KEY_TAPE_PAUSE         KSYM_UNDEFINED
+#define DEFAULT_KEY_TAPE_RECORD                KSYM_UNDEFINED
+#define DEFAULT_KEY_TAPE_PLAY          KSYM_UNDEFINED
 
 /* values for key_status */
 #define KEY_NOT_PRESSED                        FALSE
@@ -834,6 +839,12 @@ struct SetupShortcutInfo
 
   Key focus_player[MAX_PLAYERS];
   Key focus_player_all;
+
+  Key tape_eject;
+  Key tape_stop;
+  Key tape_pause;
+  Key tape_record;
+  Key tape_play;
 };
 
 struct SetupSystemInfo
index 9376b3ae4095ff270f3e5d5346ae3f30aabb5a88..56ecbd16a67dbeabac69dadc4ffd331e1411cd83 100644 (file)
 #define GFX_SPECIAL_ARG_SETUP_SOUND            4
 #define GFX_SPECIAL_ARG_SETUP_ARTWORK          5
 #define GFX_SPECIAL_ARG_SETUP_INPUT            6
-#define GFX_SPECIAL_ARG_SETUP_SHORTCUTS_1      7
-#define GFX_SPECIAL_ARG_SETUP_SHORTCUTS_2      8
-#define GFX_SPECIAL_ARG_SETUP_CHOOSE_ARTWORK   9
-#define GFX_SPECIAL_ARG_SETUP_CHOOSE_OTHER     10
-
-#define NUM_SPECIAL_GFX_SETUP_ARGS             11
+#define GFX_SPECIAL_ARG_SETUP_SHORTCUTS                7
+#define GFX_SPECIAL_ARG_SETUP_SHORTCUTS_1      8
+#define GFX_SPECIAL_ARG_SETUP_SHORTCUTS_2      9
+#define GFX_SPECIAL_ARG_SETUP_SHORTCUTS_3      10
+#define GFX_SPECIAL_ARG_SETUP_CHOOSE_ARTWORK   11
+#define GFX_SPECIAL_ARG_SETUP_CHOOSE_OTHER     12
+
+#define NUM_SPECIAL_GFX_SETUP_ARGS             13
 
 
 /* values for image configuration suffixes */
index 34eec7468caa7ca501ff2a903757a82f8aa1a1b7..74690d7fd3ce52c2a6cc59228950b3a3ac41cde4 100644 (file)
 #define SETUP_MODE_SOUND               4
 #define SETUP_MODE_ARTWORK             5
 #define SETUP_MODE_INPUT               6
-#define SETUP_MODE_SHORTCUTS_1         7
-#define SETUP_MODE_SHORTCUTS_2         8
+#define SETUP_MODE_SHORTCUTS           7
+#define SETUP_MODE_SHORTCUTS_1         8
+#define SETUP_MODE_SHORTCUTS_2         9
+#define SETUP_MODE_SHORTCUTS_3         10
 
 /* sub-screens on the setup screen (generic) */
-#define SETUP_MODE_CHOOSE_ARTWORK      9
-#define SETUP_MODE_CHOOSE_OTHER                10
+#define SETUP_MODE_CHOOSE_ARTWORK      11
+#define SETUP_MODE_CHOOSE_OTHER                12
 
 /* sub-screens on the setup screen (specific) */
-#define SETUP_MODE_CHOOSE_GAME_SPEED   11
-#define SETUP_MODE_CHOOSE_SCREEN_MODE  12
-#define SETUP_MODE_CHOOSE_SCROLL_DELAY 13
-#define SETUP_MODE_CHOOSE_GRAPHICS     14
-#define SETUP_MODE_CHOOSE_SOUNDS       15
-#define SETUP_MODE_CHOOSE_MUSIC                16
+#define SETUP_MODE_CHOOSE_GAME_SPEED   13
+#define SETUP_MODE_CHOOSE_SCREEN_MODE  14
+#define SETUP_MODE_CHOOSE_SCROLL_DELAY 15
+#define SETUP_MODE_CHOOSE_GRAPHICS     16
+#define SETUP_MODE_CHOOSE_SOUNDS       17
+#define SETUP_MODE_CHOOSE_MUSIC                18
 
-#define MAX_SETUP_MODES                        17
+#define MAX_SETUP_MODES                        19
 
 /* for input setup functions */
 #define SETUPINPUT_SCREEN_POS_START    0
@@ -232,7 +234,7 @@ static struct
                                 INFO_MODE_MAIN)
 
 #define DRAW_MODE_SETUP(i)     ((i) >= SETUP_MODE_MAIN &&              \
-                                (i) <= SETUP_MODE_SHORTCUTS_2 ? (i) :  \
+                                (i) <= SETUP_MODE_SHORTCUTS_3 ? (i) :  \
                                 (i) >= SETUP_MODE_CHOOSE_GRAPHICS &&   \
                                 (i) <= SETUP_MODE_CHOOSE_MUSIC ?       \
                                 SETUP_MODE_CHOOSE_ARTWORK :            \
@@ -4081,6 +4083,13 @@ static void execSetupInput()
   DrawSetupScreen();
 }
 
+static void execSetupShortcuts()
+{
+  setup_mode = SETUP_MODE_SHORTCUTS;
+
+  DrawSetupScreen();
+}
+
 static void execSetupShortcuts1()
 {
   setup_mode = SETUP_MODE_SHORTCUTS_1;
@@ -4095,6 +4104,13 @@ static void execSetupShortcuts2()
   DrawSetupScreen();
 }
 
+static void execSetupShortcuts3()
+{
+  setup_mode = SETUP_MODE_SHORTCUTS_3;
+
+  DrawSetupScreen();
+}
+
 static void execExitSetup()
 {
   game_status = GAME_MODE_MAIN;
@@ -4116,8 +4132,7 @@ static struct TokenInfo setup_info_main[] =
   { TYPE_ENTER_MENU,   execSetupSound,         "Sound & Music"         },
   { TYPE_ENTER_MENU,   execSetupArtwork,       "Custom Artwork"        },
   { TYPE_ENTER_MENU,   execSetupInput,         "Input Devices"         },
-  { TYPE_ENTER_MENU,   execSetupShortcuts1,    "Key Shortcuts 1"       },
-  { TYPE_ENTER_MENU,   execSetupShortcuts2,    "Key Shortcuts 2"       },
+  { TYPE_ENTER_MENU,   execSetupShortcuts,     "Key Shortcuts"         },
   { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_LEAVE_MENU,   execExitSetup,          "Exit"                  },
   { TYPE_LEAVE_MENU,   execSaveAndExitSetup,   "Save and Exit"         },
@@ -4263,6 +4278,17 @@ static struct TokenInfo setup_info_input[] =
   { 0,                 NULL,                   NULL                    }
 };
 
+static struct TokenInfo setup_info_shortcuts[] =
+{
+  { TYPE_ENTER_MENU,   execSetupShortcuts1,    "Various Keys"  },
+  { TYPE_ENTER_MENU,   execSetupShortcuts2,    "Player Focus"  },
+  { TYPE_ENTER_MENU,   execSetupShortcuts3,    "Tape Buttons"  },
+  { TYPE_EMPTY,                NULL,                   ""                      },
+  { TYPE_LEAVE_MENU,   execSetupMain,          "Back"                  },
+
+  { 0,                 NULL,                   NULL                    }
+};
+
 static struct TokenInfo setup_info_shortcuts_1[] =
 {
   { TYPE_KEYTEXT,      NULL,           "Quick Save Game to Tape:",     },
@@ -4275,7 +4301,7 @@ static struct TokenInfo setup_info_shortcuts_1[] =
   { TYPE_YES_NO,       &setup.ask_on_escape,   "Ask on 'Esc' Key:"     },
   { TYPE_YES_NO, &setup.ask_on_escape_editor,  "Ask on 'Esc' Key (Editor):" },
   { TYPE_EMPTY,                NULL,                   ""                      },
-  { TYPE_LEAVE_MENU,   execSetupMain,          "Back"                  },
+  { TYPE_LEAVE_MENU,   execSetupShortcuts,     "Back"                  },
 
   { 0,                 NULL,                   NULL                    }
 };
@@ -4293,7 +4319,25 @@ static struct TokenInfo setup_info_shortcuts_2[] =
   { TYPE_KEYTEXT,      NULL,           "Set Focus to All Players:",    },
   { TYPE_KEY,          &setup.shortcut.focus_player_all, ""            },
   { TYPE_EMPTY,                NULL,                   ""                      },
-  { TYPE_LEAVE_MENU,   execSetupMain,          "Back"                  },
+  { TYPE_LEAVE_MENU,   execSetupShortcuts,     "Back"                  },
+
+  { 0,                 NULL,                   NULL                    }
+};
+
+static struct TokenInfo setup_info_shortcuts_3[] =
+{
+  { TYPE_KEYTEXT,      NULL,           "Tape Eject:",                  },
+  { TYPE_KEY,          &setup.shortcut.tape_eject, ""                  },
+  { TYPE_KEYTEXT,      NULL,           "Tape Stop:",                   },
+  { TYPE_KEY,          &setup.shortcut.tape_stop, ""                   },
+  { TYPE_KEYTEXT,      NULL,           "Tape Pause:",                  },
+  { TYPE_KEY,          &setup.shortcut.tape_pause, ""                  },
+  { TYPE_KEYTEXT,      NULL,           "Tape Record:",                 },
+  { TYPE_KEY,          &setup.shortcut.tape_record, ""                 },
+  { TYPE_KEYTEXT,      NULL,           "Tape Play:",                   },
+  { TYPE_KEY,          &setup.shortcut.tape_play, ""                   },
+  { TYPE_EMPTY,                NULL,                   ""                      },
+  { TYPE_LEAVE_MENU,   execSetupShortcuts,     "Back"                  },
 
   { 0,                 NULL,                   NULL                    }
 };
@@ -4576,6 +4620,11 @@ static void DrawSetupScreen_Generic()
     setup_info = setup_info_artwork;
     title_string = "Custom Artwork";
   }
+  else if (setup_mode == SETUP_MODE_SHORTCUTS)
+  {
+    setup_info = setup_info_shortcuts;
+    title_string = "Setup Shortcuts";
+  }
   else if (setup_mode == SETUP_MODE_SHORTCUTS_1)
   {
     setup_info = setup_info_shortcuts_1;
@@ -4586,6 +4635,11 @@ static void DrawSetupScreen_Generic()
     setup_info = setup_info_shortcuts_2;
     title_string = "Setup Shortcuts";
   }
+  else if (setup_mode == SETUP_MODE_SHORTCUTS_3)
+  {
+    setup_info = setup_info_shortcuts_3;
+    title_string = "Setup Shortcuts";
+  }
 
   DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, title_string);
 
index 88f0f5a0300e4e0799ff9abf40cda0e138d3fd51..9f2a61f39bae0069976c9587c3d908289051250f 100644 (file)
@@ -1299,10 +1299,8 @@ void UnmapTapeButtons()
     UnmapGadget(tape_gadget[i]);
 }
 
-static void HandleTapeButtons(struct GadgetInfo *gi)
+static void HandleTapeButtonsExt(int id)
 {
-  int id = gi->custom_id;
-
   if (game_status != GAME_MODE_MAIN && game_status != GAME_MODE_PLAYING)
     return;
 
@@ -1407,3 +1405,24 @@ static void HandleTapeButtons(struct GadgetInfo *gi)
       break;
   }
 }
+
+static void HandleTapeButtons(struct GadgetInfo *gi)
+{
+  HandleTapeButtonsExt(gi->custom_id);
+}
+
+void HandleTapeButtonKeys(Key key)
+{
+  boolean use_extra = (tape.recording || tape.playing);
+
+  if (key == setup.shortcut.tape_eject)
+    HandleTapeButtonsExt(use_extra ? TAPE_CTRL_ID_EXTRA : TAPE_CTRL_ID_EJECT);
+  else if (key == setup.shortcut.tape_stop)
+    HandleTapeButtonsExt(TAPE_CTRL_ID_STOP);
+  else if (key == setup.shortcut.tape_pause)
+    HandleTapeButtonsExt(TAPE_CTRL_ID_PAUSE);
+  else if (key == setup.shortcut.tape_record)
+    HandleTapeButtonsExt(TAPE_CTRL_ID_RECORD);
+  else if (key == setup.shortcut.tape_play)
+    HandleTapeButtonsExt(TAPE_CTRL_ID_PLAY);
+}
index 5243f26845d1f7671b9419c61a1d53ce1eb3f24c..cafa235d41170fc46ad4191df5a0509510b17172 100644 (file)
@@ -165,4 +165,6 @@ void MapTapeWarpButton();
 void MapTapeButtons();
 void UnmapTapeButtons();
 
+void HandleTapeButtonKeys(Key);
+
 #endif