More decomp of cutscene and rewrite JirachiWish cleaner

This commit is contained in:
Seth Barberee
2023-06-19 12:07:31 -07:00
parent 260d2c8726
commit 039955d796
3 changed files with 313 additions and 529 deletions

View File

@@ -5,459 +5,6 @@
.text
thumb_func_start sub_8086F54
sub_8086F54:
push {r4-r6,lr}
lsls r0, 24
lsrs r6, r0, 24
lsls r1, 24
movs r0, 0xFC
lsls r0, 24
adds r1, r0
lsrs r1, 24
cmp r1, 0x1
bhi _08086FA8
movs r5, 0
_08086F6A:
ldr r0, _08086FB0
ldr r0, [r0]
lsls r1, r5, 2
ldr r2, _08086FB4
adds r0, r2
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityExists
lsls r0, 24
cmp r0, 0
beq _08086F8E
ldr r0, [r4, 0x70]
adds r0, 0xA4
ldrb r0, [r0]
cmp r0, r6
bne _08086FA8
_08086F8E:
adds r5, 0x1
cmp r5, 0xF
ble _08086F6A
movs r0, 0
cmp r0, 0
bne _08086FA8
movs r0, 0x3
bl sub_8097FA8
ldr r0, _08086FB0
ldr r1, [r0]
movs r0, 0x1
strb r0, [r1, 0x2]
_08086FA8:
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08086FB0: .4byte gDungeon
_08086FB4: .4byte 0x0001358c
thumb_func_end sub_8086F54
thumb_func_start TeamMeaniesPreFightDialogue
TeamMeaniesPreFightDialogue:
push {r4,lr}
bl xxx_call_GetLeader
adds r4, r0, 0
bl sub_8086448
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
ldr r0, _08087048
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
ldr r0, _0808704C
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
bl sub_8087144
movs r0, 0xA
bl DungeonStartNewBGM
ldr r0, _08087050
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
ldr r0, _08087054
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
ldr r0, _08087058
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
ldr r0, _0808705C
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
ldr r0, _08087060
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
adds r4, 0xC
adds r0, r4, 0
movs r1, 0x10
bl ShiftCameraToPosition
pop {r4}
pop {r0}
bx r0
.align 2, 0
_08087048: .4byte gTeamMeaniesPreFightDialogue_1
_0808704C: .4byte gTeamMeaniesPreFightDialogue_2
_08087050: .4byte gTeamMeaniesPreFightDialogue_3
_08087054: .4byte gTeamMeaniesPreFightDialogue_4
_08087058: .4byte gTeamMeaniesPreFightDialogue_5
_0808705C: .4byte gTeamMeaniesPreFightDialogue_6
_08087060: .4byte gTeamMeaniesPreFightDialogue_7
thumb_func_end TeamMeaniesPreFightDialogue
thumb_func_start TeamMeaniesReFightDialogue
TeamMeaniesReFightDialogue:
push {r4,r5,lr}
bl xxx_call_GetLeader
adds r4, r0, 0
bl GetPartnerEntity
adds r5, r0, 0
bl sub_8086448
ldr r0, _08087118
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
ldr r0, _0808711C
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
bl sub_8087144
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
ldr r0, _08087120
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
ldr r0, _08087124
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
adds r0, r4, 0
movs r1, 0x6
movs r2, 0x4
bl sub_806CDD4
adds r0, r5, 0
movs r1, 0x6
movs r2, 0x4
bl sub_806CDD4
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
adds r0, r4, 0
movs r1, 0x7
movs r2, 0x4
bl sub_806CDD4
adds r0, r5, 0
movs r1, 0x7
movs r2, 0x4
bl sub_806CDD4
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
ldr r0, _08087128
bl DisplayDungeonDialogue
ldr r0, _0808712C
bl DisplayDungeonDialogue
movs r0, 0xA
movs r1, 0x46
bl sub_803E708
adds r4, 0xC
adds r0, r4, 0
movs r1, 0x10
bl ShiftCameraToPosition
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_08087118: .4byte gTeamMeaniesReFightDialogue_1
_0808711C: .4byte gTeamMeaniesPreFightDialogue_2
_08087120: .4byte gTeamMeaniesReFightDialogue_2
_08087124: .4byte gTeamMeaniesReFightDialogue_3
_08087128: .4byte gTeamMeaniesReFightDialogue_4
_0808712C: .4byte gTeamMeaniesReFightDialogue_5
thumb_func_end TeamMeaniesReFightDialogue
thumb_func_start sub_8087130
sub_8087130:
push {lr}
bl sub_8086448
ldr r0, _08087140
bl sub_80866C4
pop {r0}
bx r0
.align 2, 0
_08087140: .4byte gUnknown_8101440
thumb_func_end sub_8087130
thumb_func_start sub_8087144
sub_8087144:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
sub sp, 0xF0
movs r0, 0x5
bl GetEntityFromClientType
adds r7, r0, 0
movs r0, 0x6
bl GetEntityFromClientType
mov r8, r0
movs r0, 0x7
bl GetEntityFromClientType
mov r9, r0
ldr r1, _080871E0
mov r0, sp
movs r2, 0x38
bl memcpy
add r6, sp, 0x38
ldr r1, _080871E4
adds r0, r6, 0
movs r2, 0x38
bl memcpy
add r4, sp, 0x70
ldr r1, _080871E8
adds r0, r4, 0
movs r2, 0x38
bl memcpy
add r5, sp, 0xA8
mov r0, sp
str r0, [r5]
str r6, [r5, 0x4]
str r4, [r5, 0x8]
add r4, sp, 0xB4
str r7, [r4]
mov r3, r8
str r3, [r4, 0x4]
mov r0, r9
str r0, [r4, 0x8]
movs r0, 0xA
bl DungeonStartNewBGM
adds r0, r7, 0
bl sub_8086A54
mov r0, r8
bl sub_8086A54
mov r0, r9
bl sub_8086A54
add r6, sp, 0xC0
adds r0, r6, 0
adds r1, r5, 0
adds r2, r4, 0
movs r3, 0x3
bl sub_8085B4C
ldr r0, [r7, 0x70]
ldr r2, _080871EC
adds r0, r2
movs r1, 0x1
strb r1, [r0]
mov r3, r8
ldr r0, [r3, 0x70]
adds r0, r2
strb r1, [r0]
mov r3, r9
ldr r0, [r3, 0x70]
adds r0, r2
strb r1, [r0]
b _080871F6
.align 2, 0
_080871E0: .4byte gUnknown_810739C
_080871E4: .4byte gUnknown_81073D4
_080871E8: .4byte gUnknown_810740C
_080871EC: .4byte 0x0000015f
_080871F0:
movs r0, 0x46
bl sub_803E46C
_080871F6:
adds r0, r6, 0
bl sub_8085B80
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0
bne _080871F0
ldr r0, [r7, 0x70]
ldr r1, _0808722C
adds r0, r1
strb r2, [r0]
mov r3, r8
ldr r0, [r3, 0x70]
adds r0, r1
strb r2, [r0]
mov r3, r9
ldr r0, [r3, 0x70]
adds r0, r1
strb r2, [r0]
add sp, 0xF0
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_0808722C: .4byte 0x0000015f
thumb_func_end sub_8087144
thumb_func_start sub_8087230
sub_8087230:
push {r4-r6,lr}
bl xxx_call_GetLeader
adds r6, r0, 0
movs r0, 0x8
bl GetEntityFromClientType
adds r5, r0, 0
movs r0, 0x72
bl DungeonStartNewBGM
bl sub_8085374
bl sub_80854D4
movs r0, 0x4
bl sub_8085930
ldr r4, _08087294
adds r0, r4, 0
bl sub_80855E4
adds r0, r5, 0
movs r1, 0
bl SetFacingDirection
adds r0, r5, 0
bl _call_via_r4
movs r1, 0x4
ldrsh r0, [r6, r1]
movs r2, 0x6
ldrsh r1, [r6, r2]
subs r1, 0x3
bl sub_8085860
ldr r4, _08087298
movs r1, 0x96
lsls r1, 1
adds r0, r4, 0
bl CopyMonsterNametoBuffer
adds r4, 0x50
adds r0, r4, 0
movs r1, 0x91
bl CopyMonsterNametoBuffer
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08087294: .4byte sub_8086A3C
_08087298: .4byte gUnknown_202E038
thumb_func_end sub_8087230
thumb_func_start sub_808729C
sub_808729C:
push {r4-r6,lr}
sub sp, 0x4
bl xxx_call_GetLeader
adds r5, r0, 0
movs r0, 0x8
bl GetEntityFromClientType
adds r4, r0, 0
bl sub_80854D4
movs r0, 0x4
bl sub_8085930
ldr r6, _080872DC
adds r0, r6, 0
bl sub_80855E4
movs r0, 0x91
bl sub_8086AE4
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0
beq _080872E0
movs r1, 0x87
lsls r1, 2
adds r0, r4, 0
movs r2, 0
bl sub_8068FE0
b _08087300
.align 2, 0
_080872DC: .4byte sub_8086A3C
_080872E0:
ldr r0, _0808732C
movs r3, 0
ldrsh r2, [r0, r3]
str r1, [sp]
adds r0, r4, 0
adds r1, r4, 0
movs r3, 0
bl sub_8072008
adds r0, r4, 0
movs r1, 0
bl SetFacingDirection
adds r0, r4, 0
bl _call_via_r6
_08087300:
movs r1, 0x4
ldrsh r0, [r5, r1]
movs r2, 0x6
ldrsh r1, [r5, r2]
subs r1, 0x3
bl sub_8085860
ldr r4, _08087330
movs r1, 0x96
lsls r1, 1
adds r0, r4, 0
bl CopyMonsterNametoBuffer
adds r4, 0x50
adds r0, r4, 0
movs r1, 0x91
bl CopyMonsterNametoBuffer
add sp, 0x4
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_0808732C: .4byte gUnknown_80F57CC
_08087330: .4byte gUnknown_202E038
thumb_func_end sub_808729C
thumb_func_start sub_8087334
sub_8087334:
push {lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 24
movs r2, 0xF9
lsls r2, 24
adds r1, r2
lsrs r1, 24
cmp r1, 0x2
bhi _0808735A
cmp r0, 0x8
bne _0808735A
movs r0, 0x5
bl sub_8097FA8
ldr r0, _08087360
ldr r1, [r0]
movs r0, 0x1
strb r0, [r1, 0x2]
_0808735A:
pop {r0}
bx r0
.align 2, 0
_08087360: .4byte gDungeon
thumb_func_end sub_8087334
thumb_func_start ZapdosPreFightDialogue
ZapdosPreFightDialogue:
push {r4-r7,lr}

View File

@@ -408,7 +408,7 @@ extern void sub_808692C();
extern void sub_80868F4();
extern void sub_8086910();
extern u32 sub_8085EC8(u32, u32, u32, u32 *, u32);
extern u32 sub_8085EC8(u32, u32, u32, struct Position *, u32);
extern void sub_808680C();
extern void sub_808682C();
extern void sub_8086854();
@@ -487,8 +487,8 @@ extern s32 sub_8052C68(u32, u8 *, u32 *, u32);
extern void sub_80861A8(void);
extern void sub_8045C28(struct Item *, u8 , u8 *);
extern void sub_808BD38(void);
extern void sub_808BB3C(s16 *);
extern void sub_8046860(struct Entity *, s32 *, struct Item *, u32);
extern void sub_808BB3C(struct Position *);
extern void sub_8046860(struct Entity *, struct Position *, struct Item *, u32);
extern u32 sub_803D73C(u32);
void ZapdosReFightDialogue(void)
@@ -562,20 +562,20 @@ void ZapdosDropInEffect(struct Entity *zapdosEntity)
sub_803E708(0x1e,0x46);
}
void ZapdosScreenFlash(s32 param_1)
void ZapdosScreenFlash(s32 numFlashes)
{
s32 iVar1;
s32 iVar2;
PlaySoundEffect(0x1f6);
if (2 < param_1) {
if (2 < numFlashes) {
for(iVar2 = 250; iVar2 > 199; iVar2 -= 10)
{
SetDungeonBGColorRGB(iVar2,iVar2,iVar2 / 2,1,1);
sub_803E46C(0x46);
}
}
if (1 < param_1) {
if (1 < numFlashes) {
for(iVar2 = 250; iVar2 > 199; iVar2 -= 10)
{
SetDungeonBGColorRGB(iVar2,iVar2,iVar2 / 2,1,1);
@@ -594,8 +594,6 @@ void ZapdosScreenFlash(s32 param_1)
sub_8085EB0();
}
void sub_80877E8(void)
{
struct Entity * LeaderEntity;
@@ -643,8 +641,6 @@ void sub_8087848(void)
CopyMonsterNametoBuffer(gUnknown_202E038,MONSTER_MOLTRES);
}
void sub_80878F4(char param_1, s32 param_2)
{
if ((((param_2 * 0x1000000) + 0xF6000000U) >> 0x18 < 3) && (param_1 == 0x9)) {
@@ -2101,15 +2097,15 @@ void sub_808974C(void)
void sub_8089788(struct Entity *param_1, u8 param_2, s32 param_3)
{
struct Entity *iVar2;
s32 iVar3;
s32 index;
u32 unk1;
unk1 = 0;
if ((((param_3 * 0x1000000) + 0xe6000000U) >> 0x18) < 2) {
for(iVar3 = 0; iVar3 < DUNGEON_MAX_WILD_POKEMON; iVar3++)
for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++)
{
iVar2 = gDungeon->wildPokemon[iVar3];
iVar2 = gDungeon->wildPokemon[index];
if ((EntityExists(iVar2) != '\0') && (iVar2 != param_1) && (iVar2->info->clientType == param_2)) {
return;
}
@@ -3047,14 +3043,15 @@ void LatiosPreFightDialogue(void)
struct Entity * LeaderEntity;
struct Entity * LatiosEntity;
struct Position32 local_18;
u32 local_19;
struct Position local_19;
LeaderEntity = xxx_call_GetLeader();
LatiosEntity = GetEntityFromClientType(0x16);
local_18.x = LatiosEntity->pixelPos.x;
local_18.y = LatiosEntity->pixelPos.y + (0x80 << 6);
local_19 = 0x7000fc;
local_19.y = 0x70;
local_19.x = 0xFC;
sub_8085EC8(0x1bd,0,0,&local_19,1);
sub_803E708(0x1e,70);
@@ -3694,15 +3691,12 @@ void JirachiWish(void)
s32 counter;
u32 direction;
s32 index;
struct Item money [9];
struct Item auStack152 [9];
struct Item itemStack [9];
struct Item strengthItems [9];
s32 local_2c;
s32 local_28;
s32 local_24;
s32 temp;
s32 temp2;
s32 temp3;
struct Position pos1;
struct Position pos2;
struct Position pos3;
JirachiEntity = GetEntityFromClientType(0x1a);
CopyMonsterNametoBuffer(gUnknown_202E038, MONSTER_JIRACHI);
@@ -3749,25 +3743,20 @@ void JirachiWish(void)
DisplayDungeonDialogue(&gUnknown_810581C);
sub_803E708(10,0x46);
JirachiWishGrantDialogue(JirachiEntity);
for(counter = 0; counter < 6; counter = r8)
{
r8 = counter + 1;
for(index = 0; index < 9; index++)
{
sub_8045C28(&money[index], 0x69, 0);
sub_8045C28(&auStack152[index], 0x69, 0);
}
temp = (u16)(((((u16)JirachiEntity->pos.x + DungeonRandInt(3)) - 1) << 16) >> 16);
local_2c &= 0xffff0000;
local_2c |= temp;
temp = ((u16)JirachiEntity->pos.y + DungeonRandInt(3) + -1) * 0x10000;
local_2c &= 0xffff;
local_2c |= temp;
if ((GetTileSafe((s16)local_2c, local_2c >> 16)->terrainType & 3) != 0) {
pos1.x = (JirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos1.y = (JirachiEntity->pos.y + DungeonRandInt(3) + -1);
if ((GetTileSafe(pos1.x, pos1.y)->terrainType & 3) != 0) {
PlaySoundEffect(0x14c);
sub_808BB3C((s16 *)&local_2c);
sub_8046860(JirachiEntity,&local_2c,money,9);
sub_808BB3C(&pos1);
sub_8046860(JirachiEntity,&pos1,auStack152,9);
}
}
JirachiEntity->info->unk15D = 0;
@@ -3787,17 +3776,13 @@ void JirachiWish(void)
{
sub_8045C28(&itemStack[index], sub_803D73C(0),0);
}
temp2 = (u16)(((((u16)JirachiEntity->pos.x + DungeonRandInt(3)) - 1) << 16) >> 16);
local_28 &= 0xffff0000;
local_28 |= temp2;
temp2 = ((u16)JirachiEntity->pos.y + DungeonRandInt(3) + -1) * 0x10000;
local_28 &= 0xffff;
local_28 |= temp2;
if ((GetTileSafe((s16)local_28, local_28 >> 16)->terrainType & 3) != 0) {
pos2.x = (JirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos2.y = (JirachiEntity->pos.y + DungeonRandInt(3) + -1);
if ((GetTileSafe(pos2.x, pos2.y)->terrainType & 3) != 0) {
PlaySoundEffect(400);
sub_808BB3C((s16 *)&local_28);
sub_8046860(JirachiEntity,&local_28,itemStack,9);
sub_808BB3C(&pos2);
sub_8046860(JirachiEntity,&pos2,itemStack,9);
}
}
JirachiEntity->info->unk15D = 0;
@@ -3836,25 +3821,22 @@ void JirachiWish(void)
DisplayDungeonDialogue(&gUnknown_8105BA8);
sub_803E708(10,0x46);
JirachiWishGrantDialogue(JirachiEntity);
for(counter = 0; counter < 5; counter++)
{
for(index = 0; index < 4; index++)
{
sub_8045C28(&strengthItems[index],gUnknown_81074FC[DungeonRandInt(8)],0);
}
temp3 = (u16)(((((u16)JirachiEntity->pos.x + DungeonRandInt(3)) - 1) << 16) >> 16);
local_24 &= 0xffff0000;
local_24 |= temp3;
temp3 = ((u16)JirachiEntity->pos.y + DungeonRandInt(3) + -1) * 0x10000;
local_24 &= 0xffff;
local_24 |= temp3;
if ((GetTileSafe((s16)local_24, local_24 >> 16)->terrainType & 3) != 0) {
pos3.x = (JirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos3.y = (JirachiEntity->pos.y + DungeonRandInt(3) + -1);
if ((GetTileSafe(pos3.x, pos3.y)->terrainType & 3) != 0) {
PlaySoundEffect(400);
sub_808BB3C((s16 *)&local_24);
sub_8046860(JirachiEntity,&local_24,strengthItems,4);
sub_808BB3C(&pos3);
sub_8046860(JirachiEntity,&pos3,strengthItems,4);
}
}
JirachiEntity->info->unk15D = 0;
@@ -3931,37 +3913,27 @@ void JirachiWishGrantFlash(void)
sub_8085EB0();
}
void sub_808BB3C(s16 *param_1)
void sub_808BB3C(struct Position *param_1)
{
#ifndef NONMATCHING
register s32 iVar1 asm("r0");
#else
s32 iVar1;
#endif
s32 uVar2;
u32 local_8;
struct Position local_8;
iVar1 = param_1[0] * 0x1800 + 0xc00;
iVar1 = param_1->x * 0x1800 + 0xc00;
if (iVar1 < 0) {
iVar1 += 0xff;
}
local_8.x = iVar1 >> 8;
iVar1 = param_1->y * 0x1800 + 0x1000;
if (iVar1 < 0) {
iVar1 += 0xff;
}
iVar1 <<= 8;
iVar1 = (u16)(iVar1 >> 16);
uVar2 = (local_8 & 0xffff0000) | iVar1;
local_8 = uVar2;
iVar1 = param_1[1] * 0x1800 + 0x1000;
if (iVar1 < 0) {
iVar1 += 0xff;
}
iVar1 <<= 8;
iVar1 = (u16)(iVar1 >> 0x10);
iVar1 <<= 0x10;
local_8 = (iVar1) | (uVar2 & 0x0000ffff);
local_8.y = iVar1 >> 8;
sub_8085EC8(100,0,0,&local_8,0);
}

View File

@@ -1,3 +1,4 @@
#include "constants/monster.h"
#include "global.h"
#include "constants/bg_music.h"
#include "constants/direction.h"
@@ -7,6 +8,7 @@
#include "dungeon_pokemon_attributes.h"
#include "pokemon.h"
#include "dungeon_util_1.h"
#include "dungeon_util.h"
extern struct Entity *GetPartnerEntity();
extern struct Entity *xxx_call_GetLeader(void);
@@ -30,7 +32,18 @@ extern void SkarmoryEntry(struct Entity *);
extern void SpriteLookAroundEffect(struct Entity *);
extern void sub_8086A54(struct Entity *);
extern void sub_808563C(void *);
extern void sub_8087144();
void sub_80866C4(u8 *);
extern void sub_8072008(struct Entity *pokemon, struct Entity *r1, u32 r2, u8 r3, u32);
extern bool8 sub_8085B80(u8 *);
extern void sub_8085B4C(u8 *, void *, struct Entity **, u32);
extern void sub_803E46C(u32);
extern u8 gUnknown_810739C[];
extern u8 gUnknown_81073D4[];
extern u8 gUnknown_810740C[];
extern s16 gUnknown_80F57CC;
extern u8 gUnknown_8101440[];
extern u8 gSkarmoryPreFightDialogue_1;
extern u8 gSkarmoryPreFightDialogue_2;
extern u8 gSkarmoryPreFightDialogue_3;
@@ -43,6 +56,19 @@ extern u8 gSkarmoryPreFightDialogue_9;
extern u8 gSkarmoryReFightDialogue_1;
extern u8 gSkarmoryReFightDialogue_2;
extern u8 gSkarmoryReFightDialogue_3;
extern u8 gTeamMeaniesPreFightDialogue_1;
extern u8 gTeamMeaniesPreFightDialogue_2;
extern u8 gTeamMeaniesPreFightDialogue_3;
extern u8 gTeamMeaniesPreFightDialogue_4;
extern u8 gTeamMeaniesPreFightDialogue_5;
extern u8 gTeamMeaniesPreFightDialogue_6;
extern u8 gTeamMeaniesPreFightDialogue_7;
extern u8 gTeamMeaniesReFightDialogue_1;
extern u8 gTeamMeaniesReFightDialogue_2;
extern u8 gTeamMeaniesReFightDialogue_3;
extern u8 gTeamMeaniesReFightDialogue_4;
extern u8 gTeamMeaniesReFightDialogue_5;
extern u8 gUnknown_8100D3C;
void sub_8086A3C(struct Entity *pokemon)
@@ -117,7 +143,7 @@ void sub_8086B14(void)
sub_80855E4(sub_8086A3C);
sub_8086A3C(SkarmoryEntity);
DiglettEntity->info->unk15C = 1;
sub_8085860(LeaderEntity->pos.x,LeaderEntity->pos.y + -2);
sub_8085860(LeaderEntity->pos.x,LeaderEntity->pos.y - 2);
CopyMonsterNametoBuffer(gUnknown_202E038,MONSTER_DIGLETT);
CopyMonsterNametoBuffer(gUnknown_202E038 + 0x50, MONSTER_SKARMORY);
}
@@ -279,3 +305,242 @@ void sub_8086F00(void)
CopyMonsterNametoBuffer(gUnknown_202E038 + 0x50, MONSTER_GENGAR);
CopyMonsterNametoBuffer(gUnknown_202E038 + 0xA0, MONSTER_CATERPIE);
}
// https://decomp.me/scratch/bLnx3 (94.46 %)
#ifdef NONMATCHING
void sub_8086F54(u8 param_1, s32 param_2)
{
struct Entity *entity;
s32 index;
u32 unk1;
register u32 param_1_u8 asm("r6") = param_1;
unk1 = 0;
if ((((param_2 * 0x1000000) + 0xfc000000U) >> 0x18) < 2) {
for(index = 0; index < 0x10; index++)
{
entity = gDungeon->wildPokemon[index];
if ((EntityExists(entity)) && (entity->info->clientType != param_1_u8)) {
return;
}
}
if(!unk1)
{
sub_8097FA8(3);
gDungeon->unk2 = 1;
}
}
}
#else
NAKED
void sub_8086F54(u8 param_1, s32 param_2)
{
asm_unified(
"\tpush {r4-r6,lr}\n"
"\tlsls r0, 24\n"
"\tlsrs r6, r0, 24\n"
"\tlsls r1, 24\n"
"\tmovs r0, 0xFC\n"
"\tlsls r0, 24\n"
"\tadds r1, r0\n"
"\tlsrs r1, 24\n"
"\tcmp r1, 0x1\n"
"\tbhi _08086FA8\n"
"\tmovs r5, 0\n"
"_08086F6A:\n"
"\tldr r0, _08086FB0\n"
"\tldr r0, [r0]\n"
"\tlsls r1, r5, 2\n"
"\tldr r2, _08086FB4\n"
"\tadds r0, r2\n"
"\tadds r0, r1\n"
"\tldr r4, [r0]\n"
"\tadds r0, r4, 0\n"
"\tbl EntityExists\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbeq _08086F8E\n"
"\tldr r0, [r4, 0x70]\n"
"\tadds r0, 0xA4\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, r6\n"
"\tbne _08086FA8\n"
"_08086F8E:\n"
"\tadds r5, 0x1\n"
"\tcmp r5, 0xF\n"
"\tble _08086F6A\n"
"\tmovs r0, 0\n"
"\tcmp r0, 0\n"
"\tbne _08086FA8\n"
"\tmovs r0, 0x3\n"
"\tbl sub_8097FA8\n"
"\tldr r0, _08086FB0\n"
"\tldr r1, [r0]\n"
"\tmovs r0, 0x1\n"
"\tstrb r0, [r1, 0x2]\n"
"_08086FA8:\n"
"\tpop {r4-r6}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.align 2, 0\n"
"_08086FB0: .4byte gDungeon\n"
"_08086FB4: .4byte 0x0001358c");
}
#endif
void TeamMeaniesPreFightDialogue(void)
{
struct 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)
{
struct Entity *LeaderEntity;
struct 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)
{
struct Entity *iVar2;
struct Entity *iVar3;
struct Entity *iVar4;
u8 auStack_10c [56];
u8 puStack_60[56];
u8 puStack_5c[56];
u8 *puStack_64[3];
struct Entity *pEStack_58[3];
u8 auStack_4c [48];
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)
{
struct Entity *LeaderEntity;
struct 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)
{
struct Entity *LeaderEntity;
struct 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(char param_1, s32 param_2)
{
if ((((param_2 * 0x1000000) + 0xF9000000U) >> 0x18 < 3) && (param_1 == 8)) {
sub_8097FA8(5);
gDungeon->unk2 = 1;
}
}