Merge pull request #385 from DizzyEggg/dungeon_2
Some checks are pending
GithubCI / build (push) Waiting to run

Dungeon splits - part 2
This commit is contained in:
AnonymousRandomPerson
2025-04-08 17:25:52 -04:00
committed by GitHub
137 changed files with 9943 additions and 9740 deletions

View File

@@ -1,585 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_8083660
sub_8083660:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r4, _080836D4
add sp, r4
movs r1, 0xE0
lsls r1, 5
add r1, sp
str r0, [r1]
bl GetLeader
ldr r2, _080836D8
add r2, sp
str r0, [r2]
movs r7, 0
movs r0, 0
ldr r1, _080836DC
add r1, sp
str r0, [r1]
_0808368A:
movs r0, 0x38
bl DungeonRandInt
adds r4, r0, 0
movs r0, 0x20
bl DungeonRandInt
ldr r2, _080836E0
add r2, sp
str r0, [r2]
ldr r0, _080836D8
add r0, sp
ldr r0, [r0]
ldr r3, [r0, 0x4]
adds r5, r4, 0
movs r1, 0
ldr r4, [r2]
ldr r0, _080836E4
cmp r7, r0
ble _080836B4
b _080837E6
_080836B4:
movs r2, 0x3
mov r10, r2
lsls r0, r7, 2
mov r2, sp
adds r6, r0, r2
_080836BE:
movs r0, 0
mov r8, r0
adds r2, r5, 0x1
ldr r0, _080836E8
add r0, sp
str r2, [r0]
adds r1, 0x1
ldr r2, _080836EC
add r2, sp
str r1, [r2]
b _0808379C
.align 2, 0
_080836D4: .4byte 0xffffe3e4
_080836D8: .4byte 0x00001c04
_080836DC: .4byte 0x00001c0c
_080836E0: .4byte 0x00001c08
_080836E4: .4byte 0x000006ff
_080836E8: .4byte 0x00001c14
_080836EC: .4byte 0x00001c10
_080836F0:
ldr r0, _08083738
add r0, sp
ldr r0, [r0]
cmp r0, 0
bne _0808373C
ldrh r1, [r2]
mov r0, r10
ands r0, r1
cmp r0, 0x1
bne _08083782
ldrb r0, [r2, 0x9]
cmp r0, 0xFF
beq _08083782
ldr r0, [r2, 0x14]
cmp r0, 0
bne _08083782
ldr r0, [r2, 0x10]
cmp r0, 0
bne _08083782
lsls r0, r3, 16
asrs r0, 16
subs r0, r5
cmp r0, 0
bge _08083722
negs r0, r0
_08083722:
cmp r0, 0x5
bgt _08083788
asrs r0, r3, 16
subs r0, r4
cmp r0, 0
bge _08083730
negs r0, r0
_08083730:
cmp r0, 0x5
ble _08083782
b _08083788
.align 2, 0
_08083738: .4byte 0x00001c0c
_0808373C:
ldr r1, _08083764
add r1, sp
ldr r1, [r1]
cmp r1, 0x1
bne _08083768
ldrh r1, [r2]
mov r0, r10
ands r0, r1
cmp r0, 0x1
bne _08083782
ldrb r0, [r2, 0x9]
cmp r0, 0xFF
beq _08083782
ldr r0, [r2, 0x14]
cmp r0, 0
bne _08083782
ldr r0, [r2, 0x10]
cmp r0, 0
bne _08083782
b _08083788
.align 2, 0
_08083764: .4byte 0x00001c0c
_08083768:
ldrh r1, [r2]
mov r0, r10
ands r0, r1
cmp r0, 0x1
bne _08083782
ldr r0, [r2, 0x14]
cmp r0, 0
bne _08083782
ldr r0, [r2, 0x10]
cmp r0, 0
bne _08083782
movs r2, 0x1
mov r9, r2
_08083782:
mov r0, r9
cmp r0, 0
beq _08083790
_08083788:
strb r5, [r6]
strb r4, [r6, 0x1]
adds r6, 0x4
adds r7, 0x1
_08083790:
adds r4, 0x1
cmp r4, 0x1F
ble _08083798
movs r4, 0
_08083798:
movs r1, 0x1
add r8, r1
_0808379C:
mov r2, r8
cmp r2, 0x1F
bgt _080837C2
movs r0, 0
mov r9, r0
adds r0, r5, 0
adds r1, r4, 0
ldr r2, _0808380C
add r2, sp
str r3, [r2]
bl GetTile
adds r2, r0, 0
ldr r0, _08083810
ldr r1, _0808380C
add r1, sp
ldr r3, [r1]
cmp r7, r0
ble _080836F0
_080837C2:
ldr r2, _08083814
add r2, sp
ldr r5, [r2]
cmp r5, 0x37
ble _080837CE
movs r5, 0
_080837CE:
ldr r0, _08083818
add r0, sp
ldr r1, [r0]
cmp r1, 0x37
bgt _080837E6
ldr r2, _0808381C
add r2, sp
ldr r4, [r2]
ldr r0, _08083810
cmp r7, r0
bgt _080837E6
b _080836BE
_080837E6:
cmp r7, 0
beq _08083820
adds r0, r7, 0
bl DungeonRandInt
lsls r0, 2
mov r2, sp
adds r1, r2, r0
ldrb r0, [r1]
movs r2, 0xE0
lsls r2, 5
add r2, sp
ldr r2, [r2]
strh r0, [r2]
ldrb r0, [r1, 0x1]
strh r0, [r2, 0x2]
movs r0, 0x1
b _08083832
.align 2, 0
_0808380C: .4byte 0x00001c18
_08083810: .4byte 0x000006ff
_08083814: .4byte 0x00001c14
_08083818: .4byte 0x00001c10
_0808381C: .4byte 0x00001c08
_08083820:
ldr r0, _08083844
add r0, sp
ldr r2, [r0]
adds r2, 0x1
str r2, [r0]
cmp r2, 0x2
bgt _08083830
b _0808368A
_08083830:
movs r0, 0
_08083832:
ldr r3, _08083848
add sp, r3
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
.align 2, 0
_08083844: .4byte 0x00001c0c
_08083848: .4byte 0x00001c1c
thumb_func_end sub_8083660
thumb_func_start sub_808384C
sub_808384C:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
sub sp, 0x4
adds r3, r0, 0
mov r9, r1
movs r0, 0
mov r8, r0
ldr r0, _080838BC
movs r2, 0
ldrsh r1, [r0, r2]
cmp r1, 0x63
beq _080838D8
movs r6, 0
_0808386A:
adds r2, r6, r0
movs r4, 0
ldrsh r1, [r2, r4]
mov r5, r9
movs r7, 0
ldrsh r0, [r5, r7]
adds r5, r1, r0
movs r0, 0x2
ldrsh r1, [r2, r0]
mov r2, r9
movs r4, 0x2
ldrsh r0, [r2, r4]
adds r4, r1, r0
adds r0, r5, 0
adds r1, r4, 0
str r3, [sp]
bl GetTile
adds r1, r0, 0
ldrh r2, [r1]
movs r7, 0x80
lsls r7, 4
adds r0, r7, 0
ands r0, r2
ldr r3, [sp]
cmp r0, 0
bne _080838C0
movs r0, 0x3
ands r0, r2
cmp r0, 0x1
bne _080838C0
ldr r0, [r1, 0x14]
cmp r0, 0
bne _080838C0
ldr r0, [r1, 0x10]
cmp r0, 0
bne _080838C0
strh r5, [r3]
strh r4, [r3, 0x2]
movs r0, 0x1
b _080838DA
.align 2, 0
_080838BC: .4byte gUnknown_80F4468
_080838C0:
adds r6, 0x4
movs r0, 0x1
add r8, r0
mov r2, r8
cmp r2, 0x18
bgt _080838D8
ldr r0, _080838E8
adds r1, r6, r0
movs r4, 0
ldrsh r1, [r1, r4]
cmp r1, 0x63
bne _0808386A
_080838D8:
movs r0, 0
_080838DA:
add sp, 0x4
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r1}
bx r1
.align 2, 0
_080838E8: .4byte gUnknown_80F4468
thumb_func_end sub_808384C
thumb_func_start sub_80838EC
sub_80838EC:
push {lr}
adds r2, r0, 0
ldrb r0, [r2]
adds r1, r0, 0
cmp r1, 0x7F
beq _08083900
cmp r1, 0
beq _08083900
subs r0, 0x1
strb r0, [r2]
_08083900:
pop {r0}
bx r0
thumb_func_end sub_80838EC
thumb_func_start sub_8083904
sub_8083904:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x20
str r0, [sp]
mov r10, r1
ldr r4, [r1, 0x70]
str r4, [sp, 0x4]
adds r5, r4, 0
adds r5, 0x46
ldrb r6, [r5]
mov r0, r10
movs r1, 0x1
bl CheckVariousStatuses2
lsls r0, 24
cmp r0, 0
beq _08083954
ldr r0, _08083950
lsls r2, r6, 2
adds r2, r0
movs r0, 0
ldrsh r1, [r2, r0]
lsls r0, r1, 1
adds r0, r1
mov r1, r10
ldrh r1, [r1, 0x4]
adds r0, r1
ldr r3, [sp]
strh r0, [r3]
movs r4, 0x2
ldrsh r1, [r2, r4]
lsls r0, r1, 1
adds r0, r1
b _08083A6E
.align 2, 0
_08083950: .4byte gAdjacentTileOffsets
_08083954:
ldr r1, [r4, 0x58]
movs r0, 0x1
negs r0, r0
cmp r1, r0
beq _08083960
b _08083A8C
_08083960:
ldrb r0, [r5]
ldr r1, _080839A0
lsls r0, 3
adds r0, r1
ldr r7, [r0]
movs r3, 0x4
ldrsh r2, [r0, r3]
str r2, [sp, 0x8]
movs r2, 0x6
ldrsh r1, [r0, r2]
str r1, [sp, 0xC]
mov r3, r10
movs r0, 0x4
ldrsh r3, [r3, r0]
str r3, [sp, 0x10]
mov r1, r10
movs r2, 0x6
ldrsh r1, [r1, r2]
str r1, [sp, 0x14]
ldr r0, _080839A4
ldr r1, [r0]
ldr r3, _080839A8
adds r0, r1, r3
ldrb r0, [r0]
cmp r0, 0
beq _080839B0
ldr r4, _080839AC
adds r4, r1, r4
str r4, [sp, 0x18]
movs r0, 0x14
b _080839D0
.align 2, 0
_080839A0: .4byte gUnknown_80F4CC4
_080839A4: .4byte gDungeon
_080839A8: .4byte 0x000037fc
_080839AC: .4byte 0x000135cc
_080839B0:
ldrb r0, [r4, 0x6]
cmp r0, 0
bne _080839C8
ldr r2, _080839C4
adds r2, r1, r2
str r2, [sp, 0x18]
movs r3, 0x10
str r3, [sp, 0x1C]
b _080839D2
.align 2, 0
_080839C4: .4byte 0x0001358c
_080839C8:
ldr r4, _08083A78
adds r4, r1, r4
str r4, [sp, 0x18]
movs r0, 0x4
_080839D0:
str r0, [sp, 0x1C]
_080839D2:
movs r1, 0
ldrsh r0, [r7, r1]
cmp r0, 0x63
beq _08083A46
_080839DA:
movs r2, 0
ldrsh r0, [r7, r2]
ldr r3, [sp, 0x8]
muls r0, r3
ldr r4, [sp, 0x10]
adds r4, r0
mov r9, r4
movs r1, 0x2
ldrsh r0, [r7, r1]
ldr r2, [sp, 0xC]
muls r0, r2
ldr r3, [sp, 0x14]
adds r3, r0
mov r8, r3
movs r6, 0
ldr r4, [sp, 0x1C]
cmp r6, r4
bge _08083A3C
ldr r5, [sp, 0x18]
_08083A00:
ldr r4, [r5]
adds r0, r4, 0
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _08083A32
movs r1, 0x4
ldrsh r0, [r4, r1]
cmp r0, r9
bne _08083A32
movs r2, 0x6
ldrsh r0, [r4, r2]
cmp r0, r8
bne _08083A32
mov r0, r10
adds r1, r4, 0
movs r2, 0
movs r3, 0
bl GetTreatmentBetweenMonsters
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _08083A80
_08083A32:
adds r5, 0x4
adds r6, 0x1
ldr r3, [sp, 0x1C]
cmp r6, r3
blt _08083A00
_08083A3C:
adds r7, 0x4
movs r4, 0
ldrsh r0, [r7, r4]
cmp r0, 0x63
bne _080839DA
_08083A46:
ldr r2, _08083A7C
ldr r1, [sp, 0x4]
adds r1, 0x46
ldrb r0, [r1]
lsls r0, 2
adds r0, r2
movs r3, 0
ldrsh r0, [r0, r3]
lsls r0, 1
mov r4, r10
ldrh r4, [r4, 0x4]
adds r0, r4
ldr r3, [sp]
strh r0, [r3]
ldrb r0, [r1]
lsls r0, 2
adds r0, r2
movs r4, 0x2
ldrsh r0, [r0, r4]
lsls r0, 1
_08083A6E:
mov r1, r10
ldrh r1, [r1, 0x6]
adds r0, r1
strh r0, [r3, 0x2]
b _08083A9E
.align 2, 0
_08083A78: .4byte 0x0001357c
_08083A7C: .4byte gAdjacentTileOffsets
_08083A80:
mov r3, r9
ldr r2, [sp]
strh r3, [r2]
mov r4, r8
strh r4, [r2, 0x2]
b _08083A9E
_08083A8C:
ldr r0, [sp, 0x4]
adds r0, 0x58
ldrh r0, [r0]
ldr r1, [sp]
strh r0, [r1]
ldr r0, [sp, 0x4]
adds r0, 0x5A
ldrh r0, [r0]
strh r0, [r1, 0x2]
_08083A9E:
add sp, 0x20
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8083904
.align 2, 0

View File

@@ -1,694 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_80841EC
sub_80841EC:
push {r4-r6,lr}
mov r6, r8
push {r6}
sub sp, 0xC4
add r0, sp, 0x60
mov r8, r0
movs r1, 0
movs r2, 0x60
bl memset
movs r0, 0x6
str r0, [sp, 0x64]
add r1, sp, 0x68
movs r6, 0
movs r0, 0x4
strh r0, [r1]
movs r2, 0x3
strh r2, [r1, 0x2]
add r1, sp, 0x6C
movs r0, 0x16
strh r0, [r1]
mov r0, sp
adds r0, 0x6E
movs r5, 0xE
movs r1, 0xE
strh r1, [r0]
add r0, sp, 0x70
strh r1, [r0]
add r4, sp, 0xC0
str r4, [sp, 0x74]
str r2, [sp, 0x7C]
add r0, sp, 0x90
str r2, [r0, 0x4]
add r0, sp, 0xA8
str r2, [r0, 0x4]
mov r0, sp
mov r1, r8
movs r2, 0x60
bl memcpy
movs r0, 0x1
strb r0, [r4]
strb r6, [r4, 0x1]
strb r5, [r4, 0x2]
strb r6, [r4, 0x3]
mov r1, sp
movs r0, 0x14
strh r0, [r1, 0xA]
mov r0, sp
movs r1, 0x1
bl DungeonShowWindows
ldr r0, _0808426C
ldr r0, [r0]
ldr r1, _08084270
adds r0, r1
movs r2, 0
ldrsh r1, [r0, r2]
ldr r0, _08084274
cmp r1, r0
ble _08084278
bl PlayDungeonCompleteBGM
b _0808427C
.align 2, 0
_0808426C: .4byte gDungeon
_08084270: .4byte 0x0001ceac
_08084274: .4byte 0x00000225
_08084278:
bl PlayDungeonFailBGM
_0808427C:
ldr r0, _080842B8
ldr r1, [r0]
ldr r0, _080842BC
ldr r2, [r0]
ldr r0, _080842C0
adds r2, r0
movs r0, 0
bl sub_8094558
mov r4, sp
_08084290:
movs r0, 0x36
bl sub_803E668
bl UpdateDungeonMusic
ldrh r1, [r4, 0xA]
movs r2, 0xA
ldrsh r0, [r4, r2]
cmp r0, 0x3
ble _080842C4
subs r0, r1, 0x1
strh r0, [r4, 0xA]
movs r0, 0xA0
strb r0, [r4]
mov r0, sp
movs r1, 0x1
bl DungeonShowWindows
b _08084290
.align 2, 0
_080842B8: .4byte gUnknown_80FE6E8
_080842BC: .4byte gDungeon
_080842C0: .4byte 0x0001ce98
_080842C4:
bl sub_8094D14
lsls r0, 24
cmp r0, 0
bne _080842DA
ldr r0, _080842EC
ldrh r1, [r0, 0x2]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _08084290
_080842DA:
bl PlayDungeonConfirmationSE
add sp, 0xC4
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_080842EC: .4byte gRealInputs
thumb_func_end sub_80841EC
thumb_func_start sub_80842F0
sub_80842F0:
push {r4-r7,lr}
mov r7, r8
push {r7}
ldr r1, _0808436C
ldr r0, [r1]
ldr r2, _08084370
adds r0, r2
movs r2, 0
strb r2, [r0]
ldr r0, [r1]
ldr r3, _08084374
adds r0, r3
strb r2, [r0]
ldr r0, [r1]
movs r5, 0xCF
lsls r5, 3
adds r0, r5
ldrb r0, [r0]
cmp r0, 0x2
bne _080843AE
movs r6, 0
ldr r0, _08084378
mov r8, r0
movs r7, 0x1
_08084320:
lsls r0, r6, 24
lsrs r0, 24
bl GetJobSlotInfo
adds r4, r0, 0
ldrb r0, [r4]
cmp r0, 0x6
bne _080843A8
ldr r3, _0808436C
ldr r5, [r3]
ldr r1, _0808437C
adds r0, r5, r1
ldrh r0, [r0]
ldrh r2, [r4, 0x4]
mov r1, r8
ands r1, r0
mov r0, r8
ands r0, r2
cmp r1, r0
bne _080843A8
ldrb r0, [r4, 0x1]
cmp r0, 0x3
beq _080843A8
cmp r0, 0x4
bne _08084380
ldrb r1, [r4, 0x10]
ldr r2, _08084374
adds r0, r5, r2
strb r1, [r0]
ldr r2, [r3]
ldrh r1, [r4, 0xE]
movs r3, 0xD1
lsls r3, 3
adds r0, r2, r3
strh r1, [r0]
strb r7, [r2, 0x9]
b _080843A8
.align 2, 0
_0808436C: .4byte gDungeon
_08084370: .4byte 0x00000677
_08084374: .4byte 0x0000068a
_08084378: .4byte 0x0000ffff
_0808437C: .4byte 0x00000644
_08084380:
cmp r0, 0
beq _0808438C
cmp r0, 0x2
beq _0808438C
cmp r0, 0x1
bne _080843A8
_0808438C:
ldr r2, [r3]
ldrh r0, [r4, 0xE]
movs r5, 0xD1
lsls r5, 3
adds r1, r2, r5
strh r0, [r1]
ldrb r0, [r4, 0x1]
cmp r0, 0x2
bne _080843A4
ldr r1, _080843B8
adds r0, r2, r1
strb r7, [r0]
_080843A4:
ldr r0, [r3]
strb r7, [r0, 0x9]
_080843A8:
adds r6, 0x1
cmp r6, 0x7
ble _08084320
_080843AE:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080843B8: .4byte 0x00000677
thumb_func_end sub_80842F0
thumb_func_start sub_80843BC
sub_80843BC:
push {r4-r6,lr}
lsls r0, 16
asrs r6, r0, 16
movs r4, 0
ldr r5, _08084418
_080843C6:
lsls r0, r4, 24
lsrs r0, 24
bl GetJobSlotInfo
adds r3, r0, 0
ldrb r0, [r3]
cmp r0, 0x6
bne _0808440C
ldr r0, _0808441C
ldr r0, [r0]
ldr r1, _08084420
adds r0, r1
ldrh r0, [r0]
ldrh r2, [r3, 0x4]
adds r1, r5, 0
ands r1, r0
adds r0, r5, 0
ands r0, r2
cmp r1, r0
bne _0808440C
ldrb r0, [r3, 0x1]
cmp r0, 0
beq _08084400
cmp r0, 0x4
beq _08084400
cmp r0, 0x2
beq _08084400
cmp r0, 0x1
bne _0808440C
_08084400:
movs r1, 0xE
ldrsh r0, [r3, r1]
cmp r6, r0
bne _0808440C
movs r0, 0x8
strb r0, [r3]
_0808440C:
adds r4, 0x1
cmp r4, 0x7
ble _080843C6
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08084418: .4byte 0x0000ffff
_0808441C: .4byte gDungeon
_08084420: .4byte 0x00000644
thumb_func_end sub_80843BC
thumb_func_start sub_8084424
sub_8084424:
push {r4,lr}
movs r4, 0
_08084428:
lsls r0, r4, 24
lsrs r0, 24
bl GetJobSlotInfo
adds r1, r0, 0
ldrb r0, [r1]
cmp r0, 0x8
bne _0808443C
movs r0, 0x9
strb r0, [r1]
_0808443C:
adds r4, 0x1
cmp r4, 0x7
ble _08084428
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8084424
thumb_func_start sub_8084448
sub_8084448:
push {r4-r7,lr}
adds r5, r0, 0
ldr r7, [r5, 0x70]
ldr r4, _0808447C
bl GetLeader
adds r1, r0, 0
adds r0, r4, 0
movs r2, 0
bl SubstitutePlaceholderStringTags
adds r4, 0x50
adds r0, r4, 0
adds r1, r5, 0
movs r2, 0
bl SubstitutePlaceholderStringTags
adds r0, r5, 0
bl sub_8070BC0
lsls r0, 24
cmp r0, 0
bne _08084484
ldr r0, _08084480
b _080844F0
.align 2, 0
_0808447C: .4byte gFormatBuffer_Monsters
_08084480: .4byte gUnknown_80FA464
_08084484:
ldr r4, _080844FC
ldr r0, [r4]
ldr r6, _08084500
adds r0, r6
ldrb r0, [r0]
cmp r0, 0
beq _08084540
ldr r0, _08084504
ldr r1, [r0]
movs r0, 0
movs r2, 0x1
bl DisplayDungeonYesNoMessage
cmp r0, 0x1
beq _080844A4
b _080845D4
_080844A4:
ldr r0, _08084508
ldr r1, [r4]
adds r1, r6
ldrb r1, [r1]
movs r2, 0
bl BufferItemName
movs r3, 0
ldr r0, _0808450C
adds r6, r0, 0
ldr r2, [r6]
_080844BA:
ldrb r1, [r2]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _080844E2
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _080844E2
movs r0, 0x18
ands r0, r1
cmp r0, 0x18
beq _080844E2
ldr r0, [r4]
ldr r1, _08084500
adds r0, r1
ldrb r1, [r2, 0x2]
ldrb r0, [r0]
cmp r1, r0
beq _080844EA
_080844E2:
adds r2, 0x4
adds r3, 0x1
cmp r3, 0x13
ble _080844BA
_080844EA:
cmp r3, 0x14
bne _08084514
ldr r0, _08084510
_080844F0:
ldr r1, [r0]
movs r0, 0
movs r2, 0x1
bl DisplayDungeonMessage
b _080845D4
.align 2, 0
_080844FC: .4byte gDungeon
_08084500: .4byte 0x0000068a
_08084504: .4byte gUnknown_80FA32C
_08084508: .4byte gFormatBuffer_Items
_0808450C: .4byte gTeamInventoryRef
_08084510: .4byte gUnknown_80FA448
_08084514:
lsls r1, r3, 2
ldr r0, [r6]
adds r1, r0
movs r0, 0
strb r0, [r1, 0x2]
strb r0, [r1, 0x1]
strb r0, [r1]
bl FillInventoryGaps
ldr r0, _08084538
ldr r1, [r0]
movs r0, 0
movs r2, 0x1
bl DisplayDungeonMessage
ldr r0, _0808453C
b _0808455E
.align 2, 0
_08084538: .4byte gUnknown_80FA2B0
_0808453C: .4byte gUnknown_80FA370
_08084540:
ldr r0, _080845B0
ldr r1, [r0]
movs r0, 0
movs r2, 0x1
bl DisplayDungeonYesNoMessage
cmp r0, 0x1
bne _080845D4
ldr r0, _080845B4
ldr r1, [r0]
movs r0, 0
movs r2, 0x1
bl DisplayDungeonMessage
ldr r0, _080845B8
_0808455E:
ldr r4, [r0]
movs r1, 0x2
ldrsh r0, [r7, r1]
bl sub_80843BC
adds r0, r5, 0x4
bl sub_8042A34
movs r1, 0x87
lsls r1, 2
adds r0, r5, 0
movs r2, 0
bl sub_8068FE0
movs r0, 0x1
bl sub_804178C
ldr r5, _080845BC
_08084582:
movs r0, 0
adds r1, r4, 0
movs r2, 0x1
bl DisplayDungeonYesNoMessage
cmp r0, 0x1
bne _080845C4
ldr r0, _080845C0
ldr r1, [r0]
movs r0, 0
movs r2, 0
bl DisplayDungeonYesNoMessage
adds r1, r0, 0
cmp r1, 0x1
bne _08084582
ldr r0, [r5]
strb r1, [r0, 0x4]
ldr r1, [r5]
movs r0, 0x2
strb r0, [r1, 0x11]
b _080845D4
.align 2, 0
_080845B0: .4byte gUnknown_80FA2F0
_080845B4: .4byte gUnknown_80FA260
_080845B8: .4byte gUnknown_80FA36C
_080845BC: .4byte gDungeon
_080845C0: .4byte gUnknown_80FA394
_080845C4:
ldr r0, _080845DC
ldr r1, [r0]
movs r0, 0
movs r2, 0
bl DisplayDungeonYesNoMessage
cmp r0, 0x1
bne _08084582
_080845D4:
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080845DC: .4byte gUnknown_80FA3B8
thumb_func_end sub_8084448
thumb_func_start sub_80845E0
sub_80845E0:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
adds r6, r0, 0
ldr r0, [r6, 0x70]
mov r8, r0
movs r7, 0
movs r1, 0
mov r9, r1
ldr r4, _08084620
bl GetLeader
adds r1, r0, 0
adds r0, r4, 0
movs r2, 0
bl SubstitutePlaceholderStringTags
adds r4, 0x50
adds r0, r4, 0
adds r1, r6, 0
movs r2, 0
bl SubstitutePlaceholderStringTags
adds r0, r6, 0
bl sub_8070BC0
lsls r0, 24
cmp r0, 0
bne _08084630
ldr r0, _08084624
b _080846B4
.align 2, 0
_08084620: .4byte gFormatBuffer_Monsters
_08084624: .4byte gUnknown_80FA530
_08084628:
adds r7, r4, 0
ldr r2, [r7, 0x70]
mov r9, r2
b _08084674
_08084630:
movs r5, 0
_08084632:
ldr r0, _08084660
ldr r0, [r0]
lsls r1, r5, 2
ldr r2, _08084664
adds r0, r2
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _0808466E
ldr r0, [r4, 0x70]
adds r0, 0x40
ldrb r0, [r0]
cmp r0, 0x4A
beq _0808465A
cmp r0, 0x47
bne _08084668
_0808465A:
movs r0, 0x1
b _0808466A
.align 2, 0
_08084660: .4byte gDungeon
_08084664: .4byte 0x0001357c
_08084668:
movs r0, 0
_0808466A:
cmp r0, 0
bne _08084628
_0808466E:
adds r5, 0x1
cmp r5, 0x3
ble _08084632
_08084674:
cmp r7, 0
bne _08084680
ldr r0, _0808467C
b _080846B4
.align 2, 0
_0808467C: .4byte gUnknown_80FA52C
_08084680:
ldr r0, _0808469C
adds r1, r7, 0
movs r2, 0
bl SubstitutePlaceholderStringTags
adds r0, r7, 0
bl sub_8070BC0
lsls r0, 24
cmp r0, 0
bne _080846A4
ldr r0, _080846A0
b _080846B4
.align 2, 0
_0808469C: .4byte gFormatBuffer_Monsters + 160
_080846A0: .4byte gUnknown_80FA54C
_080846A4:
adds r0, r6, 0
adds r1, r7, 0
bl CanSeeTarget
lsls r0, 24
cmp r0, 0
bne _080846C4
ldr r0, _080846C0
_080846B4:
ldr r1, [r0]
movs r0, 0
movs r2, 0x1
bl DisplayDungeonMessage
b _08084768
.align 2, 0
_080846C0: .4byte gUnknown_80FA500
_080846C4:
ldr r0, _08084744
ldr r1, [r0]
movs r0, 0
movs r2, 0x1
bl DisplayDungeonMessage
mov r1, r8
movs r2, 0x2
ldrsh r0, [r1, r2]
bl sub_80843BC
ldr r5, _08084748
ldr r0, [r5]
ldr r1, _0808474C
adds r0, r1
ldrb r1, [r0]
mov r0, r9
adds r0, 0x40
strb r1, [r0]
adds r0, r6, 0x4
bl sub_8042A34
adds r0, r7, 0x4
bl sub_8042A34
movs r4, 0x87
lsls r4, 2
adds r0, r6, 0
adds r1, r4, 0
movs r2, 0
bl sub_8068FE0
adds r0, r7, 0
adds r1, r4, 0
movs r2, 0
bl sub_8068FE0
movs r0, 0x1
bl sub_804178C
ldr r4, _08084750
_08084716:
movs r0, 0
ldr r1, [r4]
movs r2, 0x1
bl DisplayDungeonYesNoMessage
cmp r0, 0x1
bne _08084758
ldr r0, _08084754
ldr r1, [r0]
movs r0, 0
movs r2, 0
bl DisplayDungeonYesNoMessage
adds r1, r0, 0
cmp r1, 0x1
bne _08084716
ldr r0, [r5]
strb r1, [r0, 0x4]
ldr r1, [r5]
movs r0, 0x2
strb r0, [r1, 0x11]
b _08084768
.align 2, 0
_08084744: .4byte gUnknown_80FA4D4
_08084748: .4byte gDungeon
_0808474C: .4byte 0x00000644
_08084750: .4byte gUnknown_80FA4D8
_08084754: .4byte gUnknown_80FA394
_08084758:
ldr r0, _08084774
ldr r1, [r0]
movs r0, 0
movs r2, 0
bl DisplayDungeonYesNoMessage
cmp r0, 0x1
bne _08084716
_08084768:
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08084774: .4byte gUnknown_80FA3B8
thumb_func_end sub_80845E0

View File

@@ -1,310 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start SetDungeonBGColorRGB
SetDungeonBGColorRGB:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x28
str r0, [sp, 0x14]
mov r10, r1
mov r9, r2
ldr r4, [sp, 0x48]
lsls r3, 24
lsrs r3, 24
str r3, [sp, 0x18]
lsls r4, 24
lsrs r4, 24
bl sub_8085E98
movs r0, 0
mov r8, r0
ldr r0, _08085E70
ldr r0, [r0]
ldr r5, [r0, 0x4]
cmp r4, 0
beq _08085CAE
ldr r1, [sp, 0x14]
cmp r1, 0
blt _08085C92
lsrs r0, r1, 31
adds r0, r1, r0
asrs r0, 1
str r0, [sp, 0x14]
_08085C92:
mov r2, r10
cmp r2, 0
blt _08085CA0
lsrs r0, r2, 31
add r0, r10
asrs r0, 1
mov r10, r0
_08085CA0:
mov r3, r9
cmp r3, 0
blt _08085CAE
lsrs r0, r3, 31
add r0, r9
asrs r0, 1
mov r9, r0
_08085CAE:
ldr r1, _08085E74
ldr r0, [sp, 0x8]
ands r0, r1
ldr r1, _08085E78
ands r0, r1
ldr r1, _08085E7C
ands r0, r1
str r0, [sp, 0x8]
ldr r0, _08085E80
ldr r2, [r0]
ldr r0, _08085E84
ldr r3, [r0]
movs r0, 0xBE
lsls r0, 1
adds r3, r0
mov r0, r8
add r1, sp, 0x8
bl SetBGPaletteBufferColorRGB
adds r5, 0x4
movs r1, 0x1
add r8, r1
ldr r2, [sp, 0x14]
lsls r2, 16
str r2, [sp, 0x1C]
mov r3, r10
lsls r3, 16
str r3, [sp, 0x20]
mov r0, r9
lsls r0, 16
str r0, [sp, 0x24]
add r7, sp, 0xC
movs r1, 0xA0
cmp r1, 0x1
ble _08085D56
add r6, sp, 0x8
movs r4, 0xA0
subs r4, 0x1
_08085CFA:
ldrb r0, [r5]
ldr r3, [sp, 0x14]
adds r2, r0, r3
ldrb r0, [r5, 0x1]
mov r3, r10
adds r1, r0, r3
ldrb r0, [r5, 0x2]
add r0, r9
cmp r2, 0xFF
ble _08085D10
movs r2, 0xFF
_08085D10:
cmp r1, 0xFF
ble _08085D16
movs r1, 0xFF
_08085D16:
cmp r0, 0xFF
ble _08085D1C
movs r0, 0xFF
_08085D1C:
cmp r2, 0
bge _08085D22
movs r2, 0
_08085D22:
cmp r1, 0
bge _08085D28
movs r1, 0
_08085D28:
cmp r0, 0
bge _08085D2E
movs r0, 0
_08085D2E:
strb r2, [r6]
strb r1, [r6, 0x1]
strb r0, [r6, 0x2]
ldr r0, _08085E80
ldr r2, [r0]
ldr r0, _08085E84
ldr r3, [r0]
movs r0, 0xBE
lsls r0, 1
adds r3, r0
mov r0, r8
add r1, sp, 0x8
bl SetBGPaletteBufferColorRGB
adds r5, 0x4
movs r1, 0x1
add r8, r1
subs r4, 0x1
cmp r4, 0
bne _08085CFA
_08085D56:
ldr r2, _08085E88
ldr r3, [sp, 0x1C]
lsrs r0, r3, 16
ldr r1, [sp, 0x20]
orrs r0, r1
str r0, [sp, 0xC]
ldr r3, [sp, 0x24]
lsrs r1, r3, 16
ldr r0, [r7, 0x4]
ands r0, r2
orrs r0, r1
str r0, [r7, 0x4]
ldr r0, _08085E8C
ldr r1, _08085E80
ldr r3, [r1]
ldr r1, _08085E84
ldr r1, [r1]
movs r2, 0xBE
lsls r2, 1
adds r1, r2
str r1, [sp]
str r7, [sp, 0x4]
movs r1, 0xA0
movs r2, 0x20
bl sub_8004C00
movs r3, 0x20
add r8, r3
ldr r5, _08085E90
add r6, sp, 0x8
movs r4, 0x20
_08085D94:
ldrb r0, [r5]
ldr r1, [sp, 0x14]
adds r2, r0, r1
ldrb r0, [r5, 0x1]
mov r3, r10
adds r1, r0, r3
ldrb r0, [r5, 0x2]
add r0, r9
cmp r2, 0xFF
ble _08085DAA
movs r2, 0xFF
_08085DAA:
cmp r1, 0xFF
ble _08085DB0
movs r1, 0xFF
_08085DB0:
cmp r0, 0xFF
ble _08085DB6
movs r0, 0xFF
_08085DB6:
cmp r2, 0
bge _08085DBC
movs r2, 0
_08085DBC:
cmp r1, 0
bge _08085DC2
movs r1, 0
_08085DC2:
cmp r0, 0
bge _08085DC8
movs r0, 0
_08085DC8:
strb r2, [r6]
strb r1, [r6, 0x1]
strb r0, [r6, 0x2]
ldr r0, _08085E80
ldr r2, [r0]
ldr r7, _08085E84
ldr r3, [r7]
movs r0, 0xBE
lsls r0, 1
adds r3, r0
mov r0, r8
add r1, sp, 0x8
bl SetBGPaletteBufferColorRGB
adds r5, 0x4
movs r1, 0x1
add r8, r1
subs r4, 0x1
cmp r4, 0
bne _08085D94
ldr r2, [sp, 0x18]
cmp r2, 0
beq _08085E5E
ldr r0, [r7]
ldr r3, _08085E94
adds r0, r3
ldr r0, [r0]
ldr r5, [r0, 0x4]
movs r0, 0x80
lsls r0, 1
mov r8, r0
add r6, sp, 0x8
movs r4, 0xD0
_08085E0A:
ldrb r0, [r5]
ldr r1, [sp, 0x14]
adds r2, r0, r1
ldrb r0, [r5, 0x1]
mov r3, r10
adds r1, r0, r3
ldrb r0, [r5, 0x2]
add r0, r9
cmp r2, 0xFF
ble _08085E20
movs r2, 0xFF
_08085E20:
cmp r1, 0xFF
ble _08085E26
movs r1, 0xFF
_08085E26:
cmp r0, 0xFF
ble _08085E2C
movs r0, 0xFF
_08085E2C:
cmp r2, 0
bge _08085E32
movs r2, 0
_08085E32:
cmp r1, 0
bge _08085E38
movs r1, 0
_08085E38:
cmp r0, 0
bge _08085E3E
movs r0, 0
_08085E3E:
strb r2, [r6]
strb r1, [r6, 0x1]
strb r0, [r6, 0x2]
ldr r0, _08085E80
ldr r2, [r0]
mov r0, r8
add r1, sp, 0x8
movs r3, 0
bl SetBGPaletteBufferColorRGB
adds r5, 0x4
movs r0, 0x1
add r8, r0
subs r4, 0x1
cmp r4, 0
bne _08085E0A
_08085E5E:
add sp, 0x28
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08085E70: .4byte gDungeonPaletteFile
_08085E74: .4byte 0xffffff00
_08085E78: .4byte 0xffff00ff
_08085E7C: .4byte 0xff00ffff
_08085E80: .4byte gDungeonBrightness
_08085E84: .4byte gDungeon
_08085E88: .4byte 0xffff0000
_08085E8C: .4byte gUnknown_202EE8C
_08085E90: .4byte gUnknown_202ECA4
_08085E94: .4byte 0x000181e4
thumb_func_end SetDungeonBGColorRGB

