#ifndef MAIN_H
#define MAIN_H
+#ifndef MSDOS
#define XK_MISCELLANY
#define XK_LATIN1
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include <X11/Xatom.h>
#include <X11/Xos.h>
#include <X11/Intrinsic.h>
#include <X11/keysymdef.h>
#ifdef XPM_INCLUDE_FILE
#include XPM_INCLUDE_FILE
#endif
+#else
+#include "msdos.h"
+#endif // von #ifndef MSDOS
#include <sys/types.h>
#include <sys/stat.h>
typedef int BOOL;
-#define TRUE 1
-#define FALSE 0
+#ifndef FALSE
+#define FALSE 0
+#define TRUE (!FALSE)
+#endif
-#define WIN_XPOS 0
-#define WIN_YPOS 0
#define WIN_XSIZE 672
#define WIN_YSIZE 560
+#ifndef MSDOS
+#define WIN_XPOS 0
+#define WIN_YPOS 0
+#else
+#define WIN_XPOS (XRES-WIN_XSIZE)/2
+#define WIN_YPOS (YRES-WIN_YSIZE)/2
+#endif
#define SCR_FIELDX 17
#define SCR_FIELDY 17
#define MAX_BUF_XSIZE (SCR_FIELDX + 2)
#define MAX_LEV_FIELDX 128
#define MAX_LEV_FIELDY 128
+#ifndef MIN
#define MIN(a,b) ((a)<(b) ? (a) : (b))
+#endif
+#ifndef MAX
#define MAX(a,b) ((a)>(b) ? (a) : (b))
+#endif
+#ifndef ABS
#define ABS(a) ((a)<0 ? -(a) : (a))
+#endif
+#ifndef SIGN
#define SIGN(a) ((a)<0 ? -1 : ((a)>0 ? 1 : 0))
+#endif
#define SCROLLX(a) ((a)-scroll_x)
#define SCROLLY(a) ((a)-scroll_y)
#define UNSCROLLX(a) ((a)+scroll_x)
#define IN_SCR_FIELD(x,y) ((x)>=BX1 && (x)<=BX2 && (y)>=BY1 &&(y)<=BY2)
#define IN_LEV_FIELD(x,y) ((x)>=0 && (x)<lev_fieldx && (y)>=0 &&(y)<lev_fieldy)
-/*
+
#define IS_PLAYER(x,y) (JX==(x) && JY==(y))
-*/
-#define IS_PLAYER(x,y) ((JX==(x) && JY==(y)) || (JX2==(x) && JY2==(y)))
+/*
+#define IS_PLAYER(x,y) ((JX==(x) && JY==(y)) || (lastJX==(x) && lastJY==(y)))
+*/
#define IS_FREE(x,y) (Feld[x][y]==EL_LEERRAUM && !IS_PLAYER(x,y))
#define IS_FREE_OR_PLAYER(x,y) (Feld[x][y]==EL_LEERRAUM)
};
extern Display *display;
+extern Visual *visual;
extern int screen;
extern Window window;
extern GC gc, clip_gc[];
extern int level_nr, leveldir_nr, num_leveldirs;
extern int lev_fieldx,lev_fieldy, scroll_x,scroll_y;
-extern int FX,FY, ScreenMovPos;
+extern int FX,FY, ScreenMovPos, ScrollStepSize;
extern int BX1,BY1, BX2,BY2;
-extern int JX,JY, JX2,JY2, ZX,ZY, ExitX,ExitY;
-extern int PlayerMovDir, PlayerMovPos, PlayerFrame, PlayerPushing;
+extern int JX,JY, lastJX,lastJY, ZX,ZY, ExitX,ExitY;
+extern int PlayerMovDir, PlayerMovPos, PlayerPushing;
+extern int PlayerFrame, PlayerGfxPos;
extern int PlayerGone,LevelSolved,GameOver;
extern int FrameCounter,TimeFrames,TimeLeft,Score;
extern int Gems,SokobanFields,Lights,Friends;
#define EL_AMOEBING 305
#define EL_MAUERND 306
#define EL_BURNING 307
+#define EL_PLAYER_IS_LEAVING 308
/* game graphics:
** 0 - 255: graphics from "RocksScreen"
#define JOYDAT_PATH GAME_DIR
#endif
+#ifndef MSDOS
#define SCORE_FILENAME "ROCKS.score"
#define NAMES_FILENAME "ROCKS.names"
#define LEVDIR_FILENAME "ROCKS.levelinfo"
#define JOYDAT_FILENAME "ROCKS.joystick"
+#else
+#define SCORE_FILENAME "ROCKS.sco"
+#define NAMES_FILENAME "ROCKS.nam"
+#define LEVDIR_FILENAME "ROCKS.lev"
+#define JOYDAT_FILENAME "ROCKS.joy"
+#endif
#define JOYDAT_FILE JOYDAT_PATH "/" JOYDAT_FILENAME
#define MB_MENU_MARK TRUE
#define MB_MENU_INITIALIZE (-1)
#define MB_LEFT 1
+#ifdef MSDOS
+#define MB_MIDDLE 4
+#define MB_RIGHT 2
+#else
#define MB_MIDDLE 2
#define MB_RIGHT 3
+#endif
/* values for key_status */
#define KEY_NOT_PRESSED FALSE
#define REDRAW_VIDEO_2 (1L<<5)
#define REDRAW_VIDEO_3 (1L<<6)
#define REDRAW_MICROLEV (1L<<7)
+#define REDRAW_FROM_BACKBUFFER (1L<<8)
#define REDRAW_DOOR_2 (REDRAW_VIDEO_1 | REDRAW_VIDEO_2 | REDRAW_VIDEO_3)
#define REDRAW_DOORS (REDRAW_DOOR_1 | REDRAW_DOOR_2)
#define REDRAW_MAIN (REDRAW_FIELD | REDRAW_TILES | REDRAW_MICROLEV)
/* für DrawGraphicAnimation (tools.c) und AnimateToon (cartoons.c) */
#define ANIM_NORMAL 0
#define ANIM_OSCILLATE 1
+#define ANIM_REVERSE 2
#endif