through SetContinueGameWarpToDynamicWarp

This commit is contained in:
PikalaxALT
2020-03-27 17:21:00 -04:00
parent 71c003dcdb
commit a03906a1a3
14 changed files with 201 additions and 722 deletions
+7 -645
View File
@@ -5,644 +5,6 @@
.text
thumb_func_start update_camera_pos_from_warpid
update_camera_pos_from_warpid: @ 80552FC
push {r4,r5,lr}
ldr r0, _0805532C @ =gSaveBlock1Ptr
ldr r2, [r0]
movs r1, 0x6
ldrsb r1, [r2, r1]
adds r4, r0, 0
cmp r1, 0
blt _08055334
ldr r3, _08055330 @ =gMapHeader
ldr r0, [r3, 0x4]
ldrb r5, [r0, 0x1]
cmp r1, r5
bge _08055334
ldr r0, [r0, 0x8]
lsls r1, 3
adds r0, r1, r0
ldrh r0, [r0]
strh r0, [r2]
ldr r0, [r3, 0x4]
ldr r0, [r0, 0x8]
adds r1, r0
ldrh r0, [r1, 0x2]
strh r0, [r2, 0x2]
b _0805536C
.align 2, 0
_0805532C: .4byte gSaveBlock1Ptr
_08055330: .4byte gMapHeader
_08055334:
ldr r1, [r4]
ldrh r3, [r1, 0x8]
movs r2, 0x8
ldrsh r0, [r1, r2]
cmp r0, 0
blt _08055350
ldrh r2, [r1, 0xA]
movs r5, 0xA
ldrsh r0, [r1, r5]
cmp r0, 0
blt _08055350
strh r3, [r1]
strh r2, [r1, 0x2]
b _0805536C
_08055350:
ldr r3, [r4]
ldr r2, _08055374 @ =gMapHeader
ldr r0, [r2]
ldr r0, [r0]
lsrs r1, r0, 31
adds r0, r1
asrs r0, 1
strh r0, [r3]
ldr r0, [r2]
ldr r0, [r0, 0x4]
lsrs r1, r0, 31
adds r0, r1
asrs r0, 1
strh r0, [r3, 0x2]
_0805536C:
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_08055374: .4byte gMapHeader
thumb_func_end update_camera_pos_from_warpid
thumb_func_start WarpIntoMap
WarpIntoMap: @ 8055378
push {lr}
bl ApplyCurrentWarp
bl LoadCurrentMapData
bl update_camera_pos_from_warpid
pop {r0}
bx r0
thumb_func_end WarpIntoMap
thumb_func_start SetWarpDestination
SetWarpDestination: @ 805538C
push {r4-r6,lr}
sub sp, 0x8
adds r4, r0, 0
adds r5, r1, 0
adds r6, r2, 0
ldr r1, [sp, 0x18]
ldr r0, _080553C4 @ =sWarpDestination
lsls r4, 24
asrs r4, 24
lsls r5, 24
asrs r5, 24
lsls r6, 24
asrs r6, 24
lsls r3, 24
asrs r3, 24
str r3, [sp]
lsls r1, 24
asrs r1, 24
str r1, [sp, 0x4]
adds r1, r4, 0
adds r2, r5, 0
adds r3, r6, 0
bl SetWarpData
add sp, 0x8
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_080553C4: .4byte sWarpDestination
thumb_func_end SetWarpDestination
thumb_func_start SetWarpDestinationToMapWarp
SetWarpDestinationToMapWarp: @ 80553C8
push {lr}
sub sp, 0x4
lsls r0, 24
asrs r0, 24
lsls r1, 24
asrs r1, 24
lsls r2, 24
asrs r2, 24
movs r3, 0x1
negs r3, r3
str r3, [sp]
bl SetWarpDestination
add sp, 0x4
pop {r0}
bx r0
thumb_func_end SetWarpDestinationToMapWarp
thumb_func_start SetDynamicWarp
SetDynamicWarp: @ 80553E8
push {r4,r5,lr}
sub sp, 0x8
ldr r0, _08055418 @ =gSaveBlock1Ptr
ldr r5, [r0]
adds r0, r5, 0
adds r0, 0x14
lsls r1, 24
asrs r1, 24
lsls r2, 24
asrs r2, 24
lsls r3, 24
asrs r3, 24
movs r4, 0
ldrsb r4, [r5, r4]
str r4, [sp]
movs r4, 0x2
ldrsb r4, [r5, r4]
str r4, [sp, 0x4]
bl SetWarpData
add sp, 0x8
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_08055418: .4byte gSaveBlock1Ptr
thumb_func_end SetDynamicWarp
thumb_func_start SetDynamicWarpWithCoords
SetDynamicWarpWithCoords: @ 805541C
push {r4,r5,lr}
sub sp, 0x8
ldr r4, [sp, 0x14]
ldr r5, [sp, 0x18]
ldr r0, _08055450 @ =gSaveBlock1Ptr
ldr r0, [r0]
adds r0, 0x14
lsls r1, 24
asrs r1, 24
lsls r2, 24
asrs r2, 24
lsls r3, 24
asrs r3, 24
lsls r4, 24
asrs r4, 24
str r4, [sp]
lsls r5, 24
asrs r5, 24
str r5, [sp, 0x4]
bl SetWarpData
add sp, 0x8
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_08055450: .4byte gSaveBlock1Ptr
thumb_func_end SetDynamicWarpWithCoords
thumb_func_start SetWarpDestinationToDynamicWarp
SetWarpDestinationToDynamicWarp: @ 8055454
ldr r2, _08055464 @ =sWarpDestination
ldr r0, _08055468 @ =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, [r0, 0x18]
ldr r0, [r0, 0x14]
str r0, [r2]
str r1, [r2, 0x4]
bx lr
.align 2, 0
_08055464: .4byte sWarpDestination
_08055468: .4byte gSaveBlock1Ptr
thumb_func_end SetWarpDestinationToDynamicWarp
thumb_func_start sub_805546C
sub_805546C: @ 805546C
push {r4,lr}
sub sp, 0x4
lsls r0, 24
lsrs r0, 24
bl GetHealLocationPointer
adds r4, r0, 0
cmp r4, 0
beq _0805549A
movs r0, 0
ldrsb r0, [r4, r0]
movs r1, 0x1
ldrsb r1, [r4, r1]
movs r2, 0x1
negs r2, r2
movs r3, 0x2
ldrsb r3, [r4, r3]
ldrb r4, [r4, 0x4]
lsls r4, 24
asrs r4, 24
str r4, [sp]
bl SetWarpDestination
_0805549A:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_805546C
thumb_func_start copy_saved_warp3_bank_and_enter_x_to_warp1
copy_saved_warp3_bank_and_enter_x_to_warp1: @ 80554A4
ldr r2, _080554B4 @ =sWarpDestination
ldr r0, _080554B8 @ =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, [r0, 0x20]
ldr r0, [r0, 0x1C]
str r0, [r2]
str r1, [r2, 0x4]
bx lr
.align 2, 0
_080554B4: .4byte sWarpDestination
_080554B8: .4byte gSaveBlock1Ptr
thumb_func_end copy_saved_warp3_bank_and_enter_x_to_warp1
thumb_func_start Overworld_SetWhiteoutRespawnPoint
Overworld_SetWhiteoutRespawnPoint: @ 80554BC
push {lr}
ldr r0, _080554C8 @ =sWarpDestination
bl SetWhiteoutRespawnWarpAndHealerNpc
pop {r0}
bx r0
.align 2, 0
_080554C8: .4byte sWarpDestination
thumb_func_end Overworld_SetWhiteoutRespawnPoint
thumb_func_start SetLastHealLocationWarp
SetLastHealLocationWarp: @ 80554CC
push {r4,r5,lr}
sub sp, 0x8
lsls r0, 24
lsrs r0, 24
bl GetHealLocationPointer
adds r5, r0, 0
cmp r5, 0
beq _08055500
ldr r0, _08055508 @ =gSaveBlock1Ptr
ldr r0, [r0]
adds r0, 0x1C
movs r1, 0
ldrsb r1, [r5, r1]
movs r2, 0x1
ldrsb r2, [r5, r2]
movs r3, 0x1
negs r3, r3
movs r4, 0x2
ldrsb r4, [r5, r4]
str r4, [sp]
movs r4, 0x4
ldrsb r4, [r5, r4]
str r4, [sp, 0x4]
bl SetWarpData
_08055500:
add sp, 0x8
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_08055508: .4byte gSaveBlock1Ptr
thumb_func_end SetLastHealLocationWarp
thumb_func_start UpdateEscapeWarp
UpdateEscapeWarp: @ 805550C
push {r4-r7,lr}
sub sp, 0x4
lsls r0, 16
lsrs r6, r0, 16
lsls r1, 16
lsrs r7, r1, 16
bl GetCurrentMapType
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r1, _08055598 @ =sWarpDestination
movs r0, 0
ldrsb r0, [r1, r0]
ldrb r1, [r1, 0x1]
lsls r1, 24
asrs r1, 24
bl get_map_light_level_by_bank_and_number
lsls r0, 24
lsrs r5, r0, 24
adds r0, r4, 0
bl IsMapTypeOutdoors
lsls r0, 24
cmp r0, 0
beq _08055590
adds r0, r5, 0
bl IsMapTypeOutdoors
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _08055590
ldr r5, _0805559C @ =gSaveBlock1Ptr
ldr r0, [r5]
ldrh r0, [r0, 0x4]
cmp r0, 0x1
beq _08055590
bl GetPlayerFacingDirection
lsls r0, 24
lsrs r0, 24
movs r1, 0x1
eors r0, r1
negs r4, r0
orrs r4, r0
ldr r1, [r5]
movs r0, 0x4
ldrsb r0, [r1, r0]
ldrb r1, [r1, 0x5]
lsls r1, 24
asrs r1, 24
movs r2, 0x1
negs r2, r2
subs r3, r6, 0x7
lsls r3, 24
asrs r3, 24
lsrs r4, 31
subs r4, 0x7
adds r4, r7, r4
lsls r4, 24
asrs r4, 24
str r4, [sp]
bl SetEscapeWarp
_08055590:
add sp, 0x4
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08055598: .4byte sWarpDestination
_0805559C: .4byte gSaveBlock1Ptr
thumb_func_end UpdateEscapeWarp
thumb_func_start SetEscapeWarp
SetEscapeWarp: @ 80555A0
push {r4-r6,lr}
sub sp, 0x8
adds r4, r0, 0
adds r5, r1, 0
adds r6, r2, 0
ldr r1, [sp, 0x18]
ldr r0, _080555DC @ =gSaveBlock1Ptr
ldr r0, [r0]
adds r0, 0x24
lsls r4, 24
asrs r4, 24
lsls r5, 24
asrs r5, 24
lsls r6, 24
asrs r6, 24
lsls r3, 24
asrs r3, 24
str r3, [sp]
lsls r1, 24
asrs r1, 24
str r1, [sp, 0x4]
adds r1, r4, 0
adds r2, r5, 0
adds r3, r6, 0
bl SetWarpData
add sp, 0x8
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_080555DC: .4byte gSaveBlock1Ptr
thumb_func_end SetEscapeWarp
thumb_func_start sub_80555E0
sub_80555E0: @ 80555E0
ldr r2, _080555F0 @ =sWarpDestination
ldr r0, _080555F4 @ =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, [r0, 0x28]
ldr r0, [r0, 0x24]
str r0, [r2]
str r1, [r2, 0x4]
bx lr
.align 2, 0
_080555F0: .4byte sWarpDestination
_080555F4: .4byte gSaveBlock1Ptr
thumb_func_end sub_80555E0
thumb_func_start SetFixedDiveWarp
SetFixedDiveWarp: @ 80555F8
push {r4-r6,lr}
sub sp, 0x8
adds r4, r0, 0
adds r5, r1, 0
adds r6, r2, 0
ldr r1, [sp, 0x18]
ldr r0, _08055630 @ =gFixedDiveWarp
lsls r4, 24
asrs r4, 24
lsls r5, 24
asrs r5, 24
lsls r6, 24
asrs r6, 24
lsls r3, 24
asrs r3, 24
str r3, [sp]
lsls r1, 24
asrs r1, 24
str r1, [sp, 0x4]
adds r1, r4, 0
adds r2, r5, 0
adds r3, r6, 0
bl SetWarpData
add sp, 0x8
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08055630: .4byte gFixedDiveWarp
thumb_func_end SetFixedDiveWarp
thumb_func_start warp1_set_to_warp2
warp1_set_to_warp2: @ 8055634
ldr r2, _08055644 @ =sWarpDestination
ldr r0, _08055648 @ =gFixedDiveWarp
ldr r1, [r0, 0x4]
ldr r0, [r0]
str r0, [r2]
str r1, [r2, 0x4]
bx lr
.align 2, 0
_08055644: .4byte sWarpDestination
_08055648: .4byte gFixedDiveWarp
thumb_func_end warp1_set_to_warp2
thumb_func_start SetFixedHoleWarp
SetFixedHoleWarp: @ 805564C
push {r4-r6,lr}
sub sp, 0x8
adds r4, r0, 0
adds r5, r1, 0
adds r6, r2, 0
ldr r1, [sp, 0x18]
ldr r0, _08055684 @ =gFixedHoleWarp
lsls r4, 24
asrs r4, 24
lsls r5, 24
asrs r5, 24
lsls r6, 24
asrs r6, 24
lsls r3, 24
asrs r3, 24
str r3, [sp]
lsls r1, 24
asrs r1, 24
str r1, [sp, 0x4]
adds r1, r4, 0
adds r2, r5, 0
adds r3, r6, 0
bl SetWarpData
add sp, 0x8
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08055684: .4byte gFixedHoleWarp
thumb_func_end SetFixedHoleWarp
thumb_func_start SetWarpDestinationToFixedHoleWarp
SetWarpDestinationToFixedHoleWarp: @ 8055688
push {r4-r6,lr}
sub sp, 0x4
lsls r0, 16
lsrs r5, r0, 16
lsls r1, 16
lsrs r6, r1, 16
ldr r4, _080556B0 @ =gFixedHoleWarp
adds r0, r4, 0
bl IsDummyWarp
cmp r0, 0x1
bne _080556BC
ldr r2, _080556B4 @ =sWarpDestination
ldr r0, _080556B8 @ =gLastUsedWarp
ldr r1, [r0, 0x4]
ldr r0, [r0]
str r0, [r2]
str r1, [r2, 0x4]
b _080556D6
.align 2, 0
_080556B0: .4byte gFixedHoleWarp
_080556B4: .4byte sWarpDestination
_080556B8: .4byte gLastUsedWarp
_080556BC:
movs r0, 0
ldrsb r0, [r4, r0]
movs r1, 0x1
ldrsb r1, [r4, r1]
movs r2, 0x1
negs r2, r2
lsls r3, r5, 24
asrs r3, 24
lsls r4, r6, 24
asrs r4, 24
str r4, [sp]
bl SetWarpDestination
_080556D6:
add sp, 0x4
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end SetWarpDestinationToFixedHoleWarp
thumb_func_start warp1_set_to_sav1w
warp1_set_to_sav1w: @ 80556E0
ldr r2, _080556F0 @ =sWarpDestination
ldr r0, _080556F4 @ =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, [r0, 0x10]
ldr r0, [r0, 0xC]
str r0, [r2]
str r1, [r2, 0x4]
bx lr
.align 2, 0
_080556F0: .4byte sWarpDestination
_080556F4: .4byte gSaveBlock1Ptr
thumb_func_end warp1_set_to_sav1w
thumb_func_start sub_80556F8
sub_80556F8: @ 80556F8
push {r4-r6,lr}
sub sp, 0x8
adds r4, r0, 0
adds r5, r1, 0
adds r6, r2, 0
ldr r1, [sp, 0x18]
ldr r0, _08055734 @ =gSaveBlock1Ptr
ldr r0, [r0]
adds r0, 0xC
lsls r4, 24
asrs r4, 24
lsls r5, 24
asrs r5, 24
lsls r6, 24
asrs r6, 24
lsls r3, 24
asrs r3, 24
str r3, [sp]
lsls r1, 24
asrs r1, 24
str r1, [sp, 0x4]
adds r1, r4, 0
adds r2, r5, 0
adds r3, r6, 0
bl SetWarpData
add sp, 0x8
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08055734: .4byte gSaveBlock1Ptr
thumb_func_end sub_80556F8
thumb_func_start sub_8055738
sub_8055738: @ 8055738
push {r4,r5,lr}
sub sp, 0x8
lsls r0, 24
lsrs r0, 24
bl GetHealLocationPointer
adds r5, r0, 0
cmp r5, 0
beq _0805576C
ldr r0, _08055774 @ =gSaveBlock1Ptr
ldr r0, [r0]
adds r0, 0xC
movs r1, 0
ldrsb r1, [r5, r1]
movs r2, 0x1
ldrsb r2, [r5, r2]
movs r3, 0x1
negs r3, r3
movs r4, 0x2
ldrsb r4, [r5, r4]
str r4, [sp]
movs r4, 0x4
ldrsb r4, [r5, r4]
str r4, [sp, 0x4]
bl SetWarpData
_0805576C:
add sp, 0x8
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_08055774: .4byte gSaveBlock1Ptr
thumb_func_end sub_8055738
thumb_func_start sub_8055778
sub_8055778: @ 8055778
ldr r0, _08055788 @ =gSaveBlock1Ptr
ldr r2, [r0]
ldr r0, [r2, 0x14]
ldr r1, [r2, 0x18]
str r0, [r2, 0xC]
str r1, [r2, 0x10]
bx lr
.align 2, 0
_08055788: .4byte gSaveBlock1Ptr
thumb_func_end sub_8055778
thumb_func_start GetMapConnection
GetMapConnection: @ 805578C
push {r4,lr}
@@ -719,7 +81,7 @@ _080557FC:
.align 2, 0
_08055810: .4byte gFixedDiveWarp
_08055814:
bl warp1_set_to_warp2
bl SetWarpDestinationToDiveWarp
_08055818:
movs r0, 0x1
_0805581A:
@@ -1933,8 +1295,8 @@ _08056152:
bx r1
thumb_func_end sub_8056124
thumb_func_start get_map_light_level_by_bank_and_number
get_map_light_level_by_bank_and_number: @ 8056158
thumb_func_start GetMapTypeByGroupAndId
GetMapTypeByGroupAndId: @ 8056158
push {lr}
lsls r0, 24
asrs r0, 8
@@ -1946,7 +1308,7 @@ get_map_light_level_by_bank_and_number: @ 8056158
ldrb r0, [r0, 0x17]
pop {r1}
bx r1
thumb_func_end get_map_light_level_by_bank_and_number
thumb_func_end GetMapTypeByGroupAndId
thumb_func_start get_map_light_level_from_warp
get_map_light_level_from_warp: @ 8056170
@@ -1956,7 +1318,7 @@ get_map_light_level_from_warp: @ 8056170
movs r1, 0x1
ldrsb r1, [r0, r1]
adds r0, r2, 0
bl get_map_light_level_by_bank_and_number
bl GetMapTypeByGroupAndId
lsls r0, 24
lsrs r0, 24
pop {r1}
@@ -2936,7 +2298,7 @@ CB2_ContinueSavedGame: @ 8056938
cmp r0, 0x1
bne _0805699C
bl sav2_x9_clear_bit1
bl warp1_set_to_sav1w
bl SetWarpDestinationToContinueGameWarp
bl WarpIntoMap
ldr r0, _08056998 @ =CB2_LoadMap
bl SetMainCallback2
@@ -4217,7 +3579,7 @@ sub_8057430: @ 8057430
cmp r0, 0x1
bne _08057490
bl sav2_x9_clear_bit1
bl warp1_set_to_sav1w
bl SetWarpDestinationToContinueGameWarp
bl WarpIntoMap
ldr r0, _0805748C @ =CB2_LoadMap
bl SetMainCallback2
+2 -2
View File
@@ -639,8 +639,8 @@ struct SaveBlock1 /* 0x02025734 */
{
/*0x00*/ struct Coords16 pos;
/*0x04*/ struct WarpData location;
/*0x0C*/ struct WarpData warp1;
/*0x14*/ struct WarpData warp2;
/*0x0C*/ struct WarpData continueGameWarp;
/*0x14*/ struct WarpData dynamicWarp;
/*0x1C*/ struct WarpData lastHealLocation;
/*0x24*/ struct WarpData warp4;
/*0x2C*/ u16 savedMusic;
+2 -2
View File
@@ -743,8 +743,8 @@ struct SaveBlock1
{
/*0x0000*/ struct Coords16 pos;
/*0x0004*/ struct WarpData location;
/*0x000C*/ struct WarpData warp1;
/*0x0014*/ struct WarpData warp2;
/*0x000C*/ struct WarpData continueGameWarp;
/*0x0014*/ struct WarpData dynamicWarp;
/*0x001C*/ struct WarpData lastHealLocation;
/*0x0024*/ struct WarpData escapeWarp;
/*0x002C*/ u16 savedMusic;
+1 -1
View File
@@ -11,7 +11,7 @@ struct HealLocation
s16 y;
};
const struct HealLocation *GetHealLocationPointer(u32 loc);
const struct HealLocation *GetHealLocation(u32 loc);
void SetWhiteoutRespawnWarpAndHealerNpc(struct WarpData * warp);
#endif // GUARD_HEAL_LOCATION_H
+6 -6
View File
@@ -82,8 +82,8 @@ void sub_8084DD4(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void sub_8084E2C(s8, s8, s8, s8, s8);
void sub_8084E80(s8, s8, s8, s8, s8);
void sub_8084EBC(s16, s16);
void sub_80555E0(void);
void copy_saved_warp3_bank_and_enter_x_to_warp1(void);
void SetWarpDestinationToEscapeWarp(void);
void SetWarpDestinationToLastHealLocation(void);
u8 IsMapTypeOutdoors(u8 mapType);
void Overworld_ClearSavedMusic(void);
bool32 sub_8056124(u16 song);
@@ -107,7 +107,7 @@ void CB2_ReturnToField(void);
bool32 sub_8087598(void);
void CB2_ReturnToFieldContinueScriptPlayMapMusic(void);
void WarpIntoMap(void);
u8 get_map_light_level_by_bank_and_number(s8 mapGroup, s8 mapNum);
u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum);
void sub_8086194(void);
void sub_8084CCC(u8 spawn);
void SetWarpDestinationToMapWarp(s8 mapGroup, s8 mapNum, s8 warpNum);
@@ -173,12 +173,12 @@ void CB2_ReturnToFieldWithOpenMenu(void);
void CB2_WhiteOut(void);
void c2_8056854(void);
void ApplyNewEncryptionKeyToGameStats(u32 newKey);
void sub_8055778(int);
void SetContinueGameWarpToDynamicWarp(int);
void sub_8055738(u8 loc);
void SetContinueGameWarpToHealLocation(u8 loc);
void sub_8056078(void *, void *);
void sub_805546C(u8 a0);
void SetWarpDestinationToHealLocation(u8 a0);
bool32 sub_80582E0(void);
bool32 sub_8058274(void);
u8 GetCurrentMapBattleScene(void);
+2 -2
View File
@@ -2064,7 +2064,7 @@ static void EscapeRopeFieldEffect_Step1(struct Task * task)
if (data[4] == 1 && !gPaletteFade.active && BGMusicStopped() == TRUE)
{
SetObjectEventDirection(playerObj, task->data[15]);
sub_80555E0();
SetWarpDestinationToEscapeWarp();
WarpIntoMap();
gFieldCallback = FieldCallback_EscapeRopeExit;
SetMainCallback2(CB2_LoadMap);
@@ -2331,7 +2331,7 @@ static void TeleportFieldEffectTask4(struct Task * task)
{
if (BGMusicStopped() == TRUE)
{
copy_saved_warp3_bank_and_enter_x_to_warp1();
SetWarpDestinationToLastHealLocation();
WarpIntoMap();
SetMainCallback2(CB2_LoadMap);
gFieldCallback = FieldCallback_TeleportIn;
+1 -1
View File
@@ -399,7 +399,7 @@ static void sub_807F45C(u8 taskId)
FillWindowPixelBuffer(windowId, PIXEL_FILL(0));
PutWindowTilemap(windowId);
CopyWindowToVram(windowId, 3);
loc = GetHealLocationPointer(1);
loc = GetHealLocation(1);
if (gSaveBlock1Ptr->lastHealLocation.mapGroup == loc->group
&& gSaveBlock1Ptr->lastHealLocation.mapNum == loc->map
&& gSaveBlock1Ptr->lastHealLocation.warpId == -1
+12 -12
View File
@@ -840,9 +840,9 @@ static const u8 sElevatorWindowAnimDuration[] = {
void GetElevatorFloor(void)
{
u16 floor = 4;
if (gSaveBlock1Ptr->warp2.mapGroup == MAP_GROUP(ROCKET_HIDEOUT_B1F))
if (gSaveBlock1Ptr->dynamicWarp.mapGroup == MAP_GROUP(ROCKET_HIDEOUT_B1F))
{
switch (gSaveBlock1Ptr->warp2.mapNum)
switch (gSaveBlock1Ptr->dynamicWarp.mapNum)
{
case MAP_NUM(SILPH_CO_1F):
floor = 4;
@@ -888,9 +888,9 @@ void GetElevatorFloor(void)
break;
}
}
if (gSaveBlock1Ptr->warp2.mapGroup == MAP_GROUP(CELADON_CITY_DEPARTMENT_STORE_1F))
if (gSaveBlock1Ptr->dynamicWarp.mapGroup == MAP_GROUP(CELADON_CITY_DEPARTMENT_STORE_1F))
{
switch (gSaveBlock1Ptr->warp2.mapNum)
switch (gSaveBlock1Ptr->dynamicWarp.mapNum)
{
case MAP_NUM(CELADON_CITY_DEPARTMENT_STORE_1F):
floor = 4;
@@ -909,9 +909,9 @@ void GetElevatorFloor(void)
break;
}
}
if (gSaveBlock1Ptr->warp2.mapGroup == MAP_GROUP(TRAINER_TOWER_1F))
if (gSaveBlock1Ptr->dynamicWarp.mapGroup == MAP_GROUP(TRAINER_TOWER_1F))
{
switch (gSaveBlock1Ptr->warp2.mapNum)
switch (gSaveBlock1Ptr->dynamicWarp.mapNum)
{
case MAP_NUM(TRAINER_TOWER_1F):
case MAP_NUM(TRAINER_TOWER_2F):
@@ -937,9 +937,9 @@ u16 InitElevatorFloorSelectMenuPos(void)
sElevatorScroll = 0;
sElevatorCursorPos = 0;
if (gSaveBlock1Ptr->warp2.mapGroup == MAP_GROUP(ROCKET_HIDEOUT_B1F))
if (gSaveBlock1Ptr->dynamicWarp.mapGroup == MAP_GROUP(ROCKET_HIDEOUT_B1F))
{
switch (gSaveBlock1Ptr->warp2.mapNum)
switch (gSaveBlock1Ptr->dynamicWarp.mapNum)
{
case MAP_NUM(SILPH_CO_11F):
sElevatorScroll = 0;
@@ -999,9 +999,9 @@ u16 InitElevatorFloorSelectMenuPos(void)
break;
}
}
if (gSaveBlock1Ptr->warp2.mapGroup == MAP_GROUP(CELADON_CITY_DEPARTMENT_STORE_1F))
if (gSaveBlock1Ptr->dynamicWarp.mapGroup == MAP_GROUP(CELADON_CITY_DEPARTMENT_STORE_1F))
{
switch (gSaveBlock1Ptr->warp2.mapNum)
switch (gSaveBlock1Ptr->dynamicWarp.mapNum)
{
case MAP_NUM(CELADON_CITY_DEPARTMENT_STORE_5F):
sElevatorScroll = 0;
@@ -1025,9 +1025,9 @@ u16 InitElevatorFloorSelectMenuPos(void)
break;
}
}
if (gSaveBlock1Ptr->warp2.mapGroup == MAP_GROUP(TRAINER_TOWER_1F))
if (gSaveBlock1Ptr->dynamicWarp.mapGroup == MAP_GROUP(TRAINER_TOWER_1F))
{
switch (gSaveBlock1Ptr->warp2.mapNum)
switch (gSaveBlock1Ptr->dynamicWarp.mapNum)
{
case MAP_NUM(TRAINER_TOWER_1F):
case MAP_NUM(TRAINER_TOWER_2F):
+1 -1
View File
@@ -50,7 +50,7 @@ static const struct HealLocation * GetHealLocationPointerFromMapGroupAndNum(u16
return &sSpawnPoints[i - 1];
}
const struct HealLocation * GetHealLocationPointer(u32 idx)
const struct HealLocation * GetHealLocation(u32 idx)
{
if (idx == 0)
return NULL;
+1 -1
View File
@@ -144,7 +144,7 @@ void sub_804C1AC(void)
void SetContinueGameWarpStatusToDynamicWarp(void)
{
sub_8055778(0);
SetContinueGameWarpToDynamicWarp(0);
gSaveBlock2Ptr->specialSaveWarpFlags |= CONTINUE_GAME_WARP;
}
+157
View File
@@ -3,8 +3,10 @@
#include "event_data.h"
#include "event_scripts.h"
#include "field_camera.h"
#include "field_player_avatar.h"
#include "field_specials.h"
#include "fieldmap.h"
#include "heal_location.h"
#include "load_save.h"
#include "money.h"
#include "overworld.h"
@@ -14,6 +16,7 @@
#include "tileset_anims.h"
#include "constants/maps.h"
#include "constants/flags.h"
#include "constants/species.h"
struct InitialPlayerAvatarState
{
@@ -27,6 +30,18 @@ EWRAM_DATA struct WarpData sWarpDestination = {};
EWRAM_DATA struct WarpData gFixedDiveWarp = {};
EWRAM_DATA struct WarpData gFixedHoleWarp = {};
EWRAM_DATA struct InitialPlayerAvatarState gUnknown_2031DD4 = {};
EWRAM_DATA bool8 gDisableMapMusicChangeOnMapLoad = FALSE;
EWRAM_DATA u16 gUnknown_2031DDA = SPECIES_NONE;
EWRAM_DATA bool8 gUnknown_2031DDC = FALSE;
// File boundary perhaps?
ALIGNED(4) EWRAM_DATA bool8 gUnknown_2031DE0 = FALSE;
EWRAM_DATA const struct CreditsOverworldCmd *gUnknown_2031DE4 = NULL;
EWRAM_DATA s16 gUnknown_2031DE8 = 0;
EWRAM_DATA s16 gUnknown_2031DEA = 0;
// File boundary perhaps?
EWRAM_DATA struct LinkPlayerObjectEvent gLinkPlayerObjectEvents[4] = {};
u8 CountBadgesForOverworldWhiteOutLossCalculation(void);
void Overworld_ResetStateAfterWhitingOut(void);
@@ -367,3 +382,145 @@ void LoadSaveblockMapHeader(void)
gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum);
gMapHeader.mapLayout = GetMapLayout();
}
void SetPlayerCoordsFromWarp(void)
{
if (gSaveBlock1Ptr->location.warpId >= 0 && gSaveBlock1Ptr->location.warpId < gMapHeader.events->warpCount)
{
gSaveBlock1Ptr->pos.x = gMapHeader.events->warps[gSaveBlock1Ptr->location.warpId].x;
gSaveBlock1Ptr->pos.y = gMapHeader.events->warps[gSaveBlock1Ptr->location.warpId].y;
}
else if (gSaveBlock1Ptr->location.x >= 0 && gSaveBlock1Ptr->location.y >= 0)
{
gSaveBlock1Ptr->pos.x = gSaveBlock1Ptr->location.x;
gSaveBlock1Ptr->pos.y = gSaveBlock1Ptr->location.y;
}
else
{
gSaveBlock1Ptr->pos.x = gMapHeader.mapLayout->width / 2;
gSaveBlock1Ptr->pos.y = gMapHeader.mapLayout->height / 2;
}
}
void WarpIntoMap(void)
{
ApplyCurrentWarp();
LoadCurrentMapData();
SetPlayerCoordsFromWarp();
}
void SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
SetWarpData(&sWarpDestination, mapGroup, mapNum, warpId, x, y);
}
void SetWarpDestinationToMapWarp(s8 mapGroup, s8 mapNum, s8 warpId)
{
SetWarpDestination(mapGroup, mapNum, warpId, -1, -1);
}
void SetDynamicWarp(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId)
{
SetWarpData(&gSaveBlock1Ptr->dynamicWarp, mapGroup, mapNum, warpId, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y);
}
void SetDynamicWarpWithCoords(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
SetWarpData(&gSaveBlock1Ptr->dynamicWarp, mapGroup, mapNum, warpId, x, y);
}
void SetWarpDestinationToDynamicWarp(u8 unusedWarpId)
{
sWarpDestination = gSaveBlock1Ptr->dynamicWarp;
}
void SetWarpDestinationToHealLocation(u8 healLocationId)
{
const struct HealLocation *warp = GetHealLocation(healLocationId);
if (warp)
SetWarpDestination(warp->group, warp->map, -1, warp->x, warp->y);
}
void SetWarpDestinationToLastHealLocation(void)
{
sWarpDestination = gSaveBlock1Ptr->lastHealLocation;
}
void Overworld_SetWhiteoutRespawnPoint(void)
{
SetWhiteoutRespawnWarpAndHealerNpc(&sWarpDestination);
}
void SetLastHealLocationWarp(u8 healLocationId)
{
const struct HealLocation *healLocation = GetHealLocation(healLocationId);
if (healLocation)
SetWarpData(&gSaveBlock1Ptr->lastHealLocation, healLocation->group, healLocation->map, -1, healLocation->x, healLocation->y);
}
void UpdateEscapeWarp(s16 x, s16 y)
{
u8 currMapType = GetCurrentMapType();
u8 destMapType = GetMapTypeByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum);
u8 delta;
if (IsMapTypeOutdoors(currMapType) && IsMapTypeOutdoors(destMapType) != TRUE && !(gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(VIRIDIAN_FOREST) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(VIRIDIAN_FOREST)))
{
delta = GetPlayerFacingDirection() != DIR_SOUTH;
SetEscapeWarp(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x - 7, y - 7 + delta);
}
}
void SetEscapeWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
SetWarpData(&gSaveBlock1Ptr->escapeWarp, mapGroup, mapNum, warpId, x, y);
}
void SetWarpDestinationToEscapeWarp(void)
{
sWarpDestination = gSaveBlock1Ptr->escapeWarp;
}
void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
SetWarpData(&gFixedDiveWarp, mapGroup, mapNum, warpId, x, y);
}
void SetWarpDestinationToDiveWarp(void)
{
sWarpDestination = gFixedDiveWarp;
}
void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
SetWarpData(&gFixedHoleWarp, mapGroup, mapNum, warpId, x, y);
}
void SetWarpDestinationToFixedHoleWarp(s16 x, s16 y)
{
if (IsDummyWarp(&gFixedHoleWarp) == TRUE)
sWarpDestination = gLastUsedWarp;
else
SetWarpDestination(gFixedHoleWarp.mapGroup, gFixedHoleWarp.mapNum, -1, x, y);
}
void SetWarpDestinationToContinueGameWarp(void)
{
sWarpDestination = gSaveBlock1Ptr->continueGameWarp;
}
void SetContinueGameWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y)
{
SetWarpData(&gSaveBlock1Ptr->continueGameWarp, mapGroup, mapNum, warpId, x, y);
}
void SetContinueGameWarpToHealLocation(u8 healLocationId)
{
const struct HealLocation *warp = GetHealLocation(healLocationId);
if (warp)
SetWarpData(&gSaveBlock1Ptr->continueGameWarp, warp->group, warp->map, -1, warp->x, warp->y);
}
void SetContinueGameWarpToDynamicWarp(int unused)
{
gSaveBlock1Ptr->continueGameWarp = gSaveBlock1Ptr->dynamicWarp;
}
+1 -1
View File
@@ -29,7 +29,7 @@ bool8 EnterHallOfFame(void)
SetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME, (gSaveBlock2Ptr->playTimeHours << 16) | (gSaveBlock2Ptr->playTimeMinutes << 8) | gSaveBlock2Ptr->playTimeSeconds);
}
sub_804C1AC();
sub_8055738(SPAWN_PALLET_TOWN);
SetContinueGameWarpToHealLocation(SPAWN_PALLET_TOWN);
gaveAtLeastOneRibbon = FALSE;
for (i = 0, r7 = &ribbonState; i < PARTY_SIZE; i++)
{
+7 -7
View File
@@ -3471,7 +3471,7 @@ static void GetPlayerPositionOnRegionMap(void)
const struct MapHeader * mapHeader;
struct WarpData * warp;
switch (get_map_light_level_by_bank_and_number(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum))
switch (GetMapTypeByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum))
{
default:
case 1:
@@ -3495,12 +3495,12 @@ static void GetPlayerPositionOnRegionMap(void)
y = gSaveBlock1Ptr->escapeWarp.y;
break;
case 9:
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->warp2.mapGroup, gSaveBlock1Ptr->warp2.mapNum);
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->dynamicWarp.mapGroup, gSaveBlock1Ptr->dynamicWarp.mapNum);
gUnknown_20399E4->field_014 = mapHeader->regionMapSectionId;
width = mapHeader->mapLayout->width;
height = mapHeader->mapLayout->height;
x = gSaveBlock1Ptr->warp2.x;
y = gSaveBlock1Ptr->warp2.y;
x = gSaveBlock1Ptr->dynamicWarp.x;
y = gSaveBlock1Ptr->dynamicWarp.y;
break;
case 8:
if ((gUnknown_20399E4->field_014 = gMapHeader.regionMapSectionId) != MAPSEC_SPECIAL_AREA)
@@ -3510,7 +3510,7 @@ static void GetPlayerPositionOnRegionMap(void)
}
else
{
warp = &gSaveBlock1Ptr->warp2;
warp = &gSaveBlock1Ptr->dynamicWarp;
mapHeader = Overworld_GetMapHeaderByGroupAndId(warp->mapGroup, warp->mapNum);
gUnknown_20399E4->field_014 = mapHeader->regionMapSectionId;
}
@@ -4318,7 +4318,7 @@ static void sub_80C4F08(u8 taskId)
case 4:
if ((sub_80C3AC8(0) == 2 || sub_80C3AC8(0) == 4) && GetRegionMapPermission(MAPPERM_3) == TRUE)
{
switch (get_map_light_level_by_bank_and_number(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum))
switch (GetMapTypeByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum))
{
case 4:
case 8:
@@ -4388,7 +4388,7 @@ static void sub_80C527C(u16 mapsec)
u16 idx = mapsec - MAPSECS_KANTO;
if (sMapsecToSpawn[idx][2])
{
sub_805546C(sMapsecToSpawn[idx][2]);
SetWarpDestinationToHealLocation(sMapsecToSpawn[idx][2]);
SetUsedFlyQuestLogEvent(sMapsecToSpawn[idx]);
}
else
+1 -41
View File
@@ -32,48 +32,8 @@
.include "src/trade_scene.o"
.align 2
.include "src/new_game.o"
.align 2
@ .include "src/overworld.o"
gLastUsedWarp: @ 2031DB4
.space 0x8
sWarpDestination: @ 2031DBC
.space 0x8
gFixedDiveWarp: @ 2031DC4
.space 0x8
gFixedHoleWarp: @ 2031DCC
.space 0x8
gUnknown_2031DD4: @ 2031DD4
.space 0x4
gDisableMapMusicChangeOnMapLoad: @ 2031DD8
.space 0x2
gUnknown_2031DDA: @ 2031DDA
.space 0x2
gUnknown_2031DDC: @ 2031DDC
.space 0x4
gUnknown_2031DE0: @ 2031DE0
.space 0x4
gUnknown_2031DE4: @ 2031DE4
.space 0x4
gUnknown_2031DE8: @ 2031DE8
.space 0x2
gUnknown_2031DEA: @ 2031DEA
.space 0x2
gLinkPlayerObjectEvents: @ 2031DEC
.space 0x10
.include "src/overworld.o"
.align 2
.include "src/fieldmap.o"
.align 2