View File

@@ -1,11 +0,0 @@
.section .rodata
.align 2,0
.string "pksdir0\0"
.align 2,0
.global gUnknown_80F4D8C
gUnknown_80F4D8C: @ 80F4D8C
@ replacing .incbin "baserom.gba", 0x000f4d8c, 0x14
.string "mapparam\0"
.align 2,0

View File

@@ -1,62 +0,0 @@
#include "constants/status.h"
.section .rodata
#.incbin "baserom.gba", 0xF59C4, 0x4
.string "pksdir0\0"
.global gUnknown_80F6490
gUnknown_80F6490: @ 80F6490
@ replacing .incbin "baserom.gba", 0x000f6490, 0x24
.byte 0x00, 0x00, 0x00, 0x0
.byte 0x0f, 0x00, 0x00, 0x00
.byte 0xff, 0x00, 0x00, 0x00
.byte 0xff, 0x0f, 0x00, 0x00
.byte 0xff, 0xff, 0x00, 0x00
.byte 0xff, 0xff, 0x0f, 0x00
.byte 0xff, 0xff, 0xff, 0x00
.byte 0xff, 0xff, 0xff, 0x0f
.byte 0xff, 0xff, 0xff, 0xff
.global gUnknown_80F64B4
gUnknown_80F64B4: @ 80F64B4
@ replacing .incbin "baserom.gba", 0x000f64b4, 0x24
.byte 0x5a, 0x00, 0x00, 0x00
.byte 0x50, 0x00, 0x00, 0x00
.byte 0x46, 0x00, 0x00, 0x00
.byte 0x3c, 0x00, 0x00, 0x00
.byte 0x32, 0x00, 0x00, 0x00
.byte 0x28, 0x00, 0x00, 0x00
.byte 0x1e, 0x00, 0x00, 0x00
.byte 0x14, 0x00, 0x00, 0x00
.byte 0x0a, 0x00, 0x00, 0x00
.global gUnknown_80F64D8
gUnknown_80F64D8: @ 80F64D8
@ replacing .incbin "baserom.gba", 0x000f64d8, 0x24
.byte 0x91, 0xf2, 0x90, 0xf2, 0x8f, 0xf2, 0x8e, 0xf2, 0x8d, 0xf2, 0x8c, 0xf2, 0x8b, 0xf2, 0x8a, 0xf2, 0x89, 0xf2, 0xc8, 0xf2, 0xc7, 0xf2, 0xc6, 0xf2, 0xc5, 0xf2, 0xc4, 0xf2, 0xc3, 0xf2, 0xc2, 0xf2
.byte 0xc1, 0xf2, 0xc0, 0xf2
.global gUnknown_80F64FC
gUnknown_80F64FC: @ 80F64FC
@ replacing .incbin "baserom.gba", 0x000f64fc, 0x24
.byte 0x84, 0x03, 0x00, 0x00, 0x20, 0x03, 0x00, 0x00, 0xbc, 0x02, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00
.byte 0x64, 0x00, 0x00, 0x00
.global gUnknown_80F6520
gUnknown_80F6520: @ 80F6520
@ replacing .incbin "baserom.gba", 0x000f6520, 0x24
.byte 0x5a, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
.byte 0x0a, 0x00, 0x00, 0x00
.global gUnknown_80F6544
gUnknown_80F6544: @ 80F6544
@ replacing .incbin "baserom.gba", 0x000f6544, 0x24
.byte 0x91, 0xf2, 0x90, 0xf2, 0x8f, 0xf2, 0x8e, 0xf2, 0x8d, 0xf2, 0x8c, 0xf2, 0x8b, 0xf2, 0x8a, 0xf2, 0x89, 0xf2, 0xc8, 0xf2, 0xc7, 0xf2, 0xc6, 0xf2, 0xc5, 0xf2, 0xc4, 0xf2, 0xc3, 0xf2, 0xc2, 0xf2
.byte 0xc1, 0xf2, 0xc0, 0xf2
.global gUnknown_80F6568
gUnknown_80F6568: @ 80F6568
@ replacing .incbin "baserom.gba", 0x000f6568, 0x88
.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff
.byte 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff
.byte 0x03, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff
.byte 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff

View File

@@ -1,26 +0,0 @@
#include "constants/status.h"
.section .rodata
#.incbin "baserom.gba", 0xF59C4, 0x4
.string "pksdir0\0"
.global gUnknown_80F61EC
gUnknown_80F61EC: @ 80F61EC
@ replacing .incbin "baserom.gba", 0x000f61ec, 0x30
.byte 0xfc, 0xff, 0xfc, 0xff, 0xf8, 0xff, 0xfc, 0xff, 0xf0, 0xff, 0xfc, 0xff, 0xf0, 0xff, 0xfc, 0xff, 0xf0, 0xff, 0xfc, 0xff, 0xf0, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xf8, 0xff, 0xfc, 0xff
.byte 0xf0, 0xff, 0xf8, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xf0, 0xff, 0xf8, 0xff, 0xf0, 0xff, 0xf8, 0xff
.global gUnknown_80F621C
gUnknown_80F621C: @ 80F621C
@ replacing .incbin "baserom.gba", 0x000f621c, 0x8
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global gUnknown_80F6224
gUnknown_80F6224: @ 80F6224
@ replacing .incbin "baserom.gba", 0x000f6224, 0x88
.byte 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
.byte 0x0a, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00

View File

@@ -1,152 +0,0 @@
.section .rodata
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ START code_808417C #1
.string "pksdir0\0"
.string "pksdir0\0"
.global gUnknown_8107224
gUnknown_8107224: @ 8107224
.string "??????\0"
.align 2, 0
@ END code_808417C #1
@ code_8085B0C
.string "pksdir0\0"
.global gUnknown_8107234
gUnknown_8107234: @ 8107234
.byte 0x01, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x02, 0x04, 0x02, 0x05, 0x03, 0x06, 0x00, 0x00
.byte 0x03, 0x07, 0x04, 0x08, 0x05, 0x09, 0x00, 0x00, 0x04, 0x0a, 0x06, 0x0b, 0x07, 0x0c, 0x00, 0x00
.byte 0x05, 0x0d, 0x08, 0x0e, 0x09, 0x0f, 0x00, 0x00, 0x06, 0x10, 0x0a, 0x11, 0x0a, 0x11, 0x00, 0x00
.byte 0x07, 0x12, 0x0b, 0x13, 0x0c, 0x14, 0x00, 0x00, 0x14, 0x15, 0x0d, 0x16, 0x0d, 0x16, 0x00, 0x00
.byte 0x08, 0x17, 0x0e, 0x18, 0x0f, 0x19, 0x00, 0x00, 0x0b, 0x1a, 0x10, 0x1b, 0x11, 0x1c, 0x00, 0x00
.byte 0x09, 0x1d, 0x12, 0x1e, 0x13, 0x1f, 0x00, 0x00, 0x0c, 0x20, 0x14, 0x21, 0x15, 0x22, 0x00, 0x00
.byte 0x0d, 0x23, 0x16, 0x24, 0x17, 0x25, 0x00, 0x00, 0x0e, 0x26, 0x18, 0x27, 0x19, 0x28, 0x00, 0x00
.byte 0x0f, 0x29, 0x40, 0x29, 0x1a, 0x2a, 0x00, 0x00, 0x10, 0x2b, 0x1b, 0x2c, 0x1c, 0x2d, 0x00, 0x00
.byte 0x11, 0x2e, 0x40, 0x2e, 0x40, 0x2e, 0x00, 0x00, 0x12, 0x2f, 0x40, 0x2f, 0x40, 0x2f, 0x00, 0x00
.byte 0x13, 0x30, 0x40, 0x30, 0x40, 0x30, 0x00, 0x00, 0x0a, 0x31, 0x40, 0x31, 0x1e, 0x32, 0x00, 0x00
.byte 0x15, 0x33, 0x40, 0x33, 0x40, 0x33, 0x00, 0x00, 0x16, 0x34, 0x40, 0x34, 0x40, 0x34, 0x00, 0x00
.byte 0x17, 0x35, 0x40, 0x35, 0x40, 0x35, 0x00, 0x00, 0x19, 0x36, 0x40, 0x36, 0x40, 0x36, 0x00, 0x00
.byte 0x1b, 0x37, 0x40, 0x37, 0x40, 0x37, 0x00, 0x00, 0x1a, 0x38, 0x20, 0x39, 0x20, 0x39, 0x00, 0x00
.byte 0x18, 0x3a, 0x21, 0x3b, 0x21, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global gUnknown_8107314
gUnknown_8107314: @ 8107314
.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff
.byte 0x02, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff
.byte 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff
.byte 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff
.byte 0x04, 0x00, 0x00, 0x00
.global gUnknown_8107358
gUnknown_8107358: @ 8107358
.byte 0x04, 0x03, 0x02, 0x03, 0x04, 0x05, 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x04, 0x05, 0x06, 0x05
.byte 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00
.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"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
.global gUnknown_81074FC
gUnknown_81074FC: @ 81074FC
.byte 0x4e, 0x4f, 0x50, 0x51, 0x4a, 0x49, 0x3e, 0x38
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
@ ???
.string "pksdir0\0"
.global gUnknown_8107544
gUnknown_8107544: @ 8107544
.byte 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x0d, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x17, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x12, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x0d, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x17, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x12, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00
.align 2,0

View File

@@ -4,4 +4,4 @@
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"

4
data/pksdir_4.s Normal file
View File

@@ -0,0 +1,4 @@
.section .rodata
.align 2
.string "pksdir0\0"

View File

@@ -16,6 +16,7 @@ typedef struct unkStruct_80416E0
u16 unk12;
s32 unk14;
u32 unk18;
unkStruct_2039DB0 unk1C;
} unkStruct_80416E0;
u32 sub_800E890(unkStruct_80416E0 *);

View File

@@ -1,8 +0,0 @@
#ifndef GUARD_CODE_803E46C_H
#define GUARD_CODE_803E46C_H
extern u8 gUnknown_203B40D;
void DungeonRunFrameActions(u32);
#endif // GUARD_CODE_803E46C_H

View File

@@ -1,17 +0,0 @@
#ifndef GUARD_CODE_8044CC8_H
#define GUARD_CODE_8044CC8_H
// size: 0x4
typedef struct unkStruct_202EE44
{
u16 actionId;
u8 unk2;
bool8 canBeChosen;
} unkStruct_202EE44;
extern unkStruct_202EE44 gDungeonSubMenu[10];
void AddActionToDungeonSubMenu(u16 actionId, u8 param_2);
void SetActionUnusableInDungeonSubMenu(u16 actionId);
#endif // GUARD_CODE_8044CC8_H

View File

@@ -1,8 +0,0 @@
#ifndef GUARD_808417C_H
#define GUARD_808417C_H
#include "structs/dungeon_entity.h"
s32 CalculateStatusTurns(Entity *target, const s16 *turnRange, bool8 factorCurerSkills);
#endif // GUARD_808417C_H

View File

@@ -1,6 +0,0 @@
#ifndef GUARD_CODE_8084778_H
#define GUARD_CODE_8084778_H
void sub_8084778(void);
#endif

View File

@@ -60,4 +60,18 @@ enum DungeonAction
NUM_DUNGEON_ACTIONS
};
// size: 0x4
typedef struct SubMenuAction
{
u16 actionId;
u8 unk2;
bool8 canBeChosen;
} SubMenuAction;
extern SubMenuAction gDungeonSubMenu[10];
extern s32 gDungeonSubMenuItemsCount;
void AddActionToDungeonSubMenu(u16 actionId, u8 param_2);
void SetActionUnusableInDungeonSubMenu(u16 actionId);
#endif

11
include/dungeon_8083AB0.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef GUARD_DUNGEON_8083AB0_H
#define GUARD_DUNGEON_8083AB0_H
#include "structs/dungeon_entity.h"
void sub_8083AB0(s16 param_0, Entity *target, Entity *entity);
bool8 sub_8083C24(void);
bool8 sub_8083C50(void);
bool8 sub_8083C88(u8 param_1);
#endif // GUARD_DUNGEON_8083AB0_H

13
include/dungeon_jobs.h Normal file
View File

@@ -0,0 +1,13 @@
#ifndef GUARD_DUNGEON_JOBS_H
#define GUARD_DUNGEON_JOBS_H
#include "structs/dungeon_entity.h"
void sub_80842F0(void);
void sub_80843BC(s32 id);
void sub_8084424(void);
void sub_8084448(Entity *pokemon);
void sub_80845E0(Entity *pokemon);
void sub_8084778(void);
#endif

View File

@@ -12,10 +12,6 @@ void PlayDungeonStartButtonSE(void);
void PlaySoundEffect(u32 songIndex);
void StopDungeonBGM(void);
void StopSoundEffect(u32 songIndex);
void sub_8083AB0(s16 param_0, Entity *target, Entity *entity);
bool8 sub_8083C24(void);
bool8 sub_8083C50(void);
bool8 sub_8083C88(u8);
void UpdateDungeonMusic(void);
#endif // GUARD_DUNGEON_MUSIC_H

View File

@@ -0,0 +1,14 @@
#ifndef GUARD_DUNGEON_PORTRAIT_PLACEMENT_H
#define GUARD_DUNGEON_PORTRAIT_PLACEMENT_H
#include "structs/str_position.h"
struct PortraitPlacementInfo
{
DungeonPos pos;
bool8 flip;
};
const struct PortraitPlacementInfo *GetPortraitPlacementInfo(u8 id);
#endif

View File

@@ -0,0 +1,22 @@
#ifndef GUARD_DUNGEON_POS_DATA_H
#define GUARD_DUNGEON_POS_DATA_H
#include "structs/str_position.h"
#include "constants/direction.h"
struct PositionArrayWithOffsets
{
const DungeonPos *posArray;
s16 xOffset;
s16 yOffset;
};
extern const DungeonPos gAdjacentTileOffsets[];
extern const DungeonPos gUnknown_80F4468[76];
extern const DungeonPos gUnknown_80F4598[158];
extern const struct PositionArrayWithOffsets gUnknown_80F4CC4[NUM_DIRECTIONS];
extern const s32 gFaceDirectionIncrements[];
extern const DungeonPos gUnknown_80F4D44[];
extern const u8 gUnknown_80F4D64[];
#endif

View File

@@ -1,6 +1,8 @@
#ifndef GUARD_DUNGEON_RANDOM_H
#define GUARD_DUNGEON_RANDOM_H
#include "structs/dungeon_entity.h"
void sub_808408C(u32 param_1);
u32 YetAnotherRandom24(void);
void InitDungeonRNG(u32 value);
@@ -9,4 +11,6 @@ s32 DungeonRandInt(s32 cap);
s32 DungeonRandRange(s32 low, s32 high);
bool8 DungeonRandOutcome(s32 percentChance);
bool8 DungeonRandOutcome_2(s32 percentChance);
s32 CalculateStatusTurns(Entity *target, const s16 *turnRange, bool8 factorCurerSkills);
#endif

View File

@@ -21,13 +21,11 @@ void sub_80856C8(Entity * pokemon, s32 x, s32 y);
void sub_80856E0(Entity * pokemon, s32 direction);
void sub_8085764(void);
void sub_8085860(s32 x, s32 y);
void sub_8085890(s32 x, s32 y);
void ShiftCameraToPosition(PixelPos *posStruct, s32 cameraSteps);
void SetFacingDirection(Entity *pokemon, s32 direction);
void sub_8085930(s32 direction);
void sub_80859F0(s32 direction);
bool8 ShouldRunMonsterAI(Entity *entity);
void sub_8085B0C(Entity *pokemon);
void sub_8085B4C(struct_8085B80 a0[], s16 *a1[], Entity *a2[], s32 a3);
void sub_80857B8(void);

10
include/dungeon_vram.h Normal file
View File

@@ -0,0 +1,10 @@
#ifndef GUARD_DUNGEON_VRAM_H
#define GUARD_DUNGEON_VRAM_H
// TODO: copy stuff from dungeon_vram.c to this header
extern u8 gUnknown_203B40D;
void DungeonRunFrameActions(u32);
#endif // GUARD_DUNGEON_VRAM_H

View File

