diff --git a/asm/macros/map.inc b/asm/macros/map.inc index 2040553355..9fd21223ff 100644 --- a/asm/macros/map.inc +++ b/asm/macros/map.inc @@ -160,6 +160,6 @@ .endm @ Defines the flags for a map header. Mirrors the layout of the bitfield in struct MapHeader in include/global.fieldmap.h - .macro map_header_flags allow_cycling:req, allow_escaping:req, allow_running:req, show_map_name:req - .byte ((\show_map_name & 1) << 3) | ((\allow_running & 1) << 2) | ((\allow_escaping & 1) << 1) | \allow_cycling + .macro map_header_flags allow_cycling:req, allow_escaping:req, allow_running:req, show_map_name:req, write_specialvar_iseffect:req + .byte ((\write_specialvar_iseffect & 1) << 4) | ((\show_map_name & 1) << 3) | ((\allow_running & 1) << 2) | ((\allow_escaping & 1) << 1) | \allow_cycling .endm diff --git a/data/maps/BattleFrontier_BattleDomeBattleRoom/map.json b/data/maps/BattleFrontier_BattleDomeBattleRoom/map.json index b4407e55d6..2cbb02a243 100644 --- a/data/maps/BattleFrontier_BattleDomeBattleRoom/map.json +++ b/data/maps/BattleFrontier_BattleDomeBattleRoom/map.json @@ -11,6 +11,7 @@ "allow_escaping": false, "allow_running": false, "show_map_name": false, + "write_specialvar_iseffect": true, "battle_scene": "MAP_BATTLE_SCENE_NORMAL", "connections": null, "object_events": [ diff --git a/data/maps/BattleFrontier_BattleDomeCorridor/map.json b/data/maps/BattleFrontier_BattleDomeCorridor/map.json index bb2088e7fc..f55a3e44bc 100644 --- a/data/maps/BattleFrontier_BattleDomeCorridor/map.json +++ b/data/maps/BattleFrontier_BattleDomeCorridor/map.json @@ -11,6 +11,7 @@ "allow_escaping": false, "allow_running": false, "show_map_name": false, + "write_specialvar_iseffect": true, "battle_scene": "MAP_BATTLE_SCENE_NORMAL", "connections": null, "object_events": [ diff --git a/data/maps/BattleFrontier_BattleDomePreBattleRoom/map.json b/data/maps/BattleFrontier_BattleDomePreBattleRoom/map.json index 5c5b891797..c8e439b126 100644 --- a/data/maps/BattleFrontier_BattleDomePreBattleRoom/map.json +++ b/data/maps/BattleFrontier_BattleDomePreBattleRoom/map.json @@ -11,6 +11,7 @@ "allow_escaping": false, "allow_running": false, "show_map_name": false, + "write_specialvar_iseffect": true, "battle_scene": "MAP_BATTLE_SCENE_NORMAL", "connections": null, "object_events": [ diff --git a/data/maps/BattleFrontier_BattleDomePreBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleDomePreBattleRoom/scripts.inc index 3406d4121c..e06284c2ca 100644 --- a/data/maps/BattleFrontier_BattleDomePreBattleRoom/scripts.inc +++ b/data/maps/BattleFrontier_BattleDomePreBattleRoom/scripts.inc @@ -18,7 +18,6 @@ BattleFrontier_BattleDomePreBattleRoom_OnFrame: BattleFrontier_BattleDomePreBattleRoom_EventScript_EnterRoom:: goto_if_eq VAR_0x8006, 1, BattleFrontier_BattleDomePreBattleRoom_EventScript_ReturnFromBattle - delay 1 frontier_set FRONTIER_DATA_RECORD_DISABLED, TRUE setvar VAR_TEMP_0, 1 applymovement LOCALID_PLAYER, BattleFrontier_BattleDomePreBattleRoom_Movement_PlayerEnter diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 6ed5f37fc6..b62901e5ff 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -240,8 +240,9 @@ struct MapHeader /* 0x1A */ bool8 allowCycling:1; bool8 allowEscaping:1; // Escape Rope and Dig bool8 allowRunning:1; - bool8 showMapName:5; // the last 4 bits are unused - // but the 5 bit sized bitfield is required to match + bool8 showMapName:1; + bool8 writeSpecialVarIsEffect:4; // the last 3 bits are unused + // but the 4 bit sized bitfield is required to match /* 0x1B */ u8 battleType; }; diff --git a/src/script.c b/src/script.c index 97b7f7bc7f..59306ec999 100644 --- a/src/script.c +++ b/src/script.c @@ -648,7 +648,9 @@ void Script_RequestWriteVar_Internal(u32 varId) { if (varId == 0) return; - if (SPECIAL_VARS_START <= varId && varId <= SPECIAL_VARS_END) + + if ((!gMapHeader.writeSpecialVarIsEffect) + && (SPECIAL_VARS_START <= varId && varId <= SPECIAL_VARS_END)) return; Script_RequestEffects(SCREFF_V1 | SCREFF_SAVE); } diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index 57e7c1337d..d884dac616 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -175,11 +175,17 @@ string generate_map_header_text(Json map_data, Json layouts_data) { if (version == "ruby") text << "\t.byte " << json_to_string(map_data, "show_map_name") << "\n"; else if (version == "emerald" || version == "firered") + { text << "\tmap_header_flags " << "allow_cycling=" << json_to_string(map_data, "allow_cycling") << ", " << "allow_escaping=" << json_to_string(map_data, "allow_escaping") << ", " << "allow_running=" << json_to_string(map_data, "allow_running") << ", " - << "show_map_name=" << json_to_string(map_data, "show_map_name") << "\n"; + << "show_map_name=" << json_to_string(map_data, "show_map_name") << ", "; + if (map_data.object_items().find("write_specialvar_iseffect") != map_data.object_items().end()) + text << "write_specialvar_iseffect=" << json_to_string(map_data, "write_specialvar_iseffect") << "\n"; + else + text << "write_specialvar_iseffect=FALSE" << "\n"; + } if (version == "firered") text << "\t.byte " << json_to_string(map_data, "floor_number") << "\n";