rnd-20100608-1-src
authorHolger Schemel <info@artsoft.org>
Tue, 8 Jun 2010 20:12:49 +0000 (22:12 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:59:21 +0000 (10:59 +0200)
* added configurable key shortcuts for snap+direction player actions
  (probably most useful for recording tool-assisted speedrun (TAS)
  tapes using the single-step mode of the tape recorder)
* version number set to 3.3.0.1
* version 3.3.0.0 released

ChangeLog
src/Makefile
src/conftime.h
src/events.c
src/files.c
src/libgame/joystick.h
src/libgame/system.h
src/main.h
src/screens.c

index 945185889fcbf1d89ae14da6d22a205ba4cfc838..54fffaceb579c560ba707da6da94211ab6c330d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-06-08
+       * added configurable key shortcuts for snap+direction player actions
+         (probably most useful for recording tool-assisted speedrun (TAS)
+         tapes using the single-step mode of the tape recorder)
+
+2010-05-28
+       * version number set to 3.3.0.1
+
+2010-05-25
+       * version 3.3.0.0 released
+
 2010-05-22
        * fixed missing memory allocation in SP engine when saving engine data
          for non-SP game engine snapshots (which also stores SP engine part)
index 4bbbcca9c1c8fbb29fb4f4c0905fecf82db2c5e2..20b8f36790085e47ac016cb2d2759f61ffd2f01e 100644 (file)
@@ -144,7 +144,7 @@ CONFIG_GAME_DIR = $(CONFIG_RO_GAME_DIR) $(CONFIG_RW_GAME_DIR)
 CONFIG_GAME = $(CONFIG_GAME_DIR) $(CONFIG_SCORE_ENTRIES) $(CONFIG_SPECIAL)
 
 CONFIG = $(CONFIG_GAME) $(JOYSTICK)
-DEBUG = -DDEBUG -g
+DEBUG = -DDEBUG -g
 # PROFILING = $(PROFILING_FLAGS)
 
 # OPTIONS = $(DEBUG) -Wall                     # only for debugging purposes
index 9be483641a98f8003cf4eeb794120cf35957acae..902b91f30a025aab9d7013b50ed8c57a17a9fdc6 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2010-05-25 22:42"
+#define COMPILE_DATE_STRING "2010-06-08 22:05"
index 9a42eb47c16e74f5b7c6edfa7140c2f9712e5091..8c7aecae91f65ec4d95c5b8880f250062120704b 100644 (file)
@@ -607,20 +607,22 @@ static void HandleKeysSpecial(Key key)
 void HandleKey(Key key, int key_status)
 {
   boolean anyTextGadgetActiveOrJustFinished = anyTextGadgetActive();
-  static struct SetupKeyboardInfo custom_key;
+  static struct SetupKeyboardInfo ski;
+  static struct SetupShortcutInfo ssi;
   static struct
   {
     Key *key_custom;
+    Key *key_snap;
     Key key_default;
     byte action;
   } key_info[] =
   {
-    { &custom_key.left,  DEFAULT_KEY_LEFT,  JOY_LEFT     },
-    { &custom_key.right, DEFAULT_KEY_RIGHT, JOY_RIGHT    },
-    { &custom_key.up,    DEFAULT_KEY_UP,    JOY_UP       },
-    { &custom_key.down,  DEFAULT_KEY_DOWN,  JOY_DOWN     },
-    { &custom_key.snap,  DEFAULT_KEY_SNAP,  JOY_BUTTON_1 },
-    { &custom_key.drop,  DEFAULT_KEY_DROP,  JOY_BUTTON_2 }
+    { &ski.left,  &ssi.snap_left,  DEFAULT_KEY_LEFT,  JOY_LEFT        },
+    { &ski.right, &ssi.snap_right, DEFAULT_KEY_RIGHT, JOY_RIGHT       },
+    { &ski.up,    &ssi.snap_up,    DEFAULT_KEY_UP,    JOY_UP          },
+    { &ski.down,  &ssi.snap_down,  DEFAULT_KEY_DOWN,  JOY_DOWN        },
+    { &ski.snap,  NULL,            DEFAULT_KEY_SNAP,  JOY_BUTTON_SNAP },
+    { &ski.drop,  NULL,            DEFAULT_KEY_DROP,  JOY_BUTTON_DROP }
   };
   int joy = 0;
   int i;
@@ -632,6 +634,8 @@ void HandleKey(Key key, int key_status)
     static boolean element_dropped[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE };
     int pnr;
 
+    ssi = setup.shortcut;
+
     for (pnr = 0; pnr < MAX_PLAYERS; pnr++)
     {
       byte key_action = 0;
@@ -639,12 +643,16 @@ void HandleKey(Key key, int key_status)
       if (setup.input[pnr].use_joystick)
        continue;
 
-      custom_key = setup.input[pnr].key;
+      ski = setup.input[pnr].key;
 
-      for (i = 0; i < 6; i++)
+      for (i = 0; i < NUM_PLAYER_ACTIONS; i++)
        if (key == *key_info[i].key_custom)
          key_action |= key_info[i].action;
 
+      for (i = 0; i < NUM_DIRECTIONS; i++)
+       if (key == *key_info[i].key_snap)
+         key_action |= key_info[i].action | JOY_BUTTON_SNAP;
+
       if (tape.single_step && clear_button_2[pnr])
       {
        stored_player[pnr].action &= ~KEY_BUTTON_2;
@@ -699,7 +707,7 @@ void HandleKey(Key key, int key_status)
   }
   else
   {
-    for (i = 0; i < 6; i++)
+    for (i = 0; i < NUM_PLAYER_ACTIONS; i++)
       if (key == key_info[i].key_default)
        joy |= key_info[i].action;
   }
index d7837486d401d930248e8bfafe7836753027f1fe..349d2d52806c2bcec427e55733f4e06a941e947b 100644 (file)
@@ -9067,8 +9067,12 @@ void SaveScore(int nr)
 #define SETUP_TOKEN_SHORTCUT_SOUND_SIMPLE      13
 #define SETUP_TOKEN_SHORTCUT_SOUND_LOOPS       14
 #define SETUP_TOKEN_SHORTCUT_SOUND_MUSIC       15
+#define SETUP_TOKEN_SHORTCUT_SNAP_LEFT         16
+#define SETUP_TOKEN_SHORTCUT_SNAP_RIGHT                17
+#define SETUP_TOKEN_SHORTCUT_SNAP_UP           18
+#define SETUP_TOKEN_SHORTCUT_SNAP_DOWN         19
 
-#define NUM_SHORTCUT_SETUP_TOKENS              16
+#define NUM_SHORTCUT_SETUP_TOKENS              20
 
 /* player setup */
 #define SETUP_TOKEN_PLAYER_USE_JOYSTICK                0
@@ -9221,6 +9225,10 @@ static struct TokenInfo shortcut_setup_tokens[] =
   { TYPE_KEY_X11, &ssi.sound_simple,   "shortcut.sound_simple"         },
   { TYPE_KEY_X11, &ssi.sound_loops,    "shortcut.sound_loops"          },
   { TYPE_KEY_X11, &ssi.sound_music,    "shortcut.sound_music"          },
+  { TYPE_KEY_X11, &ssi.snap_left,      "shortcut.snap_left"            },
+  { TYPE_KEY_X11, &ssi.snap_right,     "shortcut.snap_right"           },
+  { TYPE_KEY_X11, &ssi.snap_up,                "shortcut.snap_up"              },
+  { TYPE_KEY_X11, &ssi.snap_down,      "shortcut.snap_down"            },
 };
 
 static struct TokenInfo player_setup_tokens[] =
@@ -9347,6 +9355,11 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->shortcut.sound_loops     = DEFAULT_KEY_SOUND_LOOPS;
   si->shortcut.sound_music     = DEFAULT_KEY_SOUND_MUSIC;
 
+  si->shortcut.snap_left       = DEFAULT_KEY_SNAP_LEFT;
+  si->shortcut.snap_right      = DEFAULT_KEY_SNAP_RIGHT;
+  si->shortcut.snap_up         = DEFAULT_KEY_SNAP_UP;
+  si->shortcut.snap_down       = DEFAULT_KEY_SNAP_DOWN;
+
   for (i = 0; i < MAX_PLAYERS; i++)
   {
     si->input[i].use_joystick = FALSE;
index efaaf5b8974440571dc1d6cc97e071c3f42158f4..dfc3089b8851cd0402f7a2fb8f037bd071ee6849 100644 (file)
@@ -61,6 +61,8 @@
 #define JOY_DOWN               MV_DOWN
 #define JOY_BUTTON_1           KEY_BUTTON_1
 #define JOY_BUTTON_2           KEY_BUTTON_2
+#define JOY_BUTTON_SNAP                KEY_BUTTON_SNAP
+#define JOY_BUTTON_DROP                KEY_BUTTON_DROP
 #define JOY_MOTION             KEY_MOTION
 #define JOY_BUTTON             KEY_BUTTON
 #define JOY_ACTION             KEY_ACTION
index cbcf5c86ae4d24abcdbb66d561b17d22fd1f9ed5..4383b60b1ab97bc78a9046d12407baf66cabcdea 100644 (file)
 #define DEFAULT_KEY_SOUND_SIMPLE       KSYM_UNDEFINED
 #define DEFAULT_KEY_SOUND_LOOPS                KSYM_UNDEFINED
 #define DEFAULT_KEY_SOUND_MUSIC                KSYM_UNDEFINED
+#define DEFAULT_KEY_SNAP_LEFT          KSYM_UNDEFINED
+#define DEFAULT_KEY_SNAP_RIGHT         KSYM_UNDEFINED
+#define DEFAULT_KEY_SNAP_UP            KSYM_UNDEFINED
+#define DEFAULT_KEY_SNAP_DOWN          KSYM_UNDEFINED
 
 /* values for key_status */
 #define KEY_NOT_PRESSED                        FALSE
 #define BUTTON_1                       4
 #define BUTTON_2                       5
 
+#define NUM_PLAYER_ACTIONS             6
+
 /* values for special "focus player" bitmasks */
 #define BIT_SET_FOCUS                  6
 
 
 #define KEY_BUTTON_1           (1 << BUTTON_1)
 #define KEY_BUTTON_2           (1 << BUTTON_2)
+#define KEY_BUTTON_SNAP                KEY_BUTTON_1
+#define KEY_BUTTON_DROP                KEY_BUTTON_2
 #define KEY_MOTION             (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
 #define KEY_BUTTON             (KEY_BUTTON_1 | KEY_BUTTON_2)
 #define KEY_ACTION             (KEY_MOTION | KEY_BUTTON)
@@ -863,6 +871,11 @@ struct SetupShortcutInfo
   Key sound_simple;
   Key sound_loops;
   Key sound_music;
+
+  Key snap_left;
+  Key snap_right;
+  Key snap_up;
+  Key snap_down;
 };
 
 struct SetupSystemInfo
index 0933b06470633fc74a3e888c0a12ab90540d7b2a..d16f5bc9fa1ce72bc978af69a64a58b2eb852e89 100644 (file)
 #define PROGRAM_VERSION_MAJOR          3
 #define PROGRAM_VERSION_MINOR          3
 #define PROGRAM_VERSION_PATCH          0
-#define PROGRAM_VERSION_BUILD          0
+#define PROGRAM_VERSION_BUILD          1
 
 #define PROGRAM_TITLE_STRING           "Rocks'n'Diamonds"
 #define PROGRAM_AUTHOR_STRING          "Holger Schemel"
index db347cdaa88e55ca0c28a2ce531b74fb2e7ef08c..de24626aa57757a6911d460bddcb3ee2125cf2e6 100644 (file)
 #define SETUP_MODE_SHORTCUTS_2         9
 #define SETUP_MODE_SHORTCUTS_3         10
 #define SETUP_MODE_SHORTCUTS_4         11
+#define SETUP_MODE_SHORTCUTS_5         12
 
 /* sub-screens on the setup screen (generic) */
-#define SETUP_MODE_CHOOSE_ARTWORK      12
-#define SETUP_MODE_CHOOSE_OTHER                13
+#define SETUP_MODE_CHOOSE_ARTWORK      13
+#define SETUP_MODE_CHOOSE_OTHER                14
 
 /* sub-screens on the setup screen (specific) */
-#define SETUP_MODE_CHOOSE_GAME_SPEED   14
-#define SETUP_MODE_CHOOSE_SCREEN_MODE  15
-#define SETUP_MODE_CHOOSE_SCROLL_DELAY 16
-#define SETUP_MODE_CHOOSE_GRAPHICS     17
-#define SETUP_MODE_CHOOSE_SOUNDS       18
-#define SETUP_MODE_CHOOSE_MUSIC                19
+#define SETUP_MODE_CHOOSE_GAME_SPEED   15
+#define SETUP_MODE_CHOOSE_SCREEN_MODE  16
+#define SETUP_MODE_CHOOSE_SCROLL_DELAY 17
+#define SETUP_MODE_CHOOSE_GRAPHICS     18
+#define SETUP_MODE_CHOOSE_SOUNDS       19
+#define SETUP_MODE_CHOOSE_MUSIC                20
 
-#define MAX_SETUP_MODES                        20
+#define MAX_SETUP_MODES                        21
 
 /* for input setup functions */
 #define SETUPINPUT_SCREEN_POS_START    0
@@ -235,7 +236,7 @@ static struct
                                 INFO_MODE_MAIN)
 
 #define DRAW_MODE_SETUP(i)     ((i) >= SETUP_MODE_MAIN &&              \
-                                (i) <= SETUP_MODE_SHORTCUTS_4 ? (i) :  \
+                                (i) <= SETUP_MODE_SHORTCUTS_5 ? (i) :  \
                                 (i) >= SETUP_MODE_CHOOSE_GRAPHICS &&   \
                                 (i) <= SETUP_MODE_CHOOSE_MUSIC ?       \
                                 SETUP_MODE_CHOOSE_ARTWORK :            \
@@ -4135,6 +4136,13 @@ static void execSetupShortcuts4()
   DrawSetupScreen();
 }
 