@@ -67,7 +67,7 @@ static inline bool8 AreStringsDifferent(const u8 *str1, const u8 *str2)
#define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided\n")
#define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0]))
#define ARRAY_COUNT_INT(array) ((s32)(sizeof(array) / sizeof((array)[0]))) // When an int is needed to match.
#define ARRAY_COUNT_INT(array) ((s32)(ARRAY_COUNT(array))) // When an int is needed to match.
#define SWAP(a, b, temp) \
{ \

View File

@@ -12,6 +12,7 @@
#define DUNGEON_MAX_SIZE_X 56
#define DUNGEON_MAX_SIZE_Y 32
#define DUNGEON_MAX_NUM_TILES (DUNGEON_MAX_SIZE_X * DUNGEON_MAX_SIZE_Y)
#define DUNGEON_MAX_WILD_POKEMON 16
#define DUNGEON_MAX_WILD_POKEMON_BODY_SIZE 16
#define DUNGEON_MAX_POKEMON (MAX_TEAM_MEMBERS + DUNGEON_MAX_WILD_POKEMON)

View File

@@ -1,6 +1,13 @@
#ifndef GUARD_STR_POSITION_H
#define GUARD_STR_POSITION_H
// Used in dungeon generation and sub_8083660
struct PositionU8
{
u8 x;
u8 y;
};
// size: 0x4
typedef struct DungeonPos
{

View File

@@ -3,7 +3,7 @@
void sub_80922B4(u8 *buffer, const u8 *string, s32 size);
u32 sub_80922E4(u32 r0);
void CopyStringtoBuffer(u8 *buffer, u8 *string);
void CopyStringtoBuffer(u8 *buffer, const u8 *string);
void BoundedCopyStringtoBuffer(u8 *buffer, u8 *string, s32 size);
const char *GetUnformattedTypeString(u8 type);
const char * GetFormattedTypeString(u8 type);

View File

@@ -197,9 +197,9 @@ SECTIONS {
src/personality_test2.o(.text);
src/code_803D0D8.o(.text);
src/code_803D110.o(.text);
src/code_803E46C.o(.text);
src/code_803E724.o(.text);
src/code_8040094.o(.text);
src/code_803DA7C.o(.text);
src/dungeon_vram.o(.text);
src/dungeon_tilemap.o(.text);
src/dungeon_map.o(.text);
src/code_8040094_1.o(.text);
src/code_8041AD0.o(.text);
@@ -275,21 +275,38 @@ SECTIONS {
src/trap.o(.text);
src/dungeon_serializer.o(.text);
src/dungeon_range.o(.text);
src/code_808333C.o(.text);
src/dungeon_leader.o(.text);
asm/code_8083654.o(.text);
src/dungeon_8083AB0.o(.text);
src/dungeon_music.o(.text);
src/dungeon_random.o(.text);
src/code_808417C.o(.text);
asm/code_808417C.o(.text);
src/code_8084778.o(.text);
src/dungeon_cleared_window.o(.text);
src/dungeon_jobs.o(.text);
src/code_80848F0.o(.text);
src/dungeon_util_1.o(.text);
asm/code_8085B80.o(.text);
src/code_8085E98.o(.text);
src/code_80861A8.o(.text);
src/code_80869E4.o(.text);
src/dungeon_cutscenes.o(.text);
src/dungeon_cutscene_skarmory.o(.text);
src/dungeon_cutscene_meanies.o(.text);
src/dungeon_cutscene_zapdos.o(.text);
src/dungeon_cutscene_moltres.o(.text);
src/dungeon_cutscene_articuno.o(.text);
src/dungeon_cutscene_empty_summit.o(.text);
src/dungeon_cutscene_groudon.o(.text);
src/dungeon_cutscene_magma_cavern.o(.text);
src/dungeon_cutscene_rayquaza.o(.text);
src/dungeon_cutscene_mankey.o(.text);
src/dungeon_cutscene_mewtwo.o(.text);
src/dungeon_cutscene_entei.o(.text);
src/dungeon_cutscene_raikou.o(.text);
src/dungeon_cutscene_suicune.o(.text);
src/dungeon_cutscene_hooh.o(.text);
src/dungeon_cutscene_latios.o(.text);
src/dungeon_cutscene_regis.o(.text);
src/dungeon_cutscene_jirachi.o(.text);
src/dungeon_cutscene_lugia.o(.text);
src/dungeon_cutscene_kyogre.o(.text);
src/dungeon_cutscene_deoxys.o(.text);
src/dungeon_cutscene_celebi.o(.text);
src/dungeon_cutscene_medicham.o(.text);
src/dungeon_cutscene_smeargle.o(.text);
src/dungeon_cutscene_no_one_here.o(.text);
src/dungeon_portrait_placement.o(.text);
src/pokemon.o(.text);
src/pokemon_3.o(.text);
src/dungeon.o(.text);
@@ -535,13 +552,12 @@ SECTIONS {
src/personality_test2.o(.rodata);
src/code_803D0D8.o(.rodata);
src/dungeon_pos_data.o(.rodata);
data/data_80F4D44.o(.rodata);
src/code_803D110.o(.rodata);
src/dungeon_config.o(.rodata);
data/data_80F59C8_1.o(.rodata);
src/code_803D110.o(.rodata);
data/data_80F59C8_3.o(.rodata);
src/code_803E724.o(.rodata);
data/data_80F59C8_0.o(.rodata);
src/code_803DA7C.o(.rodata);
src/dungeon_vram.o(.rodata);
src/dungeon_tilemap.o(.rodata);
src/dungeon_map.o(.rodata);
src/code_8040094_1.o(.rodata);
data/pksdir_0.o(.rodata);
@@ -621,7 +637,40 @@ SECTIONS {
src/trap.o(.rodata);
data/pksdir_3.o(.rodata);
src/dungeon_serializer.o(.rodata);
data/data_8107224.o(.rodata);
data/pksdir_4.o(.rodata);
src/dungeon_range.o(.rodata);
src/dungeon_8083AB0.o(.rodata);
src/dungeon_music.o(.rodata);
src/dungeon_random.o(.rodata);
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);
src/dungeon_cutscene_moltres.o(.rodata);
src/dungeon_cutscene_articuno.o(.rodata);
src/dungeon_cutscene_empty_summit.o(.rodata);
src/dungeon_cutscene_groudon.o(.rodata);
src/dungeon_cutscene_magma_cavern.o(.rodata);
src/dungeon_cutscene_rayquaza.o(.rodata);
src/dungeon_cutscene_mankey.o(.rodata);
src/dungeon_cutscene_mewtwo.o(.rodata);
src/dungeon_cutscene_entei.o(.rodata);
src/dungeon_cutscene_raikou.o(.rodata);
src/dungeon_cutscene_suicune.o(.rodata);
src/dungeon_cutscene_hooh.o(.rodata);
src/dungeon_cutscene_latios.o(.rodata);
src/dungeon_cutscene_regis.o(.rodata);
src/dungeon_cutscene_jirachi.o(.rodata);
src/dungeon_cutscene_lugia.o(.rodata);
src/dungeon_cutscene_kyogre.o(.rodata);
src/dungeon_cutscene_deoxys.o(.rodata);
src/dungeon_cutscene_celebi.o(.rodata);
src/dungeon_cutscene_medicham.o(.rodata);
src/dungeon_cutscene_smeargle.o(.rodata);
src/dungeon_cutscene_no_one_here.o(.rodata);
src/dungeon_portrait_placement.o(.rodata);
src/pokemon.o(.rodata);
data/data_81076E4.o(.rodata);
src/game_options.o(.rodata);

View File

@@ -2,7 +2,7 @@
#include "globaldata.h"
#include "constants/ability.h"
#include "constants/weather.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "dungeon_message.h"
#include "code_806CD90.h"
#include "code_807CD9C.h"

View File

@@ -246,14 +246,3 @@ void sub_803D414(u8 *buffer,WonderMail *mail)
}
MemoryCopy8(buffer,auStack_44,sizeof(auStack_44));
}
// File boundary?
void sub_803D4AC(void)
{
gDungeon->unk1C570.id = 0x63;
gDungeon->unk1C570.floor = 0xFF;
}

View File

@@ -1,4 +1,5 @@
#include "global.h"
#include "globaldata.h"
#include "constants/dungeon.h"
#include "structs/str_202ED28.h"
#include "structs/str_202EDE8.h"
@@ -6,7 +7,7 @@
#include "code_8009804.h"
#include "code_800D090.h"
#include "code_803D110.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "cpu.h"
#include "def_filearchives.h"
#include "dungeon.h"
@@ -19,29 +20,10 @@
#include "text_3.h"
#include "dungeon_config.h"
// File split is correct.
extern s32 sub_80902C8(u8 dungeon);
extern void sub_808E9C4(UnkDungeonGlobal_unk1CD98 *r0, s16 r1);
extern bool8 sub_80848EC(void);
extern u8 GetFloorType(void);
extern const u8 *GetDungeonName2(u8 dungeon);
extern const char gUnknown_80F4D8C[]; // "mapparam"
extern const char gUnknown_80F60F8[]; // "banrpal"
extern const char gUnknown_80F6100[]; // "banfont"
extern const char gUnknown_80F6108[];
extern const char gUnknown_80F610C[];
extern const char gUnknown_80F6110[];
extern const char gUnknown_80F6118[];
extern const u32 gUnknown_80F6120[];
extern RGB gUnknown_202ECA4[];
extern OpenedFile *gDungeonNameBannerPalette;
extern OpenedFile *gDungeonNameBannerFontFile;
extern OpenedFile *gUnknown_202ECA0;
extern OpenedFile *gUnknown_202EC9C;
extern OpenedFile *gUnknown_202EC98;
extern OpenedFile *gUnknown_202EC94;
extern s32 gDungeonNameBannerFont;
struct UnkDungeonFileData
{
@@ -60,49 +42,11 @@ struct UnkDataFileStruct
u16 **unk10;
};
// Very similar to unkChar struct
typedef struct UnkStruct_sub_803DC6C
void sub_803D4AC(void)
{
u8 *unk0;
u16 unk4;
u8 unk6;
} UnkStruct_sub_803DC6C;
extern u32 gUnknown_202EDD0;
extern s32 gUnknown_202EDD4;
extern s32 gDungeonBrightness;
extern SpriteOAM gUnknown_202EDC0;
extern SpriteOAM gUnknown_202EDB8;
extern const DungeonPos gUnknown_80F61EC[2][6];
struct Unk80F6224Struct
{
s32 shape;
s32 size;
s32 tileNum;
};
struct FileStruct2
{
s32 count;
u8 array[0];
};
struct FileStruct
{
struct FileStruct2 *ptr;
struct u8 *ptr2;
};
extern const struct Unk80F6224Struct gUnknown_80F621C[2][6];
s32 sub_803DC14(const u8 *dungName, s32 strWidth, s32 a2);
s32 CalcStringWidth(const u8 *dungName);
s32 sub_803DC6C(u32 chr, s32 strWidth, s32 a2);
static UnkStruct_sub_803DC6C *sub_803DEC8(s32 chr);
void sub_803DD30(u8 *a0, u32 *a1);
gDungeon->unk1C570.id = 0x63;
gDungeon->unk1C570.floor = 0xFF;
}
void sub_803D4D0(void)
{
@@ -116,7 +60,7 @@ void sub_803D4D0(void)
return;
gDungeon->unk1C570 = gDungeon->unk644.dungeonLocation2;
file = OpenFileAndGetFileDataPtr(gUnknown_80F4D8C, &gDungeonFileArchive);
file = OpenFileAndGetFileDataPtr("mapparam", &gDungeonFileArchive);
strPtr = &((struct UnkDataFileStruct *)(file->data))->unk0[gDungeon->unk1C570.id][gDungeon->unk1C570.floor];
gDungeon->unk1CEC8 = GetDungeonFloorCount(gDungeon->unk644.dungeonLocation.id);
@@ -289,465 +233,3 @@ s32 sub_803DA20(s32 species)
}
return 1;
}
struct DungeonNameFontFileData
{
/* 0x0 */ u8 unk0;
/* 0x4 */ s32 font;
};
struct DungeonNamePaletteFileData
{
RGB pal[16];
};
void ShowDungeonNameBanner_Async(void)
{
u8 text[100];
s32 var;
s32 i, r7;
const u8 *r6;
gDungeonNameBannerPalette = OpenFileAndGetFileDataPtr(gUnknown_80F60F8, &gDungeonFileArchive);
gDungeonNameBannerFontFile = OpenFileAndGetFileDataPtr(gUnknown_80F6100, &gDungeonFileArchive);
gDungeonNameBannerFont = ((struct DungeonNameFontFileData *)(gDungeonNameBannerFontFile->data))->font;
for (i = 0; i < 16; i++) {
SetBGPaletteBufferColorArray(i + 224, &((struct DungeonNamePaletteFileData *)(gDungeonNameBannerPalette->data))->pal[i]);
}
CpuClear((void *)(VRAM + 0x140), 0x1C00);
if (sub_80848EC()) {
s32 r8 = gDungeon->unk644.dungeonLocation.floor + gDungeon->unk14;
const u8 *dungName = GetDungeonName2(gDungeon->unk644.dungeonLocation.id);
s32 r5 = 10;
for (r7 = 0; r7 < 8; r7++) {
for (i = 0; i < 28; r5++) {
u16 a2;
i++;
a2 = r5 | 0xE000;
sub_8008DC8(i, r7 + 4, r5 | a2, 0);
}
}
var = sub_803DC14(dungName, (224 - CalcStringWidth(dungName)) / 2, 0);
if (IsStairDirectionUp(gDungeon->unk644.dungeonLocation.id))
r6 = gUnknown_80F6108;
else
r6 = gUnknown_80F610C;
if (r8 > 9) {
sprintfStatic(text, gUnknown_80F6110, r6, 48 + (r8 / 10), 48 + (r8 % 10));
}
else {
sprintfStatic(text, gUnknown_80F6118, r6, 48 + r8);
}
sub_803DC14(text, (224 - CalcStringWidth(text)) / 2, var + 32);
gUnknown_20274A5 = TRUE;
}
CloseFile(gDungeonNameBannerFontFile);
DungeonRunFrameActions(2);
}
s32 sub_803DC14(const u8 *dungName, s32 strWidth, s32 a2)
{
while (*dungName != '\0') {
u32 currChar = *(dungName++);
if (currChar == '/') {
strWidth = 0;
a2 += 24;
}
else if (currChar == '#') {
strWidth += 8;
}
else if (currChar == ' ') {
strWidth += 12;
}
else {
if (currChar & 0x80 && *dungName != '\0') {
currChar = (currChar << 8) | *dungName;
dungName++;
}
strWidth += sub_803DC6C(currChar, strWidth, a2);
}
}
return a2;
}
s32 sub_803DC6C(u32 chr, s32 strWidth, s32 a2)
{
u32 *spPtr;
s32 i, j, a2DivMul;
u32 *vramPtr;
const u32 *constData;
u32 sp[72];
s32 r9;
UnkStruct_sub_803DC6C *strPtr = sub_803DEC8(chr);
sub_803DD30(strPtr->unk0, sp);
r9 = strPtr->unk6;
spPtr = sp;
a2DivMul = ((a2 / 8) * 8);
vramPtr = (void *)(VRAM + 0x140 + (((a2DivMul - a2 / 8) * 4) + (strWidth / 8)) * 32); // Pixels?
vramPtr += a2 - a2DivMul;
constData = &gUnknown_80F6120[(strWidth - ((strWidth / 8) * 8)) * 4];
for (i = 0; i < 24; i++) {
u32 *vramPtrLoop = vramPtr;
for (j = 0; j < 3; j++) {
// Sadly cannot match it without asm :/
#ifdef NONMATCHING
u32 spVal = *spPtr;
#else
register u32 spVal asm("r2") = *spPtr;
#endif // NONMATCHING
if (spVal != 0) {
*vramPtrLoop |= ((constData[0] & spVal) << constData[2]);
vramPtrLoop += 8;
spVal &= constData[1];
spVal >>= constData[3];
*vramPtrLoop |= spVal;
vramPtrLoop -= 8;
}
spPtr++;
vramPtrLoop += 8;
}
vramPtr++;
a2++;
if (!(a2 & 7)) {
vramPtr += 216;
}
}
return r9;
}
void sub_803DD30(u8 *a0, u32 *a1)
{
u8 sp[576];
u8 sp575[576];
s32 spId = 0;
s32 i, j = 0, k;
u32 currSp;
s32 r6;
for (i = 0; i < 576; i += 2) {
sp[i] = (*a0 >> 4) & 0xF;
sp[i+1] = *a0 & 0xF;
a0++;
}
while (j < 576) {
currSp = sp[spId++];
r6 = currSp & 7;
if (currSp & 8) {
currSp = sp[spId++];
for (k = 0; k < r6; k++) {
sp575[j] = currSp;
if (++j >= 576)
break;
}
}
else {
for (k = 0; k < r6; k++) {
currSp = sp[spId++];
sp575[j] = currSp;
if (++j >= 576)
break;
}
}
if (j >= 576)
break;
}
for (i = 0; i < 576; i += 8) {
u32 val = sp575[i + 7] << 0x1C;
val |= (sp575[i + 6] << 0x18) & 0xF000000;
val |= (sp575[i + 5] << 0x14) & 0xF00000;
val |= (sp575[i + 4] << 0x10) & 0xF0000;
val |= (sp575[i + 3] << 0xC) & 0xF000;
val |= (sp575[i + 2] << 0x8) & 0xF00;
val |= (sp575[i + 1] << 0x4) & 0xF0;
val |= (sp575[i]) & 0xF;
*(a1++) = val;
}
}
// Could be a misnomer?
s32 CalcStringWidth(const u8 *dungName)
{
s32 w = 0;
while (*dungName != '\0') {
u32 currChar = *(dungName++);
if (currChar == '#') {
w += 8;
}
else if (currChar == ' ') {
w += 12;
}
else {
struct UnkStruct_sub_803DC6C *strPtr;
if (currChar & 0x80 && *dungName != '\0') {
currChar = (currChar << 8) | *dungName;
dungName++;
}
strPtr = sub_803DEC8(currChar);
if (strPtr != NULL) {
w += strPtr->unk6;
}
}
}
return w;
}
static UnkStruct_sub_803DC6C *sub_803DEC8(s32 chr)
{
s32 r2, r4;
UnkStruct_sub_803DC6C *ret;
UnkStruct_sub_803DC6C *strPtr = *((UnkStruct_sub_803DC6C **) gDungeonNameBannerFontFile->data);
// Fakematch? Or just magic numbers which will make more sense once this file is documented?
if (chr > 63487 && chr < 65535)
{
s32 r2 = chr & 0xFF;
s32 r1 = (chr & 0xFF00) >> 8;
r2 -= 32;
r1 -= 248;
ret = &strPtr[r1 * 224 + r2];
}
else
{
r4 = 0;
r2 = gDungeonNameBannerFont - 1;
while (r4 < r2) {
s32 r1 = (r4 + r2) / 2;
if (strPtr[r1].unk4 == chr) {
r4 = r1;
break;
}
else if (strPtr[r1].unk4 < chr) {
r4 = r1 + 1;
}
else {
r2 = r1;
}
}
ret = &strPtr[r4];
if (ret->unk4 != chr)
ret = &strPtr[1];
}
return ret;
};
void sub_803DF60(void)
{
u8 *vram;
s32 i;
const void *src;
OpenedFile *file;
file = OpenFileAndGetFileDataPtr("itempat", &gDungeonFileArchive);
src = ((struct FileStruct *)(file->data))->ptr;
i = ((struct FileStruct2 *)(src))->count;
src = ((struct FileStruct2 *)(src))->array;
vram = OBJ_VRAM0 + 0x3400;
while (i != 0)
{
CpuCopy(vram, src, 0x20);
vram += 0x20;
src += 0x20;
i--;
}
CloseFile(file);
file = OpenFileAndGetFileDataPtr("etcfont", &gDungeonFileArchive);
src = ((struct FileStruct2 *)(file->data));
i = ((struct FileStruct2 *)(src))->count;
src = ((struct FileStruct2 *)(src))->array;
vram = OBJ_VRAM0 + 0x4000;
while (i != 0)
{
CpuCopy(vram, src, 0x20);
vram += 0x20;
src += 0x20;
i--;
}
CloseFile(file);
gUnknown_202EC94 = OpenFileAndGetFileDataPtr("etcfonta", &gDungeonFileArchive);
gUnknown_202EC98 = OpenFileAndGetFileDataPtr("levfont", &gDungeonFileArchive);
gUnknown_202EC9C = OpenFileAndGetFileDataPtr("hp5font", &gDungeonFileArchive);
gUnknown_202ECA0 = OpenFileAndGetFileDataPtr("colvec", &gDungeonFileArchive);
}
void sub_803E02C(void)
{
u8 *vram;
s32 i, j, r6;
const void *src;
OpenedFile *file;
u8 fileName[12];
sub_803E13C();
strcpy(fileName, "trappat");
file = OpenFileAndGetFileDataPtr(fileName, &gDungeonFileArchive);
src = ((struct FileStruct *)(file->data))->ptr;
i = ((struct FileStruct2 *)(src))->count;
src = ((struct FileStruct2 *)(src))->array;
vram = (void *) VRAM + 0xC000;
while (i != 0)
{
CpuCopy(vram, src, 0x20);
vram += 0x20;
src += 0x20;
i--;
}
CpuCopy(gUnknown_202ECA4, ((struct FileStruct *)(file->data))->ptr2, 0x80);
CloseFile(file);
r6 = 0x200;
for (i = 0; i < UNK12A18_ARR_COUNT; i++) {
for (j = 0; j < UNK12A18_ARR_COUNT_2; j++) {
gDungeon->unk12A18[i][j] = (gUnknown_80F5F70[i] << 0xC) | r6;
r6++;
}
}
for (i = 0; i < 9; i++) {
gDungeon->unk13554[i] = 0xC000;
}
for (i = 0; i < COLOR_RAMP_COUNT; i++) {
gDungeon->colorRamp[i].r = i;
gDungeon->colorRamp[i].g = i;
gDungeon->colorRamp[i].b = i;
}
}
void sub_803E13C(void)
{
s32 i;
RGB *pal;
SetWindowBGColor();
if (gGameOptionsRef->playerGender != 0)
pal = &gFontPalette[16 * 4];
else
pal = &gFontPalette[0];
for (i = 0; i < 16; i++) {
SetBGPaletteBufferColorArray(240 + i, pal);
pal++;
}
}
void sub_803E178(void)
{
s32 val = GetFloorType();
if (val == 0) {
if (gDungeon->unk644.dungeonLocation.id == DUNGEON_METEOR_CAVE && !gDungeon->deoxysDefeat) {
gDungeon->unk3A12 = 28;
}
else {
gDungeon->unk3A12 = (IsStairDirectionUp(gDungeon->unk644.dungeonLocation.id) != FALSE) ? 23 : 22;
}
}
else if (val == 1) {
gDungeon->unk3A12 = 6;
}
else {
gDungeon->unk3A12 = 24;
}
}
void sub_803E214(void)
{
CloseFile(gUnknown_202EC94);
CloseFile(gUnknown_202EC98);
CloseFile(gUnknown_202EC9C);
CloseFile(gUnknown_202ECA0);
}
void nullsub_56(void)
{
}
void sub_803E250(void)
{
s32 i, j;
gUnknown_202EDD0 = 999;
gUnknown_202EDD4 = 0;
gUnknown_203B40D = 0;
gUnknown_202EDE8.unk0 = 0;
SpriteSetY(&gUnknown_202EDC0, 0);
SpriteSetAffine1(&gUnknown_202EDC0, 0);
SpriteSetAffine2(&gUnknown_202EDC0, 0);
SpriteSetObjMode(&gUnknown_202EDC0, 0);
SpriteSetMosaic(&gUnknown_202EDC0, 0);
SpriteSetBpp(&gUnknown_202EDC0, 0);
SpriteSetShape(&gUnknown_202EDC0, 0);
SpriteSetMatrixNum(&gUnknown_202EDC0, 0);
SpriteSetSize(&gUnknown_202EDC0, 1);
SpriteSetX(&gUnknown_202EDC0, 0);
SpriteSetTileNum(&gUnknown_202EDC0, 0);
SpriteSetPriority(&gUnknown_202EDC0, 0);
SpriteSetPalNum(&gUnknown_202EDC0, 0);
SpriteSetUnk6_0(&gUnknown_202EDC0, 0);
SpriteSetUnk6_1(&gUnknown_202EDC0, 0);
SpriteSetUnk6_2(&gUnknown_202EDC0, 0);
SpriteSetY(&gUnknown_202EDB8, 0);
SpriteSetAffine1(&gUnknown_202EDB8, 0);
SpriteSetAffine2(&gUnknown_202EDB8, 0);
SpriteSetObjMode(&gUnknown_202EDB8, 0);
SpriteSetMosaic(&gUnknown_202EDB8, 0);
SpriteSetBpp(&gUnknown_202EDB8, 0);
SpriteSetShape(&gUnknown_202EDB8, 0);
SpriteSetMatrixNum(&gUnknown_202EDB8, 0);
SpriteSetSize(&gUnknown_202EDB8, 0);
SpriteSetX(&gUnknown_202EDB8, 0);
SpriteSetTileNum(&gUnknown_202EDB8, 0);
SpriteSetPriority(&gUnknown_202EDB8, 3);
SpriteSetPalNum(&gUnknown_202EDB8, 5);
SpriteSetUnk6_0(&gUnknown_202EDB8, 0);
SpriteSetUnk6_1(&gUnknown_202EDB8, 0);
SpriteSetUnk6_2(&gUnknown_202EDB8, 0);
for (i = 0; i < 2; i++) {
for (j = 0; j < 6; j++) {
SpriteSetAffine1(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetAffine2(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetObjMode(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetMosaic(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetBpp(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetShape(&gUnknown_202ED28[i][j].sprite, gUnknown_80F621C[i][j].shape);
SpriteSetMatrixNum(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetSize(&gUnknown_202ED28[i][j].sprite, gUnknown_80F621C[i][j].size);
SpriteSetTileNum(&gUnknown_202ED28[i][j].sprite, gUnknown_80F621C[i][j].tileNum);
SpriteSetPriority(&gUnknown_202ED28[i][j].sprite, 3);
SpriteSetPalNum(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetUnk6_0(&gUnknown_202ED28[i][j].sprite, 0);
SpriteSetUnk6_1(&gUnknown_202ED28[i][j].sprite, 0);
gUnknown_202ED28[i][j].pos = gUnknown_80F61EC[i][j];
}
}
gDungeon->unk181e8.unk18217 = 1;
gDungeon->unk181e8.unk18218 = 1;
gDungeonBrightness = 0;
SetBGPaletteBufferColorRGB(0xf8, &gFontPalette[8],0,NULL);
}

463
src/code_803DA7C.c Normal file
View File

@@ -0,0 +1,463 @@
#include "global.h"
#include "constants/dungeon.h"
#include "structs/str_202ED28.h"
#include "structs/str_202EDE8.h"
#include "bg_palette_buffer.h"
#include "code_8009804.h"
#include "code_800D090.h"
#include "code_803D110.h"
#include "dungeon_vram.h"
#include "cpu.h"
#include "def_filearchives.h"
#include "dungeon.h"
#include "dungeon_random.h"
#include "file_system.h"
#include "game_options.h"
#include "pokemon.h"
#include "pokemon_3.h"
#include "text_1.h"
#include "text_3.h"
#include "dungeon_config.h"
// File split could be wrong here. Todo.
extern bool8 sub_80848EC(void);
extern u8 GetFloorType(void);
extern const u8 *GetDungeonName2(u8 dungeon);
extern const char gUnknown_80F60F8[]; // "banrpal"
extern const char gUnknown_80F6100[]; // "banfont"
extern const char gUnknown_80F6108[];
extern const char gUnknown_80F610C[];
extern const char gUnknown_80F6110[];
extern const char gUnknown_80F6118[];
extern const u32 gUnknown_80F6120[];
EWRAM_DATA OpenedFile *gDungeonNameBannerPalette = NULL;
EWRAM_DATA OpenedFile *gDungeonNameBannerFontFile = NULL;
EWRAM_DATA s32 gDungeonNameBannerFont = 0;
EWRAM_DATA OpenedFile *gUnknown_202EC94 = NULL;
EWRAM_DATA OpenedFile *gUnknown_202EC98 = NULL;
EWRAM_DATA OpenedFile *gUnknown_202EC9C = NULL;
EWRAM_DATA OpenedFile *gUnknown_202ECA0 = NULL;
// Very similar to unkChar struct
typedef struct UnkStruct_sub_803DC6C
{
u8 *unk0;
u16 unk4;
u8 unk6;
} UnkStruct_sub_803DC6C;
struct FileStruct2
{
s32 count;
u8 array[0];
};
struct FileStruct
{
struct FileStruct2 *ptr;
struct u8 *ptr2;
};
s32 sub_803DC14(const u8 *dungName, s32 strWidth, s32 a2);
s32 CalcStringWidth(const u8 *dungName);
s32 sub_803DC6C(u32 chr, s32 strWidth, s32 a2);
static UnkStruct_sub_803DC6C *sub_803DEC8(s32 chr);
void sub_803DD30(u8 *a0, u32 *a1);
struct DungeonNameFontFileData
{
/* 0x0 */ u8 unk0;
/* 0x4 */ s32 font;
};
struct DungeonNamePaletteFileData
{
RGB pal[16];
};
void ShowDungeonNameBanner_Async(void)
{
u8 text[100];
s32 var;
s32 i, r7;
const u8 *r6;
gDungeonNameBannerPalette = OpenFileAndGetFileDataPtr(gUnknown_80F60F8, &gDungeonFileArchive);
gDungeonNameBannerFontFile = OpenFileAndGetFileDataPtr(gUnknown_80F6100, &gDungeonFileArchive);
gDungeonNameBannerFont = ((struct DungeonNameFontFileData *)(gDungeonNameBannerFontFile->data))->font;
for (i = 0; i < 16; i++) {
SetBGPaletteBufferColorArray(i + 224, &((struct DungeonNamePaletteFileData *)(gDungeonNameBannerPalette->data))->pal[i]);
}
CpuClear((void *)(VRAM + 0x140), 0x1C00);
if (sub_80848EC()) {
s32 r8 = gDungeon->unk644.dungeonLocation.floor + gDungeon->unk14;
const u8 *dungName = GetDungeonName2(gDungeon->unk644.dungeonLocation.id);
s32 r5 = 10;
for (r7 = 0; r7 < 8; r7++) {
for (i = 0; i < 28; r5++) {
u16 a2;
i++;
a2 = r5 | 0xE000;
sub_8008DC8(i, r7 + 4, r5 | a2, 0);
}
}
var = sub_803DC14(dungName, (224 - CalcStringWidth(dungName)) / 2, 0);
if (IsStairDirectionUp(gDungeon->unk644.dungeonLocation.id))
r6 = gUnknown_80F6108;
else
r6 = gUnknown_80F610C;
if (r8 > 9) {
sprintfStatic(text, gUnknown_80F6110, r6, 48 + (r8 / 10), 48 + (r8 % 10));
}
else {
sprintfStatic(text, gUnknown_80F6118, r6, 48 + r8);
}
sub_803DC14(text, (224 - CalcStringWidth(text)) / 2, var + 32);
gUnknown_20274A5 = TRUE;
}
CloseFile(gDungeonNameBannerFontFile);
DungeonRunFrameActions(2);
}
s32 sub_803DC14(const u8 *dungName, s32 strWidth, s32 a2)
{
while (*dungName != '\0') {
u32 currChar = *(dungName++);
if (currChar == '/') {
strWidth = 0;
a2 += 24;
}
else if (currChar == '#') {
strWidth += 8;
}
else if (currChar == ' ') {
strWidth += 12;
}
else {
if (currChar & 0x80 && *dungName != '\0') {
currChar = (currChar << 8) | *dungName;
dungName++;
}
strWidth += sub_803DC6C(currChar, strWidth, a2);
}
}
return a2;
}
s32 sub_803DC6C(u32 chr, s32 strWidth, s32 a2)
{
u32 *spPtr;
s32 i, j, a2DivMul;
u32 *vramPtr;
const u32 *constData;
u32 sp[72];
s32 r9;
UnkStruct_sub_803DC6C *strPtr = sub_803DEC8(chr);
sub_803DD30(strPtr->unk0, sp);
r9 = strPtr->unk6;
spPtr = sp;
a2DivMul = ((a2 / 8) * 8);
vramPtr = (void *)(VRAM + 0x140 + (((a2DivMul - a2 / 8) * 4) + (strWidth / 8)) * 32); // Pixels?
vramPtr += a2 - a2DivMul;
constData = &gUnknown_80F6120[(strWidth - ((strWidth / 8) * 8)) * 4];
for (i = 0; i < 24; i++) {
u32 *vramPtrLoop = vramPtr;
for (j = 0; j < 3; j++) {
// Sadly cannot match it without asm :/
#ifdef NONMATCHING
u32 spVal = *spPtr;
#else
register u32 spVal asm("r2") = *spPtr;
#endif // NONMATCHING
if (spVal != 0) {
*vramPtrLoop |= ((constData[0] & spVal) << constData[2]);
vramPtrLoop += 8;
spVal &= constData[1];
spVal >>= constData[3];
*vramPtrLoop |= spVal;
vramPtrLoop -= 8;
}
spPtr++;
vramPtrLoop += 8;
}
vramPtr++;
a2++;
if (!(a2 & 7)) {
vramPtr += 216;
}
}
return r9;
}
void sub_803DD30(u8 *a0, u32 *a1)
{
u8 sp[576];
u8 sp575[576];
s32 spId = 0;
s32 i, j = 0, k;
u32 currSp;
s32 r6;
for (i = 0; i < 576; i += 2) {
sp[i] = (*a0 >> 4) & 0xF;
sp[i+1] = *a0 & 0xF;
a0++;
}
while (j < 576) {
currSp = sp[spId++];
r6 = currSp & 7;
if (currSp & 8) {
currSp = sp[spId++];
for (k = 0; k < r6; k++) {
sp575[j] = currSp;
if (++j >= 576)
break;
}
}
else {
for (k = 0; k < r6; k++) {
currSp = sp[spId++];
sp575[j] = currSp;
if (++j >= 576)
break;
}
}
if (j >= 576)
break;
}
for (i = 0; i < 576; i += 8) {
u32 val = sp575[i + 7] << 0x1C;
val |= (sp575[i + 6] << 0x18) & 0xF000000;
val |= (sp575[i + 5] << 0x14) & 0xF00000;
val |= (sp575[i + 4] << 0x10) & 0xF0000;
val |= (sp575[i + 3] << 0xC) & 0xF000;
val |= (sp575[i + 2] << 0x8) & 0xF00;
val |= (sp575[i + 1] << 0x4) & 0xF0;
val |= (sp575[i]) & 0xF;
*(a1++) = val;
}
}
// Could be a misnomer?
s32 CalcStringWidth(const u8 *dungName)
{
s32 w = 0;
while (*dungName != '\0') {
u32 currChar = *(dungName++);
if (currChar == '#') {
w += 8;
}
else if (currChar == ' ') {
w += 12;
}
else {
struct UnkStruct_sub_803DC6C *strPtr;
if (currChar & 0x80 && *dungName != '\0') {
currChar = (currChar << 8) | *dungName;
dungName++;
}
strPtr = sub_803DEC8(currChar);
if (strPtr != NULL) {
w += strPtr->unk6;
}
}
}
return w;
}
static UnkStruct_sub_803DC6C *sub_803DEC8(s32 chr)
{
s32 r2, r4;
UnkStruct_sub_803DC6C *ret;
UnkStruct_sub_803DC6C *strPtr = *((UnkStruct_sub_803DC6C **) gDungeonNameBannerFontFile->data);
// Fakematch? Or just magic numbers which will make more sense once this file is documented?
if (chr > 63487 && chr < 65535)
{
s32 r2 = chr & 0xFF;
s32 r1 = (chr & 0xFF00) >> 8;
r2 -= 32;
r1 -= 248;
ret = &strPtr[r1 * 224 + r2];
}
else
{
r4 = 0;
r2 = gDungeonNameBannerFont - 1;
while (r4 < r2) {
s32 r1 = (r4 + r2) / 2;
if (strPtr[r1].unk4 == chr) {
r4 = r1;
break;
}
else if (strPtr[r1].unk4 < chr) {
r4 = r1 + 1;
}
else {
r2 = r1;
}
}
ret = &strPtr[r4];
if (ret->unk4 != chr)
ret = &strPtr[1];
}
return ret;
};
EWRAM_DATA RGB gUnknown_202ECA4[33] = {0};
void sub_803DF60(void)
{
u8 *vram;
s32 i;
const void *src;
OpenedFile *file;
file = OpenFileAndGetFileDataPtr("itempat", &gDungeonFileArchive);
src = ((struct FileStruct *)(file->data))->ptr;
i = ((struct FileStruct2 *)(src))->count;
src = ((struct FileStruct2 *)(src))->array;
vram = OBJ_VRAM0 + 0x3400;
while (i != 0)
{
CpuCopy(vram, src, 0x20);
vram += 0x20;
src += 0x20;
i--;
}
CloseFile(file);
file = OpenFileAndGetFileDataPtr("etcfont", &gDungeonFileArchive);
src = ((struct FileStruct2 *)(file->data));
i = ((struct FileStruct2 *)(src))->count;
src = ((struct FileStruct2 *)(src))->array;
vram = OBJ_VRAM0 + 0x4000;
while (i != 0)
{
CpuCopy(vram, src, 0x20);
vram += 0x20;
src += 0x20;
i--;
}
CloseFile(file);
gUnknown_202EC94 = OpenFileAndGetFileDataPtr("etcfonta", &gDungeonFileArchive);
gUnknown_202EC98 = OpenFileAndGetFileDataPtr("levfont", &gDungeonFileArchive);
gUnknown_202EC9C = OpenFileAndGetFileDataPtr("hp5font", &gDungeonFileArchive);
gUnknown_202ECA0 = OpenFileAndGetFileDataPtr("colvec", &gDungeonFileArchive);
}
void sub_803E02C(void)
{
u8 *vram;
s32 i, j, r6;
const void *src;
OpenedFile *file;
u8 fileName[12];
sub_803E13C();
strcpy(fileName, "trappat");
file = OpenFileAndGetFileDataPtr(fileName, &gDungeonFileArchive);
src = ((struct FileStruct *)(file->data))->ptr;
i = ((struct FileStruct2 *)(src))->count;
src = ((struct FileStruct2 *)(src))->array;
vram = (void *) VRAM + 0xC000;
while (i != 0)
{
CpuCopy(vram, src, 0x20);
vram += 0x20;
src += 0x20;
i--;
}
CpuCopy(gUnknown_202ECA4, ((struct FileStruct *)(file->data))->ptr2, 0x80);
CloseFile(file);
r6 = 0x200;
for (i = 0; i < UNK12A18_ARR_COUNT; i++) {
for (j = 0; j < UNK12A18_ARR_COUNT_2; j++) {
gDungeon->unk12A18[i][j] = (gUnknown_80F5F70[i] << 0xC) | r6;
r6++;
}
}
for (i = 0; i < 9; i++) {
gDungeon->unk13554[i] = 0xC000;
}
for (i = 0; i < COLOR_RAMP_COUNT; i++) {
gDungeon->colorRamp[i].r = i;
gDungeon->colorRamp[i].g = i;
gDungeon->colorRamp[i].b = i;
}
}
void sub_803E13C(void)
{
s32 i;
RGB *pal;
SetWindowBGColor();
if (gGameOptionsRef->playerGender != 0)
pal = &gFontPalette[16 * 4];
else
pal = &gFontPalette[0];
for (i = 0; i < 16; i++) {
SetBGPaletteBufferColorArray(240 + i, pal);
pal++;
}
}
void sub_803E178(void)
{
s32 val = GetFloorType();
if (val == 0) {
if (gDungeon->unk644.dungeonLocation.id == DUNGEON_METEOR_CAVE && !gDungeon->deoxysDefeat) {
gDungeon->unk3A12 = 28;
}
else {
gDungeon->unk3A12 = (IsStairDirectionUp(gDungeon->unk644.dungeonLocation.id) != FALSE) ? 23 : 22;
}
}
else if (val == 1) {
gDungeon->unk3A12 = 6;
}
else {
gDungeon->unk3A12 = 24;
}
}
void sub_803E214(void)
{
CloseFile(gUnknown_202EC94);
CloseFile(gUnknown_202EC98);
CloseFile(gUnknown_202EC9C);
CloseFile(gUnknown_202ECA0);
}
void nullsub_56(void)
{
}

View File

@@ -1,240 +0,0 @@
#include "global.h"
#include "structs/str_dungeon.h"
#include "bg_control.h"
#include "bg_palette_buffer.h"
#include "code_8004AA0.h"
#include "code_800558C.h"
#include "code_8009804.h"
#include "code_800C9CC.h"
#include "code_80118A4.h"
#include "code_803E46C.h"
#include "code_803E668.h"
#include "code_803E724.h"
#include "dungeon_map.h"
#include "dungeon_music.h"
#include "game_options.h"
#include "input.h"
#include "play_time.h"
#include "sprite.h"
#include "text_2.h"
EWRAM_INIT u8 gUnknown_203B40C = 0;
EWRAM_INIT u8 gUnknown_203B40D = 0;
extern s32 gDungeonBrightness;
extern s32 gDungeonFramesCounter;
extern u32 gUnknown_202EDD0;
extern s32 gUnknown_202EDD4;
static void sub_803E490(u32);
void xxx_draw_string_80524F0(void);
void sub_8085F78(void);
void sub_803F580(s32);
void sub_806CC10();
void sub_804522C();
void sub_803F9CC();
void sub_803ECE0();
void sub_803EDF0();
void sub_800E90C();
void sub_8042E5C();
void sub_800F7D0(DungeonPos *);
void sub_803E874(s32, s32);
void DungeonRunFrameActions(u32 a0)
{
if (gUnknown_203B40C != 0)
sub_803E490(a0);
else
sub_803E668(a0);
}
static void sub_803E490(u32 unused)
{
gUnknown_202EDD4++;
xxx_draw_string_80524F0();
sub_8085F78();
sub_803F580(1);
if(gDungeon->unk181e8.unk1821A)
{
gDungeon->unk181e8.priority = 2;
SetBG2RegOffsets(gDungeon->unk181e8.cameraPixelPos.x, gDungeon->unk181e8.cameraPixelPos.y);
}
else
{
gDungeon->unk181e8.priority = 3;
SetBG2RegOffsets(0, 0);
}
SetBG3RegOffsets(gDungeon->unk181e8.cameraPixelPos.x, gDungeon->unk181e8.cameraPixelPos.y - gDungeon->unk181e8.unk181FC);
sub_806CC10();
sub_804522C();
sub_803F9CC();
sub_800F7D0(&gDungeon->unk181e8.cameraPixelPos);
if(gDungeon->unk12 <= 0x63)
gDungeon->unk12++;
sub_800E90C(&gDungeon->unk181e8.cameraPixelPos);
sub_8042E5C();
if(gUnknown_202EDD0 == 0 || gUnknown_202EDD0 == 3 || gGameOptionsRef->mapOption == TOP_MAP_AND_TEAM_NO_BOTTOM)
ShowPlayerDotOnMap();
sub_803ECE0();
sub_803EDF0();
if(gDungeon->unk181e8.unk18215 != 0 && gDungeon->unk1BDD4.unk1C06C != 3)
sub_8004AF0(gUnknown_203B40D, gUnknown_202EE8C, 0xA0, 0x20, gDungeonBrightness, gDungeon->colorRamp);
nullsub_8(gGameOptionsRef->unkA);
sub_8005180();
nullsub_12();
sub_80060EC();
gDungeonFramesCounter++;
IncrementPlayTime(gPlayTimeRef);
WaitForNextFrameAndAdvanceRNG();
LoadBufferedInputs();
CopySpritesToOam();
nullsub_13();
sub_8005304();
nullsub_14();
TransferBGPaletteBuffer();
sub_8009908();
xxx_call_update_bg_vram();
CopyDungeonMapToVram();
xxx_call_update_bg_sound_input();
gDungeon->unk181e8.unk18213 = 0;
UpdateDungeonMusic();
sub_8011860();
TryResetDungeonMapTilesScheduledForCopy();
ResetSprites(FALSE);
nullsub_10(FALSE);
gUnknown_202EDD4--;
}
void sub_803E668(u32 unused)
{
gUnknown_202EDD4++;
nullsub_8(gGameOptionsRef->unkA);
sub_8005180();
nullsub_12();
sub_8005838(NULL, 0);
sub_80060EC();
gDungeonFramesCounter++;
IncrementPlayTime(gPlayTimeRef);
WaitForNextFrameAndAdvanceRNG();
LoadBufferedInputs();
CopySpritesToOam();
nullsub_13();
sub_8005304();
nullsub_14();
TransferBGPaletteBuffer();
sub_8009908();
xxx_call_update_bg_vram();
xxx_call_update_bg_sound_input();
gDungeon->unk181e8.unk18213 = 0;
sub_8011860();
ResetSprites(FALSE);
nullsub_10(FALSE);
gUnknown_202EDD4--;
}
void sub_803E708(s32 numFrames, u32 a1)
{
while (numFrames != 0) {
DungeonRunFrameActions(a1);
numFrames--;
}
}
void sub_803E724(s32 r0)
{
do
{
DungeonRunFrameActions(r0);
} while (gRealInputs.held & 0xF0);
}
void sub_803E748(void) {
s32 index1;
s32 index2;
index2 = 0x1F;
gUnknown_203B40D = 1;
gDungeonBrightness = 0;
sub_803E874(1, 0x1F);
for(index1 = 0; index1 < 0x2C; index1++)
{
if(index1 < 0x20)
{
index2 -= 2;
if(index2 <= 0)
{
index2 = 0;
sub_803EAF0(1, NULL);
gDungeon->unk181e8.unk18217 = index2;
}
}
if(index1 > 0xB)
if(gDungeonBrightness <= 0x1E)
gDungeonBrightness++;
sub_803E874(1, index2);
DungeonRunFrameActions(5);
}
gUnknown_203B40D = 0;
gDungeonBrightness = 0x1F;
}
void sub_803E7C8(void)
{
s32 index1;
s32 index2;
index2 = 0x1F;
gUnknown_203B40D = 1;
gDungeonBrightness = 0;
DungeonRunFrameActions(5);
for(index1 = 0; index1 < 0x2C; index1++)
{
sub_803E874(1, index2);
if(index1 < 0x20)
{
index2 -= 2;
if(index2 <= 0)
{
index2 = 0;
sub_803EAF0(1, NULL);
gDungeon->unk181e8.unk18217 = index2;
}
}
DungeonRunFrameActions(5);
}
gUnknown_203B40D = 0;
}
void sub_803E830(void)
{
s32 index;
gUnknown_203B40D = 1;
for(index = 0; index < 0x20; index++)
{
sub_803E874(0, 0);
DungeonRunFrameActions(5);
if(gDungeonBrightness > 0)
gDungeonBrightness--;
}
gDungeonBrightness = 0;
gUnknown_203B40D = 0;
}

View File

@@ -1,71 +0,0 @@
#include "global.h"
#include "structs/dungeon_entity.h"
#include "structs/str_dungeon.h"
#include "code_800558C.h"
#include "code_800C9CC.h"
#include "code_80118A4.h"
#include "def_filearchives.h"
#include "dungeon_message.h"
#include "dungeon_map_access.h"
#include "dungeon_music.h"
#include "file_system.h"
#include "play_time.h"
extern s32 gUnknown_80F6568[];
extern const char gUnknown_80F6604; // "zmappat"
extern void sub_803F7BC(void);
extern void sub_803F580(u32);
extern void ShowWholeRevealedDungeonMap();
extern const char *gUnknown_80FD040; // It became brighter on the floor
// Luminous Orb???
void HandleLuminousOrbAction(Entity *pokemon)
{
int XCoord;
int YCoord;
gDungeon->unk181e8.allTilesRevealed = TRUE;
for(YCoord = 0; YCoord < DUNGEON_MAX_SIZE_Y; YCoord++)
{
for(XCoord = 0; XCoord < DUNGEON_MAX_SIZE_X; XCoord++)
{
Tile *mapTile = GetTileMut(XCoord, YCoord);
mapTile->spawnOrVisibilityFlags |= VISIBILITY_FLAG_REVEALED;
}
}
sub_803F580(0);
sub_8049ED4();
ShowWholeRevealedDungeonMap();
LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FD040);
}
void sub_8040094(u8 r0)
{
gDungeon->unk181e8.unk18217 = r0;
sub_803F7BC();
sub_80060EC();
IncrementPlayTime(gPlayTimeRef);
WaitForNextFrameAndAdvanceRNG();
LoadBufferedInputs();
xxx_call_update_bg_sound_input();
UpdateDungeonMusic();
sub_8011860();
}
void sub_80400D4(void)
{
s32 temp;
temp = gDungeon->unk181e8.unk18200;
if(temp == 0)
return;
if(temp > 0x1E)
temp = 0x1F;
gDungeon->unk181e8.unk181FC = gUnknown_80F6568[temp];
gDungeon->unk181e8.unk18200--;
if(gDungeon->unk181e8.unk18200 == 0)
gDungeon->unk181e8.unk18200 = gDungeon->unk181e8.unk18204;
}

View File

@@ -9,7 +9,7 @@
#include "code_8009804.h"
#include "code_800E9E4.h"
#include "code_800ED38.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_804267C.h"
#include "dungeon.h"
#include "dungeon_message.h"

View File

@@ -10,7 +10,7 @@
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "code_800ED38.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "code_8041AD0.h"
#include "code_804267C.h"
@@ -216,7 +216,6 @@ s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5)
EntityInfo *entInfo;
DungeonPos pos;
unkStruct_80416E0 sp;
unkStruct_2039DB0 unkStruct;
PixelPos pixelPos;
s32 var;
s32 r4;
@@ -258,7 +257,7 @@ s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5)
sp.unk12 = 0;
sp.unk18 = var;
sub_8004E8C(&unkStruct);
sub_8004E8C(&sp.unk1C);
r4 = sub_8041764(&sp, FALSE);
if (a2) {
for (i = 0; i < 100; i++) {
@@ -286,7 +285,6 @@ s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3)
int counter;
s32 ret;
unkStruct_80416E0 auStack_10;
unkStruct_2039DB0 stack1C;
auStack_10.unk0 = param_2;
auStack_10.unk4 = 0;
@@ -299,7 +297,7 @@ s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3)
auStack_10.unk10 = 0;
auStack_10.unk12 = 0;
auStack_10.unk18 = 0xffff;
sub_8004E8C(&stack1C);
sub_8004E8C(&auStack_10.unk1C);
ret = sub_8041764(&auStack_10, FALSE);
if (param_3) {
counter = 0;
@@ -1227,7 +1225,6 @@ s32 sub_8042520(Entity *a0)
u32 dir;
s32 iVar8;
unkStruct_80416E0 local_58;
unkStruct_2039DB0 u203; // Unused
PixelPos local_2c;
if (sub_8045888(a0)) {
@@ -1245,7 +1242,7 @@ s32 sub_8042520(Entity *a0)
local_58.unk12 = 0;
local_58.unk14 = -1;
local_58.unk18 = iVar8;
sub_8004E8C(&u203);
sub_8004E8C(&local_58.unk1C);
uVar4 = sub_8041764(&local_58, 0);
for (i = 0; i < 6; i++) {
@@ -1568,7 +1565,6 @@ static const unkStruct_2039DB0 gUnknown_80F683C = {0xFFFF, 0xFFFF, 0xFFFF, 0, 0,
void sub_8042B34(s32 a0, s32 a1, s32 a2)
{
unkStruct_80416E0 spStruct;
unkStruct_2039DB0 stack1C;
s32 i;
s32 r8 = 0;
Entity *leader = xxx_call_GetLeader();
@@ -1598,7 +1594,7 @@ void sub_8042B34(s32 a0, s32 a1, s32 a2)
spStruct.unk12 = gUnknown_203B414->unk8C[i].y;
spStruct.unk14 = 4;
spStruct.unk18 = 0xFFFF;
stack1C = gUnknown_80F683C;
spStruct.unk1C = gUnknown_80F683C;
gUnknown_203B414->unkC[i] = sub_800E890(&spStruct);
r8++;

View File

@@ -3,15 +3,15 @@
#include "constants/dungeon.h"
#include "constants/item.h"
#include "constants/move_id.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "code_8041AD0.h"
#include "code_8044CC8.h"
#include "dungeon_action.h"
#include "code_8066D04.h"
#include "code_806CD90.h"
#include "code_8077274_1.h"
#include "code_807CD9C.h"
#include "code_8084778.h"
#include "dungeon_jobs.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"

View File

@@ -10,7 +10,7 @@
#include "structs/str_806B7F8.h"
#include "structs/str_dungeon.h"
#include "code_800F958.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E668.h"
#include "code_805D8C8.h"
#include "code_806CD90.h"

View File

@@ -7,7 +7,7 @@
#include "constants/dungeon.h"
#include "constants/iq_skill.h"
#include "structs/str_dungeon.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E668.h"
#include "code_8041AD0.h"
#include "code_804267C.h"

View File

@@ -10,7 +10,7 @@
#include "position_util.h"
#include "dungeon_music.h"
#include "dungeon_map_access.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_806CD90.h"
#include "game_options.h"
#include "dungeon_items.h"

View File

@@ -23,7 +23,7 @@
#include "position_util.h"
#include "dungeon_music.h"
#include "dungeon_map_access.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_806CD90.h"
#include "game_options.h"
#include "dungeon_items.h"

View File

@@ -1,12 +1,12 @@
#include "global.h"
#include "globaldata.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "code_805D8C8.h"
#include "code_806CD90.h"
#include "code_8077274_1.h"
#include "code_808417C.h"
#include "dungeon_random.h"
#include "constants/ability.h"
#include "constants/item.h"
#include "constants/status.h"

View File

@@ -1,23 +0,0 @@
#include "global.h"
#include "structs/str_dungeon.h"
#include "structs/str_202ED28.h"
#include "sprite.h"
bool8 sub_8083568(s32 inX, s32 inY, u8 index)
{
s32 x = inX - gDungeon->unk181e8.cameraPixelPos.x;
s32 y = inY - gDungeon->unk181e8.cameraPixelPos.y;
if (x >= -16 && y >= -16 && x <= 255 && y <= 175)
{
SpriteSetX(&gUnknown_202ED28[0][index].sprite, x + gUnknown_202ED28[0][index].pos.x);
SpriteSetY(&gUnknown_202ED28[0][index].sprite, y + gUnknown_202ED28[0][index].pos.y);
AddSprite(&gUnknown_202ED28[0][index].sprite, 0, NULL, NULL);
return TRUE;
}
else
{
return FALSE;
}
}

View File

@@ -1,26 +0,0 @@
#include "global.h"
#include "constants/ability.h"
#include "constants/iq_skill.h"
#include "structs/dungeon_entity.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
s32 CalculateStatusTurns(Entity *target, s16 *turnRange, bool8 factorCurerSkills)
{
s32 numTurns;
numTurns = DungeonRandRange(turnRange[0],turnRange[1]);
if (EntityIsValid(target) && (GetEntityType(target) == ENTITY_MONSTER) && (factorCurerSkills)) {
if (IQSkillIsEnabled(target, IQ_SELF_CURER) && (numTurns != 0x7f)) {
numTurns /= 2;
}
if (AbilityIsActive(target, ABILITY_NATURAL_CURE) && (numTurns != 0x7f) && (4 < numTurns)) {
numTurns = 5;
}
}
if (numTurns < 1) {
numTurns = 1;
}
return numTurns;
}

View File

@@ -1,25 +0,0 @@
#include "global.h"
#include "code_8084778.h"
#include "string_format.h"
#include "code_80958E8.h"
#include "mailbox.h"
#include "pokemon_mid.h"
#include "structs/str_dungeon.h"
extern const u8 gUnknown_8107224[];
void sub_8084778(void)
{
s32 i;
WonderMail *wm;
strcpy(gFormatBuffer_Monsters[3], gUnknown_8107224);
for (i = 0; i < MAX_ACCEPTED_JOBS; i++) {
wm = GetJobSlotInfo(i);
if (wm->mailType == MAIL_TYPE_TAKEN_JOB && gDungeon->unk644.dungeonLocation.id == wm->unk4.dungeon.id && wm->missionType == WONDER_MAIL_MISSION_TYPE_ESCORT_CLIENT) {
CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[3], wm->targetSpecies);
break;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,122 +0,0 @@
#include "global.h"
#include "code_8085E98.h"
#include "code_800E9A8.h"
#include "code_803E46C.h"
#include "dungeon_util.h"
#include "items.h"
#include "code_800DAC0.h"
#include "code_800ED38.h"
#include "structs/sprite_oam.h"
#include "structs/str_dungeon.h"
extern const unkStruct_2039DB0 gUnknown_8107374;
void sub_8085F44(s32);
bool8 sub_800E90C(DungeonPos *);
void sub_8088EE8(void);
void sub_8088848(void);
void sub_808A718(void);
void sub_8085E98(void)
{
gDungeon->unk181e8.unk18215 = 0;
}
void sub_8085EB0(void)
{
gDungeon->unk181e8.unk18215 = 1;
}
u32 sub_8085EC8(s16 param_1,u32 param_2,u32 param_3,DungeonPos *param_4,
bool32 param_5)
{
u32 uVar1;
unkStruct_80416E0 local_40;
unkStruct_2039DB0 stack1C;
bool8 param_5_bool8;
s32 param_1_s32 = param_1;
param_5_bool8 = param_5;
sub_800EE5C(param_1_s32);
sub_800EF64();
DungeonRunFrameActions(0x46);
local_40.unk0 = param_1;
local_40.unk4 = param_2;
local_40.dir = param_3;
local_40.x = param_4->x;
local_40.y = param_4->y;
local_40.unk10 = 0;
local_40.unk12 = 0;
local_40.unk18 = 0xffff;
stack1C = gUnknown_8107374;
uVar1 = sub_800E890(&local_40);
if (param_5_bool8) {
sub_8085F44(uVar1);
uVar1 = -1;
}
return uVar1;
}
void sub_8085F44(s32 param_1)
{
while (sub_800E9A8(param_1)) {
sub_800E90C(&gDungeon->unk181e8.cameraPixelPos);
DungeonRunFrameActions(0x46);
}
}
void sub_8085F78(void)
{
switch(gDungeon->unk3A0D) {
case 0x12:
case 0x13:
case 0x14:
sub_8088848();
break;
case 0x15:
sub_8088EE8();
break;
case 0x29:
case 0x2A:
sub_808A718();
break;
case 0:
case 0x3C:
default:
break;
}
return;
}
bool8 sub_80860A8(u8 id)
{
Item *item;
EntityInfo *info;
Entity *entity;
int index;
for(index = 0; index < INVENTORY_SIZE; index++)
{
item = &gTeamInventoryRef->teamItems[index];
if((item->flags & 1) != 0)
{
if((item->id) == id) return TRUE;
}
}
for(index = 0; index < MAX_TEAM_MEMBERS; index++)
{
entity = gDungeon->teamPokemon[index];
if (((EntityIsValid(entity)) && (info = GetEntInfo(entity), ((info->heldItem).flags & 1))) && ((info->heldItem).id == id)) return TRUE;
}
return FALSE;
}

View File

@@ -1,118 +0,0 @@
#include "global.h"
#include "constants/direction.h"
#include "structs/sprite_oam.h"
#include "code_800DAC0.h"
#include "code_800ED38.h"
#include "code_803E46C.h"
#include "code_803E668.h"
#include "code_806CD90.h"
#include "code_80861A8.h"
#include "dungeon_music.h"
#include "dungeon_util.h"
#include "sprite.h"
extern const unkStruct_2039DB0 gUnknown_8107380;
extern const u8 *gUnknown_810665C[];
extern const u8 *gUnknown_810668C[];
extern const u8 *gUnknown_81066D4[];
extern const u8 *gUnknown_81066F0[];
extern const u8 *gUnknown_810671C[];
static void sub_80861EC(Entity *);
s32 sub_800E700(s32);
void sub_8085F44(s32);
void sub_8052FB8(const u8 *);
void sub_8086124(Entity *entity, u8 param_2)
{
GetEntInfo(entity)->unk160 = param_2;
}
void sub_8086130(void)
{
DungeonFadeOutBGM(0x3c);
sub_803E708(0x3c,0x46);
sub_8052FB8(*gUnknown_810665C);
sub_803E708(0x1e,0x46);
sub_8052FB8(*gUnknown_810668C);
sub_803E708(0x1e,0x46);
sub_8052FB8(*gUnknown_81066D4);
sub_803E708(0x1e,0x46);
sub_8052FB8(*gUnknown_81066F0);
sub_803E708(0x1e,0x46);
sub_8052FB8(*gUnknown_810671C);
sub_803E708(0x1e,0x46);
}
void sub_80861A8(Entity *a0)
{
sub_806CDD4(a0, 0, NUM_DIRECTIONS);
}
void sub_80861B8(Entity *a0, u8 r1, s32 direction)
{
EntityInfo *info;
info = GetEntInfo(a0);
sub_806CDD4(a0, r1, direction);
info->unkFE = r1;
}
void sub_80861D4(Entity *a0, u8 r1, s32 direction)
{
sub_806CDD4(a0, r1, direction);
sub_80861EC(a0);
}
void sub_80861EC(Entity *a0)
{
GetEntInfo(a0)->unkFE = 0x63;
}
s32 sub_80861F8(s32 param_1,Entity *param_2,bool32 param_3)
{
EntityInfo *info;
s32 uVar2;
s32 uStack_38;
DungeonPos pos;
unkStruct_80416E0 stack;
unkStruct_2039DB0 stack1C;
// Needed to match.
s32 param_1Copy2 = (s16) param_1;
s32 param_1Copy = param_1Copy2;
u8 param_3_bool32 = param_3;
sub_800EE5C(param_1Copy2);
sub_800EF64();
DungeonRunFrameActions(0x46);
info = GetEntInfo(param_2);
pos.x = 0;
pos.y = 0;
uStack_38 = sub_800E700(param_1Copy);
if (uStack_38 != -1) {
sub_800569C(&pos, &param_2->axObj, uStack_38);
}
stack.unk0 = param_1Copy;
stack.unk4 = 0;
stack.dir = info->action.direction;
stack.x = (param_2->pixelPos).x / 256;
stack.y = (param_2->pixelPos).y / 256;
stack.unk10 = pos.x;
stack.unk12 = pos.y;
stack.unk14 = uStack_38;
stack.unk18 = 0xffff;
stack1C = gUnknown_8107380;
uVar2 = sub_800E890(&stack);
if (param_3_bool32) {
sub_8085F44(uVar2);
uVar2 = -1;
}
return uVar2;
}

View File

@@ -1,492 +0,0 @@
#include "global.h"
#include "code_800E9E4.h"
#include "code_803E46C.h"
#include "code_803E668.h"
#include "code_806CD90.h"
#include "code_80869E4.h"
#include "constants/direction.h"
#include "dungeon_util.h"
#include "dungeon_util_1.h"
#include "random.h"
#include "structs/str_dungeon.h"
// This file may originally be merged with code_8086A3C.c and code_8057824_1.c
// ???
extern u32 gDungeonBrightness;
EWRAM_DATA static unkStruct_202F3D0 gUnknown_202F3D0 = {0};
// data_8107010.s
extern u32 gUnknown_8107314[];
s8 sub_8002984(s8, u8);
extern void BgColorCallNullsub4(void);
extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32);
extern void PlaySoundEffect(u32);
extern void sub_8085EB0(void);
extern void sub_803E748(void);
extern s32 GetCameraXPos(void);
extern s32 GetCameraYPos(void);
extern void sub_803F878(u32, u32);
extern void sub_8086A54(Entity *);
extern void sub_8086A3C(Entity *);
extern void PlaySoundEffect(u32);
extern void sub_80861F8(u32, Entity *, u32);
extern u32 sub_8002A70(u32, s32, u8);
void SpriteShockEffect(Entity *entity)
{
PlaySoundEffect(464);
sub_80861F8(323, entity, 0);
}
static void sub_80862DC(Entity *entity)
{
PixelPos pos;
pos.x = entity->pixelPos.x;
pos.y = entity->pixelPos.y + 0x3800;
sub_804535C(entity, &pos);
sub_806CDD4(entity, 0, DIRECTION_NORTH);
sub_8086A54(entity);
}
static void sub_8086310(Entity *entity)
{
PixelPos pos;
pos.x = entity->pixelPos.x;
pos.y = entity->pixelPos.y + 0x9000;
sub_804535C(entity, &pos);
sub_806CE68(entity, DIRECTION_SOUTH);
sub_8086A3C(entity);
entity->isVisible = 0;
}
static void sub_8086348(Entity *entity)
{
PixelPos pos;
pos.x = entity->pixelPos.x + 0x7800;
pos.y = entity->pixelPos.y - 0x2000;
sub_804535C(entity, &pos);
sub_806CDD4(entity, 0, DIRECTION_WEST);
sub_8086A54(entity);
}
static void sub_8086384(Entity *entity)
{
PixelPos pos;
pos.x = entity->pixelPos.x + 0x7800;
pos.y = entity->pixelPos.y;
sub_804535C(entity, &pos);
sub_806CDD4(entity, 0, DIRECTION_WEST);
sub_8086A54(entity);
}
static void sub_80863B8(Entity *entity)
{
sub_806CDD4(entity, 0, DIRECTION_NORTH);
}
static void sub_80863C8(Entity *entity)
{
sub_806CDD4(entity, 0, DIRECTION_SOUTH);
}
static void sub_80863D8(Entity *entity)
{
sub_806CDD4(entity, 0, DIRECTION_WEST);
}
static void sub_80863E8(Entity *entity)
{
sub_806CDD4(entity, 6, DIRECTION_NORTH);
}
static void sub_80863F8(Entity *entity)
{
sub_806CE68(entity, DIRECTION_NORTH);
}
static void sub_8086404(Entity *entity)
{
sub_806CE68(entity, DIRECTION_WEST);
}
static void sub_8086410(Entity *entity)
{
IncreaseEntityPixelPos(entity, 0, -0x100);
}
static void sub_8086424(Entity *entity)
{
IncreaseEntityPixelPos(entity, 0, 0x100);
}
static void sub_8086434(Entity *entity)
{
IncreaseEntityPixelPos(entity, -0x100, 0);
}
void sub_8086448(void)
{
s32 i;
u32 XPos;
u32 YPos;
sub_80855E4(sub_80862DC);
for (i = 0; i < 56; i++) {
XPos = GetCameraXPos();
YPos = GetCameraYPos();
YPos += 0x100;
sub_803F878(XPos, YPos);
sub_80855E4(sub_8086410);
DungeonRunFrameActions(0x46);
}
sub_80855E4(sub_80863F8);
}
static void sub_8086494(void)
{
s32 i;
sub_8085930(DIRECTION_NORTHEAST);
sub_803E708(4, 70);
sub_8085930(DIRECTION_EAST);
sub_803E708(4, 70);
sub_8085930(DIRECTION_SOUTHEAST);
sub_803E708(4, 70);
sub_8085930(DIRECTION_SOUTH);
sub_803E708(4, 70);
sub_80855E4(sub_80863C8);
for (i = 0; i < 144; i++) {
sub_80855E4(sub_8086424);
DungeonRunFrameActions(70);
}
sub_80855E4(sub_8086310);
}
void sub_8086500(void)
{
s32 i;
u32 XPos;
u32 YPos;
sub_80855E4(sub_8086348);
for (i = 0; i < 72; i++) {
XPos = GetCameraXPos();
XPos += 0x100;
YPos = GetCameraYPos();
sub_803F878(XPos, YPos);
sub_80855E4(sub_8086434);
DungeonRunFrameActions(70);
}
sub_80855E4(sub_8086404);
}
void sub_808654C(void)
{
s32 i;
u32 XPos;
u32 YPos;
sub_80855E4(sub_8086384);
for (i = 0; i < 120; i++) {
XPos = GetCameraXPos();
XPos += 0x100;
YPos = GetCameraYPos();
sub_803F878(XPos, YPos);
sub_80855E4(sub_8086434);
DungeonRunFrameActions(70);
}
sub_80855E4(sub_8086404);
}
void sub_8086598(void)
{
s32 i;
u32 XPos;
u32 YPos;
sub_80855E4(sub_80863B8);
for (i = 0; i < 24; i++) {
XPos = GetCameraXPos();
YPos = GetCameraYPos();
sub_803F878(XPos, YPos - 0x100);
sub_80855E4(sub_8086410);
DungeonRunFrameActions(70);
}
sub_80855E4(sub_80863F8);
}
void sub_80865E8(void)
{
s32 i;
u32 XPos;
u32 YPos;
sub_80855E4(sub_80863E8);
for (i = 0; i < 12; i++) {
XPos = GetCameraXPos();
YPos = GetCameraYPos();
sub_803F878(XPos, YPos + 0x200);
sub_80855E4(sub_8086424);
sub_80855E4(sub_8086424);
DungeonRunFrameActions(70);
}
sub_80855E4(sub_80863F8);
}
void sub_808663C(void)
{
s32 i;
u32 XPos;
u32 YPos;
sub_80855E4(sub_80863E8);
for (i = 0; i < 16; i++) {
XPos = GetCameraXPos();
YPos = GetCameraYPos();
sub_803F878(XPos, YPos + 0x200);
sub_80855E4(sub_8086424);
sub_80855E4(sub_8086424);
DungeonRunFrameActions(70);
}
sub_80855E4(sub_80863F8);
}
void sub_8086690(void)
{
s32 i;
sub_80855E4(sub_80863D8);
for (i = 0; i < 48; i++) {
sub_80855E4(sub_8086434);
DungeonRunFrameActions(70);
}
sub_80855E4(sub_8086404);
}
void sub_80866C4(const struct DungeonDialogueStruct *dialogue)
{
SpriteLookAroundEffect(xxx_call_GetLeader());
sub_803E708(10, 70);
DisplayDungeonDialogue(dialogue);
sub_803E708(10, 70);
sub_8086494();
gDungeon->unk2 = 1;
}
UNUSED static void sub_80866FC(void)
{
s32 i;
for (i = 0; i >= -250; i -= 10) {
SetDungeonBGColorRGB(i, i, i, 1, 0);
DungeonRunFrameActions(70);
}
}
UNUSED static void sub_808627C(void)
{
sub_803E748();
}
void sub_8086738(void)
{
s32 i;
for (i = 0; i < 250; i += 10) {
SetDungeonBGColorRGB(i, i, i, 1, 0);
DungeonRunFrameActions(70);
}
}
void sub_8086764(void)
{
s32 i;
for (i = 250; i >= 0; i -= 5) {
SetDungeonBGColorRGB(i, i, i, 1, 0);
DungeonRunFrameActions(70);
}
sub_8085EB0();
}
void sub_8086794(void)
{
s32 i;
gDungeonBrightness = 0;
for (i = 0; i < 200; i++) {
SetDungeonBGColorRGB(0, 0, 0, 1, 0);
BgColorCallNullsub4();
DungeonRunFrameActions(70);
if ((i & 3) == 0) {
gDungeonBrightness++;
if (gDungeonBrightness == 31)
break;
}
}
DungeonRunFrameActions(70);
gDungeon->unk7 = 0;
}
void sub_80867F4(void)
{
gUnknown_202F3D0.unk0 = 0;
gUnknown_202F3D0.unk1 = 0;
gUnknown_202F3D0.unk2 = 0;
gUnknown_202F3D0.unk3 = 0;
gUnknown_202F3D0.unk4 = 0;
gUnknown_202F3D0.unk5 = 0;
}
void sub_808680C(void)
{
gUnknown_202F3D0.unk0 = 1;
if (gUnknown_202F3D0.unk3 != 0)
PlaySoundEffect(505);
}
void sub_808682C(void)
{
gUnknown_202F3D0.unk0 = 0;
}
void sub_8086838(u8 entity, u8 r1, u8 r2)
{
gUnknown_202F3D0.unk1 = entity;
gUnknown_202F3D0.unk2 = r1;
gUnknown_202F3D0.unk3 = r2;
}
void sub_8086848(u8 entity, u8 r1)
{
gUnknown_202F3D0.unk4 = entity;
gUnknown_202F3D0.unk5 = r1;
}
void sub_8086854(void)
{
if (gUnknown_202F3D0.unk0) {
if (gUnknown_202F3D0.unk4 == 0) {
if (gUnknown_202F3D0.unk1) {
gUnknown_202F3D0.unk4 = 80;
gUnknown_202F3D0.unk5 = 16;
}
else {
gUnknown_202F3D0.unk4 = RandInt(6) + 2;
gUnknown_202F3D0.unk5 = RandInt(6) + 2;
}
if (gUnknown_202F3D0.unk3 != 0)
PlaySoundEffect(505);
}
else
gUnknown_202F3D0.unk4--;
if (gUnknown_202F3D0.unk5 != 0)
gUnknown_202F3D0.unk5--;
gDungeon->unk181e8.unk181FC = gUnknown_8107314[gUnknown_202F3D0.unk5];
}
else
gDungeon->unk181e8.unk181FC = 0;
}
void sub_80868F4(Entity *entity)
{
GetEntInfo(entity)->unk15C = 1;
GetEntInfo(entity)->unk15D = 1;
}
void sub_8086910(Entity *entity)
{
GetEntInfo(entity)->unk15C = 0;
GetEntInfo(entity)->unk15D = 0;
}
void sub_808692C(void)
{
sub_80859F0(DIRECTION_NORTHWEST);
sub_803E708(4, 70);
sub_80859F0(DIRECTION_WEST);
sub_803E708(4, 70);
sub_80859F0(DIRECTION_SOUTHWEST);
sub_803E708(4, 70);
sub_80859F0(DIRECTION_SOUTH);
sub_803E708(4, 70);
}
void SpriteLookAroundEffect(Entity *entity)
{
s8 r4;
s8 r3;
r4 = sub_8002984(GetEntInfo(entity)->action.direction, 4);
sub_80869E4(entity, 4, 2, r4);
sub_803E708(15, 70);
r4 = sub_8002984(r4, 5);
sub_80869E4(entity, 4, 1, r4);
sub_803E708(15, 70);
r3 = sub_8002984(r4, 4);
sub_80869E4(entity, 4, 2, r3);
sub_803E708(15, 70);
}
void sub_80869E4(struct Entity *entity, s32 a1, u8 a2, s32 _someDirection)
{
s32 someDirection = (s8) _someDirection;
struct EntityInfo *info = GetEntInfo(entity);
s32 direction = (s8) info->action.direction;
while (direction != someDirection) {
direction = (s8) sub_8002A70(direction, someDirection, a2);
info->action.direction = direction;
info->action.direction &= DIRECTION_MASK;
sub_806CE68(entity, info->action.direction);
sub_803E708(a1, 70);
}
}

View File

@@ -41,18 +41,17 @@ static const u8 sUnknown_80F42F0[256] = {
};
static const u8 gUnknown_80F43F0[PASSWORD_BUFFER_SIZE] = {
0x0d, 0x07, 0x19, 0x0f, 0x04, 0x1d, 0x2a, 0x31, 0x08, 0x13,
0x2d, 0x18, 0x0e, 0x1a, 0x1b, 0x29, 0x01, 0x20, 0x21,
0x22, 0x11, 0x33, 0x26, 0x00, 0x35, 0x0a, 0x2b, 0x1f,
0x12, 0x23, 0x2c, 0x17, 0x27, 0x10, 0x1c, 0x30, 0x0b,
0x02, 0x24, 0x09, 0x32, 0x05, 0x28, 0x34, 0x2e, 0x03,
0x1e, 0x0c, 0x25, 0x14, 0x2f, 0x16, 0x06, 0x15
0x0d, 0x07, 0x19, 0x0f, 0x04, 0x1d, 0x2a, 0x31, 0x08, 0x13,
0x2d, 0x18, 0x0e, 0x1a, 0x1b, 0x29, 0x01, 0x20, 0x21,
0x22, 0x11, 0x33, 0x26, 0x00, 0x35, 0x0a, 0x2b, 0x1f,
0x12, 0x23, 0x2c, 0x17, 0x27, 0x10, 0x1c, 0x30, 0x0b,
0x02, 0x24, 0x09, 0x32, 0x05, 0x28, 0x34, 0x2e, 0x03,
0x1e, 0x0c, 0x25, 0x14, 0x2f, 0x16, 0x06, 0x15
};
static const u8 gUnknown_80F4426[34] = {
0x0c, 0x06, 0x13, 0x08, 0x04, 0x0d, 0x0f, 0x09, 0x10, 0x02,
0x14, 0x12, 0x00, 0x15, 0x0b, 0x05, 0x17, 0x03, 0x11,
0x0a, 0x01, 0x0e, 0x16, 0x07, 0x00, 0x00,0x70, 0x6b,
0x73, 0x64, 0x69, 0x72, 0x30, 0x00
static const u8 gUnknown_80F4426[] = {
0x0c, 0x06, 0x13, 0x08, 0x04, 0x0d, 0x0f, 0x09, 0x10, 0x02,
0x14, 0x12, 0x00, 0x15, 0x0b, 0x05, 0x17, 0x03, 0x11,
0x0a, 0x01, 0x0e, 0x16, 0x07, 0x00, 0x00
};

View File

@@ -2,7 +2,7 @@
#include "globaldata.h"
#include "constants/ability.h"
#include "constants/weather.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "dungeon_message.h"
#include "code_806CD90.h"
#include "code_807CD9C.h"

View File

@@ -3,15 +3,14 @@
#include "constants/dungeon.h"
#include "constants/item.h"
#include "constants/move_id.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "code_8041AD0.h"
#include "code_8044CC8.h"
#include "dungeon_action.h"
#include "code_8066D04.h"
#include "code_806CD90.h"
#include "code_8077274_1.h"
#include "code_807CD9C.h"
#include "code_8084778.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"

View File

@@ -2,7 +2,7 @@
#include "globaldata.h"
#include "dungeon_ai_leader.h"
#include "dungeon_move_util.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_8041AD0.h"
#include "code_804267C.h"
#include "code_8066D04.h"
@@ -32,8 +32,6 @@
extern u8 gUnknown_202F221;
extern u8 gUnknown_202F222;
extern u8 gUnknown_202F32C;
extern u8 gUnknown_202F32D;
extern u8 gUnknown_203B434;
extern u8 *gUnknown_80FA5B4[];
@@ -86,6 +84,9 @@ extern void MarkLastUsedMonMove(Entity *entity, Move *move);
bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, bool32 isLinkedMove, struct Move *move);
extern void sub_80838EC(u8 *a);
EWRAM_DATA u8 gUnknown_202F32C = 0;
EWRAM_DATA u8 gUnknown_202F32D = 0;
bool8 sub_8072CF4(Entity *entity)
{
bool8 bVar4;

110
src/dungeon_8083AB0.c Normal file
View File

@@ -0,0 +1,110 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_8083AB0.h"
#include "dungeon.h"
#include "dungeon_util.h"
#include "text_util.h"
#include "dungeon_logic.h"
#include "dungeon_data.h"
#include "dungeon_strings.h"
void sub_8083AB0(s16 param_0, Entity *target, Entity *entity)
{
u8 *defPtr;
u8 *attackPtr;
u8 *spDefPtr;
EntityInfo * entityInfo;
EntityInfo * targetEntityInfo;
u8 *spAttPtr;
u8 buffer [0x14];
UnkDungeonGlobal_unk1CE98_sub *temp;
u8 *id;
s32 param_0_s32 = param_0;
temp = &gDungeon->unk1CE98;
targetEntityInfo = NULL;
if ((EntityIsValid(target)) && (GetEntityType(target) == ENTITY_MONSTER)) {
targetEntityInfo = GetEntInfo(target);
}
entityInfo = GetEntInfo(entity);
if (targetEntityInfo != NULL) {
sub_80709C8(buffer, targetEntityInfo);
CopyStringtoBuffer(temp->buffer1, buffer);
}
else {
CopyStringtoBuffer(temp->buffer1, gUnknown_80FE6F4); // Someone
}
sub_80709C8(buffer,entityInfo);
CopyStringtoBuffer(temp->buffer2, buffer);
temp->moveID = param_0_s32;
temp->heldItem = entityInfo->heldItem;
temp->exp = entityInfo->exp;
temp->level = entityInfo->level;
temp->maxHPStat = entityInfo->maxHPStat;
temp->atk = entityInfo->atk[0];
temp->spAtk = entityInfo->atk[1];
temp->def = entityInfo->def[0];
temp->spDef = entityInfo->def[1];
temp->dungeonLocation = gDungeon->unk644.dungeonLocation;
attackPtr = &temp->attBoost;
*attackPtr = 0;
spAttPtr = &temp->spAttBoost;
*spAttPtr = 0;
defPtr = &temp->defBoost;
*defPtr = 0;
spDefPtr = &temp->spDefBoost;
*spDefPtr = 0;
if ((entityInfo->heldItem.flags & ITEM_FLAG_EXISTS) && !(entityInfo->heldItem.flags & ITEM_FLAG_STICKY)) {
id = &entityInfo->heldItem.id;
if (*id == ITEM_POWER_BAND) {
*attackPtr += gUnknown_810AC60;
}
if (*id == ITEM_MUNCH_BELT) {
*attackPtr += gUnknown_810AC68;
}
if (*id == ITEM_SPECIAL_BAND) {
*spAttPtr += gUnknown_810AC62;
}
if (*id == ITEM_MUNCH_BELT) {
*spAttPtr += gUnknown_810AC68;
}
if (*id == ITEM_DEF_SCARF) {
*defPtr += gUnknown_810AC64;
}
if (*id == ITEM_ZINC_BAND) {
*spDefPtr += gUnknown_810AC66;
}
}
}
bool8 sub_8083C24(void)
{
UnkDungeonGlobal_unk1CE98_sub *temp = &gDungeon->unk1CE98;
if (temp->moveID < 0x226)
return TRUE;
return FALSE;
}
bool8 sub_8083C50(void)
{
UnkDungeonGlobal_unk1CE98_sub *temp = &gDungeon->unk1CE98;
if (temp->moveID == 0x227 || temp->moveID == 0x22A || temp->moveID == 0x228)
return TRUE;
return FALSE;
}
bool8 sub_8083C88(u8 param_1)
{
UnkDungeonGlobal_unk1CE98_sub *temp = &gDungeon->unk1CE98;
if ((!HasCheckpoint(gDungeon->unk644.dungeonLocation.id) && (gDungeon->unk644.unk18 != 0 || param_1 != 0))
|| temp->moveID != 0x227) {
return TRUE;
}
return FALSE;
}

View File

@@ -14,7 +14,7 @@
#include "pokemon.h"
#include "items.h"
#include "structs/str_item_text.h"
#include "code_8044CC8.h"
#include "dungeon_action.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_engine.h"
@@ -27,9 +27,8 @@ extern void TriggerWeatherAbilities(void);
extern void sub_8071DA4(Entity *);
extern void TickStatusHeal(Entity *);
extern unkStruct_202EE44 gDungeonSubMenu[10];
extern s32 gDungeonSubMenuItemsCount;
EWRAM_DATA SubMenuAction gDungeonSubMenu[10] = {0};
EWRAM_DATA s32 gDungeonSubMenuItemsCount = 0;
extern bool8 sub_8045888(Entity *);
@@ -339,9 +338,9 @@ void sub_8045064(void)
for (i = 0; i < gDungeonSubMenuItemsCount; i++) {
for (j = i + 1; j < gDungeonSubMenuItemsCount; j++) {
unkStruct_202EE44 temp;
unkStruct_202EE44 *iPtr = &gDungeonSubMenu[i];
unkStruct_202EE44 *jPtr = &gDungeonSubMenu[j];
SubMenuAction temp;
SubMenuAction *iPtr = &gDungeonSubMenu[i];
SubMenuAction *jPtr = &gDungeonSubMenu[j];
if (gUnknown_80F7C50[iPtr->actionId].val > gUnknown_80F7C50[jPtr->actionId].val) {
SWAP(*iPtr, *jPtr, temp);

View File

@@ -5,7 +5,7 @@
#include "code_803E724.h"
#include "dungeon_message.h"
#include "code_8077274_1.h"
#include "code_808417C.h"
#include "dungeon_random.h"
#include "constants/ability.h"
#include "constants/direction.h"
#include "constants/dungeon_action.h"

View File

@@ -0,0 +1,65 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon.h"
#include "dungeon_strings.h"
#include "input.h"
#include "text_1.h"
#include "code_803E668.h"
extern void DungeonShowWindows(WindowTemplates *a0, bool8 a1);
extern void sub_8094558(u32 param_1, const u8 *param_2,UnkDungeonGlobal_unk1CE98_sub *param_3);
extern void PlayDungeonCompleteBGM(void);
extern void PlayDungeonFailBGM(void);
extern void PlayDungeonConfirmationSE(void);
extern void UpdateDungeonMusic(void);
extern u8 sub_8094D14(void);
void ShowDungeonClearedWindow(void)
{
WindowHeader header;
WindowTemplates windows = {
.id = {
[0] = {
.type = WINDOW_TYPE_WITH_HEADER,
.pos = {4, 3},
.width = 22,
.height = 14,
.unk10 = 14,
.unk12 = 0,
.header = &header,
},
[1] = WIN_TEMPLATE_DUMMY,
[2] = WIN_TEMPLATE_DUMMY,
[3] = WIN_TEMPLATE_DUMMY,
}
};
header.count = 1;
header.currId = 0;
header.width = 14;
header.f3 = 0;
windows.id[0].pos.y = 20;
DungeonShowWindows(&windows, TRUE);
if (gDungeon->unk1CE98.moveID > 549) {
PlayDungeonCompleteBGM();
}
else {
PlayDungeonFailBGM();
}
sub_8094558(0, gUnknown_80FE6E8,&gDungeon->unk1CE98); // The Last Outing
while(1) {
sub_803E668(0x36);
UpdateDungeonMusic();
if (windows.id[0].pos.y >= 4){
windows.id[0].pos.y--;
windows.id[0].unk0 = 0xa0;
DungeonShowWindows(&windows, TRUE);
continue;
}
if (sub_8094D14())
break;
if (gRealInputs.pressed & A_BUTTON)
break;
}
PlayDungeonConfirmationSE();
}

View File

@@ -0,0 +1,320 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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_8088484(Entity *param_1);
static void ArticunoScreenFlash(void);
static void sub_8088574(void);
void sub_8087F54(void)
{
Entity *leaderEntity;
Entity *articunoEntity;
leaderEntity = xxx_call_GetLeader();
articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_8085374();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
SetFacingDirection(articunoEntity, DIRECTION_SOUTH);
sub_8086A3C(articunoEntity);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y + -3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_ARTICUNO);
}
void sub_8087FB4(void)
{
Entity *articunoEntity;
articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_8085374();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
SetFacingDirection(articunoEntity, DIRECTION_SOUTH);
sub_806CDD4(articunoEntity, 0xF, DIRECTION_SOUTH);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_ARTICUNO);
}
void sub_8087FF8(void)
{
Entity *leaderEntity;
Entity *articunoEntity;
leaderEntity = xxx_call_GetLeader();
articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO);
sub_8085374();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
if (sub_8086AE4(MONSTER_ARTICUNO)) {
sub_8068FE0(articunoEntity,0x21c,0);
}
else {
sub_8072008(articunoEntity,articunoEntity,gArticunoConfigLevel,0,0);
SetFacingDirection(articunoEntity, DIRECTION_SOUTH);
sub_8086A3C(articunoEntity);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y + -3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_ARTICUNO);
}
void sub_8088088(u8 param_1, u8 param_2)
{
if ((param_2 == 0xD || param_2 == 0xE || param_2 == 0xF) && (param_1 == 0xD)) {
sub_8097FA8(0x9);
gDungeon->unk2 = 1;
}
}
void ArticunoPreFightDialogue(void)
{
Entity *leaderEntity;
Entity *partnerEntity;
Entity *articunoEntity;
leaderEntity = xxx_call_GetLeader();
partnerEntity = GetPartnerEntity();
articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO);
sub_8086448();
SpriteLookAroundEffect(partnerEntity);
DisplayDungeonDialogue(gArticunoPreFightDialogue_1);
sub_803E708(10,0x46);
sub_8086598();
DungeonStopBGM();
DisplayDungeonDialogue(&gArticunoPreFightDialogue_2);
sub_803E708(10,0x46);
sub_80869E4(partnerEntity,4,1,DIRECTION_EAST);
sub_80869E4(leaderEntity,4,2,DIRECTION_WEST);
DisplayDungeonDialogue(&gArticunoPreFightDialogue_3);
sub_803E708(10,0x46);
SetFacingDirection(leaderEntity, DIRECTION_WEST);
sub_803E708(4,0x46);
SetFacingDirection(leaderEntity, DIRECTION_NORTHWEST);
sub_803E708(4,0x46);
SetFacingDirection(leaderEntity, DIRECTION_WEST);
sub_803E708(4,0x46);
SetFacingDirection(leaderEntity, DIRECTION_SOUTHWEST);
sub_803E708(4,0x46);
SetFacingDirection(leaderEntity, DIRECTION_WEST);
sub_803E708(4,0x46);
SetFacingDirection(leaderEntity, DIRECTION_NORTHWEST);
sub_803E708(4,0x46);
SetFacingDirection(leaderEntity, DIRECTION_WEST);
sub_803E708(10,0x46);
DisplayDungeonDialogue(gArticunoPreFightDialogue_4);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gArticunoPreFightDialogue_5);
sub_803E708(10,0x46);
sub_80869E4(leaderEntity,4,1,DIRECTION_NORTH);
sub_80869E4(partnerEntity,4,2,DIRECTION_NORTH);
PlaySoundEffect(0x1d5);
SpriteLookAroundEffect(partnerEntity);
PlaySoundEffect(0x1d5);
SpriteLookAroundEffect(leaderEntity);
DisplayDungeonDialogue(&gArticunoPreFightDialogue_6);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gArticunoPreFightDialogue_7);
sub_803E708(10,0x46);
PlaySoundEffect(0); // snow flurry
gDungeon->weather.unkE265 = WEATHER_SNOW;
sub_807EAA0(0,1);
PlaySoundEffect(0x1ee); // flash effect?
sub_8088574();
DisplayDungeonDialogue(&gArticunoPreFightDialogue_8);
sub_803E708(10,0x46);
ArticunoScreenFlash();
sub_8086738();
PlaySoundEffect(0x1da);
DisplayDungeonDialogue(&gArticunoPreFightDialogue_9);
sub_803E708(10,0x46);
PlaySoundEffect(0x1ea);
sub_8088484(articunoEntity);
sub_80865E8();
ArticunoScreenFlash();
DisplayDungeonDialogue(&gArticunoPreFightDialogue_10);
sub_806CDD4(articunoEntity,0xf,DIRECTION_SOUTH);
ArticunoScreenFlash();
DisplayDungeonDialogue(&gArticunoPreFightDialogue_11);
sub_806CDD4(articunoEntity,0x10,DIRECTION_SOUTH);
ArticunoScreenFlash();
DisplayDungeonDialogue(&gArticunoPreFightDialogue_12);
sub_806CDD4(articunoEntity,0xf,DIRECTION_SOUTH);
sub_803E708(0x10,0x46);
SetupBossFightHP(articunoEntity,0x1c2,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void ArticunoReFightDialogue(void)
{
Entity *leaderEntity;
Entity *articunoEntity;
leaderEntity = xxx_call_GetLeader();
articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO);
gDungeon->weather.unkE265 = WEATHER_SNOW;
sub_807EAA0(0,1);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gArticunoReFightDialogue_1);
sub_806CDD4(articunoEntity,0x10,DIRECTION_SOUTH);
ArticunoScreenFlash();
DisplayDungeonDialogue(&gArticunoReFightDialogue_2);
ArticunoScreenFlash();
DisplayDungeonDialogue(&gArticunoReFightDialogue_3);
sub_806CDD4(articunoEntity,0xf,DIRECTION_SOUTH);
sub_803E708(0x28,0x46);
SetupBossFightHP(articunoEntity,0x1c2,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void ArticunoPostStoryPreFightDialogue(void)
{
Entity *leaderEntity;
Entity *articunoEntity;
leaderEntity = xxx_call_GetLeader();
articunoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ARTICUNO);
sub_8086448();
if (sub_8086AE4(MONSTER_ARTICUNO)) {
sub_80866C4(&gUnknown_8102A9C);
}
else {
gDungeon->weather.unkE265 = WEATHER_SNOW;
sub_807EAA0(0,1);
ArticunoScreenFlash();
sub_8086738();
PlaySoundEffect(0x1da);
DisplayDungeonDialogue(&gArticunoPostStoryPreFightDialogue_1);
sub_803E708(10,0x46);
sub_8088484(articunoEntity);
ArticunoScreenFlash();
DisplayDungeonDialogue(&gArticunoPostStoryPreFightDialogue_2);
sub_806CDD4(articunoEntity,0xf,DIRECTION_SOUTH);
ArticunoScreenFlash();
DisplayDungeonDialogue(&gArticunoPostStoryPreFightDialogue_3);
sub_806CDD4(articunoEntity,0x10,DIRECTION_SOUTH);
ArticunoScreenFlash();
DisplayDungeonDialogue(&gArticunoPostStoryPreFightDialogue_4);
ArticunoScreenFlash();
DisplayDungeonDialogue(&gArticunoPostStoryPreFightDialogue_5);
sub_806CDD4(articunoEntity,0xf,DIRECTION_SOUTH);
sub_803E708(0x28,0x46);
SetupBossFightHP(articunoEntity,0x1c2,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void sub_8088484(Entity *param_1)
{
int iVar1;
GetEntInfo(param_1)->unk15C = 1;
GetEntInfo(param_1)->unk15E = 0;
PlaySoundEffect(0x1ea);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 5)
{
GetEntInfo(param_1)->unk174 = IntToF248_2(iVar1);
SetDungeonBGColorRGB(iVar1,iVar1,iVar1 / 2,1,0);
DungeonRunFrameActions(0x46);
}
}
static void ArticunoScreenFlash(void)
{
int iVar1;
PlaySoundEffect(0x2ad);
for(iVar1 = 250; iVar1 > 0x95; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1 / 2,iVar1,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(4,0x46);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10)
{
SetDungeonBGColorRGB(0,iVar1,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(4,0x46);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1 / 2,iVar1,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(4,0x46);
sub_8085EB0();
}
static void sub_8088574(void)
{
int iVar1;
for(iVar1 = 0; iVar1 <= 80; iVar1 += 8)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,0,0);
DungeonRunFrameActions(0x46);
}
}

View File

@@ -0,0 +1,274 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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_808C8E0(Entity *entity);
static void sub_808C9B0(Entity *param_1);
void sub_808C5C0(void)
{
Entity * leaderEntity;
Entity * celebiEntity;
u32 XPos;
s32 YPos;
leaderEntity = xxx_call_GetLeader();
celebiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_CELEBI);
DungeonStartNewBGM(MUS_FRIEND_AREA_HEALING_FOREST);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
SetFacingDirection(celebiEntity, DIRECTION_SOUTH);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y);
XPos = GetCameraXPos();
YPos = GetCameraYPos();
sub_803F878(XPos,YPos - 0x1000);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_CELEBI);
}
void nullsub_100(u8 r0, u8 r1, u8 r3)
{
}
void CelebiJoinDialogue(void)
{
Entity *leaderEntity;
s32 state;
s32 menuChoice;
Entity *celebiEntity;
leaderEntity = xxx_call_GetLeader();
celebiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_CELEBI);
if ((HasRecruitedMon(MONSTER_CELEBI)) || (!sub_806FD18(celebiEntity)))
{
sub_8068FE0(celebiEntity,0x21c,0);
SpriteLookAroundEffect(leaderEntity);
sub_803E708(10,0x46);
// .........
DisplayDungeonDialogue(&gCelebiJoinDialogue_10);
}
else
{
SpriteLookAroundEffect(leaderEntity);
sub_803E708(10,0x46);
SpriteShockEffect(leaderEntity);
sub_803E708(10,0x46);
// Oh? There's someone there.
DisplayDungeonDialogue(&gCelebiJoinDialogue_1);
sub_803E708(10,0x46);
sub_8086598();
sub_8086598();
sub_8086598();
sub_8086598();
// The Time-Traveling Pokemon {POKEMON_2} (Celebi)!
DisplayDungeonDialogue(&gCelebiJoinDialogue_2);
PlaySoundEffect(0x1c7);
sub_806CDD4(celebiEntity,10,DIRECTION_SOUTH);
sub_803E708(0x14,0x46);
sub_806CE68(celebiEntity, DIRECTION_SOUTH);
sub_803E708(4,0x46);
PlaySoundEffect(0x1c7);
sub_806CDD4(celebiEntity,10,DIRECTION_SOUTH);
DisplayDungeonDialogue(&gCelebiJoinDialogue_3);
sub_803E708(10,0x46);
state = 0;
do
{
switch(state)
{
case 0:
do
{
menuChoice = DisplayDungeonMenuMessage(0,gPtrPurityForestAllowCelebiToJoinText, gPurityForestAllowCelebiToJoinPrompt,0x701);
} while (menuChoice < 1);
sub_803E708(10,0x46);
if (menuChoice == 1)
{
DungeonStopBGM();
PlaySoundEffect(0xcc);
while (IsFanfareSEPlaying_2(0xcc) != 0) {
DungeonRunFrameActions(0x46);
}
DungeonStartNewBGM(MUS_FRIEND_AREA_HEALING_FOREST);
PlaySoundEffect(0x1c7);
sub_80861D4(celebiEntity,0xd,DIRECTION_SOUTH);
sub_803E708(0x37,0x46);
PlaySoundEffect(0x1d5);
sub_803E708(0x1a,0x46);
PlaySoundEffect(0x1d5);
sub_803E708(0x1c,0x46);
DisplayDungeonDialogue(&gCelebiJoinDialogue_4);
sub_803E708(10,0x46);
sub_806FDF4(leaderEntity,celebiEntity,&celebiEntity);
DungeonStartNewBGM(MUS_FRIEND_AREA_HEALING_FOREST);
DisplayDungeonDialogue(&gCelebiJoinDialogue_5);
sub_803E708(10,0x46);
PlaySoundEffect(0x1c7);
sub_80861D4(celebiEntity,0xd,DIRECTION_SOUTH);
sub_803E708(0x37,0x46);
PlaySoundEffect(0x1d5);
sub_803E708(0x1a,0x46);
PlaySoundEffect(0x1d5);
sub_803E708(0x1b,0x46);
DisplayDungeonDialogue(&gCelebiJoinDialogue_6);
sub_803E708(10,0x46);
state = 2;
}
else
{
state = 1;
}
break;
case 1:
do
{
menuChoice = DisplayDungeonMenuMessage(0,gPtrPurityForestRefuseCelebiConfirmText, gPurityForestRefuseCelebiConfirmPrompt,0x701);
} while (menuChoice < 1);
if (menuChoice == 1)
{
state = 0;
}
else
{
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gCelebiJoinDialogue_7);
sub_80861F8(0x3e,celebiEntity,1);
sub_803E708(0x18,0x46);
sub_80861F8(0x3e,celebiEntity,1);
sub_803E708(0xe,0x46);
DisplayDungeonDialogue(&gCelebiJoinDialogue_8);
sub_803E708(10,0x46);
sub_808C8E0(celebiEntity);
DisplayDungeonDialogue(&gCelebiJoinDialogue_9);
sub_803E708(10,0x46);
state = 2;
}
break;
}
} while (state != 2);
}
DungeonFadeOutBGM(0x1e);
sub_803E708(0x1e,0x46);
gDungeon->unk2 = 1;
}
static void sub_808C8E0(Entity *entity)
{
s32 iVar1;
PlaySoundEffect(0x1a5);
sub_806CDD4(entity, 0, DIRECTION_SOUTH);
for(iVar1 = 0; iVar1 < 16; iVar1++){
GetEntInfo(entity)->unk174 = IntToF248_2(iVar1);
DungeonRunFrameActions(0x46);
}
for(iVar1 = 16; iVar1 < 200; iVar1 += 4){
GetEntInfo(entity)->unk174 = IntToF248_2(iVar1);
DungeonRunFrameActions(0x46);
}
sub_8086A3C(entity);
}
void sub_808C938(void)
{
sub_80855E4(sub_808C9B0);
}
void sub_808C948(Entity *entity, u8 param_2)
{
bool8 flag;
s32 index;
Entity *pokeEntity;
if (param_2 == 0x37) {
flag = FALSE;
for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++){
pokeEntity = gDungeon->wildPokemon[index];
if ((pokeEntity != entity) && (EntityIsValid(pokeEntity))) {
flag = TRUE;
break;
}
}
if (!flag) {
gDungeon->unk2 = 1;
}
}
}
void sub_808C998(void)
{
// Defeat the opposing team to win
// Be careful, your opponents are tough
DisplayDungeonDialogue(&gUnknown_8106720);
sub_803E708(0xA, 0x46);
}
static void sub_808C9B0(Entity *param_1)
{
GetEntInfo(param_1)->action.direction = DIRECTION_NORTH;
sub_806CE68(param_1, DIRECTION_NORTH);
}

View File

@@ -0,0 +1,175 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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 s32 gDungeonBrightness;
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_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 DeoxysScreenFlash(void);
static void sub_808C550(void);
static void sub_808C590(Entity *r0);
static void SetupDeoxysFacingDirection(Entity *deoxysEntity);
static void SetupDeoxysFightHP(Entity *deoxysEntity);
void sub_808C3A0(void)
{
Entity * leaderEntity;
leaderEntity = xxx_call_GetLeader();
DungeonStopBGM();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
if (HasRecruitedMon(MONSTER_DEOXYS_NORMAL)) {
sub_808563C(sub_808C590);
}
else {
gDungeon->unk7 = 1;
sub_808563C(SetupDeoxysFacingDirection);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_DEOXYS_NORMAL);
}
void sub_808C414(u8 param_1,u8 param_2,u8 param_3)
{
if ((param_2 == 0x35) && (param_1 == 0x1D)) {
gDungeon->unk2 = 1;
DungeonStartNewBGM(MUS_RAYQUAZAS_DOMAIN);
}
}
void DeoxysPreFightDialogue(void)
{
Entity * leaderEntity;
leaderEntity = xxx_call_GetLeader();
sub_8086448();
if (HasRecruitedMon(MONSTER_DEOXYS_NORMAL)) {
// There appears to be no one here.
// It's impossible to go any further
sub_80866C4(&gDeoxysPreFightDialogue_5);
}
else {
DisplayDungeonDialogue(&gDeoxysPreFightDialogue_1);
DungeonFadeInNewBGM(MUS_RAYQUAZAS_DOMAIN, 0x3c);
sub_808C550();
DisplayDungeonDialogue(&gDeoxysPreFightDialogue_2);
DeoxysScreenFlash();
DisplayDungeonDialogue(&gDeoxysPreFightDialogue_3);
DeoxysScreenFlash();
DisplayDungeonDialogue(&gDeoxysPreFightDialogue_4);
sub_803E708(10,0x46);
sub_808563C(SetupDeoxysFightHP);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void DeoxysScreenFlash(void)
{
s32 iVar1;
PlaySoundEffect(0x2c1);
for(iVar1 = 250; iVar1 > 149; iVar1 -= 10){
SetDungeonBGColorRGB(iVar1,0,0,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10){
SetDungeonBGColorRGB(iVar1,iVar1,0,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10){
SetDungeonBGColorRGB(iVar1,0,0,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
sub_8085EB0();
}
static void sub_808C550(void)
{
gDungeonBrightness = 0x1f;
SetDungeonBGColorRGB(0,0,0,1,1);
BgColorCallNullsub4();
DungeonRunFrameActions(0x46);
gDungeon->unk7 = 0;
DeoxysScreenFlash();
}
static void sub_808C590(Entity *r0)
{
sub_8068FE0(r0, 0x21C, 0);
}
static void SetupDeoxysFacingDirection(Entity *deoxysEntity)
{
SetFacingDirection(deoxysEntity, DIRECTION_SOUTH);
}
static void SetupDeoxysFightHP(Entity *deoxysEntity)
{
SetupBossFightHP(deoxysEntity, 950, MUS_BATTLE_WITH_RAYQUAZA);
}

View File

@@ -0,0 +1,73 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_8086A3C(Entity *pokemon);
void sub_80885A0(void)
{
DungeonFadeOutBGM(0x3c);
sub_803E708(0x3c,0x46);
DungeonStopBGM();
gDungeon->unk7 = 1;
}
void sub_80885C4(void)
{
Entity * leaderEntity;
leaderEntity = xxx_call_GetLeader();
DungeonFadeOutBGM(0x3c);
sub_803E708(0x3c,0x46);
DungeonStopBGM();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
}
void sub_8088608(void)
{
gDungeon->unk2 = 1;
}
void sub_8088618(void)
{
sub_8086448();
// The mountain's summit...
// But there is no one here
// It's time to go back
sub_80866C4(&gUnknown_8102B10);
}

View File

@@ -0,0 +1,195 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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 EnteiScreenFlash(void);
void sub_8089C44(void)
{
Entity * leaderEntity;
Entity * EnteiEntity;
leaderEntity = xxx_call_GetLeader();
EnteiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ENTEI);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
SetFacingDirection(EnteiEntity, DIRECTION_SOUTH);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_ENTEI);
}
void sub_8089C90(void)
{
Entity * leaderEntity;
Entity * EnteiEntity;
leaderEntity = xxx_call_GetLeader();
EnteiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ENTEI);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
if (HasRecruitedMon(MONSTER_ENTEI)) {
sub_8068FE0(EnteiEntity,0x21c,0);
}
else {
SetFacingDirection(EnteiEntity, DIRECTION_SOUTH);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_ENTEI);
}
void sub_8089CFC(u8 param_1, u8 param_2)
{
if ((param_2 == 0x20 || param_2 == 0x21 || param_2 == 0x22) && (param_1 == 0x12)) {
sub_8097FA8(0x15);
gDungeon->unk2 = 1;
}
}
void EnteiPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * EnteiEntity;
leaderEntity = xxx_call_GetLeader();
EnteiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ENTEI);
EnteiScreenFlash();
DisplayDungeonDialogue(&gEnteiPreFightDialogue_1);
EnteiScreenFlash();
DisplayDungeonDialogue(&gEnteiPreFightDialogue_2);
EnteiScreenFlash();
DisplayDungeonDialogue(&gEnteiPreFightDialogue_3);
sub_803E708(10,70);
SetupBossFightHP(EnteiEntity,600,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void EnteiReFightDialogue(void)
{
Entity * leaderEntity;
Entity * EnteiEntity;
leaderEntity = xxx_call_GetLeader();
EnteiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ENTEI);
EnteiScreenFlash();
DisplayDungeonDialogue(&gEnteiReFightDialogue_1);
EnteiScreenFlash();
DisplayDungeonDialogue(&gEnteiReFightDialogue_2);
EnteiScreenFlash();
DisplayDungeonDialogue(&gEnteiReFightDialogue_3);
sub_803E708(10,70);
SetupBossFightHP(EnteiEntity,600,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void EnteiPostStoryPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * EnteiEntity;
leaderEntity = xxx_call_GetLeader();
EnteiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ENTEI);
if (HasRecruitedMon(MONSTER_ENTEI)) {
sub_80866C4(&gEnteiPostStoryPreFightDialogue_4);
}
else {
EnteiScreenFlash();
DisplayDungeonDialogue(&gEnteiPostStoryPreFightDialogue_1);
EnteiScreenFlash();
DisplayDungeonDialogue(&gEnteiPostStoryPreFightDialogue_2);
EnteiScreenFlash();
DisplayDungeonDialogue(&gEnteiPostStoryPreFightDialogue_3);
sub_803E708(10,70);
SetupBossFightHP(EnteiEntity,600,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void EnteiScreenFlash(void)
{
s32 iVar1;
PlaySoundEffect(0x1ed);
for(iVar1 = 250; iVar1 > 149; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1, iVar1 / 2, iVar1 / 2, 1, 1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1, 0, 0, 1, 1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1, iVar1 / 2, iVar1 / 2, 1, 1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
sub_8085EB0();
}

View File

@@ -0,0 +1,386 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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 SceneGroudonMovement(Entity * groudonEntity);
static void GroudonScreenFlash(void);
static void GroudonScreenFlash2(void);
void sub_808862C(void)
{
Entity * leaderEntity;
Entity * alakazamEntity;
Entity * groudonEntity;
leaderEntity = xxx_call_GetLeader();
alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_1);
groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80867F4();
sub_8085374();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
SetFacingDirection(alakazamEntity, DIRECTION_NORTH);
sub_80861D4(alakazamEntity,0xd,DIRECTION_NORTH);
SetFacingDirection(groudonEntity, DIRECTION_SOUTH);
sub_8086A3C(groudonEntity);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y -3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_GROUDON);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_ALAKAZAM);
}
void sub_80886C4(void)
{
Entity * leaderEntity;
Entity * alakazamEntity;
Entity * groudonEntity;
u32 XPos;
s32 YPos;
leaderEntity = xxx_call_GetLeader();
alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_1);
groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2);
PlaySoundEffect(0x3e5);
sub_80867F4();
sub_8085374();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_8068FE0(alakazamEntity,0x21c,0);
SetFacingDirection(groudonEntity, DIRECTION_SOUTH);
sub_8086A3C(groudonEntity);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y);
XPos = GetCameraXPos();
YPos = GetCameraYPos();
sub_803F878(XPos,YPos + -0x1000);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_GROUDON);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_ALAKAZAM);
}
void sub_808875C(void)
{
Entity * leaderEntity;
Entity * alakazamEntity;
Entity * groudonEntity;
leaderEntity = xxx_call_GetLeader();
alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_1);
groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2);
sub_80867F4();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
sub_8068FE0(alakazamEntity,0x21c,0);
if (sub_8086AE4(MONSTER_GROUDON)) {
sub_8068FE0(groudonEntity,0x21c,0);
}
else {
sub_8072008(groudonEntity,groudonEntity,gGroudonConfigLevel,0,0);
SetFacingDirection(groudonEntity, DIRECTION_SOUTH);
sub_80861D4(groudonEntity,0xf,DIRECTION_SOUTH);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_GROUDON);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_ALAKAZAM);
}
void sub_8088818(u8 param_1, u8 param_2)
{
if ((param_2 == 0x12 || param_2 == 0x13 || param_2 == 0x14) && (param_1 == 0xE)) {
sub_8097FA8(0xC);
gDungeon->unk2 = 1;
}
}
void sub_8088848(void)
{
sub_8086854();
}
void GroudonPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * partnerEntity;
Entity * alakazamEntity;
Entity * groudonEntity;
leaderEntity = xxx_call_GetLeader();
partnerEntity = GetPartnerEntity();
alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_1);
groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2);
sub_8086448();
DisplayDungeonDialogue(GroudonPreFightDialogue_1);
sub_803E708(10,0x46);
sub_803E708(0x3c,0x46);
DisplayDungeonDialogue(&GroudonPreFightDialogue_2);
sub_803E708(10,0x46);
sub_8086838(1,1,1);
sub_808680C();
sub_803E708(0x3c,0x46);
sub_808682C();
sub_803E708(0x1e,0x46);
DisplayDungeonDialogue(&GroudonPreFightDialogue_3);
sub_803E708(10,0x46);
sub_8086838(1,1,1);
sub_808680C();
sub_803E708(0x3c,0x46);
DisplayDungeonDialogue(&GroudonPreFightDialogue_4);
sub_803E708(10,0x46);
GroudonScreenFlash();
DisplayDungeonDialogue(&GroudonPreFightDialogue_5);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&GroudonPreFightDialogue_6);
sub_803E708(10,0x46);
PlaySoundEffect(0x1d5);
SpriteLookAroundEffect(partnerEntity);
DisplayDungeonDialogue(&GroudonPreFightDialogue_7);
sub_803E708(10,0x46);
sub_808682C();
sub_803E708(0x3c,0x46);
sub_80861B8(alakazamEntity,6,DIRECTION_NORTH);
PlaySoundEffect(0x205);
sub_8086738();
sub_8068FE0(alakazamEntity,0x21c,0);
DisplayDungeonDialogue(&GroudonPreFightDialogue_8);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&GroudonPreFightDialogue_9);
sub_803E708(10,0x46);
sub_8085930(DIRECTION_NORTH);
sub_8086764();
sub_803E708(0x28,0x46);
PlaySoundEffect(0x1d5);
SpriteLookAroundEffect(partnerEntity);
DisplayDungeonDialogue(GroudonPreFightDialogue_10);
sub_803E708(10,0x46);
sub_8086838(1,1,1);
sub_808680C();
sub_803E708(0x3c,0x46);
DisplayDungeonDialogue(GroudonPreFightDialogue_11);
sub_803E708(10,0x46);
DungeonStopBGM();
GroudonScreenFlash2();
sub_803E708(0x1e,0x46);
DisplayDungeonDialogue(&GroudonPreFightDialogue_12);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&GroudonPreFightDialogue_13);
sub_803E708(10,0x46);
sub_803E708(0x1e,0x46);
sub_808682C();
sub_803E708(0x3c,0x46);
PlaySoundEffect(0x1fa);
sub_8086738();
sub_8085930(DIRECTION_NORTH);
DisplayDungeonDialogue(GroudonPreFightDialogue_14);
sub_803E708(10,0x46);
sub_8086A54(groudonEntity);
sub_8085930(DIRECTION_NORTH);
sub_8086764();
SetupBossFightHP(groudonEntity,500,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void GroudonReFightDialogue(void)
{
Entity * leaderEntity;
Entity * groudonEntity;
leaderEntity = xxx_call_GetLeader();
groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2);
sub_8086838(1,1,1);
sub_808680C();
sub_803E708(0x3c,0x46);
DisplayDungeonDialogue(gGroudonReFightDialogue_1);
sub_803E708(10,0x46);
GroudonScreenFlash();
sub_803E708(0x1e,0x46);
DisplayDungeonDialogue(gGroudonReFightDialogue_2);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gGroudonReFightDialogue_3);
sub_803E708(10,0x46);
sub_808682C();
sub_803E708(0x3c,0x46);
DungeonStopBGM();
PlaySoundEffect(0x1fa);
sub_8086738();
DisplayDungeonDialogue(gGroudonReFightDialogue_4);
sub_803E708(10,0x46);
sub_8086A54(groudonEntity);
sub_8085930(DIRECTION_NORTH);
sub_8086764();
SetupBossFightHP(groudonEntity,500,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void GroudonPostStoryPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * groudonEntity;
leaderEntity = xxx_call_GetLeader();
groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_2);
sub_8086448();
if (sub_8086AE4(MONSTER_GROUDON)) {
sub_80866C4(&gUnknown_8103488);
}
else{
DisplayDungeonDialogue(&gGroudonPostStoryPreFightDialogue_1);
sub_803E708(10,0x46);
SceneGroudonMovement(groudonEntity);
SceneGroudonMovement(groudonEntity);
DisplayDungeonDialogue(&gGroudonPostStoryPreFightDialogue_2);
PlaySoundEffect(0x1f6);
GroudonScreenFlash();
DisplayDungeonDialogue(&gGroudonPostStoryPreFightDialogue_3);
PlaySoundEffect(0x1f6);
GroudonScreenFlash();
DisplayDungeonDialogue(&gGroudonPostStoryPreFightDialogue_4);
sub_803E708(10,0x46);
SetupBossFightHP(groudonEntity,500,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
// Moves Groudon down in a walking fashion
static void SceneGroudonMovement(Entity * groudonEntity)
{
int iVar1;
sub_8086848(0x18,0x10);
sub_806CDD4(groudonEntity,0,DIRECTION_SOUTH);
for(iVar1 = 0; iVar1 < 0x2C; iVar1++)
{
if ((iVar1 == 10) || (iVar1 == 0x20)) {
PlaySoundEffect(0x1f9);
sub_8086838(0,1,0);
sub_808680C();
}
if ((iVar1 - 10U < 0xc) || (iVar1 > 0x1f)) {
IncreaseEntityPixelPos(groudonEntity,0,0x100);
}
DungeonRunFrameActions(0x46);
}
sub_80856C8(groudonEntity,groudonEntity->pos.x,groudonEntity->pos.y + 1);
sub_80861D4(groudonEntity,0xf,DIRECTION_SOUTH);
sub_803E708(10,0x46);
sub_808682C();
sub_8085930(DIRECTION_NORTH);
sub_803E708(0x22,0x46);
}
static void GroudonScreenFlash(void)
{
s32 iVar1;
for(iVar1 = 250; iVar1 > 0x95; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1 / 2,iVar1 / 2,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1 / 2,0,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1 / 2,iVar1 / 2,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
sub_8085EB0();
}
static void GroudonScreenFlash2(void)
{
s32 iVar1;
for(iVar1 = 250; iVar1 > 0x95; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1 / 2,iVar1 / 2,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1 / 2,0,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1 / 2,iVar1 / 2,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
sub_8085EB0();
}

245
src/dungeon_cutscene_hooh.c Normal file
View File

@@ -0,0 +1,245 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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 HoOhDropInEffect(Entity * param_1);
static void HoOhScreenFlash(void);
void sub_808A608(void)
{
Entity * leaderEntity;
Entity * HoOhEntity;
leaderEntity = xxx_call_GetLeader();
HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH);
DungeonStartNewBGM(MUS_FRIEND_AREA_RAINBOW_PEAK);
sub_80867F4();
sub_8086838(0,0,0);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
SetFacingDirection(HoOhEntity, DIRECTION_SOUTH);
sub_8086A3C(HoOhEntity);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y + -6);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_HO_OH);
}
void sub_808A668(void)
{
Entity * leaderEntity;
Entity * HoOhEntity;
leaderEntity = xxx_call_GetLeader();
HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH);
DungeonStartNewBGM(MUS_FRIEND_AREA_RAINBOW_PEAK);
sub_80867F4();
sub_8086838(0,0,0);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
if (HasRecruitedMon(MONSTER_HO_OH)) {
sub_8068FE0(HoOhEntity,0x21c,0);
}
else {
SetFacingDirection(HoOhEntity, DIRECTION_SOUTH);
sub_8086A3C(HoOhEntity);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 6);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_HO_OH);
}
void sub_808A6E8(u8 param_1, u8 param_2)
{
if ((param_2 == 0x29 || param_2 == 0x2A) && (param_1 == 0x15)) {
sub_8097FA8(0x1A);
gDungeon->unk2 = 1;
}
}
void sub_808A718(void)
{
sub_8086854();
}
void HoOhPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * HoOhEntity;
PixelPos local_14;
leaderEntity = xxx_call_GetLeader();
HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH);
local_14.x = leaderEntity->pixelPos.x;
local_14.y = leaderEntity->pixelPos.y + -0x1000;
ShiftCameraToPosition(&local_14,0x88);
sub_803E708(0x40,70);
DisplayDungeonDialogue(&gHoOhPreFightDialogue_1);
sub_803E708(10,70);
HoOhScreenFlash();
DisplayDungeonDialogue(&gHoOhPreFightDialogue_2);
sub_803E708(10,70);
sub_80855E4(sub_80868F4);
sub_808680C();
PlaySoundEffect(0x1c5);
sub_803E708(0xfa,70);
HoOhDropInEffect(HoOhEntity);
StopSoundEffect(0x1c5);
sub_808682C();
sub_80855E4(sub_8086910);
sub_8085930(DIRECTION_NORTH);
DisplayDungeonDialogue(&gHoOhPreFightDialogue_3);
DisplayDungeonDialogue(&gHoOhPreFightDialogue_4);
sub_803E708(0x1e,70);
sub_803E708(0x1e,70);
HoOhScreenFlash();
DisplayDungeonDialogue(&gHoOhPreFightDialogue_5);
HoOhScreenFlash();
DisplayDungeonDialogue(&gHoOhPreFightDialogue_6);
sub_803E708(10,70);
SetupBossFightHP(HoOhEntity,800,MUS_BATTLE_WITH_RAYQUAZA);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void HoOhReFightDialogue(void)
{
Entity * leaderEntity;
Entity * HoOhEntity;
PixelPos local_14;
leaderEntity = xxx_call_GetLeader();
HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH);
local_14.x = leaderEntity->pixelPos.x;
local_14.y = leaderEntity->pixelPos.y + -0x1000;
ShiftCameraToPosition(&local_14,0x88);
sub_803E708(0x40,70);
if (HasRecruitedMon(MONSTER_HO_OH)) {
sub_80866C4(&HoOhReFightDialogue_5);
}
else {
DisplayDungeonDialogue(&HoOhReFightDialogue_1);
HoOhScreenFlash();
sub_80855E4(sub_80868F4);
sub_808680C();
sub_803E708(10,70);
HoOhDropInEffect(HoOhEntity);
sub_808682C();
sub_80855E4(sub_8086910);
sub_8085930(DIRECTION_NORTH);
DisplayDungeonDialogue(&HoOhReFightDialogue_2);
HoOhScreenFlash();
DisplayDungeonDialogue(&HoOhReFightDialogue_3);
HoOhScreenFlash();
DisplayDungeonDialogue(&HoOhReFightDialogue_4);
sub_803E708(10,70);
SetupBossFightHP(HoOhEntity,800,MUS_BATTLE_WITH_RAYQUAZA);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void HoOhDropInEffect(Entity * param_1)
{
s24_8 iVar1;
s24_8 iVar2;
GetEntInfo(param_1)->unk15E = 0;
iVar2 = IntToF248(200);
iVar1 = IntToF248(12);
PlaySoundEffect(0x1f8);
while( 1 ) {
iVar2.raw -= iVar1.raw;
iVar1 = F248_Sub(iVar1, FloatToF248(0.375));
if (F248LessThanFloat(iVar1, 0.08)) {
iVar1 = FloatToF248_2(0.08);
}
if (F248LessThanInt(iVar2, 0)) break;
GetEntInfo(param_1)->unk174 = iVar2;
DungeonRunFrameActions(70);
}
GetEntInfo(param_1)->unk174 = IntToF248_2(0);
}
static void HoOhScreenFlash(void)
{
s32 iVar1;
PlaySoundEffect(0x1ed);
for(iVar1 = 250; iVar1 > 149; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
sub_8085EB0();
}

View File

@@ -0,0 +1,567 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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 s32 gDungeonBrightness;
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_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_808B50C(void);
static void JirachiWish(void);
static void JirachiWishGrantFlash(void);
static void sub_808BB3C(DungeonPos *pos1);
static void sub_808BBA8(Entity *jirachiEntity);
static void JirachiDropInEffect(Entity *jirachiEntity);
static void JirachiSpinEffect(Entity * jirachiEntity);
static void JirachiWishGrantDialogue(Entity *jirachiEntity);
static void CreateJirachiWishWarpTile(void);
static void EnableJirachiWishWarpTile(void);
static u8 JirachiFriendAreaSearch(void);
void sub_808B2F4(void)
{
Entity * leaderEntity;
Entity * jirachiEntity;
leaderEntity = xxx_call_GetLeader();
jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI);
DungeonStartNewBGM(MUS_FRIEND_AREA_FOREST);
CreateJirachiWishWarpTile();
sub_8049ED4();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
SetFacingDirection(jirachiEntity, DIRECTION_SOUTH);
sub_8086A3C(jirachiEntity);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_JIRACHI);
}
void sub_808B35C(void)
{
Entity * leaderEntity;
Entity * jirachiEntity;
leaderEntity = xxx_call_GetLeader();
jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI);
DungeonStartNewBGM(MUS_FRIEND_AREA_FOREST);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
if (HasRecruitedMon(MONSTER_JIRACHI)) {
sub_8068FE0(jirachiEntity,0x21c,0);
}
else {
SetFacingDirection(jirachiEntity, DIRECTION_SOUTH);
sub_8086A3C(jirachiEntity);
CreateJirachiWishWarpTile();
sub_8049ED4();
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_JIRACHI);
}
void sub_808B3E4(u8 param_1, u8 param_2, u8 param_3)
{
u8 uVar1;
if ((param_2 == 0x31 || param_2 == 0x32) && (param_1 == 0x1A)) {
sub_8097FA8(0x1E);
if(param_3 != 0)
{
gDungeon->unk2 = 1;
}
else {
uVar1 = gDungeon->unk1356C;
if(sub_80860A8(0x36) != 0)
{
JirachiWish();
}
else
{
sub_808B50C();
}
gDungeon->unk1356C = uVar1;
ShowWholeRevealedDungeonMap();
}
}
}
void JirachiPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * jirachiEntity;
leaderEntity = xxx_call_GetLeader();
jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI);
sub_8086448();
sub_803E708(0x40,70);
DisplayDungeonDialogue(&gJirachiPreFightDialogue_1);
sub_803E708(10,70);
SpriteLookAroundEffect(leaderEntity);
sub_803E708(10,70);
DisplayDungeonDialogue(&gJirachiPreFightDialogue_2);
sub_80861F8(0x37,jirachiEntity,1);
sub_80855E4(SpriteShockEffect);
sub_803E708(0x3c,70);
JirachiDropInEffect(jirachiEntity);
sub_803E708(0x5a,70);
DisplayDungeonDialogue(&gJirachiPreFightDialogue_3);
sub_803E708(10,70);
DisplayDungeonDialogue(&gJirachiPreFightDialogue_4);
sub_803E708(10,70);
SetupBossFightHP(jirachiEntity,0x15e,MUS_BATTLE_WITH_RAYQUAZA);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
static void sub_808B50C(void)
{
Entity * jirachiEntity;
jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_JIRACHI);
sub_80855E4(sub_808BBA8);
sub_808BBA8(jirachiEntity);
sub_8041888(0);
GetEntInfo(jirachiEntity)->unk15C = 1;
GetEntInfo(jirachiEntity)->unk15E = 0;
sub_80861B8(jirachiEntity,0xe,DIRECTION_SOUTH);
DungeonFadeOutBGM(0x1e);
sub_803E708(0x1e,70);
// Fwaaaahhhh
DisplayDungeonDialogue(&gUnknown_810554C);
DungeonStartNewBGM(MUS_FRIEND_AREA_FOREST);
// I think I had a dream, and I was fighting in it
// Did I imagine it?
// I'm sleepy so I'm going back to sleep.
DisplayDungeonDialogue(&gUnknown_8105558);
sub_803E708(10,70);
JirachiSpinEffect(jirachiEntity);
DisplayDungeonDialogue(&gUnknown_81055F4);
sub_803E708(10,70);
gDungeon->unk2 = 1;
}
static const u8 sJirachiItems[] = {ITEM_PROTEIN, ITEM_CALCIUM, ITEM_IRON, ITEM_ZINC, ITEM_JOY_SEED, ITEM_GINSENG, ITEM_LIFE_SEED, ITEM_SITRUS_BERRY};
static void JirachiWish(void)
{
Entity *jirachiEntity;
DungeonPos *LeaderPos;
Entity *leaderEntity;
s32 wishChoice;
jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_JIRACHI);
sub_80855E4(sub_808BBA8);
sub_808BBA8(jirachiEntity);
sub_8041888(0);
GetEntInfo(jirachiEntity)->unk15C = 1;
GetEntInfo(jirachiEntity)->unk15E = 0;
sub_80861B8(jirachiEntity,0xe,DIRECTION_SOUTH);
sub_80855E4(sub_80861A8);
gDungeon->unk1356C = 1;
DungeonFadeOutBGM(0x1e);
sub_803E708(0x1e,0x46);
DisplayDungeonDialogue(&gUnknown_8105668);
sub_803E708(10,0x46);
PlaySoundEffect(0x1a7);
sub_803E708(0x96,0x46);
SpriteShockEffect(jirachiEntity);
DisplayDungeonDialogue(&gUnknown_8105674);
DungeonStartNewBGM(MUS_FRIEND_AREA_FOREST);
sub_803E708(10,0x46);
sub_80856E0(jirachiEntity, DIRECTION_SOUTH);
PlaySoundEffect(0x16a);
DisplayDungeonDialogue(&gUnknown_81056B8);
sub_803E708(10,0x46);
SpriteLookAroundEffect(jirachiEntity);
DisplayDungeonDialogue(&gUnknown_81056DC);
sub_803E708(10,0x46);
while( 1 ) {
while (1) {
wishChoice = DisplayDungeonMenuMessage(NULL,gUnknown_8105798,gUnknown_810579C,0x705);
if (wishChoice >= 1) break;
}
sub_803E708(10,0x46);
if (wishChoice == 1) {
s32 counter, index;
DungeonPos pos;
Item moneyItems [9];
// Lots of Money
DisplayDungeonDialogue(&gUnknown_810581C);
sub_803E708(10,0x46);
JirachiWishGrantDialogue(jirachiEntity);
for(counter = 0; counter < 6; counter++)
{
for(index = 0; index < 9; index++)
{
CreateItemWithStickyChance(&moneyItems[index], ITEM_POKE, 0);
}
pos.x = (jirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos.y = (jirachiEntity->pos.y + DungeonRandInt(3) + -1);
if ((GetTileMut(pos.x, pos.y)->terrainType & 3) != 0) {
PlaySoundEffect(0x14c);
sub_808BB3C(&pos);
sub_8046860(jirachiEntity,&pos,moneyItems,9);
}
}
GetEntInfo(jirachiEntity)->unk15D = 0;
}
if (wishChoice == 2) {
s32 counter, index;
DungeonPos pos;
Item items [9];
// Lots of Items
DisplayDungeonDialogue(&gUnknown_8105974);
sub_803E708(10,0x46);
JirachiWishGrantDialogue(jirachiEntity);
for(counter = 0; counter < 6; counter++)
{
for(index = 0; index < 9; index++)
{
CreateItemWithStickyChance(&items[index], GetRandomFloorItem(0),0);
}
pos.x = (jirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos.y = (jirachiEntity->pos.y + DungeonRandInt(3) + -1);
if ((GetTileMut(pos.x, pos.y)->terrainType & 3) != 0) {
PlaySoundEffect(400);
sub_808BB3C(&pos);
sub_8046860(jirachiEntity,&pos,items,9);
}
}
GetEntInfo(jirachiEntity)->unk15D = 0;
}
if (wishChoice == 3)
{
// A Friend Area
s32 friendArea = JirachiFriendAreaSearch();
if (friendArea == NUM_FRIEND_AREAS)
{
// You want a friend area? But you already have many friend areas...
DisplayDungeonDialogue(&gUnknown_8105A08);
sub_803E708(10,0x46);
continue;
}
else
{
// You want a friend area? As you wish..
DisplayDungeonDialogue(&gUnknown_8105AD4);
sub_803E708(10,0x46);
JirachiWishGrantDialogue(jirachiEntity);
GetEntInfo(jirachiEntity)->unk15D = 0;
DisplayDungeonDialogue(&gUnknown_8105B20);
UnlockFriendArea(friendArea);
PlaySoundEffect(0xd4);
leaderEntity = GetLeader();
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],leaderEntity,0);
WriteFriendAreaName(gFormatBuffer_Items[0],friendArea,FALSE);
// Obtained the friend area!
DisplayDungeonDialogue(&gUnknown_8105B68);
}
}
if (wishChoice == 4) {
s32 counter, index;
DungeonPos pos;
Item strengthItems [9];
// More Strength..
DisplayDungeonDialogue(&gUnknown_8105BA8);
sub_803E708(10,0x46);
JirachiWishGrantDialogue(jirachiEntity);
for(counter = 0; counter < 5; counter++)
{
for(index = 0; index < 4; index++)
{
CreateItemWithStickyChance(&strengthItems[index],sJirachiItems[DungeonRandInt(ARRAY_COUNT(sJirachiItems))],0);
}
pos.x = (jirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos.y = (jirachiEntity->pos.y + DungeonRandInt(3) + -1);
if ((GetTileMut(pos.x, pos.y)->terrainType & 3) != 0) {
PlaySoundEffect(400);
sub_808BB3C(&pos);
sub_8046860(jirachiEntity,&pos,strengthItems,4);
}
}
GetEntInfo(jirachiEntity)->unk15D = 0;
DisplayDungeonDialogue(&gUnknown_8105BF4);
sub_803E708(10,0x46);
}
if (wishChoice == 5) {
s32 direction;
// Something Good...
DisplayDungeonDialogue(&gUnknown_8105D2C);
sub_803E708(10,0x46);
JirachiWishGrantDialogue(jirachiEntity);
GetEntInfo(jirachiEntity)->unk15D = 0;
DisplayDungeonDialogue(&gUnknown_8105D80);
sub_803E708(10,0x46);
LeaderPos = &GetLeader()->pos;
direction = GetDirectionTowardsPosition(&jirachiEntity->pos,LeaderPos);
SetFacingDirection(jirachiEntity,direction);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gUnknown_8105D9C);
sub_803E708(10,0x46);
gDungeon->unk644.unk30 = 1;
}
break;
}
DisplayDungeonDialogue(&gUnknown_81058E0);
JirachiSpinEffect(jirachiEntity);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gUnknown_810593C);
sub_803E708(10,0x46);
EnableJirachiWishWarpTile();
}
void JirachiReFightDialogue(void)
{
if(HasRecruitedMon(MONSTER_JIRACHI))
{
sub_8086448();
sub_80866C4(&gJirachiReFightDialogue_1);
}
else
{
JirachiPreFightDialogue();
}
}
static void JirachiWishGrantFlash(void)
{
s32 iVar1;
PlaySoundEffect(0x2c1);
gDungeonBrightness = 0x1f;
for(iVar1 = 0xFA; iVar1 > 0x95; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 0xFA; iVar1 > 0xC7; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 0xFA; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
sub_8085EB0();
}
static void sub_808BB3C(DungeonPos *pos1)
{
s32 x, y;
DungeonPos newPos;
x = X_POS_TO_PIXELPOS(pos1->x);
newPos.x = x / 256;
y = Y_POS_TO_PIXELPOS(pos1->y);
newPos.y = y / 256;
sub_8085EC8(100,0,0,&newPos,0);
}
static void sub_808BBA8(Entity *jirachiEntity)
{
ResetMonEntityData(GetEntInfo(jirachiEntity),0);
}
static void JirachiDropInEffect(Entity *jirachiEntity)
{
s24_8 iVar1;
s24_8 iVar2;
sub_80861F8(0x1b,jirachiEntity,0);
sub_8086A54(jirachiEntity);
sub_80861B8(jirachiEntity,0xe,DIRECTION_SOUTH);
iVar1 = IntToF248(160);
iVar2 = IntToF248(2);
PlaySoundEffect(0x1f8);
while (1) {
iVar1.raw = iVar1.raw - iVar2.raw; // FRAGILE! Subtraction and assignment below must use .raw
if (F248LessThanInt(iVar1, 24)) {
iVar2.raw = IntToF248_2(1).raw;
}
if (F248LessThanInt(iVar1, 0)) break;
GetEntInfo(jirachiEntity)->unk174 = iVar1;
DungeonRunFrameActions(0x46);
}
GetEntInfo(jirachiEntity)->unk174 = IntToF248_2(0);
}
static void JirachiSpinEffect(Entity * jirachiEntity)
{
s32 uVar1;
PlaySoundEffect(0x298);
for(uVar1 = 0; uVar1 < 25; uVar1++){
SetFacingDirection(jirachiEntity, uVar1 & DIRECTION_MASK);
sub_803E708(3,0x46);
}
GetEntInfo(jirachiEntity)->unk15E = 1;
PlaySoundEffect(0x27f);
sub_80861F8(99,jirachiEntity,1);
}
static void JirachiWishGrantDialogue(Entity *jirachiEntity)
{
u32 uVar2;
GetEntInfo(jirachiEntity)->unk15D = 1;
// Nnnnnnnnnn!
DisplayDungeonDialogue(&gUnknown_81058A8);
PlaySoundEffect(0x375);
sub_80861F8(0x67,jirachiEntity,1);
PlaySoundEffect(0x2a8);
uVar2 = sub_80861F8(0x68,jirachiEntity,0);
// Taaaaaaaah!
DisplayDungeonDialogue(&gUnknown_81058C4);
if (sub_800E9A8(uVar2)) {
sub_800DC14(uVar2);
}
sub_803E708(10,0x46);
JirachiWishGrantFlash();
}
// Warp Tile is created but not enabled until the Wish is done with EnableJirachiWishWarpTile
static void CreateJirachiWishWarpTile(void)
{
Tile *tile;
tile = GetTileMut(gDungeon->unkE220[7].x, gDungeon->unkE220[7].y);
tile->terrainType &= ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
tile->terrainType |= TERRAIN_TYPE_IMPASSABLE_WALL;
tile->terrainType &= ~TERRAIN_TYPE_STAIRS;
sub_8049884();
sub_8049B8C();
sub_8049ED4();
ShowWholeRevealedDungeonMap();
}
static void EnableJirachiWishWarpTile(void)
{
Tile *tile;
tile = GetTileMut(gDungeon->unkE220[7].x, gDungeon->unkE220[7].y);
tile->terrainType &= ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
tile->terrainType |= TERRAIN_TYPE_NORMAL;
tile->terrainType &= ~TERRAIN_TYPE_IMPASSABLE_WALL;
tile->terrainType |= TERRAIN_TYPE_STAIRS;
tile->unk8 = 1;
sub_8049884();
sub_8049B8C();
sub_8049ED4();
ShowWholeRevealedDungeonMap();
}
static u8 JirachiFriendAreaSearch(void)
{
u8 unlockCondition;
s32 friendAreaCounter;
s32 numUnlockableAreas;
u8 friendAreas[NUM_FRIEND_AREAS];
u32 friendAreaIndex;
// Build a copy of friend area list and keep track of
// how many are only Story Unlockable
numUnlockableAreas = 0;
for(friendAreaCounter = 1; friendAreaCounter < NUM_FRIEND_AREAS; friendAreaCounter++){
unlockCondition = GetFriendAreaUnlockCondition(friendAreaCounter);
if (!(unlockCondition == UNLOCK_LEGENDARY_REQUEST)){
if (!(unlockCondition == UNLOCK_WONDER_MAIL)){
if(!gFriendAreas[friendAreaCounter]) {
friendAreas[numUnlockableAreas] = friendAreaCounter;
numUnlockableAreas++;
}
}
}
}
if (numUnlockableAreas == 0) {
return NUM_FRIEND_AREAS;
}
else {
// Randomly pick 1
friendAreaIndex = DungeonRandInt(numUnlockableAreas);
return friendAreas[friendAreaIndex];
}
}

View File

@@ -0,0 +1,191 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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 s32 gDungeonBrightness;
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_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 nullsub_99(void);
static void KyogreScreenFlash(void);
static void sub_808C360(void);
void sub_808C10C(void)
{
Entity * leaderEntity;
Entity * kyogreEntity;
u32 XPos;
s32 YPos;
leaderEntity = xxx_call_GetLeader();
kyogreEntity = GetEntityFromMonsterBehavior(BEHAVIOR_KYOGRE);
DungeonStopBGM();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
if (HasRecruitedMon(MONSTER_KYOGRE)) {
sub_8068FE0(kyogreEntity,0x21c,0);
}
else {
gDungeon->unk7 = 1;
SetFacingDirection(kyogreEntity, DIRECTION_SOUTH);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y);
XPos = GetCameraXPos();
YPos = GetCameraYPos();
sub_803F878(XPos,YPos + -0x1000);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2],MONSTER_KYOGRE);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_GROUDON);
}
void sub_808C1A4(u8 param_1,u8 param_2,u8 param_3)
{
if ((param_2 == 0x34) && (param_1 == 0x1C)) {
gDungeon->unk2 = 1;
DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE);
}
}
void KyogrePreFightDialogue(void)
{
Entity *leaderEntity;
Entity *KyogreEntity;
leaderEntity = xxx_call_GetLeader();
KyogreEntity = GetEntityFromMonsterBehavior(BEHAVIOR_KYOGRE);
DungeonStopBGM();
if (HasRecruitedMon(MONSTER_KYOGRE)) {
DungeonFadeInNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE,0x3c);
SpriteLookAroundEffect(leaderEntity);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gKyogrePreFightDialogue_8);
sub_803E708(10,0x46);
gDungeon->unk2 = 1;
}
else {
DisplayDungeonDialogue(&gKyogrePreFightDialogue_1);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gKyogrePreFightDialogue_2);
sub_803E708(10,0x46);
nullsub_99();
sub_803E708(10,0x46);
// Gwwwwwooooooooh
DisplayDungeonDialogue(&gKyogrePreFightDialogue_3);
sub_803E708(10,0x46);
DungeonFadeInNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE,0x3c);
sub_808C360();
// My duels against {POKEMON_3} (Groudon) left us both exhausted
DisplayDungeonDialogue(&gKyogrePreFightDialogue_4);
KyogreScreenFlash();
// I am {POKEMON_2} (Kyogre)!
// The lord of the sea!
DisplayDungeonDialogue(&gKyogrePreFightDialogue_5);
KyogreScreenFlash();
// Witness the destructive force of my waves!
DisplayDungeonDialogue(&gKyogrePreFightDialogue_6);
KyogreScreenFlash();
// Marvel at my awesome
// power!
DisplayDungeonDialogue(&gKyogrePreFightDialogue_7);
sub_803E708(10,0x46);
SetupBossFightHP(KyogreEntity,600,MUS_BOSS_BATTLE);
DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void nullsub_99(void)
{
}
static void KyogreScreenFlash(void)
{
s32 iVar1;
PlaySoundEffect(0x1f8);
for(iVar1 = 250; iVar1 > 149; iVar1 -= 10){
SetDungeonBGColorRGB(0,0,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10){
SetDungeonBGColorRGB(0,iVar1,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10){
SetDungeonBGColorRGB(0,0,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
sub_8085EB0();
}
static void sub_808C360(void)
{
gDungeonBrightness = 0x1f;
SetDungeonBGColorRGB(0,0,0,1,1);
BgColorCallNullsub4();
DungeonRunFrameActions(0x46);
gDungeon->unk7 = 0;
KyogreScreenFlash();
}

View File

@@ -0,0 +1,204 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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 s32 gDungeonBrightness;
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_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 LatiosScreenFlash(void);
void sub_808A9E4(void)
{
Entity * leaderEntity;
Entity * LatiosEntity;
leaderEntity = xxx_call_GetLeader();
LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
SetFacingDirection(LatiosEntity, DIRECTION_NORTH);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 4);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_LATIOS);
}
void sub_808AA3C(void)
{
Entity * leaderEntity;
Entity * LatiosEntity;
leaderEntity = xxx_call_GetLeader();
LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
SetFacingDirection(LatiosEntity, DIRECTION_NORTH);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_LATIOS);
}
void sub_808AA94(void)
{
Entity * leaderEntity;
Entity * LatiosEntity;
leaderEntity = xxx_call_GetLeader();
LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
sub_8068FE0(LatiosEntity,0x21c,0);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_LATIOS);
}
void sub_808AAF0(u8 param_1, u8 param_2)
{
if ((param_2 == 0x2B || param_2 == 0x2C || param_2 == 0x2D) && (param_1 == 0x16)) {
sub_8097FA8(0x1C);
gDungeon->unk2 = 1;
}
}
void LatiosPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * LatiosEntity;
PixelPos local_18;
DungeonPos local_19;
leaderEntity = xxx_call_GetLeader();
LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS);
local_18.x = LatiosEntity->pixelPos.x;
local_18.y = LatiosEntity->pixelPos.y + (0x80 << 6);
local_19.y = 0x70;
local_19.x = 0xFC;
sub_8085EC8(0x1bd,0,0,&local_19,1);
sub_803E708(0x1e,70);
sub_8086448();
ShiftCameraToPosition(&local_18,0x18);
sub_803E708(2,70);
SpriteShockEffect(LatiosEntity);
sub_803E708(0x20,70);
sub_808692C();
DisplayDungeonDialogue(&gLatiosPreFightDialogue_1);
LatiosScreenFlash();
DisplayDungeonDialogue(&gLatiosPreFightDialogue_2);
LatiosScreenFlash();
DisplayDungeonDialogue(&gLatiosPreFightDialogue_3);
sub_803E708(10,70);
SetupBossFightHP(LatiosEntity,600,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void LatiosReFightDialogue(void)
{
Entity * leaderEntity;
Entity * LatiosEntity;
leaderEntity = xxx_call_GetLeader();
LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS);
sub_8086448();
sub_808692C();
DisplayDungeonDialogue(&gLatiosReFightDialogue_1);
LatiosScreenFlash();
DisplayDungeonDialogue(&gLatiosPreFightDialogue_2);
LatiosScreenFlash();
DisplayDungeonDialogue(&gLatiosPreFightDialogue_3);
sub_803E708(10,70);
SetupBossFightHP(LatiosEntity,600,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void sub_808AC3C(void)
{
sub_8086448();
// There appears to be no one here
sub_80866C4(&gUnknown_8104FC8);
}
static void LatiosScreenFlash(void)
{
s32 iVar1;
PlaySoundEffect(0x1ee);
gDungeonBrightness = 0x1f;
for(iVar1 = 250; iVar1 > 149; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
sub_8085EB0();
}

View File

@@ -0,0 +1,207 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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 s32 gDungeonBrightness;
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_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 LugiaScreenFlash(void);
static void LugiaScreenFlash2(void);
static void sub_808C0CC(void);
void sub_808BDEC(void)
{
Entity * leaderEntity;
Entity * lugiaEntity;
leaderEntity = xxx_call_GetLeader();
lugiaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LUGIA);
DungeonStopBGM();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
if (HasRecruitedMon(MONSTER_LUGIA)) {
DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE);
sub_8068FE0(lugiaEntity,0x21c,0);
}
else {
gDungeon->unk7 = 1;
SetFacingDirection(lugiaEntity, DIRECTION_SOUTH);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_LUGIA);
}
void sub_808BE70(u8 param_1,u8 param_2,u8 param_3)
{
if ((param_2 == 0x33) && (param_1 == 0x1B)) {
gDungeon->unk2 = 1;
}
}
void LugiaPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * lugiaEntity;
leaderEntity = xxx_call_GetLeader();
lugiaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LUGIA);
if (HasRecruitedMon(MONSTER_LUGIA)) {
sub_8086448();
sub_80866C4(&gLugiaPreFightDialogue_8);
}
else {
DungeonStopBGM();
sub_8086448();
DisplayDungeonDialogue(&gLugiaPreFightDialogue_1);
DungeonFadeInNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE,0x3c);
sub_808C0CC();
DisplayDungeonDialogue(&gLugiaPreFightDialogue_2);
LugiaScreenFlash();
DisplayDungeonDialogue(&gLugiaPreFightDialogue_3);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gLugiaPreFightDialogue_4);
PlaySoundEffect(0x1f8);
sub_80861D4(lugiaEntity,0xd,DIRECTION_SOUTH);
sub_803E708(0x2b,0x46);
sub_80861B8(lugiaEntity,0,DIRECTION_SOUTH);
DisplayDungeonDialogue(&gLugiaPreFightDialogue_5);
LugiaScreenFlash();
DisplayDungeonDialogue(&gLugiaPreFightDialogue_6);
LugiaScreenFlash2();
SetDungeonBGColorRGB(-250,-250,-250,1,0);
DungeonStopBGM();
sub_80861D4(lugiaEntity,7,DIRECTION_SOUTH);
DisplayDungeonDialogue(&gLugiaPreFightDialogue_7);
LugiaScreenFlash();
SetupBossFightHP(lugiaEntity,800,MUS_BATTLE_WITH_RAYQUAZA);
DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void LugiaScreenFlash(void)
{
s32 iVar1;
PlaySoundEffect(0x1f6);
for(iVar1 = 250; iVar1 > 149; iVar1 -= 10){
SetDungeonBGColorRGB(0,0,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10){
SetDungeonBGColorRGB(0,iVar1,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10){
SetDungeonBGColorRGB(0,0,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
sub_8085EB0();
}
static void LugiaScreenFlash2(void)
{
s32 iVar1;
PlaySoundEffect(0x1f6);
for(iVar1 = 0; iVar1 < 200; iVar1 += 100){
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,0);
DungeonRunFrameActions(0x46);
}
for(iVar1 = 200; iVar1 >= 0; iVar1 -= 100){
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,0);
DungeonRunFrameActions(0x46);
}
sub_803E708(4,0x46);
for(iVar1 = 0; iVar1 < 200; iVar1 += 100){
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,0);
DungeonRunFrameActions(0x46);
}
for(iVar1 = 200; iVar1 >= 0; iVar1 -= 100){
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,0);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
sub_8085EB0();
}
static void sub_808C0CC(void)
{
gDungeonBrightness = 0x1f;
SetDungeonBGColorRGB(0,0,0,1,1);
BgColorCallNullsub4();
DungeonRunFrameActions(0x46);
gDungeon->unk7 = 0;
LugiaScreenFlash();
}

View File

@@ -0,0 +1,331 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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_80891F0(void);
static void sub_8089294(void);
void sub_8088DC0(void)
{
Entity * leaderEntity;
Entity * groudonEntity;
Entity * alakazamEntity;
leaderEntity = xxx_call_GetLeader();
groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_1);
alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_2);
sub_80867F4();
sub_8086838(0,1,0);
sub_8085374();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
sub_8086A3C(groudonEntity);
sub_806CDD4(groudonEntity,0xe,DIRECTION_SOUTH);
sub_8086A3C(alakazamEntity);
sub_806CDD4(alakazamEntity,0xe,DIRECTION_SOUTH);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_GROUDON);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_ALAKAZAM);
}
void sub_8088E5C(void)
{
Entity * leaderEntity;
Entity * groudonEntity;
Entity * alakazamEntity;
leaderEntity = xxx_call_GetLeader();
groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_1);
alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_2);
sub_80867F4();
sub_8086838(0,1,0);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
sub_8068FE0(groudonEntity,0x21c,0);
sub_8068FE0(alakazamEntity,0x21c,0);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y + -3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_GROUDON);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[3], MONSTER_ALAKAZAM);
}
void sub_8088EE8(void)
{
sub_8086854();
}
void MagmaCavernMidDialogue(void)
{
Entity * leaderEntity;
Entity * partnerEntity;
Entity * groudonEntity;
Entity * alakazamEntity;
s16 IDStack [2];
PixelPos pos;
leaderEntity = xxx_call_GetLeader();
partnerEntity = GetPartnerEntity();
groudonEntity = GetEntityFromMonsterBehavior(BEHAVIOR_GROUDON_1);
alakazamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_ALAKAZAM_2);
sub_8052D44(IDStack,leaderEntity,partnerEntity);
sub_8086448();
SpriteLookAroundEffect(partnerEntity);
// Let's see..
// I wonder where we are?
DisplayDungeonDialogue(&MagmaCavernMidDialogue_1);
sub_803E708(10,0x46);
sub_80869E4(partnerEntity,4,1,DIRECTION_EAST);
sub_80869E4(leaderEntity,4,2,DIRECTION_WEST);
// I know we've come pretty
// far...
//
// I'm certain we've come quite
// far already..
DisplayDungeonDialogue(MagmaCavernMidDialogue_2);
sub_803E708(10,0x46);
DungeonStopBGM();
sub_80855E4(sub_80868F4);
sub_808680C();
PlaySoundEffect(0x1c5);
sub_803E708(0x28,0x46);
// Waaah!
// Qu-quake!
DisplayDungeonDialogue(&MagmaCavernMidDialogue_3);
sub_803E708(0x78,0x46);
StopSoundEffect(0x1c5);
sub_808682C();
sub_80855E4(sub_8086910);
sub_803E708(0x14,0x46);
sub_8085930(DIRECTION_NORTH);
sub_803E708(10,0x46);
// Whew!
// It settled down.
//
// Whew
// It's over.
DisplayDungeonDialogue(MagmaCavernMidDialogue_4);
sub_803E708(10,0x46);
PlaySoundEffect(0x1d5);
SpriteLookAroundEffect(partnerEntity);
PlaySoundEffect(0x1c7);
sub_80856E0(partnerEntity, DIRECTION_NORTH);
// Hey! {POKEMON_0}!
// Over there!
DisplayDungeonDialogue(&MagmaCavernMidDialogue_5);
GetEntInfo(groudonEntity)->unk15E = 0;
GetEntInfo(alakazamEntity)->unk15E =0;
pos.x = (groudonEntity->pixelPos.x + alakazamEntity->pixelPos.x) / 2;
pos.y = (groudonEntity->pixelPos.y + alakazamEntity->pixelPos.y) / 2 + 0x800;
ShiftCameraToPosition(&pos,0x20);
sub_803E708(0x3c,0x46);
sub_80891F0();
// Hey!
// Are you OK?!
//
// Hey!
// Snap out of it!
DisplayDungeonDialogue(MagmaCavernMidDialogue_6);
sub_803E708(10,0x46);
// Urrrrgh...
DisplayDungeonDialogue(&MagmaCavernMidDialogue_7);
sub_803E708(10,0x46);
sub_80869E4(leaderEntity,4,2,DIRECTION_NORTHWEST);
// What happened to you?
//
// What happened here?
DisplayDungeonDialogue(MagmaCavernMidDialogue_8);
sub_803E708(10,0x46);
// We challenged..
// {POKEMON_2}...
// And wiped out..
DisplayDungeonDialogue(&MagmaCavernMidDialogue_9);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&MagmaCavernMidDialogue_10);
sub_803E708(10,0x46);
sub_80869E4(leaderEntity,4,1,DIRECTION_NORTHEAST);
sub_80869E4(partnerEntity,4,1,DIRECTION_NORTHEAST);
// Grrgh..
// We... It crushed us
DisplayDungeonDialogue(&MagmaCavernMidDialogue_11);
sub_803E708(10,0x46);
PlaySoundEffect(0x1d5);
SpriteLookAroundEffect(partnerEntity);
// That's right...
// What happened to {POKEMON_3}?
// Where is {POKEMON_3}?
//
// Wait...
// What about {POKEMON_3}?
// Where did {POKEMON_3} go?
DisplayDungeonDialogue(MagmaCavernMidDialogue_12);
sub_803E708(0x1e,0x46);
// {POKEMON_3} is...
// Still battling {POKEMON_2}...
DisplayDungeonDialogue(&MagmaCavernMidDialogue_13);
sub_803E708(10,0x46);
sub_80869E4(partnerEntity,4,1,DIRECTION_EAST);
sub_80869E4(leaderEntity,4,2,DIRECTION_WEST);
// {POKEMON_0}!
// We've got to hurry!
DisplayDungeonDialogue(&MagmaCavernMidDialogue_14);
sub_8089294();
// Be careful!
DisplayDungeonDialogue(&MagmaCavernMidDialogue_15);
sub_803E708(10,0x46);
gDungeon->unk2 = 1;
}
void sub_8089168(void)
{
Entity *leaderEntity;
leaderEntity = xxx_call_GetLeader();
sub_8086448();
sub_803E708(10,0x46);
SpriteLookAroundEffect(leaderEntity);
sub_803E708(10,0x46);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void sub_808919C(Entity *r0)
{
IncreaseEntityPixelPos(r0, 0, -512);
}
void sub_80891B0(Entity *r0)
{
sub_806CDD4(r0, 0, DIRECTION_NORTH);
GetEntInfo(r0)->unk15F = 1;
}
void sub_80891D0(Entity *r0)
{
sub_806CDD4(r0, 7, DIRECTION_NORTH);
GetEntInfo(r0)->unk15F = 0;
}
static void sub_80891F0(void)
{
s32 iVar1;
sub_80855E4(sub_80891B0);
for(iVar1 = 0; iVar1 < 0x30; iVar1++)
{
sub_80855E4(sub_808919C);
DungeonRunFrameActions(0x46);
}
sub_80855E4(sub_80891D0);
}
void sub_8089224(Entity * entity)
{
s32 xPixelPos;
if (entity->pixelPos.y < 0x9001) {
return;
}
xPixelPos = entity->pixelPos.x;
if(xPixelPos < 0xE400)
{
if(xPixelPos <= 0xB400)
{
// 0 - 0xB400
IncreaseEntityPixelPos(entity, 0, -512);
}
else
{
// 0xB401 - 0xE3FF
IncreaseEntityPixelPos(entity, -512, 0);
}
}
else if(xPixelPos < 0xFC00)
{
IncreaseEntityPixelPos(entity, 0, -512);
}
else if(xPixelPos <= 0x11400)
{
IncreaseEntityPixelPos(entity, 0x200, 0);
}
else
{
IncreaseEntityPixelPos(entity, 0, -512);
}
}
static void sub_8089294(void)
{
s32 iVar1;
sub_80855E4(sub_80891B0);
for(iVar1 = 0; iVar1 <= 0x77; iVar1++)
{
sub_80855E4(sub_8089224);
DungeonRunFrameActions(0x46);
}
sub_80855E4(sub_80891D0);
}

View File

@@ -0,0 +1,185 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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_80898F8(Entity *r0);
static void sub_8089908(Entity *r0);
void sub_808970C(void)
{
Entity *leaderEntity;
leaderEntity = xxx_call_GetLeader();
DungeonStartNewBGM(MUS_TINY_WOODS);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
sub_808563C(sub_8089908);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y -3);
}
void sub_808974C(void)
{
Entity *leaderEntity;
leaderEntity = xxx_call_GetLeader();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
sub_808563C(sub_80898F8);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y + -3);
}
void sub_8089788(Entity *entity, u8 param_2, u8 param_3)
{
Entity *monEntity;
s32 index;
bool8 found = FALSE;
if (param_3 == 0x1A || param_3 == 0x1B) {
for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++)
{
monEntity = gDungeon->wildPokemon[index];
if ((EntityIsValid(monEntity)) && (monEntity != entity) && (GetEntInfo(monEntity)->monsterBehavior == param_2)) {
found = TRUE;
break;
}
}
if(!found){
sub_8097FA8(0x11);
gDungeon->unk2 = 1;
}
}
}
void sub_80897F0(void)
{
Entity *leaderEntity;
leaderEntity = xxx_call_GetLeader();
sub_8086448();
sub_803E708(10,0x46);
sub_808563C(SpriteShockEffect);
sub_803E708(0x20,0x46);
sub_808692C();
DisplayDungeonDialogue(&gUnknown_8103BD8);
// We don't like to brag or
// nothing, but
DisplayDungeonDialogue(&gUnknown_8103C00);
// We get furious real easy
// You know that?!
DisplayDungeonDialogue(&gUnknown_8103C3C);
// What really irritates us is
// when we see some dim witted face
DisplayDungeonDialogue(&gUnknown_8103C74);
// .........
// Wrooooooar!
// That vacant expression
DisplayDungeonDialogue(&gUnknown_8103CC4);
// Gwoooh
// It's ticking me off!
// I'm seeing red!
DisplayDungeonDialogue(&gUnknown_8103D0C);
// Mukkkeeeeeh
// Get 'em! It's frenzy time!
DisplayDungeonDialogue(&gUnknown_8103D50);
sub_803E708(10,0x46);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void sub_8089878(void)
{
Entity *leaderEntity;
leaderEntity = xxx_call_GetLeader();
sub_8086448();
sub_803E708(10,0x46);
sub_808563C(SpriteShockEffect);
sub_803E708(0x20,0x46);
sub_808692C();
DisplayDungeonDialogue(&gUnknown_8103D8C);
DisplayDungeonDialogue(&gUnknown_8103D98);
DisplayDungeonDialogue(&gUnknown_8103DD8);
DisplayDungeonDialogue(&gUnknown_8103E28);
sub_803E708(10,0x46);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void sub_80898E4(void)
{
sub_8086448();
sub_80866C4(&gUnknown_8103E34);
}
static void sub_80898F8(Entity *r0)
{
sub_8068FE0(r0, 0x21C, 0);
}
static void sub_8089908(Entity *r0)
{
SetFacingDirection(r0, DIRECTION_NORTH);
}

View File

@@ -0,0 +1,219 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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;
}

View File

@@ -0,0 +1,148 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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);
void sub_808C9C4(void)
{
Entity *leaderEntity;
Entity *medichamEntity;
leaderEntity = xxx_call_GetLeader();
medichamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEDICHAM);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
SetFacingDirection(medichamEntity, DIRECTION_SOUTH);
sub_8085860(leaderEntity->pos.x, leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_MEDICHAM);
}
void MedichamRescueDialogue(void)
{
Entity *medichamEntity;
s32 counter;
medichamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEDICHAM);
SpriteLookAroundEffect(medichamEntity);
sub_803E708(0xA, 0x46);
// Oh my I can't seem to find a way out...
DisplayDungeonDialogue(&gMedichamRescueDialogue_1);
sub_803E708(0xA, 0x46);
sub_80869E4(medichamEntity, 4, 2, DIRECTION_NORTH);
sub_803E708(0xA, 0x46);
// What am I to do...?
DisplayDungeonDialogue(&gMedichamRescueDialogue_2);
sub_803E708(0xA, 0x46);
sub_8086448();
sub_8086598();
sub_803E708(0x20, 0x46);
SpriteShockEffect(medichamEntity);
sub_803E708(0x20, 0x46);
sub_80869E4(medichamEntity, 4, 2, DIRECTION_SOUTH);
DisplayDungeonDialogue(&gMedichamRescueDialogue_3);
sub_803E708(0xA, 0x46);
PlaySoundEffect(0x1c7);
sub_806CDD4(medichamEntity, 0xA, DIRECTION_SOUTH);
sub_803E708(0x14, 0x46);
sub_806CE68(medichamEntity, DIRECTION_SOUTH);
sub_803E708(0x4, 0x46);
PlaySoundEffect(0x1c7);
sub_806CDD4(medichamEntity, 0xA, DIRECTION_SOUTH);
sub_803E708(0x14, 0x46);
// Yes Yes
// I am so lucky
//
// There appears to be no one here
DisplayDungeonDialogue(&gMedichamRescueDialogue_4);
sub_803E708(0xA, 0x46);
sub_806CDD4(medichamEntity, 0, DIRECTION_SOUTH);
for(counter = 0x17; counter >= 0; counter--)
{
IncreaseEntityPixelPos(medichamEntity, 0, 0x100);
DungeonRunFrameActions(0x46);
}
sub_806CE68(medichamEntity, DIRECTION_SOUTH);
sub_803E708(0x20, 0x46);
sub_8042B0C(medichamEntity);
sub_8068FE0(medichamEntity, 0x21C, 0);
gDungeon->unk4 = 1;
gDungeon->unk11 = 4;
}
void sub_808CB5C(void)
{
Entity *leaderEntity;
Entity *medichamEntity;
leaderEntity = xxx_call_GetLeader();
medichamEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEDICHAM);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_8068FE0(medichamEntity, 0x21C, 0);
sub_8085860(leaderEntity->pos.x, leaderEntity->pos.y);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_MEDICHAM);
}

