projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed showing/hiding mouse cursor in playfield when playing MM style games
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index 349d75fb21ffc5f74c83baf9733e996da12fc1f7..c40075e4d375faa0157249fbd68e9d909ba26b41 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-304,7
+304,8
@@
void HandleMouseCursor()
cursor_inside_playfield &&
DelayReached(&special_cursor_delay, special_cursor_delay_value))
{
cursor_inside_playfield &&
DelayReached(&special_cursor_delay, special_cursor_delay_value))
{
- if (level.game_engine_type != GAME_ENGINE_TYPE_MM)
+ if (level.game_engine_type != GAME_ENGINE_TYPE_MM ||
+ tile_cursor.enabled)
SetMouseCursor(CURSOR_PLAYFIELD);
}
}
SetMouseCursor(CURSOR_PLAYFIELD);
}
}
@@
-1824,7
+1825,7
@@
void HandleKey(Key key, int key_status)
else
stored_player[pnr].action &= ~key_action;
else
stored_player[pnr].action &= ~key_action;
- if (tape.single_step && tape.recording && tape.pausing)
+ if (tape.single_step && tape.recording && tape.pausing
&& !tape.use_mouse
)
{
if (key_status == KEY_PRESSED && key_action & KEY_MOTION)
{
{
if (key_status == KEY_PRESSED && key_action & KEY_MOTION)
{
@@
-2187,7
+2188,7
@@
static void HandleTileCursor(int dx, int dy, int button)
(dx < 0 ? MB_LEFTBUTTON :
dx > 0 ? MB_RIGHTBUTTON : MB_RELEASED));
}
(dx < 0 ? MB_LEFTBUTTON :
dx > 0 ? MB_RIGHTBUTTON : MB_RELEASED));
}
- else
+ else
if (!tile_cursor.moving)
{
int old_xpos = tile_cursor.xpos;
int old_ypos = tile_cursor.ypos;
{
int old_xpos = tile_cursor.xpos;
int old_ypos = tile_cursor.ypos;
@@
-2242,6
+2243,8
@@
void HandleJoystick()
static unsigned int joytest_delay = 0;
static unsigned int joytest_delay_value = GADGET_FRAME_DELAY;
static int joytest_last = 0;
static unsigned int joytest_delay = 0;
static unsigned int joytest_delay_value = GADGET_FRAME_DELAY;
static int joytest_last = 0;
+ int delay_value_first = GADGET_FRAME_DELAY_FIRST;
+ int delay_value = GADGET_FRAME_DELAY;
int joystick = HandleJoystickForAllPlayers();
int keyboard = key_joystick_mapping;
int joy = (joystick | keyboard);
int joystick = HandleJoystickForAllPlayers();
int keyboard = key_joystick_mapping;
int joy = (joystick | keyboard);
@@
-2254,6
+2257,7
@@
void HandleJoystick()
int newbutton = (AnyJoystickButton() == JOY_BUTTON_NEW_PRESSED);
int dx = (left ? -1 : right ? 1 : 0);
int dy = (up ? -1 : down ? 1 : 0);
int newbutton = (AnyJoystickButton() == JOY_BUTTON_NEW_PRESSED);
int dx = (left ? -1 : right ? 1 : 0);
int dy = (up ? -1 : down ? 1 : 0);
+ boolean use_delay_value_first = (joytest != joytest_last);
if (HandleGlobalAnimClicks(-1, -1, newbutton))
{
if (HandleGlobalAnimClicks(-1, -1, newbutton))
{
@@
-2263,10
+2267,18
@@
void HandleJoystick()
if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
{
if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
{
- // when playing MM style levels, also use delay for keyboard events
if (game_status == GAME_MODE_PLAYING)
if (game_status == GAME_MODE_PLAYING)
+ {
+ // when playing MM style levels, also use delay for keyboard events
joytest |= keyboard;
joytest |= keyboard;
+ // only use first delay value for new events, but not for changed events
+ use_delay_value_first = (!joytest != !joytest_last);
+
+ // only use delay after the initial keyboard event
+ delay_value = 0;
+ }
+
// for any joystick or keyboard event, enable playfield tile cursor
if (dx || dy || button)
SetTileCursorEnabled(TRUE);
// for any joystick or keyboard event, enable playfield tile cursor
if (dx || dy || button)
SetTileCursorEnabled(TRUE);
@@
-2281,7
+2293,7
@@
void HandleJoystick()
{
/* first start with longer delay, then continue with shorter delay */
joytest_delay_value =
{
/* first start with longer delay, then continue with shorter delay */
joytest_delay_value =
- (
joytest != joytest_last ? GADGET_FRAME_DELAY_FIRST : GADGET_FRAME_DELAY
);
+ (
use_delay_value_first ? delay_value_first : delay_value
);
}
joytest_last = joytest;
}
joytest_last = joytest;
@@
-2328,7
+2340,7
@@
void HandleJoystick()
return;
}
return;
}
- if (tape.recording && tape.pausing)
+ if (tape.recording && tape.pausing
&& !tape.use_mouse
)
{
if (joystick & JOY_ACTION)
TapeTogglePause(TAPE_TOGGLE_MANUAL);
{
if (joystick & JOY_ACTION)
TapeTogglePause(TAPE_TOGGLE_MANUAL);