diff --git a/data/data_8107224.s b/data/data_8107224.s index 320fe3790..b7d4f2227 100644 --- a/data/data_8107224.s +++ b/data/data_8107224.s @@ -1,51 +1,7 @@ .section .rodata -.align 2 -.global gUnknown_8107374 -gUnknown_8107374: @ 8107374 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.global gUnknown_8107380 -gUnknown_8107380: @ 8107380 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -@ ??? -.string "pksdir0\0" -@ code_8086A3C #1 -.string "pksdir0\0" - -.global gUnknown_810739C -gUnknown_810739C: @ 810739C -.byte 0x04, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x18, 0x00, 0x00, 0x00 -.byte 0x04, 0x00, 0x02, 0x00, 0x18, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00 -.byte 0x06, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x00, 0x00 - -.global gUnknown_81073D4 -gUnknown_81073D4: @ 81073D4 -.byte 0x04, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x18, 0x00, 0x00, 0x00 -.byte 0x04, 0x00, 0x02, 0x00, 0x18, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00 -.byte 0x06, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x00, 0x00 - -.global gUnknown_810740C -gUnknown_810740C: @ 810740C -.byte 0x04, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00 -.byte 0x04, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x18, 0x00, 0x00, 0x00 -.byte 0x03, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x00, 0x00 -@ code_8086A3C #2 -.string "pksdir0\0" - -.global gUnknown_810744C -gUnknown_810744C: @ 810744C -.byte 0x01, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00 - -.global gUnknown_8107464 -gUnknown_8107464: @ 8107464 -.byte 0x05, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00 -.byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00 .string "pksdir0\0" .string "pksdir0\0" .string "pksdir0\0" diff --git a/ld_script.txt b/ld_script.txt index a164d24b5..dc709b798 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -282,6 +282,9 @@ SECTIONS { src/dungeon_cleared_window.o(.text); src/dungeon_jobs.o(.text); src/code_80848F0.o(.text); + src/dungeon_cutscene_skarmory.o(.text); + src/dungeon_cutscene_meanies.o(.text); + src/dungeon_cutscene_zapdos.o(.text); src/dungeon_cutscenes.o(.text); src/pokemon.o(.text); src/pokemon_3.o(.text); @@ -622,6 +625,9 @@ SECTIONS { src/dungeon_cleared_window.o(.rodata); src/dungeon_jobs.o(.rodata); src/code_80848F0.o(.rodata); + src/dungeon_cutscene_skarmory.o(.rodata); + src/dungeon_cutscene_meanies.o(.rodata); + src/dungeon_cutscene_zapdos.o(.rodata); data/data_8107224.o(.rodata); src/pokemon.o(.rodata); data/data_81076E4.o(.rodata); diff --git a/src/code_80848F0.c b/src/code_80848F0.c index 542a4fc82..8f7fd35fc 100644 --- a/src/code_80848F0.c +++ b/src/code_80848F0.c @@ -51,7 +51,6 @@ extern s32 gUnknown_202F3D8; extern const u8 gUnknown_8107358[25]; extern const DungeonPos gUnknown_80F4598[]; -extern const struct unkStruct_2039DB0 gUnknown_8107380; extern bool8 sub_8004C00(unkStruct_202EE8C *a0, s32 a1, s32 a2, s32 brightness, const RGB *ramp, struct RgbS16 *a5); extern void ShowWholeRevealedDungeonMap(void); @@ -1333,8 +1332,6 @@ void sub_8085EB0(void) gDungeon->unk181e8.unk18215 = 1; } -extern const unkStruct_2039DB0 gUnknown_8107374; - u32 sub_8085EC8(s16 param_1,u32 param_2,u32 param_3,DungeonPos *param_4, bool32 param_5) { u32 uVar1; @@ -1357,7 +1354,7 @@ u32 sub_8085EC8(s16 param_1,u32 param_2,u32 param_3,DungeonPos *param_4, bool32 local_40.unk10 = 0; local_40.unk12 = 0; local_40.unk18 = 0xffff; - local_40.unk1C = gUnknown_8107374; + local_40.unk1C = (unkStruct_2039DB0) {0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0}; uVar1 = sub_800E890(&local_40); if (param_5_bool8) { @@ -1503,7 +1500,7 @@ s32 sub_80861F8(s32 param_1,Entity *param_2,bool32 param_3) stack.unk12 = pos.y; stack.unk14 = uStack_38; stack.unk18 = 0xffff; - stack.unk1C = gUnknown_8107380; + stack.unk1C = (unkStruct_2039DB0) {0xFFFF, 0xFFFF, 0xFFFF, 0, 0}; uVar2 = sub_800E890(&stack); if (param_3_bool32) { diff --git a/src/dungeon_cutscene_meanies.c b/src/dungeon_cutscene_meanies.c new file mode 100644 index 000000000..9cd71e15a --- /dev/null +++ b/src/dungeon_cutscene_meanies.c @@ -0,0 +1,220 @@ +#include "global.h" +#include "globaldata.h" +#include "code_800DAC0.h" +#include "code_800E9A8.h" +#include "code_803E46C.h" +#include "code_803E668.h" +#include "code_8041AD0.h" +#include "code_804267C.h" +#include "code_80861A8.h" +#include "code_806CD90.h" +#include "code_80869E4.h" +#include "constants/bg_music.h" +#include "constants/direction.h" +#include "constants/friend_area.h" +#include "constants/weather.h" +#include "dungeon_items.h" +#include "dungeon_leader.h" +#include "dungeon_map_access.h" +#include "dungeon_message.h" +#include "dungeon_music.h" +#include "dungeon_misc.h" +#include "dungeon_logic.h" +#include "dungeon_random.h" +#include "dungeon_util_1.h" +#include "dungeon_util.h" +#include "exclusive_pokemon.h" +#include "friend_area.h" +#include "items.h" +#include "pokemon_3.h" +#include "pokemon.h" +#include "position_util.h" +#include "trap.h" +#include "math.h" +#include "dungeon_config.h" +#include "dungeon_boss_dialogue.h" + +extern void sub_8042B0C(Entity *); +extern u8 sub_806FD18(Entity *); +extern void sub_806FDF4(Entity *, Entity *, Entity **); +extern s32 GetCameraXPos(void); +extern s32 GetCameraYPos(void); +extern void sub_803F878(u32, s32); +extern void BgColorCallNullsub4(void); +extern void sub_8085EB0(void); +extern void sub_8049884(void); +extern void sub_8049B8C(void); +extern void ShowWholeRevealedDungeonMap(void); +extern void sub_8086A54(Entity *); +extern void ResetMonEntityData(EntityInfo *, u32); +extern void sub_808BBA8(Entity * ); +extern void sub_8041888(u32); +extern u32 sub_80861F8(u32, Entity *, u32); +extern u8 sub_80860A8(u32); +extern void sub_8052D44(s16 *, Entity *, Entity *); +extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); +extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); +extern void sub_807EAA0(u32, u32); +extern void sub_8072008(Entity *, Entity *, s16, u32, u32); +extern void sub_8085374(void); +extern u32 GetRandomFloorItem(u32); +extern bool8 sub_8085B80(struct_8085B80 *); +extern void sub_8086A3C(Entity *pokemon); +extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); +extern u8 sub_8086AE4(s16 _index); + +static void sub_8087144(void); + +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(gFormatBuffer_Monsters[2], MONSTER_METAPOD); + CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_GENGAR); + CopyMonsterNameToBuffer(gFormatBuffer_Monsters[4], 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(gFormatBuffer_Monsters[2], MONSTER_METAPOD); + CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_GENGAR); + CopyMonsterNameToBuffer(gFormatBuffer_Monsters[4], MONSTER_CATERPIE); +} + +void sub_8086F54(u8 param_1, u8 param_2) +{ + s32 index; + + if (param_2 == 4 || param_2 == 5) { + bool8 found = FALSE; + for (index = 0; index < 0x10; index++) { + struct Entity *entity = gDungeon->wildPokemon[index]; + if ((EntityIsValid(entity))) { + struct EntityInfo *entInfo = GetEntInfo(entity); + if (entInfo->monsterBehavior != param_1) { + found = TRUE; + return; + } + } + } + + if (!found) { + sub_8097FA8(3); + 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, DIRECTION_NORTH); + sub_806CDD4(partnerEntity, 6, DIRECTION_NORTH); + sub_803E708(10, 0x46); + sub_806CDD4(leaderEntity, 7, DIRECTION_NORTH); + sub_806CDD4(partnerEntity, 7, DIRECTION_NORTH); + 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); +} + +static void sub_8087144(void) +{ + Entity *gengarEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GENGAR); + Entity *ekansEntity = GetEntityFromMonsterBehavior(BEHAVIOR_EKANS); + Entity *medichamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEDICHAM); + s16 auStack_10c[28] = {4, 2, 12, 0, 3, 2, 24, 0, 4, 2, 24, 0, 5, 2, 12, 0, 6, 2, 12, 0, 0, 0, 0, 0, 0, 11, 8, 0}; + s16 puStack_60[28] = {4, 2, 12, 0, 3, 2, 24, 0, 4, 2, 24, 0, 5, 2, 12, 0, 6, 2, 12, 0, 0, 0, 0, 0, 0, 12, 8, 0}; + s16 puStack_5c[28] = {4, 2, 12, 0, 5, 2, 12, 0, 4, 2, 12, 0, 4, 2, 24, 0, 3, 2, 12, 0, 0, 0, 0, 0, 0, 10, 8, 0}; + s16 *puStack_64[3]; + Entity *pEStack_58[3]; + struct_8085B80 auStack_4c[3]; + + puStack_64[0] = auStack_10c; + puStack_64[1] = puStack_60; + puStack_64[2] = puStack_5c; + pEStack_58[0] = gengarEntity; + pEStack_58[1] = ekansEntity; + pEStack_58[2] = medichamEntity; + DungeonStartNewBGM(MUS_THERES_TROUBLE); + sub_8086A54(gengarEntity); + sub_8086A54(ekansEntity); + sub_8086A54(medichamEntity); + sub_8085B4C(auStack_4c,puStack_64,pEStack_58,3); + GetEntInfo(gengarEntity)->unk15F = 1; + GetEntInfo(ekansEntity)->unk15F = 1; + GetEntInfo(medichamEntity)->unk15F = 1; + while( TRUE ) { + if (!sub_8085B80(auStack_4c)) break; + DungeonRunFrameActions(0x46); + } + GetEntInfo(gengarEntity)->unk15F = 0; + GetEntInfo(ekansEntity)->unk15F = 0; + GetEntInfo(medichamEntity)->unk15F = 0; +} + diff --git a/src/dungeon_cutscene_placeholder.c b/src/dungeon_cutscene_placeholder.c new file mode 100644 index 000000000..7e38f30f0 --- /dev/null +++ b/src/dungeon_cutscene_placeholder.c @@ -0,0 +1,66 @@ +#include "global.h" +#include "globaldata.h" +#include "code_800DAC0.h" +#include "code_800E9A8.h" +#include "code_803E46C.h" +#include "code_803E668.h" +#include "code_8041AD0.h" +#include "code_804267C.h" +#include "code_80861A8.h" +#include "code_806CD90.h" +#include "code_80869E4.h" +#include "constants/bg_music.h" +#include "constants/direction.h" +#include "constants/friend_area.h" +#include "constants/weather.h" +#include "dungeon_items.h" +#include "dungeon_leader.h" +#include "dungeon_map_access.h" +#include "dungeon_message.h" +#include "dungeon_music.h" +#include "dungeon_misc.h" +#include "dungeon_logic.h" +#include "dungeon_random.h" +#include "dungeon_util_1.h" +#include "dungeon_util.h" +#include "exclusive_pokemon.h" +#include "friend_area.h" +#include "items.h" +#include "pokemon_3.h" +#include "pokemon.h" +#include "position_util.h" +#include "trap.h" +#include "math.h" +#include "dungeon_config.h" +#include "dungeon_boss_dialogue.h" + +extern void sub_8042B0C(Entity *); +extern u8 sub_806FD18(Entity *); +extern void sub_806FDF4(Entity *, Entity *, Entity **); +extern s32 GetCameraXPos(void); +extern s32 GetCameraYPos(void); +extern void sub_803F878(u32, s32); +extern void BgColorCallNullsub4(void); +extern void sub_8085EB0(void); +extern void sub_8049884(void); +extern void sub_8049B8C(void); +extern void ShowWholeRevealedDungeonMap(void); +extern void sub_8086A54(Entity *); +extern void ResetMonEntityData(EntityInfo *, u32); +extern void sub_808BBA8(Entity * ); +extern void sub_8041888(u32); +extern u32 sub_80861F8(u32, Entity *, u32); +extern u8 sub_80860A8(u32); +extern void sub_8052D44(s16 *, Entity *, Entity *); +extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); +extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); +extern void sub_807EAA0(u32, u32); +extern void sub_8072008(Entity *, Entity *, s16, u32, u32); +extern void sub_8085374(void); +extern u32 GetRandomFloorItem(u32); +extern bool8 sub_8085B80(struct_8085B80 *); +extern void sub_8086A3C(Entity *pokemon); +extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); +extern u8 sub_8086AE4(s16 _index); + diff --git a/src/dungeon_cutscene_skarmory.c b/src/dungeon_cutscene_skarmory.c new file mode 100644 index 000000000..7096e2974 --- /dev/null +++ b/src/dungeon_cutscene_skarmory.c @@ -0,0 +1,217 @@ +#include "global.h" +#include "globaldata.h" +#include "code_800DAC0.h" +#include "code_800E9A8.h" +#include "code_803E46C.h" +#include "code_803E668.h" +#include "code_8041AD0.h" +#include "code_804267C.h" +#include "code_80861A8.h" +#include "code_806CD90.h" +#include "code_80869E4.h" +#include "constants/bg_music.h" +#include "constants/direction.h" +#include "constants/friend_area.h" +#include "constants/weather.h" +#include "dungeon_items.h" +#include "dungeon_leader.h" +#include "dungeon_map_access.h" +#include "dungeon_message.h" +#include "dungeon_music.h" +#include "dungeon_misc.h" +#include "dungeon_logic.h" +#include "dungeon_random.h" +#include "dungeon_util_1.h" +#include "dungeon_util.h" +#include "exclusive_pokemon.h" +#include "friend_area.h" +#include "items.h" +#include "pokemon_3.h" +#include "pokemon.h" +#include "position_util.h" +#include "trap.h" +#include "math.h" +#include "dungeon_config.h" +#include "dungeon_boss_dialogue.h" + +extern void sub_8042B0C(Entity *); +extern u8 sub_806FD18(Entity *); +extern void sub_806FDF4(Entity *, Entity *, Entity **); +extern s32 GetCameraXPos(void); +extern s32 GetCameraYPos(void); +extern void sub_803F878(u32, s32); +extern void BgColorCallNullsub4(void); +extern void sub_8085EB0(void); +extern void sub_8049884(void); +extern void sub_8049B8C(void); +extern void ShowWholeRevealedDungeonMap(void); +extern void sub_8086A54(Entity *); +extern void ResetMonEntityData(EntityInfo *, u32); +extern void sub_808BBA8(Entity * ); +extern void sub_8041888(u32); +extern u32 sub_80861F8(u32, Entity *, u32); +extern u8 sub_80860A8(u32); +extern void sub_8052D44(s16 *, Entity *, Entity *); +extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); +extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); +extern void sub_807EAA0(u32, u32); +extern void sub_8072008(Entity *, Entity *, s16, u32, u32); +extern void sub_8085374(void); +extern u32 GetRandomFloorItem(u32); +extern bool8 sub_8085B80(struct_8085B80 *); +extern void sub_8086A3C(Entity *pokemon); +extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); +extern u8 sub_8086AE4(s16 _index); + +static void SkarmoryEntry(Entity * skarmoryEntity); + +void sub_8086B14(void) +{ + Entity * leaderEntity; + Entity * diglettEntity; + Entity * skarmoryEntity; + + leaderEntity = xxx_call_GetLeader(); + diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); + skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); + DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); + sub_8085374(); + sub_80854D4(); + sub_8085930(DIRECTION_NORTH); + sub_80855E4(sub_8086A3C); + sub_8086A3C(skarmoryEntity); + GetEntInfo(diglettEntity)->unk15C = 1; + sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 2); + CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2],MONSTER_DIGLETT); + CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_SKARMORY); +} + +void sub_8086B94(void) +{ + Entity * leaderEntity; + Entity * diglettEntity; + Entity * skarmoryEntity; + + leaderEntity = xxx_call_GetLeader(); + diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); + skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); + + 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(u8 param_1, u8 param_2) +{ + param_2 += 0xFF; + if ((param_2 == 0 || param_2 == 1) && param_1 == 3) { + sub_8097FA8(1); + gDungeon->unk2 = 1; + } +} + +void SkarmoryPreFightDialogue(void) +{ + Entity *leaderEntity; + Entity *partnerEntity; + Entity * diglettEntity; + Entity * skarmoryEntity; + + PixelPos pos1; + PixelPos pos2; + + leaderEntity = xxx_call_GetLeader(); // Player + partnerEntity = GetPartnerEntity(); // Partner + diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); // Diglett + skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); // 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); + GetEntInfo(diglettEntity)->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,DIRECTION_SOUTH); + DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_8); + sub_803E708(10,0x46); + sub_80869E4(partnerEntity,4,1,DIRECTION_EAST); + sub_80869E4(leaderEntity,4,2,DIRECTION_WEST); + DisplayDungeonDialogue(gSkarmoryPreFightDialogue_9); + sub_80869E4(partnerEntity,4,2,DIRECTION_NORTH); + sub_80869E4(leaderEntity,4,1,DIRECTION_NORTH); + sub_803E708(10,0x46); + DungeonStartNewBGM(MUS_BOSS_BATTLE); + ShiftCameraToPosition(&leaderEntity->pixelPos,0x10); +} + +void SkarmoryReFightDialogue(void) +{ + Entity * leaderEntity; + Entity * skarmoryEntity; + PixelPos pos; + + leaderEntity = xxx_call_GetLeader(); + skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); + 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,DIRECTION_SOUTH); + 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; +} + +static void SkarmoryEntry(Entity * skarmoryEntity) +{ + sub_806CDD4(skarmoryEntity,0xf,DIRECTION_SOUTH); + sub_8086A54(skarmoryEntity); + PlaySoundEffect(0x1f8); + sub_803E708(0x44,0x46); +} + diff --git a/src/dungeon_cutscene_zapdos.c b/src/dungeon_cutscene_zapdos.c new file mode 100644 index 000000000..3c047184d --- /dev/null +++ b/src/dungeon_cutscene_zapdos.c @@ -0,0 +1,310 @@ +#include "global.h" +#include "globaldata.h" +#include "code_800DAC0.h" +#include "code_800E9A8.h" +#include "code_803E46C.h" +#include "code_803E668.h" +#include "code_8041AD0.h" +#include "code_804267C.h" +#include "code_80861A8.h" +#include "code_806CD90.h" +#include "code_80869E4.h" +#include "constants/bg_music.h" +#include "constants/direction.h" +#include "constants/friend_area.h" +#include "constants/weather.h" +#include "dungeon_items.h" +#include "dungeon_leader.h" +#include "dungeon_map_access.h" +#include "dungeon_message.h" +#include "dungeon_music.h" +#include "dungeon_misc.h" +#include "dungeon_logic.h" +#include "dungeon_random.h" +#include "dungeon_util_1.h" +#include "dungeon_util.h" +#include "exclusive_pokemon.h" +#include "friend_area.h" +#include "items.h" +#include "pokemon_3.h" +#include "pokemon.h" +#include "position_util.h" +#include "trap.h" +#include "math.h" +#include "dungeon_config.h" +#include "dungeon_boss_dialogue.h" + +extern void sub_8042B0C(Entity *); +extern u8 sub_806FD18(Entity *); +extern void sub_806FDF4(Entity *, Entity *, Entity **); +extern s32 GetCameraXPos(void); +extern s32 GetCameraYPos(void); +extern void sub_803F878(u32, s32); +extern void BgColorCallNullsub4(void); +extern void sub_8085EB0(void); +extern void sub_8049884(void); +extern void sub_8049B8C(void); +extern void ShowWholeRevealedDungeonMap(void); +extern void sub_8086A54(Entity *); +extern void ResetMonEntityData(EntityInfo *, u32); +extern void sub_808BBA8(Entity * ); +extern void sub_8041888(u32); +extern u32 sub_80861F8(u32, Entity *, u32); +extern u8 sub_80860A8(u32); +extern void sub_8052D44(s16 *, Entity *, Entity *); +extern void sub_80464C8(Entity *, DungeonPos *, Item *); +extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); +extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); +extern void sub_807EAA0(u32, u32); +extern void sub_8072008(Entity *, Entity *, s16, u32, u32); +extern void sub_8085374(void); +extern u32 GetRandomFloorItem(u32); +extern bool8 sub_8085B80(struct_8085B80 *); +extern void sub_8086A3C(Entity *pokemon); +extern void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex); +extern u8 sub_8086AE4(s16 _index); + +struct Zapdos1 +{ + s16 unk0[12]; +}; + +struct Zapdos2 +{ + s16 unk0[16]; +}; + +static void ZapdosDropInEffect(Entity *zapdosEntity); +static void ZapdosScreenFlash(s32 numFlashes); + +void sub_8087230(void) +{ + Entity *leaderEntity; + Entity *zapdosEntity; + + leaderEntity = xxx_call_GetLeader(); + zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); + DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); + sub_8085374(); + sub_80854D4(); + sub_8085930(4); + sub_80855E4(sub_8086A3C); + SetFacingDirection(zapdosEntity, DIRECTION_SOUTH); + sub_8086A3C(zapdosEntity); + sub_8085860(leaderEntity->pos.x, leaderEntity->pos.y - 3); + CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SHIFTRY); + CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_ZAPDOS); +} + +void sub_808729C(void) +{ + Entity *leaderEntity; + Entity *zapdosEntity; + + leaderEntity = xxx_call_GetLeader(); + zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); + sub_80854D4(); + sub_8085930(4); + sub_80855E4(sub_8086A3C); + if (sub_8086AE4(0x91) != 0) { + sub_8068FE0(zapdosEntity,0x21c,0); + } + else { + sub_8072008(zapdosEntity,zapdosEntity,gZapdosConfigLevel,0,0); + SetFacingDirection(zapdosEntity,DIRECTION_SOUTH); + sub_8086A3C(zapdosEntity); + } + sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3); + CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SHIFTRY); + CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], 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 = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); + 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 = (struct Zapdos1) {1, 2, 12, 0, 1, 0, 0, 0, 0, 9, 9, 0}; + puStack_34[0] = puStack_38.unk0; + pEStack_34[0] = partnerEntity; + sub_8085B4C(&auStack_78,puStack_34,pEStack_34,1); + GetEntInfo(partnerEntity)->unk15F = 1; + while(sub_8085B80(&auStack_78)) { + DungeonRunFrameActions(0x46); + } + + GetEntInfo(partnerEntity)->unk15F = 0; + GetEntInfo(partnerEntity)->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); + GetEntInfo(partnerEntity)->unk15D = 0; + sub_80869E4(partnerEntity,2,2,DIRECTION_NORTHWEST); + + puStack_30 = (struct Zapdos2) {5, 2, 12, 0, 4, 2, 12, 0, 4, 0, 0, 0, 0, 8, 7, 0}; + puStack_4c[0] = puStack_30.unk0; + pEStack_2c[0] = partnerEntity; + sub_8085B4C(&auStack_48,puStack_4c,pEStack_2c,1); + while (sub_8085B80(&auStack_48)) { + DungeonRunFrameActions(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; + Entity *zapdosEntity; + + leaderEntity = xxx_call_GetLeader(); + zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); + sub_8086448(); + sub_803E708(10,0x46); + DisplayDungeonDialogue(gZapdosReFightDialogue_1); + sub_803E708(10,0x46); + PlaySoundEffect(0x1da); + DisplayDungeonDialogue(&gUnknown_81015A0); + sub_803E708(10,0x46); + ZapdosDropInEffect(zapdosEntity); + sub_803E708(10,0x46); + DisplayDungeonDialogue(&gZapdosReFightDialogue_2); + ZapdosScreenFlash(1); + DisplayDungeonDialogue(&gZapdosReFightDialogue_3); + ZapdosScreenFlash(2); + DisplayDungeonDialogue(&gZapdosReFightDialogue_4); + SetupBossFightHP(zapdosEntity,300,MUS_BOSS_BATTLE); + ShiftCameraToPosition(&leaderEntity->pixelPos,0x10); +} + +void ZapdosPostStoryPreFightDialogue(void) +{ + Entity * leaderEntity; + Entity * zapdosEntity; + + leaderEntity = xxx_call_GetLeader(); + zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); + sub_8086448(); + if (sub_8086AE4(MONSTER_ZAPDOS)) { + sub_80866C4(&gZapdosPostStoryPreFightDialogue_6); + } + else { + ZapdosScreenFlash(1); + PlaySoundEffect(0x1da); + DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_1); + ZapdosDropInEffect(zapdosEntity); + DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_2); + ZapdosScreenFlash(1); + DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_3); + ZapdosScreenFlash(2); + DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_4); + ZapdosScreenFlash(2); + DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_5); + sub_803E708(10,0x46); + SetupBossFightHP(zapdosEntity,300,MUS_BOSS_BATTLE); + ShiftCameraToPosition(&leaderEntity->pixelPos,0x10); + } +} + +static void ZapdosDropInEffect(Entity *zapdosEntity) +{ + int iVar1; + + GetEntInfo(zapdosEntity)->unk15C = 1; + GetEntInfo(zapdosEntity)->unk15E = 0; + GetEntInfo(zapdosEntity)->unk174.raw = 200; // incorrect value? Overwritten immediately anyway + PlaySoundEffect(0x1ea); + for(iVar1 = 200; iVar1 >= 0; iVar1 -= 5) + { + GetEntInfo(zapdosEntity)->unk174 = IntToF248_2(iVar1); + DungeonRunFrameActions(0x46); + } + sub_803E708(0x1e,0x46); +} + +static void ZapdosScreenFlash(s32 numFlashes) +{ + s32 index; + + PlaySoundEffect(0x1f6); + if (2 < numFlashes) { + for(index = 250; index > 199; index -= 10) + { + SetDungeonBGColorRGB(index,index,index / 2,1,1); + DungeonRunFrameActions(0x46); + } + } + if (1 < numFlashes) { + for(index = 250; index > 199; index -= 10) + { + SetDungeonBGColorRGB(index,index,index / 2,1,1); + DungeonRunFrameActions(0x46); + } + } + for(index = 250; index >= 0; index -= 10) + { + SetDungeonBGColorRGB(index,index,index / 4,1,1); + DungeonRunFrameActions(0x46); + } + sub_8085EB0(); +} + + diff --git a/src/dungeon_cutscenes.c b/src/dungeon_cutscenes.c index 648ad2217..06b356ef1 100644 --- a/src/dungeon_cutscenes.c +++ b/src/dungeon_cutscenes.c @@ -38,23 +38,9 @@ extern u32 gDungeonBrightness; extern const struct MenuItem gUnknown_810579C[]; extern const u64 gUnknown_8107544[]; extern const u8 *const gUnknown_8105798; -extern const u8 gUnknown_810739C[]; -extern const u8 gUnknown_81073D4[]; -extern const u8 gUnknown_810740C[]; extern const u8 gUnknown_81074FC[]; -struct Zapdos1 -{ - s16 unk0[12]; -}; -struct Zapdos2 -{ - s16 unk0[16]; -}; - -extern const struct Zapdos1 gUnknown_810744C; -extern struct Zapdos2 gUnknown_8107464; extern void sub_8042B0C(Entity *); extern u8 sub_806FD18(Entity *); @@ -147,543 +133,14 @@ void sub_808BB3C(DungeonPos *pos); void sub_8087144(); void SkarmoryEntry(Entity *); -void sub_8086B14(void) -{ - Entity * leaderEntity; - Entity * diglettEntity; - Entity * skarmoryEntity; - leaderEntity = xxx_call_GetLeader(); - diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); - skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); - DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); - sub_8085374(); - sub_80854D4(); - sub_8085930(DIRECTION_NORTH); - sub_80855E4(sub_8086A3C); - sub_8086A3C(skarmoryEntity); - GetEntInfo(diglettEntity)->unk15C = 1; - sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 2); - CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2],MONSTER_DIGLETT); - CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_SKARMORY); -} - -void sub_8086B94(void) -{ - Entity * leaderEntity; - Entity * diglettEntity; - Entity * skarmoryEntity; - - leaderEntity = xxx_call_GetLeader(); - diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); - skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); - - sub_8068FE0(skarmoryEntity,0x21c,0); - sub_8068FE0(diglettEntity,0x21c,0); - sub_80854D4(); - sub_8085930(DIRECTION_NORTH); - sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y); -} - -// TODO: fix this function as param_2 should be u8 -void sub_8086BDC(u8 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; - - PixelPos pos1; - PixelPos pos2; - - leaderEntity = xxx_call_GetLeader(); // Player - partnerEntity = GetPartnerEntity(); // Partner - diglettEntity = GetEntityFromMonsterBehavior(BEHAVIOR_DIGLETT); // Diglett - skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); // 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); - GetEntInfo(diglettEntity)->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,DIRECTION_SOUTH); - DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_8); - sub_803E708(10,0x46); - sub_80869E4(partnerEntity,4,1,DIRECTION_EAST); - sub_80869E4(leaderEntity,4,2,DIRECTION_WEST); - DisplayDungeonDialogue(gSkarmoryPreFightDialogue_9); - sub_80869E4(partnerEntity,4,2,DIRECTION_NORTH); - sub_80869E4(leaderEntity,4,1,DIRECTION_NORTH); - sub_803E708(10,0x46); - DungeonStartNewBGM(MUS_BOSS_BATTLE); - ShiftCameraToPosition(&leaderEntity->pixelPos,0x10); -} - -void SkarmoryReFightDialogue(void) -{ - Entity * leaderEntity; - Entity * skarmoryEntity; - PixelPos pos; - - leaderEntity = xxx_call_GetLeader(); - skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); - 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,DIRECTION_SOUTH); - 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,DIRECTION_SOUTH); - 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(gFormatBuffer_Monsters[2], MONSTER_METAPOD); - CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_GENGAR); - CopyMonsterNameToBuffer(gFormatBuffer_Monsters[4], 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(gFormatBuffer_Monsters[2], MONSTER_METAPOD); - CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_GENGAR); - CopyMonsterNameToBuffer(gFormatBuffer_Monsters[4], MONSTER_CATERPIE); -} - -void sub_8086F54(u8 param_1, u8 param_2) -{ - s32 index; - - if (param_2 == 4 || param_2 == 5) { - bool8 found = FALSE; - for (index = 0; index < 0x10; index++) { - struct Entity *entity = gDungeon->wildPokemon[index]; - if ((EntityIsValid(entity))) { - struct EntityInfo *entInfo = GetEntInfo(entity); - if (entInfo->monsterBehavior != param_1) { - found = TRUE; - return; - } - } - } - - if (!found) { - sub_8097FA8(3); - 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, DIRECTION_NORTH); - sub_806CDD4(partnerEntity, 6, DIRECTION_NORTH); - sub_803E708(10, 0x46); - sub_806CDD4(leaderEntity, 7, DIRECTION_NORTH); - sub_806CDD4(partnerEntity, 7, DIRECTION_NORTH); - 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 *gengarEntity; - Entity *ekansEntity; - Entity *medichamEntity; - 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]; - - gengarEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GENGAR); - ekansEntity = GetEntityFromMonsterBehavior(BEHAVIOR_EKANS); - medichamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEDICHAM); - 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] = gengarEntity; - pEStack_58[1] = ekansEntity; - pEStack_58[2] = medichamEntity; - DungeonStartNewBGM(MUS_THERES_TROUBLE); - sub_8086A54(gengarEntity); - sub_8086A54(ekansEntity); - sub_8086A54(medichamEntity); - sub_8085B4C(auStack_4c,puStack_64,pEStack_58,3); - GetEntInfo(gengarEntity)->unk15F = 1; - GetEntInfo(ekansEntity)->unk15F = 1; - GetEntInfo(medichamEntity)->unk15F = 1; - while( TRUE ) { - if (!sub_8085B80(auStack_4c)) break; - DungeonRunFrameActions(0x46); - } - GetEntInfo(gengarEntity)->unk15F = 0; - GetEntInfo(ekansEntity)->unk15F = 0; - GetEntInfo(medichamEntity)->unk15F = 0; -} - -void sub_8087230(void) -{ - Entity *leaderEntity; - Entity *zapdosEntity; - - leaderEntity = xxx_call_GetLeader(); - zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); - DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); - sub_8085374(); - sub_80854D4(); - sub_8085930(4); - sub_80855E4(sub_8086A3C); - SetFacingDirection(zapdosEntity, DIRECTION_SOUTH); - sub_8086A3C(zapdosEntity); - sub_8085860(leaderEntity->pos.x, leaderEntity->pos.y - 3); - CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SHIFTRY); - CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_ZAPDOS); -} - -void sub_808729C(void) -{ - Entity *leaderEntity; - Entity *zapdosEntity; - - leaderEntity = xxx_call_GetLeader(); - zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); - sub_80854D4(); - sub_8085930(4); - sub_80855E4(sub_8086A3C); - if (sub_8086AE4(0x91) != 0) { - sub_8068FE0(zapdosEntity,0x21c,0); - } - else { - sub_8072008(zapdosEntity,zapdosEntity,gZapdosConfigLevel,0,0); - SetFacingDirection(zapdosEntity,DIRECTION_SOUTH); - sub_8086A3C(zapdosEntity); - } - sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3); - CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SHIFTRY); - CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], 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 = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); - 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); - GetEntInfo(partnerEntity)->unk15F = 1; - while(sub_8085B80(&auStack_78)) { - DungeonRunFrameActions(0x46); - } - - GetEntInfo(partnerEntity)->unk15F = 0; - GetEntInfo(partnerEntity)->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); - GetEntInfo(partnerEntity)->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)) { - DungeonRunFrameActions(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; - Entity *zapdosEntity; - - leaderEntity = xxx_call_GetLeader(); - zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); - sub_8086448(); - sub_803E708(10,0x46); - DisplayDungeonDialogue(gZapdosReFightDialogue_1); - sub_803E708(10,0x46); - PlaySoundEffect(0x1da); - DisplayDungeonDialogue(&gUnknown_81015A0); - sub_803E708(10,0x46); - ZapdosDropInEffect(zapdosEntity); - sub_803E708(10,0x46); - DisplayDungeonDialogue(&gZapdosReFightDialogue_2); - ZapdosScreenFlash(1); - DisplayDungeonDialogue(&gZapdosReFightDialogue_3); - ZapdosScreenFlash(2); - DisplayDungeonDialogue(&gZapdosReFightDialogue_4); - SetupBossFightHP(zapdosEntity,300,MUS_BOSS_BATTLE); - ShiftCameraToPosition(&leaderEntity->pixelPos,0x10); -} - -void ZapdosPostStoryPreFightDialogue(void) -{ - Entity * leaderEntity; - Entity * zapdosEntity; - - leaderEntity = xxx_call_GetLeader(); - zapdosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ZAPDOS); - sub_8086448(); - if (sub_8086AE4(MONSTER_ZAPDOS)) { - sub_80866C4(&gZapdosPostStoryPreFightDialogue_6); - } - else { - ZapdosScreenFlash(1); - PlaySoundEffect(0x1da); - DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_1); - ZapdosDropInEffect(zapdosEntity); - DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_2); - ZapdosScreenFlash(1); - DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_3); - ZapdosScreenFlash(2); - DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_4); - ZapdosScreenFlash(2); - DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_5); - sub_803E708(10,0x46); - SetupBossFightHP(zapdosEntity,300,MUS_BOSS_BATTLE); - ShiftCameraToPosition(&leaderEntity->pixelPos,0x10); - } -} +// FILE SPLIT -void ZapdosDropInEffect(Entity *zapdosEntity) -{ - int iVar1; +// FILE SPLIT - GetEntInfo(zapdosEntity)->unk15C = 1; - GetEntInfo(zapdosEntity)->unk15E = 0; - GetEntInfo(zapdosEntity)->unk174.raw = 200; // incorrect value? Overwritten immediately anyway - PlaySoundEffect(0x1ea); - for(iVar1 = 200; iVar1 >= 0; iVar1 -= 5) - { - GetEntInfo(zapdosEntity)->unk174 = IntToF248_2(iVar1); - DungeonRunFrameActions(0x46); - } - sub_803E708(0x1e,0x46); -} -void ZapdosScreenFlash(s32 numFlashes) -{ - s32 index; - - PlaySoundEffect(0x1f6); - if (2 < numFlashes) { - for(index = 250; index > 199; index -= 10) - { - SetDungeonBGColorRGB(index,index,index / 2,1,1); - DungeonRunFrameActions(0x46); - } - } - if (1 < numFlashes) { - for(index = 250; index > 199; index -= 10) - { - SetDungeonBGColorRGB(index,index,index / 2,1,1); - DungeonRunFrameActions(0x46); - } - } - for(index = 250; index >= 0; index -= 10) - { - SetDungeonBGColorRGB(index,index,index / 4,1,1); - DungeonRunFrameActions(0x46); - } - sub_8085EB0(); -} +// FILE SPLIT void sub_80877E8(void) { @@ -809,7 +266,6 @@ void MoltresPreFightDialogue(void) ShiftCameraToPosition(&leaderEntity->pixelPos,0x10); } - void MoltresReFightDialogue(void) { Entity *leaderEntity;