diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/code_801AFA4.c | 20 | ||||
-rw-r--r-- | src/code_801C620.c | 30 | ||||
-rw-r--r-- | src/code_8040094.c | 37 | ||||
-rw-r--r-- | src/code_80521D0.c | 21 | ||||
-rw-r--r-- | src/code_80521D0_1.c | 158 | ||||
-rw-r--r-- | src/code_8057824_1.c | 526 | ||||
-rw-r--r-- | src/code_80869E4.c | 20 | ||||
-rw-r--r-- | src/code_8086A3C.c | 37 | ||||
-rw-r--r-- | src/code_80958E8.c | 14 | ||||
-rw-r--r-- | src/dungeon_ai.c | 21 | ||||
-rw-r--r-- | src/dungeon_ai_items.c | 23 | ||||
-rw-r--r-- | src/dungeon_capabilities_1.c | 23 | ||||
-rw-r--r-- | src/dungeon_movement.c | 144 | ||||
-rw-r--r-- | src/dungeon_pokemon_attributes.c | 71 | ||||
-rw-r--r-- | src/dungeon_util.c | 16 | ||||
-rw-r--r-- | src/dungeon_util_1.c | 120 | ||||
-rw-r--r-- | src/items.c | 18 | ||||
-rw-r--r-- | src/memory_mid.c | 29 | ||||
-rw-r--r-- | src/music_pre.c | 8 | ||||
-rw-r--r-- | src/pokemon_3.c | 32 | ||||
-rw-r--r-- | src/rescue_team_info.c | 19 | ||||
-rw-r--r-- | src/thank_you_wonder_mail.c | 42 | ||||
-rw-r--r-- | src/wonder_mail.c | 56 | ||||
-rw-r--r-- | src/wonder_mail_2.c | 167 | ||||
-rw-r--r-- | src/wonder_mail_3.c | 4 | ||||
-rw-r--r-- | src/wonder_mail_802DF88.c | 316 |
26 files changed, 1432 insertions, 540 deletions
diff --git a/src/code_801AFA4.c b/src/code_801AFA4.c index 3f00c22..117b34b 100644 --- a/src/code_801AFA4.c +++ b/src/code_801AFA4.c @@ -247,7 +247,6 @@ s32 GetNumMonsAbleToLearnItemMove(void) s32 team [MAX_TEAM_MEMBERS]; struct PokemonStruct *preload; - length = sub_808D580(team); gUnknown_203B22C->monsAbleToLearnMove = 0; @@ -263,3 +262,22 @@ s32 GetNumMonsAbleToLearnItemMove(void) } return gUnknown_203B22C->monsAbleToLearnMove; } + +// Unused +bool8 sub_801B374(u8 itemIndex) +{ + u16 moveID; + struct PokemonStruct *puVar4; + s32 iVar5; + + puVar4 = &gRecruitedPokemonRef->pokemon[0]; + moveID = GetItemMove(itemIndex); + + for(iVar5 = 0; iVar5 < NUM_SPECIES; iVar5++, puVar4++) + { + if((puVar4->unk0 >> 1 & 1) != 0) + if(CanMonLearnMove(moveID, puVar4->speciesNum)) + return FALSE; + } + return TRUE; +} diff --git a/src/code_801C620.c b/src/code_801C620.c index c28e347..9776487 100644 --- a/src/code_801C620.c +++ b/src/code_801C620.c @@ -1,6 +1,8 @@ #include "global.h" +#include "constants/iq_skill.h" #include "input.h" #include "memory.h" +#include "pokemon.h" #include "text.h" #include "subStruct_203B240.h" @@ -8,7 +10,7 @@ struct unkStruct_203B240 { // size: 0x94 s32 state; - u8 unk4; + u8 chosenIQSkill; u8 fill5[3]; s32 unk8; s32 unkC; @@ -45,17 +47,33 @@ extern void sub_8013F84(); extern void PlayMenuSoundEffect(u32); extern char * GetIQSkillName(u8 r0); extern char * GetIQSkillDescription(u8 r0); +extern s32 GetNumAvailableIQSkills(u8 *param_1, s32 pokeIQ); void sub_801C6D0(s32); void sub_801C7D4(); void sub_801C6E4(); void sub_801C848(); -u32 sub_801C620(u8 param_1) +bool8 HasNoAvailIQSkills(s16 species) +{ + s32 species_s32; + u8 iqSkillBuffer[NUM_IQ_SKILLS]; + struct PokemonStruct *pokeStruct; + + species_s32 = species; + + pokeStruct = &gRecruitedPokemonRef->pokemon[species_s32]; + if(GetNumAvailableIQSkills(iqSkillBuffer, pokeStruct->IQ) == 0) + return TRUE; + else + return FALSE; +} + +u32 sub_801C620(u8 iqSkill) { ResetSprites(1); gUnknown_203B240 = MemoryAlloc(sizeof(struct unkStruct_203B240),8); - gUnknown_203B240->unk4 = param_1; + gUnknown_203B240->chosenIQSkill = iqSkill; sub_801317C(&gUnknown_203B240->unk88); gUnknown_203B240->unk24 = 0; sub_80140B4(gUnknown_203B240->unk28); @@ -109,12 +127,12 @@ void sub_801C6E4(void) case 0: sub_8008C54(gUnknown_203B240->unk24); sub_80073B8(gUnknown_203B240->unk24); - skillName = GetIQSkillName(gUnknown_203B240->unk4); + skillName = GetIQSkillName(gUnknown_203B240->chosenIQSkill); strcpy(gUnknown_202DE58,skillName); xxx_format_and_draw(16,0,gUnknown_80DBE2C,0,0); // {ARG_MOVE_ITEM_0} - xxx_call_draw_string(8,16,GetIQSkillDescription(gUnknown_203B240->unk4),gUnknown_203B240->unk24,0); + xxx_call_draw_string(8,16,GetIQSkillDescription(gUnknown_203B240->chosenIQSkill),gUnknown_203B240->unk24,0); sub_80073E0(gUnknown_203B240->unk24); - gUnknown_203B240->unkC = sub_8097DF0(GetIQSkillDescription(gUnknown_203B240->unk4),gUnknown_203B240->unk10); + gUnknown_203B240->unkC = sub_8097DF0(GetIQSkillDescription(gUnknown_203B240->chosenIQSkill),gUnknown_203B240->unk10); gUnknown_203B240->unk20 = 0; break; case 1: diff --git a/src/code_8040094.c b/src/code_8040094.c index 4e30873..cdebf7b 100644 --- a/src/code_8040094.c +++ b/src/code_8040094.c @@ -25,34 +25,25 @@ extern void SendMessage(u32, const char *); extern const char *gUnknown_80FD040; // It became brighter on the floor -struct unk8049590 -{ - u32 unk0; - u16 unk4; -}; - -extern struct unk8049590 *GetMapEntity(u32, u32); +extern struct MapTile *GetMapEntity(u32, u32); // Luminous Orb??? -void sub_804002C(u32 param_1) +void HandleLuminousOrbAction(u32 param_1) { - struct unk8049590 *iVar1; - int innerCounter; - int iVar3; - int iVar4; + struct MapTile *mapTile; + int XCoord; + int YCoord; gDungeonGlobalData->unk1820B = 1; - iVar3 = 0; - do { - innerCounter = 0; - iVar4 = iVar3 + 1; - do { - iVar1 = GetMapEntity(innerCounter, iVar3); - iVar1->unk4 = iVar1->unk4 | 1; - innerCounter++; - } while (innerCounter < 0x38); - iVar3 = iVar4; - } while (iVar4 < 0x20); + + for(YCoord = 0; YCoord <= DUNGEON_MAX_SIZE_Y; YCoord++) + { + for(XCoord = 0; XCoord <= DUNGEON_MAX_SIZE_X; XCoord++) + { + mapTile = GetMapEntity(XCoord, YCoord); + mapTile->unk4 = mapTile->unk4 | 1; + } + } sub_803F580(0); sub_8049ED4(); sub_8040A84(); diff --git a/src/code_80521D0.c b/src/code_80521D0.c index 8be49f8..272991d 100644 --- a/src/code_80521D0.c +++ b/src/code_80521D0.c @@ -1,9 +1,10 @@ #include "global.h" +#include "dungeon_entity.h" extern void sub_80526D0(u8 r0); -extern u8 sub_8045888(u32 r0); -extern void sub_80523A8(u32 r0, u32 r1, u8 r2); -extern u8 sub_8052DC0(u32); +extern u8 sub_8045888(struct DungeonEntity *r0); +extern void sub_80523A8(struct DungeonEntity *r0, u32 r1, u8 r2); +extern u8 sub_8052DC0(struct DungeonEntity *); extern u8 sub_803F428(u32); void sub_805229C(void) @@ -11,26 +12,26 @@ void sub_805229C(void) return sub_80526D0(0x50); } -void SendMessage(u32 r0, u32 r1) +void SendMessage(struct DungeonEntity *r0, u32 r1) { if (sub_8045888(r0) != 0){ sub_80523A8(r0, r1, 1); } } -void sub_80522C8(u32 r0, u32 r1) +void sub_80522C8(struct DungeonEntity *r0, u32 r1) { if (sub_8045888(r0) != 0){ sub_80523A8(r0, r1, 0); } } -void sub_80522E8(u32 r0, u32 r1) +void sub_80522E8(struct DungeonEntity *r0, u32 r1) { sub_80523A8(r0, r1, 0); } -void sub_80522F4(u32 r0, u32 r1, u32 r2) +void sub_80522F4(struct DungeonEntity *r0, struct DungeonEntity *r1, u32 r2) { u8 temp; u32 temp_reg; @@ -48,7 +49,7 @@ void sub_80522F4(u32 r0, u32 r1, u32 r2) } } -void sub_805232C(u32 r0, u32 r1, u32 r2) +void sub_805232C(struct DungeonEntity *r0, struct DungeonEntity *r1, u32 r2) { u8 temp; u32 temp_reg; @@ -66,7 +67,7 @@ void sub_805232C(u32 r0, u32 r1, u32 r2) } } -void sub_8052364(u32 r0, u32 r1, u32 r2) +void sub_8052364(struct DungeonEntity *r0, u32 r1, u32 r2) { u8 temp; u32 temp_reg; @@ -84,7 +85,7 @@ void sub_8052364(u32 r0, u32 r1, u32 r2) } } -void sub_805239C(u32 r0, u32 r1) +void sub_805239C(struct DungeonEntity *r0, u32 r1) { sub_80523A8(r0, r1, 1); } diff --git a/src/code_80521D0_1.c b/src/code_80521D0_1.c index a5cd497..0ed02f1 100644 --- a/src/code_80521D0_1.c +++ b/src/code_80521D0_1.c @@ -5,6 +5,7 @@ #include "constants/friend_area.h" #include "pokemon.h" #include "constants/direction.h" +#include "map.h" extern struct DungeonEntity *xxx_call_GetLeaderEntity(void); extern struct DungeonEntity *sub_8085680(u32); @@ -91,7 +92,7 @@ extern void sub_804539C(struct DungeonEntity *, u32, u32); extern void sub_803E46C(u32); extern void sub_8042B0C(struct DungeonEntity *); extern void SetFacingDirection(struct DungeonEntity *, u32); -extern void sub_8052910(u32 *); +extern void DisplayDungeonDialogue(u32 *); extern void sub_803E708(u32, u32); extern u8 EntityExists(struct DungeonEntity *); extern u8 HasRecruitedMon(u32); @@ -114,10 +115,10 @@ extern void sub_8085EB0(); extern void sub_808563C(void *); extern void sub_80858AC(u32 *, u32); -void sub_808C5AC(struct DungeonEntity *r0); +void SetupDeoxysFightHP(struct DungeonEntity *r0); void sub_808C550(void); void sub_808C590(struct DungeonEntity *r0); -void sub_808C5A0(struct DungeonEntity *r0); +void SetupDeoxysFacingDirection(struct DungeonEntity *r0); void sub_808C9B0(); void sub_808C8E0(struct DungeonEntity *param_1); void sub_808C360(void); @@ -138,16 +139,7 @@ extern void sub_8049ED4(); extern void sub_8040A84(); extern void sub_8086A54(struct DungeonEntity *); -struct unk8049590 -{ - u16 unk0; - u16 fill2; - u16 unk4; - u16 unk6; - u8 unk8; -}; - -extern struct unk8049590 *GetMapEntity(u32, u32); +extern struct MapTile *GetMapEntity(u32, u32); extern void sub_806BFC0(struct DungeonEntityData *, u32); void sub_808BBA8(struct DungeonEntity *param_1) @@ -198,13 +190,13 @@ void JirachiWishGrantDialogue(struct DungeonEntity *param_1) param_1->entityData->unk15D = 1; // Nnnnnnnnnn! - sub_8052910(&gUnknown_81058A8); + DisplayDungeonDialogue(&gUnknown_81058A8); PlaySoundEffect(0x375); sub_80861F8(0x67,param_1,1); PlaySoundEffect(0x2a8); uVar2 = sub_80861F8(0x68,param_1,0); // Taaaaaaaah! - sub_8052910(&gUnknown_81058C4); + DisplayDungeonDialogue(&gUnknown_81058C4); if (sub_800E9A8(uVar2) != 0) { sub_800DC14(uVar2); } @@ -214,12 +206,12 @@ void JirachiWishGrantDialogue(struct DungeonEntity *param_1) void sub_808BCE4(void) { - struct unk8049590 *puVar1; + struct MapTile *puVar1; puVar1 = GetMapEntity(gDungeonGlobalData->unkE23C, gDungeonGlobalData->unkE23E); - puVar1->unk0 &= 0xfffc; - puVar1->unk0 |= 16; - puVar1->unk0 &= 0xfdff; + puVar1->MapTileUnion.tileFlags_u16 &= 0xfffc; + puVar1->MapTileUnion.tileFlags_u16 |= TILE_TYPE_MAP_EDGE; + puVar1->MapTileUnion.tileFlags_u16 &= 0xfdff; sub_8049884(); sub_8049B8C(); sub_8049ED4(); @@ -228,13 +220,13 @@ void sub_808BCE4(void) void sub_808BD38(void) { - struct unk8049590 *puVar1; + struct MapTile *puVar1; puVar1 = GetMapEntity(gDungeonGlobalData->unkE23C, gDungeonGlobalData->unkE23E); - puVar1->unk0 &= 0xfffc; - puVar1->unk0 |= 1; - puVar1->unk0 &= 0xffef; - puVar1->unk0 |= (0x200); + puVar1->MapTileUnion.tileFlags_u16 &= 0xfffc; + puVar1->MapTileUnion.tileFlags_u16 |= TILE_TYPE_FLOOR; + puVar1->MapTileUnion.tileFlags_u16 &= 0xffef; + puVar1->MapTileUnion.tileFlags_u16 |= TILE_TYPE_STAIRS; puVar1->unk8 = 1; sub_8049884(); sub_8049B8C(); @@ -284,7 +276,7 @@ void sub_808BDEC(void) LugiaEntity = sub_8085680(0x1b); sub_8083F14(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (HasRecruitedMon(SPECIES_LUGIA)) { sub_8083E88(0x23); @@ -320,26 +312,26 @@ void LugiaPreFightDialogue(void) else { sub_8083F14(); sub_8086448(); - sub_8052910(&gUnknown_8105E88); + DisplayDungeonDialogue(&gUnknown_8105E88); sub_8083EA8(0x23,0x3c); sub_808C0CC(); - sub_8052910(&gUnknown_8105EF8); + DisplayDungeonDialogue(&gUnknown_8105EF8); sub_808BFA0(); - sub_8052910(&gUnknown_8105F38); + DisplayDungeonDialogue(&gUnknown_8105F38); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8105F74); + DisplayDungeonDialogue(&gUnknown_8105F74); PlaySoundEffect(0x1f8); sub_80861D4(LugiaEntity,0xd,0); sub_803E708(0x2b,0x46); sub_80861B8(LugiaEntity,0,0); - sub_8052910(&gUnknown_8105FA0); + DisplayDungeonDialogue(&gUnknown_8105FA0); sub_808BFA0(); - sub_8052910(&gUnknown_8105FD8); + DisplayDungeonDialogue(&gUnknown_8105FD8); sub_808C02C(); sub_8085C54(0xffffff06,0xffffff06,0xffffff06,1,0); sub_8083F14(); sub_80861D4(LugiaEntity,7,0); - sub_8052910(&gUnknown_8106024); + DisplayDungeonDialogue(&gUnknown_8106024); sub_808BFA0(); SetupBossFightHP(LugiaEntity,800,0x20); sub_8083E88(0x23); @@ -424,7 +416,7 @@ void sub_808C10C(void) KyogreEntity = sub_8085680(0x1c); sub_8083F14(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(SPECIES_KYOGRE)) { sub_8068FE0(KyogreEntity,0x21c,0); } @@ -461,35 +453,35 @@ void KyogrePreFightDialogue(void) sub_8083EA8(0x23,0x3c); SpriteLookAroundEffect(LeaderEntity); sub_803E708(10,0x46); - sub_8052910(&gUnknown_81062A8); + DisplayDungeonDialogue(&gUnknown_81062A8); sub_803E708(10,0x46); gDungeonGlobalData->unk2 = 1; } else { - sub_8052910(&gUnknown_8106074); + DisplayDungeonDialogue(&gUnknown_8106074); sub_803E708(10,0x46); - sub_8052910(&gUnknown_81060BC); + DisplayDungeonDialogue(&gUnknown_81060BC); sub_803E708(10,0x46); nullsub_99(); sub_803E708(10,0x46); // Gwwwwwooooooooh - sub_8052910(&gUnknown_8106104); + DisplayDungeonDialogue(&gUnknown_8106104); sub_803E708(10,0x46); sub_8083EA8(0x23,0x3c); sub_808C360(); // My duels against {ARG_POKEMON_3} (Groudon) left us both exhausted - sub_8052910(&gUnknown_8106140); + DisplayDungeonDialogue(&gUnknown_8106140); KyogreScreenFlash(); // I am {ARG_POKEMON_2} (Kyogre)! // The lord of the sea! - sub_8052910(&gUnknown_8106214); + DisplayDungeonDialogue(&gUnknown_8106214); KyogreScreenFlash(); // Witness the destructive force of my waves! - sub_8052910(&gUnknown_8106244); + DisplayDungeonDialogue(&gUnknown_8106244); KyogreScreenFlash(); // Marvel at my awesome // power! - sub_8052910(&gUnknown_810627C); + DisplayDungeonDialogue(&gUnknown_810627C); sub_803E708(10,0x46); SetupBossFightHP(KyogreEntity,600,0xb); sub_8083E88(0x23); @@ -541,14 +533,14 @@ void sub_808C3A0(void) LeaderEntity = xxx_call_GetLeaderEntity(); sub_8083F14(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (HasRecruitedMon(SPECIES_DEOXYS_NORMAL)) { sub_808563C(sub_808C590); } else { gDungeonGlobalData->unk7 = 1; - sub_808563C(sub_808C5A0); + sub_808563C(SetupDeoxysFacingDirection); } sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_DEOXYS_NORMAL); @@ -574,16 +566,16 @@ void DeoxysPreFightDialogue(void) sub_80866C4(&gUnknown_81063C4); } else { - sub_8052910(&gUnknown_81062B4); + DisplayDungeonDialogue(&gUnknown_81062B4); sub_8083EA8(0x1a,0x3c); sub_808C550(); - sub_8052910(&gUnknown_81062E8); + DisplayDungeonDialogue(&gUnknown_81062E8); DeoxysScreenFlash(); - sub_8052910(&gUnknown_8106368); + DisplayDungeonDialogue(&gUnknown_8106368); DeoxysScreenFlash(); - sub_8052910(&gUnknown_8106390); + DisplayDungeonDialogue(&gUnknown_8106390); sub_803E708(10,0x46); - sub_808563C(sub_808C5AC); + sub_808563C(SetupDeoxysFightHP); sub_80858AC(&LeaderEntity->posPixelX,0x10); } } @@ -626,12 +618,12 @@ void sub_808C590(struct DungeonEntity *r0) sub_8068FE0(r0, 0x21C, 0); } -void sub_808C5A0(struct DungeonEntity *r0) +void SetupDeoxysFacingDirection(struct DungeonEntity *r0) { SetFacingDirection(r0, DIRECTION_SOUTH); } -void sub_808C5AC(struct DungeonEntity *r0) +void SetupDeoxysFightHP(struct DungeonEntity *r0) { SetupBossFightHP(r0, 950, 0x20); } @@ -648,7 +640,7 @@ void sub_808C5C0(void) CelebiEntity = sub_8085680(0x1e); sub_8083E88(0x7f); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); SetFacingDirection(CelebiEntity, DIRECTION_SOUTH); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY); uVar3 = sub_803F994(); @@ -678,7 +670,7 @@ void CelebiJoinDialogue(void) SpriteLookAroundEffect(LeaderEntity); sub_803E708(10,0x46); // ......... - sub_8052910(&gUnknown_810663C); + DisplayDungeonDialogue(&gUnknown_810663C); } else { @@ -687,14 +679,14 @@ void CelebiJoinDialogue(void) sub_80862BC(LeaderEntity); sub_803E708(10,0x46); // Oh? There's someone there. - sub_8052910(&gUnknown_81063D0); + DisplayDungeonDialogue(&gUnknown_81063D0); sub_803E708(10,0x46); sub_8086598(); sub_8086598(); sub_8086598(); sub_8086598(); // The Time-Traveling Pokemon {ARG_POKEMON_2} (Celebi)! - sub_8052910(&gUnknown_8106400); + DisplayDungeonDialogue(&gUnknown_8106400); PlaySoundEffect(0x1c7); sub_806CDD4(CelebiEntity,10,DIRECTION_SOUTH); sub_803E708(0x14,0x46); @@ -702,7 +694,7 @@ void CelebiJoinDialogue(void) sub_803E708(4,0x46); PlaySoundEffect(0x1c7); sub_806CDD4(CelebiEntity,10,DIRECTION_SOUTH); - sub_8052910(&gUnknown_810643C); + DisplayDungeonDialogue(&gUnknown_810643C); sub_803E708(10,0x46); state = 0; do { @@ -730,11 +722,11 @@ void CelebiJoinDialogue(void) sub_803E708(0x1a,0x46); PlaySoundEffect(0x1d5); sub_803E708(0x1c,0x46); - sub_8052910(&gUnknown_8106468); + DisplayDungeonDialogue(&gUnknown_8106468); sub_803E708(10,0x46); sub_806FDF4(LeaderEntity,CelebiEntity,&CelebiEntity); sub_8083E88(0x7f); - sub_8052910(&gUnknown_810648C); + DisplayDungeonDialogue(&gUnknown_810648C); sub_803E708(10,0x46); PlaySoundEffect(0x1c7); sub_80861D4(CelebiEntity,0xd,0); @@ -743,7 +735,7 @@ void CelebiJoinDialogue(void) sub_803E708(0x1a,0x46); PlaySoundEffect(0x1d5); sub_803E708(0x1b,0x46); - sub_8052910(&gUnknown_81064BC); + DisplayDungeonDialogue(&gUnknown_81064BC); sub_803E708(10,0x46); state = 2; } @@ -763,15 +755,15 @@ void CelebiJoinDialogue(void) else { sub_803E708(10,0x46); - sub_8052910(&gUnknown_8106500); + DisplayDungeonDialogue(&gUnknown_8106500); sub_80861F8(0x3e,CelebiEntity,1); sub_803E708(0x18,0x46); sub_80861F8(0x3e,CelebiEntity,1); sub_803E708(0xe,0x46); - sub_8052910(&gUnknown_8106534); + DisplayDungeonDialogue(&gUnknown_8106534); sub_803E708(10,0x46); sub_808C8E0(CelebiEntity); - sub_8052910(&gUnknown_8106560); + DisplayDungeonDialogue(&gUnknown_8106560); sub_803E708(10,0x46); state = 2; } @@ -820,7 +812,7 @@ void CelebiJoinDialogue(void) "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" "\tldr r0, _0808C67C\n" - "\tbl sub_8052910\n" + "\tbl DisplayDungeonDialogue\n" "\tb _0808C8AC\n" "\t.align 2, 0\n" "_0808C67C: .4byte gUnknown_810663C\n" @@ -836,7 +828,7 @@ void CelebiJoinDialogue(void) "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" "\tldr r0, _0808C71C\n" - "\tbl sub_8052910\n" + "\tbl DisplayDungeonDialogue\n" "\tmovs r0, 0xA\n" "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" @@ -845,7 +837,7 @@ void CelebiJoinDialogue(void) "\tbl sub_8086598\n" "\tbl sub_8086598\n" "\tldr r0, _0808C720\n" - "\tbl sub_8052910\n" + "\tbl DisplayDungeonDialogue\n" "\tldr r4, _0808C724\n" "\tadds r0, r4, 0\n" "\tbl PlaySoundEffect\n" @@ -869,7 +861,7 @@ void CelebiJoinDialogue(void) "\tmovs r2, 0\n" "\tbl sub_806CDD4\n" "\tldr r0, _0808C728\n" - "\tbl sub_8052910\n" + "\tbl DisplayDungeonDialogue\n" "\tmovs r0, 0xA\n" "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" @@ -945,7 +937,7 @@ void CelebiJoinDialogue(void) "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" "\tldr r0, _0808C818\n" - "\tbl sub_8052910\n" + "\tbl DisplayDungeonDialogue\n" "\tmovs r0, 0xA\n" "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" @@ -956,7 +948,7 @@ void CelebiJoinDialogue(void) "\tmovs r0, 0x7F\n" "\tbl sub_8083E88\n" "\tldr r0, _0808C81C\n" - "\tbl sub_8052910\n" + "\tbl DisplayDungeonDialogue\n" "\tmovs r0, 0xA\n" "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" @@ -1012,7 +1004,7 @@ void CelebiJoinDialogue(void) "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" "\tldr r0, _0808C8D0\n" - "\tbl sub_8052910\n" + "\tbl DisplayDungeonDialogue\n" "\tldr r1, [sp]\n" "\tmovs r0, 0x3E\n" "\tmovs r2, 0x1\n" @@ -1028,7 +1020,7 @@ void CelebiJoinDialogue(void) "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" "\tldr r0, _0808C8D4\n" - "\tbl sub_8052910\n" + "\tbl DisplayDungeonDialogue\n" "\tmovs r0, 0xA\n" "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" @@ -1036,7 +1028,7 @@ void CelebiJoinDialogue(void) "\tbl sub_808C8E0\n" "\tldr r0, _0808C8D8\n" "_0808C898:\n" - "\tbl sub_8052910\n" + "\tbl DisplayDungeonDialogue\n" "\tmovs r0, 0xA\n" "\tmovs r1, 0x46\n" "\tbl sub_803E708\n" @@ -1116,7 +1108,7 @@ void sub_808C998(void) { // Defeat the opposing team to win // Be careful, your opponents are tough - sub_8052910(&gUnknown_8106720); + DisplayDungeonDialogue(&gUnknown_8106720); sub_803E708(0xA, 0x46); } @@ -1135,7 +1127,7 @@ void sub_808C9C4(void) MedichamEntity = sub_8085680(7); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); SetFacingDirection(MedichamEntity, DIRECTION_SOUTH); sub_8085860(LeaderEntity->posWorldX, LeaderEntity->posWorldY - 3); @@ -1152,12 +1144,12 @@ void MedichamRescueDialogue(void) SpriteLookAroundEffect(MedichamEntity); sub_803E708(0xA, 0x46); // Oh my I can't seem to find a way out... - sub_8052910(&gUnknown_8106778); + DisplayDungeonDialogue(&gUnknown_8106778); sub_803E708(0xA, 0x46); sub_80869E4(MedichamEntity, 4, 2, 4); sub_803E708(0xA, 0x46); // What am I to do...? - sub_8052910(&gUnknown_81067BC); + DisplayDungeonDialogue(&gUnknown_81067BC); sub_803E708(0xA, 0x46); sub_8086448(); sub_8086598(); @@ -1165,7 +1157,7 @@ void MedichamRescueDialogue(void) sub_80862BC(MedichamEntity); sub_803E708(0x20, 0x46); sub_80869E4(MedichamEntity, 4, 2, 0); - sub_8052910(&gUnknown_81067E0); + DisplayDungeonDialogue(&gUnknown_81067E0); sub_803E708(0xA, 0x46); PlaySoundEffect(0x1c7); sub_806CDD4(MedichamEntity, 0xA, DIRECTION_SOUTH); @@ -1179,7 +1171,7 @@ void MedichamRescueDialogue(void) // I am so lucky // // There appears to be no one here - sub_8052910(&gUnknown_8106834); + DisplayDungeonDialogue(&gUnknown_8106834); sub_803E708(0xA, 0x46); sub_806CDD4(MedichamEntity, 0, DIRECTION_SOUTH); for(counter = 0x17; counter >= 0; counter--) @@ -1204,7 +1196,7 @@ void sub_808CB5C(void) MedichamEntity = sub_8085680(7); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_8068FE0(MedichamEntity, 0x21C, 0); sub_8085860(LeaderEntity->posWorldX, LeaderEntity->posWorldY); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_MEDICHAM); @@ -1223,7 +1215,7 @@ void sub_808CBB0(void) SmeargleEntity = sub_8085680(0x1F); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); SetFacingDirection(SmeargleEntity, DIRECTION_SOUTH); sub_8085860(LeaderEntity->posWorldX, LeaderEntity->posWorldY - 3); @@ -1241,14 +1233,14 @@ void SmeargleRescueDialogue(void) sub_803E708(0xA, 0x46); // Ohhh... // I've lost my bearings - sub_8052910(&gUnknown_810688C); + DisplayDungeonDialogue(&gUnknown_810688C); sub_803E708(0xA, 0x46); sub_80869E4(SmeargleEntity, 4, 2, 4); sub_803E708(0xA, 0x46); // I can't get out... // I'm hungry... // I'm in trouble - sub_8052910(&gUnknown_81068D0); + DisplayDungeonDialogue(&gUnknown_81068D0); sub_803E708(0xA, 0x46); sub_8086448(); sub_8086598(); @@ -1257,7 +1249,7 @@ void SmeargleRescueDialogue(void) sub_803E708(0x20, 0x46); sub_80869E4(SmeargleEntity, 4, 2, 0); // Oh! You are? - sub_8052910(&gUnknown_8106918); + DisplayDungeonDialogue(&gUnknown_8106918); sub_803E708(0xA, 0x46); PlaySoundEffect(0x1c7); sub_806CDD4(SmeargleEntity, 0xA, DIRECTION_SOUTH); @@ -1269,7 +1261,7 @@ void SmeargleRescueDialogue(void) sub_803E708(0x14, 0x46); // Did you maybe come to rescue me? // Am I glad to see you - sub_8052910(&gUnknown_8106934); + DisplayDungeonDialogue(&gUnknown_8106934); sub_803E708(0xA, 0x46); sub_806CDD4(SmeargleEntity, 0, DIRECTION_SOUTH); for(counter = 0x17; counter >= 0; counter--) @@ -1295,7 +1287,7 @@ void sub_808CD44(void) SmeargleEntity = sub_8085680(0x1F); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_8068FE0(SmeargleEntity, 0x21C, 0); sub_8085860(LeaderEntity->posWorldX, LeaderEntity->posWorldY - 3); diff --git a/src/code_8057824_1.c b/src/code_8057824_1.c index 502e8ee..f79299a 100644 --- a/src/code_8057824_1.c +++ b/src/code_8057824_1.c @@ -227,7 +227,7 @@ extern void sub_8041888(u32); extern void sub_80861B8(struct DungeonEntity *, u32, u32); extern void sub_8083ED8(u32); extern void sub_803E708(u32, u32); -extern void sub_8052910(u32 *r0); +extern void DisplayDungeonDialogue(u32 *r0); extern void sub_8083E88(u32); extern void sub_808BC20(struct DungeonEntity *); @@ -293,10 +293,10 @@ void SuicuneScreenFlash(); void sub_808A904(struct DungeonEntity * param_1); void HoOhScreenFlash(void); void LatiosScreenFlash(void); -void sub_808B2B0(struct DungeonEntity *r0); -void sub_808B2C4(struct DungeonEntity *r0); -void sub_808B2D4(struct DungeonEntity *r0); -void sub_808B2E4(struct DungeonEntity *r0); +void SetupRegiFacingDirection(struct DungeonEntity *r0); +void SetupRegirockFightHP(struct DungeonEntity *r0); +void SetupRegiceFightHP(struct DungeonEntity *r0); +void SetupRegisteelFightHP(struct DungeonEntity *r0); void sub_808B50C(void); void sub_8089B64(struct DungeonEntity *param_1); void MewtwoScreenFlash(void); @@ -375,18 +375,18 @@ void ZapdosReFightDialogue(void) ZapdosEntity = sub_8085680(8); sub_8086448(); sub_803E708(10,0x46); - sub_8052910(&gUnknown_81017E4); + DisplayDungeonDialogue(&gUnknown_81017E4); sub_803E708(10,0x46); PlaySoundEffect(0x1da); - sub_8052910(&gUnknown_81015A0); + DisplayDungeonDialogue(&gUnknown_81015A0); sub_803E708(10,0x46); sub_8087704(ZapdosEntity); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8101898); + DisplayDungeonDialogue(&gUnknown_8101898); sub_808775C(1); - sub_8052910(&gUnknown_81018EC); + DisplayDungeonDialogue(&gUnknown_81018EC); sub_808775C(2); - sub_8052910(&gUnknown_8101918); + DisplayDungeonDialogue(&gUnknown_8101918); SetupBossFightHP(ZapdosEntity,300,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); } @@ -405,15 +405,15 @@ void ZapdosPostStoryPreFightDialogue(void) else { sub_808775C(1); PlaySoundEffect(0x1da); - sub_8052910(&gUnknown_810193C); + DisplayDungeonDialogue(&gUnknown_810193C); sub_8087704(ZapdosEntity); - sub_8052910(&gUnknown_8101970); + DisplayDungeonDialogue(&gUnknown_8101970); sub_808775C(1); - sub_8052910(&gUnknown_8101994); + DisplayDungeonDialogue(&gUnknown_8101994); sub_808775C(2); - sub_8052910(&gUnknown_81019E4); + DisplayDungeonDialogue(&gUnknown_81019E4); sub_808775C(2); - sub_8052910(&gUnknown_8101A04); + DisplayDungeonDialogue(&gUnknown_8101A04); sub_803E708(10,0x46); SetupBossFightHP(ZapdosEntity,300,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -481,7 +481,7 @@ void sub_80877E8(void) sub_8083E88(0x26); sub_8085374(); sub_80854D4(); - sub_8085930(6); + sub_8085930(DIRECTION_WEST); sub_80855E4(sub_8086A3C); SetFacingDirection(MoltresEntity, DIRECTION_SOUTH); sub_8086A3C(MoltresEntity); @@ -501,7 +501,7 @@ void sub_8087848(void) MoltresEntity = sub_8085680(9); sub_8083E88(0x26); sub_80854D4(); - sub_8085930(6); + sub_8085930(DIRECTION_WEST); sub_80855E4(sub_8086A3C); if (sub_8086AE4(SPECIES_MOLTRES)) { sub_8068FE0(MoltresEntity,0x21c,0); @@ -540,58 +540,58 @@ void MoltresPreFightDialogue(void) sub_8087D80(0xc,5); sub_8086500(); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8101A9C); + DisplayDungeonDialogue(&gUnknown_8101A9C); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,5); sub_803E708(4,0x46); SpriteLookAroundEffect(PartnerEntity); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8101AD4); + DisplayDungeonDialogue(&gUnknown_8101AD4); sub_803E708(10,0x46); sub_8087D80(0xc,5); sub_8087DE8(9,5); - sub_8052910(&gUnknown_8101C30); + DisplayDungeonDialogue(&gUnknown_8101C30); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); - sub_8052910(&gUnknown_8101CBC); + DisplayDungeonDialogue(&gUnknown_8101CBC); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,2,6); sub_8086690(); - sub_8052910(&gUnknown_8101D8C); + DisplayDungeonDialogue(&gUnknown_8101D8C); sub_803E708(10,0x46); - sub_8085930(5); + sub_8085930(DIRECTION_NORTHWEST); sub_803E708(4,0x46); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); PlaySoundEffect(0x2f2); sub_8083F14(); sub_8087F24(); - sub_8052910(&gUnknown_8101DA0); + DisplayDungeonDialogue(&gUnknown_8101DA0); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8101E1C); + DisplayDungeonDialogue(&gUnknown_8101E1C); sub_803E708(10,0x46); PlaySoundEffect(0x1cf); sub_80856E0(PartnerEntity,4); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8101EAC); + DisplayDungeonDialogue(&gUnknown_8101EAC); sub_803E708(10,0x46); sub_8087EB0(); PlaySoundEffect(0x1da); - sub_8052910(&gUnknown_8102070); + DisplayDungeonDialogue(&gUnknown_8102070); sub_803E708(10,0x46); sub_8087D80(9,5); sub_8087DE8(0xb,5); - sub_8052910(&gUnknown_81020A4); + DisplayDungeonDialogue(&gUnknown_81020A4); sub_803E708(10,0x46); sub_8087D80(0xc,5); sub_8087DE8(9,5); sub_8087D30(MoltresEntity); sub_808663C(); sub_8087EB0(); - sub_8052910(&gUnknown_81020D4); + DisplayDungeonDialogue(&gUnknown_81020D4); sub_803E708(10,0x46); sub_8087DE8(0xb,6); - sub_8052910(&gUnknown_8102108); + DisplayDungeonDialogue(&gUnknown_8102108); sub_803E708(10,0x46); SetupBossFightHP(MoltresEntity,400,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -612,29 +612,29 @@ void MoltresReFightDialogue(void) sub_803E708(10,0x46); SpriteLookAroundEffect(PartnerEntity); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8102158); + DisplayDungeonDialogue(&gUnknown_8102158); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); - sub_8052910(&gUnknown_8102190); + DisplayDungeonDialogue(&gUnknown_8102190); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,2,6); sub_80869E4(LeaderEntity,4,2,6); sub_8086690(); sub_8087F24(); sub_803E708(10,0x46); - sub_8085930(5); + sub_8085930(DIRECTION_NORTHWEST); sub_803E708(4,0x46); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_8087D30(MoltresEntity); sub_808663C(); sub_8087EB0(); - sub_8052910(&gUnknown_8102200); + DisplayDungeonDialogue(&gUnknown_8102200); sub_803E708(10,0x46); sub_8087DE8(0xb,6); - sub_8052910(&gUnknown_8102254); + DisplayDungeonDialogue(&gUnknown_8102254); sub_803E708(10,0x46); - sub_8052910(&gUnknown_81022F8); + DisplayDungeonDialogue(&gUnknown_81022F8); sub_803E708(10,0x46); SetupBossFightHP(MoltresEntity,400,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -650,29 +650,29 @@ void MoltresPostStoryPreFightDialogue(void) sub_8087D80(0xc,5); sub_808654C(); if (sub_8086AE4(SPECIES_MOLTRES)) { - sub_8085930(5); + sub_8085930(DIRECTION_NORTHWEST); sub_803E708(4,0x46); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_803E708(4,0x46); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8100D3C); + DisplayDungeonDialogue(&gUnknown_8100D3C); sub_803E708(10,0x46); gDungeonGlobalData->unk2 = 1; } else { - sub_8052910(&gUnknown_810232C); - sub_8085930(5); + DisplayDungeonDialogue(&gUnknown_810232C); + sub_8085930(DIRECTION_NORTHWEST); sub_803E708(4,0x46); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_8087D30(MoltresEntity); - sub_8052910(&gUnknown_8102398); + DisplayDungeonDialogue(&gUnknown_8102398); sub_8087D80(0xc,5); sub_8087DE8(9,5); - sub_8052910(&gUnknown_81023C4); + DisplayDungeonDialogue(&gUnknown_81023C4); sub_8087EB0(); - sub_8052910(&gUnknown_8102400); + DisplayDungeonDialogue(&gUnknown_8102400); sub_8087DE8(0xb,6); - sub_8052910(&gUnknown_8102454); + DisplayDungeonDialogue(&gUnknown_8102454); sub_803E708(10,0x46); SetupBossFightHP(MoltresEntity,400,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -893,7 +893,7 @@ void sub_8087F54(void) sub_8083E88(0x72); sub_8085374(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); SetFacingDirection(ArticunoEntity, DIRECTION_SOUTH); sub_8086A3C(ArticunoEntity); @@ -909,7 +909,7 @@ void sub_8087FB4(void) sub_8083E88(0x72); sub_8085374(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); SetFacingDirection(ArticunoEntity, DIRECTION_SOUTH); sub_806CDD4(ArticunoEntity, 0xF, DIRECTION_SOUTH); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_ARTICUNO); @@ -924,7 +924,7 @@ void sub_8087FF8(void) ArticunoEntity = sub_8085680(0xd); sub_8085374(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (sub_8086AE4(SPECIES_ARTICUNO)) { sub_8068FE0(ArticunoEntity,0x21c,0); @@ -959,15 +959,15 @@ void ArticunoPreFightDialogue(void) ArticunoEntity = sub_8085680(0xd); sub_8086448(); SpriteLookAroundEffect(PartnerEntity); - sub_8052910(&gUnknown_8102478); + DisplayDungeonDialogue(&gUnknown_8102478); sub_803E708(10,0x46); sub_8086598(); sub_8083F14(); - sub_8052910(&gUnknown_81025B4); + DisplayDungeonDialogue(&gUnknown_81025B4); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); - sub_8052910(&gUnknown_81025D4); + DisplayDungeonDialogue(&gUnknown_81025D4); sub_803E708(10,0x46); SetFacingDirection(LeaderEntity, DIRECTION_WEST); sub_803E708(4,0x46); @@ -983,9 +983,9 @@ void ArticunoPreFightDialogue(void) sub_803E708(4,0x46); SetFacingDirection(LeaderEntity, DIRECTION_WEST); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8102610); + DisplayDungeonDialogue(&gUnknown_8102610); sub_803E708(10,0x46); - sub_8052910(&gUnknown_81026C4); + DisplayDungeonDialogue(&gUnknown_81026C4); sub_803E708(10,0x46); sub_80869E4(LeaderEntity,4,1,4); sub_80869E4(PartnerEntity,4,2,4); @@ -993,33 +993,33 @@ void ArticunoPreFightDialogue(void) SpriteLookAroundEffect(PartnerEntity); PlaySoundEffect(0x1d5); SpriteLookAroundEffect(LeaderEntity); - sub_8052910(&gUnknown_810270C); + DisplayDungeonDialogue(&gUnknown_810270C); sub_803E708(10,0x46); - sub_8052910(&gUnknown_810272C); + DisplayDungeonDialogue(&gUnknown_810272C); sub_803E708(10,0x46); PlaySoundEffect(0); // snow flurry gDungeonGlobalData->unkE265 = 7; sub_807EAA0(0,1); PlaySoundEffect(0x1ee); // flash effect? sub_8088574(); - sub_8052910(&gUnknown_81027BC); + DisplayDungeonDialogue(&gUnknown_81027BC); sub_803E708(10,0x46); ArticunoScreenFlash(); sub_8086738(); PlaySoundEffect(0x1da); - sub_8052910(&gUnknown_8102810); + DisplayDungeonDialogue(&gUnknown_8102810); sub_803E708(10,0x46); PlaySoundEffect(0x1ea); sub_8088484(ArticunoEntity); sub_80865E8(); ArticunoScreenFlash(); - sub_8052910(&gUnknown_8102840); + DisplayDungeonDialogue(&gUnknown_8102840); sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH); ArticunoScreenFlash(); - sub_8052910(&gUnknown_810286C); + DisplayDungeonDialogue(&gUnknown_810286C); sub_806CDD4(ArticunoEntity,0x10,DIRECTION_SOUTH); ArticunoScreenFlash(); - sub_8052910(&gUnknown_81028B8); + DisplayDungeonDialogue(&gUnknown_81028B8); sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH); sub_803E708(0x10,0x46); SetupBossFightHP(ArticunoEntity,0x1c2,0xb); @@ -1036,12 +1036,12 @@ void ArticunoReFightDialogue(void) gDungeonGlobalData->unkE265 = 7; sub_807EAA0(0,1); sub_803E708(10,0x46); - sub_8052910(&gUnknown_81028D4); + DisplayDungeonDialogue(&gUnknown_81028D4); sub_806CDD4(ArticunoEntity,0x10,DIRECTION_SOUTH); ArticunoScreenFlash(); - sub_8052910(&gUnknown_8102918); + DisplayDungeonDialogue(&gUnknown_8102918); ArticunoScreenFlash(); - sub_8052910(&gUnknown_8102948); + DisplayDungeonDialogue(&gUnknown_8102948); sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH); sub_803E708(0x28,0x46); SetupBossFightHP(ArticunoEntity,0x1c2,0xb); @@ -1065,19 +1065,19 @@ void ArticunoPostStoryPreFightDialogue(void) ArticunoScreenFlash(); sub_8086738(); PlaySoundEffect(0x1da); - sub_8052910(&gUnknown_8102984); + DisplayDungeonDialogue(&gUnknown_8102984); sub_803E708(10,0x46); sub_8088484(ArticunoEntity); ArticunoScreenFlash(); - sub_8052910(&gUnknown_81029B4); + DisplayDungeonDialogue(&gUnknown_81029B4); sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH); ArticunoScreenFlash(); - sub_8052910(&gUnknown_8102A18); + DisplayDungeonDialogue(&gUnknown_8102A18); sub_806CDD4(ArticunoEntity,0x10,DIRECTION_SOUTH); ArticunoScreenFlash(); - sub_8052910(&gUnknown_8102A24); + DisplayDungeonDialogue(&gUnknown_8102A24); ArticunoScreenFlash(); - sub_8052910(&gUnknown_8102A74); + DisplayDungeonDialogue(&gUnknown_8102A74); sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH); sub_803E708(0x28,0x46); SetupBossFightHP(ArticunoEntity,0x1c2,0xb); @@ -1154,7 +1154,7 @@ void sub_80885C4(void) sub_803E708(0x3c,0x46); sub_8083F14(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3); } @@ -1186,7 +1186,7 @@ void sub_808862C(void) sub_80867F4(); sub_8085374(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); SetFacingDirection(AlakazamEntity, DIRECTION_NORTH); sub_80861D4(AlakazamEntity,0xd,4); @@ -1213,7 +1213,7 @@ void sub_80886C4(void) sub_80867F4(); sub_8085374(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_8068FE0(AlakazamEntity,0x21c,0); SetFacingDirection(GroudonEntity, DIRECTION_SOUTH); sub_8086A3C(GroudonEntity); @@ -1236,7 +1236,7 @@ void sub_808875C(void) GroudonEntity = sub_8085680(0xe); sub_80867F4(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_8068FE0(AlakazamEntity,0x21c,0); if (sub_8086AE4(SPECIES_GROUDON)) { @@ -1277,31 +1277,31 @@ void GroudonPreFightDialogue(void) AlakazamEntity = sub_8085680(10); GroudonEntity = sub_8085680(0xe); sub_8086448(); - sub_8052910(&gUnknown_8102E70); + DisplayDungeonDialogue(&gUnknown_8102E70); sub_803E708(10,0x46); sub_803E708(0x3c,0x46); - sub_8052910(&gUnknown_8102EBC); + DisplayDungeonDialogue(&gUnknown_8102EBC); sub_803E708(10,0x46); sub_8086838(1,1,1); sub_808680C(); sub_803E708(0x3c,0x46); sub_808682C(); sub_803E708(0x1e,0x46); - sub_8052910(&gUnknown_8102EE0); + DisplayDungeonDialogue(&gUnknown_8102EE0); sub_803E708(10,0x46); sub_8086838(1,1,1); sub_808680C(); sub_803E708(0x3c,0x46); - sub_8052910(&gUnknown_8102EF8); + DisplayDungeonDialogue(&gUnknown_8102EF8); sub_803E708(10,0x46); GroudonScreenFlash(); - sub_8052910(&gUnknown_8102F30); + DisplayDungeonDialogue(&gUnknown_8102F30); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8102F64); + DisplayDungeonDialogue(&gUnknown_8102F64); sub_803E708(10,0x46); PlaySoundEffect(0x1d5); SpriteLookAroundEffect(PartnerEntity); - sub_8052910(&gUnknown_8102F84); + DisplayDungeonDialogue(&gUnknown_8102F84); sub_803E708(10,0x46); sub_808682C(); sub_803E708(0x3c,0x46); @@ -1309,39 +1309,39 @@ void GroudonPreFightDialogue(void) PlaySoundEffect(0x205); sub_8086738(); sub_8068FE0(AlakazamEntity,0x21c,0); - sub_8052910(&gUnknown_8102FAC); + DisplayDungeonDialogue(&gUnknown_8102FAC); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8102FC4); + DisplayDungeonDialogue(&gUnknown_8102FC4); sub_803E708(10,0x46); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_8086764(); sub_803E708(0x28,0x46); PlaySoundEffect(0x1d5); SpriteLookAroundEffect(PartnerEntity); - sub_8052910(&gUnknown_8102FD8); + DisplayDungeonDialogue(&gUnknown_8102FD8); sub_803E708(10,0x46); sub_8086838(1,1,1); sub_808680C(); sub_803E708(0x3c,0x46); - sub_8052910(&gUnknown_8103054); + DisplayDungeonDialogue(&gUnknown_8103054); sub_803E708(10,0x46); sub_8083F14(); GroudonScreenFlash2(); sub_803E708(0x1e,0x46); - sub_8052910(&gUnknown_81030D8); + DisplayDungeonDialogue(&gUnknown_81030D8); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8103110); + DisplayDungeonDialogue(&gUnknown_8103110); sub_803E708(10,0x46); sub_803E708(0x1e,0x46); sub_808682C(); sub_803E708(0x3c,0x46); PlaySoundEffect(0x1fa); sub_8086738(); - sub_8085930(4); - sub_8052910(&gUnknown_8103140); + sub_8085930(DIRECTION_NORTH); + DisplayDungeonDialogue(&gUnknown_8103140); sub_803E708(10,0x46); sub_8086A54(GroudonEntity); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_8086764(); SetupBossFightHP(GroudonEntity,500,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -1357,23 +1357,23 @@ void GroudonReFightDialogue(void) sub_8086838(1,1,1); sub_808680C(); sub_803E708(0x3c,0x46); - sub_8052910(&gUnknown_8103188); + DisplayDungeonDialogue(&gUnknown_8103188); sub_803E708(10,0x46); GroudonScreenFlash(); sub_803E708(0x1e,0x46); - sub_8052910(&gUnknown_8103228); + DisplayDungeonDialogue(&gUnknown_8103228); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8103310); + DisplayDungeonDialogue(&gUnknown_8103310); sub_803E708(10,0x46); sub_808682C(); sub_803E708(0x3c,0x46); sub_8083F14(); PlaySoundEffect(0x1fa); sub_8086738(); - sub_8052910(&gUnknown_8103340); + DisplayDungeonDialogue(&gUnknown_8103340); sub_803E708(10,0x46); sub_8086A54(GroudonEntity); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_8086764(); SetupBossFightHP(GroudonEntity,500,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -1391,17 +1391,17 @@ void GroudonPostStoryPreFightDialogue(void) sub_80866C4(&gUnknown_8103488); } else{ - sub_8052910(&gUnknown_81033A0); + DisplayDungeonDialogue(&gUnknown_81033A0); sub_803E708(10,0x46); SceneGroudonMovement(GroudonEntity); SceneGroudonMovement(GroudonEntity); - sub_8052910(&gUnknown_81033AC); + DisplayDungeonDialogue(&gUnknown_81033AC); PlaySoundEffect(0x1f6); GroudonScreenFlash(); - sub_8052910(&gUnknown_810343C); + DisplayDungeonDialogue(&gUnknown_810343C); PlaySoundEffect(0x1f6); GroudonScreenFlash(); - sub_8052910(&gUnknown_810347C); + DisplayDungeonDialogue(&gUnknown_810347C); sub_803E708(10,0x46); SetupBossFightHP(GroudonEntity,500,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -1431,7 +1431,7 @@ void SceneGroudonMovement(struct DungeonEntity * param_1) sub_80861D4(param_1,0xf,0); sub_803E708(10,0x46); sub_808682C(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_803E708(0x22,0x46); } @@ -1503,7 +1503,7 @@ void sub_8088DC0(void) sub_8086838(0,1,0); sub_8085374(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_8086A3C(uVar2); sub_806CDD4(uVar2,0xe,DIRECTION_SOUTH); @@ -1526,7 +1526,7 @@ void sub_8088E5C(void) sub_80867F4(); sub_8086838(0,1,0); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_8068FE0(uVar2,0x21c,0); sub_8068FE0(uVar3,0x21c,0); @@ -1559,7 +1559,7 @@ void MagmaCavernMidDialogue(void) SpriteLookAroundEffect(PartnerEntity); // Let's see.. // I wonder where we are? - sub_8052910(&gUnknown_8102B1C); + DisplayDungeonDialogue(&gUnknown_8102B1C); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); @@ -1568,7 +1568,7 @@ void MagmaCavernMidDialogue(void) // // I'm certain we've come quite // far already.. - sub_8052910(&gUnknown_8102B54); + DisplayDungeonDialogue(&gUnknown_8102B54); sub_803E708(10,0x46); sub_8083F14(); sub_80855E4(sub_80868F4); @@ -1577,20 +1577,20 @@ void MagmaCavernMidDialogue(void) sub_803E708(0x28,0x46); // Waaah! // Qu-quake! - sub_8052910(&gUnknown_8102BC4); + DisplayDungeonDialogue(&gUnknown_8102BC4); sub_803E708(0x78,0x46); sub_8083E58(0x1c5); sub_808682C(); sub_80855E4(sub_8086910); sub_803E708(0x14,0x46); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_803E708(10,0x46); // Whew! // It settled down. // // Whew // It's over. - sub_8052910(&gUnknown_8102BE4); + DisplayDungeonDialogue(&gUnknown_8102BE4); sub_803E708(10,0x46); PlaySoundEffect(0x1d5); SpriteLookAroundEffect(PartnerEntity); @@ -1598,7 +1598,7 @@ void MagmaCavernMidDialogue(void) sub_80856E0(PartnerEntity,4); // Hey! {ARG_POKEMON_0}! // Over there! - sub_8052910(&gUnknown_8102C30); + DisplayDungeonDialogue(&gUnknown_8102C30); iVar3->entityData->unk15E = 0; iVar4->entityData->unk15E =0; local_20[0] = (iVar3->posPixelX + iVar4->posPixelX) / 2; @@ -1611,29 +1611,29 @@ void MagmaCavernMidDialogue(void) // // Hey! // Snap out of it! - sub_8052910(&gUnknown_8102C54); + DisplayDungeonDialogue(&gUnknown_8102C54); sub_803E708(10,0x46); // Urrrrgh... - sub_8052910(&gUnknown_8102C98); + DisplayDungeonDialogue(&gUnknown_8102C98); sub_803E708(10,0x46); sub_80869E4(LeaderEntity,4,2,5); // What happened to you? // // What happened here? - sub_8052910(&gUnknown_8102CB0); + DisplayDungeonDialogue(&gUnknown_8102CB0); sub_803E708(10,0x46); // We challenged.. // {ARG_POKEMON_2}... // And wiped out.. - sub_8052910(&gUnknown_8102CF8); + DisplayDungeonDialogue(&gUnknown_8102CF8); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8102D34); + DisplayDungeonDialogue(&gUnknown_8102D34); sub_803E708(10,0x46); sub_80869E4(LeaderEntity,4,1,3); sub_80869E4(PartnerEntity,4,1,3); // Grrgh.. // We... It crushed us - sub_8052910(&gUnknown_8102D4C); + DisplayDungeonDialogue(&gUnknown_8102D4C); sub_803E708(10,0x46); PlaySoundEffect(0x1d5); SpriteLookAroundEffect(PartnerEntity); @@ -1644,20 +1644,20 @@ void MagmaCavernMidDialogue(void) // Wait... // What about {ARG_POKEMON_3}? // Where did {ARG_POKEMON_3} go? - sub_8052910(&gUnknown_8102D7C); + DisplayDungeonDialogue(&gUnknown_8102D7C); sub_803E708(0x1e,0x46); // {ARG_POKEMON_3} is... // Still battling {ARG_POKEMON_2}... - sub_8052910(&gUnknown_8102DFC); + DisplayDungeonDialogue(&gUnknown_8102DFC); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); // {ARG_POKEMON_0}! // We've got to hurry! - sub_8052910(&gUnknown_8102E2C); + DisplayDungeonDialogue(&gUnknown_8102E2C); sub_8089294(); // Be careful! - sub_8052910(&gUnknown_8102E54); + DisplayDungeonDialogue(&gUnknown_8102E54); sub_803E708(10,0x46); gDungeonGlobalData->unk2 = 1; } @@ -1770,7 +1770,7 @@ void sub_80892C8(void) sub_8083E88(0x1a); sub_8085374(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); SetFacingDirection(RayquazaEntity, DIRECTION_SOUTH); sub_8086A3C(RayquazaEntity); @@ -1787,7 +1787,7 @@ void sub_8089328(void) RayquazaEntity = sub_8085680(0xf); sub_8083E88(0x1a); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (sub_8086AE4(SPECIES_RAYQUAZA)) { sub_8068FE0(RayquazaEntity,0x21c,0); @@ -1818,33 +1818,33 @@ void RayquazaPreFightDialogue(void) PartnerEntity = GetPartnerEntity(); RayquazaEntity = sub_8085680(0xf); sub_8086448(); - sub_8052910(&gUnknown_8103500); + DisplayDungeonDialogue(&gUnknown_8103500); RayquazaScreenFlash(); - sub_8052910(&gUnknown_810352C); + DisplayDungeonDialogue(&gUnknown_810352C); sub_80856E0(PartnerEntity,4); SpriteLookAroundEffect(PartnerEntity); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); - sub_8052910(&gUnknown_8103578); + DisplayDungeonDialogue(&gUnknown_8103578); sub_80869E4(PartnerEntity,4,2,4); sub_80869E4(LeaderEntity,4,1,4); - sub_8052910(&gUnknown_81035D4); + DisplayDungeonDialogue(&gUnknown_81035D4); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8103618); + DisplayDungeonDialogue(&gUnknown_8103618); sub_803E708(10,0x46); - sub_8052910(&gUnknown_810367C); + DisplayDungeonDialogue(&gUnknown_810367C); RayquazaScreenFlash(); PlaySoundEffect(0x1da); // Rayquaza Cry - sub_8052910(&gUnknown_8103690); + DisplayDungeonDialogue(&gUnknown_8103690); sub_8089620(RayquazaEntity); - sub_8052910(&gUnknown_81036C8); + DisplayDungeonDialogue(&gUnknown_81036C8); RayquazaScreenFlash(); - sub_8052910(&gUnknown_81037A0); + DisplayDungeonDialogue(&gUnknown_81037A0); RayquazaScreenFlash(); - sub_8052910(&gUnknown_81037D4); + DisplayDungeonDialogue(&gUnknown_81037D4); RayquazaScreenFlash(); - sub_8052910(&gUnknown_8103820); + DisplayDungeonDialogue(&gUnknown_8103820); SetupBossFightHP(RayquazaEntity,600,0x20); sub_80858AC(&LeaderEntity->posPixelX,0x10); } @@ -1859,16 +1859,16 @@ void RayquazaReFightDialogue(void) sub_8086448(); RayquazaScreenFlash(); PlaySoundEffect(0x1da); // Rayquaza Cry - sub_8052910(&gUnknown_8103690); + DisplayDungeonDialogue(&gUnknown_8103690); sub_803E708(10,0x46); sub_8089620(RayquazaEntity); - sub_8052910(&gUnknown_8103844); + DisplayDungeonDialogue(&gUnknown_8103844); RayquazaScreenFlash(); - sub_8052910(&gUnknown_8103874); + DisplayDungeonDialogue(&gUnknown_8103874); RayquazaScreenFlash(); - sub_8052910(&gUnknown_81038A8); + DisplayDungeonDialogue(&gUnknown_81038A8); RayquazaScreenFlash(); - sub_8052910(&gUnknown_81038F8); + DisplayDungeonDialogue(&gUnknown_81038F8); SetupBossFightHP(RayquazaEntity,600,0x20); sub_80858AC(&LeaderEntity->posPixelX,0x10); } @@ -1886,15 +1886,15 @@ void RayquazaPostStoryPreFightDialogue(void) } else { PlaySoundEffect(0x1da); // Rayquaza Cry - sub_8052910(&gUnknown_8103904); + DisplayDungeonDialogue(&gUnknown_8103904); sub_8089620(RayquazaEntity); - sub_8052910(&gUnknown_8103938); + DisplayDungeonDialogue(&gUnknown_8103938); RayquazaScreenFlash(); - sub_8052910(&gUnknown_8103AA4); + DisplayDungeonDialogue(&gUnknown_8103AA4); RayquazaScreenFlash(); - sub_8052910(&gUnknown_8103AE4); + DisplayDungeonDialogue(&gUnknown_8103AE4); RayquazaScreenFlash(); - sub_8052910(&gUnknown_8103B30); + DisplayDungeonDialogue(&gUnknown_8103B30); SetupBossFightHP(RayquazaEntity,600,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); } @@ -1956,7 +1956,7 @@ void sub_808970C(void) LeaderEntity = xxx_call_GetLeaderEntity(); sub_8083E88(0x7D); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_808563C(sub_8089908); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY + -3); @@ -1968,7 +1968,7 @@ void sub_808974C(void) LeaderEntity = xxx_call_GetLeaderEntity(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_808563C(sub_80898F8); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY + -3); @@ -2008,27 +2008,27 @@ void sub_80897F0(void) sub_808563C(sub_80862BC); sub_803E708(0x20,0x46); sub_808692C(); - sub_8052910(&gUnknown_8103BD8); + DisplayDungeonDialogue(&gUnknown_8103BD8); // We don't like to brag or // nothing, but - sub_8052910(&gUnknown_8103C00); + DisplayDungeonDialogue(&gUnknown_8103C00); // We get furious real easy // You know that?! - sub_8052910(&gUnknown_8103C3C); + DisplayDungeonDialogue(&gUnknown_8103C3C); // What really irritates us is // when we see some dim witted face - sub_8052910(&gUnknown_8103C74); + DisplayDungeonDialogue(&gUnknown_8103C74); // ......... // Wrooooooar! // That vacant expression - sub_8052910(&gUnknown_8103CC4); + DisplayDungeonDialogue(&gUnknown_8103CC4); // Gwoooh // It's ticking me off! // I'm seeing red! - sub_8052910(&gUnknown_8103D0C); + DisplayDungeonDialogue(&gUnknown_8103D0C); // Mukkkeeeeeh // Get 'em! It's frenzy time! - sub_8052910(&gUnknown_8103D50); + DisplayDungeonDialogue(&gUnknown_8103D50); sub_803E708(10,0x46); sub_80858AC(&LeaderEntity->posPixelX,0x10); } @@ -2045,10 +2045,10 @@ void sub_8089878(void) sub_808563C(sub_80862BC); sub_803E708(0x20,0x46); sub_808692C(); - sub_8052910(&gUnknown_8103D8C); - sub_8052910(&gUnknown_8103D98); - sub_8052910(&gUnknown_8103DD8); - sub_8052910(&gUnknown_8103E28); + DisplayDungeonDialogue(&gUnknown_8103D8C); + DisplayDungeonDialogue(&gUnknown_8103D98); + DisplayDungeonDialogue(&gUnknown_8103DD8); + DisplayDungeonDialogue(&gUnknown_8103E28); sub_803E708(10,0x46); sub_80858AC(&LeaderEntity->posPixelX,0x10); } @@ -2079,7 +2079,7 @@ void sub_8089914(void) sub_8083F14(); gDungeonGlobalData->unk7 = 1; sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); SetFacingDirection(MewtwoEntity, DIRECTION_SOUTH); sub_8086A3C(MewtwoEntity); @@ -2096,7 +2096,7 @@ void sub_8089978(void) MewtwoEntity = sub_8085680(0x11); sub_8083F14(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if(HasRecruitedMon(SPECIES_MEWTWO)){ sub_8083E88(0x23); @@ -2127,20 +2127,20 @@ void MewtwoPreFightDialogue(void) LeaderEntity = xxx_call_GetLeaderEntity(); MewtwoEntity = sub_8085680(0x11); sub_8086448(); - sub_8052910(&gUnknown_8103EA4); + DisplayDungeonDialogue(&gUnknown_8103EA4); sub_803E708(10,0x46); sub_8083E88(0x23); sub_8086794(); sub_803E708(0x1e,0x46); sub_8089B64(MewtwoEntity); sub_803E708(0x3c,0x46); - sub_8052910(&gUnknown_8103F0C); - sub_8052910(&gUnknown_8103F4C); + DisplayDungeonDialogue(&gUnknown_8103F0C); + DisplayDungeonDialogue(&gUnknown_8103F4C); sub_803E708(10,0x46); MewtwoScreenFlash(); - sub_8052910(&gUnknown_8103FCC); + DisplayDungeonDialogue(&gUnknown_8103FCC); MewtwoScreenFlash(); - sub_8052910(&gUnknown_8104008); + DisplayDungeonDialogue(&gUnknown_8104008); sub_803E708(10,0x46); SetupBossFightHP(MewtwoEntity,900,0x20); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2158,16 +2158,16 @@ void MewtwoPreFightDialogue1(void) sub_80866C4(&gUnknown_8104144); } else { - sub_8052910(&gUnknown_8104044); + DisplayDungeonDialogue(&gUnknown_8104044); sub_8083E88(0x23); sub_8086794(); sub_8089B64(MewtwoEntity); sub_803E708(0x3c,0x46); - sub_8052910(&gUnknown_8104050); + DisplayDungeonDialogue(&gUnknown_8104050); MewtwoScreenFlash(); - sub_8052910(&gUnknown_81040CC); + DisplayDungeonDialogue(&gUnknown_81040CC); MewtwoScreenFlash(); - sub_8052910(&gUnknown_8104114); + DisplayDungeonDialogue(&gUnknown_8104114); SetupBossFightHP(MewtwoEntity,900,0x20); sub_80858AC(&LeaderEntity->posPixelX,0x10); } @@ -2230,7 +2230,7 @@ void sub_8089C44(void) EnteiEntity = sub_8085680(0x12); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); SetFacingDirection(EnteiEntity, DIRECTION_SOUTH); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_ENTEI); @@ -2246,7 +2246,7 @@ void sub_8089C90(void) EnteiEntity = sub_8085680(0x12); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(SPECIES_ENTEI)) { sub_8068FE0(EnteiEntity,0x21c,0); } @@ -2275,11 +2275,11 @@ void EnteiPreFightDialogue(void) LeaderEntity = xxx_call_GetLeaderEntity(); EnteiEntity = sub_8085680(0x12); EnteiScreenFlash(); - sub_8052910(&gUnknown_8104150); + DisplayDungeonDialogue(&gUnknown_8104150); EnteiScreenFlash(); - sub_8052910(&gUnknown_81041AC); + DisplayDungeonDialogue(&gUnknown_81041AC); EnteiScreenFlash(); - sub_8052910(&gUnknown_81041F8); + DisplayDungeonDialogue(&gUnknown_81041F8); sub_803E708(10,70); SetupBossFightHP(EnteiEntity,600,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2293,11 +2293,11 @@ void EnteiPreFightDialogue1(void) LeaderEntity = xxx_call_GetLeaderEntity(); EnteiEntity = sub_8085680(0x12); EnteiScreenFlash(); - sub_8052910(&gUnknown_8104240); + DisplayDungeonDialogue(&gUnknown_8104240); EnteiScreenFlash(); - sub_8052910(&gUnknown_81042AC); + DisplayDungeonDialogue(&gUnknown_81042AC); EnteiScreenFlash(); - sub_8052910(&gUnknown_81042B8); + DisplayDungeonDialogue(&gUnknown_81042B8); sub_803E708(10,70); SetupBossFightHP(EnteiEntity,600,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2315,11 +2315,11 @@ void EnteiPreFightDialogue2(void) } else { EnteiScreenFlash(); - sub_8052910(&gUnknown_8104310); + DisplayDungeonDialogue(&gUnknown_8104310); EnteiScreenFlash(); - sub_8052910(&gUnknown_810439C); + DisplayDungeonDialogue(&gUnknown_810439C); EnteiScreenFlash(); - sub_8052910(&gUnknown_81043C0); + DisplayDungeonDialogue(&gUnknown_81043C0); sub_803E708(10,70); SetupBossFightHP(EnteiEntity,600,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2361,7 +2361,7 @@ void sub_8089EFC(void) RaikouEntity = sub_8085680(0x13); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); SetFacingDirection(RaikouEntity, DIRECTION_SOUTH); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_RAIKOU); @@ -2377,7 +2377,7 @@ void sub_8089F44(void) RaikouEntity = sub_8085680(0x13); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); SetFacingDirection(RaikouEntity, DIRECTION_SOUTH); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_RAIKOU); @@ -2393,7 +2393,7 @@ void sub_8089F8C(void) RaikouEntity = sub_8085680(0x13); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(SPECIES_RAIKOU)) { sub_8068FE0(RaikouEntity,0x21c,0); } @@ -2420,19 +2420,19 @@ void RaikouPreFightDialogue(void) LeaderEntity = xxx_call_GetLeaderEntity(); RaikouEntity = sub_8085680(0x13); - sub_8052910(&gUnknown_8104450); + DisplayDungeonDialogue(&gUnknown_8104450); RaikouScreenFlash(); - sub_8052910(&gUnknown_81044B4); + DisplayDungeonDialogue(&gUnknown_81044B4); gDungeonGlobalData->unkE265 = 4; sub_807EAA0(0,1); sub_803E708(10,70); - sub_8052910(&gUnknown_8104510); + DisplayDungeonDialogue(&gUnknown_8104510); RaikouScreenFlash(); - sub_8052910(&gUnknown_810453C); + DisplayDungeonDialogue(&gUnknown_810453C); RaikouScreenFlash(); - sub_8052910(&gUnknown_8104570); + DisplayDungeonDialogue(&gUnknown_8104570); RaikouScreenFlash(); - sub_8052910(&gUnknown_81045B0); + DisplayDungeonDialogue(&gUnknown_81045B0); sub_803E708(10,70); SetupBossFightHP(RaikouEntity,0x28a,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2448,11 +2448,11 @@ void RaikouPreFightDialogue1(void) gDungeonGlobalData->unkE265 = 4; sub_807EAA0(0,1); RaikouScreenFlash(); - sub_8052910(&gUnknown_81045F8); + DisplayDungeonDialogue(&gUnknown_81045F8); RaikouScreenFlash(); - sub_8052910(&gUnknown_8104674); + DisplayDungeonDialogue(&gUnknown_8104674); RaikouScreenFlash(); - sub_8052910(&gUnknown_81046A0); + DisplayDungeonDialogue(&gUnknown_81046A0); sub_803E708(10,70); SetupBossFightHP(RaikouEntity,0x28a,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2471,11 +2471,11 @@ void RaikouPreFightDialogue2(void) else { gDungeonGlobalData->unkE265 = 4; sub_807EAA0(0,1); - sub_8052910(&gUnknown_81046CC); + DisplayDungeonDialogue(&gUnknown_81046CC); RaikouScreenFlash(); - sub_8052910(&gUnknown_8104744); + DisplayDungeonDialogue(&gUnknown_8104744); RaikouScreenFlash(); - sub_8052910(&gUnknown_810476C); + DisplayDungeonDialogue(&gUnknown_810476C); sub_803E708(10,70); SetupBossFightHP(RaikouEntity,0x28a,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2517,7 +2517,7 @@ void sub_808A264(void) SuicuneEntity = sub_8085680(0x14); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); SetFacingDirection(SuicuneEntity, DIRECTION_SOUTH); sub_8086A3C(SuicuneEntity); @@ -2534,7 +2534,7 @@ void sub_808A2C0(void) SuicuneEntity = sub_8085680(0x14); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); SetFacingDirection(SuicuneEntity, DIRECTION_SOUTH); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_SUICUNE); @@ -2549,7 +2549,7 @@ void sub_808A308(void) SuicuneEntity = sub_8085680(0x14); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(SPECIES_SUICUNE)) { sub_8068FE0(SuicuneEntity,0x21c,0); } @@ -2576,21 +2576,21 @@ void SuicunePreFightDialogue(void) LeaderEntity = xxx_call_GetLeaderEntity(); SuicuneEntity = sub_8085680(0x14); sub_8086448(); - sub_8052910(&gUnknown_8104784); + DisplayDungeonDialogue(&gUnknown_8104784); sub_803E708(10,70); - sub_8052910(&gUnknown_8104790); + DisplayDungeonDialogue(&gUnknown_8104790); sub_803E708(10,70); sub_80426C8(1,2); sub_803E708(0x3c,70); - sub_8052910(&gUnknown_81047B0); + DisplayDungeonDialogue(&gUnknown_81047B0); sub_803E708(10,70); sub_808A528(SuicuneEntity); - sub_8052910(&gUnknown_810484C); - sub_8052910(&gUnknown_8104888); + DisplayDungeonDialogue(&gUnknown_810484C); + DisplayDungeonDialogue(&gUnknown_8104888); SuicuneScreenFlash(); - sub_8052910(&gUnknown_81048C8); + DisplayDungeonDialogue(&gUnknown_81048C8); SuicuneScreenFlash(); - sub_8052910(&gUnknown_8104914); + DisplayDungeonDialogue(&gUnknown_8104914); sub_803E708(10,70); SetupBossFightHP(SuicuneEntity,0x28a,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2603,11 +2603,11 @@ void SuicunePreFightDialogue1(void) LeaderEntity = xxx_call_GetLeaderEntity(); SuicuneEntity = sub_8085680(0x14); - sub_8052910(&gUnknown_8104930); + DisplayDungeonDialogue(&gUnknown_8104930); SuicuneScreenFlash(); - sub_8052910(&gUnknown_8104980); + DisplayDungeonDialogue(&gUnknown_8104980); SuicuneScreenFlash(); - sub_8052910(&gUnknown_8104998); + DisplayDungeonDialogue(&gUnknown_8104998); sub_803E708(10,70); SetupBossFightHP(SuicuneEntity,0x28a,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2624,11 +2624,11 @@ void SuicunePreFightDialogue2(void) sub_80866C4(&gUnknown_8104AC8); } else { - sub_8052910(&gUnknown_81049D4); + DisplayDungeonDialogue(&gUnknown_81049D4); SuicuneScreenFlash(); - sub_8052910(&gUnknown_8104A80); + DisplayDungeonDialogue(&gUnknown_8104A80); SuicuneScreenFlash(); - sub_8052910(&gUnknown_8104A9C); + DisplayDungeonDialogue(&gUnknown_8104A9C); sub_803E708(10,70); SetupBossFightHP(SuicuneEntity,0x28a,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2694,7 +2694,7 @@ void sub_808A608(void) sub_80867F4(); sub_8086838(0,0,0); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); SetFacingDirection(HoOhEntity, DIRECTION_SOUTH); sub_8086A3C(HoOhEntity); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY + -6); @@ -2712,7 +2712,7 @@ void sub_808A668(void) sub_80867F4(); sub_8086838(0,0,0); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); if (HasRecruitedMon(SPECIES_HO_OH)) { sub_8068FE0(HoOhEntity,0x21c,0); } @@ -2750,10 +2750,10 @@ void HoOhPreFightDialogue(void) local_14[1] = LeaderEntity->posPixelY + -0x1000; sub_80858AC(local_14,0x88); sub_803E708(0x40,70); - sub_8052910(&gUnknown_8104AD4); + DisplayDungeonDialogue(&gUnknown_8104AD4); sub_803E708(10,70); HoOhScreenFlash(); - sub_8052910(&gUnknown_8104BEC); + DisplayDungeonDialogue(&gUnknown_8104BEC); sub_803E708(10,70); sub_80855E4(sub_80868F4); sub_808680C(); @@ -2763,15 +2763,15 @@ void HoOhPreFightDialogue(void) sub_8083E58(0x1c5); sub_808682C(); sub_80855E4(sub_8086910); - sub_8085930(4); - sub_8052910(&gUnknown_8104C10); - sub_8052910(&gUnknown_8104C54); + sub_8085930(DIRECTION_NORTH); + DisplayDungeonDialogue(&gUnknown_8104C10); + DisplayDungeonDialogue(&gUnknown_8104C54); sub_803E708(0x1e,70); sub_803E708(0x1e,70); HoOhScreenFlash(); - sub_8052910(&gUnknown_8104CB4); + DisplayDungeonDialogue(&gUnknown_8104CB4); HoOhScreenFlash(); - sub_8052910(&gUnknown_8104CE0); + DisplayDungeonDialogue(&gUnknown_8104CE0); sub_803E708(10,70); SetupBossFightHP(HoOhEntity,800,0x20); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2794,7 +2794,7 @@ void HoOhPreFightDialogue1(void) sub_80866C4(&gUnknown_8104E54); } else { - sub_8052910(&gUnknown_8104CEC); + DisplayDungeonDialogue(&gUnknown_8104CEC); HoOhScreenFlash(); sub_80855E4(sub_80868F4); sub_808680C(); @@ -2802,12 +2802,12 @@ void HoOhPreFightDialogue1(void) sub_808A904(HoOhEntity); sub_808682C(); sub_80855E4(sub_8086910); - sub_8085930(4); - sub_8052910(&gUnknown_8104D60); + sub_8085930(DIRECTION_NORTH); + DisplayDungeonDialogue(&gUnknown_8104D60); HoOhScreenFlash(); - sub_8052910(&gUnknown_8104DDC); + DisplayDungeonDialogue(&gUnknown_8104DDC); HoOhScreenFlash(); - sub_8052910(&gUnknown_8104E0C); + DisplayDungeonDialogue(&gUnknown_8104E0C); sub_803E708(10,70); SetupBossFightHP(HoOhEntity,800,0x20); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2871,7 +2871,7 @@ void sub_808A9E4(void) LatiosEntity = sub_8085680(0x16); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); SetFacingDirection(LatiosEntity, DIRECTION_NORTH); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 4); @@ -2887,7 +2887,7 @@ void sub_808AA3C(void) LatiosEntity = sub_8085680(0x16); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); SetFacingDirection(LatiosEntity, DIRECTION_NORTH); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3); @@ -2903,7 +2903,7 @@ void sub_808AA94(void) LatiosEntity = sub_8085680(0x16); sub_8083E88(0x72); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_8068FE0(LatiosEntity,0x21c,0); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3); @@ -2939,11 +2939,11 @@ void LatiosPreFightDialogue(void) sub_80862BC(LatiosEntity); sub_803E708(0x20,70); sub_808692C(); - sub_8052910(&gUnknown_8104E60); + DisplayDungeonDialogue(&gUnknown_8104E60); LatiosScreenFlash(); - sub_8052910(&gUnknown_8104EFC); + DisplayDungeonDialogue(&gUnknown_8104EFC); LatiosScreenFlash(); - sub_8052910(&gUnknown_8104F30); + DisplayDungeonDialogue(&gUnknown_8104F30); sub_803E708(10,70); SetupBossFightHP(LatiosEntity,600,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -2958,11 +2958,11 @@ void LatiosReFightDialogue(void) LatiosEntity = sub_8085680(0x16); sub_8086448(); sub_808692C(); - sub_8052910(&gUnknown_8104F64); + DisplayDungeonDialogue(&gUnknown_8104F64); LatiosScreenFlash(); - sub_8052910(&gUnknown_8104EFC); + DisplayDungeonDialogue(&gUnknown_8104EFC); LatiosScreenFlash(); - sub_8052910(&gUnknown_8104F30); + DisplayDungeonDialogue(&gUnknown_8104F30); sub_803E708(10,70); SetupBossFightHP(LatiosEntity,600,0xb); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -3021,7 +3021,7 @@ void sub_808ACC0(void) else { sub_8098044(0x22); sub_8098044(0x1d); - sub_80855E4(sub_808B2B0); + sub_80855E4(SetupRegiFacingDirection); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_REGIROCK); } } @@ -3053,7 +3053,7 @@ void sub_808AD48(void) else { sub_8098044(0x22); sub_8098044(0x1d); - sub_80855E4(sub_808B2B0); + sub_80855E4(SetupRegiFacingDirection); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_REGICE); } } @@ -3086,7 +3086,7 @@ void sub_808ADCC(void) else { sub_8098044(0x22); sub_8098044(0x1d); - sub_80855E4(sub_808B2B0); + sub_80855E4(SetupRegiFacingDirection); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_REGISTEEL); } } @@ -3110,7 +3110,7 @@ void sub_808AE54(char param_1,char param_2,u32 *param_3) sub_8083E88(0x72); // Something fell from Regirock's body // Regirock was apparently guarding this item - sub_8052910(&gUnknown_8105040); + DisplayDungeonDialogue(&gUnknown_8105040); } } } @@ -3133,7 +3133,7 @@ void sub_808AEC8(char param_1,char param_2,u32 *param_3) sub_8083E88(0x72); // Something fell from Regice's body // Regice was apparently guarding this item - sub_8052910(&gUnknown_810510C); + DisplayDungeonDialogue(&gUnknown_810510C); } } } @@ -3155,7 +3155,7 @@ void sub_808AF3C(char param_1,char param_2,u32 *param_3) sub_8083E88(0x72); // Something fell from Registeel's body // Registeel was apparently guarding this item - sub_8052910(&gUnknown_81051D0); + DisplayDungeonDialogue(&gUnknown_81051D0); } } } @@ -3171,7 +3171,7 @@ void sub_808AFB0(char param_1) sub_8097FD0(0x1d); SetMessageArgument(gAvailablePokemonNames,GetLeaderEntity(),0); // {ARG_POKEMON_0} obtained the Rock Part that Regirock was guarding - sub_8052910(&gUnknown_81050B4); + DisplayDungeonDialogue(&gUnknown_81050B4); sub_80421C0(0,0xd4); sub_803E708(10,70); sub_8046D20(); @@ -3189,7 +3189,7 @@ void sub_808B030(char param_1) sub_8097FD0(0x1d); SetMessageArgument(gAvailablePokemonNames,GetLeaderEntity(),0); // {ARG_POKEMON_0} obtained the Ice Part that Regice was guarding - sub_8052910(&gUnknown_810517C); + DisplayDungeonDialogue(&gUnknown_810517C); sub_80421C0(0,0xd4); sub_803E708(10,70); sub_8046D20(); @@ -3207,7 +3207,7 @@ void sub_808B0B0(char param_1) sub_8097FD0(0x1d); SetMessageArgument(gAvailablePokemonNames, GetLeaderEntity(), 0); // {ARG_POKEMON_0} obtained the Steel Part that Registeel was guarding - sub_8052910(&gUnknown_8105244); + DisplayDungeonDialogue(&gUnknown_8105244); sub_80421C0(0,0xd4); sub_803E708(10,70); sub_8046D20(); @@ -3217,36 +3217,36 @@ void sub_808B0B0(char param_1) void RegirockPreFightDialogue(void) { if (sub_8098100(0x22) == '\0') { - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); // INTRUDER ALERT // EXTERMINATE - sub_8052910(&gUnknown_8104FD4); + DisplayDungeonDialogue(&gUnknown_8104FD4); sub_803E708(10,70); - sub_808563C(sub_808B2C4); + sub_808563C(SetupRegirockFightHP); } } void RegicePreFightDialogue(void) { if (sub_8098100(0x22) == '\0') { - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); // INTRUDER ALERT // EXTERMINATE - sub_8052910(&gUnknown_8105028); + DisplayDungeonDialogue(&gUnknown_8105028); sub_803E708(10,70); - sub_808563C(sub_808B2D4); + sub_808563C(SetupRegiceFightHP); } } void RegisteelPreFightDialogue(void) { if (sub_8098100(0x22) == '\0') { - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); // INTRUDER ALERT // EXTERMINATE - sub_8052910(&gUnknown_8105034); + DisplayDungeonDialogue(&gUnknown_8105034); sub_803E708(10,70); - sub_808563C(sub_808B2E4); + sub_808563C(SetupRegisteelFightHP); } } @@ -3362,26 +3362,26 @@ void sub_808B1CC(u8 r0) } -void sub_808B2B0(struct DungeonEntity *r0) +void SetupRegiFacingDirection(struct DungeonEntity *r0) { r0->entityData->facingDir = DIRECTION_NORTH; sub_806CE68(r0, DIRECTION_NORTH); } -void sub_808B2C4(struct DungeonEntity *r0) +void SetupRegirockFightHP(struct DungeonEntity *r0) { SetupBossFightHP(r0, 0xE1 << 1, 0xB); } -void sub_808B2D4(struct DungeonEntity *r0) +void SetupRegiceFightHP(struct DungeonEntity *r0) { SetupBossFightHP(r0, 0xE1 << 1, 0xB); } -void sub_808B2E4(struct DungeonEntity *r0) +void SetupRegisteelFightHP(struct DungeonEntity *r0) { SetupBossFightHP(r0, 0xE1 << 1, 0xB); } @@ -3397,7 +3397,7 @@ void sub_808B2F4(void) sub_808BCE4(); sub_8049ED4(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); SetFacingDirection(JirachiEntity, DIRECTION_SOUTH); sub_8086A3C(JirachiEntity); @@ -3414,7 +3414,7 @@ void sub_808B35C(void) JirachiEntity = sub_8085680(0x1a); sub_8083E88(0x79); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); if (HasRecruitedMon(SPECIES_JIRACHI)) { sub_8068FE0(JirachiEntity,0x21c,0); @@ -3528,19 +3528,19 @@ void JirachiPreFightDialogue(void) JirachiEntity = sub_8085680(0x1a); sub_8086448(); sub_803E708(0x40,70); - sub_8052910(&gUnknown_8105438); + DisplayDungeonDialogue(&gUnknown_8105438); sub_803E708(10,70); SpriteLookAroundEffect(LeaderEntity); sub_803E708(10,70); - sub_8052910(&gUnknown_81054A0); + DisplayDungeonDialogue(&gUnknown_81054A0); sub_80861F8(0x37,JirachiEntity,1); sub_80855E4(sub_80862BC); sub_803E708(0x3c,70); sub_808BBB8(JirachiEntity); sub_803E708(0x5a,70); - sub_8052910(&gUnknown_81054E4); + DisplayDungeonDialogue(&gUnknown_81054E4); sub_803E708(10,70); - sub_8052910(&gUnknown_810550C); + DisplayDungeonDialogue(&gUnknown_810550C); sub_803E708(10,70); SetupBossFightHP(JirachiEntity,0x15e,0x20); sub_80858AC(&LeaderEntity->posPixelX,0x10); @@ -3561,15 +3561,15 @@ void sub_808B50C(void) sub_8083ED8(0x1e); sub_803E708(0x1e,70); // Fwaaaahhhh - sub_8052910(&gUnknown_810554C); + DisplayDungeonDialogue(&gUnknown_810554C); sub_8083E88(0x79); // I think I had a dream, and I was fighting in it // Did I imagine it? // I'm sleepy so I'm going back to sleep. - sub_8052910(&gUnknown_8105558); + DisplayDungeonDialogue(&gUnknown_8105558); sub_803E708(10,70); sub_808BC20(JirachiEntity); - sub_8052910(&gUnknown_81055F4); + DisplayDungeonDialogue(&gUnknown_81055F4); sub_803E708(10,70); gDungeonGlobalData->unk2 = 1; } diff --git a/src/code_80869E4.c b/src/code_80869E4.c index b7526d0..d7ebaf5 100644 --- a/src/code_80869E4.c +++ b/src/code_80869E4.c @@ -27,7 +27,7 @@ extern void sub_8085C54(u32, u32, u32, u32, u32); extern void PlaySoundEffect(u32); extern struct DungeonEntity *xxx_call_GetLeaderEntity(void); void SpriteLookAroundEffect(struct DungeonEntity *r0); -extern void sub_8052910(u32); +extern void DisplayDungeonDialogue(u32); void sub_8086494(); extern u32 gUnknown_8107314[]; @@ -171,16 +171,16 @@ void sub_8086494(void) { s32 iVar1; - sub_8085930(3); + sub_8085930(DIRECTION_NORTHEAST); sub_803E708(4, 0x46); - sub_8085930(2); + sub_8085930(DIRECTION_EAST); sub_803E708(4, 0x46); - sub_8085930(1); + sub_8085930(DIRECTION_SOUTHEAST); sub_803E708(4, 0x46); - sub_8085930(0); + sub_8085930(DIRECTION_SOUTH); sub_803E708(4, 0x46); sub_80855E4(sub_80863C8); @@ -312,7 +312,7 @@ void sub_80866C4(u32 r0) SpriteLookAroundEffect(xxx_call_GetLeaderEntity()); sub_803E708(0xA, 0x46); - sub_8052910(r0); + DisplayDungeonDialogue(r0); sub_803E708(0xA, 0x46); sub_8086494(); gDungeonGlobalData->unk2 = 1; @@ -461,16 +461,16 @@ void sub_8086910(struct DungeonEntity *r0) void sub_808692C(void) { - sub_80859F0(5); + sub_80859F0(DIRECTION_NORTHWEST); sub_803E708(0x4, 0x46); - sub_80859F0(6); + sub_80859F0(DIRECTION_WEST); sub_803E708(0x4, 0x46); - sub_80859F0(7); + sub_80859F0(DIRECTION_SOUTHWEST); sub_803E708(0x4, 0x46); - sub_80859F0(0); + sub_80859F0(DIRECTION_SOUTH); sub_803E708(0x4, 0x46); } diff --git a/src/code_8086A3C.c b/src/code_8086A3C.c index d8dbe4c..1e5c5cd 100644 --- a/src/code_8086A3C.c +++ b/src/code_8086A3C.c @@ -1,4 +1,5 @@ #include "global.h" +#include "constants/direction.h" #include "dungeon_entity.h" #include "dungeon_global_data.h" #include "pokemon.h" @@ -22,7 +23,7 @@ extern void sub_8085860(s32 r0, u32 r1); extern void sub_8068FE0(struct DungeonEntity *, u32, u32); extern void sub_8097FA8(u32); extern void sub_80858AC(void *, u32); -extern void sub_8052910(u8 *); +extern void DisplayDungeonDialogue(u8 *); extern void sub_806CDD4(struct DungeonEntity *, u32, u32); extern void sub_80869E4(struct DungeonEntity *, u32, u32, u32); extern void sub_8083E88(u32); @@ -124,7 +125,7 @@ void sub_8086B14(void) sub_8083E88(0x72); sub_8085374(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_8086A3C(SkarmoryEntity); DiglettEntity->entityData->unk15C = 1; @@ -146,7 +147,7 @@ void sub_8086B94(void) sub_8068FE0(SkarmoryEntity,0x21c,0); sub_8068FE0(DiglettEntity,0x21c,0); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY); } @@ -184,33 +185,33 @@ void SkarmoryPreFightDialogue(void) sub_80862BC(PartnerEntity); sub_803E708(0x20,0x46); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8100768); + DisplayDungeonDialogue(&gUnknown_8100768); sub_80858AC(&local_1c,0x40); sub_803E708(0x40,0x46); sub_80858AC(&local_20,0x30); - sub_8052910(&gUnknown_8100798); + DisplayDungeonDialogue(&gUnknown_8100798); sub_803E708(10,0x46); DiglettEntity->entityData->unk15D = 1; sub_80858AC(&local_1c,0x30); - sub_8052910(&gUnknown_8100820); // Diglett: ...I...\nI'm scared. + DisplayDungeonDialogue(&gUnknown_8100820); // Diglett: ...I...\nI'm scared. sub_803E708(10,0x46); sub_80858AC(&local_20,0x20); sub_803E708(0x20,0x46); sub_8086E74(SkarmoryEntity); - sub_8052910(&gUnknown_8100844); // Skarmory: You!\nWhat do you think you're doing here?! + DisplayDungeonDialogue(&gUnknown_8100844); // Skarmory: You!\nWhat do you think you're doing here?! sub_803E708(10,0x46); - sub_8052910(&gUnknown_8100880); + DisplayDungeonDialogue(&gUnknown_8100880); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8100928); + DisplayDungeonDialogue(&gUnknown_8100928); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8100A04); + DisplayDungeonDialogue(&gUnknown_8100A04); sub_803E708(10,0x46); sub_806CDD4(SkarmoryEntity,0xd,0); - sub_8052910(&gUnknown_8100B80); + DisplayDungeonDialogue(&gUnknown_8100B80); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); - sub_8052910(&gUnknown_8100BC0); + DisplayDungeonDialogue(&gUnknown_8100BC0); sub_80869E4(PartnerEntity,4,2,4); sub_80869E4(LeaderEntity,4,1,4); sub_803E708(10,0x46); @@ -232,12 +233,12 @@ void SkarmoryReFightDialogue(void) sub_803E708(10,0x46); sub_8086E74(SkarmoryEntity); sub_80858AC(&local_14,0x10); - sub_8052910(&gUnknown_8100C90); + DisplayDungeonDialogue(&gUnknown_8100C90); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8100CBC); + DisplayDungeonDialogue(&gUnknown_8100CBC); sub_803E708(10,0x46); sub_806CDD4(SkarmoryEntity,0xd,0); - sub_8052910(&gUnknown_8100CDC); + DisplayDungeonDialogue(&gUnknown_8100CDC); sub_803E708(10,0x46); sub_80858AC(&LeaderEntity->posPixelX,0x10); sub_8083E88(0xb); @@ -247,7 +248,7 @@ void sub_8086E40(void) { SpriteLookAroundEffect(xxx_call_GetLeaderEntity()); sub_803E708(10,0x46); - sub_8052910(&gUnknown_8100D3C); + DisplayDungeonDialogue(&gUnknown_8100D3C); sub_803E708(10,0x46); gDungeonGlobalData->unk2 = 1; } @@ -268,7 +269,7 @@ void sub_8086E9C(void) sub_8083E88(0x72); sub_8085374(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_808563C(sub_8086A3C); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3); @@ -283,7 +284,7 @@ void sub_8086F00(void) LeaderEntity = xxx_call_GetLeaderEntity(); sub_80854D4(); - sub_8085930(4); + sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3); CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_METAPOD); diff --git a/src/code_80958E8.c b/src/code_80958E8.c index 7674ed4..cae46bc 100644 --- a/src/code_80958E8.c +++ b/src/code_80958E8.c @@ -34,7 +34,7 @@ extern bool8 sub_809095C(u8); extern s32 sub_8090298(u8); extern bool8 sub_809017C(u8 *); extern s16 GetBaseSpecies(s16); -extern bool8 sub_8092040(u8); +extern bool8 IsInvalidItemReward(u8); extern u8 sub_803C1D0(u8 *, u8); extern bool8 IsNotMoneyOrUsedTMItem(u8); extern u8 xxx_bit_lut_lookup_8091E50(u8 ,u8 ); @@ -107,11 +107,11 @@ bool8 IsValidWonderMail(struct WonderMail *WonderMailData) bool8 ValidateWonderMail(struct WonderMail *data) { - if(data->missionType > DELIVER_ITEM) + if(data->missionType > WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM) return FALSE; else { - if(data->missionType == DELIVER_ITEM && GetMaxItemCount(data->dungeon) == 0) + if(data->missionType == WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM && GetMaxItemCount(data->dungeon) == 0) return FALSE; if(data->unk2 > 9) @@ -141,11 +141,11 @@ bool8 ValidateWonderMail(struct WonderMail *data) return FALSE; // Item Delivery/Finding - if((u8)(data->missionType - 1) > FIND_POKE) + if((u8)(data->missionType - 1) > WONDER_MAIL_MISSION_TYPE_RESCUE_TARGET) if(data->targetSpecies != data->clientSpecies) return FALSE; - if(sub_8092040(data->targetItem)) + if(IsInvalidItemReward(data->targetItem)) return FALSE; if(IsThrowableItem(data->targetItem)) return FALSE; @@ -153,13 +153,13 @@ bool8 ValidateWonderMail(struct WonderMail *data) return FALSE; // Item finding - if(data->missionType == FIND_ITEM && xxx_bit_lut_lookup_8091E50(data->dungeon, data->targetItem) == 0) + if(data->missionType == WONDER_MAIL_MISSION_TYPE_FIND_ITEM && xxx_bit_lut_lookup_8091E50(data->dungeon, data->targetItem) == 0) return FALSE; if(data->rewardType == BLANK_4 || data->rewardType == END_REWARDS || data->rewardType > END_REWARDS) return FALSE; - if(sub_8092040(data->itemReward)) + if(IsInvalidItemReward(data->itemReward)) return FALSE; // Friend Area Reward diff --git a/src/dungeon_ai.c b/src/dungeon_ai.c index 6253a64..5776bfa 100644 --- a/src/dungeon_ai.c +++ b/src/dungeon_ai.c @@ -7,6 +7,17 @@ #include "dungeon_pokemon_attributes_1.h" #include "dungeon_util.h" +extern void CheckRunAwayVisualFlag(struct DungeonEntity *, u8 r1); + +bool8 ShouldAvoidFirstHit(struct DungeonEntity *pokemon, bool8 forceAvoid) +{ + if(!HasTactic(pokemon, TACTIC_AVOID_THE_FIRST_HIT)) + return FALSE; + if(!forceAvoid) + return FALSE; + return TRUE; +} + bool8 ShouldAvoidEnemies(struct DungeonEntity *pokemon) { if (!EntityExists(pokemon)) @@ -40,3 +51,13 @@ bool8 ShouldAvoidEnemies(struct DungeonEntity *pokemon) return FALSE; } } + +bool8 ShouldAvoidEnemies_2(struct DungeonEntity *pokemon, u8 r1) +{ + if(ShouldAvoidEnemies(pokemon)) + { + CheckRunAwayVisualFlag(pokemon, r1); + return TRUE; + } + return FALSE; +} diff --git a/src/dungeon_ai_items.c b/src/dungeon_ai_items.c index 4877712..7a348f1 100644 --- a/src/dungeon_ai_items.c +++ b/src/dungeon_ai_items.c @@ -27,12 +27,35 @@ extern u32 GetEntityType(struct DungeonEntity*); extern struct ItemSlot* GetItemData(struct DungeonEntity*); extern u32 EvaluateItem(struct DungeonEntity*, struct ItemSlot*, u8); extern bool8 ToolboxEnabled(struct DungeonEntityData*); +extern void sub_8077274(struct DungeonEntity *, struct DungeonEntity *); +extern bool8 EntityExists(struct DungeonEntity *); extern s32 gNumPotentialTargets; extern u32 gPotentialTargetWeights[NUM_DIRECTIONS]; extern u32 gPotentialTargetDirections[NUM_DIRECTIONS]; extern struct TeamInventory *gTeamInventory_203B460; +extern struct DungeonGlobalData *gDungeonGlobalData; + +void sub_807360C(struct DungeonEntity *pokemon) +{ + s32 iVar2; + struct DungeonEntity *entity; + + for(iVar2 = 0; iVar2 < DUNGEON_MAX_POKEMON; iVar2++) + { + entity = gDungeonGlobalData->allPokemon[iVar2]; + if(EntityExists(entity)) + { + if(entity->entityData->unk152 != 0) + { + entity->entityData->unk152 = 0; + sub_8077274(entity, entity); + } + } + } +} + void DecideUseItem(struct DungeonEntity *pokemon) { struct DungeonEntityData *pokemonData = pokemon->entityData; diff --git a/src/dungeon_capabilities_1.c b/src/dungeon_capabilities_1.c index 956c6e1..869e2f3 100644 --- a/src/dungeon_capabilities_1.c +++ b/src/dungeon_capabilities_1.c @@ -54,3 +54,26 @@ bool8 CannotAct(struct DungeonEntity *pokemon) } return FALSE; } + +bool8 CannotAttack(struct DungeonEntity *pokemon, u8 param_2) +{ + struct DungeonEntityData *iVar3; + + iVar3 = pokemon->entityData; + if ((((((param_2 != '\0') || + (iVar3->sleepStatus == SLEEP_STATUS_SLEEPLESS)) || + (iVar3->sleepStatus == SLEEP_STATUS_YAWNING)) || + (iVar3->sleepStatus == SLEEP_STATUS_NONE)) && + ((((iVar3->immobilizeStatus != IMMOBILIZE_STATUS_FROZEN && + (iVar3->immobilizeStatus != IMMOBILIZE_STATUS_WRAPPED_AROUND_FOE)) && + ((iVar3->immobilizeStatus != IMMOBILIZE_STATUS_WRAPPED_BY_FOE && + ((iVar3->immobilizeStatus != IMMOBILIZE_STATUS_PETRIFIED && + (iVar3->volatileStatus != VOLATILE_STATUS_CRINGING)))))) && + (iVar3->volatileStatus != VOLATILE_STATUS_PAUSED)))) && + (((iVar3->volatileStatus != VOLATILE_STATUS_INFATUATED && + iVar3->nonVolatileStatus != NON_VOLATILE_STATUS_PARALYZED)) && + !ShouldAvoidEnemies(pokemon))) { + return FALSE; + } + return TRUE; +} diff --git a/src/dungeon_movement.c b/src/dungeon_movement.c index 6a55c90..5525f28 100644 --- a/src/dungeon_movement.c +++ b/src/dungeon_movement.c @@ -2,6 +2,7 @@ #include "dungeon_movement.h" #include "constants/dungeon_action.h" +#include "constants/direction.h" #include "constants/iq_skill.h" #include "constants/status.h" #include "dungeon_global_data.h" @@ -10,6 +11,7 @@ extern char gAvailablePokemonNames[]; extern char *gPtrCouldntBeUsedMessage; +extern char *gPtrItsaMonsterHouseMessage; extern struct DungeonGlobalData *gDungeonGlobalData; extern void SendImmobilizeEndMessage(struct DungeonEntity*, struct DungeonEntity*); @@ -27,6 +29,132 @@ extern bool8 HasIQSkill(struct DungeonEntity*, u8); extern void DecideAttack(struct DungeonEntity*); extern bool8 GetIsMoving(s16); extern void MoveIfPossible(struct DungeonEntity*, bool8); +extern u8 sub_8044B28(void); +struct MapTile *sub_8045128(struct DungeonEntity *entity); +extern void sub_807AB38(struct DungeonEntity *, u32); +extern void sub_8041888(u32); +extern u8 sub_803F428(s16 *); +extern void sub_803E708(u32, u32); +extern struct DungeonEntity *GetLeaderEntity(); +struct ItemSlot *GetItemData(struct DungeonEntity *entity); +u8 *GetTrapData(struct DungeonEntity *entity); +u32 GetEntityType(struct DungeonEntity *entity); +extern void TargetTileInFront(struct DungeonEntity *); + +u32 sub_8075818(struct DungeonEntity *entity) +{ + struct MapTile *tile; + struct DungeonEntityData *entityData; + struct DungeonEntity *subEntity; + struct ItemSlot *item; + u8 *trapData; // TODO: turn into struct when more research is done.. + u8 r1; + + entityData = entity->entityData; + if(EntityExists(entity)) + { + tile = sub_8045128(entity); + if(HasIQSkill(entity, IQ_SKILL_SUPER_MOBILE)) + if(!(tile->MapTileUnion.tileFlags_u16 & 3)) + return 1; + subEntity = tile->mapObject; + if(subEntity != NULL) + { + switch(GetEntityType(subEntity)) + { + case ENTITY_NONE: + case ENTITY_POKEMON: + case 4: + case 5: + break; + case ENTITY_TRAP: + trapData = GetTrapData(subEntity); + r1 = 0; + if(trapData[1] == 0) + { + if(!subEntity->visible || entityData->isEnemy) + goto flag_check; + else + goto error; + } + else if(trapData[1] == 1) + { + if(!entityData->isEnemy) + goto flag_check; + else + goto error; + } + else if(trapData[1] == 2) + { + if(!entityData->isEnemy) + r1 = 1; + } +flag_check: + if(r1 == 0) + break; + else + goto error; + case ENTITY_ITEM: + if(!entityData->isLeader) + { + if(!(entityData->heldItem.itemFlags & ITEM_FLAG_EXISTS)) + { + if(!(tile->MapTileUnion.tileFlags_u16 & 3)) + { + if(entityData->isEnemy) + break; + else + { + item = GetItemData(subEntity); + if(!(item->itemFlags & ITEM_FLAG_FOR_SALE)) + { + return 1; + } + } + } + else + { + item = GetItemData(subEntity); + if(!(item->itemFlags & ITEM_FLAG_FOR_SALE)) + { +error: + return 1; + } + } + } + } + break; + } + } + } + return 0; +} + +void sub_8075900(struct DungeonEntity *pokemon, u8 r1) +{ + if(EntityExists(pokemon)) + { + if(!pokemon->entityData->isEnemy) + { + if(!sub_8044B28()) + { + if(!gDungeonGlobalData->monsterHouseActive) + { + if((sub_8045128(pokemon)->MapTileUnion.tileFlags_u16 & TILE_TYPE_MONSTER_HOUSE)) + { + // It's a monster house! + SendMessage(GetLeaderEntity(), gPtrItsaMonsterHouseMessage); + gDungeonGlobalData->unk672 = 1; + sub_807AB38(pokemon, r1); + sub_8041888(0); + if(sub_803F428(&pokemon->posWorldX) != 0) + sub_803E708(0x78, 0x39); + } + } + } + } + } +} void DecideAction(struct DungeonEntity *pokemon) { @@ -35,7 +163,7 @@ void DecideAction(struct DungeonEntity *pokemon) { if (pokemonData->immobilizeStatus == IMMOBILIZE_STATUS_PETRIFIED) { - SendImmobilizeEndMessage(pokemon, pokemon); + SendImmobilizeEndMessage(pokemon, pokemon); } } else @@ -147,3 +275,17 @@ void DecideAction(struct DungeonEntity *pokemon) } } } + +void sub_8075BA4(struct DungeonEntity *param_1,char param_2) +{ + struct DungeonEntityData * iVar2 = param_1->entityData; + + if ((param_2 != '\0') && (iVar2->volatileStatus == VOLATILE_STATUS_COWERING)) { + iVar2->facingDir = (iVar2->facingDir + 4) & DIRECTION_MASK; + TargetTileInFront(param_1); + } + else if (iVar2->volatileStatus == VOLATILE_STATUS_CONFUSED) { + iVar2->facingDir = DungeonRandomCapped(NUM_DIRECTIONS); + TargetTileInFront(param_1); + } +} diff --git a/src/dungeon_pokemon_attributes.c b/src/dungeon_pokemon_attributes.c index a9aa6c2..c70d4ff 100644 --- a/src/dungeon_pokemon_attributes.c +++ b/src/dungeon_pokemon_attributes.c @@ -2,6 +2,77 @@ #include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" +#include "constants/ability.h" +#include "constants/status.h" + +extern u8 gAvailablePokemonNames[]; +extern u32 gUnknown_80FC31C; +extern u32 gUnknown_80FCEFC; +extern u32 gUnknown_80FC2FC; + +extern bool8 sub_805744C(struct DungeonEntity *, struct PokemonMove *, u32); +extern void SetMessageArgument(char[], struct DungeonEntity*, u32); +extern void sub_80522F4(struct DungeonEntity *r1, struct DungeonEntity *r2, u32); + +bool8 sub_80716E8(struct DungeonEntity * param_1, struct DungeonEntity * param_2, u8 param_3) +{ + if (param_2->entityData->protectionStatus == PROTECTION_STATUS_SAFEGUARD) { + if (param_3 != '\0') { + SetMessageArgument(gAvailablePokemonNames,param_2,0); + sub_80522F4(param_1,param_2,gUnknown_80FC2FC); + } + return TRUE; + } + return FALSE; +} + +bool8 sub_8071728(struct DungeonEntity * param_1, struct DungeonEntity * param_2, u8 param_3) +{ + if (param_2->entityData->protectionStatus == PROTECTION_STATUS_MIST) { + if (param_3 != '\0') { + SetMessageArgument(gAvailablePokemonNames, param_2, 0); + sub_80522F4(param_1, param_2, gUnknown_80FC31C); + } + return TRUE; + } + else { + if (HasAbility(param_2, ABILITY_CLEAR_BODY) || HasAbility(param_2, ABILITY_WHITE_SMOKE)) { + if (param_3 != '\0') { + SetMessageArgument(gAvailablePokemonNames, param_2, 0); + sub_80522F4(param_1, param_2, gUnknown_80FCEFC); + } + return TRUE; + } + } + return FALSE; +} + +bool8 sub_80717A4(struct DungeonEntity *param_1, u16 moveID) +{ + struct DungeonEntityData * entityData; + s32 iVar3; + + entityData = param_1->entityData; + if ((entityData->sleepStatus != SLEEP_STATUS_SLEEP) && (entityData->sleepStatus != SLEEP_STATUS_NAPPING) && (entityData->sleepStatus != SLEEP_STATUS_NIGHTMARE)) { + return FALSE; + } + else + { + // Pin this register to match + register struct PokemonMove *pokeMove asm("r4"); + + struct PokemonMove *pokeMove2; // some reason uses another pointer to same struct + + for(iVar3 = 0, pokeMove = entityData->moves, pokeMove2 = pokeMove; iVar3 < MAX_MON_MOVES; pokeMove++, pokeMove2++, iVar3++) + { + if (((pokeMove->moveFlags & MOVE_FLAG_EXISTS) != 0) && (entityData->isLeader || ((pokeMove->moveFlags & MOVE_FLAG_ENABLED) != 0))) + if((sub_805744C(param_1, pokeMove2, 1) != '\0') && (pokeMove->pp != 0)) + if(pokeMove->moveID == moveID) + return TRUE; + } + return FALSE; + } +} bool8 HasAbility(struct DungeonEntity *pokemon, u8 ability) { diff --git a/src/dungeon_util.c b/src/dungeon_util.c index f70148a..f717212 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -2,17 +2,7 @@ #include "dungeon_util.h" extern struct MapTile* GetMapTileAtPosition(s16, s16); - -struct unk8049590 -{ - u16 unk0; - u16 fill2; - u16 unk4; - u16 unk6; - u8 unk8; -}; - -extern struct unk8049590 *GetMapEntity(s16, s16); +extern struct MapTile *GetMapEntity(s16, s16); bool8 EntityExists(struct DungeonEntity *entity) { @@ -33,7 +23,7 @@ u8 GetEntityRoomIndex(struct DungeonEntity *entity) return entity->roomIndex; } -struct DungeonEntityData *sub_8045104(struct DungeonEntity *entity) +struct DungeonEntityData *GetTrapData(struct DungeonEntity *entity) { return entity->entityData; } @@ -58,7 +48,7 @@ struct MapTile *sub_8045114(struct DungeonEntity *entity) return GetMapTileAtPosition(entity->posWorldX, entity->posWorldY); } -struct unk8049590 *sub_8045128(struct DungeonEntity *entity) +struct MapTile *sub_8045128(struct DungeonEntity *entity) { return GetMapEntity(entity->posWorldX, entity->posWorldY); } diff --git a/src/dungeon_util_1.c b/src/dungeon_util_1.c index 97af7fb..51ec765 100644 --- a/src/dungeon_util_1.c +++ b/src/dungeon_util_1.c @@ -1,5 +1,125 @@ #include "global.h" +#include "constants/direction.h" #include "dungeon_util_1.h" +#include "dungeon_global_data.h" +#include "random.h" + +extern struct DungeonGlobalData *gDungeonGlobalData; +extern bool8 EntityExists(struct DungeonEntity *); +extern void sub_806CE68(struct DungeonEntity *, s32); + +extern s32 sub_803F994(void); +extern s32 sub_803F9B0(void); +extern void sub_803F4A0(u32); +extern void sub_803F878(s32, s32); +extern void sub_803E46C(u32); + +void sub_8085860(s32 x, s32 y) +{ + + sub_803F4A0(0); + sub_803F878(x * 0x1800 + 0xc00, y * 0x1800 + 0x1000); +} + +void sub_8085890(s32 x, s32 y) +{ + sub_803F4A0(0); + sub_803F878(x, y); +} + +void sub_80858AC(s32 *param_1, s32 param_2) +{ + s32 iVar1; + s32 iVar2; + s32 iVar3; + s32 iVar4; + + iVar1 = sub_803F994(); + iVar2 = sub_803F9B0(); + iVar3 = (param_1[0] - iVar1) / param_2; + iVar4 = (param_1[1] - iVar2) / param_2; + sub_803F4A0(0); + if (0 < param_2) { + do { + iVar1 += iVar3; + iVar2 += iVar4; + sub_803F878(iVar1,iVar2); + sub_803E46C(0x46); + param_2--; + } while (param_2 != 0); + } + sub_803F878(param_1[0],param_1[1]); + sub_803E46C(0x46); +} + +void SetFacingDirection(struct DungeonEntity *pokemon, s32 direction) +{ + pokemon->entityData->facingDir = direction & DIRECTION_MASK; + sub_806CE68(pokemon, direction); +} + +void sub_8085930(s32 direction) +{ + s32 iVar2; + struct DungeonEntity *entity; + for(iVar2 = 0; iVar2 < MAX_TEAM_MEMBERS; iVar2++) + { + entity = gDungeonGlobalData->teamPokemon[iVar2]; + if(EntityExists(entity)) + { + if(direction >= NUM_DIRECTIONS) + { + sub_806CE68(entity, RandomCapped(NUM_DIRECTIONS)); + } + else + { + entity->entityData->facingDir = direction & DIRECTION_MASK; + sub_806CE68(entity, direction); + } + } + } + for(iVar2 = 0; iVar2 < DUNGEON_MAX_WILD_POKEMON; iVar2++) + { + entity = gDungeonGlobalData->wildPokemon[iVar2]; + if(EntityExists(entity)) + { + if(entity->entityData->clientType == 2) + { + if(direction >= NUM_DIRECTIONS) + { + sub_806CE68(entity, RandomCapped(NUM_DIRECTIONS)); + } + else + { + entity->entityData->facingDir = direction & DIRECTION_MASK; + sub_806CE68(entity, direction); + } + } + } + } +} + +void sub_80859F0(s32 direction) +{ + s32 iVar2; + struct DungeonEntity *entity; + for(iVar2 = 0; iVar2 < DUNGEON_MAX_WILD_POKEMON; iVar2++) + { + entity = gDungeonGlobalData->wildPokemon[iVar2]; + if(EntityExists(entity)) + { + if(direction >= NUM_DIRECTIONS) + { + sub_806CE68(entity, RandomCapped(NUM_DIRECTIONS)); + } + else + { + entity->entityData->facingDir = direction & DIRECTION_MASK; + sub_806CE68(entity, direction); + } + } + } +} bool8 IsMovingClient(struct DungeonEntity *pokemon) { diff --git a/src/items.c b/src/items.c index 0b6075f..ff79822 100644 --- a/src/items.c +++ b/src/items.c @@ -27,6 +27,7 @@ extern u32 gUnknown_81097F8[4]; // some sort of lookup table (17, 19, 21, 23) extern u32 gUnknown_810AF50[]; extern u8 gUnknown_8108F64[0x3f][32]; // some sort of bit lookup table extern s16 gTypeGummiIQBoost[0x12][NUMBER_OF_GUMMIS]; +extern u8 gInvalidItemIDs[0x10]; EWRAM_DATA struct OpenedFile *gItemParametersFile; EWRAM_DATA struct Item *gItemParametersData; @@ -1502,3 +1503,20 @@ void ClearAllItems_8091FB4() { } } } + +bool32 IsInvalidItemReward(u8 itemID) +{ + s32 index; + + if (itemID >= NUMBER_OF_ITEM_IDS) + return TRUE; + else { + index = 0; + while (gInvalidItemIDs[index] != NUMBER_OF_ITEM_IDS){ + if (gInvalidItemIDs[index] == itemID) + return TRUE; + index++; + }; + return FALSE; + } +} diff --git a/src/memory_mid.c b/src/memory_mid.c index 51c927a..546820a 100644 --- a/src/memory_mid.c +++ b/src/memory_mid.c @@ -2,15 +2,17 @@ #include "memory.h" extern u32 gUnknown_80B7F14; +extern u32 gUnknown_80B7F88; extern const char gLocateSetErrorMessage[]; extern struct HeapDescriptor gMainHeapDescriptor; - +extern const char gLocalCreateErrorMessage[]; extern s32 MemorySearchFromBack(struct HeapDescriptor *heap, s32, s32); extern s32 MemorySearchFromFront(struct HeapDescriptor *heap, s32, s32); extern struct HeapDescriptor * _LocateSetBack(struct HeapDescriptor *, u32, u32, u32, u32); extern struct HeapDescriptor * _LocateSetFront(struct HeapDescriptor *, u32, u32, u32, u32); void DoFree(struct HeapDescriptor *, void *); void *DoAlloc(struct HeapDescriptor *, s32, u32); +extern struct HeapDescriptor *DoCreateSubHeap(u32 *, u32); void FatalError(u32 *, const char *, ...) __attribute__((noreturn)); @@ -61,3 +63,28 @@ void MemoryFree(void *a) { DoFree(&gMainHeapDescriptor, a); } + +struct HeapDescriptor *MemoryLocate_LocalCreate(struct HeapDescriptor *parentHeap,u32 size,u32 param_3,u32 group) +{ + int index; + struct HeapDescriptor *iVar2; + struct HeapDescriptor *iVar3; + s32 local_1c[2]; + + if (parentHeap == NULL) { + parentHeap = &gMainHeapDescriptor; + } + + index = MemorySearchFromBack(parentHeap,9,size); + if (index < 0) + // Memroy LocalCreate buffer %08x size can't locate + FatalError(&gUnknown_80B7F88,gLocalCreateErrorMessage,size); + + iVar2 = _LocateSetBack(parentHeap,index,9,size,group); + local_1c[0] = iVar2->freeCount; + local_1c[1] = iVar2->freeListLength; + + iVar3 = DoCreateSubHeap(local_1c,param_3); + iVar3->parentHeap = parentHeap; + return iVar3; +} diff --git a/src/music_pre.c b/src/music_pre.c index cb983d3..95940aa 100644 --- a/src/music_pre.c +++ b/src/music_pre.c @@ -277,20 +277,18 @@ void sub_800BA5C(void) void xxx_update_bg_sound_input(void) { - u32 store; - store = gUnknown_203B09B; if(gUnknown_203B09B != 0){ gUnknown_203B09C++; } else { gUnknown_203B09B = 1; - gUnknown_203B09A = store; - gUnknown_203B09C = store; + gUnknown_203B09A = 0; + gUnknown_203B09C = 0; UpdateBGControlRegisters(); if(gUnknown_203B099 != 0) UpdateSound(); UpdateInput(); - gUnknown_203B099 = store; + gUnknown_203B099 = 0; gUnknown_203B0A4 = gUnknown_203B0A0; } } diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 427e0ed..743a9dd 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -8,7 +8,7 @@ extern u32 gIQSkillNames[]; extern u32 gIQSkillDescriptions[]; extern u32 gTacticsDescriptions[]; extern u8 *gTactics[]; -extern u8 gUnknown_810A36B[]; +extern u8 gTacticsTargetLeader[]; extern s16 gReqTacticLvls[]; extern s32 gReqIQSkillPts[]; @@ -483,10 +483,10 @@ u32 GetTacticsDescription(u8 r0) u8 TacticsTargetLeader(u8 r0) { - return gUnknown_810A36B[r0]; + return gTacticsTargetLeader[r0]; } -void sub_808EB0C(u8 *r0, s32 pokeLevel) +void GetAvailTacticsforLvl(u8 *tacticsBuffer, s32 pokeLevel) { s32 tactic; s32 availTactics; @@ -496,7 +496,7 @@ void sub_808EB0C(u8 *r0, s32 pokeLevel) { if(gReqTacticLvls[tactic] <= pokeLevel) { - r0[availTactics] = tactic; + tacticsBuffer[availTactics] = tactic; availTactics++; } } @@ -506,12 +506,13 @@ void sub_808EB0C(u8 *r0, s32 pokeLevel) } while(availTactics < NUM_TACTICS) { - r0[availTactics] = TACTIC_UNUSED; + tacticsBuffer[availTactics] = TACTIC_UNUSED; availTactics++; } } -void sub_808EB48(u8 *r0, s32 pokeLevel) +// Instead of assigning the Tactic, a bool is assigned showing it is available +void GetAvailTacticsforLvl_Bool(u8 *tacticsBuffer, s32 pokeLevel) { s32 tactic; @@ -519,18 +520,18 @@ void sub_808EB48(u8 *r0, s32 pokeLevel) { if(gReqTacticLvls[tactic] <= pokeLevel) { - r0[tactic] = TRUE; + tacticsBuffer[tactic] = TRUE; } else { - r0[tactic] = FALSE; + tacticsBuffer[tactic] = FALSE; } } } bool8 HasIQForSkill(s32 pokeIQ, u8 IQSkillIndex) { - if(IQSkillIndex == 0) + if(IQSkillIndex == IQ_SKILL_NONE) { return FALSE; } @@ -538,7 +539,8 @@ bool8 HasIQForSkill(s32 pokeIQ, u8 IQSkillIndex) return gReqIQSkillPts[IQSkillIndex] <= pokeIQ; } -s32 GetNumAvailableIQSkills(u8 *param_1, s32 pokeIQ) +// Fills buffer with all avaiable IQ Skills and returns the amount +s32 GetNumAvailableIQSkills(u8 *iqSkillBuffer, s32 pokeIQ) { s32 counter_2; s32 counter_1; @@ -550,22 +552,22 @@ s32 GetNumAvailableIQSkills(u8 *param_1, s32 pokeIQ) for(counter_1 = IQ_SKILL_TYPE_ADVANTAGE_MASTER; counter_1 < NUM_IQ_SKILLS; counter_1++) { iqSkill_u8 = counter_1; // force this cast to be in a reg if (HasIQForSkill(pokeIQ, iqSkill_u8)) { - param_1[availIQSkills] = iqSkill_u8; + iqSkillBuffer[availIQSkills] = iqSkill_u8; availIQSkills++; } } for (counter_2 = availIQSkills; counter_2 < NUM_IQ_SKILLS; counter_2++) { - param_1[counter_2] = 0; + iqSkillBuffer[counter_2] = IQ_SKILL_NONE; } return availIQSkills; } -void sub_808EBF4(u8 *param_1, u32 param_2) +void ToggleIQSkill(u8 *param_1, u32 skillIndex) { int iVar2; // a mask? - iVar2 = 1 << (param_2); + iVar2 = 1 << (skillIndex); if (IsIQSkillSet(param_1, iVar2)) { param_1[0] = param_1[0] & ~iVar2; param_1[1] = param_1[1] & ~(iVar2 >> 8); @@ -573,7 +575,7 @@ void sub_808EBF4(u8 *param_1, u32 param_2) } else { - SetIQSkill(param_1, param_2); + SetIQSkill(param_1, skillIndex); } } diff --git a/src/rescue_team_info.c b/src/rescue_team_info.c index 9de46ad..5f49cab 100644 --- a/src/rescue_team_info.c +++ b/src/rescue_team_info.c @@ -12,25 +12,6 @@ extern void BoundedCopyStringtoBuffer(u8 *buffer, u8 *string, s32 size); extern const char *gRescueTeamRanks[]; extern s32 gRescueRankMaxPoints[7]; extern u8 gTeamNamePlaceholder[0x8]; // Pokemon -extern u8 gUnknown_810A35B[0x10]; - -bool32 sub_8092040(u8 param_1) -{ - s32 index; - - // NUMBER_OF_ITEM_IDS == 0xf0 - if (param_1 >= 0xF0) - return TRUE; - else { - index = 0; - while (gUnknown_810A35B[index] != 0xF0){ - if (gUnknown_810A35B[index] == param_1) - return TRUE; - index++; - }; - return FALSE; - } -} void LoadRescueTeamInfo(void) { diff --git a/src/thank_you_wonder_mail.c b/src/thank_you_wonder_mail.c index 3f105c5..cfd83c6 100644 --- a/src/thank_you_wonder_mail.c +++ b/src/thank_you_wonder_mail.c @@ -504,7 +504,7 @@ u32 CreateThankYouMailPelipper(void) gUnknown_203B2C4->unk218 = -1; SetThankYouMailMenuState(THANK_YOU_MAIL_MAIN_MENU); } - gUnknown_203B2C4->unk4 = 0x2b; + gUnknown_203B2C4->fallbackState = 0x2b; return 1; } @@ -665,40 +665,40 @@ void ReturnToThankYouMainFromError(void) } } -void PrintThankYouMailLinkError(u32 param_1) +void PrintThankYouMailLinkError(u32 errorCode) { - switch(param_1) { - case 3: + switch(errorCode) { + case WONDER_MAIL_INCORRECT_NUM_SYSTEMS: sub_80141B4(gUnknown_80DEF28, 0, &gUnknown_203B2C4->faceFile, 0x10d); break; - case 4: + case WONDER_MAIL_DIFFERENT_MODES: sub_80141B4(gUnknown_80DEF80, 0, &gUnknown_203B2C4->faceFile, 0x10d); break; - case 6: + case WONDER_MAIL_NO_ROOM_STORAGE: sub_80141B4(gUnknown_80DEFDC, 0, &gUnknown_203B2C4->faceFile, 0x10d); break; - case 7: + case WONDER_MAIL_DUPLICATE_MAIL: sub_80141B4(gUnknown_80DF044, 0, &gUnknown_203B2C4->faceFile, 0x10d); break; - case 9: + case WONDER_MAIL_NOT_ELIGIBLE_1: sub_80141B4(gUnknown_80DF0A0, 0, &gUnknown_203B2C4->faceFile, 0x10d); break; - case 11: + case WONDER_MAIL_NOT_ELIGIBLE_2: sub_80141B4(gUnknown_80DF0A0, 0, &gUnknown_203B2C4->faceFile, 0x10d); break; - case 13: + case WONDER_MAIL_NO_ROOM_MAIL: sub_80141B4(gUnknown_80DF0E0, 0, &gUnknown_203B2C4->faceFile, 0x10d); break; case 1: - case 2: + case WONDER_MAIL_NO_RESPONSE: case 5: case 14: sub_80141B4(gUnknown_80DEF04, 0, &gUnknown_203B2C4->faceFile, 0x10d); break; - case 15: + case WONDER_MAIL_NOT_READY: sub_80141B4(gUnknown_80DF138, 0, &gUnknown_203B2C4->faceFile, 0x10d); break; - case 0: + case WONDER_MAIL_GOOD: default: break; } @@ -800,7 +800,7 @@ void sub_802A0C8(void) SetThankYouMailMenuState(0x11); break; case 4: - gUnknown_203B2C4->unk4 = 0x10; + gUnknown_203B2C4->fallbackState = 0x10; gUnknown_203B2C4->unk218 = sub_80307EC(); sub_8006518(gUnknown_203B2C4->unk3BC); ResetUnusedInputStruct(); @@ -837,7 +837,7 @@ void sub_802A174(void) SetThankYouMailMenuState(0xe); break; case 0xC: - gUnknown_203B2C4->unk4 = 0x2b; + gUnknown_203B2C4->fallbackState = 0x2b; sub_8006518(gUnknown_203B2C4->unk3BC); ResetUnusedInputStruct(); sub_800641C(0,1,1); @@ -864,12 +864,12 @@ void sub_802A230(void) ResetUnusedInputStruct(); sub_800641C(gUnknown_203B2C4->unk3BC, 1, 1); sub_803092C(); - if (gUnknown_203B2C4->unk4 == 0x2b) { + if (gUnknown_203B2C4->fallbackState == 0x2b) { sub_8035CF4(&gUnknown_203B2C4->unk21C, 3, 1); SetThankYouMailMenuState(0x11); } else { - SetThankYouMailMenuState(gUnknown_203B2C4->unk4); + SetThankYouMailMenuState(gUnknown_203B2C4->fallbackState); } break; default: @@ -895,7 +895,7 @@ void sub_802A28C(void) SetThankYouMailMenuState(0x14); break; case 4: - gUnknown_203B2C4->unk4 = 0x13; + gUnknown_203B2C4->fallbackState = 0x13; gUnknown_203B2C4->unk41C.itemIndex = sub_801CB24(); sub_8006518(gUnknown_203B2C4->unk3BC); ResetUnusedInputStruct(); @@ -916,12 +916,12 @@ void sub_802A33C(void) ResetUnusedInputStruct(); sub_800641C(gUnknown_203B2C4->unk3BC,1,1); sub_801CB5C(1); - if (gUnknown_203B2C4->unk4 == 0x2b) { + if (gUnknown_203B2C4->fallbackState == 0x2b) { sub_8035CF4(&gUnknown_203B2C4->unk21C,3,1); SetThankYouMailMenuState(0x14); } else { - SetThankYouMailMenuState(gUnknown_203B2C4->unk4); + SetThankYouMailMenuState(gUnknown_203B2C4->fallbackState); } break; case 1: @@ -947,7 +947,7 @@ void sub_802A39C(void) SetThankYouMailMenuState(CONFIRM_ITEM_TO_SEND); break; case 0xC: - gUnknown_203B2C4->unk4 = 0x2b; + gUnknown_203B2C4->fallbackState = 0x2b; sub_8006518(gUnknown_203B2C4->unk3BC); ResetUnusedInputStruct(); sub_800641C(0,1,1); diff --git a/src/wonder_mail.c b/src/wonder_mail.c index 6f7e081..fd5e1df 100644 --- a/src/wonder_mail.c +++ b/src/wonder_mail.c @@ -197,7 +197,7 @@ u32 sub_8027F88(void) for(counter = 0; counter < PASSWORD_BUFFER_SIZE; counter++){ gUnknown_203B2C0->passwordBuffer[counter] = 0; } - gUnknown_203B2C0->unk0 = 0x3D; + gUnknown_203B2C0->fallbackState = 0x3D; sub_8028B04(0); // Set initial state to 0? return 1; } @@ -706,50 +706,44 @@ void sub_8028B04(u32 r0) } // Wonder Mail Linking... -void sub_8028B1C(u32 r0) +void sub_8028B1C(u32 errorCode) { - switch(r0) + switch(errorCode) { - case 0: + case WONDER_MAIL_GOOD: break; case 1: - case 2: + case WONDER_MAIL_NO_RESPONSE: sub_80141B4(gWonderMailErrorText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; - case 3: + case WONDER_MAIL_INCORRECT_NUM_SYSTEMS: sub_80141B4(gWonderMailNumGBAsText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; - case 4: + case WONDER_MAIL_DIFFERENT_MODES: sub_80141B4(gWonderMailWrongModeText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; case 5: sub_80141B4(gWonderMailErrorText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; - case 6: + case WONDER_MAIL_NO_ROOM_STORAGE: sub_80141B4(gWonderMailStorageFullText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; - case 7: + case WONDER_MAIL_DUPLICATE_MAIL: sub_80141B4(gWonderMailDuplicateText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; - case 8: - break; - case 9: + case WONDER_MAIL_NOT_ELIGIBLE_1: sub_80141B4(gWonderMailNotEligibleReceiveText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; - case 10: - break; - case 11: + case WONDER_MAIL_NOT_ELIGIBLE_2: sub_80141B4(gWonderMailNotEligibleReceiveText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; - case 12: - break; - case 13: + case WONDER_MAIL_NO_ROOM_MAIL: sub_80141B4(gWonderMailNoRoomText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; case 14: sub_80141B4(gWonderMailErrorText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; - case 15: + case WONDER_MAIL_NOT_READY: sub_80141B4(gWonderMailFriendErrorText, 0, &gUnknown_203B2C0->faceFile, 0x10d); break; default: @@ -1134,7 +1128,7 @@ void sub_8029044(void) sub_8028B04(32); break; case 4: - gUnknown_203B2C0->unk0 = 0x1F; + gUnknown_203B2C0->fallbackState = 0x1F; gUnknown_203B2C0->unk218 = sub_80307EC(); sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); @@ -1171,7 +1165,7 @@ void sub_80290F0(void) sub_8028B04(34); break; case 12: - gUnknown_203B2C0->unk0 = 0x3D; + gUnknown_203B2C0->fallbackState = 0x3D; sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); sub_800641C(0, 1, 1); @@ -1199,14 +1193,14 @@ void sub_80291AC(void) ResetUnusedInputStruct(); sub_800641C(gUnknown_203B2C0->unk3BC, 1, 1); sub_803092C(); - if(gUnknown_203B2C0->unk0 == 0x3D) + if(gUnknown_203B2C0->fallbackState == 0x3D) { sub_8035CF4(&(gUnknown_203B2C0->unk21C), 3, 1); sub_8028B04(0x20); } else { - sub_8028B04(gUnknown_203B2C0->unk0); + sub_8028B04(gUnknown_203B2C0->fallbackState); } default: break; @@ -1484,7 +1478,7 @@ void sub_80295D8(void) sub_8028B04(0x2B); break; case 4: - gUnknown_203B2C0->unk0 = 0x2A; + gUnknown_203B2C0->fallbackState = 0x2A; gUnknown_203B2C0->unk218 = sub_80307EC(); sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); @@ -1521,7 +1515,7 @@ void sub_8029684(void) sub_8028B04(0x2D); break; case 0xC: - gUnknown_203B2C0->unk0 = 0x3D; + gUnknown_203B2C0->fallbackState = 0x3D; sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); sub_800641C(0, 1, 1); @@ -1547,14 +1541,14 @@ void sub_8029740(void) ResetUnusedInputStruct(); sub_800641C(gUnknown_203B2C0->unk3BC, 1, 1); sub_803092C(); - if(gUnknown_203B2C0->unk0 == 0x3D) + if(gUnknown_203B2C0->fallbackState == 0x3D) { sub_8035CF4(&(gUnknown_203B2C0->unk21C), 3, 1); sub_8028B04(0x2B); } else { - sub_8028B04(gUnknown_203B2C0->unk0); + sub_8028B04(gUnknown_203B2C0->fallbackState); } break; } @@ -1594,7 +1588,7 @@ void sub_80297D4(void) sub_8028B04(0x34); break; case 4: - gUnknown_203B2C0->unk0 = 0x33; + gUnknown_203B2C0->fallbackState = 0x33; gUnknown_203B2C0->unk544 = sub_8023B44(); sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); @@ -1621,7 +1615,7 @@ void sub_8029884(void) sub_8028B04(4); break; case 0xC: - gUnknown_203B2C0->unk0 = 0x3D; + gUnknown_203B2C0->fallbackState = 0x3D; sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); sub_800641C(0, 1, 1); @@ -1656,14 +1650,14 @@ void sub_8029944(void) ResetUnusedInputStruct(); sub_800641C(gUnknown_203B2C0->unk3BC, 1, 1); sub_8023B7C(1); - if(gUnknown_203B2C0->unk0 == 0x3D) + if(gUnknown_203B2C0->fallbackState == 0x3D) { sub_8035CF4(&(gUnknown_203B2C0->unk21C), 3, 1); sub_8028B04(0x34); } else { - sub_8028B04(gUnknown_203B2C0->unk0); + sub_8028B04(gUnknown_203B2C0->fallbackState); } } diff --git a/src/wonder_mail_2.c b/src/wonder_mail_2.c index 1ded0ec..cf1f122 100644 --- a/src/wonder_mail_2.c +++ b/src/wonder_mail_2.c @@ -13,9 +13,8 @@ struct unkStruct_203B2C8 { // size: 0x140 - u8 currState; - u8 unk1; - u16 unk2; + /* 0x0 */ u8 currState; + /* 0x1 */ u8 unk1; /* 0x4 */ struct OpenedFile *faceFile; /* 0x8 */ u8 *faceData; /* 0xC */ u16 unkC; @@ -53,15 +52,13 @@ struct unkStruct_203B2CC struct UnkTextStruct2 *unk70; struct UnkTextStruct2 unk74[4]; }; - extern struct unkStruct_203B2CC *gUnknown_203B2CC; struct unkStruct_203B2D4 { // size: 0x94 - s32 state; - u8 currMailIndex; - u8 fill5[0x8 - 0x5]; + /* 0x0 */ s32 state; + /* 0x4 */ u8 currMailIndex; s32 unk8; s32 unkC; u8 *unk10[4]; @@ -71,9 +68,28 @@ struct unkStruct_203B2D4 u32 unk88; u8 fill8C[0x94 - 0x8C]; }; - extern struct unkStruct_203B2D4 *gUnknown_203B2D4; +struct unkStruct_203B2D8 +{ + // size: 0xA4 + u8 unk0[4]; + u32 unk4; + u8 fill8[0x1C - 0x8]; + s16 unk1C; + s16 unk1E; + s16 unk20; + s16 unk22; + s16 fill24; + /* 0x26 */ s16 emptyMailSlots; + u8 fill28[0x38 - 0x28]; + u32 unk38; + struct UnkTextStruct2 *unk3C; + struct UnkTextStruct2 unk40[4]; + u8 unkA0[4]; +}; +extern struct unkStruct_203B2D8 *gUnknown_203B2D8; + extern struct UnkSaveStruct1 *gUnknown_203B46C; @@ -89,7 +105,7 @@ extern struct PokemonStruct *sub_808D3BC(void); extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); extern u16 gUnknown_203B2D0; extern u16 gUnknown_203B2D2; - +extern u16 gUnknown_203B2DC; extern u8 sub_80138B8(void *, u32); extern void PlayMenuSoundEffect(u32); extern s32 GetKeyPress(u32 *); @@ -101,7 +117,6 @@ extern void sub_802BC08(void); extern void sub_802BB28(void); extern void sub_8013E54(void); extern s32 sub_8012A64(u32 *, u32); -extern void PlayMenuSoundEffect(u32); extern struct UnkTextStruct2 gUnknown_80DFBEC; @@ -144,6 +159,8 @@ extern void sub_802ABF8(void); extern u8 gUnknown_80DFC04[]; extern u8 gUnknown_80DFBE8[]; +extern struct UnkTextStruct2 gUnknown_80DFC74; +extern struct UnkTextStruct2 gUnknown_80DFC5C; extern char *GetPokemonMailHeadline(u8 index); extern void sub_8008C54(u32); extern void sub_80073B8(u32); @@ -158,6 +175,13 @@ extern s32 sub_8013800(u32 *, s32); extern void sub_802BCC4(void); extern void sub_802BB14(u32); extern void sub_801317C(u32 *); +char *GetPokemonMailText(u8 index); +extern u8 HasNoMailinMailbox(void); +extern void sub_802BF30(void); +extern void CreateMailMenu(void); +extern void sub_8012D34(struct UnkTextStruct2 *, u32); +extern s32 CountEmptyMailSlots(void); +extern void sub_8013848(u32 *, s32, u32, u32); ALIGNED(4) const char gUnknown_80DF9F0[] = "????"; @@ -595,7 +619,7 @@ bool8 HasNoPKMNNews(void) u32 sub_802B9FC(u8 mailIndex) { - gUnknown_203B2D4 = MemoryAlloc(sizeof(struct unkStruct_203B2D4), 0x8); + gUnknown_203B2D4 = MemoryAlloc(sizeof(struct unkStruct_203B2D4), 8); gUnknown_203B2D4->currMailIndex = mailIndex; sub_801317C(&gUnknown_203B2D4->unk88); gUnknown_203B2D4->unk24 = 0; @@ -729,3 +753,124 @@ void sub_802BC7C(void) strcpy(gAvailablePokemonNames + 0x50, gUnknown_80DFC50); // He } } + +void sub_802BCC4(void) +{ + char *mailTextPtr; + + mailTextPtr = GetPokemonMailText(gUnknown_203B2D4->currMailIndex); + gUnknown_203B2D4->unkC = 0; + gUnknown_203B2D4->unk10[0] = mailTextPtr; + + // Count all the {EXTRA_MSG}'s + while (*mailTextPtr != '\0') { + if (*mailTextPtr == '#') { + if ((mailTextPtr[1] == 'P') || (mailTextPtr[1] == 'p')) { + gUnknown_203B2D4->unkC++; + gUnknown_203B2D4->unk10[gUnknown_203B2D4->unkC] = mailTextPtr + 2; + } + mailTextPtr += 2; + } + else { + mailTextPtr++; + } + } +} + +u32 sub_802BD14(s32 param_1, struct UnkTextStruct2_sub *param_2, u32 param_3) +{ + + if (HasNoMailinMailbox()) { + return 0; + } + else + { + if (gUnknown_203B2D8 == NULL) { + gUnknown_203B2D8 = MemoryAlloc(sizeof(struct unkStruct_203B2D8),8); + } + gUnknown_203B2D8->unk38 = param_1; + gUnknown_203B2D8->unk3C = &gUnknown_203B2D8->unk40[param_1]; + sub_8006518(gUnknown_203B2D8->unk40); + gUnknown_203B2D8->unk40[gUnknown_203B2D8->unk38] = gUnknown_80DFC74; + gUnknown_203B2D8->unk3C->unk14 = gUnknown_203B2D8->unkA0; + if (param_2 != NULL) { + gUnknown_203B2D8->unk40[gUnknown_203B2D8->unk38].unk08 = *param_2; + } + sub_8012D34(gUnknown_203B2D8->unk3C,param_3); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B2D8->unk40,1,1); + sub_8013848(&gUnknown_203B2D8->unk4,CountEmptyMailSlots(),param_3,param_1); + gUnknown_203B2D8->unk1C = gUnknown_203B2DC; + sub_8013984(&gUnknown_203B2D8->unk4); + sub_802BF30(); + CreateMailMenu(); + return 1; + } +} + +u32 sub_802BDEC(u8 r0) +{ + if(r0 == 0) + { + sub_8013660(&gUnknown_203B2D8->unk4); + return 0; + } + switch(GetKeyPress(&gUnknown_203B2D8->unk4)) + { + case 2: + PlayMenuSoundEffect(1); + return 2; + case 1: + PlayMenuSoundEffect(0); + return 3; + case 4: + PlayMenuSoundEffect(4); + return 4; + default: + if(sub_80138B8(&gUnknown_203B2D8->unk4, 1) != 0) + { + sub_802BF30(); + CreateMailMenu(); + return 1; + } + else + return 0; + } +} + +u8 sub_802BE74(void) { + return gUnknown_203B2D8->unk0[(gUnknown_203B2D8->unk22 * gUnknown_203B2D8->unk20) + gUnknown_203B2D8->unk1C]; +} + +void sub_802BE94(u32 r0) +{ + u8 temp; + + temp = r0; + + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B2D8->unk40, 0, 0); + + gUnknown_203B2D8->emptyMailSlots = CountEmptyMailSlots(); + sub_8013984(&gUnknown_203B2D8->unk4); + sub_802BF30(); + CreateMailMenu(); + + if(temp != 0) + { + AddMenuCursorSprite(&gUnknown_203B2D8->unk4); + } +} + +void sub_802BEDC(void) +{ + if(gUnknown_203B2D8 != NULL) + { + gUnknown_203B2DC = gUnknown_203B2D8->unk1C; + gUnknown_203B2D8->unk40[gUnknown_203B2D8->unk38] = gUnknown_80DFC5C; + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B2D8->unk40, 1, 1); + MemoryFree(gUnknown_203B2D8); + gUnknown_203B2D8 = NULL; + } +} diff --git a/src/wonder_mail_3.c b/src/wonder_mail_3.c index aa87888..02dcfb7 100644 --- a/src/wonder_mail_3.c +++ b/src/wonder_mail_3.c @@ -2,6 +2,7 @@ #include "memory.h" #include "text.h" #include "input.h" +#include "mailbox.h" #include "menu.h" #include "constants/dungeon.h" #include "wonder_mail.h" @@ -82,7 +83,6 @@ extern u8 sub_802DADC(void); extern u8 *sub_8096DD8(void); extern u8 sub_8096C08(u8 *); extern void sub_802C750(void); -extern s32 GetNumAcceptedJobs(void); extern void sub_802D1A0(u32); extern void sub_8012EA4(u8 *, u32); extern void* sub_8096AB4(u8); @@ -228,7 +228,7 @@ void sub_802D2A8(void) } } else { - if (GetNumAcceptedJobs() >= 8) { + if (GetNumAcceptedJobs() >= MAX_ACCEPTED_JOBS) { if (sub_802DADC() != 0) { sub_802D1A0(10); } diff --git a/src/wonder_mail_802DF88.c b/src/wonder_mail_802DF88.c new file mode 100644 index 0000000..b85df28 --- /dev/null +++ b/src/wonder_mail_802DF88.c @@ -0,0 +1,316 @@ +#include "global.h" +#include "exclusive_pokemon.h" +#include "input.h" +#include "item.h" +#include "memory.h" +#include "text.h" +#include "wonder_mail.h" + +struct unkStruct_203B2FC +{ + // size: 0xA8 + /* 0x0 */ u32 state; + /* 0x4 */ u32 fallbackState; + u32 unk8; + s16 unkC; + s16 unkE; + u8 unk10; + u8 fill11[0x30 - 0x11]; + u8 unk30; + u8 fill31[3]; + struct WonderMail *unk34; + struct OpenedFile *faceFile; + u8 *faceData; + u16 unk40; + u16 unk42; + u8 unk44; + u8 unk45; + u8 unk46; + u8 fill47[0x48 - 0x47]; + struct UnkTextStruct2 unk48[4]; +}; +extern struct unkStruct_203B2FC *gUnknown_203B2FC; + + +struct unkStruct_203B300 +{ + // size: 0x7C + u8 fill0[0xC]; + u32 *unkC; + u32 unk10; + struct UnkTextStruct2 *unk14; + struct UnkTextStruct2 unk18[4]; + u8 unk78[4]; +}; + +extern struct unkStruct_203B300 *gUnknown_203B300; +extern struct UnkTextStruct2 gUnknown_80E0248; +extern struct UnkTextStruct2 gUnknown_80E0264; +extern struct UnkTextStruct2 gUnknown_80E016C; +extern void sub_80073B8(u32); +extern void sub_80073E0(u32); +extern void CreateRescueDescription(u32 *); +extern void PlayMenuSoundEffect(u32); +extern s32 sub_8012A64(void *, u32); +void sub_802DF6C(void); +void sub_802DF88(void); +void sub_802DF14(void); +void sub_801317C(void); +extern s32 sub_80144A4(s32 *); +extern void sub_802DC28(u32); +extern void sub_802F2C0(void); +extern void sub_802DC28(u32); +extern u32 sub_802F298(void); +extern u8 gUnknown_202E5D8[]; +extern u8 gUnknown_202E1C8[]; +extern u8 gUnknown_202DE58[]; + +extern u8 gWonderMailClientThanksForRescuingMe[]; +extern u8 gWonderMailClientThanksForRescuingThem[]; +extern u8 gWonderMailClientEscorted[]; +extern u8 gWonderMailClientItemDelivered1[]; +extern u8 gWonderMailClientItemDelivered2[]; +extern void sub_802F204(u32 *, u32); +extern void sub_80141B4(u8 *r0, u32, struct OpenedFile **r1, u32); +extern void sub_802DC40(void); +extern void sub_802DC9C(void); +void sub_802DE44(void); +void sub_802DE60(void); +struct WonderMail *sub_8096AB4(u8); +extern void sub_8096AF8(u8 *, u32, u32); +extern void sub_8096EEC(void); +extern void sub_803C21C(struct WonderMail *, u32 *); + +u32 sub_802DB28(u8 param_1, u8 param_2) +{ + char local_18 [8]; + + sub_8096AF8(local_18,param_1,param_2); + if (local_18[0] == '\0') { + return 0; + } + else { + ResetUnusedInputStruct(); + sub_800641C(0,1,1); + gUnknown_203B2FC = MemoryAlloc(sizeof(struct unkStruct_203B2FC),8); + gUnknown_203B2FC->unk30 = param_1; + gUnknown_203B2FC->unk34 = sub_8096AB4(param_1); + sub_8096EEC(); + sub_803C21C(gUnknown_203B2FC->unk34,&gUnknown_203B2FC->unk8); + gUnknown_203B2FC->faceFile = GetDialogueSpriteDataPtr(gUnknown_203B2FC->unk34->clientSpecies); + gUnknown_203B2FC->faceData = NULL; + gUnknown_203B2FC->unk44 = 0; + gUnknown_203B2FC->unk45 = 0; + gUnknown_203B2FC->unk46 = 0; + gUnknown_203B2FC->unk40 = 2; + gUnknown_203B2FC->unk42 = 8; + if (gUnknown_203B2FC->faceFile != NULL) { + gUnknown_203B2FC->faceData = gUnknown_203B2FC->faceFile->data; + } + sub_802DC28(0); + return 1; + } +} + +u32 sub_802DBD4(void) +{ + switch(gUnknown_203B2FC->state) + { + case 7: + gUnknown_203B2FC->unk34->mailType = 7; + return 3; + case 6: + sub_802DE44(); + return 0; + default: + sub_802DE60(); + return 0; + } +} + +void sub_802DC00(void) +{ + if(gUnknown_203B2FC != NULL) + { + if(gUnknown_203B2FC->faceFile != NULL) + { + CloseFile(gUnknown_203B2FC->faceFile); + } + MemoryFree(gUnknown_203B2FC); + gUnknown_203B2FC = NULL; + } +} + +void sub_802DC28(u32 newState) +{ + gUnknown_203B2FC->state = newState; + sub_802DC40(); + sub_802DC9C(); +} + +void sub_802DC40(void) +{ + s32 iVar3; + sub_8006518(gUnknown_203B2FC->unk48); + switch(gUnknown_203B2FC->state) + { + case 0: + case 7: + for(iVar3 = 0; iVar3 < 4; iVar3++) + { + gUnknown_203B2FC->unk48[iVar3] = gUnknown_80E016C; + } + break; + } + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B2FC->unk48, 1, 1); +} + +void sub_802DC9C(void) +{ + char *speciesText; + s32 index; + + switch(gUnknown_203B2FC->state) { + case 0: + CopyYellowSpeciesNametoBuffer(gUnknown_202E5D8,gUnknown_203B2FC->unk34->clientSpecies); + CopyYellowSpeciesNametoBuffer(gUnknown_202E1C8,gUnknown_203B2FC->unk34->clientSpecies); + speciesText = GetMonSpecies(gUnknown_203B2FC->unk34->clientSpecies); + strcpy(gUnknown_202E1C8 + 0xfffffdd0,speciesText); + speciesText = GetMonSpecies(gUnknown_203B2FC->unk34->targetSpecies); + strcpy(gUnknown_202E1C8 + 0xfffffe20,speciesText); + UnlockExclusivePokemon(gUnknown_203B2FC->unk34->clientSpecies); + sub_8090DC4(gUnknown_202DE58,gUnknown_203B2FC->unk34->targetItem,0); + gUnknown_203B2FC->fallbackState = 6; + switch(gUnknown_203B2FC->unk34->missionType) { + case WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM: + sub_802DC28(5); + break; + case WONDER_MAIL_MISSION_TYPE_FIND_ITEM: + sub_802DC28(4); + break; + case WONDER_MAIL_MISSION_TYPE_RESCUE_TARGET: + sub_802DC28(2); + UnlockExclusivePokemon(gUnknown_203B2FC->unk34->targetSpecies); + break; + case WONDER_MAIL_MISSION_TYPE_ESCORT_CLIENT: + sub_802DC28(3); + UnlockExclusivePokemon(gUnknown_203B2FC->unk34->targetSpecies); + break; + default: + case WONDER_MAIL_MISSION_TYPE_RESCUE_CLIENT: + sub_802DC28(1); + break; + } + break; + case 1: + sub_80141B4(gWonderMailClientThanksForRescuingMe,0,&gUnknown_203B2FC->faceFile,0x10d); + break; + case 2: + sub_80141B4(gWonderMailClientThanksForRescuingThem,0,&gUnknown_203B2FC->faceFile,0x10d); + break; + case 3: + sub_80141B4(gWonderMailClientEscorted,0,&gUnknown_203B2FC->faceFile,0x10d); + break; + case 5: + sub_80141B4(gWonderMailClientItemDelivered1,0,&gUnknown_203B2FC->faceFile,0x10d); + break; + case 4: + index = FindItemInInventory(gUnknown_203B2FC->unk34->targetItem); + if (index != -1) { + ShiftItemsDownFrom(index); + FillInventoryGaps(); + } + sub_80141B4(gWonderMailClientItemDelivered2,0,&gUnknown_203B2FC->faceFile,0x10d); + break; + case 6: + sub_802F204(&gUnknown_203B2FC->unk8,1); + break; + case 7: + default: + break; + } +} + +void sub_802DE44(void) +{ + switch(sub_802F298()) + { + case 2: + case 3: + sub_802F2C0(); + sub_802DC28(7); + break; + case 0: + case 1: + break; + } +} + +void sub_802DE60(void) +{ + s32 temp; + if(sub_80144A4(&temp) == 0) + { + sub_802DC28(gUnknown_203B2FC->fallbackState); + } +} + +u32 sub_802DE84(u32 *r0) +{ + gUnknown_203B300 = MemoryAlloc(sizeof(struct unkStruct_203B300), 8); + gUnknown_203B300->unkC = r0; + sub_801317C(); + gUnknown_203B300->unk10 = *gUnknown_203B300->unkC; + gUnknown_203B300->unk14 = &gUnknown_203B300->unk18[gUnknown_203B300->unk10]; + sub_8006518(gUnknown_203B300->unk18); + gUnknown_203B300->unk18[gUnknown_203B300->unk10] = gUnknown_80E0264; + sub_802DF14(); + return 1; +} + +u32 sub_802DEE0(void) +{ + switch(sub_8012A64(gUnknown_203B300, gUnknown_203B300->unk10)) + { + case 2: + PlayMenuSoundEffect(1); + return 2; + case 1: + PlayMenuSoundEffect(0); + return 3; + default: + return 0; + } +} + +void sub_802DF14(void) +{ + sub_802DF6C(); + sub_802DF88(); +} + +void sub_802DF24(void) +{ + if(gUnknown_203B300 != NULL) + { + gUnknown_203B300->unk18[gUnknown_203B300->unk10] = gUnknown_80E0248; + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B300->unk18, 1, 1); + MemoryFree(gUnknown_203B300); + gUnknown_203B300 = NULL; + } +} + +void sub_802DF6C(void) +{ + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B300->unk18, 1, 1); +} + +void sub_802DF88(void) +{ + sub_80073B8(gUnknown_203B300->unk10); + CreateRescueDescription(gUnknown_203B300->unkC); + sub_80073E0(gUnknown_203B300->unk10); +} |