View File

@@ -0,0 +1,221 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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 MewtwoDropInEffect(Entity *mewtwoEntity);
static void MewtwoScreenFlash(void);
void sub_8089914(void)
{
Entity *leaderEntity;
Entity *MewtwoEntity;
leaderEntity = xxx_call_GetLeader();
MewtwoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEWTWO);
DungeonStopBGM();
gDungeon->unk7 = 1;
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
SetFacingDirection(MewtwoEntity, DIRECTION_SOUTH);
sub_8086A3C(MewtwoEntity);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2],MONSTER_MEWTWO);
}
void sub_8089978(void)
{
Entity *leaderEntity;
Entity *MewtwoEntity;
leaderEntity = xxx_call_GetLeader();
MewtwoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEWTWO);
DungeonStopBGM();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
if(HasRecruitedMon(MONSTER_MEWTWO)){
DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE);
sub_8068FE0(MewtwoEntity,0x21c,0);
}
else {
gDungeon->unk7 = 1;
SetFacingDirection(MewtwoEntity, DIRECTION_SOUTH);
sub_8086A3C(MewtwoEntity);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2],MONSTER_MEWTWO);
}
void sub_8089A00(u8 param_1, u8 param_2)
{
if ((param_2 == 0x1d || param_2 == 0x1e || param_2 == 0x1f) && (param_1 == 0x11)) {
sub_8097FA8(0x13);
gDungeon->unk2 = 1;
}
}
void MewtwoPreFightDialogue(void)
{
Entity *leaderEntity;
Entity *MewtwoEntity;
leaderEntity = xxx_call_GetLeader();
MewtwoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEWTWO);
sub_8086448();
DisplayDungeonDialogue(&gMewtwoPreFightDialogue_1);
sub_803E708(10,0x46);
DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE);
sub_8086794();
sub_803E708(0x1e,0x46);
MewtwoDropInEffect(MewtwoEntity);
sub_803E708(0x3c,0x46);
DisplayDungeonDialogue(&gMewtwoPreFightDialogue_2);
DisplayDungeonDialogue(&gMewtwoPreFightDialogue_3);
sub_803E708(10,0x46);
MewtwoScreenFlash();
DisplayDungeonDialogue(&gMewtwoPreFightDialogue_4);
MewtwoScreenFlash();
DisplayDungeonDialogue(&gMewtwoPreFightDialogue_5);
sub_803E708(10,0x46);
SetupBossFightHP(MewtwoEntity,900,MUS_BATTLE_WITH_RAYQUAZA);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void MewtwoReFightDialogue(void)
{
Entity *leaderEntity;
Entity *MewtwoEntity;
leaderEntity = xxx_call_GetLeader();
MewtwoEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MEWTWO);
sub_8086448();
if(HasRecruitedMon(MONSTER_MEWTWO)) {
sub_80866C4(&gMewtwoReFightDialogue_5);
}
else {
DisplayDungeonDialogue(&gMewtwoReFightDialogue_1);
DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE);
sub_8086794();
MewtwoDropInEffect(MewtwoEntity);
sub_803E708(0x3c,0x46);
DisplayDungeonDialogue(&gMewtwoReFightDialogue_2);
MewtwoScreenFlash();
DisplayDungeonDialogue(&gMewtwoReFightDialogue_3);
MewtwoScreenFlash();
DisplayDungeonDialogue(&gMewtwoReFightDialogue_4);
SetupBossFightHP(MewtwoEntity,900,MUS_BATTLE_WITH_RAYQUAZA);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void MewtwoDropInEffect(Entity *mewtwoEntity)
{
s24_8 iVar1;
s24_8 iVar2;
GetEntInfo(mewtwoEntity)->unk15E = 0;
iVar2 = IntToF248_2(200);
iVar1 = IntToF248_2(4);
PlaySoundEffect(0x1f8);
while( 1 ) {
iVar2.raw -= iVar1.raw;
iVar1 = F248_Sub(iVar1, FloatToF248_2(0.045));
if (F248LessThanFloat(iVar1, 0.12)) {
iVar1 = FloatToF248_2(0.12);
}
if (F248LessThanInt(iVar2, 0)) break;
GetEntInfo(mewtwoEntity)->unk174 = iVar2;
DungeonRunFrameActions(0x46);
}
GetEntInfo(mewtwoEntity)->unk174 = IntToF248_2(0);
}
static void MewtwoScreenFlash(void)
{
int iVar1;
PlaySoundEffect(0x1f6);
for(iVar1 = 250; iVar1 > 149; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,0,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(10,0x46);
sub_8085EB0();
}

View File

@@ -0,0 +1,369 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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);
extern void sub_8085F44(s32);
static void MoltresDropInEffect(Entity * moltresEntity);
static void MoltresScreenFlash1(s32 xArg, s32 yArg);
static void MoltresScreenFlash2(s32 xArg, s32 yArg);
static void MoltresScreenFlash3(void);
static void MoltresScreenDarken(void);
void sub_80877E8(void)
{
Entity * leaderEntity;
Entity * moltresEntity;
leaderEntity = xxx_call_GetLeader();
moltresEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MOLTRES);
DungeonStartNewBGM(MUS_THE_MOUNTAIN_OF_FIRE);
sub_8085374();
sub_80854D4();
sub_8085930(DIRECTION_WEST);
sub_80855E4(sub_8086A3C);
SetFacingDirection(moltresEntity, DIRECTION_SOUTH);
sub_8086A3C(moltresEntity);
sub_8085860(leaderEntity->pos.x + -3,leaderEntity->pos.y + -2);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_MOLTRES);
}
void sub_8087848(void)
{
Entity *leaderEntity;
Entity *moltresEntity;
u32 XPos;
s32 YPos;
leaderEntity = xxx_call_GetLeader();
moltresEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MOLTRES);
DungeonStartNewBGM(MUS_THE_MOUNTAIN_OF_FIRE);
sub_80854D4();
sub_8085930(DIRECTION_WEST);
sub_80855E4(sub_8086A3C);
if (sub_8086AE4(MONSTER_MOLTRES)) {
sub_8068FE0(moltresEntity,0x21c,0);
}
else {
sub_8072008(moltresEntity,moltresEntity,gMoltresConfigLevel,0,0);
SetFacingDirection(moltresEntity, DIRECTION_SOUTH);
sub_8086A3C(moltresEntity);
}
sub_8085860(leaderEntity->pos.x - 5, leaderEntity->pos.y);
XPos = GetCameraXPos();
YPos = GetCameraYPos();
sub_803F878(XPos, YPos + -0x1000);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2],MONSTER_MOLTRES);
}
void sub_80878F4(u8 param_1, u8 param_2)
{
if ((param_2 == 0xA || param_2 == 0xB || param_2 == 0xC) && (param_1 == 0x9)) {
sub_8097FA8(0x7);
gDungeon->unk2 = 1;
}
}
void MoltresPreFightDialogue(void)
{
Entity *leaderEntity;
Entity *partnerEntity;
Entity *moltresEntity;
leaderEntity = xxx_call_GetLeader();
partnerEntity = GetPartnerEntity();
moltresEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MOLTRES);
MoltresScreenFlash1(0xc,5);
sub_8086500();
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gMoltresPreFightDialogue_1);
sub_803E708(10,0x46);
sub_80869E4(partnerEntity,4,1,DIRECTION_NORTHWEST);
sub_803E708(4,0x46);
SpriteLookAroundEffect(partnerEntity);
sub_803E708(10,0x46);
DisplayDungeonDialogue(gMoltresPreFightDialogue_2);
sub_803E708(10,0x46);
MoltresScreenFlash1(0xc,5);
MoltresScreenFlash2(9,5);
DisplayDungeonDialogue(gMoltresPreFightDialogue_3);
sub_803E708(10,0x46);
sub_80869E4(partnerEntity,4,1,DIRECTION_EAST);
sub_80869E4(leaderEntity,4,2,DIRECTION_WEST);
DisplayDungeonDialogue(gMoltresPreFightDialogue_4);
sub_803E708(10,0x46);
sub_80869E4(partnerEntity,4,2,DIRECTION_WEST);
sub_8086690();
DisplayDungeonDialogue(&gMoltresPreFightDialogue_5);
sub_803E708(10,0x46);
sub_8085930(DIRECTION_NORTHWEST);
sub_803E708(4,0x46);
sub_8085930(DIRECTION_NORTH);
PlaySoundEffect(0x2f2);
DungeonStopBGM();
MoltresScreenDarken();
DisplayDungeonDialogue(gMoltresPreFightDialogue_6);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gMoltresPreFightDialogue_7);
sub_803E708(10,0x46);
PlaySoundEffect(0x1cf);
sub_80856E0(partnerEntity, DIRECTION_NORTH);
sub_803E708(10,0x46);
DisplayDungeonDialogue(gMoltresPreFightDialogue_8);
sub_803E708(10,0x46);
MoltresScreenFlash3();
PlaySoundEffect(0x1da);
DisplayDungeonDialogue(&gMoltresPreFightDialogue_9);
sub_803E708(10,0x46);
MoltresScreenFlash1(9,5);
MoltresScreenFlash2(0xb,5);
DisplayDungeonDialogue(&gMoltresPreFightDialogue_10);
sub_803E708(10,0x46);
MoltresScreenFlash1(0xc,5);
MoltresScreenFlash2(9,5);
MoltresDropInEffect(moltresEntity);
sub_808663C();
MoltresScreenFlash3();
DisplayDungeonDialogue(&gMoltresPreFightDialogue_11);
sub_803E708(10,0x46);
MoltresScreenFlash2(0xb,6);
DisplayDungeonDialogue(&gMoltresPreFightDialogue_12);
sub_803E708(10,0x46);
SetupBossFightHP(moltresEntity,400,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void MoltresReFightDialogue(void)
{
Entity *leaderEntity;
Entity *partnerEntity;
Entity *moltresEntity;
leaderEntity = xxx_call_GetLeader();
partnerEntity = GetPartnerEntity();
moltresEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MOLTRES);
MoltresScreenFlash1(10,5);
sub_8086500();
sub_803E708(10,0x46);
SpriteLookAroundEffect(partnerEntity);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gMoltresReFightDialogue_1);
sub_803E708(10,0x46);
sub_80869E4(partnerEntity,4,1,DIRECTION_EAST);
sub_80869E4(leaderEntity,4,2,DIRECTION_WEST);
DisplayDungeonDialogue(gMoltresReFightDialogue_2);
sub_803E708(10,0x46);
sub_80869E4(partnerEntity,4,2,DIRECTION_WEST);
sub_80869E4(leaderEntity,4,2,DIRECTION_WEST);
sub_8086690();
MoltresScreenDarken();
sub_803E708(10,0x46);
sub_8085930(DIRECTION_NORTHWEST);
sub_803E708(4,0x46);
sub_8085930(DIRECTION_NORTH);
MoltresDropInEffect(moltresEntity);
sub_808663C();
MoltresScreenFlash3();
DisplayDungeonDialogue(&gMoltresReFightDialogue_3);
sub_803E708(10,0x46);
MoltresScreenFlash2(0xb,6);
DisplayDungeonDialogue(gMoltresReFightDialogue_4);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gMoltresReFightDialogue_5);
sub_803E708(10,0x46);
SetupBossFightHP(moltresEntity,400,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void MoltresPostStoryPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * moltresEntity;
leaderEntity = xxx_call_GetLeader();
moltresEntity = GetEntityFromMonsterBehavior(BEHAVIOR_MOLTRES);
MoltresScreenFlash1(0xc,5);
sub_808654C();
if (sub_8086AE4(MONSTER_MOLTRES)) {
sub_8085930(DIRECTION_NORTHWEST);
sub_803E708(4,0x46);
sub_8085930(DIRECTION_NORTH);
sub_803E708(4,0x46);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gUnknown_8100D3C);
sub_803E708(10,0x46);
gDungeon->unk2 = 1;
}
else {
DisplayDungeonDialogue(&gMoltresPostStoryPreFightDialogue_1);
sub_8085930(DIRECTION_NORTHWEST);
sub_803E708(4,0x46);
sub_8085930(DIRECTION_NORTH);
MoltresDropInEffect(moltresEntity);
DisplayDungeonDialogue(&gMoltresPostStoryPreFightDialogue_2);
MoltresScreenFlash1(0xc,5);
MoltresScreenFlash2(9,5);
DisplayDungeonDialogue(&gMoltresPostStoryPreFightDialogue_3);
MoltresScreenFlash3();
DisplayDungeonDialogue(&gMoltresPostStoryPreFightDialogue_4);
MoltresScreenFlash2(0xb,6);
DisplayDungeonDialogue(&gMoltresPostStoryPreFightDialogue_5);
sub_803E708(10,0x46);
SetupBossFightHP(moltresEntity,400,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void MoltresDropInEffect(Entity * moltresEntity)
{
s32 iVar1;
GetEntInfo(moltresEntity)->unk15C = 1;
GetEntInfo(moltresEntity)->unk15E = 0;
GetEntInfo(moltresEntity)->unk174 = IntToF248_2(200);
PlaySoundEffect(0x1f8);
for(iVar1 = 200; iVar1 >= 0; iVar1 -= 5)
{
GetEntInfo(moltresEntity)->unk174 = IntToF248_2(iVar1);
DungeonRunFrameActions(0x46);
}
}
static void MoltresScreenFlash1(s32 xArg, s32 yArg)
{
s32 x, y;
DungeonPos newPos;
x = X_POS_TO_PIXELPOS(xArg);
newPos.x = x / 256;
y = Y_POS_TO_PIXELPOS(yArg);
newPos.y = y / 256;
sub_8085EC8(370,16,0,&newPos,0);
}
static void MoltresScreenFlash2(s32 xArg, s32 yArg)
{
s32 r6;
s32 i, x, y;
DungeonPos newPos;
x = X_POS_TO_PIXELPOS(xArg);
newPos.x = x / 256;
y = Y_POS_TO_PIXELPOS(yArg);
newPos.y = y / 256;
r6 = sub_8085EC8(370,22,0,&newPos,0);
PlaySoundEffect(0x1EC);
for (i = 250; i >= 20; i -= 10) {
SetDungeonBGColorRGB(i, 0, 0, 1, 1);
DungeonRunFrameActions(0x46);
}
sub_803E708(0xA, 0x46);
for (i = 250; i >= 0; i -= 10) {
SetDungeonBGColorRGB(i, 0, 0, 1, 1);
DungeonRunFrameActions(0x46);
}
sub_803E708(0xA, 0x46);
sub_8085EB0();
sub_8085F44(r6);
}
static void MoltresScreenFlash3(void)
{
int iVar1;
PlaySoundEffect(0x1ed);
iVar1 = 0xfa;
for(iVar1 = 250; iVar1 > 9; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1 / 2,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(0x1e,0x46);
PlaySoundEffect(0x1ed);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1 / 2,1,1);
DungeonRunFrameActions(0x46);
}
sub_803E708(0x1e,0x46);
sub_8085EB0();
}
static void MoltresScreenDarken(void)
{
s32 iVar1;
for(iVar1 = 0; iVar1 >= -80; iVar1 -= 8)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,0,0);
DungeonRunFrameActions(0x46);
}
}

