added in-game mouse actions for Mirror Magic game engine
authorHolger Schemel <info@artsoft.org>
Sat, 18 Feb 2017 13:39:36 +0000 (14:39 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:08 +0000 (23:21 +0100)
src/events.c
src/game_mm/export.h
src/game_mm/mm_game.c
src/game_mm/mm_game.h

index b51839817a0e480b37be24bc8fb26bab2aee0aca..2365674739f44880cc7890a31ea06d5e482b6be1 100644 (file)
@@ -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);
   }
index 7b6167bc3137e9e8218c9a131a4e57ae7a50459c..5ca618cdd30a231cd35f544c37da81f14674dfd3 100644 (file)
@@ -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();
index 6b8d02aeba340cbae2f6c72d414747dc6904344f..ca8c49c534e17f98fe83309edc890f3eb80ed27e 100644 (file)
@@ -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;
index c0d5af9066bfeedd48456d96dace8ee5e5c8fa19..845968207026ad82822f777f53b4c4c90838a3aa 100644 (file)
@@ -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);