X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ffiles.c;h=239b85ec89a51863584162e5c2a7a9f840016854;hb=5ba7f2d9a3f07f342afdf215a3307d5487cb6d43;hp=6c2261d5038087e946190592687cd80894883b06;hpb=25324e48a023debcf7848c1c04fd4236cf7e6fb9;p=rocksndiamonds.git diff --git a/src/files.c b/src/files.c index 6c2261d5..239b85ec 100644 --- a/src/files.c +++ b/src/files.c @@ -182,6 +182,12 @@ static struct LevelFileConfigInfo chunk_config_INFO[] = &li.gems_needed, 0 }, + { + -1, -1, + TYPE_INTEGER, CONF_VALUE_32_BIT(2), + &li.random_seed, 0 + }, + { -1, -1, TYPE_BOOLEAN, CONF_VALUE_8_BIT(2), @@ -2029,6 +2035,7 @@ int getMappedElement(int element) case EL_KEY_OBSOLETE: element = EL_KEY_1; + break; case EL_EM_KEY_1_FILE_OBSOLETE: element = EL_EM_KEY_1; @@ -6153,6 +6160,9 @@ void LoadLevelFromFileInfo(struct LevelInfo *level, case LEVEL_FILE_TYPE_SP: LoadLevelFromFileInfo_SP(level, level_file_info); +#if 1 + level->game_engine_type = GAME_ENGINE_TYPE_SP; +#endif break; case LEVEL_FILE_TYPE_DC: @@ -6338,6 +6348,32 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) change->target_element = EL_PLAYER_1; } +#if 1 + /* try to detect and fix "Zelda" style levels, which are broken with 3.2.5 */ + if (level->game_version < VERSION_IDENT(3,2,5,0)) + { + /* This is needed to fix a problem that was caused by a bugfix in function + game.c/CheckTriggeredElementChangeExt() introduced with 3.2.5 that + corrects the behaviour when a custom element changes to another custom + element with a higher element number that has change actions defined. + Normally, only one change per frame is allowed for custom elements. + Therefore, it is checked if a custom element already changed in the + current frame; if it did, subsequent changes are suppressed. + Unfortunately, this is only checked for element changes, but not for + change actions, which are still executed. As the function above loops + through all custom elements from lower to higher, an element change + resulting in a lower CE number won't be checked again, while a target + element with a higher number will also be checked, and potential change + actions will get executed for this CE, too (which is wrong), while + further changes are ignored (which is correct). As this bugfix breaks + Zelda II (and introduces graphical bugs to Zelda I, and also breaks a + few other levels like Alan Bond's "FMV"), allow the previous, incorrect + behaviour for existing levels and tapes that make use of this bug */ + + level->use_action_after_change_bug = TRUE; + } +#else + /* !!! THIS DOES NOT FIX "Zelda I" (GRAPHICALLY) AND "Alan's FMV" LEVELS */ /* try to detect and fix "Zelda II" levels, which are broken with 3.2.5 */ { int element = EL_CUSTOM_16; @@ -6364,6 +6400,7 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) strncmp(ei->description, "scanline - row 1", 16) == 0) level->use_action_after_change_bug = TRUE; } +#endif /* not centering level after relocating player was default only in 3.2.3 */ if (level->game_version == VERSION_IDENT(3,2,3,0)) /* (no pre-releases) */ @@ -9861,6 +9898,8 @@ void CreateLevelSketchImages() Bitmap *bitmap2; int i; + InitElementPropertiesGfxElement(); + bitmap1 = CreateBitmap(TILEX, TILEY, DEFAULT_DEPTH); bitmap2 = CreateBitmap(MINI_TILEX, MINI_TILEY, DEFAULT_DEPTH); @@ -9868,7 +9907,8 @@ void CreateLevelSketchImages() { Bitmap *src_bitmap; int src_x, src_y; - int graphic = el2edimg(i); + int element = getMappedElement(i); + int graphic = el2edimg(element); char basename1[16]; char basename2[16]; char *filename1;