# when installing the game in a single user environment, choose this
# SCORE_ENTRIES = MANY_PER_NAME
-# specify path for cross-compiling (only needed for Win32 build)
-CROSS_PATH=/usr/local/cross-tools/i386-mingw32/bin
+# specify paths for cross-compiling (only needed for MS-DOS and Win32 build)
+CROSS_PATH_MSDOS=/usr/local/cross-msdos/i386-msdosdjgpp
+CROSS_PATH_WIN32=/usr/local/cross-tools/i386-mingw32msvc
#-----------------------------------------------------------------------------#
# you should not need to change anything below #
msdos:
@$(MAKE_CMD) PLATFORM=msdos
-win32:
- @PATH=$(CROSS_PATH):${PATH} $(MAKE_CMD) PLATFORM=win32
+cross-msdos:
+ @PATH=$(CROSS_PATH_MSDOS)/bin:${PATH} $(MAKE_CMD) PLATFORM=cross-msdos
+
+cross-win32:
+ @PATH=$(CROSS_PATH_WIN32)/bin:${PATH} $(MAKE_CMD) PLATFORM=cross-win32
clean:
@$(MAKE_CMD) clean
PROGNAME = ../rocks.exe
SYS_CFLAGS = -DTARGET_X11
-SYS_LDFLAGS = -s -lalleg -lm
+SYS_LDFLAGS = -s -lalleg
-else # Unix; Win32 cross-compiling
+else # Unix or cross-compiling for MS-DOS and Win32
RM = rm -f
PROGNAME = ../rocksndiamonds
ifeq ($(PLATFORM),solaris)
EXTRA_LDFLAGS = -lnsl -lsocket -R$(XLIB_PATH)
+PLATFORM = unix
+endif
+
+ifeq ($(PLATFORM),unix)
+PROFILING = -pg
endif
-ifeq ($(PLATFORM),win32)
+ifeq ($(PLATFORM),cross-msdos)
+PROGNAME = ../rocks.exe
+TARGET = allegro
+endif
+
+ifeq ($(PLATFORM),cross-win32)
PROGNAME = ../rocksndiamonds.exe
TARGET = sdl
-else
-PROFILING = -pg
+endif
+
+ifeq ($(TARGET),x11)
+SYS_CFLAGS = -DTARGET_X11 $(X11_INCL)
+SYS_LDFLAGS = $(X11_LIBS) -lX11
endif
ifeq ($(TARGET),sdl)
SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags)
-SYS_LDFLAGS = -lSDL_image -lSDL_mixer $(shell sdl-config --libs) -lm
-else
-SYS_CFLAGS = -DTARGET_X11 $(X11_INCL)
-SYS_LDFLAGS = $(X11_LIBS) -lX11 -lm
+SYS_LDFLAGS = -lSDL_image -lSDL_mixer $(shell sdl-config --libs)
+endif
+
+ifeq ($(TARGET),allegro)
+SYS_CFLAGS = -DTARGET_X11 -I$(CROSS_PATH_MSDOS)/include
+SYS_LDFLAGS = -lalleg
endif
endif # (PLATFORM != msdos)
# OPTIONS = -O3
CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(CONFIG)
-LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS)
+LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) -lm
SRCS = main.c \
init.c \
gi->text.cursor_position++;
DrawGadget(gi, DG_PRESSED, DG_DIRECT);
}
- else if (key == KEY_Left && cursor_pos > 0)
+ else if (key == KSYM_Left && cursor_pos > 0)
{
gi->text.cursor_position--;
DrawGadget(gi, DG_PRESSED, DG_DIRECT);
}
- else if (key == KEY_Right && cursor_pos < text_length)
+ else if (key == KSYM_Right && cursor_pos < text_length)
{
gi->text.cursor_position++;
DrawGadget(gi, DG_PRESSED, DG_DIRECT);
}
- else if (key == KEY_BackSpace && cursor_pos > 0)
+ else if (key == KSYM_BackSpace && cursor_pos > 0)
{
strcpy(text, gi->text.value);
strcpy(&gi->text.value[cursor_pos - 1], &text[cursor_pos]);
gi->text.cursor_position--;
DrawGadget(gi, DG_PRESSED, DG_DIRECT);
}
- else if (key == KEY_Delete && cursor_pos < text_length)
+ else if (key == KSYM_Delete && cursor_pos < text_length)
{
strcpy(text, gi->text.value);
strcpy(&gi->text.value[cursor_pos], &text[cursor_pos + 1]);
DrawGadget(gi, DG_PRESSED, DG_DIRECT);
}
- else if (key == KEY_Return)
+ else if (key == KSYM_Return)
{
CheckRangeOfNumericInputGadget(gi);
DrawGadget(gi, DG_UNPRESSED, DG_DIRECT);
{
if (letter)
DrawLevelText(0, 0, letter, TEXT_WRITECHAR);
- else if (key == KEY_Delete || key == KEY_BackSpace)
+ else if (key == KSYM_Delete || key == KSYM_BackSpace)
DrawLevelText(0, 0, 0, TEXT_BACKSPACE);
- else if (key == KEY_Return)
+ else if (key == KSYM_Return)
DrawLevelText(0, 0, 0, TEXT_NEWLINE);
}
else if (button_status == MB_RELEASED)
switch (key)
{
- case KEY_Left:
+ case KSYM_Left:
id = GADGET_ID_SCROLL_LEFT;
break;
- case KEY_Right:
+ case KSYM_Right:
id = GADGET_ID_SCROLL_RIGHT;
break;
- case KEY_Up:
+ case KSYM_Up:
id = GADGET_ID_SCROLL_UP;
break;
- case KEY_Down:
+ case KSYM_Down:
id = GADGET_ID_SCROLL_DOWN;
break;
- case KEY_Page_Up:
+ case KSYM_Page_Up:
id = GADGET_ID_SCROLL_LIST_UP;
button = MB_RIGHTBUTTON;
break;
- case KEY_Page_Down:
+ case KSYM_Page_Down:
id = GADGET_ID_SCROLL_LIST_DOWN;
button = MB_RIGHTBUTTON;
break;
ClickOnGadget(level_editor_gadget[id], button);
else if (letter == '.')
ClickOnGadget(level_editor_gadget[GADGET_ID_SINGLE_ITEMS], button);
- else if (key == KEY_space || key == KEY_Return)
+ else if (key == KSYM_space || key == KSYM_Return)
ClickOnGadget(level_editor_gadget[GADGET_ID_TEST], button);
else
for (i=0; i<ED_NUM_CTRL_BUTTONS; i++)
HandleClientMessageEvent((ClientMessageEvent *) event);
break;
-#ifdef USE_SDL_JOYSTICK
+#if defined(TARGET_SDL)
case SDL_JOYAXISMOTION:
case SDL_JOYBUTTONDOWN:
case SDL_JOYBUTTONUP:
break;
case TYPENAME:
- HandleTypeName(0, KEY_Return);
+ HandleTypeName(0, KSYM_Return);
break;
case CHOOSELEVEL:
if (key_status == KEY_RELEASED)
return;
- if ((key == KEY_Return || key == KEY_space) &&
+ if ((key == KSYM_Return || key == KSYM_space) &&
game_status == PLAYING && AllPlayersGone)
{
CloseDoor(DOOR_CLOSE_1);
}
/* allow quick escape to the main menu with the Escape key */
- if (key == KEY_Escape && game_status != MAINMENU)
+ if (key == KSYM_Escape && game_status != MAINMENU)
{
CloseDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY);
game_status = MAINMENU;
case SETUPINPUT:
switch(key)
{
- case KEY_Return:
- case KEY_space:
+ case KSYM_Return:
+ case KSYM_space:
if (game_status == MAINMENU)
HandleMainMenu(0,0, 0,0, MB_MENU_CHOICE);
else if (game_status == CHOOSELEVEL)
HandleSetupInputScreen(0,0, 0,0, MB_MENU_CHOICE);
break;
- case KEY_Page_Up:
+ case KSYM_Page_Up:
if (game_status == CHOOSELEVEL)
HandleChooseLevel(0,0, 0,-SCR_FIELDY, MB_MENU_MARK);
break;
- case KEY_Page_Down:
+ case KSYM_Page_Down:
if (game_status == CHOOSELEVEL)
HandleChooseLevel(0,0, 0,SCR_FIELDY, MB_MENU_MARK);
break;
case HALLOFFAME:
switch(key)
{
- case KEY_Return:
- case KEY_space:
+ case KSYM_Return:
+ case KSYM_space:
game_status = MAINMENU;
DrawMainMenu();
BackToFront();
break;
- case KEY_Page_Up:
+ case KSYM_Page_Up:
HandleHallOfFame(0,0, 0,-SCR_FIELDY, MB_MENU_MARK);
break;
- case KEY_Page_Down:
+ case KSYM_Page_Down:
HandleHallOfFame(0,0, 0,SCR_FIELDY, MB_MENU_MARK);
break;
{
#ifdef DEBUG
- case KEY_0:
- case KEY_1:
- case KEY_2:
- case KEY_3:
- case KEY_4:
- case KEY_5:
- case KEY_6:
- case KEY_7:
- case KEY_8:
- case KEY_9:
- if (key == KEY_0)
+ case KSYM_0:
+ case KSYM_1:
+ case KSYM_2:
+ case KSYM_3:
+ case KSYM_4:
+ case KSYM_5:
+ case KSYM_6:
+ case KSYM_7:
+ case KSYM_8:
+ case KSYM_9:
+ if (key == KSYM_0)
{
if (GameFrameDelay == 500)
GameFrameDelay = GAME_FRAME_DELAY;
GameFrameDelay = 500;
}
else
- GameFrameDelay = (key - KEY_0) * 10;
+ GameFrameDelay = (key - KSYM_0) * 10;
printf("Game speed == %d%% (%d ms delay between two frames)\n",
GAME_FRAME_DELAY * 100 / GameFrameDelay, GameFrameDelay);
break;
- case KEY_d:
+ case KSYM_d:
if (options.debug)
{
options.debug = FALSE;
}
break;
- case KEY_s:
+ case KSYM_s:
if (!global.fps_slowdown)
{
global.fps_slowdown = TRUE;
break;
#if 0
- case KEY_a:
+ case KSYM_a:
if (ScrollStepSize == TILEX/8)
ScrollStepSize = TILEX/4;
else
#endif
#if 0
- case KEY_m:
+ case KSYM_m:
if (MoveSpeed == 8)
{
MoveSpeed = 4;
break;
#endif
- case KEY_f:
+ case KSYM_f:
ScrollStepSize = TILEX/8;
printf("ScrollStepSize == %d (1/8)\n", ScrollStepSize);
break;
- case KEY_g:
+ case KSYM_g:
ScrollStepSize = TILEX/4;
printf("ScrollStepSize == %d (1/4)\n", ScrollStepSize);
break;
- case KEY_h:
+ case KSYM_h:
ScrollStepSize = TILEX/2;
printf("ScrollStepSize == %d (1/2)\n", ScrollStepSize);
break;
- case KEY_l:
+ case KSYM_l:
ScrollStepSize = TILEX;
printf("ScrollStepSize == %d (1/1)\n", ScrollStepSize);
break;
- case KEY_Q:
- case KEY_q:
+ case KSYM_Q:
+ case KSYM_q:
local_player->dynamite = 1000;
break;
#if 0
- case KEY_z:
+ case KSYM_z:
{
int i;
return;
}
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
if (options.network)
HandleNetworking();
#endif
#define TAPE_COOKIE_10 "ROCKSNDIAMONDS_LEVELREC_FILE_VERSION_1.0"
/* file names and filename extensions */
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
#define USERDATA_DIRECTORY ".rocksndiamonds"
#define LEVELSETUP_DIRECTORY "levelsetup"
#define SETUP_FILENAME "setup.conf"
#define SCOREFILE_EXTENSION "sco"
#endif
-#if defined(MSDOS) || defined(WIN32)
+#if !defined(PLATFORM_UNIX)
#define ERROR_FILENAME "error.out"
#endif
-#ifdef WIN32
+#if defined(PLATFORM_WIN32)
#ifndef S_IRGRP
#define S_IRGRP S_IRUSR
#endif
#ifndef S_IXOTH
#define S_IXOTH S_IXUSR
#endif
-#endif
+#endif /* PLATFORM_WIN32 */
/* file permissions for newly written files */
#define MODE_R_ALL (S_IRUSR | S_IRGRP | S_IROTH)
static void createDirectory(char *dir, char *text)
{
if (access(dir, F_OK) != 0)
-#ifdef WIN32
+#if defined(PLATFORM_WIN32)
if (mkdir(dir) != 0)
#else
if (mkdir(dir, USERDATA_DIR_MODE) != 0)
si->input[i].joy.ylower = JOYSTICK_YLOWER;
si->input[i].joy.snap = (i == 0 ? JOY_BUTTON_1 : 0);
si->input[i].joy.bomb = (i == 0 ? JOY_BUTTON_2 : 0);
- si->input[i].key.left = (i == 0 ? DEFAULT_KEY_LEFT : KEY_UNDEFINED);
- si->input[i].key.right = (i == 0 ? DEFAULT_KEY_RIGHT : KEY_UNDEFINED);
- si->input[i].key.up = (i == 0 ? DEFAULT_KEY_UP : KEY_UNDEFINED);
- si->input[i].key.down = (i == 0 ? DEFAULT_KEY_DOWN : KEY_UNDEFINED);
- si->input[i].key.snap = (i == 0 ? DEFAULT_KEY_SNAP : KEY_UNDEFINED);
- si->input[i].key.bomb = (i == 0 ? DEFAULT_KEY_BOMB : KEY_UNDEFINED);
+ si->input[i].key.left = (i == 0 ? DEFAULT_KEY_LEFT : KSYM_UNDEFINED);
+ si->input[i].key.right = (i == 0 ? DEFAULT_KEY_RIGHT : KSYM_UNDEFINED);
+ si->input[i].key.up = (i == 0 ? DEFAULT_KEY_UP : KSYM_UNDEFINED);
+ si->input[i].key.down = (i == 0 ? DEFAULT_KEY_DOWN : KSYM_UNDEFINED);
+ si->input[i].key.snap = (i == 0 ? DEFAULT_KEY_SNAP : KSYM_UNDEFINED);
+ si->input[i].key.bomb = (i == 0 ? DEFAULT_KEY_BOMB : KSYM_UNDEFINED);
}
}
chmod(filename, SETUP_PERMS);
}
-#if defined(MSDOS) || defined(WIN32)
+#if !defined(PLATFORM_UNIX)
void initErrorFile()
{
char *filename;
void LoadLevelSetup_SeriesInfo(void);
void SaveLevelSetup_SeriesInfo(void);
-#if defined(MSDOS) || defined(WIN32)
+#if !defined(PLATFORM_UNIX)
void initErrorFile();
FILE *openErrorFile();
void dumpErrorFile();
network_player_action_received = FALSE;
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
/* initial null action */
if (network_playing)
SendToServer_MovePlayer(MV_NO_MOVING);
#endif
*/
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
/* last chance to get network player actions without main loop delay */
HandleNetworking();
#endif
stored_player[i].effective_action = stored_player[i].action;
}
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
if (network_playing)
SendToServer_MovePlayer(summarized_player_action);
#endif
volume = PSND_MAX_VOLUME;
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
stereo = (sx - SCR_FIELDX/2) * 12;
#else
stereo = PSND_MIDDLE + (2 * sx - (SCR_FIELDX - 1)) * 5;
Request("Do you really want to quit the game ?",
REQ_ASK | REQ_STAY_CLOSED))
{
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
if (options.network)
SendToServer_StopPlaying();
else
case GAME_CTRL_ID_PAUSE:
if (options.network)
{
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
if (tape.pausing)
SendToServer_ContinuePlaying();
else
case GAME_CTRL_ID_PLAY:
if (tape.pausing)
{
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
if (options.network)
SendToServer_ContinuePlaying();
else
* image.c *
***********************************************************/
-#ifndef TARGET_SDL
+#if defined(TARGET_X11)
#include "image.h"
#include "pcx.h"
#include "misc.h"
-/* exclude all except newImage() and freeImage() */
-#ifndef MSDOS
+/* for MS-DOS/Allegro, exclude all except newImage() and freeImage() */
+
+Image *newImage(unsigned int width, unsigned int height, unsigned int depth)
+{
+ Image *image;
+ const unsigned int bytes_per_pixel = 1;
+ int i;
+
+ if (depth > 8)
+ Error(ERR_EXIT, "images with more than 256 colors are not supported");
+
+ depth = 8;
+ image = checked_malloc(sizeof(Image));
+ image->data = checked_malloc(width * height * bytes_per_pixel);
+ image->width = width;
+ image->height = height;
+ image->depth = depth;
+ image->rgb.used = 0;
+ for (i=0; i<MAX_COLORS; i++)
+ image->rgb.color_used[i] = FALSE;
+
+ return image;
+}
+
+void freeImage(Image *image)
+{
+ free(image->data);
+ free(image);
+}
+
+#if defined(PLATFORM_UNIX)
/* extra colors to try allocating in private color maps to minimize flashing */
#define NOFLASH_COLORS 256
free(ximageinfo);
}
-#endif /* !MSDOS */
-
-Image *newImage(unsigned int width, unsigned int height, unsigned int depth)
-{
- Image *image;
- const unsigned int bytes_per_pixel = 1;
- int i;
-
- if (depth > 8)
- Error(ERR_EXIT, "images with more than 256 colors are not supported");
-
- depth = 8;
- image = checked_malloc(sizeof(Image));
- image->data = checked_malloc(width * height * bytes_per_pixel);
- image->width = width;
- image->height = height;
- image->depth = depth;
- image->rgb.used = 0;
- for (i=0; i<MAX_COLORS; i++)
- image->rgb.color_used[i] = FALSE;
-
- return image;
-}
-
-void freeImage(Image *image)
-{
- free(image->data);
- free(image);
-}
-
-#ifndef MSDOS
-
int Read_PCX_to_Pixmap(Display *display, Window window, GC gc, char *filename,
Pixmap *pixmap, Pixmap *pixmap_mask)
{
return PCX_Success;
}
-#endif /* !MSDOS */
-#endif /* !TARGET_SDL */
+#endif /* PLATFORM_UNIX */
+#endif /* TARGET_X11 */
byte *data; /* image data */
} Image;
-int Read_PCX_to_Pixmap(Display *, Window, GC, char *, Pixmap *, Pixmap *);
-
Image *newImage(unsigned int, unsigned int, unsigned int);
void freeImage(Image *);
void freeXImage(Image *, XImageInfo *);
+int Read_PCX_to_Pixmap(Display *, Window, GC, char *, Pixmap *, Pixmap *);
#endif /* !TARGET_SDL */
#endif /* IMAGE_H */
void OpenAll(int argc, char *argv[])
{
-#if defined(MSDOS) || defined(WIN32)
+#if !defined(PLATFORM_UNIX)
initErrorFile();
#endif
if (options.serveronly)
{
-#ifdef WIN32
- Error(ERR_WARN, "networking not supported in Windows version");
-#else
+#if defined(PLATFORM_UNIX)
NetworkServer(options.server_port, options.serveronly);
+#else
+ Error(ERR_WARN, "networking not supported in Windows version");
#endif
/* never reached */
void InitNetworkServer()
{
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
int nr_wanted;
#endif
if (!options.network)
return;
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED);
if (!ConnectToServer(options.server_host, options.server_port))
if (sound_status == SOUND_OFF)
return;
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
if (InitAudio())
{
sound_status = SOUND_AVAILABLE;
}
#else /* !TARGET_SDL */
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
if ((sound_status = CheckAudio(sound_device_name)) == SOUND_OFF)
return;
sound_loops_allowed = TRUE;
#endif
-#else /* MSDOS || WIN32 */
+#else /* !PLATFORM_UNIX */
sound_loops_allowed = TRUE;
-#endif /* MSDOS || WIN32 */
+#endif /* !PLATFORM_UNIX */
#endif /* !TARGET_SDL */
for(i=0; i<NUM_SOUNDS; i++)
if (sound_status == SOUND_OFF)
return;
-#ifndef TARGET_SDL
-
-#if !defined(MSDOS) && !defined(WIN32)
+#if !defined(TARGET_SDL)
+#if defined(PLATFORM_UNIX)
if (pipe(sound_pipe)<0)
{
else /* we are parent */
close(sound_pipe[0]); /* no reading from pipe needed */
-#else /* MSDOS || WIN32 */
+#else /* !PLATFORM_UNIX */
SoundServer();
-#endif /* MSDOS */
-
+#endif /* !PLATFORM_UNIX */
#endif /* !TARGET_SDL */
}
void InitJoysticks()
{
-#ifdef USE_SDL_JOYSTICK
+#if defined(TARGET_SDL)
static boolean sdl_joystick_subsystem_initialized = FALSE;
#endif
joystick_status = JOYSTICK_OFF;
-#ifdef USE_SDL_JOYSTICK
+#if defined(TARGET_SDL)
if (!sdl_joystick_subsystem_initialized)
{
joystick_status = JOYSTICK_AVAILABLE;
}
-#else /* !USE_SDL_JOYSTICK */
+#else /* !TARGET_SDL */
-#ifndef MSDOS
+#if defined(PLATFORM_UNIX)
for (i=0; i<MAX_PLAYERS; i++)
{
char *device_name = setup.input[i].joy.device_name;
joystick_status = JOYSTICK_AVAILABLE;
}
-#else /* MSDOS */
+#else /* !PLATFORM_UNIX */
/* try to access two joysticks; if that fails, try to access just one */
if (install_joystick(JOY_TYPE_2PADS) == 0 ||
{
int i, j;
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
SDL_Surface *sdl_image_tmp;
#else
GC copy_clipmask_gc;
unsigned long clip_gc_valuemask;
#endif
-#ifdef MSDOS
- static struct PictureFileInfo pic[NUM_PICTURES] =
- {
- { "Screen", TRUE },
- { "Door", TRUE },
- { "Heroes", TRUE },
- { "Toons", TRUE },
- { "SP", TRUE },
- { "DC", TRUE },
- { "More", TRUE },
- { "Font", FALSE },
- { "Font2", FALSE },
- { "Font3", FALSE }
- };
-#else
+#if !defined(PLATFORM_MSDOS)
static struct PictureFileInfo pic[NUM_PICTURES] =
{
{ "RocksScreen", TRUE },
{ "RocksFont2", FALSE },
{ "RocksFont3", FALSE }
};
+#else
+ static struct PictureFileInfo pic[NUM_PICTURES] =
+ {
+ { "Screen", TRUE },
+ { "Door", TRUE },
+ { "Heroes", TRUE },
+ { "Toons", TRUE },
+ { "SP", TRUE },
+ { "DC", TRUE },
+ { "More", TRUE },
+ { "Font", FALSE },
+ { "Font2", FALSE },
+ { "Font3", FALSE }
+ };
#endif
static struct
LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
rest(200);
-#endif /* MSDOS */
+#endif
DrawInitText("Loading graphics:",120,FC_GREEN);
for(i=0; i<NUM_PICTURES; i++)
/* create additional image buffers for masking of graphics */
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
/* initialize surface array to 'NULL' */
for(i=0; i<NUM_TILES; i++)
char basefilename[256];
char filename[256];
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
SDL_Surface *sdl_image_tmp;
-#else /* !TARGET_SDL */
+#else
int pcx_err;
-#endif /* !TARGET_SDL */
+#endif
char *picture_ext = ".pcx";
/* Grafik laden */
sprintf(filename, "%s/%s/%s",
options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
rest(100);
-#endif /* MSDOS */
+#endif
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
/* load image to temporary surface */
if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
#endif /* !TARGET_SDL */
}
-#ifndef TARGET_SDL
- /* zugehörige Maske laden (wenn vorhanden) */
+#if defined(TARGET_X11)
+ /* check if clip mask was correctly created */
if (pic->picture_with_mask && !clipmask[pos])
Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
-#endif /* !TARGET_SDL */
+#endif
}
void InitGadgets()
{
int i;
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
StopSounds();
FreeSounds(NUM_SOUNDS);
#else
if (pix[i])
FreeBitmap(pix[i]);
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
FreeBitmap(pix_masked[i]);
#else
if (clipmask[i])
#endif
}
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
KeyboardAutoRepeatOn();
#else
if (gc)
}
#endif
-#if defined(MSDOS) || defined(WIN32)
+#if !defined(PLATFORM_UNIX)
dumpErrorFile();
#endif
#include "joystick.h"
#include "misc.h"
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
static int JoystickPosition(int middle, int margin, int actual)
{
long range, pos;
}
#endif
-#ifdef USE_SDL_JOYSTICK
+#if defined(TARGET_SDL)
static SDL_Joystick *sdl_joystick[MAX_PLAYERS] = { NULL, NULL, NULL, NULL };
static int sdl_js_axis[MAX_PLAYERS][2] = { {0, 0}, {0, 0}, {0, 0}, {0, 0} };
return result;
}
-#else /* !USE_SDL_JOYSTICK */
+#else /* !TARGET_SDL */
void CheckJoystickData()
{
}
}
-#ifndef MSDOS
+#if defined(PLATFORM_UNIX)
int Joystick(int player_nr)
{
#ifdef __FreeBSD__
return result;
}
-#else /* MSDOS */
+#else /* PLATFORM_MSDOS */
/* allegro global variables for joystick control */
extern int num_joysticks;
return 0;
/* the allegro global variable 'num_joysticks' contains the number
- of joysticks found at initialization under MSDOS / Windows */
+ of joysticks found at initialization under MS-DOS / Windows */
#if 0
if (joystick_nr >= num_joysticks || !setup.input[player_nr].use_joystick)
return result;
}
-#endif /* MSDOS */
+#endif /* PLATFORM_MSDOS */
-#endif /* !USE_SDL_JOYSTICK */
+#endif /* !TARGET_SDL */
int JoystickButton(int player_nr)
{
#endif
-#ifdef USE_SDL_JOYSTICK
+#if defined(TARGET_SDL)
SDL_Joystick *Get_SDL_Joystick(int);
boolean Open_SDL_Joystick(int);
void Close_SDL_Joystick(int);
int AnyJoystick(void);
int AnyJoystickButton(void);
-#endif
+#endif /* JOYSTICK_H */
#include "joystick.h"
#include "misc.h"
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
#include <fcntl.h>
#endif
/* | SDL TEST STUFF | */
/* +-----------------------------------------------------------------------+ */
-#ifdef USE_SDL_JOYSTICK
+#if defined(TARGET_SDL)
SDL_Surface *sdl_screen, *sdl_image_tmp, *sdl_image, *sdl_image_masked;
SDL_Surface *sdl_image2_tmp, *sdl_image2, *sdl_image2_masked;
SDL_QuitSubSystem(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK);
}
-#endif /* USE_SDL_JOYSTICK */
+#endif /* TARGET_SDL */
/* +-----------------------------------------------------------------------+ */
/* | SDL TEST STUFF | */
{
program_name = (strrchr(argv[0],'/') ? strrchr(argv[0],'/') + 1 : argv[0]);
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
_fmode = O_BINARY;
#endif
#endif
#if 0
-#ifdef USE_SDL_JOYSTICK
+#ifdef TARGET_SDL
/*
TEST_SDL_BLIT_RECT((WIN_XSIZE - TILEX)/2, (WIN_YSIZE - TILEY)/2);
TEST_SDL_EVENT_LOOP();
#define WIN_XSIZE 672
#define WIN_YSIZE 560
#define WIN_SDL_DEPTH 16 /* !!! change this !!! */
-#ifndef MSDOS
+
+#if !defined(PLATFORM_MSDOS)
#define WIN_XPOS 0
#define WIN_YPOS 0
-#else /* MSDOS */
+#else
#define WIN_XPOS ((XRES - WIN_XSIZE) / 2)
#define WIN_YPOS ((YRES - WIN_YSIZE) / 2)
-#endif /* MSDOS */
+#endif
+
#define SCR_FIELDX 17
#define SCR_FIELDY 17
#define MAX_BUF_XSIZE (SCR_FIELDX + 2)
#define NUM_SOUNDS 62
/* default input keys */
-#define DEFAULT_KEY_LEFT KEY_Left
-#define DEFAULT_KEY_RIGHT KEY_Right
-#define DEFAULT_KEY_UP KEY_Up
-#define DEFAULT_KEY_DOWN KEY_Down
-#define DEFAULT_KEY_SNAP KEY_Shift_L
-#define DEFAULT_KEY_BOMB KEY_Shift_R
-#define DEFAULT_KEY_OKAY KEY_Return
-#define DEFAULT_KEY_CANCEL KEY_Escape
+#define DEFAULT_KEY_LEFT KSYM_Left
+#define DEFAULT_KEY_RIGHT KSYM_Right
+#define DEFAULT_KEY_UP KSYM_Up
+#define DEFAULT_KEY_DOWN KSYM_Down
+#define DEFAULT_KEY_SNAP KSYM_Shift_L
+#define DEFAULT_KEY_BOMB KSYM_Shift_R
+#define DEFAULT_KEY_OKAY KSYM_Return
+#define DEFAULT_KEY_CANCEL KSYM_Escape
/* directions for moving */
#define MV_NO_MOVING 0
* misc.c *
***********************************************************/
+#include "platform.h"
+
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <stdarg.h>
#include <ctype.h>
-#ifndef WIN32
+#if !defined(PLATFORM_WIN32)
#include <pwd.h>
#include <sys/param.h>
#endif
#include "joystick.h"
#include "files.h"
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
volatile unsigned long counter = 0;
void increment_counter()
#define MAX_OPTION_LEN 256
#ifdef TARGET_SDL
-
static unsigned long mainCounter(int mode)
{
static unsigned long base_ms = 0;
}
#else /* !TARGET_SDL */
-#ifndef MSDOS
+#if defined(PLATFORM_UNIX)
static unsigned long mainCounter(int mode)
{
static struct timeval base_time = { 0, 0 };
return counter_ms; /* return milliseconds since last init */
}
-
-#endif /* !MSDOS */
+#endif /* PLATFORM_UNIX */
#endif /* !TARGET_SDL */
void InitCounter() /* set counter back to zero */
{
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
mainCounter(INIT_COUNTER);
#else
LOCK_VARIABLE(counter);
unsigned long Counter() /* get milliseconds since last call of InitCounter() */
{
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
return mainCounter(READ_COUNTER);
#else
return (counter * 10);
{
boolean do_busy_waiting = (milliseconds_delay < 5 ? TRUE : FALSE);
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
/* don't use select() to perform waiting operations under DOS/Windows
environment; always use a busy loop for waiting instead */
do_busy_waiting = TRUE;
}
else
{
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
SDL_Delay(milliseconds_delay);
-#else /* !TARGET_SDL */
+#else
struct timeval delay;
delay.tv_sec = milliseconds_delay / 1000;
if (select(0, NULL, NULL, NULL, &delay) != 0)
Error(ERR_WARN, "sleep_milliseconds(): select() failed");
-#endif /* !TARGET_SDL */
+#endif
}
}
unsigned int SimpleRND(unsigned int max)
{
-#ifdef TARGET_SDL
-
+#if defined(TARGET_SDL)
static unsigned long root = 654321;
unsigned long current_ms;
current_ms = SDL_GetTicks();
root = root * 4253261 + current_ms;
return (root % max);
-
-#else /* !TARGET_SDL */
-
+#else
static unsigned long root = 654321;
struct timeval current_time;
gettimeofday(¤t_time, NULL);
root = root * 4253261 + current_time.tv_sec + current_time.tv_usec;
return (root % max);
-
-#endif /* !TARGET_SDL */
+#endif
}
#ifdef DEBUG
unsigned int InitRND(long seed)
{
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
unsigned long current_ms;
if (seed == NEW_RANDOMIZE)
srandom_linux_libc((unsigned int) seed);
return (unsigned int) seed;
}
-#else /* !TARGET_SDL */
+#else
struct timeval current_time;
if (seed == NEW_RANDOMIZE)
srandom_linux_libc((unsigned int) seed);
return (unsigned int) seed;
}
-#endif /* !TARGET_SDL */
+#endif
}
char *getLoginName()
{
-#ifdef WIN32
+#if defined(PLATFORM_WIN32)
return ANONYMOUS_NAME;
#else
struct passwd *pwd;
char *getRealName()
{
-#if defined(MSDOS) || defined(WIN32)
- return ANONYMOUS_NAME;
-#else
+#if defined(PLATFORM_UNIX)
struct passwd *pwd;
if ((pwd = getpwuid(getuid())) == NULL || strlen(pwd->pw_gecos) == 0)
return real_name;
}
+#else /* !PLATFORM_UNIX */
+ return ANONYMOUS_NAME;
#endif
}
char *getHomeDir()
{
-#if defined(MSDOS) || defined(WIN32)
- return ".";
-#else
+#if defined(PLATFORM_UNIX)
static char *home_dir = NULL;
if (!home_dir)
}
return home_dir;
+#else
+ return ".";
#endif
}
if (mode & ERR_WARN && !options.verbose)
return;
-#if defined(MSDOS) || defined(WIN32)
+#if !defined(PLATFORM_UNIX)
if ((error = openErrorFile()) == NULL)
{
printf("Cannot write to error output file!\n");
putFile32BitInteger(file, chunk_length, byte_order);
}
-#define TRANSLATE_KEY_TO_KEYNAME 0
-#define TRANSLATE_KEY_TO_X11KEYNAME 1
-#define TRANSLATE_X11KEYNAME_TO_KEY 2
+#define TRANSLATE_KEYSYM_TO_KEYNAME 0
+#define TRANSLATE_KEYSYM_TO_X11KEYNAME 1
+#define TRANSLATE_X11KEYNAME_TO_KEYSYM 2
void translate_keyname(Key *keysym, char **x11name, char **name, int mode)
{
} translate_key[] =
{
/* normal cursor keys */
- { KEY_Left, "XK_Left", "cursor left" },
- { KEY_Right, "XK_Right", "cursor right" },
- { KEY_Up, "XK_Up", "cursor up" },
- { KEY_Down, "XK_Down", "cursor down" },
+ { KSYM_Left, "XK_Left", "cursor left" },
+ { KSYM_Right, "XK_Right", "cursor right" },
+ { KSYM_Up, "XK_Up", "cursor up" },
+ { KSYM_Down, "XK_Down", "cursor down" },
/* keypad cursor keys */
-#ifdef KEY_KP_Left
- { KEY_KP_Left, "XK_KP_Left", "keypad left" },
- { KEY_KP_Right, "XK_KP_Right", "keypad right" },
- { KEY_KP_Up, "XK_KP_Up", "keypad up" },
- { KEY_KP_Down, "XK_KP_Down", "keypad down" },
+#ifdef KSYM_KP_Left
+ { KSYM_KP_Left, "XK_KP_Left", "keypad left" },
+ { KSYM_KP_Right, "XK_KP_Right", "keypad right" },
+ { KSYM_KP_Up, "XK_KP_Up", "keypad up" },
+ { KSYM_KP_Down, "XK_KP_Down", "keypad down" },
#endif
/* other keypad keys */
-#ifdef KEY_KP_Enter
- { KEY_KP_Enter, "XK_KP_Enter", "keypad enter" },
- { KEY_KP_Add, "XK_KP_Add", "keypad +" },
- { KEY_KP_Subtract, "XK_KP_Subtract", "keypad -" },
- { KEY_KP_Multiply, "XK_KP_Multiply", "keypad mltply" },
- { KEY_KP_Divide, "XK_KP_Divide", "keypad /" },
- { KEY_KP_Separator, "XK_KP_Separator", "keypad ," },
+#ifdef KSYM_KP_Enter
+ { KSYM_KP_Enter, "XK_KP_Enter", "keypad enter" },
+ { KSYM_KP_Add, "XK_KP_Add", "keypad +" },
+ { KSYM_KP_Subtract, "XK_KP_Subtract", "keypad -" },
+ { KSYM_KP_Multiply, "XK_KP_Multiply", "keypad mltply" },
+ { KSYM_KP_Divide, "XK_KP_Divide", "keypad /" },
+ { KSYM_KP_Separator,"XK_KP_Separator", "keypad ," },
#endif
/* modifier keys */
- { KEY_Shift_L, "XK_Shift_L", "left shift" },
- { KEY_Shift_R, "XK_Shift_R", "right shift" },
- { KEY_Control_L, "XK_Control_L", "left control" },
- { KEY_Control_R, "XK_Control_R", "right control" },
- { KEY_Meta_L, "XK_Meta_L", "left meta" },
- { KEY_Meta_R, "XK_Meta_R", "right meta" },
- { KEY_Alt_L, "XK_Alt_L", "left alt" },
- { KEY_Alt_R, "XK_Alt_R", "right alt" },
- { KEY_Super_L, "XK_Super_L", "left super" }, /* Win-L */
- { KEY_Super_R, "XK_Super_R", "right super" }, /* Win-R */
- { KEY_Mode_switch, "XK_Mode_switch", "mode switch" }, /* Alt-R */
- { KEY_Multi_key, "XK_Multi_key", "multi key" }, /* Ctrl-R */
+ { KSYM_Shift_L, "XK_Shift_L", "left shift" },
+ { KSYM_Shift_R, "XK_Shift_R", "right shift" },
+ { KSYM_Control_L, "XK_Control_L", "left control" },
+ { KSYM_Control_R, "XK_Control_R", "right control" },
+ { KSYM_Meta_L, "XK_Meta_L", "left meta" },
+ { KSYM_Meta_R, "XK_Meta_R", "right meta" },
+ { KSYM_Alt_L, "XK_Alt_L", "left alt" },
+ { KSYM_Alt_R, "XK_Alt_R", "right alt" },
+ { KSYM_Super_L, "XK_Super_L", "left super" }, /* Win-L */
+ { KSYM_Super_R, "XK_Super_R", "right super" }, /* Win-R */
+ { KSYM_Mode_switch, "XK_Mode_switch", "mode switch" }, /* Alt-R */
+ { KSYM_Multi_key, "XK_Multi_key", "multi key" }, /* Ctrl-R */
/* some special keys */
- { KEY_BackSpace, "XK_BackSpace", "backspace" },
- { KEY_Delete, "XK_Delete", "delete" },
- { KEY_Insert, "XK_Insert", "insert" },
- { KEY_Tab, "XK_Tab", "tab" },
- { KEY_Home, "XK_Home", "home" },
- { KEY_End, "XK_End", "end" },
- { KEY_Page_Up, "XK_Page_Up", "page up" },
- { KEY_Page_Down, "XK_Page_Down", "page down" },
- { KEY_Menu, "XK_Menu", "menu" }, /* Win-Menu */
+ { KSYM_BackSpace, "XK_BackSpace", "backspace" },
+ { KSYM_Delete, "XK_Delete", "delete" },
+ { KSYM_Insert, "XK_Insert", "insert" },
+ { KSYM_Tab, "XK_Tab", "tab" },
+ { KSYM_Home, "XK_Home", "home" },
+ { KSYM_End, "XK_End", "end" },
+ { KSYM_Page_Up, "XK_Page_Up", "page up" },
+ { KSYM_Page_Down, "XK_Page_Down", "page down" },
+ { KSYM_Menu, "XK_Menu", "menu" }, /* Win-Menu */
/* ASCII 0x20 to 0x40 keys (except numbers) */
- { KEY_space, "XK_space", "space" },
- { KEY_exclam, "XK_exclam", "!" },
- { KEY_quotedbl, "XK_quotedbl", "\"" },
- { KEY_numbersign, "XK_numbersign", "#" },
- { KEY_dollar, "XK_dollar", "$" },
- { KEY_percent, "XK_percent", "%" },
- { KEY_ampersand, "XK_ampersand", "&" },
- { KEY_apostrophe, "XK_apostrophe", "'" },
- { KEY_parenleft, "XK_parenleft", "(" },
- { KEY_parenright, "XK_parenright", ")" },
- { KEY_asterisk, "XK_asterisk", "*" },
- { KEY_plus, "XK_plus", "+" },
- { KEY_comma, "XK_comma", "," },
- { KEY_minus, "XK_minus", "-" },
- { KEY_period, "XK_period", "." },
- { KEY_slash, "XK_slash", "/" },
- { KEY_colon, "XK_colon", ":" },
- { KEY_semicolon, "XK_semicolon", ";" },
- { KEY_less, "XK_less", "<" },
- { KEY_equal, "XK_equal", "=" },
- { KEY_greater, "XK_greater", ">" },
- { KEY_question, "XK_question", "?" },
- { KEY_at, "XK_at", "@" },
+ { KSYM_space, "XK_space", "space" },
+ { KSYM_exclam, "XK_exclam", "!" },
+ { KSYM_quotedbl, "XK_quotedbl", "\"" },
+ { KSYM_numbersign, "XK_numbersign", "#" },
+ { KSYM_dollar, "XK_dollar", "$" },
+ { KSYM_percent, "XK_percent", "%" },
+ { KSYM_ampersand, "XK_ampersand", "&" },
+ { KSYM_apostrophe, "XK_apostrophe", "'" },
+ { KSYM_parenleft, "XK_parenleft", "(" },
+ { KSYM_parenright, "XK_parenright", ")" },
+ { KSYM_asterisk, "XK_asterisk", "*" },
+ { KSYM_plus, "XK_plus", "+" },
+ { KSYM_comma, "XK_comma", "," },
+ { KSYM_minus, "XK_minus", "-" },
+ { KSYM_period, "XK_period", "." },
+ { KSYM_slash, "XK_slash", "/" },
+ { KSYM_colon, "XK_colon", ":" },
+ { KSYM_semicolon, "XK_semicolon", ";" },
+ { KSYM_less, "XK_less", "<" },
+ { KSYM_equal, "XK_equal", "=" },
+ { KSYM_greater, "XK_greater", ">" },
+ { KSYM_question, "XK_question", "?" },
+ { KSYM_at, "XK_at", "@" },
/* more ASCII keys */
- { KEY_bracketleft, "XK_bracketleft", "[" },
- { KEY_backslash, "XK_backslash", "backslash" },
- { KEY_bracketright, "XK_bracketright", "]" },
- { KEY_asciicircum, "XK_asciicircum", "circumflex" },
- { KEY_underscore, "XK_underscore", "_" },
- { KEY_grave, "XK_grave", "grave" },
- { KEY_quoteleft, "XK_quoteleft", "quote left" },
- { KEY_braceleft, "XK_braceleft", "brace left" },
- { KEY_bar, "XK_bar", "bar" },
- { KEY_braceright, "XK_braceright", "brace right" },
- { KEY_asciitilde, "XK_asciitilde", "ascii tilde" },
+ { KSYM_bracketleft, "XK_bracketleft", "[" },
+ { KSYM_backslash, "XK_backslash", "backslash" },
+ { KSYM_bracketright,"XK_bracketright", "]" },
+ { KSYM_asciicircum, "XK_asciicircum", "circumflex" },
+ { KSYM_underscore, "XK_underscore", "_" },
+ { KSYM_grave, "XK_grave", "grave" },
+ { KSYM_quoteleft, "XK_quoteleft", "quote left" },
+ { KSYM_braceleft, "XK_braceleft", "brace left" },
+ { KSYM_bar, "XK_bar", "bar" },
+ { KSYM_braceright, "XK_braceright", "brace right" },
+ { KSYM_asciitilde, "XK_asciitilde", "ascii tilde" },
/* special (non-ASCII) keys */
- { KEY_Adiaeresis, "XK_Adiaeresis", "Ä" },
- { KEY_Odiaeresis, "XK_Odiaeresis", "Ö" },
- { KEY_Udiaeresis, "XK_Udiaeresis", "Ü" },
- { KEY_adiaeresis, "XK_adiaeresis", "ä" },
- { KEY_odiaeresis, "XK_odiaeresis", "ö" },
- { KEY_udiaeresis, "XK_udiaeresis", "ü" },
- { KEY_ssharp, "XK_ssharp", "sharp s" },
+ { KSYM_Adiaeresis, "XK_Adiaeresis", "Ä" },
+ { KSYM_Odiaeresis, "XK_Odiaeresis", "Ö" },
+ { KSYM_Udiaeresis, "XK_Udiaeresis", "Ü" },
+ { KSYM_adiaeresis, "XK_adiaeresis", "ä" },
+ { KSYM_odiaeresis, "XK_odiaeresis", "ö" },
+ { KSYM_udiaeresis, "XK_udiaeresis", "ü" },
+ { KSYM_ssharp, "XK_ssharp", "sharp s" },
/* end-of-array identifier */
{ 0, NULL, NULL }
int i;
- if (mode == TRANSLATE_KEY_TO_KEYNAME)
+ if (mode == TRANSLATE_KEYSYM_TO_KEYNAME)
{
static char name_buffer[30];
Key key = *keysym;
- if (key >= KEY_A && key <= KEY_Z)
- sprintf(name_buffer, "%c", 'A' + (char)(key - KEY_A));
- else if (key >= KEY_a && key <= KEY_z)
- sprintf(name_buffer, "%c", 'a' + (char)(key - KEY_a));
- else if (key >= KEY_0 && key <= KEY_9)
- sprintf(name_buffer, "%c", '0' + (char)(key - KEY_0));
- else if (key >= KEY_KP_0 && key <= KEY_KP_9)
- sprintf(name_buffer, "keypad %c", '0' + (char)(key - KEY_KP_0));
- else if (key >= KEY_F1 && key <= KEY_F24)
- sprintf(name_buffer, "function F%d", (int)(key - KEY_F1 + 1));
- else if (key == KEY_UNDEFINED)
+ if (key >= KSYM_A && key <= KSYM_Z)
+ sprintf(name_buffer, "%c", 'A' + (char)(key - KSYM_A));
+ else if (key >= KSYM_a && key <= KSYM_z)
+ sprintf(name_buffer, "%c", 'a' + (char)(key - KSYM_a));
+ else if (key >= KSYM_0 && key <= KSYM_9)
+ sprintf(name_buffer, "%c", '0' + (char)(key - KSYM_0));
+ else if (key >= KSYM_KP_0 && key <= KSYM_KP_9)
+ sprintf(name_buffer, "keypad %c", '0' + (char)(key - KSYM_KP_0));
+ else if (key >= KSYM_F1 && key <= KSYM_F24)
+ sprintf(name_buffer, "function F%d", (int)(key - KSYM_F1 + 1));
+ else if (key == KSYM_UNDEFINED)
strcpy(name_buffer, "(undefined)");
else
{
*name = name_buffer;
}
- else if (mode == TRANSLATE_KEY_TO_X11KEYNAME)
+ else if (mode == TRANSLATE_KEYSYM_TO_X11KEYNAME)
{
static char name_buffer[30];
Key key = *keysym;
- if (key >= KEY_A && key <= KEY_Z)
- sprintf(name_buffer, "XK_%c", 'A' + (char)(key - KEY_A));
- else if (key >= KEY_a && key <= KEY_z)
- sprintf(name_buffer, "XK_%c", 'a' + (char)(key - KEY_a));
- else if (key >= KEY_0 && key <= KEY_9)
- sprintf(name_buffer, "XK_%c", '0' + (char)(key - KEY_0));
- else if (key >= KEY_KP_0 && key <= KEY_KP_9)
- sprintf(name_buffer, "XK_KP_%c", '0' + (char)(key - KEY_KP_0));
- else if (key >= KEY_F1 && key <= KEY_F24)
- sprintf(name_buffer, "XK_F%d", (int)(key - KEY_F1 + 1));
- else if (key == KEY_UNDEFINED)
+ if (key >= KSYM_A && key <= KSYM_Z)
+ sprintf(name_buffer, "XK_%c", 'A' + (char)(key - KSYM_A));
+ else if (key >= KSYM_a && key <= KSYM_z)
+ sprintf(name_buffer, "XK_%c", 'a' + (char)(key - KSYM_a));
+ else if (key >= KSYM_0 && key <= KSYM_9)
+ sprintf(name_buffer, "XK_%c", '0' + (char)(key - KSYM_0));
+ else if (key >= KSYM_KP_0 && key <= KSYM_KP_9)
+ sprintf(name_buffer, "XK_KP_%c", '0' + (char)(key - KSYM_KP_0));
+ else if (key >= KSYM_F1 && key <= KSYM_F24)
+ sprintf(name_buffer, "XK_F%d", (int)(key - KSYM_F1 + 1));
+ else if (key == KSYM_UNDEFINED)
strcpy(name_buffer, "[undefined]");
else
{
*x11name = name_buffer;
}
- else if (mode == TRANSLATE_X11KEYNAME_TO_KEY)
+ else if (mode == TRANSLATE_X11KEYNAME_TO_KEYSYM)
{
- Key key = KEY_UNDEFINED;
+ Key key = KSYM_UNDEFINED;
char *name_ptr = *x11name;
if (strncmp(name_ptr, "XK_", 3) == 0 && strlen(name_ptr) == 4)
char c = name_ptr[3];
if (c >= 'A' && c <= 'Z')
- key = KEY_A + (Key)(c - 'A');
+ key = KSYM_A + (Key)(c - 'A');
else if (c >= 'a' && c <= 'z')
- key = KEY_a + (Key)(c - 'a');
+ key = KSYM_a + (Key)(c - 'a');
else if (c >= '0' && c <= '9')
- key = KEY_0 + (Key)(c - '0');
+ key = KSYM_0 + (Key)(c - '0');
}
else if (strncmp(name_ptr, "XK_KP_", 6) == 0 && strlen(name_ptr) == 7)
{
char c = name_ptr[6];
if (c >= '0' && c <= '9')
- key = KEY_0 + (Key)(c - '0');
+ key = KSYM_0 + (Key)(c - '0');
}
else if (strncmp(name_ptr, "XK_F", 4) == 0 && strlen(name_ptr) <= 6)
{
d = atoi(&name_ptr[4]);
if (d >=1 && d <= 24)
- key = KEY_F1 + (Key)(d - 1);
+ key = KSYM_F1 + (Key)(d - 1);
}
else if (strncmp(name_ptr, "XK_", 3) == 0)
{
{
char *name;
- translate_keyname(&key, NULL, &name, TRANSLATE_KEY_TO_KEYNAME);
+ translate_keyname(&key, NULL, &name, TRANSLATE_KEYSYM_TO_KEYNAME);
return name;
}
{
char *x11name;
- translate_keyname(&key, &x11name, NULL, TRANSLATE_KEY_TO_X11KEYNAME);
+ translate_keyname(&key, &x11name, NULL, TRANSLATE_KEYSYM_TO_X11KEYNAME);
return x11name;
}
{
Key key;
- translate_keyname(&key, &x11name, NULL, TRANSLATE_X11KEYNAME_TO_KEY);
+ translate_keyname(&key, &x11name, NULL, TRANSLATE_X11KEYNAME_TO_KEYSYM);
return key;
}
* msdos.c *
***********************************************************/
-#ifdef MSDOS
+#include "platform.h"
+
+#if defined(PLATFORM_MSDOS)
#include "main.h"
#include "misc.h"
Error(ERR_WARN, "networking not supported in DOS version");
}
-#endif /* MSDOS */
+#endif /* PLATFORM_MSDOS */
#include <allegro.h>
#include <time.h>
+/* symbol 'window' is defined in DJGPP cross-compiler in libc.a(conio.o) */
+#define window window_djgpp
/* system dependent definitions */
* network.c *
***********************************************************/
-#if !defined(MSDOS) && !defined(WIN32)
+#include "platform.h"
+
+#if defined(PLATFORM_UNIX)
#include <fcntl.h>
#include <sys/time.h>
}
}
-#endif /* !MSDOS && !WIN32 */
+#endif /* PLATFORM_UNIX */
* network.c *
***********************************************************/
-#if !defined(MSDOS) && !defined(WIN32)
+#include "platform.h"
+
+#if defined(PLATFORM_UNIX)
#include <signal.h>
#include <sys/time.h>
}
}
-#endif /* !MSDOS && !WIN32 */
+#endif /* PLATFORM_UNIX */
--- /dev/null
+/***********************************************************
+* Rocks'n'Diamonds -- McDuffin Strikes Back! *
+*----------------------------------------------------------*
+* (c) 1995-98 Artsoft Entertainment *
+* Holger Schemel *
+* Oststrasse 11a *
+* 33604 Bielefeld *
+* phone: ++49 +521 290471 *
+* email: aeglos@valinor.owl.de *
+*----------------------------------------------------------*
+* platform.h *
+***********************************************************/
+
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+#if defined(MSDOS)
+#define PLATFORM_MSDOS
+#elif defined(WIN32)
+#define PLATFORM_WIN32
+#else
+#define PLATFORM_UNIX
+#endif
+
+#endif /* PLATFORM_H */
if (setup.autorecord)
TapeStartRecording();
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
if (options.network)
SendToServer_StartPlaying();
else
return;
}
- if (((key >= KEY_A && key <= KEY_Z) || (key >= KEY_a && key <= KEY_z)) &&
+ if (((key >= KSYM_A && key <= KSYM_Z) ||
+ (key >= KSYM_a && key <= KSYM_z)) &&
xpos < MAX_PLAYER_NAME_LEN)
{
char ascii;
- if (key >= KEY_A && key <= KEY_Z)
- ascii = 'A' + (char)(key - KEY_A);
+ if (key >= KSYM_A && key <= KSYM_Z)
+ ascii = 'A' + (char)(key - KSYM_A);
else
- ascii = 'a' + (char)(key - KEY_a);
+ ascii = 'a' + (char)(key - KSYM_a);
setup.player_name[xpos] = ascii;
setup.player_name[xpos + 1] = 0;
setup.player_name, FS_BIG, FC_YELLOW);
DrawGraphic(xpos + 6, ypos, GFX_KUGEL_ROT);
}
- else if ((key == KEY_Delete || key == KEY_BackSpace) && xpos > 0)
+ else if ((key == KSYM_Delete || key == KSYM_BackSpace) && xpos > 0)
{
xpos--;
setup.player_name[xpos] = 0;
DrawGraphic(xpos + 6, ypos, GFX_KUGEL_ROT);
DrawGraphic(xpos + 7, ypos, GFX_LEERRAUM);
}
- else if (key == KEY_Return && xpos > 0)
+ else if (key == KSYM_Return && xpos > 0)
{
DrawText(SX + 6*32, SY + ypos*32, setup.player_name, FS_BIG, FC_RED);
DrawGraphic(xpos + 6, ypos, GFX_LEERRAUM);
else
x = y = 0; /* no action */
- if (ABS(dy) == SCR_FIELDY) /* handle KEY_Page_Up, KEY_Page_Down */
+ if (ABS(dy) == SCR_FIELDY) /* handle KSYM_Page_Up, KSYM_Page_Down */
{
dy = SIGN(dy);
step = num_page_entries - 1;
return;
}
- if (ABS(dy) == SCR_FIELDY) /* handle KEY_Page_Up, KEY_Page_Down */
+ if (ABS(dy) == SCR_FIELDY) /* handle KSYM_Page_Up, KSYM_Page_Down */
step = MAX_LEVEL_SERIES_ON_SCREEN - 1;
if (dy < 0)
SaveJoystickData();
*/
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
save_joystick_data(JOYSTICK_FILENAME);
#endif
{
Key key = GetEventKey((KeyEvent *)&event, TRUE);
- if (key == KEY_Escape || (key == KEY_Return && step_nr == 6))
+ if (key == KSYM_Escape || (key == KSYM_Return && step_nr == 6))
{
finished = TRUE;
break;
break;
/* press 'Enter' to keep the existing key binding */
- if (key == KEY_Return)
+ if (key == KSYM_Return)
key = *customize_step[step_nr].key;
/* check if key already used */
} joy_ctrl;
#endif
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
int new_joystick_xleft = 128, new_joystick_xright = 128;
int new_joystick_yupper = 128, new_joystick_ylower = 128;
int new_joystick_xmiddle, new_joystick_ymiddle;
ClearWindow();
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
DrawText(SX, SY + 6*32, " ROTATE JOYSTICK ", FS_BIG, FC_YELLOW);
DrawText(SX, SY + 7*32, "IN ALL DIRECTIONS", FS_BIG, FC_YELLOW);
DrawText(SX + 16, SY + 9*32, " IF ALL BALLS ", FS_BIG, FC_YELLOW);
case EVENT_KEYPRESS:
switch(GetEventKey((KeyEvent *)&event, TRUE))
{
- case KEY_Return:
+ case KSYM_Return:
if (check_remaining == 0)
result = 1;
break;
- case KEY_Escape:
+ case KSYM_Escape:
result = 0;
break;
}
}
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
-#ifdef USE_SDL_JOYSTICK
+#if defined(TARGET_SDL)
joy_ctrl.x = Get_SDL_Joystick_Axis(joystick_fd, 0);
joy_ctrl.y = Get_SDL_Joystick_Axis(joystick_fd, 1);
#else
{
result = 1;
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
if (calibration_step == 1)
{
remove_joystick();
if (x != last_x || y != last_y)
{
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
DrawGraphic(xpos + last_x, ypos + last_y, GFX_KUGEL_GELB);
#else
DrawGraphic(xpos + last_x, ypos + last_y, GFX_KUGEL_BLAU);
#define SDL_H
#include "SDL.h"
-
-#if SDL_MAJOR_VERSION >= 1 && SDL_MINOR_VERSION >= 1
#include "SDL_image.h"
#include "SDL_mixer.h"
-#define USE_SDL_JOYSTICK
-#else
-#include "IMG.h"
-#include "mixer.h"
-#endif
/* definitions needed for "system.c" */
#define EVENT_MAPNOTIFY SDL_USEREVENT + 4
#define EVENT_UNMAPNOTIFY SDL_USEREVENT + 5
-#define KEY_UNDEFINED SDLK_UNKNOWN
+#define KSYM_UNDEFINED SDLK_UNKNOWN
-#define KEY_Return SDLK_RETURN
-#define KEY_Escape SDLK_ESCAPE
+#define KSYM_Return SDLK_RETURN
+#define KSYM_Escape SDLK_ESCAPE
-#define KEY_Left SDLK_LEFT
-#define KEY_Right SDLK_RIGHT
-#define KEY_Up SDLK_UP
-#define KEY_Down SDLK_DOWN
+#define KSYM_Left SDLK_LEFT
+#define KSYM_Right SDLK_RIGHT
+#define KSYM_Up SDLK_UP
+#define KSYM_Down SDLK_DOWN
#ifdef SDLK_KP_LEFT
-#define KEY_KP_Left SDLK_KP_LEFT
-#define KEY_KP_Right SDLK_KP_RIGHT
-#define KEY_KP_Up SDLK_KP_UP
-#define KEY_KP_Down SDLK_KP_DOWN
+#define KSYM_KP_Left SDLK_KP_LEFT
+#define KSYM_KP_Right SDLK_KP_RIGHT
+#define KSYM_KP_Up SDLK_KP_UP
+#define KSYM_KP_Down SDLK_KP_DOWN
#endif
-#define KEY_KP_Enter SDLK_KP_ENTER
-#define KEY_KP_Add SDLK_KP_PLUS
-#define KEY_KP_Subtract SDLK_KP_MINUS
-#define KEY_KP_Multiply SDLK_KP_MULTIPLY
-#define KEY_KP_Divide SDLK_KP_DIVIDE
-#define KEY_KP_Separator SDLK_KP_PERIOD
-
-#define KEY_Shift_L SDLK_LSHIFT
-#define KEY_Shift_R SDLK_RSHIFT
-#define KEY_Control_L SDLK_LCTRL
-#define KEY_Control_R SDLK_RCTRL
-#define KEY_Meta_L SDLK_LMETA
-#define KEY_Meta_R SDLK_RMETA
-#define KEY_Alt_L SDLK_LALT
-#define KEY_Alt_R SDLK_RALT
-#define KEY_Super_L SDLK_LSUPER
-#define KEY_Super_R SDLK_RSUPER
-#define KEY_Mode_switch SDLK_MODE
-#define KEY_Multi_key SDLK_RCTRL
-
-#define KEY_BackSpace SDLK_BACKSPACE
-#define KEY_Delete SDLK_DELETE
-#define KEY_Insert SDLK_INSERT
-#define KEY_Tab SDLK_TAB
-#define KEY_Home SDLK_HOME
-#define KEY_End SDLK_END
-#define KEY_Page_Up SDLK_PAGEUP
-#define KEY_Page_Down SDLK_PAGEDOWN
-#define KEY_Menu SDLK_MENU
-
-#define KEY_space SDLK_SPACE
-#define KEY_exclam SDLK_EXCLAIM
-#define KEY_quotedbl SDLK_QUOTEDBL
-#define KEY_numbersign SDLK_HASH
-#define KEY_dollar SDLK_DOLLAR
-#define KEY_percent KEY_UNDEFINED /* undefined */
-#define KEY_ampersand SDLK_AMPERSAND
-#define KEY_apostrophe SDLK_QUOTE
-#define KEY_parenleft SDLK_LEFTPAREN
-#define KEY_parenright SDLK_RIGHTPAREN
-#define KEY_asterisk SDLK_ASTERISK
-#define KEY_plus SDLK_PLUS
-#define KEY_comma SDLK_COMMA
-#define KEY_minus SDLK_MINUS
-#define KEY_period SDLK_PERIOD
-#define KEY_slash SDLK_SLASH
-
-#define KEY_colon SDLK_COLON
-#define KEY_semicolon SDLK_SEMICOLON
-#define KEY_less SDLK_LESS
-#define KEY_equal SDLK_EQUALS
-#define KEY_greater SDLK_GREATER
-#define KEY_question SDLK_QUESTION
-#define KEY_at SDLK_AT
-
-#define KEY_bracketleft SDLK_LEFTBRACKET
-#define KEY_backslash SDLK_BACKSLASH
-#define KEY_bracketright SDLK_RIGHTBRACKET
-#define KEY_asciicircum SDLK_CARET
-#define KEY_underscore SDLK_UNDERSCORE
-#define KEY_grave SDLK_BACKQUOTE
-
-#define KEY_quoteleft KEY_UNDEFINED /* undefined */
-#define KEY_braceleft KEY_UNDEFINED /* undefined */
-#define KEY_bar KEY_UNDEFINED /* undefined */
-#define KEY_braceright KEY_UNDEFINED /* undefined */
-#define KEY_asciitilde KEY_UNDEFINED /* undefined */
-
-#define KEY_Adiaeresis SDLK_WORLD_36
-#define KEY_Odiaeresis SDLK_WORLD_54
-#define KEY_Udiaeresis SDLK_WORLD_60
-#define KEY_adiaeresis SDLK_WORLD_68
-#define KEY_odiaeresis SDLK_WORLD_86
-#define KEY_udiaeresis SDLK_WORLD_92
-#define KEY_ssharp SDLK_WORLD_63
+#define KSYM_KP_Enter SDLK_KP_ENTER
+#define KSYM_KP_Add SDLK_KP_PLUS
+#define KSYM_KP_Subtract SDLK_KP_MINUS
+#define KSYM_KP_Multiply SDLK_KP_MULTIPLY
+#define KSYM_KP_Divide SDLK_KP_DIVIDE
+#define KSYM_KP_Separator SDLK_KP_PERIOD
+
+#define KSYM_Shift_L SDLK_LSHIFT
+#define KSYM_Shift_R SDLK_RSHIFT
+#define KSYM_Control_L SDLK_LCTRL
+#define KSYM_Control_R SDLK_RCTRL
+#define KSYM_Meta_L SDLK_LMETA
+#define KSYM_Meta_R SDLK_RMETA
+#define KSYM_Alt_L SDLK_LALT
+#define KSYM_Alt_R SDLK_RALT
+#define KSYM_Super_L SDLK_LSUPER
+#define KSYM_Super_R SDLK_RSUPER
+#define KSYM_Mode_switch SDLK_MODE
+#define KSYM_Multi_key SDLK_RCTRL
+
+#define KSYM_BackSpace SDLK_BACKSPACE
+#define KSYM_Delete SDLK_DELETE
+#define KSYM_Insert SDLK_INSERT
+#define KSYM_Tab SDLK_TAB
+#define KSYM_Home SDLK_HOME
+#define KSYM_End SDLK_END
+#define KSYM_Page_Up SDLK_PAGEUP
+#define KSYM_Page_Down SDLK_PAGEDOWN
+#define KSYM_Menu SDLK_MENU
+
+#define KSYM_space SDLK_SPACE
+#define KSYM_exclam SDLK_EXCLAIM
+#define KSYM_quotedbl SDLK_QUOTEDBL
+#define KSYM_numbersign SDLK_HASH
+#define KSYM_dollar SDLK_DOLLAR
+#define KSYM_percent KSYM_UNDEFINED /* undefined */
+#define KSYM_ampersand SDLK_AMPERSAND
+#define KSYM_apostrophe SDLK_QUOTE
+#define KSYM_parenleft SDLK_LEFTPAREN
+#define KSYM_parenright SDLK_RIGHTPAREN
+#define KSYM_asterisk SDLK_ASTERISK
+#define KSYM_plus SDLK_PLUS
+#define KSYM_comma SDLK_COMMA
+#define KSYM_minus SDLK_MINUS
+#define KSYM_period SDLK_PERIOD
+#define KSYM_slash SDLK_SLASH
+
+#define KSYM_colon SDLK_COLON
+#define KSYM_semicolon SDLK_SEMICOLON
+#define KSYM_less SDLK_LESS
+#define KSYM_equal SDLK_EQUALS
+#define KSYM_greater SDLK_GREATER
+#define KSYM_question SDLK_QUESTION
+#define KSYM_at SDLK_AT
+
+#define KSYM_bracketleft SDLK_LEFTBRACKET
+#define KSYM_backslash SDLK_BACKSLASH
+#define KSYM_bracketright SDLK_RIGHTBRACKET
+#define KSYM_asciicircum SDLK_CARET
+#define KSYM_underscore SDLK_UNDERSCORE
+#define KSYM_grave SDLK_BACKQUOTE
+
+#define KSYM_quoteleft KSYM_UNDEFINED /* undefined */
+#define KSYM_braceleft KSYM_UNDEFINED /* undefined */
+#define KSYM_bar KSYM_UNDEFINED /* undefined */
+#define KSYM_braceright KSYM_UNDEFINED /* undefined */
+#define KSYM_asciitilde KSYM_UNDEFINED /* undefined */
+
+#define KSYM_Adiaeresis SDLK_WORLD_36
+#define KSYM_Odiaeresis SDLK_WORLD_54
+#define KSYM_Udiaeresis SDLK_WORLD_60
+#define KSYM_adiaeresis SDLK_WORLD_68
+#define KSYM_odiaeresis SDLK_WORLD_86
+#define KSYM_udiaeresis SDLK_WORLD_92
+#define KSYM_ssharp SDLK_WORLD_63
#ifndef SDLK_A
#define SDLK_A 65
#define SDLK_Z 90
#endif
-#define KEY_A SDLK_A
-#define KEY_B SDLK_B
-#define KEY_C SDLK_C
-#define KEY_D SDLK_D
-#define KEY_E SDLK_E
-#define KEY_F SDLK_F
-#define KEY_G SDLK_G
-#define KEY_H SDLK_H
-#define KEY_I SDLK_I
-#define KEY_J SDLK_J
-#define KEY_K SDLK_K
-#define KEY_L SDLK_L
-#define KEY_M SDLK_M
-#define KEY_N SDLK_N
-#define KEY_O SDLK_O
-#define KEY_P SDLK_P
-#define KEY_Q SDLK_Q
-#define KEY_R SDLK_R
-#define KEY_S SDLK_S
-#define KEY_T SDLK_T
-#define KEY_U SDLK_U
-#define KEY_V SDLK_V
-#define KEY_W SDLK_W
-#define KEY_X SDLK_X
-#define KEY_Y SDLK_Y
-#define KEY_Z SDLK_Z
-
-#define KEY_a SDLK_a
-#define KEY_b SDLK_b
-#define KEY_c SDLK_c
-#define KEY_d SDLK_d
-#define KEY_e SDLK_e
-#define KEY_f SDLK_f
-#define KEY_g SDLK_g
-#define KEY_h SDLK_h
-#define KEY_i SDLK_i
-#define KEY_j SDLK_j
-#define KEY_k SDLK_k
-#define KEY_l SDLK_l
-#define KEY_m SDLK_m
-#define KEY_n SDLK_n
-#define KEY_o SDLK_o
-#define KEY_p SDLK_p
-#define KEY_q SDLK_q
-#define KEY_r SDLK_r
-#define KEY_s SDLK_s
-#define KEY_t SDLK_t
-#define KEY_u SDLK_u
-#define KEY_v SDLK_v
-#define KEY_w SDLK_w
-#define KEY_x SDLK_x
-#define KEY_y SDLK_y
-#define KEY_z SDLK_z
-
-#define KEY_0 SDLK_0
-#define KEY_1 SDLK_1
-#define KEY_2 SDLK_2
-#define KEY_3 SDLK_3
-#define KEY_4 SDLK_4
-#define KEY_5 SDLK_5
-#define KEY_6 SDLK_6
-#define KEY_7 SDLK_7
-#define KEY_8 SDLK_8
-#define KEY_9 SDLK_9
-
-#define KEY_KP_0 SDLK_KP0
-#define KEY_KP_1 SDLK_KP1
-#define KEY_KP_2 SDLK_KP2
-#define KEY_KP_3 SDLK_KP3
-#define KEY_KP_4 SDLK_KP4
-#define KEY_KP_5 SDLK_KP5
-#define KEY_KP_6 SDLK_KP6
-#define KEY_KP_7 SDLK_KP7
-#define KEY_KP_8 SDLK_KP8
-#define KEY_KP_9 SDLK_KP9
-
-#define KEY_F1 SDLK_F1
-#define KEY_F2 SDLK_F2
-#define KEY_F3 SDLK_F3
-#define KEY_F4 SDLK_F4
-#define KEY_F5 SDLK_F5
-#define KEY_F6 SDLK_F6
-#define KEY_F7 SDLK_F7
-#define KEY_F8 SDLK_F8
-#define KEY_F9 SDLK_F9
-#define KEY_F10 SDLK_F10
-#define KEY_F11 SDLK_F11
-#define KEY_F12 SDLK_F12
-#define KEY_F13 SDLK_F13
-#define KEY_F14 SDLK_F14
-#define KEY_F15 SDLK_F15
-#define KEY_F16 KEY_UNDEFINED
-#define KEY_F17 KEY_UNDEFINED
-#define KEY_F18 KEY_UNDEFINED
-#define KEY_F19 KEY_UNDEFINED
-#define KEY_F20 KEY_UNDEFINED
-#define KEY_F21 KEY_UNDEFINED
-#define KEY_F22 KEY_UNDEFINED
-#define KEY_F23 KEY_UNDEFINED
-#define KEY_F24 KEY_UNDEFINED
+#define KSYM_A SDLK_A
+#define KSYM_B SDLK_B
+#define KSYM_C SDLK_C
+#define KSYM_D SDLK_D
+#define KSYM_E SDLK_E
+#define KSYM_F SDLK_F
+#define KSYM_G SDLK_G
+#define KSYM_H SDLK_H
+#define KSYM_I SDLK_I
+#define KSYM_J SDLK_J
+#define KSYM_K SDLK_K
+#define KSYM_L SDLK_L
+#define KSYM_M SDLK_M
+#define KSYM_N SDLK_N
+#define KSYM_O SDLK_O
+#define KSYM_P SDLK_P
+#define KSYM_Q SDLK_Q
+#define KSYM_R SDLK_R
+#define KSYM_S SDLK_S
+#define KSYM_T SDLK_T
+#define KSYM_U SDLK_U
+#define KSYM_V SDLK_V
+#define KSYM_W SDLK_W
+#define KSYM_X SDLK_X
+#define KSYM_Y SDLK_Y
+#define KSYM_Z SDLK_Z
+
+#define KSYM_a SDLK_a
+#define KSYM_b SDLK_b
+#define KSYM_c SDLK_c
+#define KSYM_d SDLK_d
+#define KSYM_e SDLK_e
+#define KSYM_f SDLK_f
+#define KSYM_g SDLK_g
+#define KSYM_h SDLK_h
+#define KSYM_i SDLK_i
+#define KSYM_j SDLK_j
+#define KSYM_k SDLK_k
+#define KSYM_l SDLK_l
+#define KSYM_m SDLK_m
+#define KSYM_n SDLK_n
+#define KSYM_o SDLK_o
+#define KSYM_p SDLK_p
+#define KSYM_q SDLK_q
+#define KSYM_r SDLK_r
+#define KSYM_s SDLK_s
+#define KSYM_t SDLK_t
+#define KSYM_u SDLK_u
+#define KSYM_v SDLK_v
+#define KSYM_w SDLK_w
+#define KSYM_x SDLK_x
+#define KSYM_y SDLK_y
+#define KSYM_z SDLK_z
+
+#define KSYM_0 SDLK_0
+#define KSYM_1 SDLK_1
+#define KSYM_2 SDLK_2
+#define KSYM_3 SDLK_3
+#define KSYM_4 SDLK_4
+#define KSYM_5 SDLK_5
+#define KSYM_6 SDLK_6
+#define KSYM_7 SDLK_7
+#define KSYM_8 SDLK_8
+#define KSYM_9 SDLK_9
+
+#define KSYM_KP_0 SDLK_KP0
+#define KSYM_KP_1 SDLK_KP1
+#define KSYM_KP_2 SDLK_KP2
+#define KSYM_KP_3 SDLK_KP3
+#define KSYM_KP_4 SDLK_KP4
+#define KSYM_KP_5 SDLK_KP5
+#define KSYM_KP_6 SDLK_KP6
+#define KSYM_KP_7 SDLK_KP7
+#define KSYM_KP_8 SDLK_KP8
+#define KSYM_KP_9 SDLK_KP9
+
+#define KSYM_F1 SDLK_F1
+#define KSYM_F2 SDLK_F2
+#define KSYM_F3 SDLK_F3
+#define KSYM_F4 SDLK_F4
+#define KSYM_F5 SDLK_F5
+#define KSYM_F6 SDLK_F6
+#define KSYM_F7 SDLK_F7
+#define KSYM_F8 SDLK_F8
+#define KSYM_F9 SDLK_F9
+#define KSYM_F10 SDLK_F10
+#define KSYM_F11 SDLK_F11
+#define KSYM_F12 SDLK_F12
+#define KSYM_F13 SDLK_F13
+#define KSYM_F14 SDLK_F14
+#define KSYM_F15 SDLK_F15
+#define KSYM_F16 KSYM_UNDEFINED
+#define KSYM_F17 KSYM_UNDEFINED
+#define KSYM_F18 KSYM_UNDEFINED
+#define KSYM_F19 KSYM_UNDEFINED
+#define KSYM_F20 KSYM_UNDEFINED
+#define KSYM_F21 KSYM_UNDEFINED
+#define KSYM_F22 KSYM_UNDEFINED
+#define KSYM_F23 KSYM_UNDEFINED
+#define KSYM_F24 KSYM_UNDEFINED
/* SDL function definitions */
-1,0,0, FALSE,FALSE,FALSE,FALSE,FALSE, 0,0L,0L,NULL
};
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
static int stereo_volume[PSND_MAX_LEFT2RIGHT+1];
static char premix_first_buffer[SND_BLOCKSIZE];
#ifdef VOXWARE
static char premix_left_buffer[SND_BLOCKSIZE];
static char premix_right_buffer[SND_BLOCKSIZE];
static int premix_last_buffer[SND_BLOCKSIZE];
-#endif /* VOXWARE */
+#endif
static unsigned char playing_buffer[SND_BLOCKSIZE];
-#endif /* !MSDOS && !WIN32 */
+#endif
/* forward declaration of internal functions */
#ifdef VOXWARE
static void SoundServer_InsertNewSound(struct SoundControl);
-#endif
-
-#if !defined(VOXWARE) && !defined(MSDOS) && !defined(WIN32)
+#else
+#if defined(PLATFORM_UNIX)
static unsigned char linear_to_ulaw(int);
static int ulaw_to_linear(unsigned char);
#endif
+#endif
#ifdef HPUX_AUDIO
static void HPUX_Audio_Control();
#endif
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
static void SoundServer_InsertNewSound(struct SoundControl);
static void SoundServer_StopSound(int);
static void SoundServer_StopAllSounds();
#endif
+#if defined(PLATFORM_UNIX)
int OpenAudio(char *audio_device_name)
{
int audio_fd;
{
return TRUE;
}
+#endif /* PLATFORM_UNIX */
void SoundServer()
{
int i;
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
struct SoundControl snd_ctrl;
fd_set sound_fdset;
playlist[i] = emptySoundControl;
playing_sounds = 0;
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
stereo_volume[PSND_MAX_LEFT2RIGHT] = 0;
for(i=0;i<PSND_MAX_LEFT2RIGHT;i++)
stereo_volume[i] =
}
-#endif /* !MSDOS && !WIN32 */
+#endif /* PLATFORM_UNIX */
}
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
static void sound_handler(struct SoundControl snd_ctrl)
{
int i;
if (snd_ctrl.active)
SoundServer_InsertNewSound(snd_ctrl);
}
-#endif /* MSDOS */
+#endif /* PLATFORM_MSDOS */
-#ifndef WIN32
+#if !defined(PLATFORM_WIN32)
static void SoundServer_InsertNewSound(struct SoundControl snd_ctrl)
{
int i, k;
for(i=0;i<MAX_SOUNDS_PLAYING;i++)
{
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
int actual = 100 * playlist[i].playingpos / playlist[i].data_len;
#else
int actual = playlist[i].playingpos;
longest_nr=i;
}
}
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
voice_set_volume(playlist[longest_nr].voice, 0);
deallocate_voice(playlist[longest_nr].voice);
#endif
{
playlist[i].fade_sound = FALSE;
playlist[i].volume = PSND_MAX_VOLUME;
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
playlist[i].loop = PSND_LOOP;
voice_stop_volumeramp(playlist[i].voice);
voice_ramp_volume(playlist[i].voice, playlist[i].volume, 1000);
if (!playlist[i].active || playlist[i].nr != snd_ctrl.nr)
continue;
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
actual = 100 * playlist[i].playingpos / playlist[i].data_len;
#else
actual = playlist[i].playingpos;
longest_nr=i;
}
}
-#ifdef MSDOS
+
+#if defined(PLATFORM_MSDOS)
voice_set_volume(playlist[longest_nr].voice, 0);
deallocate_voice(playlist[longest_nr].voice);
#endif
{
playlist[i] = snd_ctrl;
playing_sounds++;
-#ifdef MSDOS
+
+#if defined(PLATFORM_MSDOS)
playlist[i].voice = allocate_voice(Sound[snd_ctrl.nr].sample_ptr);
if(snd_ctrl.loop)
voice_set_playmode(playlist[i].voice, PLAYMODE_LOOP);
}
}
}
-#endif /* !WIN32 */
+#endif /* !PLATFORM_WIN32 */
/*
void SoundServer_FadeSound(int nr)
}
*/
-#ifndef WIN32
-#ifdef MSDOS
+#if !defined(PLATFORM_WIN32)
+#if defined(PLATFORM_MSDOS)
static void SoundServer_StopSound(int nr)
{
int i;
for(i=0;i<MAX_SOUNDS_PLAYING;i++)
if (playlist[i].nr == nr)
{
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
voice_set_volume(playlist[i].voice, 0);
deallocate_voice(playlist[i].voice);
#endif
playing_sounds--;
}
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
if (!playing_sounds)
close(sound_device);
#endif
for(i=0;i<MAX_SOUNDS_PLAYING;i++)
{
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
voice_set_volume(playlist[i].voice, 0);
deallocate_voice(playlist[i].voice);
#endif
}
playing_sounds = 0;
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
close(sound_device);
#endif
}
-#endif /* MSDOS */
-#endif /* !WIN32 */
+#endif /* PLATFORM_MSDOS */
+#endif /* !PLATFORM_WIN32 */
#ifdef HPUX_AUDIO
static void HPUX_Audio_Control()
}
#endif /* HPUX_AUDIO */
-#if !defined(VOXWARE) && !defined(MSDOS) && !defined(WIN32)
+#if !defined(VOXWARE) && defined(PLATFORM_UNIX)
/* these two are stolen from "sox"... :) */
return(sample);
}
-#endif /* !VOXWARE && !MSDOS && !WIN32 */
+#endif /* !VOXWARE && PLATFORM_UNIX */
/*** THE STUFF ABOVE IS ONLY USED BY THE SOUND SERVER CHILD PROCESS ***/
{
char filename[256];
char *sound_ext = "wav";
-#ifndef TARGET_SDL
-#ifndef MSDOS
+#if !defined(TARGET_SDL)
+#if !defined(PLATFORM_MSDOS)
byte sound_header_buffer[WAV_HEADER_SIZE];
char chunk[CHUNK_ID_LEN + 1];
int chunk_length, dummy;
options.ro_base_directory, SOUNDS_DIRECTORY,
snd_info->name, sound_ext);
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
snd_info->mix_chunk = Mix_LoadWAV(filename);
if (snd_info->mix_chunk == NULL)
#else /* !TARGET_SDL */
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
if ((file = fopen(filename, "r")) == NULL)
{
for (i=0; i<snd_info->data_len; i++)
snd_info->data_ptr[i] = snd_info->data_ptr[i] ^ 0x80;
-#else /* MSDOS */
+#else /* PLATFORM_MSDOS */
snd_info->sample_ptr = load_sample(filename);
if (!snd_info->sample_ptr)
return FALSE;
}
-#endif /* MSDOS */
+#endif /* PLATFORM_MSDOS */
#endif /* !TARGET_SDL */
return TRUE;
snd_ctrl.data_ptr = Sound[nr].data_ptr;
snd_ctrl.data_len = Sound[nr].data_len;
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
Mix_Volume(-1, SDL_MIX_MAXVOLUME / 4);
Mix_VolumeMusic(SDL_MIX_MAXVOLUME / 4);
Mix_PlayChannel(-1, Sound[nr].mix_chunk, (loop ? -1 : 0));
#else
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
if (write(sound_pipe[1], &snd_ctrl, sizeof(snd_ctrl))<0)
{
Error(ERR_WARN, "cannot pipe to child process - no sounds");
snd_ctrl.stop_sound = TRUE;
}
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
if (SSND_FADING(method))
{
}
#else
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
if (write(sound_pipe[1], &snd_ctrl, sizeof(snd_ctrl))<0)
{
Error(ERR_WARN, "cannot pipe to child process - no sounds");
return;
for(i=0; i<num_sounds; i++)
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
free(Sound[i].data_ptr);
#else
destroy_sample(Sound[i].sample_ptr);
#define HPUX_AUDIO
#endif /* _HPUX_SOURCE */
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
#define MAX_SOUNDS_PLAYING 16
#else
#define MAX_SOUNDS_PLAYING 8
#endif
/* some values for PlaySound(), StopSound() and friends */
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
#define PSND_SILENCE 0
#define PSND_MAX_VOLUME_BITS 7
#define PSND_MIN_VOLUME 0
byte *data_ptr;
long data_len;
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
SAMPLE *sample_ptr;
#endif
-#ifdef TARGET_SDL
+#if defined(TARGET_SDL)
Mix_Chunk *mix_chunk;
#endif
};
long playingpos;
long data_len;
byte *data_ptr;
-#ifdef MSDOS
+
+#if defined(PLATFORM_MSDOS)
int voice;
#endif
};
#ifndef SYSTEM_H
#define SYSTEM_H
-#if defined(MSDOS)
-#define PLATFORM_MSDOS
-#elif defined(WIN32)
-#define PLATFORM_WIN32
-#else
-#define PLATFORM_UNIX
-#endif
+#include "platform.h"
-#if defined(MSDOS)
+#if defined(PLATFORM_MSDOS)
#include "msdos.h"
#endif
inline boolean PendingEvent(void);
inline void NextEvent(Event *event);
inline Key GetEventKey(KeyEvent *, boolean);
+inline boolean CheckCloseWindowEvent(ClientMessageEvent *);
#endif /* SYSTEM_H */
{
TapeStartRecording();
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
if (options.network)
SendToServer_StartPlaying();
else
#include "cartoons.h"
#include "network.h"
-#ifdef MSDOS
+#if defined(PLATFORM_MSDOS)
extern boolean wait_for_vsync;
#endif
int mx, my, ty, result = -1;
unsigned int old_door_state;
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
/* pause network game while waiting for request to answer */
if (options.network &&
game_status == PLAYING &&
case EVENT_KEYPRESS:
switch(GetEventKey((KeyEvent *)&event, TRUE))
{
- case KEY_Return:
+ case KSYM_Return:
result = 1;
break;
- case KEY_Escape:
+ case KSYM_Escape:
result = 0;
break;
RemapAllGadgets();
-#if !defined(MSDOS) && !defined(WIN32)
+#if defined(PLATFORM_UNIX)
/* continue network game after request */
if (options.network &&
game_status == PLAYING &&
* x11.c *
***********************************************************/
-#ifdef TARGET_X11
+#if defined(TARGET_X11)
#include "main.h"
#include "misc.h"
static void X11InitDisplay()
{
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
XVisualInfo vinfo_template, *vinfo;
int num_visuals;
#endif
depth = DefaultDepth(display, screen);
cmap = DefaultColormap(display, screen);
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
/* look for good enough visual */
vinfo_template.screen = screen;
vinfo_template.class = (depth == 8 ? PseudoColor : TrueColor);
printf("Sorry, cannot get appropriate visual.\n");
exit(-1);
}
-#endif /* !MSDOS */
+#endif /* !PLATFORM_MSDOS */
}
static DrawWindow X11InitWindow()
unsigned int border_width = 4;
XGCValues gc_values;
unsigned long gc_valuemask;
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
XTextProperty windowName, iconName;
Pixmap icon_pixmap, iconmask_pixmap;
unsigned int icon_width, icon_height;
unsigned long pen_bg = BlackPixel(display,screen);
const int width = WIN_XSIZE, height = WIN_YSIZE;
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
static struct IconFileInfo icon_pic =
{
"rocks_icon.xbm",
win_xpos, win_ypos, width, height, border_width,
pen_fg, pen_bg);
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
proto_atom = XInternAtom(display, "WM_PROTOCOLS", FALSE);
delete_atom = XInternAtom(display, "WM_DELETE_WINDOW", FALSE);
if ((proto_atom != None) && (delete_atom != None))
#ifndef X11_H
#define X11_H
-#ifndef MSDOS
+#if !defined(PLATFORM_MSDOS)
#define XK_MISCELLANY
#define XK_LATIN1
#include <X11/Xos.h>
#include <X11/Intrinsic.h>
#include <X11/keysymdef.h>
-#endif /* !MSDOS */
+#endif
/* system dependent definitions */
-/* DOS version also defines "TARGET_STRING" */
+/* MS-DOS header file also defines "TARGET_STRING" */
#ifndef TARGET_STRING
#define TARGET_STRING "X11"
#endif
#define EVENT_MAPNOTIFY MapNotify
#define EVENT_UNMAPNOTIFY UnmapNotify
-#define KEY_UNDEFINED XK_VoidSymbol
+#define KSYM_UNDEFINED XK_VoidSymbol
-#define KEY_Return XK_Return
-#define KEY_Escape XK_Escape
+#define KSYM_Return XK_Return
+#define KSYM_Escape XK_Escape
-#define KEY_Left XK_Left
-#define KEY_Right XK_Right
-#define KEY_Up XK_Up
-#define KEY_Down XK_Down
+#define KSYM_Left XK_Left
+#define KSYM_Right XK_Right
+#define KSYM_Up XK_Up
+#define KSYM_Down XK_Down
#ifdef XK_KP_Left
-#define KEY_KP_Left XK_KP_Left
-#define KEY_KP_Right XK_KP_Right
-#define KEY_KP_Up XK_KP_Up
-#define KEY_KP_Down XK_KP_Down
+#define KSYM_KP_Left XK_KP_Left
+#define KSYM_KP_Right XK_KP_Right
+#define KSYM_KP_Up XK_KP_Up
+#define KSYM_KP_Down XK_KP_Down
#endif
#ifdef XK_KP_Enter
-#define KEY_KP_Enter XK_KP_Enter
-#define KEY_KP_Add XK_KP_Add
-#define KEY_KP_Subtract XK_KP_Subtract
-#define KEY_KP_Multiply XK_KP_Multiply
-#define KEY_KP_Divide XK_KP_Divide
-#define KEY_KP_Separator XK_KP_Separator
+#define KSYM_KP_Enter XK_KP_Enter
+#define KSYM_KP_Add XK_KP_Add
+#define KSYM_KP_Subtract XK_KP_Subtract
+#define KSYM_KP_Multiply XK_KP_Multiply
+#define KSYM_KP_Divide XK_KP_Divide
+#define KSYM_KP_Separator XK_KP_Separator
#endif
-#define KEY_Shift_L XK_Shift_L
-#define KEY_Shift_R XK_Shift_R
-#define KEY_Control_L XK_Control_L
-#define KEY_Control_R XK_Control_R
-#define KEY_Meta_L XK_Meta_L
-#define KEY_Meta_R XK_Meta_R
-#define KEY_Alt_L XK_Alt_L
-#define KEY_Alt_R XK_Alt_R
-#define KEY_Super_L XK_Super_L
-#define KEY_Super_R XK_Super_R
-#define KEY_Mode_switch XK_Mode_switch
-#define KEY_Multi_key XK_Multi_key
-
-#define KEY_BackSpace XK_BackSpace
-#define KEY_Delete XK_Delete
-#define KEY_Insert XK_Insert
-#define KEY_Tab XK_Tab
-#define KEY_Home XK_Home
-#define KEY_End XK_End
-#define KEY_Page_Up XK_Page_Up
-#define KEY_Page_Down XK_Page_Down
-#define KEY_Menu XK_Menu
-
-#define KEY_space XK_space
-#define KEY_exclam XK_exclam
-#define KEY_quotedbl XK_quotedbl
-#define KEY_numbersign XK_numbersign
-#define KEY_dollar XK_dollar
-#define KEY_percent XK_percent
-#define KEY_ampersand XK_ampersand
-#define KEY_apostrophe XK_apostrophe
-#define KEY_parenleft XK_parenleft
-#define KEY_parenright XK_parenright
-#define KEY_asterisk XK_asterisk
-#define KEY_plus XK_plus
-#define KEY_comma XK_comma
-#define KEY_minus XK_minus
-#define KEY_period XK_period
-#define KEY_slash XK_slash
-
-#define KEY_colon XK_colon
-#define KEY_semicolon XK_semicolon
-#define KEY_less XK_less
-#define KEY_equal XK_equal
-#define KEY_greater XK_greater
-#define KEY_question XK_question
-#define KEY_at XK_at
-
-#define KEY_bracketleft XK_bracketleft
-#define KEY_backslash XK_backslash
-#define KEY_bracketright XK_bracketright
-#define KEY_asciicircum XK_asciicircum
-#define KEY_underscore XK_underscore
-#define KEY_grave XK_grave
-
-#define KEY_quoteleft XK_quoteleft
-#define KEY_braceleft XK_braceleft
-#define KEY_bar XK_bar
-#define KEY_braceright XK_braceright
-#define KEY_asciitilde XK_asciitilde
-
-#define KEY_Adiaeresis XK_Adiaeresis
-#define KEY_Odiaeresis XK_Odiaeresis
-#define KEY_Udiaeresis XK_Udiaeresis
-#define KEY_adiaeresis XK_adiaeresis
-#define KEY_odiaeresis XK_odiaeresis
-#define KEY_udiaeresis XK_udiaeresis
-#define KEY_ssharp XK_ssharp
-
-#define KEY_A XK_A
-#define KEY_B XK_B
-#define KEY_C XK_C
-#define KEY_D XK_D
-#define KEY_E XK_E
-#define KEY_F XK_F
-#define KEY_G XK_G
-#define KEY_H XK_H
-#define KEY_I XK_I
-#define KEY_J XK_J
-#define KEY_K XK_K
-#define KEY_L XK_L
-#define KEY_M XK_M
-#define KEY_N XK_N
-#define KEY_O XK_O
-#define KEY_P XK_P
-#define KEY_Q XK_Q
-#define KEY_R XK_R
-#define KEY_S XK_S
-#define KEY_T XK_T
-#define KEY_U XK_U
-#define KEY_V XK_V
-#define KEY_W XK_W
-#define KEY_X XK_X
-#define KEY_Y XK_Y
-#define KEY_Z XK_Z
-
-#define KEY_a XK_a
-#define KEY_b XK_b
-#define KEY_c XK_c
-#define KEY_d XK_d
-#define KEY_e XK_e
-#define KEY_f XK_f
-#define KEY_g XK_g
-#define KEY_h XK_h
-#define KEY_i XK_i
-#define KEY_j XK_j
-#define KEY_k XK_k
-#define KEY_l XK_l
-#define KEY_m XK_m
-#define KEY_n XK_n
-#define KEY_o XK_o
-#define KEY_p XK_p
-#define KEY_q XK_q
-#define KEY_r XK_r
-#define KEY_s XK_s
-#define KEY_t XK_t
-#define KEY_u XK_u
-#define KEY_v XK_v
-#define KEY_w XK_w
-#define KEY_x XK_x
-#define KEY_y XK_y
-#define KEY_z XK_z
-
-#define KEY_0 XK_0
-#define KEY_1 XK_1
-#define KEY_2 XK_2
-#define KEY_3 XK_3
-#define KEY_4 XK_4
-#define KEY_5 XK_5
-#define KEY_6 XK_6
-#define KEY_7 XK_7
-#define KEY_8 XK_8
-#define KEY_9 XK_9
-
-#define KEY_KP_0 XK_KP_0
-#define KEY_KP_1 XK_KP_1
-#define KEY_KP_2 XK_KP_2
-#define KEY_KP_3 XK_KP_3
-#define KEY_KP_4 XK_KP_4
-#define KEY_KP_5 XK_KP_5
-#define KEY_KP_6 XK_KP_6
-#define KEY_KP_7 XK_KP_7
-#define KEY_KP_8 XK_KP_8
-#define KEY_KP_9 XK_KP_9
-
-#define KEY_F1 XK_F1
-#define KEY_F2 XK_F2
-#define KEY_F3 XK_F3
-#define KEY_F4 XK_F4
-#define KEY_F5 XK_F5
-#define KEY_F6 XK_F6
-#define KEY_F7 XK_F7
-#define KEY_F8 XK_F8
-#define KEY_F9 XK_F9
-#define KEY_F10 XK_F10
-#define KEY_F11 XK_F11
-#define KEY_F12 XK_F12
-#define KEY_F13 XK_F13
-#define KEY_F14 XK_F14
-#define KEY_F15 XK_F15
-#define KEY_F16 XK_F16
-#define KEY_F17 XK_F17
-#define KEY_F18 XK_F18
-#define KEY_F19 XK_F19
-#define KEY_F20 XK_F20
-#define KEY_F21 XK_F21
-#define KEY_F22 XK_F22
-#define KEY_F23 XK_F23
-#define KEY_F24 XK_F24
+#define KSYM_Shift_L XK_Shift_L
+#define KSYM_Shift_R XK_Shift_R
+#define KSYM_Control_L XK_Control_L
+#define KSYM_Control_R XK_Control_R
+#define KSYM_Meta_L XK_Meta_L
+#define KSYM_Meta_R XK_Meta_R
+#define KSYM_Alt_L XK_Alt_L
+#define KSYM_Alt_R XK_Alt_R
+#define KSYM_Super_L XK_Super_L
+#define KSYM_Super_R XK_Super_R
+#define KSYM_Mode_switch XK_Mode_switch
+#define KSYM_Multi_key XK_Multi_key
+
+#define KSYM_BackSpace XK_BackSpace
+#define KSYM_Delete XK_Delete
+#define KSYM_Insert XK_Insert
+#define KSYM_Tab XK_Tab
+#define KSYM_Home XK_Home
+#define KSYM_End XK_End
+#define KSYM_Page_Up XK_Page_Up
+#define KSYM_Page_Down XK_Page_Down
+#define KSYM_Menu XK_Menu
+
+#define KSYM_space XK_space
+#define KSYM_exclam XK_exclam
+#define KSYM_quotedbl XK_quotedbl
+#define KSYM_numbersign XK_numbersign
+#define KSYM_dollar XK_dollar
+#define KSYM_percent XK_percent
+#define KSYM_ampersand XK_ampersand
+#define KSYM_apostrophe XK_apostrophe
+#define KSYM_parenleft XK_parenleft
+#define KSYM_parenright XK_parenright
+#define KSYM_asterisk XK_asterisk
+#define KSYM_plus XK_plus
+#define KSYM_comma XK_comma
+#define KSYM_minus XK_minus
+#define KSYM_period XK_period
+#define KSYM_slash XK_slash
+
+#define KSYM_colon XK_colon
+#define KSYM_semicolon XK_semicolon
+#define KSYM_less XK_less
+#define KSYM_equal XK_equal
+#define KSYM_greater XK_greater
+#define KSYM_question XK_question
+#define KSYM_at XK_at
+
+#define KSYM_bracketleft XK_bracketleft
+#define KSYM_backslash XK_backslash
+#define KSYM_bracketright XK_bracketright
+#define KSYM_asciicircum XK_asciicircum
+#define KSYM_underscore XK_underscore
+#define KSYM_grave XK_grave
+
+#define KSYM_quoteleft XK_quoteleft
+#define KSYM_braceleft XK_braceleft
+#define KSYM_bar XK_bar
+#define KSYM_braceright XK_braceright
+#define KSYM_asciitilde XK_asciitilde
+
+#define KSYM_Adiaeresis XK_Adiaeresis
+#define KSYM_Odiaeresis XK_Odiaeresis
+#define KSYM_Udiaeresis XK_Udiaeresis
+#define KSYM_adiaeresis XK_adiaeresis
+#define KSYM_odiaeresis XK_odiaeresis
+#define KSYM_udiaeresis XK_udiaeresis
+#define KSYM_ssharp XK_ssharp
+
+#define KSYM_A XK_A
+#define KSYM_B XK_B
+#define KSYM_C XK_C
+#define KSYM_D XK_D
+#define KSYM_E XK_E
+#define KSYM_F XK_F
+#define KSYM_G XK_G
+#define KSYM_H XK_H
+#define KSYM_I XK_I
+#define KSYM_J XK_J
+#define KSYM_K XK_K
+#define KSYM_L XK_L
+#define KSYM_M XK_M
+#define KSYM_N XK_N
+#define KSYM_O XK_O
+#define KSYM_P XK_P
+#define KSYM_Q XK_Q
+#define KSYM_R XK_R
+#define KSYM_S XK_S
+#define KSYM_T XK_T
+#define KSYM_U XK_U
+#define KSYM_V XK_V
+#define KSYM_W XK_W
+#define KSYM_X XK_X
+#define KSYM_Y XK_Y
+#define KSYM_Z XK_Z
+
+#define KSYM_a XK_a
+#define KSYM_b XK_b
+#define KSYM_c XK_c
+#define KSYM_d XK_d
+#define KSYM_e XK_e
+#define KSYM_f XK_f
+#define KSYM_g XK_g
+#define KSYM_h XK_h
+#define KSYM_i XK_i
+#define KSYM_j XK_j
+#define KSYM_k XK_k
+#define KSYM_l XK_l
+#define KSYM_m XK_m
+#define KSYM_n XK_n
+#define KSYM_o XK_o
+#define KSYM_p XK_p
+#define KSYM_q XK_q
+#define KSYM_r XK_r
+#define KSYM_s XK_s
+#define KSYM_t XK_t
+#define KSYM_u XK_u
+#define KSYM_v XK_v
+#define KSYM_w XK_w
+#define KSYM_x XK_x
+#define KSYM_y XK_y
+#define KSYM_z XK_z
+
+#define KSYM_0 XK_0
+#define KSYM_1 XK_1
+#define KSYM_2 XK_2
+#define KSYM_3 XK_3
+#define KSYM_4 XK_4
+#define KSYM_5 XK_5
+#define KSYM_6 XK_6
+#define KSYM_7 XK_7
+#define KSYM_8 XK_8
+#define KSYM_9 XK_9
+
+#define KSYM_KP_0 XK_KP_0
+#define KSYM_KP_1 XK_KP_1
+#define KSYM_KP_2 XK_KP_2
+#define KSYM_KP_3 XK_KP_3
+#define KSYM_KP_4 XK_KP_4
+#define KSYM_KP_5 XK_KP_5
+#define KSYM_KP_6 XK_KP_6
+#define KSYM_KP_7 XK_KP_7
+#define KSYM_KP_8 XK_KP_8
+#define KSYM_KP_9 XK_KP_9
+
+#define KSYM_F1 XK_F1
+#define KSYM_F2 XK_F2
+#define KSYM_F3 XK_F3
+#define KSYM_F4 XK_F4
+#define KSYM_F5 XK_F5
+#define KSYM_F6 XK_F6
+#define KSYM_F7 XK_F7
+#define KSYM_F8 XK_F8
+#define KSYM_F9 XK_F9
+#define KSYM_F10 XK_F10
+#define KSYM_F11 XK_F11
+#define KSYM_F12 XK_F12
+#define KSYM_F13 XK_F13
+#define KSYM_F14 XK_F14
+#define KSYM_F15 XK_F15
+#define KSYM_F16 XK_F16
+#define KSYM_F17 XK_F17
+#define KSYM_F18 XK_F18
+#define KSYM_F19 XK_F19
+#define KSYM_F20 XK_F20
+#define KSYM_F21 XK_F21
+#define KSYM_F22 XK_F22
+#define KSYM_F23 XK_F23
+#define KSYM_F24 XK_F24
/* X11 function definitions */