#define EP_HAS_ACTION 87
#define EP_CAN_CHANGE_OR_HAS_ACTION 88
-#define NUM_ELEMENT_PROPERTIES 89
+/* values for internal purpose only (other) */
+#define EP_OBSOLETE 89
+
+#define NUM_ELEMENT_PROPERTIES 90
#define NUM_EP_BITFIELDS ((NUM_ELEMENT_PROPERTIES + 31) / 32)
-#define EP_BITFIELD_BASE 0
+#define EP_BITFIELD_BASE_NR 0
+#define EP_BITMASK_BASE_DEFAULT (1 << EP_CAN_MOVE_INTO_ACID)
#define EP_BITMASK_DEFAULT 0
#define PROPERTY_BIT(p) (1 << ((p) % 32))
#define CE_MOVE_OF_X 35
#define CE_DIGGING_X 36
#define CE_CREATION_OF_X 37
+#define CE_SCORE_GETS_ZERO 38
+#define CE_SCORE_GETS_ZERO_OF_X 39
+#define CE_VALUE_CHANGES 40
+#define CE_VALUE_CHANGES_OF_X 41
+#define CE_SCORE_CHANGES 42
+#define CE_SCORE_CHANGES_OF_X 43
+
+#define NUM_CHANGE_EVENTS 44
-#define NUM_CHANGE_EVENTS 38
+#define NUM_CE_BITFIELDS ((NUM_CHANGE_EVENTS + 31) / 32)
#define CE_BITMASK_DEFAULT 0
+#define CH_EVENT_BITFIELD_NR(e) (e / 32)
+#define CH_EVENT_BIT(e) (1 << ((e) % 32))
+
#define CH_EVENT_VAR(e,c) (element_info[e].change->has_event[c])
#define CH_ANY_EVENT_VAR(e,c) (element_info[e].has_change_event[c])
#define CA_SET_LEVEL_GEMS 7
#define CA_SET_LEVEL_SCORE 8
#define CA_SET_LEVEL_WIND 9
-#define CA_SET_LEVEL_GRAVITY 10
+#define CA_SET_PLAYER_GRAVITY 10
#define CA_SET_PLAYER_KEYS 11
#define CA_SET_PLAYER_SPEED 12
#define CA_SET_PLAYER_SHIELD 13
#define CA_ARG_ELEMENT_RESET (CA_ARG_ELEMENT + 0)
#define CA_ARG_ELEMENT_TARGET (CA_ARG_ELEMENT + 1)
#define CA_ARG_ELEMENT_TRIGGER (CA_ARG_ELEMENT + 2)
-#define CA_ARG_ELEMENT_HEADLINE (CA_ARG_ELEMENT + 998)
+#define CA_ARG_ELEMENT_HEADLINE (CA_ARG_ELEMENT + 997)
#define CA_ARG_ELEMENT_CV_TARGET (CA_ARG_ELEMENT_TARGET)
#define CA_ARG_ELEMENT_CV_TRIGGER (CA_ARG_ELEMENT_TRIGGER)
#define CA_ARG_ELEMENT_CV_HEADLINE (CA_ARG_ELEMENT_HEADLINE)
#define CA_ARG_ELEMENT_NR_TARGET (CA_ARG_ELEMENT + 3)
#define CA_ARG_ELEMENT_NR_TRIGGER (CA_ARG_ELEMENT + 4)
-#define CA_ARG_ELEMENT_NR_HEADLINE (CA_ARG_ELEMENT + 999)
+#define CA_ARG_ELEMENT_NR_HEADLINE (CA_ARG_ELEMENT + 998)
+#define CA_ARG_ELEMENT_CS_TARGET (CA_ARG_ELEMENT + 5)
+#define CA_ARG_ELEMENT_CS_TRIGGER (CA_ARG_ELEMENT + 6)
+#define CA_ARG_ELEMENT_CS_HEADLINE (CA_ARG_ELEMENT + 999)
#define CA_ARG_SPEED 13000
#define CA_ARG_SPEED_NOT_MOVING (CA_ARG_SPEED + STEPSIZE_NOT_MOVING)
#define CA_ARG_SPEED_VERY_SLOW (CA_ARG_SPEED + STEPSIZE_VERY_SLOW)
#define CAN_CHANGE_OR_HAS_ACTION(e) \
HAS_PROPERTY(e, EP_CAN_CHANGE_OR_HAS_ACTION)
+#define IS_OBSOLETE(e) HAS_PROPERTY(e, EP_OBSOLETE)
+
/* special macros used in game engine */
#define IS_CUSTOM_ELEMENT(e) ((e) >= EL_CUSTOM_START && \
(e) <= EL_CUSTOM_END)
#define GFX_ELEMENT(e) (element_info[e].use_gfx_element ? \
element_info[e].gfx_element : e)
+/* !!! CHECK THIS !!! */
+#if 1
+#define TILE_GFX_ELEMENT(x, y) \
+ (GfxElement[x][y] != EL_UNDEFINED && \
+ Feld[x][y] != EL_EXPLOSION ? \
+ GfxElement[x][y] : Feld[x][y])
+#else
+#define TILE_GFX_ELEMENT(x, y) \
+ GFX_ELEMENT(GfxElement[x][y] != EL_UNDEFINED && \
+ Feld[x][y] != EL_EXPLOSION ? \
+ GfxElement[x][y] : Feld[x][y])
+#endif
+
/* !!! "use sound" deactivated due to problems with level "bug machine" !!! */
/* (solution: add separate "use sound of element" to level file and editor) */
#if 0
IS_EDITOR_CASCADE_ACTIVE(e) ? (e) - 1 : (e))
#define EL_NAME(e) ((e) >= 0 ? element_info[e].token_name : "(?)")
+#define MV_TEXT(d) ((d) == MV_NONE ? "MV_NONE" : \
+ (d) == MV_LEFT ? "MV_LEFT" : \
+ (d) == MV_RIGHT ? "MV_RIGHT" : \
+ (d) == MV_UP ? "MV_UP" : \
+ (d) == MV_DOWN ? "MV_DOWN" : "(various)")
/* 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 (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_LEVEL_NAME_LEN 32
#define MAX_LEVEL_AUTHOR_LEN 32
#define MAX_ELEMENT_NAME_LEN 32
-#define MAX_TAPE_LEN (1000 * FRAMES_PER_SECOND) /* max.time x fps */
#define MAX_TAPES_PER_SET 1024
#define MAX_SCORE_ENTRIES 100
+#define MAX_NUM_TITLE_SCREENS 5
+
#define MAX_NUM_AMOEBA 100
+
+#if 0 /* game.h */
#define MAX_INVENTORY_SIZE 1000
#define STD_NUM_KEYS 4
#define MAX_NUM_KEYS 8
+#endif
+
#define NUM_BELTS 4
#define NUM_BELT_PARTS 3
+#define NUM_ENVELOPES 4
#define MIN_ENVELOPE_XSIZE 1
#define MIN_ENVELOPE_YSIZE 1
#define MAX_ENVELOPE_XSIZE 30
#define STD_ELEMENT_CONTENTS 4
#define MAX_ELEMENT_CONTENTS 8
-#define LEVEL_SCORE_ELEMENTS 16 /* level elements with score */
-
/* often used screen positions */
#define SX 8
#define SY 8
#define SC_CRYSTAL 11
#define SC_PEARL 12
#define SC_SHIELD 13
+#define SC_UNKNOWN_14 14
+#define SC_UNKNOWN_15 15
+
+#define LEVEL_SCORE_ELEMENTS 16 /* level elements with score */
/* "real" level file elements */
#define EL_EMC_DRIPPER 704
#define EL_TRIGGER_CE_VALUE 705
+#define EL_TRIGGER_CE_SCORE 706
+#define EL_CURRENT_CE_VALUE 707
+#define EL_CURRENT_CE_SCORE 708
+
+#define EL_YAMYAM_LEFT 709
+#define EL_YAMYAM_RIGHT 710
+#define EL_YAMYAM_UP 711
+#define EL_YAMYAM_DOWN 712
-#define NUM_FILE_ELEMENTS 706
+#define EL_BD_EXPANDABLE_WALL 713
+
+#define NUM_FILE_ELEMENTS 714
/* "real" (and therefore drawable) runtime elements */
#define EL_INTERNAL_CASCADE_CE_ACTIVE (EL_FIRST_INTERNAL + 23)
#define EL_INTERNAL_CASCADE_GE (EL_FIRST_INTERNAL + 24)
#define EL_INTERNAL_CASCADE_GE_ACTIVE (EL_FIRST_INTERNAL + 25)
-#define EL_INTERNAL_CASCADE_USER (EL_FIRST_INTERNAL + 26)
-#define EL_INTERNAL_CASCADE_USER_ACTIVE (EL_FIRST_INTERNAL + 27)
-#define EL_INTERNAL_CASCADE_GENERIC (EL_FIRST_INTERNAL + 28)
-#define EL_INTERNAL_CASCADE_GENERIC_ACTIVE (EL_FIRST_INTERNAL + 29)
+#define EL_INTERNAL_CASCADE_REF (EL_FIRST_INTERNAL + 26)
+#define EL_INTERNAL_CASCADE_REF_ACTIVE (EL_FIRST_INTERNAL + 27)
+#define EL_INTERNAL_CASCADE_USER (EL_FIRST_INTERNAL + 28)
+#define EL_INTERNAL_CASCADE_USER_ACTIVE (EL_FIRST_INTERNAL + 29)
#define EL_INTERNAL_CASCADE_DYNAMIC (EL_FIRST_INTERNAL + 30)
#define EL_INTERNAL_CASCADE_DYNAMIC_ACTIVE (EL_FIRST_INTERNAL + 31)
/* values for special image configuration suffixes (must match game mode) */
#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 GFX_SPECIAL_ARG_TITLE 1
+#define GFX_SPECIAL_ARG_MAIN 2
+#define GFX_SPECIAL_ARG_LEVELS 3
+#define GFX_SPECIAL_ARG_SCORES 4
+#define GFX_SPECIAL_ARG_EDITOR 5
+#define GFX_SPECIAL_ARG_INFO 6
+#define GFX_SPECIAL_ARG_SETUP 7
+#define GFX_SPECIAL_ARG_PLAYING 8
+#define GFX_SPECIAL_ARG_DOOR 9
+#define GFX_SPECIAL_ARG_PREVIEW 10
+#define GFX_SPECIAL_ARG_CRUMBLED 11
-#define NUM_SPECIAL_GFX_ARGS 11
+#define NUM_SPECIAL_GFX_ARGS 12
/* values for image configuration suffixes */
#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 FONT_LEVEL_NUMBER_ACTIVE 29
+#define FONT_LEVEL_NUMBER 30
+#define FONT_TAPE_RECORDER 31
+#define FONT_GAME_INFO 32
-#define NUM_FONTS 32
+#define NUM_FONTS 33
#define NUM_INITIAL_FONTS 4
/* values for game_status (must match special image configuration suffixes) */
#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
+#define GAME_MODE_TITLE 1
+#define GAME_MODE_MAIN 2
+#define GAME_MODE_LEVELS 3
+#define GAME_MODE_SCORES 4
+#define GAME_MODE_EDITOR 5
+#define GAME_MODE_INFO 6
+#define GAME_MODE_SETUP 7
+#define GAME_MODE_PLAYING 8
+#define GAME_MODE_PSEUDO_DOOR 9
+#define GAME_MODE_PSEUDO_PREVIEW 10
+#define GAME_MODE_PSEUDO_CRUMBLED 11
/* there are no special config file suffixes for these modes */
-#define GAME_MODE_PSEUDO_TYPENAME 11
-#define GAME_MODE_QUIT 12
+#define GAME_MODE_PSEUDO_TYPENAME 12
+#define GAME_MODE_QUIT 13
/* special definitions currently only used for custom artwork configuration */
#define MUSIC_PREFIX_BACKGROUND 0
#define PROGRAM_VERSION_MAJOR 3
#define PROGRAM_VERSION_MINOR 2
#define PROGRAM_VERSION_PATCH 0
-#define PROGRAM_VERSION_BUILD 7
+#define PROGRAM_VERSION_BUILD 9
#define PROGRAM_TITLE_STRING "Rocks'n'Diamonds"
#define PROGRAM_AUTHOR_STRING "Holger Schemel"
#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)
+#define FILE_VERSION_3_0 VERSION_IDENT(3,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_3_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_3_0 FILE_VERSION_3_0
#define GAME_VERSION_ACTUAL VERSION_IDENT(PROGRAM_VERSION_MAJOR, \
PROGRAM_VERSION_MINOR, \
int e[3][3];
};
-struct PlayerInfo
+struct EnvelopeInfo
{
- boolean present; /* player present in level playfield */
- boolean connected; /* player connected (locally or via network) */
- boolean active; /* player present and connected */
-
- 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
- or summarized over all configured input
- devices when in single player mode */
- byte programmed_action; /* action forced by game itself (like moving
- through doors); overrides other actions */
-
- int jx, jy, last_jx, last_jy;
- int MovDir, MovPos, GfxDir, GfxPos;
- int Frame, StepFrame;
-
- int GfxAction;
-
- boolean use_murphy;
- int artwork_element;
-
- boolean block_last_field;
- int block_delay_adjustment; /* needed for different engine versions */
-
- boolean can_fall_into_acid;
-
- boolean LevelSolved, GameOver;
-
- int last_move_dir;
-
- 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;
-
- boolean cannot_move;
+ int xsize;
+ int ysize;
- 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 drop_x, drop_y;
-
- int show_envelope;
-
- int move_delay;
- int move_delay_value;
- int move_delay_value_next;
- int move_delay_reset_counter;
-
- int push_delay;
- int push_delay_value;
-
- unsigned long actual_frame_counter;
-
- int drop_delay;
-
- int step_counter;
-
- int score;
- int gems_still_needed;
- int sokobanfields_still_needed;
- int lights_still_needed;
- int friends_still_needed;
- int key[MAX_NUM_KEYS];
- int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
- int shield_normal_time_left;
- int shield_deadly_time_left;
-
- int inventory_element[MAX_INVENTORY_SIZE];
- int inventory_infinite_element;
- int inventory_size;
+ char text[MAX_ENVELOPE_TEXT_LEN + 1];
};
struct LevelSetInfo
char *filename;
};
+struct DateInfo
+{
+ int year;
+ int month;
+ int day;
+};
+
struct LevelInfo
{
struct LevelFileInfo file_info;
int file_version; /* file format version the level is stored with */
int game_version; /* game release version the level was created with */
+ struct DateInfo creation_date;
+
boolean encoding_16bit_field; /* level contains 16-bit elements */
boolean encoding_16bit_yamyam; /* yamyam contains 16-bit elements */
boolean encoding_16bit_amoeba; /* amoeba contains 16-bit elements */
char name[MAX_LEVEL_NAME_LEN + 1];
char author[MAX_LEVEL_AUTHOR_LEN + 1];
- char envelope_text[4][MAX_ENVELOPE_TEXT_LEN + 1];
- int envelope_xsize[4], envelope_ysize[4];
+ struct EnvelopeInfo envelope[NUM_ENVELOPES];
int score[LEVEL_SCORE_ELEMENTS];
int can_move_into_acid_bits; /* bitfield to store property for elements */
int dont_collide_with_bits; /* bitfield to store property for elements */
- int initial_player_stepsize; /* initial player speed */
+ int initial_player_stepsize[MAX_PLAYERS]; /* initial player speed */
+ boolean initial_player_gravity[MAX_PLAYERS];
- boolean initial_gravity;
boolean em_slippery_gems; /* EM style "gems slip from wall" behaviour */
boolean use_spring_bug; /* for compatibility with old levels */
boolean use_time_orb_bug; /* for compatibility with old levels */
boolean can_pass_to_walkable; /* player can pass to empty or walkable tile */
boolean grow_into_diggable; /* amoeba can grow into anything diggable */
+ boolean continuous_snapping; /* repeated snapping without releasing key */
boolean block_snap_field; /* snapping blocks field to show animation */
boolean block_last_field; /* player blocks previous field while moving */
boolean sp_block_last_field; /* player blocks previous field while moving */
boolean changed; /* set when level was changed in the editor */
};
-struct TapeInfo
-{
- int file_version; /* file format version the tape is stored with */
- int game_version; /* game release version the tape was created with */
- int engine_version; /* game engine version the tape was recorded with */
-
- char *level_identifier;
- int level_nr;
- unsigned long random_seed;
- unsigned long date;
- unsigned long counter;
- unsigned long length;
- unsigned long length_seconds;
- unsigned int delay_played;
- boolean pause_before_death;
- boolean recording, playing, pausing;
- boolean fast_forward;
- boolean warp_forward;
- boolean deactivate_display;
- boolean auto_play;
- boolean auto_play_level_solved;
- boolean quick_resume;
- boolean single_step;
- boolean changed;
- boolean player_participates[MAX_PLAYERS];
- int num_participating_players;
-
- struct
- {
- byte action[MAX_PLAYERS];
- byte delay;
- } pos[MAX_TAPE_LEN];
-
- 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_change_when_pushing_bug;
- boolean use_block_last_field_bug;
- boolean max_num_changes_per_frame;
- boolean use_reverse_scan_direction;
-
- /* variable within running game */
- int yamyam_content_nr;
- boolean magic_wall_active;
- int magic_wall_time_left;
- int light_time_left;
- int timegate_time_left;
- int belt_dir[4];
- int belt_dir_nr[4];
- int switchgate_pos;
- int wind_direction;
- boolean gravity;
- boolean explosions_delayed;
- boolean envelope_active;
-
-#if 1
- /* values for the new EMC elements */
- int lenses_time_left;
- int magnify_time_left;
- boolean ball_state;
- int ball_content_nr;
-#endif
-
- /* 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;
-
- /* values for special game initialization control */
- boolean restart_level;
-
- /* values for special game control */
- int centered_to_player;
- int centered_to_player_next;
-};
-
struct GlobalInfo
{
char *autoplay_leveldir;
int actual_trigger_side; /* element side that triggered the change */
int actual_trigger_player; /* player which actually triggered change */
int actual_trigger_ce_value; /* CE value of element that triggered change */
+ int actual_trigger_ce_score; /* CE score of element that triggered change */
boolean can_change_or_has_action; /* can_change | has_action */
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_xoffset; /* optional offset for drawing font chars */
+ int draw_yoffset; /* optional offset for drawing font chars */
int draw_masked; /* optional setting for drawing envelope gfx */
};
-extern Bitmap *bitmap_db_field, *bitmap_db_door;
+extern Bitmap *bitmap_db_title;
+extern Bitmap *bitmap_db_field;
+extern Bitmap *bitmap_db_door;
extern Pixmap tile_clipmask[];
-extern DrawBuffer *fieldbuffer;
-extern DrawBuffer *drawto_field;
+extern DrawBuffer *fieldbuffer;
+extern DrawBuffer *drawto_field;
extern int game_status;
extern boolean level_editor_test_game;
extern struct LevelSetInfo levelset;
extern struct LevelInfo level, level_template;
-extern struct PlayerInfo stored_player[], *local_player;
extern struct HiScore highscore[];
extern struct TapeInfo tape;
-extern struct GameInfo game;
extern struct GlobalInfo global;
extern struct MenuInfo menu;
extern struct DoorInfo door_1, door_2;