mirror of
https://github.com/pret/pmd-red.git
synced 2026-04-20 14:07:36 -05:00
Dungeon random/AI decomp + converted positions to structs (#83)
* Decomped RollPercentChance() * Decomped DungeonRandomCapped() * Decomped DungeonRandom() * Decomped FindRockItemTargets() -Added position struct.
This commit is contained in:
parent
a34c9ab91b
commit
c53bdc35f8
|
|
@ -1,120 +1,10 @@
|
|||
.include "constants/gba_constants.inc"
|
||||
.include "asm/macros.inc"
|
||||
.include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start FindRockItemTargets
|
||||
FindRockItemTargets:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
adds r5, r0, 0
|
||||
mov r10, r1
|
||||
mov r9, r2
|
||||
lsls r3, 24
|
||||
lsrs r3, 24
|
||||
mov r8, r3
|
||||
ldr r1, _08073B6C
|
||||
movs r0, 0
|
||||
str r0, [r1]
|
||||
movs r6, 0
|
||||
adds r7, r1, 0
|
||||
_08073AC0:
|
||||
ldr r0, _08073B70
|
||||
ldr r0, [r0]
|
||||
lsls r1, r6, 2
|
||||
ldr r2, _08073B74
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08073B56
|
||||
cmp r5, r4
|
||||
beq _08073B56
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl CanSee
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08073B56
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
movs r3, 0x1
|
||||
bl CanTarget
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _08073B56
|
||||
movs r3, 0x4
|
||||
ldrsh r1, [r4, r3]
|
||||
movs r2, 0x4
|
||||
ldrsh r0, [r5, r2]
|
||||
subs r2, r1, r0
|
||||
cmp r2, 0
|
||||
bge _08073B10
|
||||
negs r2, r2
|
||||
_08073B10:
|
||||
movs r3, 0x6
|
||||
ldrsh r1, [r4, r3]
|
||||
movs r3, 0x6
|
||||
ldrsh r0, [r5, r3]
|
||||
subs r1, r0
|
||||
cmp r1, 0
|
||||
bge _08073B20
|
||||
negs r1, r1
|
||||
_08073B20:
|
||||
cmp r1, r2
|
||||
bge _08073B26
|
||||
adds r1, r2, 0
|
||||
_08073B26:
|
||||
cmp r1, 0xA
|
||||
bgt _08073B56
|
||||
mov r0, r8
|
||||
cmp r0, 0
|
||||
bne _08073B44
|
||||
adds r0, r4, 0
|
||||
mov r1, r10
|
||||
movs r2, 0x1
|
||||
bl EvaluateItem
|
||||
bl RollPercentChance
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08073B56
|
||||
_08073B44:
|
||||
ldr r2, [r7]
|
||||
lsls r1, r2, 2
|
||||
add r1, r9
|
||||
ldrh r0, [r4, 0x4]
|
||||
strh r0, [r1]
|
||||
ldrh r0, [r4, 0x6]
|
||||
strh r0, [r1, 0x2]
|
||||
adds r2, 0x1
|
||||
str r2, [r7]
|
||||
_08073B56:
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x13
|
||||
ble _08073AC0
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08073B6C: .4byte gNumPotentialTargets
|
||||
_08073B70: .4byte gDungeonGlobalData
|
||||
_08073B74: .4byte 0x000135cc
|
||||
thumb_func_end FindRockItemTargets
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start TargetThrownItem
|
||||
TargetThrownItem:
|
||||
push {r4-r7,lr}
|
||||
1027
asm/code_8075BA4.s
1027
asm/code_8075BA4.s
File diff suppressed because it is too large
Load Diff
31
asm/code_808411C.s
Normal file
31
asm/code_808411C.s
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
.include "constants/gba_constants.inc"
|
||||
.include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_808411C
|
||||
sub_808411C:
|
||||
push {r4,r5,lr}
|
||||
adds r5, r0, 0
|
||||
adds r4, r1, 0
|
||||
cmp r5, r4
|
||||
beq _0808413C
|
||||
cmp r5, r4
|
||||
blt _08084134
|
||||
subs r0, r5, r4
|
||||
bl DungeonRandomCapped
|
||||
adds r0, r4
|
||||
b _0808413C
|
||||
_08084134:
|
||||
subs r0, r4, r5
|
||||
bl DungeonRandomCapped
|
||||
adds r0, r5
|
||||
_0808413C:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_808411C
|
||||
|
||||
.align 2, 0
|
||||
958
asm/code_8084160.s
Normal file
958
asm/code_8084160.s
Normal file
|
|
@ -0,0 +1,958 @@
|
|||
.include "constants/gba_constants.inc"
|
||||
.include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8084160
|
||||
sub_8084160:
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
movs r0, 0x64
|
||||
bl DungeonRandomCapped
|
||||
cmp r0, r4
|
||||
blt _08084172
|
||||
movs r0, 0
|
||||
b _08084174
|
||||
_08084172:
|
||||
movs r0, 0x1
|
||||
_08084174:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8084160
|
||||
|
||||
thumb_func_start sub_808417C
|
||||
sub_808417C:
|
||||
push {r4-r6,lr}
|
||||
adds r5, r0, 0
|
||||
lsls r2, 24
|
||||
lsrs r6, r2, 24
|
||||
movs r2, 0
|
||||
ldrsh r0, [r1, r2]
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r1, r2]
|
||||
bl sub_808411C
|
||||
adds r4, r0, 0
|
||||
adds r0, r5, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080841DC
|
||||
adds r0, r5, 0
|
||||
bl GetEntityType
|
||||
cmp r0, 0x1
|
||||
bne _080841DC
|
||||
cmp r6, 0
|
||||
beq _080841DC
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x12
|
||||
bl HasIQSkill
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080841C4
|
||||
cmp r4, 0x7F
|
||||
beq _080841C4
|
||||
lsrs r0, r4, 31
|
||||
adds r0, r4, r0
|
||||
asrs r4, r0, 1
|
||||
_080841C4:
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x14
|
||||
bl HasAbility
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080841DC
|
||||
cmp r4, 0x7F
|
||||
beq _080841DC
|
||||
cmp r4, 0x4
|
||||
ble _080841DC
|
||||
movs r4, 0x5
|
||||
_080841DC:
|
||||
cmp r4, 0
|
||||
bgt _080841E2
|
||||
movs r4, 0x1
|
||||
_080841E2:
|
||||
adds r0, r4, 0
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_808417C
|
||||
|
||||
thumb_func_start sub_80841EC
|
||||
sub_80841EC:
|
||||
push {r4-r6,lr}
|
||||
mov r6, r8
|
||||
push {r6}
|
||||
sub sp, 0xC4
|
||||
add r0, sp, 0x60
|
||||
mov r8, r0
|
||||
movs r1, 0
|
||||
movs r2, 0x60
|
||||
bl memset
|
||||
movs r0, 0x6
|
||||
str r0, [sp, 0x64]
|
||||
add r1, sp, 0x68
|
||||
movs r6, 0
|
||||
movs r0, 0x4
|
||||
strh r0, [r1]
|
||||
movs r2, 0x3
|
||||
strh r2, [r1, 0x2]
|
||||
add r1, sp, 0x6C
|
||||
movs r0, 0x16
|
||||
strh r0, [r1]
|
||||
mov r0, sp
|
||||
adds r0, 0x6E
|
||||
movs r5, 0xE
|
||||
movs r1, 0xE
|
||||
strh r1, [r0]
|
||||
add r0, sp, 0x70
|
||||
strh r1, [r0]
|
||||
add r4, sp, 0xC0
|
||||
str r4, [sp, 0x74]
|
||||
str r2, [sp, 0x7C]
|
||||
add r0, sp, 0x90
|
||||
str r2, [r0, 0x4]
|
||||
add r0, sp, 0xA8
|
||||
str r2, [r0, 0x4]
|
||||
mov r0, sp
|
||||
mov r1, r8
|
||||
movs r2, 0x60
|
||||
bl memcpy
|
||||
movs r0, 0x1
|
||||
strb r0, [r4]
|
||||
strb r6, [r4, 0x1]
|
||||
strb r5, [r4, 0x2]
|
||||
strb r6, [r4, 0x3]
|
||||
mov r1, sp
|
||||
movs r0, 0x14
|
||||
strh r0, [r1, 0xA]
|
||||
mov r0, sp
|
||||
movs r1, 0x1
|
||||
bl sub_803ECB4
|
||||
ldr r0, _0808426C
|
||||
ldr r0, [r0]
|
||||
ldr r1, _08084270
|
||||
adds r0, r1
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
ldr r0, _08084274
|
||||
cmp r1, r0
|
||||
ble _08084278
|
||||
bl sub_8083DE0
|
||||
b _0808427C
|
||||
.align 2, 0
|
||||
_0808426C: .4byte gDungeonGlobalData
|
||||
_08084270: .4byte 0x0001ceac
|
||||
_08084274: .4byte 0x00000225
|
||||
_08084278:
|
||||
bl sub_8083D98
|
||||
_0808427C:
|
||||
ldr r0, _080842B8
|
||||
ldr r1, [r0]
|
||||
ldr r0, _080842BC
|
||||
ldr r2, [r0]
|
||||
ldr r0, _080842C0
|
||||
adds r2, r0
|
||||
movs r0, 0
|
||||
bl sub_8094558
|
||||
mov r4, sp
|
||||
_08084290:
|
||||
movs r0, 0x36
|
||||
bl sub_803E668
|
||||
bl sub_8083F58
|
||||
ldrh r1, [r4, 0xA]
|
||||
movs r2, 0xA
|
||||
ldrsh r0, [r4, r2]
|
||||
cmp r0, 0x3
|
||||
ble _080842C4
|
||||
subs r0, r1, 0x1
|
||||
strh r0, [r4, 0xA]
|
||||
movs r0, 0xA0
|
||||
strb r0, [r4]
|
||||
mov r0, sp
|
||||
movs r1, 0x1
|
||||
bl sub_803ECB4
|
||||
b _08084290
|
||||
.align 2, 0
|
||||
_080842B8: .4byte gUnknown_80FE6E8
|
||||
_080842BC: .4byte gDungeonGlobalData
|
||||
_080842C0: .4byte 0x0001ce98
|
||||
_080842C4:
|
||||
bl sub_8094D14
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080842DA
|
||||
ldr r0, _080842EC
|
||||
ldrh r1, [r0, 0x2]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08084290
|
||||
_080842DA:
|
||||
bl sub_8083D08
|
||||
add sp, 0xC4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_080842EC: .4byte gRealInputs
|
||||
thumb_func_end sub_80841EC
|
||||
|
||||
thumb_func_start sub_80842F0
|
||||
sub_80842F0:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
ldr r1, _0808436C
|
||||
ldr r0, [r1]
|
||||
ldr r2, _08084370
|
||||
adds r0, r2
|
||||
movs r2, 0
|
||||
strb r2, [r0]
|
||||
ldr r0, [r1]
|
||||
ldr r3, _08084374
|
||||
adds r0, r3
|
||||
strb r2, [r0]
|
||||
ldr r0, [r1]
|
||||
movs r5, 0xCF
|
||||
lsls r5, 3
|
||||
adds r0, r5
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x2
|
||||
bne _080843AE
|
||||
movs r6, 0
|
||||
ldr r0, _08084378
|
||||
mov r8, r0
|
||||
movs r7, 0x1
|
||||
_08084320:
|
||||
lsls r0, r6, 24
|
||||
lsrs r0, 24
|
||||
bl sub_8096AB4
|
||||
adds r4, r0, 0
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0x6
|
||||
bne _080843A8
|
||||
ldr r3, _0808436C
|
||||
ldr r5, [r3]
|
||||
ldr r1, _0808437C
|
||||
adds r0, r5, r1
|
||||
ldrh r0, [r0]
|
||||
ldrh r2, [r4, 0x4]
|
||||
mov r1, r8
|
||||
ands r1, r0
|
||||
mov r0, r8
|
||||
ands r0, r2
|
||||
cmp r1, r0
|
||||
bne _080843A8
|
||||
ldrb r0, [r4, 0x1]
|
||||
cmp r0, 0x3
|
||||
beq _080843A8
|
||||
cmp r0, 0x4
|
||||
bne _08084380
|
||||
ldrb r1, [r4, 0x10]
|
||||
ldr r2, _08084374
|
||||
adds r0, r5, r2
|
||||
strb r1, [r0]
|
||||
ldr r2, [r3]
|
||||
ldrh r1, [r4, 0xE]
|
||||
movs r3, 0xD1
|
||||
lsls r3, 3
|
||||
adds r0, r2, r3
|
||||
strh r1, [r0]
|
||||
strb r7, [r2, 0x9]
|
||||
b _080843A8
|
||||
.align 2, 0
|
||||
_0808436C: .4byte gDungeonGlobalData
|
||||
_08084370: .4byte 0x00000677
|
||||
_08084374: .4byte 0x0000068a
|
||||
_08084378: .4byte 0x0000ffff
|
||||
_0808437C: .4byte 0x00000644
|
||||
_08084380:
|
||||
cmp r0, 0
|
||||
beq _0808438C
|
||||
cmp r0, 0x2
|
||||
beq _0808438C
|
||||
cmp r0, 0x1
|
||||
bne _080843A8
|
||||
_0808438C:
|
||||
ldr r2, [r3]
|
||||
ldrh r0, [r4, 0xE]
|
||||
movs r5, 0xD1
|
||||
lsls r5, 3
|
||||
adds r1, r2, r5
|
||||
strh r0, [r1]
|
||||
ldrb r0, [r4, 0x1]
|
||||
cmp r0, 0x2
|
||||
bne _080843A4
|
||||
ldr r1, _080843B8
|
||||
adds r0, r2, r1
|
||||
strb r7, [r0]
|
||||
_080843A4:
|
||||
ldr r0, [r3]
|
||||
strb r7, [r0, 0x9]
|
||||
_080843A8:
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x7
|
||||
ble _08084320
|
||||
_080843AE:
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_080843B8: .4byte 0x00000677
|
||||
thumb_func_end sub_80842F0
|
||||
|
||||
thumb_func_start sub_80843BC
|
||||
sub_80843BC:
|
||||
push {r4-r6,lr}
|
||||
lsls r0, 16
|
||||
asrs r6, r0, 16
|
||||
movs r4, 0
|
||||
ldr r5, _08084418
|
||||
_080843C6:
|
||||
lsls r0, r4, 24
|
||||
lsrs r0, 24
|
||||
bl sub_8096AB4
|
||||
adds r3, r0, 0
|
||||
ldrb r0, [r3]
|
||||
cmp r0, 0x6
|
||||
bne _0808440C
|
||||
ldr r0, _0808441C
|
||||
ldr r0, [r0]
|
||||
ldr r1, _08084420
|
||||
adds r0, r1
|
||||
ldrh r0, [r0]
|
||||
ldrh r2, [r3, 0x4]
|
||||
adds r1, r5, 0
|
||||
ands r1, r0
|
||||
adds r0, r5, 0
|
||||
ands r0, r2
|
||||
cmp r1, r0
|
||||
bne _0808440C
|
||||
ldrb r0, [r3, 0x1]
|
||||
cmp r0, 0
|
||||
beq _08084400
|
||||
cmp r0, 0x4
|
||||
beq _08084400
|
||||
cmp r0, 0x2
|
||||
beq _08084400
|
||||
cmp r0, 0x1
|
||||
bne _0808440C
|
||||
_08084400:
|
||||
movs r1, 0xE
|
||||
ldrsh r0, [r3, r1]
|
||||
cmp r6, r0
|
||||
bne _0808440C
|
||||
movs r0, 0x8
|
||||
strb r0, [r3]
|
||||
_0808440C:
|
||||
adds r4, 0x1
|
||||
cmp r4, 0x7
|
||||
ble _080843C6
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08084418: .4byte 0x0000ffff
|
||||
_0808441C: .4byte gDungeonGlobalData
|
||||
_08084420: .4byte 0x00000644
|
||||
thumb_func_end sub_80843BC
|
||||
|
||||
thumb_func_start sub_8084424
|
||||
sub_8084424:
|
||||
push {r4,lr}
|
||||
movs r4, 0
|
||||
_08084428:
|
||||
lsls r0, r4, 24
|
||||
lsrs r0, 24
|
||||
bl sub_8096AB4
|
||||
adds r1, r0, 0
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0x8
|
||||
bne _0808443C
|
||||
movs r0, 0x9
|
||||
strb r0, [r1]
|
||||
_0808443C:
|
||||
adds r4, 0x1
|
||||
cmp r4, 0x7
|
||||
ble _08084428
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8084424
|
||||
|
||||
thumb_func_start sub_8084448
|
||||
sub_8084448:
|
||||
push {r4-r7,lr}
|
||||
adds r5, r0, 0
|
||||
ldr r7, [r5, 0x70]
|
||||
ldr r4, _0808447C
|
||||
bl GetLeaderEntity
|
||||
adds r1, r0, 0
|
||||
adds r0, r4, 0
|
||||
movs r2, 0
|
||||
bl SetMessageArgument
|
||||
adds r4, 0x50
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0
|
||||
bl SetMessageArgument
|
||||
adds r0, r5, 0
|
||||
bl sub_8070BC0
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08084484
|
||||
ldr r0, _08084480
|
||||
b _080844F0
|
||||
.align 2, 0
|
||||
_0808447C: .4byte gAvailablePokemonNames
|
||||
_08084480: .4byte gUnknown_80FA464
|
||||
_08084484:
|
||||
ldr r4, _080844FC
|
||||
ldr r0, [r4]
|
||||
ldr r6, _08084500
|
||||
adds r0, r6
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08084540
|
||||
ldr r0, _08084504
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0x1
|
||||
bl sub_8052B8C
|
||||
cmp r0, 0x1
|
||||
beq _080844A4
|
||||
b _080845D4
|
||||
_080844A4:
|
||||
ldr r0, _08084508
|
||||
ldr r1, [r4]
|
||||
adds r1, r6
|
||||
ldrb r1, [r1]
|
||||
movs r2, 0
|
||||
bl sub_8090DC4
|
||||
movs r3, 0
|
||||
ldr r0, _0808450C
|
||||
adds r6, r0, 0
|
||||
ldr r2, [r6]
|
||||
_080844BA:
|
||||
ldrb r1, [r2]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080844E2
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _080844E2
|
||||
movs r0, 0x18
|
||||
ands r0, r1
|
||||
cmp r0, 0x18
|
||||
beq _080844E2
|
||||
ldr r0, [r4]
|
||||
ldr r1, _08084500
|
||||
adds r0, r1
|
||||
ldrb r1, [r2, 0x2]
|
||||
ldrb r0, [r0]
|
||||
cmp r1, r0
|
||||
beq _080844EA
|
||||
_080844E2:
|
||||
adds r2, 0x4
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x13
|
||||
ble _080844BA
|
||||
_080844EA:
|
||||
cmp r3, 0x14
|
||||
bne _08084514
|
||||
ldr r0, _08084510
|
||||
_080844F0:
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0x1
|
||||
bl PrintFieldMessage
|
||||
b _080845D4
|
||||
.align 2, 0
|
||||
_080844FC: .4byte gDungeonGlobalData
|
||||
_08084500: .4byte 0x0000068a
|
||||
_08084504: .4byte gUnknown_80FA32C
|
||||
_08084508: .4byte gUnknown_202DE58
|
||||
_0808450C: .4byte gTeamInventory_203B460
|
||||
_08084510: .4byte gUnknown_80FA448
|
||||
_08084514:
|
||||
lsls r1, r3, 2
|
||||
ldr r0, [r6]
|
||||
adds r1, r0
|
||||
movs r0, 0
|
||||
strb r0, [r1, 0x2]
|
||||
strb r0, [r1, 0x1]
|
||||
strb r0, [r1]
|
||||
bl FillInventoryGaps
|
||||
ldr r0, _08084538
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0x1
|
||||
bl PrintFieldMessage
|
||||
ldr r0, _0808453C
|
||||
b _0808455E
|
||||
.align 2, 0
|
||||
_08084538: .4byte gUnknown_80FA2B0
|
||||
_0808453C: .4byte gUnknown_80FA370
|
||||
_08084540:
|
||||
ldr r0, _080845B0
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0x1
|
||||
bl sub_8052B8C
|
||||
cmp r0, 0x1
|
||||
bne _080845D4
|
||||
ldr r0, _080845B4
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0x1
|
||||
bl PrintFieldMessage
|
||||
ldr r0, _080845B8
|
||||
_0808455E:
|
||||
ldr r4, [r0]
|
||||
movs r1, 0x2
|
||||
ldrsh r0, [r7, r1]
|
||||
bl sub_80843BC
|
||||
adds r0, r5, 0x4
|
||||
bl sub_8042A34
|
||||
movs r1, 0x87
|
||||
lsls r1, 2
|
||||
adds r0, r5, 0
|
||||
movs r2, 0
|
||||
bl sub_8068FE0
|
||||
movs r0, 0x1
|
||||
bl sub_804178C
|
||||
ldr r5, _080845BC
|
||||
_08084582:
|
||||
movs r0, 0
|
||||
adds r1, r4, 0
|
||||
movs r2, 0x1
|
||||
bl sub_8052B8C
|
||||
cmp r0, 0x1
|
||||
bne _080845C4
|
||||
ldr r0, _080845C0
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0
|
||||
bl sub_8052B8C
|
||||
adds r1, r0, 0
|
||||
cmp r1, 0x1
|
||||
bne _08084582
|
||||
ldr r0, [r5]
|
||||
strb r1, [r0, 0x4]
|
||||
ldr r1, [r5]
|
||||
movs r0, 0x2
|
||||
strb r0, [r1, 0x11]
|
||||
b _080845D4
|
||||
.align 2, 0
|
||||
_080845B0: .4byte gUnknown_80FA2F0
|
||||
_080845B4: .4byte gUnknown_80FA260
|
||||
_080845B8: .4byte gUnknown_80FA36C
|
||||
_080845BC: .4byte gDungeonGlobalData
|
||||
_080845C0: .4byte gUnknown_80FA394
|
||||
_080845C4:
|
||||
ldr r0, _080845DC
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0
|
||||
bl sub_8052B8C
|
||||
cmp r0, 0x1
|
||||
bne _08084582
|
||||
_080845D4:
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_080845DC: .4byte gUnknown_80FA3B8
|
||||
thumb_func_end sub_8084448
|
||||
|
||||
thumb_func_start sub_80845E0
|
||||
sub_80845E0:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
adds r6, r0, 0
|
||||
ldr r0, [r6, 0x70]
|
||||
mov r8, r0
|
||||
movs r7, 0
|
||||
movs r1, 0
|
||||
mov r9, r1
|
||||
ldr r4, _08084620
|
||||
bl GetLeaderEntity
|
||||
adds r1, r0, 0
|
||||
adds r0, r4, 0
|
||||
movs r2, 0
|
||||
bl SetMessageArgument
|
||||
adds r4, 0x50
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
movs r2, 0
|
||||
bl SetMessageArgument
|
||||
adds r0, r6, 0
|
||||
bl sub_8070BC0
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08084630
|
||||
ldr r0, _08084624
|
||||
b _080846B4
|
||||
.align 2, 0
|
||||
_08084620: .4byte gAvailablePokemonNames
|
||||
_08084624: .4byte gUnknown_80FA530
|
||||
_08084628:
|
||||
adds r7, r4, 0
|
||||
ldr r2, [r7, 0x70]
|
||||
mov r9, r2
|
||||
b _08084674
|
||||
_08084630:
|
||||
movs r5, 0
|
||||
_08084632:
|
||||
ldr r0, _08084660
|
||||
ldr r0, [r0]
|
||||
lsls r1, r5, 2
|
||||
ldr r2, _08084664
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0808466E
|
||||
ldr r0, [r4, 0x70]
|
||||
adds r0, 0x40
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x4A
|
||||
beq _0808465A
|
||||
cmp r0, 0x47
|
||||
bne _08084668
|
||||
_0808465A:
|
||||
movs r0, 0x1
|
||||
b _0808466A
|
||||
.align 2, 0
|
||||
_08084660: .4byte gDungeonGlobalData
|
||||
_08084664: .4byte 0x0001357c
|
||||
_08084668:
|
||||
movs r0, 0
|
||||
_0808466A:
|
||||
cmp r0, 0
|
||||
bne _08084628
|
||||
_0808466E:
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x3
|
||||
ble _08084632
|
||||
_08084674:
|
||||
cmp r7, 0
|
||||
bne _08084680
|
||||
ldr r0, _0808467C
|
||||
b _080846B4
|
||||
.align 2, 0
|
||||
_0808467C: .4byte gUnknown_80FA52C
|
||||
_08084680:
|
||||
ldr r0, _0808469C
|
||||
adds r1, r7, 0
|
||||
movs r2, 0
|
||||
bl SetMessageArgument
|
||||
adds r0, r7, 0
|
||||
bl sub_8070BC0
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080846A4
|
||||
ldr r0, _080846A0
|
||||
b _080846B4
|
||||
.align 2, 0
|
||||
_0808469C: .4byte gUnknown_202E038
|
||||
_080846A0: .4byte gUnknown_80FA54C
|
||||
_080846A4:
|
||||
adds r0, r6, 0
|
||||
adds r1, r7, 0
|
||||
bl CanSee
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080846C4
|
||||
ldr r0, _080846C0
|
||||
_080846B4:
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0x1
|
||||
bl PrintFieldMessage
|
||||
b _08084768
|
||||
.align 2, 0
|
||||
_080846C0: .4byte gUnknown_80FA500
|
||||
_080846C4:
|
||||
ldr r0, _08084744
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0x1
|
||||
bl PrintFieldMessage
|
||||
mov r1, r8
|
||||
movs r2, 0x2
|
||||
ldrsh r0, [r1, r2]
|
||||
bl sub_80843BC
|
||||
ldr r5, _08084748
|
||||
ldr r0, [r5]
|
||||
ldr r1, _0808474C
|
||||
adds r0, r1
|
||||
ldrb r1, [r0]
|
||||
mov r0, r9
|
||||
adds r0, 0x40
|
||||
strb r1, [r0]
|
||||
adds r0, r6, 0x4
|
||||
bl sub_8042A34
|
||||
adds r0, r7, 0x4
|
||||
bl sub_8042A34
|
||||
movs r4, 0x87
|
||||
lsls r4, 2
|
||||
adds r0, r6, 0
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
bl sub_8068FE0
|
||||
adds r0, r7, 0
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
bl sub_8068FE0
|
||||
movs r0, 0x1
|
||||
bl sub_804178C
|
||||
ldr r4, _08084750
|
||||
_08084716:
|
||||
movs r0, 0
|
||||
ldr r1, [r4]
|
||||
movs r2, 0x1
|
||||
bl sub_8052B8C
|
||||
cmp r0, 0x1
|
||||
bne _08084758
|
||||
ldr r0, _08084754
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0
|
||||
bl sub_8052B8C
|
||||
adds r1, r0, 0
|
||||
cmp r1, 0x1
|
||||
bne _08084716
|
||||
ldr r0, [r5]
|
||||
strb r1, [r0, 0x4]
|
||||
ldr r1, [r5]
|
||||
movs r0, 0x2
|
||||
strb r0, [r1, 0x11]
|
||||
b _08084768
|
||||
.align 2, 0
|
||||
_08084744: .4byte gUnknown_80FA4D4
|
||||
_08084748: .4byte gDungeonGlobalData
|
||||
_0808474C: .4byte 0x00000644
|
||||
_08084750: .4byte gUnknown_80FA4D8
|
||||
_08084754: .4byte gUnknown_80FA394
|
||||
_08084758:
|
||||
ldr r0, _08084774
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0
|
||||
bl sub_8052B8C
|
||||
cmp r0, 0x1
|
||||
bne _08084716
|
||||
_08084768:
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08084774: .4byte gUnknown_80FA3B8
|
||||
thumb_func_end sub_80845E0
|
||||
|
||||
thumb_func_start sub_8084778
|
||||
sub_8084778:
|
||||
push {r4,lr}
|
||||
ldr r0, _080847B8
|
||||
ldr r1, _080847BC
|
||||
bl strcpy
|
||||
movs r4, 0
|
||||
_08084784:
|
||||
lsls r0, r4, 24
|
||||
lsrs r0, 24
|
||||
bl sub_8096AB4
|
||||
adds r1, r0, 0
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0x6
|
||||
bne _080847C8
|
||||
ldr r0, _080847C0
|
||||
ldr r0, [r0]
|
||||
ldr r2, _080847C4
|
||||
adds r0, r2
|
||||
ldrb r0, [r0]
|
||||
ldrb r2, [r1, 0x4]
|
||||
cmp r0, r2
|
||||
bne _080847C8
|
||||
ldrb r0, [r1, 0x1]
|
||||
cmp r0, 0x2
|
||||
bne _080847C8
|
||||
movs r0, 0xE
|
||||
ldrsh r1, [r1, r0]
|
||||
ldr r0, _080847B8
|
||||
bl CopyCyanSpeciesNametoBuffer
|
||||
b _080847CE
|
||||
.align 2, 0
|
||||
_080847B8: .4byte gUnknown_202E088
|
||||
_080847BC: .4byte gUnknown_8107224
|
||||
_080847C0: .4byte gDungeonGlobalData
|
||||
_080847C4: .4byte 0x00000644
|
||||
_080847C8:
|
||||
adds r4, 0x1
|
||||
cmp r4, 0x7
|
||||
ble _08084784
|
||||
_080847CE:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8084778
|
||||
|
||||
thumb_func_start sub_80847D4
|
||||
sub_80847D4:
|
||||
push {r4,r5,lr}
|
||||
ldr r2, _08084820
|
||||
ldr r0, [r2]
|
||||
ldr r1, _08084824
|
||||
adds r0, r1
|
||||
movs r1, 0
|
||||
strb r1, [r0]
|
||||
ldr r0, [r2]
|
||||
ldr r2, _08084828
|
||||
adds r0, r2
|
||||
strb r1, [r0]
|
||||
bl sub_8040A84
|
||||
movs r4, 0
|
||||
ldr r0, _0808482C
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08084846
|
||||
movs r3, 0
|
||||
_080847FA:
|
||||
ldr r0, _08084820
|
||||
ldr r0, [r0]
|
||||
ldr r5, _08084830
|
||||
adds r0, r5
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
adds r0, r1, 0
|
||||
subs r0, 0x1C
|
||||
cmp r0, 0x15
|
||||
bhi _08084810
|
||||
movs r1, 0x1B
|
||||
_08084810:
|
||||
ldr r2, _0808482C
|
||||
adds r0, r3, r2
|
||||
ldrb r5, [r0]
|
||||
cmp r1, r5
|
||||
bne _08084834
|
||||
bl sub_8084854
|
||||
b _08084846
|
||||
.align 2, 0
|
||||
_08084820: .4byte gDungeonGlobalData
|
||||
_08084824: .4byte 0x00003a0d
|
||||
_08084828: .4byte 0x0001356c
|
||||
_0808482C: .4byte gUnknown_8107234
|
||||
_08084830: .4byte 0x00003a14
|
||||
_08084834:
|
||||
adds r3, 0x8
|
||||
adds r4, 0x1
|
||||
ldr r0, _08084850
|
||||
cmp r4, r0
|
||||
bgt _08084846
|
||||
adds r0, r3, r2
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _080847FA
|
||||
_08084846:
|
||||
bl sub_8097FF8
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08084850: .4byte 0x000003e6
|
||||
thumb_func_end sub_80847D4
|
||||
|
||||
thumb_func_start sub_8084854
|
||||
sub_8084854:
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r5, _08084874
|
||||
ldr r2, [r5]
|
||||
movs r1, 0xCF
|
||||
lsls r1, 3
|
||||
adds r0, r2, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0808487C
|
||||
ldrb r1, [r4, 0x5]
|
||||
ldr r3, _08084878
|
||||
adds r0, r2, r3
|
||||
strb r1, [r0]
|
||||
b _080848C8
|
||||
.align 2, 0
|
||||
_08084874: .4byte gDungeonGlobalData
|
||||
_08084878: .4byte 0x00003a0d
|
||||
_0808487C:
|
||||
ldrb r0, [r4, 0x4]
|
||||
bl sub_8098100
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08084898
|
||||
ldr r0, [r5]
|
||||
ldrb r1, [r4, 0x5]
|
||||
ldr r2, _08084894
|
||||
adds r0, r2
|
||||
strb r1, [r0]
|
||||
b _080848C8
|
||||
.align 2, 0
|
||||
_08084894: .4byte 0x00003a0d
|
||||
_08084898:
|
||||
ldrb r0, [r4, 0x2]
|
||||
bl sub_8098100
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080848B4
|
||||
ldr r0, [r5]
|
||||
ldrb r1, [r4, 0x3]
|
||||
ldr r3, _080848B0
|
||||
adds r0, r3
|
||||
strb r1, [r0]
|
||||
b _080848C8
|
||||
.align 2, 0
|
||||
_080848B0: .4byte 0x00003a0d
|
||||
_080848B4:
|
||||
ldr r0, [r5]
|
||||
ldrb r1, [r4, 0x1]
|
||||
ldr r2, _080848E0
|
||||
adds r0, r2
|
||||
strb r1, [r0]
|
||||
ldrb r0, [r4, 0x2]
|
||||
cmp r0, 0x40
|
||||
beq _080848C8
|
||||
bl sub_8097FA8
|
||||
_080848C8:
|
||||
ldr r0, _080848E4
|
||||
ldr r0, [r0]
|
||||
ldr r3, _080848E8
|
||||
adds r0, r3
|
||||
movs r1, 0x1
|
||||
strb r1, [r0]
|
||||
movs r0, 0
|
||||
bl sub_807E5E4
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_080848E0: .4byte 0x00003a0d
|
||||
_080848E4: .4byte gDungeonGlobalData
|
||||
_080848E8: .4byte 0x00000675
|
||||
thumb_func_end sub_8084854
|
||||
|
||||
.align 2,0
|
||||
|
|
@ -2,10 +2,13 @@
|
|||
#define GUARD_DUNGEON_AI_ITEMS_H
|
||||
|
||||
#include "dungeon_entity.h"
|
||||
#include "map.h"
|
||||
|
||||
// 0x73658
|
||||
void DecideUseItem(struct DungeonEntity *pokemon);
|
||||
// 0x739DC
|
||||
void FindStraightThrowableTargets(struct DungeonEntity* pokemon, s32 thrownAIFlag, struct ItemSlot* item, bool8 ignoreRollChance);
|
||||
void FindStraightThrowableTargets(struct DungeonEntity *pokemon, s32 thrownAIFlag, struct ItemSlot *item, bool8 ignoreRollChance);
|
||||
// 0x73AA0
|
||||
void FindRockItemTargets(struct DungeonEntity *pokemon, struct ItemSlot *item, struct Position potentialTargets[], bool8 ignoreRollChance);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#ifndef GUARD_DUNGEON_ENTITY_H
|
||||
#define GUARD_DUNGEON_ENTITY_H
|
||||
|
||||
#include "item.h"
|
||||
#include "constants/move.h"
|
||||
#include "item.h"
|
||||
#include "map.h"
|
||||
|
||||
struct DungeonActionContainer
|
||||
{
|
||||
|
|
@ -13,8 +14,7 @@ struct DungeonActionContainer
|
|||
/* 0x4 */ u8 actionUseIndex;
|
||||
u8 fill5[0x8 - 0x5];
|
||||
// Position of the Pokémon the last time it threw an item.
|
||||
/* 0x8 */ s16 lastItemThrowPositionX;
|
||||
/* 0xA */ s16 lastItemThrowPositionY;
|
||||
/* 0x8 */ struct Position lastItemThrowPosition;
|
||||
u8 unkC;
|
||||
};
|
||||
|
||||
|
|
@ -68,21 +68,17 @@ struct DungeonEntityData
|
|||
/* 0x44 */ struct DungeonActionContainer action;
|
||||
u8 fill55[0x58 - 0x55];
|
||||
// Position of the target that the Pokémon wants throw an item at.
|
||||
/* 0x58 */ s16 *itemTargetPosition;
|
||||
/* 0x58 */ struct Position itemTargetPosition;
|
||||
/* 0x5C */ u8 type1;
|
||||
/* 0x5D */ u8 type2;
|
||||
/* 0x5E */ u8 ability1;
|
||||
/* 0x5F */ u8 ability2;
|
||||
/* 0x60 */ struct ItemSlot heldItem;
|
||||
u8 fill64[0x68 - 0x64];
|
||||
/* 0x68 */ s16 previousPosition1X;
|
||||
/* 0x6A */ s16 previousPosition1Y;
|
||||
/* 0x6C */ s16 previousPosition2X;
|
||||
/* 0x6E */ s16 previousPosition2Y;
|
||||
/* 0x70 */ s16 previousPosition3X;
|
||||
/* 0x72 */ s16 previousPosition3Y;
|
||||
/* 0x74 */ s16 previousPosition4X;
|
||||
/* 0x76 */ s16 previousPosition4Y;
|
||||
/* 0x68 */ struct Position previousPosition1;
|
||||
/* 0x6C */ struct Position previousPosition2;
|
||||
/* 0x70 */ struct Position previousPosition3;
|
||||
/* 0x74 */ struct Position previousPosition4;
|
||||
/* 0x78 */ u8 movementAction;
|
||||
/* 0x79 */ bool8 notAdjacentToTarget;
|
||||
/* 0x7A */ bool8 hasTarget;
|
||||
|
|
@ -91,8 +87,7 @@ struct DungeonEntityData
|
|||
u8 fill7E[0x80 - 0x7E];
|
||||
/* 0x80 */ u32 targetPokemon;
|
||||
u8 fill84[0x88 - 0x84];
|
||||
/* 0x88 */ s16 targetMovePositionX;
|
||||
/* 0x8A */ s16 targetMovePositionY;
|
||||
/* 0x88 */ struct Position targetMovePosition;
|
||||
// Bitwise flags corresponding to selected IQ skills.
|
||||
/* 0x8C */ u8 IQSkillsSelected[4]; // IQ skills selected in the IQ skills menu.
|
||||
/* 0x90 */ u8 IQSkillsEnabled[4];
|
||||
|
|
@ -200,22 +195,17 @@ struct DungeonEntityData
|
|||
u8 unk15E;
|
||||
u8 unk15F;
|
||||
u8 fill160[0x16C - 0x160];
|
||||
/* 0x16C */ s16 targetPositionX;
|
||||
/* 0x16E */ s16 targetPositionY;
|
||||
/* 0x170 */ s16 posPixelX;
|
||||
/* 0x172 */ s16 posPixelY;
|
||||
/* 0x16C */ struct Position targetPosition;
|
||||
/* 0x170 */ struct Position posPixel;
|
||||
u32 unk174;
|
||||
u8 fill178[0x184 - 0x178];
|
||||
// Previous value of targetPosition for movement, 1 and 2 moves ago.
|
||||
/* 0x184 */ s16 previousTargetMovePosition1X;
|
||||
/* 0x186 */ s16 previousTargetMovePosition1Y;
|
||||
/* 0x188 */ s32 previousTargetMovePosition2X;
|
||||
/* 0x18C */ s32 previousTargetMovePosition2Y;
|
||||
/* 0x184 */ struct Position previousTargetMovePosition1;
|
||||
/* 0x188 */ struct Position32 previousTargetMovePosition2;
|
||||
/* 0x190 */ u8 lastMoveDirection; // The last direction that the Pokémon moved in.
|
||||
u8 fill191[0x194 - 0x191];
|
||||
// Number of tiles that the Pokémon moved last, multiplied by 0x100.
|
||||
/* 0x194 */ s32 lastMoveIncrementX;
|
||||
/* 0x198 */ s32 lastMoveIncrementY;
|
||||
/* 0x194 */ struct Position32 lastMoveIncrement;
|
||||
/* 0x19C */ u8 walkAnimationCounter; // Set when the Pokémon starts moving, and counts down until the Pokémon's walk animation stops.
|
||||
u8 fill19D[0x1F4 - 0x19D];
|
||||
/* 0x1F4 */ u8 numMoveTiles; // Number of tiles to move in a turn. Can be greater than 1 if the user's movement speed is boosted.
|
||||
|
|
@ -232,16 +222,12 @@ struct DungeonEntityData
|
|||
struct DungeonEntity
|
||||
{
|
||||
/* 0x0 */ u32 entityType;
|
||||
/* 0x4 */ s16 posWorldX;
|
||||
/* 0x6 */ s16 posWorldY;
|
||||
/* 0x8 */ s16 prevPosWorldX;
|
||||
/* 0xA */ s16 prevPosWorldY;
|
||||
/* 0x4 */ struct Position posWorld;
|
||||
/* 0x8 */ struct Position prevPosWorld;
|
||||
// The center of the entity acccording to pixel-space coordinates, using the same origin as posWorld.
|
||||
// X = (posWorld * 24 + 16) * 256, while Y = (posWorld * 24 + 12) * 256.
|
||||
/* 0xC */ s32 posPixelX;
|
||||
/* 0x10 */ s32 posPixelY;
|
||||
/* 0x14 */ s32 prevPosPixelX;
|
||||
/* 0x18 */ s32 prevPosPixelY;
|
||||
/* 0xC */ struct Position32 posPixel;
|
||||
/* 0x14 */ struct Position32 prevPosPixel;
|
||||
u8 fill1C[0x20 - 0x1C];
|
||||
/* 0x20 */ bool8 visible; // Turned off when a Pokémon faints.
|
||||
u8 fill21[0x25 - 0x21];
|
||||
|
|
@ -259,11 +245,9 @@ struct DungeonEntity
|
|||
/* 0x2C */ u16 spriteAnimationIndex;
|
||||
/* 0x2E */ u16 spriteAnimationCounter2;
|
||||
// The position of the sprite within the tile. The animation may change the position slightly.
|
||||
/* 0x30 */ u16 spritePosX;
|
||||
/* 0x32 */ u16 spritePosY;
|
||||
/* 0x30 */ struct Position spritePos;
|
||||
// Offset of the sprite from its position at the start of the animation. Changes alongside spritePos.
|
||||
/* 0x34 */ s16 spritePosOffsetX;
|
||||
/* 0x36 */ s16 spritePosOffsetY;
|
||||
/* 0x34 */ struct Position spritePosOffset;
|
||||
u8 fill38[0x48 - 0x38];
|
||||
// The sprite index to display, among the Pokémon's possible sprites.
|
||||
/* 0x48 */ u16 spriteIndexForEntity;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ struct DungeonGlobalData
|
|||
u8 fill10364[0x10844 - 0x10364];
|
||||
/* 0x10844 */ u16 numRoomExits[MAX_ROOM_COUNT];
|
||||
u8 fill10874[0x10884 - 0x10874];
|
||||
/* 0x10884 */ struct RoomExit roomExits[MAX_ROOM_COUNT][32]; // Arrays of room exits for each room.
|
||||
/* 0x10884 */ struct Position roomExits[MAX_ROOM_COUNT][32]; // Arrays of room exits for each room.
|
||||
u8 fill11444[0x1356C - 0x11484];
|
||||
u8 unk1356C;
|
||||
u8 fill1356D[0x1357C - 0x1356D];
|
||||
|
|
|
|||
9
include/dungeon_random.h
Normal file
9
include/dungeon_random.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef GUARD_DUNGEON_RANDOM_H
|
||||
#define GUARD_DUNGEON_RANDOM_H
|
||||
|
||||
// 0x840E8
|
||||
s32 DungeonRandom(void);
|
||||
// 0x84100
|
||||
s32 DungeonRandomCapped(s32 cap);
|
||||
|
||||
#endif
|
||||
7
include/dungeon_random_1.h
Normal file
7
include/dungeon_random_1.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef GUARD_DUNGEON_RANDOM_1_H
|
||||
#define GUARD_DUNGEON_RANDOM_1_H
|
||||
|
||||
// 0x84144
|
||||
bool8 RollPercentChance(s32 percentChance);
|
||||
|
||||
#endif
|
||||
|
|
@ -25,23 +25,27 @@ struct MapTile
|
|||
/* 0x14 */ struct DungeonEntity *mapObject; // Item or trap on the tile.
|
||||
};
|
||||
|
||||
struct Position
|
||||
{
|
||||
s16 x;
|
||||
s16 y;
|
||||
};
|
||||
|
||||
struct Position32
|
||||
{
|
||||
s32 x;
|
||||
s32 y;
|
||||
};
|
||||
|
||||
struct MapRoom
|
||||
{
|
||||
u8 fill0[0x2 - 0x0];
|
||||
// All coordinates are inclusive.
|
||||
/* 0x2 */ s16 startX;
|
||||
/* 0x4 */ s16 startY;
|
||||
/* 0x6 */ s16 endX;
|
||||
/* 0x8 */ s16 endY;
|
||||
/* 0x2 */ struct Position start;
|
||||
/* 0x6 */ struct Position end;
|
||||
u8 fillA[0x1C - 0xA];
|
||||
};
|
||||
|
||||
struct RoomExit
|
||||
{
|
||||
s16 x;
|
||||
s16 y;
|
||||
};
|
||||
|
||||
enum TileType
|
||||
{
|
||||
TILE_TYPE_FLOOR = 1 << 0,
|
||||
|
|
|
|||
|
|
@ -212,9 +212,13 @@ SECTIONS {
|
|||
src/dungeon_pokemon_attributes_1.o(.text);
|
||||
asm/code_80718D8.o(.text);
|
||||
src/dungeon_ai_items.o(.text);
|
||||
asm/code_8073AA0.o(.text);
|
||||
asm/code_8073B78.o(.text);
|
||||
src/dungeon_movement.o(.text);
|
||||
asm/code_8075BA4.o(.text);
|
||||
src/dungeon_random.o(.text);
|
||||
asm/code_808411C.o(.text);
|
||||
src/dungeon_random_1.o(.text);
|
||||
asm/code_8084160.o(.text);
|
||||
src/code_80848F0.o(.text);
|
||||
asm/code_80848F0.o(.text);
|
||||
src/dungeon_util_1.o(.text);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
#include "global.h"
|
||||
#include "constants/direction.h"
|
||||
#include "constants/friend_area.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_entity.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "friend_area.h"
|
||||
#include "constants/friend_area.h"
|
||||
#include "pokemon.h"
|
||||
#include "constants/direction.h"
|
||||
#include "map.h"
|
||||
#include "pokemon.h"
|
||||
|
||||
extern struct DungeonEntity *xxx_call_GetLeaderEntity(void);
|
||||
extern struct DungeonEntity *sub_8085680(u32);
|
||||
|
|
@ -130,7 +131,6 @@ void sub_808C02C();
|
|||
extern void sub_80861B8(struct DungeonEntity *, u32, u32);
|
||||
|
||||
void nullsub_99();
|
||||
extern u32 DungeonRandomCapped(s32);
|
||||
extern bool8 *gFriendAreas;
|
||||
|
||||
extern void sub_8049884();
|
||||
|
|
@ -286,7 +286,7 @@ void sub_808BDEC(void)
|
|||
gDungeonGlobalData->unk7 = 1;
|
||||
SetFacingDirection(LugiaEntity, DIRECTION_SOUTH);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_LUGIA);
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ void LugiaPreFightDialogue(void)
|
|||
sub_808BFA0();
|
||||
SetupBossFightHP(LugiaEntity,800,0x20);
|
||||
sub_8083E88(0x23);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -424,7 +424,7 @@ void sub_808C10C(void)
|
|||
gDungeonGlobalData->unk7 = 1;
|
||||
SetFacingDirection(KyogreEntity, DIRECTION_SOUTH);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
uVar3 = sub_803F994();
|
||||
iVar2 = sub_803F9B0();
|
||||
sub_803F878(uVar3,iVar2 + -0x1000);
|
||||
|
|
@ -485,7 +485,7 @@ void KyogrePreFightDialogue(void)
|
|||
sub_803E708(10,0x46);
|
||||
SetupBossFightHP(KyogreEntity,600,0xb);
|
||||
sub_8083E88(0x23);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -542,7 +542,7 @@ void sub_808C3A0(void)
|
|||
gDungeonGlobalData->unk7 = 1;
|
||||
sub_808563C(SetupDeoxysFacingDirection);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_DEOXYS_NORMAL);
|
||||
}
|
||||
|
||||
|
|
@ -576,7 +576,7 @@ void DeoxysPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8106390);
|
||||
sub_803E708(10,0x46);
|
||||
sub_808563C(SetupDeoxysFightHP);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -642,7 +642,7 @@ void sub_808C5C0(void)
|
|||
sub_80854D4();
|
||||
sub_8085930(DIRECTION_NORTH);
|
||||
SetFacingDirection(CelebiEntity, DIRECTION_SOUTH);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
uVar3 = sub_803F994();
|
||||
iVar2 = sub_803F9B0();
|
||||
sub_803F878(uVar3,iVar2 + 0xfffff000);
|
||||
|
|
@ -1130,7 +1130,7 @@ void sub_808C9C4(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
SetFacingDirection(MedichamEntity, DIRECTION_SOUTH);
|
||||
sub_8085860(LeaderEntity->posWorldX, LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x, LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_MEDICHAM);
|
||||
}
|
||||
|
||||
|
|
@ -1198,7 +1198,7 @@ void sub_808CB5C(void)
|
|||
sub_80854D4();
|
||||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_8068FE0(MedichamEntity, 0x21C, 0);
|
||||
sub_8085860(LeaderEntity->posWorldX, LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x, LeaderEntity->posWorld.y);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_MEDICHAM);
|
||||
}
|
||||
|
||||
|
|
@ -1218,7 +1218,7 @@ void sub_808CBB0(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
SetFacingDirection(SmeargleEntity, DIRECTION_SOUTH);
|
||||
sub_8085860(LeaderEntity->posWorldX, LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x, LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_SMEARGLE);
|
||||
}
|
||||
|
||||
|
|
@ -1290,7 +1290,7 @@ void sub_808CD44(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
sub_8068FE0(SmeargleEntity, 0x21C, 0);
|
||||
sub_8085860(LeaderEntity->posWorldX, LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x, LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_SMEARGLE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
#include "global.h"
|
||||
#include "constants/direction.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_entity.h"
|
||||
#include "pokemon.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "item.h"
|
||||
#include "constants/direction.h"
|
||||
#include "pokemon.h"
|
||||
|
||||
extern struct DungeonGlobalData *gDungeonGlobalData;
|
||||
|
||||
|
|
@ -313,7 +314,6 @@ void sub_808919C();
|
|||
void GroudonScreenFlash2(void);
|
||||
|
||||
extern void sub_8083F14();
|
||||
extern u8 EntityExists(struct DungeonEntity *);
|
||||
extern u8 sub_8086AE4(u32);
|
||||
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ void ZapdosReFightDialogue(void)
|
|||
sub_808775C(2);
|
||||
DisplayDungeonDialogue(&gUnknown_8101918);
|
||||
SetupBossFightHP(ZapdosEntity,300,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void ZapdosPostStoryPreFightDialogue(void)
|
||||
|
|
@ -416,7 +416,7 @@ void ZapdosPostStoryPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8101A04);
|
||||
sub_803E708(10,0x46);
|
||||
SetupBossFightHP(ZapdosEntity,300,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -485,7 +485,7 @@ void sub_80877E8(void)
|
|||
sub_80855E4(sub_8086A3C);
|
||||
SetFacingDirection(MoltresEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(MoltresEntity);
|
||||
sub_8085860(LeaderEntity->posWorldX + -3,LeaderEntity->posWorldY + -2);
|
||||
sub_8085860(LeaderEntity->posWorld.x + -3,LeaderEntity->posWorld.y + -2);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_MOLTRES);
|
||||
}
|
||||
|
||||
|
|
@ -511,7 +511,7 @@ void sub_8087848(void)
|
|||
SetFacingDirection(MoltresEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(MoltresEntity);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX - 5, LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x - 5, LeaderEntity->posWorld.y);
|
||||
uVar4 = sub_803F994();
|
||||
iVar3 = sub_803F9B0();
|
||||
sub_803F878(uVar4,iVar3 + -0x1000);
|
||||
|
|
@ -594,7 +594,7 @@ void MoltresPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8102108);
|
||||
sub_803E708(10,0x46);
|
||||
SetupBossFightHP(MoltresEntity,400,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -637,7 +637,7 @@ void MoltresReFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_81022F8);
|
||||
sub_803E708(10,0x46);
|
||||
SetupBossFightHP(MoltresEntity,400,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void MoltresPostStoryPreFightDialogue(void)
|
||||
|
|
@ -675,7 +675,7 @@ void MoltresPostStoryPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8102454);
|
||||
sub_803E708(10,0x46);
|
||||
SetupBossFightHP(MoltresEntity,400,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -897,7 +897,7 @@ void sub_8087F54(void)
|
|||
sub_80855E4(sub_8086A3C);
|
||||
SetFacingDirection(ArticunoEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(ArticunoEntity);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY + -3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y + -3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_ARTICUNO);
|
||||
}
|
||||
|
||||
|
|
@ -934,7 +934,7 @@ void sub_8087FF8(void)
|
|||
SetFacingDirection(ArticunoEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(ArticunoEntity);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY + -3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y + -3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_ARTICUNO);
|
||||
}
|
||||
|
||||
|
|
@ -1023,7 +1023,7 @@ void ArticunoPreFightDialogue(void)
|
|||
sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH);
|
||||
sub_803E708(0x10,0x46);
|
||||
SetupBossFightHP(ArticunoEntity,0x1c2,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void ArticunoReFightDialogue(void)
|
||||
|
|
@ -1045,7 +1045,7 @@ void ArticunoReFightDialogue(void)
|
|||
sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH);
|
||||
sub_803E708(0x28,0x46);
|
||||
SetupBossFightHP(ArticunoEntity,0x1c2,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void ArticunoPostStoryPreFightDialogue(void)
|
||||
|
|
@ -1081,7 +1081,7 @@ void ArticunoPostStoryPreFightDialogue(void)
|
|||
sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH);
|
||||
sub_803E708(0x28,0x46);
|
||||
SetupBossFightHP(ArticunoEntity,0x1c2,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1156,7 +1156,7 @@ void sub_80885C4(void)
|
|||
sub_80854D4();
|
||||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
}
|
||||
|
||||
void sub_8088608(void)
|
||||
|
|
@ -1192,7 +1192,7 @@ void sub_808862C(void)
|
|||
sub_80861D4(AlakazamEntity,0xd,4);
|
||||
SetFacingDirection(GroudonEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(GroudonEntity);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY -3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y -3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_GROUDON);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038 + 0x50, SPECIES_ALAKAZAM);
|
||||
}
|
||||
|
|
@ -1217,7 +1217,7 @@ void sub_80886C4(void)
|
|||
sub_8068FE0(AlakazamEntity,0x21c,0);
|
||||
SetFacingDirection(GroudonEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(GroudonEntity);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
uVar4 = sub_803F994();
|
||||
iVar2 = sub_803F9B0();
|
||||
sub_803F878(uVar4,iVar2 + -0x1000);
|
||||
|
|
@ -1247,7 +1247,7 @@ void sub_808875C(void)
|
|||
SetFacingDirection(GroudonEntity, DIRECTION_SOUTH);
|
||||
sub_80861D4(GroudonEntity,0xf,0);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_GROUDON);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038 + 0x50, SPECIES_ALAKAZAM);
|
||||
}
|
||||
|
|
@ -1344,7 +1344,7 @@ void GroudonPreFightDialogue(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_8086764();
|
||||
SetupBossFightHP(GroudonEntity,500,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void GroudonReFightDialogue(void)
|
||||
|
|
@ -1376,7 +1376,7 @@ void GroudonReFightDialogue(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_8086764();
|
||||
SetupBossFightHP(GroudonEntity,500,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void GroudonPostStoryPreFightDialogue(void)
|
||||
|
|
@ -1404,7 +1404,7 @@ void GroudonPostStoryPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_810347C);
|
||||
sub_803E708(10,0x46);
|
||||
SetupBossFightHP(GroudonEntity,500,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1427,7 +1427,7 @@ void SceneGroudonMovement(struct DungeonEntity * param_1)
|
|||
}
|
||||
sub_803E46C(0x46);
|
||||
}
|
||||
sub_80856C8(param_1,param_1->posWorldX,param_1->posWorldY + 1);
|
||||
sub_80856C8(param_1,param_1->posWorld.x,param_1->posWorld.y + 1);
|
||||
sub_80861D4(param_1,0xf,0);
|
||||
sub_803E708(10,0x46);
|
||||
sub_808682C();
|
||||
|
|
@ -1509,7 +1509,7 @@ void sub_8088DC0(void)
|
|||
sub_806CDD4(uVar2,0xe,DIRECTION_SOUTH);
|
||||
sub_8086A3C(uVar3);
|
||||
sub_806CDD4(uVar3,0xe,DIRECTION_SOUTH);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_GROUDON);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038 + 0x50, SPECIES_ALAKAZAM);
|
||||
}
|
||||
|
|
@ -1530,7 +1530,7 @@ void sub_8088E5C(void)
|
|||
sub_80855E4(sub_8086A3C);
|
||||
sub_8068FE0(uVar2,0x21c,0);
|
||||
sub_8068FE0(uVar3,0x21c,0);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY + -3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y + -3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_GROUDON);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038 + 0x50, SPECIES_ALAKAZAM);
|
||||
}
|
||||
|
|
@ -1601,8 +1601,8 @@ void MagmaCavernMidDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8102C30);
|
||||
iVar3->entityData->unk15E = 0;
|
||||
iVar4->entityData->unk15E =0;
|
||||
local_20[0] = (iVar3->posPixelX + iVar4->posPixelX) / 2;
|
||||
local_20[1] = (iVar3->posPixelY + iVar4->posPixelY) / 2 + 0x800;
|
||||
local_20[0] = (iVar3->posPixel.x + iVar4->posPixel.x) / 2;
|
||||
local_20[1] = (iVar3->posPixel.y + iVar4->posPixel.y) / 2 + 0x800;
|
||||
sub_80858AC(local_20,0x20);
|
||||
sub_803E708(0x3c,0x46);
|
||||
sub_80891F0();
|
||||
|
|
@ -1671,7 +1671,7 @@ void sub_8089168(void)
|
|||
sub_803E708(10,0x46);
|
||||
SpriteLookAroundEffect(LeaderEntity);
|
||||
sub_803E708(10,0x46);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void sub_808919C(struct DungeonEntity *r0)
|
||||
|
|
@ -1709,10 +1709,10 @@ void sub_8089224(struct DungeonEntity * param_1)
|
|||
{
|
||||
s32 iVar1;
|
||||
|
||||
if (param_1->posPixelY < 0x9001) {
|
||||
if (param_1->posPixel.y < 0x9001) {
|
||||
return;
|
||||
}
|
||||
iVar1 = param_1->posPixelX;
|
||||
iVar1 = param_1->posPixel.x;
|
||||
|
||||
if(iVar1 < 0xE400)
|
||||
{
|
||||
|
|
@ -1774,7 +1774,7 @@ void sub_80892C8(void)
|
|||
sub_80855E4(sub_8086A3C);
|
||||
SetFacingDirection(RayquazaEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(RayquazaEntity);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038,SPECIES_RAYQUAZA);
|
||||
}
|
||||
|
||||
|
|
@ -1796,7 +1796,7 @@ void sub_8089328(void)
|
|||
sub_8072008(RayquazaEntity,RayquazaEntity,gUnknown_80F57CA,0,0);
|
||||
sub_8086A3C(RayquazaEntity);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038,SPECIES_RAYQUAZA);
|
||||
}
|
||||
|
||||
|
|
@ -1846,7 +1846,7 @@ void RayquazaPreFightDialogue(void)
|
|||
RayquazaScreenFlash();
|
||||
DisplayDungeonDialogue(&gUnknown_8103820);
|
||||
SetupBossFightHP(RayquazaEntity,600,0x20);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void RayquazaReFightDialogue(void)
|
||||
|
|
@ -1870,7 +1870,7 @@ void RayquazaReFightDialogue(void)
|
|||
RayquazaScreenFlash();
|
||||
DisplayDungeonDialogue(&gUnknown_81038F8);
|
||||
SetupBossFightHP(RayquazaEntity,600,0x20);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void RayquazaPostStoryPreFightDialogue(void)
|
||||
|
|
@ -1896,7 +1896,7 @@ void RayquazaPostStoryPreFightDialogue(void)
|
|||
RayquazaScreenFlash();
|
||||
DisplayDungeonDialogue(&gUnknown_8103B30);
|
||||
SetupBossFightHP(RayquazaEntity,600,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1959,7 +1959,7 @@ void sub_808970C(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
sub_808563C(sub_8089908);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY + -3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y + -3);
|
||||
}
|
||||
|
||||
void sub_808974C(void)
|
||||
|
|
@ -1971,7 +1971,7 @@ void sub_808974C(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
sub_808563C(sub_80898F8);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY + -3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y + -3);
|
||||
}
|
||||
|
||||
void sub_8089788(struct DungeonEntity *param_1, u8 param_2, s32 param_3)
|
||||
|
|
@ -2030,7 +2030,7 @@ void sub_80897F0(void)
|
|||
// Get 'em! It's frenzy time!
|
||||
DisplayDungeonDialogue(&gUnknown_8103D50);
|
||||
sub_803E708(10,0x46);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2050,7 +2050,7 @@ void sub_8089878(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8103DD8);
|
||||
DisplayDungeonDialogue(&gUnknown_8103E28);
|
||||
sub_803E708(10,0x46);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void sub_80898E4(void)
|
||||
|
|
@ -2083,7 +2083,7 @@ void sub_8089914(void)
|
|||
sub_80855E4(sub_8086A3C);
|
||||
SetFacingDirection(MewtwoEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(MewtwoEntity);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038,SPECIES_MEWTWO);
|
||||
}
|
||||
|
||||
|
|
@ -2107,7 +2107,7 @@ void sub_8089978(void)
|
|||
SetFacingDirection(MewtwoEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(MewtwoEntity);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038,SPECIES_MEWTWO);
|
||||
}
|
||||
|
||||
|
|
@ -2143,7 +2143,7 @@ void MewtwoPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8104008);
|
||||
sub_803E708(10,0x46);
|
||||
SetupBossFightHP(MewtwoEntity,900,0x20);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void MewtwoPreFightDialogue1(void)
|
||||
|
|
@ -2169,7 +2169,7 @@ void MewtwoPreFightDialogue1(void)
|
|||
MewtwoScreenFlash();
|
||||
DisplayDungeonDialogue(&gUnknown_8104114);
|
||||
SetupBossFightHP(MewtwoEntity,900,0x20);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2232,7 +2232,7 @@ void sub_8089C44(void)
|
|||
sub_80854D4();
|
||||
sub_8085930(DIRECTION_NORTH);
|
||||
SetFacingDirection(EnteiEntity, DIRECTION_SOUTH);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_ENTEI);
|
||||
}
|
||||
|
||||
|
|
@ -2253,7 +2253,7 @@ void sub_8089C90(void)
|
|||
else {
|
||||
SetFacingDirection(EnteiEntity, DIRECTION_SOUTH);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_ENTEI);
|
||||
}
|
||||
|
||||
|
|
@ -2282,7 +2282,7 @@ void EnteiPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_81041F8);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(EnteiEntity,600,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void EnteiPreFightDialogue1(void)
|
||||
|
|
@ -2300,7 +2300,7 @@ void EnteiPreFightDialogue1(void)
|
|||
DisplayDungeonDialogue(&gUnknown_81042B8);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(EnteiEntity,600,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void EnteiPreFightDialogue2(void)
|
||||
|
|
@ -2322,7 +2322,7 @@ void EnteiPreFightDialogue2(void)
|
|||
DisplayDungeonDialogue(&gUnknown_81043C0);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(EnteiEntity,600,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2363,7 +2363,7 @@ void sub_8089EFC(void)
|
|||
sub_80854D4();
|
||||
sub_8085930(DIRECTION_NORTH);
|
||||
SetFacingDirection(RaikouEntity, DIRECTION_SOUTH);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_RAIKOU);
|
||||
}
|
||||
|
||||
|
|
@ -2379,7 +2379,7 @@ void sub_8089F44(void)
|
|||
sub_80854D4();
|
||||
sub_8085930(DIRECTION_NORTH);
|
||||
SetFacingDirection(RaikouEntity, DIRECTION_SOUTH);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_RAIKOU);
|
||||
}
|
||||
|
||||
|
|
@ -2400,7 +2400,7 @@ void sub_8089F8C(void)
|
|||
else {
|
||||
SetFacingDirection(RaikouEntity, DIRECTION_SOUTH);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_RAIKOU);
|
||||
}
|
||||
|
||||
|
|
@ -2435,7 +2435,7 @@ void RaikouPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_81045B0);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(RaikouEntity,0x28a,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void RaikouPreFightDialogue1(void)
|
||||
|
|
@ -2455,7 +2455,7 @@ void RaikouPreFightDialogue1(void)
|
|||
DisplayDungeonDialogue(&gUnknown_81046A0);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(RaikouEntity,0x28a,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void RaikouPreFightDialogue2(void)
|
||||
|
|
@ -2478,7 +2478,7 @@ void RaikouPreFightDialogue2(void)
|
|||
DisplayDungeonDialogue(&gUnknown_810476C);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(RaikouEntity,0x28a,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2521,7 +2521,7 @@ void sub_808A264(void)
|
|||
sub_80855E4(sub_8086A3C);
|
||||
SetFacingDirection(SuicuneEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(SuicuneEntity);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_SUICUNE);
|
||||
}
|
||||
|
||||
|
|
@ -2536,7 +2536,7 @@ void sub_808A2C0(void)
|
|||
sub_80854D4();
|
||||
sub_8085930(DIRECTION_NORTH);
|
||||
SetFacingDirection(SuicuneEntity, DIRECTION_SOUTH);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_SUICUNE);
|
||||
}
|
||||
|
||||
|
|
@ -2556,7 +2556,7 @@ void sub_808A308(void)
|
|||
else {
|
||||
SetFacingDirection(SuicuneEntity, DIRECTION_SOUTH);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_SUICUNE);
|
||||
}
|
||||
|
||||
|
|
@ -2593,7 +2593,7 @@ void SuicunePreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8104914);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(SuicuneEntity,0x28a,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void SuicunePreFightDialogue1(void)
|
||||
|
|
@ -2610,7 +2610,7 @@ void SuicunePreFightDialogue1(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8104998);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(SuicuneEntity,0x28a,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void SuicunePreFightDialogue2(void)
|
||||
|
|
@ -2631,7 +2631,7 @@ void SuicunePreFightDialogue2(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8104A9C);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(SuicuneEntity,0x28a,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2697,7 +2697,7 @@ void sub_808A608(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
SetFacingDirection(HoOhEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(HoOhEntity);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY + -6);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y + -6);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_HO_OH);
|
||||
}
|
||||
|
||||
|
|
@ -2720,7 +2720,7 @@ void sub_808A668(void)
|
|||
SetFacingDirection(HoOhEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(HoOhEntity);
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 6);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 6);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_HO_OH);
|
||||
}
|
||||
|
||||
|
|
@ -2746,8 +2746,8 @@ void HoOhPreFightDialogue(void)
|
|||
|
||||
LeaderEntity = xxx_call_GetLeaderEntity();
|
||||
HoOhEntity = sub_8085680(0x15);
|
||||
local_14[0] = LeaderEntity->posPixelX;
|
||||
local_14[1] = LeaderEntity->posPixelY + -0x1000;
|
||||
local_14[0] = LeaderEntity->posPixel.x;
|
||||
local_14[1] = LeaderEntity->posPixel.y + -0x1000;
|
||||
sub_80858AC(local_14,0x88);
|
||||
sub_803E708(0x40,70);
|
||||
DisplayDungeonDialogue(&gUnknown_8104AD4);
|
||||
|
|
@ -2774,7 +2774,7 @@ void HoOhPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8104CE0);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(HoOhEntity,800,0x20);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void HoOhPreFightDialogue1(void)
|
||||
|
|
@ -2786,8 +2786,8 @@ void HoOhPreFightDialogue1(void)
|
|||
LeaderEntity = xxx_call_GetLeaderEntity();
|
||||
HoOhEntity = sub_8085680(0x15);
|
||||
|
||||
local_14[0] = LeaderEntity->posPixelX;
|
||||
local_14[1] = LeaderEntity->posPixelY + -0x1000;
|
||||
local_14[0] = LeaderEntity->posPixel.x;
|
||||
local_14[1] = LeaderEntity->posPixel.y + -0x1000;
|
||||
sub_80858AC(local_14,0x88);
|
||||
sub_803E708(0x40,70);
|
||||
if (HasRecruitedMon(SPECIES_HO_OH)) {
|
||||
|
|
@ -2810,7 +2810,7 @@ void HoOhPreFightDialogue1(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8104E0C);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(HoOhEntity,800,0x20);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2874,7 +2874,7 @@ void sub_808A9E4(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
SetFacingDirection(LatiosEntity, DIRECTION_NORTH);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 4);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 4);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_LATIOS);
|
||||
}
|
||||
|
||||
|
|
@ -2890,7 +2890,7 @@ void sub_808AA3C(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
SetFacingDirection(LatiosEntity, DIRECTION_NORTH);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_LATIOS);
|
||||
}
|
||||
|
||||
|
|
@ -2906,7 +2906,7 @@ void sub_808AA94(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
sub_8068FE0(LatiosEntity,0x21c,0);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_LATIOS);
|
||||
}
|
||||
|
||||
|
|
@ -2927,8 +2927,8 @@ void LatiosPreFightDialogue(void)
|
|||
LeaderEntity = xxx_call_GetLeaderEntity();
|
||||
LatiosEntity = sub_8085680(0x16);
|
||||
|
||||
local_18[0] = LatiosEntity->posPixelX;
|
||||
local_18[1] = LatiosEntity->posPixelY + (0x80 << 6);
|
||||
local_18[0] = LatiosEntity->posPixel.x;
|
||||
local_18[1] = LatiosEntity->posPixel.y + (0x80 << 6);
|
||||
local_18[2] = 0x7000fc;
|
||||
sub_8085EC8(0x1bd,0,0,&local_18[2],1);
|
||||
|
||||
|
|
@ -2946,7 +2946,7 @@ void LatiosPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8104F30);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(LatiosEntity,600,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void LatiosReFightDialogue(void)
|
||||
|
|
@ -2965,7 +2965,7 @@ void LatiosReFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_8104F30);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(LatiosEntity,600,0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void sub_808AC3C(void)
|
||||
|
|
@ -3401,7 +3401,7 @@ void sub_808B2F4(void)
|
|||
sub_80855E4(sub_8086A3C);
|
||||
SetFacingDirection(JirachiEntity, DIRECTION_SOUTH);
|
||||
sub_8086A3C(JirachiEntity);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_JIRACHI);
|
||||
}
|
||||
|
||||
|
|
@ -3426,7 +3426,7 @@ void sub_808B35C(void)
|
|||
sub_8049ED4();
|
||||
|
||||
}
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_JIRACHI);
|
||||
}
|
||||
|
||||
|
|
@ -3543,7 +3543,7 @@ void JirachiPreFightDialogue(void)
|
|||
DisplayDungeonDialogue(&gUnknown_810550C);
|
||||
sub_803E708(10,70);
|
||||
SetupBossFightHP(JirachiEntity,0x15e,0x20);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void sub_808B50C(void)
|
||||
|
|
|
|||
|
|
@ -589,13 +589,13 @@ void sub_8084E00(struct DungeonEntity *param_1,char param_2,char param_3)
|
|||
sub_808AAF0(param_2,gDungeonGlobalData->unk3A0D);
|
||||
break;
|
||||
case 0x2e:
|
||||
sub_808AE54(param_2,gDungeonGlobalData->unk3A0D,¶m_1->posWorldX);
|
||||
sub_808AE54(param_2,gDungeonGlobalData->unk3A0D,¶m_1->posWorld.x);
|
||||
break;
|
||||
case 0x2f:
|
||||
sub_808AEC8(param_2,gDungeonGlobalData->unk3A0D,¶m_1->posWorldX);
|
||||
sub_808AEC8(param_2,gDungeonGlobalData->unk3A0D,¶m_1->posWorld.x);
|
||||
break;
|
||||
case 0x30:
|
||||
sub_808AF3C(param_2,gDungeonGlobalData->unk3A0D,¶m_1->posWorldX);
|
||||
sub_808AF3C(param_2,gDungeonGlobalData->unk3A0D,¶m_1->posWorld.x);
|
||||
break;
|
||||
case 0x31:
|
||||
case 0x32:
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ void sub_80862BC(struct DungeonEntity *r0)
|
|||
void sub_80862DC(struct DungeonEntity *r0)
|
||||
{
|
||||
u32 array[2];
|
||||
array[0] = r0->posPixelX;
|
||||
array[1] = r0->posPixelY + (0xE0 << 6);
|
||||
array[0] = r0->posPixel.x;
|
||||
array[1] = r0->posPixel.y + (0xE0 << 6);
|
||||
|
||||
sub_804535C(r0, array);
|
||||
sub_806CDD4(r0, 0, DIRECTION_NORTH);
|
||||
|
|
@ -71,8 +71,8 @@ void sub_80862DC(struct DungeonEntity *r0)
|
|||
void sub_8086310(struct DungeonEntity *r0)
|
||||
{
|
||||
u32 array[2];
|
||||
array[0] = r0->posPixelX;
|
||||
array[1] = r0->posPixelY + (0x90 << 8);
|
||||
array[0] = r0->posPixel.x;
|
||||
array[1] = r0->posPixel.y + (0x90 << 8);
|
||||
|
||||
sub_804535C(r0, array);
|
||||
sub_806CE68(r0, DIRECTION_SOUTH);
|
||||
|
|
@ -83,8 +83,8 @@ void sub_8086310(struct DungeonEntity *r0)
|
|||
void sub_8086348(struct DungeonEntity *r0)
|
||||
{
|
||||
u32 array[2];
|
||||
array[0] = r0->posPixelX + (0xF0 << 7);
|
||||
array[1] = r0->posPixelY + 0xffffe000;
|
||||
array[0] = r0->posPixel.x + (0xF0 << 7);
|
||||
array[1] = r0->posPixel.y + 0xffffe000;
|
||||
|
||||
sub_804535C(r0, array);
|
||||
sub_806CDD4(r0, 0, DIRECTION_WEST);
|
||||
|
|
@ -94,8 +94,8 @@ void sub_8086348(struct DungeonEntity *r0)
|
|||
void sub_8086384(struct DungeonEntity *r0)
|
||||
{
|
||||
u32 array[2];
|
||||
array[0] = r0->posPixelX + (0xF0 << 7);
|
||||
array[1] = r0->posPixelY;
|
||||
array[0] = r0->posPixel.x + (0xF0 << 7);
|
||||
array[1] = r0->posPixel.y;
|
||||
|
||||
sub_804535C(r0, array);
|
||||
sub_806CDD4(r0, 0, DIRECTION_WEST);
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ void sub_8086B14(void)
|
|||
sub_80855E4(sub_8086A3C);
|
||||
sub_8086A3C(SkarmoryEntity);
|
||||
DiglettEntity->entityData->unk15C = 1;
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY + -2);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y + -2);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038,SPECIES_DIGLETT);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038 + 0x50, SPECIES_SKARMORY);
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ void sub_8086B94(void)
|
|||
sub_8068FE0(DiglettEntity,0x21c,0);
|
||||
sub_80854D4();
|
||||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y);
|
||||
}
|
||||
|
||||
void sub_8086BDC(char param_1, s32 param_2)
|
||||
|
|
@ -168,17 +168,17 @@ void SkarmoryPreFightDialogue(void)
|
|||
|
||||
struct subStruct_Skarmory local_1c;
|
||||
struct subStruct_Skarmory local_20;
|
||||
|
||||
|
||||
LeaderEntity = xxx_call_GetLeaderEntity(); // Player
|
||||
PartnerEntity = GetPartnerEntity(); // Partner
|
||||
DiglettEntity = sub_8085680(4); // Diglett
|
||||
SkarmoryEntity = sub_8085680(3); // Skarmory
|
||||
|
||||
local_1c.x = DiglettEntity->posPixelX;
|
||||
local_1c.y = DiglettEntity->posPixelY + 0x3000;
|
||||
local_1c.x = DiglettEntity->posPixel.x;
|
||||
local_1c.y = DiglettEntity->posPixel.y + 0x3000;
|
||||
|
||||
local_20.x = SkarmoryEntity->posPixelX;
|
||||
local_20.y = SkarmoryEntity->posPixelY + 0x2000;
|
||||
local_20.x = SkarmoryEntity->posPixel.x;
|
||||
local_20.y = SkarmoryEntity->posPixel.y + 0x2000;
|
||||
|
||||
sub_8086448();
|
||||
sub_803E708(10,0x46);
|
||||
|
|
@ -216,7 +216,7 @@ void SkarmoryPreFightDialogue(void)
|
|||
sub_80869E4(LeaderEntity,4,1,4);
|
||||
sub_803E708(10,0x46);
|
||||
sub_8083E88(0xb);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
}
|
||||
|
||||
void SkarmoryReFightDialogue(void)
|
||||
|
|
@ -224,11 +224,11 @@ void SkarmoryReFightDialogue(void)
|
|||
struct DungeonEntity * LeaderEntity;
|
||||
struct DungeonEntity * SkarmoryEntity;
|
||||
struct subStruct_Skarmory local_14;
|
||||
|
||||
|
||||
LeaderEntity = xxx_call_GetLeaderEntity();
|
||||
SkarmoryEntity = sub_8085680(3);
|
||||
local_14.x = SkarmoryEntity->posPixelX;
|
||||
local_14.y = SkarmoryEntity->posPixelY + 0x2000;
|
||||
local_14.x = SkarmoryEntity->posPixel.x;
|
||||
local_14.y = SkarmoryEntity->posPixel.y + 0x2000;
|
||||
sub_8086448();
|
||||
sub_803E708(10,0x46);
|
||||
sub_8086E74(SkarmoryEntity);
|
||||
|
|
@ -240,7 +240,7 @@ void SkarmoryReFightDialogue(void)
|
|||
sub_806CDD4(SkarmoryEntity,0xd,0);
|
||||
DisplayDungeonDialogue(&gUnknown_8100CDC);
|
||||
sub_803E708(10,0x46);
|
||||
sub_80858AC(&LeaderEntity->posPixelX,0x10);
|
||||
sub_80858AC(&LeaderEntity->posPixel.x,0x10);
|
||||
sub_8083E88(0xb);
|
||||
}
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ void sub_8086E9C(void)
|
|||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
sub_808563C(sub_8086A3C);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_METAPOD);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038 + 0x50, SPECIES_GENGAR);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038 + 0xA0, SPECIES_CATERPIE);
|
||||
|
|
@ -281,12 +281,12 @@ void sub_8086E9C(void)
|
|||
void sub_8086F00(void)
|
||||
{
|
||||
struct DungeonEntity * LeaderEntity;
|
||||
|
||||
|
||||
LeaderEntity = xxx_call_GetLeaderEntity();
|
||||
sub_80854D4();
|
||||
sub_8085930(DIRECTION_NORTH);
|
||||
sub_80855E4(sub_8086A3C);
|
||||
sub_8085860(LeaderEntity->posWorldX,LeaderEntity->posWorldY - 3);
|
||||
sub_8085860(LeaderEntity->posWorld.x,LeaderEntity->posWorld.y - 3);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038, SPECIES_METAPOD);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038 + 0x50, SPECIES_GENGAR);
|
||||
CopySpeciesNametoBuffer(gUnknown_202E038 + 0xA0, SPECIES_CATERPIE);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
#include "dungeon_entity.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_pokemon_attributes_1.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_random_1.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "item.h"
|
||||
#include "team_inventory.h"
|
||||
|
|
@ -31,10 +33,7 @@ enum TargetCapability
|
|||
TARGET_CAPABILITY_CAN_ATTACK_NOT_TARGET
|
||||
};
|
||||
|
||||
extern bool8 RollPercentChance(u32);
|
||||
extern void FindRockItemTargets(struct DungeonEntity*, struct ItemSlot*, s16*[], bool8);
|
||||
extern s32 DungeonRandomCapped(s32);
|
||||
extern s32 CalculateFacingDir(s16*, s16*);
|
||||
extern s32 CalculateFacingDir(struct Position*, struct Position*);
|
||||
extern struct MapTile* GetMapTileAtPosition(s16, s16);
|
||||
extern u32 EvaluateItem(struct DungeonEntity*, struct ItemSlot*, u8);
|
||||
extern bool8 ToolboxEnabled(struct DungeonEntityData*);
|
||||
|
|
@ -105,8 +104,8 @@ void DecideUseItem(struct DungeonEntity *pokemon)
|
|||
{
|
||||
SetAction(&pokemonData->action, DUNGEON_ACTION_THROW_ITEM_AI);
|
||||
pokemonData->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
|
||||
pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
|
||||
pokemonData->action.lastItemThrowPosition.x = pokemon->posWorld.x;
|
||||
pokemonData->action.lastItemThrowPosition.y = pokemon->posWorld.y;
|
||||
pokemonData->action.facingDir = gPotentialTargetDirections[targetIndex] & DIRECTION_MASK;
|
||||
break;
|
||||
}
|
||||
|
|
@ -118,7 +117,7 @@ void DecideUseItem(struct DungeonEntity *pokemon)
|
|||
}
|
||||
else if (itemType == ITEM_TYPE_ROCK)
|
||||
{
|
||||
s16 *potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS];
|
||||
struct Position potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS];
|
||||
FindRockItemTargets(pokemon, item, potentialTargetPositions, TRUE);
|
||||
if (gNumPotentialTargets == 0)
|
||||
{
|
||||
|
|
@ -129,9 +128,9 @@ void DecideUseItem(struct DungeonEntity *pokemon)
|
|||
u32 chosenTargetIndex = DungeonRandomCapped(gNumPotentialTargets);
|
||||
SetAction(&pokemonData->action, DUNGEON_ACTION_THROW_ITEM_AI);
|
||||
pokemonData->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
|
||||
pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
|
||||
pokemonData->action.facingDir = CalculateFacingDir(&pokemon->posWorldX, (s16 *) (&potentialTargetPositions[chosenTargetIndex])) & DIRECTION_MASK;
|
||||
pokemonData->action.lastItemThrowPosition.x = pokemon->posWorld.x;
|
||||
pokemonData->action.lastItemThrowPosition.y = pokemon->posWorld.y;
|
||||
pokemonData->action.facingDir = CalculateFacingDir(&pokemon->posWorld, &potentialTargetPositions[chosenTargetIndex]) & DIRECTION_MASK;
|
||||
pokemonData->itemTargetPosition = potentialTargetPositions[chosenTargetIndex];
|
||||
}
|
||||
}
|
||||
|
|
@ -142,8 +141,8 @@ void DecideUseItem(struct DungeonEntity *pokemon)
|
|||
{
|
||||
SetAction(&pokemonData->action, DUNGEON_ACTION_CONSUME_ITEM_AI);
|
||||
pokemonData->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
|
||||
pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
|
||||
pokemonData->action.lastItemThrowPosition.x = pokemon->posWorld.x;
|
||||
pokemonData->action.lastItemThrowPosition.y = pokemon->posWorld.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -164,7 +163,7 @@ void DecideUseItem(struct DungeonEntity *pokemon)
|
|||
else if (toolboxIndex == 0)
|
||||
{
|
||||
// This seems unused. toolboxIndex can never be 0.
|
||||
struct MapTile *mapTile = GetMapTileAtPosition(pokemon->posWorldX, pokemon->posWorldY);
|
||||
struct MapTile *mapTile = GetMapTileAtPosition(pokemon->posWorld.x, pokemon->posWorld.y);
|
||||
struct DungeonEntity *mapObject = mapTile->mapObject;
|
||||
if (mapObject != null)
|
||||
{
|
||||
|
|
@ -214,8 +213,8 @@ void DecideUseItem(struct DungeonEntity *pokemon)
|
|||
SetAction(&pokemonData->action, DUNGEON_ACTION_CONSUME_ITEM_AI);
|
||||
}
|
||||
pokemonData->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
|
||||
pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
|
||||
pokemonData->action.lastItemThrowPosition.x = pokemon->posWorld.x;
|
||||
pokemonData->action.lastItemThrowPosition.y = pokemon->posWorld.y;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -241,16 +240,16 @@ void DecideUseItem(struct DungeonEntity *pokemon)
|
|||
u8 itemType = GetItemType(item->itemIndex);
|
||||
if (itemType == ITEM_TYPE_ROCK)
|
||||
{
|
||||
s16 *potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS];
|
||||
struct Position potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS];
|
||||
FindRockItemTargets(pokemon, item, potentialTargetPositions, FALSE);
|
||||
if (gNumPotentialTargets != 0)
|
||||
{
|
||||
u32 chosenTargetIndex = DungeonRandomCapped(gNumPotentialTargets);
|
||||
SetAction(&pokemonData->action, DUNGEON_ACTION_THROW_ITEM_AI);
|
||||
pokemonData->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
|
||||
pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
|
||||
pokemonData->action.facingDir = CalculateFacingDir(&pokemon->posWorldX, (s16 *) (&potentialTargetPositions[chosenTargetIndex])) & DIRECTION_MASK;
|
||||
pokemonData->action.lastItemThrowPosition.x = pokemon->posWorld.x;
|
||||
pokemonData->action.lastItemThrowPosition.y = pokemon->posWorld.y;
|
||||
pokemonData->action.facingDir = CalculateFacingDir(&pokemon->posWorld, &potentialTargetPositions[chosenTargetIndex]) & DIRECTION_MASK;
|
||||
pokemonData->itemTargetPosition = potentialTargetPositions[chosenTargetIndex];
|
||||
return;
|
||||
}
|
||||
|
|
@ -265,8 +264,8 @@ void DecideUseItem(struct DungeonEntity *pokemon)
|
|||
{
|
||||
SetAction(&pokemonData->action, DUNGEON_ACTION_THROW_ITEM_AI);
|
||||
pokemonData->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonData->action.lastItemThrowPositionX = pokemon->posWorldX;
|
||||
pokemonData->action.lastItemThrowPositionY = pokemon->posWorldY;
|
||||
pokemonData->action.lastItemThrowPosition.x = pokemon->posWorld.x;
|
||||
pokemonData->action.lastItemThrowPosition.y = pokemon->posWorld.y;
|
||||
pokemonData->action.facingDir = gPotentialTargetDirections[targetIndex] & DIRECTION_MASK;
|
||||
return;
|
||||
}
|
||||
|
|
@ -279,7 +278,7 @@ void DecideUseItem(struct DungeonEntity *pokemon)
|
|||
}
|
||||
}
|
||||
|
||||
void FindStraightThrowableTargets(struct DungeonEntity* pokemon, s32 thrownAIFlag, struct ItemSlot* item, bool8 ignoreRollChance)
|
||||
void FindStraightThrowableTargets(struct DungeonEntity *pokemon, s32 thrownAIFlag, struct ItemSlot *item, bool8 ignoreRollChance)
|
||||
{
|
||||
s32 i;
|
||||
gNumPotentialTargets = 0;
|
||||
|
|
@ -319,3 +318,49 @@ void FindStraightThrowableTargets(struct DungeonEntity* pokemon, s32 thrownAIFla
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FindRockItemTargets(struct DungeonEntity *pokemon, struct ItemSlot *item, struct Position potentialTargets[], bool8 ignoreRollChance)
|
||||
{
|
||||
s32 i;
|
||||
gNumPotentialTargets = 0;
|
||||
for (i = 0; i < DUNGEON_MAX_POKEMON; i++)
|
||||
{
|
||||
struct DungeonEntity* targetPokemon = gDungeonGlobalData->allPokemon[i];
|
||||
if (EntityExists(targetPokemon) && pokemon != targetPokemon &&
|
||||
CanSee(pokemon, targetPokemon) && CanTarget(pokemon, targetPokemon, FALSE, TRUE) == TARGET_CAPABILITY_CAN_TARGET)
|
||||
{
|
||||
s32 posDiffX;
|
||||
s32 maxPosDiff;
|
||||
posDiffX = targetPokemon->posWorld.x - pokemon->posWorld.x;
|
||||
if (posDiffX < 0)
|
||||
{
|
||||
posDiffX = -posDiffX;
|
||||
}
|
||||
maxPosDiff = targetPokemon->posWorld.y - pokemon->posWorld.y;
|
||||
if (maxPosDiff < 0)
|
||||
{
|
||||
maxPosDiff = -maxPosDiff;
|
||||
}
|
||||
if (maxPosDiff < posDiffX)
|
||||
{
|
||||
maxPosDiff = posDiffX;
|
||||
}
|
||||
if (maxPosDiff <= 10)
|
||||
{
|
||||
struct Position *newPotentialTarget;
|
||||
if (!ignoreRollChance)
|
||||
{
|
||||
u32 itemWeight = EvaluateItem(targetPokemon, item, ITEM_TARGET_OTHER);
|
||||
if (!RollPercentChance(itemWeight))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
newPotentialTarget = &potentialTargets[gNumPotentialTargets];
|
||||
newPotentialTarget->x = targetPokemon->posWorld.x;
|
||||
newPotentialTarget->y = targetPokemon->posWorld.y;
|
||||
gNumPotentialTargets++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "dungeon_capabilities_1.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_pokemon_attributes_1.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "dungeon_util_1.h"
|
||||
#include "map.h"
|
||||
|
|
@ -26,7 +27,6 @@ extern bool8 HasStatusAffectingActions(struct DungeonEntity*);
|
|||
extern bool8 CanSee(struct DungeonEntity*, struct DungeonEntity*);
|
||||
extern void ResetAction(u16*);
|
||||
extern void SetWalkAction(u16*, s16);
|
||||
extern s32 DungeonRandomCapped(s32);
|
||||
extern void DecideAttack(struct DungeonEntity*);
|
||||
extern void MoveIfPossible(struct DungeonEntity*, bool8);
|
||||
extern u8 sub_8044B28(void);
|
||||
|
|
@ -143,7 +143,7 @@ void sub_8075900(struct DungeonEntity *pokemon, u8 r1)
|
|||
gDungeonGlobalData->unk672 = 1;
|
||||
sub_807AB38(pokemon, r1);
|
||||
sub_8041888(0);
|
||||
if(sub_803F428(&pokemon->posWorldX) != 0)
|
||||
if(sub_803F428(&pokemon->posWorld.x) != 0)
|
||||
sub_803E708(0x78, 0x39);
|
||||
}
|
||||
}
|
||||
|
|
@ -211,8 +211,8 @@ void DecideAction(struct DungeonEntity *pokemon)
|
|||
{
|
||||
SetWalkAction(&pokemonData->action.action, pokemonData->entityID);
|
||||
pokemonData->action.facingDir = DungeonRandomCapped(8);
|
||||
pokemonData->targetPositionX = pokemon->posWorldX;
|
||||
pokemonData->targetPositionY = pokemon->posWorldY - 1;
|
||||
pokemonData->targetPosition.x = pokemon->posWorld.x;
|
||||
pokemonData->targetPosition.y = pokemon->posWorld.y - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
15
src/dungeon_random.c
Normal file
15
src/dungeon_random.c
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include "global.h"
|
||||
#include "dungeon_random.h"
|
||||
|
||||
extern u32 gDungeonRngState;
|
||||
|
||||
s32 DungeonRandom(void)
|
||||
{
|
||||
gDungeonRngState = 1566083941 * gDungeonRngState + 1;
|
||||
return gDungeonRngState >> 16;
|
||||
}
|
||||
|
||||
s32 DungeonRandomCapped(s32 cap)
|
||||
{
|
||||
return (((DungeonRandom() & 0xFFFF) * cap) >> 16) & 0xFFFF;
|
||||
}
|
||||
13
src/dungeon_random_1.c
Normal file
13
src/dungeon_random_1.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "global.h"
|
||||
#include "dungeon_random_1.h"
|
||||
|
||||
#include "dungeon_random.h"
|
||||
|
||||
bool8 RollPercentChance(s32 percentChance)
|
||||
{
|
||||
if (DungeonRandomCapped(100) < percentChance)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -45,10 +45,10 @@ struct DungeonEntityData *sub_8045110(struct DungeonEntity *entity)
|
|||
|
||||
struct MapTile *sub_8045114(struct DungeonEntity *entity)
|
||||
{
|
||||
return GetMapTileAtPosition(entity->posWorldX, entity->posWorldY);
|
||||
return GetMapTileAtPosition(entity->posWorld.x, entity->posWorld.y);
|
||||
}
|
||||
|
||||
struct MapTile *sub_8045128(struct DungeonEntity *entity)
|
||||
{
|
||||
return GetMapEntity(entity->posWorldX, entity->posWorldY);
|
||||
return GetMapEntity(entity->posWorld.x, entity->posWorld.y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -578,7 +578,7 @@ gUnknown_203B444 = .; /* 203B444 */
|
|||
gLeaderPokemon = .; /* 203B450 */
|
||||
. += 0x4;
|
||||
|
||||
gUnknown_203B454 = .; /* 203B454 */
|
||||
gDungeonRngState = .; /* 203B454 */
|
||||
. += 0x4;
|
||||
|
||||
gUnknown_203B458 = .; /* 203B458 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user