#=============================================================================#
-# Makefile for Rocks'n'Diamonds 1.4.0 #
-# (c) 1995-1999 Holger Schemel, aeglos@valinor.owl.de #
+# Makefile for Rocks'n'Diamonds #
+# (c) 1995-2000 Holger Schemel, info@artsoft.org #
#=============================================================================#
#-----------------------------------------------------------------------------#
# specify your favorite ANSI C compiler
CC = gcc
-# explicitely choose your platform, if defaults doesn't work right
-# needed for SUN/Solaris; Linux and DOS work fine with auto detection
-# PLATFORM = solaris
-# PLATFORM = unix
-# PLATFORM = dos
-# PLATFORM = windows
-
# specify path to X11 on your system
# if undefined, use system defaults (works with Linux/gcc/libc5)
X11_PATH = /usr/X11
# when installing the game in a single user environment, choose this
# SCORE_ENTRIES = MANY_PER_NAME
-# specify path for cross-compiling (only needed for Windows build)
+# specify path for cross-compiling (only needed for Win32 build)
CROSS_PATH=/usr/local/cross-tools/i386-mingw32/bin
#-----------------------------------------------------------------------------#
sdl:
@$(MAKE_CMD) TARGET=sdl
-sdl_old:
- @$(MAKE_CMD) TARGET=sdl USE_SDL_OLD_LIBS=true
-
solaris:
@$(MAKE_CMD) PLATFORM=solaris
-windows:
- @PATH=$(CROSS_PATH):${PATH} $(MAKE_CMD) PLATFORM=windows
+msdos:
+ @$(MAKE_CMD) PLATFORM=msdos
+
+win32:
+ @PATH=$(CROSS_PATH):${PATH} $(MAKE_CMD) PLATFORM=win32
clean:
@$(MAKE_CMD) clean
dist-unix:
./Scripts/make_dist.sh unix .
-dist-dos:
+dist-msdos:
./Scripts/make_dist.sh dos .
-dist: dist-unix dist-dos
+dist: dist-unix dist-msdos
depend dep:
$(MAKE_CMD) depend
#=============================================================================#
-# Makefile for Rocks'n'Diamonds 1.4.0 #
-# (c) 1995-1999 Holger Schemel, aeglos@valinor.owl.de #
+# Makefile for Rocks'n'Diamonds #
+# (c) 1995-2000 Holger Schemel, info@artsoft.org #
#=============================================================================#
ifndef PLATFORM # platform not specified -- try auto detection
ifdef COMSPEC
-PLATFORM = dos
+PLATFORM = msdos
else
PLATFORM = unix
endif
endif
-ifeq ($(PLATFORM),dos) # DOS / Windows
+ifeq ($(PLATFORM),msdos) # MS-DOS native compiling
RM = del
PROGNAME = ../rocks.exe
-LIBS = -s -lm -lalleg
-else # Unix
+SYS_CFLAGS = -DTARGET_X11
+SYS_LDFLAGS = -s -lalleg -lm
+
+else # Unix; Win32 cross-compiling
RM = rm -f
PROGNAME = ../rocksndiamonds
ifeq ($(PLATFORM),solaris)
-EXTRA_LIBS = -lnsl -lsocket -R$(XLIB_PATH)
+EXTRA_LDFLAGS = -lnsl -lsocket -R$(XLIB_PATH)
endif
-ifeq ($(PLATFORM),windows)
+ifeq ($(PLATFORM),win32)
PROGNAME = ../rocksndiamonds.exe
TARGET = sdl
else
endif
ifeq ($(TARGET),sdl)
-USE_SDL = true
-else
-USE_SDL = false
-endif
-
-ifeq ($(USE_SDL_OLD_LIBS),true)
-SDL_EXTRA_LIBS = -lIMG -lmixer
+SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags)
+SYS_LDFLAGS = -lSDL_image -lSDL_mixer $(shell sdl-config --libs) -lm
else
-SDL_EXTRA_LIBS = -lSDL_image -lSDL_mixer
+SYS_CFLAGS = -DTARGET_X11 $(X11_INCL)
+SYS_LDFLAGS = $(X11_LIBS) -lX11 -lm
endif
-SDL_CFLAGS := -DUSE_SDL_LIBRARY $(shell sdl-config --cflags)
-SDL_LDFLAGS := $(SDL_EXTRA_LIBS) $(shell sdl-config --libs)
-
-X11_CFLAGS = -DUSE_X11_LIBRARY $(X11_INCL)
-X11_LDFLAGS = $(X11_LIBS) -lX11
-
-ifeq ($(USE_SDL),true)
-SYS_CFLAGS = $(SDL_CFLAGS)
-SYS_LDFLAGS = $(SDL_LDFLAGS)
-else
-SYS_CFLAGS = $(X11_CFLAGS)
-SYS_LDFLAGS = $(X11_LDFLAGS)
-endif
-
-INCL = $(SYS_CFLAGS)
-LIBS = $(SYS_LDFLAGS) $(EXTRA_LIBS) -lm
-
-endif # (PLATFORM != dos)
+endif # (PLATFORM != msdos)
ifdef RO_GAME_DIR # path to read-only game data specified
# OPTIONS = -O3 -Wall
# OPTIONS = -O3
-# SYSTEM = -DSYSV -Ae # may be needed for HP-UX
-
-CFLAGS = $(OPTIONS) $(SYSTEM) $(SYS_CFLAGS) $(CONFIG)
+CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(CONFIG)
+LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS)
SRCS = main.c \
init.c \
all: $(PROGNAME)
$(PROGNAME): $(OBJS)
- $(CC) $(PROFILING) $(OBJS) $(LIBS) -o $(PROGNAME)
+ $(CC) $(PROFILING) $(OBJS) $(LDFLAGS) -o $(PROGNAME)
.c.o:
$(CC) $(PROFILING) $(CFLAGS) -c $*.c
void HandleExposeEvent(ExposeEvent *event)
{
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
int x = event->x, y = event->y;
int width = event->width, height = event->height;
void HandleClientMessageEvent(ClientMessageEvent *event)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
CloseAllAndExit(0); /* the only possible message here is SDL_QUIT */
#else
#ifndef MSDOS
* image.c *
***********************************************************/
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
#include "image.h"
#include "pcx.h"
}
#endif /* !MSDOS */
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
#ifndef IMAGE_H
#define IMAGE_H
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
#include "main.h"
void freeImage(Image *);
void freeXImage(Image *, XImageInfo *);
-#endif /* !USE_SDL_LIBRARY */
-
+#endif /* !TARGET_SDL */
#endif /* IMAGE_H */
boolean picture_with_mask;
};
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
static int sound_process_id = 0;
#endif
if (sound_status == SOUND_OFF)
return;
-#ifdef USE_SDL_LIBRARY
- /* initialize SDL audio */
-
- if (SDL_Init(SDL_INIT_AUDIO) < 0)
+#ifdef TARGET_SDL
+ if (InitAudio())
{
- Error(ERR_WARN, "SDL_Init() failed: %s", SDL_GetError());
- sound_status = SOUND_OFF;
- return;
+ sound_status = SOUND_AVAILABLE;
+ sound_loops_allowed = TRUE;
}
-
- if (Mix_OpenAudio(22050, AUDIO_S16, 2, 512) < 0)
+ else
{
- Error(ERR_WARN, "Mix_OpenAudio() failed: %s", SDL_GetError());
sound_status = SOUND_OFF;
- return;
}
-
- Mix_Volume(-1, SDL_MIX_MAXVOLUME / 4);
- Mix_VolumeMusic(SDL_MIX_MAXVOLUME / 4);
-
- sound_status = SOUND_AVAILABLE;
- sound_loops_allowed = TRUE;
-
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
#if !defined(MSDOS) && !defined(WIN32)
- if (access(sound_device_name, W_OK) != 0)
- {
- Error(ERR_WARN, "cannot access sound device - no sounds");
- sound_status = SOUND_OFF;
+ if ((sound_status = CheckAudio(sound_device_name)) == SOUND_OFF)
return;
- }
-
- if ((sound_device = OpenAudio(sound_device_name)) < 0)
- {
- Error(ERR_WARN, "cannot open sound device - no sounds");
- sound_status = SOUND_OFF;
- return;
- }
-
- close(sound_device);
- sound_status = SOUND_AVAILABLE;
#ifdef VOXWARE
sound_loops_allowed = TRUE;
-
- /*
- setup.sound_loops_on = TRUE;
- */
-
#endif
+
#else /* MSDOS || WIN32 */
sound_loops_allowed = TRUE;
- /*
- setup.sound_loops_on = TRUE;
- */
-
#endif /* MSDOS || WIN32 */
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
for(i=0; i<NUM_SOUNDS; i++)
{
return;
}
}
-
-#if 0
- sound_status = SOUND_OFF;
-#endif
-
}
void InitSoundServer()
if (sound_status == SOUND_OFF)
return;
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
#if !defined(MSDOS) && !defined(WIN32)
#endif /* MSDOS */
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
void InitJoysticks()
}
#endif
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
void InitGfx()
{
int i, j;
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDL_Surface *sdl_image_tmp;
#else
GC copy_clipmask_gc;
/* create additional image buffers for masking of graphics */
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
/* initialize surface array to 'NULL' */
for(i=0; i<NUM_TILES; i++)
}
}
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
/* create graphic context structures needed for clipping */
clip_gc_values.graphics_exposures = False;
}
}
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
void InitGfxBackground()
char basefilename[256];
char filename[256];
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDL_Surface *sdl_image_tmp;
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
int pcx_err;
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
char *picture_ext = ".pcx";
/* Grafik laden */
rest(100);
#endif /* MSDOS */
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
/* load image to temporary surface */
if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
/* free temporary surface */
SDL_FreeSurface(sdl_image_tmp);
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
pcx_err = Read_PCX_to_Pixmap(display, window, gc, filename,
&pix[pos], &clipmask[pos]);
use pix_masked[], although they are the same when not using SDL */
pix_masked[pos] = pix[pos];
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
/* zugehörige Maske laden (wenn vorhanden) */
if (pic->picture_with_mask && !clipmask[pos])
Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
void InitGadgets()
{
int i;
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
StopSounds();
FreeSounds(NUM_SOUNDS);
#else
if (pix[i])
FreeBitmap(pix[i]);
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
FreeBitmap(pix_masked[i]);
#else
if (clipmask[i])
#endif
}
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
KeyboardAutoRepeatOn();
#else
if (gc)
/* get these values from the program 'js' from the joystick package, */
/* set JOYSTICK_PERCENT to a threshold appropriate for your joystick */
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
#define JOYSTICK_XLEFT -32767
#define JOYSTICK_XMIDDLE 0
#define JOYSTICK_XRIGHT 32767
/* maximal allowed length of a command line option */
#define MAX_OPTION_LEN 256
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
static unsigned long mainCounter(int mode)
{
return counter_ms; /* return milliseconds since last init */
}
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
#ifndef MSDOS
static unsigned long mainCounter(int mode)
}
#endif /* !MSDOS */
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
void InitCounter() /* set counter back to zero */
{
}
else
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDL_Delay(milliseconds_delay);
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
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 /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
}
unsigned int SimpleRND(unsigned int max)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
static unsigned long root = 654321;
unsigned long current_ms;
root = root * 4253261 + current_ms;
return (root % max);
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
static unsigned long root = 654321;
struct timeval current_time;
root = root * 4253261 + current_time.tv_sec + current_time.tv_usec;
return (root % max);
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
#ifdef DEBUG
unsigned int InitRND(long seed)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
unsigned long current_ms;
if (seed == NEW_RANDOMIZE)
srandom_linux_libc((unsigned int) seed);
return (unsigned int) seed;
}
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
struct timeval current_time;
if (seed == NEW_RANDOMIZE)
srandom_linux_libc((unsigned int) seed);
return (unsigned int) seed;
}
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
}
char *getLoginName()
* pcx.c *
***********************************************************/
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
#include "pcx.h"
#include "image.h"
return image;
}
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
#ifndef PCX_H
#define PCX_H
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
#include "main.h"
#include "image.h"
Image *Read_PCX_to_Image(char *);
-#endif /* !USE_SDL_LIBRARY */
-
+#endif /* !TARGET_SDL */
#endif /* PCX_H */
/* needed if last screen was the setup screen and fullscreen state changed */
ChangeVideoModeIfNeeded();
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SetDrawtoField(DRAW_BACKBUFFER);
#endif
* sdl.c *
***********************************************************/
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
#include "main.h"
#include "misc.h"
SDL_MapRGB(surface->format, color_r, color_g, color_b));
}
-#endif /* USE_SDL_LIBRARY */
+inline boolean SDLInitAudio(void)
+{
+ if (SDL_Init(SDL_INIT_AUDIO) < 0)
+ {
+ Error(ERR_WARN, "SDL_Init() failed: %s", SDL_GetError());
+ return FALSE;
+ }
+
+ if (Mix_OpenAudio(22050, AUDIO_S16, 2, 512) < 0)
+ {
+ Error(ERR_WARN, "Mix_OpenAudio() failed: %s", SDL_GetError());
+ return FALSE;
+ }
+
+ Mix_Volume(-1, SDL_MIX_MAXVOLUME / 4);
+ Mix_VolumeMusic(SDL_MIX_MAXVOLUME / 4);
+
+ return TRUE;
+}
+
+#endif /* TARGET_SDL */
inline void SDLFillRectangle(SDL_Surface *, int, int, int, int, unsigned int);
inline void SDLDrawSimpleLine(SDL_Surface *, int, int, int, int, unsigned int);
+inline boolean SDLInitAudio(void);
+
#endif /* SDL_H */
return audio_fd;
}
+int CheckAudio(char *audio_device_name)
+{
+ int audio_fd;
+
+ if (access(audio_device_name, W_OK) != 0)
+ {
+ Error(ERR_WARN, "cannot access audio device - no sound");
+ return SOUND_OFF;
+ }
+
+ if ((audio_fd = OpenAudio(sound_device_name)) < 0)
+ {
+ Error(ERR_WARN, "cannot open audio device - no sound");
+ return SOUND_OFF;
+ }
+
+ close(audio_fd);
+
+ return SOUND_AVAILABLE;
+}
+
+boolean UnixInitAudio(void)
+{
+ return TRUE;
+}
+
void SoundServer()
{
int i;
{
char filename[256];
char *sound_ext = "wav";
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
#ifndef MSDOS
byte sound_header_buffer[WAV_HEADER_SIZE];
char chunk[CHUNK_ID_LEN + 1];
options.ro_base_directory, SOUNDS_DIRECTORY,
snd_info->name, sound_ext);
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
snd_info->mix_chunk = Mix_LoadWAV(filename);
if (snd_info->mix_chunk == NULL)
return FALSE;
}
-#else /* !USE_SDL_LIBRARY */
+#else /* !TARGET_SDL */
#ifndef MSDOS
}
#endif /* MSDOS */
-#endif /* !USE_SDL_LIBRARY */
+#endif /* !TARGET_SDL */
return TRUE;
}
snd_ctrl.data_ptr = Sound[nr].data_ptr;
snd_ctrl.data_len = Sound[nr].data_len;
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
Mix_Volume(-1, SDL_MIX_MAXVOLUME / 4);
Mix_VolumeMusic(SDL_MIX_MAXVOLUME / 4);
snd_ctrl.stop_sound = TRUE;
}
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
if (SSND_FADING(method))
{
SAMPLE *sample_ptr;
#endif
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
Mix_Chunk *mix_chunk;
#endif
};
#endif
};
-/* start sound server */
+/* general sound functions */
int OpenAudio(char *);
+int CheckAudio(char *);
+boolean UnixInitAudio(void);
+
+/* sound server functions */
void SoundServer(void);
-/* client functions */
+/* sound client functions */
boolean LoadSound(struct SoundInfo *);
void PlaySound(int);
void PlaySoundStereo(int, int);
inline void InitEventFilter(EventFilter filter_function)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
/* set event filter to filter out certain events */
SDL_SetEventFilter(filter_function);
#endif
inline void InitBufferedDisplay(DrawBuffer *backbuffer, DrawWindow *window)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDLInitBufferedDisplay(backbuffer, window);
#else
X11InitBufferedDisplay(backbuffer, window);
inline int GetDisplayDepth(void)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
return SDL_GetVideoSurface()->format->BitsPerPixel;
#else
return XDefaultDepth(display, screen);
{
int real_depth = (depth == DEFAULT_DEPTH ? GetDisplayDepth() : depth);
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDL_Surface *surface_tmp, *surface_native;
if ((surface_tmp = SDL_CreateRGBSurface(SURFACE_FLAGS, width, height,
inline void FreeBitmap(Bitmap bitmap)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDL_FreeSurface(bitmap);
#else
XFreePixmap(display, bitmap);
inline void ClearRectangle(Bitmap bitmap, int x, int y, int width, int height)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDLFillRectangle(bitmap, x, y, width, height, 0x000000);
#else
XFillRectangle(display, bitmap, gc, x, y, width, height);
int width, int height,
int dst_x, int dst_y)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDLCopyArea(src_bitmap, dst_bitmap,
src_x, src_y, width, height, dst_x, dst_y);
#else
#endif
}
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
static GC last_clip_gc = 0; /* needed for XCopyArea() through clip mask */
#endif
inline void SetClipMask(GC clip_gc, Pixmap clip_pixmap)
{
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
XSetClipMask(display, clip_gc, clip_pixmap);
last_clip_gc = clip_gc;
#endif
inline void SetClipOrigin(GC clip_gc, int clip_x, int clip_y)
{
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
XSetClipOrigin(display, clip_gc, clip_x, clip_y);
last_clip_gc = clip_gc;
#endif
int width, int height,
int dst_x, int dst_y)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDLCopyArea(src_bitmap, dst_bitmap,
src_x, src_y, width, height, dst_x, dst_y);
#else
inline void DrawSimpleWhiteLine(Bitmap bitmap, int from_x, int from_y,
int to_x, int to_y)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDLDrawSimpleLine(bitmap, from_x, from_y, to_x, to_y, 0xffffff);
#else
XSetForeground(display, gc, WhitePixel(display, screen));
/* execute all pending screen drawing operations */
inline void FlushDisplay(void)
{
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
XFlush(display);
#endif
}
/* execute and wait for all pending screen drawing operations */
inline void SyncDisplay(void)
{
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
XSync(display, FALSE);
#endif
}
inline void KeyboardAutoRepeatOn(void)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY / 2,
SDL_DEFAULT_REPEAT_INTERVAL / 2);
SDL_EnableUNICODE(1);
inline void KeyboardAutoRepeatOff(void)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDL_EnableKeyRepeat(0, SDL_DEFAULT_REPEAT_INTERVAL);
SDL_EnableUNICODE(0);
#else
inline boolean PointerInWindow(DrawWindow window)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
return TRUE;
#else
DrawWindow root, child;
inline boolean PendingEvent(void)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
return (SDL_PollEvent(NULL) ? TRUE : FALSE);
#else
return (XPending(display) ? TRUE : FALSE);
inline void NextEvent(Event *event)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
SDL_WaitEvent(event);
#else
XNextEvent(display, event);
inline Key GetEventKey(KeyEvent *event, boolean with_modifiers)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
#if 0
printf("unicode == '%d', sym == '%d', mod == '0x%04x'\n",
(int)event->keysym.unicode,
inline boolean SetVideoMode(void)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
return SDLSetVideoMode(&backbuffer);
#else
boolean success = TRUE;
inline void ChangeVideoModeIfNeeded(void)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
if ((setup.fullscreen && !fullscreen_enabled && fullscreen_available) ||
(!setup.fullscreen && fullscreen_enabled))
SetVideoMode();
#endif
}
+inline boolean InitAudio(void)
+{
+#ifdef TARGET_SDL
+ return SDLInitAudio();
+#else
+ return TRUE;
+#endif
+}
+
inline void dummy(void)
{
-#ifdef USE_SDL_LIBRARY
+#ifdef TARGET_SDL
#else
#endif
}
#ifndef SYSTEM_H
#define SYSTEM_H
+#if defined(MSDOS)
+#define PLATFORM_MSDOS
+#elif defined(WIN32)
+#define PLATFORM_WIN32
+#else
+#define PLATFORM_UNIX
+#endif
+
#if defined(MSDOS)
#include "msdos.h"
#endif
-#if defined(USE_SDL_LIBRARY)
+#if defined(TARGET_SDL)
#include "sdl.h"
-#elif defined(USE_X11_LIBRARY)
+#elif defined(TARGET_X11)
#include "x11.h"
#endif
inline boolean SetVideoMode(void);
inline void ChangeVideoModeIfNeeded(void);
+inline boolean InitAudio(void);
+
#endif /* SYSTEM_H */
else
{
#if DEBUG
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
printf("DrawGraphicThruMask(): tile '%d' needs clipping!\n", tile);
#endif
#endif
else
{
#if DEBUG
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
printf("DrawGraphicShifted(): tile '%d' needs clipping!\n", tile);
#endif
#endif
redraw_mask |= REDRAW_ALL;
}
-#ifndef USE_SDL_LIBRARY
+#ifndef TARGET_SDL
int ReadPixel(DrawBuffer d, int x, int y)
{
XImage *pixel_image;
* x11.c *
***********************************************************/
-#ifdef USE_X11_LIBRARY
+#ifdef TARGET_X11
#include "main.h"
#include "misc.h"
pix[PIX_DB_BACK] = *backbuffer; /* 'backbuffer' is off-screen buffer */
}
-#endif /* USE_X11_LIBRARY */
+#endif /* TARGET_X11 */