View File

@@ -0,0 +1,13 @@
#include "global.h"
#include "globaldata.h"
#include "code_80869E4.h"
#include "dungeon_boss_dialogue.h"
void sub_808CD9C(void)
{
sub_8086448();
// There appears to be no one here.
// It's impossible to go any further
sub_80866C4(&gUnknown_810697C);
}

View File

@@ -0,0 +1,220 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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 RaikouScreenFlash(void);
void sub_8089EFC(void)
{
Entity * leaderEntity;
Entity * RaikouEntity;
leaderEntity = xxx_call_GetLeader();
RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
SetFacingDirection(RaikouEntity, DIRECTION_SOUTH);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_RAIKOU);
}
void sub_8089F44(void)
{
Entity * leaderEntity;
Entity * RaikouEntity;
leaderEntity = xxx_call_GetLeader();
RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
SetFacingDirection(RaikouEntity, DIRECTION_SOUTH);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_RAIKOU);
}
void sub_8089F8C(void)
{
Entity * leaderEntity;
Entity * RaikouEntity;
leaderEntity = xxx_call_GetLeader();
RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
if (HasRecruitedMon(MONSTER_RAIKOU)) {
sub_8068FE0(RaikouEntity,0x21c,0);
}
else {
SetFacingDirection(RaikouEntity, DIRECTION_SOUTH);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_RAIKOU);
}
void sub_8089FF0(u8 param_1, u8 param_2)
{
if ((param_2 == 0x23 || param_2 == 0x24 || param_2 == 0x25) && (param_1 == 0x13)) {
sub_8097FA8(0x17);
gDungeon->unk2 = 1;
}
}
void RaikouPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * RaikouEntity;
leaderEntity = xxx_call_GetLeader();
RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU);
DisplayDungeonDialogue(&gRaikouPreFightDialogue_1);
RaikouScreenFlash();
DisplayDungeonDialogue(&gRaikouPreFightDialogue_2);
gDungeon->weather.unkE265 = WEATHER_RAIN;
sub_807EAA0(0,1);
sub_803E708(10,70);
DisplayDungeonDialogue(&gRaikouPreFightDialogue_3);
RaikouScreenFlash();
DisplayDungeonDialogue(&gRaikouPreFightDialogue_4);
RaikouScreenFlash();
DisplayDungeonDialogue(&gRaikouPreFightDialogue_5);
RaikouScreenFlash();
DisplayDungeonDialogue(&gRaikouPreFightDialogue_6);
sub_803E708(10,70);
SetupBossFightHP(RaikouEntity,0x28a,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void RaikouReFightDialogue(void)
{
Entity * leaderEntity;
Entity * RaikouEntity;
leaderEntity = xxx_call_GetLeader();
RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU);
gDungeon->weather.unkE265 = WEATHER_RAIN;
sub_807EAA0(0,1);
RaikouScreenFlash();
DisplayDungeonDialogue(&gRaikouReFightDialogue_1);
RaikouScreenFlash();
DisplayDungeonDialogue(&gRaikouReFightDialogue_2);
RaikouScreenFlash();
DisplayDungeonDialogue(&gRaikouReFightDialogue_3);
sub_803E708(10,70);
SetupBossFightHP(RaikouEntity,0x28a,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void RaikouPostStoryPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * RaikouEntity;
leaderEntity = xxx_call_GetLeader();
RaikouEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAIKOU);
if (HasRecruitedMon(MONSTER_RAIKOU)) {
sub_80866C4(&gRaikouPostStoryPreFightDialogue_4);
}
else {
gDungeon->weather.unkE265 = WEATHER_RAIN;
sub_807EAA0(0,1);
DisplayDungeonDialogue(&gRaikouPostStoryPreFightDialogue_1);
RaikouScreenFlash();
DisplayDungeonDialogue(&gRaikouPostStoryPreFightDialogue_2);
RaikouScreenFlash();
DisplayDungeonDialogue(&gRaikouPostStoryPreFightDialogue_3);
sub_803E708(10,70);
SetupBossFightHP(RaikouEntity,0x28a,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void RaikouScreenFlash(void)
{
s32 iVar1;
PlaySoundEffect(0x1f6);
for(iVar1 = 250; iVar1 > 149; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
sub_8085EB0();
}

View File

@@ -0,0 +1,255 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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 RayquazaDropInEffect(Entity *rayquazaEntity);
static void RayquazaScreenFlash(void);
void sub_80892C8(void)
{
Entity * leaderEntity;
Entity * RayquazaEntity;
leaderEntity = xxx_call_GetLeader();
RayquazaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAYQUAZA);
DungeonStartNewBGM(MUS_RAYQUAZAS_DOMAIN);
sub_8085374();
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
SetFacingDirection(RayquazaEntity, DIRECTION_SOUTH);
sub_8086A3C(RayquazaEntity);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2],MONSTER_RAYQUAZA);
}
void sub_8089328(void)
{
Entity * leaderEntity;
Entity * rayquazaEntity;
leaderEntity = xxx_call_GetLeader();
rayquazaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAYQUAZA);
DungeonStartNewBGM(MUS_RAYQUAZAS_DOMAIN);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
if (sub_8086AE4(MONSTER_RAYQUAZA)) {
sub_8068FE0(rayquazaEntity,0x21c,0);
}
else {
sub_8072008(rayquazaEntity,rayquazaEntity,gRayquazaConfigLevel,0,0);
sub_8086A3C(rayquazaEntity);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2],MONSTER_RAYQUAZA);
}
void sub_80893B4(u8 param_1, u8 param_2)
{
if ((param_2 == 0x17 || param_2 == 0x18 || param_2 == 0x19) && (param_1 == 0xF)) {
sub_8097FA8(0xF);
gDungeon->unk2 = 1;
}
}
void RayquazaPreFightDialogue(void)
{
Entity *leaderEntity;
Entity *partnerEntity;
Entity *rayquazaEntity;
leaderEntity = xxx_call_GetLeader();
partnerEntity = GetPartnerEntity();
rayquazaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAYQUAZA);
sub_8086448();
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_1);
RayquazaScreenFlash();
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_2);
sub_80856E0(partnerEntity, DIRECTION_NORTH);
SpriteLookAroundEffect(partnerEntity);
sub_803E708(10,0x46);
sub_80869E4(partnerEntity,4,1,DIRECTION_EAST);
sub_80869E4(leaderEntity,4,2,DIRECTION_WEST);
DisplayDungeonDialogue(gRayquazaPreFightDialogue_3);
sub_80869E4(partnerEntity,4,2,DIRECTION_NORTH);
sub_80869E4(leaderEntity,4,1,DIRECTION_NORTH);
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_4);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_5);
sub_803E708(10,0x46);
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_6);
RayquazaScreenFlash();
PlaySoundEffect(0x1da); // Rayquaza Cry
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_7);
RayquazaDropInEffect(rayquazaEntity);
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_8);
RayquazaScreenFlash();
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_9);
RayquazaScreenFlash();
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_10);
RayquazaScreenFlash();
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_11);
SetupBossFightHP(rayquazaEntity,600,MUS_BATTLE_WITH_RAYQUAZA);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void RayquazaReFightDialogue(void)
{
Entity *leaderEntity;
Entity *rayquazaEntity;
leaderEntity = xxx_call_GetLeader();
rayquazaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAYQUAZA);
sub_8086448();
RayquazaScreenFlash();
PlaySoundEffect(0x1da); // Rayquaza Cry
DisplayDungeonDialogue(&gRayquazaPreFightDialogue_7);
sub_803E708(10,0x46);
RayquazaDropInEffect(rayquazaEntity);
DisplayDungeonDialogue(&gRayquazaReFightDialogue_1);
RayquazaScreenFlash();
DisplayDungeonDialogue(&gRayquazaReFightDialogue_2);
RayquazaScreenFlash();
DisplayDungeonDialogue(&gRayquazaReFightDialogue_3);
RayquazaScreenFlash();
DisplayDungeonDialogue(&gRayquazaReFightDialogue_4);
SetupBossFightHP(rayquazaEntity,600,MUS_BATTLE_WITH_RAYQUAZA);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void RayquazaPostStoryPreFightDialogue(void)
{
Entity *leaderEntity;
Entity *rayquazaEntity;
leaderEntity = xxx_call_GetLeader();
rayquazaEntity = GetEntityFromMonsterBehavior(BEHAVIOR_RAYQUAZA);
sub_8086448();
if (sub_8086AE4(MONSTER_RAYQUAZA)) {
sub_80866C4(&gRayquazaPostStoryPreFightDialogue_6);
}
else {
PlaySoundEffect(0x1da); // Rayquaza Cry
DisplayDungeonDialogue(&gRayquazaPostStoryPreFightDialogue_1);
RayquazaDropInEffect(rayquazaEntity);
DisplayDungeonDialogue(&gRayquazaPostStoryPreFightDialogue_2);
RayquazaScreenFlash();
DisplayDungeonDialogue(&gRayquazaPostStoryPreFightDialogue_3);
RayquazaScreenFlash();
DisplayDungeonDialogue(&gRayquazaPostStoryPreFightDialogue_4);
RayquazaScreenFlash();
DisplayDungeonDialogue(&gRayquazaPostStoryPreFightDialogue_5);
SetupBossFightHP(rayquazaEntity,600,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void RayquazaDropInEffect(Entity *rayquazaEntity)
{
s24_8 iVar1;
s24_8 iVar2;
GetEntInfo(rayquazaEntity)->unk15E = 0;
iVar2 = IntToF248_2(200);
iVar1 = IntToF248_2(6);
PlaySoundEffect(0x1f8);
while( 1 ) {
iVar2.raw = iVar2.raw - iVar1.raw; // must be .raw
iVar1 = F248_Sub(iVar1, FloatToF248_2(3./32.));
if (F248LessThanFloat(iVar1, 0.08)) {
iVar1 = FloatToF248(0.08);
}
if (F248LessThanInt(iVar2, 0)) break;
GetEntInfo(rayquazaEntity)->unk174 = iVar2;
DungeonRunFrameActions(0x46);
}
GetEntInfo(rayquazaEntity)->unk174 = IntToF248_2(0);
}
static void RayquazaScreenFlash(void)
{
s32 iVar1;
PlaySoundEffect(0x1f6);
for(iVar1 = 250; iVar1 > 149; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1 / 2, iVar1, iVar1 / 2, 1, 1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1 / 2, iVar1, 0, 1, 1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1 / 2, iVar1, iVar1 / 2, 1, 1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
sub_8085EB0();
}

View File

@@ -0,0 +1,363 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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_808B1CC(u8 itemID);
static void SetupRegiFacingDirection(Entity *regiEntity);
static void SetupRegirockFightHP(Entity *r0);
static void SetupRegiceFightHP(Entity *r0);
static void SetupRegisteelFightHP(Entity *r0);
void sub_808ACC0(void)
{
Entity * entity;
if (HasRecruitedMon(MONSTER_REGIROCK)) {
entity = GetEntityFromMonsterBehavior(BEHAVIOR_REGIROCK);
sub_8068FE0(entity,0x21c,0);
sub_8097FA8(0x22);
sub_8097FA8(0x1d);
sub_808B1CC(ITEM_ROCK_PART);
}
else if (sub_80860A8(ITEM_ROCK_PART) != 0) {
sub_8098044(0x22);
sub_8097FA8(0x1d);
}
else if (sub_80860A8(ITEM_MUSIC_BOX) != 0) {
sub_8098044(0x22);
sub_8097FA8(0x1d);
}
else {
sub_8098044(0x22);
sub_8098044(0x1d);
sub_80855E4(SetupRegiFacingDirection);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_REGIROCK);
}
}
void sub_808AD48(void)
{
Entity * entity;
if (HasRecruitedMon(MONSTER_REGICE)) {
entity = GetEntityFromMonsterBehavior(BEHAVIOR_REGICE);
sub_8068FE0(entity,0x21c,0);
sub_8097FA8(0x22);
sub_8097FA8(0x1d);
sub_808B1CC(ITEM_ICE_PART);
}
else if (sub_80860A8(ITEM_ICE_PART) != 0) {
sub_8098044(0x22);
sub_8097FA8(0x1d);
}
else if (sub_80860A8(ITEM_MUSIC_BOX) != 0) {
sub_8098044(0x22);
sub_8097FA8(0x1d);
}
else {
sub_8098044(0x22);
sub_8098044(0x1d);
sub_80855E4(SetupRegiFacingDirection);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_REGICE);
}
}
void sub_808ADCC(void)
{
Entity * entity;
if (HasRecruitedMon(MONSTER_REGISTEEL)) {
entity = GetEntityFromMonsterBehavior(BEHAVIOR_REGISTEEL);
sub_8068FE0(entity,0x21c,0);
sub_8097FA8(0x22);
sub_8097FA8(0x1d);
sub_808B1CC(ITEM_STEEL_PART);
}
else if (sub_80860A8(ITEM_STEEL_PART) != 0) {
sub_8098044(0x22);
sub_8097FA8(0x1d);
}
else if (sub_80860A8(ITEM_MUSIC_BOX) != 0) {
sub_8098044(0x22);
sub_8097FA8(0x1d);
}
else {
sub_8098044(0x22);
sub_8098044(0x1d);
sub_80855E4(SetupRegiFacingDirection);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_REGISTEEL);
}
}
void sub_808AE54(u8 param_1,u8 param_2,DungeonPos *param_3)
{
Entity * leaderEntity;
s16 IDStack[2];
Item item;
leaderEntity = xxx_call_GetLeader();
sub_8052D44(IDStack,leaderEntity,0);
if (!sub_8098100(0x22) && (param_2 == 0x2E) && (param_1 == 0x17)) {
sub_808B1CC(ITEM_NOTHING);
if (!sub_8098100(0x1d)) {
ItemIdToSlot(&item,ITEM_ROCK_PART,0);
sub_80464C8(GetLeader(),param_3,&item);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
// Something fell from Regirock's body
// Regirock was apparently guarding this item
DisplayDungeonDialogue(&gRegirockPostFightDialogue_1);
}
}
}
void sub_808AEC8(u8 param_1,u8 param_2,DungeonPos *param_3)
{
Entity * leaderEntity;
s16 IDStack[2];
Item item;
leaderEntity = xxx_call_GetLeader();
sub_8052D44(IDStack,leaderEntity,0);
if (!sub_8098100(0x22) && (param_2 == 0x2F) && (param_1 == 0x18)) {
sub_808B1CC(ITEM_NOTHING);
if (!sub_8098100(0x1d)) {
ItemIdToSlot(&item,ITEM_ICE_PART,0);
sub_80464C8(GetLeader(),param_3,&item);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
// Something fell from Regice's body
// Regice was apparently guarding this item
DisplayDungeonDialogue(&gRegicePostFightDialogue_1);
}
}
}
void sub_808AF3C(u8 param_1,u8 param_2,DungeonPos *param_3)
{
Entity * leaderEntity;
s16 IDStack[2];
Item item;
leaderEntity = xxx_call_GetLeader();
sub_8052D44(IDStack,leaderEntity,0);
if (!sub_8098100(0x22) && (param_2 == 0x30) && (param_1 == 0x19)) {
sub_808B1CC(ITEM_NOTHING);
if (!sub_8098100(0x1d)) {
ItemIdToSlot(&item,ITEM_STEEL_PART,0);
sub_80464C8(GetLeader(),param_3, &item);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
// Something fell from Registeel's body
// Registeel was apparently guarding this item
DisplayDungeonDialogue(&gRegisteelPostFightDialogue_1);
}
}
}
void sub_808AFB0(u8 param_1)
{
Entity * leaderEntity;
s16 IDStack [2];
leaderEntity = xxx_call_GetLeader();
sub_8052D44(IDStack,leaderEntity,0);
if (!sub_8098100(0x22) && (param_1 == 0x2E) && (!sub_8098100(0x1d)) && (sub_80860A8(ITEM_ROCK_PART) != 0)) {
sub_8097FD0(0x1d);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],GetLeader(),0);
// {POKEMON_0} obtained the Rock Part that Regirock was guarding
DisplayDungeonDialogue(&gRegirockPostFightDialogue_2);
sub_80421C0(0,0xd4);
sub_803E708(10,70);
sub_8046D20();
}
}
void sub_808B030(u8 param_1)
{
Entity * leaderEntity;
s16 IDStack [2];
leaderEntity = xxx_call_GetLeader();
sub_8052D44(IDStack,leaderEntity,0);
if (!sub_8098100(0x22) && (param_1 == 0x2F) && (!sub_8098100(0x1d)) && (sub_80860A8(ITEM_ICE_PART) != 0)) {
sub_8097FD0(0x1d);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],GetLeader(),0);
// {POKEMON_0} obtained the Ice Part that Regice was guarding
DisplayDungeonDialogue(&gRegicePostFightDialogue_2);
sub_80421C0(0,0xd4);
sub_803E708(10,70);
sub_8046D20();
}
}
void sub_808B0B0(u8 param_1)
{
Entity * leaderEntity;
s16 IDStack [2];
leaderEntity = xxx_call_GetLeader();
sub_8052D44(IDStack,leaderEntity,0);
if (!sub_8098100(0x22) && (param_1 == 0x30) && (!sub_8098100(0x1d)) && (sub_80860A8(ITEM_STEEL_PART) != 0)) {
sub_8097FD0(0x1d);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], GetLeader(), 0);
// {POKEMON_0} obtained the Steel Part that Registeel was guarding
DisplayDungeonDialogue(&gRegisteelPostFightDialogue_2);
sub_80421C0(0,0xd4);
sub_803E708(10,70);
sub_8046D20();
}
}
void RegirockPreFightDialogue(void)
{
if (!sub_8098100(0x22)) {
sub_8085930(DIRECTION_NORTH);
// INTRUDER ALERT
// EXTERMINATE
DisplayDungeonDialogue(&gRegirockPreFightDialogue_1);
sub_803E708(10,70);
sub_808563C(SetupRegirockFightHP);
}
}
void RegicePreFightDialogue(void)
{
if (!sub_8098100(0x22)) {
sub_8085930(DIRECTION_NORTH);
// INTRUDER ALERT
// EXTERMINATE
DisplayDungeonDialogue(&gRegicePreFightDialogue_1);
sub_803E708(10,70);
sub_808563C(SetupRegiceFightHP);
}
}
void RegisteelPreFightDialogue(void)
{
if (!sub_8098100(0x22)) {
sub_8085930(DIRECTION_NORTH);
// INTRUDER ALERT
// EXTERMINATE
DisplayDungeonDialogue(&gRegisteelPreFightDialogue_1);
sub_803E708(10,70);
sub_808563C(SetupRegisteelFightHP);
}
}
static void sub_808B1CC(u8 itemID)
{
Entity *entity;
Tile *tile;
DungeonPos pos;
Item item;
pos.x = gDungeon->unk644.unk40;
pos.y = gDungeon->unk644.unk42;
if ((pos.x < 0) || (pos.y < 0)) {
entity = GetLeader();
if (entity == NULL) {
gDungeon->unk2 = 1;
return;
}
pos.x = entity->pos.x;
pos.y = entity->pos.y;
}
sub_807FE04(&pos, 0);
tile = GetTileMut(pos.x, pos.y);
tile->terrainType = tile->terrainType | TERRAIN_TYPE_STAIRS;
if (((itemID != ITEM_NOTHING) && (sub_80860A8(itemID) == 0)) &&
(sub_80860A8(ITEM_MUSIC_BOX) == 0)) {
ItemIdToSlot(&item,itemID,0);
pos.y--;
AddItemToDungeonAt(&pos,&item,1);
}
sub_8049ED4();
ShowWholeRevealedDungeonMap();
}
static void SetupRegiFacingDirection(Entity *regiEntity)
{
GetEntInfo(regiEntity)->action.direction = DIRECTION_NORTH;
sub_806CE68(regiEntity, DIRECTION_NORTH);
}
static void SetupRegirockFightHP(Entity *r0)
{
SetupBossFightHP(r0, 450, MUS_BOSS_BATTLE);
}
static void SetupRegiceFightHP(Entity *r0)
{
SetupBossFightHP(r0, 450, MUS_BOSS_BATTLE);
}
static void SetupRegisteelFightHP(Entity *r0)
{
SetupBossFightHP(r0, 450, MUS_BOSS_BATTLE);
}

