void HandleClientMessageEvent(ClientMessageEvent *event)
{
-#ifdef TARGET_SDL
- CloseAllAndExit(0); /* the only possible message here is SDL_QUIT */
-#else
-#ifndef MSDOS
- if ((event->window == window) &&
- (event->data.l[0] == XInternAtom(display, "WM_DELETE_WINDOW", FALSE)))
+ if (CheckCloseWindowEvent(event))
CloseAllAndExit(0);
-#endif
-#endif
}
void HandleButton(int mx, int my, int button)
printf("ScrollStepSize == %d (1/1)\n", ScrollStepSize);
break;
-#ifndef MSDOS
case KEY_Q:
-#endif
- case KEY_q:
local_player->dynamite = 1000;
break;
#define PROGRAM_AUTHOR_STRING "Holger Schemel"
#define PROGRAM_RIGHTS_STRING "Copyright ^1995-2000 by"
#define PROGRAM_DOS_PORT_STRING "DOS port done by Guido Schulz"
-#define PROGRAM_IDENT_STRING PROGRAM_VERSION_STRING " " PLATFORM_STRING
+#define PROGRAM_IDENT_STRING PROGRAM_VERSION_STRING " " TARGET_STRING
#define WINDOW_TITLE_STRING PROGRAM_TITLE_STRING " " PROGRAM_IDENT_STRING
#define WINDOW_SUBTITLE_STRING PROGRAM_RIGHTS_STRING " " PROGRAM_AUTHOR_STRING
/* system dependent definitions */
-#define PLATFORM_STRING "DOS"
+#define TARGET_STRING "DOS"
/* allegro defines TRUE as -1 */
#ifdef TRUE
/* system dependent definitions */
-#define PLATFORM_STRING "SDL"
+#define TARGET_STRING "SDL"
#define FULLSCREEN_STATUS FULLSCREEN_AVAILABLE
#include "main.h"
#include "misc.h"
-inline void InitEventFilter(EventFilter filter_function)
-{
-#ifdef TARGET_SDL
- /* set event filter to filter out certain events */
- SDL_SetEventFilter(filter_function);
-#endif
-}
+
+/* ========================================================================= */
+/* video functions */
+/* ========================================================================= */
inline void InitBufferedDisplay(DrawBuffer *backbuffer, DrawWindow *window)
{
#endif
}
+inline boolean SetVideoMode(void)
+{
+#ifdef TARGET_SDL
+ return SDLSetVideoMode(&backbuffer);
+#else
+ boolean success = TRUE;
+
+ if (setup.fullscreen && fullscreen_available)
+ {
+ Error(ERR_WARN, "fullscreen not available in X11 version");
+
+ /* display error message only once */
+ fullscreen_available = FALSE;
+
+ success = FALSE;
+ }
+
+ return success;
+#endif
+}
+
+inline void ChangeVideoModeIfNeeded(void)
+{
+#ifdef TARGET_SDL
+ if ((setup.fullscreen && !fullscreen_enabled && fullscreen_available) ||
+ (!setup.fullscreen && fullscreen_enabled))
+ SetVideoMode();
+#endif
+}
+
+
+/* ========================================================================= */
+/* audio functions */
+/* ========================================================================= */
+
+inline boolean InitAudio(void)
+{
+#ifdef TARGET_SDL
+ return SDLInitAudio();
+#else
+ return TRUE;
+#endif
+}
+
+
+/* ========================================================================= */
+/* event functions */
+/* ========================================================================= */
+
+inline void InitEventFilter(EventFilter filter_function)
+{
+#ifdef TARGET_SDL
+ /* set event filter to filter out certain events */
+ SDL_SetEventFilter(filter_function);
+#endif
+}
+
inline boolean PendingEvent(void)
{
#ifdef TARGET_SDL
#endif
}
-inline boolean SetVideoMode(void)
+inline boolean CheckCloseWindowEvent(ClientMessageEvent *event)
{
-#ifdef TARGET_SDL
- return SDLSetVideoMode(&backbuffer);
-#else
- boolean success = TRUE;
-
- if (setup.fullscreen && fullscreen_available)
- {
- Error(ERR_WARN, "fullscreen not available in X11 version");
-
- /* display error message only once */
- fullscreen_available = FALSE;
-
- success = FALSE;
- }
-
- return success;
+ if (event->type != EVENT_CLIENTMESSAGE)
+ return FALSE;
+
+#if defined(TARGET_SDL)
+ return TRUE; /* the only possible message here is SDL_QUIT */
+#elif defined(PLATFORM_UNIX)
+ if ((event->window == window) &&
+ (event->data.l[0] == XInternAtom(display, "WM_DELETE_WINDOW", FALSE)))
+ return TRUE;
#endif
-}
-inline void ChangeVideoModeIfNeeded(void)
-{
-#ifdef TARGET_SDL
- if ((setup.fullscreen && !fullscreen_enabled && fullscreen_available) ||
- (!setup.fullscreen && fullscreen_enabled))
- SetVideoMode();
-#endif
+ return FALSE;
}
-inline boolean InitAudio(void)
-{
-#ifdef TARGET_SDL
- return SDLInitAudio();
-#else
- return TRUE;
-#endif
-}
inline void dummy(void)
{
/* system-wide function definitions */
-inline void InitEventFilter(EventFilter);
inline void InitBufferedDisplay(DrawBuffer *, DrawWindow *);
-
inline int GetDisplayDepth(void);
-
inline Bitmap CreateBitmap(int, int, int);
inline void FreeBitmap(Bitmap);
-
inline void ClearRectangle(Bitmap, int, int, int, int);
inline void BlitBitmap(Bitmap, Bitmap, int, int, int, int, int, int);
inline void SetClipMask(GC, Pixmap);
inline void SetClipOrigin(GC, int, int);
inline void BlitBitmapMasked(Bitmap, Bitmap, int, int, int, int, int, int);
inline void DrawSimpleWhiteLine(Bitmap, int, int, int, int);
-
inline void FlushDisplay(void);
inline void SyncDisplay(void);
inline void KeyboardAutoRepeatOn(void);
inline void KeyboardAutoRepeatOff(void);
inline boolean PointerInWindow(DrawWindow);
-
-inline boolean PendingEvent(void);
-inline void NextEvent(Event *event);
-
-inline Key GetEventKey(KeyEvent *, boolean);
-
inline boolean SetVideoMode(void);
inline void ChangeVideoModeIfNeeded(void);
inline boolean InitAudio(void);
+inline void InitEventFilter(EventFilter);
+inline boolean PendingEvent(void);
+inline void NextEvent(Event *event);
+inline Key GetEventKey(KeyEvent *, boolean);
+
#endif /* SYSTEM_H */
/* system dependent definitions */
-/* DOS version has already defined "PLATFORM_STRING" */
-#ifndef PLATFORM_STRING
-#define PLATFORM_STRING "X11"
+/* DOS version also defines "TARGET_STRING" */
+#ifndef TARGET_STRING
+#define TARGET_STRING "X11"
#endif
#define FULLSCREEN_STATUS FULLSCREEN_NOT_AVAILABLE