diff --git a/asm/code_8086A3C.s b/asm/code_8086A3C.s deleted file mode 100644 index 73589b544..000000000 --- a/asm/code_8086A3C.s +++ /dev/null @@ -1,253 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start ZapdosPreFightDialogue -ZapdosPreFightDialogue: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x70 - bl xxx_call_GetLeader - mov r9, r0 - bl GetPartnerEntity - adds r6, r0, 0 - movs r0, 0x8 - bl GetEntityFromClientType - str r0, [sp, 0x68] - bl sub_8086448 - movs r0, 0xA - movs r1, 0x46 - bl sub_803E708 - adds r0, r6, 0 - bl SpriteLookAroundEffect - movs r0, 0xA - movs r1, 0x46 - bl sub_803E708 - adds r0, r6, 0 - movs r1, 0x4 - movs r2, 0x1 - movs r3, 0x2 - bl sub_80869E4 - mov r0, r9 - movs r1, 0x4 - movs r2, 0x2 - movs r3, 0x6 - bl sub_80869E4 - ldr r0, _08087470 - bl DisplayDungeonDialogue - movs r0, 0xA - movs r1, 0x46 - bl sub_803E708 - adds r0, r6, 0 - movs r1, 0x4 - movs r2, 0x2 - movs r3, 0x4 - bl sub_80869E4 - mov r0, r9 - movs r1, 0x4 - movs r2, 0x1 - movs r3, 0x4 - bl sub_80869E4 - ldr r0, _08087474 - bl DisplayDungeonDialogue - movs r0, 0xA - movs r1, 0x46 - bl sub_803E708 - movs r0, 0x3 - bl ZapdosScreenFlash - bl DungeonStopBGM - movs r0, 0xED - lsls r0, 1 - bl PlaySoundEffect - ldr r0, _08087478 - bl DisplayDungeonDialogue - ldr r0, [sp, 0x68] - bl ZapdosDropInEffect - movs r0, 0x9 - bl DungeonStartNewBGM - adds r0, r6, 0 - movs r1, 0x6 - movs r2, 0x4 - bl sub_806CDD4 - ldr r0, _0808747C - bl DisplayDungeonDialogue - movs r0, 0xA - movs r1, 0x46 - bl sub_803E708 - adds r0, r6, 0 - movs r1, 0x2 - movs r2, 0x1 - movs r3, 0x1 - bl sub_80869E4 - mov r1, sp - ldr r0, _08087480 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - mov r0, sp - str r0, [sp, 0x58] - str r6, [sp, 0x5C] - add r4, sp, 0x18 - add r1, sp, 0x58 - add r2, sp, 0x5C - adds r0, r4, 0 - movs r3, 0x1 - bl sub_8085B4C - ldr r0, [r6, 0x70] - ldr r2, _08087484 - adds r1, r0, r2 - movs r0, 0x1 - strb r0, [r1] - add r7, sp, 0x28 - add r3, sp, 0x48 - mov r8, r3 - add r0, sp, 0x60 - mov r10, r0 - mov r1, sp - adds r1, 0x64 - str r1, [sp, 0x6C] - b _0808748E - .align 2, 0 -_08087470: .4byte gUnknown_81014B0 -_08087474: .4byte gUnknown_8101504 -_08087478: .4byte gUnknown_81015A0 -_0808747C: .4byte gUnknown_81015D4 -_08087480: .4byte gUnknown_810744C -_08087484: .4byte 0x0000015f -_08087488: - movs r0, 0x46 - bl sub_803E46C -_0808748E: - adds r0, r4, 0 - bl sub_8085B80 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08087488 - ldr r0, [r6, 0x70] - ldr r2, _08087510 - adds r0, r2 - strb r5, [r0] - ldr r0, [r6, 0x70] - ldr r4, _08087514 - adds r0, r4 - movs r1, 0x1 - strb r1, [r0] - adds r0, r6, 0 - movs r1, 0x2 - movs r2, 0x2 - movs r3, 0x4 - bl sub_80869E4 - ldr r0, _08087518 - bl DisplayDungeonDialogue - movs r0, 0x3C - movs r1, 0x46 - bl sub_803E708 - ldr r0, _0808751C - bl DisplayDungeonDialogue - movs r0, 0xA - movs r1, 0x46 - bl sub_803E708 - ldr r0, [r6, 0x70] - adds r0, r4 - strb r5, [r0] - adds r0, r6, 0 - movs r1, 0x2 - movs r2, 0x2 - movs r3, 0x5 - bl sub_80869E4 - adds r1, r7, 0 - ldr r0, _08087520 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r3,r4} - stm r1!, {r3,r4} - str r7, [sp, 0x60] - str r6, [sp, 0x64] - mov r0, r8 - mov r1, r10 - ldr r2, [sp, 0x6C] - movs r3, 0x1 - bl sub_8085B4C - mov r4, r9 - adds r4, 0xC - b _0808752A - .align 2, 0 -_08087510: .4byte 0x0000015f -_08087514: .4byte 0x0000015d -_08087518: .4byte gUnknown_81015E8 -_0808751C: .4byte gUnknown_8101624 -_08087520: .4byte gUnknown_8107464 -_08087524: - movs r0, 0x46 - bl sub_803E46C -_0808752A: - mov r0, r8 - bl sub_8085B80 - lsls r0, 24 - cmp r0, 0 - bne _08087524 - adds r0, r6, 0 - movs r1, 0x2 - movs r2, 0x1 - movs r3, 0x3 - bl sub_80869E4 - ldr r0, _080875B0 - bl DisplayDungeonDialogue - movs r0, 0xA - movs r1, 0x46 - bl sub_803E708 - movs r0, 0x3 - bl ZapdosScreenFlash - ldr r0, _080875B4 - bl DisplayDungeonDialogue - movs r0, 0xA - movs r1, 0x46 - bl sub_803E708 - movs r0, 0x1 - bl ZapdosScreenFlash - ldr r0, _080875B8 - bl DisplayDungeonDialogue - movs r0, 0xA - movs r1, 0x46 - bl sub_803E708 - movs r0, 0x2 - bl ZapdosScreenFlash - ldr r0, _080875BC - bl DisplayDungeonDialogue - movs r0, 0xA - movs r1, 0x46 - bl sub_803E708 - movs r1, 0x96 - lsls r1, 1 - ldr r0, [sp, 0x68] - movs r2, 0xB - bl SetupBossFightHP - adds r0, r4, 0 - movs r1, 0x10 - bl ShiftCameraToPosition - add sp, 0x70 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_080875B0: .4byte gUnknown_810165C -_080875B4: .4byte gUnknown_8101750 -_080875B8: .4byte gUnknown_810178C -_080875BC: .4byte gUnknown_81017B4 - thumb_func_end ZapdosPreFightDialogue - - .align 2,0 diff --git a/include/code_80869E4.h b/include/code_80869E4.h index 6a777dac6..43e9bb5f9 100644 --- a/include/code_80869E4.h +++ b/include/code_80869E4.h @@ -38,6 +38,6 @@ void sub_8086854(void); void sub_80868F4(Entity *entity); void sub_8086910(Entity *entity); void sub_808692C(void); -void sub_80869E4(Entity *, s32, u8, s8); +void sub_80869E4(Entity *, s32, u8, s8 direction); #endif // GUARD_CODE_80869E4_H diff --git a/ld_script.txt b/ld_script.txt index df9779149..9c7c8f728 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -300,8 +300,6 @@ SECTIONS { src/code_8085E98.o(.text); src/code_80861A8.o(.text); src/code_80869E4.o(.text); - src/code_8086A3C.o(.text); - asm/code_8086A3C.o(.text); src/code_8057824_1.o(.text); src/pokemon.o(.text); asm/pokemon.o(.text); diff --git a/src/code_8057824_1.c b/src/code_8057824_1.c index dafdbcd21..9722bb4ed 100644 --- a/src/code_8057824_1.c +++ b/src/code_8057824_1.c @@ -16,6 +16,7 @@ #include "dungeon_map_access.h" #include "dungeon_message.h" #include "dungeon_music.h" +#include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" #include "dungeon_util_1.h" #include "dungeon_util.h" @@ -33,10 +34,42 @@ extern u8 gUnknown_202E038[0x50]; extern u8 gAvailablePokemonNames[0x58]; extern u8 gFormatItems[]; + +extern const u8 gUnknown_810739C[]; +extern const u8 gUnknown_81073D4[]; +extern const u8 gUnknown_810740C[]; extern const s16 gUnknown_80F57CA; extern const s16 gUnknown_80F57D2; extern const s16 gUnknown_80F57D0; extern const s16 gUnknown_80F57CE; +extern const s16 gUnknown_80F57CC; +extern const struct DungeonDialogueStruct gUnknown_8101440; +extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_1; +extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_2; +extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_3; +extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_4; +extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_5; +extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_6; +extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_7; +extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_8; +extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_9; +extern const struct DungeonDialogueStruct gSkarmoryReFightDialogue_1; +extern const struct DungeonDialogueStruct gSkarmoryReFightDialogue_2; +extern const struct DungeonDialogueStruct gSkarmoryReFightDialogue_3; +extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_1; +extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_2; +extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_3; +extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_4; +extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_5; +extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_6; +extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_7; +extern const struct DungeonDialogueStruct gTeamMeaniesReFightDialogue_1; +extern const struct DungeonDialogueStruct gTeamMeaniesReFightDialogue_2; +extern const struct DungeonDialogueStruct gTeamMeaniesReFightDialogue_3; +extern const struct DungeonDialogueStruct gTeamMeaniesReFightDialogue_4; +extern const struct DungeonDialogueStruct gTeamMeaniesReFightDialogue_5; + +extern const struct DungeonDialogueStruct gUnknown_8100D3C; extern const struct DungeonDialogueStruct gUnknown_8103D8C; extern const struct DungeonDialogueStruct gUnknown_8103D98; @@ -319,6 +352,31 @@ extern const struct DungeonDialogueStruct gUnknown_81058C4; extern const struct DungeonDialogueStruct gUnknown_81058A8; extern const u8 gUnknown_81074FC[]; +extern const struct DungeonDialogueStruct gUnknown_81014B0; +extern const struct DungeonDialogueStruct gUnknown_8101504; +extern const struct DungeonDialogueStruct gUnknown_81015D4; +extern const struct DungeonDialogueStruct gUnknown_81015E8; +extern const struct DungeonDialogueStruct gUnknown_8101624; +extern const struct DungeonDialogueStruct gUnknown_810165C; +extern const struct DungeonDialogueStruct gUnknown_8101750; +extern const struct DungeonDialogueStruct gUnknown_810178C; +extern const struct DungeonDialogueStruct gUnknown_81017B4; + +struct Zapdos1 +{ + s16 unk0[12]; +}; + +struct Zapdos2 +{ + s16 unk0[16]; +}; + +extern const struct Zapdos1 gUnknown_810744C; +extern struct Zapdos2 gUnknown_8107464; + +void ZapdosScreenFlash(s32 numFlashes); +void ZapdosDropInEffect(Entity *); extern void sub_800DC14(u32); @@ -333,7 +391,6 @@ extern u32 sub_80861F8(u32, Entity *, u32); extern s32 GetCameraXPos(); extern s32 GetCameraYPos(); extern void sub_803F878(u32, s32); -extern void SetupBossFightHP(Entity *, u32, u32); extern void BgColorCallNullsub4(void); extern void DeoxysScreenFlash(void); extern void sub_8085EB0(); @@ -426,11 +483,7 @@ void MoltresDropInEffect(Entity * param_1); void MoltresScreenFlash1(s32 r0, s32 r1); void MoltresScreenFlash2(s32 r0, s32 r1); void MoltresScreenFlash3(void); - - void MoltresScreenDarken(void); -void ZapdosDropInEffect(Entity *param_1); -void ZapdosScreenFlash(int param_1); extern void sub_8045C28(Item *, u8 , u8 *); extern void EnableJirachiWishWarpTile(void); @@ -440,6 +493,512 @@ extern u32 sub_803D73C(u32); extern void sub_80460F8(Position *, Item *, u8); +extern u8 sub_8044B28(void); +extern u8 gUnknown_202E038[]; +extern void sub_8085374(); +extern void sub_8068FE0(Entity *, u32, u32); +extern void sub_8086448(void); +extern void sub_8086A54(Entity *); +extern void sub_8087144(); +extern bool8 sub_8085B80(struct_8085B80 *); + +void SkarmoryEntry(Entity *); + +void sub_8086A3C(Entity *pokemon) +{ + pokemon->info->unk15C = 1; + pokemon->info->unk15E = 1; +} + +void sub_8086A54(Entity *pokemon) +{ + pokemon->info->unk15C = 1; + pokemon->info->unk15E = 0; +} + +void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex) +{ + EntityInfo *entityInfo = GetEntInfo(pokemon); + + entityInfo->bossFlag = TRUE; + + // BUG: Source of the Reviver Seed Boss Glitch + // + // Video to demonstration: + // https://www.youtube.com/watch?v=rHu7EehrZ68 + entityInfo->originalHP = entityInfo->maxHPStat; + if (newHP != 0) { + entityInfo->maxHPStat = newHP; + entityInfo->HP = newHP; + } + + gDungeon->bossSongIndex = songIndex; + SetDefaultIQSkills(entityInfo->IQSkillMenuFlags, entityInfo->bossFlag); + LoadIQSkills(pokemon); +} + +void sub_8086AC0(void) +{ + if(!sub_8044B28()) + if(gDungeon->unk2 == 0) + sub_8097FF8(); +} + +u8 sub_8086AE4(s16 _index) +{ + s32 pokeIndex = _index; + + if(gDungeon->unk65C == 0) + return 1; + else + return HasRecruitedMon(pokeIndex); +} + +void sub_8086B14(void) +{ + Entity * LeaderEntity; + Entity * DiglettEntity; + Entity * SkarmoryEntity; + + LeaderEntity = xxx_call_GetLeader(); + DiglettEntity = GetEntityFromClientType(4); + SkarmoryEntity = GetEntityFromClientType(3); + DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); + sub_8085374(); + sub_80854D4(); + sub_8085930(DIRECTION_NORTH); + sub_80855E4(sub_8086A3C); + sub_8086A3C(SkarmoryEntity); + DiglettEntity->info->unk15C = 1; + sub_8085860(LeaderEntity->pos.x,LeaderEntity->pos.y - 2); + CopyMonsterNametoBuffer(gUnknown_202E038,MONSTER_DIGLETT); + CopyMonsterNametoBuffer(gUnknown_202E038 + 0x50, MONSTER_SKARMORY); +} + +void sub_8086B94(void) +{ + Entity * LeaderEntity; + Entity * DiglettEntity; + Entity * SkarmoryEntity; + + LeaderEntity = xxx_call_GetLeader(); + DiglettEntity = GetEntityFromClientType(4); + SkarmoryEntity = GetEntityFromClientType(3); + + sub_8068FE0(SkarmoryEntity,0x21c,0); + sub_8068FE0(DiglettEntity,0x21c,0); + sub_80854D4(); + sub_8085930(DIRECTION_NORTH); + sub_8085860(LeaderEntity->pos.x,LeaderEntity->pos.y); +} + +void sub_8086BDC(char param_1, s32 param_2) +{ + if ((((param_2 * 0x1000000) - 0x1000000U) >> 0x18 < 2) && (param_1 == 3)) { + sub_8097FA8(1); + gDungeon->unk2 = 1; + } +} + +void SkarmoryPreFightDialogue(void) +{ + Entity *LeaderEntity; + Entity *PartnerEntity; + Entity * DiglettEntity; + Entity * SkarmoryEntity; + + Position32 pos1; + Position32 pos2; + + LeaderEntity = xxx_call_GetLeader(); // Player + PartnerEntity = GetPartnerEntity(); // Partner + DiglettEntity = GetEntityFromClientType(4); // Diglett + SkarmoryEntity = GetEntityFromClientType(3); // Skarmory + + pos1.x = DiglettEntity->pixelPos.x; + pos1.y = DiglettEntity->pixelPos.y + 0x3000; + + pos2.x = SkarmoryEntity->pixelPos.x; + pos2.y = SkarmoryEntity->pixelPos.y + 0x2000; + + sub_8086448(); + sub_803E708(10,0x46); + SpriteShockEffect(PartnerEntity); + sub_803E708(0x20,0x46); + sub_803E708(10,0x46); + DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_1); + ShiftCameraToPosition(&pos1,0x40); + sub_803E708(0x40,0x46); + ShiftCameraToPosition(&pos2,0x30); + DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_2); + sub_803E708(10,0x46); + DiglettEntity->info->unk15D = 1; + ShiftCameraToPosition(&pos1,0x30); + DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_3); // Diglett: ...I...\nI'm scared. + sub_803E708(10,0x46); + ShiftCameraToPosition(&pos2,0x20); + sub_803E708(0x20,0x46); + SkarmoryEntry(SkarmoryEntity); + DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_4); // Skarmory: You!\nWhat do you think you're doing here?! + sub_803E708(10,0x46); + DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_5); + sub_803E708(10,0x46); + DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_6); + sub_803E708(10,0x46); + DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_7); + sub_803E708(10,0x46); + sub_806CDD4(SkarmoryEntity,0xd,0); + DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_8); + sub_803E708(10,0x46); + sub_80869E4(PartnerEntity,4,1,2); + sub_80869E4(LeaderEntity,4,2,6); + DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_9); + sub_80869E4(PartnerEntity,4,2,4); + sub_80869E4(LeaderEntity,4,1,4); + sub_803E708(10,0x46); + DungeonStartNewBGM(MUS_BOSS_BATTLE); + ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); +} + +void SkarmoryReFightDialogue(void) +{ + Entity * LeaderEntity; + Entity * SkarmoryEntity; + Position32 pos; + + LeaderEntity = xxx_call_GetLeader(); + SkarmoryEntity = GetEntityFromClientType(3); + pos.x = SkarmoryEntity->pixelPos.x; + pos.y = SkarmoryEntity->pixelPos.y + 0x2000; + sub_8086448(); + sub_803E708(10,0x46); + SkarmoryEntry(SkarmoryEntity); + ShiftCameraToPosition(&pos,0x10); + DisplayDungeonDialogue(&gSkarmoryReFightDialogue_1); + sub_803E708(10,0x46); + DisplayDungeonDialogue(&gSkarmoryReFightDialogue_2); + sub_803E708(10,0x46); + sub_806CDD4(SkarmoryEntity,0xd,0); + DisplayDungeonDialogue(&gSkarmoryReFightDialogue_3); + sub_803E708(10,0x46); + ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); + DungeonStartNewBGM(MUS_BOSS_BATTLE); +} + +void sub_8086E40(void) +{ + SpriteLookAroundEffect(xxx_call_GetLeader()); + sub_803E708(10,0x46); + DisplayDungeonDialogue(&gUnknown_8100D3C); + sub_803E708(10,0x46); + gDungeon->unk2 = 1; +} + +void SkarmoryEntry(Entity * skarmoryEntity) +{ + sub_806CDD4(skarmoryEntity,0xf,0); + sub_8086A54(skarmoryEntity); + PlaySoundEffect(0x1f8); + sub_803E708(0x44,0x46); +} + +void sub_8086E9C(void) +{ + Entity * LeaderEntity; + + LeaderEntity = xxx_call_GetLeader(); + DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); + sub_8085374(); + sub_80854D4(); + sub_8085930(DIRECTION_NORTH); + sub_80855E4(sub_8086A3C); + sub_808563C(sub_8086A3C); + sub_8085860(LeaderEntity->pos.x,LeaderEntity->pos.y - 3); + CopyMonsterNametoBuffer(gUnknown_202E038, MONSTER_METAPOD); + CopyMonsterNametoBuffer(gUnknown_202E038 + 0x50, MONSTER_GENGAR); + CopyMonsterNametoBuffer(gUnknown_202E038 + 0xA0, MONSTER_CATERPIE); +} + +void sub_8086F00(void) +{ + Entity * LeaderEntity; + + LeaderEntity = xxx_call_GetLeader(); + sub_80854D4(); + sub_8085930(DIRECTION_NORTH); + sub_80855E4(sub_8086A3C); + sub_8085860(LeaderEntity->pos.x,LeaderEntity->pos.y - 3); + CopyMonsterNametoBuffer(gUnknown_202E038, MONSTER_METAPOD); + CopyMonsterNametoBuffer(gUnknown_202E038 + 0x50, MONSTER_GENGAR); + CopyMonsterNametoBuffer(gUnknown_202E038 + 0xA0, MONSTER_CATERPIE); +} + +// From @jiangzhengwenjz: +// Matches this way for -O2 but can match w/o this hack on -O1 +// https://decomp.me/scratch/BTqWo +void sub_8086F54(u8 param_1, u8 param_2) +{ + Entity *entity; + s32 index; + u32 unk1 = 0; + + + if (param_2 == 4 || param_2 == 5) { + void *labels[2]; + labels[0] = labels[1] = &&label; + + for(index = 0; index < 0x10; index++) + { + entity = gDungeon->wildPokemon[index]; + if ((EntityExists(entity)) && (entity->info->clientType != param_1)) { + return; + } + } + if(!unk1) + { + sub_8097FA8(3); + label: + gDungeon->unk2 = 1; + } + } +} + +void TeamMeaniesPreFightDialogue(void) +{ + Entity *LeaderEntity; + + LeaderEntity = xxx_call_GetLeader(); + sub_8086448(); + sub_803E708(10, 0x46); + DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_1); + sub_803E708(10, 0x46); + DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_2); + sub_803E708(10, 0x46); + sub_8087144(); + DungeonStartNewBGM(MUS_THERES_TROUBLE); + DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_3); + sub_803E708(10, 0x46); + DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_4); + sub_803E708(10, 0x46); + DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_5); + sub_803E708(10, 0x46); + DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_6); + sub_803E708(10, 0x46); + DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_7); + sub_803E708(10, 0x46); + ShiftCameraToPosition(&LeaderEntity->pixelPos, 0x10); +} + +void TeamMeaniesReFightDialogue(void) +{ + Entity *LeaderEntity; + Entity *PartnerEntity; + + LeaderEntity = xxx_call_GetLeader(); + PartnerEntity = GetPartnerEntity(); + sub_8086448(); + DisplayDungeonDialogue(&gTeamMeaniesReFightDialogue_1); + sub_803E708(10, 0x46); + DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_2); + sub_803E708(10, 0x46); + sub_8087144(); + sub_803E708(10, 0x46); + DisplayDungeonDialogue(&gTeamMeaniesReFightDialogue_2); + sub_803E708(10, 0x46); + DisplayDungeonDialogue(&gTeamMeaniesReFightDialogue_3); + sub_803E708(10, 0x46); + sub_806CDD4(LeaderEntity, 6, 4); + sub_806CDD4(PartnerEntity, 6, 4); + sub_803E708(10, 0x46); + sub_806CDD4(LeaderEntity, 7, 4); + sub_806CDD4(PartnerEntity, 7, 4); + sub_803E708(10, 0x46); + DisplayDungeonDialogue(&gTeamMeaniesReFightDialogue_4); + DisplayDungeonDialogue(&gTeamMeaniesReFightDialogue_5); + sub_803E708(10, 0x46); + ShiftCameraToPosition(&LeaderEntity->pixelPos, 0x10); +} + +void sub_8087130(void) +{ + sub_8086448(); + sub_80866C4(&gUnknown_8101440); +} + +void sub_8087144(void) +{ + Entity *iVar2; + Entity *iVar3; + Entity *iVar4; + s16 auStack_10c[28]; + s16 puStack_60[28]; + s16 puStack_5c[28]; + s16 *puStack_64[3]; + Entity *pEStack_58[3]; + struct_8085B80 auStack_4c[3]; + + iVar2 = GetEntityFromClientType(5); + iVar3 = GetEntityFromClientType(6); + iVar4 = GetEntityFromClientType(7); + memcpy(auStack_10c,gUnknown_810739C, 0x38); + memcpy(puStack_60, gUnknown_81073D4, 0x38); + memcpy(puStack_5c, gUnknown_810740C, 0x38); + puStack_64[0] = auStack_10c; + puStack_64[1] = puStack_60; + puStack_64[2] = puStack_5c; + pEStack_58[0] = iVar2; + pEStack_58[1] = iVar3; + pEStack_58[2] = iVar4; + DungeonStartNewBGM(MUS_THERES_TROUBLE); + sub_8086A54(iVar2); + sub_8086A54(iVar3); + sub_8086A54(iVar4); + sub_8085B4C(auStack_4c,puStack_64,pEStack_58,3); + iVar2->info->unk15F = 1; + iVar3->info->unk15F = 1; + iVar4->info->unk15F = 1; + while( TRUE ) { + if (!sub_8085B80(auStack_4c)) break; + sub_803E46C(0x46); + } + iVar2->info->unk15F = 0; + iVar3->info->unk15F = 0; + iVar4->info->unk15F = 0; +} + +void sub_8087230(void) +{ + Entity *LeaderEntity; + Entity *ZapdosEntity; + + LeaderEntity = xxx_call_GetLeader(); + ZapdosEntity = GetEntityFromClientType(0x8); + DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); + sub_8085374(); + sub_80854D4(); + sub_8085930(4); + sub_80855E4(sub_8086A3C); + SetFacingDirection(ZapdosEntity, 0); + sub_8086A3C(ZapdosEntity); + sub_8085860(LeaderEntity->pos.x, LeaderEntity->pos.y - 3); + CopyMonsterNametoBuffer(gUnknown_202E038, MONSTER_SHIFTRY); + CopyMonsterNametoBuffer(gUnknown_202E038 + 0x50, MONSTER_ZAPDOS); +} + +void sub_808729C(void) +{ + Entity *LeaderEntity; + Entity *ZapdosEntity; + + LeaderEntity = xxx_call_GetLeader(); + ZapdosEntity = GetEntityFromClientType(8); + sub_80854D4(); + sub_8085930(4); + sub_80855E4(sub_8086A3C); + if (sub_8086AE4(0x91) != 0) { + sub_8068FE0(ZapdosEntity,0x21c,0); + } + else { + sub_8072008(ZapdosEntity,ZapdosEntity,gUnknown_80F57CC,0,0); + SetFacingDirection(ZapdosEntity,0); + sub_8086A3C(ZapdosEntity); + } + sub_8085860(LeaderEntity->pos.x,LeaderEntity->pos.y - 3); + CopyMonsterNametoBuffer(gUnknown_202E038, MONSTER_SHIFTRY); + CopyMonsterNametoBuffer(gUnknown_202E038 + 0x50, MONSTER_ZAPDOS); +} + +void sub_8087334(u8 param_1, u8 param_2) +{ + if ((param_2 == 7 || param_2 == 8 || param_2 == 9) && (param_1 == 8)) { + sub_8097FA8(5); + gDungeon->unk2 = 1; + } +} + +void ZapdosPreFightDialogue(void) +{ + Entity *LeaderEntity; + Entity *PartnerEntity; + struct Zapdos1 puStack_38; // sp 0x0 + struct_8085B80 auStack_78; + struct Zapdos2 puStack_30; + s16 *puStack_34[1]; // sp 0x58 + struct Entity *pEStack_34[1]; // sp 0x5c + s16 *puStack_4c[1]; // sp 0x60 + Entity *pEStack_2c[1]; // sp 0x64 + Entity *ZapdosEntity; // sp 0x68 + struct_8085B80 auStack_48; // r8 + + LeaderEntity = xxx_call_GetLeader(); + PartnerEntity = GetPartnerEntity(); + ZapdosEntity = GetEntityFromClientType(8); + sub_8086448(); + sub_803E708(10,0x46); + SpriteLookAroundEffect(PartnerEntity); + sub_803E708(10,0x46); + sub_80869E4(PartnerEntity,4,1,DIRECTION_EAST); + sub_80869E4(LeaderEntity,4,2,DIRECTION_WEST); + DisplayDungeonDialogue(&gUnknown_81014B0); + sub_803E708(10,0x46); + sub_80869E4(PartnerEntity,4,2,DIRECTION_NORTH); + sub_80869E4(LeaderEntity,4,1,DIRECTION_NORTH); + DisplayDungeonDialogue(&gUnknown_8101504); + sub_803E708(10,0x46); + ZapdosScreenFlash(3); + DungeonStopBGM(); + PlaySoundEffect(0x1da); + DisplayDungeonDialogue(&gUnknown_81015A0); + ZapdosDropInEffect(ZapdosEntity); + DungeonStartNewBGM(MUS_RISING_FEAR); + sub_806CDD4(PartnerEntity,6,DIRECTION_NORTH); + DisplayDungeonDialogue(&gUnknown_81015D4); // Waah! + sub_803E708(10,0x46); + sub_80869E4(PartnerEntity,2,1,DIRECTION_SOUTHEAST); + + puStack_38 = gUnknown_810744C; + puStack_34[0] = puStack_38.unk0; + pEStack_34[0] = PartnerEntity; + sub_8085B4C(&auStack_78,puStack_34,pEStack_34,1); + PartnerEntity->info->unk15F = 1; + while(sub_8085B80(&auStack_78)) { + sub_803E46C(0x46); + } + + PartnerEntity->info->unk15F = 0; + PartnerEntity->info->unk15D = 1; + sub_80869E4(PartnerEntity,2,2,DIRECTION_NORTH); + DisplayDungeonDialogue(&gUnknown_81015E8); // I warned you! I have no mercy for meddlers + sub_803E708(0x3c,0x46); + DisplayDungeonDialogue(&gUnknown_8101624); + sub_803E708(10,0x46); + PartnerEntity->info->unk15D = 0; + sub_80869E4(PartnerEntity,2,2,DIRECTION_NORTHWEST); + + puStack_30 = gUnknown_8107464; + puStack_4c[0] = puStack_30.unk0; + pEStack_2c[0] = PartnerEntity; + sub_8085B4C(&auStack_48,puStack_4c,pEStack_2c,1); + while (sub_8085B80(&auStack_48)) { + sub_803E46C(0x46); + } + + sub_80869E4(PartnerEntity,2,1,DIRECTION_NORTHEAST); + DisplayDungeonDialogue(&gUnknown_810165C); + sub_803E708(10,0x46); + ZapdosScreenFlash(3); + DisplayDungeonDialogue(&gUnknown_8101750); + sub_803E708(10,0x46); + ZapdosScreenFlash(1); + DisplayDungeonDialogue(&gUnknown_810178C); + sub_803E708(10,0x46); + ZapdosScreenFlash(2); + DisplayDungeonDialogue(&gUnknown_81017B4); + sub_803E708(10,0x46); + SetupBossFightHP(ZapdosEntity,300, MUS_BOSS_BATTLE); + ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); +} + void ZapdosReFightDialogue(void) { Entity *LeaderEntity; @@ -513,31 +1072,26 @@ void ZapdosDropInEffect(Entity *zapdosEntity) void ZapdosScreenFlash(s32 numFlashes) { - s32 iVar1; - s32 iVar2; + s32 index; PlaySoundEffect(0x1f6); if (2 < numFlashes) { - for(iVar2 = 250; iVar2 > 199; iVar2 -= 10) + for(index = 250; index > 199; index -= 10) { - SetDungeonBGColorRGB(iVar2,iVar2,iVar2 / 2,1,1); + SetDungeonBGColorRGB(index,index,index / 2,1,1); sub_803E46C(0x46); } } if (1 < numFlashes) { - for(iVar2 = 250; iVar2 > 199; iVar2 -= 10) + for(index = 250; index > 199; index -= 10) { - SetDungeonBGColorRGB(iVar2,iVar2,iVar2 / 2,1,1); + SetDungeonBGColorRGB(index,index,index / 2,1,1); sub_803E46C(0x46); } } - for(iVar2 = 250; iVar2 >= 0; iVar2 -= 10) + for(index = 250; index >= 0; index -= 10) { - iVar1 = iVar2; - if (iVar2 < 0) { - iVar1 = iVar2 + 3; - } - SetDungeonBGColorRGB(iVar2,iVar2,iVar1 >> 2,1,1); + SetDungeonBGColorRGB(index,index,index / 4,1,1); sub_803E46C(0x46); } sub_8085EB0(); diff --git a/src/code_8095824.c b/src/code_8095824.c deleted file mode 100644 index f5e7b6272..000000000 --- a/src/code_8095824.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "global.h" -#include "dungeon.h" -#include "memory.h" -#include "pokemon.h" -#include "random.h" -#include "save.h" -#include "text_util.h" -#include "code_8094F88.h"