View File

@@ -0,0 +1,215 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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)
{
if ((param_2 == 1 || param_2 == 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;
}
static void SkarmoryEntry(Entity * skarmoryEntity)
{
sub_806CDD4(skarmoryEntity,0xf,DIRECTION_SOUTH);
sub_8086A54(skarmoryEntity);
PlaySoundEffect(0x1f8);
sub_803E708(0x44,0x46);
}

View File

@@ -0,0 +1,154 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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);
void DummyFightDialogue(void)
{
}
void sub_808CBB0(void)
{
Entity *leaderEntity;
Entity *smeargleEntity;
leaderEntity = xxx_call_GetLeader();
smeargleEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SMEARGLE);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
SetFacingDirection(smeargleEntity, DIRECTION_SOUTH);
sub_8085860(leaderEntity->pos.x, leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SMEARGLE);
}
void SmeargleRescueDialogue(void)
{
Entity *smeargleEntity;
s32 counter;
smeargleEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SMEARGLE);
SpriteLookAroundEffect(smeargleEntity);
sub_803E708(0xA, 0x46);
// Ohhh...
// I've lost my bearings
DisplayDungeonDialogue(&gSmeargleRescueDialogue_1);
sub_803E708(0xA, 0x46);
sub_80869E4(smeargleEntity, 4, 2, DIRECTION_NORTH);
sub_803E708(0xA, 0x46);
// I can't get out...
// I'm hungry...
// I'm in trouble
DisplayDungeonDialogue(&gSmeargleRescueDialogue_2);
sub_803E708(0xA, 0x46);
sub_8086448();
sub_8086598();
sub_803E708(0x20, 0x46);
SpriteShockEffect(smeargleEntity);
sub_803E708(0x20, 0x46);
sub_80869E4(smeargleEntity, 4, 2, DIRECTION_SOUTH);
// Oh! You are?
DisplayDungeonDialogue(&gSmeargleRescueDialogue_3);
sub_803E708(0xA, 0x46);
PlaySoundEffect(0x1c7);
sub_806CDD4(smeargleEntity, 0xA, DIRECTION_SOUTH);
sub_803E708(0x14, 0x46);
sub_806CE68(smeargleEntity, DIRECTION_SOUTH);
sub_803E708(0x4, 0x46);
PlaySoundEffect(0x1c7);
sub_806CDD4(smeargleEntity, 0xA, DIRECTION_SOUTH);
sub_803E708(0x14, 0x46);
// Did you maybe come to rescue me?
// Am I glad to see you
DisplayDungeonDialogue(&gSmeargleRescueDialogue_4);
sub_803E708(0xA, 0x46);
sub_806CDD4(smeargleEntity, 0, DIRECTION_SOUTH);
for(counter = 0x17; counter >= 0; counter--)
{
IncreaseEntityPixelPos(smeargleEntity, 0, 0x100);
DungeonRunFrameActions(0x46);
}
sub_806CE68(smeargleEntity, DIRECTION_SOUTH);
sub_803E708(0x20, 0x46);
sub_8042B0C(smeargleEntity);
sub_8068FE0(smeargleEntity, 0x21C, 0);
gDungeon->unk4 = 1;
gDungeon->unk11 = 4;
}
void sub_808CD44(void)
{
Entity *leaderEntity;
Entity *smeargleEntity;
leaderEntity = xxx_call_GetLeader();
smeargleEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SMEARGLE);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
sub_8068FE0(smeargleEntity, 540, 0);
sub_8085860(leaderEntity->pos.x, leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SMEARGLE);
}

