mirror of https://github.com/pret/pokeemerald.git
Misc overworld documentation
This commit is contained in:
parent
2c0f5f58e9
commit
d59f5a8e56
|
@ -578,10 +578,10 @@ _080F5D58:
|
||||||
adds r0, r5, 0
|
adds r0, r5, 0
|
||||||
movs r1, 0
|
movs r1, 0
|
||||||
bl VarSet
|
bl VarSet
|
||||||
bl sub_8076D5C
|
bl SetContinueGameWarpStatusToDynamicWarp
|
||||||
movs r0, 0x1
|
movs r0, 0x1
|
||||||
bl TrySavingData
|
bl TrySavingData
|
||||||
bl sav2_gender2_inplace_and_xFE
|
bl ClearContinueGameWarpStatus2
|
||||||
adds r0, r5, 0
|
adds r0, r5, 0
|
||||||
adds r1, r4, 0
|
adds r1, r4, 0
|
||||||
bl VarSet
|
bl VarSet
|
||||||
|
@ -5598,7 +5598,7 @@ _080F874C:
|
||||||
movs r3, 0x1
|
movs r3, 0x1
|
||||||
negs r3, r3
|
negs r3, r3
|
||||||
movs r0, 0
|
movs r0, 0
|
||||||
bl saved_warp2_set
|
bl SetDynamicWarp
|
||||||
bl ScriptContext2_Disable
|
bl ScriptContext2_Disable
|
||||||
bl EnableBothScriptContexts
|
bl EnableBothScriptContexts
|
||||||
_080F877E:
|
_080F877E:
|
||||||
|
|
|
@ -15686,7 +15686,7 @@ _0801EB04:
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
cmp r0, 0
|
cmp r0, 0
|
||||||
bne _0801EBC2
|
bne _0801EBC2
|
||||||
bl sub_8076D5C
|
bl SetContinueGameWarpStatusToDynamicWarp
|
||||||
movs r0, 0
|
movs r0, 0
|
||||||
bl TrySavingData
|
bl TrySavingData
|
||||||
ldr r0, =gUnknown_02022C84
|
ldr r0, =gUnknown_02022C84
|
||||||
|
@ -15713,7 +15713,7 @@ _0801EB40:
|
||||||
bne _0801EBC2
|
bne _0801EBC2
|
||||||
movs r0, 0x37
|
movs r0, 0x37
|
||||||
bl PlaySE
|
bl PlaySE
|
||||||
bl sav2_gender2_inplace_and_xFE
|
bl ClearContinueGameWarpStatus2
|
||||||
ldr r0, =gUnknown_02022C84
|
ldr r0, =gUnknown_02022C84
|
||||||
ldr r1, [r0]
|
ldr r1, [r0]
|
||||||
movs r0, 0xA
|
movs r0, 0xA
|
||||||
|
@ -20568,7 +20568,7 @@ _080211EC:
|
||||||
beq _080211F8
|
beq _080211F8
|
||||||
b _08021302
|
b _08021302
|
||||||
_080211F8:
|
_080211F8:
|
||||||
bl sub_81971D0
|
bl InitStandardTextBoxWindows
|
||||||
bl sub_8197200
|
bl sub_8197200
|
||||||
adds r0, r5, 0
|
adds r0, r5, 0
|
||||||
bl sub_8022588
|
bl sub_8022588
|
||||||
|
@ -39128,7 +39128,7 @@ _0802A7CE:
|
||||||
movs r1, 0
|
movs r1, 0
|
||||||
movs r2, 0
|
movs r2, 0
|
||||||
bl ChangeBgY
|
bl ChangeBgY
|
||||||
bl sub_81971D0
|
bl InitStandardTextBoxWindows
|
||||||
bl sub_8197200
|
bl sub_8197200
|
||||||
movs r1, 0x82
|
movs r1, 0x82
|
||||||
lsls r1, 5
|
lsls r1, 5
|
||||||
|
|
|
@ -13851,7 +13851,7 @@ _0807EDCE:
|
||||||
movs r0, 0x2
|
movs r0, 0x2
|
||||||
bl sub_801B990
|
bl sub_801B990
|
||||||
_0807EDF6:
|
_0807EDF6:
|
||||||
bl sub_8076D5C
|
bl SetContinueGameWarpStatusToDynamicWarp
|
||||||
bl sub_8153380
|
bl sub_8153380
|
||||||
ldr r1, =gMain
|
ldr r1, =gMain
|
||||||
movs r2, 0x87
|
movs r2, 0x87
|
||||||
|
@ -13884,7 +13884,7 @@ _0807EE38:
|
||||||
lsrs r1, r0, 24
|
lsrs r1, r0, 24
|
||||||
cmp r1, 0
|
cmp r1, 0
|
||||||
beq _0807EE5C
|
beq _0807EE5C
|
||||||
bl sav2_gender2_inplace_and_xFE
|
bl ClearContinueGameWarpStatus2
|
||||||
ldr r0, =gMain
|
ldr r0, =gMain
|
||||||
movs r1, 0x87
|
movs r1, 0x87
|
||||||
lsls r1, 3
|
lsls r1, 3
|
||||||
|
|
|
@ -4971,7 +4971,7 @@ _080C5204:
|
||||||
b _080C52C8
|
b _080C52C8
|
||||||
_080C5214:
|
_080C5214:
|
||||||
str r4, [r0]
|
str r4, [r0]
|
||||||
bl sav1_map_get_name
|
bl GetCurrentRegionMapSectionId
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
lsrs r4, r0, 24
|
lsrs r4, r0, 24
|
||||||
cmp r4, 0x3A
|
cmp r4, 0x3A
|
||||||
|
@ -7780,7 +7780,7 @@ sub_80C6974: @ 80C6974
|
||||||
adds r1, r6
|
adds r1, r6
|
||||||
ldrb r1, [r1, 0xC]
|
ldrb r1, [r1, 0xC]
|
||||||
bl StartSpriteAnim
|
bl StartSpriteAnim
|
||||||
bl sav1_map_get_name
|
bl GetCurrentRegionMapSectionId
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
lsrs r5, r0, 24
|
lsrs r5, r0, 24
|
||||||
cmp r5, 0x3A
|
cmp r5, 0x3A
|
||||||
|
|
|
@ -536,6 +536,6 @@
|
||||||
#define PH_NURSE_HELD 608
|
#define PH_NURSE_HELD 608
|
||||||
#define PH_NURSE_SOLO 609
|
#define PH_NURSE_SOLO 609
|
||||||
|
|
||||||
#define MUS_ROUTE_118 0x7FFF // What is this for?
|
#define MUS_ROUTE_118 0x7FFF // map is split into 2 music sections. controlled by GetCurrLocationDefaultMusic().
|
||||||
|
|
||||||
#endif // GUARD_CONSTANTS_SONGS_H
|
#endif // GUARD_CONSTANTS_SONGS_H
|
||||||
|
|
|
@ -521,7 +521,7 @@ struct SaveBlock2
|
||||||
{
|
{
|
||||||
/*0x00*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
|
/*0x00*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
|
||||||
/*0x08*/ u8 playerGender; // MALE, FEMALE
|
/*0x08*/ u8 playerGender; // MALE, FEMALE
|
||||||
/*0x09*/ u8 specialSaveWarp;
|
/*0x09*/ u8 specialSaveWarpFlags;
|
||||||
/*0x0A*/ u8 playerTrainerId[4];
|
/*0x0A*/ u8 playerTrainerId[4];
|
||||||
/*0x0E*/ u16 playTimeHours;
|
/*0x0E*/ u16 playTimeHours;
|
||||||
/*0x10*/ u8 playTimeMinutes;
|
/*0x10*/ u8 playTimeMinutes;
|
||||||
|
@ -889,10 +889,10 @@ struct SaveBlock1
|
||||||
{
|
{
|
||||||
/*0x00*/ struct Coords16 pos;
|
/*0x00*/ struct Coords16 pos;
|
||||||
/*0x04*/ struct WarpData location;
|
/*0x04*/ struct WarpData location;
|
||||||
/*0x0C*/ struct WarpData warp1;
|
/*0x0C*/ struct WarpData continueGameWarp;
|
||||||
/*0x14*/ struct WarpData warp2;
|
/*0x14*/ struct WarpData dynamicWarp;
|
||||||
/*0x1C*/ struct WarpData lastHealLocation;
|
/*0x1C*/ struct WarpData lastHealLocation; // used by white-out and teleport
|
||||||
/*0x24*/ struct WarpData warp4;
|
/*0x24*/ struct WarpData escapeWarp; // used by Dig and Escape Rope
|
||||||
/*0x2C*/ u16 savedMusic;
|
/*0x2C*/ u16 savedMusic;
|
||||||
/*0x2E*/ u8 weather;
|
/*0x2E*/ u8 weather;
|
||||||
/*0x2F*/ u8 weatherCycleStage;
|
/*0x2F*/ u8 weatherCycleStage;
|
||||||
|
|
|
@ -15,11 +15,11 @@ void ClearSav2(void);
|
||||||
void ClearSav1(void);
|
void ClearSav1(void);
|
||||||
void SetSaveBlocksPointers(u16 offset);
|
void SetSaveBlocksPointers(u16 offset);
|
||||||
void MoveSaveBlocks_ResetHeap(void);
|
void MoveSaveBlocks_ResetHeap(void);
|
||||||
u32 GetSecretBase2Field_9(void);
|
u32 UseContinueGameWarp(void);
|
||||||
void ClearSecretBase2Field_9(void);
|
void ClearContinueGameWarpStatus(void);
|
||||||
void SetSecretBase2Field_9(void);
|
void SetContinueGameWarpStatus(void);
|
||||||
void sub_8076D5C(void);
|
void SetContinueGameWarpStatusToDynamicWarp(void);
|
||||||
void sav2_gender2_inplace_and_xFE(void);
|
void ClearContinueGameWarpStatus2(void);
|
||||||
void SavePlayerParty(void);
|
void SavePlayerParty(void);
|
||||||
void LoadPlayerParty(void);
|
void LoadPlayerParty(void);
|
||||||
void SaveEventObjects(void);
|
void SaveEventObjects(void);
|
||||||
|
|
|
@ -20,7 +20,8 @@ struct MenuAction
|
||||||
|
|
||||||
extern const u16 gUnknown_0860F074[];
|
extern const u16 gUnknown_0860F074[];
|
||||||
|
|
||||||
void sub_81971D0(void);
|
void FreeAllOverworldWindowBuffers(void);
|
||||||
|
void InitStandardTextBoxWindows(void);
|
||||||
void sub_8197200(void);
|
void sub_8197200(void);
|
||||||
u16 RunTextPrintersAndIsPrinter0Active(void);
|
u16 RunTextPrintersAndIsPrinter0Active(void);
|
||||||
void sub_81973A4(void);
|
void sub_81973A4(void);
|
||||||
|
|
|
@ -46,28 +46,25 @@ void Overworld_SetEventObjTemplateCoords(u8 localId, s16 x, s16 y);
|
||||||
void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType);
|
void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType);
|
||||||
const struct MapLayout *GetMapLayout(void);
|
const struct MapLayout *GetMapLayout(void);
|
||||||
void ApplyCurrentWarp(void);
|
void ApplyCurrentWarp(void);
|
||||||
void set_warp2_warp3_to_neg_1(void);
|
|
||||||
struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum);
|
struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum);
|
||||||
struct MapHeader const *const GetDestinationWarpMapHeader(void);
|
struct MapHeader const *const GetDestinationWarpMapHeader(void);
|
||||||
void WarpIntoMap(void);
|
void WarpIntoMap(void);
|
||||||
void Overworld_SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
void SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
||||||
void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpId);
|
void SetWarpDestinationToMapWarp(s8 mapGroup, s8 mapNum, s8 warpId);
|
||||||
void saved_warp2_set(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId);
|
void SetDynamicWarp(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId);
|
||||||
void saved_warp2_set_2(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
void SetDynamicWarpWithCoords(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
||||||
void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused);
|
void SetWarpDestinationToDynamicWarp(u8 unused);
|
||||||
void sub_8084CCC(u8 a1);
|
void SetWarpDestinationToHealLocation(u8 a1);
|
||||||
void Overworld_SetWarpDestToLastHealLoc(void);
|
void SetWarpDestinationToLastHealLocation(void);
|
||||||
void Overworld_SetHealLocationWarp(u8 healLocationId);
|
void SetLastHealLocationWarp(u8 healLocationId);
|
||||||
void sub_8084D5C(s16 a1, s16 a2);
|
void sub_8084D5C(s16 x, s16 y);
|
||||||
void sub_8084DD4(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
void SetEscapeWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
||||||
void sub_8084E14(void);
|
void SetWarpDestinationToEscapeWarp(void);
|
||||||
void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
||||||
void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
||||||
void SetFixedHoleWarpAsDestination(s16 x, s16 y);
|
void SetWarpDestinationToFixedHoleWarp(s16 x, s16 y);
|
||||||
void warp1_set_to_sav1w(void);
|
void SetContinueGameWarpToHealLocation(u8 a1);
|
||||||
void sub_8084F2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
void SetContinueGameWarpToDynamicWarp(int unused);
|
||||||
void sub_8084F6C(u8 a1);
|
|
||||||
void sub_8084FAC(int unused);
|
|
||||||
const struct MapConnection *GetMapConnection(u8 dir);
|
const struct MapConnection *GetMapConnection(u8 dir);
|
||||||
bool8 SetDiveWarpEmerge(u16 x, u16 y);
|
bool8 SetDiveWarpEmerge(u16 x, u16 y);
|
||||||
bool8 SetDiveWarpDive(u16 x, u16 y);
|
bool8 SetDiveWarpDive(u16 x, u16 y);
|
||||||
|
@ -78,7 +75,7 @@ bool32 Overworld_IsBikingAllowed(void);
|
||||||
void SetDefaultFlashLevel(void);
|
void SetDefaultFlashLevel(void);
|
||||||
void Overworld_SetFlashLevel(s32 flashLevel);
|
void Overworld_SetFlashLevel(s32 flashLevel);
|
||||||
u8 Overworld_GetFlashLevel(void);
|
u8 Overworld_GetFlashLevel(void);
|
||||||
void sub_8085524(u16 mapLayoutId);
|
void SetCurrentMapLayout(u16 mapLayoutId);
|
||||||
void sub_8085540(u8 var);
|
void sub_8085540(u8 var);
|
||||||
u8 sub_808554C(void);
|
u8 sub_808554C(void);
|
||||||
u16 GetLocationMusic(struct WarpData *warp);
|
u16 GetLocationMusic(struct WarpData *warp);
|
||||||
|
@ -97,15 +94,15 @@ void Overworld_FadeOutMapMusic(void);
|
||||||
void UpdateAmbientCry(s16 *state, u16 *delayCounter);
|
void UpdateAmbientCry(s16 *state, u16 *delayCounter);
|
||||||
u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum);
|
u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum);
|
||||||
u8 GetMapTypeByWarpData(struct WarpData *warp);
|
u8 GetMapTypeByWarpData(struct WarpData *warp);
|
||||||
u8 Overworld_GetMapTypeOfSaveblockLocation(void);
|
u8 GetCurrentMapType(void);
|
||||||
u8 GetLastUsedWarpMapType(void);
|
u8 GetLastUsedWarpMapType(void);
|
||||||
bool8 is_map_type_1_2_3_5_or_6(u8 mapType);
|
bool8 is_map_type_1_2_3_5_or_6(u8 mapType);
|
||||||
bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType);
|
bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType);
|
||||||
bool8 Overworld_MapTypeIsIndoors(u8 mapType);
|
bool8 Overworld_MapTypeIsIndoors(u8 mapType);
|
||||||
u8 sav1_saved_warp2_map_get_name(void);
|
u8 GetSavedWarpRegionMapSectionId(void);
|
||||||
u8 sav1_map_get_name(void);
|
u8 GetCurrentRegionMapSectionId(void);
|
||||||
u8 GetCurrentMapBattleScene(void);
|
u8 GetCurrentMapBattleScene(void);
|
||||||
void overworld_free_bg_tilemaps(void);
|
void CleanupOverworldWindowsAndTilemaps(void);
|
||||||
bool32 is_c1_link_related_active(void);
|
bool32 is_c1_link_related_active(void);
|
||||||
void CB1_Overworld(void);
|
void CB1_Overworld(void);
|
||||||
void CB2_OverworldBasic(void);
|
void CB2_OverworldBasic(void);
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
#ifndef GUARD_SAVE_LOCATION_H
|
#ifndef GUARD_SAVE_LOCATION_H
|
||||||
#define GUARD_SAVE_LOCATION_H
|
#define GUARD_SAVE_LOCATION_H
|
||||||
|
|
||||||
|
// specialSaveWarp flags
|
||||||
|
#define CONTINUE_GAME_WARP (1 << 0)
|
||||||
|
#define POKECENTER_SAVEWARP (1 << 1)
|
||||||
|
#define LOBBY_SAVEWARP (1 << 2)
|
||||||
|
#define UNK_SPECIAL_SAVE_WARP_FLAG_3 (1 << 3)
|
||||||
|
|
||||||
void TrySetMapSaveWarpStatus(void);
|
void TrySetMapSaveWarpStatus(void);
|
||||||
void sub_81AFDA0(void);
|
void sub_81AFDA0(void);
|
||||||
void sub_81AFDD0(void);
|
void sub_81AFDD0(void);
|
||||||
|
|
|
@ -784,7 +784,7 @@ static void sub_81A58B4(void)
|
||||||
if (!isCurrent)
|
if (!isCurrent)
|
||||||
gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] = 0;
|
gSaveBlock2Ptr->frontier.arenaWinStreaks[lvlMode] = 0;
|
||||||
|
|
||||||
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
||||||
gTrainerBattleOpponent_A = 0;
|
gTrainerBattleOpponent_A = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2388,7 +2388,7 @@ static void sub_818E9CC(void)
|
||||||
if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860D0EC[battleMode][lvlMode]))
|
if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860D0EC[battleMode][lvlMode]))
|
||||||
gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] = 0;
|
gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] = 0;
|
||||||
|
|
||||||
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
||||||
gTrainerBattleOpponent_A = 0;
|
gTrainerBattleOpponent_A = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ static void sub_81A5E94(void)
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
gUnknown_03006298[i] |= 0xFFFF;
|
gUnknown_03006298[i] |= 0xFFFF;
|
||||||
|
|
||||||
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
||||||
gTrainerBattleOpponent_A = 0;
|
gTrainerBattleOpponent_A = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ static void sub_8195980(void)
|
||||||
if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860DE98[battleMode][lvlMode]))
|
if (!(gSaveBlock2Ptr->frontier.field_CDC & gUnknown_0860DE98[battleMode][lvlMode]))
|
||||||
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] = 0;
|
gSaveBlock2Ptr->frontier.palaceWinStreaks[battleMode][lvlMode] = 0;
|
||||||
|
|
||||||
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
||||||
gTrainerBattleOpponent_A = 0;
|
gTrainerBattleOpponent_A = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,7 @@ static void sub_81C4F44(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
gFieldCallback2 = hm_add_c3_without_phase_2;
|
gFieldCallback2 = hm_add_c3_without_phase_2;
|
||||||
sub_81C4F98(3, CB2_ReturnToField);
|
sub_81C4F98(3, CB2_ReturnToField);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
|
|
|
@ -10138,7 +10138,7 @@ static void atkEF_handleballthrow(void)
|
||||||
ballMultiplier = 10;
|
ballMultiplier = 10;
|
||||||
break;
|
break;
|
||||||
case ITEM_DIVE_BALL:
|
case ITEM_DIVE_BALL:
|
||||||
if (Overworld_GetMapTypeOfSaveblockLocation() == MAP_TYPE_UNDERWATER)
|
if (GetCurrentMapType() == MAP_TYPE_UNDERWATER)
|
||||||
ballMultiplier = 35;
|
ballMultiplier = 35;
|
||||||
else
|
else
|
||||||
ballMultiplier = 10;
|
ballMultiplier = 10;
|
||||||
|
|
|
@ -349,7 +349,7 @@ static void Task_BattleStart(u8 taskId)
|
||||||
case 1:
|
case 1:
|
||||||
if (IsBattleTransitionDone() == TRUE)
|
if (IsBattleTransitionDone() == TRUE)
|
||||||
{
|
{
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
SetMainCallback2(CB2_InitBattle);
|
SetMainCallback2(CB2_InitBattle);
|
||||||
RestartWildEncounterImmunitySteps();
|
RestartWildEncounterImmunitySteps();
|
||||||
ClearPoisonStepCounter();
|
ClearPoisonStepCounter();
|
||||||
|
|
|
@ -100,7 +100,7 @@ static void sub_81B99D4(void)
|
||||||
gSaveBlock2Ptr->frontier.field_CA8 = 0;
|
gSaveBlock2Ptr->frontier.field_CA8 = 0;
|
||||||
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
|
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
|
||||||
gSaveBlock2Ptr->frontier.field_CA9_a = FALSE;
|
gSaveBlock2Ptr->frontier.field_CA9_a = FALSE;
|
||||||
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81B9A28(void)
|
static void sub_81B9A28(void)
|
||||||
|
@ -162,7 +162,7 @@ static void sub_81B9BA0(void)
|
||||||
gSaveBlock2Ptr->frontier.field_CA8 = 0;
|
gSaveBlock2Ptr->frontier.field_CA8 = 0;
|
||||||
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
|
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
|
||||||
gSaveBlock2Ptr->frontier.field_CA9_a = FALSE;
|
gSaveBlock2Ptr->frontier.field_CA9_a = FALSE;
|
||||||
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81B9BF4(void)
|
static void sub_81B9BF4(void)
|
||||||
|
@ -217,7 +217,7 @@ static void sub_81B9D28(void)
|
||||||
gSaveBlock2Ptr->frontier.field_CA8 = 0;
|
gSaveBlock2Ptr->frontier.field_CA8 = 0;
|
||||||
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
|
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
|
||||||
gSaveBlock2Ptr->frontier.field_CA9_a = FALSE;
|
gSaveBlock2Ptr->frontier.field_CA9_a = FALSE;
|
||||||
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81B9D7C(void)
|
static void sub_81B9D7C(void)
|
||||||
|
|
|
@ -1163,7 +1163,7 @@ static void sub_8161F94(void)
|
||||||
gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = 0;
|
gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] = 0;
|
||||||
|
|
||||||
ValidateBattleTowerRecordChecksums();
|
ValidateBattleTowerRecordChecksums();
|
||||||
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
||||||
gTrainerBattleOpponent_A = 0;
|
gTrainerBattleOpponent_A = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -845,7 +845,7 @@ static void sub_80B32B4(u8 taskId)
|
||||||
PlayMapChosenOrBattleBGM(MUS_BATTLE20);
|
PlayMapChosenOrBattleBGM(MUS_BATTLE20);
|
||||||
|
|
||||||
sub_80B3260(gSpecialVar_0x8004);
|
sub_80B3260(gSpecialVar_0x8004);
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
gTrainerBattleOpponent_A = 0x800;
|
gTrainerBattleOpponent_A = 0x800;
|
||||||
SetMainCallback2(CB2_InitBattle);
|
SetMainCallback2(CB2_InitBattle);
|
||||||
gMain.savedCallback = sub_80B360C;
|
gMain.savedCallback = sub_80B360C;
|
||||||
|
@ -911,7 +911,7 @@ static void sub_80B33BC(u8 taskId)
|
||||||
|
|
||||||
gLinkPlayers[0].linkType = 0x2211;
|
gLinkPlayers[0].linkType = 0x2211;
|
||||||
sub_80B3260(gSpecialVar_0x8004);
|
sub_80B3260(gSpecialVar_0x8004);
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
gTrainerBattleOpponent_A = 0x800;
|
gTrainerBattleOpponent_A = 0x800;
|
||||||
SetMainCallback2(CB2_InitBattle);
|
SetMainCallback2(CB2_InitBattle);
|
||||||
gMain.savedCallback = sub_80B360C;
|
gMain.savedCallback = sub_80B360C;
|
||||||
|
@ -1008,7 +1008,7 @@ void sub_80B36EC(void)
|
||||||
LoadPlayerParty();
|
LoadPlayerParty();
|
||||||
SavePlayerBag();
|
SavePlayerBag();
|
||||||
}
|
}
|
||||||
copy_saved_warp2_bank_and_enter_x_to_warp1(0x7F);
|
SetWarpDestinationToDynamicWarp(0x7F);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80B371C(void)
|
void sub_80B371C(void)
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ void sub_8127ACC(u8 taskId)
|
||||||
void sub_8127B04(u8 taskId)
|
void sub_8127B04(u8 taskId)
|
||||||
{
|
{
|
||||||
DrawWholeMapView();
|
DrawWholeMapView();
|
||||||
Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gTasks[taskId].data[3], gTasks[taskId].data[4]);
|
SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gTasks[taskId].data[3], gTasks[taskId].data[4]);
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@ void easy_chat_input_maybe(void)
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
sub_811A20C(gSpecialVar_0x8004, words, CB2_ReturnToFieldContinueScript, sizeParam);
|
sub_811A20C(gSpecialVar_0x8004, words, CB2_ReturnToFieldContinueScript, sizeParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ static void sub_811A7E4(void)
|
||||||
{
|
{
|
||||||
lilycoveLady = &gSaveBlock1Ptr->lilycoveLady;
|
lilycoveLady = &gSaveBlock1Ptr->lilycoveLady;
|
||||||
lilycoveLady->quiz.unk_016 = -1;
|
lilycoveLady->quiz.unk_016 = -1;
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
sub_811A8F0();
|
sub_811A8F0();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -379,7 +379,7 @@ static void AddHatchedMonToParty(u8 id)
|
||||||
caughtLvl = 0;
|
caughtLvl = 0;
|
||||||
SetMonData(mon, MON_DATA_MET_LEVEL, &caughtLvl);
|
SetMonData(mon, MON_DATA_MET_LEVEL, &caughtLvl);
|
||||||
|
|
||||||
mapNameID = sav1_map_get_name();
|
mapNameID = GetCurrentRegionMapSectionId();
|
||||||
SetMonData(mon, MON_DATA_MET_LOCATION, &mapNameID);
|
SetMonData(mon, MON_DATA_MET_LOCATION, &mapNameID);
|
||||||
|
|
||||||
MonRestorePP(mon);
|
MonRestorePP(mon);
|
||||||
|
@ -471,7 +471,7 @@ static void Task_EggHatch(u8 taskID)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
SetMainCallback2(CB2_EggHatch_0);
|
SetMainCallback2(CB2_EggHatch_0);
|
||||||
gFieldCallback = sub_80AF168;
|
gFieldCallback = sub_80AF168;
|
||||||
DestroyTask(taskID);
|
DestroyTask(taskID);
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "wild_encounter.h"
|
#include "wild_encounter.h"
|
||||||
#include "constants/bg_event_constants.h"
|
#include "constants/bg_event_constants.h"
|
||||||
#include "constants/map_types.h"
|
#include "constants/map_types.h"
|
||||||
|
#include "constants/maps.h"
|
||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
|
|
||||||
extern bool32 sub_8196034(void);
|
extern bool32 sub_8196034(void);
|
||||||
|
@ -818,19 +819,19 @@ static void sub_809CEB0(struct MapHeader *unused, s8 warpEventId, struct MapPosi
|
||||||
warpEvent = &gMapHeader.events->warps[warpEventId];
|
warpEvent = &gMapHeader.events->warps[warpEventId];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (warpEvent->mapNum == 0x7F)
|
if (warpEvent->mapNum == MAP_NUM(NONE))
|
||||||
{
|
{
|
||||||
copy_saved_warp2_bank_and_enter_x_to_warp1(warpEvent->warpId);
|
SetWarpDestinationToDynamicWarp(warpEvent->warpId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const struct MapHeader *mapHeader;
|
const struct MapHeader *mapHeader;
|
||||||
|
|
||||||
warp1_set_2(warpEvent->mapGroup, warpEvent->mapNum, warpEvent->warpId);
|
SetWarpDestinationToMapWarp(warpEvent->mapGroup, warpEvent->mapNum, warpEvent->warpId);
|
||||||
sub_8084D5C(position->x, position->y);
|
sub_8084D5C(position->x, position->y);
|
||||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->mapGroup, warpEvent->mapNum);
|
mapHeader = Overworld_GetMapHeaderByGroupAndId(warpEvent->mapGroup, warpEvent->mapNum);
|
||||||
if (mapHeader->events->warps[warpEvent->warpId].mapNum == 0x7F)
|
if (mapHeader->events->warps[warpEvent->warpId].mapNum == MAP_NUM(NONE))
|
||||||
saved_warp2_set(mapHeader->events->warps[warpEventId].warpId, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, warpEventId);
|
SetDynamicWarp(mapHeader->events->warps[warpEventId].warpId, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, warpEventId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2171,7 +2171,7 @@ static void EscapeRopeFieldEffect_Step1(struct Task *task)
|
||||||
if (task->data[14] == 0 && !gPaletteFade.active && BGMusicStopped() == TRUE)
|
if (task->data[14] == 0 && !gPaletteFade.active && BGMusicStopped() == TRUE)
|
||||||
{
|
{
|
||||||
SetEventObjectDirection(eventObject, task->data[15]);
|
SetEventObjectDirection(eventObject, task->data[15]);
|
||||||
sub_8084E14();
|
SetWarpDestinationToEscapeWarp();
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
gFieldCallback = mapldr_080859D4;
|
gFieldCallback = mapldr_080859D4;
|
||||||
SetMainCallback2(CB2_LoadMap);
|
SetMainCallback2(CB2_LoadMap);
|
||||||
|
@ -2332,7 +2332,7 @@ static void TeleportFieldEffectTask4(struct Task *task)
|
||||||
|
|
||||||
if (BGMusicStopped() == TRUE)
|
if (BGMusicStopped() == TRUE)
|
||||||
{
|
{
|
||||||
Overworld_SetWarpDestToLastHealLoc();
|
SetWarpDestinationToLastHealLocation();
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
SetMainCallback2(CB2_LoadMap);
|
SetMainCallback2(CB2_LoadMap);
|
||||||
gFieldCallback = mapldr_08085D88;
|
gFieldCallback = mapldr_08085D88;
|
||||||
|
@ -2443,7 +2443,7 @@ static void sub_80B8410(struct Task *task)
|
||||||
bool8 FldEff_FieldMoveShowMon(void)
|
bool8 FldEff_FieldMoveShowMon(void)
|
||||||
{
|
{
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
if (is_map_type_1_2_3_5_or_6(Overworld_GetMapTypeOfSaveblockLocation()) == TRUE)
|
if (is_map_type_1_2_3_5_or_6(GetCurrentMapType()) == TRUE)
|
||||||
{
|
{
|
||||||
taskId = CreateTask(sub_80B8554, 0xff);
|
taskId = CreateTask(sub_80B8554, 0xff);
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -8,21 +8,21 @@
|
||||||
extern bool32 sub_8196094(void);
|
extern bool32 sub_8196094(void);
|
||||||
extern void sub_8196080(u8*);
|
extern void sub_8196080(u8*);
|
||||||
|
|
||||||
EWRAM_DATA u8 gUnknown_020375BC = 0;
|
static EWRAM_DATA u8 sFieldMessageBoxMode = 0;
|
||||||
|
|
||||||
void textbox_fdecode_auto_and_task_add(u8*, int);
|
static void textbox_fdecode_auto_and_task_add(u8*, bool32);
|
||||||
void textbox_auto_and_task_add(void);
|
static void textbox_auto_and_task_add(void);
|
||||||
|
|
||||||
void sub_8098128(void)
|
void InitFieldMessageBox(void)
|
||||||
{
|
{
|
||||||
gUnknown_020375BC = 0;
|
sFieldMessageBoxMode = 0;
|
||||||
gTextFlags.canABSpeedUpPrint = 0;
|
gTextFlags.canABSpeedUpPrint = 0;
|
||||||
gTextFlags.useAlternateDownArrow = 0;
|
gTextFlags.useAlternateDownArrow = 0;
|
||||||
gTextFlags.autoScroll = 0;
|
gTextFlags.autoScroll = 0;
|
||||||
gTextFlags.forceMidTextSpeed = 0;
|
gTextFlags.forceMidTextSpeed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8098154(u8 taskId)
|
static void sub_8098154(u8 taskId)
|
||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
|
@ -39,18 +39,18 @@ void sub_8098154(u8 taskId)
|
||||||
case 2:
|
case 2:
|
||||||
if (RunTextPrintersAndIsPrinter0Active() != 1)
|
if (RunTextPrintersAndIsPrinter0Active() != 1)
|
||||||
{
|
{
|
||||||
gUnknown_020375BC = 0;
|
sFieldMessageBoxMode = 0;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void task_add_textbox(void)
|
static void task_add_textbox(void)
|
||||||
{
|
{
|
||||||
CreateTask(sub_8098154, 0x50);
|
CreateTask(sub_8098154, 0x50);
|
||||||
}
|
}
|
||||||
|
|
||||||
void task_del_textbox(void)
|
static void task_del_textbox(void)
|
||||||
{
|
{
|
||||||
u8 taskId = FindTaskIdByFunc(sub_8098154);
|
u8 taskId = FindTaskIdByFunc(sub_8098154);
|
||||||
if (taskId != 0xFF)
|
if (taskId != 0xFF)
|
||||||
|
@ -59,10 +59,10 @@ void task_del_textbox(void)
|
||||||
|
|
||||||
bool8 ShowFieldMessage(u8 *str)
|
bool8 ShowFieldMessage(u8 *str)
|
||||||
{
|
{
|
||||||
if (gUnknown_020375BC != 0)
|
if (sFieldMessageBoxMode != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
textbox_fdecode_auto_and_task_add(str, 1);
|
textbox_fdecode_auto_and_task_add(str, 1);
|
||||||
gUnknown_020375BC = 2;
|
sFieldMessageBoxMode = 2;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,57 +70,57 @@ void sub_8098214(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!sub_8196094())
|
if (!sub_8196094())
|
||||||
{
|
{
|
||||||
gUnknown_020375BC = 0;
|
sFieldMessageBoxMode = 0;
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_8098238(u8 *str)
|
bool8 sub_8098238(u8 *str)
|
||||||
{
|
{
|
||||||
if (gUnknown_020375BC != 0)
|
if (sFieldMessageBoxMode != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
StringExpandPlaceholders(gStringVar4, str);
|
StringExpandPlaceholders(gStringVar4, str);
|
||||||
CreateTask(sub_8098214, 0);
|
CreateTask(sub_8098214, 0);
|
||||||
sub_8196080(str);
|
sub_8196080(str);
|
||||||
gUnknown_020375BC = 2;
|
sFieldMessageBoxMode = 2;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ShowFieldAutoScrollMessage(u8 *str)
|
bool8 ShowFieldAutoScrollMessage(u8 *str)
|
||||||
{
|
{
|
||||||
if (gUnknown_020375BC != 0)
|
if (sFieldMessageBoxMode != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
gUnknown_020375BC = 3;
|
sFieldMessageBoxMode = 3;
|
||||||
textbox_fdecode_auto_and_task_add(str, 0);
|
textbox_fdecode_auto_and_task_add(str, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80982A0(u8 *str)
|
bool8 sub_80982A0(u8 *str)
|
||||||
{
|
{
|
||||||
gUnknown_020375BC = 3;
|
sFieldMessageBoxMode = 3;
|
||||||
textbox_fdecode_auto_and_task_add(str, 1);
|
textbox_fdecode_auto_and_task_add(str, 1);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80982B8(void)
|
bool8 sub_80982B8(void)
|
||||||
{
|
{
|
||||||
if (gUnknown_020375BC != 0)
|
if (sFieldMessageBoxMode != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
gUnknown_020375BC = 2;
|
sFieldMessageBoxMode = 2;
|
||||||
textbox_auto_and_task_add();
|
textbox_auto_and_task_add();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void textbox_fdecode_auto_and_task_add(u8* str, int a)
|
static void textbox_fdecode_auto_and_task_add(u8* str, bool32 allowSkippingDelayWithButtonPress)
|
||||||
{
|
{
|
||||||
StringExpandPlaceholders(gStringVar4, str);
|
StringExpandPlaceholders(gStringVar4, str);
|
||||||
AddTextPrinterForMessage(a);
|
AddTextPrinterForMessage(allowSkippingDelayWithButtonPress);
|
||||||
task_add_textbox();
|
task_add_textbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
void textbox_auto_and_task_add(void)
|
static void textbox_auto_and_task_add(void)
|
||||||
{
|
{
|
||||||
AddTextPrinterForMessage(1);
|
AddTextPrinterForMessage(TRUE);
|
||||||
task_add_textbox();
|
task_add_textbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,17 +128,17 @@ void HideFieldMessageBox(void)
|
||||||
{
|
{
|
||||||
task_del_textbox();
|
task_del_textbox();
|
||||||
sub_8197434(0, 1);
|
sub_8197434(0, 1);
|
||||||
gUnknown_020375BC = 0;
|
sFieldMessageBoxMode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetFieldMessageBoxMode(void)
|
u8 GetFieldMessageBoxMode(void)
|
||||||
{
|
{
|
||||||
return gUnknown_020375BC;
|
return sFieldMessageBoxMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 IsFieldMessageBoxHidden(void)
|
bool8 IsFieldMessageBoxHidden(void)
|
||||||
{
|
{
|
||||||
if (gUnknown_020375BC == 0)
|
if (sFieldMessageBoxMode == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -147,11 +147,11 @@ void sub_8098358(void)
|
||||||
{
|
{
|
||||||
task_del_textbox();
|
task_del_textbox();
|
||||||
NewMenuHelpers_DrawStdWindowFrame(0, 1);
|
NewMenuHelpers_DrawStdWindowFrame(0, 1);
|
||||||
gUnknown_020375BC = 0;
|
sFieldMessageBoxMode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8098374(void)
|
void sub_8098374(void)
|
||||||
{
|
{
|
||||||
task_del_textbox();
|
task_del_textbox();
|
||||||
gUnknown_020375BC = 0;
|
sFieldMessageBoxMode = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ static void palette_bg_faded_fill_black(void)
|
||||||
void pal_fill_for_maplights(void)
|
void pal_fill_for_maplights(void)
|
||||||
{
|
{
|
||||||
u8 previousMapType = GetLastUsedWarpMapType();
|
u8 previousMapType = GetLastUsedWarpMapType();
|
||||||
switch (GetMapPairFadeFromType(previousMapType, Overworld_GetMapTypeOfSaveblockLocation()))
|
switch (GetMapPairFadeFromType(previousMapType, GetCurrentMapType()))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
palette_bg_faded_fill_black();
|
palette_bg_faded_fill_black();
|
||||||
|
@ -115,7 +115,7 @@ void pal_fill_black(void)
|
||||||
|
|
||||||
void WarpFadeScreen(void)
|
void WarpFadeScreen(void)
|
||||||
{
|
{
|
||||||
u8 currentMapType = Overworld_GetMapTypeOfSaveblockLocation();
|
u8 currentMapType = GetCurrentMapType();
|
||||||
switch (GetMapPairFadeToType(currentMapType, GetDestinationWarpMapHeader()->mapType))
|
switch (GetMapPairFadeToType(currentMapType, GetDestinationWarpMapHeader()->mapType))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "event_data.h"
|
#include "event_data.h"
|
||||||
#include "event_object_movement.h"
|
#include "event_object_movement.h"
|
||||||
|
#include "field_camera.h"
|
||||||
|
#include "field_screen_effect.h"
|
||||||
|
#include "field_specials.h"
|
||||||
|
#include "fieldmap.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "overworld.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "script.h"
|
#include "script.h"
|
||||||
#include "script_movement.h"
|
#include "script_movement.h"
|
||||||
|
@ -13,14 +18,6 @@
|
||||||
|
|
||||||
#define SECONDS(value) ((signed) (60.0 * value + 0.5))
|
#define SECONDS(value) ((signed) (60.0 * value + 0.5))
|
||||||
|
|
||||||
extern u8 GetSSTidalLocation(s8 *, s8 *, s16 *, s16 *); // should be in field_specials.h
|
|
||||||
extern void Overworld_SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
|
|
||||||
extern bool32 CountSSTidalStep(u16);
|
|
||||||
extern void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused);
|
|
||||||
extern void sp13E_warp_to_last_warp(void);
|
|
||||||
extern void saved_warp2_set(int unused, s8 mapGroup, s8 mapNum, s8 warpId);
|
|
||||||
extern void sub_80AF8B8(void);
|
|
||||||
|
|
||||||
// porthole states
|
// porthole states
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -30,20 +27,13 @@ enum
|
||||||
EXIT_PORTHOLE,
|
EXIT_PORTHOLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void SetCameraPanning(s16 x, s16 y);
|
|
||||||
extern void SetCameraPanningCallback(void ( *callback)());
|
|
||||||
extern void InstallCameraPanAheadCallback();
|
|
||||||
extern void pal_fill_black(void);
|
|
||||||
extern void MapGridSetMetatileIdAt(s32 x, s32 y, u16 metatileId);
|
|
||||||
extern void DrawWholeMapView();
|
|
||||||
|
|
||||||
//. rodata
|
//. rodata
|
||||||
static const s8 gTruckCamera_HorizontalTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, -1, -1, -1, 0};
|
static const s8 gTruckCamera_HorizontalTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, -1, -1, -1, 0};
|
||||||
const u8 gUnknown_0858E8AB[] = {0x18, 0xFE};
|
const u8 gUnknown_0858E8AB[] = {0x18, 0xFE};
|
||||||
const u8 gUnknown_0858E8AD[] = {0x17, 0xFE};
|
const u8 gUnknown_0858E8AD[] = {0x17, 0xFE};
|
||||||
|
|
||||||
// .text
|
// .text
|
||||||
void Task_Truck3(u8);
|
static void Task_Truck3(u8);
|
||||||
|
|
||||||
s16 GetTruckCameraBobbingY(int a1)
|
s16 GetTruckCameraBobbingY(int a1)
|
||||||
{
|
{
|
||||||
|
@ -121,7 +111,7 @@ void Task_Truck2(u8 taskId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Task_Truck3(u8 taskId)
|
static void Task_Truck3(u8 taskId)
|
||||||
{
|
{
|
||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
s16 cameraXpan;
|
s16 cameraXpan;
|
||||||
|
@ -256,7 +246,7 @@ bool8 sub_80FB59C(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, -1, x, y);
|
SetWarpDestination(mapGroup, mapNum, -1, x, y);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +302,7 @@ void Task_HandlePorthole(u8 taskId)
|
||||||
case EXIT_PORTHOLE: // exit porthole.
|
case EXIT_PORTHOLE: // exit porthole.
|
||||||
FlagClear(0x4001);
|
FlagClear(0x4001);
|
||||||
FlagClear(0x4000);
|
FlagClear(0x4000);
|
||||||
copy_saved_warp2_bank_and_enter_x_to_warp1(0);
|
SetWarpDestinationToDynamicWarp(0);
|
||||||
sp13E_warp_to_last_warp();
|
sp13E_warp_to_last_warp();
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
break;
|
break;
|
||||||
|
@ -349,7 +339,7 @@ void sub_80FB7A4(void)
|
||||||
FlagSet(FLAG_SYS_CRUISE_MODE);
|
FlagSet(FLAG_SYS_CRUISE_MODE);
|
||||||
FlagSet(0x4001);
|
FlagSet(0x4001);
|
||||||
FlagSet(0x4000);
|
FlagSet(0x4000);
|
||||||
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
||||||
sub_80FB59C();
|
sub_80FB59C();
|
||||||
sub_80AF8B8();
|
sub_80AF8B8();
|
||||||
}
|
}
|
||||||
|
|
|
@ -945,11 +945,11 @@ void CableCarWarp(void)
|
||||||
{
|
{
|
||||||
if (gSpecialVar_0x8004 != 0)
|
if (gSpecialVar_0x8004 != 0)
|
||||||
{
|
{
|
||||||
Overworld_SetWarpDestination(MAP_GROUP(ROUTE112_CABLE_CAR_STATION), MAP_NUM(ROUTE112_CABLE_CAR_STATION), -1, 6, 4);
|
SetWarpDestination(MAP_GROUP(ROUTE112_CABLE_CAR_STATION), MAP_NUM(ROUTE112_CABLE_CAR_STATION), -1, 6, 4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Overworld_SetWarpDestination(MAP_GROUP(MT_CHIMNEY_CABLE_CAR_STATION), MAP_NUM(MT_CHIMNEY_CABLE_CAR_STATION), -1, 6, 4);
|
SetWarpDestination(MAP_GROUP(MT_CHIMNEY_CABLE_CAR_STATION), MAP_NUM(MT_CHIMNEY_CABLE_CAR_STATION), -1, 6, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1725,7 +1725,7 @@ const u16 gUnknown_085B2C06[][3] =
|
||||||
void SetDepartmentStoreFloorVar(void)
|
void SetDepartmentStoreFloorVar(void)
|
||||||
{
|
{
|
||||||
u8 deptStoreFloor;
|
u8 deptStoreFloor;
|
||||||
switch (gSaveBlock1Ptr->warp2.mapNum)
|
switch (gSaveBlock1Ptr->dynamicWarp.mapNum)
|
||||||
{
|
{
|
||||||
case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F):
|
case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F):
|
||||||
deptStoreFloor = 4;
|
deptStoreFloor = 4;
|
||||||
|
@ -1757,9 +1757,9 @@ u16 sub_81399F4(void)
|
||||||
gUnknown_0203AB60 = 0;
|
gUnknown_0203AB60 = 0;
|
||||||
gUnknown_0203AB62 = 0;
|
gUnknown_0203AB62 = 0;
|
||||||
|
|
||||||
if (gSaveBlock1Ptr->warp2.mapGroup == 13)
|
if (gSaveBlock1Ptr->dynamicWarp.mapGroup == MAP_GROUP(LILYCOVE_CITY_DEPARTMENT_STORE_1F))
|
||||||
{
|
{
|
||||||
switch (gSaveBlock1Ptr->warp2.mapNum)
|
switch (gSaveBlock1Ptr->dynamicWarp.mapNum)
|
||||||
{
|
{
|
||||||
case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F):
|
case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F):
|
||||||
gUnknown_0203AB60 = 0;
|
gUnknown_0203AB60 = 0;
|
||||||
|
@ -3813,7 +3813,7 @@ void sub_813B9A0(void)
|
||||||
{
|
{
|
||||||
if (gSaveBlock1Ptr->lastHealLocation.mapGroup == MAP_GROUP(DEWFORD_TOWN) && gSaveBlock1Ptr->lastHealLocation.mapNum == MAP_NUM(DEWFORD_TOWN))
|
if (gSaveBlock1Ptr->lastHealLocation.mapGroup == MAP_GROUP(DEWFORD_TOWN) && gSaveBlock1Ptr->lastHealLocation.mapNum == MAP_NUM(DEWFORD_TOWN))
|
||||||
{
|
{
|
||||||
Overworld_SetHealLocationWarp(3);
|
SetLastHealLocationWarp(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ static bool8 sub_8137304(void)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
u8 v0 = GetLastUsedWarpMapType();
|
u8 v0 = GetLastUsedWarpMapType();
|
||||||
u8 v1 = Overworld_GetMapTypeOfSaveblockLocation();
|
u8 v1 = GetCurrentMapType();
|
||||||
|
|
||||||
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
|
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2407,9 +2407,9 @@ void sub_81A4C30(void)
|
||||||
|
|
||||||
i = gPlayerPartyCount;
|
i = gPlayerPartyCount;
|
||||||
LoadPlayerParty();
|
LoadPlayerParty();
|
||||||
sub_8076D5C();
|
SetContinueGameWarpStatusToDynamicWarp();
|
||||||
TrySavingData(SAVE_LINK);
|
TrySavingData(SAVE_LINK);
|
||||||
sav2_gender2_inplace_and_xFE();
|
ClearContinueGameWarpStatus2();
|
||||||
gPlayerPartyCount = i;
|
gPlayerPartyCount = i;
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
|
|
|
@ -1299,7 +1299,7 @@ static bool8 sub_8175024(void)
|
||||||
CopyBgTilemapBufferToVram(3);
|
CopyBgTilemapBufferToVram(3);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
sub_81971D0();
|
InitStandardTextBoxWindows();
|
||||||
sub_8197200();
|
sub_8197200();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
|
|
@ -627,7 +627,7 @@ void sub_80FDC00(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
OpenPokeblockCase(0, CB2_ReturnToField);
|
OpenPokeblockCase(0, CB2_ReturnToField);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "gba/flash_internal.h"
|
#include "alloc.h"
|
||||||
|
#include "item.h"
|
||||||
#include "load_save.h"
|
#include "load_save.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "overworld.h"
|
||||||
#include "pokemon.h"
|
#include "pokemon.h"
|
||||||
#include "pokemon_storage_system.h"
|
#include "pokemon_storage_system.h"
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
#include "alloc.h"
|
#include "save_location.h"
|
||||||
#include "item.h"
|
#include "gba/flash_internal.h"
|
||||||
#include "overworld.h"
|
|
||||||
#include "decoration_inventory.h"
|
#include "decoration_inventory.h"
|
||||||
|
|
||||||
static void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey);
|
static void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey);
|
||||||
|
@ -136,30 +137,30 @@ void MoveSaveBlocks_ResetHeap(void)
|
||||||
gSaveBlock2Ptr->encryptionKey = encryptionKey;
|
gSaveBlock2Ptr->encryptionKey = encryptionKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetSecretBase2Field_9(void)
|
u32 UseContinueGameWarp(void)
|
||||||
{
|
{
|
||||||
return gSaveBlock2Ptr->specialSaveWarp & 1;
|
return gSaveBlock2Ptr->specialSaveWarpFlags & CONTINUE_GAME_WARP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearSecretBase2Field_9(void)
|
void ClearContinueGameWarpStatus(void)
|
||||||
{
|
{
|
||||||
gSaveBlock2Ptr->specialSaveWarp &= ~1;
|
gSaveBlock2Ptr->specialSaveWarpFlags &= ~CONTINUE_GAME_WARP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSecretBase2Field_9(void)
|
void SetContinueGameWarpStatus(void)
|
||||||
{
|
{
|
||||||
gSaveBlock2Ptr->specialSaveWarp |= 1;
|
gSaveBlock2Ptr->specialSaveWarpFlags |= CONTINUE_GAME_WARP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8076D5C(void)
|
void SetContinueGameWarpStatusToDynamicWarp(void)
|
||||||
{
|
{
|
||||||
sub_8084FAC(0);
|
SetContinueGameWarpToDynamicWarp(0);
|
||||||
gSaveBlock2Ptr->specialSaveWarp |= 1;
|
gSaveBlock2Ptr->specialSaveWarpFlags |= CONTINUE_GAME_WARP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sav2_gender2_inplace_and_xFE(void)
|
void ClearContinueGameWarpStatus2(void)
|
||||||
{
|
{
|
||||||
gSaveBlock2Ptr->specialSaveWarp &= ~1;
|
gSaveBlock2Ptr->specialSaveWarpFlags &= ~CONTINUE_GAME_WARP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavePlayerParty(void)
|
void SavePlayerParty(void)
|
||||||
|
|
50
src/menu.c
50
src/menu.c
|
@ -48,8 +48,8 @@ struct Menu
|
||||||
bool8 APressMuted;
|
bool8 APressMuted;
|
||||||
};
|
};
|
||||||
|
|
||||||
static EWRAM_DATA u8 gStartMenuWindowId = 0;
|
static EWRAM_DATA u8 sStartMenuWindowId = 0;
|
||||||
static EWRAM_DATA u8 gUnknown_0203CD8D = 0;
|
static EWRAM_DATA u8 sMapNamePopupWindowId = 0;
|
||||||
static EWRAM_DATA struct Menu gUnknown_0203CD90 = {0};
|
static EWRAM_DATA struct Menu gUnknown_0203CD90 = {0};
|
||||||
static EWRAM_DATA u16 gUnknown_0203CD9C = 0;
|
static EWRAM_DATA u16 gUnknown_0203CD9C = 0;
|
||||||
static EWRAM_DATA u8 gUnknown_0203CD9E = 0;
|
static EWRAM_DATA u8 gUnknown_0203CD9E = 0;
|
||||||
|
@ -63,7 +63,7 @@ static EWRAM_DATA void *gUnknown_0203CDAC[0x20] = {NULL};
|
||||||
const u16 gUnknown_0860F074[] = INCBIN_U16("graphics/interface/860F074.gbapal");
|
const u16 gUnknown_0860F074[] = INCBIN_U16("graphics/interface/860F074.gbapal");
|
||||||
static const u8 gUnknown_0860F094[] = { 8, 4, 1 };
|
static const u8 gUnknown_0860F094[] = { 8, 4, 1 };
|
||||||
|
|
||||||
static const struct WindowTemplate gUnknown_0860F098[] =
|
static const struct WindowTemplate sStandardTextBox_WindowTemplates[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
|
@ -77,7 +77,7 @@ static const struct WindowTemplate gUnknown_0860F098[] =
|
||||||
DUMMY_WIN_TEMPLATE
|
DUMMY_WIN_TEMPLATE
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct WindowTemplate gUnknown_0860F0A8 =
|
static const struct WindowTemplate sYesNo_WindowTemplates =
|
||||||
{
|
{
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
.tilemapLeft = 21,
|
.tilemapLeft = 21,
|
||||||
|
@ -137,14 +137,14 @@ extern u8 sub_8199134(s8, s8);
|
||||||
extern void sub_8198C78(void);
|
extern void sub_8198C78(void);
|
||||||
extern void task_free_buf_after_copying_tile_data_to_vram(u8 taskId);
|
extern void task_free_buf_after_copying_tile_data_to_vram(u8 taskId);
|
||||||
|
|
||||||
void sub_81971D0(void)
|
void InitStandardTextBoxWindows(void)
|
||||||
{
|
{
|
||||||
InitWindows(gUnknown_0860F098);
|
InitWindows(sStandardTextBox_WindowTemplates);
|
||||||
gStartMenuWindowId = 0xFF;
|
sStartMenuWindowId = 0xFF;
|
||||||
gUnknown_0203CD8D = 0xFF;
|
sMapNamePopupWindowId = 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_81971F4(void)
|
void FreeAllOverworldWindowBuffers(void)
|
||||||
{
|
{
|
||||||
FreeAllWindowBuffers();
|
FreeAllWindowBuffers();
|
||||||
}
|
}
|
||||||
|
@ -460,12 +460,12 @@ void DisplayItemMessageOnField(u8 taskId, const u8 *string, TaskFunc callback)
|
||||||
|
|
||||||
void DisplayYesNoMenu(void)
|
void DisplayYesNoMenu(void)
|
||||||
{
|
{
|
||||||
CreateYesNoMenu(&gUnknown_0860F0A8, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM, 0);
|
CreateYesNoMenu(&sYesNo_WindowTemplates, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8197948(u8 initialCursorPos)
|
void sub_8197948(u8 initialCursorPos)
|
||||||
{
|
{
|
||||||
CreateYesNoMenu(&gUnknown_0860F0A8, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM, initialCursorPos);
|
CreateYesNoMenu(&sYesNo_WindowTemplates, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM, initialCursorPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetPlayerTextSpeed(void)
|
u32 GetPlayerTextSpeed(void)
|
||||||
|
@ -486,22 +486,22 @@ u8 GetPlayerTextSpeedDelay(void)
|
||||||
|
|
||||||
u8 sub_81979C4(u8 a1)
|
u8 sub_81979C4(u8 a1)
|
||||||
{
|
{
|
||||||
if (gStartMenuWindowId == 0xFF)
|
if (sStartMenuWindowId == 0xFF)
|
||||||
gStartMenuWindowId = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139);
|
sStartMenuWindowId = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139);
|
||||||
return gStartMenuWindowId;
|
return sStartMenuWindowId;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetStartMenuWindowId(void)
|
u8 GetStartMenuWindowId(void)
|
||||||
{
|
{
|
||||||
return gStartMenuWindowId;
|
return sStartMenuWindowId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveStartMenuWindow(void)
|
void RemoveStartMenuWindow(void)
|
||||||
{
|
{
|
||||||
if (gStartMenuWindowId != 0xFF)
|
if (sStartMenuWindowId != 0xFF)
|
||||||
{
|
{
|
||||||
RemoveWindow(gStartMenuWindowId);
|
RemoveWindow(sStartMenuWindowId);
|
||||||
gStartMenuWindowId = 0xFF;
|
sStartMenuWindowId = 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,22 +517,22 @@ u16 sub_8197A38(void)
|
||||||
|
|
||||||
u8 AddMapNamePopUpWindow(void)
|
u8 AddMapNamePopUpWindow(void)
|
||||||
{
|
{
|
||||||
if (gUnknown_0203CD8D == 0xFF)
|
if (sMapNamePopupWindowId == 0xFF)
|
||||||
gUnknown_0203CD8D = sub_8198AA4(0, 1, 1, 10, 3, 14, 0x107);
|
sMapNamePopupWindowId = sub_8198AA4(0, 1, 1, 10, 3, 14, 0x107);
|
||||||
return gUnknown_0203CD8D;
|
return sMapNamePopupWindowId;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetMapNamePopUpWindowId(void)
|
u8 GetMapNamePopUpWindowId(void)
|
||||||
{
|
{
|
||||||
return gUnknown_0203CD8D;
|
return sMapNamePopupWindowId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveMapNamePopUpWindow(void)
|
void RemoveMapNamePopUpWindow(void)
|
||||||
{
|
{
|
||||||
if (gUnknown_0203CD8D != 0xFF)
|
if (sMapNamePopupWindowId != 0xFF)
|
||||||
{
|
{
|
||||||
RemoveWindow(gUnknown_0203CD8D);
|
RemoveWindow(sMapNamePopupWindowId);
|
||||||
gUnknown_0203CD8D = 0xFF;
|
sMapNamePopupWindowId = 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -625,7 +625,7 @@ static void DoMirageTowerDisintegration(u8 taskId)
|
||||||
SetGpuRegBits(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2));
|
SetGpuRegBits(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2));
|
||||||
SetGpuRegBits(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0));
|
SetGpuRegBits(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0));
|
||||||
SetBgAttribute(0, BG_ATTR_PRIORITY, 0);
|
SetBgAttribute(0, BG_ATTR_PRIORITY, 0);
|
||||||
sub_81971D0();
|
InitStandardTextBoxWindows();
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
ShowBg(0);
|
ShowBg(0);
|
||||||
|
|
|
@ -362,7 +362,7 @@ static void NamingScreen_InitBGs(void)
|
||||||
ChangeBgX(3, 0, 0);
|
ChangeBgX(3, 0, 0);
|
||||||
ChangeBgY(3, 0, 0);
|
ChangeBgY(3, 0, 0);
|
||||||
|
|
||||||
sub_81971D0();
|
InitStandardTextBoxWindows();
|
||||||
sub_8197200();
|
sub_8197200();
|
||||||
|
|
||||||
for (i = 0; i < 5; i++)
|
for (i = 0; i < 5; i++)
|
||||||
|
|
|
@ -136,7 +136,7 @@ static void ClearFrontierRecord(void)
|
||||||
|
|
||||||
static void WarpToTruck(void)
|
static void WarpToTruck(void)
|
||||||
{
|
{
|
||||||
Overworld_SetWarpDestination(MAP_GROUP(INSIDE_OF_TRUCK), MAP_NUM(INSIDE_OF_TRUCK), -1, -1, -1);
|
SetWarpDestination(MAP_GROUP(INSIDE_OF_TRUCK), MAP_NUM(INSIDE_OF_TRUCK), -1, -1, -1);
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ void NewGameInitData(void)
|
||||||
ClearFrontierRecord();
|
ClearFrontierRecord();
|
||||||
ClearSav1();
|
ClearSav1();
|
||||||
ClearMailData();
|
ClearMailData();
|
||||||
gSaveBlock2Ptr->specialSaveWarp = 0;
|
gSaveBlock2Ptr->specialSaveWarpFlags = 0;
|
||||||
gSaveBlock2Ptr->field_A8 = 0;
|
gSaveBlock2Ptr->field_A8 = 0;
|
||||||
InitPlayerTrainerId();
|
InitPlayerTrainerId();
|
||||||
PlayTimeCounter_Reset();
|
PlayTimeCounter_Reset();
|
||||||
|
|
153
src/overworld.c
153
src/overworld.c
|
@ -57,8 +57,10 @@
|
||||||
#include "constants/abilities.h"
|
#include "constants/abilities.h"
|
||||||
#include "constants/map_types.h"
|
#include "constants/map_types.h"
|
||||||
#include "constants/maps.h"
|
#include "constants/maps.h"
|
||||||
|
#include "constants/region_map_sections.h"
|
||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
#include "constants/species.h"
|
#include "constants/species.h"
|
||||||
|
#include "constants/weather.h"
|
||||||
|
|
||||||
// event scripts
|
// event scripts
|
||||||
extern const u8 EventScript_WhiteOut[];
|
extern const u8 EventScript_WhiteOut[];
|
||||||
|
@ -114,7 +116,6 @@ extern void c2_change_map(void);
|
||||||
extern void sub_81D5DF8(void);
|
extern void sub_81D5DF8(void);
|
||||||
extern void sub_80EB218(void);
|
extern void sub_80EB218(void);
|
||||||
extern void sub_80AF3C8(void);
|
extern void sub_80AF3C8(void);
|
||||||
extern void sub_81971F4(void);
|
|
||||||
extern void sub_808B578(void);
|
extern void sub_808B578(void);
|
||||||
extern void sub_80AF314(void);
|
extern void sub_80AF314(void);
|
||||||
extern void sub_80AF214(void);
|
extern void sub_80AF214(void);
|
||||||
|
@ -134,7 +135,7 @@ extern void sub_81AA2F8(void);
|
||||||
extern void sub_8195E10(void);
|
extern void sub_8195E10(void);
|
||||||
extern void sub_80EDB44(void);
|
extern void sub_80EDB44(void);
|
||||||
extern void sub_81D64C0(void);
|
extern void sub_81D64C0(void);
|
||||||
extern void sub_8098128(void);
|
extern void InitFieldMessageBox(void);
|
||||||
extern void copy_map_tileset1_to_vram(const struct MapLayout *);
|
extern void copy_map_tileset1_to_vram(const struct MapLayout *);
|
||||||
extern void copy_map_tileset2_to_vram(const struct MapLayout *);
|
extern void copy_map_tileset2_to_vram(const struct MapLayout *);
|
||||||
extern void FieldUpdateBgTilemapScroll(void);
|
extern void FieldUpdateBgTilemapScroll(void);
|
||||||
|
@ -339,7 +340,7 @@ const struct UCoords32 gDirectionToVectors[] =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct BgTemplate gUnknown_08339DAC[] =
|
static const struct BgTemplate sOverworldBgTemplates[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
|
@ -433,7 +434,7 @@ void DoWhiteOut(void)
|
||||||
SetMoney(&gSaveBlock1Ptr->money, GetMoney(&gSaveBlock1Ptr->money) / 2);
|
SetMoney(&gSaveBlock1Ptr->money, GetMoney(&gSaveBlock1Ptr->money) / 2);
|
||||||
HealPlayerParty();
|
HealPlayerParty();
|
||||||
Overworld_ResetStateAfterWhiteOut();
|
Overworld_ResetStateAfterWhiteOut();
|
||||||
Overworld_SetWarpDestToLastHealLoc();
|
SetWarpDestinationToLastHealLocation();
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,7 +616,7 @@ void ApplyCurrentWarp(void)
|
||||||
gFixedHoleWarp = sDummyWarpData;
|
gFixedHoleWarp = sDummyWarpData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_warp2_warp3_to_neg_1(void)
|
static void ClearDiveAndHoleWarps(void)
|
||||||
{
|
{
|
||||||
gFixedDiveWarp = sDummyWarpData;
|
gFixedDiveWarp = sDummyWarpData;
|
||||||
gFixedHoleWarp = sDummyWarpData;
|
gFixedHoleWarp = sDummyWarpData;
|
||||||
|
@ -696,68 +697,66 @@ void WarpIntoMap(void)
|
||||||
SetPlayerCoordsFromWarp();
|
SetPlayerCoordsFromWarp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overworld_SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
void SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
||||||
{
|
{
|
||||||
SetWarpData(&sWarpDestination, mapGroup, mapNum, warpId, x, y);
|
SetWarpData(&sWarpDestination, mapGroup, mapNum, warpId, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpId)
|
void SetWarpDestinationToMapWarp(s8 mapGroup, s8 mapNum, s8 warpId)
|
||||||
{
|
{
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, -1, -1);
|
SetWarpDestination(mapGroup, mapNum, warpId, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void saved_warp2_set(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId)
|
void SetDynamicWarp(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId)
|
||||||
{
|
{
|
||||||
SetWarpData(&gSaveBlock1Ptr->warp2, mapGroup, mapNum, warpId, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y);
|
SetWarpData(&gSaveBlock1Ptr->dynamicWarp, mapGroup, mapNum, warpId, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void saved_warp2_set_2(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
void SetDynamicWarpWithCoords(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
||||||
{
|
{
|
||||||
SetWarpData(&gSaveBlock1Ptr->warp2, mapGroup, mapNum, warpId, x, y);
|
SetWarpData(&gSaveBlock1Ptr->dynamicWarp, mapGroup, mapNum, warpId, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused)
|
void SetWarpDestinationToDynamicWarp(u8 unusedWarpId)
|
||||||
{
|
{
|
||||||
sWarpDestination = gSaveBlock1Ptr->warp2;
|
sWarpDestination = gSaveBlock1Ptr->dynamicWarp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8084CCC(u8 a1)
|
void SetWarpDestinationToHealLocation(u8 healLocationId)
|
||||||
{
|
{
|
||||||
const struct HealLocation *warp = GetHealLocation(a1);
|
const struct HealLocation *warp = GetHealLocation(healLocationId);
|
||||||
|
|
||||||
if (warp)
|
if (warp)
|
||||||
Overworld_SetWarpDestination(warp->group, warp->map, -1, warp->x, warp->y);
|
SetWarpDestination(warp->group, warp->map, -1, warp->x, warp->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overworld_SetWarpDestToLastHealLoc(void)
|
void SetWarpDestinationToLastHealLocation(void)
|
||||||
{
|
{
|
||||||
sWarpDestination = gSaveBlock1Ptr->lastHealLocation;
|
sWarpDestination = gSaveBlock1Ptr->lastHealLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overworld_SetHealLocationWarp(u8 healLocationId)
|
void SetLastHealLocationWarp(u8 healLocationId)
|
||||||
{
|
{
|
||||||
const struct HealLocation *healLocation = GetHealLocation(healLocationId);
|
const struct HealLocation *healLocation = GetHealLocation(healLocationId);
|
||||||
|
if (healLocation)
|
||||||
if (healLocation != NULL)
|
|
||||||
SetWarpData(&gSaveBlock1Ptr->lastHealLocation, healLocation->group, healLocation->map, -1, healLocation->x, healLocation->y);
|
SetWarpData(&gSaveBlock1Ptr->lastHealLocation, healLocation->group, healLocation->map, -1, healLocation->x, healLocation->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8084D5C(s16 a1, s16 a2)
|
void sub_8084D5C(s16 x, s16 y)
|
||||||
{
|
{
|
||||||
u8 currMapType = Overworld_GetMapTypeOfSaveblockLocation();
|
u8 currMapType = GetCurrentMapType();
|
||||||
u8 destMapType = GetMapTypeByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum);
|
u8 destMapType = GetMapTypeByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum);
|
||||||
if (is_map_type_1_2_3_5_or_6(currMapType) && is_map_type_1_2_3_5_or_6(destMapType) != TRUE)
|
if (is_map_type_1_2_3_5_or_6(currMapType) && is_map_type_1_2_3_5_or_6(destMapType) != TRUE)
|
||||||
sub_8084DD4(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, a1 - 7, a2 - 6);
|
SetEscapeWarp(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x - 7, y - 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8084DD4(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
void SetEscapeWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
||||||
{
|
{
|
||||||
SetWarpData(&gSaveBlock1Ptr->warp4, mapGroup, mapNum, warpId, x, y);
|
SetWarpData(&gSaveBlock1Ptr->escapeWarp, mapGroup, mapNum, warpId, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8084E14(void)
|
void SetWarpDestinationToEscapeWarp(void)
|
||||||
{
|
{
|
||||||
sWarpDestination = gSaveBlock1Ptr->warp4;
|
sWarpDestination = gSaveBlock1Ptr->escapeWarp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
||||||
|
@ -765,7 +764,7 @@ void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
||||||
SetWarpData(&gFixedDiveWarp, mapGroup, mapNum, warpId, x, y);
|
SetWarpData(&gFixedDiveWarp, mapGroup, mapNum, warpId, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetFixedDiveWarpAsDestination(void)
|
static void SetWarpDestinationToDiveWarp(void)
|
||||||
{
|
{
|
||||||
sWarpDestination = gFixedDiveWarp;
|
sWarpDestination = gFixedDiveWarp;
|
||||||
}
|
}
|
||||||
|
@ -775,34 +774,34 @@ void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
||||||
SetWarpData(&gFixedHoleWarp, mapGroup, mapNum, warpId, x, y);
|
SetWarpData(&gFixedHoleWarp, mapGroup, mapNum, warpId, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFixedHoleWarpAsDestination(s16 x, s16 y)
|
void SetWarpDestinationToFixedHoleWarp(s16 x, s16 y)
|
||||||
{
|
{
|
||||||
if (IsDummyWarp(&gFixedHoleWarp) == TRUE)
|
if (IsDummyWarp(&gFixedHoleWarp) == TRUE)
|
||||||
sWarpDestination = gLastUsedWarp;
|
sWarpDestination = gLastUsedWarp;
|
||||||
else
|
else
|
||||||
Overworld_SetWarpDestination(gFixedHoleWarp.mapGroup, gFixedHoleWarp.mapNum, -1, x, y);
|
SetWarpDestination(gFixedHoleWarp.mapGroup, gFixedHoleWarp.mapNum, -1, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void warp1_set_to_sav1w(void)
|
static void SetWarpDestinationToContinueGameWarp(void)
|
||||||
{
|
{
|
||||||
sWarpDestination = gSaveBlock1Ptr->warp1;
|
sWarpDestination = gSaveBlock1Ptr->continueGameWarp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8084F2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
void SetContinueGameWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
|
||||||
{
|
{
|
||||||
SetWarpData(&gSaveBlock1Ptr->warp1, mapGroup, mapNum, warpId, x, y);
|
SetWarpData(&gSaveBlock1Ptr->continueGameWarp, mapGroup, mapNum, warpId, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8084F6C(u8 a1)
|
void SetContinueGameWarpToHealLocation(u8 healLocationId)
|
||||||
{
|
{
|
||||||
const struct HealLocation *warp = GetHealLocation(a1);
|
const struct HealLocation *warp = GetHealLocation(healLocationId);
|
||||||
if (warp)
|
if (warp)
|
||||||
SetWarpData(&gSaveBlock1Ptr->warp1, warp->group, warp->map, -1, warp->x, warp->y);
|
SetWarpData(&gSaveBlock1Ptr->continueGameWarp, warp->group, warp->map, -1, warp->x, warp->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8084FAC(int unused)
|
void SetContinueGameWarpToDynamicWarp(int unused)
|
||||||
{
|
{
|
||||||
gSaveBlock1Ptr->warp1 = gSaveBlock1Ptr->warp2;
|
gSaveBlock1Ptr->continueGameWarp = gSaveBlock1Ptr->dynamicWarp;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct MapConnection *GetMapConnection(u8 dir)
|
const struct MapConnection *GetMapConnection(u8 dir)
|
||||||
|
@ -827,14 +826,14 @@ static bool8 SetDiveWarp(u8 dir, u16 x, u16 y)
|
||||||
|
|
||||||
if (connection != NULL)
|
if (connection != NULL)
|
||||||
{
|
{
|
||||||
Overworld_SetWarpDestination(connection->mapGroup, connection->mapNum, -1, x, y);
|
SetWarpDestination(connection->mapGroup, connection->mapNum, -1, x, y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mapheader_run_script_with_tag_x6();
|
mapheader_run_script_with_tag_x6();
|
||||||
if (IsDummyWarp(&gFixedDiveWarp))
|
if (IsDummyWarp(&gFixedDiveWarp))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
SetFixedDiveWarpAsDestination();
|
SetWarpDestinationToDiveWarp();
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -853,7 +852,7 @@ void mliX_load_map(u8 mapGroup, u8 mapNum)
|
||||||
{
|
{
|
||||||
s32 paletteIndex;
|
s32 paletteIndex;
|
||||||
|
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, -1, -1, -1);
|
SetWarpDestination(mapGroup, mapNum, -1, -1, -1);
|
||||||
if (gMapHeader.regionMapSectionId != 0x3A)
|
if (gMapHeader.regionMapSectionId != 0x3A)
|
||||||
sub_8085810();
|
sub_8085810();
|
||||||
|
|
||||||
|
@ -885,7 +884,7 @@ void mliX_load_map(u8 mapGroup, u8 mapNum)
|
||||||
ResetFieldTasksArgs();
|
ResetFieldTasksArgs();
|
||||||
mapheader_run_script_with_tag_x5();
|
mapheader_run_script_with_tag_x5();
|
||||||
|
|
||||||
if (gMapHeader.regionMapSectionId != 0x3A || gMapHeader.regionMapSectionId != sLastMapSectionId)
|
if (gMapHeader.regionMapSectionId != MAPSEC_BATTLE_FRONTIER || gMapHeader.regionMapSectionId != sLastMapSectionId)
|
||||||
ShowMapNamePopup();
|
ShowMapNamePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -964,7 +963,7 @@ void StoreInitialPlayerAvatarState(void)
|
||||||
static struct InitialPlayerAvatarState *GetInitialPlayerAvatarState(void)
|
static struct InitialPlayerAvatarState *GetInitialPlayerAvatarState(void)
|
||||||
{
|
{
|
||||||
struct InitialPlayerAvatarState playerStruct;
|
struct InitialPlayerAvatarState playerStruct;
|
||||||
u8 mapType = Overworld_GetMapTypeOfSaveblockLocation();
|
u8 mapType = GetCurrentMapType();
|
||||||
u16 metatileBehavior = GetCenterScreenMetatileBehavior();
|
u16 metatileBehavior = GetCenterScreenMetatileBehavior();
|
||||||
u8 transitionFlags = GetAdjustedInitialTransitionFlags(&gInitialPlayerAvatarState, metatileBehavior, mapType);
|
u8 transitionFlags = GetAdjustedInitialTransitionFlags(&gInitialPlayerAvatarState, metatileBehavior, mapType);
|
||||||
playerStruct.transitionFlags = transitionFlags;
|
playerStruct.transitionFlags = transitionFlags;
|
||||||
|
@ -1051,7 +1050,7 @@ u8 Overworld_GetFlashLevel(void)
|
||||||
return gSaveBlock1Ptr->flashLevel;
|
return gSaveBlock1Ptr->flashLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8085524(u16 mapLayoutId)
|
void SetCurrentMapLayout(u16 mapLayoutId)
|
||||||
{
|
{
|
||||||
gSaveBlock1Ptr->mapLayoutId = mapLayoutId;
|
gSaveBlock1Ptr->mapLayoutId = mapLayoutId;
|
||||||
gMapHeader.mapLayout = GetMapLayout();
|
gMapHeader.mapLayout = GetMapLayout();
|
||||||
|
@ -1160,11 +1159,11 @@ u16 GetCurrLocationDefaultMusic(void)
|
||||||
// Play the desert music only when the sandstorm is active on Route 111.
|
// Play the desert music only when the sandstorm is active on Route 111.
|
||||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ROUTE111)
|
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(ROUTE111)
|
||||||
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE111)
|
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(ROUTE111)
|
||||||
&& GetSav1Weather() == 8)
|
&& GetSav1Weather() == WEATHER_SANDSTORM)
|
||||||
return MUS_ASHROAD;
|
return MUS_ASHROAD;
|
||||||
|
|
||||||
music = GetLocationMusic(&gSaveBlock1Ptr->location);
|
music = GetLocationMusic(&gSaveBlock1Ptr->location);
|
||||||
if (music != 0x7FFF)
|
if (music != MUS_ROUTE_118)
|
||||||
{
|
{
|
||||||
return music;
|
return music;
|
||||||
}
|
}
|
||||||
|
@ -1180,7 +1179,7 @@ u16 GetCurrLocationDefaultMusic(void)
|
||||||
u16 GetWarpDestinationMusic(void)
|
u16 GetWarpDestinationMusic(void)
|
||||||
{
|
{
|
||||||
u16 music = GetLocationMusic(&sWarpDestination);
|
u16 music = GetLocationMusic(&sWarpDestination);
|
||||||
if (music != 0x7FFF)
|
if (music != MUS_ROUTE_118)
|
||||||
{
|
{
|
||||||
return music;
|
return music;
|
||||||
}
|
}
|
||||||
|
@ -1207,7 +1206,7 @@ void Overworld_PlaySpecialMapMusic(void)
|
||||||
{
|
{
|
||||||
if (gSaveBlock1Ptr->savedMusic)
|
if (gSaveBlock1Ptr->savedMusic)
|
||||||
music = gSaveBlock1Ptr->savedMusic;
|
music = gSaveBlock1Ptr->savedMusic;
|
||||||
else if (Overworld_GetMapTypeOfSaveblockLocation() == MAP_TYPE_UNDERWATER)
|
else if (GetCurrentMapType() == MAP_TYPE_UNDERWATER)
|
||||||
music = MUS_DEEPDEEP;
|
music = MUS_DEEPDEEP;
|
||||||
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
|
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
|
||||||
music = MUS_NAMINORI;
|
music = MUS_NAMINORI;
|
||||||
|
@ -1285,8 +1284,8 @@ void TryFadeOutOldMapMusic(void)
|
||||||
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(SOOTOPOLIS_CITY)
|
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(SOOTOPOLIS_CITY)
|
||||||
&& sWarpDestination.mapGroup == MAP_GROUP(SOOTOPOLIS_CITY)
|
&& sWarpDestination.mapGroup == MAP_GROUP(SOOTOPOLIS_CITY)
|
||||||
&& sWarpDestination.mapNum == MAP_NUM(SOOTOPOLIS_CITY)
|
&& sWarpDestination.mapNum == MAP_NUM(SOOTOPOLIS_CITY)
|
||||||
&& sWarpDestination.x == 0x1D
|
&& sWarpDestination.x == 29
|
||||||
&& sWarpDestination.y == 0x35)
|
&& sWarpDestination.y == 53)
|
||||||
return;
|
return;
|
||||||
FadeOutMapMusic(GetMapMusicFadeoutSpeed());
|
FadeOutMapMusic(GetMapMusicFadeoutSpeed());
|
||||||
}
|
}
|
||||||
|
@ -1388,7 +1387,7 @@ u8 GetMapTypeByWarpData(struct WarpData *warp)
|
||||||
return GetMapTypeByGroupAndId(warp->mapGroup, warp->mapNum);
|
return GetMapTypeByGroupAndId(warp->mapGroup, warp->mapNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 Overworld_GetMapTypeOfSaveblockLocation(void)
|
u8 GetCurrentMapType(void)
|
||||||
{
|
{
|
||||||
return GetMapTypeByWarpData(&gSaveBlock1Ptr->location);
|
return GetMapTypeByWarpData(&gSaveBlock1Ptr->location);
|
||||||
}
|
}
|
||||||
|
@ -1430,12 +1429,12 @@ bool8 Overworld_MapTypeIsIndoors(u8 mapType)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 sav1_saved_warp2_map_get_name(void)
|
u8 GetSavedWarpRegionMapSectionId(void)
|
||||||
{
|
{
|
||||||
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->warp2.mapGroup, gSaveBlock1Ptr->warp2.mapNum)->regionMapSectionId;
|
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->dynamicWarp.mapGroup, gSaveBlock1Ptr->dynamicWarp.mapNum)->regionMapSectionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 sav1_map_get_name(void)
|
u8 GetCurrentRegionMapSectionId(void)
|
||||||
{
|
{
|
||||||
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum)->regionMapSectionId;
|
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum)->regionMapSectionId;
|
||||||
}
|
}
|
||||||
|
@ -1445,30 +1444,30 @@ u8 GetCurrentMapBattleScene(void)
|
||||||
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum)->battleType;
|
return Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum)->battleType;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void overworld_bg_setup(void)
|
static void InitOverworldBgs(void)
|
||||||
{
|
{
|
||||||
InitBgsFromTemplates(0, gUnknown_08339DAC, ARRAY_COUNT(gUnknown_08339DAC));
|
InitBgsFromTemplates(0, sOverworldBgTemplates, ARRAY_COUNT(sOverworldBgTemplates));
|
||||||
SetBgAttribute(1, BG_ATTR_MOSAIC, 1);
|
SetBgAttribute(1, BG_ATTR_MOSAIC, 1);
|
||||||
SetBgAttribute(2, BG_ATTR_MOSAIC, 1);
|
SetBgAttribute(2, BG_ATTR_MOSAIC, 1);
|
||||||
SetBgAttribute(3, BG_ATTR_MOSAIC, 1);
|
SetBgAttribute(3, BG_ATTR_MOSAIC, 1);
|
||||||
gBGTilemapBuffers2 = AllocZeroed(0x800);
|
gBGTilemapBuffers2 = AllocZeroed(BG_SCREEN_SIZE);
|
||||||
gBGTilemapBuffers1 = AllocZeroed(0x800);
|
gBGTilemapBuffers1 = AllocZeroed(BG_SCREEN_SIZE);
|
||||||
gBGTilemapBuffers3 = AllocZeroed(0x800);
|
gBGTilemapBuffers3 = AllocZeroed(BG_SCREEN_SIZE);
|
||||||
SetBgTilemapBuffer(1, gBGTilemapBuffers2);
|
SetBgTilemapBuffer(1, gBGTilemapBuffers2);
|
||||||
SetBgTilemapBuffer(2, gBGTilemapBuffers1);
|
SetBgTilemapBuffer(2, gBGTilemapBuffers1);
|
||||||
SetBgTilemapBuffer(3, gBGTilemapBuffers3);
|
SetBgTilemapBuffer(3, gBGTilemapBuffers3);
|
||||||
sub_81971D0();
|
InitStandardTextBoxWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void overworld_free_bg_tilemaps(void)
|
void CleanupOverworldWindowsAndTilemaps(void)
|
||||||
{
|
{
|
||||||
ClearMirageTowerPulseBlendEffect();
|
ClearMirageTowerPulseBlendEffect();
|
||||||
sub_81971F4();
|
FreeAllOverworldWindowBuffers();
|
||||||
if (gBGTilemapBuffers3 != NULL)
|
if (gBGTilemapBuffers3)
|
||||||
FREE_AND_SET_NULL(gBGTilemapBuffers3);
|
FREE_AND_SET_NULL(gBGTilemapBuffers3);
|
||||||
if (gBGTilemapBuffers1 != NULL)
|
if (gBGTilemapBuffers1)
|
||||||
FREE_AND_SET_NULL(gBGTilemapBuffers1);
|
FREE_AND_SET_NULL(gBGTilemapBuffers1);
|
||||||
if (gBGTilemapBuffers2 != NULL)
|
if (gBGTilemapBuffers2)
|
||||||
FREE_AND_SET_NULL(gBGTilemapBuffers2);
|
FREE_AND_SET_NULL(gBGTilemapBuffers2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1762,7 +1761,7 @@ void CB2_ContinueSavedGame(void)
|
||||||
sub_81A3908();
|
sub_81A3908();
|
||||||
|
|
||||||
LoadSaveblockMapHeader();
|
LoadSaveblockMapHeader();
|
||||||
set_warp2_warp3_to_neg_1();
|
ClearDiveAndHoleWarps();
|
||||||
trainerHillMapId = GetCurrentTrainerHillMapId();
|
trainerHillMapId = GetCurrentTrainerHillMapId();
|
||||||
if (gMapHeader.mapLayoutId == 0x169)
|
if (gMapHeader.mapLayoutId == 0x169)
|
||||||
sub_81AA2F8();
|
sub_81AA2F8();
|
||||||
|
@ -1785,10 +1784,10 @@ void CB2_ContinueSavedGame(void)
|
||||||
ScriptContext1_Init();
|
ScriptContext1_Init();
|
||||||
ScriptContext2_Disable();
|
ScriptContext2_Disable();
|
||||||
sub_8195E10();
|
sub_8195E10();
|
||||||
if (GetSecretBase2Field_9() == 1)
|
if (UseContinueGameWarp() == TRUE)
|
||||||
{
|
{
|
||||||
ClearSecretBase2Field_9();
|
ClearContinueGameWarpStatus();
|
||||||
warp1_set_to_sav1w();
|
SetWarpDestinationToContinueGameWarp();
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
sub_80EDB44();
|
sub_80EDB44();
|
||||||
SetMainCallback2(CB2_LoadMap);
|
SetMainCallback2(CB2_LoadMap);
|
||||||
|
@ -1861,7 +1860,7 @@ static bool32 map_loading_iteration_3(u8 *state)
|
||||||
switch (*state)
|
switch (*state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
overworld_bg_setup();
|
InitOverworldBgs();
|
||||||
ScriptContext1_Init();
|
ScriptContext1_Init();
|
||||||
ScriptContext2_Disable();
|
ScriptContext2_Disable();
|
||||||
sub_80867C8();
|
sub_80867C8();
|
||||||
|
@ -2147,8 +2146,8 @@ static void InitOverworldGraphicsRegisters(void)
|
||||||
clear_scheduled_bg_copies_to_vram();
|
clear_scheduled_bg_copies_to_vram();
|
||||||
reset_temp_tile_data_buffers();
|
reset_temp_tile_data_buffers();
|
||||||
SetGpuReg(REG_OFFSET_MOSAIC, 0);
|
SetGpuReg(REG_OFFSET_MOSAIC, 0);
|
||||||
SetGpuReg(REG_OFFSET_WININ, 0x1F1F);
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ);
|
||||||
SetGpuReg(REG_OFFSET_WINOUT, 0x101);
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WINOBJ_BG0);
|
||||||
SetGpuReg(REG_OFFSET_WIN0H, 0xFF);
|
SetGpuReg(REG_OFFSET_WIN0H, 0xFF);
|
||||||
SetGpuReg(REG_OFFSET_WIN0V, 0xFF);
|
SetGpuReg(REG_OFFSET_WIN0V, 0xFF);
|
||||||
SetGpuReg(REG_OFFSET_WIN1H, 0xFFFF);
|
SetGpuReg(REG_OFFSET_WIN1H, 0xFFFF);
|
||||||
|
@ -2156,7 +2155,7 @@ static void InitOverworldGraphicsRegisters(void)
|
||||||
SetGpuReg(REG_OFFSET_BLDCNT, gUnknown_82EC7C4[1] | gUnknown_82EC7C4[2] | gUnknown_82EC7C4[3]
|
SetGpuReg(REG_OFFSET_BLDCNT, gUnknown_82EC7C4[1] | gUnknown_82EC7C4[2] | gUnknown_82EC7C4[3]
|
||||||
| BLDCNT_TGT2_OBJ | BLDCNT_EFFECT_BLEND);
|
| BLDCNT_TGT2_OBJ | BLDCNT_EFFECT_BLEND);
|
||||||
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(13, 7));
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(13, 7));
|
||||||
overworld_bg_setup();
|
InitOverworldBgs();
|
||||||
schedule_bg_copy_tilemap_to_vram(1);
|
schedule_bg_copy_tilemap_to_vram(1);
|
||||||
schedule_bg_copy_tilemap_to_vram(2);
|
schedule_bg_copy_tilemap_to_vram(2);
|
||||||
schedule_bg_copy_tilemap_to_vram(3);
|
schedule_bg_copy_tilemap_to_vram(3);
|
||||||
|
@ -2174,7 +2173,7 @@ static void InitOverworldGraphicsRegisters(void)
|
||||||
ShowBg(1);
|
ShowBg(1);
|
||||||
ShowBg(2);
|
ShowBg(2);
|
||||||
ShowBg(3);
|
ShowBg(3);
|
||||||
sub_8098128();
|
InitFieldMessageBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8086988(u32 a1)
|
static void sub_8086988(u32 a1)
|
||||||
|
|
|
@ -4721,7 +4721,7 @@ static void CursorCb_FieldMove(u8 taskId)
|
||||||
gUnknown_0203CEC4->data[0] = fieldMove;
|
gUnknown_0203CEC4->data[0] = fieldMove;
|
||||||
break;
|
break;
|
||||||
case FIELD_MOVE_DIG:
|
case FIELD_MOVE_DIG:
|
||||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->warp4.mapGroup, gSaveBlock1Ptr->warp4.mapNum);
|
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->escapeWarp.mapGroup, gSaveBlock1Ptr->escapeWarp.mapNum);
|
||||||
sub_81245DC(gStringVar1, mapHeader->regionMapSectionId);
|
sub_81245DC(gStringVar1, mapHeader->regionMapSectionId);
|
||||||
StringExpandPlaceholders(gStringVar4, gText_EscapeFromHere);
|
StringExpandPlaceholders(gStringVar4, gText_EscapeFromHere);
|
||||||
sub_81B5674(taskId);
|
sub_81B5674(taskId);
|
||||||
|
@ -7249,7 +7249,7 @@ static void sub_81B9424(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
InitPartyMenu(2, 0, 11, 0, 0, sub_81B1370, sub_81B9470);
|
InitPartyMenu(2, 0, 11, 0, 0, sub_81B1370, sub_81B9470);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
@ -7276,7 +7276,7 @@ static void sub_81B94D0(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
InitPartyMenu(3, 0, 11, 0, 0, sub_81B1370, sub_81B9390);
|
InitPartyMenu(3, 0, 11, 0, 0, sub_81B1370, sub_81B9390);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
@ -7293,7 +7293,7 @@ static void sub_81B953C(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
InitPartyMenu(7, 0, 11, 0, 0, sub_81B1370, sub_81B9588);
|
InitPartyMenu(7, 0, 11, 0, 0, sub_81B1370, sub_81B9588);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
@ -7336,7 +7336,7 @@ static void sub_81B9640(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
InitPartyMenu(12, 0, 0, 0, 0, sub_81B1370, sub_81B9390);
|
InitPartyMenu(12, 0, 0, 0, 0, sub_81B1370, sub_81B9390);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,7 +491,7 @@ static void Task_ItemStorage_Deposit(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
sub_81AAC14();
|
sub_81AAC14();
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
@ -723,7 +723,7 @@ static void Mailbox_FadeAndReadMail(u8 taskId)
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
sub_81D1EC0();
|
sub_81D1EC0();
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
ReadMail(&(gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos]), Mailbox_ReturnToFieldFromReadMail, TRUE);
|
ReadMail(&(gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos]), Mailbox_ReturnToFieldFromReadMail, TRUE);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
@ -823,7 +823,7 @@ static void Mailbox_DoGiveMailPokeMenu(u8 taskId)
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
sub_81D1EC0();
|
sub_81D1EC0();
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
sub_81B8448();
|
sub_81B8448();
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2588,7 +2588,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||||
SetBoxMonData(boxMon, MON_DATA_SPECIES, &species);
|
SetBoxMonData(boxMon, MON_DATA_SPECIES, &species);
|
||||||
SetBoxMonData(boxMon, MON_DATA_EXP, &gExperienceTables[gBaseStats[species].growthRate][level]);
|
SetBoxMonData(boxMon, MON_DATA_EXP, &gExperienceTables[gBaseStats[species].growthRate][level]);
|
||||||
SetBoxMonData(boxMon, MON_DATA_FRIENDSHIP, &gBaseStats[species].friendship);
|
SetBoxMonData(boxMon, MON_DATA_FRIENDSHIP, &gBaseStats[species].friendship);
|
||||||
value = sav1_map_get_name();
|
value = GetCurrentRegionMapSectionId();
|
||||||
SetBoxMonData(boxMon, MON_DATA_MET_LOCATION, &value);
|
SetBoxMonData(boxMon, MON_DATA_MET_LOCATION, &value);
|
||||||
SetBoxMonData(boxMon, MON_DATA_MET_LEVEL, &level);
|
SetBoxMonData(boxMon, MON_DATA_MET_LEVEL, &level);
|
||||||
SetBoxMonData(boxMon, MON_DATA_MET_GAME, &gGameVersion);
|
SetBoxMonData(boxMon, MON_DATA_MET_GAME, &gGameVersion);
|
||||||
|
@ -5457,7 +5457,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
{
|
{
|
||||||
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
|
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
|
||||||
friendship++;
|
friendship++;
|
||||||
if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == sav1_map_get_name())
|
if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId())
|
||||||
friendship++;
|
friendship++;
|
||||||
}
|
}
|
||||||
if (friendship < 0)
|
if (friendship < 0)
|
||||||
|
@ -5483,7 +5483,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
{
|
{
|
||||||
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
|
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
|
||||||
friendship++;
|
friendship++;
|
||||||
if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == sav1_map_get_name())
|
if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId())
|
||||||
friendship++;
|
friendship++;
|
||||||
}
|
}
|
||||||
if (friendship < 0)
|
if (friendship < 0)
|
||||||
|
@ -5508,7 +5508,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
{
|
{
|
||||||
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
|
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)
|
||||||
friendship++;
|
friendship++;
|
||||||
if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == sav1_map_get_name())
|
if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId())
|
||||||
friendship++;
|
friendship++;
|
||||||
}
|
}
|
||||||
if (friendship < 0)
|
if (friendship < 0)
|
||||||
|
@ -6156,7 +6156,7 @@ void AdjustFriendship(struct Pokemon *mon, u8 event)
|
||||||
{
|
{
|
||||||
if (GetMonData(mon, MON_DATA_POKEBALL, 0) == ITEM_LUXURY_BALL)
|
if (GetMonData(mon, MON_DATA_POKEBALL, 0) == ITEM_LUXURY_BALL)
|
||||||
friendship++;
|
friendship++;
|
||||||
if (GetMonData(mon, MON_DATA_MET_LOCATION, 0) == sav1_map_get_name())
|
if (GetMonData(mon, MON_DATA_MET_LOCATION, 0) == GetCurrentRegionMapSectionId())
|
||||||
friendship++;
|
friendship++;
|
||||||
}
|
}
|
||||||
if (friendship < 0)
|
if (friendship < 0)
|
||||||
|
|
|
@ -1759,7 +1759,7 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
|
||||||
case 4:
|
case 4:
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
Cb2_EnterPSS(task->data[2]);
|
Cb2_EnterPSS(task->data[2]);
|
||||||
RemoveWindow(task->data[15]);
|
RemoveWindow(task->data[15]);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
|
|
|
@ -34,12 +34,12 @@ int GameClear(void)
|
||||||
if (GetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME) == 0)
|
if (GetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME) == 0)
|
||||||
SetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME, (gSaveBlock2Ptr->playTimeHours << 16) | (gSaveBlock2Ptr->playTimeMinutes << 8) | gSaveBlock2Ptr->playTimeSeconds);
|
SetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME, (gSaveBlock2Ptr->playTimeHours << 16) | (gSaveBlock2Ptr->playTimeMinutes << 8) | gSaveBlock2Ptr->playTimeSeconds);
|
||||||
|
|
||||||
SetSecretBase2Field_9();
|
SetContinueGameWarpStatus();
|
||||||
|
|
||||||
if (gSaveBlock2Ptr->playerGender == MALE)
|
if (gSaveBlock2Ptr->playerGender == MALE)
|
||||||
sub_8084F6C(HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F);
|
SetContinueGameWarpToHealLocation(HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F);
|
||||||
else
|
else
|
||||||
sub_8084F6C(HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F);
|
SetContinueGameWarpToHealLocation(HEAL_LOCATION_LITTLEROOT_TOWN_MAYS_HOUSE_2F);
|
||||||
|
|
||||||
ribbonGet = FALSE;
|
ribbonGet = FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1481,14 +1481,14 @@ static void sub_80E7FF8(u8 taskId)
|
||||||
task->data[0] = 6;
|
task->data[0] = 6;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sub_8076D5C();
|
SetContinueGameWarpStatusToDynamicWarp();
|
||||||
sub_8153430();
|
sub_8153430();
|
||||||
task->data[0] ++;
|
task->data[0] ++;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (sub_8153474())
|
if (sub_8153474())
|
||||||
{
|
{
|
||||||
sav2_gender2_inplace_and_xFE();
|
ClearContinueGameWarpStatus2();
|
||||||
task->data[0] = 4;
|
task->data[0] = 4;
|
||||||
task->data[1] = 0;
|
task->data[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "constants/region_map_sections.h"
|
#include "constants/region_map_sections.h"
|
||||||
#include "heal_location.h"
|
#include "heal_location.h"
|
||||||
#include "constants/heal_locations.h"
|
#include "constants/heal_locations.h"
|
||||||
|
#include "constants/map_types.h"
|
||||||
|
|
||||||
#define MAP_WIDTH 28
|
#define MAP_WIDTH 28
|
||||||
#define MAP_HEIGHT 15
|
#define MAP_HEIGHT 15
|
||||||
|
@ -864,7 +865,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
|
||||||
u16 y;
|
u16 y;
|
||||||
u16 dimensionScale;
|
u16 dimensionScale;
|
||||||
u16 xOnMap;
|
u16 xOnMap;
|
||||||
struct WarpData *storedWarp;
|
struct WarpData *warp;
|
||||||
|
|
||||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SS_TIDAL_CORRIDOR)
|
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(SS_TIDAL_CORRIDOR)
|
||||||
&& (gSaveBlock1Ptr->location.mapNum == MAP_NUM(SS_TIDAL_CORRIDOR)
|
&& (gSaveBlock1Ptr->location.mapNum == MAP_NUM(SS_TIDAL_CORRIDOR)
|
||||||
|
@ -878,11 +879,11 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
|
||||||
switch (GetMapTypeByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum))
|
switch (GetMapTypeByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 1:
|
case MAP_TYPE_TOWN:
|
||||||
case 2:
|
case MAP_TYPE_CITY:
|
||||||
case 3:
|
case MAP_TYPE_ROUTE:
|
||||||
case 5:
|
case MAP_TYPE_UNDERWATER:
|
||||||
case 6:
|
case MAP_TYPE_6:
|
||||||
gRegionMap->mapSecId = gMapHeader.regionMapSectionId;
|
gRegionMap->mapSecId = gMapHeader.regionMapSectionId;
|
||||||
gRegionMap->playerIsInCave = FALSE;
|
gRegionMap->playerIsInCave = FALSE;
|
||||||
mapWidth = gMapHeader.mapLayout->width;
|
mapWidth = gMapHeader.mapLayout->width;
|
||||||
|
@ -894,17 +895,17 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
|
||||||
gRegionMap->playerIsInCave = TRUE;
|
gRegionMap->playerIsInCave = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case MAP_TYPE_UNDERGROUND:
|
||||||
case 7:
|
case MAP_TYPE_7:
|
||||||
if (gMapHeader.flags & 0x02)
|
if (gMapHeader.flags & 0x02)
|
||||||
{
|
{
|
||||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->warp4.mapGroup, gSaveBlock1Ptr->warp4.mapNum);
|
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->escapeWarp.mapGroup, gSaveBlock1Ptr->escapeWarp.mapNum);
|
||||||
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
||||||
gRegionMap->playerIsInCave = TRUE;
|
gRegionMap->playerIsInCave = TRUE;
|
||||||
mapWidth = mapHeader->mapLayout->width;
|
mapWidth = mapHeader->mapLayout->width;
|
||||||
mapHeight = mapHeader->mapLayout->height;
|
mapHeight = mapHeader->mapLayout->height;
|
||||||
x = gSaveBlock1Ptr->warp4.x;
|
x = gSaveBlock1Ptr->escapeWarp.x;
|
||||||
y = gSaveBlock1Ptr->warp4.y;
|
y = gSaveBlock1Ptr->escapeWarp.y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -916,27 +917,26 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
|
||||||
y = 1;
|
y = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9:
|
case MAP_TYPE_SECRET_BASE:
|
||||||
mapHeader = Overworld_GetMapHeaderByGroupAndId((u16)gSaveBlock1Ptr->warp2.mapGroup, (u16)gSaveBlock1Ptr->warp2.mapNum);
|
mapHeader = Overworld_GetMapHeaderByGroupAndId((u16)gSaveBlock1Ptr->dynamicWarp.mapGroup, (u16)gSaveBlock1Ptr->dynamicWarp.mapNum);
|
||||||
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
||||||
gRegionMap->playerIsInCave = TRUE;
|
gRegionMap->playerIsInCave = TRUE;
|
||||||
mapWidth = mapHeader->mapLayout->width;
|
mapWidth = mapHeader->mapLayout->width;
|
||||||
mapHeight = mapHeader->mapLayout->height;
|
mapHeight = mapHeader->mapLayout->height;
|
||||||
x = gSaveBlock1Ptr->warp2.x;
|
x = gSaveBlock1Ptr->dynamicWarp.x;
|
||||||
y = gSaveBlock1Ptr->warp2.y;
|
y = gSaveBlock1Ptr->dynamicWarp.y;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case MAP_TYPE_INDOOR:
|
||||||
|
|
||||||
gRegionMap->mapSecId = gMapHeader.regionMapSectionId;
|
gRegionMap->mapSecId = gMapHeader.regionMapSectionId;
|
||||||
if (gRegionMap->mapSecId != MAPSEC_DYNAMIC)
|
if (gRegionMap->mapSecId != MAPSEC_DYNAMIC)
|
||||||
{
|
{
|
||||||
storedWarp = &gSaveBlock1Ptr->warp4;
|
warp = &gSaveBlock1Ptr->escapeWarp;
|
||||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(storedWarp->mapGroup, storedWarp->mapNum);
|
mapHeader = Overworld_GetMapHeaderByGroupAndId(warp->mapGroup, warp->mapNum);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
storedWarp = &gSaveBlock1Ptr->warp2;
|
warp = &gSaveBlock1Ptr->dynamicWarp;
|
||||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(storedWarp->mapGroup, storedWarp->mapNum);
|
mapHeader = Overworld_GetMapHeaderByGroupAndId(warp->mapGroup, warp->mapNum);
|
||||||
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
|
||||||
}
|
}
|
||||||
if (RegionMap_IsPlayerInCave(gRegionMap->mapSecId))
|
if (RegionMap_IsPlayerInCave(gRegionMap->mapSecId))
|
||||||
|
@ -949,8 +949,8 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
|
||||||
}
|
}
|
||||||
mapWidth = mapHeader->mapLayout->width;
|
mapWidth = mapHeader->mapLayout->width;
|
||||||
mapHeight = mapHeader->mapLayout->height;
|
mapHeight = mapHeader->mapLayout->height;
|
||||||
x = storedWarp->x;
|
x = warp->x;
|
||||||
y = storedWarp->y;
|
y = warp->y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1902,25 +1902,25 @@ static void sub_8124E0C(void)
|
||||||
switch (sFlyMap->regionMap.mapSecId)
|
switch (sFlyMap->regionMap.mapSecId)
|
||||||
{
|
{
|
||||||
case MAPSEC_SOUTHERN_ISLAND:
|
case MAPSEC_SOUTHERN_ISLAND:
|
||||||
sub_8084CCC(HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR);
|
SetWarpDestinationToHealLocation(HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR);
|
||||||
break;
|
break;
|
||||||
case MAPSEC_BATTLE_FRONTIER:
|
case MAPSEC_BATTLE_FRONTIER:
|
||||||
sub_8084CCC(HEAL_LOCATION_BATTLE_FRONTIER_OUTSIDE_EAST);
|
SetWarpDestinationToHealLocation(HEAL_LOCATION_BATTLE_FRONTIER_OUTSIDE_EAST);
|
||||||
break;
|
break;
|
||||||
case MAPSEC_LITTLEROOT_TOWN:
|
case MAPSEC_LITTLEROOT_TOWN:
|
||||||
sub_8084CCC(gSaveBlock2Ptr->playerGender == MALE ? HEAL_LOCATION_LITTLEROOT_TOWN_1 : HEAL_LOCATION_LITTLEROOT_TOWN_2);
|
SetWarpDestinationToHealLocation(gSaveBlock2Ptr->playerGender == MALE ? HEAL_LOCATION_LITTLEROOT_TOWN_1 : HEAL_LOCATION_LITTLEROOT_TOWN_2);
|
||||||
break;
|
break;
|
||||||
case MAPSEC_EVER_GRANDE_CITY:
|
case MAPSEC_EVER_GRANDE_CITY:
|
||||||
sub_8084CCC(FlagGet(FLAG_LANDMARK_POKEMON_LEAGUE) && sFlyMap->regionMap.posWithinMapSec == 0 ? HEAL_LOCATION_EVER_GRANDE_CITY_2 : HEAL_LOCATION_EVER_GRANDE_CITY_1);
|
SetWarpDestinationToHealLocation(FlagGet(FLAG_LANDMARK_POKEMON_LEAGUE) && sFlyMap->regionMap.posWithinMapSec == 0 ? HEAL_LOCATION_EVER_GRANDE_CITY_2 : HEAL_LOCATION_EVER_GRANDE_CITY_1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (sMapHealLocations[sFlyMap->regionMap.mapSecId][2] != 0)
|
if (sMapHealLocations[sFlyMap->regionMap.mapSecId][2] != 0)
|
||||||
{
|
{
|
||||||
sub_8084CCC(sMapHealLocations[sFlyMap->regionMap.mapSecId][2]);
|
SetWarpDestinationToHealLocation(sMapHealLocations[sFlyMap->regionMap.mapSecId][2]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
warp1_set_2(sMapHealLocations[sFlyMap->regionMap.mapSecId][0], sMapHealLocations[sFlyMap->regionMap.mapSecId][1], -1);
|
SetWarpDestinationToMapWarp(sMapHealLocations[sFlyMap->regionMap.mapSecId][0], sMapHealLocations[sFlyMap->regionMap.mapSecId][1], -1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1315,7 +1315,7 @@ u32 sub_8013B8C(struct UnkStruct_Group *arg0, s32 id)
|
||||||
|
|
||||||
if (gUnknown_02022C2C == 4 && structPtr->unk.field_0.unk_00.unk_01_2 != 3)
|
if (gUnknown_02022C2C == 4 && structPtr->unk.field_0.unk_00.unk_01_2 != 3)
|
||||||
{
|
{
|
||||||
if (!(gSaveBlock2Ptr->specialSaveWarp & 0x80))
|
if (!(gSaveBlock2Ptr->specialSaveWarpFlags & 0x80))
|
||||||
return 1;
|
return 1;
|
||||||
else if (structPtr->unk.field_0.unk_00.unk_00_7)
|
else if (structPtr->unk.field_0.unk_00.unk_00_7)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1633,8 +1633,8 @@ void sub_8014210(u16 battleFlags)
|
||||||
void sub_8014290(u16 arg0, u16 x, u16 y)
|
void sub_8014290(u16 arg0, u16 x, u16 y)
|
||||||
{
|
{
|
||||||
VarSet(VAR_0x4087, arg0);
|
VarSet(VAR_0x4087, arg0);
|
||||||
Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
|
SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
|
||||||
saved_warp2_set_2(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
|
SetDynamicWarpWithCoords(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x, y);
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1645,7 +1645,7 @@ void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4)
|
||||||
gFieldLinkPlayerCount = GetLinkPlayerCount();
|
gFieldLinkPlayerCount = GetLinkPlayerCount();
|
||||||
gUnknown_03005DB4 = GetMultiplayerId();
|
gUnknown_03005DB4 = GetMultiplayerId();
|
||||||
SetCableClubWarp();
|
SetCableClubWarp();
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, -1, x, y);
|
SetWarpDestination(mapGroup, mapNum, -1, x, y);
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1697,12 +1697,12 @@ void sub_801440C(u8 taskId)
|
||||||
{
|
{
|
||||||
case 65:
|
case 65:
|
||||||
case 81:
|
case 81:
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
gMain.savedCallback = sub_801AC54;
|
gMain.savedCallback = sub_801AC54;
|
||||||
sub_81B8518(3);
|
sub_81B8518(3);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
sub_80143E4(gBlockSendBuffer, TRUE);
|
sub_80143E4(gBlockSendBuffer, TRUE);
|
||||||
HealPlayerParty();
|
HealPlayerParty();
|
||||||
SavePlayerParty();
|
SavePlayerParty();
|
||||||
|
@ -1711,7 +1711,7 @@ void sub_801440C(u8 taskId)
|
||||||
SetMainCallback2(sub_8014384);
|
SetMainCallback2(sub_8014384);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
HealPlayerParty();
|
HealPlayerParty();
|
||||||
SavePlayerParty();
|
SavePlayerParty();
|
||||||
LoadPlayerBag();
|
LoadPlayerBag();
|
||||||
|
@ -1720,7 +1720,7 @@ void sub_801440C(u8 taskId)
|
||||||
SetMainCallback2(sub_8014384);
|
SetMainCallback2(sub_8014384);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
HealPlayerParty();
|
HealPlayerParty();
|
||||||
SavePlayerParty();
|
SavePlayerParty();
|
||||||
LoadPlayerBag();
|
LoadPlayerBag();
|
||||||
|
@ -1730,18 +1730,18 @@ void sub_801440C(u8 taskId)
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
sub_80143E4(gBlockSendBuffer, TRUE);
|
sub_80143E4(gBlockSendBuffer, TRUE);
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
sub_8014304(MAP_GROUP(TRADE_CENTER), MAP_NUM(TRADE_CENTER), 5, 8, 3);
|
sub_8014304(MAP_GROUP(TRADE_CENTER), MAP_NUM(TRADE_CENTER), 5, 8, 3);
|
||||||
SetMainCallback2(sub_8014384);
|
SetMainCallback2(sub_8014384);
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
sub_80143E4(gBlockSendBuffer, TRUE);
|
sub_80143E4(gBlockSendBuffer, TRUE);
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
sub_8014304(MAP_GROUP(RECORD_CORNER), MAP_NUM(RECORD_CORNER), 8, 9, 4);
|
sub_8014304(MAP_GROUP(RECORD_CORNER), MAP_NUM(RECORD_CORNER), 8, 9, 4);
|
||||||
SetMainCallback2(sub_8014384);
|
SetMainCallback2(sub_8014384);
|
||||||
break;
|
break;
|
||||||
case 68:
|
case 68:
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
CreateTask(sub_8013F90, 0);
|
CreateTask(sub_8013F90, 0);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
|
|
@ -923,7 +923,7 @@ void sub_8153688(u8 taskId)
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (taskData[2] == 0)
|
if (taskData[2] == 0)
|
||||||
sub_8076D5C();
|
SetContinueGameWarpStatusToDynamicWarp();
|
||||||
sub_8153380();
|
sub_8153380();
|
||||||
taskData[0] = 4;
|
taskData[0] = 4;
|
||||||
break;
|
break;
|
||||||
|
@ -946,7 +946,7 @@ void sub_8153688(u8 taskId)
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (taskData[2] == 0)
|
if (taskData[2] == 0)
|
||||||
sav2_gender2_inplace_and_xFE();
|
ClearContinueGameWarpStatus2();
|
||||||
sub_800ADF8();
|
sub_800ADF8();
|
||||||
taskData[0] = 8;
|
taskData[0] = 8;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,11 +2,6 @@
|
||||||
#include "save_location.h"
|
#include "save_location.h"
|
||||||
#include "constants/maps.h"
|
#include "constants/maps.h"
|
||||||
|
|
||||||
// specialSaveWarp flags
|
|
||||||
#define POKECENTER_SAVEWARP (1 << 1)
|
|
||||||
#define LOBBY_SAVEWARP (1 << 2)
|
|
||||||
#define UNK_SPECIAL_SAVE_WARP_FLAG_3 (1 << 3)
|
|
||||||
|
|
||||||
static bool32 IsCurMapInLocationList(const u16 *list)
|
static bool32 IsCurMapInLocationList(const u16 *list)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
|
@ -94,26 +89,26 @@ static bool32 sub_81AFCEC(void)
|
||||||
static void TrySetPokeCenterWarpStatus(void)
|
static void TrySetPokeCenterWarpStatus(void)
|
||||||
{
|
{
|
||||||
if (IsCurMapPokeCenter() == FALSE)
|
if (IsCurMapPokeCenter() == FALSE)
|
||||||
gSaveBlock2Ptr->specialSaveWarp &= ~(POKECENTER_SAVEWARP);
|
gSaveBlock2Ptr->specialSaveWarpFlags &= ~(POKECENTER_SAVEWARP);
|
||||||
else
|
else
|
||||||
gSaveBlock2Ptr->specialSaveWarp |= POKECENTER_SAVEWARP;
|
gSaveBlock2Ptr->specialSaveWarpFlags |= POKECENTER_SAVEWARP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void TrySetReloadWarpStatus(void)
|
static void TrySetReloadWarpStatus(void)
|
||||||
{
|
{
|
||||||
if (!IsCurMapReloadLocation())
|
if (!IsCurMapReloadLocation())
|
||||||
gSaveBlock2Ptr->specialSaveWarp &= ~(LOBBY_SAVEWARP);
|
gSaveBlock2Ptr->specialSaveWarpFlags &= ~(LOBBY_SAVEWARP);
|
||||||
else
|
else
|
||||||
gSaveBlock2Ptr->specialSaveWarp |= LOBBY_SAVEWARP;
|
gSaveBlock2Ptr->specialSaveWarpFlags |= LOBBY_SAVEWARP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function definitely sets a warp status, but because the list is empty, it's unknown what this does yet.
|
// this function definitely sets a warp status, but because the list is empty, it's unknown what this does yet.
|
||||||
static void sub_81AFD5C(void)
|
static void sub_81AFD5C(void)
|
||||||
{
|
{
|
||||||
if (!sub_81AFCEC())
|
if (!sub_81AFCEC())
|
||||||
gSaveBlock2Ptr->specialSaveWarp &= ~(UNK_SPECIAL_SAVE_WARP_FLAG_3);
|
gSaveBlock2Ptr->specialSaveWarpFlags &= ~(UNK_SPECIAL_SAVE_WARP_FLAG_3);
|
||||||
else
|
else
|
||||||
gSaveBlock2Ptr->specialSaveWarp |= UNK_SPECIAL_SAVE_WARP_FLAG_3;
|
gSaveBlock2Ptr->specialSaveWarpFlags |= UNK_SPECIAL_SAVE_WARP_FLAG_3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrySetMapSaveWarpStatus(void)
|
void TrySetMapSaveWarpStatus(void)
|
||||||
|
@ -136,5 +131,5 @@ void sub_81AFDA0(void)
|
||||||
|
|
||||||
void sub_81AFDD0(void)
|
void sub_81AFDD0(void)
|
||||||
{
|
{
|
||||||
gSaveBlock2Ptr->specialSaveWarp |= 0x80;
|
gSaveBlock2Ptr->specialSaveWarpFlags |= 0x80;
|
||||||
}
|
}
|
||||||
|
|
28
src/scrcmd.c
28
src/scrcmd.c
|
@ -735,7 +735,7 @@ bool8 ScrCmd_setmaplayoutindex(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u16 value = VarGet(ScriptReadHalfword(ctx));
|
u16 value = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
sub_8085524(value);
|
SetCurrentMapLayout(value);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ bool8 ScrCmd_warp(struct ScriptContext *ctx)
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||||
sub_80AF734();
|
sub_80AF734();
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -761,7 +761,7 @@ bool8 ScrCmd_warpsilent(struct ScriptContext *ctx)
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||||
sp13E_warp_to_last_warp();
|
sp13E_warp_to_last_warp();
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -775,7 +775,7 @@ bool8 ScrCmd_warpdoor(struct ScriptContext *ctx)
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||||
sub_80AF7D0();
|
sub_80AF7D0();
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -790,9 +790,9 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx)
|
||||||
|
|
||||||
PlayerGetDestCoords(&x, &y);
|
PlayerGetDestCoords(&x, &y);
|
||||||
if (mapGroup == 0xFF && mapNum == 0xFF)
|
if (mapGroup == 0xFF && mapNum == 0xFF)
|
||||||
SetFixedHoleWarpAsDestination(x - 7, y - 7);
|
SetWarpDestinationToFixedHoleWarp(x - 7, y - 7);
|
||||||
else
|
else
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7);
|
SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7);
|
||||||
sp13F_fall_to_last_warp();
|
sp13F_fall_to_last_warp();
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -806,7 +806,7 @@ bool8 ScrCmd_warpteleport(struct ScriptContext *ctx)
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||||
sub_80AF848();
|
sub_80AF848();
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -820,7 +820,7 @@ bool8 ScrCmd_warpD7(struct ScriptContext *ctx)
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||||
sub_80AF87C();
|
sub_80AF87C();
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -834,7 +834,7 @@ bool8 ScrCmd_setwarp(struct ScriptContext *ctx)
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,7 +846,7 @@ bool8 ScrCmd_setdynamicwarp(struct ScriptContext *ctx)
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
saved_warp2_set_2(0, mapGroup, mapNum, warpId, x, y);
|
SetDynamicWarpWithCoords(0, mapGroup, mapNum, warpId, x, y);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,7 +882,7 @@ bool8 ScrCmd_setescapewarp(struct ScriptContext *ctx)
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
sub_8084DD4(mapGroup, mapNum, warpId, x, y);
|
SetEscapeWarp(mapGroup, mapNum, warpId, x, y);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1998,7 +1998,7 @@ bool8 ScrCmd_setrespawn(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u16 healLocationId = VarGet(ScriptReadHalfword(ctx));
|
u16 healLocationId = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
Overworld_SetHealLocationWarp(healLocationId);
|
SetLastHealLocationWarp(healLocationId);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2235,7 +2235,7 @@ bool8 ScrCmd_warpD1(struct ScriptContext *ctx)
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||||
sub_808D074(GetPlayerFacingDirection());
|
sub_808D074(GetPlayerFacingDirection());
|
||||||
sub_80B0244();
|
sub_80B0244();
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
|
@ -2289,7 +2289,7 @@ bool8 ScrCmd_warpE0(struct ScriptContext *ctx)
|
||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
Overworld_SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||||
sub_80AF79C();
|
sub_80AF79C();
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -366,7 +366,7 @@ void sub_80E8F9C(void)
|
||||||
s8 idx;
|
s8 idx;
|
||||||
|
|
||||||
idx = sCurSecretBaseId / 10 * 4;
|
idx = sCurSecretBaseId / 10 * 4;
|
||||||
warp1_set_2(MAP_GROUP(SECRET_BASE_RED_CAVE1), gUnknown_0858CFE8[idx], gUnknown_0858CFE8[idx + 1]);
|
SetWarpDestinationToMapWarp(MAP_GROUP(SECRET_BASE_RED_CAVE1), gUnknown_0858CFE8[idx], gUnknown_0858CFE8[idx + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80E8FD0(u8 taskId)
|
void sub_80E8FD0(u8 taskId)
|
||||||
|
@ -400,7 +400,7 @@ void sub_80E9068(void)
|
||||||
{
|
{
|
||||||
CreateTask(sub_80E8FD0, 0);
|
CreateTask(sub_80E8FD0, 0);
|
||||||
FadeScreen(1, 0);
|
FadeScreen(1, 0);
|
||||||
saved_warp2_set(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80E909C(void)
|
bool8 sub_80E909C(void)
|
||||||
|
@ -445,7 +445,7 @@ void sub_80E916C(u8 taskId)
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
idx = sCurSecretBaseId / 10 * 4;
|
idx = sCurSecretBaseId / 10 * 4;
|
||||||
Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gUnknown_0858CFE8[idx + 2], gUnknown_0858CFE8[idx + 3]);
|
SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gUnknown_0858CFE8[idx + 2], gUnknown_0858CFE8[idx + 3]);
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
gFieldCallback = sub_80E9108;
|
gFieldCallback = sub_80E9108;
|
||||||
SetMainCallback2(CB2_LoadMap);
|
SetMainCallback2(CB2_LoadMap);
|
||||||
|
@ -643,7 +643,7 @@ void sub_80E96A4(u8 taskId)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
copy_saved_warp2_bank_and_enter_x_to_warp1(0x7e);
|
SetWarpDestinationToDynamicWarp(0x7e);
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
gFieldCallback = mapldr_default;
|
gFieldCallback = mapldr_default;
|
||||||
SetMainCallback2(CB2_LoadMap);
|
SetMainCallback2(CB2_LoadMap);
|
||||||
|
|
|
@ -623,7 +623,7 @@ static bool8 StartMenuPokedexCallback(void)
|
||||||
IncrementGameStat(GAME_STAT_CHECKED_POKEDEX);
|
IncrementGameStat(GAME_STAT_CHECKED_POKEDEX);
|
||||||
PlayRainSoundEffect();
|
PlayRainSoundEffect();
|
||||||
RemoveExtraStartMenuWindows();
|
RemoveExtraStartMenuWindows();
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
SetMainCallback2(CB2_Pokedex);
|
SetMainCallback2(CB2_Pokedex);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -638,7 +638,7 @@ static bool8 StartMenuPokemonCallback(void)
|
||||||
{
|
{
|
||||||
PlayRainSoundEffect();
|
PlayRainSoundEffect();
|
||||||
RemoveExtraStartMenuWindows();
|
RemoveExtraStartMenuWindows();
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
SetMainCallback2(CB2_PartyMenuFromStartMenu); // Display party menu
|
SetMainCallback2(CB2_PartyMenuFromStartMenu); // Display party menu
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -653,7 +653,7 @@ static bool8 StartMenuBagCallback(void)
|
||||||
{
|
{
|
||||||
PlayRainSoundEffect();
|
PlayRainSoundEffect();
|
||||||
RemoveExtraStartMenuWindows();
|
RemoveExtraStartMenuWindows();
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
SetMainCallback2(CB2_BagMenuFromStartMenu); // Display bag menu
|
SetMainCallback2(CB2_BagMenuFromStartMenu); // Display bag menu
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -668,7 +668,7 @@ static bool8 StartMenuPokeNavCallback(void)
|
||||||
{
|
{
|
||||||
PlayRainSoundEffect();
|
PlayRainSoundEffect();
|
||||||
RemoveExtraStartMenuWindows();
|
RemoveExtraStartMenuWindows();
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
SetMainCallback2(CB2_PokeNav); // Display PokeNav
|
SetMainCallback2(CB2_PokeNav); // Display PokeNav
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -683,7 +683,7 @@ static bool8 StartMenuPlayerNameCallback(void)
|
||||||
{
|
{
|
||||||
PlayRainSoundEffect();
|
PlayRainSoundEffect();
|
||||||
RemoveExtraStartMenuWindows();
|
RemoveExtraStartMenuWindows();
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
|
|
||||||
if (is_c1_link_related_active() || InUnionRoom())
|
if (is_c1_link_related_active() || InUnionRoom())
|
||||||
{
|
{
|
||||||
|
@ -722,7 +722,7 @@ static bool8 StartMenuOptionCallback(void)
|
||||||
{
|
{
|
||||||
PlayRainSoundEffect();
|
PlayRainSoundEffect();
|
||||||
RemoveExtraStartMenuWindows();
|
RemoveExtraStartMenuWindows();
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
SetMainCallback2(CB2_InitOptionMenu); // Display option menu
|
SetMainCallback2(CB2_InitOptionMenu); // Display option menu
|
||||||
gMain.savedCallback = CB2_ReturnToFieldWithOpenMenu;
|
gMain.savedCallback = CB2_ReturnToFieldWithOpenMenu;
|
||||||
|
|
||||||
|
@ -754,7 +754,7 @@ static bool8 StartMenuLinkModePlayerNameCallback(void)
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
PlayRainSoundEffect();
|
PlayRainSoundEffect();
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
TrainerCard_ShowLinkCard(gUnknown_03005DB4, CB2_ReturnToFieldWithOpenMenu);
|
TrainerCard_ShowLinkCard(gUnknown_03005DB4, CB2_ReturnToFieldWithOpenMenu);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -784,7 +784,7 @@ static bool8 StartMenuBattlePyramidBagCallback(void)
|
||||||
{
|
{
|
||||||
PlayRainSoundEffect();
|
PlayRainSoundEffect();
|
||||||
RemoveExtraStartMenuWindows();
|
RemoveExtraStartMenuWindows();
|
||||||
overworld_free_bg_tilemaps();
|
CleanupOverworldWindowsAndTilemaps();
|
||||||
SetMainCallback2(CB2_PyramidBagMenuFromStartMenu);
|
SetMainCallback2(CB2_PyramidBagMenuFromStartMenu);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1285,14 +1285,14 @@ static void sub_80A0550(u8 taskId)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sub_8076D5C();
|
SetContinueGameWarpStatusToDynamicWarp();
|
||||||
sub_8153430();
|
sub_8153430();
|
||||||
*step = 2;
|
*step = 2;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (sub_8153474())
|
if (sub_8153474())
|
||||||
{
|
{
|
||||||
sav2_gender2_inplace_and_xFE();
|
ClearContinueGameWarpStatus2();
|
||||||
*step = 3;
|
*step = 3;
|
||||||
gSoftResetDisabled = 0;
|
gSoftResetDisabled = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue