2004-06-11
* fixed bug with wrong door state after trying to quickload empty tape
+ * fixed waste of static memory usage of the binary, making it smaller
+ * fixed very little graphical bug in Supaplex explosion
2004-06-07
* version number set to 3.1.1
reliable default values. If that value is GFX_ARG_UNDEFINED, it will
be dynamically determined, using some of the other list values. */
-struct ConfigInfo image_config_suffix[] =
+struct ConfigTypeInfo image_config_suffix[] =
{
{ ".x", ARG_UNDEFINED, TYPE_INTEGER },
{ ".y", ARG_UNDEFINED, TYPE_INTEGER },
reliable default values. If that value is MUS_ARG_UNDEFINED, it will
be dynamically determined, using some of the other list values. */
-struct ConfigInfo music_config_suffix[] =
+struct ConfigTypeInfo music_config_suffix[] =
{
{ ".mode_loop", ARG_UNDEFINED, TYPE_BOOLEAN },
reliable default values. If that value is SND_ARG_UNDEFINED, it will
be dynamically determined, using some of the other list values. */
-struct ConfigInfo sound_config_suffix[] =
+struct ConfigTypeInfo sound_config_suffix[] =
{
{ ".mode_loop", ARG_UNDEFINED, TYPE_BOOLEAN },
-#define COMPILE_DATE_STRING "[2004-06-11 03:48]"
+#define COMPILE_DATE_STRING "[2004-06-12 03:59]"
/* EXPERIMENTAL STUFF */
#define USE_NEW_MOVEMENT FALSE
+#define USE_NEW_MOVE_DELAY TRUE *1
+#define USE_NEW_PUSH_DELAY TRUE *1
/* for DigField() */
#define DF_NO_PUSH 0
/* forward declaration for internal use */
+static void AdvanceFrameAndPlayerCounters(int);
+
static boolean MovePlayerOneStep(struct PlayerInfo *, int, int, int, int);
static boolean MovePlayer(struct PlayerInfo *, int, int);
static void ScrollPlayer(struct PlayerInfo *, int);
/*
=============================================================================
- InitGameEngine()
+ InitGameEngine()
-----------------------------------------------------------------------------
initialize game engine due to level / tape version number
=============================================================================
/* ---------- initialize player's initial move delay --------------------- */
+#if USE_NEW_MOVE_DELAY
+ /* dynamically adjust player properties according to level information */
+ game.initial_move_delay_value =
+ (level.double_speed ? MOVE_DELAY_HIGH_SPEED : MOVE_DELAY_NORMAL_SPEED);
+
+ /* dynamically adjust player properties according to game engine version */
+ game.initial_move_delay = (game.engine_version <= VERSION_IDENT(2,0,1,0) ?
+ game.initial_move_delay_value : 0);
+#else
/* dynamically adjust player properties according to game engine version */
game.initial_move_delay =
(game.engine_version <= VERSION_IDENT(2,0,1,0) ? INITIAL_MOVE_DELAY_ON :
/* dynamically adjust player properties according to level information */
game.initial_move_delay_value =
(level.double_speed ? MOVE_DELAY_HIGH_SPEED : MOVE_DELAY_NORMAL_SPEED);
+#endif
/* ---------- initialize player's initial push delay --------------------- */
player->move_delay_reset_counter = 0;
- player->push_delay = 0;
+#if USE_NEW_PUSH_DELAY
+ player->push_delay = -1; /* initialized when pushing starts */
player->push_delay_value = game.initial_push_delay_value;
+#else
+ player->push_delay = 0;
+ player->push_delay_value = game.initial_push_delay_value;
+#endif
player->drop_delay = 0;
{
ScrollPlayer(player, SCROLL_GO_ON);
ScrollScreen(NULL, SCROLL_GO_ON);
+
+#if USE_NEW_MOVE_DELAY
+ AdvanceFrameAndPlayerCounters(player->index_nr);
+#else
FrameCounter++;
+#endif
DrawPlayer(player);
}
#endif
+void AdvanceFrameAndPlayerCounters(int player_nr)
+{
+ int i;
+
+ /* advance frame counters (global frame counter and time frame counter) */
+ FrameCounter++;
+ TimeFrames++;
+
+ /* advance player counters (counters for move delay, move animation etc.) */
+ for (i = 0; i < MAX_PLAYERS; i++)
+ {
+ boolean advance_player_counters = (player_nr == -1 || player_nr == i);
+ int move_frames =
+ MOVE_DELAY_NORMAL_SPEED / stored_player[i].move_delay_value;
+
+ if (!advance_player_counters) /* not all players may be affected */
+ continue;
+
+ stored_player[i].Frame += move_frames;
+
+ if (stored_player[i].MovPos != 0)
+ stored_player[i].StepFrame += move_frames;
+
+#if USE_NEW_MOVE_DELAY
+ if (stored_player[i].move_delay > 0)
+ stored_player[i].move_delay--;
+#endif
+
+#if USE_NEW_PUSH_DELAY
+ /* due to bugs in previous versions, counter must count up, not down */
+ if (stored_player[i].push_delay != -1)
+ stored_player[i].push_delay++;
+#endif
+
+ if (stored_player[i].drop_delay > 0)
+ stored_player[i].drop_delay--;
+ }
+}
+
void GameActions()
{
static unsigned long action_delay = 0;
stored_player[0].StepFrame);
#endif
-#if 1
+#if USE_NEW_MOVE_DELAY
+ AdvanceFrameAndPlayerCounters(-1); /* advance counters for all players */
+#else
FrameCounter++;
TimeFrames++;
if (stored_player[i].MovPos != 0)
stored_player[i].StepFrame += move_frames;
+#if USE_NEW_MOVE_DELAY
+ if (stored_player[i].move_delay > 0)
+ stored_player[i].move_delay--;
+#endif
+
if (stored_player[i].drop_delay > 0)
stored_player[i].drop_delay--;
}
player->move_delay + player->move_delay_value);
#endif
+#if USE_NEW_MOVE_DELAY
+ if (player->move_delay > 0)
+#else
if (!FrameReached(&player->move_delay, player->move_delay_value))
+#endif
{
#if 0
printf("::: can NOT move\n");
printf("::: COULD move now\n");
#endif
+#if USE_NEW_MOVE_DELAY
+ player->move_delay = -1; /* set to "uninitialized" value */
+#endif
+
/* store if player is automatically moved to next field */
player->is_auto_moving = (player->programmed_action != MV_NO_MOVING);
{
ScrollPlayer(player, SCROLL_GO_ON);
ScrollScreen(NULL, SCROLL_GO_ON);
+
+#if USE_NEW_MOVE_DELAY
+ AdvanceFrameAndPlayerCounters(player->index_nr);
+#else
FrameCounter++;
+#endif
+
DrawAllPlayers();
BackToFront();
}
#endif
}
+#if USE_NEW_MOVE_DELAY
+ if (player->move_delay == -1) /* not yet initialized by DigField() */
+ player->move_delay = player->move_delay_value;
+#endif
+
if (game.engine_version < VERSION_IDENT(3,0,7,0))
{
TestIfHeroTouchesBadThing(jx, jy);
if (mode == DF_NO_PUSH) /* player just stopped pushing */
{
player->is_switching = FALSE;
+#if USE_NEW_PUSH_DELAY
+ player->push_delay = -1;
+#else
player->push_delay = 0;
+#endif
return MF_NO_ACTION;
}
if (!checkDiagonalPushing(player, x, y, real_dx, real_dy))
return MF_NO_ACTION;
+#if USE_NEW_PUSH_DELAY
+
+#if 0
+ if ( (player->push_delay == -1) != (player->push_delay2 == 0) )
+ printf("::: ALERT: %d, %d [%d / %d]\n",
+ player->push_delay, player->push_delay2,
+ FrameCounter, FrameCounter / 50);
+#endif
+
+ if (player->push_delay == -1) /* new pushing; restart delay */
+ player->push_delay = 0;
+#else
if (player->push_delay == 0) /* new pushing; restart delay */
player->push_delay = FrameCounter;
+#endif
+
+#if USE_NEW_PUSH_DELAY
+#if 0
+ if ( (player->push_delay > 0) != (!xxx_fr) )
+ printf("::: PUSH BUG! %d, (%d -> %d) %d [%d / %d]\n",
+ player->push_delay,
+ xxx_pdv2, player->push_delay2, player->push_delay_value,
+ FrameCounter, FrameCounter / 50);
+#endif
+
+#if 0
+ if (player->push_delay > 0 &&
+ !(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
+ element != EL_SPRING && element != EL_BALLOON)
+#else
+ /* !!! */
+ if (player->push_delay < player->push_delay_value &&
+ !(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
+ element != EL_SPRING && element != EL_BALLOON)
+#endif
+#else
if (!FrameReached(&player->push_delay, player->push_delay_value) &&
!(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
element != EL_SPRING && element != EL_BALLOON)
+#endif
{
/* make sure that there is no move delay before next try to push */
+#if USE_NEW_MOVE_DELAY
+ if (game.engine_version >= VERSION_IDENT(3,0,7,1))
+ player->move_delay = 0;
+#else
if (game.engine_version >= VERSION_IDENT(3,0,7,1))
player->move_delay = INITIAL_MOVE_DELAY_OFF;
+#endif
return MF_NO_ACTION;
}
return MF_NO_ACTION;
}
+#if USE_NEW_PUSH_DELAY
+ player->push_delay = -1;
+#else
player->push_delay = 0;
+#endif
if (Feld[x][y] != element) /* really digged/collected something */
player->is_collecting = !player->is_digging;
static void InitGlobal()
{
+ int i;
+
+ for (i = 0; i < MAX_NUM_ELEMENTS + 1; i++)
+ {
+ element_info[i].token_name = element_name_info[i].token_name;
+ element_info[i].class_name = element_name_info[i].class_name;
+ element_info[i].editor_description=element_name_info[i].editor_description;
+ }
+
global.autoplay_leveldir = NULL;
global.convert_leveldir = NULL;
}
void InitImageList(struct ConfigInfo *config_list, int num_file_list_entries,
- struct ConfigInfo *config_suffix_list,
+ struct ConfigTypeInfo *config_suffix_list,
char **base_prefixes, char **ext1_suffixes,
char **ext2_suffixes, char **ext3_suffixes,
char **ignore_tokens)
char *getImageConfigFilename();
int getImageListPropertyMappingSize();
struct PropertyMapping *getImageListPropertyMapping();
-void InitImageList(struct ConfigInfo *, int, struct ConfigInfo *,
+void InitImageList(struct ConfigInfo *, int, struct ConfigTypeInfo *,
char **, char **, char **, char **, char **);
void ReloadCustomImages();
struct ListNodeInfo ***, int *);
struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list,
- struct ConfigInfo *suffix_list,
+ struct ConfigTypeInfo *suffix_list,
char **ignore_tokens,
int num_file_list_entries)
{
#define KNOWN_TOKEN_VALUE "[KNOWN_TOKEN_VALUE]"
static void read_token_parameters(SetupFileHash *setup_file_hash,
- struct ConfigInfo *suffix_list,
+ struct ConfigTypeInfo *suffix_list,
struct FileInfo *file_list_entry)
{
/* check for config token that is the base token without any suffixes */
static void add_dynamic_file_list_entry(struct FileInfo **list,
int *num_list_entries,
SetupFileHash *extra_file_hash,
- struct ConfigInfo *suffix_list,
+ struct ConfigTypeInfo *suffix_list,
int num_suffix_list_entries,
char *token)
{
char *filename)
{
struct FileInfo *file_list = artwork_info->file_list;
- struct ConfigInfo *suffix_list = artwork_info->suffix_list;
+ struct ConfigTypeInfo *suffix_list = artwork_info->suffix_list;
char **base_prefixes = artwork_info->base_prefixes;
char **ext1_suffixes = artwork_info->ext1_suffixes;
char **ext2_suffixes = artwork_info->ext2_suffixes;
int get_auto_parameter_value(char *, char *);
struct FileInfo *getFileListFromConfigList(struct ConfigInfo *,
- struct ConfigInfo *, char **, int);
+ struct ConfigTypeInfo *,
+ char **, int);
void LoadArtworkConfig(struct ArtworkListInfo *);
void ReloadCustomArtworkList(struct ArtworkListInfo *);
void FreeCustomArtworkLists(struct ArtworkListInfo *);
}
void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries,
- struct ConfigInfo *config_suffix_list,
+ struct ConfigTypeInfo *config_suffix_list,
char **base_prefixes, char **ext1_suffixes,
char **ext2_suffixes, char **ext3_suffixes,
char **ignore_tokens)
}
void InitMusicList(struct ConfigInfo *config_list, int num_file_list_entries,
- struct ConfigInfo *config_suffix_list,
+ struct ConfigTypeInfo *config_suffix_list,
char **base_prefixes, char **ext1_suffixes,
char **ext2_suffixes, char **ext3_suffixes,
char **ignore_tokens)
int getMusicListPropertyMappingSize();
struct PropertyMapping *getSoundListPropertyMapping();
struct PropertyMapping *getMusicListPropertyMapping();
-void InitSoundList(struct ConfigInfo *, int, struct ConfigInfo *,
+void InitSoundList(struct ConfigInfo *, int, struct ConfigTypeInfo *,
char **, char **, char **, char **, char **);
-void InitMusicList(struct ConfigInfo *, int, struct ConfigInfo *,
+void InitMusicList(struct ConfigInfo *, int, struct ConfigTypeInfo *,
char **, char **, char **, char **, char **);
void InitReloadCustomSounds(char *);
void InitReloadCustomMusic(char *);
};
struct ConfigInfo
+{
+ char *token;
+ char *value;
+};
+
+struct ConfigTypeInfo
{
char *token;
char *value;
struct FileInfo *dynamic_file_list; /* dynamic artwrk file array */
int num_suffix_list_entries;
- struct ConfigInfo *suffix_list; /* parameter suffixes array */
+ struct ConfigTypeInfo *suffix_list; /* parameter suffixes array */
int num_base_prefixes;
int num_ext1_suffixes;
/* element definitions */
/* ------------------------------------------------------------------------- */
-struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1] =
+struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1];
+
+/* this contains predefined structure elements to initialize "element_info" */
+struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
{
/* keyword to start parser: "ELEMENT_INFO_START" <-- do not change! */
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 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
{
/* ---------- token and description strings ---------- */
extern struct MenuInfo menu;
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 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 image_config_suffix[];
-extern struct ConfigInfo sound_config_suffix[];
-extern struct ConfigInfo music_config_suffix[];
extern struct ConfigInfo helpanim_config[];
extern struct ConfigInfo helptext_config[];