X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fevents.c;h=b30159555f124225f1526a46778befe0bf8c6a47;hp=a43db7c6510eaa59ea666d62baee3686480755e5;hb=7e68d10c8f4c814e532cc30f6fc721c269a99cb6;hpb=ce20797c3998436e5c54939ef2f56a4fe4a5b14d diff --git a/src/events.c b/src/events.c index a43db7c6..b3015955 100644 --- a/src/events.c +++ b/src/events.c @@ -370,6 +370,13 @@ void ClearEventQueue() } } +void ClearPlayerMouseAction() +{ + local_player->mouse_action.lx = 0; + local_player->mouse_action.ly = 0; + local_player->mouse_action.button = 0; +} + void ClearPlayerAction() { int i; @@ -380,6 +387,22 @@ void ClearPlayerAction() stored_player[i].action = 0; ClearJoystickState(); + ClearPlayerMouseAction(); +} + +void SetPlayerMouseAction(int mx, int my, int button) +{ + int lx = getLevelFromScreenX(mx); + int ly = getLevelFromScreenY(my); + + ClearPlayerMouseAction(); + + if (!IN_GFX_FIELD_PLAY(mx, my) || !IN_LEV_FIELD(lx, ly)) + return; + + local_player->mouse_action.lx = lx; + local_player->mouse_action.ly = ly; + local_player->mouse_action.button = button; } void SleepWhileUnmapped() @@ -1325,11 +1348,10 @@ void HandleButton(int mx, int my, int button, int button_nr) break; case GAME_MODE_PLAYING: - if (level.game_engine_type == GAME_ENGINE_TYPE_MM && !tape.pausing) - ClickElement(mx, my, button); + SetPlayerMouseAction(mx, my, button); + #if defined(TARGET_SDL2) - else - HandleFollowFinger(mx, my, button); + HandleFollowFinger(mx, my, button); #endif #ifdef DEBUG