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

Document commands WaitFrames, PlaySound, If, IfMonData, FadeOut, JumpToSub, JumpToBattleEffect #82

Merged
merged 6 commits into from
Oct 12, 2023
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
10 changes: 10 additions & 0 deletions include/battle/btlcmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,14 @@ enum BattleScriptVars {
#define BTLSCR_SWITCHED_MON_AFTER 22
#define BTLSCR_MSG_TEMP (0xFF)

enum IfOp {
IFOP_EQU = 0,
IFOP_NEQ,
IFOP_LTE,
IFOP_GT,
IFOP_FLAG_SET,
IFOP_FLAG_NOT,
IFOP_AND,
};

#endif // POKEPLATINUM_BATTLE_BTLCMD_H
16 changes: 9 additions & 7 deletions include/struct_defs/struct_021BF67C.h → include/coresys.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef POKEPLATINUM_STRUCT_021BF67C_H
#define POKEPLATINUM_STRUCT_021BF67C_H
#ifndef POKEPLATINUM_CORESYS_H
#define POKEPLATINUM_CORESYS_H

#include "functypes/funcptr_02017798.h"
#include "struct_decls/struct_0201CD88_decl.h"
#include "overlay023/funcptr_ov23_022537D4.h"

typedef struct {
typedef struct CoreSys {
UnkFuncPtr_02017798 unk_00;
void * unk_04;
UnkFuncPtr_02017798 unk_08;
Expand All @@ -24,14 +24,14 @@ typedef struct {
int unk_3C;
int unk_40;
int unk_44;
int unk_48;
int padInput;
int unk_4C;
int unk_50;
int unk_54;
int unk_58;
u16 unk_5C;
u16 unk_5E;
u16 unk_60;
u16 touchInput;
u16 unk_62;
u8 unk_64;
u8 unk_65;
Expand All @@ -41,6 +41,8 @@ typedef struct {
u8 padding_69[3];
BOOL unk_6C;
u32 * unk_70;
} UnkStruct_021BF67C;
} CoreSys;

#endif // POKEPLATINUM_STRUCT_021BF67C_H
extern CoreSys coresys;

#endif // POKEPLATINUM_CORESYS_H
8 changes: 0 additions & 8 deletions include/data_021BF67C.h

This file was deleted.

4 changes: 2 additions & 2 deletions include/overlay016/ov16_0226485C.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void BattleIO_FlickerBattler(BattleSystem * param0, int param1, u32 param2);
void BattleIO_UpdateHPGauge(BattleSystem * param0, BattleContext * param1, int param2);
void ov16_02265D14(BattleSystem * param0, BattleContext * param1, int param2, int param3);
void BattleIO_PlayFaintingSequence(BattleSystem * param0, BattleContext * param1, int param2);
void ov16_02265EAC(BattleSystem * param0, BattleContext * param1, int param2, int param3);
void ov16_02265ECC(BattleSystem * param0, BattleContext * param1);
void BattleIO_PlaySound(BattleSystem * param0, BattleContext * param1, int param2, int param3);
void BattleIO_FadeOut(BattleSystem * param0, BattleContext * param1);
void ov16_02265EE8(BattleSystem * param0, int param1, int param2);
void ov16_02265FB8(BattleSystem * param0, int param1, int param2);
void ov16_02265FD8(BattleSystem * param0, int param1, int param2);
Expand Down
8 changes: 7 additions & 1 deletion include/unk_02022594.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ int sub_020226DC(const UnkUnion_020225E0 * param0);
BOOL sub_02022734(const UnkUnion_020225E0 * param0);
BOOL sub_02022760(const UnkUnion_020225E0 * param0);
BOOL sub_0202278C(void);
BOOL sub_02022798(void);

/**
* @brief Check if the touch screen is tapped.
*
* @return TRUE if the touch screen is tapped, FALSE otherwise.
*/
BOOL TouchScreen_Tapped(void);
BOOL sub_020227A4(u32 * param0, u32 * param1);
BOOL sub_020227C0(u32 * param0, u32 * param1);
int sub_020227DC(const UnkUnion_020225E0 * param0, u32 param1, u32 param2);
Expand Down
4 changes: 2 additions & 2 deletions src/error_message_reset.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "data_021BF67C.h"
#include "coresys.h"

#include "message.h"
#include "struct_decls/struct_02018340_decl.h"
Expand Down Expand Up @@ -128,7 +128,7 @@ void ErrorMessageReset_PrintErrorAndReset (void)
GXS_SetVisiblePlane(0);

sub_02017DD4(4, 8);
Unk_021BF67C.unk_65 = 0;
coresys.unk_65 = 0;
GXLayers_SwapDisplay();

G2_BlendNone();
Expand Down
4 changes: 2 additions & 2 deletions src/gx_layers.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <string.h>
#include <nnsys.h>

#include "data_021BF67C.h"
#include "coresys.h"

#include "struct_defs/struct_02099F80.h"

Expand Down Expand Up @@ -98,7 +98,7 @@ void GXLayers_TurnBothDispOn (void)

void GXLayers_SwapDisplay (void)
{
if (Unk_021BF67C.unk_65 == 0) {
if (coresys.unk_65 == 0) {
GX_SetDispSelect(GX_DISP_SELECT_MAIN_SUB);
} else {
GX_SetDispSelect(GX_DISP_SELECT_SUB_MAIN);
Expand Down
46 changes: 23 additions & 23 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <dwc.h>
#include <string.h>

#include "data_021BF67C.h"
#include "coresys.h"
#include "assert.h"

#include "struct_decls/struct_020067E8_decl.h"
Expand Down Expand Up @@ -108,8 +108,8 @@ void NitroMain (void)
}
}

Unk_021BF67C.unk_6C = 1;
Unk_021BF67C.unk_30 = 0;
coresys.unk_6C = 1;
coresys.unk_30 = 0;

sub_02001028();
sub_0200AB84();
Expand All @@ -122,43 +122,43 @@ void NitroMain (void)
sub_0200106C();
sub_02017B9C();

if ((Unk_021BF67C.unk_38 & (PAD_BUTTON_START | PAD_BUTTON_SELECT | PAD_BUTTON_L | PAD_BUTTON_R)) == (PAD_BUTTON_START | PAD_BUTTON_SELECT | PAD_BUTTON_L | PAD_BUTTON_R)) {
if (Unk_021BF67C.unk_68 == 0) {
if ((coresys.unk_38 & (PAD_BUTTON_START | PAD_BUTTON_SELECT | PAD_BUTTON_L | PAD_BUTTON_R)) == (PAD_BUTTON_START | PAD_BUTTON_SELECT | PAD_BUTTON_L | PAD_BUTTON_R)) {
if (coresys.unk_68 == 0) {
sub_02000F60(0);
}
}

if (sub_020349EC()) {
sub_02000F30();
sub_02000E54();
sub_0201CDD4(Unk_021BF67C.unk_18);
sub_0201CDD4(Unk_021BF67C.unk_24);
sub_0201CDD4(coresys.unk_18);
sub_0201CDD4(coresys.unk_24);

if (!Unk_021BF67C.unk_30) {
if (!coresys.unk_30) {
OS_WaitIrq(1, OS_IE_V_BLANK);
Unk_021BF67C.unk_2C++;
coresys.unk_2C++;
}
}

sub_020137C4();
sub_02017458();
sub_020241CC();
sub_0201CDD4(Unk_021BF67C.unk_24);
sub_0201CDD4(coresys.unk_24);

OS_WaitIrq(1, OS_IE_V_BLANK);

Unk_021BF67C.unk_2C++;
Unk_021BF67C.unk_30 = 0;
coresys.unk_2C++;
coresys.unk_30 = 0;

sub_0200ABF0();
sub_0200F27C();

if (Unk_021BF67C.unk_00 != NULL) {
Unk_021BF67C.unk_00(Unk_021BF67C.unk_04);
if (coresys.unk_00 != NULL) {
coresys.unk_00(coresys.unk_04);
}

sub_02003BD8();
sub_0201CDD4(Unk_021BF67C.unk_20);
sub_0201CDD4(coresys.unk_20);
}
}

Expand Down Expand Up @@ -215,11 +215,11 @@ static void sub_02000EE4 (void)

OS_WaitIrq(1, OS_IE_V_BLANK);

Unk_021BF67C.unk_2C++;
Unk_021BF67C.unk_30 = 0;
coresys.unk_2C++;
coresys.unk_30 = 0;

if (Unk_021BF67C.unk_00 != NULL) {
Unk_021BF67C.unk_00(Unk_021BF67C.unk_04);
if (coresys.unk_00 != NULL) {
coresys.unk_00(coresys.unk_04);
}
}

Expand Down Expand Up @@ -298,7 +298,7 @@ static void sub_02000F94 (int param0, int param1)
sub_02017B9C();

if (v0 >= 30) {
if (Unk_021BF67C.unk_48 & PAD_BUTTON_A) {
if (coresys.padInput & PAD_BUTTON_A) {
break;
}
}
Expand All @@ -321,7 +321,7 @@ void sub_02001028 (void)

sub_0201384C(&v0, &v1);

v2 = v0.year + v0.month * 0x100 * v0.day * 0x10000 + v1.hour * 0x10000 + (v1.minute + v1.second) * 0x1000000 + Unk_021BF67C.unk_2C;
v2 = v0.year + v0.month * 0x100 * v0.day * 0x10000 + v1.hour * 0x10000 + (v1.minute + v1.second) * 0x1000000 + coresys.unk_2C;

MTRNG_SetSeed(v2);
LCRNG_SetSeed(v2);
Expand All @@ -333,7 +333,7 @@ void sub_0200106C (void)
PMWakeUpTrigger v2;

if (PAD_DetectFold()) {
if (Unk_021BF67C.unk_67 == 0) {
if (coresys.unk_67 == 0) {
sub_0201E630();

if (CTRDG_IsPulledOut() == TRUE) {
Expand All @@ -343,7 +343,7 @@ void sub_0200106C (void)
GOTOLABEL:
v2 = PM_TRIGGER_COVER_OPEN | PM_TRIGGER_CARD;

if (Unk_021BF67C.unk_66 && (Unk_02101D24 == FALSE)) {
if (coresys.unk_66 && (Unk_02101D24 == FALSE)) {
v2 |= PM_TRIGGER_CARTRIDGE;
}

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 @@ -2,7 +2,7 @@
#include <string.h>

#include "inlines.h"
#include "data_021BF67C.h"
#include "coresys.h"
#include "data_02100844.h"

#include "struct_decls/struct_020067E8_decl.h"
Expand Down Expand Up @@ -539,7 +539,7 @@ static void ov5_021D134C (UnkStruct_0203CDB0 * param0, u8 param1)
ov5_021D15F4(param0);
}

if (Unk_021BF67C.unk_48 & PAD_BUTTON_X) {
if (coresys.padInput & PAD_BUTTON_X) {
(void)0;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/overlay005/ov5_021DC018.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "data_021BF67C.h"
#include "coresys.h"

#include "struct_decls/struct_0200112C_decl.h"
#include "struct_decls/struct_02001AF4_decl.h"
Expand Down Expand Up @@ -560,7 +560,7 @@ static void ov5_021DC95C (UnkStruct_0201CD38 * param0, void * param1)
sub_02005748(1500);
}

if ((Unk_021BF67C.unk_4C & PAD_KEY_UP) || (Unk_021BF67C.unk_4C & PAD_KEY_DOWN) || (Unk_021BF67C.unk_4C & PAD_KEY_LEFT) || (Unk_021BF67C.unk_4C & PAD_KEY_RIGHT)) {
if ((coresys.unk_4C & PAD_KEY_UP) || (coresys.unk_4C & PAD_KEY_DOWN) || (coresys.unk_4C & PAD_KEY_LEFT) || (coresys.unk_4C & PAD_KEY_RIGHT)) {
ov5_021DCAF4(v2);
}

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

#include "data_021BF67C.h"
#include "coresys.h"

#include "struct_decls/struct_0201CD38_decl.h"
#include "struct_decls/struct_020216E0_decl.h"
Expand Down Expand Up @@ -878,7 +878,7 @@ static BOOL ov5_021E0560 (UnkStruct_020508D4 * param0)
case 2:
{
int v2 = sub_0205EA78(v0->unk_0C);
u32 v3, v4 = Unk_021BF67C.unk_48, v5 = Unk_021BF67C.unk_44;
u32 v3, v4 = coresys.padInput, v5 = coresys.unk_44;
int v6 = sub_02061308(v0->unk_0C, v4, v5);

if ((v6 == -1) || (v6 == v2)) {
Expand Down
6 changes: 3 additions & 3 deletions src/overlay005/ov5_021F08CC.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "data_021BF67C.h"
#include "coresys.h"

#include "message.h"
#include "struct_decls/struct_0200B358_decl.h"
Expand Down Expand Up @@ -489,7 +489,7 @@ static void * ov5_021F0D1C (u32 param0)

static int ov5_021F0D40 (void)
{
if ((Unk_021BF67C.unk_48 & PAD_BUTTON_A)) {
if ((coresys.padInput & PAD_BUTTON_A)) {
return 1;
}

Expand All @@ -498,7 +498,7 @@ static int ov5_021F0D40 (void)

static int ov5_021F0D54 (void)
{
if ((Unk_021BF67C.unk_48 & (PAD_BUTTON_A | PAD_BUTTON_B))) {
if ((coresys.padInput & (PAD_BUTTON_A | PAD_BUTTON_B))) {
return 1;
}

Expand Down
10 changes: 5 additions & 5 deletions src/overlay006/ov6_0223E140.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "data_021BF67C.h"
#include "coresys.h"

#include "struct_decls/struct_02006C24_decl.h"
#include "struct_decls/struct_02018340_decl.h"
Expand Down Expand Up @@ -2194,25 +2194,25 @@ static BOOL ov6_02240364 (UnkStruct_ov6_022401B8 * param0, int param1, int param
BOOL v1[2] = {0, 0};
UnkStruct_ov6_02240260 * v2 = &param0->unk_34;

if (Unk_021BF67C.unk_48 & PAD_KEY_UP) {
if (coresys.padInput & PAD_KEY_UP) {
v2->unk_00++;
v2->unk_00 %= 32;
}

if (Unk_021BF67C.unk_48 & PAD_KEY_DOWN) {
if (coresys.padInput & PAD_KEY_DOWN) {
if (v2->unk_00) {
v2->unk_00--;
} else {
v2->unk_00 = 31;
}
}

if (Unk_021BF67C.unk_48 & PAD_KEY_RIGHT) {
if (coresys.padInput & PAD_KEY_RIGHT) {
v2->unk_04++;
v2->unk_04 %= 32;
}

if (Unk_021BF67C.unk_48 & PAD_KEY_LEFT) {
if (coresys.padInput & PAD_KEY_LEFT) {
if (v2->unk_04) {
v2->unk_04--;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/overlay006/ov6_022477B8.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <nitro.h>
#include <string.h>

#include "data_021BF67C.h"
#include "coresys.h"

#include "overlay006/struct_ov6_02242634.h"

Expand All @@ -13,7 +13,7 @@ void ov6_022477B8 (const UnkStruct_ov6_02242634 * param0, const BOOL param1, int
return;
}

switch (Unk_021BF67C.unk_66) {
switch (coresys.unk_66) {
case 1:
(*param2) = param0->unk_88[0];
(*param3) = param0->unk_88[1];
Expand Down
Loading
Loading