+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)
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
-#define COMPILE_DATE_STRING "2010-05-25 22:42"
+#define COMPILE_DATE_STRING "2010-06-08 22:05"
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;
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;
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;
}
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;
}
#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
{ 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[] =
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;
#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
#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)
Key sound_simple;
Key sound_loops;
Key sound_music;
+
+ Key snap_left;
+ Key snap_right;
+ Key snap_up;
+ Key snap_down;
};
struct SetupSystemInfo
#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"
#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
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 : \
DrawSetupScreen();
}
+static void execSetupShortcuts5()
+{
+ setup_mode = SETUP_MODE_SHORTCUTS_5;
+
+ DrawSetupScreen();
+}
+
static void execExitSetup()
{
game_status = GAME_MODE_MAIN;
{ 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" },
{ 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;
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);