-#define COMPILE_DATE_STRING "2008-02-06 23:42"
+#define COMPILE_DATE_STRING "2008-04-26 02:20"
case SDL_JOYBUTTONUP:
HandleJoystickEvent(event);
break;
+
+ case SDL_SYSWMEVENT:
+ HandleWindowManagerEvent(event);
+ break;
#endif
default:
CloseAllAndExit(0);
}
+void HandleWindowManagerEvent(Event *event)
+{
+#if defined(TARGET_SDL)
+ SDLHandleWindowManagerEvent(event);
+#endif
+}
+
void HandleButton(int mx, int my, int button, int button_nr)
{
static int old_mx = 0, old_my = 0;
void HandleMotionEvent(MotionEvent *);
void HandleKeyEvent(KeyEvent *);
void HandleFocusEvent(FocusChangeEvent *);
-void HandleClientMessageEvent(ClientMessageEvent *event);
+void HandleClientMessageEvent(ClientMessageEvent *);
+void HandleWindowManagerEvent(Event *);
void HandleNoEvent(void);
#define USE_GFX_RESET_WHEN_NOT_MOVING (USE_NEW_STUFF * 1)
+#define USE_NEW_PLAYER_ASSIGNMENTS (USE_NEW_STUFF * 1)
+
#define USE_DELAYED_GFX_REDRAW (USE_NEW_STUFF * 0)
#if USE_DELAYED_GFX_REDRAW
if (game.belt_dir[i] == MV_NONE)
game.belt_dir_nr[i] = 3; /* not moving, next moving left */
+#if USE_NEW_PLAYER_ASSIGNMENTS
+ /* check if any connected player was not found in playfield */
+ for (i = 0; i < MAX_PLAYERS; i++)
+ {
+ struct PlayerInfo *player = &stored_player[i];
+
+ if (player->connected && !player->present)
+ {
+ for (j = 0; j < MAX_PLAYERS; j++)
+ {
+ struct PlayerInfo *some_player = &stored_player[j];
+ int jx = some_player->jx, jy = some_player->jy;
+
+ /* assign first free player found that is present in the playfield */
+ if (some_player->present && !some_player->connected)
+ {
+ player->present = FALSE;
+ player->active = FALSE;
+
+ some_player->present = TRUE;
+ some_player->active = TRUE;
+
+ /*
+ player->initial_element = some_player->initial_element;
+ player->artwork_element = some_player->artwork_element;
+
+ player->block_last_field = some_player->block_last_field;
+ player->block_delay_adjustment = some_player->block_delay_adjustment;
+ */
+
+ StorePlayer[jx][jy] = some_player->element_nr;
+
+ some_player->jx = some_player->last_jx = jx;
+ some_player->jy = some_player->last_jy = jy;
+
+ if (local_player == player)
+ local_player = some_player;
+
+ break;
+ }
+ }
+ }
+ }
+
+#else
+
/* check if any connected player was not found in playfield */
for (i = 0; i < MAX_PLAYERS; i++)
{
player->block_delay_adjustment = some_player->block_delay_adjustment;
StorePlayer[jx][jy] = player->element_nr;
+
player->jx = player->last_jx = jx;
player->jy = player->last_jy = jy;
}
}
}
+#endif
if (tape.playing)
{
}
}
+
+#if 1
+ SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
+
+#if defined(PLATFORM_WIN32)
+ {
+ SDL_SysWMinfo wminfo;
+ HWND hwnd;
+
+ SDL_VERSION(&wminfo.version);
+ SDL_GetWMInfo(&wminfo);
+
+ hwnd = wminfo.window;
+
+ DragAcceptFiles(hwnd, TRUE);
+ }
+#endif
+#endif
+
+
return success;
}
}
}
+void SDLHandleWindowManagerEvent(Event *event)
+{
+#if defined(PLATFORM_WIN32)
+ SDL_SysWMEvent *syswmevent = (SDL_SysWMEvent *)event;
+ SDL_SysWMmsg *syswmmsg = (SDL_SysWMmsg *)(syswmevent->msg);
+
+ if (syswmmsg->msg == WM_DROPFILES)
+ {
+ HDROP hdrop = (HDROP)syswmmsg->wParam;
+ int i, num_files;
+
+ printf("::: SDL_SYSWMEVENT:\n");
+
+ num_files = DragQueryFile(hdrop, 0xffffffff, NULL, 0);
+
+ for (i = 0; i < num_files; i++)
+ {
+ int buffer_len = DragQueryFile(hdrop, i, NULL, 0);
+ char buffer[buffer_len + 1];
+
+ DragQueryFile(hdrop, i, buffer, buffer_len + 1);
+
+ printf("::: - '%s'\n", buffer);
+ }
+
+ DragFinish((HDROP)syswmmsg->wParam);
+ }
+#endif
+}
+
/* ========================================================================= */
/* joystick functions */
#include <SDL_mixer.h>
#include <SDL_net.h>
#include <SDL_thread.h>
-
+#if defined(PLATFORM_WIN32)
+#include <SDL_syswm.h>
+#endif
/* definitions needed for "system.c" */
void SDLCloseAudio(void);
void SDLNextEvent(Event *);
+void SDLHandleWindowManagerEvent(Event *);
void HandleJoystickEvent(Event *);
void SDLInitJoysticks(void);