Merge pull request #383 from DizzyEggg/dungeon_splits
Some checks failed
GithubCI / build (push) Has been cancelled

Split dungeon-related files and move const data to src - part 1
This commit is contained in:
Seth Barberee
2025-04-02 14:20:28 -07:00
committed by GitHub
174 changed files with 25532 additions and 33554 deletions

View File

@@ -1,339 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_8044574
sub_8044574:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x44
bl GetLeader
mov r10, r0
movs r7, 0
mov r0, sp
adds r0, 0x4
str r0, [sp, 0x40]
ldr r1, _08044634
mov r9, r1
_08044592:
mov r2, r9
ldr r0, [r2]
lsls r1, r7, 2
ldr r3, _08044638
adds r0, r3
adds r0, r1
ldr r5, [r0]
adds r0, r5, 0
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080446A4
ldr r6, [r5, 0x70]
mov r8, r6
ldrb r0, [r6, 0x7]
cmp r0, 0
bne _080446A4
bl sub_8044B28
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0
bne _080446AC
mov r1, r9
ldr r0, [r1]
adds r0, 0xB8
str r5, [r0]
bl TriggerWeatherAbilities
movs r2, 0xA2
lsls r2, 1
adds r0, r6, r2
strb r4, [r0]
adds r0, r5, 0
bl CalcSpeedStage
mov r3, r9
ldr r1, [r3]
movs r2, 0xCC
lsls r2, 3
adds r1, r2
movs r3, 0
ldrsh r1, [r1, r3]
lsls r1, 1
movs r2, 0x32
muls r0, r2
adds r1, r0
ldr r0, _0804463C
adds r1, r0
movs r2, 0
ldrsh r0, [r1, r2]
cmp r0, 0
beq _080446A4
movs r3, 0xA4
lsls r3, 1
adds r0, r6, r3
ldrb r0, [r0]
cmp r0, 0
bne _080446A4
ldrh r1, [r6]
movs r2, 0x80
lsls r2, 8
adds r0, r2, 0
ands r0, r1
cmp r0, 0
bne _080446A4
movs r3, 0x80
lsls r3, 7
adds r0, r3, 0
ands r0, r1
lsls r0, 16
lsrs r0, 16
cmp r0, 0
beq _08044644
ldr r2, _08044640
adds r0, r2, 0
ands r0, r1
strh r0, [r6]
b _080446A4
.align 2, 0
_08044634: .4byte gDungeon
_08044638: .4byte 0x0001357c
_0804463C: .4byte gSpeedTurns
_08044640: .4byte 0x0000bfff
_08044644:
ldr r1, _08044668
add r1, r8
strb r0, [r1]
adds r0, r5, 0
bl TickStatusHeal
adds r0, r5, 0
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080446A4
adds r0, r5, 0
bl sub_8071DA4
movs r4, 0
b _0804466E
.align 2, 0
_08044668: .4byte 0x00000145
_0804466C:
adds r4, 0x1
_0804466E:
cmp r4, 0x2
bgt _080446A4
adds r0, r5, 0
movs r1, 0
bl RunMonsterAI
bl sub_8044B28
lsls r0, 24
cmp r0, 0
bne _080446A4
adds r0, r5, 0
bl sub_8072CF4
lsls r0, 24
cmp r0, 0
beq _080446A4
bl sub_8086AC0
movs r0, 0
bl sub_8043ED0
bl sub_8044B28
lsls r0, 24
cmp r0, 0
beq _0804466C
_080446A4:
adds r7, 0x1
cmp r7, 0x3
bgt _080446AC
b _08044592
_080446AC:
movs r0, 0
mov r8, r0
_080446B0:
adds r0, 0x1
mov r9, r0
add r2, sp, 0x8
ldr r1, [sp, 0x40]
mov r0, sp
movs r7, 0x2
_080446BC:
mov r3, r8
str r3, [r0]
str r2, [r1]
adds r2, 0x8
adds r1, 0x8
adds r0, 0x8
subs r7, 0x1
cmp r7, 0
bge _080446BC
str r3, [sp, 0x18]
str r3, [sp, 0x1C]
movs r7, 0
_080446D4:
ldr r0, _08044710
ldr r0, [r0]
lsls r1, r7, 2
ldr r2, _08044714
adds r0, r2
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _08044760
ldr r1, [r4, 0x70]
movs r3, 0xA2
lsls r3, 1
adds r2, r1, r3
ldrb r0, [r2]
cmp r0, 0
beq _08044760
ldrb r0, [r1, 0x7]
cmp r0, 0
beq _08044718
adds r3, 0x1
adds r0, r1, r3
mov r1, r8
strb r1, [r0]
strb r1, [r2]
b _08044760
.align 2, 0
_08044710: .4byte gDungeon
_08044714: .4byte 0x0001357c
_08044718:
mov r2, r10
movs r3, 0x4
ldrsh r1, [r2, r3]
movs r2, 0x4
ldrsh r0, [r4, r2]
subs r2, r1, r0
cmp r2, 0
bge _0804472A
negs r2, r2
_0804472A:
mov r3, r10
movs r0, 0x6
ldrsh r1, [r3, r0]
movs r3, 0x6
ldrsh r0, [r4, r3]
subs r1, r0
cmp r1, 0
bge _0804473C
negs r1, r1
_0804473C:
cmp r1, r2
bge _08044742
adds r1, r2, 0
_08044742:
cmp r1, 0x2
ble _08044748
movs r1, 0x2
_08044748:
add r3, sp, 0x20
lsls r0, r7, 3
adds r3, r0
str r4, [r3]
add r2, sp, 0x24
adds r2, r0
lsls r1, 3
ldr r0, [sp, 0x40]
adds r1, r0, r1
ldr r0, [r1]
str r0, [r2]
str r3, [r1]
_08044760:
adds r7, 0x1
cmp r7, 0x3
ble _080446D4
mov r5, sp
movs r6, 0
_0804476A:
ldr r4, [r5]
cmp r4, 0
beq _080447A0
ldr r1, [r4, 0x70]
ldr r3, _08044814
adds r2, r1, r3
movs r0, 0x1
strb r0, [r2]
movs r2, 0xA2
lsls r2, 1
adds r0, r1, r2
strb r6, [r0]
adds r0, r4, 0
movs r1, 0x1
bl RunMonsterAI
adds r0, r4, 0
bl sub_8072CF4
bl sub_8086AC0
movs r0, 0
bl sub_8043ED0
adds r0, r4, 0
bl EntityIsValid
_080447A0:
ldr r5, [r5, 0x4]
cmp r5, 0
bne _0804476A
mov r0, r9
cmp r0, 0x2
ble _080446B0
bl sub_8044B28
lsls r0, 24
cmp r0, 0
bne _08044802
movs r7, 0
_080447B8:
ldr r0, _08044818
ldr r0, [r0]
lsls r1, r7, 2
ldr r3, _0804481C
adds r0, r3
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080447FC
ldr r0, [r4, 0x70]
movs r1, 0xA2
lsls r1, 1
adds r5, r0, r1
ldrb r0, [r5]
cmp r0, 0
beq _080447FC
adds r0, r4, 0
bl sub_8074094
adds r0, r4, 0
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080447FC
adds r0, r4, 0
bl sub_8071DA4
movs r0, 0
strb r0, [r5]
_080447FC:
adds r7, 0x1
cmp r7, 0x3
ble _080447B8
_08044802:
add sp, 0x44
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08044814: .4byte 0x00000145
_08044818: .4byte gDungeon
_0804481C: .4byte 0x0001357c
thumb_func_end sub_8044574
.align 2, 0

View File

@@ -1,441 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_8072778
sub_8072778:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0xD0
mov r9, r1
lsls r2, 24
lsrs r2, 24
str r2, [sp, 0xC4]
lsls r3, 24
lsrs r3, 24
str r3, [sp, 0xC8]
ldr r0, [r1, 0x70]
mov r8, r0
movs r1, 0
str r1, [sp, 0xCC]
ldrb r0, [r0, 0x6]
cmp r0, 0
beq _080727A8
movs r2, 0
str r2, [sp, 0xC8]
movs r4, 0
str r4, [sp, 0xC4]
_080727A8:
mov r0, r8
movs r2, 0x2
ldrsh r1, [r0, r2]
ldrb r2, [r0, 0x9]
movs r4, 0xC
ldrsh r3, [r0, r4]
mov r0, sp
bl GetMovesLearnedAtLevel
adds r7, r0, 0
add r4, sp, 0x20
movs r1, 0x8C
lsls r1, 1
add r1, r8
adds r0, r4, 0
bl unk_CopyMoves4To8AndClearFlag2Unk4
mov r10, r4
cmp r7, 0
beq _08072810
adds r0, r7, 0
bl DungeonRandInt
movs r2, 0
lsls r0, 1
mov r1, sp
adds r6, r1, r0
mov r5, sp
adds r5, 0x21
mov r3, r10
_080727E4:
lsls r0, r2, 3
add r0, sp
adds r0, 0x20
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
cmp r0, 0
bne _08072806
ldrh r1, [r6]
adds r0, r3, 0
bl InitPokemonMove
ldrb r1, [r5]
movs r0, 0x4
orrs r0, r1
strb r0, [r5]
b _08072810
_08072806:
adds r5, 0x8
adds r3, 0x8
adds r2, 0x1
cmp r2, 0x7
ble _080727E4
_08072810:
movs r5, 0
movs r4, 0x1
_08072814:
movs r7, 0
movs r2, 0
_08072818:
lsls r0, r2, 3
add r0, sp
adds r0, 0x20
ldrb r1, [r0]
adds r0, r4, 0
ands r0, r1
cmp r0, 0
beq _0807282A
adds r7, 0x1
_0807282A:
adds r2, 0x1
cmp r2, 0x7
ble _08072818
cmp r7, 0x4
bgt _080728D4
movs r3, 0
movs r5, 0
cmp r3, r7
bge _0807287C
movs r4, 0x8C
lsls r4, 1
add r4, r8
mov r6, r10
_08072844:
lsls r0, r5, 3
movs r2, 0x8C
lsls r2, 1
add r2, r8
adds r2, r0
ldr r0, [r6]
ldr r1, [r6, 0x4]
str r0, [r2]
str r1, [r2, 0x4]
ldrb r1, [r4, 0x1]
movs r0, 0x4
ands r0, r1
cmp r0, 0
beq _08072872
movs r0, 0xFB
ands r0, r1
strb r0, [r4, 0x1]
add r0, sp, 0x60
adds r1, r4, 0
movs r2, 0
bl BufferMoveName
movs r3, 0x1
_08072872:
adds r4, 0x8
adds r6, 0x8
adds r5, 0x1
cmp r5, r7
blt _08072844
_0807287C:
cmp r5, 0x3
bgt _08072894
movs r2, 0x8C
lsls r2, 1
movs r1, 0
_08072886:
lsls r0, r5, 3
add r0, r8
adds r0, r2
strb r1, [r0]
adds r5, 0x1
cmp r5, 0x3
ble _08072886
_08072894:
cmp r3, 0
beq _08072928
ldr r2, [sp, 0xC4]
cmp r2, 0
beq _08072928
ldr r0, _080728C8
mov r1, r8
movs r2, 0
bl SetMessageArgument_2
ldr r0, _080728CC
add r1, sp, 0x60
bl strcpy
mov r0, r9
movs r1, 0x9C
lsls r1, 1
bl sub_80421C0
ldr r0, _080728D0
ldr r1, [r0]
mov r0, r9
bl DisplayDungeonLoggableMessage
b _08072928
.align 2, 0
_080728C8: .4byte gFormatBuffer_Monsters
_080728CC: .4byte gFormatBuffer_Items
_080728D0: .4byte gUnknown_80F9F04
_080728D4:
mov r1, r8
ldrb r0, [r1, 0x6]
cmp r0, 0
bne _08072918
ldr r2, [sp, 0xC8]
cmp r2, 0
beq _08072918
ldr r0, [sp, 0xCC]
cmp r0, 0
bne _08072902
ldr r1, [sp, 0xC4]
cmp r1, 0
beq _08072902
movs r0, 0xA
movs r1, 0x6
bl sub_803E708
ldr r0, _08072914
ldr r1, [r0]
movs r0, 0
movs r2, 0x1
bl DisplayDungeonMessage
_08072902:
movs r2, 0x1
str r2, [sp, 0xCC]
mov r0, r9
mov r1, r10
movs r3, 0
bl sub_8063E70
b _08072920
.align 2, 0
_08072914: .4byte gUnknown_80F9FA4
_08072918:
mov r0, r9
mov r1, r10
bl sub_8072B24
_08072920:
adds r5, 0x1
cmp r5, 0x1D
bgt _08072928
b _08072814
_08072928:
add sp, 0xD0
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8072778
thumb_func_start sub_8072938
sub_8072938:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0xA4
mov r9, r0
lsls r1, 16
lsrs r5, r1, 16
ldr r0, [r0, 0x70]
mov r8, r0
movs r1, 0
mov r10, r1
movs r1, 0x8C
lsls r1, 1
add r1, r8
mov r0, sp
bl unk_CopyMoves4To8AndClearFlag2Unk4
movs r3, 0
mov r4, sp
mov r2, sp
_08072964:
ldrb r1, [r4]
movs r0, 0x1
ands r0, r1
cmp r0, 0
bne _08072980
adds r0, r2, 0
adds r1, r5, 0
bl InitPokemonMove
ldrb r1, [r4, 0x1]
movs r0, 0x4
orrs r0, r1
strb r0, [r4, 0x1]
b _0807298A
_08072980:
adds r4, 0x8
adds r2, 0x8
adds r3, 0x1
cmp r3, 0x7
ble _08072964
_0807298A:
movs r4, 0
movs r5, 0x1
_0807298E:
movs r7, 0
mov r2, sp
movs r3, 0x7
_08072994:
ldrb r1, [r2]
adds r0, r5, 0
ands r0, r1
cmp r0, 0
beq _080729A0
adds r7, 0x1
_080729A0:
adds r2, 0x8
subs r3, 0x1
cmp r3, 0
bge _08072994
cmp r7, 0x4
bgt _08072A50
movs r5, 0
cmp r5, r7
bge _080729F4
movs r4, 0x8C
lsls r4, 1
add r4, r8
mov r6, sp
_080729BA:
lsls r0, r5, 3
movs r2, 0x8C
lsls r2, 1
add r2, r8
adds r2, r0
ldr r0, [r6]
ldr r1, [r6, 0x4]
str r0, [r2]
str r1, [r2, 0x4]
ldrb r1, [r4, 0x1]
movs r0, 0x4
ands r0, r1
cmp r0, 0
beq _080729EA
movs r0, 0xFB
ands r0, r1
strb r0, [r4, 0x1]
add r0, sp, 0x40
adds r1, r4, 0
movs r2, 0
bl BufferMoveName
movs r0, 0x1
mov r10, r0
_080729EA:
adds r4, 0x8
adds r6, 0x8
adds r5, 0x1
cmp r5, r7
blt _080729BA
_080729F4:
cmp r5, 0x3
bgt _08072A0C
movs r2, 0x8C
lsls r2, 1
movs r1, 0
_080729FE:
lsls r0, r5, 3
add r0, r8
adds r0, r2
strb r1, [r0]
adds r5, 0x1
cmp r5, 0x3
ble _080729FE
_08072A0C:
mov r1, r10
cmp r1, 0
beq _08072A92
mov r1, r8
ldrb r0, [r1, 0x6]
cmp r0, 0
bne _08072A8C
ldr r0, _08072A44
mov r1, r9
movs r2, 0
bl SubstitutePlaceholderStringTags
ldr r0, _08072A48
add r1, sp, 0x40
bl strcpy
mov r0, r9
movs r1, 0x9C
lsls r1, 1
bl sub_80421C0
ldr r0, _08072A4C
ldr r1, [r0]
mov r0, r9
bl DisplayDungeonLoggableMessage
b _08072A8C
.align 2, 0
_08072A44: .4byte gFormatBuffer_Monsters
_08072A48: .4byte gFormatBuffer_Items
_08072A4C: .4byte gUnknown_80F9F04
_08072A50:
movs r0, 0
mov r10, r0
mov r1, r8
ldrb r0, [r1, 0x6]
cmp r0, 0
bne _08072A84
ldr r0, _08072A80
ldr r1, [r0]
movs r0, 0
movs r2, 0x1
bl DisplayDungeonMessage
mov r0, r9
mov r1, sp
movs r2, 0x1
movs r3, 0x1
bl sub_8063E70
lsls r0, 24
cmp r0, 0
bne _08072A84
movs r0, 0
b _08072AB0
.align 2, 0
_08072A80: .4byte gUnknown_80FDF40
_08072A84:
adds r4, 0x1
cmp r4, 0x1D
bgt _08072A8C
b _0807298E
_08072A8C:
mov r0, r10
cmp r0, 0
bne _08072AAE
_08072A92:
mov r1, r8
ldrb r0, [r1, 0x6]
cmp r0, 0
bne _08072AAE
ldr r0, _08072AC0
mov r1, r9
movs r2, 0
bl SubstitutePlaceholderStringTags
ldr r0, _08072AC4
ldr r1, [r0]
mov r0, r9
bl DisplayDungeonLoggableMessage
_08072AAE:
movs r0, 0x1
_08072AB0:
add sp, 0xA4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
.align 2, 0
_08072AC0: .4byte gFormatBuffer_Monsters
_08072AC4: .4byte gUnknown_80F9F2C
thumb_func_end sub_8072938
.align 2, 0

View File

@@ -529,7 +529,11 @@ UNK_MACRO_3E = 23 3E @ #> (Seems to be an alignment operator)
EXTRA_MSG = 23 50 @ #P
WAIT_PRESS = 23 57 @ #W
NEW_LINE = 23 6E @ #n
UNK_MACRO_5F_1 = 23 5F 01 2E @ #_. (related to gUnknown_202749A)
UNK_MACRO_5F_2 = 23 5F 02 2E
UNK_MACRO_5F_3 = 23 5F 03 2E
UNK_MACRO_5F_4 = 23 5F 04 2E
UNK_MACRO_5F_5 = 23 5F 05 2E
@ COLOR FORMATTING MACROS
@

View File

@@ -1,112 +0,0 @@
.section .rodata
.global gUnknown_80F4468
gUnknown_80F4468: @ 80F4468
@ Position[76]
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00
.byte 0x01, 0x00, 0x01, 0x00, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0xfe, 0xff, 0x02, 0x00, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0xff, 0xff
.byte 0xfe, 0xff, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0xfe, 0xff, 0x02, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00
.byte 0x02, 0x00, 0x02, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
.byte 0xff, 0xff, 0x01, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xff
.byte 0xff, 0xff, 0x02, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x01, 0x00, 0xfd, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xff, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x02, 0x00
.byte 0x02, 0x00, 0xff, 0xff, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0x02, 0x00, 0xfd, 0xff, 0xff, 0xff
.byte 0xfd, 0xff, 0x01, 0x00, 0x01, 0x00, 0xfd, 0xff, 0x01, 0x00, 0x03, 0x00, 0x02, 0x00, 0xfe, 0xff, 0x02, 0x00, 0x02, 0x00, 0x03, 0x00, 0xff, 0xff, 0x03, 0x00, 0x01, 0x00, 0xfe, 0xff, 0xfd, 0xff
.byte 0xfe, 0xff, 0x03, 0x00, 0xfd, 0xff, 0xfe, 0xff, 0xfd, 0xff, 0x02, 0x00, 0x02, 0x00, 0xfd, 0xff, 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, 0xfe, 0xff, 0x03, 0x00, 0x02, 0x00, 0xfd, 0xff, 0xfd, 0xff
.byte 0xfd, 0xff, 0x03, 0x00, 0x03, 0x00, 0xfd, 0xff, 0x03, 0x00, 0x03, 0x00, 0x63, 0x00, 0x63, 0x00
.global gUnknown_80F4598
gUnknown_80F4598: @ 80F4598
@ Position[158]
.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xfe, 0xff, 0x00, 0x00
.byte 0x00, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0xff, 0xff, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0xfe, 0xff, 0xff, 0xff
.byte 0xfe, 0xff, 0x01, 0x00, 0xfd, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xff, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0xff, 0xff, 0x02, 0x00, 0x01, 0x00
.byte 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0x03, 0x00, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0x02, 0x00, 0xfd, 0xff, 0xff, 0xff, 0xfd, 0xff, 0x01, 0x00, 0x01, 0x00, 0xfd, 0xff
.byte 0x01, 0x00, 0x03, 0x00, 0x02, 0x00, 0xfe, 0xff, 0x02, 0x00, 0x02, 0x00, 0x03, 0x00, 0xff, 0xff, 0x03, 0x00, 0x01, 0x00, 0xfe, 0xff, 0xfd, 0xff, 0xfe, 0xff, 0x03, 0x00, 0xfd, 0xff, 0xfe, 0xff
.byte 0xfd, 0xff, 0x02, 0x00, 0x02, 0x00, 0xfd, 0xff, 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, 0xfe, 0xff, 0x03, 0x00, 0x02, 0x00, 0xfd, 0xff, 0xfd, 0xff, 0xfd, 0xff, 0x03, 0x00, 0x03, 0x00, 0xfd, 0xff
.byte 0x03, 0x00, 0x03, 0x00, 0xfc, 0xff, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, 0x04, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0xff, 0xff, 0xfc, 0xff
.byte 0xff, 0xff, 0x04, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0xff, 0xff, 0x01, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x04, 0x00, 0xfc, 0xff, 0x02, 0x00, 0x04, 0x00, 0x02, 0x00, 0xfe, 0xff, 0xfc, 0xff
.byte 0xfe, 0xff, 0x04, 0x00, 0xfc, 0xff, 0xfe, 0xff, 0x04, 0x00, 0xfe, 0xff, 0x02, 0x00, 0xfc, 0xff, 0x02, 0x00, 0x04, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x04, 0x00, 0x03, 0x00, 0xfd, 0xff, 0xfc, 0xff
.byte 0xfd, 0xff, 0x04, 0x00, 0xfc, 0xff, 0xfd, 0xff, 0x04, 0x00, 0xfd, 0xff, 0x03, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x04, 0x00, 0xfc, 0xff, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0xfc, 0xff, 0xfc, 0xff
.byte 0xfc, 0xff, 0x04, 0x00, 0xfb, 0xff, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb, 0xff, 0x00, 0x00, 0x05, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x05, 0x00, 0xff, 0xff, 0xff, 0xff, 0xfb, 0xff
.byte 0xff, 0xff, 0x05, 0x00, 0xfb, 0xff, 0x01, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0xfb, 0xff, 0x01, 0x00, 0x05, 0x00, 0xfb, 0xff, 0xfe, 0xff, 0x05, 0x00, 0xfe, 0xff, 0xfe, 0xff, 0xfb, 0xff
.byte 0xfe, 0xff, 0x05, 0x00, 0xfb, 0xff, 0x02, 0x00, 0x05, 0x00, 0x02, 0x00, 0x02, 0x00, 0xfb, 0xff, 0x02, 0x00, 0x05, 0x00, 0xfb, 0xff, 0xfd, 0xff, 0x05, 0x00, 0xfd, 0xff, 0xfd, 0xff, 0xfb, 0xff
.byte 0xfd, 0xff, 0x05, 0x00, 0xfb, 0xff, 0x03, 0x00, 0x05, 0x00, 0x03, 0x00, 0x03, 0x00, 0xfb, 0xff, 0x03, 0x00, 0x05, 0x00, 0xfb, 0xff, 0xfc, 0xff, 0x05, 0x00, 0xfc, 0xff, 0xfc, 0xff, 0xfb, 0xff
.byte 0xfc, 0xff, 0x05, 0x00, 0xfb, 0xff, 0x04, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0xfb, 0xff, 0x04, 0x00, 0x05, 0x00, 0xfb, 0xff, 0xfb, 0xff, 0x05, 0x00, 0xfb, 0xff, 0xfb, 0xff, 0xfb, 0xff
.byte 0xfb, 0xff, 0x05, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff
.byte 0xff, 0xff, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0xfe, 0xff, 0x02, 0x00, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff
.byte 0x02, 0x00, 0xff, 0xff, 0xfe, 0xff, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0xfe, 0xff, 0x02, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00
.byte 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00
.byte 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x63, 0x00, 0x63, 0x00
.global gUnknown_80F4810
gUnknown_80F4810:
@ Position[99]
.byte 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00
.byte 0x01, 0x00, 0x02, 0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x03, 0x00, 0xff, 0xff, 0x03, 0x00, 0x02, 0x00, 0x03, 0x00, 0xfe, 0xff, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00
.byte 0x01, 0x00, 0x04, 0x00, 0xff, 0xff, 0x04, 0x00, 0x02, 0x00, 0x04, 0x00, 0xfe, 0xff, 0x04, 0x00, 0x03, 0x00, 0x04, 0x00, 0xfd, 0xff, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x05, 0x00
.byte 0xff, 0xff, 0x05, 0x00, 0x02, 0x00, 0x05, 0x00, 0xfe, 0xff, 0x05, 0x00, 0x03, 0x00, 0x05, 0x00, 0xfd, 0xff, 0x05, 0x00, 0x04, 0x00, 0x05, 0x00, 0xfc, 0xff, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00
.byte 0x01, 0x00, 0x06, 0x00, 0xff, 0xff, 0x06, 0x00, 0x02, 0x00, 0x06, 0x00, 0xfe, 0xff, 0x06, 0x00, 0x03, 0x00, 0x06, 0x00, 0xfd, 0xff, 0x06, 0x00, 0x04, 0x00, 0x06, 0x00, 0xfc, 0xff, 0x06, 0x00
.byte 0x05, 0x00, 0x06, 0x00, 0xfb, 0xff, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x00, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0x02, 0x00, 0x07, 0x00, 0xfe, 0xff, 0x07, 0x00, 0x03, 0x00, 0x07, 0x00
.byte 0xfd, 0xff, 0x07, 0x00, 0x04, 0x00, 0x07, 0x00, 0xfc, 0xff, 0x07, 0x00, 0x05, 0x00, 0x07, 0x00, 0xfb, 0xff, 0x07, 0x00, 0x06, 0x00, 0x07, 0x00, 0xfa, 0xff, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00
.byte 0x01, 0x00, 0x08, 0x00, 0xff, 0xff, 0x08, 0x00, 0x02, 0x00, 0x08, 0x00, 0xfe, 0xff, 0x08, 0x00, 0x03, 0x00, 0x08, 0x00, 0xfd, 0xff, 0x08, 0x00, 0x04, 0x00, 0x08, 0x00, 0xfc, 0xff, 0x08, 0x00
.byte 0x05, 0x00, 0x08, 0x00, 0xfb, 0xff, 0x08, 0x00, 0x06, 0x00, 0x08, 0x00, 0xfa, 0xff, 0x08, 0x00, 0x07, 0x00, 0x08, 0x00, 0xf9, 0xff, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x01, 0x00, 0x09, 0x00
.byte 0xff, 0xff, 0x09, 0x00, 0x02, 0x00, 0x09, 0x00, 0xfe, 0xff, 0x09, 0x00, 0x03, 0x00, 0x09, 0x00, 0xfd, 0xff, 0x09, 0x00, 0x04, 0x00, 0x09, 0x00, 0xfc, 0xff, 0x09, 0x00, 0x05, 0x00, 0x09, 0x00
.byte 0xfb, 0xff, 0x09, 0x00, 0x06, 0x00, 0x09, 0x00, 0xfa, 0xff, 0x09, 0x00, 0x07, 0x00, 0x09, 0x00, 0xf9, 0xff, 0x09, 0x00, 0x08, 0x00, 0x09, 0x00, 0xf8, 0xff, 0x09, 0x00, 0x00, 0x00, 0x0a, 0x00
.byte 0x01, 0x00, 0x0a, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x02, 0x00, 0x0a, 0x00, 0xfe, 0xff, 0x0a, 0x00, 0x03, 0x00, 0x0a, 0x00, 0xfd, 0xff, 0x0a, 0x00, 0x04, 0x00, 0x0a, 0x00, 0xfc, 0xff, 0x0a, 0x00
.byte 0x05, 0x00, 0x0a, 0x00, 0xfb, 0xff, 0x0a, 0x00, 0x06, 0x00, 0x0a, 0x00, 0xfa, 0xff, 0x0a, 0x00, 0x07, 0x00, 0x0a, 0x00, 0xf9, 0xff, 0x0a, 0x00, 0x08, 0x00, 0x0a, 0x00, 0xf8, 0xff, 0x0a, 0x00
.byte 0x63, 0x00, 0x63, 0x00
.global gUnknown_80F499C
gUnknown_80F499C:
@ Position[101]
.byte 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0xff, 0xff, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0xff, 0xff, 0x03, 0x00, 0x01, 0x00
.byte 0x03, 0x00, 0xfe, 0xff, 0x03, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0xff, 0xff, 0x04, 0x00, 0x01, 0x00, 0x04, 0x00, 0xfe, 0xff, 0x04, 0x00, 0x02, 0x00, 0x04, 0x00, 0xfd, 0xff
.byte 0x04, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0xff, 0xff, 0x05, 0x00, 0x01, 0x00, 0x05, 0x00, 0xfe, 0xff, 0x05, 0x00, 0x02, 0x00, 0x05, 0x00, 0xfd, 0xff, 0x05, 0x00, 0x03, 0x00
.byte 0x05, 0x00, 0xfc, 0xff, 0x05, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0xff, 0xff, 0x06, 0x00, 0x01, 0x00, 0x06, 0x00, 0xfe, 0xff, 0x06, 0x00, 0x02, 0x00, 0x06, 0x00, 0xfd, 0xff
.byte 0x06, 0x00, 0x03, 0x00, 0x06, 0x00, 0xfc, 0xff, 0x06, 0x00, 0x04, 0x00, 0x06, 0x00, 0xfb, 0xff, 0x06, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0xff, 0xff, 0x07, 0x00, 0x01, 0x00
.byte 0x07, 0x00, 0xfe, 0xff, 0x07, 0x00, 0x02, 0x00, 0x07, 0x00, 0xfd, 0xff, 0x07, 0x00, 0x03, 0x00, 0x07, 0x00, 0xfc, 0xff, 0x07, 0x00, 0x04, 0x00, 0x07, 0x00, 0xfb, 0xff, 0x07, 0x00, 0x05, 0x00
.byte 0x07, 0x00, 0xfa, 0xff, 0x07, 0x00, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0xff, 0xff, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0xfe, 0xff, 0x08, 0x00, 0x02, 0x00, 0x08, 0x00, 0xfd, 0xff
.byte 0x08, 0x00, 0x03, 0x00, 0x08, 0x00, 0xfc, 0xff, 0x08, 0x00, 0x04, 0x00, 0x08, 0x00, 0xfb, 0xff, 0x08, 0x00, 0x05, 0x00, 0x08, 0x00, 0xfa, 0xff, 0x08, 0x00, 0x06, 0x00, 0x08, 0x00, 0xf9, 0xff
.byte 0x08, 0x00, 0x07, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0xff, 0xff, 0x09, 0x00, 0x01, 0x00, 0x09, 0x00, 0xfe, 0xff, 0x09, 0x00, 0x02, 0x00, 0x09, 0x00, 0xfd, 0xff, 0x09, 0x00, 0x03, 0x00
.byte 0x09, 0x00, 0xfc, 0xff, 0x09, 0x00, 0x04, 0x00, 0x09, 0x00, 0xfb, 0xff, 0x09, 0x00, 0x05, 0x00, 0x09, 0x00, 0xfa, 0xff, 0x09, 0x00, 0x06, 0x00, 0x09, 0x00, 0xf9, 0xff, 0x09, 0x00, 0x07, 0x00
.byte 0x09, 0x00, 0xf8, 0xff, 0x09, 0x00, 0x08, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0xff, 0xff, 0x0a, 0x00, 0x01, 0x00, 0x0a, 0x00, 0xfe, 0xff, 0x0a, 0x00, 0x02, 0x00, 0x0a, 0x00, 0xfd, 0xff
.byte 0x0a, 0x00, 0x03, 0x00, 0x0a, 0x00, 0xfc, 0xff, 0x0a, 0x00, 0x04, 0x00, 0x0a, 0x00, 0xfb, 0xff, 0x0a, 0x00, 0x05, 0x00, 0x0a, 0x00, 0xfa, 0xff, 0x0a, 0x00, 0x06, 0x00, 0x0a, 0x00, 0xf9, 0xff
.byte 0x0a, 0x00, 0x07, 0x00, 0x0a, 0x00, 0xf8, 0xff, 0x0a, 0x00, 0x08, 0x00, 0x0a, 0x00, 0xf7, 0xff, 0x0a, 0x00, 0x09, 0x00, 0x63, 0x00, 0x63, 0x00
.global gUnknown_80F4B30
gUnknown_80F4B30:
@ Position[101]
.byte 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00
.byte 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x02, 0x00, 0x03, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00
.byte 0x04, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x05, 0x00, 0x05, 0x00, 0x05, 0x00, 0x04, 0x00
.byte 0x04, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x05, 0x00, 0x02, 0x00, 0x02, 0x00, 0x05, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x05, 0x00, 0x06, 0x00, 0x06, 0x00
.byte 0x06, 0x00, 0x05, 0x00, 0x05, 0x00, 0x06, 0x00, 0x06, 0x00, 0x04, 0x00, 0x04, 0x00, 0x06, 0x00, 0x06, 0x00, 0x03, 0x00, 0x03, 0x00, 0x06, 0x00, 0x06, 0x00, 0x02, 0x00, 0x02, 0x00, 0x06, 0x00
.byte 0x06, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00, 0x07, 0x00, 0x07, 0x00, 0x07, 0x00, 0x06, 0x00, 0x06, 0x00, 0x07, 0x00, 0x07, 0x00, 0x05, 0x00, 0x05, 0x00, 0x07, 0x00, 0x07, 0x00, 0x04, 0x00
.byte 0x04, 0x00, 0x07, 0x00, 0x07, 0x00, 0x03, 0x00, 0x03, 0x00, 0x07, 0x00, 0x07, 0x00, 0x02, 0x00, 0x02, 0x00, 0x07, 0x00, 0x07, 0x00, 0x01, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00
.byte 0x08, 0x00, 0x07, 0x00, 0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x06, 0x00, 0x06, 0x00, 0x08, 0x00, 0x08, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x00, 0x08, 0x00, 0x04, 0x00, 0x04, 0x00, 0x08, 0x00
.byte 0x08, 0x00, 0x03, 0x00, 0x03, 0x00, 0x08, 0x00, 0x08, 0x00, 0x02, 0x00, 0x02, 0x00, 0x08, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x08, 0x00
.byte 0x08, 0x00, 0x09, 0x00, 0x09, 0x00, 0x07, 0x00, 0x07, 0x00, 0x09, 0x00, 0x09, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x09, 0x00, 0x05, 0x00, 0x05, 0x00, 0x09, 0x00, 0x09, 0x00, 0x04, 0x00
.byte 0x04, 0x00, 0x09, 0x00, 0x09, 0x00, 0x03, 0x00, 0x03, 0x00, 0x09, 0x00, 0x09, 0x00, 0x02, 0x00, 0x02, 0x00, 0x09, 0x00, 0x09, 0x00, 0x01, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x0a, 0x00
.byte 0x0a, 0x00, 0x09, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x08, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x07, 0x00, 0x07, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0a, 0x00
.byte 0x0a, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x03, 0x00, 0x03, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x02, 0x00, 0x0a, 0x00
.byte 0x0a, 0x00, 0x01, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x63, 0x00, 0x63, 0x00
.global gUnknown_80F4CC4
gUnknown_80F4CC4: @ 80F4CC4
@ replacing .incbin "baserom.gba", 0x000f4cc4, 0x40
.4byte gUnknown_80F4810
.byte 0x01, 0x00, 0x01, 0x00
.4byte gUnknown_80F4B30
.byte 0x01, 0x00, 0x01, 0x00
.4byte gUnknown_80F499C
.byte 0x01, 0x00, 0x01, 0x00
.4byte gUnknown_80F4B30
.byte 0x01, 0x00, 0xff, 0xff
.4byte gUnknown_80F4810
.byte 0xff, 0xff, 0xff, 0xff
.4byte gUnknown_80F4B30
.byte 0xff, 0xff, 0xff, 0xff
.4byte gUnknown_80F499C
.byte 0xff, 0xff, 0xff, 0xff
.4byte gUnknown_80F4B30
.byte 0xff, 0xff, 0x01, 0x00

View File

@@ -1,14 +1,6 @@
.section .rodata
.global gUnknown_80F4D44
gUnknown_80F4D44: @ 80F4D44
@ replacing .incbin "baserom.gba", 0x000f4d44, 0x20
.byte 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01
.global gUnknown_80F4D64
gUnknown_80F4D64: @ 80F4D64
@ replacing .incbin "baserom.gba", 0x000f4d64, 0x28
.byte 0x02, 0x06, 0x04, 0x00, 0x02, 0x00, 0x04, 0x06, 0x04, 0x00, 0x06, 0x02, 0x04, 0x02, 0x06, 0x00, 0x06, 0x02, 0x00, 0x04, 0x06, 0x04, 0x02, 0x00, 0x00, 0x04, 0x02, 0x06, 0x00, 0x06, 0x02, 0x04
.align 2,0
.string "pksdir0\0"
.align 2,0

File diff suppressed because it is too large Load Diff

View File

@@ -3,44 +3,13 @@
#.incbin "baserom.gba", 0xF59C4, 0x4
.align 2
.global gUnknown_80F5F70
gUnknown_80F5F70: @ 80F5F70
@ replacing .incbin "baserom.gba", 0xF5F70, 0x3C
.byte 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x0c, 0x00, 0x0c, 0x00
.byte 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00
.byte 0x0d, 0x00, 0x0d, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00
.byte 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x0c, 0x00, 0x00, 0x00
.global gUnknown_80F5FAC
gUnknown_80F5FAC: @ 80F5FAC
@ replacing .incbin "baserom.gba", 0xF5FAC, 0x130
.byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
.byte 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.global gUnknown_80F60DC
gUnknown_80F60DC: @ 80F60DC
@ replacing .incbin "baserom.gba", 0xF60DC, 0x1C
.byte 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
.byte 0x04, 0x00, 0x00, 0x00, 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00
.global PKSDIRCHECK
PKSDIRCHECK:
.string "pksdir0\0"
.align 2
.global gUnknown_80F60F8
gUnknown_80F60F8: @ 80F60F8
@ replacing .incbin "baserom.gba", 0x000f60f8, 0x8

View File

@@ -1,211 +0,0 @@
#include "constants/status.h"
.section .rodata
#.incbin "baserom.gba", 0xF59C4, 0x4
.string "pksdir0\0"
.string "pksdir0\0"
.global gUnknown_80F6624
gUnknown_80F6624: @ 80F6624
@ replacing .incbin "baserom.gba", 0xF6624, 0x78
.byte 0x78, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x79, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x7b, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7c, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
.byte 0x7d, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0xb9, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xba, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
.byte 0xbb, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
.global gStatusSpriteMasks_SleepClassStatus
gStatusSpriteMasks_SleepClassStatus: @ 80F669C
.4byte 0 @ STATUS_NONE
.4byte STATUS_SPRITE_SLEEP @ STATUS_SLEEP
.4byte STATUS_SPRITE_SLEEPLESS @ STATUS_SLEEPLESS
.4byte STATUS_SPRITE_SLEEP @ STATUS_NIGHTMARE
.4byte 0 @ STATUS_YAWNING
.4byte STATUS_SPRITE_SLEEP @ STATUS_NAPPING
.global gStatusSpriteMasks_BurnClassStatus
gStatusSpriteMasks_BurnClassStatus: @ 80F66B4
.4byte 0 @ STATUS_NONE
.4byte STATUS_SPRITE_BURNED @ STATUS_BURN
.4byte STATUS_SPRITE_POISONED @ STATUS_POISONED
.4byte STATUS_SPRITE_BADLY_POISONED @ STATUS_BADLY_POISONED
.4byte 0 @ STATUS_PARALYSIS
.global gStatusSpriteMasks_FrozenClassStatus
gStatusSpriteMasks_FrozenClassStatus: @ 80F66C8
.4byte 0 @ STATUS_NONE
.4byte STATUS_SPRITE_FROZEN @ STATUS_FROZEN
.4byte 0 @ STATUS_SHADOW_HOLD
.4byte 0 @ STATUS_WRAP
.4byte 0 @ STATUS_WRAPPED
.4byte 0 @ STATUS_INGRAIN
.4byte 0 @ STATUS_PETRIFIED
.4byte 0 @ STATUS_CONSTRICTION
.global gStatusSpriteMasks_CringeClassStatus
gStatusSpriteMasks_CringeClassStatus: @ 80F66E8
.4byte 0 @ STATUS_NONE
.4byte 0 @ STATUS_CRINGE
.4byte STATUS_SPRITE_CONFUSED @ STATUS_CONFUSED
.4byte 0 @ STATUS_PAUSED
.4byte STATUS_SPRITE_COWERING @ STATUS_COWERING
.4byte STATUS_SPRITE_TAUNTED @ STATUS_TAUNTED
.4byte STATUS_SPRITE_ENCORE @ STATUS_ENCORE
.4byte 0 @ STATUS_INFATUATED
.global gStatusSpriteMasks_BideClassStatus
gStatusSpriteMasks_BideClassStatus: @ 80F6708
.4byte 0 @ STATUS_NONE
.4byte 0 @ STATUS_BIDE
.4byte 0 @ STATUS_SOLARBEAM
.4byte 0 @ STATUS_SKY_ATTACK
.4byte 0 @ STATUS_RAZOR_WIND
.4byte 0 @ STATUS_FOCUS_PUNCH
.4byte 0 @ STATUS_SKULL_BASH
.4byte 0 @ STATUS_FLYING
.4byte 0 @ STATUS_BOUNCING
.4byte 0 @ STATUS_DIVING
.4byte 0 @ STATUS_DIGGING
.4byte 0 @ STATUS_CHARGING
.4byte 0 @ STATUS_ENRAGED
.global gStatusSpriteMasks_ReflectClassStatus
gStatusSpriteMasks_ReflectClassStatus: @ 80F673C
.4byte 0 @ STATUS_NONE
.4byte STATUS_SPRITE_SHIELD_BLUE @ STATUS_REFLECT
.4byte STATUS_SPRITE_SHIELD_RED @ STATUS_SAFEGUARD
.4byte STATUS_SPRITE_SHIELD_YELLOW @ STATUS_LIGHT_SCREEN
.4byte STATUS_SPRITE_SHIELD_BLUE @ STATUS_COUNTER
.4byte STATUS_SPRITE_SHIELD_YELLOW @ STATUS_MAGIC_COAT
.4byte 0 @ STATUS_WISH
.4byte STATUS_SPRITE_SHIELD_GREEN @ STATUS_PROTECT
.4byte STATUS_SPRITE_SHIELD_RED @ STATUS_MIRROR_COAT
.4byte STATUS_SPRITE_ENDURE @ STATUS_ENDURING
.4byte STATUS_SPRITE_SHIELD_BLUE @ STATUS_MINI_COUNTER
.4byte STATUS_SPRITE_SHIELD_GREEN @ STATUS_MIRROR_MOVE
.4byte 0 @ STATUS_CONVERSION2
.4byte STATUS_SPRITE_SHIELD_GREEN @ STATUS_VITAL_THROW
.4byte STATUS_SPRITE_SHIELD_BLUE @ STATUS_MIST
.global gStatusSpriteMasks_CurseClassStatus
gStatusSpriteMasks_CurseClassStatus: @ 80F6778
.4byte 0 @ STATUS_NONE
.4byte STATUS_SPRITE_CURSED @ STATUS_CURSED
.4byte 0 @ STATUS_DECOY
.4byte STATUS_SPRITE_SNATCH @ STATUS_SNATCH
.global gStatusSpriteMasks_LeechSeedClassStatus
gStatusSpriteMasks_LeechSeedClassStatus: @ 80F6788
.4byte 0 @ STATUS_NONE
.4byte 0 @ STATUS_LEECH_SEED
.4byte 0 @ STATUS_DESTINY_BOND
.global gStatusSpriteMasks_SureShotClassStatus
gStatusSpriteMasks_SureShotClassStatus: @ 80F6794
.4byte 0 @ STATUS_NONE
.4byte STATUS_SPRITE_SURE_SHOT @ STATUS_SURE_SHOT
.4byte STATUS_SPRITE_WHIFFER @ STATUS_WHIFFER
.4byte STATUS_SPRITE_SET_DAMAGE @ STATUS_SET_DAMAGE
.4byte STATUS_SPRITE_FOCUS_ENERGY @ STATUS_FOCUS_ENERGY
.global gStatusSpriteMasks_LongTossClassStatus
gStatusSpriteMasks_LongTossClassStatus: @ 80F67A8
.4byte 0 @ STATUS_NONE
.4byte 0 @ STATUS_LONG_TOSS
.4byte 0 @ STATUS_PIERCE
.global gStatusSpriteMasks_InvisibleClassStatus
gStatusSpriteMasks_InvisibleClassStatus: @ 80F67B4
.4byte 0 @ STATUS_NONE
.4byte 0 @ STATUS_INVISIBLE
.4byte 0 @ STATUS_TRANSFORMED
.4byte 0 @ STATUS_MOBILE
.global gStatusSpriteMasks_BlinkerClassStatus
gStatusSpriteMasks_BlinkerClassStatus: @ 80F67C4
.4byte 0 @ STATUS_NONE
.4byte STATUS_SPRITE_BLINKER @ STATUS_BLINKER
.4byte STATUS_SPRITE_CROSS_EYED @ STATUS_CROSS_EYED
.4byte STATUS_SPRITE_EYEDROPS @ STATUS_EYEDROPS
.global gStatusSpriteMasks_MuzzledStatus
gStatusSpriteMasks_MuzzledStatus: @ 80F67D4
.4byte 0 @ STATUS_NONE
.4byte STATUS_SPRITE_MUZZLED @ STATUS_MUZZLED
.global gUnknown_80F67DC
gUnknown_80F67DC: @ 80F67DC
@ u16[4]. They are sound effect IDs
.byte 0xD8, 0x00, 0xD9, 0x00
.byte 0xD9, 0x00, 0x73, 0x01
.global gUnknown_80F67E4
gUnknown_80F67E4: @ 80F67E4
@ u16[4]. They are sound effect IDs
.byte 0xDA, 0x00, 0xDB, 0x00
.byte 0xDB, 0x00, 0x74, 0x01
.global gUnknown_80F67EC
gUnknown_80F67EC: @ 80F67EC
@ s32[8]
.byte 0xff, 0xff, 0xff, 0xff, 0x4b, 0x01, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
.byte 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x00, 0x00, 0x00
.global gUnknown_80F680C
gUnknown_80F680C: @ 80F680C
@ u32[8]
.byte 0xff, 0xff, 0xff, 0xff, 0x4b, 0x01, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
.byte 0xb8, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x00, 0x00, 0x00
.global gUnknown_80F682C
gUnknown_80F682C: @ 80F682C
@ u16[8]
.byte 0xe5, 0x03, 0xe5, 0x03, 0xe5, 0x03, 0xa9, 0x01, 0xe5, 0x03, 0xe5, 0x03, 0xaa, 0x01, 0xe5, 0x03
.global gUnknown_80F683C
gUnknown_80F683C: @ 80F683C
@ replacing .incbin "baserom.gba", 0xF683C, 0x14
.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x6b, 0x73, 0x64
.byte 0x69, 0x72, 0x30, 0x00
.global gUnknown_80F6850
gUnknown_80F6850: @ 80F6850
@ replacing .incbin "baserom.gba", 0xF6850, 0x10
.byte 0x9e, 0x01, 0xa1, 0x01, 0xa2, 0x01, 0xa3, 0x01
.byte 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00
.global gSpeedTurns
gSpeedTurns: @ 80F6860
@ replacing .incbin "baserom.gba", 0xF6860, 0x104
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0c, 0x00
.byte 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x00
.byte 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x14, 0x00
.byte 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x17, 0x00, 0x18, 0x00, 0x00, 0x00
.byte 0x19, 0x00, 0x1a, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1d, 0x00, 0x1e, 0x00, 0x00, 0x00
.byte 0x1f, 0x00, 0x20, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x23, 0x00, 0x24, 0x00, 0x00, 0x00
.byte 0x25, 0x00, 0x26, 0x00, 0x27, 0x00, 0x00, 0x00, 0x28, 0x00, 0x29, 0x00, 0x2a, 0x00, 0x2b, 0x00
.byte 0x2c, 0x00, 0x2d, 0x00, 0x2e, 0x00, 0x2f, 0x00, 0x30, 0x00, 0x31, 0x00, 0x32, 0x00, 0x33, 0x00
.byte 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x39, 0x00, 0x3a, 0x00, 0x3b, 0x00
.byte 0x3c, 0x00, 0x3d, 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x70, 0x6b, 0x73, 0x64
.byte 0x69, 0x72, 0x30, 0x00
.global gUnknown_80F6964
gUnknown_80F6964: @ 80F6964
@ replacing .incbin "baserom.gba", 0xF6964, 0x18
.byte 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00
.byte 0x12, 0x00, 0x31, 0x00, 0x2c, 0x00, 0x12, 0x00
.global gUnknown_80F697C
gUnknown_80F697C: @ 80F697C
.byte 0x58, 0x00, 0x00, 0x00
.string "pksdir0"
.align 2,0

View File

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

View File

@@ -1,44 +0,0 @@
.section .rodata
@ sub_8048E04 - sub_805FC30
.align 2,0
.string "pksdir0\0"
.global gUnknown_8106A4C
gUnknown_8106A4C: @ 8106A4C
.4byte 0
.global gUnknown_8106A50
gUnknown_8106A50: @ 8106A50
.4byte 1
.global gUnknown_8106A54
gUnknown_8106A54: @ 8106A54
.byte 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00
.byte 0x80, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00
.byte 0x80, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00
.align 2,0
.string "pksdir0\0"
.align 2,0
.align 2,0
.string "pksdir0\0"
.align 2,0
.global gUnknown_8106A8C
gUnknown_8106A8C: @ 8106A8C
.byte 0x06, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
.byte 0x18, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x70, 0x6b, 0x73, 0x64
.byte 0x69, 0x72, 0x30, 0x00
.align 2,0
.string "pksdir0\0"
.align 2,0
.align 2,0
.string "pksdir0\0"
.align 2,0

View File

@@ -1,20 +0,0 @@
.section .rodata
.align 2,0
@ ???
.align 2,0
.string "pksdir0\0"
@ sub_806C51C - sub_806E100
.align 2,0
.string "pksdir0\0"
.align 2,0
.global gUnknown_8106EC8
gUnknown_8106EC8: @ 8106EC8
.byte 0x00, 0x01, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07
.byte 0x07, 0x07, 0x05, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x05
.byte 0x06, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x07

View File

@@ -1,13 +0,0 @@
.section .rodata
.global gUnknown_8106F7C
gUnknown_8106F7C: @ 8106F7C
.int 0, 0, 0, 1
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.global gUnknown_8106FA4
gUnknown_8106FA4: @ 8106FA4
.string "{color}%c%s{reset}\0"

View File

@@ -1,93 +0,0 @@
.section .rodata
@ ???
.string "pksdir0\0"
@ sub_807218C
.string "pksdir0\0"
.global gUnknown_8107010
gUnknown_8107010: @ 8107010
.byte 0, 1, 1, 2, 1, 1, 0, 0
.global gUnknown_8107018
gUnknown_8107018: @ 8107018
.4byte gUnknown_810702C
.4byte gUnknown_8107028
.4byte gUnknown_8107024
.global gUnknown_8107024
gUnknown_8107024: @ 8107024
.byte 0x0a, 0x00, 0x00, 0x00
.global gUnknown_8107028
gUnknown_8107028: @ 8107028
.byte 0x23, 0x57, 0x0a, 0x00
.global gUnknown_810702C
gUnknown_810702C: @ 810702C
.byte 0x00, 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"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
.string "pksdir0\0"
@ HandleExplosion
.string "pksdir0\0"
.global gUnknown_81070E8
gUnknown_81070E8: @ 81070E8
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00
.byte 0xff, 0xff, 0x01, 0x00, 0x63, 0x00, 0x63, 0x00
.global gUnknown_8107110
gUnknown_8107110: @ 8107110
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00
.byte 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff
.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00
.byte 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0xff, 0xff, 0x02, 0x00, 0xfe, 0xff, 0x01, 0x00, 0xfe, 0xff, 0x00, 0x00, 0xfe, 0xff
.byte 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0x00, 0x00
.byte 0xfe, 0xff, 0x01, 0x00, 0xfe, 0xff, 0x02, 0x00, 0xff, 0xff, 0x02, 0x00, 0x63, 0x00, 0x63, 0x00
.global gUnknown_8107178
gUnknown_8107178: @ 8107178
.4byte gUnknown_81070E8
.4byte gUnknown_81070E8
.4byte gUnknown_8107110
@ ???
.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"
.align 2,0

View File

@@ -1,94 +0,0 @@
.section .rodata
.global gUnknown_810AC60
gUnknown_810AC60: @ 810AC60
.byte 0x0C, 0x00
.global gUnknown_810AC62
gUnknown_810AC62: @ 810AC62
.byte 0x0C, 0x00
.global gUnknown_810AC64
gUnknown_810AC64: @ 810AC64
.byte 0x08, 0x00
.global gUnknown_810AC66
gUnknown_810AC66: @ 810AC66
.byte 0x08, 0x00
.global gUnknown_810AC68
gUnknown_810AC68: @ 810AC68
.byte 0x08, 0x00
.global gUnknown_810AC6A
gUnknown_810AC6A: @ 810AC6A
.byte 0x00
.byte 0x0E
.byte 0x03
.byte 0x04
.byte 0x0C
.byte 0x09
.byte 0x02
.byte 0x0E
.byte 0x11
.byte 0x0A
.byte 0x0D
.byte 0x10
.byte 0x08
.byte 0x07
.byte 0x01
.byte 0x11
.byte 0x10
.byte 0x05
.global gIsTypePhysicalTable
gIsTypePhysicalTable: @ 810AC7C
.byte 0x01
.byte 0x01
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x01
.byte 0x01
.byte 0x01
.byte 0x01
.byte 0x00
.byte 0x01
.byte 0x01
.byte 0x01
.byte 0x00
.byte 0x00
.byte 0x01
.byte 0x00
.byte 0x00
.global gUnknown_810AC90
gUnknown_810AC90: @ R=810AC90 | B=020C3498
.byte 0x02, 0x00, 0x00, 0x00
.byte 0x04, 0x00, 0x00, 0x00
.byte 0x06, 0x00, 0x00, 0x00
.byte 0x07, 0x00, 0x00, 0x00
.byte 0x08, 0x00, 0x00, 0x00
.byte 0x09, 0x00, 0x00, 0x00
.byte 0x0A, 0x00, 0x00, 0x00
.byte 0x0D, 0x00, 0x00, 0x00
.byte 0x0F, 0x00, 0x00, 0x00
.byte 0x11, 0x00, 0x00, 0x00
.global gFrenzyPlantIQReq
gFrenzyPlantIQReq: @ 810ACB8
.2byte 333
.global gHydroCannonIQReq
gHydroCannonIQReq: @ 810ACBA
.2byte 333
.global gBlastBurnIQReq
gBlastBurnIQReq: @ 810ACBC
.2byte 333
.global gVoltTackleIQReq
gVoltTackleIQReq: @ 810ACBE
.2byte 333

4
data/pksdir_0.s Normal file
View File

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

4
data/pksdir_1.s Normal file
View File

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

4
data/pksdir_2.s Normal file
View File

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

7
data/pksdir_3.s Normal file
View File

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

View File

@@ -1,10 +0,0 @@
#ifndef GUARD_CHARGE_MOVE_H
#define GUARD_CHARGE_MOVE_H
#include "structs/dungeon_entity.h"
bool8 MoveMatchesBideClassStatus(Entity *pokemon, Move *move);
// checkCharge = Check for the move named Charge.
bool8 IsChargingAnyTwoTurnMove(Entity *pokemon, bool8 checkCharge);
#endif

View File

@@ -1,7 +0,0 @@
#ifndef GUARD_CODE_8042B34_H
#define GUARD_CODE_8042B34_H
bool8 sub_8043CE4(s32 dungeonId);
void sub_8043D50(s32 *a0, s32 *a1);
#endif // GUARD_CODE_8042B34_H

View File

@@ -1,10 +0,0 @@
#ifndef GUARD_CODE_80227B8_H
#define GUARD_CODE_80227B8_H
#include "structs/dungeon_entity.h"
Entity *SpawnTrap(u8 trapID, DungeonPos *pos, u8 c);
Entity *sub_8045708(DungeonPos *pos);
void sub_80457DC(Entity* ent);
#endif // GUARD_CODE_80227B8_H

View File

@@ -1,10 +0,0 @@
#ifndef GUARD_CODE_8045A00_H
#define GUARD_CODE_8045A00_H
#include "structs/dungeon_entity.h"
void SubstitutePlaceholderStringTags(u8 *buffer, Entity *entity, u32 param_3);
void sub_8045ACC(void);
#endif // GUARD_CODE_8045A00_H

View File

@@ -18,7 +18,7 @@ void RaiseDefStatTarget(Entity * pokemon,Entity * target, s32 increment);
void RaiseSpDefStatTarget(Entity * pokemon,Entity * target, s32 increment);
void LongTossStatusTarget(Entity * pokemon,Entity * target);
void PierceStatusTarget(Entity * pokemon,Entity * target);
void SetChargeStatusTarget(Entity *pokemon, Entity *target, u8 newStatus, Move *move, u8 *message);
void SetChargeStatusTarget(Entity *pokemon, Entity *target, u8 newStatus, Move *move, const u8 *message);
void sub_8079764(Entity * pokemon);
void CounterStatusTarget(Entity * pokemon, Entity * target, u8 newStatus);
void SafeguardStatusTarget(Entity * pokemon, Entity * target);

View File

@@ -16,6 +16,7 @@
#define CATEGORY_HELD_ITEMS 4
#define CATEGORY_TMS_HMS 5
#define CATEGORY_POKE 6
#define CATEGORY_7 7
#define CATEGORY_OTHER 8
#define CATEGORY_ORBS 9
#define CATEGORY_LINK_BOX 10

View File

@@ -433,4 +433,9 @@
#define IS_CASTFORM_FORM_MONSTER(id)((id == MONSTER_CASTFORM_SNOWY || id == MONSTER_CASTFORM_SUNNY || id == MONSTER_CASTFORM_RAINY))
#define IS_DEOXYS_FORM_MONSTER(id)((id == MONSTER_DEOXYS_ATTACK || id == MONSTER_DEOXYS_DEFENSE || id == MONSTER_DEOXYS_SPEED))
// For dialogue strings
#define DIALOGUE_MONSTER_PLAYER MONSTER_MAX + 1
#define DIALOGUE_MONSTER_PARTNER MONSTER_MAX + 2
#define DIALOGUE_MONSTER_NONE MONSTER_MAX + 3
#endif // GUARD_CONSTANTS_MONSTER_H

View File

@@ -3,31 +3,6 @@
#include "structs/str_dungeon.h"
// size: 0x10
typedef struct DungeonDataEntry
{
/* 0x0 */ bool8 stairDirectionUp;
// If enabled, enemies will evolve when a team member is KOed (and doesn't revive) if their evolution spawns on the floor.
// False for all dungeons, but the code still works if this flag is enabled.
/* 0x1 */ bool8 enemiesEvolveWhenKOed;
/* 0x2 */ bool8 recruitingEnabled;
/* 0x3 */ s8 rescuesAllowed;
/* 0x4 */ u8 maxItemsAllowed;
/* 0x5 */ u8 maxPartyMembers;
/* 0x6 */ bool8 levelResetTo1;
/* 0x7 */ bool8 keepMoney;
/* 0x8 */ bool8 leaderCanSwitch;
/* 0x9 */ bool8 hasCheckpoint;
/* 0xA */ bool8 enterWithoutGameSave; // If false, the dungeon will force a quicksave before entering.
/* 0xB */ u8 HMMask; // HM mask for dungeon entry requirements (Fly, Dive, Waterfall, Surf, Water).
/* 0xC */ s16 turnLimit;
// The chance that a wild Pokémon's moveRandomly flag will be set when spawning,
// causing them to move randomly inside a room instead of exploring rooms.
/* 0xE */ s16 randomMovementChance;
} DungeonDataEntry;
extern const DungeonDataEntry gDungeons[];
s32 GetDungeonFloorCount(u8 dungeon);
const u8 *GetDungeonName1(u8 dungeon);
bool8 IsStairDirectionUp(u8 dungeon);

View File

@@ -1,16 +0,0 @@
#ifndef GUARD_DUNGEON_AI_TARGETING_H
#define GUARD_DUNGEON_AI_TARGETING_H
#include "structs/dungeon_entity.h"
bool8 CanAttackInDirection(Entity *pokemon, s32 direction);
bool8 CanAIMonsterMoveInDirection(Entity *pokemon, s32 direction, bool8 *pokemonInFront);
bool8 IsAtJunction(Entity *pokemon);
bool8 ShouldAvoidFirstHit(Entity *pokemon, bool8 forceAvoid);
bool8 ShouldMonsterRunAway(Entity *pokemon);
bool8 ShouldMonsterRunAwayAndShowEffect(Entity *pokemon, bool8 showRunAwayEffect);
void CheckRunAwayVisualFlag(Entity *pokemon, bool8 showRunAwayEffect);
u8 GetTreatmentBetweenMonsters(Entity *pokemon, Entity *targetPokemon, bool8 ignoreInvisible, bool8 checkPetrified);
u8 sub_807167C(Entity * pokemon, Entity * target);
#endif

View File

@@ -0,0 +1,325 @@
#ifndef GUARD_DUNGEON_BOSS_DIALOGUE_H
#define GUARD_DUNGEON_BOSS_DIALOGUE_H
#include "dungeon_message.h"
extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_1;
extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_2[];
extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_3;
extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_4;
extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_5[];
extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_6;
extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_7[];
extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_8;
extern const struct DungeonDialogueStruct gSkarmoryPreFightDialogue_9[];
extern const struct DungeonDialogueStruct gSkarmoryReFightDialogue_1;
extern const struct DungeonDialogueStruct gSkarmoryReFightDialogue_2;
extern const struct DungeonDialogueStruct gSkarmoryReFightDialogue_3;
extern const struct DungeonDialogueStruct gUnknown_8100D3C;
extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_1[];
extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_2;
extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_3;
extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_4[];
extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_5;
extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_6;
extern const struct DungeonDialogueStruct gTeamMeaniesPreFightDialogue_7;
extern const struct DungeonDialogueStruct gTeamMeaniesReFightDialogue_1[];
extern const struct DungeonDialogueStruct gTeamMeaniesReFightDialogue_2[];
extern const struct DungeonDialogueStruct gTeamMeaniesReFightDialogue_3;
extern const struct DungeonDialogueStruct gTeamMeaniesReFightDialogue_4;
extern const struct DungeonDialogueStruct gTeamMeaniesReFightDialogue_5;
extern const struct DungeonDialogueStruct gUnknown_8101440;
extern const struct DungeonDialogueStruct gUnknown_81014B0[];
extern const struct DungeonDialogueStruct gUnknown_8101504[];
extern const struct DungeonDialogueStruct gUnknown_81015A0;
extern const struct DungeonDialogueStruct gUnknown_81015D4;
extern const struct DungeonDialogueStruct gUnknown_81015E8;
extern const struct DungeonDialogueStruct gUnknown_8101624;
extern const struct DungeonDialogueStruct gUnknown_810165C[];
extern const struct DungeonDialogueStruct gUnknown_8101750;
extern const struct DungeonDialogueStruct gUnknown_810178C;
extern const struct DungeonDialogueStruct gUnknown_81017B4;
extern const struct DungeonDialogueStruct gZapdosReFightDialogue_1[];
extern const struct DungeonDialogueStruct gZapdosReFightDialogue_2;
extern const struct DungeonDialogueStruct gZapdosReFightDialogue_3;
extern const struct DungeonDialogueStruct gZapdosReFightDialogue_4;
extern const struct DungeonDialogueStruct gZapdosPostStoryPreFightDialogue_1;
extern const struct DungeonDialogueStruct gZapdosPostStoryPreFightDialogue_2;
extern const struct DungeonDialogueStruct gZapdosPostStoryPreFightDialogue_3;
extern const struct DungeonDialogueStruct gZapdosPostStoryPreFightDialogue_4;
extern const struct DungeonDialogueStruct gZapdosPostStoryPreFightDialogue_5;
extern const struct DungeonDialogueStruct gZapdosPostStoryPreFightDialogue_6;
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_1;
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_2[];
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_3[];
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_4[];
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_5;
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_6[];
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_7;
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_8[];
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_9;
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_10;
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_11;
extern const struct DungeonDialogueStruct gMoltresPreFightDialogue_12;
extern const struct DungeonDialogueStruct gMoltresReFightDialogue_1;
extern const struct DungeonDialogueStruct gMoltresReFightDialogue_2[];
extern const struct DungeonDialogueStruct gMoltresReFightDialogue_3;
extern const struct DungeonDialogueStruct gMoltresReFightDialogue_4[];
extern const struct DungeonDialogueStruct gMoltresReFightDialogue_5;
extern const struct DungeonDialogueStruct gMoltresPostStoryPreFightDialogue_1;
extern const struct DungeonDialogueStruct gMoltresPostStoryPreFightDialogue_2;
extern const struct DungeonDialogueStruct gMoltresPostStoryPreFightDialogue_3;
extern const struct DungeonDialogueStruct gMoltresPostStoryPreFightDialogue_4;
extern const struct DungeonDialogueStruct gMoltresPostStoryPreFightDialogue_5;
extern const struct DungeonDialogueStruct gUnknown_810246C;
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_1[];
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_2;
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_3;
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_4[];
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_5;
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_6;
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_7;
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_8;
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_9;
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_10;
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_11;
extern const struct DungeonDialogueStruct gArticunoPreFightDialogue_12;
extern const struct DungeonDialogueStruct gArticunoReFightDialogue_1;
extern const struct DungeonDialogueStruct gArticunoReFightDialogue_2;
extern const struct DungeonDialogueStruct gArticunoReFightDialogue_3;
extern const struct DungeonDialogueStruct gArticunoPostStoryPreFightDialogue_1;
extern const struct DungeonDialogueStruct gArticunoPostStoryPreFightDialogue_2;
extern const struct DungeonDialogueStruct gArticunoPostStoryPreFightDialogue_3;
extern const struct DungeonDialogueStruct gArticunoPostStoryPreFightDialogue_4;
extern const struct DungeonDialogueStruct gArticunoPostStoryPreFightDialogue_5;
extern const struct DungeonDialogueStruct gUnknown_8102A9C;
extern const struct DungeonDialogueStruct gUnknown_8102B10;
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_1;
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_2[];
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_3;
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_4[];
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_5;
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_6[];
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_7;
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_8[];
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_9;
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_10;
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_11;
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_12[];
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_13;
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_14;
extern const struct DungeonDialogueStruct MagmaCavernMidDialogue_15;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_1[];
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_2;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_3;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_4;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_5;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_6;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_7;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_8;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_9;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_10[];
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_11[];
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_12;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_13;
extern const struct DungeonDialogueStruct GroudonPreFightDialogue_14[];
extern const struct DungeonDialogueStruct gGroudonReFightDialogue_1[];
extern const struct DungeonDialogueStruct gGroudonReFightDialogue_2[];
extern const struct DungeonDialogueStruct gGroudonReFightDialogue_3;
extern const struct DungeonDialogueStruct gGroudonReFightDialogue_4[];
extern const struct DungeonDialogueStruct gGroudonPostStoryPreFightDialogue_1;
extern const struct DungeonDialogueStruct gGroudonPostStoryPreFightDialogue_2;
extern const struct DungeonDialogueStruct gGroudonPostStoryPreFightDialogue_3;
extern const struct DungeonDialogueStruct gGroudonPostStoryPreFightDialogue_4;
extern const struct DungeonDialogueStruct gUnknown_8103488;
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_1;
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_2;
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_3[];
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_4;
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_5;
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_6;
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_7;
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_8;
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_9;
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_10;
extern const struct DungeonDialogueStruct gRayquazaPreFightDialogue_11;
extern const struct DungeonDialogueStruct gRayquazaReFightDialogue_1;
extern const struct DungeonDialogueStruct gRayquazaReFightDialogue_2;
extern const struct DungeonDialogueStruct gRayquazaReFightDialogue_3;
extern const struct DungeonDialogueStruct gRayquazaReFightDialogue_4;
extern const struct DungeonDialogueStruct gRayquazaPostStoryPreFightDialogue_1;
extern const struct DungeonDialogueStruct gRayquazaPostStoryPreFightDialogue_2;
extern const struct DungeonDialogueStruct gRayquazaPostStoryPreFightDialogue_3;
extern const struct DungeonDialogueStruct gRayquazaPostStoryPreFightDialogue_4;
extern const struct DungeonDialogueStruct gRayquazaPostStoryPreFightDialogue_5;
extern const struct DungeonDialogueStruct gRayquazaPostStoryPreFightDialogue_6;
extern const struct DungeonDialogueStruct gUnknown_8103BD8;
extern const struct DungeonDialogueStruct gUnknown_8103C00;
extern const struct DungeonDialogueStruct gUnknown_8103C3C;
extern const struct DungeonDialogueStruct gUnknown_8103C74;
extern const struct DungeonDialogueStruct gUnknown_8103CC4;
extern const struct DungeonDialogueStruct gUnknown_8103D0C;
extern const struct DungeonDialogueStruct gUnknown_8103D50;
extern const struct DungeonDialogueStruct gUnknown_8103D8C;
extern const struct DungeonDialogueStruct gUnknown_8103D98;
extern const struct DungeonDialogueStruct gUnknown_8103DD8;
extern const struct DungeonDialogueStruct gUnknown_8103E28;
extern const struct DungeonDialogueStruct gUnknown_8103E34;
extern const struct DungeonDialogueStruct gMewtwoPreFightDialogue_1;
extern const struct DungeonDialogueStruct gMewtwoPreFightDialogue_2;
extern const struct DungeonDialogueStruct gMewtwoPreFightDialogue_3;
extern const struct DungeonDialogueStruct gMewtwoPreFightDialogue_4;
extern const struct DungeonDialogueStruct gMewtwoPreFightDialogue_5;
extern const struct DungeonDialogueStruct gMewtwoReFightDialogue_1;
extern const struct DungeonDialogueStruct gMewtwoReFightDialogue_2;
extern const struct DungeonDialogueStruct gMewtwoReFightDialogue_3;
extern const struct DungeonDialogueStruct gMewtwoReFightDialogue_4;
extern const struct DungeonDialogueStruct gMewtwoReFightDialogue_5;
extern const struct DungeonDialogueStruct gEnteiPreFightDialogue_1;
extern const struct DungeonDialogueStruct gEnteiPreFightDialogue_2;
extern const struct DungeonDialogueStruct gEnteiPreFightDialogue_3;
extern const struct DungeonDialogueStruct gEnteiReFightDialogue_1;
extern const struct DungeonDialogueStruct gEnteiReFightDialogue_2;
extern const struct DungeonDialogueStruct gEnteiReFightDialogue_3;
extern const struct DungeonDialogueStruct gEnteiPostStoryPreFightDialogue_1;
extern const struct DungeonDialogueStruct gEnteiPostStoryPreFightDialogue_2;
extern const struct DungeonDialogueStruct gEnteiPostStoryPreFightDialogue_3;
extern const struct DungeonDialogueStruct gEnteiPostStoryPreFightDialogue_4;
extern const struct DungeonDialogueStruct gRaikouPreFightDialogue_1;
extern const struct DungeonDialogueStruct gRaikouPreFightDialogue_2;
extern const struct DungeonDialogueStruct gRaikouPreFightDialogue_3;
extern const struct DungeonDialogueStruct gRaikouPreFightDialogue_4;
extern const struct DungeonDialogueStruct gRaikouPreFightDialogue_5;
extern const struct DungeonDialogueStruct gRaikouPreFightDialogue_6;
extern const struct DungeonDialogueStruct gRaikouReFightDialogue_1;
extern const struct DungeonDialogueStruct gRaikouReFightDialogue_2;
extern const struct DungeonDialogueStruct gRaikouReFightDialogue_3;
extern const struct DungeonDialogueStruct gRaikouPostStoryPreFightDialogue_1;
extern const struct DungeonDialogueStruct gRaikouPostStoryPreFightDialogue_2;
extern const struct DungeonDialogueStruct gRaikouPostStoryPreFightDialogue_3;
extern const struct DungeonDialogueStruct gRaikouPostStoryPreFightDialogue_4;
extern const struct DungeonDialogueStruct gSuicunePreFightDialogue_1;
extern const struct DungeonDialogueStruct gSuicunePreFightDialogue_2;
extern const struct DungeonDialogueStruct gSuicunePreFightDialogue_3;
extern const struct DungeonDialogueStruct gSuicunePreFightDialogue_4;
extern const struct DungeonDialogueStruct gSuicunePreFightDialogue_5;
extern const struct DungeonDialogueStruct gSuicunePreFightDialogue_6;
extern const struct DungeonDialogueStruct gSuicunePreFightDialogue_7;
extern const struct DungeonDialogueStruct gSuicuneReFightDialogue_1;
extern const struct DungeonDialogueStruct gSuicuneReFightDialogue_2;
extern const struct DungeonDialogueStruct gSuicuneReFightDialogue_3;
extern const struct DungeonDialogueStruct gSuicunePostStoryPreFightDialogue_1;
extern const struct DungeonDialogueStruct gSuicunePostStoryPreFightDialogue_2;
extern const struct DungeonDialogueStruct gSuicunePostStoryPreFightDialogue_3;
extern const struct DungeonDialogueStruct gSuicunePostStoryPreFightDialogue_4;
extern const struct DungeonDialogueStruct gHoOhPreFightDialogue_1;
extern const struct DungeonDialogueStruct gHoOhPreFightDialogue_2;
extern const struct DungeonDialogueStruct gHoOhPreFightDialogue_3;
extern const struct DungeonDialogueStruct gHoOhPreFightDialogue_4;
extern const struct DungeonDialogueStruct gHoOhPreFightDialogue_5;
extern const struct DungeonDialogueStruct gHoOhPreFightDialogue_6;
extern const struct DungeonDialogueStruct HoOhReFightDialogue_1;
extern const struct DungeonDialogueStruct HoOhReFightDialogue_2;
extern const struct DungeonDialogueStruct HoOhReFightDialogue_3;
extern const struct DungeonDialogueStruct HoOhReFightDialogue_4;
extern const struct DungeonDialogueStruct HoOhReFightDialogue_5;
extern const struct DungeonDialogueStruct gLatiosPreFightDialogue_1;
extern const struct DungeonDialogueStruct gLatiosPreFightDialogue_2;
extern const struct DungeonDialogueStruct gLatiosPreFightDialogue_3;
extern const struct DungeonDialogueStruct gLatiosReFightDialogue_1;
extern const struct DungeonDialogueStruct gUnknown_8104FC8;
extern const struct DungeonDialogueStruct gRegirockPreFightDialogue_1;
extern const struct DungeonDialogueStruct gRegicePreFightDialogue_1;
extern const struct DungeonDialogueStruct gRegisteelPreFightDialogue_1;
extern const struct DungeonDialogueStruct gRegirockPostFightDialogue_1;
extern const struct DungeonDialogueStruct gRegirockPostFightDialogue_2;
extern const struct DungeonDialogueStruct gRegicePostFightDialogue_1;
extern const struct DungeonDialogueStruct gRegicePostFightDialogue_2;
extern const struct DungeonDialogueStruct gRegisteelPostFightDialogue_1;
extern const struct DungeonDialogueStruct gRegisteelPostFightDialogue_2;
extern const u8 *const gUnknown_810531C;
extern const u8 *const gUnknown_8105360;
extern const u8 *const gUnknown_81053A8;
extern const u8 *const gUnknown_8105434;
extern const struct DungeonDialogueStruct gJirachiPreFightDialogue_1;
extern const struct DungeonDialogueStruct gJirachiPreFightDialogue_2;
extern const struct DungeonDialogueStruct gJirachiPreFightDialogue_3;
extern const struct DungeonDialogueStruct gJirachiPreFightDialogue_4;
extern const struct DungeonDialogueStruct gUnknown_810554C;
extern const struct DungeonDialogueStruct gUnknown_8105558;
extern const struct DungeonDialogueStruct gUnknown_81055F4;
extern const struct DungeonDialogueStruct gUnknown_8105668;
extern const struct DungeonDialogueStruct gUnknown_8105674;
extern const struct DungeonDialogueStruct gUnknown_81056B8;
extern const struct DungeonDialogueStruct gUnknown_81056DC;
extern const u8 *const gUnknown_8105798;
extern const MenuItem gUnknown_810579C[];
extern const struct DungeonDialogueStruct gUnknown_810581C;
extern const struct DungeonDialogueStruct gUnknown_81058A8;
extern const struct DungeonDialogueStruct gUnknown_81058C4;
extern const struct DungeonDialogueStruct gUnknown_81058E0;
extern const struct DungeonDialogueStruct gUnknown_810593C;
extern const struct DungeonDialogueStruct gUnknown_8105974;
extern const struct DungeonDialogueStruct gUnknown_8105A08;
extern const struct DungeonDialogueStruct gUnknown_8105AD4;
extern const struct DungeonDialogueStruct gUnknown_8105B20;
extern const struct DungeonDialogueStruct gUnknown_8105B68;
extern const struct DungeonDialogueStruct gUnknown_8105BA8;
extern const struct DungeonDialogueStruct gUnknown_8105BF4;
extern const struct DungeonDialogueStruct gUnknown_8105D2C;
extern const struct DungeonDialogueStruct gUnknown_8105D80;
extern const struct DungeonDialogueStruct gUnknown_8105D9C;
extern const struct DungeonDialogueStruct gJirachiReFightDialogue_1;
extern const struct DungeonDialogueStruct gLugiaPreFightDialogue_1;
extern const struct DungeonDialogueStruct gLugiaPreFightDialogue_2;
extern const struct DungeonDialogueStruct gLugiaPreFightDialogue_3;
extern const struct DungeonDialogueStruct gLugiaPreFightDialogue_4;
extern const struct DungeonDialogueStruct gLugiaPreFightDialogue_5;
extern const struct DungeonDialogueStruct gLugiaPreFightDialogue_6;
extern const struct DungeonDialogueStruct gLugiaPreFightDialogue_7;
extern const struct DungeonDialogueStruct gLugiaPreFightDialogue_8;
extern const struct DungeonDialogueStruct gKyogrePreFightDialogue_1;
extern const struct DungeonDialogueStruct gKyogrePreFightDialogue_2;
extern const struct DungeonDialogueStruct gKyogrePreFightDialogue_3;
extern const struct DungeonDialogueStruct gKyogrePreFightDialogue_4;
extern const struct DungeonDialogueStruct gKyogrePreFightDialogue_5;
extern const struct DungeonDialogueStruct gKyogrePreFightDialogue_6;
extern const struct DungeonDialogueStruct gKyogrePreFightDialogue_7;
extern const struct DungeonDialogueStruct gKyogrePreFightDialogue_8;
extern const struct DungeonDialogueStruct gDeoxysPreFightDialogue_1;
extern const struct DungeonDialogueStruct gDeoxysPreFightDialogue_2;
extern const struct DungeonDialogueStruct gDeoxysPreFightDialogue_3;
extern const struct DungeonDialogueStruct gDeoxysPreFightDialogue_4;
extern const struct DungeonDialogueStruct gDeoxysPreFightDialogue_5;
extern const struct DungeonDialogueStruct gCelebiJoinDialogue_1;
extern const struct DungeonDialogueStruct gCelebiJoinDialogue_2;
extern const struct DungeonDialogueStruct gCelebiJoinDialogue_3;
extern const struct DungeonDialogueStruct gCelebiJoinDialogue_4;
extern const struct DungeonDialogueStruct gCelebiJoinDialogue_5;
extern const struct DungeonDialogueStruct gCelebiJoinDialogue_6;
extern const struct DungeonDialogueStruct gCelebiJoinDialogue_7;
extern const struct DungeonDialogueStruct gCelebiJoinDialogue_8;
extern const struct DungeonDialogueStruct gCelebiJoinDialogue_9;
extern const u8 *const gPtrPurityForestAllowCelebiToJoinText;
extern const MenuItem gPurityForestAllowCelebiToJoinPrompt[];
extern const u8 *const gPtrPurityForestRefuseCelebiConfirmText;
extern const MenuItem gPurityForestRefuseCelebiConfirmPrompt[];
extern const struct DungeonDialogueStruct gCelebiJoinDialogue_10;
extern const u8 *const gUnknown_810665C;
extern const u8 *const gUnknown_810668C;
extern const u8 *const gUnknown_81066D4;
extern const u8 *const gUnknown_81066F0;
extern const u8 *const gUnknown_810671C;
extern const struct DungeonDialogueStruct gUnknown_8106720;
extern const struct DungeonDialogueStruct gMedichamRescueDialogue_1;
extern const struct DungeonDialogueStruct gMedichamRescueDialogue_2;
extern const struct DungeonDialogueStruct gMedichamRescueDialogue_3;
extern const struct DungeonDialogueStruct gMedichamRescueDialogue_4;
extern const struct DungeonDialogueStruct gUnknown_810685C;
extern const struct DungeonDialogueStruct gSmeargleRescueDialogue_1;
extern const struct DungeonDialogueStruct gSmeargleRescueDialogue_2;
extern const struct DungeonDialogueStruct gSmeargleRescueDialogue_3;
extern const struct DungeonDialogueStruct gSmeargleRescueDialogue_4;
extern const struct DungeonDialogueStruct gUnknown_810697C;
#endif // GUARD_DUNGEON_BOSS_DIALOGUE_H

View File

@@ -1,13 +0,0 @@
#ifndef GUARD_DUNGEON_CAPABILITIES_H
#define GUARD_DUNGEON_CAPABILITIES_H
#include "structs/dungeon_entity.h"
bool8 CheckVariousStatuses2(Entity *pokemon, bool8 checkBlinker);
bool8 sub_8070BC0(Entity* entity);
bool8 CheckVariousConditions(Entity *pokemon);
bool8 CheckVariousStatuses(Entity *pokemon);
bool8 CannotAttack(Entity *pokemon, bool8 skipSleep);
bool8 CanMoveInDirection(Entity *pokemon, u32 direction);
#endif

View File

@@ -5,6 +5,7 @@
#include "constants/weather.h"
#include "constants/type.h"
#include "constants/dungeon_action.h"
#include "structs/str_dungeon.h"
#include "structs/dungeon_entity.h"
#include "structs/str_moves.h"
@@ -288,4 +289,8 @@ struct CalledMove
extern const struct CalledMove gMetronomeCalledMoves[METRONOME_AVAILABLE_CALLED_MOVES];
extern const struct CalledMove gNaturePowerCalledMoves[];
extern const u16 gUnknown_80F5F70[UNK12A18_ARR_COUNT];
extern const s32 gUnknown_80F5FAC[76];
extern const s32 gUnknown_80F60DC[5];
#endif

61
include/dungeon_data.h Normal file
View File

@@ -0,0 +1,61 @@
#ifndef GUARD_DUNGEON_DATA_H
#define GUARD_DUNGEON_DATA_H
#include "exclusive_pokemon.h"
#include "friend_area.h"
#include "constants/type.h"
#include "constants/friend_area.h"
#include "constants/iq_skill.h"
#include "constants/tactic.h"
#include "constants/dungeon.h"
#include "constants/item.h"
// size: 0x10
typedef struct DungeonDataEntry
{
/* 0x0 */ bool8 stairDirectionUp;
// If enabled, enemies will evolve when a team member is KOed (and doesn't revive) if their evolution spawns on the floor.
// False for all dungeons, but the code still works if this flag is enabled.
/* 0x1 */ bool8 enemiesEvolveWhenKOed;
/* 0x2 */ bool8 recruitingEnabled;
/* 0x3 */ s8 rescuesAllowed;
/* 0x4 */ u8 maxItemsAllowed;
/* 0x5 */ u8 maxPartyMembers;
/* 0x6 */ bool8 levelResetTo1;
/* 0x7 */ bool8 keepMoney;
/* 0x8 */ bool8 leaderCanSwitch;
/* 0x9 */ bool8 hasCheckpoint;
/* 0xA */ bool8 enterWithoutGameSave; // If false, the dungeon will force a quicksave before entering.
/* 0xB */ u8 HMMask; // HM mask for dungeon entry requirements (Fly, Dive, Waterfall, Surf, Water).
/* 0xC */ s16 turnLimit;
// The chance that a wild Pok<6F>mon's moveRandomly flag will be set when spawning,
// causing them to move randomly inside a room instead of exploring rooms.
/* 0xE */ s16 randomMovementChance;
} DungeonDataEntry;
extern const DungeonDataEntry gDungeons[];
extern const u8 gInvalidDungeonIDs[11];
extern const u8 gInvalidItemIDs[16];
extern const bool8 gTacticsTargetLeader[NUM_TACTICS];
extern const s16 gReqTacticLvls[NUM_TACTICS];
extern const s32 gReqIQSkillPts[NUM_IQ_SKILLS];
extern const s32 gUnknown_810A3F0[100];
extern const s16 gTypeGummiIQBoost[NUM_TYPES][NUMBER_OF_GUMMIS];
extern const s16 gUnknown_810A808[NUM_TYPES][NUMBER_OF_GUMMIS];
extern const FriendAreaSettings gFriendAreaSettings[NUM_FRIEND_AREAS];
extern const s16 gUnknown_810AC60;
extern const s16 gUnknown_810AC62;
extern const s16 gUnknown_810AC64;
extern const s16 gUnknown_810AC66;
extern const s16 gUnknown_810AC68;
extern const u8 gBestResistTypeTable[NUM_TYPES];
extern const bool8 gIsTypePhysicalTable[NUM_TYPES];
extern const s32 gUnknown_810AC90[10];
extern const s16 gFrenzyPlantIQReq;
extern const s16 gHydroCannonIQReq;
extern const s16 gBlastBurnIQReq;
extern const s16 gVoltTackleIQReq;
extern const u8 gDungeonWaterType[76];
extern const struct ExclusivePokemon gExclusivePokemon[NUM_EXCLUSIVE_POKEMON];
#endif // GUARD_DUNGEON_DATA_H

View File

@@ -1,9 +1,10 @@
#ifndef GUARD_DUNGEON_ENGINE_H
#define GUARD_DUNGEON_ENGINE_H
bool8 IsBossFight(void);
bool8 IsCurrentFixedRoomBossFight(void);
bool8 IsMakuhitaTrainingMaze(void);
#include "structs/dungeon_entity.h"
extern const s16 gSpeedTurns[NUM_SPEED_COUNTERS][25];
void RunFractionalTurn(bool8 param_1);
#endif

View File

@@ -51,13 +51,10 @@ enum SecondaryStructureType {
SECONDARY_STRUCTURE_DIVIDER, // A "divider" of secondary terrain will split the room in half randomly either horizontally or vertically.
};
extern bool8 gUnknown_202F1A8;
void GenerateFloor(void);
bool8 StairsAlwaysReachable(s32 stairsX, s32 stairsY, bool8 markUnreachable);
void sub_804EB30(void);
void sub_8051E3C(void);
#include "structs/dungeon_entity.h"
void sub_8051E7C(Entity *pokemon);
#endif

View File

@@ -0,0 +1,11 @@
#ifndef GUARD_DUNGEON_GENERATION_FIXED_H
#define GUARD_DUNGEON_GENERATION_FIXED_H
#include "structs/dungeon_entity.h"
#include "structs/map.h"
bool8 PlaceFixedRoomTile(Tile *tile, u8 fixedRoomActionId, s32 x, s32 y, bool8 spawnTrapOrItem);
void sub_8051E3C(void);
void sub_8051E7C(Entity *pokemon);
#endif

59
include/dungeon_logic.h Normal file
View File

@@ -0,0 +1,59 @@
#ifndef GUARD_DUNGEON_LOGIC_H
#define GUARD_DUNGEON_LOGIC_H
#include "structs/map.h"
#include "structs/dungeon_entity.h"
extern u8 gWalkableTileToCrossableTerrain[8];
u8 GetCrossableTerrain(s16 species);
u8 sub_807034C(s32 id, const Tile *tile);
u8 sub_80703A0(Entity *pokemon, DungeonPos *pos);
bool8 CanCrossWalls(Entity *pokemon);
bool8 sub_807049C(Entity *pokemon, DungeonPos *pos);
bool8 sub_8070564(Entity *pokemon, DungeonPos *pos);
bool8 sub_80705F0(Entity *pokemon, DungeonPos *pos);
bool8 sub_80706A4(Entity *pokemon, DungeonPos *pos);
s32 CalcSpeedStage(Entity *pokemon);
s32 sub_8070828(Entity *pokemon, bool8 displayMessage);
void SetMessageArgument_2(u8 *buffer, EntityInfo *param_2, s32 colorNum);
void sub_8070968(u8 *buffer, EntityInfo *entityInfo, s32 colorNum);
void sub_80709C8(u8 *buffer, EntityInfo *entityInfo);
bool8 HasNegativeStatus(Entity *pokemon);
bool8 IsSleeping(Entity *pokemon);
bool8 HasLowHealth(Entity *pokemon);
bool8 CheckVariousStatuses2(Entity *pokemon, bool8 checkBlinker);
bool8 sub_8070BC0(Entity* entity);
bool8 CheckVariousConditions(Entity *pokemon);
bool8 CheckVariousStatuses(Entity *pokemon);
bool8 CannotAttack(Entity *pokemon, bool8 skipSleep);
bool8 CanMoveInDirection(Entity *pokemon, u32 direction);
bool8 sub_8070F3C(Entity * pokemon, DungeonPos *pos, s32 direction);
bool8 sub_8070F14(Entity * pokemon, s32 direction);
bool8 sub_8070F80(Entity * pokemon, s32 direction);
bool8 CanAttackInDirection(Entity *pokemon, s32 direction);
bool8 CanAIMonsterMoveInDirection(Entity *pokemon, s32 direction, bool8 *pokemonInFront);
bool8 IsAtJunction(Entity *pokemon);
bool8 ShouldAvoidFirstHit(Entity *pokemon, bool8 forceAvoid);
bool8 ShouldMonsterRunAway(Entity *pokemon);
bool8 ShouldMonsterRunAwayAndShowEffect(Entity *pokemon, bool8 showRunAwayEffect);
void CheckRunAwayVisualFlag(Entity *pokemon, bool8 showRunAwayEffect);
u8 GetTreatmentBetweenMonsters(Entity *pokemon, Entity *targetPokemon, bool8 ignoreInvisible, bool8 checkPetrified);
u8 sub_807167C(Entity * pokemon, Entity * target);
bool8 HasSafeguardStatus(Entity * pokemon, Entity * target, bool8 displayMessage);
bool8 sub_8071728(Entity * pokemon, Entity * target, bool8 displayMessage);
bool8 sub_80717A4(Entity *pokemon, u16 moveID);
bool8 AbilityIsActive(Entity *pokemon, u8 ability);
bool8 MonsterIsType(Entity *pokemon, u8 type);
bool8 CanSeeInvisibleMonsters(Entity *pokemon);
bool8 IsTacticSet(Entity *pokemon, u8 tactic);
bool8 IQSkillIsEnabled(Entity *pokemon, u8 IQSkill);
void LoadIQSkills(Entity *pokemon);
bool8 CanSeeTeammate(Entity * pokemon);
u8 GetMoveTypeForMonster(Entity *pokemon, Move *pokeMove);
s32 GetMovePower(Entity *pokemon, Move *pokeMove);
bool8 MonsterCanThrowItems(EntityInfo *pokemon);
bool8 sub_8071A8C(Entity *pokemon);
bool8 SetVisualFlags(EntityInfo *entityInfo, u16 newFlag, bool8 param_3);
#endif

View File

@@ -1,8 +1,11 @@
#ifndef GUARD_DUNGEON_MAP_H
#define GUARD_DUNGEON_MAP_H
#include "structs/str_position.h"
extern bool8 gShowMonsterDotsInDungeonMap;
extern bool8 gShowDungeonMap;
extern DungeonPos gPlayerDotMapPosition;
void SetDungeonMapToNotShown(void);
void OpenDungeonMapFile(void);

View File

@@ -24,4 +24,15 @@ void sub_804AA60(void);
void sub_804AAAC(void);
void sub_804AAD4(void);
#define DUNGEON_WATER_TYPE_NONE 0
#define DUNGEON_WATER_TYPE_LAVA 1
#define DUNGEON_WATER_TYPE_WATER 2
extern const u8 gDungeonWaterType[76];
bool8 sub_804AD34(DungeonPos *pos);
void sub_804AE84(DungeonPos *pos);
bool8 IsTileGround(Tile *tile);
bool8 IsWaterTileset(void);
#endif // GUARD_DUNGEON_MAP_ACCESS_H

View File

@@ -4,23 +4,25 @@
#include "structs/dungeon_entity.h"
#include "string_format.h"
// These flags are used in dungeon message and dungeon menu recruitment file. It's possible these are general scroll flags and should be put elsewhere, like text.h, assuming more files actually use it.
#define FLAG_CAN_SCROLL_UP 0x1
#define FLAG_CAN_SCROLL_DOWN 0x2
struct MonDialogueSpriteInfo
{
s16 species;
u8 spriteId;
};
// Depending on partner's pokemon species, the dialogue may be slightly different.
#define DIALOGUE_ALLOW_ALL 0
#define DIALOGUE_ALLOW_MOST 1 // Bulbasaur, Cyndaquil, Mudkip, Pikachu, Charmander, Treecko
#define DIALOGUE_ONLY_SQUIRTLE_TOTODILE 7
#define DIALOGUE_ONLY_TORCHIC_CHICORITA 280
struct DungeonDialogueStruct
{
u16 unk0;
u8 unk2;
u8 unk3;
s16 unk4;
s16 unk6;
u16 type;
u8 spriteId;
u8 spritePlacementId; // Information on mon's portrait x/y and flip
s16 speciesId;
s16 allowType;
const u8 *str;
};
@@ -52,7 +54,5 @@ void TryDisplayItemPickupTutorialMessage(u8 itemId);
void DisplayYouReachedDestFloorStr(void);
void sub_8052FB8(const u8 *str);
const u8 *GetCurrentDungeonName(void);
void ResetMessageLog(void);
bool32 DisplayMessageLog(void);
#endif // GUARD_DUNGEON_MESSAGE_H

View File

@@ -0,0 +1,12 @@
#ifndef GUARD_DUNGEON_MESSAGE_LOG_H
#define GUARD_DUNGEON_MESSAGE_LOG_H
// These flags are used in dungeon message log and dungeon menu recruitment file. It's possible these are general scroll flags and should be put elsewhere, like text.h, assuming more files actually use it.
#define FLAG_CAN_SCROLL_UP 0x1
#define FLAG_CAN_SCROLL_DOWN 0x2
void ResetMessageLog(void);
void CopyStringToMessageLog(const u8 *src, u32 a1, u32 a2);
bool32 DisplayMessageLog(void);
#endif

View File

@@ -1,12 +1,32 @@
#ifndef GUARD_DUNGEON_MOVE_H
#define GUARD_DUNGEON_MOVE_H
#include "structs/str_pokemon.h"
#define MAX_MOVE_TARGETS 64
#include "number_util.h"
#include "structs/str_moves.h"
#include "structs/dungeon_entity.h"
extern s32 gUnknown_202F208;
extern s32 gUnknown_202F20C;
extern s32 gUnknown_202F210;
extern s32 gUnknown_202F214;
extern u8 gUnknown_202F218;
extern u8 gUnknown_202F219;
extern u8 gUnknown_202F21A;
extern s32 gUnknown_202F21C;
extern u8 gUnknown_202F220;
extern u8 gUnknown_202F221;
extern u8 gUnknown_202F222;
extern s32 gUnknown_202F224;
extern s32 gMetronomeCalledArrayId;
bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, bool32 isLinkedMove, struct Move *move);
void UseMoveAgainstTargets(Entity **targetsArray, Entity *attacker, Move *move, s32 itemId, bool32 isLinkedMove);
bool32 HandleRegularDamagingMove(Entity *attacker, Entity *target, Move *move, s32 itemId);
s32 HandleDamagingMove(Entity *attacker, Entity *target, Move *move, s24_8 modifier, s32 itemId);
s32 sub_80556BC(Entity *attacker, Entity *target, u8 moveType, Move *move, s24_8 modifier, s32 itemId);
s32 sub_8055864(Entity *attacker, Entity *target, Move *move, s32 param_4, s32 itemId);
bool8 sub_8055988(Entity *r2, Entity *r4);
void sub_80559DC(Entity *entity1, Entity *entity2);
#endif // GUARD_DUNGEON_MOVE_H

View File

@@ -0,0 +1,32 @@
#ifndef GUARD_DUNGEON_MOVE_UTIL_H
#define GUARD_DUNGEON_MOVE_UTIL_H
#include "structs/str_moves.h"
#include "structs/dungeon_entity.h"
bool32 sub_8055A00(Entity *attacker, s32 firstMoveId, s32 var_34, s32 itemId, s32 arg_0);
void TriggerTargetAbilityEffect(Entity *attacker);
bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, bool32 isLinkedMove, struct Move *move);
bool8 sub_8056468(Entity *entity, Move *move, const u8 *str, Entity **unkArray, bool32 itemId, bool8 arg_4, bool32 unused);
s32 sub_8056564(Entity *entity, DungeonPos *pos, Move *move, s32 r4);
void sub_80566F8(Entity *attacker, Move *move, s32 a2, bool8 a3, s32 itemId, s32 isLinkedMove);
bool8 AccuracyCalc(Entity *attacker, Entity *target, Move *move, s32 accuracyType, bool8 selfAlwaysHits);
void SetTargetsForMove(Entity **targetsArray, Entity *attacker, Move *move);
s32 SetNewTarget(s32 targetArrId, Entity **targetsArray, s32 targetFlags_, Entity *attacker, Entity *target, Move *move, bool32 canHitAnyone_);
s32 sub_8057070(Move *move);
bool8 MoveCausesPaused(Move *move);
bool8 MoveMatchesBideClassStatus(Entity *pokemon, Move *move);
bool8 IsChargingAnyTwoTurnMove(Entity *pokemon, bool8 checkCharge);
u32 sub_8057144(Entity * pokemon);
bool8 sub_80571F0(Entity * pokemon, Move *move);
bool8 sub_805727C(Entity * pokemon, Entity * target, s32 chance);
bool8 RollSecondaryEffect(Entity *pokemon, s32 chance);
bool8 CanAIUseMove(Entity *pokemon, s32 moveIndex, bool8 hasPPChecker);
bool8 CanMonsterUseMove(Entity *pokemon, Move *move, bool8 hasPPChecker);
bool8 sub_805744C(Entity * pokemon, Move *move, bool8 param_3);
void SortTargets(Entity **targetsArray, Entity *attacker);
bool8 MoveRequiresCharging(Entity* pokemon, u16 moveID);
void sub_8057588(Entity * pokemon, u8 param_2);
s16 sub_8057600(Move *move, s32 itemID);
#endif

View File

@@ -1,19 +0,0 @@
#ifndef GUARD_DUNGEON_MOVEMENT
#define GUARD_DUNGEON_MOVEMENT
#include "structs/dungeon_entity.h"
#include "structs/map.h"
extern u8 gWalkableTileToCrossableTerrain[8];
u8 GetCrossableTerrain(s16 species);
u8 sub_807034C(s32 id, const Tile *tile);
u8 sub_80703A0(Entity *pokemon, DungeonPos *pos);
bool8 CanCrossWalls(Entity *pokemon);
bool8 sub_807049C(Entity *pokemon, DungeonPos *pos);
bool8 sub_8070564(Entity *pokemon, DungeonPos *pos);
bool8 sub_80705F0(Entity *pokemon, DungeonPos *pos);
bool8 sub_80706A4(Entity *pokemon, DungeonPos *pos);
s32 CalcSpeedStage(Entity *pokemon);
#endif

View File

@@ -1,21 +0,0 @@
#ifndef GUARD_DUNGEON_POKEMON_ATTRIBUTES_H
#define GUARD_DUNGEON_POKEMON_ATTRIBUTES_H
#include "structs/dungeon_entity.h"
bool8 HasSafeguardStatus(Entity * param_1, Entity * param_2, bool8 displayMessage);
bool8 sub_8071728(Entity * pokemon, Entity * target, bool8 displayMessage);
bool8 sub_80717A4(Entity *pokemon, u16 moveID);
bool8 AbilityIsActive(Entity *pokemon, u8 ability);
bool8 MonsterIsType(Entity *pokemon, u8 type);
bool8 CanSeeInvisibleMonsters(Entity *pokemon);
bool8 IsTacticSet(Entity *pokemon, u8 tactic);
bool8 IQSkillIsEnabled(Entity *pokemon, u8 IQSkill);
void LoadIQSkills(Entity *pokemon);
bool8 CanSeeTeammate(Entity * pokemon);
u8 GetMoveTypeForMonster(Entity *pokemon, Move *pokeMove);
s32 GetMovePower(Entity *pokemon, Move *pokeMove);
bool8 MonsterCanThrowItems(EntityInfo *pokemon);
bool8 SetVisualFlags(EntityInfo *entityInfo, u16 newFlag, bool8 param_3);
#endif

857
include/dungeon_strings.h Normal file
View File

@@ -0,0 +1,857 @@
#ifndef GUARD_DUNGEON_STRINGS_H
#define GUARD_DUNGEON_STRINGS_H
#include "structs/str_item_text.h"
#include "constants/trap.h"
#include "constants/weather.h"
struct Struct_80F7C50
{
const u8 *str;
s32 val;
};
struct TutorialFlagMsg
{
s32 flagId;
const u8 *str;
};
extern const ItemText gActions[];
extern const struct Struct_80F7C50 gUnknown_80F7C50[];
extern const u8 *const gUnknown_80F7F70[];
extern const u8 *const gUnknown_80F8104[];
extern const u8 *const gTrapDescriptions[NUM_TRAPS];
extern const u8 *const gUnknown_80F8968;
extern const u8 *const gUnknown_80F8974;
extern const u8 *const gUnknown_80F8988;
extern const u8 *const gUnknown_80F8994;
extern const u8 *const gUnknown_80F89B4;
extern const u8 *const gUnknown_80F89D4;
extern const u8 *const gUnknown_80F89D8;
extern const u8 *const gUnknown_80F89F4;
extern const u8 *const gUnknown_80F8A0C;
extern const u8 *const gUnknown_80F8A28;
extern const u8 *const gUnknown_80F8A4C;
extern const u8 *const gUnknown_80F8A6C;
extern const u8 *const gUnknown_80F8A84;
extern const u8 *const gUnknown_80F8AB0;
extern const u8 *const gUnknown_80F8ADC;
extern const u8 *const gUnknown_80F8B0C;
extern const u8 *const gUnknown_80F8B24;
extern const u8 *const gUnknown_80F8B40;
extern const u8 *const gUnknown_80F8B64;
extern const u8 *const gUnknown_80F8B68;
extern const u8 *const gUnknown_80F8B88;
extern const u8 *const gUnknown_80F8BB4;
extern const u8 *const gUnknown_80F8BE0;
extern const u8 *const gUnknown_80F8BE4;
extern const u8 *const gItemStickyCannotMove1;
extern const u8 *const gItemStickyCannotMove2;
extern const u8 *const gItemStickyCannotMove3;
extern const u8 *const gItemStickyCannotEquip;
extern const u8 *const gMonTookAndReturnedItem;
extern const u8 *const gUnknown_80F8CE4;
extern const u8 *const gUnknown_80F8CE8;
extern const u8 *const gUnknown_80F8D04;
extern const u8 *const gUnknown_80F8D20;
extern const u8 *const gUnknown_80F8D44;
extern const u8 *const gUnknown_80F8D60;
extern const u8 *const gUnknown_80F8D7C;
extern const u8 *const gUnknown_80F8DB4;
extern const u8 *const gUnknown_80F8DB8;
extern const u8 *const gUnknown_80F8DE0;
extern const u8 *const gUnknown_80F8E04;
extern const u8 *const gUnknown_80F8E28;
extern const u8 *const gUnknown_80F8E2C;
extern const u8 *const gNoExchangesHere;
extern const u8 *const gNothingCanBePutDownHere;
extern const u8 *const gSwappedGroundItem;
extern const u8 *const gMonThrewItem1;
extern const u8 *const gMonThrewItem2;
extern const u8 *const gCannotTalk;
extern const u8 *const gCannotFarewell;
extern const u8 *const gMonCringing;
extern const u8 *const gMonParalyzed;
extern const u8 *const gMonSteppedOnItem;
extern const u8 *const gMonTerrifiedCouldntPickUpItem;
extern const u8 *const gMonCouldntPickUpItem;
extern const u8 *const gPickedUpItem2;
extern const u8 *const gPickedUpItemToolbox;
extern const u8 *const gPickedUpItem;
extern const u8 *const gMonPickedUpItem2;
extern const u8 *const gMonPickedUpItemToolbox;
extern const u8 *const gMonPickedUpItem;
extern const u8 *const gSayFarewellQ;
extern const u8 *const gSendMonBackWithItemQ;
extern const u8 *const gSendMonBackQ;
extern const u8 *const gUnknown_80F9114;
extern const u8 *const gUnknown_80F913C;
extern const u8 *const gMonWentBack;
extern const u8 *const gMonDisappointedAndLeft;
extern const u8 *const gUnknown_80F9158;
extern const u8 *const gUnknown_80F9174;
extern const u8 *const gUnknown_80F9190;
extern const u8 *const gUnknown_80F91A8;
extern const u8 *const gUnknown_80F91C8;
extern const u8 *const gUnknown_80F91E0;
extern const u8 *const gUnknown_80F91EC;
extern const u8 *const gTrapNames[NUM_TRAPS];
extern const u8 *const gUnknown_80F9364;
extern const u8 *const gUnknown_80F9380;
extern const u8 *const gUnknown_80F9384;
extern const u8 *const gUnknown_80F93A4;
extern const u8 *const gUnknown_80F93C8;
extern const u8 *const gItemFellOnGround;
extern const u8 *const gItemFellInWater;
extern const u8 *const gItemBuried;
extern const u8 *const gItemLost;
extern const u8 *const gAllItemsLost;
extern const u8 *const gSeveralItemsLost;
extern const u8 *const gItemFellOutOfSight;
extern const u8 *const gUnknown_80F94C4;
extern const u8 *const gUnknown_80F94D8;
extern const u8 *const gUnknown_80F94F0;
extern const u8 *const gUnknown_80F9510;
extern const u8 *const gUnknown_80F9530;
extern const u8 *const gPtrFrozenMessage;
extern const u8 *const gPtrWrappedAroundMessage;
extern const u8 *const gPtrWrappedByMessage;
extern const u8 *const gPtrPausedMessage;
extern const u8 *const gPtrInfatuatedMessage;
extern const u8 *const gPtrBideMessage;
extern const u8 *const gUnknown_80F95EC;
extern const u8 *const gUnknown_80F9600;
extern const u8 *const gUnknown_80F9614;
extern const u8 *const gUnknown_80F9630;
extern const u8 *const gUnknown_80F9654;
extern const u8 *const gUnknown_80F9670;
extern const u8 *const gUnknown_80F9688;
extern const u8 *const gUnknown_80F96A8;
extern const u8 *const gUnknown_80F96BC;
extern const u8 *const gUnknown_80F96EC;
extern const u8 *const gUnknown_80F970C;
extern const u8 *const gUnknown_80F9728;
extern const u8 *const gUnknown_80F9740;
extern const u8 *const gUnknown_80F9760;
extern const u8 *const gUnknown_80F9764[];
extern const u8 *const gWeatherNames[WEATHER_COUNT];
extern const u8 *const gUnknown_80F9ACC;
extern const u8 *const gUnknown_80F9AEC;
extern const u8 *const gUnknown_80F9B10;
extern const u8 *const gUnknown_80F9B34;
extern const u8 *const gUnknown_80F9B58;
extern const u8 *const gUnknown_80F9B74;
extern const u8 *const gUnknown_80F9B94;
extern const u8 *const gUnknown_80F9BB0;
extern const u8 *const gUnknown_80F9BD8;
extern const u8 *const gUnknown_80F9C08;
extern const u8 *const gUnknown_80F9C2C;
extern const u8 *const gUnknown_80F9C4C;
extern const u8 *const gUnknown_80F9C70;
extern const u8 *const gUnknown_80F9C8C;
extern const u8 *const gUnknown_80F9CBC;
extern const u8 *const gUnknown_80F9CC0[];
extern const u8 *const gUnknown_80F9CEC[];
extern const u8 *const gUnknown_80F9D28[];
extern const u8 *const gUnknown_80F9D84[];
extern const u8 *const gUnknown_80F9D8C[];
extern const u8 *const gUnknown_80F9DAC[];
extern const u8 *const gUnknown_80F9DF0[];
extern const u8 *const gUnknown_80F9E44;
extern const u8 *const gUnknown_80F9E64;
extern const u8 *const gUnknown_80F9E80;
extern const u8 *const gUnknown_80F9E84;
extern const u8 *const gUnknown_80F9EC8;
extern const u8 *const gUnknown_80F9EEC;
extern const u8 *const gUnknown_80F9F04;
extern const u8 *const gUnknown_80F9F2C;
extern const u8 *const gUnknown_80F9FA4;
extern const u8 *const gUnknown_80F9FE8;
extern const u8 *const gUnknown_80F9FEC;
extern const u8 *const gUnknown_80FA004;
extern const u8 *const gUnknown_80FA030;
extern const u8 *const gUnknown_80FA058;
extern const u8 *const gUnknown_80FA090;
extern const u8 *const gUnknown_80FA0C8;
extern const u8 *const gUnknown_80FA0F0;
extern const u8 *const gUnknown_80FA120;
extern const u8 *const gUnknown_80FA124[];
extern const u8 *const gUnknown_80FA260;
extern const u8 *const gUnknown_80FA2B0;
extern const u8 *const gUnknown_80FA2F0;
extern const u8 *const gUnknown_80FA32C;
extern const u8 *const gUnknown_80FA36C;
extern const u8 *const gUnknown_80FA370;
extern const u8 *const gUnknown_80FA394;
extern const u8 *const gUnknown_80FA3B8;
extern const u8 *const gUnknown_80FA408;
extern const u8 *const gUnknown_80FA448;
extern const u8 *const gUnknown_80FA464;
extern const u8 *const gUnknown_80FA4D4;
extern const u8 *const gUnknown_80FA4D8;
extern const u8 *const gUnknown_80FA500;
extern const u8 *const gUnknown_80FA52C;
extern const u8 *const gUnknown_80FA530;
extern const u8 *const gUnknown_80FA54C;
extern const u8 *const gUnknown_80FA580;
extern const u8 *const gUnknown_80FA5B4;
extern const u8 *const gUnknown_80FA5B8;
extern const u8 *const gUnknown_80FA5F4;
extern const u8 *const gUnknown_80FA61C;
extern const u8 *const gUnknown_80FA638;
extern const u8 *const gUnknown_80FA658;
extern const u8 *const gUnknown_80FA67C;
extern const u8 *const gUnknown_80FA69C;
extern const u8 *const gUnknown_80FA6BC;
extern const u8 *const gUnknown_80FA6D4;
extern const u8 *const gUnknown_80FA6E8;
extern const u8 *const gUnknown_80FA708;
extern const u8 *const gUnknown_80FA70C;
extern const u8 *const gUnknown_80FA710;
extern const u8 *const gUnknown_80FA734;
extern const u8 *const gUnknown_80FA758;
extern const u8 *const gUnknown_80FA778;
extern const u8 *const gUnknown_80FA79C;
extern const u8 *const gUnknown_80FA7BC;
extern const u8 *const gUnknown_80FA7DC;
extern const u8 *const gUnknown_80FA800;
extern const u8 *const gUnknown_80FA81C;
extern const u8 *const gUnknown_80FA820;
extern const u8 *const gUnknown_80FA824;
extern const u8 *const gUnknown_80FA844;
extern const u8 *const gUnknown_80FA868;
extern const u8 *const gUnknown_80FA888;
extern const u8 *const gUnknown_80FA8A8;
extern const u8 *const gUnknown_80FA8BC;
extern const u8 *const gUnknown_80FA8E0;
extern const u8 *const gUnknown_80FA90C;
extern const u8 *const gUnknown_80FA934;
extern const u8 *const gUnknown_80FA95C;
extern const u8 *const gUnknown_80FA97C;
extern const u8 *const gUnknown_80FA9A0;
extern const u8 *const gUnknown_80FA9C0;
extern const u8 *const gUnknown_80FA9DC;
extern const u8 *const gUnknown_80FA9F4;
extern const u8 *const gUnknown_80FAA0C;
extern const u8 *const gUnknown_80FAA2C;
extern const u8 *const gUnknown_80FAA48;
extern const u8 *const gUnknown_80FAA68;
extern const u8 *const gUnknown_80FAA8C;
extern const u8 *const gUnknown_80FAAAC;
extern const u8 *const gPtrMonStoppedEnduringMessage;
extern const u8 *const gPtrMonMirrorMoveFadedMessage;
extern const u8 *const gPtrMonConversion2FailedMessage;
extern const u8 *const gPtrMonGaveUpVitalThrowMessage;
extern const u8 *const gUnknown_80FAB40;
extern const u8 *const gUnknown_80FAB6C;
extern const u8 *const gUnknown_80FAB90;
extern const u8 *const gUnknown_80FABBC;
extern const u8 *const gUnknown_80FABC0;
extern const u8 *const gUnknown_80FABD8;
extern const u8 *const gPtrMonNoLongerPetrifiedMessage;
extern const u8 *const gPtrMonNoLongerCringingMessage;
extern const u8 *const gUnknown_80FAC38;
extern const u8 *const gUnknown_80FAC54;
extern const u8 *const gUnknown_80FAC74;
extern const u8 *const gUnknown_80FAC88;
extern const u8 *const gUnknown_80FACA4;
extern const u8 *const gUnknown_80FACC4;
extern const u8 *const gUnknown_80FACE4;
extern const u8 *const gUnknown_80FACFC;
extern const u8 *const gUnknown_80FAD10;
extern const u8 *const gUnknown_80FAD2C;
extern const u8 *const gUnknown_80FAD4C;
extern const u8 *const gUnknown_80FAD6C;
extern const u8 *const gUnknown_80FAD8C;
extern const u8 *const gUnknown_80FADB0;
extern const u8 *const gUnknown_80FADD8;
extern const u8 *const gUnknown_80FAE00;
extern const u8 *const gUnknown_80FAE1C;
extern const u8 *const gUnknown_80FAE3C;
extern const u8 *const gUnknown_80FAE58;
extern const u8 *const gUnknown_80FAE7C;
extern const u8 *const gUnknown_80FAEA0;
extern const u8 *const gUnknown_80FAEC8;
extern const u8 *const gUnknown_80FAEF0;
extern const u8 *const gUnknown_80FAF1C;
extern const u8 *const gUnknown_80FAF3C;
extern const u8 *const gUnknown_80FAF5C;
extern const u8 *const gUnknown_80FAF8C;
extern const u8 *const gUnknown_80FAFAC;
extern const u8 *const gUnknown_80FAFD0;
extern const u8 *const gUnknown_80FAFF0;
extern const u8 *const gUnknown_80FB004;
extern const u8 *const gUnknown_80FB01C;
extern const u8 *const gUnknown_80FB048;
extern const u8 *const gUnknown_80FB074;
extern const u8 *const gUnknown_80FB09C;
extern const u8 *const gUnknown_80FB0C4;
extern const u8 *const gUnknown_80FB0E0;
extern const u8 *const gUnknown_80FB10C;
extern const u8 *const gUnknown_80FB130;
extern const u8 *const gUnknown_80FB160;
extern const u8 *const gUnknown_80FB17C;
extern const u8 *const gUnknown_80FB1A8;
extern const u8 *const gUnknown_80FB1C4;
extern const u8 *const gUnknown_80FB1E0;
extern const u8 *const gUnknown_80FB204;
extern const u8 *const gUnknown_80FB21C;
extern const u8 *const gUnknown_80FB240;
extern const u8 *const gUnknown_80FB25C;
extern const u8 *const gUnknown_80FB27C;
extern const u8 *const gUnknown_80FB2AC;
extern const u8 *const gUnknown_80FB2CC;
extern const u8 *const gUnknown_80FB2E0;
extern const u8 *const gUnknown_80FB300;
extern const u8 *const gUnknown_80FB318;
extern const u8 *const gUnknown_80FB31C;
extern const u8 *const gUnknown_80FB338;
extern const u8 *const gUnknown_80FB35C;
extern const u8 *const gUnknown_80FB360;
extern const u8 *const gUnknown_80FB380;
extern const u8 *const gUnknown_80FB384;
extern const u8 *const gUnknown_80FB388;
extern const u8 *const gUnknown_80FB3A4;
extern const u8 *const gUnknown_80FB3CC;
extern const u8 *const gUnknown_80FB3D0;
extern const u8 *const gUnknown_80FB3E0;
extern const u8 *const gUnknown_80FB3F8;
extern const u8 *const gUnknown_80FB414;
extern const u8 *const gUnknown_80FB418;
extern const u8 *const gUnknown_80FB41C;
extern const u8 *const gUnknown_80FB43C;
extern const u8 *const gUnknown_80FB458;
extern const u8 *const gUnknown_80FB480;
extern const u8 *const gUnknown_80FB4B0;
extern const u8 *const gUnknown_80FB4D4;
extern const u8 *const gUnknown_80FB4F0;
extern const u8 *const gUnknown_80FB50C;
extern const u8 *const gUnknown_80FB52C;
extern const u8 *const gUnknown_80FB548;
extern const u8 *const gUnknown_80FB564;
extern const u8 *const gUnknown_80FB580;
extern const u8 *const gUnknown_80FB598;
extern const u8 *const gUnknown_80FB5B4;
extern const u8 *const gUnknown_80FB5D4;
extern const u8 *const gUnknown_80FB5F8;
extern const u8 *const gUnknown_80FB610;
extern const u8 *const gUnknown_80FB628;
extern const u8 *const gUnknown_80FB64C;
extern const u8 *const gUnknown_80FB668;
extern const u8 *const gUnknown_80FB688;
extern const u8 *const gUnknown_80FB6A4;
extern const u8 *const gUnknown_80FB6C0;
extern const u8 *const gUnknown_80FB6D8;
extern const u8 *const gUnknown_80FB6FC;
extern const u8 *const gUnknown_80FB718;
extern const u8 *const gUnknown_80FB73C;
extern const u8 *const gUnknown_80FB764;
extern const u8 *const gUnknown_80FB780;
extern const u8 *const gUnknown_80FB7A0;
extern const u8 *const gUnknown_80FB7BC;
extern const u8 *const gUnknown_80FB7DC;
extern const u8 *const gUnknown_80FB7F4;
extern const u8 *const gUnknown_80FB810;
extern const u8 *const gUnknown_80FB834;
extern const u8 *const gUnknown_80FB85C;
extern const u8 *const gUnknown_80FB880;
extern const u8 *const gUnknown_80FB89C;
extern const u8 *const gUnknown_80FB8BC;
extern const u8 *const gUnknown_80FB8E4;
extern const u8 *const gUnknown_80FB900;
extern const u8 *const gUnknown_80FB924;
extern const u8 *const gUnknown_80FB940;
extern const u8 *const gUnknown_80FB960;
extern const u8 *const gUnknown_80FB978;
extern const u8 *const gUnknown_80FB994;
extern const u8 *const gUnknown_80FB9B0;
extern const u8 *const gUnknown_80FB9D8;
extern const u8 *const gUnknown_80FB9F0;
extern const u8 *const gUnknown_80FBA14;
extern const u8 *const gUnknown_80FBA38;
extern const u8 *const gUnknown_80FBA60;
extern const u8 *const gUnknown_80FBA80;
extern const u8 *const gUnknown_80FBAA0;
extern const u8 *const gUnknown_80FBAC0;
extern const u8 *const gUnknown_80FBAE4;
extern const u8 *const gUnknown_80FBB04;
extern const u8 *const gUnknown_80FBB28;
extern const u8 *const gUnknown_80FBB4C;
extern const u8 *const gUnknown_80FBB78;
extern const u8 *const gUnknown_80FBB94;
extern const u8 *const gUnknown_80FBBB8;
extern const u8 *const gUnknown_80FBBD4;
extern const u8 *const gUnknown_80FBBF0;
extern const u8 *const gUnknown_80FBC14;
extern const u8 *const gUnknown_80FBC38;
extern const u8 *const gUnknown_80FBC5C;
extern const u8 *const gUnknown_80FBC7C;
extern const u8 *const gUnknown_80FBCA4;
extern const u8 *const gUnknown_80FBCC8;
extern const u8 *const gUnknown_80FBCF0;
extern const u8 *const gUnknown_80FBD18;
extern const u8 *const gUnknown_80FBD3C;
extern const u8 *const gUnknown_80FBD58;
extern const u8 *const gUnknown_80FBD78;
extern const u8 *const gUnknown_80FBD9C;
extern const u8 *const gUnknown_80FBDC4;
extern const u8 *const gUnknown_80FBDF0;
extern const u8 *const gUnknown_80FBE14;
extern const u8 *const gUnknown_80FBE3C;
extern const u8 *const gUnknown_80FBE40;
extern const u8 *const gUnknown_80FBE64;
extern const u8 *const gUnknown_80FBE84;
extern const u8 *const gUnknown_80FBEA0;
extern const u8 *const gUnknown_80FBEC0;
extern const u8 *const gUnknown_80FBEE4;
extern const u8 *const gUnknown_80FBF04;
extern const u8 *const gUnknown_80FBF28;
extern const u8 *const gUnknown_80FBF50;
extern const u8 *const gUnknown_80FBF68;
extern const u8 *const gUnknown_80FBF84;
extern const u8 *const gUnknown_80FBF9C;
extern const u8 *const gUnknown_80FBFB8;
extern const u8 *const gUnknown_80FBFD8;
extern const u8 *const gUnknown_80FC000;
extern const u8 *const gUnknown_80FC028;
extern const u8 *const gUnknown_80FC054;
extern const u8 *const gUnknown_80FC074;
extern const u8 *const gUnknown_80FC084;
extern const u8 *const gUnknown_80FC090;
extern const u8 *const gUnknown_80FC09C;
extern const u8 *const gUnknown_80FC0AC;
extern const u8 *const gUnknown_80FC0B8;
extern const u8 *const gUnknown_80FC0C8;
extern const u8 *const gUnknown_80FC0D4;
extern const u8 *const gUnknown_80FC0E4;
extern const u8 *const gUnknown_80FC0FC;
extern const u8 *const gUnknown_80FC114;
extern const u8 *const gUnknown_80FC118;
extern const u8 *const gUnknown_80FC11C;
extern const u8 *const gUnknown_80FC138;
extern const u8 *const gUnknown_80FC13C;
extern const u8 *const gUnknown_80FC158;
extern const u8 *const gUnknown_80FC15C;
extern const u8 *const gUnknown_80FC180;
extern const u8 *const gUnknown_80FC184;
extern const u8 *const gUnknown_80FC1A4;
extern const u8 *const gUnknown_80FC1C4;
extern const u8 *const gUnknown_80FC1F0;
extern const u8 *const gUnknown_80FC218;
extern const u8 *const gUnknown_80FC21C;
extern const u8 *const gUnknown_80FC248;
extern const u8 *const gUnknown_80FC270;
extern const u8 *const gUnknown_80FC274;
extern const u8 *const gUnknown_80FC298;
extern const u8 *const gUnknown_80FC2B8;
extern const u8 *const gUnknown_80FC2D8;
extern const u8 *const gUnknown_80FC2FC;
extern const u8 *const gUnknown_80FC31C;
extern const u8 *const gUnknown_80FC33C;
extern const u8 *const gUnknown_80FC360;
extern const u8 *const gUnknown_80FC388;
extern const u8 *const gUnknown_80FC3B4;
extern const u8 *const gUnknown_80FC3D8;
extern const u8 *const gUnknown_80FC3FC;
extern const u8 *const gUnknown_80FC428;
extern const u8 *const gUnknown_80FC454;
extern const u8 *const gUnknown_80FC458;
extern const u8 *const gUnknown_80FC47C;
extern const u8 *const gUnknown_80FC4A4;
extern const u8 *const gUnknown_80FC4D0;
extern const u8 *const gUnknown_80FC52C;
extern const u8 *const gUnknown_80FC558;
extern const u8 *const gUnknown_80FC574;
extern const u8 *const gUnknown_80FC584;
extern const u8 *const gUnknown_80FC5A8;
extern const u8 *const gUnknown_80FC5CC;
extern const u8 *const gUnknown_80FC5E0;
extern const u8 *const gUnknown_80FC5F8;
extern const u8 *const gUnknown_80FC5FC;
extern const u8 *const gUnknown_80FC614;
extern const u8 *const gUnknown_80FC654;
extern const u8 *const gUnknown_80FC678;
extern const u8 *const gUnknown_80FC690;
extern const u8 *const gUnknown_80FC6A4;
extern const u8 *const gUnknown_80FC6A8;
extern const u8 *const gUnknown_80FC6D0;
extern const u8 *const gUnknown_80FC6FC;
extern const u8 *const gUnknown_80FC710;
extern const u8 *const gUnknown_80FC714;
extern const u8 *const gUnknown_80FC718;
extern const u8 *const gUnknown_80FC72C;
extern const u8 *const gUnknown_80FC730;
extern const u8 *const gUnknown_80FC734;
extern const u8 *const gUnknown_80FC74C;
extern const u8 *const gUnknown_80FC770;
extern const u8 *const gUnknown_80FC790;
extern const u8 *const gUnknown_80FC7AC;
extern const u8 *const gUnknown_80FC7C8;
extern const u8 *const gUnknown_80FC7EC;
extern const u8 *const gUnknown_80FC81C;
extern const u8 *const gUnknown_80FC854;
extern const u8 *const gUnknown_80FC888;
extern const u8 *const gUnknown_80FC8C0;
extern const u8 *const gUnknown_80FC8F0;
extern const u8 *const gUnknown_80FC920;
extern const u8 *const gUnknown_80FC924;
extern const u8 *const gUnknown_80FC97C;
extern const u8 *const gUnknown_80FC9A0;
extern const u8 *const gUnknown_80FC9C0;
extern const u8 *const gUnknown_80FC9E8;
extern const u8 *const gUnknown_80FCA10;
extern const u8 *const gUnknown_80FCA3C;
extern const u8 *const gUnknown_80FCA60;
extern const u8 *const gUnknown_80FCA64;
extern const u8 *const gUnknown_80FCA90;
extern const u8 *const gUnknown_80FCAC0;
extern const u8 *const gUnknown_80FCAE8;
extern const u8 *const gUnknown_80FCB14;
extern const u8 *const gUnknown_80FCB40;
extern const u8 *const gUnknown_80FCB70;
extern const u8 *const gUnknown_80FCB98;
extern const u8 *const gUnknown_80FCBCC;
extern const u8 *const gUnknown_80FCBF8;
extern const u8 *const gUnknown_80FCC18;
extern const u8 *const gUnknown_80FCC4C;
extern const u8 *const gUnknown_80FCC7C;
extern const u8 *const gUnknown_80FCCAC;
extern const u8 *const gUnknown_80FCCB0;
extern const u8 *const gUnknown_80FCCE4;
extern const u8 *const gUnknown_80FCCE8;
extern const u8 *const gUnknown_80FCD0C;
extern const u8 *const gUnknown_80FCD28;
extern const u8 *const gUnknown_80FCD54;
extern const u8 *const gUnknown_80FCD58;
extern const u8 *const gUnknown_80FCD88;
extern const u8 *const gUnknown_80FCDB4;
extern const u8 *const gUnknown_80FCDE0;
extern const u8 *const gUnknown_80FCE00;
extern const u8 *const gUnknown_80FCE34;
extern const u8 *const gUnknown_80FCE5C;
extern const u8 *const gUnknown_80FCE84;
extern const u8 *const gUnknown_80FCEB0;
extern const u8 *const gUnknown_80FCEDC;
extern const u8 *const gUnknown_80FCEFC;
extern const u8 *const gUnknown_80FCF18;
extern const u8 *const gUnknown_80FCF38;
extern const u8 *const gUnknown_80FCF50;
extern const u8 *const gUnknown_80FCF74;
extern const u8 *const gUnknown_80FCF78;
extern const u8 *const gUnknown_80FCF7C;
extern const u8 *const gUnknown_80FCF80;
extern const u8 *const gUnknown_80FCFA4;
extern const u8 *const gUnknown_80FCFBC;
extern const u8 *const gUnknown_80FCFE4;
extern const u8 *const gUnknown_80FD018;
extern const u8 *const gUnknown_80FD040;
extern const u8 *const gUnknown_80FD05C;
extern const u8 *const gUnknown_80FD060;
extern const u8 *const gUnknown_80FD08C;
extern const u8 *const gUnknown_80FD0B4;
extern const u8 *const gUnknown_80FD0B8;
extern const u8 *const gUnknown_80FD0BC;
extern const u8 *const gUnknown_80FD0DC;
extern const u8 *const gUnknown_80FD0E0;
extern const u8 *const gUnknown_80FD0E4;
extern const u8 *const gUnknown_80FD104;
extern const u8 *const gUnknown_80FD128;
extern const u8 *const gUnknown_80FD14C;
extern const u8 *const gUnknown_80FD170;
extern const u8 *const gUnknown_80FD18C;
extern const u8 *const gUnknown_80FD1B0;
extern const u8 *const gUnknown_80FD1CC;
extern const u8 *const gUnknown_80FD1EC;
extern const u8 *const gUnknown_80FD20C;
extern const u8 *const gUnknown_80FD22C;
extern const u8 *const gUnknown_80FD254;
extern const u8 *const gUnknown_80FD27C;
extern const u8 *const gUnknown_80FD294;
extern const u8 *const gUnknown_80FD2B4;
extern const u8 *const gUnknown_80FD2CC;
extern const u8 *const gUnknown_80FD2DC;
extern const u8 *const gUnknown_80FD2F8;
extern const u8 *const gUnknown_80FD320;
extern const u8 *const gUnknown_80FD350;
extern const u8 *const gUnknown_80FD370;
extern const u8 *const gUnknown_80FD3A0;
extern const u8 *const gUnknown_80FD3C8;
extern const u8 *const gUnknown_80FD3CC;
extern const u8 *const gUnknown_80FD3D0;
extern const u8 *const gUnknown_80FD3F0;
extern const u8 *const gUnknown_80FD40C;
extern const u8 *const gUnknown_80FD430;
extern const u8 *const gUnknown_80FD434;
extern const u8 *const gUnknown_80FD450;
extern const u8 *const gUnknown_80FD454;
extern const u8 *const gUnknown_80FD46C;
extern const u8 *const gUnknown_80FD484;
extern const u8 *const gUnknown_80FD4B0;
extern const u8 *const gUnknown_80FD4C4;
extern const u8 *const gUnknown_80FD4DC;
extern const u8 *const gUnknown_80FD500;
extern const u8 *const gUnknown_80FD524;
extern const u8 *const gUnknown_80FD548;
extern const u8 *const gUnknown_80FD54C;
extern const u8 *const gUnknown_80FD550;
extern const u8 *const gUnknown_80FD574;
extern const u8 *const gUnknown_80FD578;
extern const u8 *const gUnknown_80FD57C;
extern const u8 *const gUnknown_80FD594;
extern const u8 *const gUnknown_80FD5B8;
extern const u8 *const gUnknown_80FD5DC;
extern const u8 *const gUnknown_80FD608;
extern const u8 *const gUnknown_80FD628;
extern const u8 *const gUnknown_80FD644;
extern const u8 *const gUnknown_80FD648[];
extern const u8 *const gUnknown_80FD6E8[];
extern const u8 *const gUnknown_80FD788;
extern const u8 *const gUnknown_80FD7AC;
extern const u8 *const gUnknown_80FD7D4;
extern const u8 *const gUnknown_80FD7F4;
extern const u8 *const gSteppedOnTrapStrings[NUM_TRAPS];
extern const u8 *const gUnknown_80FDA80;
extern const u8 *const gUnknown_80FDAA0;
extern const u8 *const gUnknown_80FDACC;
extern const u8 *const gUnknown_80FDAE4;
extern const u8 *const gUnknown_80FDB04;
extern const u8 *const gUnknown_80FDB2C;
extern const u8 *const gUnknown_80FDB5C;
extern const u8 *const gUnknown_80FDB7C;
extern const u8 *const gUnknown_80FDBA0;
extern const u8 *const gUnknown_80FDBB8;
extern const u8 *const gUnknown_80FDBD0;
extern const u8 *const gUnknown_80FDBF0;
extern const u8 *const gUnknown_80FDC18;
extern const u8 *const gUnknown_80FDC40;
extern const u8 *const gUnknown_80FDC7C;
extern const u8 *const gUnknown_80FDC9C;
extern const u8 *const gUnknown_80FDCA0;
extern const u8 *const gUnknown_80FDCA4;
extern const u8 *const gUnknown_80FDCC8;
extern const u8 *const gUnknown_80FDCE4;
extern const u8 *const gUnknown_80FDD00;
extern const u8 *const gUnknown_80FDD20;
extern const u8 *const gUnknown_80FDD48;
extern const u8 *const gUnknown_80FDD88;
extern const u8 *const gUnknown_80FDDA8;
extern const u8 *const gUnknown_80FDDAC;
extern const u8 *const gUnknown_80FDDD0;
extern const u8 *const gUnknown_80FDDF0;
extern const u8 *const gUnknown_80FDE18;
extern const u8 *const gUnknown_80FDE6C;
extern const u8 *const gUnknown_80FDEB8;
extern const u8 *const gUnknown_80FDF00;
extern const u8 *const gUnknown_80FDF40;
extern const u8 *const gUnknown_80FDF70;
extern const u8 *const gUnknown_80FDFB8;
extern const u8 *const gUnknown_80FDFE8;
extern const u8 *const gUnknown_80FE008;
extern const u8 *const gUnknown_80FE034;
extern const u8 *const gUnknown_80FE060;
extern const u8 *const gUnknown_80FE0AC;
extern const u8 *const gUnknown_80FE0F4;
extern const u8 *const gUnknown_80FE0F8;
extern const u8 *const gUnknown_80FE134;
extern const u8 *const gUnknown_80FE168;
extern const u8 *const gUnknown_80FE1A4;
extern const u8 *const gUnknown_80FE20C;
extern const u8 *const gUnknown_80FE268;
extern const u8 *const gUnknown_80FE28C;
extern const u8 *const gUnknown_80FE2D0;
extern const u8 *const gUnknown_80FE2EC;
extern const u8 *const gPtrItsaMonsterHouseMessage;
extern const u8 *const gUnknown_80FE330;
extern const u8 *const gUnknown_80FE36C;
extern const u8 *const gUnknown_80FE38C;
extern const u8 *const gUnknown_80FE3BC;
extern const u8 *const gItemStickyDoesntWorkText;
extern const u8 *const gUnknown_80FE3EC;
extern const u8 *const gUnknown_80FE40C;
extern const u8 *const gUnknown_80FE434;
extern const u8 *const gUnknown_80FE454;
extern const u8 *const gUnknown_80FE458;
extern const u8 *const gUnknown_80FE478;
extern const u8 *const gUnknown_80FE4B8;
extern const u8 *const gUnknown_80FE4D4;
extern const u8 *const gUnknown_80FE4F4;
extern const u8 *const gUnknown_80FE520;
extern const u8 *const gUnknown_80FE568;
extern const u8 *const gUnknown_80FE5C0;
extern const u8 *const gUnknown_80FE5F0;
extern const u8 *const gUnknown_80FE63C;
extern const u8 *const gUnknown_80FE65C;
extern const u8 *const gUnknown_80FE674;
extern const u8 *const gUnknown_80FE690;
extern const u8 *const gUnknown_80FE6B4;
extern const u8 *const gUnknown_80FE6D4;
extern const u8 *const gUnknown_80FE6E8;
extern const u8 *const gUnknown_80FE6F4;
extern const u8 *const gUnknown_80FE708;
extern const u8 *const gUnknown_80FE70C;
extern const u8 *const gUnknown_80FE720;
extern const u8 *const gUnknown_80FE724;
extern const u8 *const gOptionsDungeonTextPtr;
extern const u8 *const gOptionsOthersTextPtr;
extern const u8 *const gUnknown_80FE748;
extern const u8 *const gUnknown_80FE764;
extern const u8 *const gUnknown_80FE788;
extern const u8 *const gUnknown_80FE7A8;
extern const u8 *const gUnknown_80FE7C0;
extern const u8 *const gUnknown_80FE7E4;
extern const u8 *const gOptionsWindowColorPtr;
extern const u8 *const gDsTopScreenOptions[];
extern const u8 *const gDsBottomScreenOptions[];
extern const u8 *const gGameOptionsTextPtr;
extern const u8 *const gUnknown_80FE8F4;
extern const u8 *const gUnknown_80FE8F8;
extern const u8 *const gTeamToolboxAPtr;
extern const u8 *const gTeamToolboxBPtr;
extern const u8 *const gFieldItemMenuGroundTextPtr;
extern const u8 *const gUnknown_80FE940;
extern const u8 *const gWhichTextPtr1;
extern const u8 *const gWhichTextPtr2;
extern const u8 *const gUnknown_80FE954;
extern const u8 *const gUnknown_80FE95C;
extern const u8 *const gUnknown_80FE960;
extern const u8 *const gUnknown_80FE964;
extern const u8 *const gUnknown_80FE978;
extern const u8 *const gFieldMenuMovesPtr;
extern const u8 *const gFieldMenuItemsPtr;
extern const u8 *const gFieldMenuTeamPtr;
extern const u8 *const gFieldMenuOthersPtr;
extern const u8 *const gFieldMenuGroundPtr;
extern const u8 *const gUnknown_80FE9CC;
extern const u8 *const gUnknown_80FE9E8;
extern const u8 *const gUnknown_80FE9F8;
extern const u8 *const gUnknown_80FEA10;
extern const u8 *const gUnknown_80FEA28;
extern const u8 *const gUnknown_80FEA44;
extern const u8 *const gUnknown_80FEA50;
extern const u8 *const gUnknown_80FEA68;
extern const u8 *const gUnknown_80FEA80;
extern const u8 *const gUnknown_80FEA8C;
extern const u8 *const gUnknown_80FEAC4;
extern const u8 *const gUnknown_80FEAE8;
extern const u8 *const gUnknown_80FEB08;
extern const u8 *const gUnknown_80FEB30;
extern const u8 *const gUnknown_80FEB60;
extern const u8 *const gUnknown_80FEB88;
extern const u8 *const gUnknown_80FEB8C;
extern const u8 *const gUnknown_80FEB90;
extern const u8 *const gUnknown_80FEBBC;
extern const u8 *const gUnknown_80FEBDC;
extern const u8 *const gUnknown_80FEBF8;
extern const u8 *const gUnknown_80FEC28;
extern const u8 *const gUnknown_80FEC48;
extern const u8 *const gUnknown_80FEC7C;
extern const u8 *const gUnknown_80FECA0;
extern const u8 *const gUnknown_80FECBC;
extern const u8 *const gUnknown_80FECE0;
extern const u8 *const gUnknown_80FED00;
extern const u8 *const gUnknown_80FED04;
extern const u8 *const gUnknown_80FED08;
extern const u8 *const gUnknown_80FED0C;
extern const u8 *const gUnknown_80FED30;
extern const u8 *const gUnknown_80FED34;
extern const u8 *const gUnknown_80FED68;
extern const u8 *const gUnknown_80FED88;
extern const u8 *const gUnknown_80FEDA8;
extern const u8 *const gUnknown_80FEDC8;
extern const u8 *const gUnknown_80FEDE8;
extern const u8 *const gUnknown_80FEE04;
extern const u8 *const gUnknown_80FEE2C;
extern const u8 *const gUnknown_80FEE54;
extern const u8 *const gUnknown_80FEE80;
extern const u8 *const gUnknown_80FEEA4;
extern const u8 *const gUnknown_80FEEC8;
extern const u8 *const gUnknown_80FEEEC;
extern const u8 *const gUnknown_80FEF0C;
extern const u8 *const gUnknown_80FEF30;
extern const u8 *const gUnknown_80FEF4C;
extern const u8 *const gUnknown_80FEF50;
extern const u8 *const gUnknown_80FEF54;
extern const u8 *const gUnknown_80FEF74;
extern const u8 *const gUnknown_80FEF98;
extern const u8 *const gUnknown_80FEFD0;
extern const u8 *const gUnknown_80FEFF4;
extern const u8 *const gUnknown_80FF01C;
extern const struct TutorialFlagMsg gUnknown_80FF020;
extern const struct TutorialFlagMsg gUnknown_80FF080;
extern const struct TutorialFlagMsg gUnknown_80FF0D8;
extern const struct TutorialFlagMsg gUnknown_80FF13C;
extern const struct TutorialFlagMsg gUnknown_80FF1B4;
extern const struct TutorialFlagMsg gMovementTutorial;
extern const struct TutorialFlagMsg gHungerTutorial;
extern const struct TutorialFlagMsg gFoodTutorial;
extern const struct TutorialFlagMsg gOranTutorial;
extern const struct TutorialFlagMsg gCheriTutorial;
extern const struct TutorialFlagMsg gBlastSeedTutorial;
extern const struct TutorialFlagMsg gUnknown_80FF4A0;
extern const struct TutorialFlagMsg gPechaTutorial;
extern const struct TutorialFlagMsg gSleepSeedTutorial;
extern const struct TutorialFlagMsg gMoneyTutorial;
extern const u8 *const gUnknown_80FF674;
extern const u8 *const gUnknown_80FF678;
extern const u8 *const gUnknown_80FF6A4;
extern const u8 *const gUnknown_80FF6F8;
extern const u8 *const gUnknown_80FF730;
extern const u8 *const gUnknown_80FF76C;
extern const u8 *const gText_Hints;
extern const u8 *const gHintsNames[];
enum
{
HINTS_CONTROLS,
HINTS_ORIENTATION,
HINTS_SEEDS,
HINTS_MOVES,
HINTS_RANGE,
HINTS_LINKING_MOVES,
HINTS_POKEMON_TYPES,
HINTS_TOUCH_SCREEN,
HINTS_COUNT,
};
#define HINTS_COUNT_RED_VERSION HINTS_COUNT - 1 // No Touch Screen Hints in Red
extern const u8 *const gHintsDescriptions[2][HINTS_COUNT];
extern const u8 *const gUnknown_8100208;
extern const u8 *const gPtrMagnitudeMessage;
extern const u8 *const gPtrSleepingTargetOnlyMessage;
extern const u8 *const gPtrFeralFoundItemMessage;
extern const u8 *const gPtrSelfHealPreventedHungerMessage;
extern const u8 *const gUnknown_81002B8;
extern const u8 *const gPtrFinalChanceMessage;
extern const u8 *const gPtrLinkedMovesComeApartMessage;
extern const u8 *const gPtrLinkMoveOneUseWarningMessage;
extern const u8 *const gPtrLinkMoveTwoUsesWarningMessage;
extern const u8 *const gPtrIcePartCrumbledMessage;
extern const u8 *const gPtrRockPartCrumbledMessage;
extern const u8 *const gPtrSteelPartCrumbledMessage;
extern const u8 *const gPtrWishStoneCrumbledMessage;
extern const u8 *const gPtrMusicBoxPlayedCrumbledMessage;
extern const u8 *const gPtrMysteriousPowerPreventedUseMessage;
extern const u8 *const gPtrCouldntBeUsedMessage;
extern const u8 *const gUnknown_81004E8;
extern const u8 *const gUnknown_81004EC;
extern const u8 *const gUnknown_81004F0;
extern const u8 *const gUnknown_8100524;
extern const u8 *const gUnknown_8100548;
extern const u8 *const gUnknown_810056C;
extern const u8 *const gUnknown_8100594;
extern const u8 *const gPtrExposedWoreOffMessage;
extern const u8 *const gPtrSealedMoveReleasedMessage;
extern const u8 *const gPtrCantLeechSeedSelfMessage;
extern const u8 *const gPtrCantLeechSeedMonMessage;
extern const u8 *const gPtrMoveInterruptedMessage;
extern const u8 *const gPtrClientFaintedMessage;
extern const u8 *const gPtrCantUseInDungeonMessage;
extern const u8 *const gPtrForecastPreventsTypeSwitchMessage;
extern const u8 *const gPtrForecastPreventsConversion2Message;
extern const u8 *const gPtrStenchWavedOffMessage;
extern const u8 *const gPtrProtectSavedItMessage;
#endif

View File

@@ -9,6 +9,11 @@
extern const DungeonPos gAdjacentTileOffsets[NUM_DIRECTIONS];
static inline EntityInfo *GetEntInfo(Entity *entity)
{
return entity->axObj.info.monster;
}
bool8 EntityIsValid(Entity *pokemon);
u32 GetEntityType(Entity *entity);
u8 GetEntityRoom(Entity *entity);
@@ -16,14 +21,19 @@ Tile *GetTileAtEntitySafe(Entity *entity);
void sub_804535C(Entity *entity, PixelPos *pos);
void SetEntityPixelPos(Entity *entity, s32 x, s32 y);
void IncreaseEntityPixelPos(Entity *entity, s32 x, s32 y);
static inline EntityInfo *GetEntInfo(Entity *entity)
{
return entity->axObj.info.monster;
}
Item *GetItemData(Entity *entity);
Item *GetItemData_1(Entity *entity);
Trap *GetTrapData(Entity *entity);
Trap* GetTrapData_1(Entity *entity);
Entity *SpawnTrap(u8 trapID, DungeonPos *pos, u8 c);
Entity *sub_8045708(DungeonPos *pos);
void sub_80457DC(Entity* ent);
bool8 CanSeeTarget(Entity *entity, Entity *targetEntity);
bool8 CanTargetEntity(Entity *entity, Entity *targetEntity);
bool8 sub_8045A70(Entity *entity, Entity *targetEntity);
bool8 sub_8045AAC(Entity *entity, DungeonPos *pos);
bool8 CanTargetPosition(Entity *entity, DungeonPos *pos);
void SubstitutePlaceholderStringTags(u8 *buffer, Entity *entity, u32 param_3);
void sub_8045ACC(void);
#endif // GUARD_DUNGEON_UTIL_H

View File

@@ -1,12 +0,0 @@
#ifndef GUARD_DUNGEON_VISIBILITY_H
#define GUARD_DUNGEON_VISIBILITY_H
#include "structs/dungeon_entity.h"
bool8 CanSeeTarget(Entity *entity, Entity *targetEntity);
bool8 CanTargetEntity(Entity *entity, Entity *targetEntity);
bool8 sub_8045A70(Entity *entity, Entity *targetEntity);
bool8 sub_8045AAC(Entity *entity, DungeonPos *pos);
bool8 CanTargetPosition(Entity *entity, DungeonPos *pos);
#endif

View File

@@ -47,7 +47,7 @@ s24_8 FP24_8_Hypot(s24_8 x, s24_8 y);
void FP48_16_FromS32(s48_16 *dst, s32 src);
u32 FP48_16_ToS32(s48_16 *a);
void FP48_16_FromF248(s48_16 *a, s24_8 b);
bool8 FP48_16_SLessThan(s48_16 *a, s48_16 *b);
bool8 FP48_16_SLessThan(const s48_16 *a, const s48_16 *b);
void FP48_16_Add(s48_16 *dst, s48_16 *a, s48_16 *b);
void FP48_16_Subtract(s48_16 *dst, s48_16 *a, s48_16 *b);

View File

@@ -16,7 +16,7 @@ void BurnedStatusTarget(Entity * pokemon, Entity * target, u8 param_3, bool8 dis
void PoisonedStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage);
void BadlyPoisonedStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage);
void FrozenStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage);
void SqueezedStatusTarget(Entity * pokemon, Entity * target, s16 param_3, bool32 displayMessage);
void SqueezedStatusTarget(Entity * pokemon, Entity * target, s32 param_3, bool32 displayMessage);
void ImmobilizedStatusTarget(Entity * pokemon, Entity * target);
void IngrainedStatusTarget(Entity * pokemon, Entity * target);
void WrapTarget(Entity * pokemon, Entity * target);

View File

@@ -89,6 +89,11 @@ void sub_8094060(Move *srcMoves, Move *destMoves);
void WritePoke2MovesBits(DataSerializer *, struct Moves *);
void ReadPoke2MovesBits(DataSerializer *, struct Moves *);
static inline void ResetMoveFlags(Move *move)
{
move->moveFlags = 0;
}
static inline bool8 MoveFlagExists(Move *move)
{
return (move->moveFlags & MOVE_FLAG_EXISTS) != 0;

30
include/run_dungeon.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef GUARD_RUN_DUNGEON_H
#define GUARD_RUN_DUNGEON_H
#include "structs/str_dungeon_8042F6C.h"
struct UnkStruct_203B414
{
s32 unk0;
s32 unk4;
s32 unk8;
s32 unkC[16];
s32 unk4C[16];
struct DungeonPos unk8C[16];
};
extern struct UnkStruct_203B414 *gUnknown_203B414;
void RunDungeon_Async(UnkStruct_RunDungeon *r8);
void sub_8043CD8(void);
bool8 sub_8043CE4(s32 dungeonId);
u8 GetFloorType(void);
void sub_8043D50(s32 *a0, s32 *a1);
void sub_8043D60(void);
bool8 sub_8043ED0(bool8 a0);
void EnforceMaxItemsAndMoney(void);
bool8 IsBossFight(void);
bool8 IsCurrentFixedRoomBossFight(void);
bool8 IsMakuhitaTrainingMaze(void);
#endif

View File

@@ -1,13 +0,0 @@
#ifndef GUARD_STATUS_CHECKS_1_H
#define GUARD_STATUS_CHECKS_1_H
#include "structs/dungeon_entity.h"
void SetMessageArgument_2(u8 *buffer, EntityInfo *param_2, s32 colorNum);
bool8 HasNegativeStatus(Entity *pokemon);
bool8 IsSleeping(Entity *pokemon);
bool8 HasLowHealth(Entity *pokemon);
s32 sub_8070828(Entity *pokemon, bool8 displayMessage);
void sub_80709C8(u8 *buffer, EntityInfo *entityInfo);
#endif // GUARD_STATUS_CHECKS_1_H

View File

@@ -424,8 +424,8 @@ enum MonsterBehavior
BEHAVIOR_ALLY,
BEHAVIOR_SKARMORY,
BEHAVIOR_DIGLETT, // Used for Diglett in the Skarmory boss fight.
BEHAVIOR_5, // 5 and 6 are probably Gengar and Ekans, but not sure which is which.
BEHAVIOR_6,
BEHAVIOR_GENGAR,
BEHAVIOR_EKANS,
BEHAVIOR_MEDICHAM,
BEHAVIOR_ZAPDOS,
BEHAVIOR_MOLTRES,
@@ -435,7 +435,7 @@ enum MonsterBehavior
BEHAVIOR_ARTICUNO,
BEHAVIOR_GROUDON_2,
BEHAVIOR_RAYQUAZA,
BEHAVIOR_16,
BEHAVIOR_MANKEY,
BEHAVIOR_MEWTWO,
BEHAVIOR_ENTEI,
BEHAVIOR_RAIKOU,
@@ -455,7 +455,7 @@ enum MonsterBehavior
BEHAVIOR_33,
BEHAVIOR_34,
BEHAVIOR_35,
BEHAVIOR_36,
BEHAVIOR_MAZE_BOSS,
};
enum VisualFlag

View File

@@ -30,7 +30,4 @@ typedef struct UnkStruct_RunDungeon
WonderMailSub unk84;
} UnkStruct_RunDungeon;
// TODO: This func should not be in a structs include file
void RunDungeon_Async(UnkStruct_RunDungeon *r8);
#endif // GUARD_STR_DUNGEON_8042F6C_H

View File

@@ -1,17 +0,0 @@
#ifndef GUARD_TILE_TYPES_H
#define GUARD_TILE_TYPES_H
#include "structs/map.h"
#define DUNGEON_WATER_TYPE_NONE 0
#define DUNGEON_WATER_TYPE_LAVA 1
#define DUNGEON_WATER_TYPE_WATER 2
extern const u8 gDungeonWaterType[76];
bool8 sub_804AD34(DungeonPos *pos);
void sub_804AE84(DungeonPos *pos);
bool8 IsTileGround(Tile *tile);
bool8 IsWaterTileset();
#endif // GUARD_TILE_TYPES_H

View File

@@ -203,27 +203,27 @@ SECTIONS {
src/dungeon_map.o(.text);
src/code_8040094_1.o(.text);
src/code_8041AD0.o(.text);
src/code_804267C.o(.text);
src/code_8042B34.o(.text);
src/run_dungeon.o(.text);
src/dungeon_engine.o(.text);
asm/code_8044210.o(.text);
src/dungeon_action.o(.text);
src/code_8044CC8.o(.text);
src/dungeon_util.o(.text);
src/code_80450F8.o(.text);
src/dungeon_visibility.o(.text);
src/code_8045A00.o(.text);
src/dungeon_items.o(.text);
asm/code_8046CE4.o(.text);
src/code_8048480.o(.text);
src/code_8046CE4.o(.text);
src/dungeon_item_action.o(.text);
src/dungeon_ai_item_weight.o(.text);
src/dungeon_map_access.o(.text);
src/tile_types.o(.text);
src/dungeon_generation.o(.text);
src/dungeon_generation_fixed.o(.text);
src/dungeon_message.o(.text);
src/dungeon_message_log.o(.text);
src/dungeon_move.o(.text);
src/move_actions.o(.text);
src/status_actions.o(.text);
src/dungeon_move_util.o(.text);
src/move_orb_actions_1.o(.text);
src/move_orb_actions_2.o(.text);
src/move_orb_actions_3.o(.text);
src/move_orb_actions_4.o(.text);
src/move_orb_actions_5.o(.text);
src/move_checks.o(.text);
src/dungeon_main.o(.text);
src/dungeon_submenu.o(.text);
@@ -235,36 +235,43 @@ SECTIONS {
src/dungeon_menu_others.o(.text);
src/dungeon_menu_recruitment.o(.text);
src/code_8066D04.o(.text);
src/dungeon_8067A80.o(.text);
src/dungeon_misc.o(.text);
src/code_8069E0C.o(.text);
src/code_806CD90.o(.text);
src/type_effectiveness.o(.text);
src/code_806E8B0.o(.text);
src/dungeon_damage.o(.text);
src/code_806FDF4.o(.text);
src/status_checks.o(.text);
src/dungeon_movement.o(.text);
src/status_checks_1.o(.text);
src/dungeon_capabilities.o(.text);
src/dungeon_ai_targeting.o(.text);
src/dungeon_pokemon_attributes.o(.text);
src/dungeon_logic.o(.text);
src/dungeon_8071B48.o(.text);
src/code_80718D8.o(.text);
asm/code_80718D8.o(.text);
src/code_8072B78.o(.text);
src/dungeon_ai_leader.o(.text);
src/dungeon_8072CF4.o(.text);
src/dungeon_ai_items.o(.text);
src/code_8073CF0.o(.text);
src/code_8075708.o(.text);
src/dungeon_ai.o(.text);
src/move_effects_target.o(.text);
src/status.o(.text);
src/move_orb_effects_1.o(.text);
src/move_orb_effects_2.o(.text);
src/move_orb_effects_3.o(.text);
src/move_orb_effects_4.o(.text);
src/move_orb_effects_5.o(.text);
src/code_8077274_1.o(.text);
src/dungeon_ai_movement.o(.text);
src/dungeon_ai_attack.o(.text);
src/targeting_flags.o(.text);
src/code_807CD9C.o(.text);
src/code_807E1A0.o(.text);
src/blow_away.o(.text);
src/warp_target.o(.text);
src/expose_trap.o(.text);
src/trawl_orb.o(.text);
src/pounce_orb.o(.text);
src/drought_orb.o(.text);
src/one_room_orb.o(.text);
src/explosion.o(.text);
src/switcher_orb.o(.text);
src/dungeon_wind.o(.text);
src/weather.o(.text);
src/code_807E5AC.o(.text);
src/dungeon_kecleon_shop.o(.text);
src/hurl_orb.o(.text);
src/trap.o(.text);
src/dungeon_serializer.o(.text);
src/dungeon_range.o(.text);
@@ -527,9 +534,7 @@ SECTIONS {
src/personality_test1.o(.rodata);
src/personality_test2.o(.rodata);
src/code_803D0D8.o(.rodata);
src/dungeon_util.o(.rodata);
data/data_80F4468.o(.rodata);
src/dungeon_ai_movement.o(.rodata);
src/dungeon_pos_data.o(.rodata);
data/data_80F4D44.o(.rodata);
src/dungeon_config.o(.rodata);
data/data_80F59C8_1.o(.rodata);
@@ -539,12 +544,32 @@ SECTIONS {
data/data_80F59C8_0.o(.rodata);
src/dungeon_map.o(.rodata);
src/code_8040094_1.o(.rodata);
data/data_80F59C8_5.o(.rodata);
data/pksdir_0.o(.rodata);
src/code_8041AD0.o(.rodata);
src/run_dungeon.o(.rodata);
src/dungeon_engine.o(.rodata);
src/dungeon_action.o(.rodata);
data/pksdir_1.o(.rodata);
src/dungeon_util.o(.text);
src/dungeon_items.o(.rodata);
data/data_80F59C8.o(.rodata);
src/code_8046CE4.o(.rodata);
src/dungeon_item_action.o(.rodata);
src/dungeon_ai_item_weight.o(.rodata);
src/dungeon_map_access.o(.rodata);
src/dungeon_generation.o(.rodata);
src/dungeon_generation_fixed.o(.rodata);
src/dungeon_message.o(.rodata);
src/dungeon_strings.o(.rodata);
src/dungeon_boss_dialogue.o(.rodata);
src/dungeon_message_log.o(.rodata);
src/dungeon_move.o(.rodata);
data/data_8106A4C_0.o(.rodata);
src/dungeon_move_util.o(.rodata);
src/move_orb_actions_1.o(.rodata);
src/move_orb_actions_2.o(.rodata);
src/move_orb_actions_3.o(.rodata);
src/move_orb_actions_4.o(.rodata);
src/move_orb_actions_5.o(.rodata);
src/move_checks.o(.rodata);
src/dungeon_main.o(.rodata);
src/dungeon_submenu.o(.rodata);
src/dungeon_menu_items.o(.rodata);
@@ -554,16 +579,47 @@ SECTIONS {
src/dungeon_menu_stairs.o(.rodata);
src/dungeon_menu_others.o(.rodata);
src/dungeon_menu_recruitment.o(.rodata);
data/data_8106A4C.o(.rodata);
src/code_8066D04.o(.rodata);
src/dungeon_8067A80.o(.rodata);
src/dungeon_misc.o(.rodata);
data/data_8106A4C_2.o(.rodata);
src/code_8069E0C.o(.rodata);
src/code_806CD90.o(.rodata);
src/type_effectiveness.o(.data);
data/data_8106F7C.o(.rodata);
src/dungeon_capabilities.o(.rodata);
src/dungeon_ai_targeting.o(.rodata);
data/data_8107010.o(.rodata);
src/dungeon_damage.o(.rodata);
src/code_806FDF4.o(.rodata);
src/status_checks.o(.rodata);
src/dungeon_logic.o(.rodata);
src/dungeon_8071B48.o(.rodata);
src/code_80718D8.o(.rodata);
src/dungeon_ai_leader.o(.rodata);
src/dungeon_8072CF4.o(.rodata);
src/dungeon_ai_items.o(.rodata);
src/code_8073CF0.o(.rodata);
src/code_8075708.o(.rodata);
src/dungeon_ai.o(.rodata);
src/move_orb_effects_1.o(.rodata);
src/move_orb_effects_2.o(.rodata);
src/move_orb_effects_3.o(.rodata);
src/move_orb_effects_4.o(.rodata);
src/move_orb_effects_5.o(.rodata);
src/code_8077274_1.o(.rodata);
src/dungeon_ai_movement.o(.rodata);
src/dungeon_ai_attack.o(.rodata);
src/blow_away.o(.rodata);
src/warp_target.o(.rodata);
src/expose_trap.o(.rodata);
src/trawl_orb.o(.rodata);
src/pounce_orb.o(.rodata);
src/drought_orb.o(.rodata);
src/one_room_orb.o(.rodata);
data/pksdir_2.o(.rodata);
src/explosion.o(.rodata);
src/switcher_orb.o(.rodata);
src/dungeon_wind.o(.rodata);
src/weather.o(.rodata);
src/dungeon_kecleon_shop.o(.rodata);
src/hurl_orb.o(.rodata);
src/trap.o(.rodata);
data/pksdir_3.o(.rodata);
src/dungeon_serializer.o(.rodata);
data/data_8107224.o(.rodata);
src/pokemon.o(.rodata);
@@ -576,12 +632,7 @@ SECTIONS {
src/code_80972F4.o(.rodata);
src/code_8097504.o(.rodata);
data/data_8109D10.o(.rodata);
src/pokemon_3.o(.rodata);
src/items.o(.rodata);
src/code_8048480.o(.rodata);
src/friend_area.o(.rodata);
data/data_810AC60.o(.rodata);
src/tile_types.o(.rodata);
src/dungeon_data.o(.rodata);
src/exclusive_pokemon.o(.rodata);
src/rescue_team_info.o(.rodata);
src/strings.o(.rodata);

211
src/blow_away.c Normal file
View File

@@ -0,0 +1,211 @@
#include "global.h"
#include "globaldata.h"
#include "constants/ability.h"
#include "constants/weather.h"
#include "code_803E46C.h"
#include "dungeon_message.h"
#include "code_806CD90.h"
#include "code_807CD9C.h"
#include "structs/str_dungeon.h"
#include "code_8077274_1.h"
#include "dungeon_ai.h"
#include "run_dungeon.h"
#include "dungeon_generation.h"
#include "dungeon_logic.h"
#include "dungeon_map.h"
#include "dungeon_map_access.h"
#include "dungeon_util.h"
#include "math.h"
#include "move_effects_target.h"
#include "moves.h"
#include "move_util.h"
#include "code_8041AD0.h"
#include "code_803E668.h"
#include "weather.h"
#include "dungeon_config.h"
#include "dungeon_misc.h"
#include "dungeon_items.h"
#include "dungeon_strings.h"
void sub_804EB30();
bool8 ExposeTrap(s32 x, s32 y);
void ShowWholeRevealedDungeonMap();
void sub_8049ED4();
void sub_806A5B8(Entity *);
u8 sub_8045888(Entity *);
void sub_807EC28(u32);
u8 sub_8044B28(void);
extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32);
void sub_80421AC(Entity * pokemon, Entity * target);
void sub_807BB78(Entity *pokemon);
extern void sub_803F580(u32);
bool8 sub_808384C(DungeonPos *, DungeonPos *);
u8 sub_8083660(DungeonPos *);
extern u32 gDungeonFramesCounter;
void sub_807D068(Entity *pokemon, DungeonPos *pos);
void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction)
{
const Tile *tile;
int iVar8;
bool8 flag;
DungeonPos pos;
Move move;
int counter;
Entity *entity;
PixelPos pos32;
counter = 10;
if (IsCurrentFixedRoomBossFight()) {
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FC9E8); // It couldn't be knocked flying!
return;
}
else
{
if (pokemon == target) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FCA10); // {POKEMON_0} couldn't be knocked flying!
return;
}
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
if (AbilityIsActive(target,ABILITY_SUCTION_CUPS)) {
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FCBCC); // {POKEMON_0} is anchored! It can't be knocked flying!
return;
}
else
{
(GetEntInfo(target)->action).direction = (direction + 4) & DIRECTION_MASK;
sub_806CDD4(target, 6, (direction + 4) & DIRECTION_MASK);
sub_80421C0(target,0x1a3);
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80F8A0C); // {POKEMON_0} was blown away!
flag = TRUE;
entity = NULL;
for(; counter > 0; counter--)
{
pos = target->pos;
pos.x += gAdjacentTileOffsets[direction].x;
pos.y += gAdjacentTileOffsets[direction].y;
if ((((pos.x < 0) || (pos.y < 0)) || (DUNGEON_MAX_SIZE_X <= pos.x)) ||
(DUNGEON_MAX_SIZE_Y <= pos.y)) goto _0807CF20;
pos32.x = gAdjacentTileOffsets[direction].x << 0xA;
pos32.y = gAdjacentTileOffsets[direction].y << 0xA;
for(iVar8 = 0; iVar8 < 6; iVar8++)
{
IncreaseEntityPixelPos(target,pos32.x,pos32.y);
if (sub_8045888(target) != 0) {
DungeonRunFrameActions(0x19);
}
}
tile = GetTile(pos.x, pos.y);
if (tile->monster != NULL) {
entity = tile->monster;
goto _0807CF26;
}
if (sub_80705F0(target,&pos)){
flag = (GetTerrainType(tile) != TERRAIN_TYPE_WALL);
goto _0807CF20;
}
sub_80694C0(target,pos.x,pos.y,1);
}
flag = TRUE;
_0807CF20:
if (!flag) {
_0807CF26:
sub_807D068(target,&target->pos);
sub_806F370(pokemon,target,gBlowAwayDmgValue,0,0,0,0x219,0,0,0);
}
if (sub_8044B28()) {
return;
}
if (entity != NULL) {
InitPokemonMove(&move,0x163);
if (!sub_80571F0(entity,&move)) {
TrySendImmobilizeSleepEndMsg(pokemon,entity);
sub_806F370(pokemon,entity,gBlowAwayDmgValue,0,0,0,0x21a,0,0,0);
}
}
if (sub_8044B28()) {
return;
}
if (!EntityIsValid(target)) {
return;
}
sub_806A5B8(target);
if (sub_80706A4(target,&target->pos)) {
WarpTarget(target,target,0,0);
}
if (!EntityIsValid(target)) {
return;
}
sub_806CE68(target,8);
if (GetEntInfo(target)->isTeamLeader) {
gDungeon->unk1 = 0;
gDungeon->unk5C0 = -1;
sub_804AC20(&target->pos);
sub_807EC28(FALSE);
}
sub_806A5B8(target);
sub_8075900(target,gDungeon->forceMonsterHouse);
}
}
}
void sub_807D068(Entity *pokemon, DungeonPos *pos)
{
int pixelX;
int posY;
int pixelY;
int posX;
int counter;
int iVar8;
s32 diff;
PixelPos local_34;
int incrementX;
int incrementY;
posX = X_POS_TO_PIXELPOS(pos->x);
posY = Y_POS_TO_PIXELPOS(pos->y);
diff = (pokemon->pixelPos).x - posX;
if (diff < 0) {
diff = -diff;
}
if (diff < 0xc) {
diff = (pokemon->pixelPos).y - posY;
if (diff < 0) {
diff = -diff;
}
if (diff < 0xc) goto _0807D11E;
}
iVar8 = 0;
pixelX = (pokemon->pixelPos).x;
pixelY = (pokemon->pixelPos).y;
incrementX = (posX - pixelX) / 0xc;
incrementY = (posY - pixelY) / 0xc;
for(counter = 0; counter < 0xC; counter++)
{
pixelX += incrementX;
pixelY += incrementY;
local_34.x = pixelX;
local_34.y = pixelY;
pokemon->unk1C.raw = sin_4096(iVar8) * 0xc;
sub_804535C(pokemon, &local_34);
if (sub_8045888(pokemon)) {
DungeonRunFrameActions(0x1a);
}
iVar8 = iVar8 + 0xaa;
}
_0807D11E:
local_34.x = posX;
local_34.y = posY;
pokemon->unk1C = IntToF248(0);
sub_804535C(pokemon,&local_34);
DungeonRunFrameActions(0x1a);
}

View File

@@ -18,10 +18,8 @@ struct unkStruct_203B0D4
extern struct unkStruct_203B0D4 *gUnknown_203B0D4;
ALIGNED(4) static const u8 gUnknown_80CE77C[] = "efob%03d";
ALIGNED(4) static const u8 gUnknown_80CE788[] = "efbg%03d";
void sub_800F034(void) {
void sub_800F034(void)
{
s32 index;
if(gUnknown_203B0D4 == NULL)
{
@@ -121,10 +119,10 @@ OpenedFile * sub_800F1C0(u32 animType, s32 effectID)
case 1:
case 2:
case 3:
sprintf(fileName,gUnknown_80CE77C,effectID); // efob
sprintf(fileName,"efob%03d",effectID);
break;
case 4:
sprintf(fileName,gUnknown_80CE788,effectID); // efbg
sprintf(fileName,"efbg%03d",effectID);
break;
}

View File

@@ -17,6 +17,7 @@
#include "pokemon_3.h"
#include "text_1.h"
#include "text_3.h"
#include "dungeon_config.h"
extern s32 sub_80902C8(u8 dungeon);
extern void sub_808E9C4(UnkDungeonGlobal_unk1CD98 *r0, s16 r1);
@@ -32,7 +33,6 @@ extern const char gUnknown_80F610C[];
extern const char gUnknown_80F6110[];
extern const char gUnknown_80F6118[];
extern const u32 gUnknown_80F6120[];
extern const u16 gUnknown_80F5F70[];
extern RGB gUnknown_202ECA4[];
extern OpenedFile *gDungeonNameBannerPalette;

View File

@@ -18,7 +18,7 @@
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_music.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_range.h"
#include "dungeon_util.h"
#include "game_options.h"

View File

@@ -18,8 +18,8 @@
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "sprite.h"
#include "tile_types.h"
#include "weather.h"
#include "dungeon_map_access.h"
struct UnkStruct_8040094
{

View File

@@ -1,4 +1,5 @@
#include "global.h"
#include "globaldata.h"
#include "constants/direction.h"
#include "constants/status.h"
#include "constants/type.h"
@@ -15,25 +16,26 @@
#include "code_804267C.h"
#include "code_806CD90.h"
#include "dungeon_config.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "items.h"
#include "math.h"
#include "sprite.h"
#include "code_803E668.h"
#include "dungeon.h"
#include "run_dungeon.h"
#include "dungeon_leader.h"
#include "dungeon_map.h"
#include "dungeon_message.h"
#include "dungeon_music.h"
#include "memory.h"
#include "random.h"
#include "dungeon_util_1.h"
#include "code_800E9E4.h"
extern u32 gStatusSpriteMasks_SleepClassStatus[];
extern u32 gStatusSpriteMasks_BurnClassStatus[];
extern u32 gStatusSpriteMasks_FrozenClassStatus[];
extern u32 gStatusSpriteMasks_CringeClassStatus[];
extern u32 gStatusSpriteMasks_BideClassStatus[];
extern u32 gStatusSpriteMasks_ReflectClassStatus[];
extern u32 gStatusSpriteMasks_CurseClassStatus[];
extern u32 gStatusSpriteMasks_LeechSeedClassStatus[];
extern u32 gStatusSpriteMasks_SureShotClassStatus[];
extern u32 gStatusSpriteMasks_LongTossClassStatus[];
extern u32 gStatusSpriteMasks_InvisibleClassStatus[];
extern u32 gStatusSpriteMasks_BlinkerClassStatus[];
extern u32 gStatusSpriteMasks_MuzzledStatus[];
// Unknown dungeon file. File split is correct.
extern const u8 *gPtrFeralFoundItemMessage[];
extern void sub_803ED30(u8, Entity *pokemon, u8, u8);
extern u32 sub_806F62C(u32);
@@ -47,11 +49,160 @@ extern s32 gDungeonBrightness;
extern void sub_800DBBC(void);
extern void sub_803EA10(void);
extern void sub_8042E98(void);
extern void sub_800EF28(u8);
extern u32 sub_800E448(u8, DungeonPos *);
extern void sub_80429A0(Entity *);
void sub_8042B34(s32 a0, s32 a1, s32 a2);
extern bool8 sub_8042CC0(void);
extern void sub_8042D7C(void);
extern u8 GetFloorType(void);
extern bool8 sub_8045888(Entity *);
extern s32 sub_80416E0(PixelPos*, u32, bool8);
extern u32 sub_8041764(unkStruct_80416E0 *, bool8);
extern u32 sub_800E49C();
extern void sub_800F15C(s32);
extern void sub_800EF40(u8 r0, u8 r1);
extern s32 sub_800E6D8(s32);
extern void sub_800EB24(s32 param_1, DungeonPos *param_2, DungeonPos *param_3, s32 param_4, s32 param_5);
void sub_804178C(u8 param_1);
u32 sub_8041764(unkStruct_80416E0 *param_1, bool8 param_2);
s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3);
s32 sub_8041550(Entity *entity, s32 a1, u8 a2, u8 a3, s32 a4, u8 a5);
s32 sub_804151C(Entity *entity, s32 r1, u8 r2);
void sub_804178C(u8 param_1);
struct UnkStruct_80F6624
{
s16 unk0;
s32 unk4;
};
static const struct UnkStruct_80F6624 gUnknown_80F6624[][3] = {
{{0x178, 3}, {0x179, 1}, {0, 0}},
{{0x17A, 1}, {0x17B, 2}, {0x17C, 3}},
{{0x17D, 1}, {0x17E, 2}, {0, 0}},
{{0x17F, 2}, {0, 0}, {0, 0}},
{{0x1B9, 1}, {0x1BA, 2}, {0x1BB, 3}},
};
static const u32 sStatusSpriteMasks_SleepClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_SLEEP] = STATUS_SPRITE_SLEEP,
[STATUS_SLEEPLESS] = STATUS_SPRITE_SLEEPLESS,
[STATUS_NIGHTMARE] = STATUS_SPRITE_SLEEP,
[STATUS_YAWNING] = 0,
[STATUS_NAPPING] = STATUS_SPRITE_SLEEP,
};
static const u32 sStatusSpriteMasks_BurnClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_BURN] = STATUS_SPRITE_BURNED,
[STATUS_POISONED] = STATUS_SPRITE_POISONED,
[STATUS_BADLY_POISONED] = STATUS_SPRITE_BADLY_POISONED,
[STATUS_PARALYSIS] = 0,
};
static const u32 sStatusSpriteMasks_FrozenClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_FROZEN] = STATUS_SPRITE_FROZEN,
[STATUS_SHADOW_HOLD] = 0,
[STATUS_WRAP] = 0,
[STATUS_WRAPPED] = 0,
[STATUS_INGRAIN] = 0,
[STATUS_PETRIFIED] = 0,
[STATUS_CONSTRICTION] = 0,
};
static const u32 sStatusSpriteMasks_CringeClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_CRINGE] = 0,
[STATUS_CONFUSED] = STATUS_SPRITE_CONFUSED,
[STATUS_PAUSED] = 0,
[STATUS_COWERING] = STATUS_SPRITE_COWERING,
[STATUS_TAUNTED] = STATUS_SPRITE_TAUNTED,
[STATUS_ENCORE] = STATUS_SPRITE_ENCORE,
[STATUS_INFATUATED] = 0,
};
static const u32 sStatusSpriteMasks_BideClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_BIDE] = 0,
[STATUS_SOLARBEAM] = 0,
[STATUS_SKY_ATTACK] = 0,
[STATUS_RAZOR_WIND] = 0,
[STATUS_FOCUS_PUNCH] = 0,
[STATUS_SKULL_BASH] = 0,
[STATUS_FLYING] = 0,
[STATUS_BOUNCING] = 0,
[STATUS_DIVING] = 0,
[STATUS_DIGGING] = 0,
[STATUS_CHARGING] = 0,
[STATUS_ENRAGED] = 0,
};
static const u32 sStatusSpriteMasks_ReflectClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_REFLECT] = STATUS_SPRITE_SHIELD_BLUE,
[STATUS_SAFEGUARD] = STATUS_SPRITE_SHIELD_RED,
[STATUS_LIGHT_SCREEN] = STATUS_SPRITE_SHIELD_YELLOW,
[STATUS_COUNTER] = STATUS_SPRITE_SHIELD_BLUE,
[STATUS_MAGIC_COAT] = STATUS_SPRITE_SHIELD_YELLOW,
[STATUS_WISH] = 0,
[STATUS_PROTECT] = STATUS_SPRITE_SHIELD_GREEN,
[STATUS_MIRROR_COAT] = STATUS_SPRITE_SHIELD_RED,
[STATUS_ENDURING] = STATUS_SPRITE_ENDURE,
[STATUS_MINI_COUNTER] = STATUS_SPRITE_SHIELD_BLUE,
[STATUS_MIRROR_MOVE] = STATUS_SPRITE_SHIELD_GREEN,
[STATUS_CONVERSION2] = 0,
[STATUS_VITAL_THROW] = STATUS_SPRITE_SHIELD_GREEN,
[STATUS_MIST] = STATUS_SPRITE_SHIELD_BLUE,
};
static const u32 sStatusSpriteMasks_CurseClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_CURSED] = STATUS_SPRITE_CURSED,
[STATUS_DECOY] = 0,
[STATUS_SNATCH] = STATUS_SPRITE_SNATCH,
};
static const u32 sStatusSpriteMasks_LeechSeedClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_LEECH_SEED] = 0,
[STATUS_DESTINY_BOND] = 0,
};
static const u32 sStatusSpriteMasks_SureShotClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_SURE_SHOT] = STATUS_SPRITE_SURE_SHOT,
[STATUS_WHIFFER] = STATUS_SPRITE_WHIFFER,
[STATUS_SET_DAMAGE] = STATUS_SPRITE_SET_DAMAGE,
[STATUS_FOCUS_ENERGY] = STATUS_SPRITE_FOCUS_ENERGY,
};
static const u32 sStatusSpriteMasks_LongTossClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_LONG_TOSS] = 0,
[STATUS_PIERCE] = 0,
};
static const u32 sStatusSpriteMasks_InvisibleClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_INVISIBLE] = 0,
[STATUS_TRANSFORMED] = 0,
[STATUS_MOBILE] = 0,
};
static const u32 sStatusSpriteMasks_BlinkerClassStatus[] = {
[STATUS_NONE] = 0,
[STATUS_BLINKER] = STATUS_SPRITE_BLINKER,
[STATUS_CROSS_EYED] = STATUS_SPRITE_CROSS_EYED,
[STATUS_EYEDROPS] = STATUS_SPRITE_EYEDROPS,
};
static const u32 sStatusSpriteMasks_MuzzledStatus[] = {
[STATUS_NONE] = 0,
/*STATUS_MUZZLED not defined*/[1] = STATUS_SPRITE_MUZZLED,
};
s32 sub_804151C(Entity *entity, s32 r1, u8 r2)
{
@@ -258,21 +409,21 @@ void EntityUpdateStatusSprites(Entity *entity)
flag = (temp) != 0;
}
if (flag) {
spriteStatus = gStatusSpriteMasks_SleepClassStatus[entityInfo->sleepClassStatus.status];
spriteStatus = sStatusSpriteMasks_SleepClassStatus[entityInfo->sleepClassStatus.status];
}
spriteStatus = spriteStatus |
gStatusSpriteMasks_BurnClassStatus[entityInfo->burnClassStatus.status] |
gStatusSpriteMasks_FrozenClassStatus[entityInfo->frozenClassStatus.status] |
gStatusSpriteMasks_CringeClassStatus[entityInfo->cringeClassStatus.status] |
gStatusSpriteMasks_BideClassStatus[entityInfo->bideClassStatus.status] |
gStatusSpriteMasks_ReflectClassStatus[entityInfo->reflectClassStatus.status] |
gStatusSpriteMasks_CurseClassStatus[entityInfo->curseClassStatus.status] |
gStatusSpriteMasks_LeechSeedClassStatus[entityInfo->leechSeedClassStatus.status] |
gStatusSpriteMasks_SureShotClassStatus[entityInfo->sureShotClassStatus.status] |
gStatusSpriteMasks_LongTossClassStatus[entityInfo->longTossClassStatus.status] |
gStatusSpriteMasks_InvisibleClassStatus[entityInfo->invisibleClassStatus.status] |
gStatusSpriteMasks_BlinkerClassStatus[entityInfo->blinkerClassStatus.status] |
gStatusSpriteMasks_MuzzledStatus[entityInfo->muzzled.muzzled];
sStatusSpriteMasks_BurnClassStatus[entityInfo->burnClassStatus.status] |
sStatusSpriteMasks_FrozenClassStatus[entityInfo->frozenClassStatus.status] |
sStatusSpriteMasks_CringeClassStatus[entityInfo->cringeClassStatus.status] |
sStatusSpriteMasks_BideClassStatus[entityInfo->bideClassStatus.status] |
sStatusSpriteMasks_ReflectClassStatus[entityInfo->reflectClassStatus.status] |
sStatusSpriteMasks_CurseClassStatus[entityInfo->curseClassStatus.status] |
sStatusSpriteMasks_LeechSeedClassStatus[entityInfo->leechSeedClassStatus.status] |
sStatusSpriteMasks_SureShotClassStatus[entityInfo->sureShotClassStatus.status] |
sStatusSpriteMasks_LongTossClassStatus[entityInfo->longTossClassStatus.status] |
sStatusSpriteMasks_InvisibleClassStatus[entityInfo->invisibleClassStatus.status] |
sStatusSpriteMasks_BlinkerClassStatus[entityInfo->blinkerClassStatus.status] |
sStatusSpriteMasks_MuzzledStatus[entityInfo->muzzled.muzzled];
if (entityInfo->grudge) {
spriteStatus = spriteStatus | STATUS_SPRITE_GRUDGE;
@@ -961,10 +1112,6 @@ void sub_8042238(Entity *pokemon, Entity *target)
PlaySoundEffect(0x156);
}
extern void sub_800EF28(u8);
extern void sub_803E708(u32, u32);
extern u32 sub_800E448(u8, DungeonPos *);
void sub_804225C(Entity *entity, DungeonPos *pos, u8 trapId)
{
s32 uVar6;
@@ -1014,3 +1161,575 @@ void sub_804225C(Entity *entity, DungeonPos *pos, u8 trapId)
break;
}
}
void sub_8042390(Entity *entity, Item *item)
{
s32 sVar1;
s32 counter;
u8 id;
u32 uVar6;
DungeonPos asStack_24[4];
DungeonPos local_14;
if (sub_8042768(entity)) {
id = !ItemSticky(item) ? item->id : ITEM_NOTHING;
sub_800EF40(id, 0);
sub_800EF64();
sub_803E708(4,0x42);
local_14.x = (entity->pixelPos).x / 256;
local_14.y = (entity->pixelPos).y / 256;
sVar1 = (local_14.y - gDungeon->unk181e8.cameraPixelPos.y) / 2 + 1;
sub_8005700(asStack_24,&entity->axObj);
uVar6 = sub_800E49C(id,&local_14,asStack_24,0,sVar1);
for (counter = 0; counter < 1000; counter++) {
DungeonRunFrameActions(0x42);
if (!sub_800E9A8(uVar6)) {
break;
}
}
}
}
void sub_804245C(Entity *entity, Item *item)
{
s32 sVar1;
s32 counter;
u8 id;
u32 uVar6;
DungeonPos asStack_24[4];
DungeonPos local_14;
if (sub_8042768(entity)) {
id = !ItemSticky(item) ? item->id : ITEM_NOTHING;
sub_800EF64();
sub_803E708(4,0x42);
local_14.x = (entity->pixelPos).x / 256;
local_14.y = (entity->pixelPos).y / 256;
sVar1 = (local_14.y - gDungeon->unk181e8.cameraPixelPos.y) / 2 + 1;
sub_8005700(asStack_24,&entity->axObj);
uVar6 = sub_800E49C(id,&local_14,asStack_24,1,sVar1);
for (counter = 0; counter < 1000; counter++) {
DungeonRunFrameActions(0x42);
if (!sub_800E9A8(uVar6)) {
break;
}
}
}
}
s32 sub_8042520(Entity *a0)
{
s32 i;
s32 uVar4;
DungeonPos pos;
u32 dir;
s32 iVar8;
unkStruct_80416E0 local_58;
unkStruct_2039DB0 u203; // Unused
PixelPos local_2c;
if (sub_8045888(a0)) {
dir = GetEntInfo(a0)->action.direction;
pos.x = a0->pixelPos.x / 0x100;
pos.y = a0->pixelPos.y / 0x100;
iVar8 = (pos.y - gDungeon->unk181e8.cameraPixelPos.y) / 2;
local_58.unk0 = 357;
local_58.unk4 = 0;
local_58.dir = dir;
local_58.x = pos.x;
local_58.y = pos.y;
local_58.unk10 = 0;
local_58.unk12 = 0;
local_58.unk14 = -1;
local_58.unk18 = iVar8;
sub_8004E8C(&u203);
uVar4 = sub_8041764(&local_58, 0);
for (i = 0; i < 6; i++) {
sub_800E8AC(uVar4, &pos, 0, iVar8, 0);
DungeonRunFrameActions(66);
pos.x += gAdjacentTileOffsets[dir].x * 4;
pos.y += gAdjacentTileOffsets[dir].y * 4;
iVar8 = (pos.y - gDungeon->unk181e8.cameraPixelPos.y) / 2;
}
sub_800DBBC();
local_2c.x = pos.x * 0x100;
local_2c.y = pos.y * 0x100;
uVar4 = sub_80416E0(&local_2c, 416, TRUE);
}
else
{
uVar4 = -1;
}
return uVar4;
}
// This func plays the appropriate ascend/descend SFX for stairs depending on the direction
void PlayStairsSound(void)
{
u32 songIndex;
songIndex = 997;
switch (GetFloorType()) {
case 0:
default:
songIndex = IsStairDirectionUp(gDungeon->unk644.dungeonLocation.id) ? 340 : 341;
break;
case 1:
case 2:
break;
}
PlaySoundEffect(songIndex);
}
static const u16 gUnknown_80F67DC[4] = {
0xD8, 0xD9, 0xD9, 0x173
};
static const u16 gUnknown_80F67E4[4] = {
0xDA, 0xDB, 0xDB, 0x174
};
void sub_80426C8(u32 a0, u32 a1)
{
if (a1 == 3)
DungeonStartNewBGM(0);
if (a0 != 4)
PlaySoundEffect(gUnknown_80F67DC[a1]);
else
PlaySoundEffect(gUnknown_80F67E4[a1]);
sub_8042B34(a0, a1, 0x80);
while (sub_8042CC0())
DungeonRunFrameActions(0x46);
sub_8042D7C();
LoadDungeonMapPalette();
sub_8052210(1);
}
void sub_8042730(Entity *a0, void *unused)
{
s32 i;
sub_806CDD4(a0, 8, 8);
for (i = 0; i < 100; i++) {
DungeonRunFrameActions(0x51);
if ((a0->axObj.axdata.sub1.unk10 & 3) != 0 || a0->axObj.unk43_animId2 != 8)
break;
}
}
bool8 sub_8042768(Entity* pokemon)
{
if (!pokemon->isVisible)
return FALSE;
if (gDungeon->unk181e8.blinded) {
if (gDungeon->unk181e8.cameraTarget == pokemon)
return TRUE;
else
return FALSE;
}
return sub_8045888(pokemon);
}
void sub_80427AC(void)
{
Entity *entity;
EntityInfo *enInfo;
s32 i;
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
entity = gDungeon->activePokemon[i];
if (EntityIsValid(entity)) {
enInfo = GetEntInfo(entity);
if (enInfo->unkF3) {
enInfo->unkF3 = FALSE;
sub_80429A0(entity);
if (!enInfo->isNotTeamMember) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
DisplayDungeonLoggableMessageTrue(entity, *gPtrFeralFoundItemMessage);
}
}
}
}
}
static const s32 gUnknown_80F67EC[8] = {
-1, 331, 239, -1, 16, 20, -1, 223
};
static const s32 gUnknown_80F680C[8] = {
-1, 331, 239, -1, 440, 20, -1, 223
};
static const u16 gUnknown_80F682C[8] = {
997, 997, 997, 425, 997, 997, 426, 997
};
void sub_8042818(u8 a0, bool8 a1)
{
Entity *en;
en = gDungeon->unk181e8.cameraTarget;
if (en == NULL)
en = GetLeader();
if (gUnknown_80F682C[a0] != 997)
sub_80421C0(en, gUnknown_80F682C[a0]);
if (gUnknown_80F67EC[a0] < 0)
return;
if (a1 && !IsBossFight())
sub_804151C(en, gUnknown_80F67EC[a0], 0);
else
sub_804151C(en, gUnknown_80F680C[a0], 0);
}
void sub_80428A0(Entity *r0)
{
sub_804151C(r0, 0x29, 1);
}
void sub_80428B0(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_80428C4(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_80428D8(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_80428EC(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_8042900(Entity *r0)
{
sub_804151C(r0, 0xD4 << 1, 0);
}
void ShowVisualFlags(Entity *r0)
{
sub_804151C(r0, 0x29, 0);
}
void sub_8042920(Entity *r0)
{
sub_804151C(r0, 0x48, 0);
}
void sub_8042930(Entity *r0)
{
sub_804151C(r0, 0xD3 << 1, 1);
}
void sub_8042940(Entity *r0)
{
sub_804151C(r0, 0xC7 << 1, 0);
}
void sub_8042950(Entity *r0)
{
sub_804151C(r0, 0xD8 << 1, 1);
sub_803E708(0xA, 0x42);
}
void sub_8042968(Entity *r0)
{
sub_804151C(r0, 0xD4 << 1, 0);
}
void sub_8042978(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_804298C(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_80429A0(Entity *r0)
{
sub_804151C(r0, 0x199, 0);
}
void sub_80429B4(Entity *r0)
{
sub_804151C(r0, 0x1ab, 0);
}
void sub_80429C8(Entity *r0)
{
sub_804151C(r0, 0x4, 1);
}
void sub_80429D8(Entity *r0)
{
sub_804151C(r0, 0x8F << 1, 1);
}
void sub_80429E8(Entity *r0)
{
sub_804151C(r0, 0x11d, 1);
}
void sub_80429FC(DungeonPos *r0)
{
sub_80416A4(r0, 0x19E, TRUE);
sub_80421C0(NULL, 0xD4);
}
void sub_8042A14(DungeonPos *r0)
{
sub_80416A4(r0, 0x36, TRUE);
}
void sub_8042A24(Entity *r0)
{
sub_804151C(r0, 0x15, 1);
}
void sub_8042A34(DungeonPos *r0)
{
sub_80416A4(r0, 0x13E, FALSE);
}
void sub_8042A44(Entity *r0)
{
sub_804151C(r0, 0xDA << 1, 1);
}
void sub_8042A54(DungeonPos *r0)
{
sub_80416A4(r0, 0x37, TRUE);
}
void sub_8042A64(DungeonPos *r0)
{
sub_80416A4(r0, 0x29, TRUE);
}
void sub_8042A74(Entity *r0)
{
sub_804151C(r0, 0x18, 1);
}
void sub_8042A84(s16 param_1, Entity *entity, u32 param_3)
{
s32 iVar3;
s32 r6;
s32 param_1_s16;
param_1_s16 = param_1;
r6 = IntToF248_2(2).raw;
if (sub_8042768(entity)) {
sub_804151C(entity,param_1_s16,0);
sub_803E708(param_3,0x42);
do {
if (entity->unk1C.raw > IntToF248_2(199.999).raw) break;
DungeonRunFrameActions(0x42);
entity->unk1C.raw += + r6;
r6 += IntToF248_2(1).raw;
iVar3 = (entity->pixelPos.y - entity->unk1C.raw) / 256;
} while (-8 <= iVar3 - gDungeon->unk181e8.cameraPixelPos.y);
entity->isVisible = 0;
sub_804178C(0);
}
}
void sub_8042B0C(Entity *entity)
{
sub_8042A84(0x13e, entity, 5);
}
void sub_8042B20(Entity *entity)
{
sub_8042A84(0x1BC, entity, 0xE);
}
static const unkStruct_2039DB0 gUnknown_80F683C = {0xFFFF, 0xFFFF, 0xFFFF, 0, 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();
gUnknown_203B414 = MemoryAlloc(sizeof(*gUnknown_203B414), 7);
gUnknown_203B414->unk0 = a0;
gUnknown_203B414->unk8 = (a1 + 1) * 4;
sub_800EE5C(gUnknown_80F6624[a0][0].unk0);
sub_800EF64();
DungeonRunFrameActions(0x46);
gUnknown_203B414->unk4 = a2;
for (i = 0; i < gUnknown_203B414->unk8; i++) {
s32 rnd;
spStruct.unk0 = gUnknown_80F6624[gUnknown_203B414->unk0][r8].unk0;
spStruct.unk4 = i;
spStruct.dir = 0;
spStruct.x = leader->pixelPos.x / 256;
spStruct.y = leader->pixelPos.y / 256;
rnd = RandInt(2);
gUnknown_203B414->unk4C[i] = (gUnknown_80F6624[gUnknown_203B414->unk0][r8].unk4 * 2) + rnd;
gUnknown_203B414->unk8C[i].x = RandInt(240) + 152;
gUnknown_203B414->unk8C[i].y = RandInt(8 + (i * 2)) - (((i - (i / 4 * 4)) * 40) - 24);
spStruct.unk10 = gUnknown_203B414->unk8C[i].x;
spStruct.unk12 = gUnknown_203B414->unk8C[i].y;
spStruct.unk14 = 4;
spStruct.unk18 = 0xFFFF;
stack1C = gUnknown_80F683C;
gUnknown_203B414->unkC[i] = sub_800E890(&spStruct);
r8++;
if (r8 >= 3 || gUnknown_80F6624[gUnknown_203B414->unk0][r8].unk0 == 0) {
r8 = 0;
}
sub_800F15C(sub_800ECA4(spStruct.unk0)->effectId);
}
}
bool8 sub_8042CC0(void)
{
s32 i;
bool8 ret = FALSE;
if (gUnknown_203B414->unk4 != 0) {
ret = TRUE;
gUnknown_203B414->unk4--;
}
for (i = 0; i < gUnknown_203B414->unk8; i++) {
gUnknown_203B414->unk8C[i].x -= gUnknown_203B414->unk4C[i];
if (gUnknown_203B414->unk8C[i].x <= -152) {
if (gUnknown_203B414->unk4 > 0) {
gUnknown_203B414->unk8C[i].x = 152;
}
else {
gUnknown_203B414->unk8C[i].x = -152;
}
}
else {
ret = TRUE;
}
sub_800E8AC(gUnknown_203B414->unkC[i], NULL, &gUnknown_203B414->unk8C[i], 0, NULL);
}
sub_800E90C(&gDungeon->unk181e8.cameraPixelPos);
return ret;
}
void sub_8042D7C(void)
{
s32 i;
if (gUnknown_203B414 == NULL)
return;
for (i = 0; i < gUnknown_203B414->unk8; i++) {
if (sub_800E9A8(gUnknown_203B414->unkC[i])) {
sub_800DC14(gUnknown_203B414->unkC[i]);
}
}
sub_800DBBC();
MemoryFree(gUnknown_203B414);
gUnknown_203B414 = NULL;
}
void sub_8042DD4(s32 a0, Entity *a1, s32 a2)
{
s32 i;
for (i = 0; i < 3; i++) {
struct unkStruct_Dungeon5C4_sub *strPtr = &gDungeon->unk5C4[i];
if (strPtr->unk0 == -1) {
strPtr->unk0 = a0;
strPtr->unkC = a1;
strPtr->unk4 = a2;
strPtr->unk8 = sub_800E6D8(a0);
return;
}
}
}
static UNUSED bool32 sub_8042E1C(void)
{
s32 i;
for (i = 0; i < 3; i++) {
struct unkStruct_Dungeon5C4_sub *strPtr = &gDungeon->unk5C4[i];
if (strPtr->unk0 != -1 && sub_800E9A8(strPtr->unk0)) {
return TRUE;
}
}
return FALSE;
}
void sub_8042E5C(void)
{
s32 i;
for (i = 0; i < 3; i++) {
struct unkStruct_Dungeon5C4_sub *strPtr = &gDungeon->unk5C4[i];
if (strPtr->unk0 >= 0 && !sub_800E9A8(strPtr->unk0)) {
strPtr->unk0 = -1;
strPtr->unkC = NULL;
}
}
}
void sub_8042E98(void)
{
s32 i;
for (i = 0; i < 3; i++) {
struct unkStruct_Dungeon5C4_sub *strPtr = &gDungeon->unk5C4[i];
strPtr->unk0 = -1;
strPtr->unk4 = 0;
strPtr->unkC = NULL;
}
}
void sub_8042EC8(Entity *a0, s32 a1)
{
s32 i;
for (i = 0; i < 3; i++) {
struct unkStruct_Dungeon5C4_sub *strPtr = &gDungeon->unk5C4[i];
if (strPtr->unk0 >= 0 && strPtr->unkC == a0) {
DungeonPos sp8 = {a0->pixelPos.x / 256, a0->pixelPos.y / 256};
DungeonPos sp4 = {0};
EntityInfo *entInfo = GetEntInfo(a0);
if (strPtr->unk8 != -1) {
sub_800569C(&sp4,
&a0->axObj,
strPtr->unk8);
}
sub_800EB24(strPtr->unk0, &sp8, &sp4,a1, entInfo->action.direction);
}
}
}

View File

@@ -1,427 +0,0 @@
#include "global.h"
#include "structs/str_dungeon.h"
#include "code_800DAC0.h"
#include "code_800ED38.h"
#include "code_803E46C.h"
#include "code_803E668.h"
#include "code_8041AD0.h"
#include "code_804267C.h"
#include "code_8045A00.h"
#include "code_806CD90.h"
#include "dungeon.h"
#include "dungeon_engine.h"
#include "dungeon_leader.h"
#include "dungeon_map.h"
#include "dungeon_message.h"
#include "dungeon_music.h"
#include "dungeon_util.h"
#include "items.h"
#include "sprite.h"
extern const u16 gUnknown_80F67DC[4];
extern const u16 gUnknown_80F67E4[4];
extern const s32 gUnknown_80F67EC[8];
extern const u32 gUnknown_80F680C[8];
extern const u16 gUnknown_80F682C[8];
extern const u8 *gPtrFeralFoundItemMessage[];
extern void sub_804151C(Entity *pokemon, u32 r1, u8 r2);
extern void sub_804178C(u32);
extern void sub_80416A4(DungeonPos *r0, u32 r1, bool8 r2);
extern void sub_80429A0(Entity *);
extern void sub_8042B34(u32, u32, u32);
extern bool8 sub_8042CC0(void);
extern void sub_8042D7C(void);
extern u8 GetFloorType(void);
extern bool8 sub_8045888(Entity *);
extern s32 sub_80416E0(PixelPos*, u32, bool8);
extern u32 sub_8041764(unkStruct_80416E0 *, bool8);
extern u32 sub_800E49C();
extern void sub_800EF40(u8 r0, u8 r1);
void sub_8042390(Entity *entity, Item *item)
{
s32 sVar1;
s32 counter;
u8 id;
u32 uVar6;
DungeonPos asStack_24[4];
DungeonPos local_14;
if (sub_8042768(entity)) {
id = !ItemSticky(item) ? item->id : ITEM_NOTHING;
sub_800EF40(id, 0);
sub_800EF64();
sub_803E708(4,0x42);
local_14.x = (entity->pixelPos).x / 256;
local_14.y = (entity->pixelPos).y / 256;
sVar1 = (local_14.y - gDungeon->unk181e8.cameraPixelPos.y) / 2 + 1;
sub_8005700(asStack_24,&entity->axObj);
uVar6 = sub_800E49C(id,&local_14,asStack_24,0,sVar1);
for (counter = 0; counter < 1000; counter++) {
DungeonRunFrameActions(0x42);
if (!sub_800E9A8(uVar6)) {
break;
}
}
}
}
void sub_804245C(Entity *entity, Item *item)
{
s32 sVar1;
s32 counter;
u8 id;
u32 uVar6;
DungeonPos asStack_24[4];
DungeonPos local_14;
if (sub_8042768(entity)) {
id = !ItemSticky(item) ? item->id : ITEM_NOTHING;
sub_800EF64();
sub_803E708(4,0x42);
local_14.x = (entity->pixelPos).x / 256;
local_14.y = (entity->pixelPos).y / 256;
sVar1 = (local_14.y - gDungeon->unk181e8.cameraPixelPos.y) / 2 + 1;
sub_8005700(asStack_24,&entity->axObj);
uVar6 = sub_800E49C(id,&local_14,asStack_24,1,sVar1);
for (counter = 0; counter < 1000; counter++) {
DungeonRunFrameActions(0x42);
if (!sub_800E9A8(uVar6)) {
break;
}
}
}
}
s32 sub_8042520(Entity *a0)
{
s32 i;
s32 uVar4;
DungeonPos pos;
u32 dir;
s32 iVar8;
unkStruct_80416E0 local_58;
unkStruct_2039DB0 u203; // Unused
PixelPos local_2c;
if (sub_8045888(a0)) {
dir = GetEntInfo(a0)->action.direction;
pos.x = a0->pixelPos.x / 0x100;
pos.y = a0->pixelPos.y / 0x100;
iVar8 = (pos.y - gDungeon->unk181e8.cameraPixelPos.y) / 2;
local_58.unk0 = 357;
local_58.unk4 = 0;
local_58.dir = dir;
local_58.x = pos.x;
local_58.y = pos.y;
local_58.unk10 = 0;
local_58.unk12 = 0;
local_58.unk14 = -1;
local_58.unk18 = iVar8;
sub_8004E8C(&u203);
uVar4 = sub_8041764(&local_58, 0);
for (i = 0; i < 6; i++) {
sub_800E8AC(uVar4, &pos, 0, iVar8, 0);
DungeonRunFrameActions(66);
pos.x += gAdjacentTileOffsets[dir].x * 4;
pos.y += gAdjacentTileOffsets[dir].y * 4;
iVar8 = (pos.y - gDungeon->unk181e8.cameraPixelPos.y) / 2;
}
sub_800DBBC();
local_2c.x = pos.x * 0x100;
local_2c.y = pos.y * 0x100;
uVar4 = sub_80416E0(&local_2c, 416, TRUE);
}
else
{
uVar4 = -1;
}
return uVar4;
}
// This func plays the appropriate ascend/descend SFX for stairs depending on the direction
void PlayStairsSound(void)
{
u32 songIndex;
songIndex = 997;
switch (GetFloorType()) {
case 0:
default:
songIndex = IsStairDirectionUp(gDungeon->unk644.dungeonLocation.id) ? 340 : 341;
break;
case 1:
case 2:
break;
}
PlaySoundEffect(songIndex);
}
void sub_80426C8(u32 a0, u32 a1)
{
if (a1 == 3)
DungeonStartNewBGM(0);
if (a0 != 4)
PlaySoundEffect(gUnknown_80F67DC[a1]);
else
PlaySoundEffect(gUnknown_80F67E4[a1]);
sub_8042B34(a0, a1, 0x80);
while (sub_8042CC0())
DungeonRunFrameActions(0x46);
sub_8042D7C();
LoadDungeonMapPalette();
sub_8052210(1);
}
void sub_8042730(Entity *a0, void *unused)
{
s32 i;
sub_806CDD4(a0, 8, 8);
for (i = 0; i < 100; i++) {
DungeonRunFrameActions(0x51);
if ((a0->axObj.axdata.sub1.unk10 & 3) != 0 || a0->axObj.unk43_animId2 != 8)
break;
}
}
bool8 sub_8042768(Entity* pokemon)
{
if (!pokemon->isVisible)
return FALSE;
if (gDungeon->unk181e8.blinded) {
if (gDungeon->unk181e8.cameraTarget == pokemon)
return TRUE;
else
return FALSE;
}
return sub_8045888(pokemon);
}
void sub_80427AC(void)
{
Entity *entity;
EntityInfo *enInfo;
s32 i;
for (i = 0; i < 20; i++) {
entity = gDungeon->activePokemon[i];
if (EntityIsValid(entity)) {
enInfo = GetEntInfo(entity);
if (enInfo->unkF3) {
enInfo->unkF3 = FALSE;
sub_80429A0(entity);
if (!enInfo->isNotTeamMember) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
DisplayDungeonLoggableMessageTrue(entity, *gPtrFeralFoundItemMessage);
}
}
}
}
}
void sub_8042818(u8 a0, bool8 a1)
{
Entity *en;
en = gDungeon->unk181e8.cameraTarget;
if (en == NULL)
en = GetLeader();
if (gUnknown_80F682C[a0] != 997)
sub_80421C0(en, gUnknown_80F682C[a0]);
if (gUnknown_80F67EC[a0] < 0)
return;
if (a1 && !IsBossFight())
sub_804151C(en, gUnknown_80F67EC[a0], 0);
else
sub_804151C(en, gUnknown_80F680C[a0], 0);
}
void sub_80428A0(Entity *r0)
{
sub_804151C(r0, 0x29, 1);
}
void sub_80428B0(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_80428C4(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_80428D8(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_80428EC(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_8042900(Entity *r0)
{
sub_804151C(r0, 0xD4 << 1, 0);
}
void ShowVisualFlags(Entity *r0)
{
sub_804151C(r0, 0x29, 0);
}
void sub_8042920(Entity *r0)
{
sub_804151C(r0, 0x48, 0);
}
void sub_8042930(Entity *r0)
{
sub_804151C(r0, 0xD3 << 1, 1);
}
void sub_8042940(Entity *r0)
{
sub_804151C(r0, 0xC7 << 1, 0);
}
void sub_8042950(Entity *r0)
{
sub_804151C(r0, 0xD8 << 1, 1);
sub_803E708(0xA, 0x42);
}
void sub_8042968(Entity *r0)
{
sub_804151C(r0, 0xD4 << 1, 0);
}
void sub_8042978(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_804298C(Entity *r0)
{
sub_804151C(r0, 0x1a9, 0);
}
void sub_80429A0(Entity *r0)
{
sub_804151C(r0, 0x199, 0);
}
void sub_80429B4(Entity *r0)
{
sub_804151C(r0, 0x1ab, 0);
}
void sub_80429C8(Entity *r0)
{
sub_804151C(r0, 0x4, 1);
}
void sub_80429D8(Entity *r0)
{
sub_804151C(r0, 0x8F << 1, 1);
}
void sub_80429E8(Entity *r0)
{
sub_804151C(r0, 0x11d, 1);
}
void sub_80429FC(DungeonPos *r0)
{
sub_80416A4(r0, 0x19E, TRUE);
sub_80421C0(NULL, 0xD4);
}
void sub_8042A14(DungeonPos *r0)
{
sub_80416A4(r0, 0x36, TRUE);
}
void sub_8042A24(Entity *r0)
{
sub_804151C(r0, 0x15, 1);
}
void sub_8042A34(DungeonPos *r0)
{
sub_80416A4(r0, 0x13E, FALSE);
}
void sub_8042A44(Entity *r0)
{
sub_804151C(r0, 0xDA << 1, 1);
}
void sub_8042A54(DungeonPos *r0)
{
sub_80416A4(r0, 0x37, TRUE);
}
void sub_8042A64(DungeonPos *r0)
{
sub_80416A4(r0, 0x29, TRUE);
}
void sub_8042A74(Entity *r0)
{
sub_804151C(r0, 0x18, 1);
}
void sub_8042A84(s16 param_1, Entity *entity, u32 param_3)
{
s32 iVar3;
s32 r6;
s32 param_1_s16;
param_1_s16 = param_1;
r6 = IntToF248_2(2).raw;
if (sub_8042768(entity)) {
sub_804151C(entity,param_1_s16,0);
sub_803E708(param_3,0x42);
do {
if (entity->unk1C.raw > IntToF248_2(199.999).raw) break;
DungeonRunFrameActions(0x42);
entity->unk1C.raw += + r6;
r6 += IntToF248_2(1).raw;
iVar3 = (entity->pixelPos.y - entity->unk1C.raw) / 256;
} while (-8 <= iVar3 - gDungeon->unk181e8.cameraPixelPos.y);
entity->isVisible = 0;
sub_804178C(0);
}
}
void sub_8042B0C(Entity *entity)
{
sub_8042A84(0x13e, entity, 5);
}
void sub_8042B20(Entity *entity)
{
sub_8042A84(0x1BC, entity, 0xE);
}

View File

@@ -1,261 +0,0 @@
#include "global.h"
#include "constants/dungeon_action.h"
#include "structs/str_item_text.h"
#include "code_8044CC8.h"
#include "dungeon_generation.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_util.h"
#include "items.h"
// size: 0x8
typedef struct unkStr_80F7C54
{
s32 unk0;
u8 *text;
} unkStr_80F7C54;
EWRAM_DATA unkStruct_202EE44 gDungeonSubMenu[10] = {0};
extern s32 gDungeonSubMenuItemsCount;
extern u16 gUnknown_80F6964[NUM_ITEM_CATEGORIES];
extern u8 gUnknown_80F697C[];
extern u8 *gUnknown_80F7C50[10];
extern const unkStr_80F7C54 gUnknown_80F7C54[65];
extern u8 *gUnknown_80F91EC[];
extern bool8 sub_8045888(Entity *);
extern u8 GetFloorType(void);
Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3)
{
const Tile *tile;
Item *item;
EntityInfo *info;
if ((u8)(param_2->actionUseIndex - 1) < INVENTORY_SIZE) {
item = &gTeamInventoryRef->teamItems[param_2->actionUseIndex - 1];
}
else if (param_2->actionUseIndex == 0x80) {
tile = GetTile((param_2->itemPos).x,(param_2->itemPos).y);
item = GetItemData(tile->object);
}
else {
if (param_2->actionUseIndex == 0x81) {
info = GetEntInfo(param_1);
}
else {
u8 id = param_2->actionUseIndex - 0x90;
if (3 < id) {
return NULL;
}
info = GetEntInfo(gDungeon->teamPokemon[param_2->actionUseIndex - 0x90]);
}
item = &info->heldItem;
}
return item;
}
bool8 sub_8044D40(ActionContainer *param_1,s32 index)
{
Item *item;
ActionParameter *puVar1;
puVar1 = &param_1->actionParameters[index];
if ((u8)(puVar1->actionUseIndex - 1) < INVENTORY_SIZE) {
item = &gTeamInventoryRef->teamItems[puVar1->actionUseIndex - 1];
item->id = ITEM_NOTHING;
item->quantity = 0;
item->flags = 0;
FillInventoryGaps();
}
else {
if (puVar1->actionUseIndex != 0x80) {
return FALSE;
}
RemoveItemFromDungeonAt(&puVar1->itemPos,1);
}
return TRUE;
}
Item *sub_8044D90(Entity *entity, s32 index, s32 unused)
{
EntityInfo *info = GetEntInfo(entity);
return sub_8044CC8(entity, &info->action.actionParameters[index], unused);
}
Entity *sub_8044DA4(Entity *entity, s32 index)
{
EntityInfo *info = GetEntInfo(entity);
return gDungeon->teamPokemon[info->action.actionParameters[index].actionUseIndex];
}
u16 sub_8044DC8(Item *param_1)
{
if (param_1->id == ITEM_SWITCH_BOX) {
return 0x35;
}
else {
return gUnknown_80F6964[GetItemCategory(param_1->id)];
}
}
void sub_8044DF0(Entity *entity, s32 index, u32 unused)
{
Item *item;
EntityInfo *info;
info = GetEntInfo(entity);
item = sub_8044D90(entity,index,unused);
if ((info->action).actionParameters[0].actionUseIndex == 0x80) {
RemoveItemFromDungeonAt(&(info->action).actionParameters[0].itemPos,1);
}
else {
item->id = ITEM_NOTHING;
item->quantity = 0;
item->flags = 0;
FillInventoryGaps();
}
}
void sub_8044E24(Entity *entity,int index,u32 unused)
{
Item *itemPtr;
EntityInfo *info;
DungeonPos *pos;
Item item;
itemPtr = sub_8044D90(entity,index,unused);
info = GetEntInfo(entity);
if (!IsHMItem(itemPtr->id)) {
if (GetItemCategory(itemPtr->id) == CATEGORY_TMS_HMS) {
if (info->action.actionParameters[index].actionUseIndex == 0x80) {
item = *itemPtr;
pos = &info->action.actionParameters[index].itemPos;
RemoveItemFromDungeonAt(pos,1);
item.quantity = itemPtr->id - 125;
item.id = ITEM_TM_USED_TM;
AddItemToDungeonAt(pos,&item,1);
}
else {
itemPtr->quantity = itemPtr->id - 125;
itemPtr->id = ITEM_TM_USED_TM;
}
}
else {
sub_8044DF0(entity,index,unused);
}
}
}
// Similar to sub_8044BA8
const u8 *GetDungeonSubMenuItemString(s32 param_1)
{
u16 actionId = gDungeonSubMenu[param_1].actionId;
if (actionId == ACTION_STAIRS && GetFloorType() == FLOOR_TYPE_RESCUE) {
return *gUnknown_80F91EC;
}
else {
if (!AreStringsDifferent(gUnknown_80F7C50[actionId << 1], gUnknown_80F697C)) {
return gActions[GetItemActionType(gDungeonSubMenu[param_1].unk2)].useText;
}
else {
return gUnknown_80F7C50[actionId << 1];
}
}
}
bool8 CanSubMenuItemBeChosen(s32 itemId)
{
if (itemId < 0)
return FALSE;
else
return gDungeonSubMenu[itemId].canBeChosen;
}
void AddActionToDungeonSubMenu(u16 actionId, u8 param_2)
{
int index;
if (gDungeonSubMenuItemsCount < 10) {
for(index = 0; index < gDungeonSubMenuItemsCount; index++)
{
if (gDungeonSubMenu[index].actionId == actionId) {
return;
}
}
gDungeonSubMenu[gDungeonSubMenuItemsCount].actionId = actionId;
gDungeonSubMenu[gDungeonSubMenuItemsCount].unk2 = param_2;
gDungeonSubMenu[gDungeonSubMenuItemsCount].canBeChosen = TRUE;
gDungeonSubMenuItemsCount++;
}
}
s32 ActionToDungeonSubMenuId(u16 actionId)
{
int index;
for(index = 0; index < gDungeonSubMenuItemsCount; index++)
{
if (gDungeonSubMenu[index].actionId == actionId) {
return index;
}
}
return -1;
}
void SetActionUnusableInDungeonSubMenu(u16 actionId)
{
int index;
for(index = 0; index < gDungeonSubMenuItemsCount; index++)
{
if (gDungeonSubMenu[index].actionId == actionId) {
gDungeonSubMenu[index].canBeChosen = FALSE;
return;
}
}
}
bool8 IsNotAttacking(Entity *param_1, bool8 param_2)
{
EntityInfo *info;
u16 *action;
info = GetEntInfo(param_1);
action = &(info->action).action;
if ((param_2 == 0) || (sub_8045888(param_1)))
{
if(*action == ACTION_NOTHING)
return TRUE;
if (*action == ACTION_WALK)
return TRUE;
if (*action == ACTION_PASS_TURN)
return TRUE;
if (*action == ACTION_UNK5)
return TRUE;
return FALSE;
}
else {
return TRUE;
}
}
void sub_8045064(void)
{
s32 i, j;
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];
if (gUnknown_80F7C54[iPtr->actionId].unk0 > gUnknown_80F7C54[jPtr->actionId].unk0) {
SWAP(*iPtr, *jPtr, temp);
}
}
}
}

View File

@@ -1,291 +0,0 @@
#include "global.h"
#include "structs/str_dungeon.h"
#include "code_803E724.h"
#include "code_80450F8.h"
#include "dungeon_map_access.h"
#include "dungeon_range.h"
#include "dungeon_util.h"
#include "tile_types.h"
#include "pokemon.h"
#include "code_805D8C8.h"
extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE];
extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE];
extern void sub_8045ACC(void);
extern s32 GetMonsterApparentID(Entity *pokemon, s32 id);
Entity *sub_80453AC(s32 _species)
{
s32 i;
s32 species = (s16) _species;
s32 validId = -1;
s32 bodySize = GetBodySize(species);
for (i = 0; i <= MAX_TEAM_BODY_SIZE - bodySize; i++) {
s32 j;
for (j = 0; j < bodySize; j++) {
if (gUnknown_202EE70[i + j] != 0)
break;
}
if (j == bodySize) {
validId = i;
break;
}
}
if (validId != -1) {
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
s32 apparentId;
s32 j;
Entity *entity = gDungeon->teamPokemon[i];
if (!EntityIsValid(entity)) {
entity->type = ENTITY_MONSTER;
entity->unk24 = i;
entity->axObj.info.monster = &gDungeon->unk69C[i];
entity->axObj.info.monster->id = species;
apparentId = (s16) GetMonsterApparentID(NULL, species);
entity->axObj.info.monster->apparentID = apparentId;
entity->axObj.info.monster->isNotTeamMember = FALSE;
entity->axObj.spriteFile = GetSpriteData((s16)GetMonsterApparentID(NULL, species));
entity->axObj.unk40_maybeAnimTimer = (validId * 16) + 0x40;
entity->axObj.unk42_animId1 = 7;
entity->axObj.unk44_direction1 = 0;
entity->axObj.unk43_animId2 = 0xFF;
entity->axObj.unk45_orientation = 1;
entity->axObj.unk47 = 1;
entity->unk1C = IntToF248(0);
sub_8045ACC();
entity->axObj.info.monster->unk167 = validId;
entity->axObj.info.monster->unk168 = bodySize;
for (j = 0; j < bodySize; j++) {
gUnknown_202EE70[validId] = 1;
validId++;
}
entity->spawnGenID = gDungeon->unk644.unk24++;
return entity;
}
}
}
return NULL;
}
Entity *sub_804550C(s32 _species)
{
s32 i;
s32 species = (s16) _species;
s32 validId = -1;
s32 bodySize = GetBodySize(species);
for (i = 0; i <= DUNGEON_MAX_WILD_POKEMON_BODY_SIZE - bodySize; i++) {
s32 j;
for (j = 0; j < bodySize; j++) {
if (gUnknown_202EE76[i + j] != 0)
break;
}
if (j == bodySize) {
validId = i;
break;
}
}
if (validId != -1) {
for (i = 0; i < DUNGEON_MAX_WILD_POKEMON_BODY_SIZE; i++) {
s32 j;
Entity *entity = gDungeon->wildPokemon[i];
if (!EntityIsValid(entity)) {
entity->type = ENTITY_MONSTER;
entity->unk24 = i;
entity->unk22 = 0;
entity->axObj.info.monster = &gDungeon->unkEBC[i];
entity->axObj.info.monster->id = species;
entity->axObj.info.monster->apparentID = GetMonsterApparentID(NULL, species);
entity->axObj.info.monster->isNotTeamMember = TRUE;
entity->axObj.spriteFile = GetSpriteData((s16)GetMonsterApparentID(NULL, species));
entity->axObj.unk40_maybeAnimTimer = ((validId + 6) * 16) + 0x40;
entity->axObj.unk42_animId1 = 7;
entity->axObj.unk44_direction1 = 0;
entity->axObj.unk43_animId2 = 0xFF;
entity->axObj.unk45_orientation = 1;
entity->axObj.unk47 = 1;
entity->unk1C = IntToF248(0);
entity->axObj.info.monster->unk167 = validId;
entity->axObj.info.monster->unk168 = bodySize;
for (j = 0; j < bodySize; j++) {
gUnknown_202EE76[validId] = 1;
validId++;
}
sub_8045ACC();
entity->spawnGenID = gDungeon->unk644.unk24++;
return entity;
}
}
}
return NULL;
}
Entity *SpawnTrap(u8 trapID, DungeonPos *pos, u8 c)
{
Entity *entity;
s32 i;
for (i = 0; i < DUNGEON_MAX_TRAPS; i++) {
entity = gDungeon->traps[i];
if (!EntityIsValid(entity)) {
entity->type = ENTITY_TRAP;
entity->axObj.info.trap = &gDungeon->unk3908[i];
entity->axObj.info.trap->id = trapID;
entity->axObj.info.trap->unk1 = c;
entity->unk1C = IntToF248(0);
entity->unk22 = 0;
entity->pos = *pos;
entity->spawnGenID = 0;
return entity;
}
}
return NULL;
}
Entity *sub_8045708(DungeonPos *pos)
{
s32 i;
Entity *ent;
if (gDungeonWaterType[gDungeon->tileset] == DUNGEON_WATER_TYPE_LAVA
&& (GetTileMut(pos->x, pos->y)->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) == TERRAIN_TYPE_SECONDARY) {
return NULL;
}
for (i = 0; i < DUNGEON_MAX_ITEMS; i++) {
ent = gDungeon->items[i];
if (!EntityIsValid(ent)) {
ent->type = ENTITY_ITEM;
ent->axObj.info.item = &gDungeon->unk3804[i];
ent->pos = *pos;
SetEntityPixelPos(ent, ((pos->x * 24) + 4) * 0x100, ((pos->y * 24) + 4) * 0x100);
ent->spawnGenID = 0;
ent->unk22 = 0;
ent->unk1C = IntToF248(0);
return ent;
}
}
return NULL;
}
void sub_80457DC(Entity* ent)
{
ent->type = ENTITY_UNK_5;
ent->pos.x = 0;
ent->pos.y = 0;
SetEntityPixelPos(ent, 0, 0);
ent->spawnGenID = 0;
ent->unk22 = 0;
}
bool8 sub_8045804(Entity *ent)
{
UnkDungeonGlobal_unk181E8_sub* saveTyping;
Entity* camTarget;
EntityInfo *monInfo;
switch (GetEntityType(ent)) {
case ENTITY_MONSTER: {
if (ent->isVisible) {
saveTyping = &gDungeon->unk181e8;
camTarget = saveTyping->cameraTarget;
monInfo = GetEntInfo(ent);
if (!monInfo->isNotTeamMember)
return TRUE;
if (!saveTyping->showInvisibleTrapsMonsters && monInfo->invisibleClassStatus.status == STATUS_INVISIBLE)
return FALSE;
if (saveTyping->allTilesRevealed || saveTyping->unk1820D)
return TRUE;
if (camTarget != NULL)
return IsPositionActuallyInSight(&saveTyping->cameraPos, &ent->pos);
}
return FALSE;
}
/*case ENTITY_TRAP:
case ENTITY_ITEM:
case ENTITY_UNK_4:*/
default: {
return TRUE;
}
case ENTITY_NOTHING:
case ENTITY_UNK_5: {
return FALSE;
}
}
}
bool8 sub_8045888(Entity *ent)
{
if (ent->isVisible) {
s32 x = (ent->pixelPos.x / 256) - gDungeon->unk181e8.cameraPixelPos.x;
s32 y = (ent->pixelPos.y / 256) - gDungeon->unk181e8.cameraPixelPos.y;
if (x >= -32 && y >= -32 && x <= 272 && y <= 192) {
UnkDungeonGlobal_unk181E8_sub *saveTyping = &gDungeon->unk181e8;
switch (GetEntityType(ent)) {
case ENTITY_ITEM: {
if (!saveTyping->showAllFloorItems && !sub_803F428(&ent->pos))
return FALSE;
break;
}
case ENTITY_MONSTER: {
EntityInfo *monInfo = GetEntInfo(ent);
if (monInfo->isNotTeamMember) {
if (!gDungeon->unk181e8.showInvisibleTrapsMonsters && monInfo->invisibleClassStatus.status == STATUS_INVISIBLE)
return FALSE;
if (!saveTyping->unk1820D && !sub_803F428(&ent->pos))
return FALSE;
}
break;
}
case ENTITY_TRAP: {
if (!gDungeon->unk181e8.showInvisibleTrapsMonsters && !ent->isVisible)
return FALSE;
break;
}
case ENTITY_NOTHING:
case ENTITY_UNK_5: {
return FALSE;
}
case ENTITY_UNK_4:
default: {
break;
}
}
return TRUE;
}
}
return FALSE;
}

View File

@@ -1,85 +0,0 @@
#include "global.h"
#include "code_8045A00.h"
#include "constants/item.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_leader.h"
#include "dungeon_message.h"
#include "dungeon_music.h"
#include "dungeon_map.h"
#include "dungeon_ai_targeting.h"
#include "string_format.h"
#include "items.h"
#include "trap.h"
#include "status_checks_1.h"
#include "structs/map.h"
#include "structs/str_dungeon.h"
void sub_8045BF8(u8 *, Item *);
extern u8 *gUnknown_80FE6F4[];
void sub_8045ACC(void)
{
Entity *entity;
s32 index;
s32 pokeCount;
pokeCount = 0;
for(index = 0; index < MAX_TEAM_MEMBERS; index++)
{
entity = gDungeon->teamPokemon[index];
if (EntityIsValid(entity)) {
gDungeon->activePokemon[pokeCount] = entity;
pokeCount++;
}
}
for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++)
{
entity = gDungeon->wildPokemon[index];
if (EntityIsValid(entity)) {
gDungeon->activePokemon[pokeCount] = entity;
pokeCount++;
}
}
for (; pokeCount < DUNGEON_MAX_POKEMON; pokeCount++) {
gDungeon->activePokemon[pokeCount] = NULL;
}
}
s32 GetTeamMemberEntityIndex(Entity *pokemon)
{
Entity *entity;
s32 index;
for(index = 0; index < MAX_TEAM_MEMBERS; index++)
{
entity = gDungeon->teamPokemon[index];
if (pokemon == entity)
return index;
}
return -1;
}
void SubstitutePlaceholderStringTags(u8 *buffer, Entity *entity, u32 param_3)
{
switch(GetEntityType(entity))
{
case ENTITY_MONSTER:
SetMessageArgument_2(buffer, GetEntInfo(entity), param_3);
break;
case ENTITY_ITEM:
sub_8045BF8(buffer, GetItemData_1(entity));
break;
case ENTITY_TRAP:
GetTrapName(buffer, GetTrapData_1(entity)->id);
break;
default:
strcpy(buffer, *gUnknown_80FE6F4);
break;
}
}

39
src/code_8046CE4.c Normal file
View File

@@ -0,0 +1,39 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_items.h"
#include "dungeon_config.h"
#include "structs/dungeon_entity.h"
// Decompile code_8046CE4.s from bottom instead of top and put functions before sub_8047930
bool8 sub_8047930(Entity *pokemon, Entity *target)
{
bool8 flag;
if (((GetEntInfo(target)->shopkeeper == TRUE) ||
(GetEntInfo(target)->monsterBehavior == BEHAVIOR_DIGLETT)) || (GetEntInfo(target)->monsterBehavior == BEHAVIOR_RESCUE_TARGET)) {
return FALSE;
}
else {
if(DungeonRandInt(100) < gUnknownDungeonChance)
flag = TRUE;
else
flag = FALSE;
if (GetEntityType(pokemon) == ENTITY_MONSTER) {
if (HasHeldItem(pokemon, ITEM_WHIFF_SPECS)) {
flag = FALSE;
}
else {
if (HasHeldItem(pokemon, ITEM_LOCKON_SPECS)) {
flag = TRUE;
}
}
}
if ((GetEntityType(target) == ENTITY_MONSTER) && (HasHeldItem(target, ITEM_DODGE_SCARF))) {
flag = FALSE;
}
}
return flag;
}

View File

@@ -7,24 +7,23 @@
#include "code_803E724.h"
#include "code_8041AD0.h"
#include "code_8044CC8.h"
#include "code_8045A00.h"
#include "code_8066D04.h"
#include "code_806CD90.h"
#include "code_8077274_1.h"
#include "code_807CD9C.h"
#include "code_8084778.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_capabilities.h"
#include "dungeon_engine.h"
#include "run_dungeon.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_misc.h"
#include "dungeon_move.h"
#include "dungeon_movement.h"
#include "dungeon_move_util.h"
#include "dungeon_logic.h"
#include "dungeon_music.h"
#include "dungeon_random.h"
#include "dungeon_strings.h"
#include "dungeon_util.h"
#include "friend_area.h"
#include "input.h"
@@ -35,54 +34,10 @@
#include "pokemon_3.h"
#include "position_util.h"
#include "sprite.h"
#include "status_checks_1.h"
#include "string_format.h"
#include "text_1.h"
#include "trap.h"
extern u8 *gUnknown_80F8BE0[];
extern u8 *gUnknown_80FF76C[];
extern u8 *gItemStickyCannotMove1[];
extern u8 *gItemStickyCannotMove2[];
extern u8 *gItemStickyCannotEquip[];
extern u8 *gMonTookAndReturnedItem[];
extern u8 *gUnknown_80F8CE4[];
extern u8 *gUnknown_80F8CE8[];
extern u8 *gUnknown_80F8D04[];
extern u8 *gUnknown_80F8D20[];
extern u8 *gUnknown_80F8D44[];
extern u8 *gUnknown_80F8D60[];
extern u8 *gUnknown_80F8D7C[];
extern u8 *gUnknown_80F8DB4[];
extern u8 *gUnknown_80F8DE0[];
extern u8 *gUnknown_80F8E04[];
extern u8 *gUnknown_80F8E28[];
extern u8 *gItemStickyCannotMove3[];
extern u8 *gNothingCanBePutDownHere[];
extern u8 *gUnknown_80F8E2C[];
extern u8 *gNoExchangesHere[];
extern u8 *gSwappedGroundItem[];
extern const u8 *const gMonThrewItem2;
extern const u8 *const gMonThrewItem1;
extern const u8 *const gCannotFarewell;
extern const u8 *const gSayFarewellQ;
extern const u8 *const gUnknown_80FDFB8;
extern const u8 *const gUnknown_80F913C;
extern const u8 *const gCannotTalk;
extern const u8 *const gUnknown_80FE008;
extern const u8 *const gUnknown_80FDF74;
extern const u8 *const gUnknown_80FF674;
extern const u8 *const gUnknown_80F9114;
extern const u8 *const gMonDisappointedAndLeft;
extern const u8 *const gSendMonBackQ;
extern const u8 *const gSendMonBackWithItemQ;
extern const u8 *const gMonWentBack;
extern const u8 *const gMonCringing;
extern const u8 *const gMonParalyzed;
extern const u8 *const gUnknown_80FC690;
extern s32 gDungeonSubMenuItemsCount;
extern void sub_8071DA4(Entity *);
extern void sub_806A1B0(Entity *);
extern void sub_8057588(Entity * pokemon, u8 param_2);
@@ -131,7 +86,7 @@ void HandleSetItemAction(Entity *param_1, bool8 param_2)
if (((itemPtr->flags & ITEM_FLAG_EXISTS)) && ((itemPtr->flags & ITEM_FLAG_SET))) {
if ((itemPtr->flags & ITEM_FLAG_STICKY)) {
sub_8045BF8(gFormatBuffer_Items[0],itemPtr);
LogMessageByIdWithPopupCheckUser(param_1,*gItemStickyCannotEquip);
LogMessageByIdWithPopupCheckUser(param_1,gItemStickyCannotEquip);
return;
}
itemPtr->flags &= ~(ITEM_FLAG_SET);
@@ -141,22 +96,22 @@ void HandleSetItemAction(Entity *param_1, bool8 param_2)
PlaySoundEffect(0x133);
if (param_2 != 0) {
if ((item->flags & ITEM_FLAG_STICKY)) {
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8D04);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8D04);
}
else {
if (GetItemCategory(item->id) == CATEGORY_THROWN_LINE) {
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8CE4);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8CE4);
}
else
{
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8CE8);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8CE8);
}
}
}
item->flags |= ITEM_FLAG_SET;
if (((item->flags & ITEM_FLAG_STICKY)) && (param_2 != 0)) {
sub_8045BF8(gFormatBuffer_Items[0],item);
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8BE0);
}
}
@@ -171,14 +126,14 @@ void HandleUnsetItemAction(Entity *entity,bool8 enableMessage)
if (((item->flags & ITEM_FLAG_EXISTS)) && ((item->flags & ITEM_FLAG_SET))) {
if ((item->flags & ITEM_FLAG_STICKY)) {
sub_8045BF8(gFormatBuffer_Items[0],item);
LogMessageByIdWithPopupCheckUser(entity,*gItemStickyCannotEquip);
LogMessageByIdWithPopupCheckUser(entity,gItemStickyCannotEquip);
return;
}
item->flags &= ~(ITEM_FLAG_SET);
sub_8045BF8(gFormatBuffer_Items[0],item);
PlaySoundEffect(0x133);
if (enableMessage) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8D20);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8D20);
}
}
}
@@ -207,7 +162,7 @@ void HandleGiveItemAction(Entity *param_1)
if ((!bVar3) && ((item->flags & (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) == (ITEM_FLAG_STICKY | ITEM_FLAG_SET))) {
sub_8045BF8(gFormatBuffer_Items[1],item);
LogMessageByIdWithPopupCheckUser(param_1,*gItemStickyCannotMove2);
LogMessageByIdWithPopupCheckUser(param_1,gItemStickyCannotMove2);
}
else
{
@@ -215,7 +170,7 @@ void HandleGiveItemAction(Entity *param_1)
if (((info2->heldItem).flags & ITEM_FLAG_EXISTS)) {
if (((info2->heldItem).flags & ITEM_FLAG_STICKY)) {
sub_8045BF8(gFormatBuffer_Items[1],&info2->heldItem);
LogMessageByIdWithPopupCheckUser(param_1,*gItemStickyCannotMove1);
LogMessageByIdWithPopupCheckUser(param_1,gItemStickyCannotMove1);
return;
}
item1 = (info2->heldItem);
@@ -233,9 +188,9 @@ void HandleGiveItemAction(Entity *param_1)
sub_8045BF8(gFormatBuffer_Items[0],&item2);
sub_8045BF8(gFormatBuffer_Items[1],&item1);
PlaySoundEffect(0x14d);
LogMessageByIdWithPopupCheckUser(param_1,*gMonTookAndReturnedItem);
LogMessageByIdWithPopupCheckUser(param_1,gMonTookAndReturnedItem);
if ((item2.flags & ITEM_FLAG_STICKY)) {
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8BE0);
}
}
else {
@@ -245,9 +200,9 @@ void HandleGiveItemAction(Entity *param_1)
info2->heldItem = item3;
sub_8045BF8(gFormatBuffer_Items[0],&item3);
PlaySoundEffect(0x14d);
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8D44);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8D44);
if ((item3.flags & ITEM_FLAG_STICKY)) {
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8BE0);
}
}
sub_806A6E8(entity);
@@ -272,13 +227,13 @@ void HandleTakeItemAction(Entity *param_1)
info = GetEntInfo(entity);
heldItem = &info->heldItem;
if (ItemExists(&gTeamInventoryRef->teamItems[ITEM_POWER_BAND])) {
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8D60);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8D60);
}
else
{
if (ItemSticky(heldItem)) {
sub_8045BF8(gFormatBuffer_Items[0],heldItem);
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8BE0);
}
else
{
@@ -289,7 +244,7 @@ void HandleTakeItemAction(Entity *param_1)
ZeroOutItem(heldItem);
AddItemToInventory(&item);
PlaySoundEffect(0x14d);
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8D7C);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8D7C);
sub_806A6E8(entity);
if (sub_80706A4(entity,&entity->pos) != 0) {
WarpTarget(param_1,entity,0,0);
@@ -317,11 +272,11 @@ void sub_8066BD4(Entity *param_1)
if (heldItem->flags & ITEM_FLAG_STICKY)
{
sub_8045BF8(gFormatBuffer_Items[0],heldItem);
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8BE0);
}
else if ((item->flags & (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) == (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) {
sub_8045BF8(gFormatBuffer_Items[0],item);
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8BE0);
}
else
{
@@ -334,7 +289,7 @@ void sub_8066BD4(Entity *param_1)
info->heldItem = *item;
*item = temp;
PlaySoundEffect(0x14d);
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80F8DB4);
LogMessageByIdWithPopupCheckUser(param_1,gUnknown_80F8DB4);
if (sub_80706A4(entity,&entity->pos) != 0) {
WarpTarget(param_1,entity,0,0);
}
@@ -360,37 +315,37 @@ void HandlePlaceItemAction(Entity *entity)
sub_8045BF8(gFormatBuffer_Items[0],item);
if (info->action.actionParameters[0].actionUseIndex == 0x80) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8DE0);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8DE0);
}
else if (info->action.actionParameters[0].actionUseIndex < 0x15 && (item->flags & (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) == (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8BE0);
}
else if (info->action.actionParameters[0].actionUseIndex == 0x81 && (item->flags & ITEM_FLAG_STICKY)) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8BE0);
}
else {
const Tile *tile = GetTile(entity->pos.x, entity->pos.y);
if ((tile->terrainType & TERRAIN_TYPE_STAIRS)) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8E04);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8E04);
}
else if (GetTerrainType(tile) != TERRAIN_TYPE_NORMAL) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8E04);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8E04);
}
else if (tile->object != NULL) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8E04);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8E04);
}
else {
item->flags &= ~(ITEM_FLAG_SET);
sub_8045BF8(gFormatBuffer_Items[0],item);
if (AddItemToDungeonAt(&entity->pos,item,1) == 0) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8E04);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8E04);
}
else {
ZeroOutItem(item);
FillInventoryGaps();
PlaySoundEffect(0x14d);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8E28);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8E28);
sub_807AB38(entity,gDungeon->forceMonsterHouse);
}
}
@@ -405,20 +360,20 @@ void sub_8066E14(Entity *entity)
item[1] = sub_8044D90(entity,1,6);
if (info->action.actionParameters[0].actionUseIndex != 0x80) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8E2C);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8E2C);
}
else if (info->action.actionParameters[1].actionUseIndex < 0x15 && (item[1]->flags & ITEM_FLAG_SET) && (item[1]->flags & ITEM_FLAG_STICKY)) {
sub_8045BF8(gFormatBuffer_Items[0],item[1]);
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80F8BE0);
}
else if (info->action.actionParameters[1].actionUseIndex == 0x81 && ItemSticky(item[1])) {
sub_8045BF8(gFormatBuffer_Items[1],item[1]);
LogMessageByIdWithPopupCheckUser(entity,*gItemStickyCannotMove3);
LogMessageByIdWithPopupCheckUser(entity,gItemStickyCannotMove3);
}
else {
const Tile *tile = GetTile((entity->pos).x,(entity->pos).y);
if (tile->object != NULL && GetEntityType(tile->object) != ENTITY_ITEM) {
LogMessageByIdWithPopupCheckUser(entity,*gNoExchangesHere);
LogMessageByIdWithPopupCheckUser(entity,gNoExchangesHere);
}
else {
Item newItems[2];
@@ -431,7 +386,7 @@ void sub_8066E14(Entity *entity)
RemoveItemFromDungeonAt(&info->action.actionParameters[0].itemPos,1);
ZeroOutItem(item[1]);
if (!AddItemToDungeonAt(&info->action.actionParameters[0].itemPos,&newItems[1],1)) {
LogMessageByIdWithPopupCheckUser(entity,*gNothingCanBePutDownHere);
LogMessageByIdWithPopupCheckUser(entity,gNothingCanBePutDownHere);
}
else {
if (info->action.actionParameters[1].actionUseIndex == 0x81) {
@@ -445,7 +400,7 @@ void sub_8066E14(Entity *entity)
sub_8045BF8(gFormatBuffer_Items[0],&newItems[1]);
sub_8045BF8(gFormatBuffer_Items[1],&newItems[0]);
PlaySoundEffect(0x14d);
LogMessageByIdWithPopupCheckUser(entity,*gSwappedGroundItem);
LogMessageByIdWithPopupCheckUser(entity,gSwappedGroundItem);
sub_807AB38(entity,gDungeon->forceMonsterHouse);
}
}
@@ -462,13 +417,13 @@ void sub_8066FA4(Entity *entity)
sub_8045BF8(gFormatBuffer_Items[0],item[0]);
if (info->action.actionParameters[0].actionUseIndex < 0x15 && (item[0]->flags & ITEM_FLAG_SET) && (item[0]->flags & ITEM_FLAG_STICKY)) {
sub_8045BF8(gFormatBuffer_Items[1],item[0]);
LogMessageByIdWithPopupCheckUser(entity,*gItemStickyCannotMove3);
LogMessageByIdWithPopupCheckUser(entity,gItemStickyCannotMove3);
}
else if (info->action.actionParameters[0].actionUseIndex == 0x81 && ItemSticky(item[0])) {
LogMessageByIdWithPopupCheckUser(entity,*gItemStickyCannotMove2);
LogMessageByIdWithPopupCheckUser(entity,gItemStickyCannotMove2);
}
else if (tile->object != NULL && GetEntityType(tile->object) != ENTITY_ITEM) {
LogMessageByIdWithPopupCheckUser(entity,*gNoExchangesHere);
LogMessageByIdWithPopupCheckUser(entity,gNoExchangesHere);
}
else {
Item newItems[2];
@@ -483,7 +438,7 @@ void sub_8066FA4(Entity *entity)
RemoveItemFromDungeonAt(&entity->pos,1);
ZeroOutItem(item[0]);
if (!AddItemToDungeonAt(&entity->pos, &newItems[0],1)) {
LogMessageByIdWithPopupCheckUser(entity,*gNothingCanBePutDownHere);
LogMessageByIdWithPopupCheckUser(entity,gNothingCanBePutDownHere);
}
else {
if (info->action.actionParameters[0].actionUseIndex == 0x81) {
@@ -494,7 +449,7 @@ void sub_8066FA4(Entity *entity)
}
FillInventoryGaps();
PlaySoundEffect(0x14d);
LogMessageByIdWithPopupCheckUser(entity,*gSwappedGroundItem);
LogMessageByIdWithPopupCheckUser(entity,gSwappedGroundItem);
sub_807AB38(entity,gDungeon->forceMonsterHouse);
}
}
@@ -537,16 +492,16 @@ void sub_80671A0(Entity *entity)
if (info->action.actionParameters[0].actionUseIndex == 0x81 && ItemSticky(item)) {
sub_8045BF8(gFormatBuffer_Items[0], item);
LogMessageByIdWithPopupCheckUser(entity, *gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(entity, gUnknown_80F8BE0);
sub_803E708(0x14, 0x4C);
}
else if ((GetItemCategory(item->id) == CATEGORY_THROWN_LINE || GetItemCategory(item->id) == CATEGORY_THROWN_ARC) && ItemSticky(item)) {
sub_8045BF8(gFormatBuffer_Items[0], item);
LogMessageByIdWithPopupCheckUser(entity, *gUnknown_80F8BE0);
LogMessageByIdWithPopupCheckUser(entity, gUnknown_80F8BE0);
sub_803E708(0x14, 0x4C);
}
else if (ShouldMonsterRunAwayAndShowEffect(entity, TRUE)) {
LogMessageByIdWithPopupCheckUser(entity, *gUnknown_80FF76C);
LogMessageByIdWithPopupCheckUser(entity, gUnknown_80FF76C);
sub_803E708(0x14, 0x4C);
}
else {
@@ -892,543 +847,3 @@ void sub_8067904(Entity *entity, u16 moveId)
}
}
}
extern void sub_80684C4(void);
void sub_8045064(void);
extern void sub_8068344(void);
bool8 CanSubMenuItemBeChosen(s32 param_1);
void sub_8068310(s32 n, PokemonStruct1 **monPtrs);
void sub_8067F00(u8 a0, PokemonStruct1 **a1, s32 a2, s32 a3, s32 a4);
extern void DungeonShowWindows(WindowTemplates *a0, u8 a1);
u32 sub_8014140(s32 a0, const void *a1);
void sub_8083D1C(void);
void PlayDungeonConfirmationSE(void);
void PlayDungeonCancelSE(void);
void sub_806806C(PokemonStruct1 *a0);
void CreateDungeonMenuSubWindow(WindowTemplates *a0, s32 a1);
extern const s32 gUnknown_8106E80[];
extern MenuInputStruct gDungeonMenu;
extern u32 gDungeonFramesCounter;
static EWRAM_DATA WindowHeader gUnknown_202F308 = {0};
static EWRAM_DATA s32 gUnknown_202F30C = 0;
static EWRAM_DATA s32 gUnknown_202F310 = 0;
// It's likely a struct only used in Blue version. Touchpad maybe?
static const u8 gUnknown_8106DA4[] = {
0x01, 0, 0x38, 0, 0, 0, 0x18, 0, 0x18, 0, 0, 0, 0x02, 0, 0x38, 0, 0x68, 0, 0x18, 0, 0x18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static const WindowTemplates gUnknown_8106DC8 = {
.id = {
[0] =
{
.unk0 = 0,
.type = WINDOW_TYPE_WITH_HEADER,
.pos = {0x02, 0x02},
.width = 0x11,
.height = 0x0E,
.unk10 = 0x12,
.unk12 = 0x02,
.header = &gUnknown_202F308
},
[1] =
{
.unk0 = 0,
.type = WINDOW_TYPE_NORMAL,
.pos = {0x15, 0x04},
.width = 0x07,
.height = 0x04,
.unk10 = 0x04,
.unk12 = 0,
.header = NULL
},
[2] = WIN_TEMPLATE_DUMMY,
[3] = WIN_TEMPLATE_DUMMY,
}
};
void sub_8067A80(u8 a0, s32 a1, s32 a2, PokemonStruct1 **a3)
{
s32 i;
s32 r10;
WindowTemplates spTxtStruct = gUnknown_8106DC8;
gUnknown_202F30C = 0;
r10 = 0;
for (i = 0; i < a2; i++) {
a3[i]->unk0 &= ~(0x8000);
}
while (1) {
sub_8068310(a2, a3);
if (gUnknown_202F310 >= a1)
break;
while (1) {
s32 r7 = 0, r5 = 0;
gUnknown_202F308.count = 1;
gUnknown_202F308.currId = 0;
gUnknown_202F308.width = 0xE;
gUnknown_202F308.f3 = 0;
ASM_MATCH_TRICK(r7);
DungeonShowWindows(&spTxtStruct, 1);
sub_8067F00(a0, a3, gUnknown_202F30C, a2, a1);
gDungeonMenu.unk1A = min(a2, 8);
gDungeonMenu.menuIndex = r10;
gDungeonMenu.unk1C = 8;
gDungeonMenu.unk1E = 0;
gDungeonMenu.unk20 = 0;
gDungeonMenu.unk4 = 0;
gDungeonMenu.firstEntryY = 18;
gDungeonMenu.unkC = 0;
gDungeonMenu.unkE = 0;
gDungeonMenu.unk14.x = 0;
gDungeonMenu.unk0 = 0;
sub_801317C(&gDungeonMenu.unk28);
sub_80137B0(&gDungeonMenu, 0);
while (1) {
s32 r4;
AddMenuCursorSprite(&gDungeonMenu);
r5 = 0;
r7 = 0;
if (a2 - gUnknown_202F30C > 8) {
r5 = 1;
sub_80684C4();
}
if (gUnknown_202F30C != 0) {
r7 = 1;
sub_8068344();
}
r4 = sub_8014140(0, gUnknown_8106DA4);
DungeonRunFrameActions(0x37);
if (r4 == 2 && r5) {
if (a2 - gUnknown_202F30C > 8) {
s32 i;
for (i = 0; i < 6; i++) {
ScrollDownWindowFunc(0);
DungeonRunFrameActions(0x37);
}
gUnknown_202F30C++;
}
r7 = 0;
r10 = 7;
break;
}
if (gRealInputs.repeated & DPAD_DOWN) {
PlayDungeonCursorSE(1);
if (gDungeonMenu.menuIndex == 7) {
if (a2 - gUnknown_202F30C > 8) {
s32 i;
for (i = 0; i < 6; i++) {
ScrollDownWindowFunc(0);
DungeonRunFrameActions(0x37);
}
gUnknown_202F30C++;
}
r7 = 0;
r10 = 7;
break;
}
MoveMenuCursorDownWrapAround(&gDungeonMenu, 0);
}
if (r4 == 1 && r7 != 0) {
if (gUnknown_202F30C != 0) {
s32 i;
for (i = 0; i < 6; i++) {
ScrollUpWindowFunc(0);
DungeonRunFrameActions(0x37);
}
gUnknown_202F30C--;
}
r7 = 0;
r10 = 0;
break;
}
if (gRealInputs.repeated & DPAD_UP) {
PlayDungeonCursorSE(1);
if (gDungeonMenu.menuIndex == 0) {
if (gUnknown_202F30C != 0) {
s32 i;
for (i = 0; i < 6; i++) {
ScrollUpWindowFunc(0);
DungeonRunFrameActions(0x37);
}
gUnknown_202F30C--;
}
r7 = 0;
r10 = 0;
break;
}
MoveMenuCursorUpWrapAround(&gDungeonMenu, 0);
}
if (sub_80048C8()) {
continue;
}
if (gRealInputs.pressed & START_BUTTON) {
sub_8083D1C();
r7 = 3;
break;
}
if ((gRealInputs.pressed & A_BUTTON) || gDungeonMenu.unk28.a_button) {
PlayDungeonConfirmationSE();
r7 = 1;
break;
}
if ((gRealInputs.pressed & B_BUTTON) || gDungeonMenu.unk28.b_button) {
PlayDungeonCancelSE();
r7 = 2;
break;
}
}
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x37);
if (r7 == 0) {
continue;
}
else if (r7 == 2) {
r10 = gDungeonMenu.menuIndex;
if (gUnknown_202F310 < a1) {
continue;
}
if (DisplayDungeonYesNoMessage(NULL, gUnknown_80FDFB8, TRUE) == 1) {
break;
}
else {
continue;
}
}
else if (r7 == 3) {
r10 = gDungeonMenu.menuIndex;
sub_806806C(a3[gUnknown_202F30C + r10]);
continue;
}
else {
s32 arrId;
u8 locIdIsPartner;
r10 = gDungeonMenu.menuIndex;
arrId = gUnknown_202F30C + r10;
gDungeonSubMenuItemsCount = 0;
AddActionToDungeonSubMenu(0x29, 0);
AddActionToDungeonSubMenu(0x2A, 0);
AddActionToDungeonSubMenu(0x40, 0);
if (a3[arrId]->unk0 & 0x8000) {
SetActionUnusableInDungeonSubMenu(0x29);
}
else {
SetActionUnusableInDungeonSubMenu(0x2A);
}
// This unnecessary variable is required to match.
locIdIsPartner = DUNGEON_JOIN_LOCATION_PARTNER;
if (a3[arrId]->isTeamLeader || (a3[arrId]->dungeonLocation.id == DUNGEON_JOIN_LOCATION_LEADER || a3[arrId]->dungeonLocation.id == locIdIsPartner)) {
SetActionUnusableInDungeonSubMenu(0x29);
}
sub_8045064();
CreateDungeonMenuSubWindow(&spTxtStruct, 0x15);
while (1) {
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x37);
if (gRealInputs.repeated & DPAD_DOWN) {
PlayDungeonCursorSE(1);
MoveMenuCursorDownWrapAround(&gDungeonMenu, 1);
}
if (gRealInputs.repeated & DPAD_UP) {
PlayDungeonCursorSE(1);
MoveMenuCursorUpWrapAround(&gDungeonMenu, 1);
}
if ((gRealInputs.pressed & A_BUTTON) || gDungeonMenu.unk28.a_button) {
if (CanSubMenuItemBeChosen(gDungeonMenu.menuIndex)) {
PlayDungeonConfirmationSE();
r7 = 1;
break;
}
PlayDungeonCancelSE();
}
if ((gRealInputs.pressed & B_BUTTON) || gDungeonMenu.unk28.b_button) {
PlayDungeonCancelSE();
r7 = 0;
break;
}
}
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x37);
if (r7 != 0) {
if (gDungeonMenu.menuIndex == 0) {
a3[arrId]->unk0 |= 0x8000;
sub_8068310(a2, a3);
}
else if (gDungeonMenu.menuIndex == 1) {
a3[arrId]->unk0 &= ~(0x8000);
sub_8068310(a2, a3);
}
else {
sub_806806C(a3[arrId]);
}
}
continue;
}
}
}
}
void sub_8067F00(u8 a0, PokemonStruct1 **a1, s32 a2_, s32 a3, s32 a4)
{
s32 i, y;
s32 a2;
a2 = a2_ - 1;
y = 0x16;
sub_80073B8(0);
WriteFriendAreaName(gFormatBuffer_Monsters[0], a0, FALSE);
PrintFormattedStringOnWindow(12, 0, _("{POKEMON_0}"), 0, '\0');
i = 0;
while (i < 10) {
if (a2 >= 0) {
if (a2 >= a3) {
break;
}
PrintColoredPokeNameToBuffer(gFormatBuffer_Monsters[0], a1[a2], 0);
sub_808D930(gFormatBuffer_Monsters[1], a1[a2]->speciesNum);
gFormatArgs[0] = a2 + 1;
if (a1[a2]->unk0 & 0x8000) {
InlineStrcpy(gFormatBuffer_Items[0], _("{STAR_BULLET}"));
}
else {
InlineStrcpy(gFormatBuffer_Items[0], _("{ICON_BLANK}"));
}
if (a1[a2]->unk0 & 0x4000) {
PrintFormattedStringOnWindow(7, y, _("{MOVE_ITEM_0}{color CYAN}$v02:{POKEMON_0}{reset}"), 0, '\0');
}
else {
PrintFormattedStringOnWindow(7, y, _("{MOVE_ITEM_0}{color YELLOW}$v02:{POKEMON_0}{reset}"), 0, '\0');
}
}
i++;
y += 12;
a2++;
}
sub_80073E0(0);
sub_80073B8(1);
if (gUnknown_202F310 >= a4) {
PrintFormattedStringOnWindow(8, 2, _("Press {B_BUTTON}\nif OK."), 1, '\0');
}
else {
gFormatArgs[0] = a4 - gUnknown_202F310;
PrintFormattedStringOnWindow(8, 2, _("Say bye to\n{VALUE_0} more"), 1, '\0');
}
sub_80073E0(1);
}
void sub_806806C(PokemonStruct1 *a0)
{
struct unkStruct_808FF20 unkStruct;
struct UnkInfoTabStruct var_C8;
WindowTemplates spTxtStruct = {0};
s32 r7;
spTxtStruct.id[0].type = WINDOW_TYPE_WITH_HEADER;
spTxtStruct.id[0].pos.x = 2;
spTxtStruct.id[0].pos.y = 2;
spTxtStruct.id[0].width = 0x12;
spTxtStruct.id[0].height = 0xE;
spTxtStruct.id[0].unk10 = 0x12;
spTxtStruct.id[0].unk12 = 2;
spTxtStruct.id[0].header = &gUnknown_202F308;
spTxtStruct.id[1].type = WINDOW_TYPE_NORMAL;
spTxtStruct.id[2].type = WINDOW_TYPE_NORMAL;
spTxtStruct.id[3].type = WINDOW_TYPE_NORMAL;
r7 = 0;
unkStruct.unk40 = 0;
unkStruct.unk56 = 0;
gDungeonMenu.menuIndex = 0;
while (1) {
bool32 loopBreak = FALSE;
s32 spF8[4] = {2, 3, 4, 5};
gUnknown_202F308.count = 4;
gUnknown_202F308.currId = r7;
gUnknown_202F308.width = 10;
gUnknown_202F308.f3 = 0;
gDungeonMenu.unk1E = r7;
gDungeonMenu.unk20 = 4;
gDungeonMenu.unk1A = 0;
gDungeonMenu.menuIndex = 0;
gDungeonMenu.unk1C = 0;
gDungeonMenu.unk4 = 0;
gDungeonMenu.firstEntryY = 16;
gDungeonMenu.unk14.x = 0;
gDungeonMenu.unk0 = 0;
sub_801317C(&gDungeonMenu.unk28);
DungeonShowWindows(&spTxtStruct, 1);
sub_808FF20(&unkStruct, a0, gDungeon->unk644.unk16);
CreatePokemonInfoTabScreen(spF8[r7], r7, &unkStruct, &var_C8, 0);
gDungeonMenu.unkC = (gWindows[0].x + 15) * 8;
gDungeonMenu.unkE = ((gWindows[0].y + 1) * 8) - 2;
while (1) {
s32 r5;
AddMenuCursorSprite(&gDungeonMenu);
if (spF8[r7] == 4) {
if (var_C8.unk0[8] != 0) {
sub_80684C4();
}
if (unkStruct.unk40 != 0) {
sub_8068344();
}
}
r5 = sub_8014140(0, gUnknown_8106DA4);
DungeonRunFrameActions(0x1C);
if ((gRealInputs.pressed & DPAD_RIGHT) || gDungeonMenu.unk28.dpad_right) {
PlayDungeonCursorSE(0);
if (++r7 == 4) {
r7 = 0;
}
break;
}
if ((gRealInputs.pressed & DPAD_LEFT) || gDungeonMenu.unk28.dpad_left) {
PlayDungeonCursorSE(0);
if (--r7 == -1) {
r7 = 3;
}
break;
}
if (spF8[r7] == 4) {
if (((gRealInputs.repeated & DPAD_DOWN) || r5 == 2) && var_C8.unk0[8] != 0) {
s32 i;
PlayDungeonCursorSE(0);
for (i = 0; i < 6; i++) {
ScrollDownWindowFunc(0);
DungeonRunFrameActions(0x1C);
}
unkStruct.unk40++;
break;
}
if (((gRealInputs.repeated & DPAD_UP) || r5 == 1) && unkStruct.unk40 != 0) {
s32 i;
PlayDungeonCursorSE(0);
for (i = 0; i < 6; i++) {
ScrollUpWindowFunc(0);
DungeonRunFrameActions(0x1C);
}
unkStruct.unk40--;
break;
}
}
if (sub_80048C8()) {
continue;
}
if ((gRealInputs.pressed & A_BUTTON) || gDungeonMenu.unk28.a_button) {
PlayDungeonConfirmationSE();
loopBreak = TRUE;
break;
}
if ((gRealInputs.pressed & B_BUTTON) || gDungeonMenu.unk28.b_button) {
PlayDungeonCancelSE();
loopBreak = TRUE;
break;
}
}
DungeonRunFrameActions(0x37);
if (loopBreak) {
break;
}
}
sub_803EAF0(0, NULL);
}
void sub_8068310(s32 n, PokemonStruct1 **monPtrs)
{
s32 i;
s32 counter = 0;
for (i = 0; i < n; i++) {
if ((monPtrs[i]->unk0 & 0x8000) != 0) {
counter++;
}
}
gUnknown_202F310 = counter;
}
void sub_8068344(void)
{
if ((gDungeonFramesCounter & 8) != 0) {
Window *window = &gWindows[0];
SpriteOAM sprite = {0};
SpriteSetAffine1(&sprite, 0);
SpriteSetAffine2(&sprite, 0);
SpriteSetObjMode(&sprite, 0);
SpriteSetMosaic(&sprite, 0);
SpriteSetBpp(&sprite, 0);
SpriteSetShape(&sprite, 1);
SpriteSetMatrixNum(&sprite, 16);
SpriteSetSize(&sprite, 0);
SpriteSetTileNum(&sprite, 0x3F0);
SpriteSetPriority(&sprite, 0);
SpriteSetPalNum(&sprite, 15);
SpriteSetY(&sprite, (window->y * 8) + 0x8);
SpriteSetX(&sprite, (window->x * 8) + 0x40);
AddSprite(&sprite,0x100,NULL,NULL);
}
}
// The same as sub_80623B0
void sub_80684C4(void)
{
if ((gDungeonFramesCounter & 8) != 0) {
Window *window = &gWindows[0];
SpriteOAM sprite = {0};
SpriteSetAffine1(&sprite, 0);
SpriteSetAffine2(&sprite, 0);
SpriteSetObjMode(&sprite, 0);
SpriteSetMosaic(&sprite, 0);
SpriteSetBpp(&sprite, 0);
SpriteSetShape(&sprite, 1);
SpriteSetMatrixNum(&sprite, 0);
SpriteSetSize(&sprite, 0);
SpriteSetTileNum(&sprite, 0x3F0);
SpriteSetPriority(&sprite, 0);
SpriteSetPalNum(&sprite, 15);
SpriteSetY(&sprite, (window->y * 8) + 0x70);
SpriteSetX(&sprite, (window->x * 8) + 0x40);
AddSprite(&sprite,0x100,NULL,NULL);
}
}

View File

@@ -1,4 +1,5 @@
#include "global.h"
#include "globaldata.h"
#include "constants/ability.h"
#include "constants/iq_skill.h"
#include "constants/move_id.h"
@@ -6,25 +7,20 @@
#include "constants/type.h"
#include "constants/weather.h"
#include "structs/dungeon_entity.h"
#include "structs/str_202ED28.h"
#include "structs/str_806B7F8.h"
#include "structs/str_dungeon.h"
#include "code_800F958.h"
#include "code_803E46C.h"
#include "code_803E668.h"
#include "code_8041AD0.h"
#include "code_804267C.h"
#include "code_8045A00.h"
#include "code_805D8C8.h"
#include "code_806CD90.h"
#include "code_8077274_1.h"
#include "dungeon_config.h"
#include "dungeon_engine.h"
#include "run_dungeon.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_misc.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_message.h"
#include "dungeon_util.h"
@@ -36,10 +32,6 @@
#include "pokemon.h"
#include "pokemon_3.h"
#include "position_util.h"
#include "random.h"
#include "sprite.h"
#include "status_checks_1.h"
#include "tile_types.h"
#include "weather.h"
extern void sub_8042900(Entity *r0);
@@ -65,9 +57,6 @@ extern u8 GetRandomFloorItem(s32 a0);
extern void DeletePokemonDungeonSprite(s32 id);
extern void sub_80429E8(Entity *r0);
extern s32 sub_803DA20(s32 param_1);
extern s32 gDungeonFramesCounter;
extern void sub_800F958(s32 dungeonSpriteID, DungeonPos *pos, DungeonPos *statusOffsets, u32 a3);
extern void sub_8042EC8(Entity *a0, s32 a1);
extern Entity *sub_804550C(s16 a);
extern Entity *sub_80453AC(s16 id);
extern void sub_803F580(s32);
@@ -1107,275 +1096,3 @@ s32 sub_806C4D4(s32 _species, s32 level, s32 categoryIndex)
return defensiveCount;
}
extern const u8 gUnknown_8106EC8[][13];
static inline u16 GetUnkFlag(Entity *entity)
{
if ((entity->axObj.axdata.flags & 0x2000))
return 0;
else
return entity->axObj.axdata.flags >> 15;
}
void sub_806C51C(Entity *entity)
{
s32 x, y, y2;
bool8 var_3C;
bool8 decoySprite;
s32 var_34;
DungeonPos pos1;
DungeonPos posArray[4];
u32 statusSprites;
bool8 r4;
u8 r7;
unkStruct_2039DB0 spriteMasks;
s32 xSprite, ySprite;
EntityInfo *entInfo = GetEntInfo(entity);
if (gDungeon->unk181e8.cameraTarget == entity) {
decoySprite = FALSE;
}
else {
decoySprite = gDungeon->unk181e8.hallucinating;
}
if (entInfo->curseClassStatus.status == STATUS_DECOY) {
decoySprite = TRUE;
}
if (entity->axObj.unk43_animId2 == entity->axObj.unk42_animId1 && entity->axObj.unk45_orientation == entity->axObj.unk44_direction1 && entity->axObj.unk47 == 0) {
bool8 r2 = FALSE;
if (!GetUnkFlag(entity))
r2 = TRUE;
if (r2) {
s32 r0;
s32 r3 = sub_806CEBC(entity);
entity->unk21 = 1;
if (entInfo->unkFE == 99) {
if (entity->axObj.unk43_animId2 <= 12) {
s32 r2;
if (entInfo->bideClassStatus.status == STATUS_BIDE) {
r2 = 2;
}
else if (entity->unk23 < 3) {
r2 = 0;
}
else {
r2 = 1;
}
r0 = gUnknown_8106EC8[r2][entity->axObj.unk43_animId2];
if (r0 == 7) {
r0 = r3;
}
}
else {
r0 = 99;
}
}
else {
r0 = entInfo->unkFE;
}
if (r0 != 99) {
entity->axObj.unk42_animId1 = r0;
entity->axObj.unk44_direction1 = entity->axObj.unk45_orientation & DIRECTION_MASK;
entity->axObj.unk47 = 1;
if (entity->axObj.unk42_animId1 == 6 && ++entity->axObj.unk46 == 16) {
entity->axObj.unk42_animId1 = r3;
}
}
}
}
if (entity->axObj.unk43_animId2 != entity->axObj.unk42_animId1 || entity->axObj.unk45_orientation != entity->axObj.unk44_direction1 || entity->axObj.unk47 != 0) {
s32 r7;
entity->axObj.unk43_animId2 = entity->axObj.unk42_animId1;
entity->axObj.unk45_orientation = entity->axObj.unk44_direction1;
entity->axObj.unk47 = 0;
r7 = entity->axObj.unk40_maybeAnimTimer;
if (sub_808DA44(entInfo->apparentID, entity->axObj.unk42_animId1)) {
r7 = 0;
}
if (!decoySprite) {
s32 rnd = Rand32Bit() & 3;
AxResInitFile(&entity->axObj.axdata, entity->axObj.spriteFile, entity->axObj.unk42_animId1, entity->axObj.unk44_direction1, r7, rnd, FALSE);
}
else {
OpenedFile *spriteData = GetSpriteData(MONSTER_DECOY);
s32 rnd = Rand32Bit() & 3;
AxResInitFile(&entity->axObj.axdata, spriteData, entity->axObj.unk42_animId1, entity->axObj.unk44_direction1, r7, rnd, FALSE);
}
if (entity->axObj.unk42_animId1 != 6) {
entity->axObj.unk46 = 0;
}
}
if (gDungeon->unk1356C) {
if (entity->axObj.unk43_animId2 != 7 || GetMovementType(entInfo->apparentID) == 2) {
if (entInfo->unk15C != 0) {
if (entInfo->unk160 == 0) {
if (entInfo->unk15F != 0) {
RunAxAnimationFrame(&entity->axObj.axdata);
RunAxAnimationFrame(&entity->axObj.axdata);
RunAxAnimationFrame(&entity->axObj.axdata);
}
else {
RunAxAnimationFrame(&entity->axObj.axdata);
}
}
}
else {
RunAxAnimationFrame(&entity->axObj.axdata);
}
}
}
else {
if (entInfo->frozenClassStatus.status != STATUS_FROZEN && entInfo->frozenClassStatus.status != STATUS_PETRIFIED) {
if (gDungeon->unk644.unk28 != 0 && gDungeon->unk1BDD4.unk1C05F == 0) {
RunAxAnimationFrame(&entity->axObj.axdata);
RunAxAnimationFrame(&entity->axObj.axdata);
}
else if ((entity->axObj.unk43_animId2 == 0 || entity->axObj.unk43_animId2 == 7) && GetEntInfo(entity)->speedStage > 1) {
RunAxAnimationFrame(&entity->axObj.axdata);
}
RunAxAnimationFrame(&entity->axObj.axdata);
}
}
if (entity->pixelPos.x == entity->prevPixelPos.x && entity->pixelPos.y == entity->prevPixelPos.y) {
if (entity->unk23 < 10) {
entity->unk23++;
}
}
else {
entity->unk23 = 0;
}
entity->prevPixelPos.x = entity->pixelPos.x;
entity->prevPixelPos.y = entity->pixelPos.y;
x = (entity->pixelPos.x / 256) - gDungeon->unk181e8.cameraPixelPos.x;
y = (((entity->pixelPos.y - entity->unk1C.raw) - entInfo->unk174.raw) / 256) - gDungeon->unk181e8.cameraPixelPos.y;
y2 = (entity->pixelPos.y / 256) - gDungeon->unk181e8.cameraPixelPos.y;
y2 /= 2;
if (entInfo->unk156 == 0) {
y2--;
}
if (entInfo->unk15C == 0) {
var_3C = sub_8042768(entity);
}
else {
if (entInfo->unk15D != 0) {
if (gDungeonFramesCounter & 4) {
x++;
}
else {
x--;
}
}
var_3C = (entInfo->unk15E == 0);
}
pos1.x = entity->pixelPos.x / 256;
pos1.y = ((entity->pixelPos.y - entity->unk1C.raw) - entInfo->unk174.raw) / 256;
sub_8005700(posArray, &entity->axObj);
sub_800F958(entInfo->unk98, &pos1, posArray, gDungeon->unk181e8.priority);
statusSprites = EntityGetStatusSprites(entity);
UpdateDungeonPokemonSprite(entInfo->unk98, entInfo->apparentID, statusSprites, (var_3C && entInfo->unk14C));
sub_8042EC8(entity, y2);
if (entInfo->unk15C == 0) {
if (entInfo->unkFF == 1) {
if (entInfo->unk174.raw <= IntToF248_2(199.999).raw) {
entInfo->unk174.raw += IntToF248_2(8).raw;
if (entInfo->unk174.raw > IntToF248_2(200).raw) {
entInfo->unk174.raw = IntToF248_2(200).raw;
}
}
}
else {
entInfo->unk174.raw -= IntToF248_2(12).raw;
if (entInfo->unk174.raw < IntToF248_2(0).raw) {
entInfo->unk174.raw = IntToF248_2(0).raw;
}
}
}
if (!var_3C)
return;
r4 = FALSE;
r7 = sub_806CF54(entity);
spriteMasks.unk0 = 0xF3FF;
spriteMasks.unk2 = 0xFFFF;
spriteMasks.unk4 = 0xF3FF;
spriteMasks.unk6 = 0;
spriteMasks.unk8 = 0;
spriteMasks.unkA = gDungeon->unk181e8.priority << 10;
if (entInfo->isNotTeamMember && (entInfo->apparentID == MONSTER_DEOXYS_ATTACK || entInfo->apparentID == MONSTER_DEOXYS_DEFENSE || entInfo->apparentID == MONSTER_DEOXYS_SPEED)) {
r4 = TRUE;
}
if (entInfo->invisibleClassStatus.status == STATUS_INVISIBLE && !gDungeon->unk181e8.showInvisibleTrapsMonsters) {
r4 = TRUE;
}
if (r4) {
spriteMasks.unk6 |= 0x400;
}
var_34 = 0;
if (!entInfo->isNotTeamMember || entInfo->curseClassStatus.status == STATUS_DECOY) {
var_34 = 1;
}
if (IsExperienceLocked(entInfo->joinedAt.id) || entInfo->monsterBehavior == 1) {
var_34 = 1;
}
if (entInfo->unkFF != 2) {
s32 overworldPal;
if (entInfo->frozenClassStatus.status == STATUS_PETRIFIED || entInfo->burnClassStatus.status == STATUS_PARALYSIS || entInfo->frozenClassStatus.status == STATUS_SHADOW_HOLD) {
x += gDungeonFramesCounter & 2;
}
if (decoySprite) {
overworldPal = GetPokemonOverworldPalette(MONSTER_DECOY, FALSE);
}
else {
overworldPal = GetPokemonOverworldPalette(entInfo->apparentID, FALSE);
}
if (entity->unk22 == 0) {
DoAxFrame_800558C(&entity->axObj.axdata, x, y, y2, overworldPal, &spriteMasks);
}
else if (entity->unk22 == 1 && (gDungeonFramesCounter & 1)) {
DoAxFrame_800558C(&entity->axObj.axdata, x, y, y2, overworldPal, &spriteMasks);
}
}
entInfo->pixelPos.x = (entity->pixelPos.x / 256) + entity->axObj.axdata.sub1.shadow.x;
entInfo->pixelPos.y = (entity->pixelPos.y / 256) + entity->axObj.axdata.sub1.shadow.y;
xSprite = entInfo->pixelPos.x - gDungeon->unk181e8.cameraPixelPos.x;
ySprite = entInfo->pixelPos.y - gDungeon->unk181e8.cameraPixelPos.y;
if (xSprite >= -32 && ySprite >= -32 && xSprite <= 271 && ySprite <= 191 && r7 != 6 && entity->unk22 == 0) {
struct unkStruct_202ED28 *spriteStructPtr = &gUnknown_202ED28[var_34][r7];
if (entInfo->unk156 != 0) {
SpriteSetX(&spriteStructPtr->sprite, xSprite + spriteStructPtr->pos.x);
SpriteSetY(&spriteStructPtr->sprite, ySprite + spriteStructPtr->pos.y);
AddSprite(&spriteStructPtr->sprite, 0, NULL, NULL);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,488 +0,0 @@
#include "global.h"
#include "constants/ability.h"
#include "structs/str_dungeon.h"
#include "dungeon_pokemon_attributes.h"
#include "status_checks_1.h"
#include "text_util.h"
#include "dungeon_message.h"
#include "string_format.h"
#include "type_effectiveness.h"
#include "constants/move_id.h"
#include "constants/monster.h"
#include "constants/status.h"
#include "constants/type.h"
#include "constants/iq_skill.h"
#include "math.h"
#include "number_util.h"
#include "status.h"
#include "dungeon_random.h"
#include "code_80450F8.h"
#include "code_8045A00.h"
#include "dungeon_items.h"
#include "structs/str_damage.h"
#include "dungeon_util.h"
#include "dungeon_config.h"
void sub_8042940(Entity *r0);
void sub_80428B0(Entity *r0);
void sub_80428C4(Entity *r0);
extern void sub_806F500(void);
extern bool8 sub_806E100(s48_16 *param_1, Entity *pokemon, Entity *target, u8 type, struct DamageStruct *dmgStruct);
extern void sub_8041B74(Entity *pokemon);
extern void sub_8041B5C(Entity *pokemon);
extern void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 arg4, bool32 arg8, s32 argC);
extern const s16 gUnknown_810AC60;
extern const s16 gUnknown_810AC68;
extern const s16 gUnknown_810AC64;
extern const s16 gUnknown_810AC66;
extern const s16 gUnknown_810AC68;
extern const s16 gUnknown_810AC62;
extern s48_16 gUnknown_8106F24;
extern s48_16 gUnknown_8106F04;
extern s48_16 gUnknown_8106F1C;
extern s48_16 gUnknown_8106F14;
extern const u8 *const gUnknown_80FAE00;
extern const u8 *const gUnknown_80FADD8;
extern const u8 *const gUnknown_80FEE04;
extern const u8 *const gUnknown_80FEE2C;
extern const u8 *const gUnknown_80FEE54;
static void ApplyAtkDefStatBoosts(Entity *attacker, Entity *target, u8 moveType, s32 *atkStat, s32 *defStat, s32 rand)
{
bool32 isNotEnemy;
s32 atkMultiplier = 1;
s32 atkDivisor = 1;
s32 defMultiplier = 1;
s32 defDivisor = 1;
s32 splitIndex = (!IsTypePhysical(moveType)) ? 1 : 0;
if (AbilityIsActive(attacker, ABILITY_GUTS)) {
EntityInfo *entInfo = GetEntInfo(attacker);
bool8 gutsBoost = HasNegativeStatus(attacker);
bool8 visFlags_attacker_1 = SetVisualFlags(entInfo,1,gutsBoost);
if (gutsBoost) {
atkMultiplier = 2;
}
if (visFlags_attacker_1) {
sub_80428B0(attacker);
TryDisplayDungeonLoggableMessage3(attacker,target, gUnknown_80FEE04); // Guts boosted its power
}
}
if ((AbilityIsActive(attacker, ABILITY_HUGE_POWER)) || (AbilityIsActive(attacker, ABILITY_PURE_POWER))) {
EntityInfo *entInfo = GetEntInfo(attacker);
bool32 hugePowerBoost = (rand < 33 && splitIndex == 0);
bool8 visFlags_attacker_2 = SetVisualFlags(entInfo,0x100,hugePowerBoost);
if (hugePowerBoost) {
atkMultiplier *= 3;
atkDivisor *= 2;
}
if (visFlags_attacker_2) {
sub_80428C4(attacker);
TryDisplayDungeonLoggableMessage3(attacker,target, gUnknown_80FEE2C); // It's special ability boosted Attack
}
}
if ((AbilityIsActive(attacker, ABILITY_HUSTLE)) && (splitIndex == 0)) {
atkMultiplier *= 3;
atkDivisor *= 2;
}
if (GetEntInfo(attacker)->isNotTeamMember) {
isNotEnemy = FALSE;
}
else {
isNotEnemy = TRUE;
}
if ((AbilityIsActive(attacker, ABILITY_PLUS)) && (splitIndex == 1) && gDungeon->minusIsActive[isNotEnemy]) {
atkMultiplier *= 15;
atkDivisor *= 10;
}
if ((AbilityIsActive(attacker, ABILITY_MINUS)) && (splitIndex == 1) && gDungeon->plusIsActive[isNotEnemy]) {
atkMultiplier *= 15;
atkDivisor *= 10;
}
if (AbilityIsActive(target, ABILITY_INTIMIDATE) && (splitIndex == 0)) {
atkMultiplier *= 4;
atkDivisor *= 5;
}
if ((AbilityIsActive(target, ABILITY_MARVEL_SCALE)) && (splitIndex == 0)) {
EntityInfo *targetInfo = GetEntInfo(target);
bool8 hasNegStatus_target = HasNegativeStatus(target);
bool8 visFlags_target = SetVisualFlags(targetInfo, 8, hasNegStatus_target);
if (hasNegStatus_target) {
defMultiplier *= 3;
defDivisor *= 2;
}
if (visFlags_target) {
sub_8042940(target);
TryDisplayDungeonLoggableMessage3(attacker,target, gUnknown_80FEE54); // Its special ability quickened attacks!
}
}
*atkStat *= atkMultiplier;
*defStat *= defMultiplier;
if (atkDivisor != 1) {
*atkStat = *atkStat / atkDivisor;
}
if (defDivisor != 1) {
*defStat = *defStat / defDivisor;
}
}
static inline void SetDamageOne(struct DamageStruct *dmgStruct, u8 moveType)
{
dmgStruct->dmg = 1;
dmgStruct->residualDmgType = 0;
dmgStruct->typeEffectiveness = EFFECTIVENESS_NEUTRAL;
dmgStruct->type = moveType;
dmgStruct->isCrit = FALSE;
dmgStruct->unkE = 0;
dmgStruct->tookNoDamage = FALSE;
}
void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s32 critChance, struct DamageStruct *dmgStruct, s24_8 arg8, u16 moveId, bool8 arg_10)
{
EntityInfo *attackerInfo = GetEntInfo(attacker);
EntityInfo *targetInfo = GetEntInfo(target);
s32 splitIndex = (!IsTypePhysical(moveType)) ? 1 : 0;
sub_806F500();
if (!attackerInfo->isTeamLeader && FixedPointToInt(attackerInfo->belly) == 0) {
SetDamageOne(dmgStruct, moveType);
}
else if (moveId == MOVE_REGULAR_ATTACK && AbilityIsActive(target, ABILITY_WONDER_GUARD)) {
SetDamageOne(dmgStruct, moveType);
}
else {
s32 atkStatStage, defStatStage;
s24_8 statCalc;
s32 atkStat, defStat;
s32 rand;
s32 r6;
s48_16 unkSp1;
s48_16 unkSp2;
s48_16 unkSp3;
s48_16 unkSp4;
s48_16 unkSp5;
s48_16 unkSp6;
s48_16 unkSp7;
s48_16 unkSp8;
s48_16 unkSp9;
s48_16 unkSp10;
s48_16 unkSp11;
bool8 r5;
dmgStruct->type = moveType;
gDungeon->unk134.unk134 = moveType;
gDungeon->unk134.unk138 = splitIndex;
atkStatStage = attackerInfo->offensiveStages[splitIndex];
if (arg_10 && moveType == TYPE_FIRE) {
atkStatStage += attackerInfo->flashFireBoost;
gDungeon->unk134.unk140[2] = attackerInfo->flashFireBoost;
}
if (attackerInfo->apparentID == MONSTER_DEOXYS_ATTACK) {
atkStatStage += 2;
}
if (attackerInfo->apparentID == MONSTER_DEOXYS_DEFENSE) {
atkStatStage -= 2;
}
if (attackerInfo->apparentID == MONSTER_DEOXYS_SPEED) {
atkStatStage -= 2;
}
if (atkStatStage < 0) atkStatStage = 0;
if (atkStatStage > 20) atkStatStage = 20;
gDungeon->unk134.unk13E[0] = atkStatStage;
gDungeon->unk134.unk140[0] = attackerInfo->atk[splitIndex] + movePower;
statCalc = s24_8_mul(IntToF248(attackerInfo->atk[splitIndex] + movePower), gAtkStatStageMultipliers[atkStatStage]);
statCalc = s24_8_mul(statCalc, attackerInfo->offensiveMultipliers[splitIndex]);
atkStat = F248ToInt(statCalc);
defStatStage = targetInfo->defensiveStages[splitIndex];
if (splitIndex == 0 && targetInfo->bideClassStatus.status == STATUS_SKULL_BASH) {
gDungeon->unk134.unk17A = 1;
defStatStage++;
}
if (targetInfo->apparentID == MONSTER_DEOXYS_ATTACK) {
defStatStage -= 2;
}
if (targetInfo->apparentID == MONSTER_DEOXYS_DEFENSE) {
defStatStage += 2;
}
if (targetInfo->apparentID == MONSTER_DEOXYS_SPEED) {
defStatStage -= 2;
}
if (defStatStage < 0) defStatStage = 0;
if (defStatStage > 20) defStatStage = 20;
gDungeon->unk134.unk13E[1] = defStatStage;
gDungeon->unk134.unk140[1] = targetInfo->def[splitIndex];
statCalc = s24_8_mul(IntToF248(targetInfo->def[splitIndex]), gDefStatStageMultipliers[defStatStage]);
statCalc = s24_8_mul(statCalc, targetInfo->defensiveMultipliers[splitIndex]);
defStat = F248ToInt(statCalc);
rand = DungeonRandInt(100);
if (splitIndex == 0) {
if (HasHeldItem(attacker, ITEM_POWER_BAND)) {
atkStat += gUnknown_810AC60;
gDungeon->unk134.unk160 += gUnknown_810AC60;
}
if (HasHeldItem(attacker, ITEM_MUNCH_BELT)) {
atkStat += gUnknown_810AC68;
gDungeon->unk134.unk160 += gUnknown_810AC68;
}
if (arg_10 && HasHeldItem(target, ITEM_DEF_SCARF)) {
defStat += gUnknown_810AC64;
gDungeon->unk134.unk162 += gUnknown_810AC64;
}
}
else {
if (arg_10 && HasHeldItem(target, ITEM_ZINC_BAND)) {
defStat += gUnknown_810AC66;
gDungeon->unk134.unk163 += gUnknown_810AC66;
}
if (HasHeldItem(attacker, ITEM_SPECIAL_BAND)) {
atkStat += gUnknown_810AC62;
gDungeon->unk134.unk161 += gUnknown_810AC62;
}
if (HasHeldItem(attacker, ITEM_MUNCH_BELT)) {
atkStat += gUnknown_810AC68;
gDungeon->unk134.unk161 += gUnknown_810AC68;
}
}
gDungeon->unk134.unk140[3] = atkStat;
gDungeon->unk134.unk140[4] = defStat;
if (atkStat < 0) atkStat = 0;
if (atkStat >= 999) atkStat = 999;
attackerInfo->previousVisualFlags &= ~(0x100);
attackerInfo->visualFlags &= ~(0x100);
ApplyAtkDefStatBoosts(attacker, target, moveType, &atkStat, &defStat, rand);
FP48_16_FromS32(&unkSp1, atkStat - defStat);
FP48_16_FromS32(&unkSp2, 8);
F48_16_SDiv(&unkSp1, &unkSp1, &unkSp2);
if (!attackerInfo->isNotTeamMember) {
FP48_16_FromS32(&unkSp2, attackerInfo->level);
unkSp3.hi = 0;
unkSp3.lo = 0xAAAA;
F48_16_SMul(&unkSp2, &unkSp2, &unkSp3);
r6 = (attackerInfo->level * 2) / 3;
}
else {
s32 unkAtkStat2 = attackerInfo->atk[splitIndex];
s32 unkDefStat2 = 1;
ApplyAtkDefStatBoosts(attacker, target, moveType, &unkAtkStat2, &unkDefStat2, rand);
FP48_16_FromS32(&unkSp2, unkAtkStat2);
FP48_16_FromS32(&unkSp3, 3);
F48_16_SDiv(&unkSp2, &unkSp2, &unkSp3);
r6 = unkAtkStat2 / 3;
}
FP48_16_Add(&unkSp4, &unkSp1, &unkSp2);
gDungeon->unk134.unk140[5] = r6;
gDungeon->unk134.unk140[6] = FP48_16_ToS32(&unkSp4);
unkSp5 = unkSp4;
unkSp7 = unkSp4;
F48_16_SMul(&unkSp5, &unkSp5, &unkSp5);
unkSp6.hi = 0;
unkSp6.lo = 0xCCC;
F48_16_SMul(&unkSp5, &unkSp5, &unkSp6);
FP48_16_FromS32(&unkSp6, 2);
F48_16_SMul(&unkSp7, &unkSp7, &unkSp6);
FP48_16_FromS32(&unkSp6, defStat);
FP48_16_Subtract(&unkSp7, &unkSp7, &unkSp6);
FP48_16_FromS32(&unkSp6, 10);
FP48_16_Add(&unkSp7, &unkSp7, &unkSp6);
FP48_16_Add(&unkSp8, &unkSp5, &unkSp7);
if (FP48_16_SLessThan(&gUnknown_8106F24, &unkSp8)) {
unkSp8 = gUnknown_8106F24;
}
if (FP48_16_SLessThan(&unkSp8, &gUnknown_8106F04)) {
unkSp8 = gUnknown_8106F04;
}
r5 = sub_806E100(&unkSp9, attacker, target, moveType, dmgStruct);
if (moveType == TYPE_FIRE) {
s32 flashFireStatus = GetFlashFireStatus(target);
if (flashFireStatus != FLASH_FIRE_STATUS_NONE && targetInfo->unk152 == 0 && arg_10) {
targetInfo->unk152 = 1;
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[1], target, 0);
if (flashFireStatus == FLASH_FIRE_STATUS_MAXED) {
TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80FAE00); // Fire moves won't become stronger!
}
else {
TryDisplayDungeonLoggableMessage3(attacker, target, gUnknown_80FADD8); // m1 used Flash Fire to absorb fire!
}
}
}
if (arg_10) {
if (splitIndex == 0 && targetInfo->reflectClassStatus.status == STATUS_REFLECT) {
sub_8041B74(target);
F48_16_SMul(&unkSp9, &unkSp9, &gUnknown_8106F1C);
gDungeon->unk134.unk166 = 1;
}
if (splitIndex == 1 && targetInfo->reflectClassStatus.status == STATUS_LIGHT_SCREEN) {
sub_8041B5C(target);
F48_16_SMul(&unkSp9, &unkSp9, &gUnknown_8106F1C);
gDungeon->unk134.unk167 = 1;
}
}
// Check crit
if (!AbilityIsActive(target, ABILITY_BATTLE_ARMOR) && !AbilityIsActive(target, ABILITY_SHELL_ARMOR)) {
s32 critOdds;
if (attackerInfo->isNotTeamMember) {
critOdds = 0;
}
else {
critOdds = critChance;
}
if (attackerInfo->sureShotClassStatus.status == STATUS_FOCUS_ENERGY) {
critOdds = 999;
gDungeon->unk134.unk168 = 1;
}
else {
if (HasHeldItem(attacker, ITEM_SCOPE_LENS)) {
critOdds += gCritOddsScopeLensPatsyBand;
gDungeon->unk134.unk164 = 1;
}
if (HasHeldItem(target, ITEM_PATSY_BAND)) {
critOdds += gCritOddsScopeLensPatsyBand;
gDungeon->unk134.unk165 = 1;
}
if (r5 && IQSkillIsEnabled(attacker, IQ_TYPE_ADVANTAGE_MASTER)) {
critOdds = gCritOddsIqAdvantageMaster;
gDungeon->unk134.unk169 = 1;
}
}
if (DungeonRandInt(100) < critOdds) {
F48_16_SMul(&unkSp9, &unkSp9, &gUnknown_8106F14);
dmgStruct->isCrit = TRUE;
}
}
gDungeon->unk134.unk154 = FP48_16_ToS32(&unkSp8);
F48_16_SMul(&unkSp8, &unkSp8, &unkSp9);
{
// Ugly hack needed to match
#ifdef NONMATCHING
s24_8 arg8_Match;
#else
register s24_8 arg8_Match asm("r2");
#endif // NONMATCHING
gDungeon->unk134.unk15C = arg8_Match = arg8;
FP48_16_FromF248(&unkSp10, arg8_Match);
F48_16_SMul(&unkSp8, &unkSp8, &unkSp10);
}
// ALSO needed to match. unk694 chosen randomly and it worked with matching.
ASM_MATCH_TRICK(gDungeon->unk644.unk50);
gDungeon->unk134.unk150 = FP48_16_ToS32(&unkSp8);
{
s32 rnd = DungeonRandInt(0x4000);
unkSp9.hi = 0;
unkSp9.lo = 0xE000 + rnd;
}
F48_16_SMul(&unkSp8, &unkSp8, &unkSp9);
FP48_16_FromS32(&unkSp11, 100);
F48_16_SMul(&unkSp9, &unkSp11, &unkSp9);
gDungeon->unk134.unk158 = FP48_16_ToS32(&unkSp9);
dmgStruct->dmg = FP48_16_ToS32(&unkSp8);
dmgStruct->residualDmgType = 0;
if (dmgStruct->dmg == 0) {
dmgStruct->isCrit = FALSE;
}
}
}
void sub_806F2BC(Entity *attacker, Entity *target, u8 moveType, s32 a2, struct DamageStruct *dmgStruct)
{
s48_16 unkSp1;
s48_16 unkSp2;
s32 a2New = a2;
if (a2New <= 0) a2New = 1;
if (a2New > 999) a2New = 999;
dmgStruct->type = moveType;
sub_806E100(&unkSp1, attacker, target, moveType, dmgStruct);
FP48_16_FromS32(&unkSp2, a2New);
F48_16_SMul(&unkSp2, &unkSp2, &unkSp1);
dmgStruct->dmg = FP48_16_ToS32(&unkSp2);
dmgStruct->residualDmgType = 0;
}
void DealDamageToEntity(Entity *entity, s32 dmg, s32 r6, s16 r4)
{
Entity spEntity;
struct DamageStruct dmgStruct;
s32 r4_ = r4;
sub_80457DC(&spEntity);
dmgStruct.dmg = dmg;
dmgStruct.typeEffectiveness = EFFECTIVENESS_NEUTRAL;
dmgStruct.type = TYPE_NONE;
dmgStruct.residualDmgType = r6;
dmgStruct.isCrit = FALSE;
dmgStruct.unkE = 0;
dmgStruct.tookNoDamage = FALSE;
HandleDealingDamage(&spEntity, entity, &dmgStruct, FALSE, FALSE, r4_, FALSE, 0);
}
void sub_806F370(Entity *pokemon, Entity *target, s32 dmg, s32 giveExp, bool8 *tookNoDamage, u8 moveType, s16 arg_8, s32 residualDmgType, s32 arg_10, s32 arg_14)
{
s32 i;
struct DamageStruct dmgStruct;
s32 arg_8_ = arg_8;
s32 dmgNew = dmg;
dmgStruct.typeEffectiveness = EFFECTIVENESS_NEUTRAL;
dmgStruct.residualDmgType = residualDmgType;
dmgStruct.type = moveType;
dmgStruct.isCrit = FALSE;
dmgStruct.unkE = 0;
if (moveType != TYPE_NONE) {
s32 typeEffectiveness[2];
EntityInfo *targetInfo = GetEntInfo(target);
for (i = 0; i < 2; i++) {
s32 effectiv = gTypeEffectivenessChart[moveType][targetInfo->types[i]];
typeEffectiveness[i] = effectiv;
}
if (AbilityIsActive(target, ABILITY_WONDER_GUARD)) {
if (gEffectivenessChart[typeEffectiveness[0]][typeEffectiveness[1]] != EFFECTIVENESS_SUPER) {
dmgNew = 0;
}
}
}
dmgStruct.dmg = dmgNew;
if (dmgNew == 0) {
dmgStruct.tookNoDamage = TRUE;
}
else {
dmgStruct.tookNoDamage = FALSE;
}
HandleDealingDamage(pokemon, target, &dmgStruct, FALSE, giveExp, arg_8_, arg_10, arg_14);
if (tookNoDamage != NULL) {
*tookNoDamage = dmgStruct.tookNoDamage;
}
}

View File

@@ -1,21 +1,20 @@
#include "global.h"
#include "globaldata.h"
#include "constants/type.h"
#include "structs/str_pokemon.h"
#include "dungeon_main.h"
#include "dungeon_misc.h"
#include "code_80118A4.h"
#include "code_803E668.h"
#include "code_8045A00.h"
#include "dungeon_message.h"
#include "code_806CD90.h"
#include "code_8077274_1.h"
#include "code_8097670.h"
#include "dungeon.h"
#include "dungeon_items.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "friend_area.h"
#include "pokemon.h"
#include "pokemon_3.h"
@@ -25,19 +24,10 @@
#include "dungeon_util_1.h"
#include "math.h"
#include "dungeon_config.h"
#include "dungeon_strings.h"
#include "string_format.h"
extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE];
extern s32 gUnknown_8106F7C[];
extern u8 *gUnknown_80FA0F0[];
extern u8 *gUnknown_80FA058[];
extern u8 *gUnknown_80FA030[];
extern u8 *gUnknown_80F9FE8[];
extern u8 *gUnknown_80FA004[];
extern u8 *gUnknown_80FA0C8[];
extern u8 *gUnknown_80FA120[];
extern u8 *gUnknown_80FA090[];
u8 sub_806B8CC();
void sub_8083D88();
@@ -46,134 +36,6 @@ void nullsub_96(Entity *pokemon,Entity *target);
u8 sub_8097900(s16);
void sub_806F910(void);
u8 sub_806F9BC(s16);
extern void sub_803F508(Entity *);
void SetShopkeeperAggression(Entity *pokemon, Entity *target)
{
EntityInfo *info;
info = GetEntInfo(target);
if(info->shopkeeper != SHOPKEEPER_MODE_NORMAL)
{
if(GetEntityType(pokemon) == ENTITY_MONSTER)
{
if(GetEntInfo(pokemon)->isNotTeamMember)
{
info->shopkeeper = SHOPKEEPER_MODE_ATTACK_ENEMIES;
}
else
{
info->shopkeeper = SHOPKEEPER_MODE_ATTACK_TEAM;
}
}
}
}
void sub_806F480(Entity *pokemon, u8 r1)
{
EntityInfo *info;
info = GetEntInfo(pokemon);
if(info->shopkeeper != SHOPKEEPER_MODE_NORMAL)
{
if(r1)
{
info->shopkeeper = SHOPKEEPER_MODE_ATTACK_ENEMIES;
}
else
{
info->shopkeeper = SHOPKEEPER_MODE_ATTACK_TEAM;
}
}
}
u8 sub_806F4A4(Entity *pokemon, u8 type) {
EntityInfo *info = GetEntInfo(pokemon);
s32 index;
if(MonsterIsType(pokemon, TYPE_GHOST))
{
if(type == TYPE_NORMAL || type == TYPE_FIGHTING)
if(!info->exposed)
return FALSE;
}
for(index = 0; index < 2; index++)
{
if(gTypeEffectivenessChart[type][info->types[index]] == EFFECTIVENESS_IMMUNE)
return FALSE;
}
return TRUE;
}
void sub_806F500(void)
{
struct unkStruct_Dungeon134_sub *temp;
temp = &gDungeon->unk134;
temp->unk134 = 0;
temp->unk138 = 0;
temp->unk13C[0] = 0;
temp->unk13C[1] = 0;
temp->unk13E[0] = 0xA;
temp->unk13E[1] = 0xA;
temp->unk140[0] = 1;
temp->unk140[1] = 1;
temp->unk140[2] = 0;
temp->unk140[4] = 0;
temp->unk140[3] = 0;
temp->unk140[5] = 0;
temp->unk140[6] = 0;
temp->unk150 = 0;
temp->unk158 = 0;
temp->unk15C = F248_ZERO;
temp->unk160 = 0;
temp->unk161 = 0;
temp->unk162 = 0;
temp->unk163 = 0;
temp->unk164 = 0;
temp->unk165 = 0;
temp->unk166 = 0;
temp->unk167 = 0;
temp->unk168 = 0;
temp->unk169 = 0;
temp->unk16A = 0;
temp->unk16C = 0;
temp->unk16B = 0;
temp->unk16D = 0;
temp->fill16E[0] = 0;
temp->fill16E[1] = 0;
temp->fill16E[2] = 0;
temp->fill16E[3] = 0;
temp->fill16E[4] = 0;
temp->fill16E[5] = 0;
temp->fill16E[6] = 0;
temp->fill16E[7] = 0;
temp->fill16E[8] = 0;
temp->fill16E[9] = 0;
temp->fill16E[10] = 0;
temp->pokemonExposed = FALSE;
temp->unk17A = 0;
}
s32 sub_806F62C(int param_1)
{
return gUnknown_8106F7C[param_1];
}
void sub_806F63C(Entity *param_1)
{
UnkDungeonGlobal_unk181E8_sub *temp;
temp = &gDungeon->unk181e8;
if (temp->cameraTarget == param_1) {
sub_803F508(temp->cameraTarget);
}
}
bool8 sub_806F660(Entity *pokemon, Entity *target)
{
@@ -286,7 +148,6 @@ bool8 sub_806F660(Entity *pokemon, Entity *target)
return TRUE;
}
void nullsub_96(Entity *pokemon,Entity *target)
{}
@@ -391,9 +252,9 @@ bool8 sub_806FA5C(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *pa
sub_806CE68(entity2, direction);
CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[0],param_3->id);
if (DisplayDungeonYesNoMessage(0,*gUnknown_80F9FE8,1) == 0) {
if (DisplayDungeonYesNoMessage(0,gUnknown_80F9FE8,1) == 0) {
if (param_3->id != MONSTER_JIRACHI) {
LogMessageByIdWithPopupCheckUser(entity1,*gUnknown_80FA004);
LogMessageByIdWithPopupCheckUser(entity1,gUnknown_80FA004);
}
return 0;
}
@@ -406,7 +267,7 @@ bool8 sub_806FA5C(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *pa
}
if (pokeIndex == MAX_TEAM_MEMBERS) {
LogMessageByIdWithPopupCheckUser(entity1,*gUnknown_80FA030);
LogMessageByIdWithPopupCheckUser(entity1,gUnknown_80FA030);
return FALSE;
}
else {
@@ -447,25 +308,25 @@ bool8 sub_806FA5C(Entity *entity1, Entity *entity2, struct unkStruct_8069D4C *pa
IncrementAdventureNumJoined();
if (sub_806B8CC(param_3->id,param_3->pos.x,param_3->pos.y,pokeStruct2,&local_2c,0,1) == 0) {
LogMessageByIdWithPopupCheckUser(entity1,*gUnknown_80FA058);
LogMessageByIdWithPopupCheckUser(entity1,gUnknown_80FA058);
pokeStruct2->unk0 = 0;
}
else {
sub_8083D88();
sub_803E708(0xa0,0x46);
if (DisplayDungeonYesNoMessage(0,*gUnknown_80FA090,1) == 1) {
if (DisplayDungeonYesNoMessage(0,gUnknown_80FA090,1) == 1) {
while (DungeonGiveNameToRecruitedMon(pokeStruct2->name) == 0) {
DisplayDungeonMessage(0,*gUnknown_80FA0C8,1);
DisplayDungeonMessage(0,gUnknown_80FA0C8,1);
}
}
sub_808D9DC(gFormatBuffer_Monsters[0],pokeStruct2,0);
LogMessageByIdWithPopupCheckUser(entity1,*gUnknown_80FA0F0);
LogMessageByIdWithPopupCheckUser(entity1,gUnknown_80FA0F0);
if (flag) {
leader = xxx_call_GetLeader();
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],leader,0);
sub_8092558(gFormatBuffer_FriendArea,friendArea);
PlaySound(0xce);
DisplayDungeonMessage(0,*gUnknown_80FA120,1);
DisplayDungeonMessage(0,gUnknown_80FA120,1);
}
if (param_3->id == MONSTER_MEW) {
gDungeon->unk4 = 1;
@@ -586,9 +447,9 @@ bool8 sub_806FDF4(Entity *entity1,Entity *entity2,Entity **entityPtr)
pokeStruct2->unk0 = 0;
}
else {
if (DisplayDungeonYesNoMessage(0,*gUnknown_80FA090,1) == 1) {
if (DisplayDungeonYesNoMessage(0,gUnknown_80FA090,1) == 1) {
while (!DungeonGiveNameToRecruitedMon(buffer)) {
DisplayDungeonMessage(0,*gUnknown_80FA0C8,1);
DisplayDungeonMessage(0,gUnknown_80FA0C8,1);
}
}
if (flag) {
@@ -596,7 +457,7 @@ bool8 sub_806FDF4(Entity *entity1,Entity *entity2,Entity **entityPtr)
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],leader,0);
sub_8092558(gFormatBuffer_FriendArea,friendArea);
PlaySound(0xce);
DisplayDungeonMessage(0,*gUnknown_80FA120,1);
DisplayDungeonMessage(0,gUnknown_80FA120,1);
}
sub_808D9DC(gFormatBuffer_Monsters[3],pokeStruct2,0);
*entityPtr = local_2c;

View File

@@ -1,13 +1,10 @@
#include "global.h"
#include "globaldata.h"
#include "constants/tactic.h"
#include "dungeon_capabilities.h"
#include "dungeon_config.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_leader.h"
#include "dungeon_message.h"
#include "code_8041AD0.h"
#include "code_80450F8.h"
#include "code_8045A00.h"
#include "code_8077274_1.h"
#include "constants/dungeon.h"
#include "dungeon_map_access.h"
@@ -15,30 +12,28 @@
#include "dungeon_util.h"
#include "dungeon.h"
#include "pokemon_3.h"
#include "status_checks_1.h"
#include "code_805D8C8.h"
#include "structs/str_806B7F8.h"
#include "dungeon_logic.h"
#include "dungeon_strings.h"
#include "dungeon_menu_moves.h"
#include "code_803E668.h"
#include "code_806CD90.h"
#include "moves.h"
#include "pokemon_mid.h"
#include "structs/dungeon_entity.h"
#include "structs/map.h"
#include "structs/str_pokemon.h"
#include "structs/str_806B7F8.h"
EWRAM_DATA s32 gUnknown_202F31C[2] = {0, 0};
EWRAM_DATA s32 gUnknown_202F324[2] = {0, 0};
extern u8 *gUnknown_80F9ACC[];
extern u8 *gUnknown_80F9AEC[];
extern u8 *gUnknown_80F9B10[];
extern u8 *gUnknown_80F9B34[];
extern u8 *gUnknown_80F9B58[];
extern u8 *gUnknown_80F9B74[];
extern u8 *gUnknown_80F9B94[];
extern u8 *gUnknown_80F9E64[];
extern u8 *gUnknown_80F9E80[];
extern u8 *gUnknown_80F9EC8[];
extern u8 *gUnknown_80F9EEC[];
extern u8 *gUnknown_80FCF18[];
extern u8 *gUnknown_80FED68[];
extern u8 *gUnknown_80FF730[];
extern u8 gUnknown_8107010[8];
extern u8 *gUnknown_8107018[3];
extern void ResetMonEntityData(EntityInfo *, u32);
void sub_8069E0C(Entity *pokemon);
void sub_8042A44(Entity *r0);
void sub_8083D78(void);
extern bool8 sub_803D930(u32);
void sub_8083D58(void);
void sub_8072778(Entity *, Entity *, u8, u8);
bool8 sub_80725A4(Entity *, Entity *);
@@ -47,110 +42,19 @@ bool8 sub_80723D0(Entity *, Entity *, u8, u8);
void sub_807218C(Entity *);
void sub_806A2BC(Entity *, u32);
void sub_806A3D4(u8 *, s32, s32, s32);
extern void sub_8042920(struct Entity *r0);
extern s16 sub_803D970(u32);
extern s32 sub_803DA20(s32 param_1);
extern bool8 sub_806AA0C(s32, u32);
extern bool8 sub_8083660(DungeonPos *param_1);
extern bool8 sub_803D930(u32);
extern void sub_8072B78(Entity *pokemon, Entity *target, s16 id);
extern s32 GetMovesLearnedAtLevel(u16* dst, s16 species, s32 level, s32 IQPoints);
void sub_8071B48(void)
{
const Tile *tile;
struct Entity *entity2;
struct Entity *entity;
int index;
int index1;
int counter;
struct Entity *entityPtr;
s32 level;
struct Dungeon *dungeon; // feels like a hack
struct unkStruct_806B7F8 local_2c;
void sub_8072B24(Entity *entity, Move *moves);
entityPtr = NULL;
dungeon = gDungeon;
if ((dungeon->unk644.unk20 != 0) &&
((dungeon->unk644.dungeonLocation.id != DUNGEON_METEOR_CAVE || (dungeon->unk37FD == 0)))) {
dungeon->unk644.unk1E++;
if (dungeon->unk644.unk2A == 0) {
if ( dungeon->unk644.unk1E < gUnknown_80F4DAA) {
return;
}
}
else {
if ( dungeon->unk644.unk1E < gUnknown_80F4DAC) {
return;
}
}
if (dungeon->unk644.unk1E > 900) {
entity2 = dungeon->unk17B34;
if ((EntityIsValid(entity2)) && (entity2->spawnGenID == dungeon->unk17B40)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity2,0);
entityPtr = entity2;
}
}
dungeon->unk644.unk1E = 0;
dungeon->unk17B34 = NULL;
counter = 0;
for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++)
{
entity = dungeon->wildPokemon[index];
if ((EntityIsValid(entity)) &&
(tile = GetTile((entity->pos).x, (entity->pos).y),
(tile->terrainType & 0x100) == 0)) {
counter++;
}
}
if (dungeon->unk644.unk2A == 0) {
if (gDungeon->monsterHouseRoom == 0xff) {
if (counter >= gUnknown_80F4DA6) {
return;
}
}
else
{
if (counter >= gUnknown_80F4DA8) {
return;
}
}
}
if (entityPtr != NULL) {
DisplayDungeonLoggableMessageTrue(0,*gUnknown_80FED68);
sub_8042920(entityPtr);
}
if (dungeon->unk644.unk2A != 0) {
index1 = 0x17c;
}
else {
index1 = sub_803D970(0);
}
level = sub_803DA20(index1);
if (level == 0) {
level = 1;
}
if ((sub_806AA0C(index1, 0)) && (sub_8083660(&local_2c.pos))) {
local_2c.species = index1;
local_2c.level = level;
local_2c.unk2 = 0;
if(DungeonRandInt(100) < GetRandomMovementChance(gDungeon->unk644.dungeonLocation.id))
{
local_2c.unk4 = 1;
}
else
{
local_2c.unk4 = 0;
}
local_2c.unk10 = 0;
sub_806B7F8(&local_2c, FALSE);
}
}
}
static const u8 gUnknown_8107010[8] = {0, 1, 1, 2, 1, 1, 0, 0};
static const u8 * const gUnknown_8107018[3] = {
_(""),
_("{WAIT_PRESS}\n"),
_("\n"),
};
void sub_8071D4C(Entity *pokemon, Entity *target, s32 exp)
{
@@ -226,7 +130,7 @@ void sub_8071DA4(Entity *entity)
info->exp += expGained;
gFormatArgs[0] = expGained;
SetMessageArgument_2(gFormatBuffer_Monsters[0],info,0);
TryDisplayDungeonLoggableMessage3(entityPtr,target,*gUnknown_80F9E64); // $m0 gained $d0 Exp Points
TryDisplayDungeonLoggableMessage3(entityPtr,target,gUnknown_80F9E64); // $m0 gained $d0 Exp Points
flag = sub_80723D0(entityPtr,target,1,1);
}
}
@@ -266,7 +170,7 @@ void sub_8071DA4(Entity *entity)
if ((tacticsBuffer1[tacticIndex] == 0) && (tacticsBuffer2[tacticIndex] == 1)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
CopyTacticsNameToBuffer(gFormatBuffer_Items[0],tacticIndex);
TryDisplayDungeonLoggableMessage3(entityPtr,target,*gUnknown_80FF730); // $i0 was added to $m0's list of usable tactics
TryDisplayDungeonLoggableMessage3(entityPtr,target,gUnknown_80FF730); // $i0 was added to $m0's list of usable tactics
}
}
}
@@ -331,7 +235,7 @@ void sub_8072008(Entity *pokemon, Entity *target, s32 level, u8 param_4, u8 para
if ((tacticsBuffer1[tacticIndex] == 0) && (tacticsBuffer2[tacticIndex] == 1)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
CopyTacticsNameToBuffer(gFormatBuffer_Items[0],tacticIndex);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FF730);
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FF730);
}
}
}
@@ -339,7 +243,7 @@ void sub_8072008(Entity *pokemon, Entity *target, s32 level, u8 param_4, u8 para
info->unk149 = 0;
if ((flag == 0) && (param_4 != 0)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80F9B74);
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80F9B74);
}
}
}
@@ -378,7 +282,7 @@ void sub_807218C(Entity *pokemon)
}
else
{
strcpy(buffer, *gUnknown_80FCF18);
strcpy(buffer, gUnknown_80FCF18);
}
DisplayDungeonMessage(0, buffer, 1);
buffer[0] = 0;
@@ -386,7 +290,7 @@ void sub_807218C(Entity *pokemon)
if(gFormatArgs[0]> 0)
{
strcat(buffer, *gUnknown_80F9ACC);
strcat(buffer, gUnknown_80F9ACC);
r6++;
}
@@ -394,28 +298,28 @@ void sub_807218C(Entity *pokemon)
{
if(gUnknown_8107010[r6] != 0)
strcat(buffer, gUnknown_8107018[gUnknown_8107010[r6]]);
strcat(buffer, *gUnknown_80F9AEC);
strcat(buffer, gUnknown_80F9AEC);
r6++;
}
if(gFormatArgs[2]> 0)
{
if(gUnknown_8107010[r6] != 0)
strcat(buffer, gUnknown_8107018[gUnknown_8107010[r6]]);
strcat(buffer, *gUnknown_80F9B10);
strcat(buffer, gUnknown_80F9B10);
r6++;
}
if(gFormatArgs[3]> 0)
{
if(gUnknown_8107010[r6] != 0)
strcat(buffer, gUnknown_8107018[gUnknown_8107010[r6]]);
strcat(buffer, *gUnknown_80F9B34);
strcat(buffer, gUnknown_80F9B34);
r6++;
}
if(gFormatArgs[4]> 0)
{
if(gUnknown_8107010[r6] != 0)
strcat(buffer, gUnknown_8107018[gUnknown_8107010[r6]]);
strcat(buffer, *gUnknown_80F9B58);
strcat(buffer, gUnknown_80F9B58);
}
if(buffer[0])
@@ -454,7 +358,7 @@ void LevelDownTarget(Entity *pokemon, Entity *target, u32 level)
if(!flag)
{
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80F9B94);
TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80F9B94);
}
}
}
@@ -495,7 +399,7 @@ bool8 sub_80723D0(Entity *pokemon, Entity *target, u8 param_3, u8 param_4)
gFormatArgs[0] = level;
SetMessageArgument_2(gFormatBuffer_Monsters[0], info, 0);
DisplayDungeonLoggableMessage(target, *gUnknown_80F9E80);
DisplayDungeonLoggableMessage(target, gUnknown_80F9E80);
}
else
{
@@ -503,7 +407,7 @@ bool8 sub_80723D0(Entity *pokemon, Entity *target, u8 param_3, u8 param_4)
sub_8083D58();
gFormatArgs[0] = level;
SetMessageArgument_2(gFormatBuffer_Monsters[0], info, 0);
DisplayDungeonLoggableMessageTrue(target, *gUnknown_80F9E80);
DisplayDungeonLoggableMessageTrue(target, gUnknown_80F9E80);
}
}
flag = TRUE;
@@ -650,12 +554,267 @@ bool8 sub_80725A4(Entity *pokemon, Entity *target)
{
gFormatArgs[0] = info->level;
sub_80421C0(target, 0xD3 << 1);
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80F9EC8); // $m0 dropped to Level $d0!
TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80F9EC8); // $m0 dropped to Level $d0!
return TRUE;
}
else
{
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80F9EEC); // $m0's level didn't drop!
TryDisplayDungeonLoggableMessage3(pokemon, target, gUnknown_80F9EEC); // $m0's level didn't drop!
return FALSE;
}
}
void sub_8072778(Entity *pokemon, Entity *target, u8 param_2, u8 param_3)
{
s32 i, j;
u16 learnedMoves[16];
Move localMoves[8];
u8 text[0x64];
s32 count;
EntityInfo *info = GetEntInfo(target);
bool8 sp_0xCC = FALSE;
if (info->isNotTeamMember) {
param_3 = 0;
param_2 = 0;
}
count = GetMovesLearnedAtLevel(learnedMoves, info->id, info->level, info->IQ);
unk_CopyMoves4To8AndClearFlag2Unk4(localMoves, info->moves.moves);
if (count != 0) {
s32 randIndex = DungeonRandInt(count);
for (j = 0; j < 8; j++) {
if(!MoveFlagExists(&localMoves[j])) {
InitPokemonMove(&localMoves[j], learnedMoves[randIndex]);
localMoves[j].moveFlags2 |= 4;
break;
}
}
}
for (i = 0; i < 0x1E; i++) {
count = 0;
for (j = 0; j < 8; j++) {
if (MoveFlagExists(&localMoves[j])) {
count++;
}
}
if (count <= MAX_MON_MOVES) {
s32 i;
bool8 r3 = FALSE;
for (i = 0; i < count; i++) {
info->moves.moves[i] = localMoves[i];
if((info->moves.moves[i].moveFlags2 & 4))
{
info->moves.moves[i].moveFlags2 &= 0xFB;
BufferMoveName(text, &info->moves.moves[i], 0);
r3 = TRUE;
}
}
for (; i < MAX_MON_MOVES; i++) {
ResetMoveFlags(&info->moves.moves[i]);
}
if (r3 && param_2) {
SetMessageArgument_2(gFormatBuffer_Monsters[0], info, 0);
strcpy(gFormatBuffer_Items[0], text);
sub_80421C0(target, 312);
DisplayDungeonLoggableMessage(target, gUnknown_80F9F04);
}
return;
}
if (!info->isNotTeamMember && param_3) {
if (!sp_0xCC && param_2) {
sub_803E708(0xA, 0x6);
DisplayDungeonMessage(0, gUnknown_80F9FA4, 1);
}
sp_0xCC = 1;
sub_8063E70(target, localMoves, 1, 0);
}
else {
sub_8072B24(target, localMoves);
}
}
}
bool8 sub_8072938(Entity *target, u16 moveId)
{
s32 i, j;
Move localMoves[8];
u8 text[0x64];
s32 count;
EntityInfo *info = GetEntInfo(target);
bool8 r10 = FALSE;
unk_CopyMoves4To8AndClearFlag2Unk4(localMoves, info->moves.moves);
for (j = 0; j < 8; j++) {
if(!(MoveFlagExists(&localMoves[j]))) {
InitPokemonMove(&localMoves[j], moveId);
localMoves[j].moveFlags2 |= 4;
break;
}
}
for (i = 0; i < 0x1E; i++) {
count = 0;
for (j = 0; j < 8; j++) {
if (MoveFlagExists(&localMoves[j])) {
count++;
}
}
if (count <= MAX_MON_MOVES) {
s32 i;
for (i = 0; i < count; i++) {
info->moves.moves[i] = localMoves[i];
if((info->moves.moves[i].moveFlags2 & 4))
{
info->moves.moves[i].moveFlags2 &= 0xFB;
BufferMoveName(text, &info->moves.moves[i], 0);
r10 = TRUE;
}
}
for (; i < MAX_MON_MOVES; i++) {
ResetMoveFlags(&info->moves.moves[i]);
}
if (r10) {
if (!info->isNotTeamMember) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
strcpy(gFormatBuffer_Items[0], text);
sub_80421C0(target, 312);
DisplayDungeonLoggableMessage(target, gUnknown_80F9F04);
}
}
break;
}
r10 = FALSE;
if (!info->isNotTeamMember) {
DisplayDungeonMessage(0, gUnknown_80FDF40, 1);
if (!sub_8063E70(target, localMoves, TRUE, TRUE)) {
return FALSE;
}
}
}
if (!r10 && !info->isNotTeamMember) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
DisplayDungeonLoggableMessage(target, gUnknown_80F9F2C);
}
return TRUE;
}
void sub_8072AC8(s16 *param_1, s16 species, s32 param_3)
{
const u8 *levelUpMoves;
s32 arrIndex;
s32 counter;
u16 moveIDs [2];
s32 species_s32;
s32 index;
species_s32 = species;
for(index = 0; index < MAX_MON_MOVES; index++) {
param_1[index] = MOVE_NOTHING;
}
counter = 0;
levelUpMoves = GetLevelUpMoves(species_s32);
while( 1 ) {
if (*levelUpMoves == 0) {
return;
}
levelUpMoves = DecompressMoveID(levelUpMoves,moveIDs);
if (*levelUpMoves++ > param_3) break;
if (counter == MAX_MON_MOVES) {
arrIndex = DungeonRandInt(MAX_MON_MOVES);
counter = MAX_MON_MOVES;
}
else {
arrIndex = counter;
counter++;
}
param_1[arrIndex] = moveIDs[0];
}
}
void sub_8072B24(Entity *entity, Move *moves)
{
int index;
int count;
count = 0;
for(index = 0; index < 8; index++)
{
if (moves[index].moveFlags & MOVE_FLAG_EXISTS) {
moves[index].moveFlags &= 0xfd;
count++;
}
}
index = DungeonRandInt(count);
for (; index < 7; index++) {
moves[index] = moves[index + 1];
}
moves[7].moveFlags = 0;
}
static inline void fu(EntityInfo *entityInfo, s16 id)
{
++id; --id;
entityInfo->apparentID = id;
entityInfo->id = id;
}
void sub_8072B78(Entity *pokemon, Entity *target, s16 id)
{
OpenedFile *file;
const Tile *tile;
int index;
s32 id_s32;
EntityInfo *entityInfo;
LevelData levelData;
struct unkStruct_806B7F8 local_2c;
id_s32 = id;
entityInfo = GetEntInfo(target);
SetMessageArgument_2(gFormatBuffer_Monsters[0],entityInfo,0);
CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[1],id_s32);
file = GetSpriteData(id_s32);
fu(entityInfo, id_s32);
GetPokemonLevelData(&levelData,id_s32,entityInfo->level);
entityInfo->exp = levelData.expRequired;
target->axObj.spriteFile = file;
ResetMonEntityData(entityInfo,0);
sub_8069E0C(target);
sub_806CCB4(target,7);
TryDisplayDungeonLoggableMessage3(pokemon,target,gUnknown_80FE2EC);
sub_8042A44(target);
sub_8083D78();
if (id_s32 == MONSTER_NINJASK) {
for (index = 0; index < 8; index++) {
tile = GetTile(gAdjacentTileOffsets[index].x + target->pos.x,gAdjacentTileOffsets[index].y + target->pos.y);
if (sub_807034C(MONSTER_SHEDINJA,tile) == 0) break;
}
if (sub_803D930(MONSTER_SHEDINJA)) {
local_2c.species = MONSTER_SHEDINJA;
local_2c.level = entityInfo->level;
local_2c.unk2 = 0;
local_2c.pos.x = gAdjacentTileOffsets[index].x + target->pos.x;
local_2c.pos.y = gAdjacentTileOffsets[index].y + target->pos.y;
local_2c.unk4 = 0;
local_2c.unk10 = 0;
sub_806B7F8(&local_2c, TRUE);
}
}
}

View File

@@ -1,129 +0,0 @@
#include "global.h"
#include "code_805D8C8.h"
#include "code_806CD90.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_movement.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "moves.h"
#include "pokemon_mid.h"
#include "status_checks_1.h"
#include "structs/dungeon_entity.h"
#include "structs/map.h"
#include "structs/str_pokemon.h"
#include "structs/str_806B7F8.h"
extern u8 *gUnknown_80FE2EC[];
extern void ResetMonEntityData(EntityInfo *, u32);
void sub_8069E0C(Entity *pokemon);
void sub_8042A44(Entity *r0);
void sub_8083D78(void);
extern bool8 sub_803D930(u32);
void sub_8072AC8(s16 *param_1, s16 species, s32 param_3)
{
const u8 *levelUpMoves;
s32 arrIndex;
s32 counter;
u16 moveIDs [2];
s32 species_s32;
s32 index;
species_s32 = species;
for(index = 0; index < MAX_MON_MOVES; index++) {
param_1[index] = MOVE_NOTHING;
}
counter = 0;
levelUpMoves = GetLevelUpMoves(species_s32);
while( 1 ) {
if (*levelUpMoves == 0) {
return;
}
levelUpMoves = DecompressMoveID(levelUpMoves,moveIDs);
if (*levelUpMoves++ > param_3) break;
if (counter == MAX_MON_MOVES) {
arrIndex = DungeonRandInt(MAX_MON_MOVES);
counter = MAX_MON_MOVES;
}
else {
arrIndex = counter;
counter++;
}
param_1[arrIndex] = moveIDs[0];
}
}
void sub_8072B24(Entity *entity, Move *moves)
{
int index;
int count;
count = 0;
for(index = 0; index < 8; index++)
{
if (moves[index].moveFlags & MOVE_FLAG_EXISTS) {
moves[index].moveFlags &= 0xfd;
count++;
}
}
index = DungeonRandInt(count);
for (; index < 7; index++) {
moves[index] = moves[index + 1];
}
moves[7].moveFlags = 0;
}
static inline void fu(EntityInfo *entityInfo, s16 id)
{
++id; --id;
entityInfo->apparentID = id;
entityInfo->id = id;
}
void sub_8072B78(Entity *pokemon, Entity *target, s16 id)
{
OpenedFile *file;
const Tile *tile;
int index;
s32 id_s32;
EntityInfo *entityInfo;
LevelData levelData;
struct unkStruct_806B7F8 local_2c;
id_s32 = id;
entityInfo = GetEntInfo(target);
SetMessageArgument_2(gFormatBuffer_Monsters[0],entityInfo,0);
CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[1],id_s32);
file = GetSpriteData(id_s32);
fu(entityInfo, id_s32);
GetPokemonLevelData(&levelData,id_s32,entityInfo->level);
entityInfo->exp = levelData.expRequired;
target->axObj.spriteFile = file;
ResetMonEntityData(entityInfo,0);
sub_8069E0C(target);
sub_806CCB4(target,7);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE2EC);
sub_8042A44(target);
sub_8083D78();
if (id_s32 == MONSTER_NINJASK) {
for (index = 0; index < 8; index++) {
tile = GetTile(gAdjacentTileOffsets[index].x + target->pos.x,gAdjacentTileOffsets[index].y + target->pos.y);
if (sub_807034C(MONSTER_SHEDINJA,tile) == 0) break;
}
if (sub_803D930(MONSTER_SHEDINJA)) {
local_2c.species = MONSTER_SHEDINJA;
local_2c.level = entityInfo->level;
local_2c.unk2 = 0;
local_2c.pos.x = gAdjacentTileOffsets[index].x + target->pos.x;
local_2c.pos.y = gAdjacentTileOffsets[index].y + target->pos.y;
local_2c.unk4 = 0;
local_2c.unk10 = 0;
sub_806B7F8(&local_2c, TRUE);
}
}
}

View File

@@ -1,11 +1,9 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_util.h"
#include "items.h"
#include "status.h"
#include "weather.h"
#include "dungeon_ai_targeting.h"
#include "code_8045A00.h"
#include "dungeon_capabilities.h"
#include "structs/dungeon_entity.h"
#include "structs/map.h"
#include "structs/str_moves.h"
@@ -14,12 +12,10 @@
#include "dungeon_map_access.h"
#include "code_803E46C.h"
#include "code_806CD90.h"
#include "dungeon_movement.h"
#include "game_options.h"
#include "dungeon_items.h"
#include "moves.h"
#include "dungeon_random.h"
#include "status_checks_1.h"
#include "code_803E668.h"
#include "constants/dungeon.h"
#include "constants/iq_skill.h"
@@ -31,17 +27,14 @@
#include "number_util.h"
#include "dungeon_message.h"
#include "code_8077274_1.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "math.h"
#include "dungeon_config.h"
#include "dungeon_strings.h"
extern bool8 sub_8044B28(void);
extern void sub_8075708(Entity *entity);
extern void DealDamageToEntity(Entity *, s32, u32, u32);
extern void sub_8067110(Entity *);
extern void sub_80671A0(Entity *);
extern void sub_8073D14(Entity *);
extern void sub_8045BF8(u8 *, Item *);
extern void sub_805229C(void);
extern void sub_807E8F0(Entity *);
extern void sub_80444F4(Entity *pokemon);
@@ -63,197 +56,7 @@ extern void sub_8075900(Entity *pokemon, u8 r1);
extern void sub_806A5B8(Entity *);
extern void sub_807EC28(bool8);
extern u8 gUnknown_202F32D;
extern const u8 *gMonTerrifiedCouldntPickUpItem;
extern const u8 *gMonPickedUpItem;
extern const u8 *gMonPickedUpItem2;
extern const u8 *gMonPickedUpItemToolbox;
extern const u8 *gMonSteppedOnItem;
extern const u8 *gMonCouldntPickUpItem;
extern const u8 *gUnknown_80FD594;
extern const u8 *gUnknown_80FD5B8;
extern const u8 *gUnknown_80FD5DC;
extern const u8 *gUnknown_80FD608;
extern const u8 *gUnknown_80FD628;
extern const u8 *gUnknown_80FEB30;
extern const u8 *gUnknown_80FABD8;
extern const u8 *gPtrProtectSavedItMessage;
extern const u8 *gPtrStenchWavedOffMessage;
extern const u8 *gUnknown_80FA124[];
extern const s32 gUnknown_80F60DC[];
extern const DungeonPos gUnknown_80F4D44[];
bool8 UseAttack(Entity *a0);
void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr);
static EWRAM_DATA s32 gUnknown_202F378 = 0;
void HandleEatAIAction(Entity *pokemon)
{
sub_8067110(pokemon);
}
void HandleThrowItemAIAction(Entity *pokemon)
{
sub_80671A0(pokemon);
}
void HandlePickUpAIAction(Entity *pokemon)
{
sub_8073D14(pokemon);
}
void sub_8073D14(Entity *entity)
{
Item *groundItem;
EntityInfo *_entityInfo;
EntityInfo *entityInfo = GetEntInfo(entity);
Entity *tileObject = GetTileAtEntitySafe(entity)->object;
if (tileObject == NULL)
return;
if (sub_8044B28())
return;
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
if (entityInfo->isTeamLeader)
return;
if (entityInfo->shopkeeper == 1)
return;
if (IsExperienceLocked(entityInfo->joinedAt.id))
return;
if (entityInfo->monsterBehavior == BEHAVIOR_RESCUE_TARGET)
return;
_entityInfo = GetEntInfo(entity); // Reloaded as a new variable for some reason.
groundItem = GetItemData(tileObject);
if (groundItem->flags & ITEM_FLAG_IN_SHOP)
return;
if (ShouldMonsterRunAwayAndShowEffect(entity, TRUE)) {
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
DisplayDungeonLoggableMessageTrue(entity, gMonTerrifiedCouldntPickUpItem);
}
else if (!_entityInfo->isNotTeamMember && GetItemCategory(groundItem->id) == CATEGORY_POKE) {
// Why check the same thing again?
if (_entityInfo->isNotTeamMember) {
PlaySoundEffect(0x14B);
}
else {
PlaySoundEffect(0x14C);
}
AddToTeamMoney(GetMoneyValue(groundItem));
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
RemoveItemFromDungeonAt(&entity->pos, 1);
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem);
}
else {
s32 i, nItems, newInventoryId;
s32 inventoryIds[INVENTORY_SIZE + 1]; // plus held
Item *carriedItems[INVENTORY_SIZE + 1]; // plus held
s32 newQuantity;
if (gDungeon->unk644.hasInventory && !_entityInfo->isNotTeamMember) {
for (i = 0; i < INVENTORY_SIZE; i++) {
carriedItems[i] = &gTeamInventoryRef->teamItems[i];
inventoryIds[i] = i;
}
carriedItems[INVENTORY_SIZE] = &_entityInfo->heldItem;
inventoryIds[INVENTORY_SIZE] = -1;
nItems = INVENTORY_SIZE + 1;
}
else {
carriedItems[0] = &_entityInfo->heldItem;
inventoryIds[0] = -1;
nItems = 1;
}
if ((groundItem->id < 9) && !(groundItem->flags & ITEM_FLAG_IN_SHOP)) {
newInventoryId = -1;
newQuantity = -1;
for (i = 0; i < nItems; i++) {
if (carriedItems[i]->flags & ITEM_FLAG_EXISTS
&& !(carriedItems[i]->flags & ITEM_FLAG_IN_SHOP)
&& ((groundItem->id == carriedItems[i]->id) && (groundItem->flags & ITEM_FLAG_STICKY) == (carriedItems[i]->flags & ITEM_FLAG_STICKY))
&& carriedItems[i]->quantity != 99 && newQuantity < carriedItems[i]->quantity)
{
newQuantity = carriedItems[i]->quantity;
newInventoryId = i;
}
}
if (newInventoryId == -1) {
newQuantity = -1;
for (i = 0; i < nItems; i++) {
if (carriedItems[i]->flags & ITEM_FLAG_EXISTS
&& !(carriedItems[i]->flags & ITEM_FLAG_IN_SHOP)
&& groundItem->id == carriedItems[i]->id
&& carriedItems[i]->quantity != 99
&& newQuantity < carriedItems[i]->quantity)
{
newQuantity = carriedItems[i]->quantity;
newInventoryId = i;
}
}
}
if (newInventoryId != -1) {
s32 quantity = carriedItems[newInventoryId]->quantity + groundItem->quantity;
if (quantity >= 99)
quantity = 99;
carriedItems[newInventoryId]->quantity = quantity;
if (groundItem->flags & ITEM_FLAG_STICKY)
carriedItems[newInventoryId]->flags |= ITEM_FLAG_STICKY;
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
RemoveItemFromDungeonAt(&entity->pos, 1);
PlaySoundEffect(0x14A);
if (inventoryIds[newInventoryId] <= -1)
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem2);
else
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItemToolbox);
return;
}
}
for (i = 0; i < nItems; i++) {
if (!(carriedItems[i]->flags & ITEM_FLAG_EXISTS))
break;
}
if (i == nItems) {
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
DisplayDungeonLoggableMessageTrue(entity, gMonSteppedOnItem);
}
else {
if (_entityInfo->isNotTeamMember) {
PlaySoundEffect(0x14B);
}
else {
PlaySoundEffect(0x14A);
}
if (inventoryIds[i] <= -1) {
_entityInfo->heldItem = *groundItem;
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
RemoveItemFromDungeonAt(&entity->pos, 1);
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem2);
}
else if (AddItemToInventory(groundItem)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
DisplayDungeonLoggableMessageTrue(entity, gMonCouldntPickUpItem);
}
else {
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
RemoveItemFromDungeonAt(&entity->pos, 1);
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItemToolbox);
}
}
}
}
void sub_8074094(Entity *entity)
{
@@ -775,254 +578,3 @@ void TickStatusHeal(Entity *entity)
}
}
void sub_8074FB0(Entity *entity, s32 a1, DungeonPos *pos)
{
Unk_Entity_x184 *strPtr;
EntityInfo *entityInfo = GetEntInfo(entity);
if (entityInfo->numMoveTiles > 3) {
entityInfo->action.action = 0;
return;
}
if (gGameOptionsRef->dungeonSpeed != 0)
gUnknown_202F378 = 2;
else
gUnknown_202F378 = 1;
strPtr = &entityInfo->unk184[entityInfo->numMoveTiles];
strPtr->unk1A = 0;
strPtr->lastMoveDirection = a1;
strPtr->previousTargetMovePosition1.x = entity->pos.x;
strPtr->previousTargetMovePosition1.y = entity->pos.y;
strPtr->previousTargetMovePosition2.x = pos->x;
strPtr->previousTargetMovePosition2.y = pos->y;
strPtr->lastMoveIncrement.x = gUnknown_80F4D44[a1].x * gUnknown_202F378;
strPtr->lastMoveIncrement.y = gUnknown_80F4D44[a1].y * gUnknown_202F378;
sub_8075050(entityInfo, strPtr);
}
void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr)
{
s32 savedX, savedY;
if (gGameOptionsRef->dungeonSpeed != 0)
gUnknown_202F378 = 2;
else
gUnknown_202F378 = 1;
info->numMoveTiles++;
if (info->numMoveTiles == 2) {
info->unk184[0].walkAnimFramesLeft = 24 / (gUnknown_202F378 * 2);
info->unk184[0].lastMoveIncrement.x *= 2;
info->unk184[0].lastMoveIncrement.y *= 2;
strPtr->walkAnimFramesLeft = 24 / (gUnknown_202F378 * 2);
strPtr->lastMoveIncrement.x *= 2;
strPtr->lastMoveIncrement.y *= 2;
}
else if (info->numMoveTiles == 3) {
s32 i;
savedX = strPtr->lastMoveIncrement.x;
savedY = strPtr->lastMoveIncrement.y;
for (i = 0; i < 2; i++) {
info->unk184[i].walkAnimFramesLeft = 24 / (gUnknown_202F378 * 3);
info->unk184[i].lastMoveIncrement.x *= 3;
info->unk184[i].lastMoveIncrement.y *= 3;
info->unk184[i].lastMoveIncrement.x /= 2;
info->unk184[i].lastMoveIncrement.y /= 2;
}
strPtr->walkAnimFramesLeft = 24 / (gUnknown_202F378 * 3);
strPtr->lastMoveIncrement.x = savedX * 3;
strPtr->lastMoveIncrement.y = savedY * 3;
}
else if (info->numMoveTiles == 4) {
s32 i;
savedX = strPtr->lastMoveIncrement.x;
savedY = strPtr->lastMoveIncrement.y;
for (i = 0; i < 3; i++) {
info->unk184[i].walkAnimFramesLeft = 24 / (gUnknown_202F378 * 4);
info->unk184[i].lastMoveIncrement.x *= 4;
info->unk184[i].lastMoveIncrement.y *= 4;
info->unk184[i].lastMoveIncrement.x /= 3;
info->unk184[i].lastMoveIncrement.y /= 3;
}
strPtr->walkAnimFramesLeft = 24 / (gUnknown_202F378 * 4);
strPtr->lastMoveIncrement.x = savedX * 4;
strPtr->lastMoveIncrement.y = savedY * 4;
}
else {
strPtr->walkAnimFramesLeft = 24 / gUnknown_202F378;
}
}
bool8 UseAttack(Entity *a0)
{
s32 i, j, loop;
Entity *savedEntityPtr;
bool32 r7 = FALSE;
bool32 r9 = FALSE;
gUnknown_202F32D = 0;
if (gGameOptionsRef->dungeonSpeed != 0)
gUnknown_202F378 = 2;
else
gUnknown_202F378 = 1;
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *mon = gDungeon->activePokemon[i];
if (EntityIsValid(mon)) {
EntityInfo *monInfo = GetEntInfo(mon);
if (monInfo->numMoveTiles == 0) {
if (monInfo->waiting) {
monInfo->waiting = FALSE;
if ((monInfo->targetPos.x != 0 || monInfo->targetPos.y != 0)
&& (monInfo->targetPos.x != mon->pos.x || monInfo->targetPos.y != mon->pos.y)
&& (!CheckVariousStatuses2(mon, TRUE) || !CheckVariousStatuses(mon)))
{
s32 direction = GetDirectionTowardsPosition(&mon->pos, &monInfo->targetPos);
if (direction != monInfo->action.direction)
sub_806CE68(mon, direction);
}
}
}
else {
PixelPos pos;
monInfo->flags |= 0x2000;
pos.x = X_POS_TO_PIXELPOS(monInfo->unk184[0].previousTargetMovePosition2.x);
pos.y = Y_POS_TO_PIXELPOS(monInfo->unk184[0].previousTargetMovePosition2.y);
sub_804535C(mon, &pos);
sub_806CDFC(mon, 0, monInfo->unk184[0].lastMoveDirection);
monInfo->notMoving = 0;
r7 = TRUE;
if (sub_8045888(mon))
r9 = TRUE;
}
}
}
if (!r7)
return FALSE;
savedEntityPtr = gDungeon->unkB8;
gDungeon->unkB8 = a0;
if (gDungeon->unk644.unk28 == 0 && r9) {
sub_80526D0(0x35);
for (loop = 0; loop < 24 / gUnknown_202F378; loop++) {
DungeonRunFrameActions(7);
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *mon = gDungeon->activePokemon[i];
if (EntityIsValid(mon)) {
EntityInfo *monInfo = GetEntInfo(mon);
Unk_Entity_x184 *strPtr = &monInfo->unk184[monInfo->notMoving];
ASM_MATCH_TRICK(i);
if (monInfo->numMoveTiles != 0) {
IncreaseEntityPixelPos(mon, strPtr->lastMoveIncrement.x, strPtr->lastMoveIncrement.y);
if (--strPtr->walkAnimFramesLeft == 0) {
if (++monInfo->notMoving == monInfo->numMoveTiles) {
monInfo->numMoveTiles = 0;
}
else {
PixelPos pos;
pos.x = X_POS_TO_PIXELPOS(monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.x);
pos.y = Y_POS_TO_PIXELPOS(monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.y);
sub_804535C(mon, &pos);
sub_806CDFC(mon, 0, monInfo->unk184[monInfo->notMoving].lastMoveDirection);
}
}
}
}
}
}
}
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *mon = gDungeon->activePokemon[i];
if (EntityIsValid(mon)) {
EntityInfo *monInfo = GetEntInfo(mon);
monInfo->numMoveTiles = 0;
nullsub_97(mon);
if (monInfo->flags & 0x2000) {
sub_804535C(mon, NULL);
}
}
}
sub_807AA30();
for (j = 0; j < 2; j++) {
for (loop = 0; loop < DUNGEON_MAX_POKEMON; loop++) {
DungeonPos monPosBefore;
EntityInfo *monInfo;
Entity *mon = gDungeon->activePokemon[loop];
if (!EntityIsValid(mon))
continue;
if (sub_8044B28())
break;
monInfo = GetEntInfo(mon);
if ((j == 0 && !monInfo->isTeamLeader) || (j != 0 && monInfo->isTeamLeader))
continue;
monPosBefore = mon->pos;
// Statement with no effect needed to match.
GetEntInfo(mon)->isTeamLeader = GetEntInfo(mon)->isTeamLeader;
if (monInfo->flags & 0x2000) {
monInfo->flags &= ~(0x2000);
if (monInfo->isTeamLeader) {
sub_804AC20(&mon->pos);
sub_807EC28(FALSE);
sub_805EE30();
}
else {
sub_8075708(mon);
}
if (!EntityIsValid(mon))
continue;
if (sub_8044B28())
break;
sub_8043ED0(0);
sub_8074094(mon);
if (!EntityIsValid(mon))
continue;
if (sub_8044B28())
break;
sub_8071DA4(mon);
sub_8046D20();
sub_8075900(mon, gDungeon->forceMonsterHouse);
}
if (!EntityIsValid(mon))
continue;
if (sub_8044B28())
break;
if (monPosBefore.x != mon->pos.x || monPosBefore.y != mon->pos.y)
gUnknown_202F32D = 1;
sub_806A5B8(mon);
if (sub_80706A4(mon, &mon->pos)) {
WarpTarget(mon, mon, 0, NULL);
}
}
}
sub_8086AC0();
if (!sub_8044B28()) {
sub_8085140();
gDungeon->unkB8 = savedEntityPtr;
}
else {
gDungeon->unkB8 = savedEntityPtr;
}
return TRUE;
}

View File

@@ -1,23 +1,331 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_ai.h"
#include "constants/iq_skill.h"
#include "constants/item.h"
#include "constants/status.h"
#include "constants/type.h"
#include "code_806CD90.h"
#include "dungeon_capabilities.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "structs/str_dungeon.h"
#include "tile_types.h"
#include "position_util.h"
#include "trap.h"
#include "items.h"
#include "status.h"
#include "weather.h"
#include "structs/dungeon_entity.h"
#include "structs/map.h"
#include "structs/str_moves.h"
#include "position_util.h"
#include "dungeon_music.h"
#include "dungeon_map_access.h"
#include "code_803E46C.h"
#include "code_806CD90.h"
#include "game_options.h"
#include "dungeon_items.h"
#include "moves.h"
#include "dungeon_random.h"
#include "code_803E668.h"
#include "constants/dungeon.h"
#include "constants/iq_skill.h"
#include "constants/ability.h"
#include "constants/type.h"
#include "constants/move_id.h"
#include "constants/weather.h"
#include "number_util.h"
#include "dungeon_message.h"
#include "code_8077274_1.h"
#include "math.h"
#include "dungeon_config.h"
extern void sub_8073D14(Entity *);
extern bool8 sub_8044B28(void);
extern void sub_8075708(Entity *entity);
extern void DealDamageToEntity(Entity *, s32, u32, u32);
extern void sub_805229C(void);
extern void sub_807E8F0(Entity *);
extern void sub_80444F4(Entity *pokemon);
extern void WarpTarget(Entity *pokemon, Entity *r1, u32 r2, DungeonPos *r3);
extern void sub_80420B8(Entity *pokemon);
extern void sub_8041C4C(Entity *pokemon, u32 r1);
extern void sub_805E804(void);
extern void sub_80838EC(u8 *a);
extern bool8 TryUseChosenMove(struct Entity *, u32, u32, u32, u32, struct Move *);
extern bool8 sub_8045888(Entity *);
extern void nullsub_97(Entity *entity);
extern void sub_805EE30(void);
extern void sub_8086AC0(void);
extern void sub_8085140(void);
extern void sub_8075708(Entity *entity);
extern void sub_8043ED0(u32);
extern void sub_8071DA4(Entity *);
extern void sub_8075900(Entity *pokemon, u8 r1);
extern void sub_806A5B8(Entity *);
extern void sub_807EC28(bool8);
extern void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr);
extern void sub_8074094(Entity *entity);
extern bool8 sub_803F428(DungeonPos *pos);
extern u8 gUnknown_202F32D;
extern const DungeonPos gUnknown_80F4D44[];
static EWRAM_DATA s32 gUnknown_202F378 = 0;
void sub_8074FB0(Entity *entity, s32 a1, DungeonPos *pos)
{
Unk_Entity_x184 *strPtr;
EntityInfo *entityInfo = GetEntInfo(entity);
if (entityInfo->numMoveTiles > 3) {
entityInfo->action.action = 0;
return;
}
if (gGameOptionsRef->dungeonSpeed != 0)
gUnknown_202F378 = 2;
else
gUnknown_202F378 = 1;
strPtr = &entityInfo->unk184[entityInfo->numMoveTiles];
strPtr->unk1A = 0;
strPtr->lastMoveDirection = a1;
strPtr->previousTargetMovePosition1.x = entity->pos.x;
strPtr->previousTargetMovePosition1.y = entity->pos.y;
strPtr->previousTargetMovePosition2.x = pos->x;
strPtr->previousTargetMovePosition2.y = pos->y;
strPtr->lastMoveIncrement.x = gUnknown_80F4D44[a1].x * gUnknown_202F378;
strPtr->lastMoveIncrement.y = gUnknown_80F4D44[a1].y * gUnknown_202F378;
sub_8075050(entityInfo, strPtr);
}
void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr)
{
s32 savedX, savedY;
if (gGameOptionsRef->dungeonSpeed != 0)
gUnknown_202F378 = 2;
else
gUnknown_202F378 = 1;
info->numMoveTiles++;
if (info->numMoveTiles == 2) {
info->unk184[0].walkAnimFramesLeft = 24 / (gUnknown_202F378 * 2);
info->unk184[0].lastMoveIncrement.x *= 2;
info->unk184[0].lastMoveIncrement.y *= 2;
strPtr->walkAnimFramesLeft = 24 / (gUnknown_202F378 * 2);
strPtr->lastMoveIncrement.x *= 2;
strPtr->lastMoveIncrement.y *= 2;
}
else if (info->numMoveTiles == 3) {
s32 i;
savedX = strPtr->lastMoveIncrement.x;
savedY = strPtr->lastMoveIncrement.y;
for (i = 0; i < 2; i++) {
info->unk184[i].walkAnimFramesLeft = 24 / (gUnknown_202F378 * 3);
info->unk184[i].lastMoveIncrement.x *= 3;
info->unk184[i].lastMoveIncrement.y *= 3;
info->unk184[i].lastMoveIncrement.x /= 2;
info->unk184[i].lastMoveIncrement.y /= 2;
}
strPtr->walkAnimFramesLeft = 24 / (gUnknown_202F378 * 3);
strPtr->lastMoveIncrement.x = savedX * 3;
strPtr->lastMoveIncrement.y = savedY * 3;
}
else if (info->numMoveTiles == 4) {
s32 i;
savedX = strPtr->lastMoveIncrement.x;
savedY = strPtr->lastMoveIncrement.y;
for (i = 0; i < 3; i++) {
info->unk184[i].walkAnimFramesLeft = 24 / (gUnknown_202F378 * 4);
info->unk184[i].lastMoveIncrement.x *= 4;
info->unk184[i].lastMoveIncrement.y *= 4;
info->unk184[i].lastMoveIncrement.x /= 3;
info->unk184[i].lastMoveIncrement.y /= 3;
}
strPtr->walkAnimFramesLeft = 24 / (gUnknown_202F378 * 4);
strPtr->lastMoveIncrement.x = savedX * 4;
strPtr->lastMoveIncrement.y = savedY * 4;
}
else {
strPtr->walkAnimFramesLeft = 24 / gUnknown_202F378;
}
}
bool8 UseAttack(Entity *a0)
{
s32 i, j, loop;
Entity *savedEntityPtr;
bool32 r7 = FALSE;
bool32 r9 = FALSE;
gUnknown_202F32D = 0;
if (gGameOptionsRef->dungeonSpeed != 0)
gUnknown_202F378 = 2;
else
gUnknown_202F378 = 1;
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *mon = gDungeon->activePokemon[i];
if (EntityIsValid(mon)) {
EntityInfo *monInfo = GetEntInfo(mon);
if (monInfo->numMoveTiles == 0) {
if (monInfo->waiting) {
monInfo->waiting = FALSE;
if ((monInfo->targetPos.x != 0 || monInfo->targetPos.y != 0)
&& (monInfo->targetPos.x != mon->pos.x || monInfo->targetPos.y != mon->pos.y)
&& (!CheckVariousStatuses2(mon, TRUE) || !CheckVariousStatuses(mon)))
{
s32 direction = GetDirectionTowardsPosition(&mon->pos, &monInfo->targetPos);
if (direction != monInfo->action.direction)
sub_806CE68(mon, direction);
}
}
}
else {
PixelPos pos;
monInfo->flags |= 0x2000;
pos.x = X_POS_TO_PIXELPOS(monInfo->unk184[0].previousTargetMovePosition2.x);
pos.y = Y_POS_TO_PIXELPOS(monInfo->unk184[0].previousTargetMovePosition2.y);
sub_804535C(mon, &pos);
sub_806CDFC(mon, 0, monInfo->unk184[0].lastMoveDirection);
monInfo->notMoving = 0;
r7 = TRUE;
if (sub_8045888(mon))
r9 = TRUE;
}
}
}
if (!r7)
return FALSE;
savedEntityPtr = gDungeon->unkB8;
gDungeon->unkB8 = a0;
if (gDungeon->unk644.unk28 == 0 && r9) {
sub_80526D0(0x35);
for (loop = 0; loop < 24 / gUnknown_202F378; loop++) {
DungeonRunFrameActions(7);
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *mon = gDungeon->activePokemon[i];
if (EntityIsValid(mon)) {
EntityInfo *monInfo = GetEntInfo(mon);
Unk_Entity_x184 *strPtr = &monInfo->unk184[monInfo->notMoving];
ASM_MATCH_TRICK(i);
if (monInfo->numMoveTiles != 0) {
IncreaseEntityPixelPos(mon, strPtr->lastMoveIncrement.x, strPtr->lastMoveIncrement.y);
if (--strPtr->walkAnimFramesLeft == 0) {
if (++monInfo->notMoving == monInfo->numMoveTiles) {
monInfo->numMoveTiles = 0;
}
else {
PixelPos pos;
pos.x = X_POS_TO_PIXELPOS(monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.x);
pos.y = Y_POS_TO_PIXELPOS(monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.y);
sub_804535C(mon, &pos);
sub_806CDFC(mon, 0, monInfo->unk184[monInfo->notMoving].lastMoveDirection);
}
}
}
}
}
}
}
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *mon = gDungeon->activePokemon[i];
if (EntityIsValid(mon)) {
EntityInfo *monInfo = GetEntInfo(mon);
monInfo->numMoveTiles = 0;
nullsub_97(mon);
if (monInfo->flags & 0x2000) {
sub_804535C(mon, NULL);
}
}
}
sub_807AA30();
for (j = 0; j < 2; j++) {
for (loop = 0; loop < DUNGEON_MAX_POKEMON; loop++) {
DungeonPos monPosBefore;
EntityInfo *monInfo;
Entity *mon = gDungeon->activePokemon[loop];
if (!EntityIsValid(mon))
continue;
if (sub_8044B28())
break;
monInfo = GetEntInfo(mon);
if ((j == 0 && !monInfo->isTeamLeader) || (j != 0 && monInfo->isTeamLeader))
continue;
monPosBefore = mon->pos;
// Statement with no effect needed to match.
GetEntInfo(mon)->isTeamLeader = GetEntInfo(mon)->isTeamLeader;
if (monInfo->flags & 0x2000) {
monInfo->flags &= ~(0x2000);
if (monInfo->isTeamLeader) {
sub_804AC20(&mon->pos);
sub_807EC28(FALSE);
sub_805EE30();
}
else {
sub_8075708(mon);
}
if (!EntityIsValid(mon))
continue;
if (sub_8044B28())
break;
sub_8043ED0(0);
sub_8074094(mon);
if (!EntityIsValid(mon))
continue;
if (sub_8044B28())
break;
sub_8071DA4(mon);
sub_8046D20();
sub_8075900(mon, gDungeon->forceMonsterHouse);
}
if (!EntityIsValid(mon))
continue;
if (sub_8044B28())
break;
if (monPosBefore.x != mon->pos.x || monPosBefore.y != mon->pos.y)
gUnknown_202F32D = 1;
sub_806A5B8(mon);
if (sub_80706A4(mon, &mon->pos)) {
WarpTarget(mon, mon, 0, NULL);
}
}
}
sub_8086AC0();
if (!sub_8044B28()) {
sub_8085140();
gDungeon->unkB8 = savedEntityPtr;
}
else {
gDungeon->unkB8 = savedEntityPtr;
}
return TRUE;
}
void sub_8075680(void)
{
@@ -125,7 +433,7 @@ u32 sub_8075818(Entity *entity)
EntityInfo *entityInfo;
Entity *subEntity;
Item *item;
Trap *trapData; // TODO: turn into struct when more research is done..
Trap *trapData;
u8 r1;
entityInfo = GetEntInfo(entity);
@@ -208,3 +516,34 @@ error:
return 0;
}
extern char *gPtrItsaMonsterHouseMessage;
extern u8 sub_8044B28(void);
extern void sub_807AB38(Entity *, u32);
extern void sub_8041888(u32);
void sub_8075900(Entity *pokemon, u8 r1)
{
if(EntityIsValid(pokemon))
{
if(!GetEntInfo(pokemon)->isNotTeamMember)
{
if(!sub_8044B28())
{
if(!gDungeon->unk644.monsterHouseTriggered)
{
if((GetTileAtEntitySafe(pokemon)->terrainType & TERRAIN_TYPE_IN_MONSTER_HOUSE))
{
// It's a monster house!
LogMessageByIdWithPopupCheckUser(GetLeader(), gPtrItsaMonsterHouseMessage);
gDungeon->unk644.monsterHouseTriggeredEvent = TRUE;
sub_807AB38(pokemon, r1);
sub_8041888(0);
if(sub_803F428(&pokemon->pos))
sub_803E708(0x78, 0x39);
}
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,866 +0,0 @@
#include "global.h"
#include "constants/ability.h"
#include "constants/weather.h"
#include "code_803E46C.h"
#include "code_8045A00.h"
#include "dungeon_message.h"
#include "code_806CD90.h"
#include "code_807CD9C.h"
#include "structs/str_dungeon.h"
#include "code_8077274_1.h"
#include "dungeon_ai.h"
#include "dungeon_engine.h"
#include "dungeon_generation.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_map.h"
#include "dungeon_map_access.h"
#include "dungeon_util.h"
#include "math.h"
#include "move_effects_target.h"
#include "moves.h"
#include "move_util.h"
#include "code_8041AD0.h"
#include "tile_types.h"
#include "code_803E668.h"
#include "weather.h"
#include "dungeon_config.h"
#include "dungeon_misc.h"
#include "dungeon_items.h"
extern u32 gDungeonFramesCounter;
extern u8 *gUnknown_80FCA10[];
extern u8 *gUnknown_80F8A0C[];
extern u8 *gUnknown_80FCBCC[];
extern u8 *gUnknown_80FC9E8[];
extern u8 *gUnknown_80FCB14[];
extern u8 *gUnknown_80FCAE8[];
extern u8 *gUnknown_80FC97C[];
extern u8 *gUnknown_80FC9A0[];
extern u8 *gUnknown_80FC584[];
extern u8 *gUnknown_80FD320[];
extern u8 *gUnknown_80FD2F8[];
extern u8 *gUnknown_80FCB98[];
extern u8 *gUnknown_80FC9C0[];
extern u8 *gUnknown_80FD060[];
extern u8 *gUnknown_80FD08C[];
extern u8 *gUnknown_80FD05C[];
extern u8 *gUnknown_80FD3D0[];
extern u8 *gUnknown_80FD3CC[];
extern u8 *gUnknown_80FD3C8[];
extern u8 *gUnknown_80FD3A0[];
extern u8 *gUnknown_80F96BC[];
extern u8 *gUnknown_80F96EC[];
extern struct DungeonPos *gUnknown_8107178[3];
extern void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 param_4,s32 param_5); // TODO: param_4 should be s16
extern void sub_804216C(Entity *pokemon, Entity *target, u32 r2);
extern void sub_804218C(Entity *pokemon, Entity *target);
EWRAM_INIT u32 gUnknown_203B444[3] = {0x28, 0x28, 0x50};
void sub_804EB30();
bool8 ExposeTrap(s32 x, s32 y);
void ShowWholeRevealedDungeonMap();
void sub_8049ED4();
void sub_806A5B8(Entity *);
u8 sub_8045888(Entity *);
void sub_807EC28(u32);
void sub_807D068(Entity *, DungeonPos *);
u8 sub_8044B28(void);
extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32);
void sub_80421AC(Entity * pokemon, Entity * target);
void sub_807BB78(Entity *pokemon);
extern void sub_803F580(u32);
bool8 sub_808384C(DungeonPos *, DungeonPos *);
u8 sub_8083660(DungeonPos *);
void BlowAwayTarget(Entity *pokemon, Entity *target, u32 direction)
{
const Tile *tile;
int iVar8;
bool8 flag;
DungeonPos pos;
Move move;
int counter;
Entity *entity;
PixelPos pos32;
counter = 10;
if (IsCurrentFixedRoomBossFight()) {
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC9E8); // It couldn't be knocked flying!
return;
}
else
{
if (pokemon == target) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCA10); // {POKEMON_0} couldn't be knocked flying!
return;
}
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
if (AbilityIsActive(target,ABILITY_SUCTION_CUPS)) {
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCBCC); // {POKEMON_0} is anchored! It can't be knocked flying!
return;
}
else
{
(GetEntInfo(target)->action).direction = (direction + 4) & DIRECTION_MASK;
sub_806CDD4(target, 6, (direction + 4) & DIRECTION_MASK);
sub_80421C0(target,0x1a3);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80F8A0C); // {POKEMON_0} was blown away!
flag = TRUE;
entity = NULL;
for(; counter > 0; counter--)
{
pos = target->pos;
pos.x += gAdjacentTileOffsets[direction].x;
pos.y += gAdjacentTileOffsets[direction].y;
if ((((pos.x < 0) || (pos.y < 0)) || (DUNGEON_MAX_SIZE_X <= pos.x)) ||
(DUNGEON_MAX_SIZE_Y <= pos.y)) goto _0807CF20;
pos32.x = gAdjacentTileOffsets[direction].x << 0xA;
pos32.y = gAdjacentTileOffsets[direction].y << 0xA;
for(iVar8 = 0; iVar8 < 6; iVar8++)
{
IncreaseEntityPixelPos(target,pos32.x,pos32.y);
if (sub_8045888(target) != 0) {
DungeonRunFrameActions(0x19);
}
}
tile = GetTile(pos.x, pos.y);
if (tile->monster != NULL) {
entity = tile->monster;
goto _0807CF26;
}
if (sub_80705F0(target,&pos)){
flag = (GetTerrainType(tile) != TERRAIN_TYPE_WALL);
goto _0807CF20;
}
sub_80694C0(target,pos.x,pos.y,1);
}
flag = TRUE;
_0807CF20:
if (!flag) {
_0807CF26:
sub_807D068(target,&target->pos);
sub_806F370(pokemon,target,gBlowAwayDmgValue,0,0,0,0x219,0,0,0);
}
if (sub_8044B28()) {
return;
}
if (entity != NULL) {
InitPokemonMove(&move,0x163);
if (!sub_80571F0(entity,&move)) {
TrySendImmobilizeSleepEndMsg(pokemon,entity);
sub_806F370(pokemon,entity,gBlowAwayDmgValue,0,0,0,0x21a,0,0,0);
}
}
if (sub_8044B28()) {
return;
}
if (!EntityIsValid(target)) {
return;
}
sub_806A5B8(target);
if (sub_80706A4(target,&target->pos)) {
WarpTarget(target,target,0,0);
}
if (!EntityIsValid(target)) {
return;
}
sub_806CE68(target,8);
if (GetEntInfo(target)->isTeamLeader) {
gDungeon->unk1 = 0;
gDungeon->unk5C0 = -1;
sub_804AC20(&target->pos);
sub_807EC28(FALSE);
}
sub_806A5B8(target);
sub_8075900(target,gDungeon->forceMonsterHouse);
}
}
}
void sub_807D068(Entity *pokemon, DungeonPos *pos)
{
int pixelX;
int posY;
int pixelY;
int posX;
int counter;
int iVar8;
s32 diff;
PixelPos local_34;
int incrementX;
int incrementY;
posX = X_POS_TO_PIXELPOS(pos->x);
posY = Y_POS_TO_PIXELPOS(pos->y);
diff = (pokemon->pixelPos).x - posX;
if (diff < 0) {
diff = -diff;
}
if (diff < 0xc) {
diff = (pokemon->pixelPos).y - posY;
if (diff < 0) {
diff = -diff;
}
if (diff < 0xc) goto _0807D11E;
}
iVar8 = 0;
pixelX = (pokemon->pixelPos).x;
pixelY = (pokemon->pixelPos).y;
incrementX = (posX - pixelX) / 0xc;
incrementY = (posY - pixelY) / 0xc;
for(counter = 0; counter < 0xC; counter++)
{
pixelX += incrementX;
pixelY += incrementY;
local_34.x = pixelX;
local_34.y = pixelY;
pokemon->unk1C.raw = sin_4096(iVar8) * 0xc;
sub_804535C(pokemon, &local_34);
if (sub_8045888(pokemon)) {
DungeonRunFrameActions(0x1a);
}
iVar8 = iVar8 + 0xaa;
}
_0807D11E:
local_34.x = posX;
local_34.y = posY;
pokemon->unk1C = IntToF248(0);
sub_804535C(pokemon,&local_34);
DungeonRunFrameActions(0x1a);
}
void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos)
{
EntityInfo *info;
u32 direction;
DungeonPos local_2c;
bool8 flag;
info = GetEntInfo(target);
flag = FALSE;
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
if (AbilityIsActive(target,ABILITY_SUCTION_CUPS)) {
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCAE8);
return;
}
if (IsCurrentFixedRoomBossFight()) {
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC97C);
return;
}
if (param_3 == 1)
{
DungeonPos stairsPosition = gDungeon->stairsSpawn;
if(stairsPosition.x == target->pos.x && stairsPosition.y == target->pos.y) {
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC9A0); // It's already on the stairs!
PetrifiedStatusTarget(pokemon,target);
return;
}
}
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FC584); // $m0 warped!
TrySendImmobilizeSleepEndMsg(target,target);
sub_80421AC(pokemon,target);
if (sub_8045888(target)) {
direction = (info->action).direction;
target->unk1C.raw += + 0x800;
while ( target->unk1C.raw < 0xa000) {
if ((gDungeonFramesCounter & 3) == 0) {
direction = (direction + 1) & DIRECTION_MASK;
info->action.direction = direction & DIRECTION_MASK;
sub_806CE68(target,direction);
}
DungeonRunFrameActions(0x22);
target->unk1C.raw += 0x800;
}
}
switch(param_3)
{
default:
case 0:
if (!sub_8083660(&local_2c)) {
local_2c = target->pos;
flag = TRUE;
}
break;
case 1:
if (!sub_808384C(&local_2c,&gDungeon->stairsSpawn)) {
local_2c = target->pos;
flag = TRUE;
}
break;
case 2:
if (!sub_808384C(&local_2c,pos)) {
local_2c = target->pos;
flag = TRUE;
}
break;
case 3:
local_2c = *pos;
break;
}
sub_80694C0(target,local_2c.x,local_2c.y,1);
sub_804535C(target,0);
sub_807BB78(target);
sub_803F580(1);
if (sub_8045888(target)) {
direction = (info->action).direction;
target->unk1C.raw = 0x9c00;
do {
if ((gDungeonFramesCounter & 3) == 0) {
direction = (direction + 1) & DIRECTION_MASK;
info->action.direction = direction & DIRECTION_MASK;
sub_806CE68(target,direction);
}
DungeonRunFrameActions(0x22);
target->unk1C.raw -= 0x400;
} while (0 < target->unk1C.raw);
}
target->unk1C = IntToF248_2(0);
DungeonRunFrameActions(0x22);
if (flag) {
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCB14); // But it dropped back at the same spot!
}
if (param_3 == 1) {
PetrifiedStatusTarget(pokemon,target);
}
if (info->isTeamLeader) {
sub_804AC20(&target->pos);
gDungeon->unk1 = 0;
gDungeon->unk5C0 = -1;
sub_807EC28(0);
}
sub_806A5B8(target);
sub_8075900(target,gDungeon->forceMonsterHouse);
}
void sub_807D3CC(Entity *param_1)
{
u32 room;
u8 flag;
int x;
int y;
s32 range;
RoomData *roomData;
flag = FALSE;
range = gDungeon->unk181e8.visibilityRange;
if (range == 0) {
range = 2;
}
room = GetEntityRoom(param_1);
if (room == CORRIDOR_ROOM) {
for (y = (param_1->pos).y - range; y <= ((param_1->pos).y + range); y++)
{
for (x = (param_1->pos).x - range; x <= ((param_1->pos).x + range); x++) {
flag |= ExposeTrap(x,y);
}
}
}
else {
roomData = &gDungeon->roomData[room];
for (y = roomData->bottomRightCornerY + -1; y <= roomData->topLeftCornerY + 1; y++) {
for (x = roomData->bottomRightCornerX + -1; x <= roomData->topLeftCornerX + 1; x++) {
flag |= ExposeTrap(x,y);
}
}
}
if (flag) {
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80FD2F8); // All traps were exposed
ShowWholeRevealedDungeonMap();
sub_8049ED4();
}
else {
LogMessageByIdWithPopupCheckUser(param_1,*gUnknown_80FD320); // There appears to be no hidden traps.
}
}
bool8 ExposeTrap(s32 x,s32 y)
{
const Tile *tile;
Entity *trap;
tile = GetTile(x,y);
trap = tile->object;
if (((trap != NULL) && (GetEntityType(trap) == ENTITY_TRAP)) && (!trap->isVisible)) {
trap->isVisible = TRUE;
return TRUE;
}
else {
return FALSE;
}
}
extern const u8 *const gUnknown_80FE034;
extern const u8 *const gUnknown_80FE060;
extern const DungeonPos gUnknown_80F4468[];
void HandleTrawlOrbAction(Entity *user, Entity *target)
{
Entity itemEntities[25];
Item itemInfo[25];
DungeonPos targetTilePos[25];
PixelPos itemVelocity[25];
bool8 targetTileUsed[30];
s32 i;
s32 itemsCount;
bool8 hasTrawled;
bool8 hallucinating;
Entity *currItemEntity;
hasTrawled = FALSE;
itemsCount = 0;
currItemEntity = &itemEntities[0];
for (i = 0; i < gDungeon->numItems; i++) {
Entity *dungeonItem = gDungeon->items[i];
if (EntityIsValid(dungeonItem)) {
if (itemsCount >= 25)
break;
if ((abs(dungeonItem->pos.x - user->pos.x) > 2 || abs(dungeonItem->pos.y - user->pos.y) > 2)
&& GetTerrainType(GetTile(dungeonItem->pos.x, dungeonItem->pos.y)) != TERRAIN_TYPE_WALL)
{
currItemEntity->type = ENTITY_ITEM;
currItemEntity->axObj.info.item = &itemInfo[itemsCount];
currItemEntity->pos = dungeonItem->pos;
SetEntityPixelPos(currItemEntity, (dungeonItem->pos.x * 24 + 4) * 256, (dungeonItem->pos.y * 24 + 4) * 256);
currItemEntity->spawnGenID = 0;
currItemEntity->isVisible = TRUE;
currItemEntity->unk22 = 0;
currItemEntity->unk1C = IntToF248_2(0);
itemInfo[itemsCount] = gDungeon->unk3804[i];
currItemEntity++;
itemsCount++;
}
}
}
if (itemsCount == 0) {
LogMessageByIdWithPopupCheckUser(user, gUnknown_80FE034);
}
else {
s32 var;
s32 i;
s32 unkAngle;
s32 animFrame;
for (i = 0; i < 30; i++) {
targetTileUsed[i] = FALSE;
}
for (i = 0; i < itemsCount; i++) {
s32 j = 0;
bool8 foundTile = FALSE;
DungeonPos pos;
pos.x = user->pos.x;
pos.y = user->pos.y;
for (j = 0; j < 30; j++) {
if (gUnknown_80F4468[j].x == 99)
break;
if (!targetTileUsed[j]) {
const Tile *tile;
pos.x = user->pos.x + gUnknown_80F4468[j].x;
pos.y = user->pos.y + gUnknown_80F4468[j].y;
tile = GetTile(pos.x, pos.y);
if (GetTerrainType(tile) == TERRAIN_TYPE_NORMAL && !(tile->terrainType & TERRAIN_TYPE_STAIRS) && tile->object == NULL) {
targetTilePos[i] = pos;
targetTileUsed[j] = TRUE;
foundTile = TRUE;
break;
}
}
}
if (!foundTile) {
itemEntities[i].type = ENTITY_NOTHING;
targetTilePos[i].x = -1;
targetTilePos[i].y = -1;
}
}
for (i = 0; i < itemsCount; i++) {
if (EntityIsValid(&itemEntities[i])) {
RemoveItemFromDungeonAt(&itemEntities[i].pos, 1);
ShowDungeonMapAtPos(itemEntities[i].pos.x, itemEntities[i].pos.y);
itemVelocity[i].x = (((targetTilePos[i].x * 24 + 4) * 256) - itemEntities[i].pixelPos.x) / 60;
itemVelocity[i].y = (((targetTilePos[i].y * 24 + 4) * 256) - itemEntities[i].pixelPos.y) / 60;
}
}
sub_80421C0(user, 0x1A2);
var = 0;
hallucinating = gDungeon->unk181e8.hallucinating;
unkAngle = 0;
for (animFrame = 0; animFrame < 60; animFrame++) {
for (i = 0; i < itemsCount; i++) {
if (EntityIsValid(&itemEntities[i])) {
IncreaseEntityPixelPos(&itemEntities[i], itemVelocity[i].x, itemVelocity[i].y);
itemEntities[i].unk1C.raw = sin_4096(unkAngle) * 0xC;
sub_80462AC(&itemEntities[i], hallucinating, 0, var, 0);
}
}
DungeonRunFrameActions(0x13);
unkAngle += 0x22;
if (!(animFrame & 3)) {
var++;
}
var &= 7;
}
for (i = 0; i < itemsCount; i++) {
if (targetTilePos[i].x >= 0) {
AddItemToDungeonAt(&targetTilePos[i], GetItemData(&itemEntities[i]), 1);
ShowDungeonMapAtPos(targetTilePos[i].x, targetTilePos[i].y);
hasTrawled = TRUE;
}
}
if (hasTrawled) {
LogMessageByIdWithPopupCheckUser(user, gUnknown_80FE060);
}
else {
LogMessageByIdWithPopupCheckUser(user, gUnknown_80FE034);
}
sub_807EC28(1);
}
}
void HandlePounceOrbAction(Entity *pokemon, Entity *target, u8 r2) {
EntityInfo *info;
const Tile *tile;
DungeonPos pos;
u32 direction = r2;
info = GetEntInfo(target);
if(AbilityIsActive(target, ABILITY_SUCTION_CUPS))
{
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], target, 0);
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FCB98);
return;
}
if(IsCurrentFixedRoomBossFight())
{
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FC9C0);
return;
}
if(direction == NUM_DIRECTIONS)
direction = info->action.direction;
sub_806CDD4(target, 6, direction);
while (1)
{
pos.x = target->pos.x + gAdjacentTileOffsets[direction].x;
pos.y = target->pos.y + gAdjacentTileOffsets[direction].y;
if(pos.x <= 0 || pos.y <= 0 || pos.x > DUNGEON_MAX_SIZE_X - 2 || pos.y > DUNGEON_MAX_SIZE_Y - 2) break;
tile = GetTile(pos.x, pos.y);
if(tile->monster) break;
if(GetTerrainType(tile) == TERRAIN_TYPE_WALL) break;
sub_80694C0(target, pos.x, pos.y, 0);
sub_804535C(target, 0);
if(!sub_8045888(target)) continue;
DungeonRunFrameActions(0x3A);
}
sub_806A5B8(target);
if(sub_80706A4(target, &target->pos))
WarpTarget(target, target, 0, 0);
if(EntityIsValid(target))
{
sub_806CE68(target, 8);
if(info->isTeamLeader)
{
sub_804AC20(&target->pos);
sub_807EC28(0);
}
sub_806A5B8(target);
sub_8075900(target, gDungeon->forceMonsterHouse);
}
}
void HandleDroughtOrbAction(Entity *pokemon, Entity *target) {
s32 x;
s32 y;
Tile *tile;
bool8 flag;
flag = FALSE;
if(IsCurrentFixedRoomBossFight())
{
LogMessageByIdWithPopupCheckUser(pokemon, *gUnknown_80FD060);
return;
}
if(IsWaterTileset())
{
LogMessageByIdWithPopupCheckUser(pokemon, *gUnknown_80FD08C);
return;
}
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
tile = GetTileMut(x, y);
if(GetTerrainType(tile) == TERRAIN_TYPE_SECONDARY)
{
SetTerrainNormal(tile);
sub_80498A8(x, y);
flag = TRUE;
}
}
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
sub_8049BB0(x, y);
if(flag)
{
sub_80421C0(pokemon, 0x1A1);
LogMessageByIdWithPopupCheckUser(pokemon, *gUnknown_80FD05C);
}
else
{
LogMessageByIdWithPopupCheckUser(pokemon, *gUnknown_80FD060);
}
gDungeon->unk644.unk2C = 1;
sub_806CF60();
ShowWholeRevealedDungeonMap();
sub_8049ED4();
}
void HandleOneRoomOrb(Entity *pokemon, Entity *target) {
bool8 bVar1;
Tile *tile;
s32 y;
Entity *entity;
s32 x;
s32 index;
bool8 isMonsterHouse;
if (gDungeon->forceMonsterHouse != 0) {
LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FD3C8);
return;
}
if (gDungeon->unk3A0B != 0) {
LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FD3CC);
return;
}
if (IsBossFight()) {
LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FD3D0);
return;
}
isMonsterHouse = FALSE;
for(x = 1; x < DUNGEON_MAX_SIZE_X - 1; x++)
{
for(y = 1; y < DUNGEON_MAX_SIZE_Y - 1; y++)
{
bVar1 = 0;
tile = GetTileMut(x,y);
tile->terrainType &= ~(TERRAIN_TYPE_UNK_x400);
tile->room = 0;
if ((tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) == 0)
{
if((tile->terrainType & TERRAIN_TYPE_UNBREAKABLE) == 0) {
tile->spawnOrVisibilityFlags |= SPAWN_FLAG_STAIRS | SPAWN_FLAG_ITEM;
tile->terrainType &= ~(TERRAIN_TYPE_NATURAL_JUNCTION);
if ((tile->terrainType & TERRAIN_TYPE_IN_MONSTER_HOUSE)) {
isMonsterHouse = TRUE;
}
if (GetTerrainType(tile) != TERRAIN_TYPE_SECONDARY)
if((GetTerrainType(tile) != (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY))) {
if (((x == 1) || (((y == 1 || (x == DUNGEON_MAX_SIZE_X - 2)) || (y == DUNGEON_MAX_SIZE_Y - 2)))) &&
((tile->object == NULL && (gDungeon->unk644.unk2C == 0)))) {
bVar1 = TRUE;
}
if (bVar1) {
SetTerrainSecondary(tile);
}
else {
if (GetTerrainType(tile) == TERRAIN_TYPE_NORMAL) continue;
SetTerrainNormal(tile);
tile->terrainType |= TERRAIN_TYPE_UNK_x400;
}
}
}
}
}
}
if (StairsAlwaysReachable(gDungeon->stairsSpawn.x,gDungeon->stairsSpawn.y,TRUE)) {
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
tile = GetTileMut(x,y);
if (!(tile->terrainType & TERRAIN_TYPE_UNBREAKABLE))
if(((tile->terrainType & (TERRAIN_TYPE_UNREACHABLE_FROM_STAIRS| TERRAIN_TYPE_UNK_x400)) == (TERRAIN_TYPE_UNREACHABLE_FROM_STAIRS| TERRAIN_TYPE_UNK_x400))) {
SetTerrainSecondary(tile);
}
}
}
}
if (isMonsterHouse) {
gDungeon->monsterHouseRoom = FALSE;
}
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
if (isMonsterHouse) {
GetTileMut(x,y)->terrainType |= TERRAIN_TYPE_IN_MONSTER_HOUSE;
}
sub_8049BB0(x,y);
}
}
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
entity = gDungeon->activePokemon[index];
if (EntityIsValid(entity)) {
entity->room = GetTile(entity->pos.x,entity->pos.y)->room;
}
}
sub_804EB30();
sub_804AAD4();
sub_8049884();
sub_806CF60();
ShowWholeRevealedDungeonMap();
sub_8049ED4();
LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FD3A0);
sub_803E708(0x28,0x2b);
sub_8075900(pokemon,1);
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
entity = gDungeon->activePokemon[index];
if (EntityIsValid(entity)) {
sub_806A5B8(entity);
if ((EntityIsValid(entity)) && (sub_80706A4(entity,&entity->pos))) {
WarpTarget(entity,entity,0,0);
}
}
}
gDungeon->forceMonsterHouse = TRUE;
sub_803E708(0x14,0x2b);
}
// https://decomp.me/scratch/JZ51a -- sub_807E1A0 param_4 should be s16 but using s32 to match this func
void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 param_4,u8 moveType,s16 param_6)
{
bool8 flag;
DungeonPos *posPtr;
Tile *tile;
Entity * entity1;
Entity *entity2;
int x;
int y;
int index;
DungeonPos pos;
u32 uStack_2c;
uStack_2c = param_6;
for (index = 0; index < DUNGEON_MAX_POKEMON; index++) {
entity1 = gDungeon->activePokemon[index];
if ((EntityIsValid(entity1)) && (AbilityIsActive(entity1, ABILITY_DAMP))) break;
}
if (index != DUNGEON_MAX_POKEMON) {
sub_804218C(pokemon,target);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80F96EC);
}
else if (GetApparentWeather(target) == WEATHER_RAIN) {
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80F96EC);
}
else
{
sub_804216C(pokemon,target,param_4);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80F96BC);
flag = FALSE;
posPtr = (gUnknown_8107178)[param_4];
if (posPtr->x != 99) {
while (posPtr->x != 99) {
pos.x = posPtr->x + param_3->x;
pos.y = posPtr->y + param_3->y;
if ((0 <= pos.x) && (0 <= pos.y) && (pos.x < DUNGEON_MAX_SIZE_X) && (pos.y < DUNGEON_MAX_SIZE_Y)) {
tile = GetTileMut(pos.x,pos.y);
if ((0 < pos.x) && (0 < pos.y && ((pos.x < (DUNGEON_MAX_SIZE_X - 1) && ((pos.y < (DUNGEON_MAX_SIZE_Y - 1)
&& GetTerrainType(tile) == TERRAIN_TYPE_WALL)))
)) && (tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) == 0) {
SetTerrainNormal(tile);
for(y = -1; y < 2; y++)
{
for(x = -1; x < 2; x++)
{
sub_80498A8(pos.x + x,pos.y + y);
}
}
flag = TRUE;
}
entity2 = tile->object;
if (((entity2 != NULL) && (entity2 != target)) && (GetEntityType(entity2) == ENTITY_ITEM)) {
RemoveItemFromDungeonAt(&pos, 0);
}
entity2 = tile->monster;
if (((entity2 != NULL) && (entity2 != target)) && (GetEntityType(entity2) == ENTITY_MONSTER)) {
sub_807E1A0(pokemon,entity2,moveType,uStack_2c,gUnknown_203B444[param_4]);
if (sub_8044B28()) break;
}
}
posPtr++;
}
}
if (sub_8044B28()) {
return;
}
if (GetEntityType(target) == ENTITY_MONSTER) {
sub_807E1A0(pokemon,target,moveType,uStack_2c,gUnknown_203B444[param_4]);
}
if (!flag) {
return;
}
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
sub_8049BB0(x,y);
}
}
ShowWholeRevealedDungeonMap();
sub_8049ED4();
}
}

View File

@@ -1,178 +0,0 @@
#include "global.h"
#include "dungeon_misc.h"
#include "code_804267C.h"
#include "code_8045A00.h"
#include "dungeon_message.h"
#include "constants/ability.h"
#include "constants/type.h"
#include "dungeon_ai.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util.h"
#include "move_util.h"
#include "moves.h"
#include "structs/str_dungeon.h"
extern u8 UseAttack(Entity *);
extern void sub_805E804(void);
void sub_806A2BC(Entity *pokemon, u8 param_2);
extern u8 sub_8044B28(void);
extern void nullsub_93(DungeonPos *);
extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32);
extern void sub_807EC28(bool8);
extern void sub_806A5B8(Entity *);
extern u32 gUnknown_80F5FAC[];
extern u8 *gUnknown_80F9C4C[];
extern u8 *gUnknown_80F9C70[];
extern u8 *gUnknown_80F9C8C[];
extern u8 *gUnknown_80F9CBC[];
extern u8 *gUnknown_80FCAC0[];
void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s16 param_4,s32 param_5)
{
EntityInfo *targetInfo;
u8 flag;
Move move;
s32 newHP;
s32 param_4_s32;
param_4_s32 = param_4;
if (EntityIsValid(target)) {
targetInfo = GetEntInfo(target);
InitPokemonMove(&move, MOVE_REGULAR_ATTACK);
if (!sub_80571F0(target,&move)) {
if (!targetInfo->isNotTeamMember) {
newHP = targetInfo->HP;
newHP /= 2;
if (MonsterIsType(target, TYPE_FIRE)) {
newHP /= 2;
}
if (newHP < 1) {
newHP = 1;
}
}
else {
newHP = param_5;
if (MonsterIsType(target, TYPE_FIRE)) {
newHP /= 2;
}
}
sub_806F370(pokemon,target,newHP,0,&flag,moveType,param_4_s32,0,0,0);
}
}
}
void HandleSwitcherOrb(Entity *pokemon,Entity *target)
{
DungeonPos pokemonPos;
DungeonPos targetPos;
if (AbilityIsActive(pokemon, ABILITY_SUCTION_CUPS)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCAC0); // $m0 is anchored! It won't switch places
}
else if(AbilityIsActive(target, ABILITY_SUCTION_CUPS))
{
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],target,0);
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FCAC0); // $m0 is anchored! It won't switch places
}
else
{
pokemonPos.x = pokemon->pos.x;
pokemonPos.y = pokemon->pos.y;
targetPos.x = target->pos.x;
targetPos.y = target->pos.y;
nullsub_93(&pokemonPos);
nullsub_93(&targetPos);
sub_80694C0(pokemon,targetPos.x,targetPos.y,1);
sub_80694C0(target,pokemonPos.x,pokemonPos.y,1);
sub_804535C(pokemon,NULL);
sub_804535C(target,NULL);
if (EntityIsValid(pokemon)) {
if (GetEntInfo(pokemon)->isTeamLeader) {
sub_804AC20(&pokemon->pos);
sub_807EC28(FALSE);
}
sub_806A5B8(pokemon);
sub_8075900(pokemon,gDungeon->forceMonsterHouse);
}
if (EntityIsValid(target)) {
if (GetEntInfo(target)->isTeamLeader) {
sub_804AC20(&target->pos);
sub_807EC28(FALSE);
}
sub_806A5B8(target);
sub_8075900(target,gDungeon->forceMonsterHouse);
}
}
}
void sub_807E378(void)
{
u16 uVar2;
Entity *leader;
leader = GetLeader();
if (EntityIsValid(leader)) {
uVar2 = gDungeon->unk644.windTurns;
if ((gDungeon->unk644.windTurns < 1) ||
(gDungeon->unk644.windTurns--, ((uVar2 - 1) << 0x10) < 1)) {
gDungeon->unk644.unk36 = 3;
}
if (gDungeon->unk644.unk36 == 0) {
if (gDungeon->unk644.windTurns < 0xfa) {
sub_805E804();
sub_806A2BC(leader,1);
UseAttack(leader);
if (sub_8044B28() == 0) {
LogMessageByIdWithPopupCheckUser(leader,*gUnknown_80F9C4C);
sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],0);
gDungeon->unk644.unk36 = 1;
}
}
}
else if (gDungeon->unk644.unk36 == 1) {
if (gDungeon->unk644.windTurns < 0x96) {
sub_805E804();
sub_806A2BC(leader,1);
UseAttack(leader);
if (sub_8044B28() == 0) {
LogMessageByIdWithPopupCheckUser(leader,*gUnknown_80F9C70);
sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],1);
gDungeon->unk644.unk36 = 2;
}
}
}
else if (gDungeon->unk644.unk36 == 2) {
if (gDungeon->unk644.windTurns < 0x32) {
sub_805E804();
sub_806A2BC(leader,1);
UseAttack(leader);
if (sub_8044B28() == 0) {
LogMessageByIdWithPopupCheckUser(leader,*gUnknown_80F9C8C);
sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],2);
gDungeon->unk644.unk36 = 3;
}
}
}
else if (gDungeon->unk644.windTurns < 1) {
sub_805E804();
sub_806A2BC(leader,1);
UseAttack(leader);
if (sub_8044B28() == 0) {
LogMessageByIdWithPopupCheckUser(leader,*gUnknown_80F9CBC);
sub_80426C8(gUnknown_80F5FAC[gDungeon->tileset],3);
gDungeon->unk644.unk36 = 4;
sub_8068FE0(leader,0x21e,leader);
}
}
}
}

View File

@@ -1,911 +0,0 @@
#include "global.h"
#include "weather.h"
#include "code_804267C.h"
#include "code_803E46C.h"
#include "dungeon.h"
#include "dungeon_config.h"
#include "dungeon_leader.h"
#include "dungeon_music.h"
#include "dungeon_util.h"
#include "pokemon.h"
#include "structs/map.h"
#include "dungeon_message.h"
#include "dungeon_pokemon_attributes.h"
#include "string_format.h"
#include "dungeon_movement.h"
#include "dungeon_capabilities.h"
#include "dungeon_visibility.h"
#include "dungeon_map_access.h"
#include "dungeon_movement.h"
#include "dungeon_ai_targeting.h"
#include "position_util.h"
#include "dungeon_ai.h"
#include "code_806CD90.h"
#include "code_807CD9C.h"
#include "dungeon_random.h"
#include "code_805D8C8.h"
#include "code_803E668.h"
#include "code_8045A00.h"
#include "dungeon_items.h"
#include "move_util.h"
#include "moves.h"
#include "code_80450F8.h"
#include "math.h"
#include "constants/ability.h"
#include "constants/monster.h"
#include "constants/type.h"
#include "dungeon_misc.h"
#include "code_807E5AC.h"
#include "sprite.h"
extern OpenedFile *gUnknown_202ECA0;
extern SpriteOAM gUnknown_202EDC0;
extern void sub_804178C(u32);
extern void sub_80429D8(Entity *r0);
extern s32 GetMonsterApparentID(Entity *pokemon, s32 id);
extern void sub_803E874(bool8 r10, s32 r9);
extern void GetWeatherName(u8 *dst, u8 weatherId);
extern s32 CalculateStatusTurns(Entity *target, const s16 *turnRange, bool8 factorCurerSkills);
extern void sub_80838EC(u8 *a);
extern bool8 sub_8044B28(void);
void sub_807E7FC(bool8 arg0);
void sub_807EFFC(bool8 arg0);
s32 sub_807F19C(bool8 arg0);
void sub_807E8F0(Entity *pokemon);
bool8 sub_807EF48(void);
void sub_807F33C(void);
extern const u8 *gWeatherNames[];
extern const u8 *const gUnknown_80FC5E0;
extern const u8 *const gUnknown_80FA778;
extern const u8 *const gUnknown_80FA758;
extern const u8 *const gUnknown_80FE674;
extern const u8 *const gUnknown_80FE65C;
extern const u8 *const gUnknown_80FE63C;
extern const u8 *const gUnknown_80FE5F0;
extern const u8 *const gUnknown_80FAD8C;
extern const u8 *const gUnknown_80FADB0;
extern const u8 *const gUnknown_80FE5C0;
extern const u8 *const gUnknown_80FE4F4;
extern const u8 *const gUnknown_80FE568;
extern const u8 *const gUnknown_80FE520;
extern const u8 *const gUnknown_80FE4D4;
extern const u8 *const gUnknown_80FE4B8;
// Note: gUnknown_202ECA0 file's 2d array is read as 1d array in functions below, be careful!
void sub_807E698(bool8 arg0)
{
s32 i, j;
s32 weatherArrId = GetApparentWeather(NULL) * COLOR_RAMP_COUNT;
RGB *fileData = (void *) gUnknown_202ECA0->data;
u8 savedByte;
sub_8042818(GetApparentWeather(NULL), arg0);
DungeonRunFrameActions(0x25);
sub_804178C(1);
savedByte = gUnknown_203B40D;
gUnknown_203B40D = 1;
for (i = 0; i < 64; i++) {
bool8 r7 = FALSE;
DungeonRunFrameActions(0x25);
for (j = 0; j < COLOR_RAMP_COUNT; j++) {
if (abs(gDungeon->colorRamp[j].r - fileData[weatherArrId + j].r) < 10) {
gDungeon->colorRamp[j].r = fileData[weatherArrId + j].r;
}
else {
r7 = TRUE;
if (gDungeon->colorRamp[j].r < fileData[weatherArrId + j].r) {
gDungeon->colorRamp[j].r += 10;
}
else if (gDungeon->colorRamp[j].r > fileData[weatherArrId + j].r) {
gDungeon->colorRamp[j].r -= 10;
}
}
if (abs(gDungeon->colorRamp[j].g - fileData[weatherArrId + j].g) < 10) {
gDungeon->colorRamp[j].g = fileData[weatherArrId + j].g;
}
else {
r7 = TRUE;
if (gDungeon->colorRamp[j].g < fileData[weatherArrId + j].g) {
gDungeon->colorRamp[j].g += 10;
}
else if (gDungeon->colorRamp[j].g > fileData[weatherArrId + j].g) {
gDungeon->colorRamp[j].g -= 10;
}
}
if (abs(gDungeon->colorRamp[j].b - fileData[weatherArrId + j].b) < 10) {
gDungeon->colorRamp[j].b = fileData[weatherArrId + j].b;
}
else {
r7 = TRUE;
if (gDungeon->colorRamp[j].b < fileData[weatherArrId + j].b) {
gDungeon->colorRamp[j].b += 10;
}
else if (gDungeon->colorRamp[j].b > fileData[weatherArrId + j].b) {
gDungeon->colorRamp[j].b -= 10;
}
}
}
sub_803E874(FALSE, 0);
if (!r7)
break;
}
gUnknown_203B40D = savedByte;
sub_807E7FC(arg0);
}
void sub_807E7FC(bool8 r0)
{
s32 i;
Entity *cameraTarget = gDungeon->unk181e8.cameraTarget;
if (cameraTarget == NULL) {
cameraTarget = GetLeader();
}
if (r0) {
if (gDungeon->unk1356C == 0) {
GetWeatherName(gFormatBuffer_Monsters[0], GetApparentWeather(NULL));
LogMessageByIdWithPopupCheckUser(cameraTarget, gUnknown_80FC5E0); // Weather: {ARG_POKEMON_0}
}
}
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *pokemon = gDungeon->activePokemon[i];
if (EntityIsValid(pokemon)) {
sub_807E8F0(pokemon);
}
}
}
void sub_807E88C(void)
{
s32 i;
s32 weatherArrId = GetApparentWeather(0) * COLOR_RAMP_COUNT;
RGB *fileData = (void *) gUnknown_202ECA0->data;
for (i = 0; i < COLOR_RAMP_COUNT; i++) {
gDungeon->colorRamp[i].r = fileData[weatherArrId + i].r;
gDungeon->colorRamp[i].g = fileData[weatherArrId + i].g;
gDungeon->colorRamp[i].b = fileData[weatherArrId + i].b;
}
sub_803E874(0, 0);
}
void sub_807E8F0(Entity *pokemon)
{
u8 oldTypes[2];
bool8 flag = FALSE;
if (EntityIsValid(pokemon)) {
EntityInfo *info = GetEntInfo(pokemon);
s32 previousApparentId = info->apparentID;
oldTypes[0] = info->types[0];
oldTypes[1] = info->types[1];
CalcSpeedStage(pokemon);
if (AbilityIsActive(pokemon, ABILITY_FORECAST)) {
info->types[0] = gCastformByWeather[GetApparentWeather(pokemon)].type;
info->types[1] = TYPE_NONE;
}
else if ((info->reflectClassStatus.status != STATUS_CONVERSION2) && (info->isColorChanged == FALSE)){
info->types[0] = GetPokemonType(info->id, 0);
info->types[1] = GetPokemonType(info->id, 1);
}
if ((oldTypes[0] != info->types[0]) || (oldTypes[1] != info->types[1])) {
flag = TRUE;
}
if (IS_CASTFORM_FORM_MONSTER(info->id) || info->id == MONSTER_CASTFORM) {
if (AbilityIsActive(pokemon, ABILITY_FORECAST)) {
info->apparentID = GetMonsterApparentID(pokemon, info->id);
}
else {
info->apparentID = MONSTER_CASTFORM;
}
if (info->apparentID != previousApparentId) {
pokemon->axObj.spriteFile = GetSpriteData(info->apparentID);
sub_806CCB4(pokemon,sub_806CEBC(pokemon));
flag = TRUE;
}
}
if (flag) {
sub_80429D8(pokemon);
}
}
}
void GetWeatherName(u8 *buffer, u8 weather)
{
strcpy(buffer, gWeatherNames[weather]);
}
void MudWaterSportEffect(u8 which)
{
if (which == 0) {
gDungeon->weather.mudSportTurns = CalculateStatusTurns(0, gMudWaterSportTurnRange, FALSE);
LogMessageByIdWithPopupCheckUser(GetLeader(), gUnknown_80FAD8C);
}
else {
gDungeon->weather.waterSportTurns =CalculateStatusTurns(0, gMudWaterSportTurnRange, FALSE);
LogMessageByIdWithPopupCheckUser(GetLeader(), gUnknown_80FADB0);
}
}
bool8 sub_807EAA0(bool8 arg0, bool8 arg1)
{
s32 i;
s32 var = 0;
s32 index = -1;
bool8 ret = FALSE;
s32 weatherBefore = GetApparentWeather(NULL);
for (i = 0; i < 8; i++) {
if (gDungeon->weather.unkE267[i] < gDungeon->weather.naturalWeather[i]) {
gDungeon->weather.unkE267[i] = gDungeon->weather.naturalWeather[i];
}
else if (gDungeon->weather.unkE267[i] > gDungeon->weather.naturalWeather[i]) {
sub_80838EC(&gDungeon->weather.unkE267[i]);
}
if (var < gDungeon->weather.unkE267[i]) {
var = gDungeon->weather.unkE267[i];
index = i;
}
}
if (index < 0) {
gDungeon->weather.weather = gDungeon->weather.unkE265;
}
else {
gDungeon->weather.weather = index;
}
if (gDungeon->weather.nullifyWeather) {
gDungeon->weather.weather = 0;
}
if (weatherBefore != GetApparentWeather(NULL) || arg1) {
ret = TRUE;
sub_807E698(arg0);
}
if (gDungeon->weather.weatherDamageCounter != 0) {
gDungeon->weather.weatherDamageCounter--;
}
else {
gDungeon->weather.weatherDamageCounter = 9;
}
if (gDungeon->weather.mudSportTurns != 0) {
sub_80838EC(&gDungeon->weather.mudSportTurns);
if (gDungeon->weather.mudSportTurns == 0) {
LogMessageByIdWithPopupCheckUser(GetLeader(), gUnknown_80FA778);
}
}
if (gDungeon->weather.waterSportTurns != 0) {
sub_80838EC(&gDungeon->weather.waterSportTurns);
if (gDungeon->weather.waterSportTurns == 0) {
LogMessageByIdWithPopupCheckUser(GetLeader(), gUnknown_80FA758);
}
}
return ret;
}
void sub_807EC28(bool8 arg0)
{
Entity *leader;
EntityInfo *leaderInfo;
bool32 prevTileWasShop;
bool32 isShopTile;
if (sub_8044B28())
return;
leader = GetLeader();
leaderInfo = GetEntInfo(leader);
prevTileWasShop = gDungeon->unk644.unk54;
isShopTile = (GetTileAtEntitySafe(leader)->terrainType & TERRAIN_TYPE_SHOP) != 0;
gDungeon->unk644.unk54 = isShopTile;
gDungeon->unk644.unk55 = isShopTile;
if (gDungeon->unk644.unk2A || gDungeon->unk644.unk50 == 0)
return;
if (leaderInfo->invisibleClassStatus.status == STATUS_INVISIBLE) {
gDungeon->unk644.unk54 = 0;
gDungeon->unk644.unk55 = 0;
}
else {
s32 i;
struct MonDialogueSpriteInfo dialogueInfo;
bool8 sameRoom = FALSE;
bool8 var_2C;
bool8 var_28;
for (i = 0; i < DUNGEON_MAX_WILD_POKEMON; i++) {
Entity *wildMon = gDungeon->wildPokemon[i];
if (EntityIsValid(wildMon)) {
EntityInfo *wildMonInfo = GetEntInfo(wildMon);
if (wildMonInfo->shopkeeper == SHOPKEEPER_MODE_SHOPKEEPER && sub_8070BC0(wildMon) && GetEntityRoom(leader) == GetEntityRoom(wildMon)) {
sameRoom = TRUE;
}
}
}
dialogueInfo.species = MONSTER_KECLEON;
dialogueInfo.spriteId = 0;
if (!prevTileWasShop) {
if (isShopTile == TRUE) {
if (sameRoom) {
DisplayDungeonMessage(&dialogueInfo, gUnknown_80FE674, TRUE); // Ah welcome!
}
return;
}
}
else {
if (isShopTile == TRUE) {
return;
}
}
if ((prevTileWasShop != TRUE || isShopTile) && !arg0) {
return;
}
var_2C = FALSE;
var_28 = FALSE;
if (sub_807EF48()) {
var_28 = TRUE;
for (i = 0; i < DUNGEON_MAX_WILD_POKEMON; i++) {
Entity *wildMon = gDungeon->wildPokemon[i];
if (EntityIsValid(wildMon)
&& GetEntInfo(wildMon)->shopkeeper == SHOPKEEPER_MODE_SHOPKEEPER
&& sub_8070BC0(wildMon)
&& GetEntityRoom(leader) == GetEntityRoom(wildMon))
{
var_2C = TRUE;
if (abs(leader->pos.x - wildMon->pos.x) >= 2 || abs(leader->pos.y - wildMon->pos.y) >= 2) {
s32 x, y;
DungeonPos pos;
for (x = -1; x < 2; x++) {
for (y = -1; y < 2; y++) {
pos.x = leader->pos.x + x;
pos.y = leader->pos.y + y;
if (GetTile(pos.x, pos.y)->room != CORRIDOR_ROOM) {
if (!sub_80703A0(wildMon, &pos)) {
WarpTarget(leader, wildMon, 3, &pos);
goto LOOP_BREAK; // Used to break out of the nested loops
}
}
}
}
LOOP_BREAK:
}
if (sub_8070BC0(leader)) {
sub_806CE34(leader, GetDirectionTowardsPosition(&leader->pos, &wildMon->pos));
}
else {
var_2C = FALSE;
}
sub_806CE68(wildMon, GetDirectionTowardsPosition(&wildMon->pos, &leader->pos));
break;
}
}
}
if (var_28 && !var_2C) {
if (gDungeon->unk644.unk50 > gDungeon->unk644.unk48) {
sub_807F33C();
}
}
else if (var_28 && !sameRoom) {
if (gDungeon->unk644.unk50 > gDungeon->unk644.unk48) {
sub_807F33C();
}
}
else {
sub_807EFFC(var_2C);
if (sub_807F19C(var_2C)) {
sub_807F33C();
}
else if (prevTileWasShop == TRUE && !isShopTile && sameRoom) {
DisplayDungeonMessage(&dialogueInfo, gUnknown_80FE65C, TRUE); // I await your next visit
}
}
}
}
bool8 sub_807EF48(void)
{
if ((gDungeon->unk644.unk50 - gDungeon->unk644.unk48) > 0) {
return TRUE;
}
if (gDungeon->unk644.unk4C != 0) {
return TRUE;
}
return FALSE;
}
void sub_807EF84(void)
{
s32 val;
struct MonDialogueSpriteInfo dialogueInfo;
dialogueInfo.species = MONSTER_KECLEON;
dialogueInfo.spriteId = 0;
sub_807EFFC(1);
val = sub_807F19C(TRUE);
if (val != 0) {
Tile *tile = GetTileAtEntitySafe(GetLeader());
if (tile->terrainType & TERRAIN_TYPE_SHOP) {
if (val != 2) {
DisplayDungeonMessage(&dialogueInfo, gUnknown_80FE63C, 1); // This is very disappointing, please return any items before you leave.
}
}
else {
sub_807F33C();
}
}
else {
DisplayDungeonMessage(&dialogueInfo, gUnknown_80FE5F0, 1); // Looking forward to seeing you again!
}
}
void sub_807EFFC(bool8 arg0)
{
struct MonDialogueSpriteInfo dialogueInfo;
if (gDungeon->unk644.unk4C == 0)
return;
dialogueInfo.species = MONSTER_KECLEON;
dialogueInfo.spriteId = 0;
if (!arg0)
return;
gFormatArgs[0] = gDungeon->unk644.unk4C;
if (DisplayDungeonYesNoMessage(&dialogueInfo, gUnknown_80FE5C0, TRUE) == 1) { // For the merch you have left, I shall pay X. Is that acceptable?
s32 x, y;
DungeonPos pos;
s32 local_24;
PlaySoundEffect(0x14c);
AddToTeamMoney(gDungeon->unk644.unk4C);
local_24 = gDungeon->unk644.unk48;
for (x = gDungeon->kecleonShopPos.minX; x <= gDungeon->kecleonShopPos.maxX; x++) {
for (y = gDungeon->kecleonShopPos.minY; y <= gDungeon->kecleonShopPos.maxY; y++) {
const Tile *tile;
pos.y = y;
pos.x = x;
tile = GetTile(x,y);
if (tile->terrainType & TERRAIN_TYPE_SHOP && tile->object != NULL && GetEntityType(tile->object) == ENTITY_ITEM) {
Item *itemPtr = GetItemData(tile->object);
if (!ItemInShop(itemPtr)) {
Item item = *itemPtr;
RemoveItemFromDungeonAt(&pos, 1);
if (CanSellItem(item.id)) {
item.flags |= ITEM_FLAG_IN_SHOP;
}
AddItemToDungeonAt(&pos, &item, 1);
}
}
}
}
gDungeon->unk644.unk50 += (gDungeon->unk644.unk48 - local_24);
DisplayDungeonMessage(&dialogueInfo, gUnknown_80FE4F4, 1); // Your patronage is valued
}
}
s32 sub_807F19C(bool8 arg0)
{
s32 diff;
struct MonDialogueSpriteInfo dialogueInfo;
s32 i, x, y;
dialogueInfo.species = MONSTER_KECLEON;
dialogueInfo.spriteId = 0;
diff = gDungeon->unk644.unk50 - gDungeon->unk644.unk48;
if (diff > 0) {
if (!arg0) {
return 1;
}
gFormatArgs[0] = diff;
if (DisplayDungeonYesNoMessage(&dialogueInfo, gUnknown_80FE568, TRUE) != 1) { // The merchandise you have chosen costs X
return 1;
}
if (gTeamInventoryRef->teamMoney < diff) {
DisplayDungeonMessage(&dialogueInfo, gUnknown_80FE520, TRUE); // You don't have enough money.
return 2;
}
PlaySoundEffect(0x14c);
AddToTeamMoney(-diff);
for (x = 0; x < DUNGEON_MAX_SIZE_X; x++) {
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) {
const Tile *tile = GetTile(x, y);
if (!(tile->terrainType & TERRAIN_TYPE_SHOP) && tile->object != NULL && GetEntityType(tile->object) == ENTITY_ITEM) {
Item *itemPtr = GetItemData(tile->object);
if (CanSellItem(itemPtr->id)) {
itemPtr->flags &= ~(ITEM_FLAG_IN_SHOP);
}
}
}
}
for (i = 0; i < INVENTORY_SIZE; i++) {
Item *item = &gTeamInventoryRef->teamItems[i];
if (ItemExists(item) && CanSellItem(item->id)) {
item->flags &= ~(ITEM_FLAG_IN_SHOP);
}
}
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *mon = gDungeon->activePokemon[i];
if (EntityIsValid(mon)) {
EntityInfo *monInfo = GetEntInfo(mon);
Item *item = &monInfo->heldItem;
if (ItemExists(item) && CanSellItem(item->id)) {
item->flags &= ~(ITEM_FLAG_IN_SHOP);
}
}
}
gDungeon->unk644.unk50 = gDungeon->unk644.unk48;
DisplayDungeonMessage(&dialogueInfo, gUnknown_80FE4D4, TRUE); // Thank you very much.
}
return 0;
}
void sub_807F33C(void)
{
s32 i, x, y;
gDungeon->unk644.unk2A = 1;
gDungeon->unk644.unk2B = 1;
LogMessageByIdWithPopupCheckUser(GetLeader(), gUnknown_80FE4B8); // Help! Thief! I've been robbed! Help me catch the thief.
for (x = 0; x < DUNGEON_MAX_SIZE_X; x++) {
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) {
const Tile *tile = GetTile(x,y);
if (tile->object != NULL && GetEntityType(tile->object) == ENTITY_ITEM) {
Item *item = GetItemData(tile->object);
item->flags &= ~(ITEM_FLAG_IN_SHOP);
}
}
}
for (i = 0; i < INVENTORY_SIZE; i++) {
Item *item = &gTeamInventoryRef->teamItems[i];
if (ItemExists(item)) {
item->flags &= ~(ITEM_FLAG_IN_SHOP);
}
}
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *entity = gDungeon->activePokemon[i];
if (EntityIsValid(entity)) {
Item *item;
EntityInfo *info = GetEntInfo(entity);
info->shopkeeper = FALSE;
CalcSpeedStage(entity);
item = &info->heldItem;
if (ItemExists(item)) {
item->flags &= ~(ITEM_FLAG_IN_SHOP);
}
}
}
gDungeon->unk644.unk50 = 0;
gDungeon->unk644.unk48 = 0;
gDungeon->unk644.unk4C = 0;
}
extern void sub_80833E8(DungeonPos *param_1, s32 *param_2);
extern void sub_806A5B8(Entity *);
extern bool8 sub_8045888(Entity *ent);
extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32);
extern void sub_807D068(Entity *, DungeonPos *);
void sub_807F9BC(Entity *entity);
extern const u8 *const gUnknown_80FCB40;
extern const u8 *const gUnknown_80FCB70;
extern const u8 *const gUnknown_80FE6B4;
extern const u8 *const gUnknown_80FE690;
void sub_807F43C(Entity *target, Entity *attacker)
{
s32 attackerDirection;
s32 var_3C;
DungeonPos attackerPos;
s32 pixelPosX, pixelPosY;
PixelPos var_54;
s32 var_30, r10;
s32 r6;
s32 newDir;
s32 i, directionId;
Entity *tileEntity;
s32 var_2C;
DungeonPos positions[40];
s32 var_74[4];
s32 positionsCounter;
if (AbilityIsActive(attacker, ABILITY_SUCTION_CUPS)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], attacker, 0);
TryDisplayDungeonLoggableMessage3(target, attacker, gUnknown_80FCB40); // is anchored, cannot be moved
return;
}
if (target == attacker) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], attacker, 0);
TryDisplayDungeonLoggableMessage3(target, attacker, gUnknown_80FCB70); // couldn't be thrown for some reason
return;
}
attackerPos = attacker->pos;
for (var_3C = 0; var_3C < 2; var_3C++) {
positionsCounter = 0;
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *mon = gDungeon->activePokemon[i];
if (EntityIsValid(mon) && target != mon && attacker != mon && CanSeeTarget(target, mon)) {
if (var_3C == 0) {
if (GetTreatmentBetweenMonsters(target, mon, FALSE, TRUE) != 1)
continue;
}
else {
if (GetTreatmentBetweenMonsters(target, mon, FALSE, TRUE) != 0)
continue;
}
if (var_3C == 0) {
DungeonPos pos;
for (directionId = 0; directionId < NUM_DIRECTIONS; directionId++) {
pos.x = gAdjacentTileOffsets[directionId].x + mon->pos.x;
pos.y = gAdjacentTileOffsets[directionId].y + mon->pos.y;
if (!sub_80703A0(attacker, &pos))
break;
}
if (directionId != NUM_DIRECTIONS && positionsCounter < 40) {
positions[positionsCounter++] = mon->pos;
}
}
else {
DungeonPos pos;
for (directionId = 0; directionId < NUM_DIRECTIONS; directionId++) {
pos.x = gAdjacentTileOffsets[directionId].x + mon->pos.x;
pos.y = gAdjacentTileOffsets[directionId].y + mon->pos.y;
if (!sub_80703A0(attacker, &pos) && positionsCounter < 40) {
positions[positionsCounter++] = pos;
}
}
}
}
}
if (positionsCounter != 0)
break;
}
if (positionsCounter != 0) {
s32 rnd = DungeonRandInt(positionsCounter);
attackerPos = positions[rnd];
}
else {
sub_80833E8(&target->pos, var_74);
for (i = 0; i < 100; i++) {
DungeonPos pos;
pos.x = DungeonRandRange(var_74[0], var_74[2]);
pos.y = DungeonRandRange(var_74[1], var_74[3]);
if (!sub_80703A0(attacker, &pos)) {
attackerPos = pos;
break;
}
}
if (i == 100) {
TryDisplayDungeonLoggableMessage3(target, attacker, gUnknown_80FE6B4); // But it didn~27t go anywhere.
return;
}
}
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], attacker, 0);
TryDisplayDungeonLoggableMessage3(target, attacker, gUnknown_80FE690); // m0 was sent flying!
if (sub_8045888(attacker)) {
PlaySoundEffect(0x1A3);
}
var_2C = 0;
attackerDirection = GetEntInfo(attacker)->action.direction;
r6 = max(attackerPos.x - attacker->pos.x, attackerPos.y - attacker->pos.y) << 4;
if (r6 > 80)
r6 = 80;
if (r6 < 10)
r6 = 10;
newDir = GetDirectionTowardsPosition(&attackerPos, &attacker->pos);
pixelPosX = X_POS_TO_PIXELPOS(attackerPos.x) + ((gAdjacentTileOffsets[newDir].x << 8) / 3);
pixelPosY = Y_POS_TO_PIXELPOS(attackerPos.y) + ((gAdjacentTileOffsets[newDir].y << 8) / 3);
var_30 = (pixelPosX - attacker->pixelPos.x) / r6;
r10 = (pixelPosY - attacker->pixelPos.y) / r6;
var_54.x = attacker->pixelPos.x;
var_54.y = attacker->pixelPos.y;
for (i = 0; i < r6; i++) {
var_54.x += var_30;
var_54.y += r10;
sub_804535C(attacker, &var_54);
if (sub_8045888(attacker)) {
attacker->unk1C.raw = sin_4096(var_2C) << 5;
DungeonRunFrameActions(0x3B);
if (!(i & 3)) {
attackerDirection &= DIRECTION_MASK;
sub_806CDD4(attacker, 6, attackerDirection);
attackerDirection++;
}
}
var_2C += (0x800 / r6);
}
var_54.x = pixelPosX;
var_54.y = pixelPosY;
attacker->unk1C.raw = 0;
sub_804535C(attacker, &var_54);
DungeonRunFrameActions(0x3B);
GetEntInfo(attacker)->action.direction = attackerDirection & DIRECTION_MASK;
tileEntity = GetTile(attackerPos.x, attackerPos.y)->monster;
if (!EntityIsValid(tileEntity)) {
sub_80694C0(attacker, attackerPos.x, attackerPos.y, 1);
sub_807F9BC(attacker);
}
else {
for (directionId = 0; directionId < NUM_DIRECTIONS; directionId++) {
DungeonPos pos;
pos.x = gAdjacentTileOffsets[directionId].x + attackerPos.x;
pos.y = gAdjacentTileOffsets[directionId].y + attackerPos.y;
if (!sub_80703A0(attacker, &pos)) {
attackerPos = pos;
break;
}
}
if (directionId == NUM_DIRECTIONS) {
WarpTarget(target, attacker, 0, NULL);
}
else {
sub_807D068(attacker, &attackerPos);
sub_80694C0(attacker, attackerPos.x, attackerPos.y, 1);
}
if (GetEntityType(tileEntity) == ENTITY_MONSTER) {
Move move;
InitPokemonMove(&move, MOVE_REGULAR_ATTACK);
if (!sub_80571F0(tileEntity, &move)) {
sub_806F370(target, tileEntity, gHurlOrbDmgValue, FALSE, NULL, TYPE_NONE, 0x21A, 0, 0, 0);
}
if (EntityIsValid(tileEntity)) {
sub_806CE68(tileEntity, GetEntInfo(tileEntity)->action.direction);
}
}
sub_806F370(target, attacker, gHurlOrbDmgValue, FALSE, NULL, TYPE_NONE, 0x219, 0, 0, 0);
if (EntityIsValid(attacker)) {
sub_806CE68(attacker, GetEntInfo(attacker)->action.direction);
}
sub_803E708(0x1E, 0x3B);
sub_807F9BC(attacker);
}
}
void sub_807F9BC(Entity *entity)
{
if (EntityIsValid(entity)) {
EntityInfo *entInfo = GetEntInfo(entity);
if (entInfo->isTeamLeader) {
gDungeon->unk1 = 0;
gDungeon->unk5C0 = -1;
sub_804AC20(&entity->pos);
sub_807EC28(FALSE);
}
sub_806A5B8(entity);
sub_8075900(entity, gDungeon->forceMonsterHouse);
}
}
extern u8 sub_803D6FC(void);
void sub_807FA18(void)
{
s32 x, y;
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++) {
for (x = 0; x < DUNGEON_MAX_SIZE_X; x++) {
Tile *tile = GetTileMut(x, y);
if (tile->spawnOrVisibilityFlags & SPAWN_FLAG_TRAP) {
s32 trapId;
DungeonPos pos = {x, y};
if (tile->spawnOrVisibilityFlags & SPAWN_FLAG_UNK6) {
trapId = TRAP_WARP_TRAP;
}
else {
trapId = sub_803D6FC();
}
if (trapId == TRAP_WONDER_TILE) {
Entity *trap = SpawnTrap(trapId, &pos, 2);
if (trap != NULL) {
tile->object = trap;
trap->isVisible = TRUE;
}
}
else {
Entity *trap = SpawnTrap(trapId, &pos, 0);
if (trap != NULL) {
tile->object = trap;
trap->isVisible = FALSE;
}
}
}
}
}
}
void sub_807FA9C(void)
{
s32 x, y;
bool8 unkBool = gDungeon->unk181e8.showInvisibleTrapsMonsters;
for (y = gDungeon->unk181e8.cameraPos.y - 5; y < gDungeon->unk181e8.cameraPos.y + 5; y++) {
for (x = gDungeon->unk181e8.cameraPos.x - 6; x < gDungeon->unk181e8.cameraPos.x + 6; x++) {
bool8 r6 = FALSE;
const Tile *tile = GetTile(x, y);
if (tile->object != NULL && GetEntityType(tile->object) == ENTITY_TRAP && (tile->object->isVisible || unkBool)) {
r6 = TRUE;
}
if (tile->terrainType & TERRAIN_TYPE_STAIRS) {
r6 = TRUE;
}
if (r6) {
s32 spriteX = (x * 24) - gDungeon->unk181e8.cameraPixelPos.x;
s32 spriteY = (y * 24) - gDungeon->unk181e8.cameraPixelPos.y;
if (spriteX >= -32 && spriteY >= -32 && spriteX <= 272 && spriteY <= 192) {
SpriteSetObjMode(&gUnknown_202EDC0, 0);
SpriteSetY(&gUnknown_202EDC0, spriteY);
SpriteSetX(&gUnknown_202EDC0, spriteX);
SpriteSetPriority(&gUnknown_202EDC0, 3);
SpriteSetPalNum(&gUnknown_202EDC0, 10);
SpriteSetTileNum(&gUnknown_202EDC0, 0x1FC);
AddSprite(&gUnknown_202EDC0, 0, NULL, NULL);
}
}
}
}
}
//

View File

@@ -2,7 +2,7 @@
#include "constants/ability.h"
#include "constants/iq_skill.h"
#include "structs/dungeon_entity.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"

View File

@@ -4,7 +4,7 @@
#include "structs/str_dungeon.h"
#include "dungeon_cutscenes.h"
#include "dungeon_music.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_util_1.h"
#include "exclusive_pokemon.h"
#include "weather.h"

View File

@@ -1,6 +1,5 @@
#include "global.h"
#include "tile_types.h"
#include "dungeon_map_access.h"
bool8 IsWaterDungeon(u32 r0)
{

View File

@@ -1,21 +0,0 @@
const s16 gUnknown_810A808[NUM_TYPES][NUMBER_OF_GUMMIS] =
{
[TYPE_NONE] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[TYPE_NORMAL] = {0x00, 0x3c, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1e, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x05, 0x19, 0x19, 0x19},
[TYPE_FIRE] = {0x00, 0x19, 0x3c, 0x1e, 0x14, 0x19, 0x14, 0x19, 0x19, 0x1e, 0x19, 0x19, 0x14, 0x1e, 0x19, 0x19, 0x19, 0x14},
[TYPE_WATER] = {0x00, 0x19, 0x14, 0x3c, 0x1e, 0x1e, 0x14, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x14},
[TYPE_GRASS] = {0x00, 0x19, 0x1e, 0x14, 0x3c, 0x14, 0x1e, 0x19, 0x1e, 0x14, 0x1e, 0x19, 0x1e, 0x19, 0x19, 0x19, 0x19, 0x19},
[TYPE_ELECTRIC] = {0x00, 0x19, 0x19, 0x19, 0x19, 0x3c, 0x19, 0x19, 0x19, 0x1e, 0x14, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x14},
[TYPE_ICE] = {0x00, 0x19, 0x1e, 0x19, 0x19, 0x19, 0x3c, 0x1e, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1e, 0x19, 0x19, 0x19, 0x1e},
[TYPE_FIGHTING] = {0x00, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x3c, 0x19, 0x19, 0x1e, 0x1e, 0x14, 0x14, 0x19, 0x19, 0x14, 0x19},
[TYPE_POISON] = {0x00, 0x19, 0x19, 0x19, 0x14, 0x19, 0x19, 0x14, 0x3c, 0x1e, 0x19, 0x1e, 0x14, 0x19, 0x19, 0x19, 0x19, 0x19},
[TYPE_GROUND] = {0x00, 0x19, 0x19, 0x1e, 0x1e, 0x05, 0x1e, 0x19, 0x14, 0x3c, 0x19, 0x19, 0x19, 0x14, 0x19, 0x19, 0x19, 0x19},
[TYPE_FLYING] = {0x00, 0x19, 0x19, 0x19, 0x14, 0x1e, 0x1e, 0x14, 0x19, 0x05, 0x3c, 0x19, 0x14, 0x1e, 0x19, 0x19, 0x19, 0x19},
[TYPE_PSYCHIC] = {0x00, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x14, 0x19, 0x19, 0x19, 0x3c, 0x1e, 0x19, 0x1e, 0x19, 0x1e, 0x19},
[TYPE_BUG] = {0x00, 0x19, 0x1e, 0x19, 0x14, 0x19, 0x19, 0x14, 0x19, 0x14, 0x1e, 0x19, 0x3c, 0x1e, 0x19, 0x19, 0x19, 0x19},
[TYPE_ROCK] = {0x00, 0x14, 0x14, 0x1e, 0x1e, 0x19, 0x19, 0x1e, 0x14, 0x1e, 0x14, 0x19, 0x19, 0x3c, 0x19, 0x19, 0x19, 0x1e},
[TYPE_GHOST] = {0x00, 0x05, 0x19, 0x19, 0x19, 0x19, 0x19, 0x05, 0x14, 0x19, 0x19, 0x1e, 0x14, 0x19, 0x3c, 0x19, 0x1e, 0x19},
[TYPE_DRAGON] = {0x00, 0x19, 0x14, 0x14, 0x14, 0x14, 0x1e, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x3c, 0x19, 0x19},
[TYPE_DARK] = {0x00, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1e, 0x19, 0x19, 0x19, 0x05, 0x1e, 0x19, 0x14, 0x19, 0x3c, 0x19},
[TYPE_STEEL] = {0x00, 0x14, 0x1e, 0x19, 0x14, 0x19, 0x14, 0x1e, 0x05, 0x1e, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x3c},
};

View File

@@ -1,293 +0,0 @@
static const FriendAreaSettings sFriendAreaSettings[NUM_FRIEND_AREAS] = // 810AA90
{
[FRIEND_AREA_NONE] = {
.num_pokemon = 0,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 0,
},
[BOUNTIFUL_SEA] = {
.num_pokemon = 9,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 5500,
},
[TREASURE_SEA] = {
.num_pokemon = 10,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 4500,
},
[SERENE_SEA] = {
.num_pokemon = 4,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 8000,
},
[DEEP_SEA_FLOOR] = {
.num_pokemon = 12,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 5500,
},
[DEEP_SEA_CURRENT] = {
.num_pokemon = 1,
.unlock_condition = UNLOCK_LEGENDARY_REQUEST,
.price = 0,
},
[SEAFLOOR_CAVE] = {
.num_pokemon = 1,
.unlock_condition = UNLOCK_LEGENDARY_REQUEST,
.price = 0,
},
[SHALLOW_BEACH] = {
.num_pokemon = 5,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 5000,
},
[MT_DEEPGREEN] = {
.num_pokemon = 12,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 130,
},
[MT_CLEFT] = {
.num_pokemon = 9,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 5000,
},
[MT_MOONVIEW] = {
.num_pokemon = 6,
.unlock_condition = UNLOCK_WONDER_MAIL,
.price = 0,
},
[RAINBOW_PEAK] = {
.num_pokemon = 1,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 6500,
},
[WILD_PLAINS] = {
.num_pokemon = 13,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 100,
},
[BEAU_PLAINS] = {
.num_pokemon = 12,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 600,
},
[SKY_BLUE_PLAINS] = {
.num_pokemon = 13,
.unlock_condition = UNLOCK_WONDER_MAIL,
.price = 0,
},
[SAFARI] = {
.num_pokemon = 15,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 700,
},
[SCORCHED_PLAINS] = {
.num_pokemon = 10,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 5000,
},
[SACRED_FIELD] = {
.num_pokemon = 3,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 6500
},
[MIST_RISE_FOREST] = {
.num_pokemon = 14,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 150
},
[FLYAWAY_FOREST] = {
.num_pokemon = 12,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 550
},
[OVERGROWN_FOREST] = {
.num_pokemon = 9,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 600
},
[ENERGETIC_FOREST] = {
.num_pokemon = 15,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 5000
},
[MUSHROOM_FOREST] = {
.num_pokemon = 7,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 500
},
[HEALING_FOREST] = {
.num_pokemon = 1,
.unlock_condition = UNLOCK_LEGENDARY_REQUEST,
.price = 0
},
[TRANSFORM_FOREST] = {
.num_pokemon = 6,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 500
},
[SECRETIVE_FOREST] = {
.num_pokemon = 9,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 6500
},
[RUB_A_DUB_RIVER] = {
.num_pokemon = 7,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 500
},
[TADPOLE_POND] = {
.num_pokemon = 9,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 500
},
[TURTLESHELL_POND] = {
.num_pokemon = 10,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 5500
},
[MYSTIC_LAKE] = {
.num_pokemon = 4,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 2500
},
[WATERFALL_LAKE] = {
.num_pokemon = 4,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 3500
},
[PEANUT_SWAMP] = {
.num_pokemon = 7,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 2500
},
[POISON_SWAMP] = {
.num_pokemon = 6,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 8500
},
[ECHO_CAVE] = {
.num_pokemon = 11,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 7500
},
[CRYPTIC_CAVE] = {
.num_pokemon = 1,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 6500
},
[DRAGON_CAVE] = {
.num_pokemon = 3,
.unlock_condition = UNLOCK_WONDER_MAIL,
.price = 0
},
[BOULDER_CAVE] = {
.num_pokemon = 4,
.unlock_condition = UNLOCK_WONDER_MAIL,
.price = 0
},
[JUNGLE] = {
.num_pokemon = 13,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 800
},
[DECREPIT_LAB] = {
.num_pokemon = 7,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 1000
},
[MT_DISCIPLINE] = {
.num_pokemon = 11,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 1200
},
[THUNDER_MEADOW] = {
.num_pokemon = 11,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 1000
},
[POWER_PLANT] = {
.num_pokemon = 6,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 600
},
[CRATER] = {
.num_pokemon = 7,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 7500
},
[FURNACE_DESERT] = {
.num_pokemon = 7,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 8500
},
[AGED_CHAMBER_AN] = {
.num_pokemon = 14,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 5500
},
[AGED_CHAMBER_O_EXCLAIM] = {
.num_pokemon = 14,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 5500
},
[ANCIENT_RELIC] = {
.num_pokemon = 6,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 8000
},
[DARKNESS_RIDGE] = {
.num_pokemon = 13,
.unlock_condition = UNLOCK_LEGENDARY_REQUEST,
.price = 0
},
[FRIGID_CAVERN] = {
.num_pokemon = 7,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 9000
},
[ICE_FLOE_BEACH] = {
.num_pokemon = 5,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 9500
},
[VOLCANIC_PIT] = {
.num_pokemon = 1,
.unlock_condition = UNLOCK_LEGENDARY_REQUEST,
.price = 0
},
[STRATOS_LOOKOUT] = {
.num_pokemon = 1,
.unlock_condition = UNLOCK_LEGENDARY_REQUEST,
.price = 0
},
[RAVAGED_FIELD] = {
.num_pokemon = 5,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 1000
},
[MAGNETIC_QUARRY] = {
.num_pokemon = 3,
.unlock_condition = UNLOCK_SHOP_STORY,
.price = 1000
},
[LEGENDARY_ISLAND] = {
.num_pokemon = 3,
.unlock_condition = UNLOCK_LEGENDARY_REQUEST,
.price = 7500
},
[SOUTHERN_ISLAND] = {
.num_pokemon = 2,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 9500
},
[ENCLOSED_ISLAND] = {
.num_pokemon = 1,
.unlock_condition = UNLOCK_LEGENDARY_REQUEST,
.price = 0
},
[FINAL_ISLAND] = {
.num_pokemon = 1,
.unlock_condition = UNLOCK_SHOP_POST_GAME,
.price = 8500
},
};

View File

@@ -1,37 +0,0 @@
// LUT for money item stack size -> money amount
// NDS=020C359C
const s32 gUnknown_810A3F0[100] = {
4, 6, 10, 14, 22, 26, 34, 38, 46, 58,
62, 74, 82, 86, 94, 106, 118, 122, 134, 142,
146, 158, 166, 178, 194, 202, 206, 214, 218, 226,
254, 262, 274, 278, 298, 302, 314, 326, 334, 346,
358, 362, 382, 386, 394, 398, 422, 446, 454, 458,
466, 478, 482, 502, 514, 526, 538, 542, 554, 562,
566, 586, 614, 622, 626, 634, 662, 674, 694, 698,
706, 718, 734, 746, 758, 768, 778, 794, 802, 818,
838, 842, 862, 866, 878, 886, 898, 914, 922, 926,
934, 958, 974, 982, 998, 1000, 1100, 1300, 1500, 20000};
const s16 gTypeGummiIQBoost[NUM_TYPES][NUMBER_OF_GUMMIS] =
{
[TYPE_NONE] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[TYPE_NORMAL] = {0x00, 0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x03, 0x03, 0x03},
[TYPE_FIRE] = {0x00, 0x03, 0x07, 0x04, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x03, 0x03, 0x02, 0x04, 0x03, 0x03, 0x03, 0x02},
[TYPE_WATER] = {0x00, 0x03, 0x02, 0x07, 0x04, 0x04, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02},
[TYPE_GRASS] = {0x00, 0x03, 0x04, 0x02, 0x07, 0x02, 0x04, 0x03, 0x04, 0x02, 0x04, 0x03, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03},
[TYPE_ELECTRIC] = {0x00, 0x03, 0x03, 0x03, 0x03, 0x07, 0x03, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02},
[TYPE_ICE] = {0x00, 0x03, 0x04, 0x03, 0x03, 0x03, 0x07, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x03, 0x03, 0x03, 0x04},
[TYPE_FIGHTING] = {0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x03, 0x03, 0x04, 0x04, 0x02, 0x02, 0x03, 0x03, 0x02, 0x03},
[TYPE_POISON] = {0x00, 0x03, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02, 0x07, 0x04, 0x03, 0x04, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03},
[TYPE_GROUND] = {0x00, 0x03, 0x03, 0x04, 0x04, 0x01, 0x04, 0x03, 0x02, 0x07, 0x03, 0x03, 0x03, 0x02, 0x03, 0x03, 0x03, 0x03},
[TYPE_FLYING] = {0x00, 0x03, 0x03, 0x03, 0x02, 0x04, 0x04, 0x02, 0x03, 0x01, 0x07, 0x03, 0x02, 0x04, 0x03, 0x03, 0x03, 0x03},
[TYPE_PSYCHIC] = {0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x03, 0x03, 0x03, 0x07, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03},
[TYPE_BUG] = {0x00, 0x03, 0x04, 0x03, 0x02, 0x03, 0x03, 0x02, 0x03, 0x02, 0x04, 0x03, 0x07, 0x04, 0x03, 0x03, 0x03, 0x03},
[TYPE_ROCK] = {0x00, 0x02, 0x02, 0x04, 0x04, 0x03, 0x03, 0x04, 0x02, 0x04, 0x02, 0x03, 0x03, 0x07, 0x03, 0x03, 0x03, 0x04},
[TYPE_GHOST] = {0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x07, 0x03, 0x04, 0x03},
[TYPE_DRAGON] = {0x00, 0x03, 0x02, 0x02, 0x02, 0x02, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x03, 0x03},
[TYPE_DARK] = {0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x03, 0x03, 0x03, 0x01, 0x04, 0x03, 0x02, 0x03, 0x07, 0x03},
[TYPE_STEEL] = {0x00, 0x02, 0x04, 0x03, 0x02, 0x03, 0x02, 0x04, 0x01, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x07},
};

View File

@@ -1,97 +0,0 @@
const u8 gInvalidDungeonIDs[11] =
{
DUNGEON_BOSS_3,
DUNGEON_BOSS_4,
DUNGEON_BOSS_9,
DUNGEON_WONDROUS_SEA,
DUNGEON_AUTOPILOT,
DUNGEON_D50,
DUNGEON_D51,
DUNGEON_D54,
DUNGEON_POISON_MAZE,
DUNGEON_D61,
DUNGEON_OUT_ON_RESCUE
};
// NDS=020C3448
const u8 gInvalidItemIDs[0x10] =
{
ITEM_G_MACHINE_6,
ITEM_G_MACHINE_7,
ITEM_G_MACHINE_8,
ITEM_TM_SPIN_SLASH,
ITEM_SWITCH_BOX,
ITEM_ALERT_SPECS,
ITEM_POSSESS_ORB,
ITEM_REVIVER_ORB,
ITEM_TM_EXCAVATE,
ITEM_TOSS_ORB,
ITEM_RING_D,
ITEM_RING_E,
ITEM_RING_F,
ITEM_OBSERVER_ORB,
ITEM_BEATUP_ORB,
NUMBER_OF_ITEM_IDS
};
const bool8 gTacticsTargetLeader[NUM_TACTICS] =
{
[TACTIC_LETS_GO_TOGETHER] = TRUE,
[TACTIC_GO_THE_OTHER_WAY] = FALSE,
[TACTIC_GO_AFTER_FOES] = FALSE,
[TACTIC_AVOID_THE_FIRST_HIT] = FALSE,
[TACTIC_ALL_FOR_ONE] = TRUE,
[TACTIC_GROUP_SAFETY] = TRUE,
[TACTIC_AVOID_TROUBLE] = TRUE,
[TACTIC_BE_PATIENT] = TRUE,
[TACTIC_KEEP_YOUR_DISTANCE] = TRUE,
[TACTIC_WAIT_THERE] = FALSE,
[TACTIC_GET_AWAY] = TRUE,
[TACTIC_UNUSED] = FALSE
};
const s16 gReqTacticLvls[NUM_TACTICS] =
{
[TACTIC_LETS_GO_TOGETHER] = 1,
[TACTIC_GO_THE_OTHER_WAY] = 25,
[TACTIC_GO_AFTER_FOES] = 1,
[TACTIC_AVOID_THE_FIRST_HIT] = 1,
[TACTIC_ALL_FOR_ONE] = 999,
[TACTIC_GROUP_SAFETY] = 999,
[TACTIC_AVOID_TROUBLE] = 35,
[TACTIC_BE_PATIENT] = 40,
[TACTIC_KEEP_YOUR_DISTANCE] = 20,
[TACTIC_WAIT_THERE] = 15,
[TACTIC_GET_AWAY] = 10,
[TACTIC_UNUSED] = 999,
};
const s32 gReqIQSkillPts[NUM_IQ_SKILLS] =
{
[IQ_NONE] = 9999,
[IQ_TYPE_ADVANTAGE_MASTER] = 105,
[IQ_ITEM_CATCHER] = 1,
[IQ_COURSE_CHECKER] = 1,
[IQ_SURE_HIT_ATTACKER] = 500,
[IQ_QUICK_DODGER] = 100,
[IQ_PP_CHECKER] = 2,
[IQ_NONTRAITOR] = 40,
[IQ_STATUS_CHECKER] = 25,
[IQ_EXP_GO_GETTER] = 200,
[IQ_EFFICIENCY_EXPERT] = 10,
[IQ_WEAK_TYPE_PICKER] = 125,
[IQ_ALL_TERRAIN_HIKER] = 400,
[IQ_SUPER_MOBILE] = 990,
[IQ_TRAP_AVOIDER] = 140,
[IQ_HOUSE_AVOIDER] = 800,
[IQ_ENERGY_SAVER] = 250,
[IQ_NONSLEEPER] = 160,
[IQ_SELF_CURER] = 70,
[IQ_TRAP_SEER] = 600,
[IQ_LAVA_EVADER] = 300,
[IQ_DEDICATED_TRAVELER] = 1,
[IQ_ITEM_MASTER] = 1,
[IQ_EXCLUSIVE_MOVE_USER] = 1,
};

78
src/drought_orb.c Normal file
View File

@@ -0,0 +1,78 @@
#include "global.h"
#include "globaldata.h"
#include "constants/ability.h"
#include "constants/weather.h"
#include "code_803E46C.h"
#include "dungeon_message.h"
#include "code_806CD90.h"
#include "code_807CD9C.h"
#include "structs/str_dungeon.h"
#include "code_8077274_1.h"
#include "dungeon_ai.h"
#include "run_dungeon.h"
#include "dungeon_generation.h"
#include "dungeon_logic.h"
#include "dungeon_map.h"
#include "dungeon_map_access.h"
#include "dungeon_util.h"
#include "math.h"
#include "move_effects_target.h"
#include "moves.h"
#include "move_util.h"
#include "code_8041AD0.h"
#include "code_803E668.h"
#include "weather.h"
#include "dungeon_config.h"
#include "dungeon_misc.h"
#include "dungeon_items.h"
#include "dungeon_strings.h"
void HandleDroughtOrbAction(Entity *pokemon, Entity *target)
{
s32 x;
s32 y;
Tile *tile;
bool8 flag;
flag = FALSE;
if(IsCurrentFixedRoomBossFight())
{
LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FD060);
return;
}
if(IsWaterTileset())
{
LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FD08C);
return;
}
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
tile = GetTileMut(x, y);
if(GetTerrainType(tile) == TERRAIN_TYPE_SECONDARY)
{
SetTerrainNormal(tile);
sub_80498A8(x, y);
flag = TRUE;
}
}
for (y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
sub_8049BB0(x, y);
if(flag)
{
sub_80421C0(pokemon, 0x1A1);
LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FD05C);
}
else
{
LogMessageByIdWithPopupCheckUser(pokemon, gUnknown_80FD060);
}
gDungeon->unk644.unk2C = 1;
sub_806CF60();
ShowWholeRevealedDungeonMap();
sub_8049ED4();
}

View File

@@ -12,11 +12,11 @@
#include "random.h"
#include "string_format.h"
#include "strings.h"
#include "dungeon_data.h"
extern const char gUnknown_8108F10[];
extern const char gUnknown_8108F18[];
extern const char gUnknown_8108F2C[];
extern u8 gInvalidDungeonIDs[];
extern u8 gDungeonFloorCount[];
extern const u8 *const gUnknown_8108084[];
extern DungeonLocation gUnknown_8107828[];

580
src/dungeon_8067A80.c Normal file
View File

@@ -0,0 +1,580 @@
#include "global.h"
#include "globaldata.h"
#include "constants/dungeon.h"
#include "constants/item.h"
#include "constants/move_id.h"
#include "code_803E46C.h"
#include "code_803E724.h"
#include "code_8041AD0.h"
#include "code_8044CC8.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"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_misc.h"
#include "dungeon_move.h"
#include "dungeon_move_util.h"
#include "dungeon_logic.h"
#include "dungeon_music.h"
#include "dungeon_random.h"
#include "dungeon_strings.h"
#include "dungeon_util.h"
#include "friend_area.h"
#include "input.h"
#include "items.h"
#include "menu_input.h"
#include "moves.h"
#include "pokemon.h"
#include "pokemon_3.h"
#include "position_util.h"
#include "sprite.h"
#include "string_format.h"
#include "text_1.h"
#include "trap.h"
extern void sub_80684C4(void);
void sub_8045064(void);
extern void sub_8068344(void);
bool8 CanSubMenuItemBeChosen(s32 param_1);
void sub_8068310(s32 n, PokemonStruct1 **monPtrs);
void sub_8067F00(u8 a0, PokemonStruct1 **a1, s32 a2, s32 a3, s32 a4);
extern void DungeonShowWindows(WindowTemplates *a0, u8 a1);
u32 sub_8014140(s32 a0, const void *a1);
void sub_8083D1C(void);
void PlayDungeonConfirmationSE(void);
void PlayDungeonCancelSE(void);
void sub_806806C(PokemonStruct1 *a0);
void CreateDungeonMenuSubWindow(WindowTemplates *a0, s32 a1);
extern const s32 gUnknown_8106E80[];
extern MenuInputStruct gDungeonMenu;
extern u32 gDungeonFramesCounter;
extern s32 gDungeonSubMenuItemsCount;
static EWRAM_DATA WindowHeader gUnknown_202F308 = {0};
static EWRAM_DATA s32 gUnknown_202F30C = 0;
static EWRAM_DATA s32 gUnknown_202F310 = 0;
// It's likely a struct only used in Blue version. Touchpad maybe?
static const u8 gUnknown_8106DA4[] = {
0x01, 0, 0x38, 0, 0, 0, 0x18, 0, 0x18, 0, 0, 0, 0x02, 0, 0x38, 0, 0x68, 0, 0x18, 0, 0x18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
static const WindowTemplates gUnknown_8106DC8 = {
.id = {
[0] =
{
.unk0 = 0,
.type = WINDOW_TYPE_WITH_HEADER,
.pos = {0x02, 0x02},
.width = 0x11,
.height = 0x0E,
.unk10 = 0x12,
.unk12 = 0x02,
.header = &gUnknown_202F308
},
[1] =
{
.unk0 = 0,
.type = WINDOW_TYPE_NORMAL,
.pos = {0x15, 0x04},
.width = 0x07,
.height = 0x04,
.unk10 = 0x04,
.unk12 = 0,
.header = NULL
},
[2] = WIN_TEMPLATE_DUMMY,
[3] = WIN_TEMPLATE_DUMMY,
}
};
void sub_8067A80(u8 a0, s32 a1, s32 a2, PokemonStruct1 **a3)
{
s32 i;
s32 r10;
WindowTemplates spTxtStruct = gUnknown_8106DC8;
gUnknown_202F30C = 0;
r10 = 0;
for (i = 0; i < a2; i++) {
a3[i]->unk0 &= ~(0x8000);
}
while (1) {
sub_8068310(a2, a3);
if (gUnknown_202F310 >= a1)
break;
while (1) {
s32 r7 = 0, r5 = 0;
gUnknown_202F308.count = 1;
gUnknown_202F308.currId = 0;
gUnknown_202F308.width = 0xE;
gUnknown_202F308.f3 = 0;
ASM_MATCH_TRICK(r7);
DungeonShowWindows(&spTxtStruct, 1);
sub_8067F00(a0, a3, gUnknown_202F30C, a2, a1);
gDungeonMenu.unk1A = min(a2, 8);
gDungeonMenu.menuIndex = r10;
gDungeonMenu.unk1C = 8;
gDungeonMenu.unk1E = 0;
gDungeonMenu.unk20 = 0;
gDungeonMenu.unk4 = 0;
gDungeonMenu.firstEntryY = 18;
gDungeonMenu.unkC = 0;
gDungeonMenu.unkE = 0;
gDungeonMenu.unk14.x = 0;
gDungeonMenu.unk0 = 0;
sub_801317C(&gDungeonMenu.unk28);
sub_80137B0(&gDungeonMenu, 0);
while (1) {
s32 r4;
AddMenuCursorSprite(&gDungeonMenu);
r5 = 0;
r7 = 0;
if (a2 - gUnknown_202F30C > 8) {
r5 = 1;
sub_80684C4();
}
if (gUnknown_202F30C != 0) {
r7 = 1;
sub_8068344();
}
r4 = sub_8014140(0, gUnknown_8106DA4);
DungeonRunFrameActions(0x37);
if (r4 == 2 && r5) {
if (a2 - gUnknown_202F30C > 8) {
s32 i;
for (i = 0; i < 6; i++) {
ScrollDownWindowFunc(0);
DungeonRunFrameActions(0x37);
}
gUnknown_202F30C++;
}
r7 = 0;
r10 = 7;
break;
}
if (gRealInputs.repeated & DPAD_DOWN) {
PlayDungeonCursorSE(1);
if (gDungeonMenu.menuIndex == 7) {
if (a2 - gUnknown_202F30C > 8) {
s32 i;
for (i = 0; i < 6; i++) {
ScrollDownWindowFunc(0);
DungeonRunFrameActions(0x37);
}
gUnknown_202F30C++;
}
r7 = 0;
r10 = 7;
break;
}
MoveMenuCursorDownWrapAround(&gDungeonMenu, 0);
}
if (r4 == 1 && r7 != 0) {
if (gUnknown_202F30C != 0) {
s32 i;
for (i = 0; i < 6; i++) {
ScrollUpWindowFunc(0);
DungeonRunFrameActions(0x37);
}
gUnknown_202F30C--;
}
r7 = 0;
r10 = 0;
break;
}
if (gRealInputs.repeated & DPAD_UP) {
PlayDungeonCursorSE(1);
if (gDungeonMenu.menuIndex == 0) {
if (gUnknown_202F30C != 0) {
s32 i;
for (i = 0; i < 6; i++) {
ScrollUpWindowFunc(0);
DungeonRunFrameActions(0x37);
}
gUnknown_202F30C--;
}
r7 = 0;
r10 = 0;
break;
}
MoveMenuCursorUpWrapAround(&gDungeonMenu, 0);
}
if (sub_80048C8()) {
continue;
}
if (gRealInputs.pressed & START_BUTTON) {
sub_8083D1C();
r7 = 3;
break;
}
if ((gRealInputs.pressed & A_BUTTON) || gDungeonMenu.unk28.a_button) {
PlayDungeonConfirmationSE();
r7 = 1;
break;
}
if ((gRealInputs.pressed & B_BUTTON) || gDungeonMenu.unk28.b_button) {
PlayDungeonCancelSE();
r7 = 2;
break;
}
}
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x37);
if (r7 == 0) {
continue;
}
else if (r7 == 2) {
r10 = gDungeonMenu.menuIndex;
if (gUnknown_202F310 < a1) {
continue;
}
if (DisplayDungeonYesNoMessage(NULL, gUnknown_80FDFB8, TRUE) == 1) {
break;
}
else {
continue;
}
}
else if (r7 == 3) {
r10 = gDungeonMenu.menuIndex;
sub_806806C(a3[gUnknown_202F30C + r10]);
continue;
}
else {
s32 arrId;
u8 locIdIsPartner;
r10 = gDungeonMenu.menuIndex;
arrId = gUnknown_202F30C + r10;
gDungeonSubMenuItemsCount = 0;
AddActionToDungeonSubMenu(0x29, 0);
AddActionToDungeonSubMenu(0x2A, 0);
AddActionToDungeonSubMenu(0x40, 0);
if (a3[arrId]->unk0 & 0x8000) {
SetActionUnusableInDungeonSubMenu(0x29);
}
else {
SetActionUnusableInDungeonSubMenu(0x2A);
}
// This unnecessary variable is required to match.
locIdIsPartner = DUNGEON_JOIN_LOCATION_PARTNER;
if (a3[arrId]->isTeamLeader || (a3[arrId]->dungeonLocation.id == DUNGEON_JOIN_LOCATION_LEADER || a3[arrId]->dungeonLocation.id == locIdIsPartner)) {
SetActionUnusableInDungeonSubMenu(0x29);
}
sub_8045064();
CreateDungeonMenuSubWindow(&spTxtStruct, 0x15);
while (1) {
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x37);
if (gRealInputs.repeated & DPAD_DOWN) {
PlayDungeonCursorSE(1);
MoveMenuCursorDownWrapAround(&gDungeonMenu, 1);
}
if (gRealInputs.repeated & DPAD_UP) {
PlayDungeonCursorSE(1);
MoveMenuCursorUpWrapAround(&gDungeonMenu, 1);
}
if ((gRealInputs.pressed & A_BUTTON) || gDungeonMenu.unk28.a_button) {
if (CanSubMenuItemBeChosen(gDungeonMenu.menuIndex)) {
PlayDungeonConfirmationSE();
r7 = 1;
break;
}
PlayDungeonCancelSE();
}
if ((gRealInputs.pressed & B_BUTTON) || gDungeonMenu.unk28.b_button) {
PlayDungeonCancelSE();
r7 = 0;
break;
}
}
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x37);
if (r7 != 0) {
if (gDungeonMenu.menuIndex == 0) {
a3[arrId]->unk0 |= 0x8000;
sub_8068310(a2, a3);
}
else if (gDungeonMenu.menuIndex == 1) {
a3[arrId]->unk0 &= ~(0x8000);
sub_8068310(a2, a3);
}
else {
sub_806806C(a3[arrId]);
}
}
continue;
}
}
}
}
void sub_8067F00(u8 a0, PokemonStruct1 **a1, s32 a2_, s32 a3, s32 a4)
{
s32 i, y;
s32 a2;
a2 = a2_ - 1;
y = 0x16;
sub_80073B8(0);
WriteFriendAreaName(gFormatBuffer_Monsters[0], a0, FALSE);
PrintFormattedStringOnWindow(12, 0, _("{POKEMON_0}"), 0, '\0');
i = 0;
while (i < 10) {
if (a2 >= 0) {
if (a2 >= a3) {
break;
}
PrintColoredPokeNameToBuffer(gFormatBuffer_Monsters[0], a1[a2], 0);
sub_808D930(gFormatBuffer_Monsters[1], a1[a2]->speciesNum);
gFormatArgs[0] = a2 + 1;
if (a1[a2]->unk0 & 0x8000) {
InlineStrcpy(gFormatBuffer_Items[0], _("{STAR_BULLET}"));
}
else {
InlineStrcpy(gFormatBuffer_Items[0], _("{ICON_BLANK}"));
}
if (a1[a2]->unk0 & 0x4000) {
PrintFormattedStringOnWindow(7, y, _("{MOVE_ITEM_0}{color CYAN}$v02:{POKEMON_0}{reset}"), 0, '\0');
}
else {
PrintFormattedStringOnWindow(7, y, _("{MOVE_ITEM_0}{color YELLOW}$v02:{POKEMON_0}{reset}"), 0, '\0');
}
}
i++;
y += 12;
a2++;
}
sub_80073E0(0);
sub_80073B8(1);
if (gUnknown_202F310 >= a4) {
PrintFormattedStringOnWindow(8, 2, _("Press {B_BUTTON}\nif OK."), 1, '\0');
}
else {
gFormatArgs[0] = a4 - gUnknown_202F310;
PrintFormattedStringOnWindow(8, 2, _("Say bye to\n{VALUE_0} more"), 1, '\0');
}
sub_80073E0(1);
}
void sub_806806C(PokemonStruct1 *a0)
{
struct unkStruct_808FF20 unkStruct;
struct UnkInfoTabStruct var_C8;
WindowTemplates spTxtStruct = {0};
s32 r7;
spTxtStruct.id[0].type = WINDOW_TYPE_WITH_HEADER;
spTxtStruct.id[0].pos.x = 2;
spTxtStruct.id[0].pos.y = 2;
spTxtStruct.id[0].width = 0x12;
spTxtStruct.id[0].height = 0xE;
spTxtStruct.id[0].unk10 = 0x12;
spTxtStruct.id[0].unk12 = 2;
spTxtStruct.id[0].header = &gUnknown_202F308;
spTxtStruct.id[1].type = WINDOW_TYPE_NORMAL;
spTxtStruct.id[2].type = WINDOW_TYPE_NORMAL;
spTxtStruct.id[3].type = WINDOW_TYPE_NORMAL;
r7 = 0;
unkStruct.unk40 = 0;
unkStruct.unk56 = 0;
gDungeonMenu.menuIndex = 0;
while (1) {
bool32 loopBreak = FALSE;
s32 spF8[4] = {2, 3, 4, 5};
gUnknown_202F308.count = 4;
gUnknown_202F308.currId = r7;
gUnknown_202F308.width = 10;
gUnknown_202F308.f3 = 0;
gDungeonMenu.unk1E = r7;
gDungeonMenu.unk20 = 4;
gDungeonMenu.unk1A = 0;
gDungeonMenu.menuIndex = 0;
gDungeonMenu.unk1C = 0;
gDungeonMenu.unk4 = 0;
gDungeonMenu.firstEntryY = 16;
gDungeonMenu.unk14.x = 0;
gDungeonMenu.unk0 = 0;
sub_801317C(&gDungeonMenu.unk28);
DungeonShowWindows(&spTxtStruct, 1);
sub_808FF20(&unkStruct, a0, gDungeon->unk644.unk16);
CreatePokemonInfoTabScreen(spF8[r7], r7, &unkStruct, &var_C8, 0);
gDungeonMenu.unkC = (gWindows[0].x + 15) * 8;
gDungeonMenu.unkE = ((gWindows[0].y + 1) * 8) - 2;
while (1) {
s32 r5;
AddMenuCursorSprite(&gDungeonMenu);
if (spF8[r7] == 4) {
if (var_C8.unk0[8] != 0) {
sub_80684C4();
}
if (unkStruct.unk40 != 0) {
sub_8068344();
}
}
r5 = sub_8014140(0, gUnknown_8106DA4);
DungeonRunFrameActions(0x1C);
if ((gRealInputs.pressed & DPAD_RIGHT) || gDungeonMenu.unk28.dpad_right) {
PlayDungeonCursorSE(0);
if (++r7 == 4) {
r7 = 0;
}
break;
}
if ((gRealInputs.pressed & DPAD_LEFT) || gDungeonMenu.unk28.dpad_left) {
PlayDungeonCursorSE(0);
if (--r7 == -1) {
r7 = 3;
}
break;
}
if (spF8[r7] == 4) {
if (((gRealInputs.repeated & DPAD_DOWN) || r5 == 2) && var_C8.unk0[8] != 0) {
s32 i;
PlayDungeonCursorSE(0);
for (i = 0; i < 6; i++) {
ScrollDownWindowFunc(0);
DungeonRunFrameActions(0x1C);
}
unkStruct.unk40++;
break;
}
if (((gRealInputs.repeated & DPAD_UP) || r5 == 1) && unkStruct.unk40 != 0) {
s32 i;
PlayDungeonCursorSE(0);
for (i = 0; i < 6; i++) {
ScrollUpWindowFunc(0);
DungeonRunFrameActions(0x1C);
}
unkStruct.unk40--;
break;
}
}
if (sub_80048C8()) {
continue;
}
if ((gRealInputs.pressed & A_BUTTON) || gDungeonMenu.unk28.a_button) {
PlayDungeonConfirmationSE();
loopBreak = TRUE;
break;
}
if ((gRealInputs.pressed & B_BUTTON) || gDungeonMenu.unk28.b_button) {
PlayDungeonCancelSE();
loopBreak = TRUE;
break;
}
}
DungeonRunFrameActions(0x37);
if (loopBreak) {
break;
}
}
sub_803EAF0(0, NULL);
}
void sub_8068310(s32 n, PokemonStruct1 **monPtrs)
{
s32 i;
s32 counter = 0;
for (i = 0; i < n; i++) {
if ((monPtrs[i]->unk0 & 0x8000) != 0) {
counter++;
}
}
gUnknown_202F310 = counter;
}
void sub_8068344(void)
{
if ((gDungeonFramesCounter & 8) != 0) {
Window *window = &gWindows[0];
SpriteOAM sprite = {0};
SpriteSetAffine1(&sprite, 0);
SpriteSetAffine2(&sprite, 0);
SpriteSetObjMode(&sprite, 0);
SpriteSetMosaic(&sprite, 0);
SpriteSetBpp(&sprite, 0);
SpriteSetShape(&sprite, 1);
SpriteSetMatrixNum(&sprite, 16);
SpriteSetSize(&sprite, 0);
SpriteSetTileNum(&sprite, 0x3F0);
SpriteSetPriority(&sprite, 0);
SpriteSetPalNum(&sprite, 15);
SpriteSetY(&sprite, (window->y * 8) + 0x8);
SpriteSetX(&sprite, (window->x * 8) + 0x40);
AddSprite(&sprite,0x100,NULL,NULL);
}
}
// The same as sub_80623B0
void sub_80684C4(void)
{
if ((gDungeonFramesCounter & 8) != 0) {
Window *window = &gWindows[0];
SpriteOAM sprite = {0};
SpriteSetAffine1(&sprite, 0);
SpriteSetAffine2(&sprite, 0);
SpriteSetObjMode(&sprite, 0);
SpriteSetMosaic(&sprite, 0);
SpriteSetBpp(&sprite, 0);
SpriteSetShape(&sprite, 1);
SpriteSetMatrixNum(&sprite, 0);
SpriteSetSize(&sprite, 0);
SpriteSetTileNum(&sprite, 0x3F0);
SpriteSetPriority(&sprite, 0);
SpriteSetPalNum(&sprite, 15);
SpriteSetY(&sprite, (window->y * 8) + 0x70);
SpriteSetX(&sprite, (window->x * 8) + 0x40);
AddSprite(&sprite,0x100,NULL,NULL);
}
}

122
src/dungeon_8071B48.c Normal file
View File

@@ -0,0 +1,122 @@
#include "global.h"
#include "globaldata.h"
#include "constants/tactic.h"
#include "dungeon_config.h"
#include "dungeon_leader.h"
#include "dungeon_message.h"
#include "code_8041AD0.h"
#include "code_8077274_1.h"
#include "constants/dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon.h"
#include "pokemon_3.h"
#include "code_805D8C8.h"
#include "structs/str_806B7F8.h"
#include "dungeon_logic.h"
extern u8 *gUnknown_80FED68[];
extern void sub_8042920(struct Entity *r0);
extern s16 sub_803D970(u32);
extern s32 sub_803DA20(s32 param_1);
extern bool8 sub_806AA0C(s32, u32);
extern bool8 sub_8083660(DungeonPos *param_1);
void sub_8071B48(void)
{
const Tile *tile;
struct Entity *entity2;
struct Entity *entity;
int index;
int index1;
int counter;
struct Entity *entityPtr;
s32 level;
struct Dungeon *dungeon; // feels like a hack
struct unkStruct_806B7F8 local_2c;
entityPtr = NULL;
dungeon = gDungeon;
if ((dungeon->unk644.unk20 != 0) &&
((dungeon->unk644.dungeonLocation.id != DUNGEON_METEOR_CAVE || (dungeon->unk37FD == 0)))) {
dungeon->unk644.unk1E++;
if (dungeon->unk644.unk2A == 0) {
if ( dungeon->unk644.unk1E < gUnknown_80F4DAA) {
return;
}
}
else {
if ( dungeon->unk644.unk1E < gUnknown_80F4DAC) {
return;
}
}
if (dungeon->unk644.unk1E > 900) {
entity2 = dungeon->unk17B34;
if ((EntityIsValid(entity2)) && (entity2->spawnGenID == dungeon->unk17B40)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity2,0);
entityPtr = entity2;
}
}
dungeon->unk644.unk1E = 0;
dungeon->unk17B34 = NULL;
counter = 0;
for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++)
{
entity = dungeon->wildPokemon[index];
if ((EntityIsValid(entity)) &&
(tile = GetTile((entity->pos).x, (entity->pos).y),
(tile->terrainType & TERRAIN_TYPE_UNBREAKABLE) == 0)) {
counter++;
}
}
if (dungeon->unk644.unk2A == 0) {
if (gDungeon->monsterHouseRoom == CORRIDOR_ROOM) {
if (counter >= gUnknown_80F4DA6) {
return;
}
}
else
{
if (counter >= gUnknown_80F4DA8) {
return;
}
}
}
if (entityPtr != NULL) {
DisplayDungeonLoggableMessageTrue(0,*gUnknown_80FED68);
sub_8042920(entityPtr);
}
if (dungeon->unk644.unk2A != 0) {
index1 = 0x17c;
}
else {
index1 = sub_803D970(0);
}
level = sub_803DA20(index1);
if (level == 0) {
level = 1;
}
if ((sub_806AA0C(index1, 0)) && (sub_8083660(&local_2c.pos))) {
local_2c.species = index1;
local_2c.level = level;
local_2c.unk2 = 0;
if(DungeonRandInt(100) < GetRandomMovementChance(gDungeon->unk644.dungeonLocation.id))
{
local_2c.unk4 = 1;
}
else
{
local_2c.unk4 = 0;
}
local_2c.unk10 = 0;
sub_806B7F8(&local_2c, FALSE);
}
}
}

505
src/dungeon_8072CF4.c Normal file
View File

@@ -0,0 +1,505 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_ai_leader.h"
#include "dungeon_move_util.h"
#include "code_803E46C.h"
#include "code_8041AD0.h"
#include "code_804267C.h"
#include "code_8066D04.h"
#include "dungeon_message.h"
#include "code_8077274_1.h"
#include "code_807CD9C.h"
#include "constants/dungeon_action.h"
#include "constants/dungeon.h"
#include "constants/iq_skill.h"
#include "constants/item.h"
#include "constants/move_id.h"
#include "constants/status.h"
#include "constants/targeting.h"
#include "dungeon_logic.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "move_util.h"
#include "moves.h"
#include "pokemon_3.h"
#include "pokemon.h"
#include "status.h"
#include "trap.h"
#include "dungeon_config.h"
#include "dungeon_misc.h"
extern u8 gUnknown_202F221;
extern u8 gUnknown_202F222;
extern u8 gUnknown_202F32C;
extern u8 gUnknown_202F32D;
extern u8 gUnknown_203B434;
extern u8 *gUnknown_80FA5B4[];
extern u8 *gUnknown_80FCF50[];
extern u8 *gUnknown_80FCF38[];
extern u8 *gUnknown_80FD2CC[];
extern u8 *gUnknown_80FE478[];
extern u8 *gUnknown_80FE6D4[];
void sub_8075BA4(Entity *param_1, u8 param_2);
void sub_804178C(u8 param_1);
void nullsub_95(Entity *);
bool8 IsNotAttacking(Entity *, bool8);
extern void sub_80671A0(Entity *);
extern void sub_8067110(Entity *);
void HandleUseMoveAIAction(Entity *target);
void sub_8041888(u8 param_1);
void sub_8085140(void);
void sub_807360C(void);
void sub_805EFB4(Entity *, u8);
void sub_8074FB0(Entity *, u8, DungeonPos *);
void HandlePlaceItemAction(Entity *);
void HandlePickUpPlayerAction(Entity *);
void sub_8066E14(Entity * );
void sub_807348C(void);
void sub_80732F0(void);
void sub_8066BD4(Entity*);
void HandleTalkFieldAction(Entity *);
void HandleUseMovePlayerAction(Entity *);
void HandleUseOrbAction(Entity *);
void sub_8067904(Entity *, u32);
void HandleGiveItemAction(Entity *);
void HandleTakeItemAction(Entity *);
void HandleUseItemAction(Entity *);
void sub_8066FA4(Entity *);
void HandleUnsetItemAction(Entity *,bool8);
extern u8 sub_8044B28(void);
extern u8 UseAttack(Entity *);
void sub_806A1E8(Entity *pokemon);
bool8 sub_804AE08(DungeonPos *pos);
void HandlePickUpAIAction(Entity *pokemon);
void HandleThrowItemAIAction(Entity *pokemon);
void HandleEatAIAction(Entity *pokemon);
bool8 sub_8044B84(void);
extern void sub_8074094(Entity *);
extern void sub_8071DA4(Entity *);
u32 sub_8075818(Entity *entity);
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);
bool8 sub_8072CF4(Entity *entity)
{
bool8 bVar4;
bool8 bVar5;
Move *move;
s32 index;
EntityInfo *info;
bool8 bVar14;
DungeonPos pos;
DungeonPos pos1;
sub_804178C(1);
gUnknown_203B434 = 1;
info = GetEntInfo(entity);
info->useHeldItem = FALSE;
info->unkF3 = FALSE;
gDungeon->unkB8 = entity;
if (gUnknown_80F58F4[(info->action).action][0] != 0) {
if (info->isTeamLeader) {
sub_805EFB4(entity,gUnknown_80F58F4[(info->action).action][1]);
}
else {
sub_8075BA4(entity,gUnknown_80F58F4[(info->action).action][1]);
}
}
if ((CannotAttack(entity, FALSE)) && (IsChargingAnyTwoTurnMove(entity, TRUE))) {
sub_8079764(entity);
}
for(index = 0; index < MAX_MON_MOVES; index++)
{
move = &info->moves.moves[index];
if ((move->moveFlags & MOVE_FLAG_EXISTS)) {
move->moveFlags2 &= ~(MOVE_FLAG2_UNK4);
}
}
if (!IsNotAttacking(entity, FALSE)) {
if (UseAttack(entity)) {
if (sub_8044B28()) {
return FALSE;
}
if (!EntityIsValid(entity)) {
return FALSE;
}
if (gUnknown_202F32D != 0) {
return TRUE;
}
}
if (!info->isTeamLeader) {
sub_8052740(10);
}
sub_806A1E8(entity);
DungeonRunFrameActions(10);
}
if (((ACTION_PASS_TURN < info->action.action) && (info->action.action != 4)) && (info->action.action != ACTION_WALK)) {
info->attacking = TRUE;
}
bVar14 = FALSE;
info->unk14A = 0;
gUnknown_202F221 = 0;
gUnknown_202F222 = 0;
switch(info->action.action) {
case ACTION_WALK:
if(info->frozenClassStatus.status == STATUS_SHADOW_HOLD)
{
goto _282;
}
else if(info->frozenClassStatus.status == STATUS_CONSTRICTION)
{
goto _282;
}
else if(info->frozenClassStatus.status == STATUS_INGRAIN)
{
goto _282;
}
else if(info->frozenClassStatus.status == STATUS_WRAP)
{
goto _282;
}
else if(info->frozenClassStatus.status == STATUS_WRAPPED)
{
_282:
info->action.action = ACTION_NOTHING;
info->waiting = TRUE;
}
else {
bVar5 = FALSE;
pos1.x = (entity->pos).x + gAdjacentTileOffsets[(info->action).direction].x;
pos1.y = (entity->pos).y + gAdjacentTileOffsets[(info->action).direction].y;
if ((!(info->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY)) &&
(!CanMoveInDirection(entity,(info->action).direction))) {
bVar5 = TRUE;
}
if (bVar5) {
info->action.action = ACTION_NOTHING;
info->waiting = TRUE;
break;
}
else
{
pos.x = entity->pos.x;
pos.y = entity->pos.y;
sub_80694C0(entity,pos1.x,pos1.y,0);
sub_8074FB0(entity,(info->action).direction,&pos);
if (((IQSkillIsEnabled(entity, IQ_SUPER_MOBILE)) && (info->invisibleClassStatus.status != STATUS_MOBILE)) &&
(!HasHeldItem(entity,ITEM_MOBILE_SCARF))) {
sub_804AE08(&entity->pos);
}
bVar14 = TRUE;
break;
}
}
break;
case ACTION_USE_MOVE_AI:
HandleUseMoveAIAction(entity);
break;
case ACTION_STAIRS:
if ((gDungeon->unk644.dungeonLocation.id == DUNGEON_METEOR_CAVE) && (!gDungeon->deoxysDefeat)) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FA5B4); // It's impossible to go down the stairs now!
}
else
{
PlayStairsSound();
gDungeon->unk2 = 1;
gUnknown_202F32C = (info->action).direction;
}
break;
case ACTION_EAT_BERRY_SEED_DRINK:
case 0xe:
case ACTION_USE_TM:
sub_8067110(entity);
break;
case ACTION_USE_ORB:
HandleUseOrbAction(entity);
break;
case ACTION_PICK_UP_PLAYER:
HandlePickUpPlayerAction(entity);
break;
case ACTION_GIVE_ITEM:
HandleGiveItemAction(entity);
break;
case ACTION_TAKE_ITEM:
HandleTakeItemAction(entity);
break;
case 0x3e:
sub_8066BD4(entity); // ITEM_SWITCH_TOOLBOX (When you switch item in Toolbox)
break;
case ACTION_USE_ITEM:
HandleUseItemAction(entity);
break;
case ACTION_SET_ITEM:
HandleSetItemAction(entity, TRUE);
break;
case ACTION_UNSET_ITEM:
HandleUnsetItemAction(entity, TRUE);
break;
case 0x3b:
gDungeon->unkBC = gDungeon->teamPokemon[(info->action).actionParameters[0].actionUseIndex];
break;
case ACTION_PLACE_ITEM:
HandlePlaceItemAction(entity);
break;
case 10: // Switch with Item on Ground
sub_8066E14(entity);
break;
case 0x3a: // Switch with Item on Ground (also??)
sub_8066FA4(entity);
break;
case ACTION_THROW_ITEM_PLAYER:
case ACTION_THROW_STRAIGHT_PLAYER:
case ACTION_THROW_ARC_PLAYER:
if (MonsterCanThrowItems(info)) {
nullsub_95(entity);
sub_80671A0(entity);
break;
}
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE6D4);
break;
case ACTION_TALK_FIELD:
HandleTalkFieldAction(entity);
break;
case ACTION_USE_MOVE_PLAYER:
HandleUseMovePlayerAction(entity);
break;
case ACTION_STRUGGLE:
sub_8067904(entity, MOVE_STRUGGLE);
break;
case ACTION_REGULAR_ATTACK:
sub_8067904(entity, MOVE_REGULAR_ATTACK);
break;
case ACTION_STEPPED_ON_TRAP:
HandleTrap(entity,&entity->pos,0,0);
break;
case ACTION_PICK_UP_AI:
HandlePickUpAIAction(entity);
break;
case ACTION_EAT_AI:
HandleEatAIAction(entity);
break;
case ACTION_THROW_ITEM_AI:
HandleThrowItemAIAction(entity);
break;
case ACTION_SECOND_THOUGHTS:
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE478);
break;
default:
info->action.action = ACTION_PASS_TURN;
break;
}
sub_807FD84(entity);
if (EntityIsValid(entity)) {
if (GetEntInfo(entity)->unk14A == 0) {
GetEntInfo(entity)->unk14A = 0;
sub_8079764(entity);
}
sub_8041888(0);
if (EntityIsValid(entity)) {
sub_8085140();
if (info->unk14B != 0) {
bVar4 = FALSE;
info->unk14B = 0;
for(index = 0; index < MAX_MON_MOVES; index++)
{
move = &info->moves.moves[index];
if ((info->moves.moves[index].moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_LAST_USED)) {
move->PP = 0;
bVar4 = TRUE;
}
}
if (bVar4) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FD2CC);
}
}
sub_807360C();
if (!sub_8044B84()) {
sub_807348C();
sub_80732F0();
if (!EntityIsValid(entity)) {
return FALSE;
}
}
if (bVar14) {
sub_8075818(entity);
}
if (EntityIsValid(entity)) {
if (!sub_8044B84()) {
sub_8046D20();
}
sub_8041888(0);
if (((EntityIsValid(entity)) && (!info->aiAllySkip)) && (!bVar14)) {
if (sub_80706A4(entity,&entity->pos) != '\0') {
WarpTarget(entity,entity,0,0);
}
sub_8074094(entity);
sub_8071DA4(entity);
}
}
}
}
return FALSE;
}
void sub_80732F0(void)
{
s32 index;
Entity *entity;
EntityInfo *info;
s32 moveIndex;
s32 counter;
s32 otherIndex;
u8 flag;
Move *move;
Move *move2;
Move moveStack;
u8 sl;
for(index = 0; index < DUNGEON_MAX_POKEMON; index++){
flag = FALSE;
entity = gDungeon->activePokemon[index];
if(EntityIsValid(entity)){
info = GetEntInfo(entity);
if(info->unk164 != 0xFF){
sl = info->unk164;
if(CannotAttack(entity, TRUE)){
info->unk164 |= 0xFF;
}
else if(!IsSleeping(entity)){
info->unk164 |= 0xFF;
}
else if(info->muzzled.muzzled == TRUE){
info->unk164 |= 0xFF;
}
else{
moveIndex = DungeonRandInt(MAX_MON_MOVES);
for(counter = 0; counter < MAX_MON_MOVES; counter++){
move = &info->moves.moves[moveIndex];
if(MoveFlagExists(move)){
moveStack = *move;
if(moveStack.id == MOVE_SKETCH)
goto _increase;
if(moveStack.id == MOVE_MIMIC)
goto _increase;
for(otherIndex = 0; otherIndex < MAX_MON_MOVES; otherIndex++){
move2 = &info->moves.moves[otherIndex];
if(MoveFlagExists(move2)){
if(!info->isTeamLeader){
if(!(move2->moveFlags & MOVE_FLAG_ENABLED_FOR_AI)) continue;
}
if(move2->id == MOVE_SLEEP_TALK){
if(CanMonsterUseMove(entity, move2, TRUE))
{
sub_80838EC(&move2->PP);
break;
}
}
}
}
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
LogMessageByIdWithPopupCheckUser(entity, *gUnknown_80FCF38); // {ARG_POKEMON_0} uttered its sleep talk!
info->action.direction = sl & DIRECTION_MASK;
TryUseChosenMove(entity, 0, ITEM_NOTHING, 1, FALSE, &moveStack);
flag = TRUE;
break;
}
else
{
_increase:
moveIndex++;
if(moveIndex == MAX_MON_MOVES)
moveIndex = 0;
}
}
info->unk164 |= 0xFF;
if(flag)
sub_80421C0(entity, 0x2E0);
}
}
}
}
}
void sub_807348C(void)
{
int index;
s32 moveIndex;
Move *move;
EntityInfo *info;
Entity *pokemon;
Move chosenMove;
u8 r8;
for(index = 0; index < DUNGEON_MAX_POKEMON; index++) {
pokemon = gDungeon->activePokemon[index];
if (EntityIsValid(pokemon)) {
info = GetEntInfo(pokemon);
if (info->unk165 != 0xff) {
r8 = info->unk165;
if (CannotAttack(pokemon,TRUE)) {
info->unk165 |= 0xff;
info->unk164 |= 0xff;
}
else if (!IsSleeping(pokemon)) {
info->unk165 |= 0xff;
info->unk164 |= 0xff;
}
else if (info->muzzled.muzzled == TRUE) {
info->unk165 |= 0xff;
info->unk164 |= 0xff;
}
else {
for(moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
{
move = &info->moves.moves[moveIndex];
if (((MoveFlagExists(move)) &&
((info->isTeamLeader || (move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI)) && move->id == MOVE_SNORE)) &&
(CanMonsterUseMove(pokemon,move,TRUE))) {
chosenMove = *move;
sub_80838EC(&move->PP);
MarkLastUsedMonMove(pokemon,move);
break;
}
}
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0);
LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FCF50);
info->action.direction = r8 & DIRECTION_MASK;
TryUseChosenMove(pokemon,0,ITEM_NOTHING,1,FALSE,&chosenMove);
info->unk165 |= 0xff;
info->unk164 |= 0xff;
}
}
}
}
}
void sub_807360C(void)
{
s32 index;
Entity *entity;
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
entity = gDungeon->activePokemon[index];
if(EntityIsValid(entity))
{
if(GetEntInfo(entity)->unk152 != 0)
{
GetEntInfo(entity)->unk152 = 0;
UpdateFlashFireBoost(entity, entity);
}
}
}
}

View File

@@ -1,205 +1,64 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_action.h"
#include "constants/ability.h"
#include "constants/dungeon_action.h"
#include "dungeon_ai.h"
#include "dungeon_ai_leader.h"
#include "structs/dungeon_entity.h"
#include "structs/str_dungeon.h"
#include "dungeon_leader.h"
#include "dungeon_movement.h"
#include "dungeon_logic.h"
#include "dungeon_generation.h"
#include "dungeon_util.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_strings.h"
#include "pokemon.h"
#include "items.h"
#include "structs/str_item_text.h"
#include "code_8044CC8.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_engine.h"
#include "run_dungeon.h"
extern u8 *gUnknown_80F91EC[];
extern u8 *gUnknown_80F7C50[];
extern u8 gUnknown_80F697C[];
extern s16 gSpeedTurns[2][0x19];
extern void sub_8071B48(void);
extern void sub_8043ED0(u32);
extern u8 GetFloorType(void);
extern bool8 sub_8044B28(void);
extern void sub_8086AC0(void);
extern void sub_8043ED0(u32);
extern void sub_807EAA0(u32, u32);
extern void UseAttack(u32);
extern void sub_8071B48(void);
extern void TriggerWeatherAbilities(void);
extern void sub_8074094(Entity *);
extern void sub_8071DA4(Entity *);
extern void TickStatusHeal(Entity *);
void sub_8044820(void)
{
s32 movSpeed;
EntityInfo *entityInfo;
EntityInfo *entityInfo2;
Entity * entity;
Entity * entity2;
s32 index;
extern unkStruct_202EE44 gDungeonSubMenu[10];
for (index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++) {
entity = gDungeon->wildPokemon[index];
if (EntityIsValid(entity)) {
if (sub_8044B28()) break;
entityInfo = GetEntInfo(entity);
gDungeon->unkB8 = entity;
TriggerWeatherAbilities();
if ((entityInfo->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY) == 0) {
if ((u16)(entityInfo->flags & MOVEMENT_FLAG_UNK_14) != 0) {
entityInfo->flags &= ~(MOVEMENT_FLAG_UNK_14);
}
else
{
entityInfo->aiAllySkip = FALSE;
movSpeed = CalcSpeedStage(entity);
if (gSpeedTurns[movSpeed][gDungeon->unk644.fractionalTurn] != 0) {
if (!entityInfo->attacking) {
entityInfo->flags &= ~(MOVEMENT_FLAG_UNK_14 | MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY);
entityInfo->recalculateFollow = FALSE;
TickStatusHeal(entity);
if (EntityIsValid(entity)) {
sub_8071DA4(entity);
RunMonsterAI(entity, 0);
if (sub_8044B28()) break;
sub_8072CF4(entity);
sub_8086AC0();
sub_8043ED0(0);
if (sub_8044B28()) break;
}
}
}
}
}
}
}
if (sub_8044B28() == 0) {
for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++)
{
entity2 = gDungeon->wildPokemon[index];
if ((EntityIsValid(entity2)) && (entityInfo2 = GetEntInfo(entity2), entityInfo2->aiAllySkip))
{
sub_8074094(entity2);
if (EntityIsValid(entity2)) {
sub_8071DA4(entity2);
entityInfo2->aiAllySkip = FALSE;
}
}
}
}
}
extern s32 gDungeonSubMenuItemsCount;
void TrySpawnMonsterAndActivatePlusMinus(void)
{
EntityInfo * entityInfo;
Entity *entity;
u32 isNotEnemy;
s32 index;
extern bool8 sub_8045888(Entity *);
if (gSpeedTurns[1][gDungeon->unk644.fractionalTurn] != 0) {
sub_8071B48();
gDungeon->plusIsActive[0] = FALSE;
gDungeon->plusIsActive[1] = FALSE;
gDungeon->minusIsActive[0] = FALSE;
gDungeon->minusIsActive[1] = FALSE;
gDungeon->lightningRodPokemon = NULL;
gDungeon->unk17B38 = 2;
static const u16 gUnknown_80F6964[NUM_ITEM_CATEGORIES] = {
[CATEGORY_THROWN_LINE] = 0,
[CATEGORY_THROWN_ARC] = 0,
[CATEGORY_BERRIES_SEEDS_VITAMINS] = 13,
[CATEGORY_FOOD_GUMMIES] = 14,
[CATEGORY_HELD_ITEMS] = 0,
[CATEGORY_TMS_HMS] = 16,
[CATEGORY_POKE] = 0,
[CATEGORY_7] = 18,
[CATEGORY_OTHER] = 18,
[CATEGORY_ORBS] = 49,
[CATEGORY_LINK_BOX] = 44,
[CATEGORY_USED_TM] = 18,
};
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
entity = gDungeon->activePokemon[index];
if (EntityIsValid(entity)) {
entityInfo = GetEntInfo(entity);
entityInfo->attacking = FALSE;
if(entityInfo->isNotTeamMember)
{
isNotEnemy = FALSE;
}
else {
isNotEnemy = TRUE;
}
if (AbilityIsActive(entity, ABILITY_LIGHTNINGROD)) {
gDungeon->lightningRodPokemon = entity;
gDungeon->unk17B38 = entityInfo->unk98;
}
if (AbilityIsActive(entity, ABILITY_MINUS)) {
gDungeon->minusIsActive[isNotEnemy] = TRUE;
}
if (AbilityIsActive(entity, ABILITY_PLUS)) {
gDungeon->plusIsActive[isNotEnemy] = TRUE;
}
}
}
sub_8043ED0(0);
}
}
void sub_8044AB4(void)
{
s32 index;
if (gSpeedTurns[1][gDungeon->unk644.fractionalTurn + 1] != 0) {
for (index = 0; index < DUNGEON_MAX_POKEMON; index++) {
if (EntityIsValid(gDungeon->activePokemon[index])) {
UseAttack(0);
break;
}
}
sub_807EAA0(1,0);
sub_8086AC0();
sub_8043ED0(0);
}
}
bool8 sub_8044B28(void)
{
if (gDungeon->unk4 == 0) {
if (GetLeader() == NULL) {
gDungeon->unk644.unk10 = 1;
}
else if (gDungeon->unk2 == 1) {
gDungeon->unk644.unk10 = 2;
}
else if (gDungeon->unk2 != 2) {
return FALSE;
}
else {
gDungeon->unk644.unk10 = 2;
}
}
return TRUE;
}
bool8 sub_8044B84(void)
{
if(gDungeon->unk10 != 0)
{
return TRUE;
}
else {
return sub_8044B28();
}
}
const u8 *sub_8044BA8(u16 actionId, u8 id)
UNUSED static const u8 *sub_8044BA8(u16 actionId, u8 id)
{
if (actionId == ACTION_STAIRS && GetFloorType() == FLOOR_TYPE_RESCUE) {
return *gUnknown_80F91EC;
return gUnknown_80F91EC;
}
else {
if (!AreStringsDifferent(gUnknown_80F7C50[actionId << 1], gUnknown_80F697C)) {
if (!AreStringsDifferent(gUnknown_80F7C50[actionId].str, "X")) {
return gActions[GetItemActionType(id)].useText;
}
else {
return gUnknown_80F7C50[actionId << 1];
return gUnknown_80F7C50[actionId].str;
}
}
}
@@ -257,3 +116,236 @@ void SetActionPassTurnOrWalk(ActionContainer *actionPointer, s16 species)
actionPointer->actionParameters[0].actionUseIndex = 0;
actionPointer->actionParameters[1].actionUseIndex = 0;
}
Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3)
{
const Tile *tile;
Item *item;
EntityInfo *info;
if (param_2->actionUseIndex >= 1 && param_2->actionUseIndex < INVENTORY_SIZE + 1) {
item = &gTeamInventoryRef->teamItems[param_2->actionUseIndex - 1];
}
else if (param_2->actionUseIndex == 0x80) {
tile = GetTile((param_2->itemPos).x,(param_2->itemPos).y);
item = GetItemData(tile->object);
}
else {
if (param_2->actionUseIndex == 0x81) {
info = GetEntInfo(param_1);
}
else {
if (param_2->actionUseIndex >= 0x90 && param_2->actionUseIndex < 0x94) {
info = GetEntInfo(gDungeon->teamPokemon[param_2->actionUseIndex - 0x90]);
}
else {
return NULL;
}
}
item = &info->heldItem;
}
return item;
}
bool8 sub_8044D40(ActionContainer *param_1,s32 index)
{
Item *item;
ActionParameter *puVar1;
puVar1 = &param_1->actionParameters[index];
if ((u8)(puVar1->actionUseIndex - 1) < INVENTORY_SIZE) {
item = &gTeamInventoryRef->teamItems[puVar1->actionUseIndex - 1];
item->id = ITEM_NOTHING;
item->quantity = 0;
item->flags = 0;
FillInventoryGaps();
}
else {
if (puVar1->actionUseIndex != 0x80) {
return FALSE;
}
RemoveItemFromDungeonAt(&puVar1->itemPos,1);
}
return TRUE;
}
Item *sub_8044D90(Entity *entity, s32 index, s32 unused)
{
EntityInfo *info = GetEntInfo(entity);
return sub_8044CC8(entity, &info->action.actionParameters[index], unused);
}
Entity *sub_8044DA4(Entity *entity, s32 index)
{
EntityInfo *info = GetEntInfo(entity);
return gDungeon->teamPokemon[info->action.actionParameters[index].actionUseIndex];
}
u16 sub_8044DC8(Item *param_1)
{
if (param_1->id == ITEM_SWITCH_BOX) {
return 0x35;
}
else {
return gUnknown_80F6964[GetItemCategory(param_1->id)];
}
}
void sub_8044DF0(Entity *entity, s32 index, u32 unused)
{
Item *item;
EntityInfo *info;
info = GetEntInfo(entity);
item = sub_8044D90(entity,index,unused);
if ((info->action).actionParameters[0].actionUseIndex == 0x80) {
RemoveItemFromDungeonAt(&(info->action).actionParameters[0].itemPos,1);
}
else {
item->id = ITEM_NOTHING;
item->quantity = 0;
item->flags = 0;
FillInventoryGaps();
}
}
void sub_8044E24(Entity *entity,int index,u32 unused)
{
Item *itemPtr;
EntityInfo *info;
DungeonPos *pos;
Item item;
itemPtr = sub_8044D90(entity,index,unused);
info = GetEntInfo(entity);
if (!IsHMItem(itemPtr->id)) {
if (GetItemCategory(itemPtr->id) == CATEGORY_TMS_HMS) {
if (info->action.actionParameters[index].actionUseIndex == 0x80) {
item = *itemPtr;
pos = &info->action.actionParameters[index].itemPos;
RemoveItemFromDungeonAt(pos,1);
item.quantity = itemPtr->id - 125;
item.id = ITEM_TM_USED_TM;
AddItemToDungeonAt(pos,&item,1);
}
else {
itemPtr->quantity = itemPtr->id - 125;
itemPtr->id = ITEM_TM_USED_TM;
}
}
else {
sub_8044DF0(entity,index,unused);
}
}
}
// Similar to sub_8044BA8
const u8 *GetDungeonSubMenuItemString(s32 param_1)
{
u16 actionId = gDungeonSubMenu[param_1].actionId;
if (actionId == ACTION_STAIRS && GetFloorType() == FLOOR_TYPE_RESCUE) {
return gUnknown_80F91EC;
}
else {
if (!AreStringsDifferent(gUnknown_80F7C50[actionId].str, "X")) {
return gActions[GetItemActionType(gDungeonSubMenu[param_1].unk2)].useText;
}
else {
return gUnknown_80F7C50[actionId].str;
}
}
}
bool8 CanSubMenuItemBeChosen(s32 itemId)
{
if (itemId < 0)
return FALSE;
else
return gDungeonSubMenu[itemId].canBeChosen;
}
void AddActionToDungeonSubMenu(u16 actionId, u8 param_2)
{
int index;
if (gDungeonSubMenuItemsCount < 10) {
for(index = 0; index < gDungeonSubMenuItemsCount; index++)
{
if (gDungeonSubMenu[index].actionId == actionId) {
return;
}
}
gDungeonSubMenu[gDungeonSubMenuItemsCount].actionId = actionId;
gDungeonSubMenu[gDungeonSubMenuItemsCount].unk2 = param_2;
gDungeonSubMenu[gDungeonSubMenuItemsCount].canBeChosen = TRUE;
gDungeonSubMenuItemsCount++;
}
}
s32 ActionToDungeonSubMenuId(u16 actionId)
{
int index;
for(index = 0; index < gDungeonSubMenuItemsCount; index++)
{
if (gDungeonSubMenu[index].actionId == actionId) {
return index;
}
}
return -1;
}
void SetActionUnusableInDungeonSubMenu(u16 actionId)
{
int index;
for(index = 0; index < gDungeonSubMenuItemsCount; index++)
{
if (gDungeonSubMenu[index].actionId == actionId) {
gDungeonSubMenu[index].canBeChosen = FALSE;
return;
}
}
}
bool8 IsNotAttacking(Entity *param_1, bool8 param_2)
{
EntityInfo *info;
u16 *action;
info = GetEntInfo(param_1);
action = &(info->action).action;
if ((param_2 == 0) || (sub_8045888(param_1)))
{
if(*action == ACTION_NOTHING)
return TRUE;
if (*action == ACTION_WALK)
return TRUE;
if (*action == ACTION_PASS_TURN)
return TRUE;
if (*action == ACTION_UNK5)
return TRUE;
return FALSE;
}
else {
return TRUE;
}
}
void sub_8045064(void)
{
s32 i, j;
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];
if (gUnknown_80F7C50[iPtr->actionId].val > gUnknown_80F7C50[jPtr->actionId].val) {
SWAP(*iPtr, *jPtr, temp);
}
}
}
}

View File

@@ -1,9 +1,8 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_ai.h"
#include "code_803E668.h"
#include "code_803E724.h"
#include "code_8045A00.h"
#include "dungeon_message.h"
#include "code_8077274_1.h"
#include "code_808417C.h"
@@ -19,55 +18,20 @@
#include "dungeon_ai_attack.h"
#include "dungeon_ai_items.h"
#include "dungeon_ai_movement.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_capabilities.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util_1.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "pokemon.h"
#include "status_checks.h"
#include "structs/map.h"
#include "structs/str_dungeon.h"
#include "dungeon_misc.h"
#include "tile_types.h"
extern char *gPtrCouldntBeUsedMessage;
extern char *gPtrItsaMonsterHouseMessage;
extern u8 sub_8044B28(void);
extern void sub_807AB38(Entity *, u32);
extern void sub_8041888(u32);
void sub_8075900(Entity *pokemon, u8 r1)
{
if(EntityIsValid(pokemon))
{
if(!GetEntInfo(pokemon)->isNotTeamMember)
{
if(!sub_8044B28())
{
if(!gDungeon->unk644.monsterHouseTriggered)
{
if((GetTileAtEntitySafe(pokemon)->terrainType & TERRAIN_TYPE_IN_MONSTER_HOUSE))
{
// It's a monster house!
LogMessageByIdWithPopupCheckUser(GetLeader(), gPtrItsaMonsterHouseMessage);
gDungeon->unk644.monsterHouseTriggeredEvent = TRUE;
sub_807AB38(pokemon, r1);
sub_8041888(0);
if(sub_803F428(&pokemon->pos))
sub_803E708(0x78, 0x39);
}
}
}
}
}
}
void RunMonsterAI(Entity *pokemon, u32 unused)
{
@@ -188,3 +152,17 @@ void RunMonsterAI(Entity *pokemon, u32 unused)
}
}
}
void sub_8075BA4(Entity *param_1, u8 param_2)
{
EntityInfo * entityInfo = GetEntInfo(param_1);
if ((param_2 != 0) && (entityInfo->cringeClassStatus.status == STATUS_COWERING)) {
entityInfo->action.direction = (entityInfo->action.direction + 4) & DIRECTION_MASK;
TargetTileInFront(param_1);
}
else if (entityInfo->cringeClassStatus.status == STATUS_CONFUSED) {
entityInfo->action.direction = DungeonRandInt(NUM_DIRECTIONS);
TargetTileInFront(param_1);
}
}

View File

@@ -1,7 +1,7 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_ai_attack.h"
#include "charge_move.h"
#include "code_8045A00.h"
#include "dungeon_move_util.h"
#include "dungeon_message.h"
#include "code_806CD90.h"
#include "constants/direction.h"
@@ -13,22 +13,18 @@
#include "constants/targeting.h"
#include "constants/type.h"
#include "dungeon_action.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_ai.h"
#include "dungeon_capabilities.h"
#include "dungeon_config.h"
#include "dungeon_engine.h"
#include "run_dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "items.h"
#include "move_checks.h"
#include "move_util.h"
#include "moves.h"
#include "position_util.h"
#include "status_checks_1.h"
#include "status_checks.h"
#include "structs/str_dungeon.h"
#include "targeting_flags.h"
@@ -48,13 +44,10 @@ EWRAM_DATA u8 gPotentialAttackTargetDirections[NUM_DIRECTIONS] = {0};
EWRAM_DATA s32 gPotentialAttackTargetWeights[NUM_DIRECTIONS] = {0};
EWRAM_DATA Entity *gPotentialTargets[NUM_DIRECTIONS] = {0};
extern void sub_8055A00(Entity *, u8, u32, u32, u32);
extern bool8 sub_8044B28(void);
extern void sub_8057588(Entity *, u32);
extern void sub_806A1B0(Entity *);
extern Item *sub_8044D90(Entity *, s32, u32);
extern bool8 sub_8044D40(ActionContainer *, u32);
extern bool8 TryUseChosenMove(struct Entity *, u32, u32, u32, u32, struct Move *);
extern void sub_8045BF8(u8 *, struct Item *);
extern void sub_8044DF0(struct Entity *, u32, u32);
extern void sub_8071DA4(struct Entity *);
@@ -546,23 +539,11 @@ s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, Entity *pokemon, Move
bool8 IsTargetInLineRange(Entity *user, Entity *target, s32 range)
{
s32 distanceX = user->pos.x - target->pos.x;
s32 distanceY, distance;
s32 direction;
if (distanceX < 0)
{
distanceX = -distanceX;
}
distanceY = user->pos.y - target->pos.y;
if (distanceY < 0)
{
distanceY = -distanceY;
}
distance = distanceY;
if (distanceY < distanceX)
{
distance = distanceX;
}
s32 distanceX = abs(user->pos.x - target->pos.x);
s32 distanceY = abs(user->pos.y - target->pos.y);
s32 distance = max(distanceX, distanceY);
if (distance > RANGED_ATTACK_RANGE || distance > range)
{
return FALSE;
@@ -1070,3 +1051,12 @@ void HandleUseOrbAction(Entity *pokemon)
if (!sub_8044B28())
sub_806A1B0(pokemon);
}
s16 GetMoveTargetAndRangeForPokemon(Entity *pokemon, Move *move, bool32 isAI)
{
if (move->id == MOVE_CURSE && !isAI && !MonsterIsType(pokemon, TYPE_GHOST))
{
return TARGETING_FLAG_BOOST_SELF | TARGETING_FLAG_TARGET_SELF;
}
return GetMoveTargetAndRange(move, isAI);
}

View File

@@ -1,15 +1,13 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_ai_item_weight.h"
#include "constants/status.h"
#include "constants/targeting.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_util.h"
#include "moves.h"
#include "number_util.h"
#include "status_checks_1.h"
u32 GetAIUseItemProbability(Entity *targetPokemon, Item *item, u32 itemTargetFlags)
{

View File

@@ -1,5 +1,5 @@
#include "global.h"
#include "globaldata.h"
#include "constants/direction.h"
#include "constants/dungeon_action.h"
#include "constants/iq_skill.h"
@@ -9,18 +9,26 @@
#include "dungeon_ai_attack.h"
#include "dungeon_ai_item_weight.h"
#include "dungeon_ai_items.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_capabilities.h"
#include "structs/dungeon_entity.h"
#include "structs/str_dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_logic.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "items.h"
#include "structs/str_position.h"
#include "position_util.h"
#include "string_format.h"
#include "dungeon_strings.h"
#include "dungeon_message.h"
#include "dungeon_music.h"
#include "dungeon_items.h"
#include "constants/dungeon.h"
extern void sub_8045BF8(u8 *, Item *);
extern void sub_8067110(Entity *);
extern void sub_80671A0(Entity *);
extern bool8 sub_8044B28(void);
#define NUM_POTENTIAL_ROCK_TARGETS 20
#define GROUND_ITEM_TOOLBOX_INDEX 0x80
@@ -40,6 +48,8 @@ EWRAM_DATA u32 gAIThrownItemProbabilities[NUM_DIRECTIONS] = {0};
extern TeamInventory *gTeamInventoryRef;
void sub_8073D14(Entity *);
void AIDecideUseItem(Entity *pokemon)
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
@@ -407,3 +417,167 @@ void TargetThrownItem(Entity *pokemon, Entity *targetPokemon, Item *item, s32 ta
gAIThrowItemActionChoiceCount++;
}
}
void HandleEatAIAction(Entity *pokemon)
{
sub_8067110(pokemon);
}
void HandleThrowItemAIAction(Entity *pokemon)
{
sub_80671A0(pokemon);
}
void HandlePickUpAIAction(Entity *pokemon)
{
sub_8073D14(pokemon);
}
void sub_8073D14(Entity *entity)
{
Item *groundItem;
EntityInfo *_entityInfo;
EntityInfo *entityInfo = GetEntInfo(entity);
Entity *tileObject = GetTileAtEntitySafe(entity)->object;
if (tileObject == NULL)
return;
if (sub_8044B28())
return;
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
if (entityInfo->isTeamLeader)
return;
if (entityInfo->shopkeeper == 1)
return;
if (IsExperienceLocked(entityInfo->joinedAt.id))
return;
if (entityInfo->monsterBehavior == BEHAVIOR_RESCUE_TARGET)
return;
_entityInfo = GetEntInfo(entity); // Reloaded as a new variable for some reason.
groundItem = GetItemData(tileObject);
if (groundItem->flags & ITEM_FLAG_IN_SHOP)
return;
if (ShouldMonsterRunAwayAndShowEffect(entity, TRUE)) {
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
DisplayDungeonLoggableMessageTrue(entity, gMonTerrifiedCouldntPickUpItem);
}
else if (!_entityInfo->isNotTeamMember && GetItemCategory(groundItem->id) == CATEGORY_POKE) {
// Why check the same thing again?
if (_entityInfo->isNotTeamMember) {
PlaySoundEffect(0x14B);
}
else {
PlaySoundEffect(0x14C);
}
AddToTeamMoney(GetMoneyValue(groundItem));
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
RemoveItemFromDungeonAt(&entity->pos, 1);
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem);
}
else {
s32 i, nItems, newInventoryId;
s32 inventoryIds[INVENTORY_SIZE + 1]; // plus held
Item *carriedItems[INVENTORY_SIZE + 1]; // plus held
s32 newQuantity;
if (gDungeon->unk644.hasInventory && !_entityInfo->isNotTeamMember) {
for (i = 0; i < INVENTORY_SIZE; i++) {
carriedItems[i] = &gTeamInventoryRef->teamItems[i];
inventoryIds[i] = i;
}
carriedItems[INVENTORY_SIZE] = &_entityInfo->heldItem;
inventoryIds[INVENTORY_SIZE] = -1;
nItems = INVENTORY_SIZE + 1;
}
else {
carriedItems[0] = &_entityInfo->heldItem;
inventoryIds[0] = -1;
nItems = 1;
}
if ((groundItem->id < 9) && !(groundItem->flags & ITEM_FLAG_IN_SHOP)) {
newInventoryId = -1;
newQuantity = -1;
for (i = 0; i < nItems; i++) {
if (carriedItems[i]->flags & ITEM_FLAG_EXISTS
&& !(carriedItems[i]->flags & ITEM_FLAG_IN_SHOP)
&& ((groundItem->id == carriedItems[i]->id) && (groundItem->flags & ITEM_FLAG_STICKY) == (carriedItems[i]->flags & ITEM_FLAG_STICKY))
&& carriedItems[i]->quantity != 99 && newQuantity < carriedItems[i]->quantity)
{
newQuantity = carriedItems[i]->quantity;
newInventoryId = i;
}
}
if (newInventoryId == -1) {
newQuantity = -1;
for (i = 0; i < nItems; i++) {
if (carriedItems[i]->flags & ITEM_FLAG_EXISTS
&& !(carriedItems[i]->flags & ITEM_FLAG_IN_SHOP)
&& groundItem->id == carriedItems[i]->id
&& carriedItems[i]->quantity != 99
&& newQuantity < carriedItems[i]->quantity)
{
newQuantity = carriedItems[i]->quantity;
newInventoryId = i;
}
}
}
if (newInventoryId != -1) {
s32 quantity = carriedItems[newInventoryId]->quantity + groundItem->quantity;
if (quantity >= 99)
quantity = 99;
carriedItems[newInventoryId]->quantity = quantity;
if (groundItem->flags & ITEM_FLAG_STICKY)
carriedItems[newInventoryId]->flags |= ITEM_FLAG_STICKY;
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
RemoveItemFromDungeonAt(&entity->pos, 1);
PlaySoundEffect(0x14A);
if (inventoryIds[newInventoryId] <= -1)
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem2);
else
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItemToolbox);
return;
}
}
for (i = 0; i < nItems; i++) {
if (!(carriedItems[i]->flags & ITEM_FLAG_EXISTS))
break;
}
if (i == nItems) {
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
DisplayDungeonLoggableMessageTrue(entity, gMonSteppedOnItem);
}
else {
if (_entityInfo->isNotTeamMember) {
PlaySoundEffect(0x14B);
}
else {
PlaySoundEffect(0x14A);
}
if (inventoryIds[i] <= -1) {
_entityInfo->heldItem = *groundItem;
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
RemoveItemFromDungeonAt(&entity->pos, 1);
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem2);
}
else if (AddItemToInventory(groundItem)) {
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
DisplayDungeonLoggableMessageTrue(entity, gMonCouldntPickUpItem);
}
else {
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
RemoveItemFromDungeonAt(&entity->pos, 1);
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItemToolbox);
}
}
}
}

View File

@@ -1,96 +1,12 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_ai_leader.h"
#include "charge_move.h"
#include "code_803E46C.h"
#include "code_8041AD0.h"
#include "code_804267C.h"
#include "code_8045A00.h"
#include "code_8066D04.h"
#include "dungeon_message.h"
#include "code_8077274_1.h"
#include "code_807CD9C.h"
#include "constants/dungeon_action.h"
#include "constants/dungeon.h"
#include "constants/iq_skill.h"
#include "constants/item.h"
#include "constants/move_id.h"
#include "constants/status.h"
#include "constants/targeting.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_capabilities.h"
#include "dungeon_items.h"
#include "dungeon_logic.h"
#include "dungeon_leader.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "move_util.h"
#include "moves.h"
#include "pokemon_3.h"
#include "pokemon.h"
#include "status.h"
#include "status_checks_1.h"
#include "trap.h"
#include "dungeon_config.h"
#include "dungeon_misc.h"
extern u8 gUnknown_202F221;
extern u8 gUnknown_202F222;
extern u8 gUnknown_202F32C;
extern u8 gUnknown_202F32D;
extern u8 gUnknown_203B434;
extern u8 *gUnknown_80FA5B4[];
extern u8 *gUnknown_80FCF50[];
extern u8 *gUnknown_80FCF38[];
extern u8 *gUnknown_80FD2CC[];
extern u8 *gUnknown_80FE478[];
extern u8 *gUnknown_80FE6D4[];
void sub_8075BA4(Entity *param_1, u8 param_2);
void sub_804178C(u8 param_1);
void nullsub_95(Entity *);
bool8 IsNotAttacking(Entity *, bool8);
extern void sub_80671A0(Entity *);
extern void sub_8067110(Entity *);
void HandleUseMoveAIAction(Entity *target);
void sub_8041888(u8 param_1);
void sub_8085140(void);
void sub_807360C(void);
void sub_805EFB4(Entity *, u8);
void sub_8074FB0(Entity *, u8, DungeonPos *);
void HandlePlaceItemAction(Entity *);
void HandlePickUpPlayerAction(Entity *);
void sub_8066E14(Entity * );
void sub_807348C(void);
void sub_80732F0(void);
void sub_8066BD4(Entity*);
void HandleTalkFieldAction(Entity *);
void HandleUseMovePlayerAction(Entity *);
void HandleUseOrbAction(Entity *);
void sub_8067904(Entity *, u32);
void HandleGiveItemAction(Entity *);
void HandleTakeItemAction(Entity *);
void HandleUseItemAction(Entity *);
void sub_8066FA4(Entity *);
void HandleUnsetItemAction(Entity *,bool8);
extern u8 sub_8044B28(void);
extern u8 UseAttack(Entity *);
void sub_806A1E8(Entity *pokemon);
bool8 sub_804AE08(DungeonPos *pos);
void HandlePickUpAIAction(Entity *pokemon);
void HandleThrowItemAIAction(Entity *pokemon);
void HandleEatAIAction(Entity *pokemon);
bool8 sub_8044B84(void);
extern void sub_8074094(Entity *);
extern void sub_8071DA4(Entity *);
u32 sub_8075818(Entity *entity);
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);
bool8 TargetLeader(Entity *pokemon)
{
@@ -117,421 +33,3 @@ Entity* GetLeaderIfVisible(Entity *pokemon)
return NULL;
}
bool8 sub_8072CF4(Entity *entity)
{
bool8 bVar4;
bool8 bVar5;
Move *move;
s32 index;
EntityInfo *info;
bool8 bVar14;
DungeonPos pos;
DungeonPos pos1;
sub_804178C(1);
gUnknown_203B434 = 1;
info = GetEntInfo(entity);
info->useHeldItem = FALSE;
info->unkF3 = FALSE;
gDungeon->unkB8 = entity;
if (gUnknown_80F58F4[(info->action).action][0] != 0) {
if (info->isTeamLeader) {
sub_805EFB4(entity,gUnknown_80F58F4[(info->action).action][1]);
}
else {
sub_8075BA4(entity,gUnknown_80F58F4[(info->action).action][1]);
}
}
if ((CannotAttack(entity, FALSE)) && (IsChargingAnyTwoTurnMove(entity, TRUE))) {
sub_8079764(entity);
}
for(index = 0; index < MAX_MON_MOVES; index++)
{
move = &info->moves.moves[index];
if ((move->moveFlags & MOVE_FLAG_EXISTS)) {
move->moveFlags2 &= ~(MOVE_FLAG2_UNK4);
}
}
if (!IsNotAttacking(entity, FALSE)) {
if (UseAttack(entity)) {
if (sub_8044B28()) {
return FALSE;
}
if (!EntityIsValid(entity)) {
return FALSE;
}
if (gUnknown_202F32D != 0) {
return TRUE;
}
}
if (!info->isTeamLeader) {
sub_8052740(10);
}
sub_806A1E8(entity);
DungeonRunFrameActions(10);
}
if (((ACTION_PASS_TURN < info->action.action) && (info->action.action != 4)) && (info->action.action != ACTION_WALK)) {
info->attacking = TRUE;
}
bVar14 = FALSE;
info->unk14A = 0;
gUnknown_202F221 = 0;
gUnknown_202F222 = 0;
switch(info->action.action) {
case ACTION_WALK:
if(info->frozenClassStatus.status == STATUS_SHADOW_HOLD)
{
goto _282;
}
else if(info->frozenClassStatus.status == STATUS_CONSTRICTION)
{
goto _282;
}
else if(info->frozenClassStatus.status == STATUS_INGRAIN)
{
goto _282;
}
else if(info->frozenClassStatus.status == STATUS_WRAP)
{
goto _282;
}
else if(info->frozenClassStatus.status == STATUS_WRAPPED)
{
_282:
info->action.action = ACTION_NOTHING;
info->waiting = TRUE;
}
else {
bVar5 = FALSE;
pos1.x = (entity->pos).x + gAdjacentTileOffsets[(info->action).direction].x;
pos1.y = (entity->pos).y + gAdjacentTileOffsets[(info->action).direction].y;
if ((!(info->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY)) &&
(!CanMoveInDirection(entity,(info->action).direction))) {
bVar5 = TRUE;
}
if (bVar5) {
info->action.action = ACTION_NOTHING;
info->waiting = TRUE;
break;
}
else
{
pos.x = entity->pos.x;
pos.y = entity->pos.y;
sub_80694C0(entity,pos1.x,pos1.y,0);
sub_8074FB0(entity,(info->action).direction,&pos);
if (((IQSkillIsEnabled(entity, IQ_SUPER_MOBILE)) && (info->invisibleClassStatus.status != STATUS_MOBILE)) &&
(!HasHeldItem(entity,ITEM_MOBILE_SCARF))) {
sub_804AE08(&entity->pos);
}
bVar14 = TRUE;
break;
}
}
break;
case ACTION_USE_MOVE_AI:
HandleUseMoveAIAction(entity);
break;
case ACTION_STAIRS:
if ((gDungeon->unk644.dungeonLocation.id == DUNGEON_METEOR_CAVE) && (!gDungeon->deoxysDefeat)) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FA5B4); // It's impossible to go down the stairs now!
}
else
{
PlayStairsSound();
gDungeon->unk2 = 1;
gUnknown_202F32C = (info->action).direction;
}
break;
case ACTION_EAT_BERRY_SEED_DRINK:
case 0xe:
case ACTION_USE_TM:
sub_8067110(entity);
break;
case ACTION_USE_ORB:
HandleUseOrbAction(entity);
break;
case ACTION_PICK_UP_PLAYER:
HandlePickUpPlayerAction(entity);
break;
case ACTION_GIVE_ITEM:
HandleGiveItemAction(entity);
break;
case ACTION_TAKE_ITEM:
HandleTakeItemAction(entity);
break;
case 0x3e:
sub_8066BD4(entity); // ITEM_SWITCH_TOOLBOX (When you switch item in Toolbox)
break;
case ACTION_USE_ITEM:
HandleUseItemAction(entity);
break;
case ACTION_SET_ITEM:
HandleSetItemAction(entity, TRUE);
break;
case ACTION_UNSET_ITEM:
HandleUnsetItemAction(entity, TRUE);
break;
case 0x3b:
gDungeon->unkBC = gDungeon->teamPokemon[(info->action).actionParameters[0].actionUseIndex];
break;
case ACTION_PLACE_ITEM:
HandlePlaceItemAction(entity);
break;
case 10: // Switch with Item on Ground
sub_8066E14(entity);
break;
case 0x3a: // Switch with Item on Ground (also??)
sub_8066FA4(entity);
break;
case ACTION_THROW_ITEM_PLAYER:
case ACTION_THROW_STRAIGHT_PLAYER:
case ACTION_THROW_ARC_PLAYER:
if (MonsterCanThrowItems(info)) {
nullsub_95(entity);
sub_80671A0(entity);
break;
}
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE6D4);
break;
case ACTION_TALK_FIELD:
HandleTalkFieldAction(entity);
break;
case ACTION_USE_MOVE_PLAYER:
HandleUseMovePlayerAction(entity);
break;
case ACTION_STRUGGLE:
sub_8067904(entity, MOVE_STRUGGLE);
break;
case ACTION_REGULAR_ATTACK:
sub_8067904(entity, MOVE_REGULAR_ATTACK);
break;
case ACTION_STEPPED_ON_TRAP:
HandleTrap(entity,&entity->pos,0,0);
break;
case ACTION_PICK_UP_AI:
HandlePickUpAIAction(entity);
break;
case ACTION_EAT_AI:
HandleEatAIAction(entity);
break;
case ACTION_THROW_ITEM_AI:
HandleThrowItemAIAction(entity);
break;
case ACTION_SECOND_THOUGHTS:
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE478);
break;
default:
info->action.action = ACTION_PASS_TURN;
break;
}
sub_807FD84(entity);
if (EntityIsValid(entity)) {
if (GetEntInfo(entity)->unk14A == 0) {
GetEntInfo(entity)->unk14A = 0;
sub_8079764(entity);
}
sub_8041888(0);
if (EntityIsValid(entity)) {
sub_8085140();
if (info->unk14B != 0) {
bVar4 = FALSE;
info->unk14B = 0;
for(index = 0; index < MAX_MON_MOVES; index++)
{
move = &info->moves.moves[index];
if ((info->moves.moves[index].moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_LAST_USED)) {
move->PP = 0;
bVar4 = TRUE;
}
}
if (bVar4) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FD2CC);
}
}
sub_807360C();
if (!sub_8044B84()) {
sub_807348C();
sub_80732F0();
if (!EntityIsValid(entity)) {
return FALSE;
}
}
if (bVar14) {
sub_8075818(entity);
}
if (EntityIsValid(entity)) {
if (!sub_8044B84()) {
sub_8046D20();
}
sub_8041888(0);
if (((EntityIsValid(entity)) && (!info->aiAllySkip)) && (!bVar14)) {
if (sub_80706A4(entity,&entity->pos) != '\0') {
WarpTarget(entity,entity,0,0);
}
sub_8074094(entity);
sub_8071DA4(entity);
}
}
}
}
return FALSE;
}
void sub_80732F0(void)
{
s32 index;
Entity *entity;
EntityInfo *info;
s32 moveIndex;
s32 counter;
s32 otherIndex;
u8 flag;
Move *move;
Move *move2;
Move moveStack;
u8 sl;
for(index = 0; index < DUNGEON_MAX_POKEMON; index++){
flag = FALSE;
entity = gDungeon->activePokemon[index];
if(EntityIsValid(entity)){
info = GetEntInfo(entity);
if(info->unk164 != 0xFF){
sl = info->unk164;
if(CannotAttack(entity, TRUE)){
info->unk164 |= 0xFF;
}
else if(!IsSleeping(entity)){
info->unk164 |= 0xFF;
}
else if(info->muzzled.muzzled == TRUE){
info->unk164 |= 0xFF;
}
else{
moveIndex = DungeonRandInt(MAX_MON_MOVES);
for(counter = 0; counter < MAX_MON_MOVES; counter++){
move = &info->moves.moves[moveIndex];
if(MoveFlagExists(move)){
moveStack = *move;
if(moveStack.id == MOVE_SKETCH)
goto _increase;
if(moveStack.id == MOVE_MIMIC)
goto _increase;
for(otherIndex = 0; otherIndex < MAX_MON_MOVES; otherIndex++){
move2 = &info->moves.moves[otherIndex];
if(MoveFlagExists(move2)){
if(!info->isTeamLeader){
if(!(move2->moveFlags & MOVE_FLAG_ENABLED_FOR_AI)) continue;
}
if(move2->id == MOVE_SLEEP_TALK){
if(CanMonsterUseMove(entity, move2, TRUE))
{
sub_80838EC(&move2->PP);
break;
}
}
}
}
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
LogMessageByIdWithPopupCheckUser(entity, *gUnknown_80FCF38); // {ARG_POKEMON_0} uttered its sleep talk!
info->action.direction = sl & DIRECTION_MASK;
TryUseChosenMove(entity, 0, ITEM_NOTHING, 1, FALSE, &moveStack);
flag = TRUE;
break;
}
else
{
_increase:
moveIndex++;
if(moveIndex == MAX_MON_MOVES)
moveIndex = 0;
}
}
info->unk164 |= 0xFF;
if(flag)
sub_80421C0(entity, 0x2E0);
}
}
}
}
}
void sub_807348C(void)
{
int index;
s32 moveIndex;
Move *move;
EntityInfo *info;
Entity *pokemon;
Move chosenMove;
u8 r8;
for(index = 0; index < DUNGEON_MAX_POKEMON; index++) {
pokemon = gDungeon->activePokemon[index];
if (EntityIsValid(pokemon)) {
info = GetEntInfo(pokemon);
if (info->unk165 != 0xff) {
r8 = info->unk165;
if (CannotAttack(pokemon,TRUE)) {
info->unk165 |= 0xff;
info->unk164 |= 0xff;
}
else if (!IsSleeping(pokemon)) {
info->unk165 |= 0xff;
info->unk164 |= 0xff;
}
else if (info->muzzled.muzzled == TRUE) {
info->unk165 |= 0xff;
info->unk164 |= 0xff;
}
else {
for(moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
{
move = &info->moves.moves[moveIndex];
if (((MoveFlagExists(move)) &&
((info->isTeamLeader || (move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI)) && move->id == MOVE_SNORE)) &&
(CanMonsterUseMove(pokemon,move,TRUE))) {
chosenMove = *move;
sub_80838EC(&move->PP);
MarkLastUsedMonMove(pokemon,move);
break;
}
}
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0);
LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FCF50);
info->action.direction = r8 & DIRECTION_MASK;
TryUseChosenMove(pokemon,0,ITEM_NOTHING,1,FALSE,&chosenMove);
info->unk165 |= 0xff;
info->unk164 |= 0xff;
}
}
}
}
}
void sub_807360C(void)
{
s32 index;
Entity *entity;
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
entity = gDungeon->activePokemon[index];
if(EntityIsValid(entity))
{
if(GetEntInfo(entity)->unk152 != 0)
{
GetEntInfo(entity)->unk152 = 0;
UpdateFlashFireBoost(entity, entity);
}
}
}
}

View File

@@ -1,4 +1,5 @@
#include "global.h"
#include "globaldata.h"
#include "dungeon_ai_movement.h"
#include "constants/direction.h"
@@ -8,16 +9,12 @@
#include "constants/tactic.h"
#include "dungeon_action.h"
#include "dungeon_ai_leader.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_capabilities.h"
#include "dungeon_logic.h"
#include "structs/str_dungeon.h"
#include "dungeon_map_access.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_range.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "structs/map.h"
#include "number_util.h"
#include "position_util.h"
@@ -41,7 +38,7 @@ struct CanMoveInDirectionInfo
s32 direction;
};
const s32 gFaceDirectionIncrements[] = {0, 1, -1, 2, -2, 3, -3, 4, 0, -1, 1, -2, 2, -3, 3, 4};
extern const s32 gFaceDirectionIncrements[];
void AIMovement(Entity *pokemon, bool8 showRunAwayEffect)
{

View File

@@ -1,556 +0,0 @@
#include "global.h"
#include "dungeon_ai_targeting.h"
#include "constants/ability.h"
#include "constants/dungeon.h"
#include "constants/iq_skill.h"
#include "constants/item.h"
#include "constants/status.h"
#include "constants/tactic.h"
#include "constants/targeting.h"
#include "dungeon_engine.h"
#include "structs/str_dungeon.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_movement.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "structs/map.h"
#include "tile_types.h"
extern void ShowVisualFlags(Entity *r0);
const u8 gDirectionBitMasks_2[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_3[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_4[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_5[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_6[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gDirectionBitMasks_7[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80};
const u8 gTreatmentData[3][2][2][2] = {
{
{
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE}
},
{
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE}
}
},
{
{
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE}
},
{
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY},
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY}
}
},
{
{
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY},
{TREATMENT_IGNORE, TREATMENT_TREAT_AS_ENEMY}
},
{
{TREATMENT_TREAT_AS_ENEMY, TREATMENT_IGNORE},
{TREATMENT_TREAT_AS_ALLY, TREATMENT_IGNORE}
}
}
};
bool8 sub_8070F3C(Entity * pokemon, DungeonPos *pos, s32 direction)
{
u8 terrain;
const Tile *tile;
terrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
tile = GetTile(pos->x + gAdjacentTileOffsets[direction].x, pos->y + gAdjacentTileOffsets[direction].y);
if ((!(tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)) &&
(((tile->monster == NULL || (GetEntityType(tile->monster) == ENTITY_MONSTER))))) {
if (!IsCurrentFixedRoomBossFight())
{
if (GetEntInfo(pokemon)->invisibleClassStatus.status == STATUS_MOBILE ||
HasHeldItem(pokemon, ITEM_MOBILE_SCARF))
{
terrain = CROSSABLE_TERRAIN_WALL;
}
else if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER))
{
// BUG: If the Pokémon is a Ghost type that can normally attack through walls,
// All-Terrain Hiker/Super Mobile may make the AI think it can't attack through walls.
terrain = CROSSABLE_TERRAIN_CREVICE;
}
else if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE))
{
if ((direction & 1) != 0)
{
terrain = CROSSABLE_TERRAIN_CREVICE;
}
else
{
terrain = CROSSABLE_TERRAIN_WALL;
}
}
}
tile = GetTile(pos->x, pos->y);
if (((tile->walkableNeighborFlags[terrain] & gDirectionBitMasks_2[direction & DIRECTION_MASK]))) {
return TRUE;
}
}
return FALSE;
}
bool8 sub_8070F14(Entity * pokemon, s32 direction)
{
const Tile *tile;
tile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x, pokemon->pos.y + gAdjacentTileOffsets[direction].y);
if ((!(tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)) &&
(((tile->monster == NULL)))) {
tile = GetTile(pokemon->pos.x, pokemon->pos.y);
if (((tile->walkableNeighborFlags[0] & gDirectionBitMasks_3[direction & DIRECTION_MASK]))) {
return TRUE;
}
}
return FALSE;
}
bool8 sub_8070F80(Entity * pokemon, s32 direction)
{
u8 terrain;
const Tile *tile;
terrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
tile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x, pokemon->pos.y + gAdjacentTileOffsets[direction].y);
if ((!(tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)) &&
(((tile->monster == NULL || (GetEntityType(tile->monster) == ENTITY_MONSTER))))) {
if (!IsCurrentFixedRoomBossFight())
{
if (GetEntInfo(pokemon)->invisibleClassStatus.status == STATUS_MOBILE ||
HasHeldItem(pokemon, ITEM_MOBILE_SCARF))
{
terrain = CROSSABLE_TERRAIN_WALL;
}
else if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER))
{
// BUG: If the Pokémon is a Ghost type that can normally attack through walls,
// All-Terrain Hiker/Super Mobile may make the AI think it can't attack through walls.
terrain = CROSSABLE_TERRAIN_CREVICE;
}
else if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE))
{
if ((direction & 1) != 0)
{
terrain = CROSSABLE_TERRAIN_CREVICE;
}
else
{
terrain = CROSSABLE_TERRAIN_WALL;
}
}
}
tile = GetTile(pokemon->pos.x, pokemon->pos.y);
if (((tile->walkableNeighborFlags[terrain] & gDirectionBitMasks_4[direction & DIRECTION_MASK]))) {
return TRUE;
}
}
return FALSE;
}
bool8 sub_8071058(Entity * pokemon, s32 direction)
{
u8 terrain;
const Tile *tile;
terrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
tile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x, pokemon->pos.y + gAdjacentTileOffsets[direction].y);
if ((!(tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)) &&
(((tile->monster == NULL || (GetEntityType(tile->monster) == ENTITY_MONSTER)) ||
(!GetEntInfo(tile->monster)->isNotTeamMember)))) {
if (!IsCurrentFixedRoomBossFight())
{
if (GetEntInfo(pokemon)->invisibleClassStatus.status == STATUS_MOBILE ||
HasHeldItem(pokemon, ITEM_MOBILE_SCARF))
{
terrain = CROSSABLE_TERRAIN_WALL;
}
else if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER))
{
// BUG: If the Pokémon is a Ghost type that can normally attack through walls,
// All-Terrain Hiker/Super Mobile may make the AI think it can't attack through walls.
terrain = CROSSABLE_TERRAIN_CREVICE;
}
else if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE))
{
if ((direction & 1) != 0)
{
terrain = CROSSABLE_TERRAIN_CREVICE;
}
else
{
terrain = CROSSABLE_TERRAIN_WALL;
}
}
}
tile = GetTile(pokemon->pos.x, pokemon->pos.y);
if (((tile->walkableNeighborFlags[terrain] & gDirectionBitMasks_5[direction & DIRECTION_MASK]))) {
return TRUE;
}
}
return FALSE;
}
bool8 CanAttackInDirection(Entity *pokemon, s32 direction)
{
u8 crossableTerrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
const Tile *tile;
if (crossableTerrain < CROSSABLE_TERRAIN_CREVICE)
{
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
tile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x,
pokemon->pos.y + gAdjacentTileOffsets[direction].y);
if (!(tile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) &&
(tile->monster == NULL || GetEntityType(tile->monster) == ENTITY_MONSTER))
{
if (!IsCurrentFixedRoomBossFight())
{
if (GetEntInfo(pokemon)->invisibleClassStatus.status == STATUS_MOBILE ||
HasHeldItem(pokemon, ITEM_MOBILE_SCARF))
{
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
else if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER))
{
// BUG: If the Pokémon is a Ghost type that can normally attack through walls,
// All-Terrain Hiker/Super Mobile may make the AI think it can't attack through walls.
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
else if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE))
{
if ((direction & 1) != 0)
{
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
else
{
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
}
}
tile = GetTile(pokemon->pos.x, pokemon->pos.y);
if (tile->walkableNeighborFlags[crossableTerrain] & gDirectionBitMasks_6[direction & DIRECTION_MASK])
{
return TRUE;
}
}
return FALSE;
}
bool8 CanAIMonsterMoveInDirection(Entity *pokemon, s32 direction, bool8 *pokemonInFront)
{
u8 crossableTerrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
const Tile *currentTile;
const Tile *frontTile;
*pokemonInFront = FALSE;
frontTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x,
pokemon->pos.y + gAdjacentTileOffsets[direction].y);
if (frontTile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL)
{
return FALSE;
}
if (frontTile->terrainType & TERRAIN_TYPE_IN_MONSTER_HOUSE &&
!gDungeon->unk644.monsterHouseTriggered &&
IQSkillIsEnabled(pokemon, IQ_HOUSE_AVOIDER))
{
return FALSE;
}
if (frontTile->object != NULL &&
IQSkillIsEnabled(pokemon, IQ_TRAP_AVOIDER) &&
GetEntityType(frontTile->object) == ENTITY_TRAP &&
(frontTile->object->isVisible || GetEntInfo(pokemon)->blinkerClassStatus.status == STATUS_EYEDROPS))
{
return FALSE;
}
if ((frontTile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) == TERRAIN_TYPE_SECONDARY &&
gDungeonWaterType[gDungeon->tileset] == DUNGEON_WATER_TYPE_LAVA &&
IQSkillIsEnabled(pokemon, IQ_LAVA_EVADER))
{
return FALSE;
}
if (!IsCurrentFixedRoomBossFight())
{
if (GetEntInfo(pokemon)->invisibleClassStatus.status == STATUS_MOBILE ||
HasHeldItem(pokemon, ITEM_MOBILE_SCARF))
{
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
else if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER))
{
// BUG: If the Pokémon is a Ghost type that can normally move through walls,
// All-Terrain Hiker/Super Mobile may make the AI think it can't move through walls.
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
else if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE))
{
if ((direction & 1) != 0)
{
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
else
{
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
}
}
currentTile = GetTile(pokemon->pos.x, pokemon->pos.y);
if (currentTile->walkableNeighborFlags[crossableTerrain] & gDirectionBitMasks_7[direction & DIRECTION_MASK])
{
if (frontTile->monster == NULL)
{
return TRUE;
}
else
{
*pokemonInFront = TRUE;
}
}
return FALSE;
}
bool8 IsAtJunction(Entity *pokemon)
{
u32 crossableTerrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
if (!IsCurrentFixedRoomBossFight())
{
if (GetEntInfo(pokemon)->invisibleClassStatus.status == STATUS_MOBILE || HasHeldItem(pokemon, ITEM_MOBILE_SCARF))
{
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
else if (IQSkillIsEnabled(pokemon, IQ_ALL_TERRAIN_HIKER))
{
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
}
else if (IQSkillIsEnabled(pokemon, IQ_SUPER_MOBILE))
{
crossableTerrain = CROSSABLE_TERRAIN_WALL;
}
}
if (crossableTerrain == CROSSABLE_TERRAIN_WALL)
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
pokemonInfo->mobileTurnTimer += DungeonRandInt(100);
if (pokemonInfo->mobileTurnTimer < 200)
{
return FALSE;
}
else
{
pokemonInfo->mobileTurnTimer = 0;
}
}
else
{
const Tile *mapTile;
char walkableNeighborFlags;
if (gDungeonWaterType[gDungeon->tileset] == DUNGEON_WATER_TYPE_LAVA
&& crossableTerrain == CROSSABLE_TERRAIN_LIQUID
&& IQSkillIsEnabled(pokemon, IQ_LAVA_EVADER))
{
crossableTerrain = CROSSABLE_TERRAIN_REGULAR;
}
mapTile = GetTile(pokemon->pos.x, pokemon->pos.y);
walkableNeighborFlags = mapTile->walkableNeighborFlags[crossableTerrain];
/*
Check for configurations of open tiles that are considered junctions; i.e., shaped like a 'T' or '+'.
X=Wall, O=Open
0x54 0x51 0x45 0x15 0x55
XOX XOX XXX XOX XOX
OOO OOX OOO XOO OOO
XXX XOX XOX XOX XOX
*/
if (walkableNeighborFlags != 0x54 && walkableNeighborFlags != 0x51 && walkableNeighborFlags != 0x45 && walkableNeighborFlags != 0x15 && walkableNeighborFlags != 0x55)
{
return FALSE;
}
}
return TRUE;
}
bool8 ShouldAvoidFirstHit(Entity *pokemon, bool8 forceAvoid)
{
if (!IsTacticSet(pokemon, TACTIC_AVOID_THE_FIRST_HIT))
return FALSE;
if (!forceAvoid)
return FALSE;
return TRUE;
}
bool8 ShouldMonsterRunAway(Entity *pokemon)
{
if (!EntityIsValid(pokemon))
{
return FALSE;
}
else
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
if (pokemonInfo->terrifiedTurns != 0)
{
return TRUE;
}
if (pokemonInfo->isTeamLeader)
{
return FALSE;
}
if (AbilityIsActive(pokemon, ABILITY_RUN_AWAY))
{
bool8 runAwayActive = pokemonInfo->HP < pokemonInfo->maxHPStat / 2;
if (runAwayActive)
{
return TRUE;
}
}
if (IsTacticSet(pokemon, TACTIC_GET_AWAY) ||
(IsTacticSet(pokemon, TACTIC_AVOID_TROUBLE) && pokemonInfo->HP <= pokemonInfo->maxHPStat / 2))
{
return TRUE;
}
return FALSE;
}
}
bool8 ShouldMonsterRunAwayAndShowEffect(Entity *pokemon, bool8 showRunAwayEffect)
{
if (ShouldMonsterRunAway(pokemon))
{
CheckRunAwayVisualFlag(pokemon, showRunAwayEffect);
return TRUE;
}
return FALSE;
}
void CheckRunAwayVisualFlag(Entity *pokemon, bool8 showRunAwayEffect)
{
bool8 cVar1;
EntityInfo *iVar2;
iVar2 = GetEntInfo(pokemon);
if (((!iVar2->isTeamLeader) && AbilityIsActive(pokemon,ABILITY_RUN_AWAY) &&
(cVar1 = SetVisualFlags(iVar2,4,iVar2->HP <= iVar2->maxHPStat / 2), showRunAwayEffect)) &&
(cVar1)) {
ShowVisualFlags(pokemon);
}
}
u8 GetTreatmentBetweenMonsters(Entity *pokemon, Entity *targetPokemon, bool8 ignoreInvisible, bool8 checkPetrified)
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
EntityInfo *targetData = GetEntInfo(targetPokemon);
u8 decoyAITracker;
u8 pokemonTargetingDecoy;
bool8 pokemonIsEnemy;
bool8 targetIsEnemy;
bool8 targetIsDecoy;
if (pokemon == targetPokemon)
{
return TREATMENT_TREAT_AS_ALLY;
}
if (pokemonInfo->shopkeeper == SHOPKEEPER_MODE_SHOPKEEPER ||
targetData->shopkeeper == SHOPKEEPER_MODE_SHOPKEEPER ||
pokemonInfo->monsterBehavior == BEHAVIOR_DIGLETT ||
targetData->monsterBehavior == BEHAVIOR_DIGLETT ||
pokemonInfo->monsterBehavior == BEHAVIOR_RESCUE_TARGET ||
targetData->monsterBehavior == BEHAVIOR_RESCUE_TARGET ||
(checkPetrified && !pokemonInfo->isNotTeamMember && targetData->frozenClassStatus.status == STATUS_PETRIFIED) ||
(!ignoreInvisible && targetData->invisibleClassStatus.status == STATUS_INVISIBLE && !CanSeeInvisibleMonsters(pokemon)))
{
return TREATMENT_IGNORE;
}
pokemonTargetingDecoy = pokemonInfo->decoyAITracker;
decoyAITracker = DECOY_AI_NONE;
if (pokemonTargetingDecoy != DECOY_AI_NONE)
{
decoyAITracker = DECOY_AI_WILD;
if (pokemonTargetingDecoy == DECOY_AI_TEAM)
{
decoyAITracker = DECOY_AI_TEAM;
}
}
if (pokemonInfo->shopkeeper != SHOPKEEPER_MODE_NORMAL)
{
pokemonIsEnemy = FALSE;
if (pokemonInfo->shopkeeper == SHOPKEEPER_MODE_ATTACK_TEAM)
{
pokemonIsEnemy = TRUE;
}
}
else
{
pokemonIsEnemy = pokemonInfo->isNotTeamMember ? TRUE : FALSE;
}
if (targetData->shopkeeper != SHOPKEEPER_MODE_NORMAL)
{
targetIsEnemy = FALSE;
if (targetData->shopkeeper == SHOPKEEPER_MODE_ATTACK_TEAM)
{
targetIsEnemy = TRUE;
}
}
else
{
targetIsEnemy = targetData->isNotTeamMember ? TRUE : FALSE;
}
targetIsDecoy = FALSE;
if (targetData->curseClassStatus.status == STATUS_DECOY)
{
targetIsDecoy = TRUE;
}
return gTreatmentData[decoyAITracker][pokemonIsEnemy][targetIsEnemy][targetIsDecoy];
}
u8 sub_807167C(Entity * pokemon, Entity * target)
{
bool8 cannotUseItems;
EntityInfo * targetEntityInfo;
EntityInfo * pokemonEntityData;
pokemonEntityData = GetEntInfo(pokemon);
targetEntityInfo = GetEntInfo(target);
if (pokemonEntityData->monsterBehavior != BEHAVIOR_RESCUE_TARGET) {
cannotUseItems = IsExperienceLocked(pokemonEntityData->joinedAt.id);
if (!cannotUseItems && (pokemonEntityData->shopkeeper == SHOPKEEPER_MODE_NORMAL) && (targetEntityInfo->monsterBehavior != BEHAVIOR_RESCUE_TARGET)) {
cannotUseItems = IsExperienceLocked(targetEntityInfo->joinedAt.id);
if (cannotUseItems || (targetEntityInfo->shopkeeper != SHOPKEEPER_MODE_NORMAL)) {
error:
return TREATMENT_IGNORE;
}
else
{
if ((pokemonEntityData->isNotTeamMember) != (targetEntityInfo->isNotTeamMember)) {
return TREATMENT_TREAT_AS_ENEMY;
}
else {
return TREATMENT_TREAT_AS_ALLY;
}
}
}
}
goto error;
}

3167
src/dungeon_boss_dialogue.c Normal file

File diff suppressed because it is too large Load Diff

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