This commit is contained in:
FosterProgramming 2026-03-21 08:02:48 +01:00 committed by GitHub
commit 301d2bb45a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 18 additions and 7 deletions

View File

@ -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

View File

@ -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": [

View File

@ -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": [

View File

@ -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": [

View File

@ -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

View File

@ -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;
};

View File

@ -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);
}

View File

@ -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";