From 8cf15a6854f69fbacdb06b574b188d4ae9b5f165 Mon Sep 17 00:00:00 2001 From: SiliconA-Z Date: Mon, 9 Mar 2026 11:32:28 -0400 Subject: [PATCH] Document ov5_021D12D0, which clearly handles zone changes in distortion world (#995) --- include/overlay005/fieldmap.h | 2 +- src/overlay005/fieldmap.c | 15 ++++++--------- src/overlay009/ov9_02249960.c | 4 ++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/include/overlay005/fieldmap.h b/include/overlay005/fieldmap.h index 621dfee95e..c968ebd668 100644 --- a/include/overlay005/fieldmap.h +++ b/include/overlay005/fieldmap.h @@ -8,7 +8,7 @@ extern const ApplicationManagerTemplate gFieldMapTemplate; -void ov5_021D12D0(FieldSystem *fieldSystem, u32 param1); +void FieldMap_ChangeZoneDistortionWorld(FieldSystem *fieldSystem, u32 mapId); void ov5_021D1434(BgConfig *param0); void ov5_021D143C(BgConfig *param0); void ov5_021D16F4(FieldSystem *fieldSystem, BOOL param1); diff --git a/src/overlay005/fieldmap.c b/src/overlay005/fieldmap.c index bad87f1645..72282f91d6 100644 --- a/src/overlay005/fieldmap.c +++ b/src/overlay005/fieldmap.c @@ -455,23 +455,20 @@ static BOOL FieldMap_ChangeZone(FieldSystem *fieldSystem) return TRUE; } -void ov5_021D12D0(FieldSystem *fieldSystem, u32 param1) +void FieldMap_ChangeZoneDistortionWorld(FieldSystem *fieldSystem, u32 mapId) { - u32 mapId; - FieldOverworldState *fieldState; + u32 oldMapId = fieldSystem->location->mapId; + FieldOverworldState *fieldState = SaveData_GetFieldOverworldState(fieldSystem->saveData); - mapId = fieldSystem->location->mapId; - fieldState = SaveData_GetFieldOverworldState(fieldSystem->saveData); + fieldSystem->location->mapId = mapId; - fieldSystem->location->mapId = param1; - - MapHeaderData_Load(fieldSystem, param1); + MapHeaderData_Load(fieldSystem, mapId); FieldMapChange_UpdateGameDataDistortionWorld(fieldSystem, 1); int objEventCount = MapHeaderData_GetNumObjectEvents(fieldSystem); const ObjectEvent *objEventList = MapHeaderData_GetObjectEvents(fieldSystem); - sub_0206184C(fieldSystem->mapObjMan, mapId, param1, objEventCount, objEventList); + sub_0206184C(fieldSystem->mapObjMan, oldMapId, mapId, objEventCount, objEventList); Sound_TryFadeOutToBGM(fieldSystem, Sound_GetOverrideBGM(fieldSystem, fieldSystem->location->mapId), 1); sub_0203A418(fieldSystem); diff --git a/src/overlay009/ov9_02249960.c b/src/overlay009/ov9_02249960.c index ffb3eca884..652e5b45ff 100644 --- a/src/overlay009/ov9_02249960.c +++ b/src/overlay009/ov9_02249960.c @@ -4717,7 +4717,7 @@ static int ov9_0224CCB8(DistWorldSystem *param0, UnkStruct_ov9_0224CBD8 *param1) v2 = GetConnectionsForMap(v2->nextID); param1->unk_0C = v2->currID; - ov5_021D12D0(param0->fieldSystem, param1->unk_0C); + FieldMap_ChangeZoneDistortionWorld(param0->fieldSystem, param1->unk_0C); ov9_0224BF18(param0, v2->nextID); LandDataManager_DistortionWorldEndWithoutFreeing(fieldSystem->landDataMan); @@ -4841,7 +4841,7 @@ static int ov9_0224CEBC(DistWorldSystem *param0, UnkStruct_ov9_0224CBD8 *param1) param1->unk_0C = v2->currID; - ov5_021D12D0(param0->fieldSystem, param1->unk_0C); + FieldMap_ChangeZoneDistortionWorld(param0->fieldSystem, param1->unk_0C); ov9_0224BEB4(param0, param1->unk_0C); if (v1->unk_10 == NULL) {