View File

@@ -0,0 +1,243 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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_808A528(Entity * param_1);
static void SuicuneScreenFlash(void);
void sub_808A264(void)
{
Entity * leaderEntity;
Entity * SuicuneEntity;
leaderEntity = xxx_call_GetLeader();
SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
sub_80855E4(sub_8086A3C);
SetFacingDirection(SuicuneEntity, DIRECTION_SOUTH);
sub_8086A3C(SuicuneEntity);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y - 3);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SUICUNE);
}
void sub_808A2C0(void)
{
Entity * leaderEntity;
Entity * SuicuneEntity;
leaderEntity = xxx_call_GetLeader();
SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
SetFacingDirection(SuicuneEntity, DIRECTION_SOUTH);
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SUICUNE);
}
void sub_808A308(void)
{
Entity * leaderEntity;
Entity * SuicuneEntity;
leaderEntity = xxx_call_GetLeader();
SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
sub_80854D4();
sub_8085930(DIRECTION_NORTH);
if (HasRecruitedMon(MONSTER_SUICUNE)) {
sub_8068FE0(SuicuneEntity,0x21c,0);
}
else {
SetFacingDirection(SuicuneEntity, DIRECTION_SOUTH);
}
sub_8085860(leaderEntity->pos.x,leaderEntity->pos.y);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_SUICUNE);
}
void sub_808A36C(u8 param_1, u8 param_2)
{
if ((param_2 == 0x26 || param_2 == 0x27 || param_2 == 0x28) && (param_1 == 0x14)) {
sub_8097FA8(0x19);
gDungeon->unk2 = 1;
}
}
void SuicunePreFightDialogue(void)
{
Entity * leaderEntity;
Entity * SuicuneEntity;
leaderEntity = xxx_call_GetLeader();
SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE);
sub_8086448();
DisplayDungeonDialogue(&gSuicunePreFightDialogue_1);
sub_803E708(10,70);
DisplayDungeonDialogue(&gSuicunePreFightDialogue_2);
sub_803E708(10,70);
sub_80426C8(1,2);
sub_803E708(0x3c,70);
DisplayDungeonDialogue(&gSuicunePreFightDialogue_3);
sub_803E708(10,70);
sub_808A528(SuicuneEntity);
DisplayDungeonDialogue(&gSuicunePreFightDialogue_4);
DisplayDungeonDialogue(&gSuicunePreFightDialogue_5);
SuicuneScreenFlash();
DisplayDungeonDialogue(&gSuicunePreFightDialogue_6);
SuicuneScreenFlash();
DisplayDungeonDialogue(&gSuicunePreFightDialogue_7);
sub_803E708(10,70);
SetupBossFightHP(SuicuneEntity,0x28a,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void SuicuneReFightDialogue(void)
{
Entity * leaderEntity;
Entity * SuicuneEntity;
leaderEntity = xxx_call_GetLeader();
SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE);
DisplayDungeonDialogue(&gSuicuneReFightDialogue_1);
SuicuneScreenFlash();
DisplayDungeonDialogue(&gSuicuneReFightDialogue_2);
SuicuneScreenFlash();
DisplayDungeonDialogue(&gSuicuneReFightDialogue_3);
sub_803E708(10,70);
SetupBossFightHP(SuicuneEntity,0x28a,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
void SuicunePostStoryPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * SuicuneEntity;
leaderEntity = xxx_call_GetLeader();
SuicuneEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SUICUNE);
if (HasRecruitedMon(MONSTER_SUICUNE)) {
sub_80866C4(&gSuicunePostStoryPreFightDialogue_4);
}
else {
DisplayDungeonDialogue(&gSuicunePostStoryPreFightDialogue_1);
SuicuneScreenFlash();
DisplayDungeonDialogue(&gSuicunePostStoryPreFightDialogue_2);
SuicuneScreenFlash();
DisplayDungeonDialogue(&gSuicunePostStoryPreFightDialogue_3);
sub_803E708(10,70);
SetupBossFightHP(SuicuneEntity,0x28a,MUS_BOSS_BATTLE);
ShiftCameraToPosition(&leaderEntity->pixelPos,0x10);
}
}
static void sub_808A528(Entity * param_1)
{
s24_8 iVar1;
s24_8 iVar2;
GetEntInfo(param_1)->unk15E = 0;
iVar2 = IntToF248(200);
iVar1 = IntToF248(12);
PlaySoundEffect(0x1f8);
while( 1 ) {
iVar2.raw -= iVar1.raw;
iVar1 = F248_Sub(iVar1, FloatToF248(0.375));
if (F248LessThanFloat(iVar1, 0.08)) {
iVar1 = FloatToF248_2(0.08);
}
if (F248LessThanInt(iVar2, 0)) break;
GetEntInfo(param_1)->unk174 = iVar2;
DungeonRunFrameActions(70);
}
GetEntInfo(param_1)->unk174 = IntToF248_2(0);
}
static void SuicuneScreenFlash(void)
{
s32 iVar1;
PlaySoundEffect(0x1ee);
for(iVar1 = 250; iVar1 > 149; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 > 199; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 10)
{
SetDungeonBGColorRGB(iVar1,iVar1,iVar1,1,1);
DungeonRunFrameActions(70);
}
sub_803E708(10,70);
sub_8085EB0();
}

