diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/code_8040094.c | 20 | ||||
-rw-r--r-- | src/code_8041AD0.c | 10 | ||||
-rw-r--r-- | src/code_8048480.c | 7 | ||||
-rw-r--r-- | src/code_80521D0_1.c | 63 | ||||
-rw-r--r-- | src/code_8057824.c | 10 | ||||
-rw-r--r-- | src/code_8057824_1.c | 131 | ||||
-rw-r--r-- | src/code_80869E4.c | 25 | ||||
-rw-r--r-- | src/code_8086A3C.c | 42 | ||||
-rw-r--r-- | src/debug_menu_mid.c | 2 | ||||
-rw-r--r-- | src/friend_area_action_menu_1.c | 6 | ||||
-rw-r--r-- | src/friend_rescue_1.c | 8 | ||||
-rw-r--r-- | src/items.c | 154 | ||||
-rw-r--r-- | src/kecleon_items_1.c | 12 | ||||
-rw-r--r-- | src/pokemon_mid.c | 46 | ||||
-rw-r--r-- | src/thank_you_wonder_mail.c | 38 | ||||
-rw-r--r-- | src/trade_items_menu.c | 26 | ||||
-rw-r--r-- | src/wonder_mail.c | 3 |
17 files changed, 303 insertions, 300 deletions
diff --git a/src/code_8040094.c b/src/code_8040094.c index fc5abb1..4db3e6c 100644 --- a/src/code_8040094.c +++ b/src/code_8040094.c @@ -1,10 +1,10 @@ #include "global.h" #include "play_time.h" #include "file_system.h" -#include "gUnknown_203B418.h" +#include "dungeon_global_data.h" extern struct PlayTimeStruct *gPlayTimeRef; -extern struct unkStruct_203B418 *gUnknown_203B418; +extern struct DungeonGlobalData *gDungeonGlobalData; extern s32 gUnknown_80F6568[]; extern u8 gUnknown_202EE01; extern const char gUnknown_80F6604; // "zmappat" @@ -41,8 +41,8 @@ void sub_804002C(u32 param_1) int innerCounter; int iVar3; int iVar4; - - gUnknown_203B418->unk1820B = 1; + + gDungeonGlobalData->unk1820B = 1; iVar3 = 0; do { innerCounter = 0; @@ -62,7 +62,7 @@ void sub_804002C(u32 param_1) void sub_8040094(u8 r0) { - gUnknown_203B418->unk18217 = r0; + gDungeonGlobalData->unk18217 = r0; sub_803F7BC(); sub_80060EC(); IncrementPlayTime(gPlayTimeRef); @@ -76,15 +76,15 @@ void sub_8040094(u8 r0) void sub_80400D4(void) { s32 temp; - temp = gUnknown_203B418->unk18200; + temp = gDungeonGlobalData->unk18200; if(temp == 0) return; if(temp > 0x1E) temp = 0x1F; - gUnknown_203B418->unk181FC = gUnknown_80F6568[temp]; - gUnknown_203B418->unk18200--; - if(gUnknown_203B418->unk18200 == 0) - gUnknown_203B418->unk18200 = gUnknown_203B418->unk18204; + gDungeonGlobalData->unk181FC = gUnknown_80F6568[temp]; + gDungeonGlobalData->unk18200--; + if(gDungeonGlobalData->unk18200 == 0) + gDungeonGlobalData->unk18200 = gDungeonGlobalData->unk18204; } void sub_8040124(void) diff --git a/src/code_8041AD0.c b/src/code_8041AD0.c index 9874f48..6388af1 100644 --- a/src/code_8041AD0.c +++ b/src/code_8041AD0.c @@ -1,6 +1,6 @@ #include "global.h" #include "dungeon_entity.h" -#include "gUnknown_203B418.h" +#include "dungeon_global_data.h" struct unkStruct_80420E8 { @@ -9,7 +9,7 @@ struct unkStruct_80420E8 u32 unk8; }; -extern struct unkStruct_203B418 *gUnknown_203B418; +extern struct DungeonGlobalData *gDungeonGlobalData; extern void sub_803ED30(u8, struct DungeonEntity *r0, u8, u8); @@ -289,7 +289,7 @@ void sub_8041D5C(struct DungeonEntity *r0) { return; } - sub_803ED30(r0->unk70->stockpileCount , r0, 1, 0xB); + sub_803ED30(r0->entityData->stockpileCount, r0, 1, 0xB); } void sub_8041D84(struct DungeonEntity * r0) @@ -594,7 +594,7 @@ void sub_80420E8(struct DungeonEntity *r0, struct unkStruct_80420E8 *r1) u32 temp; u32 arg; temp = r1->unk8; - if(gUnknown_203B418->unk16D != 0) + if(gDungeonGlobalData->unk16D != 0) temp = sub_806F62C(r1->unk8); switch(temp) { @@ -675,7 +675,7 @@ void sub_8042208(struct DungeonEntity *r0, u8 r1) void sub_8042238(u32 r0, struct DungeonEntity *r1) { - if(r1->unk70->isEnemy) + if(r1->entityData->isEnemy) PlaySoundEffect(0x157); else PlaySoundEffect(0x156); diff --git a/src/code_8048480.c b/src/code_8048480.c index 470de97..675751e 100644 --- a/src/code_8048480.c +++ b/src/code_8048480.c @@ -1,5 +1,6 @@ #include "global.h" #include "dungeon_entity.h" +#include "constants/status.h" extern u32 gUnknown_80F89F4; extern u8 gAvailablePokemonNames[0x58]; @@ -81,7 +82,7 @@ void sub_804841C(struct DungeonEntity *r0, struct DungeonEntity *r1) void sub_8048428(struct DungeonEntity *r0, struct DungeonEntity *r1) { - if(r1->unk70->statusCondition == 4) // 4 - Paralyzed?? + if(r1->entityData->nonVolatileStatus == NON_VOLATILE_STATUS_PARALYZED) sub_807A290(r0, r1); else // Pointer to "But nothing happened!" @@ -90,7 +91,7 @@ void sub_8048428(struct DungeonEntity *r0, struct DungeonEntity *r1) void sub_8048450(struct DungeonEntity *r0, struct DungeonEntity *r1) { - if((u8)(r1->unk70->statusCondition - 2) <= 1) + if((u8)(r1->entityData->nonVolatileStatus - 2) <= 1) sub_807A290(r0, r1); else // Pointer to "But nothing happened!" @@ -135,7 +136,7 @@ void sub_80484DC(struct DungeonEntity *r0, struct DungeonEntity *r1) void sub_80484E8(struct DungeonEntity *r0, struct DungeonEntity *r1) { - if(r1->unk70->statusCondition == 1) // 1 - Burn?? + if(r1->entityData->nonVolatileStatus == NON_VOLATILE_STATUS_BURNED) sub_807A290(r0, r1); else { diff --git a/src/code_80521D0_1.c b/src/code_80521D0_1.c index d71de9a..ecb0ec1 100644 --- a/src/code_80521D0_1.c +++ b/src/code_80521D0_1.c @@ -1,14 +1,15 @@ #include "global.h" -#include "gUnknown_203B418.h" +#include "dungeon_global_data.h" #include "dungeon_entity.h" #include "friend_area.h" #include "constants/friend_area.h" #include "pokemon.h" +#include "constants/direction.h" extern struct DungeonEntity *sub_8085480(void); extern struct DungeonEntity *sub_8085680(u32); extern char gUnknown_202E038[0x50]; -extern struct unkStruct_203B418 *gUnknown_203B418; +extern struct DungeonGlobalData *gDungeonGlobalData; extern u32 gUnknown_202EDC8; extern u32 gUnknown_81062A8; @@ -148,11 +149,11 @@ struct unk8049590 }; extern struct unk8049590 *sub_8049590(u32, u32); -extern void sub_806BFC0(struct subStruct_8048524 *, u32); +extern void sub_806BFC0(struct DungeonEntityData *, u32); void sub_808BBA8(struct DungeonEntity *param_1) { - sub_806BFC0(param_1->unk70,0); + sub_806BFC0(param_1->entityData,0); } void sub_808BBB8(struct DungeonEntity *param_1) @@ -172,10 +173,10 @@ void sub_808BBB8(struct DungeonEntity *param_1) iVar2 = 0x100; } if (iVar1 < 0) break; - param_1->unk70->unk174 = iVar1; + param_1->entityData->unk174 = iVar1; sub_803E46C(0x46); } - param_1->unk70->unk174 = 0; + param_1->entityData->unk174 = 0; } void sub_808BC20(struct DungeonEntity * param_1) @@ -187,7 +188,7 @@ void sub_808BC20(struct DungeonEntity * param_1) sub_8085918(param_1,uVar1 & 7); sub_803E708(3,0x46); } - param_1->unk70->unk15E = 1; + param_1->entityData->unk15E = 1; PlaySoundEffect(0x27f); sub_80861F8(99,param_1,1); } @@ -196,7 +197,7 @@ void JirachiWishGrantDialogue(struct DungeonEntity *param_1) { u32 uVar2; - param_1->unk70->unk15D = 1; + param_1->entityData->unk15D = 1; // Nnnnnnnnnn! sub_8052910(&gUnknown_81058A8); PlaySoundEffect(0x375); @@ -216,7 +217,7 @@ void sub_808BCE4(void) { struct unk8049590 *puVar1; - puVar1 = sub_8049590(gUnknown_203B418->unkE23C, gUnknown_203B418->unkE23E); + puVar1 = sub_8049590(gDungeonGlobalData->unkE23C, gDungeonGlobalData->unkE23E); puVar1->unk0 &= 0xfffc; puVar1->unk0 |= 16; puVar1->unk0 &= 0xfdff; @@ -230,7 +231,7 @@ void sub_808BD38(void) { struct unk8049590 *puVar1; - puVar1 = sub_8049590(gUnknown_203B418->unkE23C, gUnknown_203B418->unkE23E); + puVar1 = sub_8049590(gDungeonGlobalData->unkE23C, gDungeonGlobalData->unkE23E); puVar1->unk0 &= 0xfffc; puVar1->unk0 |= 1; puVar1->unk0 &= 0xffef; @@ -291,7 +292,7 @@ void sub_808BDEC(void) sub_8068FE0(uVar3,0x21c,0); } else { - gUnknown_203B418->unk7 = 1; + gDungeonGlobalData->unk7 = 1; sub_8085918(uVar3,0); } sub_8085860(iVar2->posWorldX,iVar2->posWorldY - 3); @@ -301,7 +302,7 @@ void sub_808BDEC(void) void sub_808BE70(u8 param_1,u8 param_2) { if ((param_2 == 0x33) && (param_1 == 0x1B)) { - gUnknown_203B418->unk2 = 1; + gDungeonGlobalData->unk2 = 1; } } @@ -408,7 +409,7 @@ void sub_808C0CC(void) sub_8085C54(0,0,0,1,1); sub_803E9D0(); sub_803E46C(0x46); - gUnknown_203B418->unk7 = 0; + gDungeonGlobalData->unk7 = 0; sub_808BFA0(); } @@ -429,7 +430,7 @@ void sub_808C10C(void) sub_8068FE0(uVar2,0x21c,0); } else { - gUnknown_203B418->unk7 = 1; + gDungeonGlobalData->unk7 = 1; sub_8085918(uVar2,0); } sub_8085860(iVar1->posWorldX,iVar1->posWorldY); @@ -444,7 +445,7 @@ void sub_808C10C(void) void sub_808C1A4(u8 param_1,u8 param_2) { if ((param_2 == 0x34) && (param_1 == 0x1C)) { - gUnknown_203B418->unk2 = 1; + gDungeonGlobalData->unk2 = 1; sub_8083E88(0x23); } } @@ -463,7 +464,7 @@ void KyogrePreFightDialogue(void) sub_803E708(10,0x46); sub_8052910(&gUnknown_81062A8); sub_803E708(10,0x46); - gUnknown_203B418->unk2 = 1; + gDungeonGlobalData->unk2 = 1; } else { sub_8052910(&gUnknown_8106074); @@ -530,7 +531,7 @@ void sub_808C360(void) sub_8085C54(0,0,0,1,1); sub_803E9D0(); sub_803E46C(0x46); - gUnknown_203B418->unk7 = 0; + gDungeonGlobalData->unk7 = 0; KyogreScreenFlash(); } @@ -547,7 +548,7 @@ void sub_808C3A0(void) sub_808563C(sub_808C590); } else { - gUnknown_203B418->unk7 = 1; + gDungeonGlobalData->unk7 = 1; sub_808563C(sub_808C5A0); } sub_8085860(iVar2->posWorldX,iVar2->posWorldY - 3); @@ -557,7 +558,7 @@ void sub_808C3A0(void) void sub_808C414(u8 param_1,u8 param_2) { if ((param_2 == 0x35) && (param_1 == 0x1D)) { - gUnknown_203B418->unk2 = 1; + gDungeonGlobalData->unk2 = 1; sub_8083E88(0x1a); } } @@ -617,7 +618,7 @@ void sub_808C550(void) sub_8085C54(0,0,0,1,1); sub_803E9D0(); sub_803E46C(0x46); - gUnknown_203B418->unk7 = 0; + gDungeonGlobalData->unk7 = 0; DeoxysScreenFlash(); } @@ -781,7 +782,7 @@ void CelebiJoinDialogue(void) } sub_8083ED8(0x1e); sub_803E708(0x1e,0x46); - gUnknown_203B418->unk2 = 1; + gDungeonGlobalData->unk2 = 1; } #else NAKED @@ -1065,7 +1066,7 @@ void CelebiJoinDialogue(void) "_0808C8D0: .4byte gUnknown_8106500\n" "_0808C8D4: .4byte gUnknown_8106534\n" "_0808C8D8: .4byte gUnknown_8106560\n" -"_0808C8DC: .4byte gUnknown_203B418"); +"_0808C8DC: .4byte gDungeonGlobalData"); } #endif @@ -1076,11 +1077,11 @@ void sub_808C8E0(struct DungeonEntity *param_1) PlaySoundEffect(0x1a5); sub_806CDD4(param_1, 0, 0); for(iVar1 = 0; iVar1 < 16; iVar1++){ - param_1->unk70->unk174 = iVar1 * 256; + param_1->entityData->unk174 = iVar1 * 256; sub_803E46C(0x46); } for(iVar1 = 16; iVar1 < 200; iVar1 += 4){ - param_1->unk70->unk174 = iVar1 * 256; + param_1->entityData->unk174 = iVar1 * 256; sub_803E46C(0x46); } sub_8086A3C(param_1); @@ -1100,14 +1101,14 @@ void sub_808C948(struct DungeonEntity *param_1, u8 param_2) if (param_2 == 0x37) { flag = FALSE; for(iVar3 = 0; iVar3 < 0x10; iVar3++){ - iVar2 = gUnknown_203B418->unk1358C[iVar3]; + iVar2 = gDungeonGlobalData->wildPokemon[iVar3]; if ((iVar2 != param_1) && (sub_80450E0(iVar2) != 0)) { flag = TRUE; break; } } if (!flag) { - gUnknown_203B418->unk2 = 1; + gDungeonGlobalData->unk2 = 1; } } } @@ -1122,7 +1123,7 @@ void sub_808C998(void) void sub_808C9B0(struct DungeonEntity *param_1) { - param_1->unk70->facingDir = NORTH; + param_1->entityData->facingDir = DIRECTION_NORTH; sub_806CE68(param_1, 4); } @@ -1191,8 +1192,8 @@ void MedichamRescueDialogue(void) sub_803E708(0x20, 0x46); sub_8042B0C(temp); sub_8068FE0(temp, 0x21C, 0); - gUnknown_203B418->unk4 = 1; - gUnknown_203B418->unk11 = 4; + gDungeonGlobalData->unk4 = 1; + gDungeonGlobalData->unk11 = 4; } void sub_808CB5C(void) @@ -1281,8 +1282,8 @@ void SmeargleRescueDialogue(void) sub_803E708(0x20, 0x46); sub_8042B0C(temp); sub_8068FE0(temp, 0x21C, 0); - gUnknown_203B418->unk4 = 1; - gUnknown_203B418->unk11 = 4; + gDungeonGlobalData->unk4 = 1; + gDungeonGlobalData->unk11 = 4; } diff --git a/src/code_8057824.c b/src/code_8057824.c index c80aa55..9d0e673 100644 --- a/src/code_8057824.c +++ b/src/code_8057824.c @@ -1,8 +1,8 @@ #include "global.h" -#include "gUnknown_203B418.h" +#include "dungeon_global_data.h" #include "dungeon_entity.h" -extern struct unkStruct_203B418 *gUnknown_203B418; +extern struct DungeonGlobalData *gDungeonGlobalData; extern u32 gUnknown_80FCF74; extern u32 gUnknown_80FCF80; @@ -49,7 +49,7 @@ bool32 sub_805783C(struct DungeonEntity *param_1, struct DungeonEntity *param_2) bool32 sub_805785C(struct DungeonEntity *param_1, struct DungeonEntity *param_2) { - gUnknown_203B418->unkE26B = gUnknown_80F4F42; + gDungeonGlobalData->unkE26B = gUnknown_80F4F42; if (sub_807EAA0(1,0) == '\0') { // The weather remains unchanged sub_80522F4(param_1,param_2,gUnknown_80FCF74); @@ -59,7 +59,7 @@ bool32 sub_805785C(struct DungeonEntity *param_1, struct DungeonEntity *param_2) bool32 sub_80578A4(struct DungeonEntity *param_1, struct DungeonEntity *param_2) { - gUnknown_203B418->unkE26C = gUnknown_80F4F42; + gDungeonGlobalData->weatherTurnsLeft = gUnknown_80F4F42; if (sub_807EAA0(1,0) == '\0') { // The weather remains unchanged sub_80522F4(param_1,param_2,gUnknown_80FCF80); @@ -105,7 +105,7 @@ bool32 sub_8057974(struct DungeonEntity *param_1, struct DungeonEntity *param_2, s32 newHP; u8 local_24; - newHP = param_2->unk70->HP / 2; + newHP = param_2->entityData->HP / 2; local_24 = 0; if (newHP != 0) { sub_806F370(param_1,param_2,newHP,1,&local_24,sub_8092B00(param_3),sub_8057600(param_3,param_4),0,1,0); 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; } diff --git a/src/code_80869E4.c b/src/code_80869E4.c index 9718195..f7ffdb6 100644 --- a/src/code_80869E4.c +++ b/src/code_80869E4.c @@ -1,7 +1,8 @@ #include "global.h" #include "dungeon_entity.h" -#include "gUnknown_203B418.h" +#include "dungeon_global_data.h" #include "random.h" +#include "constants/direction.h" struct unkStruct_202F3D0 { @@ -14,7 +15,7 @@ struct unkStruct_202F3D0 }; EWRAM_DATA struct unkStruct_202F3D0 gUnknown_202F3D0; -extern struct unkStruct_203B418 *gUnknown_203B418; +extern struct DungeonGlobalData *gDungeonGlobalData; s8 sub_8002984(s8, u8); void sub_803E708(u32, u32); @@ -76,7 +77,7 @@ void sub_8086310(struct DungeonEntity *r0) sub_804535C(r0, array); sub_806CE68(r0, 0); sub_8086A3C(r0); - r0->active = 0; + r0->visible = 0; } void sub_8086348(struct DungeonEntity *r0) @@ -314,7 +315,7 @@ void sub_80866C4(u32 r0) sub_8052910(r0); sub_803E708(0xA, 0x46); sub_8086494(); - gUnknown_203B418->unk2 = 1; + gDungeonGlobalData->unk2 = 1; } void sub_80866FC(void) @@ -375,7 +376,7 @@ void sub_8086794(void) } } sub_803E46C(0x46); - gUnknown_203B418->unk7 = 0; + gDungeonGlobalData->unk7 = 0; } void sub_80867F4(void) @@ -438,24 +439,24 @@ void sub_8086854(void) } if(gUnknown_202F3D0.unk5 != 0) gUnknown_202F3D0.unk5--; - gUnknown_203B418->unk181FC = gUnknown_8107314[gUnknown_202F3D0.unk5]; + gDungeonGlobalData->unk181FC = gUnknown_8107314[gUnknown_202F3D0.unk5]; } else { - gUnknown_203B418->unk181FC = 0; + gDungeonGlobalData->unk181FC = 0; } } void sub_80868F4(struct DungeonEntity *r0) { - r0->unk70->unk15C = 1; - r0->unk70->unk15D = 1; + r0->entityData->unk15C = 1; + r0->entityData->unk15D = 1; } void sub_8086910(struct DungeonEntity *r0) { - r0->unk70->unk15C = 0; - r0->unk70->unk15D = 0; + r0->entityData->unk15C = 0; + r0->entityData->unk15D = 0; } void sub_808692C(void) @@ -478,7 +479,7 @@ void SpriteLookAroundEffect(struct DungeonEntity *r0) s8 r4; s8 r3; - r4 = sub_8002984(r0->unk70->facingDir, 4); + r4 = sub_8002984(r0->entityData->facingDir, 4); sub_80869E4(r0, 4, 2, r4); diff --git a/src/code_8086A3C.c b/src/code_8086A3C.c index d740ccd..63c2d44 100644 --- a/src/code_8086A3C.c +++ b/src/code_8086A3C.c @@ -1,9 +1,9 @@ #include "global.h" #include "dungeon_entity.h" -#include "gUnknown_203B418.h" +#include "dungeon_global_data.h" #include "pokemon.h" -extern struct unkStruct_203B418 *gUnknown_203B418; +extern struct DungeonGlobalData *gDungeonGlobalData; extern void sub_807191C(struct DungeonEntity *); extern struct DungeonEntity *sub_8085480(void); extern struct DungeonEntity *sub_8085680(u32); @@ -23,47 +23,47 @@ extern void sub_8097FA8(u32); void sub_8086A3C(struct DungeonEntity *param_1) { - param_1->unk70->unk15C = 1; - param_1->unk70->unk15E = 1; + param_1->entityData->unk15C = 1; + param_1->entityData->unk15E = 1; } void sub_8086A54(struct DungeonEntity *param_1) { - param_1->unk70->unk15C = 1; - param_1->unk70->unk15E = 0; + param_1->entityData->unk15C = 1; + param_1->entityData->unk15E = 0; } void SetupBossFightHP(struct DungeonEntity *param_1, s32 newHP, u16 param_3) { // NOTE: needed two of these to match.. very dumb - struct subStruct_8048524 *iVar1; - struct subStruct_8048524 *iVar2; - - iVar1 = param_1->unk70; - iVar2 = param_1->unk70; - + struct DungeonEntityData *iVar1; + struct DungeonEntityData *iVar2; + + iVar1 = param_1->entityData; + iVar2 = param_1->entityData; + iVar1->isBoss = TRUE; // BUG: Source of the Reviver Seed Boss Glitch // // Video to demonstration: // https://www.youtube.com/watch?v=rHu7EehrZ68 - iVar1->bossHPBackup = iVar1->maxHP; + iVar1->originalHP = iVar1->maxHP; if (newHP != 0) { iVar1->maxHP = newHP; iVar1->HP = newHP; } - gUnknown_203B418->unk66A = param_3; - sub_808EC94(iVar2->unk8C,iVar2->isBoss); + gDungeonGlobalData->unk66A = param_3; + sub_808EC94(iVar2->IQSkillsSelected,iVar2->isBoss); sub_807191C(param_1); } void sub_8086AC0(void) { if(!sub_8044B28()) - if(gUnknown_203B418->unk2 == 0) + if(gDungeonGlobalData->unk2 == 0) sub_8097FF8(); } @@ -71,7 +71,7 @@ u8 sub_8086AE4(s16 _index) { s32 pokeIndex = _index; - if(gUnknown_203B418->unk65C == 0) + if(gDungeonGlobalData->unk65C == 0) return 1; else return HasRecruitedMon(pokeIndex); @@ -82,7 +82,7 @@ void sub_8086B14(void) struct DungeonEntity * iVar1; struct DungeonEntity * iVar2; struct DungeonEntity * uVar3; - + iVar1 = sub_8085480(); iVar2 = sub_8085680(4); uVar3 = sub_8085680(3); @@ -92,7 +92,7 @@ void sub_8086B14(void) sub_8085930(4); sub_80855E4(sub_8086A3C); sub_8086A3C(uVar3); - iVar2->unk70->unk15C = 1; + iVar2->entityData->unk15C = 1; sub_8085860(iVar1->posWorldX,iVar1->posWorldY + -2); CopySpeciesNametoBuffer(gUnknown_202E038,SPECIES_DIGLETT); CopySpeciesNametoBuffer(gUnknown_202E038 + 0x50, SPECIES_SKARMORY); @@ -103,7 +103,7 @@ void sub_8086B94(void) struct DungeonEntity * iVar1; struct DungeonEntity * iVar2; struct DungeonEntity * uVar3; - + iVar1 = sub_8085480(); iVar2 = sub_8085680(4); uVar3 = sub_8085680(3); @@ -119,6 +119,6 @@ void sub_8086BDC(char param_1, s32 param_2) { if ((((param_2 * 0x1000000) - 0x1000000U) >> 0x18 < 2) && (param_1 == 3)) { sub_8097FA8(1); - gUnknown_203B418->unk2 = 1; + gDungeonGlobalData->unk2 = 1; } } diff --git a/src/debug_menu_mid.c b/src/debug_menu_mid.c index a07b6c5..c210773 100644 --- a/src/debug_menu_mid.c +++ b/src/debug_menu_mid.c @@ -180,7 +180,7 @@ void sub_803A51C(void) void sub_803A5A0(void) { struct ItemSlot auStack8; - + switch(gUnknown_203B3F0->state) { case 0: sub_801C8C4(2,3,0,10); diff --git a/src/friend_area_action_menu_1.c b/src/friend_area_action_menu_1.c index a848fff..98427f8 100644 --- a/src/friend_area_action_menu_1.c +++ b/src/friend_area_action_menu_1.c @@ -53,7 +53,7 @@ void sub_8027AE4(void) void sub_8027B28(void) { - switch(sub_801A6E8(1)) + switch(sub_801A6E8(1)) { case 3: gUnknown_203B2BC->unkC = sub_801A8AC(); @@ -81,7 +81,7 @@ void sub_8027B28(void) void sub_8027BD8(void) { s32 menuAction; - + menuAction = 0; sub_801A6E8(0); if ((sub_8012FD8(&gUnknown_203B2BC->unk7C) == 0) && (sub_8013114(&gUnknown_203B2BC->unk7C,&menuAction), menuAction != 1)) { @@ -93,7 +93,7 @@ void sub_8027BD8(void) PlaySound(0x14d); ShiftItemsDownFrom(gUnknown_203B2BC->unkC); FillInventoryGaps(); - if (gUnknown_203B2BC->unk14.unk0 != 0) { + if (gUnknown_203B2BC->unk14.itemFlags != 0) { sub_8091274(&gUnknown_203B2BC->unk14); } GivePokemonItem(gUnknown_203B2BC->unk8,&gUnknown_203B2BC->unk10); diff --git a/src/friend_rescue_1.c b/src/friend_rescue_1.c index 499ba92..325cf4e 100644 --- a/src/friend_rescue_1.c +++ b/src/friend_rescue_1.c @@ -101,7 +101,7 @@ extern u8 gUnknown_80E46C8[]; extern u8 gUnknown_80E4704[]; extern u8 gUnknown_80E4744[]; extern u8 gUnknown_80E4788[]; -extern u8 gUnknown_80E47D8[]; +extern u8 gUnknown_80E47D8[]; extern u8 gUnknown_80E4480[]; extern u8 gUnknown_80E482C[]; @@ -1057,7 +1057,7 @@ void sub_8034848(void) MemoryFill8((u8 *)&gUnknown_203B33C->unk41C, 0 , 4); gUnknown_203B33C->unk41C.itemIndex = ITEM_ID_NOTHING; gUnknown_203B33C->unk41C.numItems = 1; - gUnknown_203B33C->unk41C.unk0 = 0; + gUnknown_203B33C->unk41C.itemFlags = 0; if(gUnknown_203B33C->status == 0) { @@ -1087,7 +1087,7 @@ void sub_80348C4(void) MemoryFill8((u8 *)&gUnknown_203B33C->unk41C, 0 , 4); gUnknown_203B33C->unk41C.itemIndex = ITEM_ID_NOTHING; gUnknown_203B33C->unk41C.numItems = 1; - gUnknown_203B33C->unk41C.unk0 = 0; + gUnknown_203B33C->unk41C.itemFlags = 0; if(gUnknown_203B33C->status == 0) { @@ -1240,7 +1240,7 @@ void sub_8034B88(void) { gUnknown_203B33C->unk41C.itemIndex = ITEM_ID_NOTHING; gUnknown_203B33C->unk41C.numItems = 1; - gUnknown_203B33C->unk41C.unk0 = 0; + gUnknown_203B33C->unk41C.itemFlags = 0; switch(sub_801CA08(1)) { case 2: diff --git a/src/items.c b/src/items.c index 3ced8fe..f4f7170 100644 --- a/src/items.c +++ b/src/items.c @@ -64,10 +64,10 @@ struct TeamInventory *GetMoneyItemsInfo(void) void InitializeMoneyItems(void) { s32 i; - + for(i = 0; i < INVENTORY_SIZE; i++) { - gTeamInventory_203B460->teamItems[i].unk0 = 0; + gTeamInventory_203B460->teamItems[i].itemFlags = 0; } for(i = 0; i < 0xF0; i++) @@ -87,11 +87,11 @@ s32 GetNumberOfFilledInventorySlots(void) { s32 i; s32 count; - + count = 0; for(i = 0; i < INVENTORY_SIZE; i++) { - if ((gTeamInventory_203B460->teamItems[i].unk0 & 1) != 0) { + if ((gTeamInventory_203B460->teamItems[i].itemFlags & ITEM_FLAG_EXISTS) != 0) { count++; } } @@ -102,7 +102,7 @@ bool8 IsThrowableItem(u8 itemIndex) { if ((GetItemType(itemIndex) != ITEM_TYPE_THROWABLE) && (GetItemType(itemIndex) != ITEM_TYPE_ROCK)) return FALSE; - else + else return TRUE; } @@ -110,9 +110,9 @@ void xxx_init_itemslot_8090A8C(struct ItemSlot *slot, u8 itemIndex, u8 param_3) { u32 uVar3; u32 uVar4; - + if (itemIndex != ITEM_ID_NOTHING) { - slot->unk0 = 1; + slot->itemFlags = ITEM_FLAG_EXISTS; slot->itemIndex = itemIndex; if (IsThrowableItem(itemIndex)) { uVar3 = GetItemUnkThrow(itemIndex, 0); @@ -121,15 +121,15 @@ void xxx_init_itemslot_8090A8C(struct ItemSlot *slot, u8 itemIndex, u8 param_3) } else if (GetItemType(itemIndex) == ITEM_TYPE_MONEY) slot->numItems = 1; - else + else slot->numItems = 0; if (param_3 != 0) - slot->unk0 |= 8; + slot->itemFlags |= ITEM_FLAG_STICKY; } else { - slot->unk0 = 0; + slot->itemFlags = 0; slot->itemIndex = ITEM_ID_NOTHING; slot->numItems = 0; } @@ -139,14 +139,14 @@ void xxx_init_helditem_8090B08(struct HeldItem *held, u8 itemIndex) { u32 uVar2; u32 uVar3; - + if (itemIndex != ITEM_ID_NOTHING) { held->itemIndex = itemIndex; if (IsThrowableItem(itemIndex)) { uVar2 = GetItemUnkThrow(itemIndex,0); uVar3 = GetItemUnkThrow(itemIndex,1); held->numItems = RandomRange(uVar2, uVar3); - } + } else if (GetItemType(itemIndex) == ITEM_TYPE_MONEY) held->numItems = 1; else @@ -164,7 +164,7 @@ void HeldItemToSlot(struct ItemSlot *slot, struct HeldItem *held) if(held->itemIndex != ITEM_ID_NOTHING) { - slot->unk0 = 1; + slot->itemFlags = ITEM_FLAG_EXISTS; slot->itemIndex = held->itemIndex; is_throwable = IsThrowableItem(slot->itemIndex); if(is_throwable != 0 || GetItemType(slot->itemIndex) == ITEM_TYPE_MONEY) @@ -178,13 +178,13 @@ void HeldItemToSlot(struct ItemSlot *slot, struct HeldItem *held) { slot->itemIndex = ITEM_ID_NOTHING; slot->numItems = 0; - slot->unk0 = 0; + slot->itemFlags = 0; } } void SlotToHeldItem(struct HeldItem *held,struct ItemSlot *slot) { - if ((slot->unk0 & 1) != 0) { + if ((slot->itemFlags & ITEM_FLAG_EXISTS) != 0) { held->itemIndex = slot->itemIndex; held->numItems = slot->numItems; } @@ -293,16 +293,16 @@ u8 *GetItemDescription(u8 itemIndex) return gItemParametersData[itemIndex].descriptionPointer; } -u32 GetItemUnkFood(u8 itemIndex, u32 r1) +u32 GetItemAIFlags(u8 itemIndex, u32 r1) { - return gItemParametersData[itemIndex].unkFood1[r1]; + return gItemParametersData[itemIndex].aiFlags[r1]; } void sub_8090DC4(void* param_1,u8 itemIndex, struct unkStruct_8090F58* param_3) { char acStack104 [80]; struct ItemSlot unkItem; - + strncpy(acStack104,gItemParametersData[itemIndex].namePointer,0x50); xxx_init_itemslot_8090A8C(&unkItem,itemIndex,0); unkItem.numItems = 1; @@ -347,18 +347,18 @@ void sub_8090E14(u8* ext_buffer, struct ItemSlot* slot, struct unkStruct_8090F58 strncpy(buffer, gItemParametersData[slot->itemIndex].namePointer, 80); } - if (slot->unk0 & 8) { + if (slot->itemFlags & ITEM_FLAG_STICKY) { ExpandPlaceholdersBuffer(ext_buffer, gUnknown_8109784, buffer); strncpy(buffer, ext_buffer, 80); } if (a3) { - if (a3->unk4 && (slot->unk0 & 0x10)) { + if (a3->unk4 && (slot->itemFlags & ITEM_FLAG_SET)) { ExpandPlaceholdersBuffer(ext_buffer, gUnknown_810978C, buffer); strncpy(buffer, ext_buffer, 80); } if ((*(u32*)a3 == 1) || (*(u32*)a3 == 3)) { - if (slot->unk0 & 2) { + if (slot->itemFlags & ITEM_FLAG_FOR_SALE) { sub_8090F58(ext_buffer, buffer, slot, a3); return; } @@ -379,7 +379,7 @@ void sub_8090F58(void* a1, u8 *a2, struct ItemSlot *slot, struct unkStruct_8090F u32 unk0; s32 value; u8 buffer[40]; - + if (!a4) { strncpy(a1, a2, 80); return; @@ -406,7 +406,7 @@ void sub_8090F58(void* a1, u8 *a2, struct ItemSlot *slot, struct unkStruct_8090F } } - if (a4->unk6) { + if (a4->unk6) { sub_8090FEC(value, buffer, 1); ExpandPlaceholdersBuffer(a1, gUnknown_8109794, a2, a4->unk6, buffer); } @@ -416,7 +416,7 @@ void sub_8090F58(void* a1, u8 *a2, struct ItemSlot *slot, struct unkStruct_8090F } } -s32 sub_8090FEC(s32 a1, u8* strbuf, u8 a3) +s32 sub_8090FEC(s32 a1, u8* strbuf, u8 a3) { s32 i, count; s32 cond = 0; @@ -424,7 +424,7 @@ s32 sub_8090FEC(s32 a1, u8* strbuf, u8 a3) count = 0; for (i = 0; i < 5; i++) { s32 div; - + div = 0; while (a1 >= gUnknown_81097B0[i]) { a1 -= gUnknown_81097B0[i]; @@ -458,7 +458,7 @@ s32 sub_8090FEC(s32 a1, u8* strbuf, u8 a3) return count; } -void FillInventoryGaps() +void FillInventoryGaps() { // fill inventory gaps s32 slot_checking = 0; @@ -466,7 +466,7 @@ void FillInventoryGaps() do { while (slot_checking < INVENTORY_SIZE) { - if (slot_checking[gTeamInventory_203B460->teamItems].unk0 & 1) { + if (slot_checking[gTeamInventory_203B460->teamItems].itemFlags & ITEM_FLAG_EXISTS) { break; } // find next empty slot @@ -498,22 +498,22 @@ void FillInventoryGaps() #endif slot->itemIndex = 0; slot->numItems = 0; - slot->unk0 = 0; + slot->itemFlags = 0; } } -s32 FindItemInInventory(u8 itemIndex) +s32 FindItemInInventory(u8 itemIndex) { s32 i; for (i = 0; i < INVENTORY_SIZE; i++) { - if ((gTeamInventory_203B460->teamItems[i].unk0 & 1) && (gTeamInventory_203B460->teamItems[i].itemIndex == itemIndex)) { + if ((gTeamInventory_203B460->teamItems[i].itemFlags & ITEM_FLAG_EXISTS) && (gTeamInventory_203B460->teamItems[i].itemIndex == itemIndex)) { return i; } } return -1; } -s32 GetItemCountInInventory(u8 _itemIndex) +s32 GetItemCountInInventory(u8 _itemIndex) { #ifdef NONMATCHING s32 count = 0; @@ -533,7 +533,7 @@ s32 GetItemCountInInventory(u8 _itemIndex) s32 i = 19; do { - register u32 unk0 asm("r1") = slot->unk0; + register u32 unk0 asm("r1") = slot->itemFlags; u32 bottom_bit = one; bottom_bit &= unk0; if (bottom_bit && (slot->itemIndex == itemIndex)) { @@ -545,11 +545,11 @@ s32 GetItemCountInInventory(u8 _itemIndex) #endif } -s32 GetItemPossessionCount(u8 itemIndex) +s32 GetItemPossessionCount(u8 itemIndex) { s32 item_count = GetItemCountInInventory(itemIndex); s32 i = 0; - + struct unkStruct_203B45C *_gRecruitedPokemonRef = gRecruitedPokemonRef; for (i = 0; i < NUM_SPECIES; i++) { struct PokemonStruct* pokemon = &_gRecruitedPokemonRef->pokemon[i]; @@ -563,20 +563,20 @@ s32 GetItemPossessionCount(u8 itemIndex) return item_count; } -void ShiftItemsDownFrom(s32 start) +void ShiftItemsDownFrom(s32 start) { s32 i, j; for (i = start, j = start + 1; i < 19; i++, j++) { gTeamInventory_203B460->teamItems[i] = gTeamInventory_203B460->teamItems[j]; } gTeamInventory_203B460->teamItems[19].itemIndex = 0; - gTeamInventory_203B460->teamItems[19].unk0 = 0; + gTeamInventory_203B460->teamItems[19].itemFlags = 0; } void ClearItemSlotAt(u32 index) { gTeamInventory_203B460->teamItems[index].itemIndex = ITEM_ID_NOTHING; - gTeamInventory_203B460->teamItems[index].unk0 = 0; + gTeamInventory_203B460->teamItems[index].itemFlags = 0; } bool8 sub_809124C(u8 itemIndex, u8 param_3) @@ -586,7 +586,7 @@ bool8 sub_809124C(u8 itemIndex, u8 param_3) return AddItemToInventory(&temp); } -bool8 sub_8091274(struct HeldItem* slot) +bool8 sub_8091274(struct HeldItem* slot) { struct ItemSlot temp; @@ -594,14 +594,14 @@ bool8 sub_8091274(struct HeldItem* slot) return AddItemToInventory(&temp); } -bool8 AddItemToInventory(const struct ItemSlot* slot) +bool8 AddItemToInventory(const struct ItemSlot* slot) { s32 i; // try to add item to inventory, return 1 if failed for (i = 0; i < INVENTORY_SIZE; i++) { UNUSED struct ItemSlot* current = &gTeamInventory_203B460->teamItems[i]; - if (!(i[gTeamInventory_203B460->teamItems].unk0 & 1)) { + if (!(i[gTeamInventory_203B460->teamItems].itemFlags & ITEM_FLAG_EXISTS)) { gTeamInventory_203B460->teamItems[i] = *slot; return FALSE; } @@ -609,7 +609,7 @@ bool8 AddItemToInventory(const struct ItemSlot* slot) return TRUE; } -void ConvertMoneyItemToMoney() +void ConvertMoneyItemToMoney() { s32 i = 0; @@ -618,14 +618,14 @@ void ConvertMoneyItemToMoney() UNUSED size_t offs = offsetof(struct TeamInventory, teamItems[i]); struct ItemSlot* current_slot = &gTeamInventory_203B460->teamItems[i]; - if ((current_slot->unk0 & 1) && (current_slot->itemIndex == ITEM_ID_POKE)) { + if ((current_slot->itemFlags & ITEM_FLAG_EXISTS) && (current_slot->itemIndex == ITEM_ID_POKE)) { u32 result; result = GetMoneyValue(current_slot); AddToTeamMoney(result); current_slot->itemIndex = 0; current_slot->numItems = 0; - current_slot->unk0 = 0; + current_slot->itemFlags = 0; } } while (++i < INVENTORY_SIZE); FillInventoryGaps(); @@ -635,9 +635,9 @@ void ConvertMoneyItemToMoney() s32 lowest_index = -1; UNUSED size_t offs = offsetof(struct TeamInventory, teamItems[i]); - bool8 item_occupied = i[gTeamInventory_203B460->teamItems].unk0 & 1; + bool8 item_occupied = i[gTeamInventory_203B460->teamItems].itemFlags & ITEM_FLAG_EXISTS; s32 next = i + 1; - + if (item_occupied) { s32 lowest_order = GetItemOrder(gTeamInventory_203B460->teamItems[i].itemIndex); s32 j; @@ -645,7 +645,7 @@ void ConvertMoneyItemToMoney() // find next lowest for (j = next; j < INVENTORY_SIZE; j++) { UNUSED size_t offs = offsetof(struct TeamInventory, teamItems[j]); - if ((j[gTeamInventory_203B460->teamItems].unk0 & 1) && (lowest_order > GetItemOrder(gTeamInventory_203B460->teamItems[j].itemIndex))) { + if ((j[gTeamInventory_203B460->teamItems].itemFlags & ITEM_FLAG_EXISTS) && (lowest_order > GetItemOrder(gTeamInventory_203B460->teamItems[j].itemIndex))) { lowest_index = j; lowest_order = GetItemOrder(gTeamInventory_203B460->teamItems[j].itemIndex); } @@ -654,7 +654,7 @@ void ConvertMoneyItemToMoney() if (lowest_index >= 0) { // swap the slots struct ItemSlot current = gTeamInventory_203B460->teamItems[i]; - gTeamInventory_203B460->teamItems[i] = gTeamInventory_203B460->teamItems[lowest_index]; + gTeamInventory_203B460->teamItems[i] = gTeamInventory_203B460->teamItems[lowest_index]; gTeamInventory_203B460->teamItems[lowest_index] = current; } } @@ -678,12 +678,12 @@ void AddToTeamMoney(s32 amount) gTeamInventory_203B460->teamMoney = clamped_money; } -u16 GetItemMove(u8 index) +u16 GetItemMove(u8 index) { return gItemParametersData[index].move; } -u32 sub_80913E0(struct ItemSlot* slot, u32 a2, struct subStruct_203B240 ** a3) +u32 sub_80913E0(struct ItemSlot* slot, u32 a2, struct subStruct_203B240 ** a3) { u8 buffer88[88]; // some struct @@ -695,7 +695,7 @@ u32 sub_80913E0(struct ItemSlot* slot, u32 a2, struct subStruct_203B240 ** a3) } sub_80073B8(a2); xxx_format_and_draw(16, 0, buffer88, a2, 0); - + xxx_format_and_draw(8, 24, GetItemDescription(slot->itemIndex), a2, 0); if (GetItemType(slot->itemIndex) == ITEM_TYPE_TM) { u8* buffer8 = buffer88 + 0x50; // field in struct @@ -719,7 +719,7 @@ u32 sub_80913E0(struct ItemSlot* slot, u32 a2, struct subStruct_203B240 ** a3) return sub_8097DF0(GetItemDescription(slot->itemIndex), a3); } -bool8 CanSellItem(u32 id) +bool8 CanSellItem(u32 id) { u8 id_; id = (u8)id; @@ -738,7 +738,7 @@ bool8 CanSellItem(u32 id) return FALSE; } -bool8 IsNotMoneyOrUsedTMItem(u8 id) +bool8 IsNotMoneyOrUsedTMItem(u8 id) { if (id == ITEM_ID_NOTHING) { return FALSE; @@ -752,7 +752,7 @@ bool8 IsNotMoneyOrUsedTMItem(u8 id) return TRUE; } -bool8 IsNotSpecialItem(u8 id) +bool8 IsNotSpecialItem(u8 id) { if (id == ITEM_ID_NOTHING) { return FALSE; @@ -775,7 +775,7 @@ bool8 IsNotSpecialItem(u8 id) return TRUE; } -bool8 IsEdibleItem(u8 id) +bool8 IsEdibleItem(u8 id) { if (!((GetItemType(id) == ITEM_TYPE_BERRY_SEED) || (GetItemType(id) == ITEM_TYPE_APPLE_GUMMI))) { return FALSE; @@ -783,7 +783,7 @@ bool8 IsEdibleItem(u8 id) return TRUE; } -bool8 IsHMItem(u8 id) +bool8 IsHMItem(u8 id) { if (id == ITEM_ID_CUT) { return TRUE; @@ -812,18 +812,18 @@ bool8 IsHMItem(u8 id) return FALSE; } -u32 GetMoneyValue(struct ItemSlot* slot) +u32 GetMoneyValue(struct ItemSlot* slot) { return gUnknown_810A3F0[slot->numItems]; } -u32 GetMoneyValueHeld(struct HeldItem* slot) +u32 GetMoneyValueHeld(struct HeldItem* slot) { // potentially different slot type (used for held item) return gUnknown_810A3F0[slot->numItems]; } -void GetGummiItemStatBoost(struct PokemonStruct* pokemon, u8 itemIndex, u8 a3, struct unkStruct_80915F4* a4) +void GetGummiItemStatBoost(struct PokemonStruct* pokemon, u8 itemIndex, u8 a3, struct unkStruct_80915F4* a4) { // item stat buff? s8 result; @@ -917,7 +917,7 @@ void GetGummiItemStatBoost(struct PokemonStruct* pokemon, u8 itemIndex, u8 a3, s } } -bool8 IsGummiItem(u8 itemIndex) +bool8 IsGummiItem(u8 itemIndex) { if (itemIndex < ITEM_ID_WHITE_GUMMI) { return FALSE; @@ -928,19 +928,19 @@ bool8 IsGummiItem(u8 itemIndex) return TRUE; } -bool8 HasGummiItem() +bool8 HasGummiItem() { s32 i; for (i = 0; i < INVENTORY_SIZE; i++) { UNUSED size_t offs = offsetof(struct TeamInventory, teamItems[i]); - if ((i[gTeamInventory_203B460->teamItems].unk0 & 1) && IsGummiItem(i[gTeamInventory_203B460->teamItems].itemIndex)) { + if ((i[gTeamInventory_203B460->teamItems].itemFlags & ITEM_FLAG_EXISTS) && IsGummiItem(i[gTeamInventory_203B460->teamItems].itemIndex)) { return TRUE; } } return FALSE; } -void MoveToStorage(struct ItemSlot* slot) +void MoveToStorage(struct ItemSlot* slot) { if (IsThrowableItem(slot->itemIndex)) { gTeamInventory_203B460->teamStorage[slot->itemIndex] += slot->numItems; @@ -954,7 +954,7 @@ void MoveToStorage(struct ItemSlot* slot) } } -s32 xxx_count_inv_unk230() +s32 xxx_count_inv_unk230() { s32 i; s32 counter = 0; @@ -966,7 +966,7 @@ s32 xxx_count_inv_unk230() return counter; } -void xxx_init_unk230_substruct(u8 i) +void xxx_init_unk230_substruct(u8 i) { struct HeldItem* unk230; @@ -975,7 +975,7 @@ void xxx_init_unk230_substruct(u8 i) unk230->numItems = 0; } -struct HeldItem* xxx_get_inv_unk230_at_809185C(u8 i) +struct HeldItem* xxx_get_inv_unk230_at_809185C(u8 i) { return &gTeamInventory_203B460->unk230[i]; } @@ -1160,7 +1160,7 @@ bool8 xxx_insert_unk250_8091C1C(u8 itemIndex) { return TRUE; } -s32 SaveTeamInventory(u8* unk0, u32 size) +s32 SaveTeamInventory(u8* unk0, u32 size) { struct unkStruct_8094924 unk; s32 i; @@ -1184,7 +1184,7 @@ s32 SaveTeamInventory(u8* unk0, u32 size) return unk.unk8; } -s32 RestoreTeamInventory(u8 *unk0, u32 size) +s32 RestoreTeamInventory(u8 *unk0, u32 size) { struct unkStruct_8094924 unk; s32 i; @@ -1214,7 +1214,7 @@ void RestoreHeldItem(struct unkStruct_8094924 *a1, struct HeldItem *item) RestoreIntegerBits(a1, &item->numItems, 7); } -void SaveHeldItem(struct unkStruct_8094924 *a1, struct HeldItem *item) +void SaveHeldItem(struct unkStruct_8094924 *a1, struct HeldItem *item) { SaveIntegerBits(a1, &item->itemIndex, 8); SaveIntegerBits(a1, &item->numItems, 7); @@ -1222,24 +1222,24 @@ void SaveHeldItem(struct unkStruct_8094924 *a1, struct HeldItem *item) void RestoreItemSlot(struct unkStruct_8094924 *a1, struct ItemSlot *slot) { - RestoreIntegerBits(a1, &slot->unk0, 8); + RestoreIntegerBits(a1, &slot->itemFlags, 8); RestoreIntegerBits(a1, &slot->numItems, 7); RestoreIntegerBits(a1, &slot->itemIndex, 8); } -void SaveItemSlot(struct unkStruct_8094924 *a1, struct ItemSlot *slot) +void SaveItemSlot(struct unkStruct_8094924 *a1, struct ItemSlot *slot) { - SaveIntegerBits(a1, &slot->unk0, 8); + SaveIntegerBits(a1, &slot->itemFlags, 8); SaveIntegerBits(a1, &slot->numItems, 7); SaveIntegerBits(a1, &slot->itemIndex, 8); } -u32 sub_8091E50(u8 index) +u32 sub_8091E50(u8 index) { return gUnknown_810AF50[index]; } -u32 xxx_bit_lut_lookup_8091E50(u8 i0, u8 i1) +u32 xxx_bit_lut_lookup_8091E50(u8 i0, u8 i1) { if (i0 > 0x3e) return 0; @@ -1266,7 +1266,7 @@ s32 sub_8091E94(s32 a1, s32 a2, s32 a3) // struct of 12 + 0xf0 (NUMBER_OF_ITEM_IDS) hwords? struct UnkStruct_8091E94 s1; - u16 s2[12 + 0xf0]; + u16 s2[12 + 0xf0]; s32 data_index; // 30000: level up exp required? @@ -1471,13 +1471,13 @@ void ClearAllItems_8091FB4() { for (i = 0; i < INVENTORY_SIZE; i++) { struct ItemSlot* slot = &gTeamInventory_203B460->teamItems[i]; - if (slot->unk0 & 1) { - slot->unk0 &= 0xf7; + if (slot->itemFlags & ITEM_FLAG_EXISTS) { + slot->itemFlags &= 0xf7; if (slot->itemIndex == ITEM_ID_POKE) { AddToTeamMoney(GetMoneyValue(slot)); slot->itemIndex = 0; slot->numItems = 0; - slot->unk0 = 0; + slot->itemFlags = 0; } } } diff --git a/src/kecleon_items_1.c b/src/kecleon_items_1.c index b4f1b44..6d73eb0 100644 --- a/src/kecleon_items_1.c +++ b/src/kecleon_items_1.c @@ -28,7 +28,7 @@ extern void DrawTeamMoneyBox(u32); void sub_8019B08(void) { - switch(sub_801A6E8(1)) + switch(sub_801A6E8(1)) { case 0: break; @@ -59,7 +59,7 @@ void sub_8019B08(void) void sub_8019BBC(void) { int menuAction; - + menuAction = 0; if (gUnknown_203B210->unk4) { sub_8019EDC(0); @@ -94,7 +94,7 @@ void sub_8019BBC(void) void sub_8019C78(void) { int menuAction; - + menuAction = 0; sub_801A6E8(0); if ((sub_8012FD8(&gUnknown_203B210->unk84) == '\0') && (sub_8013114(&gUnknown_203B210->unk84,&menuAction), menuAction != 1)) { @@ -176,12 +176,12 @@ void sub_8019DAC(void) s32 iVar3; struct ItemSlot *pbVar4; s32 iVar5; - + gUnknown_203B210->unk14 = 0; gUnknown_203B210->unk18 = 0; for(iVar5 = 0; iVar5 < 0x14; iVar5++){ pbVar4 = &gTeamInventory_203B460->teamItems[iVar5]; - if (((pbVar4->unk0 & 1) != 0) && (CanSellItem(pbVar4->itemIndex))) { + if (((pbVar4->itemFlags & ITEM_FLAG_EXISTS) != 0) && (CanSellItem(pbVar4->itemIndex))) { iVar3 = GetStackSellPrice(pbVar4); gUnknown_203B210->unk18 += iVar3; gUnknown_203B210->unk14++; @@ -191,7 +191,7 @@ void sub_8019DAC(void) void sub_8019E04(s32 param_1) { - + if (gUnknown_203B210->unk4) { if (param_1 == 1) gUnknown_203B210->unkE0 = 1; diff --git a/src/pokemon_mid.c b/src/pokemon_mid.c index e774836..0af12d0 100644 --- a/src/pokemon_mid.c +++ b/src/pokemon_mid.c @@ -54,7 +54,7 @@ extern const char gUnknown_8107684[]; extern struct unkStruct_203B45C *gRecruitedPokemonRef; -bool8 sub_808D6E8() +bool8 sub_808D6E8() { s32 i; s32 count = 0; @@ -253,12 +253,12 @@ void sub_808D930(u8 *buffer, s16 index) char *unownString; s32 unownIndex; const char *preload; - + if (GetBaseSpecies(index) == SPECIES_UNOWN) { preload = gUnknown_8107630; // %s%c unownString = GetMonSpecies(SPECIES_UNOWN); unownIndex = GetUnownIndex(index); - ExpandPlaceholdersBuffer(buffer,preload,unownString,gUnownLetters[unownIndex]); // ABCDEFGHIJKLMNOPQRSTUVWXYZ!? + ExpandPlaceholdersBuffer(buffer,preload,unownString,gUnownLetters[unownIndex]); // ABCDEFGHIJKLMNOPQRSTUVWXYZ!? } else { ExpandPlaceholdersBuffer(buffer,gUnknown_8107638, gMonsterParameters[index].species); // %s @@ -305,7 +305,7 @@ void sub_808DA34(u8 *buffer, struct PokemonStruct *pokemon) sub_80922B4(buffer, pokemon->name, POKEMON_NAME_LENGTH); } -bool8 sub_808DA44(s32 a1_, u32 a2_) +bool8 sub_808DA44(s32 a1_, u32 a2_) { // this is the dumbest thing ever, but just making a1 a s16 and // a2 a u8 did weird stuff with shifting... @@ -388,9 +388,9 @@ u16 GetBaseHP(s16 index) return gMonsterParameters[index].base_hp; } -bool8 GetUnk33(s16 index) +bool8 IsToolboxEnabled(s16 index) { - return gMonsterParameters[index].unk33; + return gMonsterParameters[index].toolboxEnabled; } u8 GetUnk12(s16 index) @@ -472,7 +472,7 @@ u8 GetPokemonOverworldPalette(s16 index, u32 r1) { return 10; } - else + else { return gMonsterParameters[temp].overworld_palette; } @@ -547,7 +547,7 @@ void xxx_pokemonstruct_to_pokemon2_808DE50(struct PokemonStruct2 * a1, struct Po for (i = 0; i < 10; i++) { a1->name[i] = pokemon->name[i]; } - + held = &pokemon->heldItem; slot = &a1->itemSlot; @@ -557,8 +557,8 @@ void xxx_pokemonstruct_to_pokemon2_808DE50(struct PokemonStruct2 * a1, struct Po else { slot->itemIndex = 0; slot->numItems = 0; - slot->unk0 = 0; - } + slot->itemFlags = 0; + } sub_80943A0(&somestruct_80943A0, 100); a1->unk44 = somestruct_80943A0; sub_80943A0(&somestruct2_80943A0, 100); @@ -599,7 +599,7 @@ void xxx_pokemon2_to_pokemonstruct_808DF44(struct PokemonStruct* pokemon, struct pokemon->name[i] = a2->name[i]; } - if (a2->itemSlot.unk0 & 1) { + if (a2->itemSlot.itemFlags & ITEM_FLAG_EXISTS) { SlotToHeldItem(&pokemon->heldItem, &a2->itemSlot); } else { @@ -611,7 +611,7 @@ void sub_808DFDC(s32 a1, struct PokemonStruct2* a2) { // transfer item from unk to pokemon at index struct PokemonStruct* pokemon = &gRecruitedPokemonRef->pokemon[a1]; - if (a2->itemSlot.unk0 & 1) { + if (a2->itemSlot.itemFlags & ITEM_FLAG_EXISTS) { SlotToHeldItem(&pokemon->heldItem, &a2->itemSlot); } else { @@ -675,7 +675,7 @@ s32 sub_808E0AC(u16* a1, s16 species, s32 a3, s32 a4) u16 result; // struct? s32 count; register s32 _species asm("r2"); // weird regalloc - + _species = (s16)species; count = 0; @@ -716,13 +716,13 @@ s32 sub_808E0AC(u16* a1, s16 species, s32 a3, s32 a4) return count; } -bool8 sub_808E190(u16 a1, s16 _species) +bool8 sub_808E190(u16 a1, s16 _species) { u16 result; u16 result2; s32 species = _species; // r4 u8* ptr; - + if (species == SPECIES_DECOY) return 0; if (species == SPECIES_NONE) return 0; if (species == SPECIES_MUNCHLAX) return 0; @@ -748,7 +748,7 @@ bool8 sub_808E190(u16 a1, s16 _species) } -s32 sub_808E218(struct unkStruct_808E218_arg* a1, struct PokemonStruct* pokemon) +s32 sub_808E218(struct unkStruct_808E218_arg* a1, struct PokemonStruct* pokemon) { s32 i; s32 count; @@ -810,7 +810,7 @@ s32 sub_808E218(struct unkStruct_808E218_arg* a1, struct PokemonStruct* pokemon) } -s32 GetEvolutionSequence(struct PokemonStruct* pokemon, struct EvolveStage* a2) +s32 GetEvolutionSequence(struct PokemonStruct* pokemon, struct EvolveStage* a2) { #ifdef NONMATCHING s32 count; @@ -872,7 +872,7 @@ s32 GetEvolutionSequence(struct PokemonStruct* pokemon, struct EvolveStage* a2) #endif } -s32 sub_808E400(s32 _species, s16* _a2, s32 _a3, s32 _a4) +s32 sub_808E400(s32 _species, s16* _a2, s32 _a3, s32 _a4) { // this is horrible s32 i; @@ -900,7 +900,7 @@ s32 sub_808E400(s32 _species, s16* _a2, s32 _a3, s32 _a4) return count; } -void sub_808E490(struct unkPokeSubStruct_2C* a1, s16 species) +void sub_808E490(struct unkPokeSubStruct_2C* a1, s16 species) { u16 buffer[0x10]; s32 i; @@ -924,16 +924,16 @@ void sub_808E490(struct unkPokeSubStruct_2C* a1, s16 species) } } -char* sub_808E4FC(s32 a1) +char* sub_808E4FC(s32 a1) { - struct subStruct_203B240 *result[4]; + struct subStruct_203B240 *result[4]; sub_8097DF0(gFormattedStatusNames[a1], result); return result[0]->unk0; } -char* sub_808E51C(s32 a1) +char* sub_808E51C(s32 a1) { - struct subStruct_203B240 *result[4]; + struct subStruct_203B240 *result[4]; sub_8097DF0(gFormattedStatusNames[a1], result); return result[0]->unk4; } diff --git a/src/thank_you_wonder_mail.c b/src/thank_you_wonder_mail.c index 4e26b46..745d682 100644 --- a/src/thank_you_wonder_mail.c +++ b/src/thank_you_wonder_mail.c @@ -41,7 +41,7 @@ extern struct TeamInventory *gTeamInventory_203B460; #define PROCESS_THANK_YOU_PASSWORD 0x27 #define THANK_YOU_PASSWORD_WRONG 0x28 -const struct ItemSlot gUnknown_80DED44 = +const struct ItemSlot gUnknown_80DED44 = { 1, 0, 0 }; @@ -50,7 +50,7 @@ extern char gUnknown_202E5D8[0x50]; extern char gAvailablePokemonNames[0x50]; -const struct UnkTextStruct2 gUnknown_80DED48 = +const struct UnkTextStruct2 gUnknown_80DED48 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, @@ -60,7 +60,7 @@ const struct UnkTextStruct2 gUnknown_80DED48 = NULL }; -const struct UnkTextStruct2 gUnknown_80DED60 = +const struct UnkTextStruct2 gUnknown_80DED60 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, @@ -83,7 +83,7 @@ extern const u8 SendItem_Text[]; extern const u8 DontSendItem_Text[]; extern const u8 SendWOItem_Text[]; -const struct MenuItem gUnknown_80DED78[3] = +const struct MenuItem gUnknown_80DED78[3] = { {Confirm_80DED98, 0xB}, {Info_80DED90, 0xC}, @@ -94,7 +94,7 @@ ALIGNED(4) const u8 Info_80DED90[] = "Info"; ALIGNED(4) const u8 Confirm_80DED98[] = "Confirm"; // Unused -const struct UnkTextStruct2 gUnknown_80DEDA0 = +const struct UnkTextStruct2 gUnknown_80DEDA0 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, @@ -105,7 +105,7 @@ const struct UnkTextStruct2 gUnknown_80DEDA0 = }; -const struct MenuItem gThankYouMailMainMenuItems[4] = +const struct MenuItem gThankYouMailMainMenuItems[4] = { {SendThankYou_Text, 0x1}, {GetThankYou_Text, 0x2}, @@ -117,7 +117,7 @@ ALIGNED(4) const u8 Cancel_80DEDD8[] = "Cancel"; ALIGNED(4) const u8 GetThankYou_Text[] = "Get Thank-You Mail"; ALIGNED(4) const u8 SendThankYou_Text[] = "Send Thank-You Mail"; -const struct MenuItem gUnknown_80DEE08[4] = +const struct MenuItem gUnknown_80DEE08[4] = { {GameLinkCable_Text, WONDER_MAIL_GAME_LINK}, {Password_Text, WONDER_MAIL_PASSWORD}, @@ -128,7 +128,7 @@ const struct MenuItem gUnknown_80DEE08[4] = ALIGNED(4) const u8 Password_Text[] = "Password"; ALIGNED(4) const u8 GameLinkCable_Text[] = "Game Link cable"; -const struct MenuItem gUnknown_80DEE44[3] = +const struct MenuItem gUnknown_80DEE44[3] = { {Yes_80DEE5C, 0x7}, {Cancel_80DEDD8, 0x0}, @@ -138,7 +138,7 @@ const struct MenuItem gUnknown_80DEE44[3] = ALIGNED(4) const u8 Yes_80DEE5C[] = "Yes"; -const struct MenuItem gUnknown_80DEE60[3] = +const struct MenuItem gUnknown_80DEE60[3] = { {Yes_80DEE5C, 0x7}, {No_80DEE78, 0x8}, @@ -147,7 +147,7 @@ const struct MenuItem gUnknown_80DEE60[3] = ALIGNED(4) const u8 No_80DEE78[] = "No"; -const struct MenuItem gUnknown_80DEE7C[4] = +const struct MenuItem gUnknown_80DEE7C[4] = { {SendItem_Text, 0x9}, {DontSendItem_Text, 0xA}, @@ -158,7 +158,7 @@ const struct MenuItem gUnknown_80DEE7C[4] = ALIGNED(4) const u8 DontSendItem_Text[] = "Don~27t Send Item"; ALIGNED(4) const u8 SendItem_Text[] = "Send Item"; -const struct MenuItem gUnknown_80DEEBC[3] = +const struct MenuItem gUnknown_80DEEBC[3] = { {SendWOItem_Text, 0xA}, {Cancel_80DEDD8, 0x0}, @@ -167,7 +167,7 @@ const struct MenuItem gUnknown_80DEEBC[3] = ALIGNED(4) const u8 SendWOItem_Text[] = "Send w/o Item"; -const struct MenuItem gUnknown_80DEEE4[4] = +const struct MenuItem gUnknown_80DEEE4[4] = { {Yes_80DEE5C, 0x7}, {No_80DEE78, 0x8}, @@ -594,7 +594,7 @@ u32 ThankYouMailPelipperCallback(void) case 0x20: ExitThankYouMailMenu2(); break; - case THANK_YOU_MAIL_COMMS_CLEANUP: + case THANK_YOU_MAIL_COMMS_CLEANUP: ExitThankYouMailMenu1(); break; case CONFIRM_ITEM_TO_SEND: @@ -715,9 +715,9 @@ void DisplayThankYouMailCommsOutcome(void) MemoryFill8((u8 *)&gUnknown_203B2C4->unk41C, 0, sizeof(struct ItemSlot)); gUnknown_203B2C4->unk41C.itemIndex = 0; gUnknown_203B2C4->unk41C.numItems = 1; - gUnknown_203B2C4->unk41C.unk0 = 0; + gUnknown_203B2C4->unk41C.itemFlags = 0; if (gUnknown_203B2C4->linkError == 0) { - switch(gUnknown_203B2C4->unk40) + switch(gUnknown_203B2C4->unk40) { case 6: switch(gUnknown_203B2C4->wonderMailMethod) @@ -830,7 +830,7 @@ void sub_802A174(void) if (sub_8012FD8(&gUnknown_203B2C4->unk30C) == 0) { sub_8013114(&gUnknown_203B2C4->unk30C, &menuAction); } - + switch(menuAction) { case 0xB: @@ -856,7 +856,7 @@ void sub_802A174(void) } void sub_802A230(void) -{ +{ switch(sub_8030DA0()) { case 2: @@ -883,7 +883,7 @@ void sub_802A28C(void) gUnknown_203B2C4->unk41C.itemIndex = 0; gUnknown_203B2C4->unk41C.numItems = 1; - gUnknown_203B2C4->unk41C.unk0 = 0; + gUnknown_203B2C4->unk41C.itemFlags = 0; switch(sub_801CA08(1)) { @@ -1033,7 +1033,7 @@ void HandleThankYouMailPasswordMenu(void) switch(return_var) { case 3: - switch(sub_8039068(0x20,gUnknown_203B2C4->passwordBuffer,&temp.unk0)) + switch(sub_8039068(0x20,gUnknown_203B2C4->passwordBuffer,&temp.unk0)) { case 0x11: // Wrong password diff --git a/src/trade_items_menu.c b/src/trade_items_menu.c index e1c2241..d0c4598 100644 --- a/src/trade_items_menu.c +++ b/src/trade_items_menu.c @@ -51,8 +51,8 @@ extern void sub_8035CC0(struct UnkTextStruct2 *, u32); extern void sub_801CCD8(); extern u32 sub_801B410(); extern void sub_801B450(); -extern void sub_801CB5C(u32); -extern void sub_8035CF4(u32 *, u32, u32); +extern void sub_801CB5C(u32); +extern void sub_8035CF4(u32 *, u32, u32); extern u32 sub_8013BBC(u32 *); extern void sub_80141B4(u32 *, u32, u32, u32); @@ -113,7 +113,7 @@ enum TradeItemsModes s32 CreateTradeItemsMenu(void) { - + ResetUnusedInputStruct(); sub_800641C(0,1,1); gTradeItemsMenu = MemoryAlloc(sizeof(struct TradeItemsMenu), 8); @@ -127,7 +127,7 @@ s32 CreateTradeItemsMenu(void) s32 UpdateTradeItemsMenu(void) { - + switch(gTradeItemsMenu->currMenu) { case TRADE_ITEMS_MAIN_MENU: TradeItem_MainMenu(); @@ -192,7 +192,7 @@ s32 UpdateTradeItemsMenu(void) void TradeItem_MainMenu(void) { s32 menuAction; - + if (sub_80144A4(&menuAction) == 0) { switch(menuAction) { @@ -219,16 +219,16 @@ void TradeItem_MainMenu(void) void sub_8036590(void) { s32 iVar1; - + if (sub_80144A4(&iVar1) == 0) SetTradeItemMenu(TRADE_ITEMS_SEND_ITEM_SELECTION); } void sub_80365AC(void) -{ +{ gTradeItemsMenu->itemToSend.itemIndex = 0; gTradeItemsMenu->itemToSend.numItems = 1; - gTradeItemsMenu->itemToSend.unk0 = 0; + gTradeItemsMenu->itemToSend.itemFlags = 0; switch(sub_801CA08(1)){ case 2: // Cancel @@ -257,7 +257,7 @@ void sub_80365AC(void) void sub_8036674(void) { int menuAction; - + menuAction = -1; sub_801CA08(0); if (sub_8012FD8(&gTradeItemsMenu->unk134) == '\0') { @@ -309,7 +309,7 @@ void sub_8036728(void) } void sub_8036788(void) -{ +{ sub_8012FD8(&gTradeItemsMenu->unk134); sub_801CA08(0); switch(sub_8013BBC(&gTradeItemsMenu->numItemsToSend)){ @@ -344,7 +344,7 @@ void TradeItem_SendItemConfirm(void) int menuAction; u16 load; - if (sub_80144A4(&menuAction) == 0) + if (sub_80144A4(&menuAction) == 0) { switch(menuAction){ case 5: @@ -447,7 +447,7 @@ void sub_8036950(void) void TradeItem_AddItem(void) { - // Use temp var to get correct statements + // Use temp var to get correct statements u16 load; load = gTeamInventory_203B460->teamStorage[gTradeItemsMenu->sentItem.itemIdx.itemIndex]; load += gTradeItemsMenu->sentItem.numItems; @@ -558,7 +558,7 @@ void sub_8036B28(void) u32 load_2; struct TradeSubStruct *temp; struct TradeSubStruct *temp2; - + switch(gTradeItemsMenu->currMenu) { case 0: if (sub_801CF14(0) != '\0') { diff --git a/src/wonder_mail.c b/src/wonder_mail.c index ed52bb2..29cd2bc 100644 --- a/src/wonder_mail.c +++ b/src/wonder_mail.c @@ -145,7 +145,7 @@ void sub_8028B1C(u32 r0) } void sub_8028BF0(void) -{ +{ u32 temp; if(sub_80144A4(&temp) != 0) { @@ -1199,4 +1199,3 @@ void sub_8029B34(void) } sub_8028B04(3); } - |