+static void execSetupShortcuts5()
+{
+  setup_mode = SETUP_MODE_SHORTCUTS_5;
+
+  DrawSetupScreen();
+}
+
 static void execExitSetup()
 {
   game_status = GAME_MODE_MAIN;
@@ -4308,6 +4316,7 @@ static struct TokenInfo setup_info_shortcuts[] =
   { TYPE_ENTER_MENU,   execSetupShortcuts2,    "Player Focus"  },
   { TYPE_ENTER_MENU,   execSetupShortcuts3,    "Tape Buttons"  },
   { TYPE_ENTER_MENU,   execSetupShortcuts4,    "Sound & Music" },
+  { TYPE_ENTER_MENU,   execSetupShortcuts5,    "TAS Snap Keys" },
   { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_LEAVE_MENU,   execSetupMain,          "Back"                  },
 
@@ -4381,6 +4390,22 @@ static struct TokenInfo setup_info_shortcuts_4[] =
   { 0,                 NULL,                   NULL                    }
 };
 
+static struct TokenInfo setup_info_shortcuts_5[] =
+{
+  { TYPE_KEYTEXT,      NULL,                   "Snap Left:",           },
+  { TYPE_KEY,          &setup.shortcut.snap_left, ""                   },
+  { TYPE_KEYTEXT,      NULL,                   "Snap Right:",          },
+  { TYPE_KEY,          &setup.shortcut.snap_right, ""                  },
+  { TYPE_KEYTEXT,      NULL,                   "Snap Up:",             },
+  { TYPE_KEY,          &setup.shortcut.snap_up, ""                     },
+  { TYPE_KEYTEXT,      NULL,                   "Snap Down:",           },
+  { TYPE_KEY,          &setup.shortcut.snap_down, ""                   },
+  { TYPE_EMPTY,                NULL,                   ""                      },
+  { TYPE_LEAVE_MENU,   execSetupShortcuts,     "Back"                  },
+
+  { 0,                 NULL,                   NULL                    }
+};
+
 static Key getSetupKey()
 {
   Key key = KSYM_UNDEFINED;
@@ -4684,6 +4709,11 @@ static void DrawSetupScreen_Generic()
     setup_info = setup_info_shortcuts_4;
     title_string = "Setup Shortcuts";
   }
+  else if (setup_mode == SETUP_MODE_SHORTCUTS_5)
+  {
+    setup_info = setup_info_shortcuts_5;
+    title_string = "Setup Shortcuts";
+  }
 
   DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, title_string);