#ifndef MAIN_H
#define MAIN_H
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <fcntl.h>
#include "libgame/libgame.h"
+#include "game_em/game_em.h"
#include "conf_gfx.h" /* include auto-generated data structure definitions */
#include "conf_snd.h" /* include auto-generated data structure definitions */
+#include "conf_mus.h" /* include auto-generated data structure definitions */
#define IMG_UNDEFINED (-1)
#define IMG_EMPTY IMG_EMPTY_SPACE
#define IMG_CUSTOM_START IMG_CUSTOM_1
#define SND_UNDEFINED (-1)
+#define MUS_UNDEFINED (-1)
#define WIN_XSIZE 672
#define WIN_YSIZE 560
#define EP_CAN_SMASH_PLAYER 10
#define EP_CAN_SMASH_ENEMIES 11
#define EP_CAN_SMASH_EVERYTHING 12
-#define EP_CAN_EXPLODE_BY_FIRE 13
-#define EP_CAN_EXPLODE_SMASHED 14
-#define EP_CAN_EXPLODE_IMPACT 15
+#define EP_EXPLODES_BY_FIRE 13
+#define EP_EXPLODES_SMASHED 14
+#define EP_EXPLODES_IMPACT 15
#define EP_WALKABLE_OVER 16
#define EP_WALKABLE_INSIDE 17
#define EP_WALKABLE_UNDER 18
#define EP_PASSABLE_INSIDE 20
#define EP_PASSABLE_UNDER 21
#define EP_DROPPABLE 22
-#define EP_CAN_EXPLODE_1X1 23
+#define EP_EXPLODES_1X1_OLD 23
#define EP_PUSHABLE 24
-
-/* values for special configurable properties (depending on level settings) */
-#define EP_EM_SLIPPERY_WALL 32
-
-/* values for special graphics properties (no effect on game engine) */
-#define EP_CAN_BE_CRUMBLED 33
+#define EP_EXPLODES_CROSS_OLD 25
+#define EP_PROTECTED 26
+#define EP_CAN_MOVE_INTO_ACID 27
+#define EP_THROWABLE 28
+#define EP_CAN_EXPLODE 29
+#define EP_GRAVITY_REACHABLE 30
/* values for pre-defined properties */
-#define EP_PLAYER 34
-#define EP_CAN_PASS_MAGIC_WALL 35
-#define EP_SWITCHABLE 36
-#define EP_BD_ELEMENT 37
-#define EP_SP_ELEMENT 38
-#define EP_SB_ELEMENT 39
-#define EP_GEM 40
-#define EP_FOOD_DARK_YAMYAM 41
-#define EP_FOOD_PENGUIN 42
-#define EP_FOOD_PIG 43
-#define EP_HISTORIC_WALL 44
-#define EP_HISTORIC_SOLID 45
-#define EP_CLASSIC_ENEMY 46
-#define EP_BELT 47
-#define EP_BELT_ACTIVE 48
-#define EP_BELT_SWITCH 49
-#define EP_TUBE 50
-#define EP_KEYGATE 51
-#define EP_AMOEBOID 52
-#define EP_AMOEBALIVE 53
-#define EP_HAS_CONTENT 54
+#define EP_PLAYER 32
+#define EP_CAN_PASS_MAGIC_WALL 33
+#define EP_SWITCHABLE 34
+#define EP_BD_ELEMENT 35
+#define EP_SP_ELEMENT 36
+#define EP_SB_ELEMENT 37
+#define EP_GEM 38
+#define EP_FOOD_DARK_YAMYAM 39
+#define EP_FOOD_PENGUIN 40
+#define EP_FOOD_PIG 41
+#define EP_HISTORIC_WALL 42
+#define EP_HISTORIC_SOLID 43
+#define EP_CLASSIC_ENEMY 44
+#define EP_BELT 45
+#define EP_BELT_ACTIVE 46
+#define EP_BELT_SWITCH 47
+#define EP_TUBE 48
+#define EP_KEYGATE 49
+#define EP_AMOEBOID 50
+#define EP_AMOEBALIVE 51
+#define EP_HAS_CONTENT 52
+#define EP_CAN_TURN_EACH_MOVE 53
+#define EP_CAN_GROW 54
#define EP_ACTIVE_BOMB 55
#define EP_INACTIVE 56
+/* values for special configurable properties (depending on level settings) */
+#define EP_EM_SLIPPERY_WALL 57
+
+/* values for special graphics properties (no effect on game engine) */
+#define EP_GFX_CRUMBLED 58
+
/* values for derived properties (determined from properties above) */
-#define EP_ACCESSIBLE_OVER 57
-#define EP_ACCESSIBLE_INSIDE 58
-#define EP_ACCESSIBLE_UNDER 59
-#define EP_WALKABLE 60
-#define EP_PASSABLE 61
-#define EP_ACCESSIBLE 62
-#define EP_COLLECTIBLE 63
-#define EP_SNAPPABLE 64
-#define EP_WALL 65
-#define EP_SOLID_FOR_PUSHING 66
-#define EP_DRAGONFIRE_PROOF 67
-#define EP_EXPLOSION_PROOF 68
-#define EP_CAN_SMASH 69
-#define EP_CAN_EXPLODE 70
-#define EP_CAN_EXPLODE_3X3 71
+#define EP_ACCESSIBLE_OVER 59
+#define EP_ACCESSIBLE_INSIDE 60
+#define EP_ACCESSIBLE_UNDER 61
+#define EP_WALKABLE 62
+#define EP_PASSABLE 63
+#define EP_ACCESSIBLE 64
+#define EP_COLLECTIBLE 65
+#define EP_SNAPPABLE 66
+#define EP_WALL 67
+#define EP_SOLID_FOR_PUSHING 68
+#define EP_DRAGONFIRE_PROOF 69
+#define EP_EXPLOSION_PROOF 70
+#define EP_CAN_SMASH 71
+#define EP_EXPLODES_3X3_OLD 72
+#define EP_CAN_EXPLODE_BY_FIRE 73
+#define EP_CAN_EXPLODE_SMASHED 74
+#define EP_CAN_EXPLODE_IMPACT 75
+#define EP_SP_PORT 76
+#define EP_CAN_EXPLODE_BY_DRAGONFIRE 77
+#define EP_CAN_EXPLODE_BY_EXPLOSION 78
+#define EP_COULD_MOVE_INTO_ACID 79
+#define EP_MAYBE_DONT_COLLIDE_WITH 80
/* values for internal purpose only (level editor) */
-#define EP_EXPLODE_RESULT 72
-#define EP_WALK_TO_OBJECT 73
-#define EP_DEADLY 74
+#define EP_WALK_TO_OBJECT 81
+#define EP_DEADLY 82
-#define NUM_ELEMENT_PROPERTIES 75
+#define NUM_ELEMENT_PROPERTIES 83
#define NUM_EP_BITFIELDS ((NUM_ELEMENT_PROPERTIES + 31) / 32)
#define EP_BITFIELD_BASE 0
#define CE_PRESSED_BY_PLAYER 2
#define CE_PUSHED_BY_PLAYER 3
#define CE_DROPPED_BY_PLAYER 4
-#define CE_COLLISION 5
+#define CE_HITTING_SOMETHING 5
#define CE_IMPACT 6
#define CE_SMASHED 7
#define CE_OTHER_IS_TOUCHING 8
#define CE_OTHER_GETS_PUSHED 13
#define CE_OTHER_GETS_COLLECTED 14
#define CE_OTHER_GETS_DROPPED 15
-
-/* values for activating change events (also stored in level file!) */
-#define CE_BY_PLAYER 16
-#define CE_BY_COLLISION 17
-#define CE_BY_OTHER 18
-
-#define NUM_CHANGE_EVENTS 19
+#define CE_BY_PLAYER_OBSOLETE 16 /* obsolete; now CE_BY_DIRECT_ACTION */
+#define CE_BY_COLLISION_OBSOLETE 17 /* obsolete; now CE_BY_DIRECT_ACTION */
+#define CE_BY_OTHER_ACTION 18 /* activates other element events */
+#define CE_BY_DIRECT_ACTION 19 /* activates direct element events */
+#define CE_OTHER_GETS_DIGGED 20
+#define CE_ENTERED_BY_PLAYER 21
+#define CE_LEFT_BY_PLAYER 22
+#define CE_OTHER_GETS_ENTERED 23
+#define CE_OTHER_GETS_LEFT 24
+#define CE_SWITCHED 25
+#define CE_OTHER_IS_SWITCHING 26
+#define CE_HIT_BY_SOMETHING 27
+#define CE_OTHER_IS_HITTING 28
+#define CE_OTHER_GETS_HIT 29
+#define CE_BLOCKED 30
+
+#define NUM_CHANGE_EVENTS 31
#define CE_BITMASK_DEFAULT 0
#define CH_EVENT_BIT(c) (1 << (c))
#define CH_EVENT_VAR(e) (element_info[e].change->events)
+#define CH_ANY_EVENT_VAR(e) (element_info[e].change_events)
#define HAS_CHANGE_EVENT(e,c) (IS_CUSTOM_ELEMENT(e) && \
(CH_EVENT_VAR(e) & CH_EVENT_BIT(c)) != 0)
+#define HAS_ANY_CHANGE_EVENT(e,c) (IS_CUSTOM_ELEMENT(e) && \
+ (CH_ANY_EVENT_VAR(e) & CH_EVENT_BIT(c)) != 0)
#define SET_CHANGE_EVENT(e,c,v) (IS_CUSTOM_ELEMENT(e) ? \
((v) ? \
(CH_EVENT_VAR(e) |= CH_EVENT_BIT(c)) : \
(CH_EVENT_VAR(e) &= ~CH_EVENT_BIT(c))) : 0)
-/* values for change power for custom elements */
-#define CP_NON_DESTRUCTIVE 0
-#define CP_HALF_DESTRUCTIVE 1
-#define CP_FULL_DESTRUCTIVE 2
+/* values for change side for custom elements */
+#define CH_SIDE_NONE MV_NO_MOVING
+#define CH_SIDE_LEFT MV_LEFT
+#define CH_SIDE_RIGHT MV_RIGHT
+#define CH_SIDE_TOP MV_UP
+#define CH_SIDE_BOTTOM MV_DOWN
+#define CH_SIDE_LEFT_RIGHT MV_HORIZONTAL
+#define CH_SIDE_TOP_BOTTOM MV_VERTICAL
+#define CH_SIDE_ANY MV_ANY_DIRECTION
+
+/* values for change player for custom elements */
+#define CH_PLAYER_NONE 0
+#define CH_PLAYER_1 (1 << 0)
+#define CH_PLAYER_2 (1 << 1)
+#define CH_PLAYER_3 (1 << 2)
+#define CH_PLAYER_4 (1 << 3)
+#define CH_PLAYER_ANY (CH_PLAYER_1 | CH_PLAYER_2 | CH_PLAYER_3 | \
+ CH_PLAYER_4)
+
+/* values for change page for custom elements */
+#define CH_PAGE_ANY_FILE (0xff)
+#define CH_PAGE_ANY (0xffffffff)
-/* values for special move patterns (bits 0-3: basic move directions) */
+/* values for change power for custom elements */
+#define CP_WHEN_EMPTY 0
+#define CP_WHEN_DIGGABLE 1
+#define CP_WHEN_DESTRUCTIBLE 2
+#define CP_WHEN_COLLECTIBLE 3
+#define CP_WHEN_REMOVABLE 4
+#define CP_WHEN_WALKABLE 5
+
+/* values for custom move patterns (bits 0 - 3: basic move directions) */
#define MV_BIT_TOWARDS_PLAYER 4
#define MV_BIT_AWAY_FROM_PLAYER 5
#define MV_BIT_ALONG_LEFT_SIDE 6
#define MV_BIT_ALONG_RIGHT_SIDE 7
#define MV_BIT_TURNING_LEFT 8
#define MV_BIT_TURNING_RIGHT 9
-
-/* values for special move patterns for custom elements */
+#define MV_BIT_WHEN_PUSHED 10
+#define MV_BIT_MAZE_RUNNER 11
+#define MV_BIT_MAZE_HUNTER 12
+#define MV_BIT_WHEN_DROPPED 13
+#define MV_BIT_TURNING_LEFT_RIGHT 14
+#define MV_BIT_TURNING_RIGHT_LEFT 15
+#define MV_BIT_TURNING_RANDOM 16
+
+/* values for custom move patterns */
#define MV_HORIZONTAL (MV_LEFT | MV_RIGHT)
-#define MV_VERTICAL (MV_UP | MV_DOWN)
-#define MV_ALL_DIRECTIONS (MV_HORIZONTAL | MV_VERTICAL)
+#define MV_VERTICAL (MV_UP | MV_DOWN)
+#define MV_ALL_DIRECTIONS (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)
#define MV_ANY_DIRECTION (MV_ALL_DIRECTIONS)
#define MV_TOWARDS_PLAYER (1 << MV_BIT_TOWARDS_PLAYER)
#define MV_AWAY_FROM_PLAYER (1 << MV_BIT_AWAY_FROM_PLAYER)
#define MV_ALONG_RIGHT_SIDE (1 << MV_BIT_ALONG_RIGHT_SIDE)
#define MV_TURNING_LEFT (1 << MV_BIT_TURNING_LEFT)
#define MV_TURNING_RIGHT (1 << MV_BIT_TURNING_RIGHT)
+#define MV_WHEN_PUSHED (1 << MV_BIT_WHEN_PUSHED)
+#define MV_MAZE_RUNNER (1 << MV_BIT_MAZE_RUNNER)
+#define MV_MAZE_HUNTER (1 << MV_BIT_MAZE_HUNTER)
+#define MV_MAZE_RUNNER_STYLE (MV_MAZE_RUNNER | MV_MAZE_HUNTER)
+#define MV_WHEN_DROPPED (1 << MV_BIT_WHEN_DROPPED)
+#define MV_TURNING_LEFT_RIGHT (1 << MV_BIT_TURNING_LEFT_RIGHT)
+#define MV_TURNING_RIGHT_LEFT (1 << MV_BIT_TURNING_RIGHT_LEFT)
+#define MV_TURNING_RANDOM (1 << MV_BIT_TURNING_RANDOM)
+
+/* values for initial move direction (bits 0 - 3: basic move directions) */
+#define MV_START_BIT_PREVIOUS 4
+
+/* values for initial move direction */
+#define MV_START_AUTOMATIC (MV_NO_MOVING)
+#define MV_START_LEFT (MV_LEFT)
+#define MV_START_RIGHT (MV_RIGHT)
+#define MV_START_UP (MV_UP)
+#define MV_START_DOWN (MV_DOWN)
+#define MV_START_RANDOM (MV_ALL_DIRECTIONS)
+#define MV_START_PREVIOUS (1 << MV_START_BIT_PREVIOUS)
+
+/* values for elements left behind by custom elements */
+#define LEAVE_TYPE_UNLIMITED 0
+#define LEAVE_TYPE_LIMITED 1
/* values for slippery property for custom elements */
#define SLIPPERY_ANY_RANDOM 0
#define SLIPPERY_ONLY_LEFT 3
#define SLIPPERY_ONLY_RIGHT 4
+/* values for explosion type for custom elements */
+#define EXPLODES_3X3 0
+#define EXPLODES_1X1 1
+#define EXPLODES_CROSS 2
+
/* macros for configurable properties */
#define IS_DIGGABLE(e) HAS_PROPERTY(e, EP_DIGGABLE)
#define IS_COLLECTIBLE_ONLY(e) HAS_PROPERTY(e, EP_COLLECTIBLE_ONLY)
#define CAN_SMASH_PLAYER(e) HAS_PROPERTY(e, EP_CAN_SMASH_PLAYER)
#define CAN_SMASH_ENEMIES(e) HAS_PROPERTY(e, EP_CAN_SMASH_ENEMIES)
#define CAN_SMASH_EVERYTHING(e) HAS_PROPERTY(e, EP_CAN_SMASH_EVERYTHING)
-#define CAN_EXPLODE_BY_FIRE(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_FIRE)
-#define CAN_EXPLODE_SMASHED(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_SMASHED)
-#define CAN_EXPLODE_IMPACT(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_IMPACT)
+#define EXPLODES_BY_FIRE(e) HAS_PROPERTY(e, EP_EXPLODES_BY_FIRE)
+#define EXPLODES_SMASHED(e) HAS_PROPERTY(e, EP_EXPLODES_SMASHED)
+#define EXPLODES_IMPACT(e) HAS_PROPERTY(e, EP_EXPLODES_IMPACT)
#define IS_WALKABLE_OVER(e) HAS_PROPERTY(e, EP_WALKABLE_OVER)
#define IS_WALKABLE_INSIDE(e) HAS_PROPERTY(e, EP_WALKABLE_INSIDE)
#define IS_WALKABLE_UNDER(e) HAS_PROPERTY(e, EP_WALKABLE_UNDER)
#define IS_PASSABLE_INSIDE(e) HAS_PROPERTY(e, EP_PASSABLE_INSIDE)
#define IS_PASSABLE_UNDER(e) HAS_PROPERTY(e, EP_PASSABLE_UNDER)
#define IS_DROPPABLE(e) HAS_PROPERTY(e, EP_DROPPABLE)
-#define CAN_EXPLODE_1X1(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_1X1)
+#define EXPLODES_1X1_OLD(e) HAS_PROPERTY(e, EP_EXPLODES_1X1_OLD)
#define IS_PUSHABLE(e) HAS_PROPERTY(e, EP_PUSHABLE)
+#define EXPLODES_CROSS_OLD(e) HAS_PROPERTY(e, EP_EXPLODES_CROSS_OLD)
+#define IS_PROTECTED(e) HAS_PROPERTY(e, EP_PROTECTED)
+#define CAN_MOVE_INTO_ACID(e) HAS_PROPERTY(e, EP_CAN_MOVE_INTO_ACID)
+#define IS_THROWABLE(e) HAS_PROPERTY(e, EP_THROWABLE)
+#define CAN_EXPLODE(e) HAS_PROPERTY(e, EP_CAN_EXPLODE)
+#define IS_GRAVITY_REACHABLE(e) HAS_PROPERTY(e, EP_GRAVITY_REACHABLE)
/* macros for special configurable properties */
#define IS_EM_SLIPPERY_WALL(e) HAS_PROPERTY(e, EP_EM_SLIPPERY_WALL)
/* macros for special graphics properties */
-#define CAN_BE_CRUMBLED(e) HAS_PROPERTY(GFX_ELEMENT(e),EP_CAN_BE_CRUMBLED)
+#define GFX_CRUMBLED(e) HAS_PROPERTY(GFX_ELEMENT(e), EP_GFX_CRUMBLED)
/* macros for pre-defined properties */
#define ELEM_IS_PLAYER(e) HAS_PROPERTY(e, EP_PLAYER)
#define IS_AMOEBOID(e) HAS_PROPERTY(e, EP_AMOEBOID)
#define IS_AMOEBALIVE(e) HAS_PROPERTY(e, EP_AMOEBALIVE)
#define HAS_CONTENT(e) HAS_PROPERTY(e, EP_HAS_CONTENT)
+#define CAN_TURN_EACH_MOVE(e) HAS_PROPERTY(e, EP_CAN_TURN_EACH_MOVE)
+#define CAN_GROW(e) HAS_PROPERTY(e, EP_CAN_GROW)
#define IS_ACTIVE_BOMB(e) HAS_PROPERTY(e, EP_ACTIVE_BOMB)
#define IS_INACTIVE(e) HAS_PROPERTY(e, EP_INACTIVE)
#define IS_DRAGONFIRE_PROOF(e) HAS_PROPERTY(e, EP_DRAGONFIRE_PROOF)
#define IS_EXPLOSION_PROOF(e) HAS_PROPERTY(e, EP_EXPLOSION_PROOF)
#define CAN_SMASH(e) HAS_PROPERTY(e, EP_CAN_SMASH)
-#define CAN_EXPLODE(e) HAS_PROPERTY(e, EP_CAN_EXPLODE)
-#define CAN_EXPLODE_3X3(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_3X3)
+#define EXPLODES_3X3_OLD(e) HAS_PROPERTY(e, EP_EXPLODES_3X3_OLD)
+#define CAN_EXPLODE_BY_FIRE(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_FIRE)
+#define CAN_EXPLODE_SMASHED(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_SMASHED)
+#define CAN_EXPLODE_IMPACT(e) HAS_PROPERTY(e, EP_CAN_EXPLODE_IMPACT)
+#define IS_SP_PORT(e) HAS_PROPERTY(e, EP_SP_PORT)
+#define CAN_EXPLODE_BY_DRAGONFIRE(e) \
+ HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_DRAGONFIRE)
+#define CAN_EXPLODE_BY_EXPLOSION(e) \
+ HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_EXPLOSION)
+#define COULD_MOVE_INTO_ACID(e) HAS_PROPERTY(e, EP_COULD_MOVE_INTO_ACID)
+#define MAYBE_DONT_COLLIDE_WITH(e) HAS_PROPERTY(e, EP_MAYBE_DONT_COLLIDE_WITH)
/* special macros used in game engine */
#define IS_CUSTOM_ELEMENT(e) ((e) >= EL_CUSTOM_START && \
(e) <= EL_CUSTOM_END)
+#define IS_GROUP_ELEMENT(e) ((e) >= EL_GROUP_START && \
+ (e) <= EL_GROUP_END)
+
+#define IS_CLIPBOARD_ELEMENT(e) ((e) >= EL_INTERNAL_CLIPBOARD_START && \
+ (e) <= EL_INTERNAL_CLIPBOARD_END)
+
+#define IS_INTERNAL_ELEMENT(e) ((e) >= EL_INTERNAL_START && \
+ (e) <= EL_INTERNAL_END)
+
+#define IS_ENVELOPE(e) ((e) >= EL_ENVELOPE_1 && \
+ (e) <= EL_ENVELOPE_4)
+
+#define IS_GATE(e) ((e) >= EL_GATE_1 && \
+ (e) <= EL_GATE_4)
+
+#define IS_GATE_GRAY(e) ((e) >= EL_GATE_1_GRAY && \
+ (e) <= EL_GATE_4_GRAY)
+
+#define IS_EM_GATE(e) ((e) >= EL_EM_GATE_1 && \
+ (e) <= EL_EM_GATE_4)
+
+#define IS_EM_GATE_GRAY(e) ((e) >= EL_EM_GATE_1_GRAY && \
+ (e) <= EL_EM_GATE_4_GRAY)
+
#define GFX_ELEMENT(e) (element_info[e].use_gfx_element ? \
element_info[e].gfx_element : e)
-#define IS_PLAYER(x,y) (ELEM_IS_PLAYER(StorePlayer[x][y]))
+/* !!! "use sound" deactivated due to problems with level "bug machine" !!! */
+/* (solution: add separate "use sound of element" to level file and editor) */
+#if 0
+#define SND_ELEMENT(e) GFX_ELEMENT(e)
+#else
+#define SND_ELEMENT(e) (e)
+#endif
-#define IS_FREE(x,y) (Feld[x][y] == EL_EMPTY && !IS_PLAYER(x,y))
-#define IS_FREE_OR_PLAYER(x,y) (Feld[x][y] == EL_EMPTY)
+#define IS_PLAYER(x, y) (ELEM_IS_PLAYER(StorePlayer[x][y]))
+
+#define IS_FREE(x, y) (Feld[x][y] == EL_EMPTY && !IS_PLAYER(x, y))
+#define IS_FREE_OR_PLAYER(x, y) (Feld[x][y] == EL_EMPTY)
#define IS_MOVING(x,y) (MovPos[x][y] != 0)
#define IS_FALLING(x,y) (MovPos[x][y] != 0 && MovDir[x][y] == MV_DOWN)
#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)) || \
+#define PLAYER_ENEMY_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) || \
PROTECTED_FIELD(x, y))
+#define PLAYER_EXPLOSION_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))
#define PLAYER_NR_GFX(g,i) ((g) + i * (IMG_PLAYER_2 - IMG_PLAYER_1))
/* fundamental game speed values */
+#define ONE_SECOND_DELAY 1000 /* delay value for one second */
#define GAME_FRAME_DELAY 20 /* frame delay in milliseconds */
#define FFWD_FRAME_DELAY 10 /* 200% speed for fast forward */
-#define FRAMES_PER_SECOND (1000 / GAME_FRAME_DELAY)
+#define FRAMES_PER_SECOND (ONE_SECOND_DELAY / GAME_FRAME_DELAY)
#define MICROLEVEL_SCROLL_DELAY 50 /* delay for scrolling micro level */
#define MICROLEVEL_LABEL_DELAY 250 /* delay for micro level label */
#define MAX_SCORE_ENTRIES 100
#define MAX_NUM_AMOEBA 100
#define MAX_INVENTORY_SIZE 1000
+#define MAX_KEYS 4
+#define NUM_BELTS 4
+#define NUM_BELT_PARTS 3
#define MIN_ENVELOPE_XSIZE 1
#define MIN_ENVELOPE_YSIZE 1
#define MAX_ENVELOPE_XSIZE 30
#define MAX_ENVELOPE_YSIZE 20
#define MAX_ENVELOPE_TEXT_LEN (MAX_ENVELOPE_XSIZE * MAX_ENVELOPE_YSIZE)
#define MIN_CHANGE_PAGES 1
-#define MAX_CHANGE_PAGES 10
+#define MAX_CHANGE_PAGES 32
+#define MIN_ELEMENTS_IN_GROUP 1
+#define MAX_ELEMENTS_IN_GROUP 16
/* values for elements with content */
#define MIN_ELEMENT_CONTENTS 1
#define STD_ELEMENT_CONTENTS 4
#define MAX_ELEMENT_CONTENTS 8
+#define NUM_MAGIC_BALL_CONTENTS 8
#define LEVEL_SCORE_ELEMENTS 16 /* level elements with score */
#define VY 400
#define EX DX
#define EY (VY - 44)
-#define TILEX 32
-#define TILEY 32
-#define MINI_TILEX (TILEX / 2)
-#define MINI_TILEY (TILEY / 2)
-#define MICRO_TILEX (TILEX / 8)
-#define MICRO_TILEY (TILEY / 8)
+#define TILESIZE 32
+#define TILEX TILESIZE
+#define TILEY TILESIZE
+#define MINI_TILESIZE (TILESIZE / 2)
+#define MINI_TILEX MINI_TILESIZE
+#define MINI_TILEY MINI_TILESIZE
+#define MICRO_TILESIZE (TILESIZE / 8)
+#define MICRO_TILEX MICRO_TILESIZE
+#define MICRO_TILEY MICRO_TILESIZE
#define MIDPOSX (SCR_FIELDX / 2)
#define MIDPOSY (SCR_FIELDY / 2)
#define SXSIZE (SCR_FIELDX * TILEX)
#define MICROLABEL_YPOS (MICROLEV_YPOS + MICROLEV_YSIZE + 7)
+/* score for elements */
+#define SC_EMERALD 0
+#define SC_DIAMOND 1
+#define SC_BUG 2
+#define SC_SPACESHIP 3
+#define SC_YAMYAM 4
+#define SC_ROBOT 5
+#define SC_PACMAN 6
+#define SC_NUT 7
+#define SC_DYNAMITE 8
+#define SC_KEY 9
+#define SC_TIME_BONUS 10
+#define SC_CRYSTAL 11
+#define SC_PEARL 12
+#define SC_SHIELD 13
+
+
/* "real" level file elements */
#define EL_UNDEFINED -1
#define EL_WALL 2
#define EL_WALL_SLIPPERY 3
#define EL_ROCK 4
-#define EL_KEY_OBSOLETE 5 /* obsolete; mapped to EL_KEY_1 */
+#define EL_KEY_OBSOLETE 5 /* obsolete; now EL_KEY_1 */
#define EL_EMERALD 6
#define EL_EXIT_CLOSED 7
-#define EL_PLAYER_OBSOLETE 8 /* obsolete; mapped to EL_PLAYER_1 */
+#define EL_PLAYER_OBSOLETE 8 /* obsolete; now EL_PLAYER_1 */
#define EL_BUG 9
#define EL_SPACESHIP 10
#define EL_YAMYAM 11
#define EL_DARK_YAMYAM 60
#define EL_BD_MAGIC_WALL 61
#define EL_INVISIBLE_STEELWALL 62
-
-#define EL_UNUSED_63 63
-
+#define EL_SOKOBAN_FIELD_PLAYER 63
#define EL_DYNABOMB_INCREASE_NUMBER 64
#define EL_DYNABOMB_INCREASE_SIZE 65
#define EL_DYNABOMB_INCREASE_POWER 66
#define EL_PIG 117
#define EL_DRAGON 118
-#define EL_EM_KEY_1_FILE 119
+#define EL_EM_KEY_1_FILE_OBSOLETE 119 /* obsolete; now EL_EM_KEY_1 */
#define EL_CHAR_START 120
#define EL_CHAR_ASCII0 (EL_CHAR_START - 32)
#define EL_EM_GATE_3 205
#define EL_EM_GATE_4 206
-#define EL_EM_KEY_2_FILE 207
-#define EL_EM_KEY_3_FILE 208
-#define EL_EM_KEY_4_FILE 209
+#define EL_EM_KEY_2_FILE_OBSOLETE 207 /* obsolete; now EL_EM_KEY_2 */
+#define EL_EM_KEY_3_FILE_OBSOLETE 208 /* obsolete; now EL_EM_KEY_3 */
+#define EL_EM_KEY_4_FILE_OBSOLETE 209 /* obsolete; now EL_EM_KEY_4 */
#define EL_SP_START 210
#define EL_SP_EMPTY_SPACE (EL_SP_START + 0)
#define EL_CONVEYOR_BELT_4_SWITCH_MIDDLE 293
#define EL_CONVEYOR_BELT_4_SWITCH_RIGHT 294
#define EL_LANDMINE 295
-#define EL_ENVELOPE 296
+#define EL_ENVELOPE_OBSOLETE 296 /* obsolete; now EL_ENVELOPE_1 */
#define EL_LIGHT_SWITCH 297
#define EL_LIGHT_SWITCH_ACTIVE 298
#define EL_SIGN_EXCLAMATION 299
#define EL_UNUSED_358 358
#define EL_UNUSED_359 359
+/* ---------- begin of custom elements section ----------------------------- */
#define EL_CUSTOM_START 360
#include "conf_cus.h" /* include auto-generated data structure definitions */
#define NUM_CUSTOM_ELEMENTS 256
-
-#define EL_CUSTOM_END (EL_CUSTOM_START + NUM_CUSTOM_ELEMENTS - 1)
-#define NUM_FILE_ELEMENTS (EL_CUSTOM_START + NUM_CUSTOM_ELEMENTS)
+#define EL_CUSTOM_END 615
+/* ---------- end of custom elements section ------------------------------- */
+
+#define EL_EM_KEY_1 616
+#define EL_EM_KEY_2 617
+#define EL_EM_KEY_3 618
+#define EL_EM_KEY_4 619
+#define EL_ENVELOPE_1 620
+#define EL_ENVELOPE_2 621
+#define EL_ENVELOPE_3 622
+#define EL_ENVELOPE_4 623
+
+/* ---------- begin of group elements section ------------------------------ */
+#define EL_GROUP_START 624
+
+#include "conf_grp.h" /* include auto-generated data structure definitions */
+
+#define NUM_GROUP_ELEMENTS 32
+#define EL_GROUP_END 655
+/* ---------- end of custom elements section ------------------------------- */
+
+#define EL_UNKNOWN 656
+#define EL_TRIGGER_ELEMENT 657
+#define EL_TRIGGER_PLAYER 658
+
+#define EL_SP_GRAVITY_ON_PORT_RIGHT 659
+#define EL_SP_GRAVITY_ON_PORT_DOWN 660
+#define EL_SP_GRAVITY_ON_PORT_LEFT 661
+#define EL_SP_GRAVITY_ON_PORT_UP 662
+#define EL_SP_GRAVITY_OFF_PORT_RIGHT 663
+#define EL_SP_GRAVITY_OFF_PORT_DOWN 664
+#define EL_SP_GRAVITY_OFF_PORT_LEFT 665
+#define EL_SP_GRAVITY_OFF_PORT_UP 666
+
+
+/* the following EMC style elements are currently not implemented in R'n'D */
+#define EL_BALLOON_SWITCH_NONE 667
+#define EL_EM_GATE_5 668
+#define EL_EM_GATE_6 669
+#define EL_EM_GATE_7 670
+#define EL_EM_GATE_8 671
+#define EL_EM_GATE_5_GRAY 672
+#define EL_EM_GATE_6_GRAY 673
+#define EL_EM_GATE_7_GRAY 674
+#define EL_EM_GATE_8_GRAY 675
+#define EL_EM_KEY_5 676
+#define EL_EM_KEY_6 677
+#define EL_EM_KEY_7 678
+#define EL_EM_KEY_8 679
+#define EL_EMC_ANDROID 680
+#define EL_EMC_GRASS 681
+#define EL_EMC_MAGIC_BALL 682
+#define EL_EMC_MAGIC_BALL_ACTIVE 683
+#define EL_EMC_MAGIC_BALL_SWITCH 684
+#define EL_EMC_MAGIC_BALL_SWITCH_ACTIVE 685
+#define EL_EMC_SPRING_BUMPER 686
+#define EL_EMC_PLANT 687
+#define EL_EMC_LENSES 688
+#define EL_EMC_MAGNIFIER 689
+#define EL_EMC_WALL_9 690
+#define EL_EMC_WALL_10 691
+#define EL_EMC_WALL_11 692
+#define EL_EMC_WALL_12 693
+#define EL_EMC_WALL_13 694
+#define EL_EMC_WALL_14 695
+#define EL_EMC_WALL_15 696
+#define EL_EMC_WALL_16 697
+#define EL_EMC_WALL_SLIPPERY_1 698
+#define EL_EMC_WALL_SLIPPERY_2 699
+#define EL_EMC_WALL_SLIPPERY_3 700
+#define EL_EMC_WALL_SLIPPERY_4 701
+#define EL_EMC_FAKE_GRASS 702
+#define EL_EMC_DRIPPER 703
+
+#define NUM_FILE_ELEMENTS 704
/* "real" (and therefore drawable) runtime elements */
#define EL_FIRST_RUNTIME_REAL NUM_FILE_ELEMENTS
-#define EL_EM_KEY_1 (EL_FIRST_RUNTIME_REAL + 0)
-#define EL_EM_KEY_2 (EL_FIRST_RUNTIME_REAL + 1)
-#define EL_EM_KEY_3 (EL_FIRST_RUNTIME_REAL + 2)
-#define EL_EM_KEY_4 (EL_FIRST_RUNTIME_REAL + 3)
-#define EL_DYNABOMB_PLAYER_1_ACTIVE (EL_FIRST_RUNTIME_REAL + 4)
-#define EL_DYNABOMB_PLAYER_2_ACTIVE (EL_FIRST_RUNTIME_REAL + 5)
-#define EL_DYNABOMB_PLAYER_3_ACTIVE (EL_FIRST_RUNTIME_REAL + 6)
-#define EL_DYNABOMB_PLAYER_4_ACTIVE (EL_FIRST_RUNTIME_REAL + 7)
-#define EL_SP_DISK_RED_ACTIVE (EL_FIRST_RUNTIME_REAL + 8)
-#define EL_SWITCHGATE_OPENING (EL_FIRST_RUNTIME_REAL + 9)
-#define EL_SWITCHGATE_CLOSING (EL_FIRST_RUNTIME_REAL + 10)
-#define EL_TIMEGATE_OPENING (EL_FIRST_RUNTIME_REAL + 11)
-#define EL_TIMEGATE_CLOSING (EL_FIRST_RUNTIME_REAL + 12)
-#define EL_PEARL_BREAKING (EL_FIRST_RUNTIME_REAL + 13)
-#define EL_TRAP_ACTIVE (EL_FIRST_RUNTIME_REAL + 14)
-#define EL_INVISIBLE_STEELWALL_ACTIVE (EL_FIRST_RUNTIME_REAL + 15)
-#define EL_INVISIBLE_WALL_ACTIVE (EL_FIRST_RUNTIME_REAL + 16)
-#define EL_INVISIBLE_SAND_ACTIVE (EL_FIRST_RUNTIME_REAL + 17)
-#define EL_CONVEYOR_BELT_1_LEFT_ACTIVE (EL_FIRST_RUNTIME_REAL + 18)
-#define EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 19)
-#define EL_CONVEYOR_BELT_1_RIGHT_ACTIVE (EL_FIRST_RUNTIME_REAL + 20)
-#define EL_CONVEYOR_BELT_2_LEFT_ACTIVE (EL_FIRST_RUNTIME_REAL + 21)
-#define EL_CONVEYOR_BELT_2_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 22)
-#define EL_CONVEYOR_BELT_2_RIGHT_ACTIVE (EL_FIRST_RUNTIME_REAL + 23)
-#define EL_CONVEYOR_BELT_3_LEFT_ACTIVE (EL_FIRST_RUNTIME_REAL + 24)
-#define EL_CONVEYOR_BELT_3_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 25)
-#define EL_CONVEYOR_BELT_3_RIGHT_ACTIVE (EL_FIRST_RUNTIME_REAL + 26)
-#define EL_CONVEYOR_BELT_4_LEFT_ACTIVE (EL_FIRST_RUNTIME_REAL + 27)
-#define EL_CONVEYOR_BELT_4_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 28)
-#define EL_CONVEYOR_BELT_4_RIGHT_ACTIVE (EL_FIRST_RUNTIME_REAL + 29)
-#define EL_EXIT_OPENING (EL_FIRST_RUNTIME_REAL + 30)
-#define EL_SP_EXIT_OPEN (EL_FIRST_RUNTIME_REAL + 31)
-#define EL_SP_TERMINAL_ACTIVE (EL_FIRST_RUNTIME_REAL + 32)
-#define EL_SP_BUGGY_BASE_ACTIVATING (EL_FIRST_RUNTIME_REAL + 33)
-#define EL_SP_BUGGY_BASE_ACTIVE (EL_FIRST_RUNTIME_REAL + 34)
-#define EL_SP_MURPHY_CLONE (EL_FIRST_RUNTIME_REAL + 35)
-#define EL_AMOEBA_DROPPING (EL_FIRST_RUNTIME_REAL + 36)
-#define EL_QUICKSAND_EMPTYING (EL_FIRST_RUNTIME_REAL + 37)
-#define EL_MAGIC_WALL_ACTIVE (EL_FIRST_RUNTIME_REAL + 38)
-#define EL_BD_MAGIC_WALL_ACTIVE (EL_FIRST_RUNTIME_REAL + 39)
-#define EL_MAGIC_WALL_FULL (EL_FIRST_RUNTIME_REAL + 40)
-#define EL_BD_MAGIC_WALL_FULL (EL_FIRST_RUNTIME_REAL + 41)
-#define EL_MAGIC_WALL_EMPTYING (EL_FIRST_RUNTIME_REAL + 42)
-#define EL_BD_MAGIC_WALL_EMPTYING (EL_FIRST_RUNTIME_REAL + 43)
-#define EL_MAGIC_WALL_DEAD (EL_FIRST_RUNTIME_REAL + 44)
-#define EL_BD_MAGIC_WALL_DEAD (EL_FIRST_RUNTIME_REAL + 45)
+#define EL_DYNABOMB_PLAYER_1_ACTIVE (EL_FIRST_RUNTIME_REAL + 0)
+#define EL_DYNABOMB_PLAYER_2_ACTIVE (EL_FIRST_RUNTIME_REAL + 1)
+#define EL_DYNABOMB_PLAYER_3_ACTIVE (EL_FIRST_RUNTIME_REAL + 2)
+#define EL_DYNABOMB_PLAYER_4_ACTIVE (EL_FIRST_RUNTIME_REAL + 3)
+#define EL_SP_DISK_RED_ACTIVE (EL_FIRST_RUNTIME_REAL + 4)
+#define EL_SWITCHGATE_OPENING (EL_FIRST_RUNTIME_REAL + 5)
+#define EL_SWITCHGATE_CLOSING (EL_FIRST_RUNTIME_REAL + 6)
+#define EL_TIMEGATE_OPENING (EL_FIRST_RUNTIME_REAL + 7)
+#define EL_TIMEGATE_CLOSING (EL_FIRST_RUNTIME_REAL + 8)
+#define EL_PEARL_BREAKING (EL_FIRST_RUNTIME_REAL + 9)
+#define EL_TRAP_ACTIVE (EL_FIRST_RUNTIME_REAL + 10)
+#define EL_INVISIBLE_STEELWALL_ACTIVE (EL_FIRST_RUNTIME_REAL + 11)
+#define EL_INVISIBLE_WALL_ACTIVE (EL_FIRST_RUNTIME_REAL + 12)
+#define EL_INVISIBLE_SAND_ACTIVE (EL_FIRST_RUNTIME_REAL + 13)
+#define EL_CONVEYOR_BELT_1_LEFT_ACTIVE (EL_FIRST_RUNTIME_REAL + 14)
+#define EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 15)
+#define EL_CONVEYOR_BELT_1_RIGHT_ACTIVE (EL_FIRST_RUNTIME_REAL + 16)
+#define EL_CONVEYOR_BELT_2_LEFT_ACTIVE (EL_FIRST_RUNTIME_REAL + 17)
+#define EL_CONVEYOR_BELT_2_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 18)
+#define EL_CONVEYOR_BELT_2_RIGHT_ACTIVE (EL_FIRST_RUNTIME_REAL + 19)
+#define EL_CONVEYOR_BELT_3_LEFT_ACTIVE (EL_FIRST_RUNTIME_REAL + 20)
+#define EL_CONVEYOR_BELT_3_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 21)
+#define EL_CONVEYOR_BELT_3_RIGHT_ACTIVE (EL_FIRST_RUNTIME_REAL + 22)
+#define EL_CONVEYOR_BELT_4_LEFT_ACTIVE (EL_FIRST_RUNTIME_REAL + 23)
+#define EL_CONVEYOR_BELT_4_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 24)
+#define EL_CONVEYOR_BELT_4_RIGHT_ACTIVE (EL_FIRST_RUNTIME_REAL + 25)
+#define EL_EXIT_OPENING (EL_FIRST_RUNTIME_REAL + 26)
+#define EL_EXIT_CLOSING (EL_FIRST_RUNTIME_REAL + 27)
+#define EL_SP_EXIT_OPENING (EL_FIRST_RUNTIME_REAL + 28)
+#define EL_SP_EXIT_CLOSING (EL_FIRST_RUNTIME_REAL + 29)
+#define EL_SP_EXIT_OPEN (EL_FIRST_RUNTIME_REAL + 30)
+#define EL_SP_TERMINAL_ACTIVE (EL_FIRST_RUNTIME_REAL + 31)
+#define EL_SP_BUGGY_BASE_ACTIVATING (EL_FIRST_RUNTIME_REAL + 32)
+#define EL_SP_BUGGY_BASE_ACTIVE (EL_FIRST_RUNTIME_REAL + 33)
+#define EL_SP_MURPHY_CLONE (EL_FIRST_RUNTIME_REAL + 34)
+#define EL_AMOEBA_DROPPING (EL_FIRST_RUNTIME_REAL + 35)
+#define EL_QUICKSAND_EMPTYING (EL_FIRST_RUNTIME_REAL + 36)
+#define EL_MAGIC_WALL_ACTIVE (EL_FIRST_RUNTIME_REAL + 37)
+#define EL_BD_MAGIC_WALL_ACTIVE (EL_FIRST_RUNTIME_REAL + 38)
+#define EL_MAGIC_WALL_FULL (EL_FIRST_RUNTIME_REAL + 39)
+#define EL_BD_MAGIC_WALL_FULL (EL_FIRST_RUNTIME_REAL + 40)
+#define EL_MAGIC_WALL_EMPTYING (EL_FIRST_RUNTIME_REAL + 41)
+#define EL_BD_MAGIC_WALL_EMPTYING (EL_FIRST_RUNTIME_REAL + 42)
+#define EL_MAGIC_WALL_DEAD (EL_FIRST_RUNTIME_REAL + 43)
+#define EL_BD_MAGIC_WALL_DEAD (EL_FIRST_RUNTIME_REAL + 44)
/* "unreal" (and therefore not drawable) runtime elements */
-#define EL_FIRST_RUNTIME_UNREAL (EL_FIRST_RUNTIME_REAL + 46)
+#define EL_FIRST_RUNTIME_UNREAL (EL_FIRST_RUNTIME_REAL + 45)
#define EL_BLOCKED (EL_FIRST_RUNTIME_UNREAL + 0)
#define EL_EXPLOSION (EL_FIRST_RUNTIME_UNREAL + 1)
#define EL_EXPANDABLE_WALL_GROWING (EL_FIRST_RUNTIME_UNREAL + 8)
#define EL_FLAMES (EL_FIRST_RUNTIME_UNREAL + 9)
#define EL_PLAYER_IS_LEAVING (EL_FIRST_RUNTIME_UNREAL + 10)
-#define EL_QUICKSAND_FILLING (EL_FIRST_RUNTIME_UNREAL + 11)
-#define EL_MAGIC_WALL_FILLING (EL_FIRST_RUNTIME_UNREAL + 12)
-#define EL_BD_MAGIC_WALL_FILLING (EL_FIRST_RUNTIME_UNREAL + 13)
+#define EL_PLAYER_IS_EXPLODING_1 (EL_FIRST_RUNTIME_UNREAL + 11)
+#define EL_PLAYER_IS_EXPLODING_2 (EL_FIRST_RUNTIME_UNREAL + 12)
+#define EL_PLAYER_IS_EXPLODING_3 (EL_FIRST_RUNTIME_UNREAL + 13)
+#define EL_PLAYER_IS_EXPLODING_4 (EL_FIRST_RUNTIME_UNREAL + 14)
+#define EL_QUICKSAND_FILLING (EL_FIRST_RUNTIME_UNREAL + 15)
+#define EL_MAGIC_WALL_FILLING (EL_FIRST_RUNTIME_UNREAL + 16)
+#define EL_BD_MAGIC_WALL_FILLING (EL_FIRST_RUNTIME_UNREAL + 17)
/* dummy elements (never used as game elements, only used as graphics) */
-#define EL_FIRST_DUMMY (EL_FIRST_RUNTIME_UNREAL + 14)
-
-#define EL_STEELWALL_TOPLEFT (EL_FIRST_DUMMY + 0)
-#define EL_STEELWALL_TOPRIGHT (EL_FIRST_DUMMY + 1)
-#define EL_STEELWALL_BOTTOMLEFT (EL_FIRST_DUMMY + 2)
-#define EL_STEELWALL_BOTTOMRIGHT (EL_FIRST_DUMMY + 3)
-#define EL_STEELWALL_HORIZONTAL (EL_FIRST_DUMMY + 4)
-#define EL_STEELWALL_VERTICAL (EL_FIRST_DUMMY + 5)
-#define EL_INVISIBLE_STEELWALL_TOPLEFT (EL_FIRST_DUMMY + 6)
-#define EL_INVISIBLE_STEELWALL_TOPRIGHT (EL_FIRST_DUMMY + 7)
-#define EL_INVISIBLE_STEELWALL_BOTTOMLEFT (EL_FIRST_DUMMY + 8)
-#define EL_INVISIBLE_STEELWALL_BOTTOMRIGHT (EL_FIRST_DUMMY + 9)
-#define EL_INVISIBLE_STEELWALL_HORIZONTAL (EL_FIRST_DUMMY + 10)
-#define EL_INVISIBLE_STEELWALL_VERTICAL (EL_FIRST_DUMMY + 11)
-#define EL_DYNABOMB (EL_FIRST_DUMMY + 12)
-#define EL_DYNABOMB_ACTIVE (EL_FIRST_DUMMY + 13)
-#define EL_DYNABOMB_PLAYER_1 (EL_FIRST_DUMMY + 14)
-#define EL_DYNABOMB_PLAYER_2 (EL_FIRST_DUMMY + 15)
-#define EL_DYNABOMB_PLAYER_3 (EL_FIRST_DUMMY + 16)
-#define EL_DYNABOMB_PLAYER_4 (EL_FIRST_DUMMY + 17)
-#define EL_SHIELD_NORMAL_ACTIVE (EL_FIRST_DUMMY + 18)
-#define EL_SHIELD_DEADLY_ACTIVE (EL_FIRST_DUMMY + 19)
-#define EL_DEFAULT (EL_FIRST_DUMMY + 20)
-#define EL_BD_DEFAULT (EL_FIRST_DUMMY + 21)
-#define EL_SP_DEFAULT (EL_FIRST_DUMMY + 22)
-#define EL_SB_DEFAULT (EL_FIRST_DUMMY + 23)
-
-#define MAX_NUM_ELEMENTS (EL_FIRST_DUMMY + 24)
+#define EL_FIRST_DUMMY (EL_FIRST_RUNTIME_UNREAL + 18)
+
+#define EL_STEELWALL_TOPLEFT (EL_FIRST_DUMMY + 0)
+#define EL_STEELWALL_TOPRIGHT (EL_FIRST_DUMMY + 1)
+#define EL_STEELWALL_BOTTOMLEFT (EL_FIRST_DUMMY + 2)
+#define EL_STEELWALL_BOTTOMRIGHT (EL_FIRST_DUMMY + 3)
+#define EL_STEELWALL_HORIZONTAL (EL_FIRST_DUMMY + 4)
+#define EL_STEELWALL_VERTICAL (EL_FIRST_DUMMY + 5)
+#define EL_INVISIBLE_STEELWALL_TOPLEFT (EL_FIRST_DUMMY + 6)
+#define EL_INVISIBLE_STEELWALL_TOPRIGHT (EL_FIRST_DUMMY + 7)
+#define EL_INVISIBLE_STEELWALL_BOTTOMLEFT (EL_FIRST_DUMMY + 8)
+#define EL_INVISIBLE_STEELWALL_BOTTOMRIGHT (EL_FIRST_DUMMY + 9)
+#define EL_INVISIBLE_STEELWALL_HORIZONTAL (EL_FIRST_DUMMY + 10)
+#define EL_INVISIBLE_STEELWALL_VERTICAL (EL_FIRST_DUMMY + 11)
+#define EL_DYNABOMB (EL_FIRST_DUMMY + 12)
+#define EL_DYNABOMB_ACTIVE (EL_FIRST_DUMMY + 13)
+#define EL_DYNABOMB_PLAYER_1 (EL_FIRST_DUMMY + 14)
+#define EL_DYNABOMB_PLAYER_2 (EL_FIRST_DUMMY + 15)
+#define EL_DYNABOMB_PLAYER_3 (EL_FIRST_DUMMY + 16)
+#define EL_DYNABOMB_PLAYER_4 (EL_FIRST_DUMMY + 17)
+#define EL_SHIELD_NORMAL_ACTIVE (EL_FIRST_DUMMY + 18)
+#define EL_SHIELD_DEADLY_ACTIVE (EL_FIRST_DUMMY + 19)
+#define EL_AMOEBA (EL_FIRST_DUMMY + 20)
+#define EL_DEFAULT (EL_FIRST_DUMMY + 21)
+#define EL_BD_DEFAULT (EL_FIRST_DUMMY + 22)
+#define EL_SP_DEFAULT (EL_FIRST_DUMMY + 23)
+#define EL_SB_DEFAULT (EL_FIRST_DUMMY + 24)
+
+/* internal elements (only used for internal purposes like copying) */
+#define EL_FIRST_INTERNAL (EL_FIRST_DUMMY + 25)
+
+#define EL_INTERNAL_CLIPBOARD_CUSTOM (EL_FIRST_INTERNAL + 0)
+#define EL_INTERNAL_CLIPBOARD_CHANGE (EL_FIRST_INTERNAL + 1)
+#define EL_INTERNAL_CLIPBOARD_GROUP (EL_FIRST_INTERNAL + 2)
+#define EL_INTERNAL_DUMMY (EL_FIRST_INTERNAL + 3)
+
+#define EL_INTERNAL_CLIPBOARD_START (EL_FIRST_INTERNAL + 0)
+#define EL_INTERNAL_CLIPBOARD_END (EL_FIRST_INTERNAL + 2)
+#define EL_INTERNAL_START (EL_FIRST_INTERNAL + 0)
+#define EL_INTERNAL_END (EL_FIRST_INTERNAL + 3)
+
+#define MAX_NUM_ELEMENTS (EL_FIRST_INTERNAL + 4)
/* values for graphics/sounds action types */
-#define ACTION_DEFAULT 0
-#define ACTION_WAITING 1
-#define ACTION_FALLING 2
-#define ACTION_MOVING 3
-#define ACTION_DIGGING 4
-#define ACTION_SNAPPING 5
-#define ACTION_COLLECTING 6
-#define ACTION_DROPPING 7
-#define ACTION_PUSHING 8
-#define ACTION_WALKING 9
-#define ACTION_PASSING 10
-#define ACTION_IMPACT 11
-#define ACTION_BREAKING 12
-#define ACTION_ACTIVATING 13
-#define ACTION_DEACTIVATING 14
-#define ACTION_OPENING 15
-#define ACTION_CLOSING 16
-#define ACTION_ATTACKING 17
-#define ACTION_GROWING 18
-#define ACTION_SHRINKING 19
-#define ACTION_ACTIVE 20
-#define ACTION_FILLING 21
-#define ACTION_EMPTYING 22
-#define ACTION_CHANGING 23
-#define ACTION_EXPLODING 24
-#define ACTION_DYING 25
-#define ACTION_OTHER 26
-
-#define NUM_ACTIONS 27
+#define ACTION_DEFAULT 0
+#define ACTION_WAITING 1
+#define ACTION_FALLING 2
+#define ACTION_MOVING 3
+#define ACTION_DIGGING 4
+#define ACTION_SNAPPING 5
+#define ACTION_COLLECTING 6
+#define ACTION_DROPPING 7
+#define ACTION_PUSHING 8
+#define ACTION_WALKING 9
+#define ACTION_PASSING 10
+#define ACTION_IMPACT 11
+#define ACTION_BREAKING 12
+#define ACTION_ACTIVATING 13
+#define ACTION_DEACTIVATING 14
+#define ACTION_OPENING 15
+#define ACTION_CLOSING 16
+#define ACTION_ATTACKING 17
+#define ACTION_GROWING 18
+#define ACTION_SHRINKING 19
+#define ACTION_ACTIVE 20
+#define ACTION_FILLING 21
+#define ACTION_EMPTYING 22
+#define ACTION_CHANGING 23
+#define ACTION_EXPLODING 24
+#define ACTION_BORING 25
+#define ACTION_BORING_1 26
+#define ACTION_BORING_2 27
+#define ACTION_BORING_3 28
+#define ACTION_BORING_4 29
+#define ACTION_BORING_5 30
+#define ACTION_BORING_6 31
+#define ACTION_BORING_7 32
+#define ACTION_BORING_8 33
+#define ACTION_BORING_9 34
+#define ACTION_BORING_10 35
+#define ACTION_SLEEPING 36
+#define ACTION_SLEEPING_1 37
+#define ACTION_SLEEPING_2 38
+#define ACTION_SLEEPING_3 39
+#define ACTION_AWAKENING 40
+#define ACTION_DYING 41
+#define ACTION_TURNING 42
+#define ACTION_TURNING_FROM_LEFT 43
+#define ACTION_TURNING_FROM_RIGHT 44
+#define ACTION_TURNING_FROM_UP 45
+#define ACTION_TURNING_FROM_DOWN 46
+#define ACTION_SMASHED_BY_ROCK 47
+#define ACTION_SMASHED_BY_SPRING 48
+#define ACTION_SLURPED_BY_SPRING 49
+#define ACTION_TWINKLING 50
+#define ACTION_OTHER 51
+
+#define NUM_ACTIONS 52
+
+#define ACTION_BORING_LAST ACTION_BORING_10
+#define ACTION_SLEEPING_LAST ACTION_SLEEPING_3
+
/* values for special image configuration suffixes (must match game mode) */
-#define GFX_SPECIAL_ARG_MAIN 0
-#define GFX_SPECIAL_ARG_LEVELS 1
-#define GFX_SPECIAL_ARG_SCORES 2
-#define GFX_SPECIAL_ARG_EDITOR 3
-#define GFX_SPECIAL_ARG_INFO 4
-#define GFX_SPECIAL_ARG_SETUP 5
-#define GFX_SPECIAL_ARG_DOOR 6
-#define GFX_SPECIAL_ARG_PREVIEW 7
-#define GFX_SPECIAL_ARG_CRUMBLED 8
+#define GFX_SPECIAL_ARG_DEFAULT 0
+#define GFX_SPECIAL_ARG_MAIN 1
+#define GFX_SPECIAL_ARG_LEVELS 2
+#define GFX_SPECIAL_ARG_SCORES 3
+#define GFX_SPECIAL_ARG_EDITOR 4
+#define GFX_SPECIAL_ARG_INFO 5
+#define GFX_SPECIAL_ARG_SETUP 6
+#define GFX_SPECIAL_ARG_PLAYING 7
+#define GFX_SPECIAL_ARG_DOOR 8
+#define GFX_SPECIAL_ARG_PREVIEW 9
+#define GFX_SPECIAL_ARG_CRUMBLED 10
-#define NUM_SPECIAL_GFX_ARGS 9
+#define NUM_SPECIAL_GFX_ARGS 11
/* values for image configuration suffixes */
-#define GFX_ARG_X 0
-#define GFX_ARG_Y 1
-#define GFX_ARG_XPOS 2
-#define GFX_ARG_YPOS 3
-#define GFX_ARG_WIDTH 4
-#define GFX_ARG_HEIGHT 5
-#define GFX_ARG_OFFSET 6
-#define GFX_ARG_VERTICAL 7
-#define GFX_ARG_XOFFSET 8
-#define GFX_ARG_YOFFSET 9
-#define GFX_ARG_FRAMES 10
-#define GFX_ARG_FRAMES_PER_LINE 11
-#define GFX_ARG_START_FRAME 12
-#define GFX_ARG_DELAY 13
-#define GFX_ARG_ANIM_MODE 14
-#define GFX_ARG_GLOBAL_SYNC 15
-#define GFX_ARG_CRUMBLED_LIKE 16
-#define GFX_ARG_DIGGABLE_LIKE 17
-#define GFX_ARG_STEP_OFFSET 18
-#define GFX_ARG_STEP_DELAY 19
-#define GFX_ARG_DIRECTION 20
-#define GFX_ARG_POSITION 21
-#define GFX_ARG_DRAW_XOFFSET 22
-#define GFX_ARG_DRAW_YOFFSET 23
-#define GFX_ARG_NAME 24
-
-#define NUM_GFX_ARGS 25
+#define GFX_ARG_X 0
+#define GFX_ARG_Y 1
+#define GFX_ARG_XPOS 2
+#define GFX_ARG_YPOS 3
+#define GFX_ARG_WIDTH 4
+#define GFX_ARG_HEIGHT 5
+#define GFX_ARG_VERTICAL 6
+#define GFX_ARG_OFFSET 7
+#define GFX_ARG_XOFFSET 8
+#define GFX_ARG_YOFFSET 9
+#define GFX_ARG_2ND_MOVEMENT_TILE 10
+#define GFX_ARG_2ND_VERTICAL 11
+#define GFX_ARG_2ND_OFFSET 12
+#define GFX_ARG_2ND_XOFFSET 13
+#define GFX_ARG_2ND_YOFFSET 14
+#define GFX_ARG_2ND_SWAP_TILES 15
+#define GFX_ARG_FRAMES 16
+#define GFX_ARG_FRAMES_PER_LINE 17
+#define GFX_ARG_START_FRAME 18
+#define GFX_ARG_DELAY 19
+#define GFX_ARG_ANIM_MODE 20
+#define GFX_ARG_GLOBAL_SYNC 21
+#define GFX_ARG_CRUMBLED_LIKE 22
+#define GFX_ARG_DIGGABLE_LIKE 23
+#define GFX_ARG_BORDER_SIZE 24
+#define GFX_ARG_STEP_OFFSET 25
+#define GFX_ARG_STEP_DELAY 26
+#define GFX_ARG_DIRECTION 27
+#define GFX_ARG_POSITION 28
+#define GFX_ARG_DRAW_XOFFSET 29
+#define GFX_ARG_DRAW_YOFFSET 30
+#define GFX_ARG_DRAW_MASKED 31
+#define GFX_ARG_ANIM_DELAY_FIXED 32
+#define GFX_ARG_ANIM_DELAY_RANDOM 33
+#define GFX_ARG_POST_DELAY_FIXED 34
+#define GFX_ARG_POST_DELAY_RANDOM 35
+#define GFX_ARG_NAME 36
+#define GFX_ARG_SCALE_UP_FACTOR 37
+
+#define NUM_GFX_ARGS 38
/* values for sound configuration suffixes */
-#define SND_ARG_MODE_LOOP 0
+#define SND_ARG_MODE_LOOP 0
+#define SND_ARG_VOLUME 1
+#define SND_ARG_PRIORITY 2
-#define NUM_SND_ARGS 1
+#define NUM_SND_ARGS 3
-/* values for font configuration */
+/* values for music configuration suffixes */
+#define MUS_ARG_MODE_LOOP 0
-#define FONT_INITIAL_1 0
-#define FONT_INITIAL_2 1
-#define FONT_INITIAL_3 2
-#define FONT_INITIAL_4 3
-#define FONT_TITLE_1 4
-#define FONT_TITLE_2 5
-#define FONT_MENU_1 6
-#define FONT_MENU_2 7
-#define FONT_TEXT_1_ACTIVE 8
-#define FONT_TEXT_2_ACTIVE 9
-#define FONT_TEXT_3_ACTIVE 10
-#define FONT_TEXT_4_ACTIVE 11
-#define FONT_TEXT_1 12
-#define FONT_TEXT_2 13
-#define FONT_TEXT_3 14
-#define FONT_TEXT_4 15
-#define FONT_INPUT_1_ACTIVE 16
-#define FONT_INPUT_2_ACTIVE 17
-#define FONT_INPUT_1 18
-#define FONT_INPUT_2 19
-#define FONT_OPTION_OFF 20
-#define FONT_OPTION_ON 21
-#define FONT_VALUE_1 22
-#define FONT_VALUE_2 23
-#define FONT_VALUE_OLD 24
-#define FONT_LEVEL_NUMBER 25
-#define FONT_TAPE_RECORDER 26
-#define FONT_GAME_INFO 27
-
-#define NUM_FONTS 28
-#define NUM_INITIAL_FONTS 4
+#define NUM_MUS_ARGS 1
+
+
+/* values for font configuration */
+#define FONT_INITIAL_1 0
+#define FONT_INITIAL_2 1
+#define FONT_INITIAL_3 2
+#define FONT_INITIAL_4 3
+#define FONT_TITLE_1 4
+#define FONT_TITLE_2 5
+#define FONT_MENU_1 6
+#define FONT_MENU_2 7
+#define FONT_TEXT_1_ACTIVE 8
+#define FONT_TEXT_2_ACTIVE 9
+#define FONT_TEXT_3_ACTIVE 10
+#define FONT_TEXT_4_ACTIVE 11
+#define FONT_TEXT_1 12
+#define FONT_TEXT_2 13
+#define FONT_TEXT_3 14
+#define FONT_TEXT_4 15
+#define FONT_ENVELOPE_1 16
+#define FONT_ENVELOPE_2 17
+#define FONT_ENVELOPE_3 18
+#define FONT_ENVELOPE_4 19
+#define FONT_INPUT_1_ACTIVE 20
+#define FONT_INPUT_2_ACTIVE 21
+#define FONT_INPUT_1 22
+#define FONT_INPUT_2 23
+#define FONT_OPTION_OFF 24
+#define FONT_OPTION_ON 25
+#define FONT_VALUE_1 26
+#define FONT_VALUE_2 27
+#define FONT_VALUE_OLD 28
+#define FONT_LEVEL_NUMBER 29
+#define FONT_TAPE_RECORDER 30
+#define FONT_GAME_INFO 31
+
+#define NUM_FONTS 32
+#define NUM_INITIAL_FONTS 4
/* values for game_status (must match special image configuration suffixes) */
-#define GAME_MODE_MAIN 0
-#define GAME_MODE_LEVELS 1
-#define GAME_MODE_SCORES 2
-#define GAME_MODE_EDITOR 3
-#define GAME_MODE_INFO 4
-#define GAME_MODE_SETUP 5
-#define GAME_MODE_PSEUDO_DOOR 6
-#define GAME_MODE_PSEUDO_PREVIEW 7
-#define GAME_MODE_PSEUDO_CRUMBLED 8
+#define GAME_MODE_DEFAULT 0
+#define GAME_MODE_MAIN 1
+#define GAME_MODE_LEVELS 2
+#define GAME_MODE_SCORES 3
+#define GAME_MODE_EDITOR 4
+#define GAME_MODE_INFO 5
+#define GAME_MODE_SETUP 6
+#define GAME_MODE_PLAYING 7
+#define GAME_MODE_PSEUDO_DOOR 8
+#define GAME_MODE_PSEUDO_PREVIEW 9
+#define GAME_MODE_PSEUDO_CRUMBLED 10
/* there are no special config file suffixes for these modes */
-#define GAME_MODE_PLAYING 9
-#define GAME_MODE_PSEUDO_TYPENAME 10
-#define GAME_MODE_QUIT 11
-
-#define PROGRAM_VERSION_MAJOR 3
-#define PROGRAM_VERSION_MINOR 0
-#define PROGRAM_VERSION_PATCH 3
-#define PROGRAM_VERSION_RELEASE 0
-#define PROGRAM_VERSION_STRING "3.0.3"
-
-#define PROGRAM_TITLE_STRING "Rocks'n'Diamonds"
-#define PROGRAM_AUTHOR_STRING "Holger Schemel"
-#define PROGRAM_RIGHTS_STRING "Copyright ©1995-2003 by"
-#define PROGRAM_DOS_PORT_STRING "DOS port done by Guido Schulz"
-#define PROGRAM_IDENT_STRING PROGRAM_VERSION_STRING " " TARGET_STRING
-#define WINDOW_TITLE_STRING PROGRAM_TITLE_STRING " " PROGRAM_IDENT_STRING
-#define WINDOW_SUBTITLE_STRING PROGRAM_RIGHTS_STRING " " PROGRAM_AUTHOR_STRING
-#define ICON_TITLE_STRING PROGRAM_TITLE_STRING
-#define COOKIE_PREFIX "ROCKSNDIAMONDS"
-#define FILENAME_PREFIX "Rocks"
+#define GAME_MODE_PSEUDO_TYPENAME 11
+#define GAME_MODE_QUIT 12
+
+/* special definitions currently only used for custom artwork configuration */
+#define MUSIC_PREFIX_BACKGROUND 0
+#define NUM_MUSIC_PREFIXES 1
+#define MAX_LEVELS 1000
+
+/* definitions for demo animation lists */
+#define HELPANIM_LIST_NEXT -1
+#define HELPANIM_LIST_END -999
+
+
+/* program information and versioning definitions */
+
+#define PROGRAM_VERSION_MAJOR 3
+#define PROGRAM_VERSION_MINOR 2
+#define PROGRAM_VERSION_PATCH 0
+#define PROGRAM_VERSION_BUILD 1
+
+#define PROGRAM_TITLE_STRING "Rocks'n'Diamonds"
+#define PROGRAM_AUTHOR_STRING "Holger Schemel"
+#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2004 by Holger Schemel"
+
+#define ICON_TITLE_STRING PROGRAM_TITLE_STRING
+#define COOKIE_PREFIX "ROCKSNDIAMONDS"
+#define FILENAME_PREFIX "Rocks"
#if defined(PLATFORM_UNIX)
-#define USERDATA_DIRECTORY ".rocksndiamonds"
+#define USERDATA_DIRECTORY ".rocksndiamonds"
#elif defined(PLATFORM_WIN32)
-#define USERDATA_DIRECTORY PROGRAM_TITLE_STRING
+#define USERDATA_DIRECTORY PROGRAM_TITLE_STRING
#else
-#define USERDATA_DIRECTORY "userdata"
+#define USERDATA_DIRECTORY "userdata"
#endif
-#define X11_ICON_FILENAME "rocks_icon.xbm"
-#define X11_ICONMASK_FILENAME "rocks_iconmask.xbm"
-#define MSDOS_POINTER_FILENAME "mouse.pcx"
+#define X11_ICON_FILENAME "rocks_icon.xbm"
+#define X11_ICONMASK_FILENAME "rocks_iconmask.xbm"
+#define MSDOS_POINTER_FILENAME "mouse.pcx"
/* file version numbers for resource files (levels, tapes, score, setup, etc.)
** currently supported/known file version numbers:
** 1.4 (still in use)
** 2.0 (actual)
*/
-#define FILE_VERSION_1_0 VERSION_IDENT(1,0,0)
-#define FILE_VERSION_1_2 VERSION_IDENT(1,2,0)
-#define FILE_VERSION_1_4 VERSION_IDENT(1,4,0)
-#define FILE_VERSION_2_0 VERSION_IDENT(2,0,0)
+#define FILE_VERSION_1_0 VERSION_IDENT(1,0,0,0)
+#define FILE_VERSION_1_2 VERSION_IDENT(1,2,0,0)
+#define FILE_VERSION_1_4 VERSION_IDENT(1,4,0,0)
+#define FILE_VERSION_2_0 VERSION_IDENT(2,0,0,0)
/* file version does not change for every program version, but is changed
when new features are introduced that are incompatible with older file
versions, so that they can be treated accordingly */
-#define FILE_VERSION_ACTUAL FILE_VERSION_2_0
+#define FILE_VERSION_ACTUAL FILE_VERSION_2_0
-#define GAME_VERSION_1_0 FILE_VERSION_1_0
-#define GAME_VERSION_1_2 FILE_VERSION_1_2
-#define GAME_VERSION_1_4 FILE_VERSION_1_4
-#define GAME_VERSION_2_0 FILE_VERSION_2_0
+#define GAME_VERSION_1_0 FILE_VERSION_1_0
+#define GAME_VERSION_1_2 FILE_VERSION_1_2
+#define GAME_VERSION_1_4 FILE_VERSION_1_4
+#define GAME_VERSION_2_0 FILE_VERSION_2_0
-#define GAME_VERSION_ACTUAL RELEASE_IDENT(PROGRAM_VERSION_MAJOR, \
- PROGRAM_VERSION_MINOR, \
- PROGRAM_VERSION_PATCH, \
- PROGRAM_VERSION_RELEASE)
+#define GAME_VERSION_ACTUAL VERSION_IDENT(PROGRAM_VERSION_MAJOR, \
+ PROGRAM_VERSION_MINOR, \
+ PROGRAM_VERSION_PATCH, \
+ PROGRAM_VERSION_BUILD)
/* values for game_emulation */
-#define EMU_NONE 0
-#define EMU_BOULDERDASH 1
-#define EMU_SOKOBAN 2
-#define EMU_SUPAPLEX 3
+#define EMU_NONE 0
+#define EMU_BOULDERDASH 1
+#define EMU_SOKOBAN 2
+#define EMU_SUPAPLEX 3
+
+/* values for level file type identifier */
+#define LEVEL_FILE_TYPE_UNKNOWN 0
+#define LEVEL_FILE_TYPE_RND 1
+#define LEVEL_FILE_TYPE_BD 2
+#define LEVEL_FILE_TYPE_EM 3
+#define LEVEL_FILE_TYPE_SP 4
+#define LEVEL_FILE_TYPE_DX 5
+#define LEVEL_FILE_TYPE_SB 6
+#define LEVEL_FILE_TYPE_DC 7
+
+#define NUM_LEVEL_FILE_TYPES 8
+
+/* values for game engine type identifier */
+#define GAME_ENGINE_TYPE_UNKNOWN LEVEL_FILE_TYPE_UNKNOWN
+#define GAME_ENGINE_TYPE_RND LEVEL_FILE_TYPE_RND
+#define GAME_ENGINE_TYPE_EM LEVEL_FILE_TYPE_EM
+
+#define NUM_ENGINE_TYPES 3
+
+
+struct MenuInfo
+{
+ int draw_xoffset_default;
+ int draw_yoffset_default;
+ int draw_xoffset[NUM_SPECIAL_GFX_ARGS];
+ int draw_yoffset[NUM_SPECIAL_GFX_ARGS];
+
+ int scrollbar_xoffset;
+
+ int list_size_default;
+ int list_size[NUM_SPECIAL_GFX_ARGS];
+
+ int sound[NUM_SPECIAL_GFX_ARGS];
+ int music[NUM_SPECIAL_GFX_ARGS];
+};
+
+struct DoorInfo
+{
+ int step_offset;
+ int step_delay;
+ int anim_mode;
+};
struct HiScore
{
{
boolean present; /* player present in level playfield */
boolean connected; /* player connected (locally or via network) */
- boolean active; /* player (present && connected) */
+ boolean active; /* player present and connected */
- int index_nr, client_nr, element_nr;
+ int index_nr; /* player number (0 to 3) */
+ int index_bit; /* player number bit (1 << 0 to 1 << 3) */
+ int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
+ int client_nr; /* network client identifier */
byte action; /* action from local input device */
byte effective_action; /* action acknowledged from network server
byte programmed_action; /* action forced by game itself (like moving
through doors); overrides other actions */
- int jx,jy, last_jx,last_jy;
+ int jx, jy, last_jx, last_jy;
int MovDir, MovPos, GfxDir, GfxPos;
int Frame, StepFrame;
int GfxAction;
boolean use_murphy_graphic;
- boolean use_disk_red_graphic;
- boolean Pushing;
- boolean Switching;
+ boolean block_last_field;
+ int block_delay;
+
+ boolean can_fall_into_acid;
+
boolean LevelSolved, GameOver;
- boolean snapped;
int last_move_dir;
- boolean is_moving;
+
boolean is_waiting;
+ boolean is_moving;
+ boolean is_auto_moving;
boolean is_digging;
+ boolean is_snapping;
boolean is_collecting;
+ boolean is_pushing;
+ boolean is_switching;
+ boolean is_dropping;
+
+ boolean is_bored;
+ boolean is_sleeping;
+ int frame_counter_bored;
+ int frame_counter_sleeping;
+
+ int anim_delay_counter;
+ int post_delay_counter;
+
+ int action_waiting, last_action_waiting;
+ int special_action_bored;
+ int special_action_sleeping;
+
+ int num_special_action_bored;
+ int num_special_action_sleeping;
+
+ int switch_x, switch_y;
+
+ int show_envelope;
+
+#if 1 /* USE_NEW_MOVE_DELAY */
+ int move_delay;
+ int move_delay_value;
+#else
unsigned long move_delay;
int move_delay_value;
+#endif
+ int move_delay_reset_counter;
+
+#if 1 /* USE_NEW_PUSH_DELAY */
+ int push_delay;
+ int push_delay_value;
+#else
unsigned long push_delay;
unsigned long push_delay_value;
+#endif
unsigned long actual_frame_counter;
+ int drop_delay;
+
+ int step_counter;
+
int score;
int gems_still_needed;
int sokobanfields_still_needed;
int shield_deadly_time_left;
int inventory_element[MAX_INVENTORY_SIZE];
+ int inventory_infinite_element;
int inventory_size;
};
+struct LevelSetInfo
+{
+ int music[MAX_LEVELS];
+};
+
+struct LevelFileInfo
+{
+ int nr;
+ int type;
+ boolean packed;
+ char *basename;
+ char *filename;
+};
+
struct LevelInfo
{
+ struct LevelFileInfo file_info;
+
+ int game_engine_type;
+
+ /* level stored in native format for the alternative native game engines */
+ struct LevelInfo_EM *native_em_level;
+
int file_version; /* file format version the level is stored with */
int game_version; /* game release version the level was created with */
boolean encoding_16bit_amoeba; /* amoeba contains 16-bit elements */
int fieldx, fieldy;
- int time;
+
+ int time; /* available time (seconds) */
int gems_needed;
+
char name[MAX_LEVEL_NAME_LEN + 1];
char author[MAX_LEVEL_AUTHOR_LEN + 1];
- char envelope[MAX_ENVELOPE_TEXT_LEN + 1];
- int envelope_xsize, envelope_ysize;
+
+ char envelope_text[4][MAX_ENVELOPE_TEXT_LEN + 1];
+ int envelope_xsize[4], envelope_ysize[4];
+
int score[LEVEL_SCORE_ELEMENTS];
+
int yamyam_content[MAX_ELEMENT_CONTENTS][3][3];
int num_yamyam_contents;
+
int amoeba_speed;
int amoeba_content;
+
int time_magic_wall;
int time_wheel;
int time_light;
int time_timegate;
+
+ /* values for the new EMC elements */
+ int android_move_time;
+ int android_clone_time;
+ boolean ball_random;
+ boolean ball_state_initial;
+ int ball_time;
+ int lenses_score;
+ int magnify_score;
+ int slurp_score;
+ int lenses_time;
+ int magnify_time;
+ int wind_direction_initial;
+ int ball_content[NUM_MAGIC_BALL_CONTENTS][3][3];
+ boolean android_array[16];
+
+ int can_move_into_acid_bits; /* bitfield to store property for elements */
+ int dont_collide_with_bits; /* bitfield to store property for elements */
+
boolean double_speed;
- boolean gravity;
+ boolean initial_gravity;
boolean em_slippery_gems; /* EM style "gems slip from wall" behaviour */
+ boolean use_spring_bug; /* for compatibility with old levels */
+ boolean instant_relocation; /* no visual delay when relocating player */
+ boolean can_pass_to_walkable; /* player can pass to empty or walkable tile */
+ boolean grow_into_diggable; /* amoeba can grow into anything diggable */
+
+ boolean block_last_field; /* player blocks previous field while moving */
+ boolean sp_block_last_field; /* player blocks previous field while moving */
+ int block_delay; /* delay for blocking previous field */
+ int sp_block_delay; /* delay for blocking previous field */
+
+ /* ('int' instead of 'boolean' because used as selectbox value in editor) */
+ int use_step_counter; /* count steps instead of seconds for level */
short field[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
boolean use_custom_template; /* use custom properties from template file */
- boolean no_level_file; /* set for currently undefined levels */
+ boolean no_valid_file; /* set when level file missing or invalid */
+
+ boolean changed; /* set when level was changed in the editor */
};
struct TapeInfo
boolean pause_before_death;
boolean recording, playing, pausing;
boolean fast_forward;
- boolean index_search;
+ boolean warp_forward;
+ boolean deactivate_display;
boolean auto_play;
boolean auto_play_level_solved;
boolean quick_resume;
byte action[MAX_PLAYERS];
byte delay;
} pos[MAX_TAPELEN];
+
+ boolean no_valid_file; /* set when tape file missing or invalid */
};
struct GameInfo
{
+ /* values for engine initialization */
+ int default_push_delay_fixed;
+ int default_push_delay_random;
+
/* constant within running game */
int engine_version;
int emulation;
int initial_move_delay;
int initial_move_delay_value;
+ int initial_push_delay_value;
+
+ /* flags to handle bugs in and changes between different engine versions */
+ /* (for the latest engine version, these flags should always be "FALSE") */
+ boolean use_bug_change_when_pushing;
/* variable within running game */
int yamyam_content_nr;
int belt_dir_nr[4];
int switchgate_pos;
int balloon_dir;
+ boolean gravity;
boolean explosions_delayed;
+ boolean envelope_active;
+
+ /* values for player idle animation (no effect on engine) */
+ int player_boring_delay_fixed;
+ int player_boring_delay_random;
+ int player_sleeping_delay_fixed;
+ int player_sleeping_delay_random;
};
struct GlobalInfo
char *autoplay_leveldir;
int autoplay_level_nr;
+ char *convert_leveldir;
+ int convert_level_nr;
+
int num_toons;
float frames_per_second;
int fps_slowdown_factor;
};
-struct MenuInfo
+struct ElementChangeInfo
{
- int draw_xoffset_default;
- int draw_yoffset_default;
- int draw_xoffset[NUM_SPECIAL_GFX_ARGS];
- int draw_yoffset[NUM_SPECIAL_GFX_ARGS];
+ boolean can_change; /* use or ignore this change info */
- int scrollbar_xoffset;
+ unsigned long events; /* change events */
- int list_size_default;
- int list_size[NUM_SPECIAL_GFX_ARGS];
-};
-
-struct DoorInfo
-{
- int step_offset;
- int step_delay;
-};
-
-struct ElementChangeInfo
-{
- unsigned long events; /* bitfield for change events */
+ int trigger_player; /* player triggering change */
+ int trigger_side; /* side triggering change */
+ int trigger_page; /* page triggering change */
short target_element; /* target element after change */
int delay_random; /* added frame delay before changed (random) */
int delay_frames; /* either 1 (frames) or 50 (seconds; 50 fps) */
- short trigger_element; /* custom element triggering change */
+ short trigger_element; /* element triggering change */
- int content[3][3]; /* new elements after extended change */
- boolean use_content; /* use extended change content */
- boolean only_complete; /* only use complete content */
- boolean use_random_change; /* use random value for setting content */
- int random; /* random value for setting content */
- int power; /* power of extended change */
+ int target_content[3][3]; /* elements for extended change target */
+ boolean use_target_content; /* use extended change target */
+ boolean only_if_complete; /* only use complete target content */
+ boolean use_random_replace; /* use random value for replacing elements */
+ int random_percentage; /* random value for replacing elements */
+ int replace_when; /* type of elements that can be replaced */
boolean explode; /* explode instead of change */
+ /* ---------- internal values used at runtime when playing ---------- */
+
/* functions that are called before, while and after the change of an
element -- currently only used for non-custom elements */
void (*pre_change_function)(int x, int y);
void (*change_function)(int x, int y);
void (*post_change_function)(int x, int y);
+ short actual_trigger_element; /* element that actually triggered change */
+ int actual_trigger_player; /* player which actually triggered change */
+
/* ---------- internal values used in level editor ---------- */
- int player_action; /* touched/pressed/pushed by player */
- int collide_action; /* collision/impact/smashed */
- int other_action; /* various change actions */
+ int direct_action; /* change triggered by actions on element */
+ int other_action; /* change triggered by other element actions */
+};
+
+struct ElementGroupInfo
+{
+ int num_elements; /* number of elements in this group */
+ short element[MAX_ELEMENTS_IN_GROUP]; /* list of elements in this group */
+
+ int choice_mode; /* how to choose element from group */
+
+ /* ---------- internal values used at runtime when playing ---------- */
+
+ /* the following is the same as above, but with recursively resolved group
+ elements (group elements may also contain further group elements!) */
+ int num_elements_resolved;
+ short element_resolved[NUM_FILE_ELEMENTS];
+
+ int choice_pos; /* current element choice position */
+};
+
+struct ElementNameInfo
+{
+ /* ---------- token and description strings ---------- */
+
+ char *token_name; /* element token used in config files */
+ char *class_name; /* element class used in config files */
+ char *editor_description; /* pre-defined description for level editor */
};
struct ElementInfo
char *class_name; /* element class used in config files */
char *editor_description; /* pre-defined description for level editor */
char *custom_description; /* alternative description from config file */
- char description[MAX_ELEMENT_NAME_LEN + 1]; /* for custom elements */
+ char description[MAX_ELEMENT_NAME_LEN + 1]; /* for custom/group elements */
/* ---------- graphic and sound definitions ---------- */
boolean use_gfx_element; /* use custom graphic element */
short gfx_element; /* optional custom graphic element */
+ int access_direction; /* accessible from which direction */
+
int collect_score; /* score value for collecting */
int collect_count; /* count value for collecting */
- int push_delay_fixed; /* constant frame delay for pushing */
- int push_delay_random; /* additional random frame delay for pushing */
- int move_delay_fixed; /* constant frame delay for moving */
- int move_delay_random; /* additional random frame delay for moving */
+ int push_delay_fixed; /* constant delay before pushing */
+ int push_delay_random; /* additional random delay before pushing */
+ int drop_delay_fixed; /* constant delay after dropping */
+ int drop_delay_random; /* additional random delay after dropping */
+ int move_delay_fixed; /* constant delay after moving */
+ int move_delay_random; /* additional random delay after moving */
int move_pattern; /* direction movable element moves to */
int move_direction_initial; /* initial direction element moves to */
int move_stepsize; /* step size element moves with */
+ int move_enter_element; /* element that can be entered (and removed) */
+ int move_leave_element; /* element that can be left behind */
+ int move_leave_type; /* change (limited) or leave (unlimited) */
+
int slippery_type; /* how/where other elements slip away */
int content[3][3]; /* new elements after explosion */
+ int explosion_type; /* type of explosion, like 3x3, 3+3 or 1x1 */
+ 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 */
int num_change_pages; /* actual number of change pages */
int current_change_page; /* currently edited change page */
- /* ---------- internal values used in game at runtime ---------- */
+ struct ElementGroupInfo *group; /* pointer to element group info */
+
+ /* ---------- internal values used at runtime when playing ---------- */
unsigned long change_events; /* bitfield for combined change events */
+ int event_page_nr[NUM_CHANGE_EVENTS]; /* page number for each event */
+ struct ElementChangeInfo *event_page[NUM_CHANGE_EVENTS]; /* page for event */
+
+ boolean in_group[NUM_GROUP_ELEMENTS];
+
+#if 0
+ boolean can_leave_element; /* element can leave other element behind */
+ boolean can_leave_element_last;
+#endif
+
/* ---------- internal values used in level editor ---------- */
int access_type; /* walkable or passable */
int access_layer; /* accessible over/inside/under */
+ int access_protected; /* protection against deadly elements */
int walk_to_action; /* diggable/collectible/pushable */
int smash_targets; /* can smash player/enemies/everything */
int deadliness; /* deadly when running/colliding/touching */
- int consistency; /* indestructible/can explode */
boolean can_explode_by_fire; /* element explodes by fire */
boolean can_explode_smashed; /* element explodes when smashed */
int src_x, src_y; /* start position of animation frames */
int width, height; /* width/height of each animation frame */
int offset_x, offset_y; /* x/y offset to next animation frame */
+ int offset2_x, offset2_y; /* x/y offset to second movement tile */
+ boolean double_movement; /* animation has second movement tile */
+ int swap_double_tiles; /* explicitely force or forbid tile swapping */
int anim_frames;
int anim_frames_per_line;
int anim_start_frame;
boolean anim_global_sync;
int crumbled_like; /* element for cloning crumble graphics */
int diggable_like; /* element for cloning digging graphics */
+ int border_size; /* border size for "crumbled" graphics */
+ int scale_up_factor; /* optional factor for scaling image up */
+
+ int anim_delay_fixed; /* optional delay values for bored and */
+ int anim_delay_random; /* sleeping player animations (animation */
+ int post_delay_fixed; /* intervall and following pause before */
+ int post_delay_random; /* next intervall (bored animation only) */
int step_offset; /* optional step offset of toon animations */
int step_delay; /* optional step delay of toon animations */
int draw_x, draw_y; /* optional offset for drawing fonts chars */
+ int draw_masked; /* optional setting for drawing envelope gfx */
+
#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
Pixmap clip_mask; /* single-graphic-only clip mask for X11 */
GC clip_gc; /* single-graphic-only clip gc for X11 */
struct SoundInfo
{
boolean loop;
+ int volume;
+ int priority;
+};
+
+struct MusicInfo
+{
+ boolean loop;
+};
+
+struct MusicPrefixInfo
+{
+ char *prefix;
+ boolean is_loop_music;
+};
+
+struct MusicFileInfo
+{
+ char *basename;
+
+ char *title_header;
+ char *artist_header;
+ char *album_header;
+ char *year_header;
+
+ char *title;
+ char *artist;
+ char *album;
+ char *year;
+
+ int music;
+
+ boolean is_sound;
+
+ struct MusicFileInfo *next;
};
struct ElementActionInfo
int value;
};
+struct HelpAnimInfo
+{
+ int element;
+ int action;
+ int direction;
+
+ int delay;
+};
+
#if 0
extern GC tile_clip_gc;
extern boolean level_editor_test_game;
extern boolean network_playing;
+#if defined(TARGET_SDL)
+extern boolean network_server;
+extern SDL_Thread *server_thread;
+#endif
+
extern int key_joystick_mapping;
extern boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
extern short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short ChangeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short ChangePage[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short Back[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern boolean Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern boolean Pushed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern boolean Changing[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern short JustStopped[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern unsigned long Changed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern unsigned long ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short AmoebaCnt[MAX_NUM_AMOEBA];
extern short AmoebaCnt2[MAX_NUM_AMOEBA];
-extern short ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern int RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern int PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern unsigned long Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
extern int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern int GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern int GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern int GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern int lev_fieldx, lev_fieldy;
extern int scroll_x, scroll_y;
extern int ExitX, ExitY;
extern int AllPlayersGone;
-extern int TimeFrames, TimePlayed, TimeLeft;
+extern int TimeFrames, TimePlayed, TimeLeft, TapeTime;
extern boolean SiebAktiv;
extern int SiebCount;
extern int graphics_action_mapping[];
+extern struct LevelSetInfo levelset;
extern struct LevelInfo level, level_template;
extern struct PlayerInfo stored_player[], *local_player;
extern struct HiScore highscore[];
extern struct GameInfo game;
extern struct GlobalInfo global;
extern struct MenuInfo menu;
-extern struct DoorInfo door;
+extern struct DoorInfo door_1, door_2;
extern struct ElementInfo element_info[];
+extern struct ElementNameInfo element_name_info[];
extern struct ElementActionInfo element_action_info[];
extern struct ElementDirectionInfo element_direction_info[];
extern struct SpecialSuffixInfo special_suffix_info[];
extern struct TokenIntPtrInfo image_config_vars[];
extern struct FontInfo font_info[];
+extern struct MusicPrefixInfo music_prefix_info[];
extern struct GraphicInfo *graphic_info;
extern struct SoundInfo *sound_info;
-extern struct ConfigInfo image_config[], sound_config[];
-extern struct ConfigInfo image_config_suffix[], sound_config_suffix[];
+extern struct MusicInfo *music_info;
+extern struct MusicFileInfo *music_file_info;
+extern struct HelpAnimInfo *helpanim_info;
+extern SetupFileHash *helptext_info;
+extern struct ConfigTypeInfo image_config_suffix[];
+extern struct ConfigTypeInfo sound_config_suffix[];
+extern struct ConfigTypeInfo music_config_suffix[];
+extern struct ConfigInfo image_config[];
+extern struct ConfigInfo sound_config[];
+extern struct ConfigInfo music_config[];
+extern struct ConfigInfo helpanim_config[];
+extern struct ConfigInfo helptext_config[];
#endif /* MAIN_H */