Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pokeradar Documentation #137

Merged
merged 3 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/constants/sdat.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ enum SDATID {
SEQ_CONTEST_DRESSING_ROOM,
SEQ_BATTLE_ELITE_FOUR,

SEQ_POKERADAR = 1150,

SEQ_BATTLE_GIRATINA = 1201,
SEQ_BATTLE_FRONTIER_BRAIN,
SEQ_VICTORY_FRONTIER_BRAIN,
Expand Down
2 changes: 1 addition & 1 deletion include/overlay006/ov6_022430C4.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int ov6_022430C4(UnkStruct_0203CDB0 * param0);
int ov6_022430E8(UnkStruct_0203CDB0 * param0, const u8 param1);
int ov6_02243114(UnkStruct_0203CDB0 * param0, const u8 param1);
int ov6_02243140(UnkStruct_0203CDB0 * param0);
int ov6_02243148(UnkStruct_0203CDB0 * param0);
int GetRadarSpecies(UnkStruct_0203CDB0 * param0);
void ov6_02243160(UnkStruct_020698E4 * param0);

#endif // POKEPLATINUM_OV6_022430C4_H
35 changes: 35 additions & 0 deletions include/pokeradar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef POKEPLATINUM_POKERADAR_H
#define POKEPLATINUM_POKERADAR_H

#include "struct_decls/struct_0203CDB0_decl.h"
#include "struct_decls/struct_020508D4_decl.h"

typedef struct RadarChain RadarChain;

#define NUM_GRASS_PATCHES 4
#define RADAR_BATTERY_STEPS 50

enum PatchShakeType {
PATCH_SHAKE_SOFT = 0,
PATCH_SHAKE_HARD = 1
};

RadarChain *RadarChain_Init(const int heapID);
void RadarChain_Free(RadarChain *chain);
void RadarChain_Clear(RadarChain *chain);
BOOL RadarSpawnPatches(UnkStruct_0203CDB0 *param0, const int param1, const int param2, RadarChain *chain);
void SetupGrassPatches(UnkStruct_0203CDB0 *param0, const int param1, RadarChain *chain);
void sub_02069638(UnkStruct_0203CDB0 *param0, RadarChain *chain);
BOOL sub_02069690(RadarChain *chain);
int sub_020696DC(const int param0, const int param1, UnkStruct_0203CDB0 *param2, RadarChain *chain, int *param4, BOOL *param5, BOOL *param6);
void SetRadarMon(RadarChain *chain, const int species, const int level);
void GetRadarMon(RadarChain *chain, int *species, int *level);
const BOOL sub_02069798(const RadarChain *chain);
void sub_0206979C(UnkStruct_0203CDB0 *param0);
BOOL GetRadarChainActive(const RadarChain *chain);
BOOL RefreshRadarChain(UnkStruct_020508D4 *param0);
void sub_02069B74(UnkStruct_0203CDB0 *param0);
int GetChainCount(UnkStruct_0203CDB0 *param0);
void RadarChargeStep(UnkStruct_0203CDB0 *param0);

#endif // POKEPLATINUM_POKERADAR_H
6 changes: 0 additions & 6 deletions include/struct_decls/struct_0206942C_decl.h

This file was deleted.

4 changes: 2 additions & 2 deletions include/struct_defs/struct_0203CDB0.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "struct_decls/struct_0205C22C_decl.h"
#include "struct_decls/struct_0205E884_decl.h"
#include "struct_decls/struct_02061830_decl.h"
#include "struct_decls/struct_0206942C_decl.h"
#include "pokeradar.h"
#include "struct_decls/struct_0207D99C_decl.h"
#include "struct_decls/struct_02095E80_decl.h"
#include "struct_decls/struct_0209ACBC_decl.h"
Expand Down Expand Up @@ -82,7 +82,7 @@ typedef struct UnkStruct_0203CDB0_t {
UnkStruct_02095E80 * unk_88;
UnkStruct_ov5_021EB0E0 * unk_8C;
int unk_90;
UnkStruct_0206942C * unk_94;
RadarChain *chain;
UnkStruct_0207D99C * unk_98;
UnkStruct_0202B628 * unk_9C;
UnkStruct_ov5_021EF300 * unk_A0;
Expand Down
26 changes: 0 additions & 26 deletions include/unk_0206940C.h

This file was deleted.

2 changes: 1 addition & 1 deletion platinum.us/main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Static main
Object main.nef.p/src_unk_02067A84.c.o
Object main.nef.p/src_unk_02068344.c.o
Object main.nef.p/src_unk_020683F4.c.o
Object main.nef.p/src_unk_0206940C.c.o
Object main.nef.p/src_pokeradar.c.o
Object main.nef.p/src_unk_02069BE0.c.o
Object main.nef.p/src_unk_0206A780.c.o
Object main.nef.p/src_unk_0206A8DC.c.o
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ pokeplatinum_c = files(
'unk_02067A84.c',
'unk_02068344.c',
'unk_020683F4.c',
'unk_0206940C.c',
'pokeradar.c',
'unk_02069BE0.c',
'unk_0206A780.c',
'unk_0206A8DC.c',
Expand Down
4 changes: 2 additions & 2 deletions src/overlay005/ov5_021D0D80.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#include "unk_0205E7D0.h"
#include "unk_02061804.h"
#include "unk_02068344.h"
#include "unk_0206940C.h"
#include "pokeradar.h"
#include "overlay005/ov5_021D0D80.h"
#include "overlay005/ov5_021D1A94.h"
#include "overlay005/ov5_021D37AC.h"
Expand Down Expand Up @@ -448,7 +448,7 @@ static BOOL ov5_021D11CC (UnkStruct_0203CDB0 * param0)
}

{
sub_02069434(param0->unk_94);
RadarChain_Clear(param0->chain);
sub_02055554(param0, sub_02055428(param0, param0->unk_1C->unk_00), 1);
sub_0203A418(param0);

Expand Down
4 changes: 2 additions & 2 deletions src/overlay005/ov5_021D1C30.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#include "unk_02061804.h"
#include "unk_02067A84.h"
#include "unk_020683F4.h"
#include "unk_0206940C.h"
#include "pokeradar.h"
#include "unk_0206A8DC.h"
#include "unk_0206AFE0.h"
#include "unk_02071B10.h"
Expand Down Expand Up @@ -920,7 +920,7 @@ static BOOL ov5_021D2B08 (UnkStruct_0203CDB0 * param0)

static BOOL ov5_021D2B14 (UnkStruct_0203CDB0 * param0)
{
sub_02069B98(param0);
RadarChargeStep(param0);
return 0;
}

Expand Down
20 changes: 10 additions & 10 deletions src/overlay006/ov6_02240C9C.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "unk_020559DC.h"
#include "unk_0205DAC8.h"
#include "unk_0205E7D0.h"
#include "unk_0206940C.h"
#include "pokeradar.h"
#include "unk_0206A8DC.h"
#include "unk_0206AFE0.h"
#include "roaming_pokemon.h"
Expand Down Expand Up @@ -288,7 +288,7 @@ BOOL ov6_02240D5C (UnkStruct_0203CDB0 * param0)

memset(&v10, 0, sizeof(UnkStruct_ov6_02241674));

if (!sub_020696DC(v2, v3, param0, param0->unk_94, &v10.unk_00, &v10.unk_04, &v10.unk_08)) {
if (!sub_020696DC(v2, v3, param0, param0->chain, &v10.unk_00, &v10.unk_04, &v10.unk_08)) {
v10.unk_0C = 0;
} else {
v10.unk_0C = 1;
Expand All @@ -314,7 +314,7 @@ BOOL ov6_02240D5C (UnkStruct_0203CDB0 * param0)

sub_02052314(v0, param0);
ov6_0224239C(v14.unk_00, v17, v0);
sub_02069434(param0->unk_94);
RadarChain_Clear(param0->chain);
sub_02050E10(param0, v0);
return 1;
} else {
Expand Down Expand Up @@ -537,7 +537,7 @@ BOOL ov6_022411C8 (UnkStruct_0203CDB0 * param0, UnkStruct_020508D4 * param1)

sub_02052314(v0, param0);
ov6_0224239C(v13.unk_00, v15, v0);
sub_02069434(param0->unk_94);
RadarChain_Clear(param0->chain);
sub_02050E78(param0, param1, v0);
return 1;
}
Expand Down Expand Up @@ -683,7 +683,7 @@ BOOL ov6_022413E4 (UnkStruct_0203CDB0 * param0, BattleParams ** param1)

sub_02052314(*param1, param0);
ov6_0224239C(v13.unk_00, v16, *param1);
sub_02069434(param0->unk_94);
RadarChain_Clear(param0->chain);
return 1;
} else {
return 0;
Expand Down Expand Up @@ -764,7 +764,7 @@ static BOOL ov6_02241674 (UnkStruct_0203CDB0 * param0, Pokemon * param1, BattleP
param4[11].unk_00 = param3->unk_58[3];
}

sub_0206978C(param0->unk_94, &v1, &v2);
GetRadarMon(param0->chain, &v1, &v2);

if (param6->unk_04 == 1) {
TrainerInfo * v3;
Expand All @@ -782,14 +782,14 @@ static BOOL ov6_02241674 (UnkStruct_0203CDB0 * param0, Pokemon * param1, BattleP
v4 = sub_0205EABC(param0->unk_3C);
v5 = sub_0205EAC8(param0->unk_3C);

sub_02069474(param0, v4, v5, param0->unk_94);
RadarSpawnPatches(param0, v4, v5, param0->chain);
}
}
} else {
v0 = ov6_02241DC4(param1, 0xff, param5, param4, 0, 1, param2);

if (v0) {
sub_02069434(param0->unk_94);
RadarChain_Clear(param0->chain);
}
}

Expand Down Expand Up @@ -1347,15 +1347,15 @@ static BOOL ov6_02241F7C (UnkStruct_0203CDB0 * param0, Pokemon * param1, const U
v3 = param3[v1].unk_00;

if (param6 == 0) {
sub_02069774(param0->unk_94, v3, v2);
SetRadarMon(param0->chain, v3, v2);
sub_02069B74(param0);
} else {
if (v3 == param6) {
v3 = param6;
v2 = param7;
sub_02069B74(param0);
} else {
sub_02069434(param0->unk_94);
RadarChain_Clear(param0->chain);
}
}

Expand Down
13 changes: 6 additions & 7 deletions src/overlay006/ov6_022430C4.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "overlay006/struct_ov6_022430E8.h"

#include "unk_0202D7A8.h"
#include "unk_0206940C.h"
#include "pokeradar.h"
#include "overlay006/ov6_022430C4.h"

static void ov6_022431A0(UnkStruct_020698E4 * param0, UnkStruct_ov6_022430E8 ** param1);
Expand Down Expand Up @@ -56,15 +56,14 @@ int ov6_02243114 (UnkStruct_0203CDB0 * param0, const u8 param1)

int ov6_02243140 (UnkStruct_0203CDB0 * param0)
{
return sub_02069B90(param0);
return GetChainCount(param0);
}

int ov6_02243148 (UnkStruct_0203CDB0 * param0)
{
int v0, v1;
int GetRadarSpecies (UnkStruct_0203CDB0 * param0) {
int species, level;

sub_0206978C(param0->unk_94, &v0, &v1);
return v0;
GetRadarMon(param0->chain, &species, &level);
return species;
}

void ov6_02243160 (UnkStruct_020698E4 * param0)
Expand Down
4 changes: 2 additions & 2 deletions src/overlay053/ov53_022561C0.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static BOOL ov53_0225621C (UnkStruct_ov53_0225621C * param0, UnkStruct_ov25_0225
param0->unk_04.unk_04 = ov6_02243140(v1);

if (param0->unk_04.unk_04) {
param0->unk_04.unk_00 = ov6_02243148(v1);
param0->unk_04.unk_00 = GetRadarSpecies(v1);
} else {
param0->unk_04.unk_00 = 0;
}
Expand Down Expand Up @@ -212,7 +212,7 @@ static BOOL ov53_02256370 (UnkStruct_ov53_0225621C * param0)
if (param0->unk_04.unk_04 == 0) {
v1 = 0;
} else {
v1 = ov6_02243148(v0);
v1 = GetRadarSpecies(v0);
}

if (v1 != param0->unk_04.unk_00) {
Expand Down
Loading
Loading