Skip to content

Commit

Permalink
Use constants in all invocations of GameRecords functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lhearachel committed Jun 23, 2024
1 parent 9daf10b commit ca604cf
Show file tree
Hide file tree
Showing 49 changed files with 175 additions and 126 deletions.
17 changes: 9 additions & 8 deletions src/battle/ov16_0223B140.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "constants/battle.h"

#include "consts/game_records.h"
#include "struct_decls/struct_02006C24_decl.h"
#include "message.h"
#include "struct_decls/struct_02018340_decl.h"
Expand Down Expand Up @@ -188,9 +189,9 @@ BOOL Battle_Main (OverlayManager * param0, int * param1)
sub_02038F8C(v0->unk_104);

if (!sub_020389B8()) {
GameRecords_IncrementRecordValue(v0->records, (1 + 19));
GameRecords_IncrementRecordValue(v0->records, RECORD_UNK_020);
} else {
GameRecords_IncrementRecordValue(v0->records, (1 + 24));
GameRecords_IncrementRecordValue(v0->records, RECORD_UNK_025);
}
*param1 = 2;
break;
Expand Down Expand Up @@ -2165,24 +2166,24 @@ static BOOL ov16_0223DB1C (OverlayManager * param0)
switch (v0->unk_14) {
case 0x1:
if (!sub_020389B8()) {
GameRecords_IncrementRecordValue(v0->records, (1 + 20));
GameRecords_IncrementRecordValue(v0->records, RECORD_UNK_021);
} else {
GameRecords_IncrementRecordValue(v0->records, (1 + 25));
GameRecords_IncrementRecordValue(v0->records, RECORD_UNK_026);
}
break;
case 0x2:
if (!sub_020389B8()) {
GameRecords_IncrementRecordValue(v0->records, (1 + 21));
GameRecords_IncrementRecordValue(v0->records, RECORD_UNK_022);
} else {
GameRecords_IncrementRecordValue(v0->records, (1 + 26));
GameRecords_IncrementRecordValue(v0->records, RECORD_UNK_027);
}
break;
case 0x3:
case 0x5:
if (!sub_020389B8()) {
GameRecords_IncrementRecordValue(v0->records, (1 + 22));
GameRecords_IncrementRecordValue(v0->records, RECORD_UNK_023);
} else {
GameRecords_IncrementRecordValue(v0->records, (1 + 27));
GameRecords_IncrementRecordValue(v0->records, RECORD_UNK_028);
}
break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/comm_player_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <nitro/os.h>
#include <nnsys/g3d/glbstate.h>

#include "consts/game_records.h"
#include "core_sys.h"

#include "sys_task_manager.h"
Expand Down Expand Up @@ -930,7 +931,7 @@ static void sub_02058644 (int netId)
sub_0202929C(underground);

if (sub_020292B4(underground) == 50) {
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(sCommPlayerManager->fieldSystem->saveData), 37);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(sCommPlayerManager->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_37);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game_records.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static u32 GetRecordLimit(int id)
}
}

GF_ASSERT(0);
GF_ASSERT(FALSE);
return 0;
}

Expand Down
5 changes: 3 additions & 2 deletions src/overlay005/field_control.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "inlines.h"