View File

@@ -0,0 +1,309 @@
#include "global.h"
#include "globaldata.h"
#include "code_800DAC0.h"
#include "code_800E9A8.h"
#include "dungeon_vram.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_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();
}

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,7 @@
#include "code_806CD90.h"
#include "constants/direction.h"
#include "constants/dungeon.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E668.h"
#include "code_8041AD0.h"
#include "code_804267C.h"

View File

@@ -1,7 +1,7 @@
#include "global.h"
#include "globaldata.h"
#include "run_dungeon.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "constants/dungeon.h"
#include "dungeon_ai_leader.h"
#include "dungeon_ai.h"
@@ -11,6 +11,7 @@
#include "structs/str_dungeon.h"
#include "constants/ability.h"
#include "dungeon_logic.h"
#include "menu_input.h"
extern bool8 sub_8044B28(void);
extern void TrySpawnMonsterAndActivatePlusMinus(void);
@@ -32,6 +33,9 @@ extern void sub_807EAA0(u32, u32);
static void sub_8044454(void);
static bool8 xxx_dungeon_80442D0(bool8);
EWRAM_DATA DungeonPos gUnknown_202EE0C = {0};
EWRAM_DATA MenuInputStruct gDungeonMenu = {0};
const s16 gSpeedTurns[NUM_SPEED_COUNTERS][25] = {
[0] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0},
[1] = {0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0, 7, 0, 0, 0, 8, 0, 0, 0, 9, 0},

View File

@@ -4044,12 +4044,6 @@ static void ResetFloor(void)
}
}
struct PositionU8
{
u8 x;
u8 y;
};
/*
* ShuffleSpawnPositions - Randomly shuffle an array of spawn positions
*/
@@ -4083,7 +4077,7 @@ static void ShuffleSpawnPositions(struct PositionU8 *spawns, s32 count)
*/
static void SpawnNonEnemies(FloorProperties *floorProps, bool8 isEmptyMonsterHouse)
{
struct PositionU8 validSpawns[DUNGEON_MAX_SIZE_X * DUNGEON_MAX_SIZE_Y];
struct PositionU8 validSpawns[DUNGEON_MAX_NUM_TILES];
s32 count;
s32 randIndex;
s32 i;
@@ -4419,7 +4413,7 @@ static void SpawnNonEnemies(FloorProperties *floorProps, bool8 isEmptyMonsterHou
*/
static void SpawnEnemies(FloorProperties *floorProps, bool8 isEmptyMonsterHouse)
{
struct PositionU8 validSpawns[DUNGEON_MAX_SIZE_X * DUNGEON_MAX_SIZE_Y];
struct PositionU8 validSpawns[DUNGEON_MAX_NUM_TILES];
s32 count;
s32 randIndex;
s32 i;

View File

@@ -5,7 +5,7 @@
#include "dungeon_message.h"
#include "code_8077274_1.h"
#include "code_807CD9C.h"
#include "code_808417C.h"
#include "dungeon_random.h"
#include "constants/dungeon_action.h"
#include "constants/dungeon.h"
#include "constants/iq_skill.h"

View File

@@ -23,7 +23,7 @@
#include "trap.h"
#include "math.h"
#include "structs/str_item_text.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "sprite.h"
extern SpriteOAM gUnknown_202EDC0;

219
src/dungeon_jobs.c Normal file
View File

@@ -0,0 +1,219 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_jobs.h"
#include "dungeon_strings.h"
#include "dungeon_util.h"
#include "dungeon_message.h"
#include "dungeon_misc.h"
#include "dungeon_logic.h"
#include "dungeon_leader.h"
#include "string_format.h"
#include "code_80958E8.h"
#include "mailbox.h"
#include "pokemon_mid.h"
#include "structs/str_dungeon.h"
#include "constants/dungeon.h"
extern void sub_8042A34(DungeonPos *r0);
extern void sub_804178C(u32);
void sub_80842F0(void)
{
s32 i;
gDungeon->unk644.unk33 = 0;
gDungeon->unk644.unk46 = 0;
if (gDungeon->unk644.unk34 != 2)
return;
for (i = 0; i < MAX_ACCEPTED_JOBS; i++) {
WonderMail *jobSlot = GetJobSlotInfo(i);
if (jobSlot->mailType == MAIL_TYPE_TAKEN_JOB) {
if (gDungeon->unk644.dungeonLocation.id == jobSlot->unk4.dungeon.id
&& gDungeon->unk644.dungeonLocation.floor == jobSlot->unk4.dungeon.floor
&& jobSlot->missionType != 3)
{
if (jobSlot->missionType == 4) {
gDungeon->unk644.unk46 = jobSlot->targetItem;
gDungeon->unk644.unk44 = jobSlot->targetSpecies;
gDungeon->unk9 = 1;
}
else if (jobSlot->missionType == 0 || jobSlot->missionType == 2 || jobSlot->missionType == 1) {
gDungeon->unk644.unk44 = jobSlot->targetSpecies;
if (jobSlot->missionType == 2) {
gDungeon->unk644.unk33 = 1;
}
gDungeon->unk9 = 1;
}
}
}
}
}
void sub_80843BC(s32 id)
{
s32 i;
s32 id_s32 = (s16) id;
for (i = 0; i < MAX_ACCEPTED_JOBS; i++) {
WonderMail *jobSlot = GetJobSlotInfo(i);
if (jobSlot->mailType == MAIL_TYPE_TAKEN_JOB) {
if (gDungeon->unk644.dungeonLocation.id == jobSlot->unk4.dungeon.id
&& (gDungeon->unk644.dungeonLocation.floor == jobSlot->unk4.dungeon.floor)
&& (jobSlot->missionType == 0 || jobSlot->missionType == 4 || jobSlot->missionType == 2 || jobSlot->missionType == 1)
&& id_s32 == jobSlot->targetSpecies) {
jobSlot->mailType = MAIL_TYPE_UNK8;
}
}
}
}
void sub_8084424(void)
{
s32 i;
for (i = 0; i < MAX_ACCEPTED_JOBS; i++) {
WonderMail *jobSlot = GetJobSlotInfo(i);
if (jobSlot->mailType == MAIL_TYPE_UNK8) {
jobSlot->mailType = MAIL_TYPE_UNK9;
}
}
}
void sub_8084448(Entity *pokemon)
{
int i;
const u8 *str;
EntityInfo *entInfo = GetEntInfo(pokemon);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],GetLeader(),0);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[1],pokemon,0);
if (!sub_8070BC0(pokemon)) {
DisplayDungeonMessage(0,gUnknown_80FA464,1);
return;
}
if (gDungeon->unk644.unk46 != 0) {
if (DisplayDungeonYesNoMessage(0, gUnknown_80FA32C, 1) != 1)
return;
BufferItemName(gFormatBuffer_Items[0], gDungeon->unk644.unk46, 0);
for (i = 0; i < INVENTORY_SIZE; i++) {
Item *item = &gTeamInventoryRef->teamItems[i];
if (ItemExists(item)
&& !(item->flags & ITEM_FLAG_IN_SHOP)
&& !(item->flags & ITEM_FLAG_STICKY && (item->flags & ITEM_FLAG_SET))
&& item->id == gDungeon->unk644.unk46)
{
break;
}
}
if (i == INVENTORY_SIZE) {
DisplayDungeonMessage(0, gUnknown_80FA448, 1);
return;
}
ZeroOutItem(&gTeamInventoryRef->teamItems[i]);
FillInventoryGaps();
DisplayDungeonMessage(0, gUnknown_80FA2B0, 1);
str = gUnknown_80FA370;
}
else {
if (DisplayDungeonYesNoMessage(0, gUnknown_80FA2F0, 1) != 1)
return;
DisplayDungeonMessage(0, gUnknown_80FA260, 1);
str = gUnknown_80FA36C;
}
sub_80843BC(entInfo->id);
sub_8042A34(&pokemon->pos);
sub_8068FE0(pokemon,0x21c,0);
sub_804178C(1);
while(1) {
if (DisplayDungeonYesNoMessage(0,str,1) == 1) {
if (DisplayDungeonYesNoMessage(0,gUnknown_80FA394,0) == 1) {
gDungeon->unk4 = 1;
gDungeon->unk11 = 2;
return;
}
}
else if (DisplayDungeonYesNoMessage(0,gUnknown_80FA3B8,0) == 1) {
return;
}
}
}
void sub_80845E0(Entity *pokemon)
{
int i;
EntityInfo *info1 = GetEntInfo(pokemon);
Entity *entity = NULL;
EntityInfo *info2 = NULL;
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],GetLeader(),0);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[1],pokemon,0);
if (!sub_8070BC0(pokemon)) {
DisplayDungeonMessage(0,gUnknown_80FA530,1);
return;
}
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
Entity *teamMon = gDungeon->teamPokemon[i];
if (EntityIsValid(teamMon)) {
if (IsExperienceLocked(GetEntInfo(teamMon)->joinedAt.id)) {
entity = teamMon;
info2 = GetEntInfo(teamMon);
break;
}
}
}
if (entity == NULL) {
DisplayDungeonMessage(0,gUnknown_80FA52C,1);
return;
}
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[2],entity,0);
if (!sub_8070BC0(entity)) {
DisplayDungeonMessage(0,gUnknown_80FA54C,1);
return;
}
if (!CanSeeTarget(pokemon,entity)) {
DisplayDungeonMessage(0,gUnknown_80FA500,1);
return;
}
DisplayDungeonMessage(0,gUnknown_80FA4D4,1);
sub_80843BC(info1->id);
info2->joinedAt.id = gDungeon->unk644.dungeonLocation.id;
sub_8042A34(&pokemon->pos);
sub_8042A34(&entity->pos);
sub_8068FE0(pokemon,0x21c,0);
sub_8068FE0(entity,0x21c,0);
sub_804178C(1);
while(1) {
if (DisplayDungeonYesNoMessage(0,gUnknown_80FA4D8,1) == 1) {
if (DisplayDungeonYesNoMessage(0,gUnknown_80FA394,0) == 1) {
gDungeon->unk4 = 1;
gDungeon->unk11 = 2;
return;
}
}
else if (DisplayDungeonYesNoMessage(0,gUnknown_80FA3B8,0) == 1) {
return;
}
}
}
void sub_8084778(void)
{
s32 i;
WonderMail *wm;
InlineStrcpy(gFormatBuffer_Monsters[3], "??????");
for (i = 0; i < MAX_ACCEPTED_JOBS; i++) {
wm = GetJobSlotInfo(i);
if (wm->mailType == MAIL_TYPE_TAKEN_JOB && gDungeon->unk644.dungeonLocation.id == wm->unk4.dungeon.id && wm->missionType == WONDER_MAIL_MISSION_TYPE_ESCORT_CLIENT) {
CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[3], wm->targetSpecies);
break;
}
}
}

View File

@@ -2,7 +2,7 @@
#include "globaldata.h"
#include "weather.h"
#include "code_804267C.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "dungeon.h"
#include "dungeon_config.h"
#include "dungeon_leader.h"

View File

@@ -1,31 +0,0 @@
#include "global.h"
#include "structs/str_dungeon.h"
#include "dungeon_leader.h"
#include "dungeon_util.h"
EWRAM_INIT Entity *gLeaderPointer = NULL;
Entity* GetLeader(void)
{
Entity *leader = gLeaderPointer;
if (leader == NULL)
{
s32 i;
for (i = 0; i < MAX_TEAM_MEMBERS; i++)
{
Entity *currentPokemon = gDungeon->teamPokemon[i];
if (EntityIsValid(currentPokemon) && GetEntInfo(currentPokemon)->isTeamLeader)
{
gLeaderPointer = currentPokemon;
return currentPokemon;
}
}
return NULL;
}
return leader;
}
EntityInfo* GetLeaderInfo(void)
{
return GetEntInfo(GetLeader());
}

View File

@@ -14,9 +14,9 @@
#include "code_800D090.h"
#include "code_801602C.h"
#include "code_801B3C0.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "code_8044CC8.h"
#include "dungeon_action.h"
#include "code_8066D04.h"
#include "code_806CD90.h"
#include "dungeon_action.h"

View File

@@ -16,7 +16,7 @@
#include "dungeon_music.h"
#include "dungeon_ai_movement.h"
#include "string_format.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "trap.h"
#include "dungeon_map_access.h"
@@ -24,7 +24,7 @@
#include "dungeon_leader.h"
#include "menu_input.h"
#include "text_1.h"
#include "code_8044CC8.h"
#include "dungeon_action.h"
#include "code_801B3C0.h"
extern void PlayDungeonCancelSE(void);

View File

@@ -2,9 +2,9 @@
#include "globaldata.h"
#include "structs/map.h"
#include "structs/str_dungeon.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "code_8044CC8.h"
#include "dungeon_action.h"
#include "dungeon_action.h"
#include "dungeon_leader.h"
#include "dungeon_main.h"

View File

@@ -1,11 +1,12 @@
#include "global.h"
#include "globaldata.h"
#include "code_803D110.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "code_8044CC8.h"
#include "dungeon_action.h"
#include "code_8097DD0.h"
#include "dungeon.h"
#include "dungeon_8083AB0.h"
#include "dungeon_action.h"
#include "dungeon_leader.h"
#include "dungeon_main.h"

View File

@@ -1,7 +1,7 @@
#include "global.h"
#include "globaldata.h"
#include "code_800D090.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "dungeon.h"
#include "dungeon_menu_recruitment.h"

View File

@@ -1,8 +1,8 @@
#include "global.h"
#include "globaldata.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "code_8044CC8.h"
#include "dungeon_action.h"
#include "code_8097DD0.h"
#include "dungeon.h"
#include "dungeon_action.h"

View File

@@ -8,9 +8,9 @@
#include "code_800D090.h"
#include "code_801602C.h"
#include "code_801B3C0.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "code_8044CC8.h"
#include "dungeon_action.h"
#include "code_806CD90.h"
#include "code_8097DD0.h"
#include "dungeon_action.h"

View File

@@ -1,8 +1,8 @@
#include "global.h"
#include "globaldata.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E724.h"
#include "code_8044CC8.h"
#include "dungeon_action.h"
#include "code_8097DD0.h"
#include "dungeon.h"
#include "dungeon_action.h"

View File

@@ -7,7 +7,7 @@
#include "code_8009804.h"
#include "code_800D090.h"
#include "code_800E9E4.h"
#include "code_803E46C.h"
#include "dungeon_vram.h"
#include "code_803E668.h"
#include "code_803E724.h"
#include "dungeon.h"
@@ -27,6 +27,7 @@
#include "text_2.h"
#include "text_3.h"
#include "dungeon_strings.h"
#include "dungeon_portrait_placement.h"
void sub_80526D0(s32 r0);
static bool8 sub_8052DC0(Entity *);
@@ -381,14 +382,6 @@ void DisplayDungeonLoggableMessage(Entity *pokemon, const u8 *str)
DisplayDungeonLoggableMessageFalse(pokemon, str);
}
struct Struct_sub_808CDB0
{
DungeonPos pos;
bool8 flip;
};
extern const struct Struct_sub_808CDB0 *sub_808CDB0(s32 a0);
static const u16 sUnknownDialogueFlags[] = {0x30D, 0x10D, 0x30D, 0x10D, 0x301, 1, 0x11};
void DisplayDungeonDialogue(const struct DungeonDialogueStruct *dialogueInfo)
@@ -465,7 +458,7 @@ void DisplayDungeonDialogue(const struct DungeonDialogueStruct *dialogueInfo)
&& dialogueInfo->spriteId != 0x80
&& dialogueMonId != MONSTER_NONE)
{
const struct Struct_sub_808CDB0 *strPtr = sub_808CDB0(dialogueInfo->spritePlacementId);
const struct PortraitPlacementInfo *placementInfo = GetPortraitPlacementInfo(dialogueInfo->spritePlacementId);
monPortraitPtr = &monPortrait;
monPortraitPtr->faceFile = GetDialogueSpriteDataPtr(dialogueMonId);
@@ -473,9 +466,9 @@ void DisplayDungeonDialogue(const struct DungeonDialogueStruct *dialogueInfo)
monPortraitPtr->faceData = (PortraitGfx *) monPortraitPtr->faceFile->data;
monPortraitPtr->unkE = 0;
monPortraitPtr->spriteId = dialogueInfo->spriteId;
monPortraitPtr->flip = strPtr->flip;
monPortraitPtr->pos.x = strPtr->pos.x;
monPortraitPtr->pos.y = strPtr->pos.y;
monPortraitPtr->flip = placementInfo->flip;
monPortraitPtr->pos.x = placementInfo->pos.x;
monPortraitPtr->pos.y = placementInfo->pos.y;
if (monPortraitPtr->pos.y < 2) {
monPortraitPtr->pos.y = 2;
}

Some files were not shown because too many files have changed in this diff Show More