mirror of
https://github.com/pret/pokeheartgold.git
synced 2024-11-23 13:20:02 +00:00
safari_zone: Document some functions
This commit is contained in:
parent
0311771549
commit
09c2d71a39
@ -32009,7 +32009,7 @@ _021F4B70:
|
||||
str r0, [sp, #0x18]
|
||||
ldr r0, [sp, #0x14]
|
||||
ldr r1, [sp, #0x18]
|
||||
bl sub_0202F630
|
||||
bl SafariZone_GetAreaSet
|
||||
str r0, [sp, #0x10]
|
||||
ldr r0, [sp, #0x18]
|
||||
cmp r0, #0
|
||||
@ -32024,7 +32024,7 @@ _021F4B70:
|
||||
b _021F4BAC
|
||||
_021F4BA6:
|
||||
ldr r0, [sp, #0x14]
|
||||
bl sub_0202F87C
|
||||
bl SafariZone_GetLinkLeaderGender
|
||||
_021F4BAC:
|
||||
str r7, [sp]
|
||||
str r0, [sp, #4]
|
||||
|
@ -4412,7 +4412,7 @@ ov02_02247DA0: ; 0x02247DA0
|
||||
add r5, r3, #0
|
||||
bl Save_SafariZone_get
|
||||
mov r1, #3
|
||||
bl sub_0202F630
|
||||
bl SafariZone_GetAreaSet
|
||||
str r0, [sp, #0x14]
|
||||
add r0, r7, #0
|
||||
bl ov02_0224E340
|
||||
@ -18506,7 +18506,7 @@ ov02_0224E698: ; 0x0224E698
|
||||
ldr r0, [r5, #0xc]
|
||||
bl Save_SafariZone_get
|
||||
mov r1, #0
|
||||
bl sub_0202F630
|
||||
bl SafariZone_GetAreaSet
|
||||
add r2, r0, #0
|
||||
add r0, r6, #0
|
||||
sub r0, #0x20
|
||||
@ -18621,7 +18621,7 @@ ov02_0224E754: ; 0x0224E754
|
||||
ldr r0, [r4, #0xc]
|
||||
bl Save_SafariZone_get
|
||||
mov r1, #0
|
||||
bl sub_0202F630
|
||||
bl SafariZone_GetAreaSet
|
||||
mov r1, #0x7a
|
||||
mul r1, r5
|
||||
add r0, r0, r1
|
||||
|
@ -9367,13 +9367,13 @@ ov03_0225884C: ; 0x0225884C
|
||||
ldr r0, [r4, #4]
|
||||
mov r1, #1
|
||||
add r2, r6, #0
|
||||
bl sub_0202F680
|
||||
bl SafariZone_SetAreaSet
|
||||
add r0, r5, #0
|
||||
bl sub_02034818
|
||||
add r1, r0, #0
|
||||
ldr r0, [r4, #4]
|
||||
mov r2, #0xb
|
||||
bl sub_0202F7D8
|
||||
bl SafariZone_SetLinkLeaderFromProfile
|
||||
_02258876:
|
||||
pop {r4, r5, r6, pc}
|
||||
thumb_func_end ov03_0225884C
|
||||
@ -9444,7 +9444,7 @@ ov03_022588D4: ; 0x022588D4
|
||||
beq _0225890A
|
||||
ldr r0, [r4, #4]
|
||||
mov r1, #0
|
||||
bl sub_0202F630
|
||||
bl SafariZone_GetAreaSet
|
||||
add r1, r0, #0
|
||||
mov r0, #0x16
|
||||
bl sub_020376D4
|
||||
@ -9638,7 +9638,7 @@ ScrCmd_720: ; 0x02258A18
|
||||
ldr r0, [r5, #0xc]
|
||||
bl Save_SafariZone_get
|
||||
mov r1, #0
|
||||
bl sub_0202F630
|
||||
bl SafariZone_GetAreaSet
|
||||
str r0, [sp, #0xc]
|
||||
ldr r0, [r5, #0x2c]
|
||||
bl ov01_021F6320
|
||||
@ -9795,7 +9795,7 @@ _02258BC6:
|
||||
lsl r2, r2, #0x18
|
||||
ldr r1, [sp, #0x10]
|
||||
lsr r2, r2, #0x18
|
||||
bl sub_0202F968
|
||||
bl SafariZone_RemoveObjectFromArea
|
||||
mov r0, #0
|
||||
add sp, #0x30
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
|
@ -130,7 +130,7 @@ ov108_021E59E4: ; 0x021E59E4
|
||||
str r0, [r5, #0x18]
|
||||
mov r1, #0
|
||||
add r2, #0x1c
|
||||
bl sub_0202F658
|
||||
bl SafariZone_CopyAreaSet
|
||||
ldr r0, [r4]
|
||||
bl Sav2_PlayerData_GetOptionsAddr
|
||||
add r6, r0, #0
|
||||
@ -172,7 +172,7 @@ ov108_021E5A48: ; 0x021E5A48
|
||||
ldr r0, [r4, #0x18]
|
||||
mov r1, #0
|
||||
add r2, #0x1c
|
||||
bl sub_0202F680
|
||||
bl SafariZone_SetAreaSet
|
||||
ldr r0, [r4, #0x14]
|
||||
ldr r0, [r0]
|
||||
bl SavArray_Flags_get
|
||||
@ -846,7 +846,7 @@ _021E5F50:
|
||||
add r0, r5, #0
|
||||
ldrb r1, [r5, r1]
|
||||
add r0, #0x1c
|
||||
bl sub_0202F91C
|
||||
bl SafariZone_InitAreaInSet
|
||||
b _021E5FA2
|
||||
_021E5F88:
|
||||
ldr r0, _021E600C ; =0x000184DF
|
||||
@ -1049,7 +1049,7 @@ _021E60EE:
|
||||
ldrb r1, [r5, r1]
|
||||
ldrb r2, [r5, r2]
|
||||
add r0, #0x1c
|
||||
bl sub_0202F8D4
|
||||
bl SafariZone_SwapAreasInSet
|
||||
ldr r0, _021E61E4 ; =0x000184DF
|
||||
mov r3, #0x7a
|
||||
ldrb r2, [r5, r0]
|
||||
@ -1492,7 +1492,7 @@ _021E646C:
|
||||
add r0, r4, #0
|
||||
ldrb r1, [r4, r1]
|
||||
add r0, #0x1c
|
||||
bl sub_0202F91C
|
||||
bl SafariZone_InitAreaInSet
|
||||
ldr r0, _021E64BC ; =0x000184DF
|
||||
mov r2, #0x7a
|
||||
ldrb r1, [r4, r0]
|
||||
@ -6112,7 +6112,7 @@ ov108_021E8968: ; 0x021E8968
|
||||
str r0, [r5, #0x20]
|
||||
mov r1, #0
|
||||
add r2, #0x24
|
||||
bl sub_0202F658
|
||||
bl SafariZone_CopyAreaSet
|
||||
ldr r0, [r4]
|
||||
bl Sav2_PlayerData_GetOptionsAddr
|
||||
add r6, r0, #0
|
||||
@ -6243,7 +6243,7 @@ ov108_021E8A88: ; 0x021E8A88
|
||||
ldr r0, [r4, #0x20]
|
||||
mov r1, #0
|
||||
add r2, #0x24
|
||||
bl sub_0202F680
|
||||
bl SafariZone_SetAreaSet
|
||||
ldr r0, _021E8AD0 ; =0x00000431
|
||||
ldrb r1, [r4, r0]
|
||||
cmp r1, #6
|
||||
@ -6535,7 +6535,7 @@ ov108_021E8C64: ; 0x021E8C64
|
||||
add r0, r4, #0
|
||||
ldrb r1, [r1, #0x19]
|
||||
add r0, #0x24
|
||||
bl sub_0202F930
|
||||
bl SafariZone_AddObjectToArea
|
||||
add r0, sp, #0
|
||||
ldrb r1, [r0]
|
||||
ldr r0, [r4, #0x1c]
|
||||
|
@ -206,7 +206,7 @@ _021E5A94:
|
||||
add r0, r6, #0
|
||||
bl Save_SafariZone_get
|
||||
add r1, r4, #0
|
||||
bl sub_0202F5B8
|
||||
bl SafariZone_ResetAreaSetToDefaultSet
|
||||
add r0, r7, #0
|
||||
bl PlayerProfile_GetTrainerGender
|
||||
add r1, r0, #0
|
||||
|
@ -16317,7 +16317,7 @@ ScrCmd_823: ; 0x02047EC4
|
||||
ldr r0, [r0, #0xc]
|
||||
bl Save_SafariZone_get
|
||||
add r1, r4, #0
|
||||
bl sub_0202F844
|
||||
bl SafariZone_GetLinkLeaderToProfile
|
||||
ldrh r1, [r6]
|
||||
ldr r0, [r7]
|
||||
add r2, r4, #0
|
||||
@ -16345,9 +16345,9 @@ ScrCmd_824: ; 0x02047F14
|
||||
bl GetVarPointer
|
||||
add r4, r0, #0
|
||||
add r0, r5, #0
|
||||
bl sub_0202F890
|
||||
bl SafariZone_DeactivateLinkIfExpired
|
||||
add r0, r5, #0
|
||||
bl sub_0202F888
|
||||
bl SafariZone_IsCurrentlyLinked
|
||||
cmp r0, #0
|
||||
beq _02047F4A
|
||||
mov r0, #1
|
||||
|
@ -125,7 +125,7 @@ sub_0209730C: ; 0x0209730C
|
||||
bl Save_SafariZone_get
|
||||
str r0, [sp, #0x28]
|
||||
mov r1, #0
|
||||
bl sub_0202F630
|
||||
bl SafariZone_GetAreaSet
|
||||
str r0, [sp, #0x24]
|
||||
ldr r0, [sp, #0x28]
|
||||
bl sub_0202F720
|
||||
|
26
global.inc
26
global.inc
@ -27584,12 +27584,12 @@
|
||||
.public Save_SafariZone_sizeof
|
||||
.public Save_SafariZone_get
|
||||
.public Save_SafariZone_init
|
||||
.public sub_0202F5B8
|
||||
.public SafariZone_ResetAreaSetToDefaultSet
|
||||
.public sub_0202F5F8
|
||||
.public sub_0202F620
|
||||
.public sub_0202F630
|
||||
.public sub_0202F658
|
||||
.public sub_0202F680
|
||||
.public SafariZone_GetAreaSet
|
||||
.public SafariZone_CopyAreaSet
|
||||
.public SafariZone_SetAreaSet
|
||||
.public sub_0202F6A0
|
||||
.public sub_0202F6AC
|
||||
.public sub_0202F6B8
|
||||
@ -27597,15 +27597,15 @@
|
||||
.public sub_0202F730
|
||||
.public sub_0202F784
|
||||
.public sub_0202F798
|
||||
.public sub_0202F7D8
|
||||
.public sub_0202F844
|
||||
.public sub_0202F87C
|
||||
.public sub_0202F888
|
||||
.public sub_0202F890
|
||||
.public sub_0202F8D4
|
||||
.public sub_0202F91C
|
||||
.public sub_0202F930
|
||||
.public sub_0202F968
|
||||
.public SafariZone_SetLinkLeaderFromProfile
|
||||
.public SafariZone_GetLinkLeaderToProfile
|
||||
.public SafariZone_GetLinkLeaderGender
|
||||
.public SafariZone_IsCurrentlyLinked
|
||||
.public SafariZone_DeactivateLinkIfExpired
|
||||
.public SafariZone_SwapAreasInSet
|
||||
.public SafariZone_InitAreaInSet
|
||||
.public SafariZone_AddObjectToArea
|
||||
.public SafariZone_RemoveObjectFromArea
|
||||
.public Save_PhotoAlbum_sizeof
|
||||
.public Save_PhotoAlbum_get
|
||||
.public Save_PhotoAlbum_init
|
||||
|
@ -38,20 +38,20 @@ typedef struct SAFARIZONE_AREASET {
|
||||
u8 unk2DC[12];
|
||||
} SAFARIZONE_AREASET;
|
||||
|
||||
typedef struct SAFARIZONE_UNKSUB {
|
||||
s64 seconds_since_epoch;
|
||||
typedef struct SAFARIZONE_LINKLEADER {
|
||||
s64 received_timestamp;
|
||||
s64 rtc_offset;
|
||||
u8 unk10;
|
||||
u8 linked; // TODO: bool8
|
||||
u8 gender;
|
||||
u8 language;
|
||||
u8 version;
|
||||
u32 id;
|
||||
u16 name[OT_NAME_LENGTH + 1];
|
||||
} SAFARIZONE_UNKSUB;
|
||||
} SAFARIZONE_LINKLEADER;
|
||||
|
||||
typedef struct SAFARIZONE {
|
||||
SAFARIZONE_AREASET area_sets[2];
|
||||
SAFARIZONE_UNKSUB unk5D0;
|
||||
SAFARIZONE_AREASET area_sets[SAFARI_ZONE_MAX_AREA_SETS];
|
||||
SAFARIZONE_LINKLEADER link_leader;
|
||||
u8 unk5F8;
|
||||
u8 unk5F9_0:6;
|
||||
u8 unk5F9_6:2;
|
||||
@ -61,12 +61,12 @@ typedef struct SAFARIZONE {
|
||||
u32 Save_SafariZone_sizeof(void);
|
||||
SAFARIZONE* Save_SafariZone_get(SAVEDATA* savedata);
|
||||
void Save_SafariZone_init(SAFARIZONE* safari_zone);
|
||||
void sub_0202F5B8(SAFARIZONE_AREASET* area_set, u32 a1);
|
||||
void sub_0202F5F8(SAFARIZONE* safari_zone, s32 areaSet);
|
||||
void SafariZone_ResetAreaSetToDefaultSet(SAFARIZONE_AREASET* area_set, u32 default_set_no);
|
||||
void sub_0202F5F8(SAFARIZONE* safari_zone, s32 areaSetNo);
|
||||
u8 sub_0202F620(SAFARIZONE* safari_zone);
|
||||
SAFARIZONE_AREASET* sub_0202F630(SAFARIZONE* safari_zone, s32 area_set_no);
|
||||
void sub_0202F658(SAFARIZONE* safari_zone, s32 area_set_no, SAFARIZONE_AREASET* area_set);
|
||||
void sub_0202F680(SAFARIZONE* safari_zone, s32 area_set_no, SAFARIZONE_AREASET* area_set);
|
||||
SAFARIZONE_AREASET* SafariZone_GetAreaSet(SAFARIZONE* safari_zone, s32 area_set_no);
|
||||
void SafariZone_CopyAreaSet(SAFARIZONE* safari_zone, s32 area_set_no, SAFARIZONE_AREASET* area_set_dest);
|
||||
void SafariZone_SetAreaSet(SAFARIZONE* safari_zone, s32 area_set_no, SAFARIZONE_AREASET* area_set_src);
|
||||
void sub_0202F6A0(SAFARIZONE* safari_zone, u8 a1);
|
||||
u8 sub_0202F6AC(SAFARIZONE* safari_zone);
|
||||
void sub_0202F6B8(SAFARIZONE_AREASET* area_set, s32 a1);
|
||||
@ -75,19 +75,19 @@ u8 sub_0202F730(SAFARIZONE* safari_zone, s32 a1);
|
||||
void sub_0202F754(SAFARIZONE* safari_zone, u8 a1);
|
||||
void sub_0202F784(SAFARIZONE* safari_zone, IGT* igt);
|
||||
u32 sub_0202F798(SAFARIZONE* safari_zone, IGT* igt, s32 a2);
|
||||
void sub_0202F7D8(SAFARIZONE* safari_zone, PLAYERPROFILE* profile, HeapID heap_id);
|
||||
void sub_0202F844(SAFARIZONE* safari_zone, PLAYERPROFILE* profile);
|
||||
u8 sub_0202F87C(SAFARIZONE* safari_zone);
|
||||
u8 sub_0202F888(SAFARIZONE* safari_zone);
|
||||
void sub_0202F890(SAFARIZONE* safari_zone);
|
||||
void sub_0202F8D4(SAFARIZONE_AREASET* area_set, u32 first, u32 second);
|
||||
void sub_0202F91C(SAFARIZONE_AREASET* area_set, s32 area_idx, u32 area_no);
|
||||
void sub_0202F930(SAFARIZONE_AREASET* area_set, s32 area_idx, const SAFARIZONE_OBJECT* object);
|
||||
void sub_0202F968(SAFARIZONE_AREASET* area_set, s32 area_idx, s32 object_idx);
|
||||
void sub_0202F9CC(SAFARIZONE_AREASET* area_set);
|
||||
void sub_0202F9E8(SAFARIZONE_AREA* area, u8 area_no);
|
||||
void sub_0202F9FC(SAFARIZONE_OBJECT* object);
|
||||
void sub_0202FA08(SAFARIZONE_UNKSUB* a0);
|
||||
void SafariZone_SetLinkLeaderFromProfile(SAFARIZONE* safari_zone, PLAYERPROFILE* profile, HeapID heap_id);
|
||||
void SafariZone_GetLinkLeaderToProfile(SAFARIZONE* safari_zone, PLAYERPROFILE* profile);
|
||||
u8 SafariZone_GetLinkLeaderGender(SAFARIZONE* safari_zone);
|
||||
u8 SafariZone_IsCurrentlyLinked(SAFARIZONE* safari_zone);
|
||||
void SafariZone_DeactivateLinkIfExpired(SAFARIZONE* safari_zone);
|
||||
void SafariZone_SwapAreasInSet(SAFARIZONE_AREASET* area_set, u32 first, u32 second);
|
||||
void SafariZone_InitAreaInSet(SAFARIZONE_AREASET* area_set, s32 area_idx, u32 area_no);
|
||||
void SafariZone_AddObjectToArea(SAFARIZONE_AREASET* area_set, s32 area_idx, const SAFARIZONE_OBJECT* object);
|
||||
void SafariZone_RemoveObjectFromArea(SAFARIZONE_AREASET* area_set, s32 area_idx, s32 object_idx);
|
||||
void SafariZone_InitAreaSet(SAFARIZONE_AREASET* area_set);
|
||||
void SafariZone_InitArea(SAFARIZONE_AREA* area, u8 area_no);
|
||||
void SafariZone_ClearObject(SAFARIZONE_OBJECT* object);
|
||||
void SafariZone_ClearLeader(SAFARIZONE_LINKLEADER* link_leader);
|
||||
BOOL sub_0202FA3C(u8 a0, u8* a1, u8 a2);
|
||||
|
||||
#endif
|
||||
|
@ -215,7 +215,7 @@ void PlaceSafariZoneAreas(MAPMATRIX* map_matrix, SAVEDATA* save) {
|
||||
}
|
||||
|
||||
SAFARIZONE* safari_zone = Save_SafariZone_get(save);
|
||||
SAFARIZONE_AREASET* sz_area_set = sub_0202F630(safari_zone, 3);
|
||||
SAFARIZONE_AREASET* sz_area_set = SafariZone_GetAreaSet(safari_zone, 3);
|
||||
|
||||
for (s32 y = 0; y < SAFARI_ZONE_AREA_SET_ROWS; y++) {
|
||||
for (s32 x = 0; x < SAFARI_ZONE_AREA_SET_COLS; x++) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <nitro/mi/memory.h>
|
||||
#include <nitro/os/ownerInfo.h>
|
||||
|
||||
static const u8 sSafariZoneDefaultAreaSets[10][6] = {
|
||||
static const u8 sSafariZoneDefaultAreaSets[10][SAFARI_ZONE_MAX_AREAS_PER_SET] = {
|
||||
{ SAFARI_ZONE_AREA_PLAINS, SAFARI_ZONE_AREA_SWAMP, SAFARI_ZONE_AREA_MEADOW,
|
||||
SAFARI_ZONE_AREA_WETLAND, SAFARI_ZONE_AREA_PEAK, SAFARI_ZONE_AREA_FOREST },
|
||||
{ SAFARI_ZONE_AREA_MEADOW, SAFARI_ZONE_AREA_MARSHLAND, SAFARI_ZONE_AREA_WETLAND,
|
||||
@ -40,32 +40,32 @@ void Save_SafariZone_init(SAFARIZONE* safari_zone) {
|
||||
MI_CpuFill8(&safari_zone->area_sets[i], 0, sizeof(SAFARIZONE_AREASET));
|
||||
}
|
||||
|
||||
sub_0202FA08(&safari_zone->unk5D0);
|
||||
SafariZone_ClearLeader(&safari_zone->link_leader);
|
||||
}
|
||||
|
||||
void sub_0202F5B8(SAFARIZONE_AREASET* area_set, u32 a1) {
|
||||
u32 default_set_no = a1 % 10;
|
||||
void SafariZone_ResetAreaSetToDefaultSet(SAFARIZONE_AREASET* area_set, u32 default_set_no) {
|
||||
u32 default_set_no_mod = default_set_no % NELEMS(sSafariZoneDefaultAreaSets);
|
||||
for (s32 i = 0; i < SAFARI_ZONE_MAX_AREAS_PER_SET; i++) {
|
||||
sub_0202F9E8(&area_set->areas[i], sSafariZoneDefaultAreaSets[default_set_no][i]);
|
||||
SafariZone_InitArea(&area_set->areas[i], sSafariZoneDefaultAreaSets[default_set_no_mod][i]);
|
||||
}
|
||||
|
||||
MI_CpuFill8(area_set->unk2DC, 0, sizeof(area_set->unk2DC));
|
||||
}
|
||||
|
||||
void sub_0202F5F8(SAFARIZONE* safari_zone, s32 areaSet) {
|
||||
if (areaSet >= SAFARI_ZONE_MAX_AREA_SETS) {
|
||||
void sub_0202F5F8(SAFARIZONE* safari_zone, s32 areaSetNo) {
|
||||
if (areaSetNo >= SAFARI_ZONE_MAX_AREA_SETS) {
|
||||
GF_ASSERT(FALSE);
|
||||
areaSet = 0;
|
||||
areaSetNo = 0;
|
||||
}
|
||||
|
||||
safari_zone->unk5F9_6 = areaSet;
|
||||
safari_zone->unk5F9_6 = areaSetNo;
|
||||
}
|
||||
|
||||
u8 sub_0202F620(SAFARIZONE* safari_zone) {
|
||||
return safari_zone->unk5F9_6;
|
||||
}
|
||||
|
||||
SAFARIZONE_AREASET* sub_0202F630(SAFARIZONE* safari_zone, s32 area_set_no) {
|
||||
SAFARIZONE_AREASET* SafariZone_GetAreaSet(SAFARIZONE* safari_zone, s32 area_set_no) {
|
||||
if (area_set_no == 3) {
|
||||
area_set_no = safari_zone->unk5F9_6;
|
||||
}
|
||||
@ -78,23 +78,23 @@ SAFARIZONE_AREASET* sub_0202F630(SAFARIZONE* safari_zone, s32 area_set_no) {
|
||||
return &safari_zone->area_sets[area_set_no];
|
||||
}
|
||||
|
||||
void sub_0202F658(SAFARIZONE* safari_zone, s32 area_set_no, SAFARIZONE_AREASET* area_set) {
|
||||
void SafariZone_CopyAreaSet(SAFARIZONE* safari_zone, s32 area_set_no, SAFARIZONE_AREASET* area_set_dest) {
|
||||
if (area_set_no >= SAFARI_ZONE_MAX_AREA_SETS) {
|
||||
GF_ASSERT(FALSE);
|
||||
sub_0202F9CC(area_set);
|
||||
SafariZone_InitAreaSet(area_set_dest);
|
||||
return;
|
||||
}
|
||||
|
||||
MI_CpuCopy8(&safari_zone->area_sets[area_set_no], area_set, sizeof(SAFARIZONE_AREASET));
|
||||
MI_CpuCopy8(&safari_zone->area_sets[area_set_no], area_set_dest, sizeof(SAFARIZONE_AREASET));
|
||||
}
|
||||
|
||||
void sub_0202F680(SAFARIZONE* safari_zone, s32 area_set_no, SAFARIZONE_AREASET* area_set) {
|
||||
void SafariZone_SetAreaSet(SAFARIZONE* safari_zone, s32 area_set_no, SAFARIZONE_AREASET* area_set_src) {
|
||||
if (area_set_no >= SAFARI_ZONE_MAX_AREA_SETS) {
|
||||
GF_ASSERT(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
MI_CpuCopy8(area_set, &safari_zone->area_sets[area_set_no], sizeof(SAFARIZONE_AREASET));
|
||||
MI_CpuCopy8(area_set_src, &safari_zone->area_sets[area_set_no], sizeof(SAFARIZONE_AREASET));
|
||||
}
|
||||
|
||||
void sub_0202F6A0(SAFARIZONE* safari_zone, u8 a1) {
|
||||
@ -169,68 +169,70 @@ u32 sub_0202F798(SAFARIZONE* safari_zone, IGT* igt, s32 a2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_0202F7D8(SAFARIZONE* safari_zone, PLAYERPROFILE* profile, HeapID heap_id) {
|
||||
SAFARIZONE_UNKSUB *unksub = &safari_zone->unk5D0;
|
||||
unksub->id = PlayerProfile_GetTrainerID(profile);
|
||||
unksub->gender = PlayerProfile_GetTrainerGender(profile);
|
||||
unksub->language = PlayerProfile_GetLanguage(profile);
|
||||
unksub->version = PlayerProfile_GetVersion(profile);
|
||||
void SafariZone_SetLinkLeaderFromProfile(SAFARIZONE* safari_zone, PLAYERPROFILE* profile, HeapID heap_id) {
|
||||
SAFARIZONE_LINKLEADER *link_leader = &safari_zone->link_leader;
|
||||
link_leader->id = PlayerProfile_GetTrainerID(profile);
|
||||
link_leader->gender = PlayerProfile_GetTrainerGender(profile);
|
||||
link_leader->language = PlayerProfile_GetLanguage(profile);
|
||||
link_leader->version = PlayerProfile_GetVersion(profile);
|
||||
|
||||
STRING* name = String_ctor((OT_NAME_LENGTH + 1) * sizeof(u16), heap_id);
|
||||
PlayerName_FlatToString(profile, name);
|
||||
CopyStringToU16Array(name, unksub->name, (OT_NAME_LENGTH + 1) * sizeof(u16));
|
||||
CopyStringToU16Array(name, link_leader->name, (OT_NAME_LENGTH + 1) * sizeof(u16));
|
||||
String_dtor(name);
|
||||
|
||||
unksub->unk10 = 1;
|
||||
link_leader->linked = TRUE;
|
||||
|
||||
unksub->seconds_since_epoch = GF_RTC_DateTimeToSec();
|
||||
unksub->rtc_offset = OS_GetOwnerRtcOffset();
|
||||
link_leader->received_timestamp = GF_RTC_DateTimeToSec();
|
||||
link_leader->rtc_offset = OS_GetOwnerRtcOffset();
|
||||
}
|
||||
|
||||
void sub_0202F844(SAFARIZONE* safari_zone, PLAYERPROFILE* profile) {
|
||||
SAFARIZONE_UNKSUB *unksub = &safari_zone->unk5D0;
|
||||
PlayerProfile_SetTrainerID(profile, unksub->id);
|
||||
PlayerProfile_SetTrainerGender(profile, unksub->gender);
|
||||
PlayerProfile_SetLanguage(profile, unksub->language);
|
||||
PlayerProfile_SetVersion(profile, unksub->version);
|
||||
Sav2_Profile_PlayerName_set(profile, unksub->name);
|
||||
void SafariZone_GetLinkLeaderToProfile(SAFARIZONE* safari_zone, PLAYERPROFILE* profile) {
|
||||
SAFARIZONE_LINKLEADER *link_leader = &safari_zone->link_leader;
|
||||
PlayerProfile_SetTrainerID(profile, link_leader->id);
|
||||
PlayerProfile_SetTrainerGender(profile, link_leader->gender);
|
||||
PlayerProfile_SetLanguage(profile, link_leader->language);
|
||||
PlayerProfile_SetVersion(profile, link_leader->version);
|
||||
Sav2_Profile_PlayerName_set(profile, link_leader->name);
|
||||
}
|
||||
|
||||
u8 sub_0202F87C(SAFARIZONE* safari_zone) {
|
||||
return safari_zone->unk5D0.gender;
|
||||
u8 SafariZone_GetLinkLeaderGender(SAFARIZONE* safari_zone) {
|
||||
return safari_zone->link_leader.gender;
|
||||
}
|
||||
|
||||
u8 sub_0202F888(SAFARIZONE* safari_zone) {
|
||||
return safari_zone->unk5D0.unk10;
|
||||
u8 SafariZone_IsCurrentlyLinked(SAFARIZONE* safari_zone) {
|
||||
return safari_zone->link_leader.linked;
|
||||
}
|
||||
|
||||
void sub_0202F890(SAFARIZONE* safari_zone) {
|
||||
SAFARIZONE_UNKSUB *unksub = &safari_zone->unk5D0;
|
||||
if (unksub->unk10 == 0) {
|
||||
void SafariZone_DeactivateLinkIfExpired(SAFARIZONE* safari_zone) {
|
||||
SAFARIZONE_LINKLEADER *link_leader = &safari_zone->link_leader;
|
||||
if (!link_leader->linked) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((24 * 60 * 60) < GF_RTC_DateTimeToSec() - unksub->seconds_since_epoch) {
|
||||
unksub->unk10 = 0;
|
||||
if ((24 * 60 * 60) < GF_RTC_DateTimeToSec() - link_leader->received_timestamp) {
|
||||
// It has been 24 hours since the player received the Safari Zone.
|
||||
link_leader->linked = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (unksub->rtc_offset != OS_GetOwnerRtcOffset()) {
|
||||
unksub->unk10 = 0;
|
||||
if (link_leader->rtc_offset != OS_GetOwnerRtcOffset()) {
|
||||
// The player changed their system's time since receiving the Safari Zone.
|
||||
link_leader->linked = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0202F8D4(SAFARIZONE_AREASET* area_set, u32 first, u32 second) {
|
||||
void SafariZone_SwapAreasInSet(SAFARIZONE_AREASET* area_set, u32 first, u32 second) {
|
||||
SAFARIZONE_AREA tmp = area_set->areas[first];
|
||||
area_set->areas[first] = area_set->areas[second];
|
||||
area_set->areas[second] = tmp;
|
||||
}
|
||||
|
||||
void sub_0202F91C(SAFARIZONE_AREASET* area_set, s32 area_idx, u32 area_no) {
|
||||
sub_0202F9E8(&area_set->areas[area_idx], area_no);
|
||||
void SafariZone_InitAreaInSet(SAFARIZONE_AREASET* area_set, s32 area_idx, u32 area_no) {
|
||||
SafariZone_InitArea(&area_set->areas[area_idx], area_no);
|
||||
}
|
||||
|
||||
void sub_0202F930(SAFARIZONE_AREASET* area_set, s32 area_idx, const SAFARIZONE_OBJECT* object) {
|
||||
void SafariZone_AddObjectToArea(SAFARIZONE_AREASET* area_set, s32 area_idx, const SAFARIZONE_OBJECT* object) {
|
||||
if (area_idx >= SAFARI_ZONE_MAX_AREAS_PER_SET) {
|
||||
GF_ASSERT(FALSE);
|
||||
return;
|
||||
@ -245,7 +247,7 @@ void sub_0202F930(SAFARIZONE_AREASET* area_set, s32 area_idx, const SAFARIZONE_O
|
||||
area->objects[area->active_object_count++] = *object;
|
||||
}
|
||||
|
||||
void sub_0202F968(SAFARIZONE_AREASET* area_set, s32 area_idx, s32 object_idx) {
|
||||
void SafariZone_RemoveObjectFromArea(SAFARIZONE_AREASET* area_set, s32 area_idx, s32 object_idx) {
|
||||
if (area_idx >= SAFARI_ZONE_MAX_AREAS_PER_SET) {
|
||||
GF_ASSERT(FALSE);
|
||||
return;
|
||||
@ -258,39 +260,39 @@ void sub_0202F968(SAFARIZONE_AREASET* area_set, s32 area_idx, s32 object_idx) {
|
||||
}
|
||||
|
||||
if (object_idx == --area->active_object_count) {
|
||||
sub_0202F9FC(&area->objects[object_idx]);
|
||||
SafariZone_ClearObject(&area->objects[object_idx]);
|
||||
} else {
|
||||
for (; object_idx < area->active_object_count; object_idx++) {
|
||||
area->objects[object_idx] = area->objects[object_idx + 1];
|
||||
}
|
||||
|
||||
sub_0202F9FC(&area->objects[area->active_object_count]);
|
||||
SafariZone_ClearObject(&area->objects[area->active_object_count]);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0202F9CC(SAFARIZONE_AREASET* area_set) {
|
||||
void SafariZone_InitAreaSet(SAFARIZONE_AREASET* area_set) {
|
||||
for (s32 i = 0; i < SAFARI_ZONE_MAX_AREAS_PER_SET; i++) {
|
||||
sub_0202F9E8(&area_set->areas[i], i);
|
||||
SafariZone_InitArea(&area_set->areas[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0202F9E8(SAFARIZONE_AREA* area, u8 area_no) {
|
||||
void SafariZone_InitArea(SAFARIZONE_AREA* area, u8 area_no) {
|
||||
MI_CpuFill8(area, 0, sizeof(SAFARIZONE_AREA));
|
||||
area->area_no = area_no;
|
||||
}
|
||||
|
||||
void sub_0202F9FC(SAFARIZONE_OBJECT* object) {
|
||||
void SafariZone_ClearObject(SAFARIZONE_OBJECT* object) {
|
||||
MI_CpuFill8(object, 0, sizeof(SAFARIZONE_OBJECT));
|
||||
}
|
||||
|
||||
void sub_0202FA08(SAFARIZONE_UNKSUB* a0) {
|
||||
MI_CpuFill8(a0, 0, sizeof(SAFARIZONE_UNKSUB));
|
||||
void SafariZone_ClearLeader(SAFARIZONE_LINKLEADER* link_leader) {
|
||||
MI_CpuFill8(link_leader, 0, sizeof(SAFARIZONE_LINKLEADER));
|
||||
|
||||
a0->id = 0;
|
||||
a0->gender = 0;
|
||||
a0->language = gGameLanguage;
|
||||
a0->version = gGameVersion;
|
||||
StringFillEOS(a0->name, OT_NAME_LENGTH + 1);
|
||||
link_leader->id = 0;
|
||||
link_leader->gender = 0;
|
||||
link_leader->language = gGameLanguage;
|
||||
link_leader->version = gGameVersion;
|
||||
StringFillEOS(link_leader->name, OT_NAME_LENGTH + 1);
|
||||
}
|
||||
|
||||
BOOL sub_0202FA3C(u8 a0, u8* a1, u8 a2) {
|
||||
|
Loading…
Reference in New Issue
Block a user