#include "trainer_info.h"
Expand Down Expand Up @@ -832,8 +833,8 @@ static BOOL Field_UpdateDaycare (FieldSystem *fieldSystem)
if (ov5_021E7154(v1, party, fieldSystem) == TRUE) {
GameRecords *v2 = SaveData_GetGameRecordsPtr(fieldSystem->saveData);

GameRecords_IncrementRecordValue(v2, (1 + 10));
GameRecords_IncrementTrainerScore(v2, 15);
GameRecords_IncrementRecordValue(v2, RECORD_UNK_011);
GameRecords_IncrementTrainerScore(v2, TRAINER_SCORE_EVENT_UNK_15);
sub_0203E880(fieldSystem, 2031, NULL);

return TRUE;
Expand Down
5 changes: 3 additions & 2 deletions src/overlay005/ov5_021DFB54.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "core_sys.h"

#include "struct_decls/struct_020216E0_decl.h"
Expand Down Expand Up @@ -508,7 +509,7 @@ static void ov5_021DFF88 (int param0, FieldSystem * fieldSystem, PlayerAvatar *
v0->playerAvatar = playerAvatar;

FieldTask_Set(fieldSystem, ov5_021DFFBC, v0);
GameRecords_IncrementRecordValue(SaveData_GetGameRecordsPtr(fieldSystem->saveData), (1 + 54));
GameRecords_IncrementRecordValue(SaveData_GetGameRecordsPtr(fieldSystem->saveData), RECORD_UNK_055);
}

static BOOL ov5_021DFFBC (TaskManager * param0)
Expand Down Expand Up @@ -843,7 +844,7 @@ static void ov5_021E0534 (FieldSystem * fieldSystem, PlayerAvatar * playerAvatar
v0->playerAvatar = playerAvatar;

FieldTask_Set(fieldSystem, ov5_021E0560, v0);
GameRecords_IncrementRecordValue(SaveData_GetGameRecordsPtr(fieldSystem->saveData), (1 + 55));
GameRecords_IncrementRecordValue(SaveData_GetGameRecordsPtr(fieldSystem->saveData), RECORD_UNK_056);
}

static BOOL ov5_021E0560 (TaskManager * param0)
Expand Down
3 changes: 2 additions & 1 deletion src/overlay005/ov5_021E622C.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "strbuf.h"
#include "trainer_info.h"
#include "struct_decls/struct_02026218_decl.h"
Expand Down Expand Up @@ -2050,7 +2051,7 @@ void ov5_021E6358 (Party * param0, int param1, UnkStruct_02026310 * param2, Save
int v0;
GameRecords * v1 = SaveData_GetGameRecordsPtr(param3);

GameRecords_IncrementRecordValue(v1, 1 + 39);
GameRecords_IncrementRecordValue(v1, RECORD_UNK_040);
v0 = ov5_021E6270(param2);
ov5_021E62C4(param0, param1, sub_02026218(param2, v0), param3);
}
Expand Down
5 changes: 3 additions & 2 deletions src/overlay005/ov5_021F08CC.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "core_sys.h"

#include "message.h"
Expand Down Expand Up @@ -123,7 +124,7 @@ BOOL ov5_021F08F8 (TaskManager * taskMan)

{
GameRecords * v4 = SaveData_GetGameRecordsPtr(fieldSystem->saveData);
GameRecords_IncrementRecordValue(v4, (1 + 9));
GameRecords_IncrementRecordValue(v4, RECORD_UNK_010);
}

sub_02050E78(fieldSystem, taskMan, v1->unk_10);
Expand Down Expand Up @@ -352,7 +353,7 @@ static int ov5_021F0BF4 (UnkStruct_ov5_021F0D6C * param0, PlayerAvatar * playerA

{
GameRecords * v0 = SaveData_GetGameRecordsPtr(param0->fieldSystem->saveData);
GameRecords_IncrementRecordValue(v0, (((70 + 1)) + 29));
GameRecords_IncrementRecordValue(v0, RECORD_UNK_100);
}

sub_0206D340(param0->fieldSystem, 0, ov5_021F0E58(param0->unk_1C), NULL);
Expand Down
21 changes: 11 additions & 10 deletions src/overlay005/ov5_021F6454.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "inlines.h"

#include "struct_decls/struct_0200112C_decl.h"
Expand Down Expand Up @@ -816,23 +817,23 @@ BOOL ScrCmd_30F (ScriptContext * param0)

switch (v3) {
case 13:
if (GameRecords_GetRecordValue(v1, (1 + 28)) < 1) {
if (GameRecords_GetRecordValue(v1, RECORD_UNK_029) < 1) {
*v4 = 0;
}

if (GameRecords_GetRecordValue(v1, (1 + 59)) < 1) {
if (GameRecords_GetRecordValue(v1, RECORD_UNK_060) < 1) {
*v4 = 0;
}

if (GameRecords_GetRecordValue(v1, (1 + 60)) < 1) {
if (GameRecords_GetRecordValue(v1, RECORD_UNK_061) < 1) {
*v4 = 0;
}

if (GameRecords_GetRecordValue(v1, (1 + 61)) < 1) {
if (GameRecords_GetRecordValue(v1, RECORD_UNK_062) < 1) {
*v4 = 0;
}

if (GameRecords_GetRecordValue(v1, (1 + 62)) < 1) {
if (GameRecords_GetRecordValue(v1, RECORD_UNK_063) < 1) {
*v4 = 0;
}
break;
Expand Down Expand Up @@ -860,27 +861,27 @@ BOOL ScrCmd_30F (ScriptContext * param0)
}
break;
case 15:
if (GameRecords_GetRecordValue(v1, (((70 + 1)) + 2)) < 10) {
if (GameRecords_GetRecordValue(v1, RECORD_UNK_073) < 10) {
*v4 = 0;
}
break;
case 16:
if (GameRecords_GetRecordValue(v1, (1 + 56)) < 50) {
if (GameRecords_GetRecordValue(v1, RECORD_UNK_057) < 50) {
*v4 = 0;
}
break;
case 17:
if (GameRecords_GetRecordValue(v1, (1 + 3)) < 50) {
if (GameRecords_GetRecordValue(v1, RECORD_UNK_004) < 50) {
*v4 = 0;
}
break;
case 18:
if (GameRecords_GetRecordValue(v1, (1 + 10)) < 30) {
if (GameRecords_GetRecordValue(v1, RECORD_UNK_011) < 30) {
*v4 = 0;
}
break;
case 20:
if (GameRecords_GetRecordValue(v1, (0 + 0)) < 300000) {
if (GameRecords_GetRecordValue(v1, RECORD_UNK_000) < 300000) {
*v4 = 0;
}
break;
Expand Down
7 changes: 4 additions & 3 deletions src/overlay007/ov7_0224CD28.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "core_sys.h"

#include "struct_decls/struct_0200112C_decl.h"
Expand Down Expand Up @@ -1198,9 +1199,9 @@ static u8 ov7_0224E5B0 (UnkStruct_ov7_0224D008 * param0)
ov7_0224E920(param0, param0->unk_2B0 * param0->unk_2AC);

if (param0->unk_2A9 == 3) {
GameRecords_AddToRecordValue(param0->records, (1 + 68), param0->unk_2B0 * param0->unk_2AC);
GameRecords_AddToRecordValue(param0->records, RECORD_UNK_069, param0->unk_2B0 * param0->unk_2AC);
} else {
GameRecords_AddToRecordValue(param0->records, (1 + 34), param0->unk_2B0 * param0->unk_2AC);
GameRecords_AddToRecordValue(param0->records, RECORD_UNK_035, param0->unk_2B0 * param0->unk_2AC);
}

ov7_0224DAF8(param0, 1);
Expand Down Expand Up @@ -1239,7 +1240,7 @@ static u8 ov7_0224E6B8 (UnkStruct_ov7_0224D008 * param0)

{
GameRecords * v1 = SaveData_GetGameRecordsPtr(param0->unk_284);
GameRecords_IncrementRecordValue(v1, (1 + 49));
GameRecords_IncrementRecordValue(v1, RECORD_UNK_050);
}

return 11;
Expand Down
3 changes: 2 additions & 1 deletion src/overlay022/ov22_02255D44.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "core_sys.h"

#include "message.h"
Expand Down Expand Up @@ -368,7 +369,7 @@ int ov22_02256098 (OverlayManager * param0, int * param1)
UnkStruct_0203DA00 * v2 = OverlayManager_Args(param0);

if (v0->unk_71C == 1) {
GameRecords_IncrementTrainerScore(v2->records, 7);
GameRecords_IncrementTrainerScore(v2->records, TRAINER_SCORE_EVENT_UNK_07);
ov22_02256F38(v2->unk_04, &v0->unk_458, v2->unk_14);
}

Expand Down
3 changes: 2 additions & 1 deletion src/overlay023/ov23_0223E140.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "core_sys.h"

#include "struct_decls/struct_02001AF4_decl.h"
Expand Down Expand Up @@ -2748,7 +2749,7 @@ static BOOL ov23_02240CFC (UnkStruct_ov23_0223EE80 * param0)

if (ov23_02240934(param0)) {
sub_02029220(v2);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(Unk_ov23_02257740->fieldSystem->saveData), 30);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(Unk_ov23_02257740->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_30);
param0->unk_00 = 14;
param0->unk_08 = 25;
param0->unk_50 = 1;
Expand Down
3 changes: 2 additions & 1 deletion src/overlay023/ov23_022416A8.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "sys_task_manager.h"
#include "strbuf.h"
#include "struct_decls/struct_020298B0_decl.h"
Expand Down Expand Up @@ -400,7 +401,7 @@ void ov23_02241AE8 (int param0, int param1, int param2, int param3)

Sound_PlayEffect(1585);
sub_0206AA14(SaveData_GetVarsFlags(Unk_ov23_02257744->fieldSystem->saveData));
GameRecords_IncrementRecordValue(SaveData_GetGameRecordsPtr(Unk_ov23_02257744->fieldSystem->saveData), (1 + 46));
GameRecords_IncrementRecordValue(SaveData_GetGameRecordsPtr(Unk_ov23_02257744->fieldSystem->saveData), RECORD_UNK_047);

ov5_021F57C8(Unk_ov23_02257744->fieldSystem, param2, param3);
}
Expand Down
3 changes: 2 additions & 1 deletion src/overlay023/ov23_0224340C.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "core_sys.h"

#include "struct_decls/struct_02006C24_decl.h"
Expand Down Expand Up @@ -2559,7 +2560,7 @@ void ov23_022455B4 (int param0, int param1, void * param2, void * param3)

if (v0->unk_00 == CommSys_CurNetId()) {
sub_02029744(v1);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(Unk_ov23_02257764->fieldSystem->saveData), 34);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(Unk_ov23_02257764->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_34);
sub_020594FC();

ov23_02254068(ov23_0224219C(), CommInfo_TrainerInfo(v0->unk_01));
Expand Down
3 changes: 2 additions & 1 deletion src/overlay023/ov23_022499E4.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "sys_task_manager.h"

#include "field/field_system.h"
Expand Down Expand Up @@ -88,7 +89,7 @@ void ov23_02249A2C (void)
FieldCommunicationManager * v0 = FieldCommMan_Get();

v0->unk_41 = 1;
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(v0->fieldSystem->saveData), 36);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(v0->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_36);

ov23_02242BC0(v0->fieldSystem);
ov23_02249C24(ov23_02249C34, 0);
Expand Down
3 changes: 2 additions & 1 deletion src/overlay023/ov23_0224A1D0.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <string.h>
#include <nnsys/g3d/glbstate.h>

#include "consts/game_records.h"
#include "sys_task_manager.h"
#include "strbuf.h"
#include "trainer_info.h"
Expand Down Expand Up @@ -81,7 +82,7 @@ static void ov23_0224A204 (int param0)

if (param0 == CommSys_CurNetId()) {
if (commPlayerMan->unk_290[param0] != NULL) {
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(commPlayerMan->fieldSystem->saveData), 28);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(commPlayerMan->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_28);

if (commPlayerMan->unk_27C[5 - 1]) {
Heap_FreeToHeap(commPlayerMan->unk_27C[5 - 1]);
Expand Down
3 changes: 2 additions & 1 deletion src/overlay023/ov23_0224B05C.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "consts/game_records.h"
#include "core_sys.h"

#include "struct_decls/struct_02001AF4_decl.h"
Expand Down Expand Up @@ -2026,7 +2027,7 @@ void ov23_0224CF18 (int param0, int param1, void * param2, void * param3)
void * v6 = sub_0202BE20(11);

sub_0202B758(Unk_ov23_022577AC->fieldSystem->unk_9C, v6, 1);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(Unk_ov23_022577AC->fieldSystem->saveData), 35);
GameRecords_IncrementTrainerScore(SaveData_GetGameRecordsPtr(Unk_ov23_022577AC->fieldSystem->saveData), TRAINER_SCORE_EVENT_UNK_35);
}
}
}
Expand Down
Loading

0 comments on commit ca604cf

Please sign in to comment.