/***********************************************************
* Rocks'n'Diamonds -- McDuffin Strikes Back! *
*----------------------------------------------------------*
-* ©1995 Artsoft Development *
-* Holger Schemel *
-* 33659 Bielefeld-Senne *
-* Telefon: (0521) 493245 *
-* eMail: aeglos@valinor.owl.de *
-* aeglos@uni-paderborn.de *
-* q99492@pbhrzx.uni-paderborn.de *
+* (c) 1995-98 Artsoft Entertainment *
+* Holger Schemel *
+* Oststrasse 11a *
+* 33604 Bielefeld *
+* phone: ++49 +521 290471 *
+* email: aeglos@valinor.owl.de *
*----------------------------------------------------------*
* init.c *
***********************************************************/
+#include <signal.h>
+
#include "init.h"
+#include "events.h"
#include "misc.h"
#include "sound.h"
#include "screens.h"
+#include "editor.h"
+#include "game.h"
+#include "tape.h"
#include "tools.h"
#include "files.h"
#include "joystick.h"
-#include "gfxload.h"
-#include "gifload.h"
-
-#include <signal.h>
-
-#ifdef DEBUG
-/*
-#define DEBUG_TIMING
-*/
-#endif
+#include "image.h"
+#include "pcx.h"
+#include "network.h"
+#include "netserv.h"
struct PictureFileInfo
{
char *picture_filename;
- BOOL picture_with_mask;
+ boolean picture_with_mask;
};
struct IconFileInfo
char *picturemask_filename;
};
+#ifndef USE_SDL_LIBRARY
static int sound_process_id = 0;
+#endif
static void InitLevelAndPlayerInfo(void);
-static void InitDisplay(int, char **);
+static void InitNetworkServer(void);
+static void InitDisplay(void);
static void InitSound(void);
-static void InitSoundProcess(void);
+static void InitSoundServer(void);
static void InitWindow(int, char **);
static void InitGfx(void);
static void LoadGfx(int, struct PictureFileInfo *);
+static void InitGadgets(void);
static void InitElementProperties(void);
void OpenAll(int argc, char *argv[])
{
- InitLevelAndPlayerInfo();
+#if defined(MSDOS) || defined(WIN32)
+ initErrorFile();
+#endif
+
+ if (options.serveronly)
+ {
+#ifdef WIN32
+ Error(ERR_WARN, "networking not supported in Windows version");
+#else
+ NetworkServer(options.server_port, options.serveronly);
+#endif
+
+ /* never reached */
+ exit(0);
+ }
InitCounter();
InitSound();
- InitSoundProcess();
- InitJoystick();
+ InitSoundServer();
+ InitJoysticks();
InitRND(NEW_RANDOMIZE);
- signal(SIGINT, CloseAll);
- signal(SIGTERM, CloseAll);
+ signal(SIGINT, CloseAllAndExit);
+ signal(SIGTERM, CloseAllAndExit);
- InitDisplay(argc, argv);
+ InitDisplay();
InitWindow(argc, argv);
+#ifndef USE_SDL_LIBRARY
XMapWindow(display, window);
- XFlush(display);
+ FlushDisplay();
+#endif
InitGfx();
- InitElementProperties();
+ InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
+
+ InitLevelAndPlayerInfo();
+ InitGadgets(); /* needs to know number of level series */
DrawMainMenu();
+
+ InitNetworkServer();
}
void InitLevelAndPlayerInfo()
{
- player = local_player = &stored_player[0];
+ int i;
- if (!LoadLevelInfo()) /* global level info */
- CloseAll();
+ /* choose default local player */
+ local_player = &stored_player[0];
- LoadPlayerInfo(PLAYER_SETUP); /* global setup info */
- LoadPlayerInfo(PLAYER_LEVEL); /* level specific info */
+ for (i=0; i<MAX_PLAYERS; i++)
+ {
+ stored_player[i].joystick_fd = -1; /* joystick device closed */
+ stored_player[i].connected = FALSE;
+ }
+
+ local_player->connected = TRUE;
+
+ LoadLevelInfo(); /* global level info */
+ LoadSetup(); /* global setup info */
+ LoadLevelSetup_LastSeries(); /* last played series info */
+ LoadLevelSetup_SeriesInfo(); /* last played level info */
+}
+
+void InitNetworkServer()
+{
+#if !defined(MSDOS) && !defined(WIN32)
+ int nr_wanted;
+#endif
+
+ if (!options.network)
+ return;
+
+#if !defined(MSDOS) && !defined(WIN32)
+ nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED);
+
+ if (!ConnectToServer(options.server_host, options.server_port))
+ Error(ERR_EXIT, "cannot connect to network game server");
+
+ SendToServer_PlayerName(setup.player_name);
+ SendToServer_ProtocolVersion();
+
+ if (nr_wanted)
+ SendToServer_NrWanted(nr_wanted);
+#endif
}
void InitSound()
{
int i;
- if (sound_status==SOUND_OFF)
+ if (sound_status == SOUND_OFF)
return;
-#ifndef MSDOS
- if (access(sound_device_name,W_OK)<0)
+#ifdef USE_SDL_LIBRARY
+ /* initialize SDL audio */
+
+ if (SDL_Init(SDL_INIT_AUDIO) < 0)
{
- fprintf(stderr,"%s: cannot access sound device - no sounds\n",progname);
- sound_status=SOUND_OFF;
+ Error(ERR_WARN, "SDL_Init() failed: %s\n", SDL_GetError());
+ sound_status = SOUND_OFF;
return;
}
- if ((sound_device=open(sound_device_name,O_WRONLY))<0)
+ if (Mix_OpenAudio(22050, AUDIO_S16, 2, 256) < 0)
{
- fprintf(stderr,"%s: cannot open sound device - no sounds\n",progname);
- sound_status=SOUND_OFF;
+ Error(ERR_WARN, "Mix_OpenAudio() failed: %s\n", 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 */
+
+#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;
+ return;
+ }
+
+ if ((sound_device = open(sound_device_name,O_WRONLY))<0)
+ {
+ Error(ERR_WARN, "cannot open sound device - no sounds");
+ sound_status = SOUND_OFF;
return;
}
close(sound_device);
- sound_status=SOUND_AVAILABLE;
+ sound_status = SOUND_AVAILABLE;
#ifdef VOXWARE
sound_loops_allowed = TRUE;
- sound_loops_on = TRUE;
+
+ /*
+ setup.sound_loops_on = TRUE;
+ */
+
#endif
-#else
+#else /* MSDOS || WIN32 */
sound_loops_allowed = TRUE;
- sound_loops_on = TRUE;
-#endif
- for(i=0;i<NUM_SOUNDS;i++)
+ /*
+ setup.sound_loops_on = TRUE;
+ */
+
+#endif /* MSDOS || WIN32 */
+#endif /* !USE_SDL_LIBRARY */
+
+ for(i=0; i<NUM_SOUNDS; i++)
{
-#ifdef MSDOS
- sprintf(sound_name[i], "%d", i+1);
-#endif
Sound[i].name = sound_name[i];
+
if (!LoadSound(&Sound[i]))
{
- sound_status=SOUND_OFF;
+ sound_status = SOUND_OFF;
return;
}
}
+
+#if 0
+ sound_status = SOUND_OFF;
+#endif
+
}
-void InitSoundProcess()
+void InitSoundServer()
{
- if (sound_status==SOUND_OFF)
+ if (sound_status == SOUND_OFF)
return;
-#ifndef MSDOS
+#ifndef USE_SDL_LIBRARY
+
+#if !defined(MSDOS) && !defined(WIN32)
+
if (pipe(sound_pipe)<0)
{
- fprintf(stderr,"%s: cannot create pipe - no sounds\n",progname);
- sound_status=SOUND_OFF;
+ Error(ERR_WARN, "cannot create pipe - no sounds");
+ sound_status = SOUND_OFF;
return;
}
- if ((sound_process_id=fork())<0)
+ if ((sound_process_id = fork()) < 0)
{
- fprintf(stderr,"%s: cannot create child process - no sounds\n",progname);
- sound_status=SOUND_OFF;
+ Error(ERR_WARN, "cannot create sound server process - no sounds");
+ sound_status = SOUND_OFF;
return;
}
if (!sound_process_id) /* we are child */
+ {
SoundServer();
+
+ /* never reached */
+ exit(0);
+ }
else /* we are parent */
close(sound_pipe[0]); /* no reading from pipe needed */
-#else
+
+#else /* MSDOS || WIN32 */
+
SoundServer();
-#endif
+
+#endif /* MSDOS */
+
+#endif /* !USE_SDL_LIBRARY */
}
-void InitJoystick()
+void InitJoysticks()
{
- if (global_joystick_status==JOYSTICK_OFF)
+#ifdef USE_SDL_LIBRARY
+ static boolean sdl_joystick_subsystem_initialized = FALSE;
+#endif
+
+ int i;
+
+ if (global_joystick_status == JOYSTICK_OFF)
return;
-#ifndef MSDOS
- if (access(joystick_device_name[joystick_nr],R_OK)<0)
+ joystick_status = JOYSTICK_OFF;
+
+#ifdef USE_SDL_LIBRARY
+
+ if (!sdl_joystick_subsystem_initialized)
{
- fprintf(stderr,"%s: cannot access joystick device '%s'\n",
- progname,joystick_device_name[joystick_nr]);
- joystick_status = JOYSTICK_OFF;
- return;
+ sdl_joystick_subsystem_initialized = TRUE;
+
+ if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
+ {
+ Error(ERR_EXIT, "SDL_Init() failed: %s\n", SDL_GetError());
+ return;
+ }
}
- if ((joystick_device=open(joystick_device_name[joystick_nr],O_RDONLY))<0)
+ for (i=0; i<MAX_PLAYERS; i++)
{
- fprintf(stderr,"%s: cannot open joystick device '%s'\n",
- progname,joystick_device_name[joystick_nr]);
- joystick_status = JOYSTICK_OFF;
- return;
- }
+ char *device_name = setup.input[i].joy.device_name;
+ int joystick_nr = getJoystickNrFromDeviceName(device_name);
- joystick_status = JOYSTICK_AVAILABLE;
- LoadJoystickData();
-#else
- joystick_status = JOYSTICK_AVAILABLE;
-#endif
-}
+ if (joystick_nr >= SDL_NumJoysticks())
+ joystick_nr = -1;
-void InitDisplay(int argc, char *argv[])
-{
- char *display_name = NULL;
- XVisualInfo vinfo_template, *vinfo;
- int num_visuals;
- unsigned int depth;
- int i;
+ /* misuse joystick file descriptor variable to store joystick number */
+ stored_player[i].joystick_fd = joystick_nr;
+
+ /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
+ if (Check_SDL_JoystickOpened(joystick_nr))
+ Close_SDL_Joystick(joystick_nr);
- /* get X server to connect to, if given as an argument */
- for (i=1;i<argc-1;i++)
+ if (!setup.input[i].use_joystick)
+ continue;
+
+ if (!Open_SDL_Joystick(joystick_nr))
+ {
+ Error(ERR_WARN, "cannot open joystick %d", joystick_nr);
+ continue;
+ }
+
+ joystick_status = JOYSTICK_AVAILABLE;
+ }
+
+#else /* !USE_SDL_LIBRARY */
+
+#ifndef MSDOS
+ for (i=0; i<MAX_PLAYERS; i++)
{
- char *dispstr="-display";
- int len=MAX(strlen(dispstr),strlen(argv[i]));
+ char *device_name = setup.input[i].joy.device_name;
+
+ /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
+ if (stored_player[i].joystick_fd != -1)
+ {
+ close(stored_player[i].joystick_fd);
+ stored_player[i].joystick_fd = -1;
+ }
+
+ if (!setup.input[i].use_joystick)
+ continue;
- if (len<4)
+ if (access(device_name, R_OK) != 0)
+ {
+ Error(ERR_WARN, "cannot access joystick device '%s'", device_name);
continue;
- else if (!strncmp(argv[i],dispstr,len))
+ }
+
+ if ((stored_player[i].joystick_fd = open(device_name, O_RDONLY)) < 0)
{
- display_name=argv[i+1];
- break;
+ Error(ERR_WARN, "cannot open joystick device '%s'", device_name);
+ continue;
}
+
+ joystick_status = JOYSTICK_AVAILABLE;
}
- /* connect to X server */
- if (!(display=XOpenDisplay(display_name)))
+#else /* MSDOS */
+
+ /* try to access two joysticks; if that fails, try to access just one */
+ if (install_joystick(JOY_TYPE_2PADS) == 0 ||
+ install_joystick(JOY_TYPE_AUTODETECT) == 0)
+ joystick_status = JOYSTICK_AVAILABLE;
+
+ /*
+ load_joystick_data(JOYSTICK_FILENAME);
+ */
+
+ for (i=0; i<MAX_PLAYERS; i++)
{
- fprintf(stderr,"%s: cannot connect to X server %s\n",
- progname, XDisplayName(display_name));
- exit(-1);
+ char *device_name = setup.input[i].joy.device_name;
+ int joystick_nr = getJoystickNrFromDeviceName(device_name);
+
+ if (joystick_nr >= num_joysticks)
+ joystick_nr = -1;
+
+ /* misuse joystick file descriptor variable to store joystick number */
+ stored_player[i].joystick_fd = joystick_nr;
}
-
+#endif
+
+#endif /* !USE_SDL_LIBRARY */
+}
+
+void InitDisplay()
+{
+#ifdef USE_SDL_LIBRARY
+ /* initialize SDL video */
+ if (SDL_Init(SDL_INIT_VIDEO) < 0)
+ Error(ERR_EXIT, "SDL_Init() failed: %s\n", SDL_GetError());
+
+ /* automatically cleanup SDL stuff after exit() */
+ atexit(SDL_Quit);
+
+#else /* !USE_SDL_LIBRARY */
+
+#ifndef MSDOS
+ XVisualInfo vinfo_template, *vinfo;
+ int num_visuals;
+#endif
+ unsigned int depth;
+
+ /* connect to X server */
+ if (!(display = XOpenDisplay(options.display_name)))
+ Error(ERR_EXIT, "cannot connect to X server %s",
+ XDisplayName(options.display_name));
+
screen = DefaultScreen(display);
visual = DefaultVisual(display, screen);
depth = DefaultDepth(display, screen);
cmap = DefaultColormap(display, screen);
+#ifndef 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 /* !USE_SDL_LIBRARY */
}
void InitWindow(int argc, char *argv[])
{
+#ifdef USE_SDL_LIBRARY
+ /* open SDL video output device (window or fullscreen mode) */
+ if ((window = SDL_SetVideoMode(WIN_XSIZE, WIN_YSIZE, WIN_SDL_DEPTH,
+ SDL_HWSURFACE))
+ == NULL)
+ Error(ERR_EXIT, "SDL_SetVideoMode() failed: %s\n", SDL_GetError());
+
+ /* set window and icon title */
+ SDL_WM_SetCaption(WINDOW_TITLE_STRING, WINDOW_TITLE_STRING);
+
+ /* set event filter to filter out certain mouse motion events */
+ SDL_SetEventFilter(EventFilter);
+
+#else /* !USE_SDL_LIBRARY */
+
unsigned int border_width = 4;
+ XGCValues gc_values;
+ unsigned long gc_valuemask;
+#ifndef MSDOS
+ XTextProperty windowName, iconName;
Pixmap icon_pixmap, iconmask_pixmap;
- unsigned int icon_width,icon_height;
- int icon_hot_x,icon_hot_y;
+ unsigned int icon_width, icon_height;
+ int icon_hot_x, icon_hot_y;
char icon_filename[256];
XSizeHints size_hints;
XWMHints wm_hints;
XClassHint class_hints;
- XTextProperty windowName, iconName;
- XGCValues gc_values;
- unsigned long gc_valuemask;
- char *window_name = WINDOWTITLE_STRING;
- char *icon_name = WINDOWTITLE_STRING;
+ char *window_name = WINDOW_TITLE_STRING;
+ char *icon_name = WINDOW_TITLE_STRING;
long window_event_mask;
Atom proto_atom = None, delete_atom = None;
+#endif
int screen_width, screen_height;
int win_xpos = WIN_XPOS, win_ypos = WIN_YPOS;
unsigned long pen_fg = WhitePixel(display,screen);
unsigned long pen_bg = BlackPixel(display,screen);
+ const int width = WIN_XSIZE, height = WIN_YSIZE;
#ifndef MSDOS
static struct IconFileInfo icon_pic =
screen_width = XDisplayWidth(display, screen);
screen_height = XDisplayHeight(display, screen);
- width = WIN_XSIZE;
- height = WIN_YSIZE;
-
win_xpos = (screen_width - width) / 2;
win_ypos = (screen_height - height) / 2;
XChangeProperty(display, window, proto_atom, XA_ATOM, 32,
PropModePrepend, (unsigned char *) &delete_atom, 1);
- sprintf(icon_filename,"%s/%s",GFX_PATH,icon_pic.picture_filename);
+ sprintf(icon_filename, "%s/%s/%s",
+ options.ro_base_directory, GRAPHICS_DIRECTORY,
+ icon_pic.picture_filename);
XReadBitmapFile(display,window,icon_filename,
&icon_width,&icon_height,
&icon_pixmap,&icon_hot_x,&icon_hot_y);
if (!icon_pixmap)
- {
- fprintf(stderr, "%s: cannot read icon bitmap file '%s'.\n",
- progname,icon_filename);
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot read icon bitmap file '%s'", icon_filename);
- sprintf(icon_filename,"%s/%s",GFX_PATH,icon_pic.picturemask_filename);
+ sprintf(icon_filename, "%s/%s/%s",
+ options.ro_base_directory, GRAPHICS_DIRECTORY,
+ icon_pic.picturemask_filename);
XReadBitmapFile(display,window,icon_filename,
&icon_width,&icon_height,
&iconmask_pixmap,&icon_hot_x,&icon_hot_y);
if (!iconmask_pixmap)
- {
- fprintf(stderr, "%s: cannot read icon bitmap file '%s'.\n",
- progname,icon_filename);
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot read icon bitmap file '%s'", icon_filename);
size_hints.width = size_hints.min_width = size_hints.max_width = width;
size_hints.height = size_hints.min_height = size_hints.max_height = height;
}
if (!XStringListToTextProperty(&window_name, 1, &windowName))
- {
- fprintf(stderr, "%s: structure allocation for windowName failed.\n",
- progname);
- exit(-1);
- }
+ Error(ERR_EXIT, "structure allocation for windowName failed");
if (!XStringListToTextProperty(&icon_name, 1, &iconName))
- {
- fprintf(stderr, "%s: structure allocation for iconName failed.\n",
- progname);
- exit(-1);
- }
+ Error(ERR_EXIT, "structure allocation for iconName failed");
wm_hints.initial_state = NormalState;
wm_hints.input = True;
wm_hints.icon_mask = iconmask_pixmap;
wm_hints.flags = StateHint | IconPixmapHint | IconMaskHint | InputHint;
- class_hints.res_name = progname;
+ class_hints.res_name = program_name;
class_hints.res_class = "Rocks'n'Diamonds";
XSetWMProperties(display, window, &windowName, &iconName,
XFree(iconName.value);
/* Select event types wanted */
- window_event_mask = ExposureMask | StructureNotifyMask | FocusChangeMask |
- ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
- KeyPressMask | KeyReleaseMask;
+ window_event_mask =
+ ExposureMask | StructureNotifyMask | FocusChangeMask |
+ ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
+ PointerMotionHintMask | KeyPressMask | KeyReleaseMask;
+
XSelectInput(display, window, window_event_mask);
#endif
- /* create GC for drawing with window depth */
+ /* create GC for drawing with window depth and background color (black) */
gc_values.graphics_exposures = False;
gc_values.foreground = pen_bg;
gc_values.background = pen_bg;
gc_valuemask = GCGraphicsExposures | GCForeground | GCBackground;
gc = XCreateGC(display, window, gc_valuemask, &gc_values);
-}
-
-void DrawInitText(char *text, int ypos, int color)
-{
- if (display && window && pix[PIX_SMALLFONT])
- {
- XFillRectangle(display,window,gc,0,ypos, WIN_XSIZE,FONT2_YSIZE);
- DrawTextExt(window,gc,(WIN_XSIZE-strlen(text)*FONT2_XSIZE)/2,
- ypos,text,FS_SMALL,color);
- XFlush(display);
- }
+#endif /* !USE_SDL_LIBRARY */
}
void InitGfx()
{
int i,j;
+
+#ifdef USE_SDL_LIBRARY
+ SDL_Surface *sdl_image_tmp;
+#else
GC copy_clipmask_gc;
XGCValues clip_gc_values;
unsigned long clip_gc_valuemask;
+#endif
#ifdef MSDOS
static struct PictureFileInfo pic[NUM_PICTURES] =
{ "Door", TRUE },
{ "Heroes", TRUE },
{ "Toons", TRUE },
+ { "SP", TRUE },
+ { "DC", TRUE },
+ { "More", TRUE },
{ "Font", FALSE },
- { "Font2", FALSE }
+ { "Font2", FALSE },
+ { "Font3", FALSE }
};
#else
static struct PictureFileInfo pic[NUM_PICTURES] =
{ "RocksDoor", TRUE },
{ "RocksHeroes", TRUE },
{ "RocksToons", TRUE },
+ { "RocksSP", TRUE },
+ { "RocksDC", TRUE },
+ { "RocksMore", TRUE },
{ "RocksFont", FALSE },
- { "RocksFont2", FALSE }
+ { "RocksFont2", FALSE },
+ { "RocksFont3", FALSE }
};
#endif
+#ifdef DEBUG
+#if 0
+ static struct PictureFileInfo test_pic1 =
+ {
+ "RocksFont2",
+ FALSE
+ };
+ static struct PictureFileInfo test_pic2 =
+ {
+ "mouse",
+ FALSE
+ };
+#endif
+#endif
+
static struct
{
int start;
}
tile_needs_clipping[] =
{
- { GFX_SPIELER_UP, 4 },
- { GFX_SPIELER_DOWN, 4 },
- { GFX_SPIELER_LEFT, 4 },
- { GFX_SPIELER_RIGHT, 4 },
- { GFX_SPIELER_PUSH_LEFT, 4 },
- { GFX_SPIELER_PUSH_RIGHT, 4 },
+ { GFX_SPIELER1_UP, 4 },
+ { GFX_SPIELER1_DOWN, 4 },
+ { GFX_SPIELER1_LEFT, 4 },
+ { GFX_SPIELER1_RIGHT, 4 },
+ { GFX_SPIELER1_PUSH_LEFT, 4 },
+ { GFX_SPIELER1_PUSH_RIGHT, 4 },
+ { GFX_SPIELER2_UP, 4 },
+ { GFX_SPIELER2_DOWN, 4 },
+ { GFX_SPIELER2_LEFT, 4 },
+ { GFX_SPIELER2_RIGHT, 4 },
+ { GFX_SPIELER2_PUSH_LEFT, 4 },
+ { GFX_SPIELER2_PUSH_RIGHT, 4 },
+ { GFX_SPIELER3_UP, 4 },
+ { GFX_SPIELER3_DOWN, 4 },
+ { GFX_SPIELER3_LEFT, 4 },
+ { GFX_SPIELER3_RIGHT, 4 },
+ { GFX_SPIELER3_PUSH_LEFT, 4 },
+ { GFX_SPIELER3_PUSH_RIGHT, 4 },
+ { GFX_SPIELER4_UP, 4 },
+ { GFX_SPIELER4_DOWN, 4 },
+ { GFX_SPIELER4_LEFT, 4 },
+ { GFX_SPIELER4_RIGHT, 4 },
+ { GFX_SPIELER4_PUSH_LEFT, 4 },
+ { GFX_SPIELER4_PUSH_RIGHT, 4 },
+ { GFX_SP_MURPHY, 1 },
+ { GFX_MURPHY_GO_LEFT, 3 },
+ { GFX_MURPHY_GO_RIGHT, 3 },
+ { GFX_MURPHY_SNAP_UP, 1 },
+ { GFX_MURPHY_SNAP_DOWN, 1 },
+ { GFX_MURPHY_SNAP_RIGHT, 1 },
+ { GFX_MURPHY_SNAP_LEFT, 1 },
+ { GFX_MURPHY_PUSH_RIGHT, 1 },
+ { GFX_MURPHY_PUSH_LEFT, 1 },
{ GFX_GEBLUBBER, 4 },
{ GFX_DYNAMIT, 7 },
{ GFX_DYNABOMB, 4 },
+ { GFX_EXPLOSION, 8 },
{ GFX_SOKOBAN_OBJEKT, 1 },
- { GFX_MASK_SPARKLING, 3 },
+ { GFX_FUNKELN_BLAU, 3 },
+ { GFX_FUNKELN_WEISS, 3 },
+ { GFX2_SHIELD_PASSIVE, 3 },
+ { GFX2_SHIELD_ACTIVE, 3 },
{ -1, 0 }
};
-#ifdef DEBUG_TIMING
- long count1, count2;
- count1 = Counter();
+#if DEBUG_TIMING
+ debug_print_timestamp(0, NULL); /* initialize timestamp function */
+#endif
+
+#ifdef DEBUG
+#if 0
+ printf("Test: Loading RocksFont2.pcx ...\n");
+ LoadGfx(PIX_SMALLFONT,&test_pic1);
+ printf("Test: Done.\n");
+ printf("Test: Loading mouse.pcx ...\n");
+ LoadGfx(PIX_SMALLFONT,&test_pic2);
+ printf("Test: Done.\n");
+#endif
#endif
LoadGfx(PIX_SMALLFONT,&pic[PIX_SMALLFONT]);
- DrawInitText(WINDOWTITLE_STRING,20,FC_YELLOW);
+ DrawInitText(WINDOW_TITLE_STRING,20,FC_YELLOW);
DrawInitText(COPYRIGHT_STRING,50,FC_RED);
#ifdef MSDOS
DrawInitText("MSDOS version done by Guido Schulz",210,FC_BLUE);
rest(200);
-#endif MSDOS
+#endif /* MSDOS */
DrawInitText("Loading graphics:",120,FC_GREEN);
for(i=0; i<NUM_PICTURES; i++)
if (i != PIX_SMALLFONT)
LoadGfx(i,&pic[i]);
-#ifdef DEBUG_TIMING
- count2 = Counter();
- printf("SUMMARY: %.2f SECONDS LOADING TIME\n",(float)(count2-count1)/1000.0);
+#if DEBUG_TIMING
+ debug_print_timestamp(0, "SUMMARY LOADING ALL GRAPHICS:");
#endif
+#ifdef USE_SDL_LIBRARY
+ /* create some native image surfaces for double-buffer purposes */
+
+ /* create double-buffer surface for background image */
+ if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE,
+ WIN_XSIZE, WIN_YSIZE,
+ WIN_SDL_DEPTH, 0, 0, 0, 0))
+ == NULL)
+ Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s\n", SDL_GetError());
+
+ if ((pix[PIX_DB_BACK] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
+
+ SDL_FreeSurface(sdl_image_tmp);
+
+ /* create double-buffer surface for door image */
+ if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE,
+ 3 * DXSIZE, DYSIZE + VYSIZE,
+ WIN_SDL_DEPTH, 0, 0, 0, 0))
+ == NULL)
+ Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s\n", SDL_GetError());
+
+ if ((pix[PIX_DB_DOOR] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
+
+ SDL_FreeSurface(sdl_image_tmp);
+
+ /* create double-buffer surface for field image */
+ if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE,
+ FXSIZE, FYSIZE,
+ WIN_SDL_DEPTH, 0, 0, 0, 0))
+ == NULL)
+ Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s\n", SDL_GetError());
+
+ if ((pix[PIX_DB_FIELD] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
+
+ SDL_FreeSurface(sdl_image_tmp);
+
+ /* initialize surface array to 'NULL' */
+ for(i=0; i<NUM_TILES; i++)
+ tile_masked[i] = NULL;
+
+ /* create only those masked surfaces we really need */
+ for(i=0; tile_needs_clipping[i].start>=0; i++)
+ {
+ for(j=0; j<tile_needs_clipping[i].count; j++)
+ {
+ int tile = tile_needs_clipping[i].start + j;
+ int graphic = tile;
+ int src_x, src_y;
+ int bitmap_nr;
+ Bitmap src_bitmap;
+
+ getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
+ src_bitmap = pix_masked[bitmap_nr];
+
+ /* create surface for masked tile graphic */
+ if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
+ WIN_SDL_DEPTH, 0, 0, 0, 0))
+ == NULL)
+ Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s\n", SDL_GetError());
+
+ /* create native transparent surface for current image */
+ SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
+ SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
+ if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
+
+ SDL_FreeSurface(sdl_image_tmp);
+
+ BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
+ }
+ }
+
+#else /* !USE_SDL_LIBRARY */
pix[PIX_DB_BACK] = XCreatePixmap(display, window,
WIN_XSIZE,WIN_YSIZE,
int tile = tile_needs_clipping[i].start + j;
int graphic = tile;
int src_x, src_y;
+ int pixmap_nr;
Pixmap src_pixmap;
- if (tile_needs_clipping[i].start == GFX_MASK_SPARKLING)
- {
- /* special case -- should be cleaned up sometimes... */
- src_pixmap = clipmask[PIX_BACK];
- src_x = SX + GFX_PER_LINE*TILEX;
- src_y = SY + j*TILEY;
- }
- else if (graphic >= GFX_START_ROCKSSCREEN &&
- graphic <= GFX_END_ROCKSSCREEN)
- {
- src_pixmap = clipmask[PIX_BACK];
- graphic -= GFX_START_ROCKSSCREEN;
- src_x = SX + (graphic % GFX_PER_LINE) * TILEX;
- src_y = SY + (graphic / GFX_PER_LINE) * TILEY;
- }
- else if (graphic >= GFX_START_ROCKSHEROES &&
- graphic <= GFX_END_ROCKSHEROES)
- {
- src_pixmap = clipmask[PIX_HEROES];
- graphic -= GFX_START_ROCKSHEROES;
- src_x = (graphic % HEROES_PER_LINE) * TILEX;
- src_y = (graphic / HEROES_PER_LINE) * TILEY;
- }
- else if (graphic >= GFX_START_ROCKSFONT &&
- graphic <= GFX_END_ROCKSFONT)
- {
- src_pixmap = clipmask[PIX_BIGFONT];
- graphic -= GFX_START_ROCKSFONT;
- src_x = (graphic % FONT_CHARS_PER_LINE) * TILEX;
- src_y = (graphic / FONT_CHARS_PER_LINE) * TILEY +
- FC_SPECIAL1 * FONT_LINES_PER_FONT * TILEY;
- }
- else
- break;
+ getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
+ src_pixmap = clipmask[pixmap_nr];
tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
}
if (!pix[PIX_DB_BACK] || !pix[PIX_DB_DOOR])
- {
- fprintf(stderr, "%s: cannot create additional Pixmaps!\n",progname);
- CloseAll();
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot create additional pixmaps");
- for(i=0;i<NUM_PIXMAPS;i++)
+ for(i=0; i<NUM_BITMAPS; i++)
{
if (clipmask[i])
{
}
}
+#endif /* !USE_SDL_LIBRARY */
+
drawto = backbuffer = pix[PIX_DB_BACK];
fieldbuffer = pix[PIX_DB_FIELD];
SetDrawtoField(DRAW_BACKBUFFER);
- XCopyArea(display,pix[PIX_BACK],backbuffer,gc,
- 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
- XFillRectangle(display,pix[PIX_DB_BACK],gc,
- REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
- XFillRectangle(display,pix[PIX_DB_DOOR],gc,
- 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
+ BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
+ ClearRectangle(pix[PIX_DB_BACK], REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
+ ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
for(i=0; i<MAX_BUF_XSIZE; i++)
for(j=0; j<MAX_BUF_YSIZE; j++)
char basefilename[256];
char filename[256];
-#ifdef XPM_INCLUDE_FILE
+#ifdef USE_XPM_LIBRARY
int xpm_err, xbm_err;
unsigned int width,height;
int hot_x,hot_y;
char *picture_ext = ".xpm";
char *picturemask_ext = "Mask.xbm";
#else
- int gif_err;
- char *picture_ext = ".gif";
-#endif
-#ifdef DEBUG_TIMING
- long count1, count2;
-#endif
+#ifdef USE_SDL_LIBRARY
+ SDL_Surface *sdl_image_tmp;
+#else /* !USE_SDL_LIBRARY */
+ int pcx_err;
+#endif /* !USE_SDL_LIBRARY */
+ char *picture_ext = ".pcx";
+
+#endif /* !USE_XPM_LIBRARY */
/* Grafik laden */
if (pic->picture_filename)
{
- sprintf(basefilename,"%s%s",pic->picture_filename,picture_ext);
- DrawInitText(basefilename,150,FC_YELLOW);
- sprintf(filename,"%s/%s",GFX_PATH,basefilename);
+ sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext);
+ DrawInitText(basefilename, 150, FC_YELLOW);
+ sprintf(filename, "%s/%s/%s",
+ options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
#ifdef MSDOS
rest(100);
-#endif MSDOS
+#endif /* MSDOS */
-#ifdef DEBUG_TIMING
- count1 = Counter();
+#if DEBUG_TIMING
+ debug_print_timestamp(1, NULL); /* initialize timestamp function */
#endif
-#ifdef XPM_INCLUDE_FILE
+#ifdef USE_SDL_LIBRARY
+ /* load image to temporary surface */
+ if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
+ Error(ERR_EXIT, "IMG_Load() failed: %s\n", SDL_GetError());
+
+ /* create native non-transparent surface for current image */
+ if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
+
+ /* create native transparent surface for current image */
+ SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
+ SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
+ if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
+ Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError());
+
+ /* free temporary surface */
+ SDL_FreeSurface(sdl_image_tmp);
+
+#else /* !USE_SDL_LIBRARY */
+
+#ifdef USE_XPM_LIBRARY
xpm_att[pos].valuemask = XpmCloseness;
xpm_att[pos].closeness = 20000;
xpm_err = XpmReadFileToPixmap(display,window,filename,
&pix[pos],&shapemask,&xpm_att[pos]);
-
switch(xpm_err)
{
case XpmOpenFailed:
- fprintf(stderr,"Cannot open Xpm file '%s' !\n",filename);
- CloseAll();
- exit(-1);
+ Error(ERR_EXIT, "cannot open XPM file '%s'", filename);
case XpmFileInvalid:
- fprintf(stderr,"Invalid Xpm file '%s'!\n",filename);
- CloseAll();
- exit(-1);
+ Error(ERR_EXIT, "invalid XPM file '%s'", filename);
case XpmNoMemory:
- fprintf(stderr,"Not enough memory for Xpm file '%s'!\n",filename);
- CloseAll();
- exit(1);
+ Error(ERR_EXIT, "not enough memory for XPM file '%s'", filename);
case XpmColorFailed:
- fprintf(stderr,"Can't get colors for Xpm file '%s'!\n",filename);
- CloseAll();
- exit(-1);
+ Error(ERR_EXIT, "cannot get colors for XPM file '%s'", filename);
default:
break;
}
-#ifdef DEBUG_TIMING
- count2 = Counter();
- printf("XPM LOADING %s IN %.2f SECONDS\n",
- filename,(float)(count2-count1)/1000.0);
+#if DEBUG_TIMING
+ printf("LOADING XPM FILE %s:", filename);
+ debug_print_timestamp(1, "");
#endif
-#else
+#else /* !USE_XPM_LIBRARY */
- gif_err = Read_GIF_to_Pixmaps(display, window, filename,
- &pix[pos], &clipmask[pos]);
-
- switch(gif_err)
+ pcx_err = Read_PCX_to_Pixmap(display, window, gc, filename,
+ &pix[pos], &clipmask[pos]);
+ switch(pcx_err)
{
- case GIF_Success:
+ case PCX_Success:
break;
- case GIF_OpenFailed:
- fprintf(stderr,"Cannot open GIF file '%s' !\n",filename);
- CloseAll();
- exit(-1);
- case GIF_ReadFailed:
- fprintf(stderr,"Cannot read GIF file '%s' !\n",filename);
- CloseAll();
- exit(-1);
- case GIF_FileInvalid:
- fprintf(stderr,"Invalid GIF file '%s'!\n",filename);
- CloseAll();
- exit(-1);
- case GIF_NoMemory:
- fprintf(stderr,"Not enough memory for GIF file '%s'!\n",filename);
- CloseAll();
- exit(1);
- case GIF_ColorFailed:
- fprintf(stderr,"Can't get colors for GIF file '%s'!\n",filename);
- CloseAll();
- exit(-1);
+ case PCX_OpenFailed:
+ Error(ERR_EXIT, "cannot open PCX file '%s'", filename);
+ case PCX_ReadFailed:
+ Error(ERR_EXIT, "cannot read PCX file '%s'", filename);
+ case PCX_FileInvalid:
+ Error(ERR_EXIT, "invalid PCX file '%s'", filename);
+ case PCX_NoMemory:
+ Error(ERR_EXIT, "not enough memory for PCX file '%s'", filename);
+ case PCX_ColorFailed:
+ Error(ERR_EXIT, "cannot get colors for PCX file '%s'", filename);
default:
break;
}
-#ifdef DEBUG_TIMING
- count2 = Counter();
- printf("GIF LOADING %s IN %.2f SECONDS\n",
- filename,(float)(count2-count1)/1000.0);
+#if DEBUG_TIMING
+ printf("SUMMARY LOADING PCX FILE %s:", filename);
+ debug_print_timestamp(1, "");
#endif
-#endif
+#endif /* !USE_XPM_LIBRARY */
if (!pix[pos])
- {
- fprintf(stderr, "%s: cannot get graphics for '%s'.\n",
- progname, pic->picture_filename);
- CloseAll();
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
+
+ /* setting pix_masked[] to pix[] allows BlitBitmapMasked() to always
+ use pix_masked[], although they are the same when not using SDL */
+ pix_masked[pos] = pix[pos];
+
+#endif /* !USE_SDL_LIBRARY */
}
+#ifndef USE_SDL_LIBRARY
/* zugehörige Maske laden (wenn vorhanden) */
if (pic->picture_with_mask)
{
+#ifdef USE_XPM_LIBRARY
-#ifdef XPM_INCLUDE_FILE
-
- sprintf(basefilename,"%s%s",pic->picture_filename,picturemask_ext);
- DrawInitText(basefilename,150,FC_YELLOW);
- sprintf(filename,"%s/%s",GFX_PATH,basefilename);
+ sprintf(basefilename, "%s%s", pic->picture_filename, picturemask_ext);
+ DrawInitText(basefilename, 150, FC_YELLOW);
+ sprintf(filename, "%s/%s/%s",
+ options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
-#ifdef DEBUG_TIMING
- count1 = Counter();
+#if DEBUG_TIMING
+ debug_print_timestamp(1, NULL); /* initialize timestamp function */
#endif
xbm_err = XReadBitmapFile(display,window,filename,
&width,&height,&clipmask[pos],&hot_x,&hot_y);
-
switch(xbm_err)
{
case BitmapSuccess:
break;
case BitmapOpenFailed:
- fprintf(stderr,"Bitmap file open failed on '%s' !\n",filename);
- CloseAll();
- exit(-1);
- break;
+ Error(ERR_EXIT, "cannot open XBM file '%s'", filename);
case BitmapFileInvalid:
- fprintf(stderr,"Bitmap file invalid: '%s' !\n",filename);
- CloseAll();
- exit(-1);
- break;
+ Error(ERR_EXIT, "invalid XBM file '%s'", filename);
case BitmapNoMemory:
- fprintf(stderr,"No memory for file '%s' !\n",filename);
- CloseAll();
- exit(-1);
+ Error(ERR_EXIT, "not enough memory for XBM file '%s'", filename);
break;
default:
break;
}
-#ifdef DEBUG_TIMING
- count2 = Counter();
- printf("XBM LOADING %s IN %.2f SECONDS\n",
- filename,(float)(count2-count1)/1000.0);
+#if DEBUG_TIMING
+ printf("LOADING XBM FILE %s:", filename);
+ debug_print_timestamp(1, "");
#endif
-#endif
+#endif /* USE_XPM_LIBRARY */
if (!clipmask[pos])
- {
- fprintf(stderr, "%s: cannot get clipmask for '%s'.\n",
- progname, pic->picture_filename);
- CloseAll();
- exit(-1);
- }
+ Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
}
+#endif /* !USE_SDL_LIBRARY */
+}
+
+void InitGadgets()
+{
+ CreateLevelEditorGadgets();
+ CreateGameButtons();
+ CreateTapeButtons();
+ CreateToolButtons();
+ CreateScreenGadgets();
}
void InitElementProperties()
EL_SCHLUESSEL1,
EL_SCHLUESSEL2,
EL_SCHLUESSEL3,
- EL_SCHLUESSEL4
+ EL_SCHLUESSEL4,
+ EL_EM_KEY_1,
+ EL_EM_KEY_2,
+ EL_EM_KEY_3,
+ EL_EM_KEY_4
};
static int ep_schluessel_num = sizeof(ep_schluessel)/sizeof(int);
EL_PFORTE1X,
EL_PFORTE2X,
EL_PFORTE3X,
- EL_PFORTE4X
+ EL_PFORTE4X,
+ EL_EM_GATE_1,
+ EL_EM_GATE_2,
+ EL_EM_GATE_3,
+ EL_EM_GATE_4,
+ EL_EM_GATE_1X,
+ EL_EM_GATE_2X,
+ EL_EM_GATE_3X,
+ EL_EM_GATE_4X,
+ EL_SWITCHGATE_OPEN,
+ EL_SWITCHGATE_CLOSED,
+ EL_TIMEGATE_OPEN,
+ EL_TIMEGATE_CLOSED,
+ EL_TUBE_CROSS,
+ EL_TUBE_VERTICAL,
+ EL_TUBE_HORIZONTAL,
+ EL_TUBE_VERT_LEFT,
+ EL_TUBE_VERT_RIGHT,
+ EL_TUBE_HORIZ_UP,
+ EL_TUBE_HORIZ_DOWN,
+ EL_TUBE_LEFT_UP,
+ EL_TUBE_LEFT_DOWN,
+ EL_TUBE_RIGHT_UP,
+ EL_TUBE_RIGHT_DOWN
};
static int ep_pforte_num = sizeof(ep_pforte)/sizeof(int);
EL_BETON,
EL_MAUERWERK,
EL_MAUER_LEBT,
+ EL_MAUER_X,
+ EL_MAUER_Y,
+ EL_MAUER_XY,
+ EL_BD_WALL,
EL_FELSBODEN,
EL_AUSGANG_ZU,
EL_AUSGANG_ACT,
EL_AMOEBE_BD,
EL_MORAST_VOLL,
EL_MORAST_LEER,
- EL_SIEB_VOLL,
- EL_SIEB_LEER,
- EL_SIEB_TOT,
- EL_SIEB2_VOLL,
- EL_SIEB2_LEER,
- EL_SIEB2_TOT,
+ EL_MAGIC_WALL_OFF,
+ EL_MAGIC_WALL_EMPTY,
+ EL_MAGIC_WALL_FULL,
+ EL_MAGIC_WALL_DEAD,
+ EL_MAGIC_WALL_BD_OFF,
+ EL_MAGIC_WALL_BD_EMPTY,
+ EL_MAGIC_WALL_BD_FULL,
+ EL_MAGIC_WALL_BD_DEAD,
EL_LIFE,
EL_LIFE_ASYNC,
EL_BADEWANNE1,
EL_BADEWANNE2,
EL_BADEWANNE3,
EL_BADEWANNE4,
- EL_BADEWANNE5
+ EL_BADEWANNE5,
+ EL_SP_CHIP_SINGLE,
+ EL_SP_CHIP_LEFT,
+ EL_SP_CHIP_RIGHT,
+ EL_SP_CHIP_UPPER,
+ EL_SP_CHIP_LOWER,
+ EL_SP_HARD_GRAY,
+ EL_SP_HARD_GREEN,
+ EL_SP_HARD_BLUE,
+ EL_SP_HARD_RED,
+ EL_SP_HARD_YELLOW,
+ EL_SP_HARD_BASE1,
+ EL_SP_HARD_BASE2,
+ EL_SP_HARD_BASE3,
+ EL_SP_HARD_BASE4,
+ EL_SP_HARD_BASE5,
+ EL_SP_HARD_BASE6,
+ EL_SP_TERMINAL,
+ EL_SP_EXIT,
+ EL_INVISIBLE_STEEL,
+ EL_BELT1_SWITCH_LEFT,
+ EL_BELT1_SWITCH_MIDDLE,
+ EL_BELT1_SWITCH_RIGHT,
+ EL_BELT2_SWITCH_LEFT,
+ EL_BELT2_SWITCH_MIDDLE,
+ EL_BELT2_SWITCH_RIGHT,
+ EL_BELT3_SWITCH_LEFT,
+ EL_BELT3_SWITCH_MIDDLE,
+ EL_BELT3_SWITCH_RIGHT,
+ EL_BELT4_SWITCH_LEFT,
+ EL_BELT4_SWITCH_MIDDLE,
+ EL_BELT4_SWITCH_RIGHT,
+ EL_SWITCHGATE_SWITCH_1,
+ EL_SWITCHGATE_SWITCH_2,
+ EL_LIGHT_SWITCH_OFF,
+ EL_LIGHT_SWITCH_ON,
+ EL_TIMEGATE_SWITCH_OFF,
+ EL_TIMEGATE_SWITCH_ON,
+ EL_SIGN_EXCLAMATION,
+ EL_SIGN_RADIOACTIVITY,
+ EL_SIGN_STOP,
+ EL_SIGN_WHEELCHAIR,
+ EL_SIGN_PARKING,
+ EL_SIGN_ONEWAY,
+ EL_SIGN_HEART,
+ EL_SIGN_TRIANGLE,
+ EL_SIGN_ROUND,
+ EL_SIGN_EXIT,
+ EL_SIGN_YINYANG,
+ EL_SIGN_OTHER,
+ EL_STEEL_SLANTED,
+ EL_EMC_STEEL_WALL_1,
+ EL_EMC_STEEL_WALL_2,
+ EL_EMC_STEEL_WALL_3,
+ EL_EMC_STEEL_WALL_4,
+ EL_EMC_WALL_1,
+ EL_EMC_WALL_2,
+ EL_EMC_WALL_3,
+ EL_EMC_WALL_4,
+ EL_EMC_WALL_5,
+ EL_EMC_WALL_6,
+ EL_EMC_WALL_7,
+ EL_EMC_WALL_8,
+ EL_CRYSTAL,
+ EL_WALL_PEARL,
+ EL_WALL_CRYSTAL,
+ EL_TUBE_CROSS,
+ EL_TUBE_VERTICAL,
+ EL_TUBE_HORIZONTAL,
+ EL_TUBE_VERT_LEFT,
+ EL_TUBE_VERT_RIGHT,
+ EL_TUBE_HORIZ_UP,
+ EL_TUBE_HORIZ_DOWN,
+ EL_TUBE_LEFT_UP,
+ EL_TUBE_LEFT_DOWN,
+ EL_TUBE_RIGHT_UP,
+ EL_TUBE_RIGHT_DOWN
};
static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
- static int ep_massiv[] =
+ static int ep_massive[] =
{
EL_BETON,
EL_SALZSAEURE,
EL_PFORTE1X,
EL_PFORTE2X,
EL_PFORTE3X,
- EL_PFORTE4X
+ EL_PFORTE4X,
+ EL_EM_GATE_1,
+ EL_EM_GATE_2,
+ EL_EM_GATE_3,
+ EL_EM_GATE_4,
+ EL_EM_GATE_1X,
+ EL_EM_GATE_2X,
+ EL_EM_GATE_3X,
+ EL_EM_GATE_4X,
+ EL_SWITCHGATE_OPEN,
+ EL_SWITCHGATE_CLOSED,
+ EL_TIMEGATE_OPEN,
+ EL_TIMEGATE_CLOSED,
+ EL_SP_HARD_GRAY,
+ EL_SP_HARD_GREEN,
+ EL_SP_HARD_BLUE,
+ EL_SP_HARD_RED,
+ EL_SP_HARD_YELLOW,
+ EL_SP_HARD_BASE1,
+ EL_SP_HARD_BASE2,
+ EL_SP_HARD_BASE3,
+ EL_SP_HARD_BASE4,
+ EL_SP_HARD_BASE5,
+ EL_SP_HARD_BASE6,
+ EL_INVISIBLE_STEEL,
+ EL_BELT1_SWITCH_LEFT,
+ EL_BELT1_SWITCH_MIDDLE,
+ EL_BELT1_SWITCH_RIGHT,
+ EL_BELT2_SWITCH_LEFT,
+ EL_BELT2_SWITCH_MIDDLE,
+ EL_BELT2_SWITCH_RIGHT,
+ EL_BELT3_SWITCH_LEFT,
+ EL_BELT3_SWITCH_MIDDLE,
+ EL_BELT3_SWITCH_RIGHT,
+ EL_BELT4_SWITCH_LEFT,
+ EL_BELT4_SWITCH_MIDDLE,
+ EL_BELT4_SWITCH_RIGHT,
+ EL_LIGHT_SWITCH_OFF,
+ EL_LIGHT_SWITCH_ON,
+ EL_SIGN_EXCLAMATION,
+ EL_SIGN_RADIOACTIVITY,
+ EL_SIGN_STOP,
+ EL_SIGN_WHEELCHAIR,
+ EL_SIGN_PARKING,
+ EL_SIGN_ONEWAY,
+ EL_SIGN_HEART,
+ EL_SIGN_TRIANGLE,
+ EL_SIGN_ROUND,
+ EL_SIGN_EXIT,
+ EL_SIGN_YINYANG,
+ EL_SIGN_OTHER,
+ EL_STEEL_SLANTED,
+ EL_EMC_STEEL_WALL_1,
+ EL_EMC_STEEL_WALL_2,
+ EL_EMC_STEEL_WALL_3,
+ EL_EMC_STEEL_WALL_4,
+ EL_CRYSTAL,
+ EL_TUBE_CROSS,
+ EL_TUBE_VERTICAL,
+ EL_TUBE_HORIZONTAL,
+ EL_TUBE_VERT_LEFT,
+ EL_TUBE_VERT_RIGHT,
+ EL_TUBE_HORIZ_UP,
+ EL_TUBE_HORIZ_DOWN,
+ EL_TUBE_LEFT_UP,
+ EL_TUBE_LEFT_DOWN,
+ EL_TUBE_RIGHT_UP,
+ EL_TUBE_RIGHT_DOWN
};
- static int ep_massiv_num = sizeof(ep_massiv)/sizeof(int);
+ static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
static int ep_slippery[] =
{
EL_FELSBODEN,
+ EL_BD_WALL,
EL_FELSBROCKEN,
+ EL_BD_ROCK,
EL_EDELSTEIN,
EL_EDELSTEIN_BD,
EL_EDELSTEIN_GELB,
EL_BIRNE_AUS,
EL_BADEWANNE1,
EL_BADEWANNE2,
- EL_SONDE
+ EL_SONDE,
+ EL_SP_ZONK,
+ EL_SP_INFOTRON,
+ EL_SP_CHIP_SINGLE,
+ EL_SP_CHIP_LEFT,
+ EL_SP_CHIP_RIGHT,
+ EL_SP_CHIP_UPPER,
+ EL_SP_CHIP_LOWER,
+ EL_SPEED_PILL,
+ EL_STEEL_SLANTED,
+ EL_PEARL,
+ EL_CRYSTAL
};
static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int);
EL_MAMPFER,
EL_MAMPFER2,
EL_ROBOT,
- EL_PACMAN
+ EL_PACMAN,
+ EL_SP_SNIKSNAK,
+ EL_SP_ELECTRON
};
static int ep_enemy_num = sizeof(ep_enemy)/sizeof(int);
EL_PFORTE2X,
EL_PFORTE3X,
EL_PFORTE4X,
+ EL_EM_GATE_1,
+ EL_EM_GATE_2,
+ EL_EM_GATE_3,
+ EL_EM_GATE_4,
+ EL_EM_GATE_1X,
+ EL_EM_GATE_2X,
+ EL_EM_GATE_3X,
+ EL_EM_GATE_4X,
EL_AUSGANG_ZU,
EL_AUSGANG_ACT,
EL_AUSGANG_AUF,
EL_MAUERWERK,
EL_FELSBODEN,
EL_MAUER_LEBT,
- EL_MAUERND
+ EL_MAUER_X,
+ EL_MAUER_Y,
+ EL_MAUER_XY,
+ EL_MAUERND,
+ EL_BD_WALL,
+ EL_SP_CHIP_SINGLE,
+ EL_SP_CHIP_LEFT,
+ EL_SP_CHIP_RIGHT,
+ EL_SP_CHIP_UPPER,
+ EL_SP_CHIP_LOWER,
+ EL_SP_HARD_GRAY,
+ EL_SP_HARD_GREEN,
+ EL_SP_HARD_BLUE,
+ EL_SP_HARD_RED,
+ EL_SP_HARD_YELLOW,
+ EL_SP_HARD_BASE1,
+ EL_SP_HARD_BASE2,
+ EL_SP_HARD_BASE3,
+ EL_SP_HARD_BASE4,
+ EL_SP_HARD_BASE5,
+ EL_SP_HARD_BASE6,
+ EL_SP_TERMINAL,
+ EL_SP_EXIT,
+ EL_INVISIBLE_STEEL,
+ EL_STEEL_SLANTED,
+ EL_EMC_STEEL_WALL_1,
+ EL_EMC_STEEL_WALL_2,
+ EL_EMC_STEEL_WALL_3,
+ EL_EMC_STEEL_WALL_4,
+ EL_EMC_WALL_1,
+ EL_EMC_WALL_2,
+ EL_EMC_WALL_3,
+ EL_EMC_WALL_4,
+ EL_EMC_WALL_5,
+ EL_EMC_WALL_6,
+ EL_EMC_WALL_7,
+ EL_EMC_WALL_8
};
static int ep_mauer_num = sizeof(ep_mauer)/sizeof(int);
static int ep_can_fall[] =
{
EL_FELSBROCKEN,
+ EL_BD_ROCK,
EL_EDELSTEIN,
EL_EDELSTEIN_BD,
EL_EDELSTEIN_GELB,
EL_KOKOSNUSS,
EL_TROPFEN,
EL_MORAST_VOLL,
- EL_SIEB_VOLL,
- EL_SIEB2_VOLL,
+ EL_MAGIC_WALL_FULL,
+ EL_MAGIC_WALL_BD_FULL,
EL_ZEIT_VOLL,
- EL_ZEIT_LEER
+ EL_ZEIT_LEER,
+ EL_SP_ZONK,
+ EL_SP_INFOTRON,
+ EL_SP_DISK_ORANGE,
+ EL_PEARL,
+ EL_CRYSTAL,
+ EL_SPRING,
+ EL_DX_SUPABOMB
};
static int ep_can_fall_num = sizeof(ep_can_fall)/sizeof(int);
static int ep_can_smash[] =
{
EL_FELSBROCKEN,
+ EL_BD_ROCK,
EL_EDELSTEIN,
EL_EDELSTEIN_BD,
EL_EDELSTEIN_GELB,
EL_SCHLUESSEL2,
EL_SCHLUESSEL3,
EL_SCHLUESSEL4,
+ EL_EM_KEY_1,
+ EL_EM_KEY_2,
+ EL_EM_KEY_3,
+ EL_EM_KEY_4,
EL_BOMBE,
EL_KOKOSNUSS,
EL_TROPFEN,
EL_ZEIT_VOLL,
- EL_ZEIT_LEER
+ EL_ZEIT_LEER,
+ EL_SP_ZONK,
+ EL_SP_INFOTRON,
+ EL_SP_DISK_ORANGE,
+ EL_PEARL,
+ EL_CRYSTAL,
+ EL_SPRING,
+ EL_DX_SUPABOMB
};
static int ep_can_smash_num = sizeof(ep_can_smash)/sizeof(int);
static int ep_can_change[] =
{
EL_FELSBROCKEN,
+ EL_BD_ROCK,
EL_EDELSTEIN,
EL_EDELSTEIN_BD,
EL_EDELSTEIN_GELB,
EL_MAMPFER2,
EL_ROBOT,
EL_PACMAN,
- EL_MAULWURF,
+ EL_MOLE,
EL_PINGUIN,
EL_SCHWEIN,
EL_DRACHE,
- EL_SONDE
+ EL_SONDE,
+ EL_SP_SNIKSNAK,
+ EL_SP_ELECTRON,
+ EL_BALLOON,
+ EL_SPRING_MOVING
};
static int ep_can_move_num = sizeof(ep_can_move)/sizeof(int);
static int ep_could_move[] =
{
- EL_KAEFER_R,
- EL_KAEFER_O,
- EL_KAEFER_L,
- EL_KAEFER_U,
- EL_FLIEGER_R,
- EL_FLIEGER_O,
- EL_FLIEGER_L,
- EL_FLIEGER_U,
- EL_BUTTERFLY_R,
- EL_BUTTERFLY_O,
- EL_BUTTERFLY_L,
- EL_BUTTERFLY_U,
- EL_FIREFLY_R,
- EL_FIREFLY_O,
- EL_FIREFLY_L,
- EL_FIREFLY_U,
- EL_PACMAN_R,
- EL_PACMAN_O,
- EL_PACMAN_L,
- EL_PACMAN_U
+ EL_KAEFER_RIGHT,
+ EL_KAEFER_UP,
+ EL_KAEFER_LEFT,
+ EL_KAEFER_DOWN,
+ EL_FLIEGER_RIGHT,
+ EL_FLIEGER_UP,
+ EL_FLIEGER_LEFT,
+ EL_FLIEGER_DOWN,
+ EL_BUTTERFLY_RIGHT,
+ EL_BUTTERFLY_UP,
+ EL_BUTTERFLY_LEFT,
+ EL_BUTTERFLY_DOWN,
+ EL_FIREFLY_RIGHT,
+ EL_FIREFLY_UP,
+ EL_FIREFLY_LEFT,
+ EL_FIREFLY_DOWN,
+ EL_PACMAN_RIGHT,
+ EL_PACMAN_UP,
+ EL_PACMAN_LEFT,
+ EL_PACMAN_DOWN
};
static int ep_could_move_num = sizeof(ep_could_move)/sizeof(int);
EL_ROBOT,
EL_PACMAN,
EL_TROPFEN,
- EL_SALZSAEURE
+ EL_SALZSAEURE,
+ EL_SP_SNIKSNAK,
+ EL_SP_ELECTRON,
+ EL_SP_BUG_ACTIVE,
+ EL_TRAP_ACTIVE,
+ EL_LANDMINE
};
static int ep_dont_go_to_num = sizeof(ep_dont_go_to)/sizeof(int);
EL_EDELSTEIN_GELB,
EL_EDELSTEIN_ROT,
EL_EDELSTEIN_LILA,
- EL_DIAMANT
+ EL_DIAMANT,
+ EL_PEARL,
+ EL_CRYSTAL
};
static int ep_mampf2_num = sizeof(ep_mampf2)/sizeof(int);
EL_LEERRAUM,
EL_ERDREICH,
EL_FELSBODEN,
+ EL_BD_WALL,
EL_FELSBROCKEN,
+ EL_BD_ROCK,
EL_EDELSTEIN_BD,
- EL_SIEB2_LEER,
+ EL_MAGIC_WALL_BD_OFF,
EL_AUSGANG_ZU,
EL_AUSGANG_AUF,
EL_BETON,
EL_SOKOBAN_OBJEKT,
EL_SOKOBAN_FELD_LEER,
EL_SOKOBAN_FELD_VOLL,
- EL_SPIELFIGUR
+ EL_SPIELFIGUR,
+ EL_INVISIBLE_STEEL
};
static int ep_sb_element_num = sizeof(ep_sb_element)/sizeof(int);
EL_EDELSTEIN_GELB,
EL_EDELSTEIN_ROT,
EL_EDELSTEIN_LILA,
- EL_DIAMANT
+ EL_DIAMANT,
+ EL_SP_INFOTRON
};
static int ep_gem_num = sizeof(ep_gem)/sizeof(int);
EL_LEERRAUM,
EL_ERDREICH,
EL_MAUERWERK,
+ EL_BD_WALL,
EL_FELSBODEN,
EL_SCHLUESSEL,
EL_BETON,
EL_SCHLUESSEL2,
EL_SCHLUESSEL3,
EL_SCHLUESSEL4,
+ EL_EM_KEY_1,
+ EL_EM_KEY_2,
+ EL_EM_KEY_3,
+ EL_EM_KEY_4,
EL_PFORTE1,
EL_PFORTE2,
EL_PFORTE3,
EL_PFORTE2X,
EL_PFORTE3X,
EL_PFORTE4X,
- EL_DYNAMIT_AUS,
+ EL_EM_GATE_1,
+ EL_EM_GATE_2,
+ EL_EM_GATE_3,
+ EL_EM_GATE_4,
+ EL_EM_GATE_1X,
+ EL_EM_GATE_2X,
+ EL_EM_GATE_3X,
+ EL_EM_GATE_4X,
+ EL_DYNAMITE_INACTIVE,
EL_UNSICHTBAR,
EL_BIRNE_AUS,
EL_BIRNE_EIN,
EL_BADEWANNE3,
EL_BADEWANNE4,
EL_BADEWANNE5,
- EL_SIEB_TOT,
- EL_SIEB2_TOT,
+ EL_MAGIC_WALL_OFF,
+ EL_MAGIC_WALL_DEAD,
+ EL_MAGIC_WALL_BD_OFF,
+ EL_MAGIC_WALL_BD_DEAD,
EL_AMOEBA2DIAM,
- EL_BLOCKED
+ EL_BLOCKED,
+ EL_SP_EMPTY,
+ EL_SP_BASE,
+ EL_SP_PORT1_RIGHT,
+ EL_SP_PORT1_DOWN,
+ EL_SP_PORT1_LEFT,
+ EL_SP_PORT1_UP,
+ EL_SP_PORT2_RIGHT,
+ EL_SP_PORT2_DOWN,
+ EL_SP_PORT2_LEFT,
+ EL_SP_PORT2_UP,
+ EL_SP_PORT_X,
+ EL_SP_PORT_Y,
+ EL_SP_PORT_XY,
+ EL_SP_DISK_RED,
+ EL_SP_DISK_YELLOW,
+ EL_SP_CHIP_SINGLE,
+ EL_SP_CHIP_LEFT,
+ EL_SP_CHIP_RIGHT,
+ EL_SP_CHIP_UPPER,
+ EL_SP_CHIP_LOWER,
+ EL_SP_HARD_GRAY,
+ EL_SP_HARD_GREEN,
+ EL_SP_HARD_BLUE,
+ EL_SP_HARD_RED,
+ EL_SP_HARD_YELLOW,
+ EL_SP_HARD_BASE1,
+ EL_SP_HARD_BASE2,
+ EL_SP_HARD_BASE3,
+ EL_SP_HARD_BASE4,
+ EL_SP_HARD_BASE5,
+ EL_SP_HARD_BASE6,
+ EL_SP_EXIT,
+ EL_INVISIBLE_STEEL,
+ EL_BELT1_SWITCH_LEFT,
+ EL_BELT1_SWITCH_MIDDLE,
+ EL_BELT1_SWITCH_RIGHT,
+ EL_BELT2_SWITCH_LEFT,
+ EL_BELT2_SWITCH_MIDDLE,
+ EL_BELT2_SWITCH_RIGHT,
+ EL_BELT3_SWITCH_LEFT,
+ EL_BELT3_SWITCH_MIDDLE,
+ EL_BELT3_SWITCH_RIGHT,
+ EL_BELT4_SWITCH_LEFT,
+ EL_BELT4_SWITCH_MIDDLE,
+ EL_BELT4_SWITCH_RIGHT,
+ EL_SIGN_EXCLAMATION,
+ EL_SIGN_RADIOACTIVITY,
+ EL_SIGN_STOP,
+ EL_SIGN_WHEELCHAIR,
+ EL_SIGN_PARKING,
+ EL_SIGN_ONEWAY,
+ EL_SIGN_HEART,
+ EL_SIGN_TRIANGLE,
+ EL_SIGN_ROUND,
+ EL_SIGN_EXIT,
+ EL_SIGN_YINYANG,
+ EL_SIGN_OTHER,
+ EL_STEEL_SLANTED,
+ EL_EMC_STEEL_WALL_1,
+ EL_EMC_STEEL_WALL_2,
+ EL_EMC_STEEL_WALL_3,
+ EL_EMC_STEEL_WALL_4,
+ EL_EMC_WALL_1,
+ EL_EMC_WALL_2,
+ EL_EMC_WALL_3,
+ EL_EMC_WALL_4,
+ EL_EMC_WALL_5,
+ EL_EMC_WALL_6,
+ EL_EMC_WALL_7,
+ EL_EMC_WALL_8
};
static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
static int ep_explosive[] =
{
EL_BOMBE,
- EL_DYNAMIT,
- EL_DYNAMIT_AUS,
- EL_DYNABOMB,
+ EL_DYNAMITE_ACTIVE,
+ EL_DYNAMITE_INACTIVE,
+ EL_DYNABOMB_ACTIVE_1,
+ EL_DYNABOMB_ACTIVE_2,
+ EL_DYNABOMB_ACTIVE_3,
+ EL_DYNABOMB_ACTIVE_4,
EL_DYNABOMB_NR,
EL_DYNABOMB_SZ,
EL_DYNABOMB_XL,
EL_KAEFER,
- EL_MAULWURF,
+ EL_MOLE,
EL_PINGUIN,
EL_SCHWEIN,
EL_DRACHE,
- EL_SONDE
+ EL_SONDE,
+ EL_SP_DISK_RED,
+ EL_SP_DISK_ORANGE,
+ EL_SP_DISK_YELLOW,
+ EL_SP_SNIKSNAK,
+ EL_SP_ELECTRON,
+ EL_DX_SUPABOMB
};
static int ep_explosive_num = sizeof(ep_explosive)/sizeof(int);
EL_EDELSTEIN_GELB,
EL_EDELSTEIN_ROT,
EL_EDELSTEIN_LILA,
- EL_DIAMANT
+ EL_DIAMANT,
+ EL_PEARL,
+ EL_CRYSTAL
};
static int ep_mampf3_num = sizeof(ep_mampf3)/sizeof(int);
static int ep_pushable[] =
{
EL_FELSBROCKEN,
+ EL_BD_ROCK,
EL_BOMBE,
EL_KOKOSNUSS,
EL_ZEIT_LEER,
EL_SOKOBAN_FELD_VOLL,
EL_SOKOBAN_OBJEKT,
- EL_SONDE
+ EL_SONDE,
+ EL_SP_ZONK,
+ EL_SP_DISK_ORANGE,
+ EL_SP_DISK_YELLOW,
+ EL_BALLOON,
+ EL_SPRING,
+ EL_DX_SUPABOMB
};
static int ep_pushable_num = sizeof(ep_pushable)/sizeof(int);
};
static int ep_player_num = sizeof(ep_player)/sizeof(int);
- static long ep_bit[] =
+ static int ep_has_content[] =
+ {
+ EL_MAMPFER,
+ EL_AMOEBE_NASS,
+ EL_AMOEBE_NORM,
+ EL_AMOEBE_VOLL,
+ EL_AMOEBE_BD
+ };
+ static int ep_has_content_num = sizeof(ep_has_content)/sizeof(int);
+
+ static int ep_eatable[] =
+ {
+ EL_ERDREICH,
+ EL_SP_BASE,
+ EL_SP_BUG,
+ EL_TRAP_INACTIVE,
+ EL_SAND_INVISIBLE
+ };
+ static int ep_eatable_num = sizeof(ep_eatable)/sizeof(int);
+
+ static int ep_sp_element[] =
+ {
+ EL_SP_EMPTY,
+ EL_SP_ZONK,
+ EL_SP_BASE,
+ EL_SP_MURPHY,
+ EL_SP_INFOTRON,
+ EL_SP_CHIP_SINGLE,
+ EL_SP_HARD_GRAY,
+ EL_SP_EXIT,
+ EL_SP_DISK_ORANGE,
+ EL_SP_PORT1_RIGHT,
+ EL_SP_PORT1_DOWN,
+ EL_SP_PORT1_LEFT,
+ EL_SP_PORT1_UP,
+ EL_SP_PORT2_RIGHT,
+ EL_SP_PORT2_DOWN,
+ EL_SP_PORT2_LEFT,
+ EL_SP_PORT2_UP,
+ EL_SP_SNIKSNAK,
+ EL_SP_DISK_YELLOW,
+ EL_SP_TERMINAL,
+ EL_SP_DISK_RED,
+ EL_SP_PORT_Y,
+ EL_SP_PORT_X,
+ EL_SP_PORT_XY,
+ EL_SP_ELECTRON,
+ EL_SP_BUG,
+ EL_SP_CHIP_LEFT,
+ EL_SP_CHIP_RIGHT,
+ EL_SP_HARD_BASE1,
+ EL_SP_HARD_GREEN,
+ EL_SP_HARD_BLUE,
+ EL_SP_HARD_RED,
+ EL_SP_HARD_YELLOW,
+ EL_SP_HARD_BASE2,
+ EL_SP_HARD_BASE3,
+ EL_SP_HARD_BASE4,
+ EL_SP_HARD_BASE5,
+ EL_SP_HARD_BASE6,
+ EL_SP_CHIP_UPPER,
+ EL_SP_CHIP_LOWER,
+ /* additional elements that appeared in newer Supaplex levels */
+ EL_UNSICHTBAR,
+ /* more than one murphy in a level results in an inactive clone */
+ EL_SP_MURPHY_CLONE
+ };
+ static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int);
+
+ static int ep_quick_gate[] =
+ {
+ EL_EM_GATE_1,
+ EL_EM_GATE_2,
+ EL_EM_GATE_3,
+ EL_EM_GATE_4,
+ EL_EM_GATE_1X,
+ EL_EM_GATE_2X,
+ EL_EM_GATE_3X,
+ EL_EM_GATE_4X,
+ EL_SP_PORT1_LEFT,
+ EL_SP_PORT2_LEFT,
+ EL_SP_PORT1_RIGHT,
+ EL_SP_PORT2_RIGHT,
+ EL_SP_PORT1_UP,
+ EL_SP_PORT2_UP,
+ EL_SP_PORT1_DOWN,
+ EL_SP_PORT2_DOWN,
+ EL_SP_PORT_X,
+ EL_SP_PORT_Y,
+ EL_SP_PORT_XY,
+ EL_SWITCHGATE_OPEN,
+ EL_TIMEGATE_OPEN
+ };
+ static int ep_quick_gate_num = sizeof(ep_quick_gate)/sizeof(int);
+
+ static int ep_over_player[] =
+ {
+ EL_SP_PORT1_LEFT,
+ EL_SP_PORT2_LEFT,
+ EL_SP_PORT1_RIGHT,
+ EL_SP_PORT2_RIGHT,
+ EL_SP_PORT1_UP,
+ EL_SP_PORT2_UP,
+ EL_SP_PORT1_DOWN,
+ EL_SP_PORT2_DOWN,
+ EL_SP_PORT_X,
+ EL_SP_PORT_Y,
+ EL_SP_PORT_XY,
+ EL_TUBE_CROSS,
+ EL_TUBE_VERTICAL,
+ EL_TUBE_HORIZONTAL,
+ EL_TUBE_VERT_LEFT,
+ EL_TUBE_VERT_RIGHT,
+ EL_TUBE_HORIZ_UP,
+ EL_TUBE_HORIZ_DOWN,
+ EL_TUBE_LEFT_UP,
+ EL_TUBE_LEFT_DOWN,
+ EL_TUBE_RIGHT_UP,
+ EL_TUBE_RIGHT_DOWN
+ };
+ static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int);
+
+ static int ep_active_bomb[] =
+ {
+ EL_DYNAMITE_ACTIVE,
+ EL_DYNABOMB_ACTIVE_1,
+ EL_DYNABOMB_ACTIVE_2,
+ EL_DYNABOMB_ACTIVE_3,
+ EL_DYNABOMB_ACTIVE_4
+ };
+ static int ep_active_bomb_num = sizeof(ep_active_bomb)/sizeof(int);
+
+ static int ep_belt[] =
+ {
+ EL_BELT1_LEFT,
+ EL_BELT1_MIDDLE,
+ EL_BELT1_RIGHT,
+ EL_BELT2_LEFT,
+ EL_BELT2_MIDDLE,
+ EL_BELT2_RIGHT,
+ EL_BELT3_LEFT,
+ EL_BELT3_MIDDLE,
+ EL_BELT3_RIGHT,
+ EL_BELT4_LEFT,
+ EL_BELT4_MIDDLE,
+ EL_BELT4_RIGHT,
+ };
+ static int ep_belt_num = sizeof(ep_belt)/sizeof(int);
+
+ static int ep_belt_switch[] =
+ {
+ EL_BELT1_SWITCH_LEFT,
+ EL_BELT1_SWITCH_MIDDLE,
+ EL_BELT1_SWITCH_RIGHT,
+ EL_BELT2_SWITCH_LEFT,
+ EL_BELT2_SWITCH_MIDDLE,
+ EL_BELT2_SWITCH_RIGHT,
+ EL_BELT3_SWITCH_LEFT,
+ EL_BELT3_SWITCH_MIDDLE,
+ EL_BELT3_SWITCH_RIGHT,
+ EL_BELT4_SWITCH_LEFT,
+ EL_BELT4_SWITCH_MIDDLE,
+ EL_BELT4_SWITCH_RIGHT,
+ };
+ static int ep_belt_switch_num = sizeof(ep_belt_switch)/sizeof(int);
+
+ static int ep_tube[] =
+ {
+ EL_TUBE_CROSS,
+ EL_TUBE_VERTICAL,
+ EL_TUBE_HORIZONTAL,
+ EL_TUBE_VERT_LEFT,
+ EL_TUBE_VERT_RIGHT,
+ EL_TUBE_HORIZ_UP,
+ EL_TUBE_HORIZ_DOWN,
+ EL_TUBE_LEFT_UP,
+ EL_TUBE_LEFT_DOWN,
+ EL_TUBE_RIGHT_UP,
+ EL_TUBE_RIGHT_DOWN
+ };
+ static int ep_tube_num = sizeof(ep_tube)/sizeof(int);
+
+ static long ep1_bit[] =
{
EP_BIT_AMOEBALIVE,
EP_BIT_AMOEBOID,
EP_BIT_SCHLUESSEL,
EP_BIT_PFORTE,
EP_BIT_SOLID,
- EP_BIT_MASSIV,
+ EP_BIT_MASSIVE,
EP_BIT_SLIPPERY,
EP_BIT_ENEMY,
EP_BIT_MAUER,
EP_BIT_EXPLOSIVE,
EP_BIT_MAMPF3,
EP_BIT_PUSHABLE,
- EP_BIT_PLAYER
+ EP_BIT_PLAYER,
+ EP_BIT_HAS_CONTENT,
+ EP_BIT_EATABLE,
+ EP_BIT_SP_ELEMENT,
+ EP_BIT_QUICK_GATE,
+ EP_BIT_OVER_PLAYER,
+ EP_BIT_ACTIVE_BOMB
+ };
+ static long ep2_bit[] =
+ {
+ EP_BIT_BELT,
+ EP_BIT_BELT_SWITCH,
+ EP_BIT_TUBE
};
- static int *ep_array[] =
+ static int *ep1_array[] =
{
ep_amoebalive,
ep_amoeboid,
ep_schluessel,
ep_pforte,
ep_solid,
- ep_massiv,
+ ep_massive,
ep_slippery,
ep_enemy,
ep_mauer,
ep_explosive,
ep_mampf3,
ep_pushable,
- ep_player
+ ep_player,
+ ep_has_content,
+ ep_eatable,
+ ep_sp_element,
+ ep_quick_gate,
+ ep_over_player,
+ ep_active_bomb
};
- static int *ep_num[] =
+ static int *ep2_array[] =
+ {
+ ep_belt,
+ ep_belt_switch,
+ ep_tube
+ };
+ static int *ep1_num[] =
{
&ep_amoebalive_num,
&ep_amoeboid_num,
&ep_schluessel_num,
&ep_pforte_num,
&ep_solid_num,
- &ep_massiv_num,
+ &ep_massive_num,
&ep_slippery_num,
&ep_enemy_num,
&ep_mauer_num,
&ep_explosive_num,
&ep_mampf3_num,
&ep_pushable_num,
- &ep_player_num
+ &ep_player_num,
+ &ep_has_content_num,
+ &ep_eatable_num,
+ &ep_sp_element_num,
+ &ep_quick_gate_num,
+ &ep_over_player_num,
+ &ep_active_bomb_num
};
- static int num_properties = sizeof(ep_num)/sizeof(int *);
+ static int *ep2_num[] =
+ {
+ &ep_belt_num,
+ &ep_belt_switch_num,
+ &ep_tube_num
+ };
+ static int num_properties1 = sizeof(ep1_num)/sizeof(int *);
+ static int num_properties2 = sizeof(ep2_num)/sizeof(int *);
+
+ for(i=0; i<MAX_ELEMENTS; i++)
+ {
+ Elementeigenschaften1[i] = 0;
+ Elementeigenschaften2[i] = 0;
+ }
- for(i=0;i<MAX_ELEMENTS;i++)
- Elementeigenschaften[i] = 0;
+ for(i=0; i<num_properties1; i++)
+ for(j=0; j<*(ep1_num[i]); j++)
+ Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
+ for(i=0; i<num_properties2; i++)
+ for(j=0; j<*(ep2_num[i]); j++)
+ Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
- for(i=0;i<num_properties;i++)
- for(j=0;j<*(ep_num[i]);j++)
- Elementeigenschaften[(ep_array[i])[j]] |= ep_bit[i];
- for(i=EL_CHAR_START;i<EL_CHAR_END;i++)
- Elementeigenschaften[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
+ for(i=EL_CHAR_START; i<EL_CHAR_END; i++)
+ Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
}
-void CloseAll()
+void CloseAllAndExit(int exit_value)
{
int i;
+#ifdef USE_SDL_LIBRARY
+ StopSounds();
+ FreeSounds(NUM_SOUNDS);
+#else
if (sound_process_id)
{
StopSounds();
kill(sound_process_id, SIGTERM);
FreeSounds(NUM_SOUNDS);
}
+#endif
- for(i=0;i<NUM_PIXMAPS;i++)
+ for(i=0; i<NUM_BITMAPS; i++)
{
if (pix[i])
{
-#ifdef XPM_INCLUDE_FILE
- if (i<NUM_PICTURES) /* XPM pictures */
+#ifdef USE_XPM_LIBRARY
+ if (i < NUM_PICTURES) /* XPM pictures */
{
XFreeColors(display,DefaultColormap(display,screen),
xpm_att[i].pixels,xpm_att[i].npixels,0);
XpmFreeAttributes(&xpm_att[i]);
}
#endif
+
+#ifdef USE_SDL_LIBRARY
+ SDL_FreeSurface(pix[i]);
+#else
XFreePixmap(display,pix[i]);
+#endif
}
+
+#ifdef USE_SDL_LIBRARY
+ SDL_FreeSurface(pix_masked[i]);
+#else
if (clipmask[i])
XFreePixmap(display,clipmask[i]);
if (clip_gc[i])
XFreeGC(display, clip_gc[i]);
+#endif
}
+#ifdef USE_SDL_LIBRARY
+ KeyboardAutoRepeatOn();
+#else
if (gc)
XFreeGC(display, gc);
if (display)
{
- XAutoRepeatOn(display);
+ KeyboardAutoRepeatOn();
XCloseDisplay(display);
}
+#endif
+
+#ifdef MSDOS
+ dumpErrorFile();
+#endif
- exit(0);
+ exit(exit_value);
}