summaryrefslogtreecommitdiff
path: root/src/code_8057824_1.c
diff options
context:
space:
mode:
authorCheng Hann Gan <chenghanngan.us@gmail.com>2021-09-09 19:22:48 -0400
committerGitHub <noreply@github.com>2021-09-09 16:22:48 -0700
commit8237e29a164211eb2ec4cd161eb4183cc1947fee (patch)
tree67dc502264b755dc620f56969f3bea68a40b17af /src/code_8057824_1.c
parent4eff1882443b0004d9c9fa4895cdfefdc356565f (diff)
Defined more in-dungeon structs and enums (#53)
* Defined DungeonEntity * Rename EntityType enums * Revert EntityType rename * Defined more in-dungeon structs and enums * Added more dungeon global structs/enums * Prefixed dungeonGlobalData with g * Fixed compile errors * Removed some CRLFs * Fixed compile after merge * Revert Makefile * Rename DungeonEntityData.entityType Co-authored-by: Seth Barberee <seth.barberee@gmail.com> * Renamed symbols per PR comments Co-authored-by: Cheng Hann Gan <chenghann_gan@ultimatesoftware.com> Co-authored-by: Seth Barberee <seth.barberee@gmail.com>
Diffstat (limited to 'src/code_8057824_1.c')
-rw-r--r--src/code_8057824_1.c131
1 files changed, 66 insertions, 65 deletions
diff --git a/src/code_8057824_1.c b/src/code_8057824_1.c
index 29ab09e..d88918f 100644
--- a/src/code_8057824_1.c
+++ b/src/code_8057824_1.c
@@ -1,10 +1,11 @@
#include "global.h"
-#include "gUnknown_203B418.h"
+#include "dungeon_global_data.h"
#include "dungeon_entity.h"
#include "pokemon.h"
#include "item.h"
+#include "constants/direction.h"
-extern struct unkStruct_203B418 *gUnknown_203B418;
+extern struct DungeonGlobalData *gDungeonGlobalData;
extern u32 gUnknown_202EDC8;
extern u8 gUnknown_202E038[0x50];
@@ -424,13 +425,13 @@ void sub_8087704(struct DungeonEntity *param_1)
{
int iVar1;
- param_1->unk70->unk15C = 1;
- param_1->unk70->unk15E = 0;
- param_1->unk70->unk174 = 200;
+ param_1->entityData->unk15C = 1;
+ param_1->entityData->unk15E = 0;
+ param_1->entityData->unk174 = 200;
PlaySoundEffect(0x1ea);
for(iVar1 = 200; iVar1 >= 0; iVar1 -= 5)
{
- param_1->unk70->unk174 = iVar1 * 256;
+ param_1->entityData->unk174 = iVar1 * 256;
sub_803E46C(0x46);
}
sub_803E708(0x1e,0x46);
@@ -523,7 +524,7 @@ void sub_80878F4(char param_1, s32 param_2)
{
if ((((param_2 * 0x1000000) + 0xF6000000U) >> 0x18 < 3) && (param_1 == 0x9)) {
sub_8097FA8(0x7);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
@@ -656,7 +657,7 @@ void MoltresPostStoryPreFightDialogue(void)
sub_803E708(10,0x46);
sub_8052910(&gUnknown_8100D3C);
sub_803E708(10,0x46);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
else {
sub_8052910(&gUnknown_810232C);
@@ -682,14 +683,14 @@ void sub_8087D30(struct DungeonEntity * param_1)
{
s32 iVar1;
- param_1->unk70->unk15C = 1;
- param_1->unk70->unk15E = 0;
- param_1->unk70->unk174 = 0xc800;
+ param_1->entityData->unk15C = 1;
+ param_1->entityData->unk15E = 0;
+ param_1->entityData->unk174 = 0xc800;
PlaySoundEffect(0x1f8);
iVar1 = 200;
for(iVar1 = 200; iVar1 >= 0; iVar1 -= 5)
{
- param_1->unk70->unk174 = iVar1 * 256;
+ param_1->entityData->unk174 = iVar1 * 256;
sub_803E46C(0x46);
}
}
@@ -943,7 +944,7 @@ void sub_8088088(char param_1, s32 param_2)
{
if ((((param_2 * 0x1000000) + 0xF3000000U) >> 0x18 < 3) && (param_1 == 0xD)) {
sub_8097FA8(0x9);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
@@ -997,7 +998,7 @@ void ArticunoPreFightDialogue(void)
sub_8052910(&gUnknown_810272C);
sub_803E708(10,0x46);
PlaySoundEffect(0); // snow flurry
- gUnknown_203B418->unkE265 = 7;
+ gDungeonGlobalData->unkE265 = 7;
sub_807EAA0(0,1);
PlaySoundEffect(0x1ee); // flash effect?
sub_8088574();
@@ -1032,7 +1033,7 @@ void ArticunoReFightDialogue(void)
iVar1 = sub_8085480();
uVar2 = sub_8085680(0xd);
- gUnknown_203B418->unkE265 = 7;
+ gDungeonGlobalData->unkE265 = 7;
sub_807EAA0(0,1);
sub_803E708(10,0x46);
sub_8052910(&gUnknown_81028D4);
@@ -1059,7 +1060,7 @@ void ArticunoPostStoryPreFightDialogue(void)
sub_80866C4(&gUnknown_8102A9C);
}
else {
- gUnknown_203B418->unkE265 = 7;
+ gDungeonGlobalData->unkE265 = 7;
sub_807EAA0(0,1);
ArticunoScreenFlash();
sub_8086738();
@@ -1088,12 +1089,12 @@ void sub_8088484(struct DungeonEntity *param_1)
{
int iVar1;
- param_1->unk70->unk15C = 1;
- param_1->unk70->unk15E = 0;
+ param_1->entityData->unk15C = 1;
+ param_1->entityData->unk15E = 0;
PlaySoundEffect(0x1ea);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 5)
{
- param_1->unk70->unk174 = iVar1 * 256;
+ param_1->entityData->unk174 = iVar1 * 256;
sub_8085C54(iVar1,iVar1,iVar1 / 2,1,0);
sub_803E46C(0x46);
}
@@ -1141,7 +1142,7 @@ void sub_80885A0(void)
sub_8083ED8(0x3c);
sub_803E708(0x3c,0x46);
sub_8083F14();
- gUnknown_203B418->unk7 = 1;
+ gDungeonGlobalData->unk7 = 1;
}
void sub_80885C4(void)
@@ -1160,7 +1161,7 @@ void sub_80885C4(void)
void sub_8088608(void)
{
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
void sub_8088618(void)
@@ -1255,7 +1256,7 @@ void sub_8088818(char param_1, s32 param_2)
{
if ((((param_2 * 0x1000000) + 0xEE000000U) >> 0x18 < 3) && (param_1 == 0xE)) {
sub_8097FA8(0xC);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
@@ -1597,8 +1598,8 @@ void MagmaCavernMidDialogue(void)
// Hey! $m0!
// Over there!
sub_8052910(&gUnknown_8102C30);
- iVar3->unk70->unk15E = 0;
- iVar4->unk70->unk15E =0;
+ iVar3->entityData->unk15E = 0;
+ iVar4->entityData->unk15E =0;
local_20[0] = (iVar3->posPixelX + iVar4->posPixelX) / 2;
local_20[1] = (iVar3->posPixelY + iVar4->posPixelY) / 2 + 0x800;
sub_80858AC(local_20,0x20);
@@ -1657,7 +1658,7 @@ void MagmaCavernMidDialogue(void)
// Be careful!
sub_8052910(&gUnknown_8102E54);
sub_803E708(10,0x46);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
void sub_8089168(void)
@@ -1680,14 +1681,14 @@ void sub_808919C(struct DungeonEntity *r0)
void sub_80891B0(struct DungeonEntity *r0)
{
sub_806CDD4(r0, 0, 4);
- r0->unk70->unk15F = 1;
+ r0->entityData->unk15F = 1;
}
void sub_80891D0(struct DungeonEntity *r0)
{
sub_806CDD4(r0, 7, 4);
- r0->unk70->unk15F = 0;
+ r0->entityData->unk15F = 0;
}
void sub_80891F0(void)
@@ -1802,7 +1803,7 @@ void sub_80893B4(char param_1, s32 param_2)
{
if ((((param_2 * 0x1000000) + 0xE9000000U) >> 0x18 < 3) && (param_1 == 0xF)) {
sub_8097FA8(0xF);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
@@ -1903,7 +1904,7 @@ void sub_8089620(struct DungeonEntity *param_1)
s32 iVar1;
s32 iVar2;
- param_1->unk70->unk15E = 0;
+ param_1->entityData->unk15E = 0;
iVar2 = 51200;
iVar1 = 0x600;
PlaySoundEffect(0x1f8);
@@ -1914,10 +1915,10 @@ void sub_8089620(struct DungeonEntity *param_1)
iVar1 = 0x14;
}
if (iVar2 < 0) break;
- param_1->unk70->unk174 = iVar2;
+ param_1->entityData->unk174 = iVar2;
sub_803E46C(0x46);
}
- param_1->unk70->unk174 = 0;
+ param_1->entityData->unk174 = 0;
}
void RayquazaScreenFlash(void)
@@ -1983,15 +1984,15 @@ void sub_8089788(struct DungeonEntity *param_1, u8 param_2, s32 param_3)
if ((((param_3 * 0x1000000) + 0xe6000000U) >> 0x18) < 2) {
for(iVar3 = 0; iVar3 < 0x10; iVar3++)
{
- iVar2 = gUnknown_203B418->unk1358C[iVar3];
- if ((sub_80450E0(iVar2) != '\0') && (iVar2 != param_1) && (iVar2->unk70->clientFlags == param_2)) {
+ iVar2 = gDungeonGlobalData->wildPokemon[iVar3];
+ if ((sub_80450E0(iVar2) != '\0') && (iVar2 != param_1) && (iVar2->entityData->clientFlags == param_2)) {
return;
}
}
// WTF is this??
if(!unk1){
sub_8097FA8(0x11);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
}
@@ -2075,7 +2076,7 @@ void sub_8089914(void)
iVar1 = sub_8085480();
uVar2 = sub_8085680(0x11);
sub_8083F14();
- gUnknown_203B418->unk7 = 1;
+ gDungeonGlobalData->unk7 = 1;
sub_80854D4();
sub_8085930(4);
sub_80855E4(sub_8086A3C);
@@ -2101,7 +2102,7 @@ void sub_8089978(void)
sub_8068FE0(uVar3,0x21c,0);
}
else {
- gUnknown_203B418->unk7 = 1;
+ gDungeonGlobalData->unk7 = 1;
sub_8085918(uVar3,0);
sub_8086A3C(uVar3);
}
@@ -2113,7 +2114,7 @@ void sub_8089A00(char param_1, s32 param_2)
{
if ((((param_2 * 0x1000000) + 0xE3000000U) >> 0x18 < 3) && (param_1 == 0x11)) {
sub_8097FA8(0x13);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
@@ -2176,7 +2177,7 @@ void sub_8089B64(struct DungeonEntity *param_1)
s32 iVar1;
s32 iVar2;
- param_1->unk70->unk15E = 0;
+ param_1->entityData->unk15E = 0;
iVar2 = 51200;
iVar1 = 0x400;
PlaySoundEffect(0x1f8);
@@ -2187,10 +2188,10 @@ void sub_8089B64(struct DungeonEntity *param_1)
iVar1 = 0x1e;
}
if (iVar2 < 0) break;
- param_1->unk70->unk174 = iVar2;
+ param_1->entityData->unk174 = iVar2;
sub_803E46C(0x46);
}
- param_1->unk70->unk174 = 0;
+ param_1->entityData->unk174 = 0;
}
void MewtwoScreenFlash(void)
@@ -2260,7 +2261,7 @@ void sub_8089CFC(char param_1,int param_2)
{
if ((((param_2 * 0x1000000) + 0xE0000000U) >> 0x18 < 3) && (param_1 == 0x12)) {
sub_8097FA8(0x15);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
@@ -2406,7 +2407,7 @@ void sub_8089FF0(char param_1,int param_2)
{
if ((((param_2 * 0x1000000) + 0xdD000000U) >> 0x18 < 3) && (param_1 == 0x13)) {
sub_8097FA8(0x17);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
@@ -2421,7 +2422,7 @@ void RaikouPreFightDialogue(void)
sub_8052910(&gUnknown_8104450);
RaikouScreenFlash();
sub_8052910(&gUnknown_81044B4);
- gUnknown_203B418->unkE265 = 4;
+ gDungeonGlobalData->unkE265 = 4;
sub_807EAA0(0,1);
sub_803E708(10,70);
sub_8052910(&gUnknown_8104510);
@@ -2443,7 +2444,7 @@ void RaikouPreFightDialogue1(void)
iVar2 = sub_8085480();
uVar3 = sub_8085680(0x13);
- gUnknown_203B418->unkE265 = 4;
+ gDungeonGlobalData->unkE265 = 4;
sub_807EAA0(0,1);
RaikouScreenFlash();
sub_8052910(&gUnknown_81045F8);
@@ -2467,7 +2468,7 @@ void RaikouPreFightDialogue2(void)
sub_80866C4(&gUnknown_8104778);
}
else {
- gUnknown_203B418->unkE265 = 4;
+ gDungeonGlobalData->unkE265 = 4;
sub_807EAA0(0,1);
sub_8052910(&gUnknown_81046CC);
RaikouScreenFlash();
@@ -2562,7 +2563,7 @@ void sub_808A36C(char param_1,int param_2)
{
if ((((param_2 * 0x1000000) + 0xda000000U) >> 0x18 < 3) && (param_1 == 0x14)) {
sub_8097FA8(0x19);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
@@ -2638,7 +2639,7 @@ void sub_808A528(struct DungeonEntity * param_1)
s32 iVar1;
s32 iVar2;
- param_1->unk70->unk15E = 0;
+ param_1->entityData->unk15E = 0;
iVar2 = 51200;
iVar1 = 3072;
PlaySoundEffect(0x1f8);
@@ -2649,10 +2650,10 @@ void sub_808A528(struct DungeonEntity * param_1)
iVar1 = 20;
}
if (iVar2 < 0) break;
- param_1->unk70->unk174 = iVar2;
+ param_1->entityData->unk174 = iVar2;
sub_803E46C(70);
}
- param_1->unk70->unk174 = 0;
+ param_1->entityData->unk174 = 0;
}
void SuicuneScreenFlash(void)
@@ -2726,7 +2727,7 @@ void sub_808A6E8(char param_1, s32 param_2)
{
if ((((param_2 * 0x1000000) + 0xd7000000U) >> 0x18 < 2) && (param_1 == 0x15)) {
sub_8097FA8(0x1A);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
@@ -2817,7 +2818,7 @@ void sub_808A904(struct DungeonEntity * param_1)
s32 iVar1;
s32 iVar2;
- param_1->unk70->unk15E = 0;
+ param_1->entityData->unk15E = 0;
iVar2 = 51200;
iVar1 = 3072;
PlaySoundEffect(0x1f8);
@@ -2828,10 +2829,10 @@ void sub_808A904(struct DungeonEntity * param_1)
iVar1 = 20;
}
if (iVar2 < 0) break;
- param_1->unk70->unk174 = iVar2;
+ param_1->entityData->unk174 = iVar2;
sub_803E46C(70);
}
- param_1->unk70->unk174 = 0;
+ param_1->entityData->unk174 = 0;
}
void HoOhScreenFlash(void)
@@ -2912,7 +2913,7 @@ void sub_808AAF0(char param_1, s32 param_2)
{
if ((((param_2 * 0x1000000) + 0xd5000000U) >> 0x18 < 3) && (param_1 == 0x16)) {
sub_8097FA8(0x1c);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
}
@@ -3292,7 +3293,7 @@ void sub_808B1CC(u8 r0)
"\tstrb r0, [r1, 0x2]\n"
"\tb _0808B2A8\n"
"\t.align 2, 0\n"
-"_0808B21C: .4byte gUnknown_203B418\n"
+"_0808B21C: .4byte gDungeonGlobalData\n"
"_0808B220: .4byte 0x00000684\n"
"_0808B224: .4byte 0xffff0000\n"
"_0808B228: .4byte 0x00000686\n"
@@ -3362,7 +3363,7 @@ void sub_808B1CC(u8 r0)
void sub_808B2B0(struct DungeonEntity *r0)
{
- r0->unk70->facingDir = NORTH;
+ r0->entityData->facingDir = DIRECTION_NORTH;
sub_806CE68(r0, 4);
}
@@ -3437,17 +3438,17 @@ void sub_808B3E4(u8 param_1,u8 param_2,u8 param_3)
if (((((param_2 * 0x1000000) + 0xcf000000U) >> 0x18) < 2) && (param_1 == 0x1A)){
sub_8097FA8(0x1e);
if (param_3 != 0) {
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}
else {
- uVar1 = gUnknown_203B418->unk1356C;
+ uVar1 = gDungeonGlobalData->unk1356C;
if (sub_80860A8(0x36) != 0) {
JirachiWish();
}
else {
sub_808B50C();
}
- gUnknown_203B418->unk1356C = uVar1;
+ gDungeonGlobalData->unk1356C = uVar1;
sub_8040A84();
}
}
@@ -3481,7 +3482,7 @@ void sub_808B3E4(u8 param_1, u8 param_2, u8 param_3)
"\tstrb r0, [r1, 0x2]\n"
"\tb _0808B44E\n"
"\t.align 2, 0\n"
-"_0808B414: .4byte gUnknown_203B418\n"
+"_0808B414: .4byte gDungeonGlobalData\n"
"_0808B418:\n"
"\tldr r0, _0808B434\n"
"\tldr r0, [r0]\n"
@@ -3496,7 +3497,7 @@ void sub_808B3E4(u8 param_1, u8 param_2, u8 param_3)
"\tbl JirachiWish\n"
"\tb _0808B440\n"
"\t.align 2, 0\n"
-"_0808B434: .4byte gUnknown_203B418\n"
+"_0808B434: .4byte gDungeonGlobalData\n"
"_0808B438: .4byte 0x0001356c\n"
"_0808B43C:\n"
"\tbl sub_808B50C\n"
@@ -3512,7 +3513,7 @@ void sub_808B3E4(u8 param_1, u8 param_2, u8 param_3)
"\tpop {r0}\n"
"\tbx r0\n"
"\t.align 2, 0\n"
-"_0808B454: .4byte gUnknown_203B418\n"
+"_0808B454: .4byte gDungeonGlobalData\n"
"_0808B458: .4byte 0x0001356c");
}
#endif
@@ -3553,8 +3554,8 @@ void sub_808B50C(void)
sub_80855E4(sub_808BBA8);
sub_808BBA8(iVar1);
sub_8041888(0);
- iVar1->unk70->unk15C = 1;
- iVar1->unk70->unk15E = 0;
+ iVar1->entityData->unk15C = 1;
+ iVar1->entityData->unk15E = 0;
sub_80861B8(iVar1,0xe,0);
sub_8083ED8(0x1e);
sub_803E708(0x1e,70);
@@ -3569,5 +3570,5 @@ void sub_808B50C(void)
sub_808BC20(iVar1);
sub_8052910(&gUnknown_81055F4);
sub_803E708(10,70);
- gUnknown_203B418->unk2 = 1;
+ gDungeonGlobalData->unk2 = 1;
}