From: Holger Schemel Date: Sat, 18 Feb 2017 13:39:36 +0000 (+0100) Subject: added in-game mouse actions for Mirror Magic game engine X-Git-Tag: 4.1.0.0~212 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d9ea00b22977a971eaf8ee580b4f8804dd2f6fc1;p=rocksndiamonds.git added in-game mouse actions for Mirror Magic game engine --- diff --git a/src/events.c b/src/events.c index b5183981..23656747 100644 --- a/src/events.c +++ b/src/events.c @@ -1323,9 +1323,12 @@ void HandleButton(int mx, int my, int button, int button_nr) HandleSetupScreen(mx, my, 0, 0, button); break; -#if defined(TARGET_SDL2) case GAME_MODE_PLAYING: - HandleFollowFinger(mx, my, button); + if (level.game_engine_type == GAME_ENGINE_TYPE_MM) + ClickElement(mx, my, button); +#if defined(TARGET_SDL2) + else + HandleFollowFinger(mx, my, button); #endif #ifdef DEBUG @@ -1892,7 +1895,9 @@ void HandleKey(Key key, int key_status) void HandleNoEvent() { // if (button_status && game_status != GAME_MODE_PLAYING) - if (button_status && (game_status != GAME_MODE_PLAYING || tape.pausing)) + if (button_status && (game_status != GAME_MODE_PLAYING || + tape.pausing || + level.game_engine_type == GAME_ENGINE_TYPE_MM)) { HandleButton(0, 0, button_status, -button_status); } diff --git a/src/game_mm/export.h b/src/game_mm/export.h index 7b6167bc..5ca618cd 100644 --- a/src/game_mm/export.h +++ b/src/game_mm/export.h @@ -194,6 +194,8 @@ extern void InitGfxBuffers_MM(); extern void InitGameEngine_MM(); extern void GameActions_MM(byte *, boolean); +extern void ClickElement(int, int, int); + extern unsigned int InitEngineRandom_MM(int); extern void setLevelInfoToDefaults_MM(); diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 6b8d02ae..ca8c49c5 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -2680,7 +2680,7 @@ void ColorCycling(void) } } -void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode) +static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode) { static unsigned int action_delay = 0; static unsigned int pacman_delay = 0; @@ -3356,6 +3356,14 @@ void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode) return; } +void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode) +{ + if (!button_status) + ClickElement(0, 0, MB_NOT_PRESSED); + + GameActions_MM_Ext(action, warp_mode); +} + void MovePacMen() { static int p = -1; diff --git a/src/game_mm/mm_game.h b/src/game_mm/mm_game.h index c0d5af90..84596820 100644 --- a/src/game_mm/mm_game.h +++ b/src/game_mm/mm_game.h @@ -88,7 +88,6 @@ boolean HitLaserSource(int, int); boolean HitLaserDestination(int, int); boolean HitReflectingWalls(int, int); boolean HitAbsorbingWalls(int, int); -void ClickElement(int, int, int); void RotateMirror(int, int, int); boolean ObjHit(int, int, int); void DeletePacMan(int, int);