SRC_DIR = src
MAKE_CMD = $(MAKE) -C $(SRC_DIR)
-# DEFAULT_TARGET = x11
-DEFAULT_TARGET = sdl
+DEFAULT_TARGET = x11
+# DEFAULT_TARGET = sdl
# -----------------------------------------------------------------------------
msdos:
@$(MAKE_CMD) PLATFORM=msdos
+os2:
+ @$(MAKE_CMD) PLATFORM=os2
+
cross-msdos:
@PATH=$(CROSS_PATH_MSDOS)/bin:${PATH} $(MAKE_CMD) PLATFORM=cross-msdos
TARGET=sdl
endif
+ifeq ($(PLATFORM),os2)
+RANLIB = echo
+PROGNAME = ../$(PROGBASE).exe
+EXTRA_CFLAGS = -Zbin-files -D__ST_MT_ERRNO__ -Zmtd -fomit-frame-pointer
+EXTRA_LDFLAGS = -lsocket
+PLATFORM = unix
+TARGET=x11
+endif
+
ifeq ($(PLATFORM),unix)
PROFILING_FLAGS = -pg
endif
ifeq ($(TARGET),x11)
SYS_CFLAGS = -DTARGET_X11 $(X11_INCL)
-SYS_LDFLAGS = $(X11_LIBS) -lX11
+# SYS_LDFLAGS = $(X11_LIBS) -lX11
+SYS_LDFLAGS = $(XLIB_PATH)/libX11.a
endif
ifeq ($(TARGET),sdl)
OPTIONS = -O3 -Wall
endif
-CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(CONFIG)
-LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) -lm
+CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(EXTRA_CFLAGS) $(CONFIG)
+LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS) -lm
SRCS = main.c \
-#define COMPILE_DATE_STRING "[2004-02-05 03:42]"
+#define COMPILE_DATE_STRING "[2004-02-06 15:14]"
element_info[element].slippery_type = SLIPPERY_ANY_RANDOM;
+ element_info[element].explosion_delay = 0;
+ element_info[element].ignition_delay = 0;
+
for (x = 0; x < 3; x++)
for (y = 0; y < 3; y++)
element_info[element].content[x][y] = EL_EMPTY_SPACE;
(condition) || \
(DONT_COLLIDE_WITH(e) && \
IS_PLAYER(x, y) && \
- !PLAYER_PROTECTED(x, y))))
+ !PLAYER_ENEMY_PROTECTED(x, y))))
#else
#define ELEMENT_CAN_ENTER_FIELD_GENERIC(e, x, y, condition) \
(IN_LEV_FIELD(x, y) && (IS_FREE(x, y) || \
static void InitBeltMovement(void);
static void CloseAllOpenTimegates(void);
static void CheckGravityMovement(struct PlayerInfo *);
-static void KillHeroUnlessProtected(int, int);
+static void KillHeroUnlessEnemyProtected(int, int);
+static void KillHeroUnlessExplosionProtected(int, int);
static void TestIfPlayerTouchesCustomElement(int, int);
static void TestIfElementTouchesCustomElement(int, int);
RemoveField(x, y);
#endif
- if (IS_PLAYER(ex, ey) && !PLAYER_PROTECTED(ex, ey))
+ if (IS_PLAYER(ex, ey) && !PLAYER_EXPLOSION_PROTECTED(ex, ey))
{
switch(StorePlayer[ex][ey])
{
int element = Store2[x][y];
if (IS_PLAYER(x, y))
- KillHeroUnlessProtected(x, y);
+ KillHeroUnlessExplosionProtected(x, y);
else if (CAN_EXPLODE_BY_FIRE(element))
{
Feld[x][y] = Store2[x][y];
#endif
#if 1
- if (IS_PLAYER(x, y) && !PLAYER_PROTECTED(x, y))
+ if (IS_PLAYER(x, y) && !PLAYER_EXPLOSION_PROTECTED(x, y))
#else
if (IS_PLAYER(x, y))
#endif
if (impact && element == EL_AMOEBA_DROP)
{
if (object_hit && IS_PLAYER(x, y + 1))
- KillHeroUnlessProtected(x, y + 1);
+ KillHeroUnlessEnemyProtected(x, y + 1);
else if (object_hit && smashed == EL_PENGUIN)
Bang(x, y + 1);
else
{
if (CAN_SMASH_PLAYER(element))
{
- KillHeroUnlessProtected(x, y + 1);
+ KillHeroUnlessEnemyProtected(x, y + 1);
return;
}
}
if (DONT_COLLIDE_WITH(element) &&
IN_LEV_FIELD(newx, newy) && IS_PLAYER(newx, newy) &&
- !PLAYER_PROTECTED(newx, newy))
+ !PLAYER_ENEMY_PROTECTED(newx, newy))
{
#if 1
TestIfBadThingRunsIntoHero(x, y, MovDir[x][y]);
#if 0
if (IN_LEV_FIELD(nextx, nexty))
{
- static int opposite_directions[] =
- {
- MV_RIGHT,
- MV_LEFT,
- MV_DOWN,
- MV_UP
- };
- int move_dir_bit = MV_DIR_BIT(direction);
- int opposite_direction = opposite_directions[move_dir_bit];
+ int opposite_direction = MV_DIR_OPPOSITE(direction);
int hitting_side = direction;
int touched_side = opposite_direction;
int touched_element = MovingOrBlocked2Element(nextx, nexty);
/* check if element under player changes from accessible to unaccessible
(needed for special case of dropping element which then changes) */
- if (IS_PLAYER(x, y) && !PLAYER_PROTECTED(x, y) &&
+ if (IS_PLAYER(x, y) && !PLAYER_EXPLOSION_PROTECTED(x, y) &&
IS_ACCESSIBLE(Feld[x][y]) && !IS_ACCESSIBLE(target_element))
{
Bang(x, y);
if (IN_LEV_FIELD(hitx, hity))
{
- static int opposite_directions[] =
- {
- MV_RIGHT,
- MV_LEFT,
- MV_DOWN,
- MV_UP
- };
- int move_dir_bit = MV_DIR_BIT(direction);
- int opposite_direction = opposite_directions[move_dir_bit];
+ int opposite_direction = MV_DIR_OPPOSITE(direction);
int hitting_side = direction;
int touched_side = opposite_direction;
int touched_element = MovingOrBlocked2Element(hitx, hity);
if (player->shield_deadly_time_left > 0)
Bang(kill_x, kill_y);
- else if (!PLAYER_PROTECTED(good_x, good_y))
+ else if (!PLAYER_ENEMY_PROTECTED(good_x, good_y))
KillHero(player);
}
else
if (player->shield_deadly_time_left > 0)
Bang(bad_x, bad_y);
- else if (!PLAYER_PROTECTED(kill_x, kill_y))
+ else if (!PLAYER_ENEMY_PROTECTED(kill_x, kill_y))
KillHero(player);
}
else
BuryHero(player);
}
-static void KillHeroUnlessProtected(int x, int y)
+static void KillHeroUnlessEnemyProtected(int x, int y)
+{
+ if (!PLAYER_ENEMY_PROTECTED(x, y))
+ KillHero(PLAYERINFO(x, y));
+}
+
+static void KillHeroUnlessExplosionProtected(int x, int y)
{
- if (!PLAYER_PROTECTED(x, y))
+ if (!PLAYER_EXPLOSION_PROTECTED(x, y))
KillHero(PLAYERINFO(x, y));
}
-1
};
+ static int ep_protected[] =
+ {
+ -1
+ };
+
static int ep_player[] =
{
EL_PLAYER_1,
{ ep_can_explode_1x1, EP_CAN_EXPLODE_1X1 },
{ ep_pushable, EP_PUSHABLE },
{ ep_can_explode_dyna, EP_CAN_EXPLODE_DYNA },
+ { ep_protected, EP_PROTECTED },
{ ep_player, EP_PLAYER },
{ ep_can_pass_magic_wall, EP_CAN_PASS_MAGIC_WALL },
SET_PROPERTY(i, EP_DRAGONFIRE_PROOF, (IS_CUSTOM_ELEMENT(i) &&
IS_INDESTRUCTIBLE(i)));
+ /* ---------- PROTECTED ------------------------------------------------ */
+ if (IS_ACCESSIBLE_INSIDE(i))
+ SET_PROPERTY(i, EP_PROTECTED, TRUE);
+
/* ---------- EXPLOSION_PROOF ------------------------------------------ */
if (i == EL_FLAMES)
SET_PROPERTY(i, EP_EXPLOSION_PROOF, TRUE);
SET_PROPERTY(i, EP_EXPLOSION_PROOF, IS_INDESTRUCTIBLE(i));
else
SET_PROPERTY(i, EP_EXPLOSION_PROOF, (IS_INDESTRUCTIBLE(i) &&
- !IS_WALKABLE_OVER(i) &&
- !IS_WALKABLE_UNDER(i)));
+ IS_PROTECTED(i)));
if (IS_CUSTOM_ELEMENT(i))
{
XPutImage(ximageinfo->display, ximageinfo->pixmap, gc,
ximage, 0, 0, 0, 0, ximage->width, ximage->height);
- XDestroyImage(ximage);
+ X11DestroyImage(ximage);
return ximageinfo;
}
dst_width, dst_height);
/* free temporary images */
- XDestroyImage(src_ximage);
- XDestroyImage(dst_ximage);
+ X11DestroyImage(src_ximage);
+ X11DestroyImage(dst_ximage);
}
void freeXImage(Image *image, XImageInfo *ximageinfo)
(x) == MV_RIGHT ? MV_BIT_RIGHT : \
(x) == MV_UP ? MV_BIT_UP : MV_BIT_DOWN)
+#define MV_DIR_OPPOSITE(x) ((x) == MV_LEFT ? MV_RIGHT : \
+ (x) == MV_RIGHT ? MV_LEFT : \
+ (x) == MV_UP ? MV_DOWN : \
+ (x) == MV_DOWN ? MV_UP : MV_NO_MOVING)
+
/* values for animation mode (frame order and direction) */
#define ANIM_NONE 0
AllPlanes, ZPixmap);
pixel_value = XGetPixel(pixel_image, 0, 0);
- XDestroyImage(pixel_image);
+ X11DestroyImage(pixel_image);
return pixel_value;
}
}
#endif /* TARGET_X11_NATIVE */
+inline void X11DestroyImage(XImage *ximage)
+{
+ /* this seems to be needed for OS/2, but does not hurt on other platforms */
+ if (ximage->data != NULL)
+ {
+ free(ximage->data);
+ ximage->data = NULL;
+ }
+
+ XDestroyImage(ximage);
+}
+
/* ------------------------------------------------------------------------- */
/* mouse pointer functions */
inline void X11DrawSimpleLine(Bitmap *, int, int, int, int, Pixel);
inline Pixel X11GetPixel(Bitmap *, int, int);
inline Pixel X11GetPixelFromRGB(unsigned int, unsigned int, unsigned int);
+inline void X11DestroyImage(XImage *);
#if defined(TARGET_X11_NATIVE)
void X11SetMouseCursor(struct MouseCursorInfo *);
#define PLAYERINFO(x,y) (&stored_player[StorePlayer[x][y]-EL_PLAYER_1])
#define SHIELD_ON(p) ((p)->shield_normal_time_left > 0)
+
+#if 1
+#define ENEMY_PROTECTED_FIELD(x,y) (IS_PROTECTED(Feld[x][y]) || \
+ IS_PROTECTED(Back[x][y]))
+#define EXPLOSION_PROTECTED_FIELD(x,y) (IS_EXPLOSION_PROOF(Feld[x][y]))
+#define PLAYER_ENEMY_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) || \
+ ENEMY_PROTECTED_FIELD(x, y))
+#define PLAYER_EXPLOSION_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) || \
+ EXPLOSION_PROTECTED_FIELD(x, y))
+#else
#define PROTECTED_FIELD(x,y) (IS_ACCESSIBLE_INSIDE(Feld[x][y]) && \
IS_INDESTRUCTIBLE(Feld[x][y]))
#define PLAYER_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) || \
PROTECTED_FIELD(x, y))
+#endif
#define PLAYER_SWITCHING(p,x,y) ((p)->is_switching && \
(p)->switch_x == (x) && (p)->switch_y == (y))
int content[3][3]; /* new elements after explosion */
+ int explosion_delay; /* duration of explosion of this element */
+ int ignition_delay; /* delay for explosion by other explosion */
+
struct ElementChangeInfo *change_page; /* actual list of change pages */
struct ElementChangeInfo *change; /* pointer to current change page */
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
+#include <sys/select.h> /* apparently needed by OS/2 */
#include "libgame/libgame.h"