Document some underground record data and functions (#559)

This commit is contained in:
CharlesFolz4 2025-06-22 16:01:21 -04:00 committed by GitHub
parent 1639941e95
commit 9709c5f76c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 428 additions and 427 deletions

View File

@ -3342,9 +3342,9 @@
.short \arg4
.endm
.macro ScrCmd_24A arg0
.macro GetCapturedFlagCount destFlagCount
.short 586
.short \arg0
.short \destFlagCount
.endm
.macro ScrCmd_24B arg0

View File

@ -26,16 +26,16 @@ TRAINER_SCORE_EVENT_UNK_24
TRAINER_SCORE_EVENT_UNK_25
TRAINER_SCORE_EVENT_UNK_26
TRAINER_SCORE_EVENT_UNK_27
TRAINER_SCORE_EVENT_UNK_28
TRAINER_SCORE_EVENT_UNK_29
TRAINER_SCORE_EVENT_UNK_30
TRAINER_SCORE_EVENT_UNK_31
TRAINER_SCORE_EVENT_UNK_32
TRAINER_SCORE_EVENT_UNK_33
TRAINER_SCORE_EVENT_UNK_34
TRAINER_SCORE_EVENT_UNK_35
TRAINER_SCORE_EVENT_UNK_36
TRAINER_SCORE_EVENT_UNK_37
TRAINER_SCORE_EVENT_UNDERGROUND_CAPTURE_FLAG
TRAINER_SCORE_EVENT_UNDERGROUND_UNUSED
TRAINER_SCORE_EVENT_UNDERGROUND_UNCOVER_FOSSIL
TRAINER_SCORE_EVENT_UNDERGROUND_GIVE_PLAYER_GOODS
TRAINER_SCORE_EVENT_UNDERGROUND_GREET_PLAYER
TRAINER_SCORE_EVENT_UNDERGROUND_ASK_PLAYER_QUESTION
TRAINER_SCORE_EVENT_UNDERGROUND_HELP_TRAPPED_PLAYER
TRAINER_SCORE_EVENT_UNDERGROUND_NEW_SECRET_BASE
TRAINER_SCORE_EVENT_UNDERGROUND_ENTERED
TRAINER_SCORE_EVENT_UNDERGROUND_100_STEPS
TRAINER_SCORE_EVENT_UNK_38
TRAINER_SCORE_EVENT_UNK_39
TRAINER_SCORE_EVENT_UNK_40

View File

@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_FUNCPTR_OV23_02248D20_H
#define POKEPLATINUM_FUNCPTR_OV23_02248D20_H
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
typedef void (*UnkFuncPtr_ov23_02248D20)(UndergroundData *, int, int);

View File

@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_OV23_02248C08_H
#define POKEPLATINUM_OV23_02248C08_H
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "overlay023/funcptr_ov23_02248D20.h"
#include "overlay023/struct_ov23_02248D20.h"

View File

@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_OV23_0224F294_H
#define POKEPLATINUM_OV23_0224F294_H
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "field/field_system_decl.h"
#include "overlay023/funcptr_ov23_0224F758.h"

View File

@ -1,8 +1,8 @@
#ifndef POKEPLATINUM_OV23_02253598_H
#define POKEPLATINUM_OV23_02253598_H
#include "struct_decls/struct_0202855C_decl.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "struct_defs/underground_record.h"
#include "overlay023/funcptr_ov23_02253834.h"
#include "overlay023/struct_ov23_02253598_decl.h"
@ -11,7 +11,7 @@
#include "savedata.h"
#include "trainer_info.h"
void ov23_02253598(UnkStruct_ov23_02253598 *param0, SecretBaseRecord *param1, SaveData *saveData);
void ov23_02253598(UnkStruct_ov23_02253598 *param0, UndergroundRecord *param1, SaveData *saveData);
void ov23_022535CC(void);
void ov23_022535EC(void);
void ov23_02253604(void);
@ -23,7 +23,7 @@ void ov23_02253998(int param0, int param1, void *param2, void *param3);
void ov23_022539A8(int param0, int param1, void *param2, void *param3);
BOOL ov23_022539D8(void);
void ov23_022539E8(void);
void ov23_02253A00(SecretBaseRecord *param0, int param1);
void ov23_02253A00(UndergroundRecord *param0, int param1);
void *ov23_02253C64(BgConfig *param0, TrainerInfo *param1, UndergroundData *param2, UnkFuncPtr_ov23_02253834 param3, void *param4);
void ov23_02253D10(void *param0);

View File

@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_STRUCT_OV23_02248D20_H
#define POKEPLATINUM_STRUCT_OV23_02248D20_H
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "overlay023/funcptr_ov23_02248D20.h"

View File

@ -1,6 +0,0 @@
#ifndef POKEPLATINUM_STRUCT_0202855C_DECL_H
#define POKEPLATINUM_STRUCT_0202855C_DECL_H
typedef struct UnkStruct_0202855C_t SecretBaseRecord;
#endif // POKEPLATINUM_STRUCT_0202855C_DECL_H

View File

@ -1,6 +0,0 @@
#ifndef POKEPLATINUM_STRUCT_020298B0_DECL_H
#define POKEPLATINUM_STRUCT_020298B0_DECL_H
typedef struct UnkStruct_020298B0_t UndergroundData;
#endif // POKEPLATINUM_STRUCT_020298B0_DECL_H

View File

@ -1,22 +0,0 @@
#ifndef POKEPLATINUM_STRUCT_0202855C_H
#define POKEPLATINUM_STRUCT_0202855C_H
typedef struct UnkStruct_0202855C_t {
u32 unk_00_0 : 20;
u32 unk_04_0 : 20;
u32 unk_08_0 : 20;
u32 unk_0C_0 : 20;
u32 unk_10_0 : 20;
u32 unk_14_0 : 20;
u32 unk_18_0 : 20;
u32 unk_1C_0 : 20;
u32 unk_20_0 : 20;
u32 unk_24_0 : 20;
u32 unk_28_0 : 20;
u32 unk_2C_0 : 20;
u32 unk_30_0 : 20;
u32 unk_34_0 : 20;
u32 unk_38_0 : 20;
} SecretBaseRecord;
#endif // POKEPLATINUM_STRUCT_0202855C_H

View File

@ -1,14 +1,14 @@
#ifndef POKEPLATINUM_STRUCT_02029894_H
#define POKEPLATINUM_STRUCT_02029894_H
#include "struct_defs/struct_0202855C.h"
#include "struct_defs/struct_02029894_sub1.h"
#include "struct_defs/struct_02029894_sub2.h"
#include "struct_defs/underground_record.h"
typedef struct UnkStruct_02029894_t {
UnkStruct_02029894_sub1 unk_00[15];
UnkStruct_02029894_sub2 unk_2D[16];
SecretBaseRecord unk_50;
UndergroundRecord unk_50;
u16 unk_8C;
u16 unk_8E;
u8 unk_90;

View File

@ -1,11 +1,11 @@
#ifndef POKEPLATINUM_STRUCT_020298B0_H
#define POKEPLATINUM_STRUCT_020298B0_H
#ifndef POKEPLATINUM_STRUCT_UNDERGROUND_DATA_H
#define POKEPLATINUM_STRUCT_UNDERGROUND_DATA_H
#include "struct_defs/struct_02029894.h"
typedef struct UnkStruct_020298B0_t {
typedef struct UndergroundData {
UnkStruct_02029894 unk_00;
u32 unk_90;
u32 randomSeed;
s32 unk_94;
u8 unk_98;
u8 unused; // Set but never read
@ -33,9 +33,9 @@ typedef struct UnkStruct_020298B0_t {
u8 unk_94C[40];
u8 unk_974[40];
u8 unk_99C[15];
u8 unk_9AB;
u8 stepCount;
u8 unk_9AC_0 : 4;
u8 unk_9AC_4 : 4;
} UndergroundData;
#endif // POKEPLATINUM_STRUCT_020298B0_H
#endif // POKEPLATINUM_STRUCT_UNDERGROUND_DATA_H

View File

@ -0,0 +1,22 @@
#ifndef POKEPLATINUM_STRUCT_UNDERGROUND_RECORD_H
#define POKEPLATINUM_STRUCT_UNDERGROUND_RECORD_H
typedef struct UndergroundRecord {
u32 trainerScore : 20;
u32 peopleMet : 20;
u32 numGiftsGiven : 20;
u32 unk_0C_0 : 20;
u32 numSpheresDug : 20;
u32 numFossilsDug : 20;
u32 unk_18_0 : 20;
u32 numTrapsHit : 20;
u32 unk_20_0 : 20;
u32 unk_24_0 : 20;
u32 unk_28_0 : 20;
u32 unk_2C_0 : 20;
u32 unk_30_0 : 20;
u32 unk_34_0 : 20;
u32 capturedFlagCount : 20;
} UndergroundRecord;
#endif // POKEPLATINUM_STRUCT_UNDERGROUND_RECORD_H

View File

@ -1,19 +1,27 @@
#ifndef POKEPLATINUM_UNK_0202854C_H
#define POKEPLATINUM_UNK_0202854C_H
#include "struct_decls/struct_0202855C_decl.h"
#include "struct_decls/struct_02029894_decl.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "struct_defs/underground_record.h"
#include "savedata.h"
#include "trainer_info.h"
#define NUM_MAX_DECORATION_GOODS 200
enum BaseFlagType {
BASE_FLAG_NORMAL,
BASE_FLAG_BRONZE,
BASE_FLAG_SILVER,
BASE_FLAG_GOLD,
BASE_FLAG_PLATINUM
};
int Underground_SaveSize(void);
int sub_02028554(void);
int sub_02028558(void);
SecretBaseRecord *sub_0202855C(u32 heapID);
int UndergroundRecord_Size(void);
UndergroundRecord *UndergroundRecord_Init(u32 heapID);
void Underground_Init(UndergroundData *param0);
void sub_02028658(SaveData *saveData, int param1);
void sub_02028758(SaveData *saveData, s32 param1, BOOL param2);
@ -24,8 +32,8 @@ BOOL sub_02028810(SaveData *saveData);
void UndergroundData_SetUnusedField(UndergroundData *undergroundData);
void sub_02028830(UndergroundData *param0, const TrainerInfo *param1);
TrainerInfo *sub_020288C8(const UndergroundData *param0, int heapID, int param2);
u32 sub_02028930(UndergroundData *param0);
int sub_02028938(int param0);
u32 UndergroundData_GetRandomSeed(UndergroundData *param0);
int Underground_GetMiningItemID(int param0);
BOOL sub_0202895C(UndergroundData *param0, int param1);
BOOL sub_02028984(UndergroundData *param0, int param1);
int sub_020289A0(UndergroundData *param0);
@ -83,8 +91,8 @@ BOOL sub_02029234(UndergroundData *param0);
void sub_02029240(UndergroundData *param0);
void sub_02029250(UndergroundData *param0, int param1);
BOOL sub_02029274(UndergroundData *param0, int param1);
void sub_0202929C(UndergroundData *param0);
int sub_020292B4(UndergroundData *param0);
void UndergroundData_IncrementStepCount(UndergroundData *param0);
int UndergroundData_GetStepCount(UndergroundData *param0);
void sub_020292C0(UnkStruct_02029894 *param0);
void sub_020292CC(UnkStruct_02029894 *param0);
void sub_02029300(UnkStruct_02029894 *param0);
@ -93,46 +101,46 @@ void sub_02029364(UnkStruct_02029894 *param0, int param1, int param2, int param3
int sub_020293B0(const UnkStruct_02029894 *param0, int param1);
int sub_020293FC(const UnkStruct_02029894 *param0, int param1);
int sub_0202942C(const UnkStruct_02029894 *param0, int param1);
int sub_02029460(const UnkStruct_02029894 *param0);
int sub_0202948C(const UnkStruct_02029894 *param0);
int sub_020294B8(const SecretBaseRecord *param0);
int sub_020294C0(const SecretBaseRecord *param0);
void sub_020294D4(SecretBaseRecord *param0, int param1);
int sub_020294EC(const SecretBaseRecord *param0);
void sub_020294F4(SecretBaseRecord *param0, int param1);
int sub_02029524(const SecretBaseRecord *param0);
void sub_0202952C(SecretBaseRecord *param0);
void sub_0202955C(SecretBaseRecord *param0);
int sub_0202958C(const SecretBaseRecord *param0);
int sub_020295B8(const SecretBaseRecord *param0);
void sub_020295C0(SecretBaseRecord *param0);
int sub_020295F0(const SecretBaseRecord *param0);
void sub_020295F8(SecretBaseRecord *param0, int param1);
int sub_0202963C(const SecretBaseRecord *param0);
void sub_02029644(SecretBaseRecord *param0, int param1);
void sub_02029688(SecretBaseRecord *param0, int param1);
int sub_020296CC(const SecretBaseRecord *param0);
void sub_020296D4(SecretBaseRecord *param0);
int sub_02029704(const SecretBaseRecord *param0);
void sub_0202970C(SecretBaseRecord *param0);
int sub_0202973C(const SecretBaseRecord *param0);
void sub_02029744(SecretBaseRecord *param0);
int sub_02029774(const SecretBaseRecord *param0);
void sub_0202977C(SecretBaseRecord *param0);
int sub_020297AC(const SecretBaseRecord *param0);
void sub_020297B4(SecretBaseRecord *param0);
int sub_020297E4(const SecretBaseRecord *param0);
void sub_020297EC(SecretBaseRecord *param0);
int sub_0202981C(const SecretBaseRecord *param0);
void sub_02029824(SecretBaseRecord *param0);
int sub_GetMaxRemovableRocks(const UnkStruct_02029894 *param0);
int sub_GetMaxDisplayItemsCount(const UnkStruct_02029894 *param0);
int UndergroundRecord_GetTrainerScore(const UndergroundRecord *undergroundRecord);
BOOL UndergroundRecord_HasPlatBaseFlag(const UndergroundRecord *undergroundRecord);
void UndergroundRecord_SetTrainerScore(UndergroundRecord *undergroundRecord, int param1);
int UndergroundRecord_GetPeopleMet(const UndergroundRecord *undergroundRecord);
void UndergroundRecord_IncrementPeopleMet(UndergroundRecord *undergroundRecord, int param1);
int UndergroundRecord_GetNumGiftsGiven(const UndergroundRecord *undergroundRecord);
void UndergroundRecord_IncrementGiftsGiven(UndergroundRecord *undergroundRecord);
void sub_0202955C(UndergroundRecord *param0);
enum BaseFlagType UndergroundRecord_GetFlagRank(const UndergroundRecord *undergroundRecord);
int UndergroundRecord_GetCapturedFlagCount(const UndergroundRecord *undergroundRecord);
void UndergroundRecord_IncrementCapturedFlagCount(UndergroundRecord *undergroundRecord);
int UndergroundRecord_GetNumSpheresDug(const UndergroundRecord *undergroundRecord);
void UndergroundRecord_AddNumSpheresDug(UndergroundRecord *undergroundRecord, int amount);
int UndergroundRecord_GetNumFossilsDug(const UndergroundRecord *undergroundRecord);
void UndergroundRecord_AddNumFossilsDug(UndergroundRecord *undergroundRecord, int amount);
void sub_02029688(UndergroundRecord *param0, int param1);
int UndergroundRecord_GetNumTrapsHit(const UndergroundRecord *undergroundRecord);
void UndergroundRecord_IncrementNumTrapsHit(UndergroundRecord *undergroundRecord);
int sub_02029704(const UndergroundRecord *param0);
void sub_0202970C(UndergroundRecord *param0);
int sub_0202973C(const UndergroundRecord *param0);
void sub_02029744(UndergroundRecord *param0);
int sub_02029774(const UndergroundRecord *param0);
void sub_0202977C(UndergroundRecord *param0);
int sub_020297AC(const UndergroundRecord *param0);
void sub_020297B4(UndergroundRecord *param0);
int sub_020297E4(const UndergroundRecord *param0);
void sub_020297EC(UndergroundRecord *param0);
int sub_0202981C(const UndergroundRecord *param0);
void sub_02029824(UndergroundRecord *param0);
void sub_02029854(UnkStruct_02029894 *param0, int param1, int param2, int param3);
int sub_02029874(const UnkStruct_02029894 *param0);
int sub_0202987C(const UnkStruct_02029894 *param0);
int sub_02029884(const UnkStruct_02029894 *param0);
BOOL sub_0202988C(const UnkStruct_02029894 *param0);
UnkStruct_02029894 *sub_02029894(SaveData *saveData);
SecretBaseRecord *SaveData_SecretBaseRecord(SaveData *saveData);
SecretBaseRecord *sub_020298AC(UnkStruct_02029894 *param0);
UndergroundRecord *SaveData_UndergroundRecord(SaveData *saveData);
UndergroundRecord *sub_020298AC(UnkStruct_02029894 *param0);
UndergroundData *SaveData_GetUndergroundData(SaveData *saveData);
#endif // POKEPLATINUM_UNK_0202854C_H

View File

@ -306,7 +306,7 @@ _0443:
Return
_0448:
ScrCmd_24A VAR_RESULT
GetCapturedFlagCount VAR_RESULT
GoToIfLt VAR_RESULT, 3, _00A7
CallIfSet FLAG_UNK_0x00FC, _057A
CallIfUnset FLAG_UNK_0x00FC, _04A4
@ -326,7 +326,7 @@ _04A4:
Return
_04A9:
ScrCmd_24A VAR_RESULT
GetCapturedFlagCount VAR_RESULT
GoToIfLt VAR_RESULT, 10, _00A7
CallIfSet FLAG_UNK_0x00FC, _057A
CallIfUnset FLAG_UNK_0x00FC, _0505
@ -346,7 +346,7 @@ _0505:
Return
_050A:
ScrCmd_24A VAR_RESULT
GetCapturedFlagCount VAR_RESULT
GoToIfLt VAR_RESULT, 50, _00A7
CallIfSet FLAG_UNK_0x00FC, _057A
CallIfUnset FLAG_UNK_0x00FC, _0566

View File

@ -10,12 +10,12 @@
#include "generated/movement_actions.h"
#include "generated/trainer_score_events.h"
#include "struct_decls/struct_0202855C_decl.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_decls/struct_0205E884_decl.h"
#include "struct_decls/struct_02061AB4_decl.h"
#include "struct_defs/struct_02057B48.h"
#include "struct_defs/struct_020590C4.h"
#include "struct_defs/underground_data.h"
#include "struct_defs/underground_record.h"
#include "field/field_system.h"
#include "overlay005/ov5_021F55CC.h"
@ -920,14 +920,14 @@ void CommPlayer_RecvLocationAndInit(int netId, int size, void *src, void *unused
static void sub_02058644(int netId)
{
UndergroundData *underground = SaveData_GetUndergroundData(FieldSystem_GetSaveData(sCommPlayerManager->fieldSystem));
SaveData_SecretBaseRecord(FieldSystem_GetSaveData(sCommPlayerManager->fieldSystem));
SaveData_UndergroundRecord(FieldSystem_GetSaveData(sCommPlayerManager->fieldSystem));
if (sCommPlayerManager->isUnderground) {
if (netId == CommSys_CurNetId()) {
sub_0202929C(underground);
UndergroundData_IncrementStepCount(underground);
if (sub_020292B4(underground) == 50) {
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(sCommPlayerManager->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_37);
if (UndergroundData_GetStepCount(underground) == 50) {
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(sCommPlayerManager->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNDERGROUND_100_STEPS);
}
}
}

View File

@ -286,16 +286,16 @@ static const u16 sTrainerScoreIncrements[MAX_TRAINER_SCORE_EVENTS] = {
[TRAINER_SCORE_EVENT_UNK_25] = 40,
[TRAINER_SCORE_EVENT_UNK_26] = 500,
[TRAINER_SCORE_EVENT_UNK_27] = 10000,
[TRAINER_SCORE_EVENT_UNK_28] = 30,
[TRAINER_SCORE_EVENT_UNK_29] = 30,
[TRAINER_SCORE_EVENT_UNK_30] = 2,
[TRAINER_SCORE_EVENT_UNK_31] = 5,
[TRAINER_SCORE_EVENT_UNK_32] = 1,
[TRAINER_SCORE_EVENT_UNK_33] = 1,
[TRAINER_SCORE_EVENT_UNK_34] = 5,
[TRAINER_SCORE_EVENT_UNK_35] = 3,
[TRAINER_SCORE_EVENT_UNK_36] = 1,
[TRAINER_SCORE_EVENT_UNK_37] = 1,
[TRAINER_SCORE_EVENT_UNDERGROUND_CAPTURE_FLAG] = 30,
[TRAINER_SCORE_EVENT_UNDERGROUND_UNUSED] = 30,
[TRAINER_SCORE_EVENT_UNDERGROUND_UNCOVER_FOSSIL] = 2,
[TRAINER_SCORE_EVENT_UNDERGROUND_GIVE_PLAYER_GOODS] = 5,
[TRAINER_SCORE_EVENT_UNDERGROUND_GREET_PLAYER] = 1,
[TRAINER_SCORE_EVENT_UNDERGROUND_ASK_PLAYER_QUESTION] = 1,
[TRAINER_SCORE_EVENT_UNDERGROUND_HELP_TRAPPED_PLAYER] = 5,
[TRAINER_SCORE_EVENT_UNDERGROUND_NEW_SECRET_BASE] = 3,
[TRAINER_SCORE_EVENT_UNDERGROUND_ENTERED] = 1,
[TRAINER_SCORE_EVENT_UNDERGROUND_100_STEPS] = 1,
[TRAINER_SCORE_EVENT_UNK_38] = 7,
[TRAINER_SCORE_EVENT_UNK_39] = 7,
[TRAINER_SCORE_EVENT_UNK_40] = 7,

View File

@ -5,9 +5,9 @@
#include "generated/trainer_score_events.h"
#include "struct_decls/struct_0202855C_decl.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/struct_02099F80.h"
#include "struct_defs/underground_data.h"
#include "struct_defs/underground_record.h"
#include "field/field_system.h"
#include "field/field_system_sub2_t.h"
@ -606,7 +606,7 @@ static void ov23_0223E140(void)
void ov23_0223E1E4(void *param0, FieldSystem *fieldSystem)
{
int v0, v1;
UndergroundData *v2;
UndergroundData *undergroundData;
if (Unk_ov23_02257740) {
return;
@ -628,19 +628,19 @@ void ov23_0223E1E4(void *param0, FieldSystem *fieldSystem)
ov23_0223E140();
Unk_ov23_02257740->unk_A24 = -1;
v2 = SaveData_GetUndergroundData(Unk_ov23_02257740->fieldSystem->saveData);
undergroundData = SaveData_GetUndergroundData(Unk_ov23_02257740->fieldSystem->saveData);
if (sub_02029234(v2)) {
if (sub_02029234(undergroundData)) {
MATHRandContext16 v3;
MATH_InitRand16(&v3, sub_02028930(v2));
MATH_InitRand16(&v3, UndergroundData_GetRandomSeed(undergroundData));
for (v0 = 0; v0 < 255; v0++) {
sub_020291A4(v2, v0);
sub_020291A4(undergroundData, v0);
}
for (v0 = 0; v0 < (16 * 4); v0++) {
sub_02028EF8(v2, 0, v0, 0, 0);
sub_02028EF8(undergroundData, 0, v0, 0, 0);
}
v1 = ov23_02241DF8(&v3);
@ -650,7 +650,7 @@ void ov23_0223E1E4(void *param0, FieldSystem *fieldSystem)
ov23_0223E434(&v3, v0);
}
sub_02029240(v2);
sub_02029240(undergroundData);
} else {
ov23_0223E834();
ov23_02243CE8();
@ -2490,7 +2490,7 @@ static int ov23_0224080C(int param0)
static void ov23_022408A0(int param0, int param1)
{
int v0 = param0;
SecretBaseRecord *v1 = SaveData_SecretBaseRecord(FieldSystem_GetSaveData(Unk_ov23_02257740->fieldSystem));
UndergroundRecord *v1 = SaveData_UndergroundRecord(FieldSystem_GetSaveData(Unk_ov23_02257740->fieldSystem));
UndergroundData *v2 = SaveData_GetUndergroundData(FieldSystem_GetSaveData(Unk_ov23_02257740->fieldSystem));
if (ov23_02241CF4(v0)) {
@ -2583,7 +2583,7 @@ static BOOL ov23_022409F0(UnkStruct_ov23_0223EE80 *param0)
static BOOL ov23_02240A90(UnkStruct_ov23_0223EE80 *param0)
{
int v0, v1, v2;
SecretBaseRecord *v3 = SaveData_SecretBaseRecord(Unk_ov23_02257740->fieldSystem->saveData);
UndergroundRecord *undergroundRecord = SaveData_UndergroundRecord(Unk_ov23_02257740->fieldSystem->saveData);
UndergroundData *v4 = SaveData_GetUndergroundData(Unk_ov23_02257740->fieldSystem->saveData);
for (v0 = 0; v0 < param0->unk_0C; v0++) {
@ -2593,19 +2593,19 @@ static BOOL ov23_02240A90(UnkStruct_ov23_0223EE80 *param0)
v2 = Unk_ov23_02257740->unk_874[v0].unk_04;
if (ov23_02241CF4(v2)) {
sub_020295F8(v3, 1);
UndergroundRecord_AddNumSpheresDug(undergroundRecord, 1);
} else {
sub_0206D6C8(Unk_ov23_02257740->fieldSystem, v2, 1);
if ((v2 >= 23) && ((28 + 1) > v2) || (v2 == 36) || (v2 == 37)) {
sub_02029644(v3, 1);
UndergroundRecord_AddNumFossilsDug(undergroundRecord, 1);
{
VarsFlags *v5 = SaveData_GetVarsFlags(Unk_ov23_02257740->fieldSystem->saveData);
SystemVars_SetUndergroundFossilsUnearthed(v5, SystemVars_GetUndergroundFossilsUnearthed(v5) + 1);
}
} else {
sub_02029688(v3, 1);
sub_02029688(undergroundRecord, 1);
}
}
@ -2730,7 +2730,7 @@ static BOOL ov23_02240CFC(UnkStruct_ov23_0223EE80 *param0)
if (ov23_02240934(param0)) {
sub_02029220(v2);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(Unk_ov23_02257740->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_30);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(Unk_ov23_02257740->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNDERGROUND_UNCOVER_FOSSIL);
param0->unk_00 = 14;
param0->unk_08 = 25;
param0->unk_50 = 1;

View File

@ -5,7 +5,7 @@
#include "generated/game_records.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "field/field_system.h"
#include "overlay005/ov5_021F575C.h"

View File

@ -4,8 +4,8 @@
#include <string.h>
#include "struct_decls/struct_02029894_decl.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_decls/struct_02061AB4_decl.h"
#include "struct_defs/underground_data.h"
#include "field/field_system.h"
#include "overlay005/land_data.h"
@ -787,7 +787,7 @@ void ov23_02242BC0(FieldSystem *fieldSystem)
ov23_0223E1E4(v0, fieldSystem);
v0 = Heap_AllocFromHeap(HEAP_ID_COMMUNICATION, ov23_02253608());
ov23_02253598(v0, SaveData_SecretBaseRecord(FieldSystem_GetSaveData(fieldSystem)), FieldSystem_GetSaveData(fieldSystem));
ov23_02253598(v0, SaveData_UndergroundRecord(FieldSystem_GetSaveData(fieldSystem)), FieldSystem_GetSaveData(fieldSystem));
ov23_0224F588(SaveData_GetUndergroundData(FieldSystem_GetSaveData(fieldSystem)));
}
}

View File

@ -5,8 +5,8 @@
#include "generated/trainer_score_events.h"
#include "struct_decls/struct_0202855C_decl.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "struct_defs/underground_record.h"
#include "field/field_system.h"
#include "overlay005/ov5_021EAFA4.h"
@ -1542,13 +1542,13 @@ BOOL ov23_02244470(int param0)
void ov23_0224448C(int param0, int param1, void *param2, void *param3)
{
UnkStruct_ov23_02244140 *v0 = (UnkStruct_ov23_02244140 *)param2;
SecretBaseRecord *v1;
UndergroundRecord *v1;
if (!Unk_ov23_02257764) {
return;
}
v1 = SaveData_SecretBaseRecord(FieldSystem_GetSaveData(Unk_ov23_02257764->fieldSystem));
v1 = SaveData_UndergroundRecord(FieldSystem_GetSaveData(Unk_ov23_02257764->fieldSystem));
Sound_PlayEffect(SEQ_SE_DP_UG_007);
MI_CpuCopy8(v0, &Unk_ov23_02257764->unk_B28[v0->unk_07_0], sizeof(UnkStruct_ov23_02244140));
@ -1585,7 +1585,7 @@ void ov23_0224448C(int param0, int param1, void *param2, void *param3)
if (CommSys_CurNetId() == v0->unk_06) {
if (v0->unk_06 != v0->unk_07_0) {
sub_020296D4(v1);
UndergroundRecord_IncrementNumTrapsHit(v1);
}
{
@ -2542,13 +2542,13 @@ void ov23_02245560(int param0, int param1)
void ov23_022455B4(int param0, int param1, void *param2, void *param3)
{
UnkStruct_ov23_02245560 *v0 = param2;
SecretBaseRecord *v1 = SaveData_SecretBaseRecord(FieldSystem_GetSaveData(Unk_ov23_02257764->fieldSystem));
UndergroundRecord *v1 = SaveData_UndergroundRecord(FieldSystem_GetSaveData(Unk_ov23_02257764->fieldSystem));
ov23_0224B024(v0->unk_01);
if (v0->unk_00 == CommSys_CurNetId()) {
sub_02029744(v1);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(Unk_ov23_02257764->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_34);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(Unk_ov23_02257764->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNDERGROUND_HELP_TRAPPED_PLAYER);
sub_020594FC();
ov23_02254068(ov23_0224219C(), CommInfo_TrainerInfo(v0->unk_01));

View File

@ -3,7 +3,7 @@
#include <nitro.h>
#include <string.h>
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "overlay023/funcptr_ov23_02248D20.h"
#include "overlay023/struct_ov23_02248D20.h"

View File

@ -91,7 +91,7 @@ void ov23_02249A2C(void)
FieldCommunicationManager *v0 = FieldCommMan_Get();
v0->unk_41 = 1;
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(v0->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_36);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(v0->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNDERGROUND_ENTERED);
ov23_02242BC0(v0->fieldSystem);
ov23_02249C24(ov23_02249C34, 0);

View File

@ -6,8 +6,8 @@
#include "generated/trainer_score_events.h"
#include "struct_decls/struct_0202855C_decl.h"
#include "struct_defs/struct_02057B48.h"
#include "struct_defs/underground_record.h"
#include "field/field_system.h"
#include "overlay005/ov5_021F50BC.h"
@ -82,7 +82,7 @@ static void ov23_0224A204(int param0)
if (param0 == CommSys_CurNetId()) {
if (commPlayerMan->unk_290[param0] != NULL) {
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(commPlayerMan->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_28);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(commPlayerMan->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNDERGROUND_CAPTURE_FLAG);
if (commPlayerMan->unk_27C[5 - 1]) {
Heap_FreeToHeap(commPlayerMan->unk_27C[5 - 1]);
@ -227,7 +227,7 @@ void ov23_0224A410(int param0, int param1, void *param2, void *param3)
commPlayerMan->unk_58.unk_00_9 = 0;
if (commPlayerMan->unk_5A[v1->unk_02] == 0) {
sub_020294F4(SaveData_SecretBaseRecord(FieldSystem_GetSaveData(commPlayerMan->fieldSystem)), v1->unk_02);
UndergroundRecord_IncrementPeopleMet(SaveData_UndergroundRecord(FieldSystem_GetSaveData(commPlayerMan->fieldSystem)), v1->unk_02);
SystemVars_SetSpiritombCounter(v2, SystemVars_GetSpiritombCounter(v2) + 1);
SystemVars_SetUndergroundTalkCounter(v2, SystemVars_GetUndergroundTalkCounter(v2) + 1);
@ -365,7 +365,7 @@ BOOL ov23_0224A6B8(int param0)
return 1;
}
static void ov23_0224A6E4(UnkStruct_ov23_0224A570 *param0, BOOL param1, SecretBaseRecord *param2)
static void ov23_0224A6E4(UnkStruct_ov23_0224A570 *param0, BOOL param1, UndergroundRecord *param2)
{
CommPlayerManager *commPlayerMan = CommPlayerMan_Get();
@ -395,7 +395,7 @@ void ov23_0224A77C(int param0, int param1, void *param2, void *param3)
UnkStruct_ov23_0224A570 *v1 = param2;
BOOL v2;
int v3 = 0;
SecretBaseRecord *v4 = SaveData_SecretBaseRecord(FieldSystem_GetSaveData(commPlayerMan->fieldSystem));
UndergroundRecord *v4 = SaveData_UndergroundRecord(FieldSystem_GetSaveData(commPlayerMan->fieldSystem));
switch (v1->unk_00) {
case 0:
@ -469,10 +469,10 @@ void ov23_0224A77C(int param0, int param1, void *param2, void *param3)
ov23_0224B040(v1->unk_01);
if (v1->unk_01 == CommSys_CurNetId()) {
SecretBaseRecord *v5 = SaveData_SecretBaseRecord(FieldSystem_GetSaveData(commPlayerMan->fieldSystem));
u8 v6 = sub_0202958C(v5);
UndergroundRecord *undergroundRecord = SaveData_UndergroundRecord(FieldSystem_GetSaveData(commPlayerMan->fieldSystem));
u8 flagRank = UndergroundRecord_GetFlagRank(undergroundRecord);
sub_020295C0(v5);
UndergroundRecord_IncrementCapturedFlagCount(undergroundRecord);
SystemFlag_SetDeliveredStolenFlag(SaveData_GetVarsFlags(commPlayerMan->fieldSystem->saveData));
if (commPlayerMan->unk_290[v1->unk_01]) {
@ -486,10 +486,10 @@ void ov23_0224A77C(int param0, int param1, void *param2, void *param3)
sub_020594FC();
Sound_PlayEffect(SEQ_SE_DP_UG_027);
if (v6 == sub_0202958C(v5)) {
if (flagRank == UndergroundRecord_GetFlagRank(undergroundRecord)) {
ov23_02253F40(ov23_022421AC(), 7, 1, ov23_0224A300);
} else {
CommSys_SendDataFixedSize(96, &v6);
CommSys_SendDataFixedSize(96, &flagRank);
}
Sound_FadeOutAndPlayBGM(4, SEQ_TANKOU, 60, 0, 0xff, NULL);
@ -805,7 +805,7 @@ BOOL ov23_0224AEC4(int param0, int param1)
TrainerInfo_Copy(v1, (TrainerInfo *)&v0->unk_14A[param0].unk_00);
if (param1 == CommSys_CurNetId()) {
SecretBaseRecord *v2 = SaveData_SecretBaseRecord(v0->fieldSystem->saveData);
UndergroundRecord *v2 = SaveData_UndergroundRecord(v0->fieldSystem->saveData);
sub_020297B4(v2);
}

View File

@ -6,9 +6,9 @@
#include "generated/movement_actions.h"
#include "generated/trainer_score_events.h"
#include "struct_decls/struct_0202855C_decl.h"
#include "struct_decls/struct_02029894_decl.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "struct_defs/underground_record.h"
#include "field/field_system.h"
#include "overlay005/map_prop.h"
@ -375,12 +375,12 @@ void ov23_0224B144(void *param0, FieldSystem *fieldSystem)
void ov23_0224B2C8(FieldSystem *fieldSystem)
{
UnkStruct_02029894 *v0;
SecretBaseRecord *v1;
UndergroundRecord *undergroundRecord;
v0 = sub_02029894(FieldSystem_GetSaveData(fieldSystem));
v1 = sub_020298AC(v0);
undergroundRecord = sub_020298AC(v0);
sub_020294D4(v1, GameRecords_GetTrainerScore(SaveData_GetGameRecords(fieldSystem->saveData)));
UndergroundRecord_SetTrainerScore(undergroundRecord, GameRecords_GetTrainerScore(SaveData_GetGameRecords(fieldSystem->saveData)));
MI_CpuCopy8(v0, Unk_ov23_022577AC->unk_08[16].unk_02, 148);
ov23_0224B39C(v0, Unk_ov23_022577AC->unk_A04[16]);
@ -1977,7 +1977,7 @@ static void ov23_0224CEC8(void)
void ov23_0224CF18(int param0, int param1, void *param2, void *param3)
{
UnkStruct_ov23_0224CF18 *v0 = param2;
SecretBaseRecord *v1 = SaveData_SecretBaseRecord(FieldSystem_GetSaveData(Unk_ov23_022577AC->fieldSystem));
UndergroundRecord *undergroundRecord = SaveData_UndergroundRecord(FieldSystem_GetSaveData(Unk_ov23_022577AC->fieldSystem));
if (v0->unk_00 != CommSys_CurNetId()) {
return;
@ -2008,14 +2008,14 @@ void ov23_0224CF18(int param0, int param1, void *param2, void *param3)
ov23_0224C1EC(v3, v4, v5, 16);
if (v0->unk_01 == 3) {
sub_02029824(v1);
sub_02029824(undergroundRecord);
}
if (v0->unk_01 == 3 || v0->unk_01 == 4) {
void *journalEntryLocationEvent = JournalEntry_CreateEventBuiltSecretBase(HEAP_ID_FIELDMAP);
JournalEntry_SaveData(Unk_ov23_022577AC->fieldSystem->journalEntry, journalEntryLocationEvent, JOURNAL_LOCATION);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(Unk_ov23_022577AC->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_35);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(Unk_ov23_022577AC->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNDERGROUND_NEW_SECRET_BASE);
}
}
}
@ -2297,7 +2297,7 @@ void ov23_0224D4CC(int param0, int param1, void *param2, void *param3)
{
u8 *v0 = param2;
UnkStruct_02029894 *v1 = (UnkStruct_02029894 *)Unk_ov23_022577AC->unk_A00->unk_02;
SecretBaseRecord *v2 = sub_020298AC(v1);
UndergroundRecord *v2 = sub_020298AC(v1);
if (v0[0] == CommSys_CurNetId()) {
ov23_02253A00(v2, v0[1]);

View File

@ -459,7 +459,7 @@ static void ov23_0224E124(UnkStruct_ov23_0224E280 *param0)
ov23_022540F4(ov23_0224219C(), param0->unk_28.unk_02);
ov23_02253F40(ov23_0224219C(), 14, 0, NULL);
sub_0202952C(SaveData_SecretBaseRecord(FieldSystem_GetSaveData(param0->fieldSystem)));
UndergroundRecord_IncrementGiftsGiven(SaveData_UndergroundRecord(FieldSystem_GetSaveData(param0->fieldSystem)));
ov23_0224F634(param0->unk_28.unk_02);
Sound_PlayEffect(SEQ_SE_DP_PIRORIRO2);
}
@ -631,7 +631,7 @@ static void ov23_0224E2D8(SysTask *param0, void *param1)
case 10:
break;
case 11:
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(v0->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_32);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(v0->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNDERGROUND_GREET_PLAYER);
ov23_022539E8();
ov23_0224DC68(v0, 9);
v0->unk_37 = 12;
@ -727,7 +727,7 @@ static void ov23_0224E2D8(SysTask *param0, void *param1)
SystemVars_SetUndergroundItemsGivenAway(v2, SystemVars_GetUndergroundItemsGivenAway(v2) + 1);
}
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(v0->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_31);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(v0->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNDERGROUND_GIVE_PLAYER_GOODS);
v0->unk_37 = 25;
break;
case 25:
@ -795,7 +795,7 @@ static void ov23_0224E2D8(SysTask *param0, void *param1)
break;
case 36:
if (ov23_02254238(ov23_0224219C()) == 0) {
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(v0->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_33);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecords(v0->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNDERGROUND_ASK_PLAYER_QUESTION);
ov23_0224DC68(v0, 142);
v0->unk_37 = 37;
}
@ -894,7 +894,7 @@ static void ov23_0224E93C(SysTask *param0, UnkStruct_ov23_022577B0 *param1)
if (v0 == 0) {
if (ov23_0224F744(param1->unk_24.unk_02)) {
sub_0202977C(SaveData_SecretBaseRecord(FieldSystem_GetSaveData(param1->fieldSystem)));
sub_0202977C(SaveData_UndergroundRecord(FieldSystem_GetSaveData(param1->fieldSystem)));
Sound_PlayEffect(SEQ_SE_DP_PIRORIRO2);
ov23_0224DC40(param1, 22);

View File

@ -3,7 +3,7 @@
#include <nitro.h>
#include <string.h>
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "field/field_system.h"
#include "overlay005/ov5_021D2F14.h"
@ -1310,7 +1310,7 @@ static BOOL ov23_022507D8(SysTask *param0, void *param1)
ov23_0224FCF4(v0);
if (v1 == 3) {
int item = sub_02028938(Unk_ov23_022577B8->unk_05);
int item = Underground_GetMiningItemID(Unk_ov23_022577B8->unk_05);
Bag *v4 = SaveData_GetBag(v0->fieldSystem->saveData);
Sound_PlayEffect(SEQ_SE_CONFIRM);

View File

@ -3,7 +3,7 @@
#include <nitro.h>
#include <string.h>
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "field/field_system.h"
#include "overlay023/funcptr_ov23_022515D8.h"
@ -343,7 +343,7 @@ static void ov23_022515D8(UnkStruct_ov23_02250CD4 *param0, int param1, int param
int v1 = param2 + 1;
BOOL v2 = 1;
if (3 > sub_0202958C(SaveData_SecretBaseRecord(param0->fieldSystem->saveData))) {
if (BASE_FLAG_GOLD > UndergroundRecord_GetFlagRank(SaveData_UndergroundRecord(param0->fieldSystem->saveData))) {
v2 = 0;
v1 -= 1;
}

View File

@ -3,8 +3,8 @@
#include <nitro.h>
#include <string.h>
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_decls/struct_02061AB4_decl.h"
#include "struct_defs/underground_data.h"
#include "field/field_system.h"
#include "overlay023/ov23_02241F74.h"
@ -88,7 +88,7 @@ static void ov23_022521F0(UnkStruct_ov23_02250CD4 *param0, int param1)
int v1, v2, v3, v4, v5;
UndergroundData *v6 = SaveData_GetUndergroundData(FieldSystem_GetSaveData(param0->fieldSystem));
MATH_InitRand16(&v0, sub_02028930(v6) + param1);
MATH_InitRand16(&v0, UndergroundData_GetRandomSeed(v6) + param1);
for (v5 = 0; v5 < 5; v5++) {
if (v5 == 0) {
@ -135,7 +135,7 @@ static void ov23_022522F0(UnkStruct_ov23_02250CD4 *param0, int param1)
UndergroundData *v7 = SaveData_GetUndergroundData(saveData);
BOOL natdexObtained = Pokedex_IsNationalDexObtained(SaveData_GetPokedex(saveData));
MATH_InitRand16(&v0, sub_02028930(v7) + param1);
MATH_InitRand16(&v0, UndergroundData_GetRandomSeed(v7) + param1);
for (v5 = 0; v5 < 5; v5++) {
v1 = MATH_Rand16(&v0, 139 - 1) + 1;
@ -308,7 +308,7 @@ static void ov23_02252754(ListMenu *param0, u32 param1, u8 param2)
if (param1 != 0xfffffffe) {
if (v1->unk_2AC == 1) {
v6 = ov23_0224F66C(v3, v1);
MATH_InitRand16(&v0, sub_02028930(v2) + v1->unk_288 + v6);
MATH_InitRand16(&v0, UndergroundData_GetRandomSeed(v2) + v1->unk_288 + v6);
v7 = ov23_0225429C(v6);
if (v7 == 6) {
@ -321,7 +321,7 @@ static void ov23_02252754(ListMenu *param0, u32 param1, u8 param2)
v8 = v8 / 2;
} else if (v1->unk_2AC == 0) {
v6 = ov23_0224F61C(v3, v1);
MATH_InitRand16(&v0, sub_02028930(v2) + v1->unk_288 + v6);
MATH_InitRand16(&v0, UndergroundData_GetRandomSeed(v2) + v1->unk_288 + v6);
v7 = sub_0205742C(v6);
if (v7 == 6) {
@ -334,7 +334,7 @@ static void ov23_02252754(ListMenu *param0, u32 param1, u8 param2)
v8 = v8 / 2;
} else {
v6 = ov23_0224F6C8(v3, v1);
MATH_InitRand16(&v0, sub_02028930(v2) + v1->unk_288 + v6);
MATH_InitRand16(&v0, UndergroundData_GetRandomSeed(v2) + v1->unk_288 + v6);
v7 = ov23_0225426C(v6);
if (v7 == 6) {

View File

@ -5,8 +5,8 @@
#include "constants/heap.h"
#include "struct_decls/struct_0202855C_decl.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "struct_defs/underground_record.h"
#include "overlay023/funcptr_ov23_0224DCB8.h"
#include "overlay023/funcptr_ov23_02253834.h"
@ -34,7 +34,7 @@
#include "trainer_info.h"
#include "unk_0202854C.h"
typedef int (*UnkFuncPtr_ov23_022576EC)(const SecretBaseRecord *);
typedef int (*UnkFuncPtr_ov23_022576EC)(const UndergroundRecord *);
typedef struct {
UnkFuncPtr_ov23_02253834 unk_00;
@ -51,8 +51,8 @@ typedef struct UnkStruct_ov23_02253598_t {
UnkStruct_ov23_022537D4 *unk_00;
SysTask *unk_04;
SaveData *saveData;
SecretBaseRecord *unk_0C;
SecretBaseRecord *unk_10;
UndergroundRecord *unk_0C;
UndergroundRecord *unk_10;
MATHRandContext32 unk_14;
u8 unk_2C;
};
@ -60,14 +60,14 @@ typedef struct UnkStruct_ov23_02253598_t {
static UnkStruct_ov23_02253598 *Unk_ov23_022577BC = NULL;
static void ov23_022537D4(SysTask *param0, void *param1);
void ov23_02253598(UnkStruct_ov23_02253598 *param0, SecretBaseRecord *param1, SaveData *saveData)
void ov23_02253598(UnkStruct_ov23_02253598 *param0, UndergroundRecord *param1, SaveData *saveData)
{
MI_CpuFill8(param0, 0, sizeof(UnkStruct_ov23_02253598));
Unk_ov23_022577BC = param0;
Unk_ov23_022577BC->saveData = saveData;
Unk_ov23_022577BC->unk_0C = param1;
Unk_ov23_022577BC->unk_10 = sub_0202855C(HEAP_ID_COMMUNICATION);
Unk_ov23_022577BC->unk_10 = UndergroundRecord_Init(HEAP_ID_COMMUNICATION);
CommSys_Seed(&Unk_ov23_022577BC->unk_14);
}
@ -98,23 +98,23 @@ int ov23_02253608(void)
}
static UnkFuncPtr_ov23_022576EC Unk_ov23_022576EC[] = {
sub_020294B8,
sub_020294EC,
sub_02029524,
sub_020295B8,
sub_020295F0,
sub_0202963C,
sub_020296CC,
UndergroundRecord_GetTrainerScore,
UndergroundRecord_GetPeopleMet,
UndergroundRecord_GetNumGiftsGiven,
UndergroundRecord_GetCapturedFlagCount,
UndergroundRecord_GetNumSpheresDug,
UndergroundRecord_GetNumFossilsDug,
UndergroundRecord_GetNumTrapsHit,
sub_02029704,
sub_0202973C,
sub_02029774,
sub_020297AC,
sub_020297E4,
sub_0202981C,
sub_020295B8
UndergroundRecord_GetCapturedFlagCount
};
static void ov23_0225360C(Window *param0, MessageLoader *param1, TrainerInfo *param2, const SecretBaseRecord *param3)
static void ov23_0225360C(Window *param0, MessageLoader *param1, TrainerInfo *param2, const UndergroundRecord *param3)
{
StringTemplate *v0;
Strbuf *v1;
@ -152,7 +152,7 @@ static void ov23_0225360C(Window *param0, MessageLoader *param1, TrainerInfo *pa
StringTemplate_Format(v0, v2, v1);
Text_AddPrinterWithParams(param0, FONT_SYSTEM, v2, v7 + v9, 1, TEXT_SPEED_NO_TRANSFER, NULL);
v3 = sub_0202958C(param3);
v3 = UndergroundRecord_GetFlagRank(param3);
MessageLoader_GetStrbuf(param1, 20 + v3, v1);
Text_AddPrinterWithParams(param0, FONT_SYSTEM, v1, v7 + v9, v5, TEXT_SPEED_NO_TRANSFER, NULL);
@ -210,7 +210,7 @@ static void ov23_0225381C(SysTask *param0, void *param1)
void ov23_02253834(BgConfig *param0, TrainerInfo *param1, UnkFuncPtr_ov23_02253834 param2, void *param3, BOOL param4)
{
SecretBaseRecord *v0;
UndergroundRecord *v0;
MessageLoader *v1;
ListMenuTemplate v2;
int v3 = 10;
@ -246,34 +246,34 @@ void ov23_02253834(BgConfig *param0, TrainerInfo *param1, UnkFuncPtr_ov23_022538
void ov23_022538FC(int param0)
{
int v0 = sub_02028558();
int v1 = GameRecords_GetTrainerScore(SaveData_GetGameRecords(Unk_ov23_022577BC->saveData));
u8 *v2 = Heap_AllocFromHeap(HEAP_ID_FIELD, v0 + 1);
int undergroundRecordSize = UndergroundRecord_Size();
int trainerScore = GameRecords_GetTrainerScore(SaveData_GetGameRecords(Unk_ov23_022577BC->saveData));
u8 *v2 = Heap_AllocFromHeap(HEAP_ID_FIELD, undergroundRecordSize + 1);
MI_CpuClear8(v2, v0 + 1);
MI_CpuClear8(v2, undergroundRecordSize + 1);
v2[0] = param0;
if (v1 >= 999999) {
v1 = 999999;
if (trainerScore >= 999999) {
trainerScore = 999999;
}
sub_020294D4(Unk_ov23_022577BC->unk_0C, v1);
UndergroundRecord_SetTrainerScore(Unk_ov23_022577BC->unk_0C, trainerScore);
MI_CpuCopy8(Unk_ov23_022577BC->unk_0C, &v2[1], v0);
MI_CpuCopy8(Unk_ov23_022577BC->unk_0C, &v2[1], undergroundRecordSize);
CommSys_SendData(81, v2, v0 + 1);
CommSys_SendData(81, v2, undergroundRecordSize + 1);
Heap_FreeToHeap(v2);
}
void ov23_02253968(void)
{
int v0 = GameRecords_GetTrainerScore(SaveData_GetGameRecords(Unk_ov23_022577BC->saveData));
int trainerScore = GameRecords_GetTrainerScore(SaveData_GetGameRecords(Unk_ov23_022577BC->saveData));
if (v0 >= 999999) {
v0 = 999999;
if (trainerScore >= 999999) {
trainerScore = 999999;
}
sub_020294D4(Unk_ov23_022577BC->unk_0C, v0);
UndergroundRecord_SetTrainerScore(Unk_ov23_022577BC->unk_0C, trainerScore);
}
void ov23_02253998(int param0, int param1, void *param2, void *param3)
@ -306,10 +306,10 @@ static void ov23_022539F8(int param0)
sub_02059514();
}
void ov23_02253A00(SecretBaseRecord *param0, int param1)
void ov23_02253A00(UndergroundRecord *undergroundRecord, int param1)
{
s32 v0;
SecretBaseRecord *v1;
UndergroundRecord *undergroundRecordBuffer;
UnkFuncPtr_ov23_022576EC v2 = Unk_ov23_022576EC[param1 - 32];
GF_ASSERT(param1 >= 32);
@ -318,17 +318,17 @@ void ov23_02253A00(SecretBaseRecord *param0, int param1)
sub_020594FC();
ov23_02253DFC(ov23_022421BC(), 640, 1);
v1 = sub_0202855C(HEAP_ID_FIELD);
MI_CpuCopy8(param0, v1, sub_02028558());
undergroundRecordBuffer = UndergroundRecord_Init(HEAP_ID_FIELD);
MI_CpuCopy8(undergroundRecord, undergroundRecordBuffer, UndergroundRecord_Size());
v0 = v2(v1);
Heap_FreeToHeap(v1);
v0 = v2(undergroundRecordBuffer);
Heap_FreeToHeap(undergroundRecordBuffer);
ov23_02254178(ov23_022421BC(), v0);
ov23_02253F40(ov23_022421BC(), param1, 1, ov23_022539F8);
}
static void ov23_02253A78(Window *param0, MessageLoader *param1, TrainerInfo *param2, const SecretBaseRecord *param3, const UndergroundData *param4)
static void ov23_02253A78(Window *param0, MessageLoader *param1, TrainerInfo *param2, const UndergroundRecord *param3, const UndergroundData *param4)
{
StringTemplate *v0;
Strbuf *v1;
@ -355,7 +355,7 @@ static void ov23_02253A78(Window *param0, MessageLoader *param1, TrainerInfo *pa
MessageLoader_GetStrbuf(param1, 13, v1);
Text_AddPrinterWithParams(param0, FONT_SYSTEM, v1, v7, 1 + v8, TEXT_SPEED_NO_TRANSFER, NULL);
StringTemplate_SetNumber(v0, 6, sub_020295B8(param3), 6, 1, 1);
StringTemplate_SetNumber(v0, 6, UndergroundRecord_GetCapturedFlagCount(param3), 6, 1, 1);
MessageLoader_GetStrbuf(param1, 14, v1);
StringTemplate_Format(v0, v2, v1);
Text_AddPrinterWithParams(param0, FONT_SYSTEM, v2, v7 + 100, 1 + v8, TEXT_SPEED_NO_TRANSFER, NULL);
@ -393,7 +393,7 @@ static void ov23_02253A78(Window *param0, MessageLoader *param1, TrainerInfo *pa
void *ov23_02253C64(BgConfig *param0, TrainerInfo *param1, UndergroundData *param2, UnkFuncPtr_ov23_02253834 param3, void *param4)
{
SecretBaseRecord *v0;
UndergroundRecord *v0;
MessageLoader *v1;
ListMenuTemplate v2;
int v3 = 10;

View File

@ -3,8 +3,8 @@
#include <nitro.h>
#include <string.h>
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/struct_0206A844.h"
#include "struct_defs/underground_data.h"
#include "field/field_system.h"
#include "overlay023/ov23_02241F74.h"

View File

@ -4,7 +4,7 @@
#include <string.h>
#include "struct_decls/struct_02029894_decl.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "field/field_system.h"
#include "field/field_system_sub2_t.h"
@ -106,8 +106,8 @@ typedef struct {
u8 unk_51E;
u8 unk_51F;
u8 unk_520;
u8 unk_521;
u8 unk_522;
u8 secretBaseMaxRemovableRocks;
u8 secretBaseMaxDisplayItems;
} UnkStruct_ov23_02256098;
static BOOL ov23_02254C84(FieldTask *param0);
@ -302,7 +302,7 @@ static BOOL ov23_02254C84(FieldTask *param0)
return 1;
}
if (v2->unk_51F + 1 > v2->unk_522) {
if (v2->unk_51F + 1 > v2->secretBaseMaxDisplayItems) {
v2->unk_08 = ov23_0224D39C(20);
v2->unk_51E = 0;
ov23_02255EBC(8, v2);
@ -310,7 +310,7 @@ static BOOL ov23_02254C84(FieldTask *param0)
}
}
ov23_022545C4(v2->unk_508, v2->unk_51F, v2->unk_522);
ov23_022545C4(v2->unk_508, v2->unk_51F, v2->secretBaseMaxDisplayItems);
ov23_02255EBC(4, v2);
return 1;
case 1:
@ -645,12 +645,12 @@ static BOOL ov23_02255100(FieldTask *param0)
ov23_0224D3BC(v7->unk_5C[v16].unk_04.unk_14);
if (v7->unk_5C[v16].unk_04.unk_14 == 6) {
if (v7->unk_521 == 16) {
if (v7->secretBaseMaxRemovableRocks == 16) {
v7->unk_08 = ov23_0224D39C(15);
v7->unk_51E = 0;
v7->unk_04 = 4;
break;
} else if (v7->unk_520 - 1 < v7->unk_521) {
} else if (v7->unk_520 - 1 < v7->secretBaseMaxRemovableRocks) {
v7->unk_08 = ov23_0224D39C(18);
v7->unk_51E = 0;
v7->unk_04 = 4;
@ -699,7 +699,7 @@ static BOOL ov23_02255100(FieldTask *param0)
int v18;
ov23_0224D3B0();
v18 = v7->unk_520 - v7->unk_521;
v18 = v7->unk_520 - v7->secretBaseMaxRemovableRocks;
GF_ASSERT(v18 >= 0);
if (v18 == 0) {
@ -733,7 +733,7 @@ static BOOL ov23_02255100(FieldTask *param0)
if ((v7->unk_51E++) >= 10) {
int v19;
v19 = v7->unk_520 - v7->unk_521;
v19 = v7->unk_520 - v7->secretBaseMaxRemovableRocks;
ov23_0224D3D0(v19, 0);
if (v19 == 1) {
@ -1160,8 +1160,8 @@ static void ov23_02255C78(FieldSystem *fieldSystem, UnkStruct_ov23_02256098 *par
param1->unk_51F = 0;
param1->unk_520 = 0;
param1->unk_521 = sub_02029460(v4);
param1->unk_522 = sub_0202948C(v4);
param1->secretBaseMaxRemovableRocks = sub_GetMaxRemovableRocks(v4);
param1->secretBaseMaxDisplayItems = sub_GetMaxDisplayItemsCount(v4);
for (v0 = 0; v0 < 32; v0++) {
v1 = sub_020293B0(v4, v0);

View File

@ -24,8 +24,6 @@
#include "struct_decls/pokedexdata_decl.h"
#include "struct_decls/struct_02014EC4_decl.h"
#include "struct_decls/struct_0202440C_decl.h"
#include "struct_decls/struct_0202855C_decl.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_decls/struct_02029C68_decl.h"
#include "struct_decls/struct_02029C88_decl.h"
#include "struct_decls/struct_02029D04_decl.h"
@ -47,6 +45,8 @@
#include "struct_defs/struct_02042434.h"
#include "struct_defs/struct_0204AFC4.h"
#include "struct_defs/struct_02098C44.h"
#include "struct_defs/underground_data.h"
#include "struct_defs/underground_record.h"
#include "applications/pokemon_summary_screen/main.h"
#include "field/field_system.h"
@ -627,7 +627,7 @@ static BOOL ScrCmd_244(ScriptContext *ctx);
static BOOL ScrCmd_245(ScriptContext *ctx);
static BOOL ScrCmd_246(ScriptContext *ctx);
static BOOL ScrCmd_249(ScriptContext *ctx);
static BOOL ScrCmd_24A(ScriptContext *ctx);
static BOOL ScrCmd_GetCapturedFlagCount(ScriptContext *ctx);
static BOOL ScrCmd_24B(ScriptContext *ctx);
static BOOL ScrCmd_24C(ScriptContext *ctx);
static BOOL ScrCmd_24D(ScriptContext *ctx);
@ -1355,7 +1355,7 @@ const ScrCmdFunc Unk_020EAC58[] = {
ScrCmd_GetFirstNonEggInParty,
ScrCmd_248,
ScrCmd_249,
ScrCmd_24A,
ScrCmd_GetCapturedFlagCount,
ScrCmd_24B,
ScrCmd_24C,
ScrCmd_24D,
@ -6453,15 +6453,15 @@ static BOOL ScrCmd_249(ScriptContext *ctx)
return FALSE;
}
static BOOL ScrCmd_24A(ScriptContext *ctx)
static BOOL ScrCmd_GetCapturedFlagCount(ScriptContext *ctx)
{
FieldSystem *fieldSystem = ctx->fieldSystem;
SaveData *saveData = fieldSystem->saveData;
SecretBaseRecord *v2;
u16 *v3 = ScriptContext_GetVarPointer(ctx);
UndergroundRecord *undergroundRecord;
u16 *destFlagCount = ScriptContext_GetVarPointer(ctx);
v2 = SaveData_SecretBaseRecord(saveData);
*v3 = sub_020295B8(v2);
undergroundRecord = SaveData_UndergroundRecord(saveData);
*destFlagCount = UndergroundRecord_GetCapturedFlagCount(undergroundRecord);
return FALSE;
}

View File

@ -3,11 +3,13 @@
#include <nitro.h>
#include <string.h>
#include "struct_defs/struct_0202855C.h"
#include "constants/items.h"
#include "struct_defs/struct_02029894.h"
#include "struct_defs/struct_02029894_sub1.h"
#include "struct_defs/struct_02029894_sub2.h"
#include "struct_defs/struct_020298B0.h"
#include "struct_defs/underground_data.h"
#include "struct_defs/underground_record.h"
#include "heap.h"
#include "math_util.h"
@ -16,58 +18,64 @@
#include "system.h"
#include "trainer_info.h"
static void sub_02028B48(UndergroundData *param0, int param1, int param2);
#define FLAG_CAPTURED_COUNT_PLATINUM 50
#define FLAG_CAPTURED_COUNT_GOLD 10
#define FLAG_CAPTURED_COUNT_SILVER 3
#define FLAG_CAPTURED_COUNT_BRONZE 1
#define FLAG_CAPTURED_COUNT_NORMAL 0
u16 Unk_02100920[] = {
0x6E,
0x6F,
0x50,
0x5B,
0x51,
0xEE,
0x53,
0xE5,
0x52,
0x54,
0x55,
0x5C,
0x65,
0x66,
0x64,
0x63,
0x67,
0x6A,
0x1C,
0x1D,
0x48,
0x49,
0x4A,
0x4B,
0x5D,
0x68,
0x69,
0x10D,
0x116,
0x11A,
0x11B,
0x11C,
0x11D,
0x12A,
0x12B,
0x12C,
0x12D,
0x12E,
0x12F,
0x130,
0x131,
0x132,
0x133,
0x134,
0x135,
0x136,
0x137,
0x138,
0x139
static void sub_02028B48(UndergroundData *undergroundData, int param1, int param2);
static u16 sMiningItems[] = {
[0] = ITEM_OVAL_STONE,
[1] = ITEM_ODD_KEYSTONE,
[2] = ITEM_SUN_STONE,
[3] = ITEM_STAR_PIECE,
[4] = ITEM_MOON_STONE,
[5] = ITEM_HARD_STONE,
[6] = ITEM_THUNDERSTONE,
[7] = ITEM_EVERSTONE,
[8] = ITEM_FIRE_STONE,
[9] = ITEM_WATER_STONE,
[10] = ITEM_LEAF_STONE,
[11] = ITEM_NUGGET,
[12] = ITEM_HELIX_FOSSIL,
[13] = ITEM_DOME_FOSSIL,
[14] = ITEM_CLAW_FOSSIL,
[15] = ITEM_ROOT_FOSSIL,
[16] = ITEM_OLD_AMBER,
[17] = ITEM_RARE_BONE,
[18] = ITEM_REVIVE,
[19] = ITEM_MAX_REVIVE,
[20] = ITEM_RED_SHARD,
[21] = ITEM_BLUE_SHARD,
[22] = ITEM_YELLOW_SHARD,
[23] = ITEM_GREEN_SHARD,
[24] = ITEM_HEART_SCALE,
[25] = ITEM_ARMOR_FOSSIL,
[26] = ITEM_SKULL_FOSSIL,
[27] = ITEM_LIGHT_CLAY,
[28] = ITEM_IRON_BALL,
[29] = ITEM_ICY_ROCK,
[30] = ITEM_SMOOTH_ROCK,
[31] = ITEM_HEAT_ROCK,
[32] = ITEM_DAMP_ROCK,
[33] = ITEM_FLAME_PLATE,
[34] = ITEM_SPLASH_PLATE,
[35] = ITEM_ZAP_PLATE,
[36] = ITEM_MEADOW_PLATE,
[37] = ITEM_ICICLE_PLATE,
[38] = ITEM_FIST_PLATE,
[39] = ITEM_TOXIC_PLATE,
[40] = ITEM_EARTH_PLATE,
[41] = ITEM_SKY_PLATE,
[42] = ITEM_MIND_PLATE,
[43] = ITEM_INSECT_PLATE,
[44] = ITEM_STONE_PLATE,
[45] = ITEM_SPOOKY_PLATE,
[46] = ITEM_DRACO_PLATE,
[47] = ITEM_DREAD_PLATE,
[48] = ITEM_IRON_PLATE
};
int Underground_SaveSize(void)
@ -80,30 +88,30 @@ int sub_02028554(void)
return sizeof(UnkStruct_02029894);
}
int sub_02028558(void)
int UndergroundRecord_Size(void)
{
return sizeof(SecretBaseRecord);
return sizeof(UndergroundRecord);
}
SecretBaseRecord *sub_0202855C(u32 heapID)
UndergroundRecord *UndergroundRecord_Init(u32 heapID)
{
SecretBaseRecord *v0 = Heap_AllocFromHeap(heapID, sizeof(SecretBaseRecord));
MI_CpuFill8(v0, 0, sizeof(SecretBaseRecord));
return v0;
UndergroundRecord *undergroundRecord = Heap_AllocFromHeap(heapID, sizeof(UndergroundRecord));
MI_CpuFill8(undergroundRecord, 0, sizeof(UndergroundRecord));
return undergroundRecord;
}
void Underground_Init(UndergroundData *param0)
{
u32 v0 = 0;
RTCDate v1;
RTCTime v2;
u32 seed = 0;
RTCDate date;
RTCTime time;
GetCurrentDateTime(&v1, &v2);
v0 = (((((((u32)v1.year * 32ULL + v1.month) * 32ULL) + v1.day) * 32ULL + v2.hour) * 32ULL + v2.minute) * 32ULL + (v2.second + gSystem.vblankCounter));
GetCurrentDateTime(&date, &time);
seed = (((((((u32)date.year * 32ULL + date.month) * 32ULL) + date.day) * 32ULL + time.hour) * 32ULL + time.minute) * 32ULL + (time.second + gSystem.vblankCounter));
MI_CpuFill8(param0, 0, sizeof(UndergroundData));
param0->unk_90 = v0;
param0->randomSeed = seed;
param0->unk_9AC_0 = 1;
}
@ -177,7 +185,7 @@ void sub_02028658(SaveData *saveData, int param1)
v5 = 99;
}
MATH_InitRand16(&v1, v0->unk_90);
MATH_InitRand16(&v1, v0->randomSeed);
for (v4 = 0; v4 < v5; v4++) {
for (v8 = 0; v8 < 100; v8++) {
@ -194,7 +202,7 @@ void sub_02028658(SaveData *saveData, int param1)
}
}
v0->unk_90 = ARNG_Next(v0->unk_90 + param1);
v0->randomSeed = ARNG_Next(v0->randomSeed + param1);
v0->unk_9AC_0 = 1;
}
@ -313,18 +321,18 @@ TrainerInfo *sub_020288C8(const UndergroundData *param0, int heapID, int param2)
return NULL;
}
u32 sub_02028930(UndergroundData *param0)
u32 UndergroundData_GetRandomSeed(UndergroundData *param0)
{
return param0->unk_90;
return param0->randomSeed;
}
int sub_02028938(int param0)
int Underground_GetMiningItemID(int itemOptionID)
{
GF_ASSERT(11 <= param0);
GF_ASSERT(param0 < 60);
GF_ASSERT(11 <= itemOptionID);
GF_ASSERT(itemOptionID < 60);
param0 -= 11;
return Unk_02100920[param0];
itemOptionID -= 11;
return sMiningItems[itemOptionID];
}
BOOL sub_0202895C(UndergroundData *param0, int param1)
@ -980,18 +988,18 @@ BOOL sub_02029274(UndergroundData *param0, int param1)
return 1;
}
void sub_0202929C(UndergroundData *param0)
void UndergroundData_IncrementStepCount(UndergroundData *undergroundData)
{
if (param0->unk_9AB >= (100 - 1)) {
param0->unk_9AB = 0;
if (undergroundData->stepCount >= (100 - 1)) {
undergroundData->stepCount = 0;
} else {
param0->unk_9AB++;
undergroundData->stepCount++;
}
}
int sub_020292B4(UndergroundData *param0)
int UndergroundData_GetStepCount(UndergroundData *undergroundData)
{
return param0->unk_9AB;
return undergroundData->stepCount;
}
void sub_020292C0(UnkStruct_02029894 *param0)
@ -1040,17 +1048,18 @@ void sub_02029364(UnkStruct_02029894 *param0, int param1, int param2, int param3
sub_02029308(param0, param1, v0, param2, param3);
}
// this is off-by-one compared to the actual flag type
static int sub_02029384(const UnkStruct_02029894 *param0)
{
int v0 = param0->unk_50.unk_38_0;
int numFlags = param0->unk_50.capturedFlagCount;
if (50 <= v0) {
if (FLAG_CAPTURED_COUNT_PLATINUM <= numFlags) {
return 5;
} else if (10 <= v0) {
} else if (FLAG_CAPTURED_COUNT_GOLD <= numFlags) {
return 4;
} else if (3 <= v0) {
} else if (FLAG_CAPTURED_COUNT_SILVER <= numFlags) {
return 3;
} else if (1 <= v0) {
} else if (FLAG_CAPTURED_COUNT_BRONZE <= numFlags) {
return 2;
}
@ -1098,144 +1107,140 @@ int sub_0202942C(const UnkStruct_02029894 *param0, int param1)
return param0->unk_2D[param1 - 1 - 15].unk_01;
}
int sub_02029460(const UnkStruct_02029894 *param0)
int sub_GetMaxRemovableRocks(const UnkStruct_02029894 *param0)
{
if (param0->unk_50.unk_38_0 >= 50) {
if (param0->unk_50.capturedFlagCount >= FLAG_CAPTURED_COUNT_PLATINUM) {
return 0;
} else if (param0->unk_50.unk_38_0 >= 10) {
} else if (param0->unk_50.capturedFlagCount >= FLAG_CAPTURED_COUNT_GOLD) {
return 6;
} else if (param0->unk_50.unk_38_0 >= 3) {
} else if (param0->unk_50.capturedFlagCount >= FLAG_CAPTURED_COUNT_SILVER) {
return 11;
} else if (param0->unk_50.unk_38_0 >= 1) {
} else if (param0->unk_50.capturedFlagCount >= FLAG_CAPTURED_COUNT_BRONZE) {
return 15;
}
return 16;
}
int sub_0202948C(const UnkStruct_02029894 *param0)
int sub_GetMaxDisplayItemsCount(const UnkStruct_02029894 *param0)
{
if (param0->unk_50.unk_38_0 >= 50) {
if (param0->unk_50.capturedFlagCount >= FLAG_CAPTURED_COUNT_PLATINUM) {
return 15;
} else if (param0->unk_50.unk_38_0 >= 10) {
} else if (param0->unk_50.capturedFlagCount >= FLAG_CAPTURED_COUNT_GOLD) {
return 15;
} else if (param0->unk_50.unk_38_0 >= 3) {
} else if (param0->unk_50.capturedFlagCount >= FLAG_CAPTURED_COUNT_SILVER) {
return 15;
} else if (param0->unk_50.unk_38_0 >= 1) {
} else if (param0->unk_50.capturedFlagCount >= FLAG_CAPTURED_COUNT_BRONZE) {
return 12;
}
return 10;
}
int sub_020294B8(const SecretBaseRecord *param0)
int UndergroundRecord_GetTrainerScore(const UndergroundRecord *undergroundRecord)
{
return param0->unk_00_0;
return undergroundRecord->trainerScore;
}
int sub_020294C0(const SecretBaseRecord *param0)
BOOL UndergroundRecord_HasPlatBaseFlag(const UndergroundRecord *undergroundRecord)
{
if (4 == sub_0202958C(param0)) {
return 1;
}
return 0;
return BASE_FLAG_PLATINUM == UndergroundRecord_GetFlagRank(undergroundRecord);
}
void sub_020294D4(SecretBaseRecord *param0, int param1)
void UndergroundRecord_SetTrainerScore(UndergroundRecord *undergroundRecord, int trainerScore)
{
param0->unk_00_0 = param1;
undergroundRecord->trainerScore = trainerScore;
}
int sub_020294EC(const SecretBaseRecord *param0)
int UndergroundRecord_GetPeopleMet(const UndergroundRecord *undergroundRecord)
{
return param0->unk_04_0;
return undergroundRecord->peopleMet;
}
void sub_020294F4(SecretBaseRecord *param0, int param1)
void UndergroundRecord_IncrementPeopleMet(UndergroundRecord *undergroundRecord, int param1)
{
if (param0->unk_04_0 < 999999) {
param0->unk_04_0++;
if (undergroundRecord->peopleMet < 999999) {
undergroundRecord->peopleMet++;
}
}
int sub_02029524(const SecretBaseRecord *param0)
int UndergroundRecord_GetNumGiftsGiven(const UndergroundRecord *undergroundRecord)
{
return param0->unk_08_0;
return undergroundRecord->numGiftsGiven;
}
void sub_0202952C(SecretBaseRecord *param0)
void UndergroundRecord_IncrementGiftsGiven(UndergroundRecord *undergroundRecord)
{
if (param0->unk_08_0 < 999999) {
param0->unk_08_0++;
if (undergroundRecord->numGiftsGiven < 999999) {
undergroundRecord->numGiftsGiven++;
}
}
void sub_0202955C(SecretBaseRecord *param0)
void sub_0202955C(UndergroundRecord *undergroundRecord)
{
if (param0->unk_0C_0 < 999999) {
param0->unk_0C_0++;
if (undergroundRecord->unk_0C_0 < 999999) {
undergroundRecord->unk_0C_0++;
}
}
int sub_0202958C(const SecretBaseRecord *param0)
enum BaseFlagType UndergroundRecord_GetFlagRank(const UndergroundRecord *undergroundRecord)
{
int v0 = param0->unk_38_0;
int capturedFlagCount = undergroundRecord->capturedFlagCount;
if (50 <= v0) {
return 4;
} else if (10 <= v0) {
return 3;
} else if (3 <= v0) {
return 2;
} else if (1 <= v0) {
return 1;
if (FLAG_CAPTURED_COUNT_PLATINUM <= capturedFlagCount) {
return BASE_FLAG_PLATINUM;
} else if (FLAG_CAPTURED_COUNT_GOLD <= capturedFlagCount) {
return BASE_FLAG_GOLD;
} else if (FLAG_CAPTURED_COUNT_SILVER <= capturedFlagCount) {
return BASE_FLAG_SILVER;
} else if (FLAG_CAPTURED_COUNT_BRONZE <= capturedFlagCount) {
return BASE_FLAG_BRONZE;
}
return 0;
return BASE_FLAG_NORMAL;
}
int sub_020295B8(const SecretBaseRecord *param0)
int UndergroundRecord_GetCapturedFlagCount(const UndergroundRecord *undergroundRecord)
{
return param0->unk_38_0;
return undergroundRecord->capturedFlagCount;
}
void sub_020295C0(SecretBaseRecord *param0)
void UndergroundRecord_IncrementCapturedFlagCount(UndergroundRecord *undergroundRecord)
{
if (param0->unk_38_0 < 999999) {
param0->unk_38_0++;
if (undergroundRecord->capturedFlagCount < 999999) {
undergroundRecord->capturedFlagCount++;
}
}
int sub_020295F0(const SecretBaseRecord *param0)
int UndergroundRecord_GetNumSpheresDug(const UndergroundRecord *undergroundRecord)
{
return param0->unk_10_0;
return undergroundRecord->numSpheresDug;
}
void sub_020295F8(SecretBaseRecord *param0, int param1)
void UndergroundRecord_AddNumSpheresDug(UndergroundRecord *undergroundRecord, int amount)
{
if ((param1 > 0) && (param0->unk_10_0 > (999999 - param1))) {
param0->unk_10_0 = 999999;
if ((amount > 0) && (undergroundRecord->numSpheresDug > (999999 - amount))) {
undergroundRecord->numSpheresDug = 999999;
} else {
param0->unk_10_0 += param1;
undergroundRecord->numSpheresDug += amount;
}
}
int sub_0202963C(const SecretBaseRecord *param0)
int UndergroundRecord_GetNumFossilsDug(const UndergroundRecord *undergroundRecord)
{
return param0->unk_14_0;
return undergroundRecord->numFossilsDug;
}
void sub_02029644(SecretBaseRecord *param0, int param1)
void UndergroundRecord_AddNumFossilsDug(UndergroundRecord *undergroundRecord, int amount)
{
if ((param1 > 0) && (param0->unk_14_0 > (999999 - param1))) {
param0->unk_14_0 = 999999;
if ((amount > 0) && (undergroundRecord->numFossilsDug > (999999 - amount))) {
undergroundRecord->numFossilsDug = 999999;
} else {
param0->unk_14_0 += param1;
undergroundRecord->numFossilsDug += amount;
}
}
void sub_02029688(SecretBaseRecord *param0, int param1)
void sub_02029688(UndergroundRecord *param0, int param1)
{
if ((param1 > 0) && (param0->unk_18_0 > (999999 - param1))) {
param0->unk_18_0 = 999999;
@ -1244,84 +1249,84 @@ void sub_02029688(SecretBaseRecord *param0, int param1)
}
}
int sub_020296CC(const SecretBaseRecord *param0)
int UndergroundRecord_GetNumTrapsHit(const UndergroundRecord *undergroundRecord)
{
return param0->unk_1C_0;
return undergroundRecord->numTrapsHit;
}
void sub_020296D4(SecretBaseRecord *param0)
void UndergroundRecord_IncrementNumTrapsHit(UndergroundRecord *undergroundRecord)
{
if (param0->unk_1C_0 < 999999) {
param0->unk_1C_0++;
if (undergroundRecord->numTrapsHit < 999999) {
undergroundRecord->numTrapsHit++;
}
}
int sub_02029704(const SecretBaseRecord *param0)
int sub_02029704(const UndergroundRecord *param0)
{
return param0->unk_20_0;
}
void sub_0202970C(SecretBaseRecord *param0)
void sub_0202970C(UndergroundRecord *param0)
{
if (param0->unk_20_0 < 999999) {
param0->unk_20_0++;
}
}
int sub_0202973C(const SecretBaseRecord *param0)
int sub_0202973C(const UndergroundRecord *param0)
{
return param0->unk_24_0;
}
void sub_02029744(SecretBaseRecord *param0)
void sub_02029744(UndergroundRecord *param0)
{
if (param0->unk_24_0 < 999999) {
param0->unk_24_0++;
}
}
int sub_02029774(const SecretBaseRecord *param0)
int sub_02029774(const UndergroundRecord *param0)
{
return param0->unk_28_0;
}
void sub_0202977C(SecretBaseRecord *param0)
void sub_0202977C(UndergroundRecord *param0)
{
if (param0->unk_28_0 < 999999) {
param0->unk_28_0++;
}
}
int sub_020297AC(const SecretBaseRecord *param0)
int sub_020297AC(const UndergroundRecord *param0)
{
return param0->unk_2C_0;
}
void sub_020297B4(SecretBaseRecord *param0)
void sub_020297B4(UndergroundRecord *param0)
{
if (param0->unk_2C_0 < 999999) {
param0->unk_2C_0++;
}
}
int sub_020297E4(const SecretBaseRecord *param0)
int sub_020297E4(const UndergroundRecord *param0)
{
return param0->unk_30_0;
}
void sub_020297EC(SecretBaseRecord *param0)
void sub_020297EC(UndergroundRecord *param0)
{
if (param0->unk_30_0 < 999999) {
param0->unk_30_0++;
}
}
int sub_0202981C(const SecretBaseRecord *param0)
int sub_0202981C(const UndergroundRecord *param0)
{
return param0->unk_34_0;
}
void sub_02029824(SecretBaseRecord *param0)
void sub_02029824(UndergroundRecord *param0)
{
if (param0->unk_34_0 < 999999) {
param0->unk_34_0++;
@ -1362,13 +1367,13 @@ UnkStruct_02029894 *sub_02029894(SaveData *saveData)
return &v0->unk_00;
}
SecretBaseRecord *SaveData_SecretBaseRecord(SaveData *saveData)
UndergroundRecord *SaveData_UndergroundRecord(SaveData *saveData)
{
UndergroundData *v0 = SaveData_SaveTable(saveData, SAVE_TABLE_ENTRY_UNDERGROUND);
return &v0->unk_00.unk_50;
}
SecretBaseRecord *sub_020298AC(UnkStruct_02029894 *param0)
UndergroundRecord *sub_020298AC(UnkStruct_02029894 *param0)
{
return &param0->unk_50;
}

View File

@ -6,13 +6,13 @@
#include "generated/game_records.h"
#include "generated/trainer_score_events.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_decls/struct_0202D060_decl.h"
#include "struct_decls/struct_0202D750_decl.h"
#include "struct_decls/struct_0202D764_decl.h"
#include "struct_defs/battle_frontier.h"
#include "struct_defs/struct_0204AFC4.h"
#include "struct_defs/struct_02098C44.h"
#include "struct_defs/underground_data.h"
#include "field/field_system.h"
#include "savedata/save_table.h"

View File

@ -3,7 +3,7 @@
#include <nitro.h>
#include <string.h>
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_defs/underground_data.h"
#include "field/field_system.h"

View File

@ -5,12 +5,12 @@
#include "constants/species.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_decls/struct_0202D060_decl.h"
#include "struct_decls/struct_0202D750_decl.h"
#include "struct_defs/battle_frontier.h"
#include "struct_defs/struct_0206BC70.h"
#include "struct_defs/struct_02098C44.h"
#include "struct_defs/underground_data.h"
#include "applications/pokemon_summary_screen/main.h"
#include "field/field_system.h"

View File

@ -5,11 +5,11 @@
#include "generated/game_records.h"
#include "struct_decls/struct_0202855C_decl.h"
#include "struct_decls/struct_0202C834_decl.h"
#include "struct_decls/struct_0202C844_decl.h"
#include "struct_defs/battle_frontier.h"
#include "struct_defs/struct_02072014.h"
#include "struct_defs/underground_record.h"
#include "field/field_system.h"
@ -120,41 +120,41 @@ void sub_02071F20(TrainerCard *param0)
u8 sub_02071F28(FieldSystem *fieldSystem)
{
u8 v0;
u8 trainerCardStars;
SaveData *saveData;
GameRecords *gameRecords;
VarsFlags *varsFlags;
SecretBaseRecord *v4;
UndergroundRecord *undergroundRecord;
BattleFrontier *frontier;
saveData = FieldSystem_GetSaveData(fieldSystem);
gameRecords = SaveData_GetGameRecords(saveData);
varsFlags = SaveData_GetVarsFlags(saveData);
v4 = SaveData_SecretBaseRecord(saveData);
undergroundRecord = SaveData_UndergroundRecord(saveData);
frontier = SaveData_GetBattleFrontier(saveData);
v0 = 0;
trainerCardStars = 0;
if (SystemFlag_CheckGameCompleted(varsFlags)) {
v0++;
trainerCardStars++;
}
if (Pokedex_NationalDexCompleted(SaveData_GetPokedex(saveData))) {
v0++;
trainerCardStars++;
}
if ((sub_02030698(frontier, 0, 0xff) >= 100) || (sub_02030698(frontier, 2, 0xff) >= 100) || (sub_02030698(frontier, 4, 0xff) >= 100) || (sub_02030698(frontier, 6, 0xff) >= 100) || (sub_02030698(frontier, 8, 0xff) >= 100)) {
v0++;
trainerCardStars++;
}
if (SystemFlag_CheckContestMaster(varsFlags, 0) || SystemFlag_CheckContestMaster(varsFlags, 1) || SystemFlag_CheckContestMaster(varsFlags, 3) || SystemFlag_CheckContestMaster(varsFlags, 4) || SystemFlag_CheckContestMaster(varsFlags, 2)) {
v0++;
trainerCardStars++;
}
if (sub_020294C0(v4) == 1) {
v0++;
if (UndergroundRecord_HasPlatBaseFlag(undergroundRecord) == TRUE) {
trainerCardStars++;
}
return v0;
return trainerCardStars;
}
static void sub_02072014(const u8 param0, const u8 param1, const u8 param2, const u8 param3, const u8 param4, TrainerCard *param5)