From fd1c9b7a9b8d2fc25b2b4beffc224c39ee73bb35 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 2 Mar 2004 22:18:56 +0100 Subject: [PATCH] rnd-20040302-1-src --- src/conftime.h | 2 +- src/files.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- src/game.c | 10 +++++++++- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index 8c2c13bb..b1b02084 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-03-01 02:26]" +#define COMPILE_DATE_STRING "[2004-03-02 09:41]" diff --git a/src/files.c b/src/files.c index 8e6ec1bb..a6b41e1b 100644 --- a/src/files.c +++ b/src/files.c @@ -549,7 +549,7 @@ static struct LevelFileInfo *getLevelFileInfo(int nr) int getMappedElement(int element) { - /* map some (historic, now obsolete) elements */ + /* remap some (historic, now obsolete) elements */ #if 1 switch (element) @@ -610,6 +610,32 @@ int getMappedElement(int element) return element; } +int getMappedElementByVersion(int element, int game_version) +{ + /* remap some elements due to certain game version */ + + if (game_version <= VERSION_IDENT(2,2,0,0)) + { + /* map game font elements */ + element = (element == EL_CHAR('[') ? EL_CHAR_AUMLAUT : + element == EL_CHAR('\\') ? EL_CHAR_OUMLAUT : + element == EL_CHAR(']') ? EL_CHAR_UUMLAUT : + element == EL_CHAR('^') ? EL_CHAR_COPYRIGHT : element); + } + + if (game_version < VERSION_IDENT(3,0,0,0)) + { + /* map Supaplex gravity tube elements */ + element = (element == EL_SP_GRAVITY_PORT_LEFT ? EL_SP_PORT_LEFT : + element == EL_SP_GRAVITY_PORT_RIGHT ? EL_SP_PORT_RIGHT : + element == EL_SP_GRAVITY_PORT_UP ? EL_SP_PORT_UP : + element == EL_SP_GRAVITY_PORT_DOWN ? EL_SP_PORT_DOWN : + element); + } + + return element; +} + static int LoadLevel_VERS(FILE *file, int chunk_size, struct LevelInfo *level) { level->file_version = getFileVersion(file); @@ -2130,7 +2156,7 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) { - int i, j; + int i, j, x, y; /* map custom element change events that have changed in newer versions (these following values were accidentally changed in version 3.0.1) */ @@ -2189,7 +2215,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) } } - /* correct custom element fields (for old levels without these options) */ + /* correct custom element values (for old levels without these options) */ for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { int element = EL_CUSTOM_START + i; @@ -2232,6 +2258,16 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) } #endif + /* map elements that have changed in newer versions */ + level->amoeba_content = getMappedElementByVersion(level->amoeba_content, + level->game_version); + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) + for (x = 0; x < 3; x++) + for (y = 0; y < 3; y++) + level->yamyam_content[i][x][y] = + getMappedElementByVersion(level->yamyam_content[i][x][y], + level->game_version); + /* initialize element properties for level editor etc. */ InitElementPropertiesEngine(level->game_version); } @@ -2247,6 +2283,9 @@ static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename) { int element = level->field[x][y]; +#if 1 + element = getMappedElementByVersion(element, level->game_version); +#else if (level->game_version <= VERSION_IDENT(2,2,0,0)) { /* map game font elements */ @@ -2265,6 +2304,7 @@ static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename) element == EL_SP_GRAVITY_PORT_DOWN ? EL_SP_PORT_DOWN : element); } +#endif level->field[x][y] = element; } diff --git a/src/game.c b/src/game.c index bffde89c..560a0272 100644 --- a/src/game.c +++ b/src/game.c @@ -7382,6 +7382,12 @@ void GameActions() recorded_player_action = (tape.playing ? TapePlayAction() : NULL); +#if 1 + if (recorded_player_action != NULL) + for (i = 0; i < MAX_PLAYERS; i++) + stored_player[i].action = recorded_player_action[i]; +#endif + for (i = 0; i < MAX_PLAYERS; i++) { summarized_player_action |= stored_player[i].action; @@ -7413,11 +7419,13 @@ void GameActions() #if 0 if (stored_player[i].programmed_action && stored_player[i].programmed_action != recorded_player_action[i]) - printf("::: %d <-> %d\n", + printf("::: %d: %d <-> %d\n", i, stored_player[i].programmed_action, recorded_player_action[i]); #endif +#if 0 actual_player_action = recorded_player_action[i]; +#endif } #if 0 -- 2.34.1