rnd-20030417-3-src
[rocksndiamonds.git] / src / events.c
index c88a27b8dfb80324151e36d6112e1226cb9e90ef..1f78e6b2559b1a814425ef7d2072c9ce420219f8 100644 (file)
@@ -40,24 +40,21 @@ static unsigned long playfield_cursor_delay = 0;
 
 int FilterMouseMotionEvents(const Event *event)
 {
+  MotionEvent *motion;
+
   /* non-motion events are directly passed to event handler functions */
   if (event->type != EVENT_MOTIONNOTIFY)
     return 1;
 
-  if (game_status == PLAYING)
-  {
-    MotionEvent *motion = (MotionEvent *)event;
-
-    cursor_inside_playfield =
-      (motion->x >= SX && motion->x < SX + SXSIZE &&
-       motion->y >= SY && motion->y < SY + SYSIZE);
+  motion = (MotionEvent *)event;
+  cursor_inside_playfield = (motion->x >= SX && motion->x < SX + SXSIZE &&
+                            motion->y >= SY && motion->y < SY + SYSIZE);
 
-    if (playfield_cursor_set)
-    {
-      SetMouseCursor(CURSOR_DEFAULT);
-      DelayReached(&playfield_cursor_delay, 0);
-      playfield_cursor_set = FALSE;
-    }
+  if (game_status == PLAYING && playfield_cursor_set)
+  {
+    SetMouseCursor(CURSOR_DEFAULT);
+    playfield_cursor_set = FALSE;
+    DelayReached(&playfield_cursor_delay, 0);
   }
 
   /* skip mouse motion events without pressed button outside level editor */
@@ -119,11 +116,19 @@ void EventLoop(void)
     else
     {
       /* when playing, display a special mouse pointer inside the playfield */
-      if (game_status == PLAYING && cursor_inside_playfield &&
-         DelayReached(&playfield_cursor_delay, 1000))
+      if (game_status == PLAYING)
+      {
+       if (!playfield_cursor_set && cursor_inside_playfield &&
+           DelayReached(&playfield_cursor_delay, 1000))
+       {
+         SetMouseCursor(CURSOR_PLAYFIELD);
+         playfield_cursor_set = TRUE;
+       }
+      }
+      else if (playfield_cursor_set)
       {
-       SetMouseCursor(CURSOR_PLAYFIELD);
-       playfield_cursor_set = TRUE;
+       SetMouseCursor(CURSOR_DEFAULT);
+       playfield_cursor_set = FALSE;
       }
 
       HandleNoEvent();
@@ -426,6 +431,7 @@ void HandleButton(int mx, int my, int button)
          printf("      MovPos[%d][%d] == %d\n", x,y, MovPos[x][y]);
          printf("      MovDir[%d][%d] == %d\n", x,y, MovDir[x][y]);
          printf("      MovDelay[%d][%d] == %d\n", x,y, MovDelay[x][y]);
+         printf("      GfxElement[%d][%d] == %d\n", x,y, GfxElement[x][y]);
          printf("\n");
        }
       }