projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
moved code to get font for "choose tree" screen to separate function
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index fe82932a746867dcfd26d64f01208ecf2e8e0a2f..968084f48474583c99d069c728b5425b27dac550 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-38,6
+38,7
@@
static boolean cursor_inside_playfield = FALSE;
static int cursor_mode_last = CURSOR_DEFAULT;
static unsigned int special_cursor_delay = 0;
static unsigned int special_cursor_delay_value = 1000;
static int cursor_mode_last = CURSOR_DEFAULT;
static unsigned int special_cursor_delay = 0;
static unsigned int special_cursor_delay_value = 1000;
+static boolean special_cursor_enabled = FALSE;
static boolean stop_processing_events = FALSE;
static boolean stop_processing_events = FALSE;
@@
-48,6
+49,11
@@
static void HandleNoEvent(void);
static void HandleEventActions(void);
static void HandleEventActions(void);
+void SetPlayfieldMouseCursorEnabled(boolean enabled)
+{
+ special_cursor_enabled = enabled;
+}
+
// event filter to set mouse x/y position (for pointer class global animations)
// (this is especially required to ensure smooth global animation mouse pointer
// movement when the screen is updated without handling events; this can happen
// event filter to set mouse x/y position (for pointer class global animations)
// (this is especially required to ensure smooth global animation mouse pointer
// movement when the screen is updated without handling events; this can happen
@@
-108,7
+114,7
@@
static int FilterEvents(const Event *event)
{
SetMouseCursor(CURSOR_DEFAULT);
{
SetMouseCursor(CURSOR_DEFAULT);
-
DelayReached(&special_cursor_delay, 0
);
+
ResetDelayCounter(&special_cursor_delay
);
cursor_mode_last = CURSOR_DEFAULT;
}
cursor_mode_last = CURSOR_DEFAULT;
}
@@
-336,15
+342,14
@@
static void HandleMouseCursor(void)
// display normal pointer if mouse pressed
if (button_status != MB_RELEASED)
// display normal pointer if mouse pressed
if (button_status != MB_RELEASED)
-
DelayReached(&special_cursor_delay, 0
);
+
ResetDelayCounter(&special_cursor_delay
);
if (gfx.cursor_mode != CURSOR_PLAYFIELD &&
cursor_inside_playfield &&
if (gfx.cursor_mode != CURSOR_PLAYFIELD &&
cursor_inside_playfield &&
+ special_cursor_enabled &&
DelayReached(&special_cursor_delay, special_cursor_delay_value))
{
DelayReached(&special_cursor_delay, special_cursor_delay_value))
{
- if (level.game_engine_type != GAME_ENGINE_TYPE_MM ||
- tile_cursor.enabled)
- SetMouseCursor(CURSOR_PLAYFIELD);
+ SetMouseCursor(CURSOR_PLAYFIELD);
}
}
else if (gfx.cursor_mode != CURSOR_DEFAULT)
}
}
else if (gfx.cursor_mode != CURSOR_DEFAULT)
@@
-524,6
+529,10
@@
void HandleButtonEvent(ButtonEvent *event)
// for any mouse button event, disable playfield tile cursor
SetTileCursorEnabled(FALSE);
// for any mouse button event, disable playfield tile cursor
SetTileCursorEnabled(FALSE);
+ // for any mouse button event, disable playfield mouse cursor
+ if (cursor_inside_playfield)
+ SetPlayfieldMouseCursorEnabled(FALSE);
+
#if defined(HAS_SCREEN_KEYBOARD)
if (video.shifted_up)
event->y += video.shifted_up_pos;
#if defined(HAS_SCREEN_KEYBOARD)
if (video.shifted_up)
event->y += video.shifted_up_pos;
@@
-2091,6
+2100,8
@@
void HandleKey(Key key, int key_status)
{
key_action |= key_info[i].action | JOY_BUTTON_SNAP;
key_snap_action |= key_info[i].action;
{
key_action |= key_info[i].action | JOY_BUTTON_SNAP;
key_snap_action |= key_info[i].action;
+
+ tape.property_bits |= TAPE_PROPERTY_TAS_KEYS;
}
}
}
}
}
}
@@
-2154,6
+2165,10
@@
void HandleKey(Key key, int key_status)
// for MM style levels, handle in-game keyboard input in HandleJoystick()
if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
joy |= key_action;
// for MM style levels, handle in-game keyboard input in HandleJoystick()
if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
joy |= key_action;
+
+ // for any keyboard event, enable playfield mouse cursor
+ if (key_action && key_status == KEY_PRESSED)
+ SetPlayfieldMouseCursorEnabled(TRUE);
}
}
else
}
}
else
@@
-2269,6
+2284,10
@@
void HandleKey(Key key, int key_status)
TapeQuickSave();
else if (key == setup.shortcut.load_game)
TapeQuickLoad();
TapeQuickSave();
else if (key == setup.shortcut.load_game)
TapeQuickLoad();
+ else if (key == setup.shortcut.restart_game)
+ TapeRestartGame();
+ else if (key == setup.shortcut.pause_before_end)
+ TapeReplayAndPauseBeforeEnd();
else if (key == setup.shortcut.toggle_pause)
TapeTogglePause(TAPE_TOGGLE_MANUAL | TAPE_TOGGLE_PLAY_PAUSE);
else if (key == setup.shortcut.toggle_pause)
TapeTogglePause(TAPE_TOGGLE_MANUAL | TAPE_TOGGLE_PLAY_PAUSE);
@@
-2597,6
+2616,10
@@
void HandleJoystick(void)
SetTileCursorEnabled(TRUE);
}
SetTileCursorEnabled(TRUE);
}
+ // for any joystick event, enable playfield mouse cursor
+ if (dx || dy || button)
+ SetPlayfieldMouseCursorEnabled(TRUE);
+
if (joytest && !button && !DelayReached(&joytest_delay, joytest_delay_value))
{
// delay joystick/keyboard actions if axes/keys continually pressed
if (joytest && !button && !DelayReached(&joytest_delay, joytest_delay_value))
{
// delay joystick/keyboard actions if axes/keys continually pressed