fixed nasty bug with mouse actions breaking non-mouse tapes
[rocksndiamonds.git] / src / game.c
index de844f4298ca0351fcaceab4ce88082c9c8402c7..92c54f12e73bafd1ce6e952d5cda1dfdb6ae4fcb 100644 (file)
@@ -10977,6 +10977,9 @@ static byte PlayerActions(struct PlayerInfo *player, byte player_action)
 static void SetMouseActionFromTapeAction(struct MouseActionInfo *mouse_action,
                                         byte *tape_action)
 {
+  if (!tape.use_mouse)
+    return;
+
   mouse_action->lx     = tape_action[TAPE_ACTION_LX];
   mouse_action->ly     = tape_action[TAPE_ACTION_LY];
   mouse_action->button = tape_action[TAPE_ACTION_BUTTON];
@@ -10985,6 +10988,9 @@ static void SetMouseActionFromTapeAction(struct MouseActionInfo *mouse_action,
 static void SetTapeActionFromMouseAction(byte *tape_action,
                                         struct MouseActionInfo *mouse_action)
 {
+  if (!tape.use_mouse)
+    return;
+
   tape_action[TAPE_ACTION_LX]     = mouse_action->lx;
   tape_action[TAPE_ACTION_LY]     = mouse_action->ly;
   tape_action[TAPE_ACTION_BUTTON] = mouse_action->button;
@@ -14703,6 +14709,9 @@ void PlayLevelSound_MM(int xx, int yy, int element_mm, int action_mm)
   int x = xx - offset;
   int y = yy - offset;
 
+  if (!IS_MM_ELEMENT(element))
+    element = EL_MM_DEFAULT;
+
   PlayLevelSoundElementAction(x, y, element, action);
 }