}
/* skip mouse motion events without pressed button outside level editor */
- if (button_status == MB_RELEASED && game_status != GAME_MODE_EDITOR &&
- game_status != GAME_MODE_PLAYING)
+ if (button_status == MB_RELEASED &&
+ game_status != GAME_MODE_EDITOR && game_status != GAME_MODE_PLAYING)
return 0;
else
return 1;
}
+/* to prevent delay problems, skip mouse motion events if the very next
+ event is also a mouse motion event (and therefore effectively only
+ handling the last of a row of mouse motion events in the event queue) */
+
+boolean SkipPressedMouseMotionEvent(const Event *event)
+{
+ /* nothing to do if the current event is not a mouse motion event */
+ if (event->type != EVENT_MOTIONNOTIFY)
+ return FALSE;
+
+ /* only skip motion events with pressed button outside level editor */
+ if (button_status == MB_RELEASED ||
+ game_status == GAME_MODE_EDITOR || game_status == GAME_MODE_PLAYING)
+ return FALSE;
+
+ if (PendingEvent())
+ {
+ Event next_event;
+
+ PeekEvent(&next_event);
+
+ /* if next event is also a mouse motion event, skip the current one */
+ if (next_event.type == EVENT_MOTIONNOTIFY)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
/* this is only really needed for non-SDL targets to filter unwanted events;
when using SDL with properly installed event filter, this function can be
replaced with a simple "NextEvent()" call, but it doesn't hurt either */
{
while (PendingEvent())
{
+ boolean handle_this_event = FALSE;
+
NextEvent(event);
if (FilterMouseMotionEvents(event))
+ handle_this_event = TRUE;
+
+#if 1
+ if (SkipPressedMouseMotionEvent(event))
+ handle_this_event = FALSE;
+#endif
+
+ if (handle_this_event)
return TRUE;
}
else
button_status = MB_RELEASED;
+#if 0
+ printf("::: button %s\n", event->type == EVENT_BUTTONPRESS ?
+ "pressed" : "released");
+#endif
+
HandleButton(event->x, event->y, button_status);
}
motion_status = TRUE;
+#if 0
+ printf("::: %d, %d\n", event->x, event->y);
+#endif
+
HandleButton(event->x, event->y, button_status);
}
Delay(100);
KeyboardAutoRepeatOffUnlessAutoplay();
}
+
if (old_joystick_status != -1)
joystick.status = old_joystick_status;
}
if (setup.autorecord)
TapeStartRecording();
-#if defined(PLATFORM_UNIX)
+#if defined(NETWORK_AVALIABLE)
if (options.network)
SendToServer_StartPlaying();
else
case GAME_MODE_INFO:
switch(key)
{
+ case KSYM_space:
case KSYM_Return:
if (game_status == GAME_MODE_MAIN)
HandleMainMenu(0,0, 0,0, MB_MENU_CHOICE);
case GAME_MODE_SCORES:
switch(key)
{
+ case KSYM_space:
case KSYM_Return:
case KSYM_Escape:
game_status = GAME_MODE_MAIN;
printf("ScrollStepSize == %d (1/1)\n", ScrollStepSize);
break;
+ case KSYM_v:
+ printf("::: currently using game engine version %d\n",
+ game.engine_version);
+ break;
+
#if 0
case KSYM_z:
return;
}
-#if defined(PLATFORM_UNIX)
+#if defined(NETWORK_AVALIABLE)
if (options.network)
HandleNetworking();
#endif