X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Ffiles.c;h=7a29e1eebac839ff06d01b1bc3a068a3404a3c38;hb=7992b03de18aad8527835dfa03375f3a30a7e673;hp=6195f9613c5cc304df3f36258a53bcf9d4723c9a;hpb=ec2269c79c8535f2124dd8b0f0780e25d679be2b;p=rocksndiamonds.git diff --git a/src/files.c b/src/files.c index 6195f961..7a29e1ee 100644 --- a/src/files.c +++ b/src/files.c @@ -311,6 +311,22 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = TYPE_ELEMENT, CONF_VALUE_16_BIT(3), &li.explosion_element[0], EL_PLAYER_1 }, + { + EL_PLAYER_1, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(13), + &li.use_initial_inventory[0], FALSE + }, + { + EL_PLAYER_1, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(14), + &li.initial_inventory_size[0], 1 + }, + { + EL_PLAYER_1, -1, + TYPE_ELEMENT_LIST, CONF_VALUE_BYTES(1), + &li.initial_inventory_content[0][0],EL_EMPTY, NULL, + &li.initial_inventory_size[0], 1, MAX_INITIAL_INVENTORY_SIZE + }, { EL_PLAYER_2, -1, @@ -352,6 +368,22 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = TYPE_ELEMENT, CONF_VALUE_16_BIT(3), &li.explosion_element[1], EL_PLAYER_2 }, + { + EL_PLAYER_2, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(13), + &li.use_initial_inventory[1], FALSE + }, + { + EL_PLAYER_2, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(14), + &li.initial_inventory_size[1], 1 + }, + { + EL_PLAYER_2, -1, + TYPE_ELEMENT_LIST, CONF_VALUE_BYTES(1), + &li.initial_inventory_content[1][0],EL_EMPTY, NULL, + &li.initial_inventory_size[1], 1, MAX_INITIAL_INVENTORY_SIZE + }, { EL_PLAYER_3, -1, @@ -393,6 +425,22 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = TYPE_ELEMENT, CONF_VALUE_16_BIT(3), &li.explosion_element[2], EL_PLAYER_3 }, + { + EL_PLAYER_3, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(13), + &li.use_initial_inventory[2], FALSE + }, + { + EL_PLAYER_3, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(14), + &li.initial_inventory_size[2], 1 + }, + { + EL_PLAYER_3, -1, + TYPE_ELEMENT_LIST, CONF_VALUE_BYTES(1), + &li.initial_inventory_content[2][0],EL_EMPTY, NULL, + &li.initial_inventory_size[2], 1, MAX_INITIAL_INVENTORY_SIZE + }, { EL_PLAYER_4, -1, @@ -434,6 +482,22 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = TYPE_ELEMENT, CONF_VALUE_16_BIT(3), &li.explosion_element[3], EL_PLAYER_4 }, + { + EL_PLAYER_4, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(13), + &li.use_initial_inventory[3], FALSE + }, + { + EL_PLAYER_4, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(14), + &li.initial_inventory_size[3], 1 + }, + { + EL_PLAYER_4, -1, + TYPE_ELEMENT_LIST, CONF_VALUE_BYTES(1), + &li.initial_inventory_content[3][0],EL_EMPTY, NULL, + &li.initial_inventory_size[3], 1, MAX_INITIAL_INVENTORY_SIZE + }, { EL_EMERALD, -1, @@ -1100,6 +1164,12 @@ static struct LevelFileConfigInfo chunk_config_CUSX_change[] = &xx_change.action_arg, CA_ARG_UNDEFINED }, + { + -1, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(7), + &xx_change.action_element, EL_EMPTY_SPACE + }, + { -1, -1, TYPE_CONTENT_LIST, CONF_VALUE_BYTES(1), @@ -1620,6 +1690,9 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) level->changed = FALSE; + /* set all bug compatibility flags to "false" => do not emulate this bug */ + level->use_action_after_change_bug = FALSE; + if (leveldir_current == NULL) /* only when dumping level */ return; @@ -6239,7 +6312,7 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) /* try to detect and fix "Snake Bite" levels, which are broken with 3.2.0 */ { - int element = EL_CUSTOM_START + 255; + int element = EL_CUSTOM_256; struct ElementInfo *ei = &element_info[element]; struct ElementChangeInfo *change = &ei->change_page[0]; @@ -6259,6 +6332,33 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) change->target_element = EL_PLAYER_1; } + /* try to detect and fix "Zelda II" levels, which are broken with 3.2.5 */ + { + int element = EL_CUSTOM_16; + struct ElementInfo *ei = &element_info[element]; + + /* 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 (but no other levels), allow the previous, incorrect behaviour + for this outstanding level set to not break the game or existing tapes */ + + if (strncmp(leveldir_current->identifier, "zelda2", 6) == 0 || + strncmp(ei->description, "scanline - row 1", 16) == 0) + level->use_action_after_change_bug = TRUE; + } + /* 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) */ level->shifted_relocation = TRUE;