From: Holger Schemel Date: Sun, 19 Oct 2003 00:56:03 +0000 (+0200) Subject: rnd-20031019-3-src X-Git-Tag: 3.0.7^2~9 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d3eee47071cee093667ee49857d05d4f0142733e;p=rocksndiamonds.git rnd-20031019-3-src --- diff --git a/src/conftime.h b/src/conftime.h index eab05848..7d2dff02 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-10-19 01:34]" +#define COMPILE_DATE_STRING "[2003-10-19 02:53]" diff --git a/src/files.c b/src/files.c index fc7bfb7b..61bd1af8 100644 --- a/src/files.c +++ b/src/files.c @@ -186,8 +186,8 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) element_info[element].collect_score = 10; /* special default */ element_info[element].collect_count = 1; /* special default */ - element_info[element].push_delay_fixed = 8; /* special default */ - element_info[element].push_delay_random = 8; /* special default */ + element_info[element].push_delay_fixed = -1; /* initialize later */ + element_info[element].push_delay_random = -1; /* initialize later */ element_info[element].move_delay_fixed = 0; element_info[element].move_delay_random = 0; @@ -925,8 +925,6 @@ void LoadLevelFromFilename(struct LevelInfo *level, char *filename) fclose(file); } -#if 1 - static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) { if (leveldir_current == NULL) /* only when dumping level */ @@ -1051,122 +1049,36 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) } } - /* initialize element properties for level editor etc. */ - InitElementPropertiesEngine(level->game_version); -} - -static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename) -{ - int x, y; - - /* map elements that have changed in newer versions */ - for(y=0; yfieldy; y++) + /* set default push delay values (corrected since version 3.0.7) */ + if (level->game_version < VERSION_IDENT(3,0,7)) { - for(x=0; xfieldx; x++) - { - int element = level->field[x][y]; - - if (level->game_version <= VERSION_IDENT(2,2,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 (level->game_version < VERSION_IDENT(3,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); - } - - level->field[x][y] = element; - } - } - - /* copy elements to runtime playfield array */ - for(x=0; xfield[x][y]; - - /* initialize level size variables for faster access */ - lev_fieldx = level->fieldx; - lev_fieldy = level->fieldy; - - /* determine border element for this level */ - SetBorderElement(); -} - -#else - -static void LoadLevel_InitLevel(struct LevelInfo *level, char *filename) -{ - int i, j, x, y; - - if (leveldir_current == NULL) /* only when dumping level */ - return; - - /* determine correct game engine version of current level */ - if (IS_LEVELCLASS_CONTRIBUTION(leveldir_current) || - IS_LEVELCLASS_USER(leveldir_current)) - { -#if 0 - printf("\n::: This level is private or contributed: '%s'\n", filename); -#endif - - /* For user contributed and private levels, use the version of - the game engine the levels were created for. - Since 2.0.1, the game engine version is now directly stored - in the level file (chunk "VERS"), so there is no need anymore - to set the game version from the file version (except for old, - pre-2.0 levels, where the game version is still taken from the - file format version used to store the level -- see above). */ - - /* do some special adjustments to support older level versions */ - if (level->file_version == FILE_VERSION_1_0) - { - Error(ERR_WARN, "level file '%s'has version number 1.0", filename); - Error(ERR_WARN, "using high speed movement for player"); - - /* player was faster than monsters in (pre-)1.0 levels */ - level->double_speed = TRUE; - } - - /* Default behaviour for EM style gems was "slippery" only in 2.0.1 */ - if (level->game_version == VERSION_IDENT(2,0,1)) - level->em_slippery_gems = TRUE; + game.default_push_delay_fixed = 2; + game.default_push_delay_random = 8; } else { -#if 0 - printf("\n::: ALWAYS USE LATEST ENGINE FOR THIS LEVEL: [%d] '%s'\n", - leveldir_current->sort_priority, filename); -#endif + game.default_push_delay_fixed = 8; + game.default_push_delay_random = 8; + } - /* Always use the latest version of the game engine for all but - user contributed and private levels; this allows for actual - corrections in the game engine to take effect for existing, - converted levels (from "classic" or other existing games) to - make the game emulation more accurate, while (hopefully) not - breaking existing levels created from other players. */ + /* set uninitialized push delay values of custom elements in older levels */ + for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) + { + int element = EL_CUSTOM_START + i; - level->game_version = GAME_VERSION_ACTUAL; + if (element_info[element].push_delay_fixed == -1) + element_info[element].push_delay_fixed = game.default_push_delay_fixed; + if (element_info[element].push_delay_random == -1) + element_info[element].push_delay_random = game.default_push_delay_random; + } - /* Set special EM style gems behaviour: EM style gems slip down from - normal, steel and growing wall. As this is a more fundamental change, - it seems better to set the default behaviour to "off" (as it is more - natural) and make it configurable in the level editor (as a property - of gem style elements). Already existing converted levels (neither - private nor contributed levels) are changed to the new behaviour. */ + /* initialize element properties for level editor etc. */ + InitElementPropertiesEngine(level->game_version); +} - if (level->file_version < FILE_VERSION_2_0) - level->em_slippery_gems = TRUE; - } +static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename) +{ + int x, y; /* map elements that have changed in newer versions */ for(y=0; yfieldy; y++) @@ -1198,48 +1110,6 @@ static void LoadLevel_InitLevel(struct LevelInfo *level, char *filename) } } - /* map custom element change events that have changed in newer versions - (these following values have accidentally changed in version 3.0.1) */ - if (level->game_version <= VERSION_IDENT(3,0,0)) - { - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) - { - int element = EL_CUSTOM_START + i; - - /* order of checking events to be mapped is important */ - for (j=CE_BY_OTHER; j >= CE_BY_PLAYER; j--) - { - if (HAS_CHANGE_EVENT(element, j - 2)) - { - SET_CHANGE_EVENT(element, j - 2, FALSE); - SET_CHANGE_EVENT(element, j, TRUE); - } - } - - /* order of checking events to be mapped is important */ - for (j=CE_OTHER_GETS_COLLECTED; j >= CE_COLLISION; j--) - { - if (HAS_CHANGE_EVENT(element, j - 1)) - { - SET_CHANGE_EVENT(element, j - 1, FALSE); - SET_CHANGE_EVENT(element, j, TRUE); - } - } - } - } - - /* initialize "can_change" field for old levels with only one change page */ - if (level->game_version <= VERSION_IDENT(3,0,2)) - { - for (i=0; i < NUM_CUSTOM_ELEMENTS; i++) - { - int element = EL_CUSTOM_START + i; - - if (CAN_CHANGE(element)) - element_info[element].change->can_change = TRUE; - } - } - /* copy elements to runtime playfield array */ for(x=0; xgame_version); } -#endif - void LoadLevelTemplate(int level_nr) { char *filename = getLevelFilename(level_nr); diff --git a/src/game.c b/src/game.c index 87b47a8c..642b684c 100644 --- a/src/game.c +++ b/src/game.c @@ -927,9 +927,8 @@ static void InitGameEngine() { if (!IS_CUSTOM_ELEMENT(i)) { - element_info[i].push_delay_fixed = - (game.engine_version < VERSION_IDENT(3,0,7) ? 2 : 8); - element_info[i].push_delay_random = 8; + element_info[i].push_delay_fixed = game.default_push_delay_fixed; + element_info[i].push_delay_random = game.default_push_delay_random; } } diff --git a/src/main.h b/src/main.h index bf7bb7ff..7f689c34 100644 --- a/src/main.h +++ b/src/main.h @@ -1246,6 +1246,10 @@ struct TapeInfo 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;