mirror of
https://github.com/pret/pmd-red.git
synced 2026-10-01 13:28:04 -05:00
decomp, split, clean, repeat
This commit is contained in:
1910
asm/code_8057824.s
1910
asm/code_8057824.s
File diff suppressed because it is too large
Load Diff
944
asm/code_8057824_1.s
Normal file
944
asm/code_8057824_1.s
Normal file
@@ -0,0 +1,944 @@
|
||||
#include "asm/constants/gba_constants.inc"
|
||||
#include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_805A85C
|
||||
sub_805A85C:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x30
|
||||
mov r8, r0
|
||||
adds r6, r1, 0
|
||||
mov r10, r2
|
||||
str r3, [sp, 0x24]
|
||||
ldr r0, [r6, 0x4]
|
||||
str r0, [sp, 0x18]
|
||||
adds r0, r6, 0
|
||||
movs r1, 0xA
|
||||
movs r2, 0x8
|
||||
bl sub_806CDD4
|
||||
movs r5, 0
|
||||
_0805A880:
|
||||
movs r0, 0x3
|
||||
bl DungeonRandInt
|
||||
adds r4, r0, 0
|
||||
movs r0, 0x3
|
||||
bl DungeonRandInt
|
||||
adds r2, r0, 0
|
||||
subs r4, 0x1
|
||||
subs r2, 0x1
|
||||
cmp r4, 0
|
||||
bne _0805A89C
|
||||
cmp r2, 0
|
||||
beq _0805A8BC
|
||||
_0805A89C:
|
||||
ldrh r0, [r6, 0x4]
|
||||
adds r0, r4
|
||||
lsls r0, 16
|
||||
ldrh r1, [r6, 0x6]
|
||||
adds r1, r2
|
||||
lsls r1, 16
|
||||
lsrs r0, 16
|
||||
orrs r0, r1
|
||||
str r0, [sp, 0x18]
|
||||
adds r0, r6, 0
|
||||
add r1, sp, 0x18
|
||||
bl sub_80705F0
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805A8C2
|
||||
_0805A8BC:
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x27
|
||||
ble _0805A880
|
||||
_0805A8C2:
|
||||
cmp r5, 0x28
|
||||
bne _0805A8DC
|
||||
ldr r0, _0805A8D8
|
||||
ldr r2, [r0]
|
||||
mov r0, r8
|
||||
adds r1, r6, 0
|
||||
bl sub_80522F4
|
||||
movs r0, 0
|
||||
b _0805AAB8
|
||||
.align 2, 0
|
||||
_0805A8D8: .4byte gUnknown_80FEBDC
|
||||
_0805A8DC:
|
||||
add r0, sp, 0x18
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 11
|
||||
movs r3, 0xC0
|
||||
lsls r3, 4
|
||||
adds r0, r3
|
||||
ldr r1, [r6, 0xC]
|
||||
subs r0, r1
|
||||
movs r1, 0xC
|
||||
bl __divsi3
|
||||
str r0, [sp, 0x28]
|
||||
add r0, sp, 0x18
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r0, r2]
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
lsls r0, 11
|
||||
movs r3, 0x80
|
||||
lsls r3, 5
|
||||
adds r0, r3
|
||||
ldr r1, [r6, 0x10]
|
||||
subs r0, r1
|
||||
movs r1, 0xC
|
||||
bl __divsi3
|
||||
str r0, [sp, 0x2C]
|
||||
adds r4, r6, 0x4
|
||||
adds r0, r4, 0
|
||||
bl sub_803F428
|
||||
lsls r0, 24
|
||||
mov r9, r4
|
||||
cmp r0, 0
|
||||
bne _0805A934
|
||||
add r0, sp, 0x18
|
||||
bl sub_803F428
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805A94C
|
||||
_0805A934:
|
||||
movs r5, 0xB
|
||||
_0805A936:
|
||||
adds r0, r6, 0
|
||||
ldr r1, [sp, 0x28]
|
||||
ldr r2, [sp, 0x2C]
|
||||
bl sub_804539C
|
||||
movs r0, 0x2C
|
||||
bl sub_803E46C
|
||||
subs r5, 0x1
|
||||
cmp r5, 0
|
||||
bge _0805A936
|
||||
_0805A94C:
|
||||
add r0, sp, 0x18
|
||||
movs r1, 0
|
||||
ldrsh r0, [r0, r1]
|
||||
add r4, sp, 0x18
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r4, r2]
|
||||
bl GetTileSafe
|
||||
ldr r5, [r0, 0x10]
|
||||
cmp r5, 0
|
||||
beq _0805AA4C
|
||||
adds r0, r5, 0
|
||||
bl GetEntityType
|
||||
adds r7, r0, 0
|
||||
cmp r7, 0x1
|
||||
bne _0805A9FE
|
||||
add r4, sp, 0x1C
|
||||
ldr r1, _0805AA44
|
||||
adds r0, r4, 0
|
||||
bl InitPokemonMove
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl sub_80571F0
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
cmp r4, 0
|
||||
bne _0805A9B0
|
||||
mov r0, r10
|
||||
ldr r1, [sp, 0x24]
|
||||
bl sub_8057600
|
||||
lsls r0, 16
|
||||
asrs r0, 16
|
||||
ldr r1, _0805AA48
|
||||
movs r3, 0
|
||||
ldrsh r2, [r1, r3]
|
||||
str r4, [sp]
|
||||
str r4, [sp, 0x4]
|
||||
str r0, [sp, 0x8]
|
||||
str r4, [sp, 0xC]
|
||||
str r7, [sp, 0x10]
|
||||
str r4, [sp, 0x14]
|
||||
mov r0, r8
|
||||
adds r1, r5, 0
|
||||
movs r3, 0
|
||||
bl sub_806F370
|
||||
_0805A9B0:
|
||||
bl sub_8044B28
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
cmp r4, 0
|
||||
bne _0805AAB6
|
||||
mov r0, r8
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805AAB6
|
||||
ldr r0, _0805AA48
|
||||
movs r1, 0
|
||||
ldrsh r2, [r0, r1]
|
||||
str r4, [sp]
|
||||
str r4, [sp, 0x4]
|
||||
movs r0, 0xFF
|
||||
lsls r0, 1
|
||||
str r0, [sp, 0x8]
|
||||
str r4, [sp, 0xC]
|
||||
str r4, [sp, 0x10]
|
||||
str r4, [sp, 0x14]
|
||||
mov r0, r8
|
||||
mov r1, r8
|
||||
movs r3, 0
|
||||
bl sub_806F370
|
||||
bl sub_8044B28
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0805AAB6
|
||||
mov r0, r8
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805AAB6
|
||||
_0805A9FE:
|
||||
adds r0, r6, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805AAB6
|
||||
mov r0, r9
|
||||
bl sub_803F428
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0805AA22
|
||||
add r0, sp, 0x18
|
||||
bl sub_803F428
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805AA5E
|
||||
_0805AA22:
|
||||
ldr r2, [sp, 0x28]
|
||||
negs r7, r2
|
||||
ldr r3, [sp, 0x2C]
|
||||
negs r4, r3
|
||||
movs r5, 0xB
|
||||
_0805AA2C:
|
||||
adds r0, r6, 0
|
||||
adds r1, r7, 0
|
||||
adds r2, r4, 0
|
||||
bl sub_804539C
|
||||
movs r0, 0x2C
|
||||
bl sub_803E46C
|
||||
subs r5, 0x1
|
||||
cmp r5, 0
|
||||
bge _0805AA2C
|
||||
b _0805AA5E
|
||||
.align 2, 0
|
||||
_0805AA44: .4byte 0x00000163
|
||||
_0805AA48: .4byte gUnknown_80F4F82
|
||||
_0805AA4C:
|
||||
add r0, sp, 0x18
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
movs r3, 0x2
|
||||
ldrsh r2, [r4, r3]
|
||||
adds r0, r6, 0
|
||||
movs r3, 0
|
||||
bl sub_80694C0
|
||||
_0805AA5E:
|
||||
adds r0, r6, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805AAB6
|
||||
adds r0, r6, 0
|
||||
movs r1, 0
|
||||
bl sub_804535C
|
||||
mov r1, r9
|
||||
adds r0, r6, 0
|
||||
bl sub_80706A4
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805AA8C
|
||||
mov r0, r8
|
||||
adds r1, r6, 0
|
||||
movs r2, 0
|
||||
movs r3, 0
|
||||
bl sub_807D148
|
||||
_0805AA8C:
|
||||
ldr r0, [r6, 0x70]
|
||||
ldrb r0, [r0, 0x7]
|
||||
cmp r0, 0
|
||||
beq _0805AAA0
|
||||
mov r0, r9
|
||||
bl sub_804AC20
|
||||
movs r0, 0
|
||||
bl sub_807EC28
|
||||
_0805AAA0:
|
||||
adds r0, r6, 0
|
||||
bl sub_806A5B8
|
||||
ldr r0, _0805AAC8
|
||||
ldr r0, [r0]
|
||||
ldr r1, _0805AACC
|
||||
adds r0, r1
|
||||
ldrb r1, [r0]
|
||||
adds r0, r6, 0
|
||||
bl sub_8075900
|
||||
_0805AAB6:
|
||||
movs r0, 0x1
|
||||
_0805AAB8:
|
||||
add sp, 0x30
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0805AAC8: .4byte gDungeon
|
||||
_0805AACC: .4byte 0x00003a08
|
||||
thumb_func_end sub_805A85C
|
||||
|
||||
thumb_func_start sub_805AAD0
|
||||
sub_805AAD0:
|
||||
push {lr}
|
||||
adds r1, r0, 0
|
||||
bl FixedDamageStatusTarget
|
||||
movs r0, 0x1
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_805AAD0
|
||||
|
||||
thumb_func_start sub_805AAE0
|
||||
sub_805AAE0:
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r6, r1, 0
|
||||
ldr r0, [r4, 0x70]
|
||||
movs r7, 0
|
||||
movs r1, 0x9E
|
||||
lsls r1, 1
|
||||
adds r5, r0, r1
|
||||
ldr r0, [r5]
|
||||
bl RoundUpFixedPoint
|
||||
cmp r0, 0x1
|
||||
ble _0805AB20
|
||||
ldr r0, _0805AB1C
|
||||
ldr r2, [r0]
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
movs r3, 0x63
|
||||
bl RaiseAttackStageTarget
|
||||
mov r0, sp
|
||||
movs r1, 0x1
|
||||
bl sub_80943A0
|
||||
ldr r0, [sp]
|
||||
str r0, [r5]
|
||||
movs r7, 0x1
|
||||
b _0805AB36
|
||||
.align 2, 0
|
||||
_0805AB1C: .4byte gUnknown_8106A4C
|
||||
_0805AB20:
|
||||
ldr r0, _0805AB40
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
bl SetMessageArgument
|
||||
ldr r0, _0805AB44
|
||||
ldr r2, [r0]
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
bl sub_80522F4
|
||||
_0805AB36:
|
||||
adds r0, r7, 0
|
||||
add sp, 0x4
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0805AB40: .4byte gAvailablePokemonNames
|
||||
_0805AB44: .4byte gUnknown_80FC5CC
|
||||
thumb_func_end sub_805AAE0
|
||||
|
||||
thumb_func_start sub_805AB48
|
||||
sub_805AB48:
|
||||
push {lr}
|
||||
bl LightScreenStatusTarget
|
||||
movs r0, 0x1
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_805AB48
|
||||
|
||||
thumb_func_start sub_805AB54
|
||||
sub_805AB54:
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x8
|
||||
adds r5, r0, 0
|
||||
adds r6, r1, 0
|
||||
movs r7, 0
|
||||
movs r4, 0x80
|
||||
lsls r4, 1
|
||||
str r3, [sp]
|
||||
adds r3, r4, 0
|
||||
bl sub_8055640
|
||||
cmp r0, 0
|
||||
bne _0805AB70
|
||||
b _0805AC86
|
||||
_0805AB70:
|
||||
movs r7, 0x1
|
||||
ldr r0, _0805ABA8
|
||||
movs r1, 0
|
||||
ldrsh r2, [r0, r1]
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
bl sub_805727C
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0805AB88
|
||||
b _0805AC86
|
||||
_0805AB88:
|
||||
ldr r1, _0805ABAC
|
||||
ldr r0, _0805ABB0
|
||||
ldr r0, [r0]
|
||||
ldr r2, _0805ABB4
|
||||
adds r0, r2
|
||||
movs r2, 0
|
||||
ldrsh r0, [r0, r2]
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x8
|
||||
bhi _0805AC7C
|
||||
lsls r0, 2
|
||||
ldr r1, _0805ABB8
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.align 2, 0
|
||||
_0805ABA8: .4byte gUnknown_80F4E06
|
||||
_0805ABAC: .4byte gUnknown_80F5978
|
||||
_0805ABB0: .4byte gDungeon
|
||||
_0805ABB4: .4byte 0x00003a0e
|
||||
_0805ABB8: .4byte _0805ABBC
|
||||
.align 2, 0
|
||||
_0805ABBC:
|
||||
.4byte _0805ABE0
|
||||
.4byte _0805ABEC
|
||||
.4byte _0805AC08
|
||||
.4byte _0805AC16
|
||||
.4byte _0805AC34
|
||||
.4byte _0805AC50
|
||||
.4byte _0805AC64
|
||||
.4byte _0805AC70
|
||||
.4byte _0805AC7C
|
||||
_0805ABE0:
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r2, 0
|
||||
bl PoisonedStatusTarget
|
||||
b _0805AC86
|
||||
_0805ABEC:
|
||||
ldr r1, _0805AC04
|
||||
adds r0, r6, 0
|
||||
movs r2, 0x1
|
||||
bl CalculateStatusTurns
|
||||
adds r2, r0, 0
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r3, 0
|
||||
bl sub_8075C58
|
||||
b _0805AC86
|
||||
.align 2, 0
|
||||
_0805AC04: .4byte gUnknown_80F4E74
|
||||
_0805AC08:
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r2, 0x1
|
||||
movs r3, 0
|
||||
bl LowerMovementSpeedTarget
|
||||
b _0805AC86
|
||||
_0805AC16:
|
||||
ldr r0, _0805AC30
|
||||
ldr r2, [r0]
|
||||
movs r0, 0x1
|
||||
str r0, [sp]
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x4]
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r3, 0x1
|
||||
bl LowerAttackStageTarget
|
||||
b _0805AC86
|
||||
.align 2, 0
|
||||
_0805AC30: .4byte gUnknown_8106A4C
|
||||
_0805AC34:
|
||||
ldr r0, _0805AC4C
|
||||
ldr r2, [r0]
|
||||
movs r0, 0x1
|
||||
str r0, [sp]
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x4]
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r3, 0x1
|
||||
bl LowerDefenseStageTarget
|
||||
b _0805AC86
|
||||
.align 2, 0
|
||||
_0805AC4C: .4byte gUnknown_8106A4C
|
||||
_0805AC50:
|
||||
ldr r0, _0805AC60
|
||||
ldr r2, [r0]
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r3, 0
|
||||
bl LowerAccuracyStageTarget
|
||||
b _0805AC86
|
||||
.align 2, 0
|
||||
_0805AC60: .4byte gUnknown_8106A4C
|
||||
_0805AC64:
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r2, 0
|
||||
bl ConfuseStatusTarget
|
||||
b _0805AC86
|
||||
_0805AC70:
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r2, 0
|
||||
bl CringeStatusTarget
|
||||
b _0805AC86
|
||||
_0805AC7C:
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r2, 0
|
||||
bl ParalyzeStatusTarget
|
||||
_0805AC86:
|
||||
adds r0, r7, 0
|
||||
add sp, 0x8
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_805AB54
|
||||
|
||||
thumb_func_start sub_805AC90
|
||||
sub_805AC90:
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x4
|
||||
adds r5, r0, 0
|
||||
adds r6, r1, 0
|
||||
movs r7, 0
|
||||
movs r4, 0x80
|
||||
lsls r4, 1
|
||||
str r3, [sp]
|
||||
adds r3, r4, 0
|
||||
bl sub_8055640
|
||||
cmp r0, 0
|
||||
beq _0805ACCA
|
||||
movs r7, 0x1
|
||||
ldr r0, _0805ACD4
|
||||
movs r1, 0
|
||||
ldrsh r2, [r0, r1]
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
bl sub_805727C
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805ACCA
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r2, 0
|
||||
bl ConfuseStatusTarget
|
||||
_0805ACCA:
|
||||
adds r0, r7, 0
|
||||
add sp, 0x4
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0805ACD4: .4byte gUnknown_80F4DFA
|
||||
thumb_func_end sub_805AC90
|
||||
|
||||
thumb_func_start sub_805ACD8
|
||||
sub_805ACD8:
|
||||
push {r4-r6,lr}
|
||||
adds r5, r0, 0
|
||||
adds r6, r1, 0
|
||||
ldr r0, _0805AD00
|
||||
ldr r4, [r0]
|
||||
adds r0, r5, 0
|
||||
adds r2, r4, 0
|
||||
movs r3, 0x1
|
||||
bl RaiseAttackStageTarget
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
adds r2, r4, 0
|
||||
movs r3, 0x1
|
||||
bl RaiseDefenseStageTarget
|
||||
movs r0, 0x1
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0805AD00: .4byte gUnknown_8106A4C
|
||||
thumb_func_end sub_805ACD8
|
||||
|
||||
thumb_func_start sub_805AD04
|
||||
sub_805AD04:
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0x4
|
||||
adds r5, r0, 0
|
||||
adds r4, r1, 0
|
||||
ldr r1, _0805AD30
|
||||
adds r0, r4, 0
|
||||
movs r2, 0x1
|
||||
bl CalculateStatusTurns
|
||||
adds r3, r0, 0
|
||||
movs r0, 0x1
|
||||
str r0, [sp]
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
movs r2, 0x1
|
||||
bl PausedStatusTarget
|
||||
movs r0, 0x1
|
||||
add sp, 0x4
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0805AD30: .4byte gUnknown_80F4EE0
|
||||
thumb_func_end sub_805AD04
|
||||
|
||||
thumb_func_start sub_805AD34
|
||||
sub_805AD34:
|
||||
push {lr}
|
||||
sub sp, 0x8
|
||||
ldr r2, _0805AD50
|
||||
ldr r2, [r2]
|
||||
movs r3, 0x1
|
||||
str r3, [sp]
|
||||
str r3, [sp, 0x4]
|
||||
movs r3, 0x2
|
||||
bl LowerAttackStageTarget
|
||||
movs r0, 0x1
|
||||
add sp, 0x8
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0805AD50: .4byte gUnknown_8106A4C
|
||||
thumb_func_end sub_805AD34
|
||||
|
||||
thumb_func_start sub_805AD54
|
||||
sub_805AD54:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x4
|
||||
adds r5, r0, 0
|
||||
mov r9, r1
|
||||
movs r0, 0
|
||||
mov r10, r0
|
||||
ldr r1, [r5, 0x70]
|
||||
mov r8, r1
|
||||
ldrb r0, [r1, 0x6]
|
||||
cmp r0, 0
|
||||
beq _0805AD88
|
||||
ldr r0, _0805AD80
|
||||
ldr r0, [r0]
|
||||
ldr r1, _0805AD84
|
||||
adds r7, r0, r1
|
||||
movs r0, 0x10
|
||||
b _0805AD92
|
||||
.align 2, 0
|
||||
_0805AD80: .4byte gDungeon
|
||||
_0805AD84: .4byte 0x0001358c
|
||||
_0805AD88:
|
||||
ldr r0, _0805AD98
|
||||
ldr r0, [r0]
|
||||
ldr r1, _0805AD9C
|
||||
adds r7, r0, r1
|
||||
movs r0, 0x4
|
||||
_0805AD92:
|
||||
str r0, [sp]
|
||||
movs r6, 0
|
||||
b _0805AE0E
|
||||
.align 2, 0
|
||||
_0805AD98: .4byte gDungeon
|
||||
_0805AD9C: .4byte 0x0001357c
|
||||
_0805ADA0:
|
||||
lsls r0, r6, 2
|
||||
adds r0, r7
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805AE0C
|
||||
cmp r5, r4
|
||||
beq _0805AE0C
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
movs r3, 0
|
||||
bl CanTarget
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0805AE0C
|
||||
ldr r1, [r4, 0x70]
|
||||
adds r0, r1, 0
|
||||
adds r0, 0xA4
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
beq _0805AE0C
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x40
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x4A
|
||||
beq _0805ADE2
|
||||
cmp r0, 0x47
|
||||
bne _0805ADE6
|
||||
_0805ADE2:
|
||||
movs r0, 0x1
|
||||
b _0805ADE8
|
||||
_0805ADE6:
|
||||
movs r0, 0
|
||||
_0805ADE8:
|
||||
cmp r0, 0
|
||||
bne _0805AE0C
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
movs r2, 0x2
|
||||
mov r3, r9
|
||||
adds r3, 0x4
|
||||
bl sub_807D148
|
||||
movs r0, 0x1
|
||||
mov r10, r0
|
||||
mov r1, r8
|
||||
adds r1, 0xFB
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
bne _0805AE0C
|
||||
mov r0, r10
|
||||
strb r0, [r1]
|
||||
_0805AE0C:
|
||||
adds r6, 0x1
|
||||
_0805AE0E:
|
||||
ldr r1, [sp]
|
||||
cmp r6, r1
|
||||
blt _0805ADA0
|
||||
mov r0, r10
|
||||
cmp r0, 0
|
||||
bne _0805AE26
|
||||
ldr r0, _0805AE38
|
||||
ldr r2, [r0]
|
||||
adds r0, r5, 0
|
||||
mov r1, r9
|
||||
bl sub_80522F4
|
||||
_0805AE26:
|
||||
mov r0, r10
|
||||
add sp, 0x4
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0805AE38: .4byte gUnknown_81004EC
|
||||
thumb_func_end sub_805AD54
|
||||
|
||||
thumb_func_start sub_805AE3C
|
||||
sub_805AE3C:
|
||||
push {r4-r6,lr}
|
||||
mov r6, r8
|
||||
push {r6}
|
||||
sub sp, 0x4
|
||||
adds r5, r0, 0
|
||||
adds r6, r1, 0
|
||||
mov r8, r2
|
||||
adds r4, r3, 0
|
||||
bl SendThawedMessage
|
||||
movs r3, 0x80
|
||||
lsls r3, 2
|
||||
str r4, [sp]
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
mov r2, r8
|
||||
bl sub_8055640
|
||||
adds r1, r0, 0
|
||||
negs r0, r1
|
||||
orrs r0, r1
|
||||
lsrs r0, 31
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_805AE3C
|
||||
|
||||
thumb_func_start sub_805AE74
|
||||
sub_805AE74:
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x8
|
||||
adds r5, r0, 0
|
||||
adds r6, r1, 0
|
||||
movs r7, 0
|
||||
movs r4, 0x80
|
||||
lsls r4, 1
|
||||
str r3, [sp]
|
||||
adds r3, r4, 0
|
||||
bl sub_8055640
|
||||
cmp r0, 0
|
||||
beq _0805AEB8
|
||||
movs r7, 0x1
|
||||
ldr r0, _0805AEC4
|
||||
movs r1, 0
|
||||
ldrsh r2, [r0, r1]
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
bl sub_805727C
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805AEB8
|
||||
ldr r0, _0805AEC8
|
||||
ldr r2, [r0]
|
||||
str r7, [sp]
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x4]
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r3, 0x1
|
||||
bl LowerDefenseStageTarget
|
||||
_0805AEB8:
|
||||
adds r0, r7, 0
|
||||
add sp, 0x8
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0805AEC4: .4byte gUnknown_80F4DDA
|
||||
_0805AEC8: .4byte gUnknown_8106A4C
|
||||
thumb_func_end sub_805AE74
|
||||
|
||||
thumb_func_start sub_805AECC
|
||||
sub_805AECC:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x4
|
||||
adds r6, r0, 0
|
||||
adds r7, r1, 0
|
||||
adds r5, r2, 0
|
||||
adds r4, r3, 0
|
||||
movs r0, 0
|
||||
mov r8, r0
|
||||
adds r0, r6, 0
|
||||
bl SendThawedMessage
|
||||
movs r3, 0x80
|
||||
lsls r3, 1
|
||||
str r4, [sp]
|
||||
adds r0, r6, 0
|
||||
adds r1, r7, 0
|
||||
adds r2, r5, 0
|
||||
bl sub_8055640
|
||||
cmp r0, 0
|
||||
beq _0805AF1E
|
||||
movs r1, 0x1
|
||||
mov r8, r1
|
||||
ldr r0, _0805AF2C
|
||||
movs r1, 0
|
||||
ldrsh r2, [r0, r1]
|
||||
adds r0, r6, 0
|
||||
adds r1, r7, 0
|
||||
bl sub_805727C
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805AF1E
|
||||
adds r0, r6, 0
|
||||
adds r1, r7, 0
|
||||
movs r2, 0
|
||||
movs r3, 0
|
||||
bl BurnedStatusTarget
|
||||
_0805AF1E:
|
||||
mov r0, r8
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0805AF2C: .4byte gUnknown_80F4DFE
|
||||
thumb_func_end sub_805AECC
|
||||
|
||||
thumb_func_start sub_805AF30
|
||||
sub_805AF30:
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x4
|
||||
adds r7, r0, 0
|
||||
adds r5, r1, 0
|
||||
adds r6, r2, 0
|
||||
adds r4, r3, 0
|
||||
movs r0, 0x64
|
||||
bl DungeonRandInt
|
||||
adds r1, r0, 0
|
||||
cmp r0, 0x9
|
||||
bgt _0805AF54
|
||||
str r4, [sp]
|
||||
adds r0, r7, 0
|
||||
adds r1, r5, 0
|
||||
adds r2, r6, 0
|
||||
movs r3, 0x78
|
||||
b _0805AF92
|
||||
_0805AF54:
|
||||
cmp r0, 0x1D
|
||||
bgt _0805AF78
|
||||
ldr r0, [r5, 0x70]
|
||||
movs r1, 0x10
|
||||
ldrsh r2, [r0, r1]
|
||||
cmp r2, 0
|
||||
bge _0805AF64
|
||||
adds r2, 0x3
|
||||
_0805AF64:
|
||||
asrs r2, 2
|
||||
movs r0, 0x1
|
||||
str r0, [sp]
|
||||
adds r0, r7, 0
|
||||
adds r1, r5, 0
|
||||
movs r3, 0
|
||||
bl HealTargetHP
|
||||
movs r0, 0x1
|
||||
b _0805AF9C
|
||||
_0805AF78:
|
||||
cmp r1, 0x3B
|
||||
bgt _0805AF88
|
||||
str r4, [sp]
|
||||
adds r0, r7, 0
|
||||
adds r1, r5, 0
|
||||
adds r2, r6, 0
|
||||
movs r3, 0x50
|
||||
b _0805AF92
|
||||
_0805AF88:
|
||||
str r4, [sp]
|
||||
adds r0, r7, 0
|
||||
adds r1, r5, 0
|
||||
adds r2, r6, 0
|
||||
movs r3, 0x28
|
||||
_0805AF92:
|
||||
bl sub_8055864
|
||||
negs r1, r0
|
||||
orrs r1, r0
|
||||
lsrs r0, r1, 31
|
||||
_0805AF9C:
|
||||
add sp, 0x4
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_805AF30
|
||||
|
||||
.align 2,0
|
||||
@@ -257,7 +257,10 @@ struct Entity
|
||||
/* 0x14 */ struct Position32 prevPixelPos;
|
||||
s32 unk1C;
|
||||
/* 0x20 */ bool8 isVisible; // Turned off when a Pokémon faints.
|
||||
u8 fill21[0x25 - 0x21];
|
||||
u8 fill21;
|
||||
u8 unk22;
|
||||
u8 fill23;
|
||||
u8 unk24;
|
||||
/* 0x25 */ u8 room;
|
||||
// The global spawn index counter starts at 10. Each Pokémon that spawns increments the counter and
|
||||
// gets assigned the current counter value as its spawn index.
|
||||
|
||||
@@ -121,7 +121,9 @@ struct Dungeon
|
||||
/* 0x37F8 */ bool8 plusIsActive[2]; // Index 0: Enemy , Index 1: Team
|
||||
/* 0x37FA */ bool8 minusIsActive[2]; // Index 0: Enemy , Index 1: Team
|
||||
/* 0x37FC */ bool8 decoyActive;
|
||||
u8 fill37FD[0x3A0D - 0x37FD];
|
||||
u8 fill37FD[0x3A08 - 0x37FD];
|
||||
/* 0x3A08 */ u8 unk3A08;
|
||||
u8 fill3A09[0x3A0D - 0x3A09];
|
||||
/* 0x3A0D */ u8 unk3A0D;
|
||||
/* 0x3A0E */ s16 tileset;
|
||||
/* 0x3A10 */ u16 unk3A10;
|
||||
@@ -135,7 +137,7 @@ struct Dungeon
|
||||
/* 0xE264 */ u8 weather; // Uses the weather constants in weather.h.
|
||||
u8 unkE265; // Uses the weather constants in weather.h
|
||||
/* 0xE266 */ u8 weatherDamageCounter; // Timer for applying sandstorm/hail damage periodically.
|
||||
u8 unkE267[0xE26B - 0xE267];
|
||||
/* 0xE267 */ u8 unkE267[0xE26B - 0xE267];
|
||||
u8 unkE26B;
|
||||
u8 weatherTurns;
|
||||
u8 fillE26D[0xE26F - 0xE26D];
|
||||
|
||||
@@ -223,6 +223,8 @@ SECTIONS {
|
||||
asm/code_805744C.o(.text);
|
||||
src/code_8057824.o(.text);
|
||||
asm/code_8057824.o(.text);
|
||||
src/code_805A120.o(.text);
|
||||
asm/code_8057824_1.o(.text);
|
||||
src/status_actions.o(.text);
|
||||
src/move_checks.o(.text);
|
||||
asm/code_805D8C8.o(.text);
|
||||
|
||||
@@ -37,7 +37,7 @@ extern u8 sub_8042768(struct Entity *pokemon);
|
||||
extern void sub_806CDD4(struct Entity *pokemon, u8, u32);
|
||||
extern u32 sub_806F62C(u32);
|
||||
extern void PlaySoundEffect(u32);
|
||||
extern u8 sub_803F428(struct Entity *pokemon);
|
||||
extern u8 sub_803F428(struct Position *pos);
|
||||
extern void sub_8041550(struct Entity *pokemon, u32, u32, u32, u32, u32);
|
||||
|
||||
|
||||
@@ -836,9 +836,9 @@ void sub_80421C0(struct Entity *pokemon, u16 r1)
|
||||
PlaySoundEffect(r1);
|
||||
}
|
||||
|
||||
void sub_80421EC(struct Entity *pokemon, u16 r1)
|
||||
void sub_80421EC(struct Position *pos, u16 r1)
|
||||
{
|
||||
if(sub_803F428(pokemon) != 0)
|
||||
if(sub_803F428(pos) != 0)
|
||||
PlaySoundEffect(r1);
|
||||
}
|
||||
|
||||
|
||||
470
src/code_805A120.c
Normal file
470
src/code_805A120.c
Normal file
@@ -0,0 +1,470 @@
|
||||
#include "global.h"
|
||||
#include "constants/ability.h"
|
||||
#include "constants/move_id.h"
|
||||
#include "constants/status.h"
|
||||
#include "dungeon_entity.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_pokemon_attributes.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "item.h"
|
||||
#include "move_effects_target.h"
|
||||
#include "status.h"
|
||||
#include "status_actions.h"
|
||||
#include "code_8077274_1.h"
|
||||
#include "code_808417C.h"
|
||||
|
||||
extern u32 gUnknown_202F210;
|
||||
extern u8 gAvailablePokemonNames[];
|
||||
extern u8 gUnknown_202DE58[];
|
||||
extern u32 gUnknown_8106A4C;
|
||||
extern u32 gUnknown_8106A50;
|
||||
|
||||
extern s16 gUnknown_80F4E94[];
|
||||
extern u8 *gUnknown_80FC74C[];
|
||||
extern u8 *gUnknown_80FC790[];
|
||||
extern u8 *gUnknown_80FC7AC[];
|
||||
extern u8 *gUnknown_80FD578[];
|
||||
extern u8 *gUnknown_80FCCE4[];
|
||||
extern u8 *gUnknown_80FC81C[];
|
||||
extern u8 *gUnknown_80FC854[];
|
||||
extern u8 *gUnknown_80FCF7C[];
|
||||
extern u8 *gUnknown_80FC730[];
|
||||
extern u16 gUnknown_80F4F42;
|
||||
extern s16 gUnknown_80F4DF2;
|
||||
extern u8 *gUnknown_80FC770[];
|
||||
extern s32 gUnknown_80F51D4[];
|
||||
extern s16 gUnknown_80F4DD2;
|
||||
extern u8 *gUnknown_80FCA3C[];
|
||||
extern u8 *gUnknown_80FD170[];
|
||||
extern u8 *gUnknown_80FCCE8[];
|
||||
extern u8 *gUnknown_80FD18C[];
|
||||
extern u8 *gUnknown_80FD57C[];
|
||||
|
||||
bool8 sub_80706A4(struct Entity *pokemon, struct Position *pos);
|
||||
extern void sub_807D148(struct Entity *pokemon, struct Entity *target, u32 r2, struct Position *r3);
|
||||
extern void SetMessageArgument(u8 *buffer, struct Entity *r1, u32);
|
||||
void sub_80522F4(struct Entity *r0, struct Entity *r1, char r2[]);
|
||||
extern void sub_806A6E8(struct Entity *);
|
||||
extern u32 sub_8055640(struct Entity *, struct Entity *, struct Move *, u32, u32);
|
||||
extern void sub_807EA30(u32);
|
||||
extern bool8 sub_805727C(struct Entity *, struct Entity *, s16);
|
||||
extern void sub_806ABAC(struct Entity *, struct Entity *);
|
||||
extern u8 sub_807EAA0(u32, u32);
|
||||
extern void sub_8045C28(struct Item *, u8 , u8);
|
||||
extern u8 sub_8057308(struct Entity *, u32);
|
||||
extern void sub_805A7D4(struct Entity *, struct Entity *, struct Item *, struct Position *);
|
||||
extern void sub_8045394(struct Entity *, s32, s32);
|
||||
extern void sub_804652C(struct Entity *, struct Entity *, struct Item *, u32, struct Position *);
|
||||
|
||||
bool8 sub_805A120(struct Entity * pokemon,struct Entity * target, struct Move *move, u32 param_4)
|
||||
{
|
||||
struct EntityInfo *r9;
|
||||
struct EntityInfo *r8;
|
||||
struct EntityInfo *r7;
|
||||
struct EntityInfo *sp;
|
||||
struct Item item;
|
||||
bool32 flag;
|
||||
struct Item *item1;
|
||||
struct Item *item2;
|
||||
|
||||
flag = FALSE;
|
||||
r9 = pokemon->info;
|
||||
r7 = r9;
|
||||
r8 = target->info;
|
||||
sp = r8;
|
||||
|
||||
SetMessageArgument(gAvailablePokemonNames,pokemon,0);
|
||||
SetMessageArgument(gAvailablePokemonNames + 0x50,target,0);
|
||||
if (HasAbility(target, ABILITY_STICKY_HOLD)) {
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FCCE4);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (HasHeldItem(target, ITEM_ALERT_SPECS)) {
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FD578);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
item1 = &r9->heldItem;
|
||||
item2 = &r8->heldItem;
|
||||
if (!(item1->flags & ITEM_FLAG_EXISTS))
|
||||
flag = 1;
|
||||
|
||||
if(!(item2->flags & ITEM_FLAG_EXISTS))
|
||||
flag = 1;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FC7AC);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
item = r7->heldItem;
|
||||
r7->heldItem = sp->heldItem;
|
||||
sp->heldItem = item;
|
||||
sub_806A6E8(pokemon);
|
||||
sub_806A6E8(target);
|
||||
if (r7->unkFB == 0) {
|
||||
r7->unkFB = 1;
|
||||
}
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FC790);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool8 sub_805A210(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4)
|
||||
{
|
||||
bool8 flag;
|
||||
|
||||
gUnknown_202F210++;
|
||||
flag = sub_8055640(pokemon, target, move, gUnknown_202F210 << 8, param_4) ? TRUE : FALSE;
|
||||
return flag;
|
||||
}
|
||||
|
||||
bool8 sub_805A23C(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4)
|
||||
{
|
||||
if(move->id == MOVE_MUD_SPORT)
|
||||
{
|
||||
sub_807EA30(0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_807EA30(1);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool8 sub_805A258(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
bool8 flag;
|
||||
|
||||
flag = FALSE;
|
||||
if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) {
|
||||
flag = TRUE;
|
||||
if(sub_805727C(pokemon, target, 0))
|
||||
{
|
||||
LowerAccuracyStageTarget(pokemon, target, gUnknown_8106A4C, FALSE);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
bool8 sub_805A2A0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
return sub_805BA50(pokemon, target, move, param_4);
|
||||
}
|
||||
|
||||
bool8 sub_805A2B0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A50, 2);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_805A2C8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
LowerAttackStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_805A2E8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
bool8 flag;
|
||||
u32 uVar2;
|
||||
|
||||
flag = FALSE;
|
||||
if (target->info->chargingStatus == STATUS_DIVING) {
|
||||
uVar2 = 0x200;
|
||||
}
|
||||
else
|
||||
{
|
||||
uVar2 = 0x100;
|
||||
}
|
||||
if(sub_8055640(pokemon,target,move,uVar2,param_4) != 0)
|
||||
flag = TRUE;
|
||||
return flag;
|
||||
}
|
||||
|
||||
bool8 sub_805A31C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
struct EntityInfo * iVar3;
|
||||
struct EntityInfo * iVar4;
|
||||
|
||||
iVar3 = pokemon->info;
|
||||
iVar4 = target->info;
|
||||
if (HasAbility(target,0x35)) {
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FC854);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
iVar3->abilities[0] = iVar4->abilities[0];
|
||||
iVar3->abilities[1] = iVar4->abilities[1];
|
||||
gDungeon->unkC = 1;
|
||||
if (iVar3->unkFB == 0) {
|
||||
iVar3->unkFB = 1;
|
||||
}
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FC81C);
|
||||
sub_806ABAC(pokemon, pokemon);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
bool8 sub_805A394(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
gDungeon->unkE267[1] = gUnknown_80F4F42;
|
||||
if (sub_807EAA0(1,0) == 0) {
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FCF7C);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_805A3DC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
LowerDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Wish Move Action
|
||||
bool8 sub_805A3FC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
WishStatusTarget(pokemon, target);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_805A408(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
bool8 flag;
|
||||
|
||||
flag = FALSE;
|
||||
if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) {
|
||||
flag = TRUE;
|
||||
if(sub_805727C(pokemon, target, gUnknown_80F4DF2))
|
||||
{
|
||||
CringeStatusTarget(pokemon, target, FALSE);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
bool8 sub_805A450(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FC730);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_805A464(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
bool32 flag;
|
||||
struct Item item;
|
||||
struct Position pos;
|
||||
|
||||
flag = FALSE;
|
||||
if (sub_8055640(pokemon, target, move, 0x100, param_4) != 0) {
|
||||
flag = TRUE;
|
||||
if (sub_8057308(pokemon, 0) != 0) {
|
||||
if (!EntityExists(target)) {
|
||||
pos.x = 0;
|
||||
pos.y = 0;
|
||||
sub_8045C28(&item,0x69,2);
|
||||
sub_805A7D4(pokemon,target,&item,&pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
bool8 sub_805A4C0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FC74C);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_805A4D4(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
NappingStatusTarget(pokemon, target, CalculateStatusTurns(target, gUnknown_80F4E94, FALSE));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_805A4FC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
IngrainedStatusTarget(pokemon, target);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_805A508(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
u8 *stockpileStage;
|
||||
|
||||
stockpileStage = &target->info->stockpileStage;
|
||||
if (*stockpileStage != 0) {
|
||||
HealTargetHP(pokemon,target,gUnknown_80F51D4[*stockpileStage],0,TRUE);
|
||||
*stockpileStage = 0;
|
||||
}
|
||||
else {
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FC770);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Curse Move Action
|
||||
bool8 sub_805A55C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
CurseStatusTarget(pokemon, target);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_805A568(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4)
|
||||
{
|
||||
bool8 flag;
|
||||
|
||||
flag = sub_8055640(pokemon, target, move, 0x100, param_4) ? TRUE : FALSE;
|
||||
return flag;
|
||||
}
|
||||
|
||||
bool8 sub_805A588(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
u32 stat;
|
||||
bool32 flag;
|
||||
|
||||
flag = FALSE;
|
||||
if (sub_8055640(pokemon, target, move, 0x100, param_4) != 0) {
|
||||
flag = TRUE;
|
||||
if (sub_805727C(pokemon,pokemon,0) != 0) {
|
||||
stat = gUnknown_8106A4C;
|
||||
LowerAttackStageTarget(pokemon,pokemon,stat,1,0,FALSE);
|
||||
LowerDefenseStageTarget(pokemon,pokemon,stat,1,0,FALSE);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
bool8 sub_805A5E8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 stat, u32 param_5)
|
||||
{
|
||||
struct EntityInfo *iVar2;
|
||||
bool32 flag;
|
||||
|
||||
flag = FALSE;
|
||||
if (sub_8055640(pokemon,target,move,0x100,param_5) != 0) {
|
||||
flag = TRUE;
|
||||
if (sub_805727C(pokemon,pokemon,gUnknown_80F4DD2) != 0) {
|
||||
iVar2 = pokemon->info;
|
||||
RaiseDefenseStageTarget(pokemon,pokemon,stat,1);
|
||||
if (iVar2->unkFB == 0) {
|
||||
iVar2->unkFB = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
bool8 SpitUpMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
u8 *stockpileStage;
|
||||
|
||||
stockpileStage = &pokemon->info->stockpileStage;
|
||||
if (*stockpileStage != 0) {
|
||||
sub_8055640(pokemon,target,move,*stockpileStage << 8,param_4);
|
||||
*stockpileStage = 0;
|
||||
}
|
||||
else {
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FCA3C);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 sub_805A688(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
bool8 flag;
|
||||
|
||||
flag = FALSE;
|
||||
if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) {
|
||||
flag = TRUE;
|
||||
if(sub_805727C(pokemon, target, 0))
|
||||
{
|
||||
ConfuseStatusTarget(pokemon, target, FALSE);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Knock Off Move Action
|
||||
bool8 sub_805A6C8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4)
|
||||
{
|
||||
struct EntityInfo *iVar2;
|
||||
struct EntityInfo *iVar6;
|
||||
struct EntityInfo *iVar7;
|
||||
struct Item heldItem;
|
||||
struct Position pos;
|
||||
struct Item *itemPtr;
|
||||
u32 flag;
|
||||
u32 itemFlag;
|
||||
|
||||
iVar2 = pokemon->info;
|
||||
iVar6 = target->info;
|
||||
iVar7 = iVar6;
|
||||
SetMessageArgument(gAvailablePokemonNames, pokemon, 0);
|
||||
SetMessageArgument(gAvailablePokemonNames + 0x50, target, 0);
|
||||
if (HasAbility(target, ABILITY_STICKY_HOLD)) {
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FCCE8);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (HasHeldItem(target, ITEM_ALERT_SPECS)) {
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FD57C);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
heldItem = iVar6->heldItem;
|
||||
itemFlag = heldItem.flags;
|
||||
flag = ITEM_FLAG_EXISTS;
|
||||
flag &= itemFlag;
|
||||
if (flag == 0) {
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FD18C);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemPtr = &iVar7->heldItem;
|
||||
itemPtr->id = ITEM_NOTHING;
|
||||
itemPtr->quantity = 0;
|
||||
itemPtr->flags = 0;
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FD170); // $m1's item was swatted down!
|
||||
pos.x = gAdjacentTileOffsets[iVar2->action.direction].x;
|
||||
pos.y = gAdjacentTileOffsets[iVar2->action.direction].y;
|
||||
sub_805A7D4(pokemon,target,&heldItem,&pos);
|
||||
if (sub_80706A4(target, &target->pos) != 0) {
|
||||
sub_807D148(pokemon, target, 0, NULL);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_805A7D4(struct Entity * pokemon, struct Entity * target, struct Item *item, struct Position *pos)
|
||||
{
|
||||
struct Entity stackEntity;
|
||||
|
||||
stackEntity.type = ENTITY_ITEM;
|
||||
stackEntity.unk24 = 0;
|
||||
stackEntity.isVisible = TRUE;
|
||||
stackEntity.unk22 = 0;
|
||||
stackEntity.info = (struct EntityInfo*) item;
|
||||
stackEntity.pos.x = target->pos.x + pos->x;
|
||||
stackEntity.pos.y = target->pos.y + pos->y;
|
||||
sub_8045394(&stackEntity,(target->pos.x * 0x18 + 4) * 0x100,
|
||||
(target->pos.y * 0x18 + 4) * 0x100);
|
||||
stackEntity.spawnGenID = 0;
|
||||
SetMessageArgument(gUnknown_202DE58,&stackEntity,0);
|
||||
sub_804652C(pokemon,&stackEntity,item,1,0);
|
||||
}
|
||||
@@ -84,14 +84,6 @@ extern u8 gUnknown_80DB830[];
|
||||
extern u8 *gUnknown_80D4920[];
|
||||
extern u8 *gUnknown_80D4928[];
|
||||
|
||||
struct BulkItem_Alt {
|
||||
union tempHeld
|
||||
{
|
||||
struct BulkItem norm;
|
||||
u32 full_bits;
|
||||
} temp;
|
||||
};
|
||||
|
||||
void sub_80177F8(void)
|
||||
{
|
||||
struct unkStruct_203B208 *preload;
|
||||
@@ -180,24 +172,16 @@ void sub_80178D0(void)
|
||||
void sub_8017928(void)
|
||||
{
|
||||
int menuAction;
|
||||
u32 itemindex;
|
||||
u32 quantity;
|
||||
struct BulkItem_Alt item;
|
||||
struct BulkItem item;
|
||||
|
||||
if (sub_80144A4(&menuAction) == 0) {
|
||||
switch(menuAction)
|
||||
{
|
||||
case 4:
|
||||
|
||||
gTeamInventory_203B460->teamStorage[gUnknown_203B208->unkC.id] -= gUnknown_203B208->unkC.quantity;
|
||||
|
||||
itemindex = gUnknown_203B208->unkC.id;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | itemindex;
|
||||
|
||||
quantity = gUnknown_203B208->unkC.quantity << 8;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | quantity;
|
||||
|
||||
AddHeldItemToInventory((struct BulkItem *)&item);
|
||||
item.id = gUnknown_203B208->unkC.id;
|
||||
item.quantity = gUnknown_203B208->unkC.quantity;
|
||||
AddHeldItemToInventory(&item);
|
||||
UpdateKangaskhanStorageState(0x1d);
|
||||
break;
|
||||
case 1:
|
||||
@@ -240,12 +224,9 @@ void sub_80179A8(void)
|
||||
|
||||
void sub_8017A1C(void)
|
||||
{
|
||||
u8 itemID_u8;
|
||||
u32 quantity_cast;
|
||||
s32 itemID;
|
||||
int menuAction;
|
||||
u16 cast;
|
||||
struct BulkItem_Alt item;
|
||||
struct BulkItem item;
|
||||
|
||||
if (sub_80144A4(&menuAction) == 0) {
|
||||
|
||||
@@ -254,24 +235,24 @@ void sub_8017A1C(void)
|
||||
case 4:
|
||||
for(itemID = 0; itemID < NUMBER_OF_ITEM_IDS; itemID++)
|
||||
{
|
||||
itemID_u8 = itemID;
|
||||
if (sub_801CFE0(itemID) != 0) {
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | itemID_u8;
|
||||
if (IsThrowableItem(item.temp.norm.id)) {
|
||||
quantity_cast = gTeamInventory_203B460->teamStorage[item.temp.norm.id];
|
||||
if (quantity_cast > 99) {
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | 0x6300;
|
||||
if(sub_801CFE0(itemID) != 0)
|
||||
{
|
||||
item.id = itemID;
|
||||
if(IsThrowableItem(item.id))
|
||||
if(gTeamInventory_203B460->teamStorage[item.id] > 0x63)
|
||||
{
|
||||
item.quantity = 0x63;
|
||||
}
|
||||
else {
|
||||
cast = quantity_cast << 8;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | cast;
|
||||
else
|
||||
{
|
||||
item.quantity = gTeamInventory_203B460->teamStorage[item.id];
|
||||
}
|
||||
else
|
||||
{
|
||||
item.quantity = 1;
|
||||
}
|
||||
else {
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | 0x100;
|
||||
}
|
||||
gTeamInventory_203B460->teamStorage[item.temp.norm.id] -= item.temp.norm.quantity;
|
||||
AddHeldItemToInventory((struct BulkItem *)&item);
|
||||
gTeamInventory_203B460->teamStorage[item.id] -= item.quantity;
|
||||
AddHeldItemToInventory(&item);
|
||||
}
|
||||
}
|
||||
FillInventoryGaps();
|
||||
|
||||
@@ -11,14 +11,6 @@ extern void sub_8017F10(u32);
|
||||
|
||||
extern u8 sub_801CF14(u32);
|
||||
|
||||
struct BulkItem_Alt {
|
||||
union tempHeld
|
||||
{
|
||||
struct BulkItem norm;
|
||||
u32 full_bits;
|
||||
} temp;
|
||||
};
|
||||
|
||||
extern u8 sub_8012FD8(u32 *r0);
|
||||
extern void sub_8013114(u32 *, s32 *);
|
||||
extern void sub_801CBB8(void);
|
||||
@@ -128,10 +120,8 @@ void sub_8018620(void)
|
||||
|
||||
void sub_80186F8(void)
|
||||
{
|
||||
struct BulkItem_Alt item;
|
||||
u16 cast;
|
||||
struct BulkItem item;
|
||||
s32 itemID;
|
||||
u8 itemID_u8;
|
||||
|
||||
switch(sub_801CA08(1))
|
||||
{
|
||||
@@ -140,26 +130,24 @@ void sub_80186F8(void)
|
||||
{
|
||||
for(itemID = 0; itemID < NUMBER_OF_ITEM_IDS; itemID++)
|
||||
{
|
||||
itemID_u8 = itemID; // dumb cast needed to match
|
||||
if(sub_801CFE0(itemID) != 0)
|
||||
{
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | itemID_u8;
|
||||
if(IsThrowableItem(item.temp.norm.id))
|
||||
if(gTeamInventory_203B460->teamStorage[item.temp.norm.id] > 0x63)
|
||||
item.id = itemID;
|
||||
if(IsThrowableItem(item.id))
|
||||
if(gTeamInventory_203B460->teamStorage[item.id] > 0x63)
|
||||
{
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | (0xC6 << 7);
|
||||
item.quantity = 0x63;
|
||||
}
|
||||
else
|
||||
{
|
||||
cast = gTeamInventory_203B460->teamStorage[item.temp.norm.id] << 8;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | cast;
|
||||
item.quantity = gTeamInventory_203B460->teamStorage[item.id];
|
||||
}
|
||||
else
|
||||
{
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | (0x80 << 1);
|
||||
item.quantity = 1;
|
||||
}
|
||||
gTeamInventory_203B460->teamStorage[item.temp.norm.id] -= item.temp.norm.quantity;
|
||||
AddHeldItemToInventory((struct BulkItem *)&item);
|
||||
gTeamInventory_203B460->teamStorage[item.id] -= item.quantity;
|
||||
AddHeldItemToInventory(&item);
|
||||
}
|
||||
}
|
||||
FillInventoryGaps();
|
||||
@@ -198,9 +186,7 @@ void sub_80186F8(void)
|
||||
|
||||
void sub_8018854(void)
|
||||
{
|
||||
struct BulkItem_Alt item;
|
||||
u32 itemsCast;
|
||||
u32 indexCast;
|
||||
struct BulkItem item;
|
||||
|
||||
sub_801CA08(0);
|
||||
sub_8012FD8(&gUnknown_203B20C->unk70);
|
||||
@@ -209,16 +195,10 @@ void sub_8018854(void)
|
||||
{
|
||||
case 3:
|
||||
gUnknown_203B20C->unk8.quantity = gUnknown_203B20C->unkC0;
|
||||
|
||||
gTeamInventory_203B460->teamStorage[gUnknown_203B20C->unk8.id] -= gUnknown_203B20C->unk8.quantity;
|
||||
|
||||
indexCast = gUnknown_203B20C->unk8.id;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | indexCast;
|
||||
|
||||
itemsCast = (gUnknown_203B20C->unk8.quantity << 8);
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | itemsCast;
|
||||
|
||||
AddHeldItemToInventory((struct BulkItem *)&item);
|
||||
item.id = gUnknown_203B20C->unk8.id;
|
||||
item.quantity = gUnknown_203B20C->unk8.quantity;
|
||||
AddHeldItemToInventory(&item);
|
||||
if(sub_801CF14(1) == 0)
|
||||
if(GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE)
|
||||
{
|
||||
@@ -289,10 +269,8 @@ void sub_8018904(void)
|
||||
|
||||
void sub_80189C8(void)
|
||||
{
|
||||
struct BulkItem_Alt item;
|
||||
struct BulkItem item;
|
||||
s32 menuAction;
|
||||
u32 itemsCast;
|
||||
u32 indexCast;
|
||||
|
||||
menuAction = 0;
|
||||
|
||||
@@ -312,14 +290,9 @@ void sub_80189C8(void)
|
||||
else
|
||||
{
|
||||
gTeamInventory_203B460->teamStorage[gUnknown_203B20C->unk8.id] -= gUnknown_203B20C->unk8.quantity;
|
||||
|
||||
indexCast = gUnknown_203B20C->unk8.id;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | indexCast;
|
||||
|
||||
itemsCast = (gUnknown_203B20C->unk8.quantity << 8);
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | itemsCast;
|
||||
|
||||
AddHeldItemToInventory((struct BulkItem *)&item);
|
||||
item.id = gUnknown_203B20C->unk8.id;
|
||||
item.quantity = gUnknown_203B20C->unk8.quantity;
|
||||
AddHeldItemToInventory(&item);
|
||||
if(sub_801CF14(1) == 0)
|
||||
if(GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE)
|
||||
{
|
||||
|
||||
@@ -83,14 +83,6 @@ struct unkStruct_203B214
|
||||
extern struct unkStruct_203B214 *gUnknown_203B214;
|
||||
extern struct unkStruct_203B214 *gUnknown_203B21C;
|
||||
|
||||
struct Item_Alt
|
||||
{
|
||||
union temp {
|
||||
struct Item norm;
|
||||
u32 full_bits;
|
||||
} temp;
|
||||
};
|
||||
|
||||
extern void sub_8013818(void *, u32, u32, u32);
|
||||
|
||||
extern u8 sub_8019FB0(void);
|
||||
@@ -523,10 +515,8 @@ u32 sub_8019E40(u32 r0)
|
||||
|
||||
u32 sub_8019EDC(u8 r0)
|
||||
{
|
||||
struct Item_Alt slot;
|
||||
struct Item slot;
|
||||
struct BulkItem *item;
|
||||
u32 itemIndex;
|
||||
u32 numItems;
|
||||
|
||||
if(r0 == 0)
|
||||
{
|
||||
@@ -542,14 +532,9 @@ u32 sub_8019EDC(u8 r0)
|
||||
return 2;
|
||||
case 1:
|
||||
item = GetKecleonShopItem(sub_8019FB0());
|
||||
|
||||
// NOTE: needs seperate vars to match
|
||||
itemIndex = item->id << 16;
|
||||
slot.temp.full_bits = (slot.temp.full_bits & 0xff00ffff) | itemIndex;
|
||||
numItems = item->quantity << 8;
|
||||
slot.temp.full_bits = (slot.temp.full_bits & 0xffff00ff) | numItems;
|
||||
|
||||
if(GetStackBuyPrice((struct Item *)&slot) > gTeamInventory_203B460->teamMoney)
|
||||
slot.id = item->id;
|
||||
slot.quantity = item->quantity;
|
||||
if(GetStackBuyPrice(&slot) > gTeamInventory_203B460->teamMoney)
|
||||
{
|
||||
PlayMenuSoundEffect(2);
|
||||
}
|
||||
@@ -675,7 +660,7 @@ void sub_801A0D8(void)
|
||||
u8 auStack204 [80];
|
||||
struct unkStruct_8090F58 local_7c;
|
||||
u8 auStack112 [80];
|
||||
struct Item_Alt item;
|
||||
struct Item item;
|
||||
u8 temp_calc;
|
||||
|
||||
// Needed for the shifts..
|
||||
@@ -691,21 +676,15 @@ void sub_801A0D8(void)
|
||||
{
|
||||
temp_calc = (gUnknown_203B214->unk1E * gUnknown_203B214->unk1C) + index;
|
||||
heldItem = GetKecleonShopItem(temp_calc);
|
||||
|
||||
index_shift = heldItem->id << 16;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xff00ffff) | index_shift;
|
||||
|
||||
quantity_shift = heldItem->quantity << 8;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | quantity_shift;
|
||||
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP);
|
||||
|
||||
item.id = heldItem->id;
|
||||
item.quantity = heldItem->quantity;
|
||||
item.flags = (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP);
|
||||
local_7c.unk0 = 1;
|
||||
local_7c.unk4 = 0;
|
||||
local_7c.unk6 = 0x58;
|
||||
local_7c.unk8 = 1;
|
||||
sub_8090E14(auStack204,(struct Item *)&item,&local_7c);
|
||||
buyPrice = GetStackBuyPrice((struct Item *)&item);
|
||||
sub_8090E14(auStack204,&item,&local_7c);
|
||||
buyPrice = GetStackBuyPrice(&item);
|
||||
if (buyPrice <= gTeamInventory_203B460->teamMoney) {
|
||||
y = sub_8013800(gUnknown_203B214,index);
|
||||
xxx_call_draw_string(8,y,auStack204,gUnknown_203B214->unk34,0);
|
||||
@@ -746,10 +725,8 @@ u32 sub_801A20C(u32 r0)
|
||||
|
||||
u32 sub_801A2A8(u8 r0)
|
||||
{
|
||||
struct Item_Alt slot;
|
||||
struct Item slot;
|
||||
struct BulkItem *item;
|
||||
u32 itemIndex;
|
||||
u32 numItems;
|
||||
|
||||
if(r0 == 0)
|
||||
{
|
||||
@@ -767,12 +744,10 @@ u32 sub_801A2A8(u8 r0)
|
||||
item = GetKecleonWareItem(sub_801A37C());
|
||||
|
||||
// NOTE: needs seperate vars to match
|
||||
itemIndex = item->id << 16;
|
||||
slot.temp.full_bits = (slot.temp.full_bits & 0xff00ffff) | itemIndex;
|
||||
numItems = item->quantity << 8;
|
||||
slot.temp.full_bits = (slot.temp.full_bits & 0xffff00ff) | numItems;
|
||||
slot.id = item->id;
|
||||
slot.quantity = item->quantity;
|
||||
|
||||
if(GetStackBuyPrice((struct Item *)&slot) > gTeamInventory_203B460->teamMoney)
|
||||
if(GetStackBuyPrice(&slot) > gTeamInventory_203B460->teamMoney)
|
||||
{
|
||||
PlayMenuSoundEffect(2);
|
||||
}
|
||||
@@ -897,7 +872,7 @@ void sub_801A4A4(void)
|
||||
u8 buffer1 [80];
|
||||
struct unkStruct_8090F58 local_7c;
|
||||
u8 buffer2 [80];
|
||||
struct Item_Alt item;
|
||||
struct Item item;
|
||||
u8 temp_calc;
|
||||
|
||||
// Needed for the shifts..
|
||||
@@ -913,15 +888,9 @@ void sub_801A4A4(void)
|
||||
{
|
||||
temp_calc = (gUnknown_203B21C->unk1E * gUnknown_203B21C->unk1C) + index;
|
||||
heldItem = GetKecleonWareItem(temp_calc);
|
||||
|
||||
index_shift = heldItem->id << 16;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xff00ffff) | index_shift;
|
||||
|
||||
quantity_shift = heldItem->quantity << 8;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | quantity_shift;
|
||||
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP);
|
||||
|
||||
item.id = heldItem->id;
|
||||
item.quantity = heldItem->quantity;
|
||||
item.flags = (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP);
|
||||
local_7c.unk0 = 1;
|
||||
local_7c.unk4 = 0;
|
||||
local_7c.unk6 = 0x58;
|
||||
|
||||
@@ -35,7 +35,7 @@ extern void sub_8078F50(struct Entity *, struct Entity *);
|
||||
extern void sub_807DC68(struct Entity *, struct Entity *);
|
||||
extern void sub_8078A58(struct Entity *, struct Entity *, s16, u32);
|
||||
extern u32 sub_803D73C(u32);
|
||||
extern void sub_8045C28(struct Item *, u8 , u8 *);
|
||||
extern void sub_8045C28(struct Item *, u8 , u8);
|
||||
extern void sub_80464C8(struct Entity *, struct Position *, struct Item *);
|
||||
extern void sub_8068FE0(struct Entity *, u32, struct Entity *r2);
|
||||
extern void sub_80522F4(struct Entity *r1, struct Entity *r2, const char []);
|
||||
@@ -149,16 +149,6 @@ extern s16 gUnknown_80F4E08;
|
||||
extern u8 gDungeonCamouflageTypes[76];
|
||||
extern u32 gUnknown_202F228;
|
||||
|
||||
struct Position_Alt
|
||||
{
|
||||
union PositionAlt
|
||||
{
|
||||
struct Position norm;
|
||||
u32 full_bits;
|
||||
} temp;
|
||||
};
|
||||
|
||||
|
||||
extern s16 gUnknown_80F4DC6;
|
||||
extern u8 *gUnknown_80FEFF4[];
|
||||
|
||||
@@ -1182,9 +1172,7 @@ bool8 FillInOrbAction(struct Entity *pokemon,struct Entity *target)
|
||||
int y;
|
||||
bool8 filledInTile;
|
||||
int x;
|
||||
u16 cast_x;
|
||||
u32 cast_y;
|
||||
struct Position_Alt tileCoords;
|
||||
struct Position tileCoords;
|
||||
|
||||
filledInTile = FALSE;
|
||||
iVar5 = target->info;
|
||||
@@ -1195,20 +1183,17 @@ bool8 FillInOrbAction(struct Entity *pokemon,struct Entity *target)
|
||||
else
|
||||
{
|
||||
// Calculate the coordinates of the tile in front of the user
|
||||
cast_x = target->pos.x + gAdjacentTileOffsets[iVar5->action.direction].x;
|
||||
tileCoords.temp.full_bits = (tileCoords.temp.full_bits & 0xffff0000) | cast_x;
|
||||
tileCoords.x = target->pos.x + gAdjacentTileOffsets[iVar5->action.direction].x;
|
||||
tileCoords.y = target->pos.y + gAdjacentTileOffsets[iVar5->action.direction].y;
|
||||
|
||||
cast_y = ((u16)(target->pos.y + gAdjacentTileOffsets[iVar5->action.direction].y)) << 0x10;
|
||||
tileCoords.temp.full_bits = (tileCoords.temp.full_bits & 0x0000ffff) | cast_y;
|
||||
|
||||
sub_8042A54((struct Position *)&tileCoords);
|
||||
tileToFill = GetTileSafe(tileCoords.temp.norm.x,tileCoords.temp.norm.y);
|
||||
sub_8042A54(&tileCoords);
|
||||
tileToFill = GetTileSafe(tileCoords.x,tileCoords.y);
|
||||
if ((tileToFill->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) == TERRAIN_TYPE_SECONDARY) {
|
||||
tileToFill->terrainType = (tileToFill->terrainType & ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) | TERRAIN_TYPE_NORMAL;
|
||||
|
||||
for(y = -1; y < 2; y++)
|
||||
for(x = -1; x < 2; x++)
|
||||
sub_80498A8(tileCoords.temp.norm.x + x, tileCoords.temp.norm.y + y);
|
||||
sub_80498A8(tileCoords.x + x, tileCoords.y + y);
|
||||
filledInTile = TRUE;
|
||||
sub_806CF60();
|
||||
}
|
||||
@@ -1218,7 +1203,7 @@ bool8 FillInOrbAction(struct Entity *pokemon,struct Entity *target)
|
||||
sub_8049BB0(x,y);
|
||||
|
||||
if (filledInTile) {
|
||||
sub_8042A64((struct Position *)&tileCoords);
|
||||
sub_8042A64(&tileCoords);
|
||||
sub_80522F4(pokemon,target,*gUnknown_80FD0B4);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -539,12 +539,9 @@ void HandleMissionReward(void)
|
||||
{
|
||||
int moneyReward;
|
||||
const u8 *rankString;
|
||||
u8 uVar7;
|
||||
u8 itemID;
|
||||
struct unkStruct_8090F58 local_20;
|
||||
struct Item_Alt item;
|
||||
u32 quantity;
|
||||
u32 index_cast;
|
||||
u32 index_cast2;
|
||||
struct Item item;
|
||||
|
||||
switch(gUnknown_203B310->state) {
|
||||
case 0:
|
||||
@@ -615,29 +612,22 @@ void HandleMissionReward(void)
|
||||
gUnknown_203B310->nextState = 4;
|
||||
break;
|
||||
case 4:
|
||||
uVar7 = gUnknown_203B310->unk10->itemRewards[0];
|
||||
if (uVar7 != 0)
|
||||
itemID = gUnknown_203B310->unk10->itemRewards[0];
|
||||
if (itemID != ITEM_NOTHING)
|
||||
{
|
||||
if (gUnknown_203B310->unk10->moneyReward == 0) {
|
||||
|
||||
// Cast ItemIndex
|
||||
index_cast = uVar7 << 16;
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xff00ffff) | index_cast;
|
||||
|
||||
index_cast2 = item.temp.full_bits >> 16;
|
||||
if (IsThrowableItem(index_cast2)) {
|
||||
// Cast number items
|
||||
quantity = (gUnknown_203B310->unk10->quantity << 8);
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | quantity;
|
||||
item.id = itemID;
|
||||
if (IsThrowableItem(item.id)) {
|
||||
item.quantity = gUnknown_203B310->unk10->quantity;
|
||||
}
|
||||
else {
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | 0;
|
||||
item.quantity = 0;
|
||||
}
|
||||
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | ITEM_FLAG_EXISTS;
|
||||
item.flags = ITEM_FLAG_EXISTS;
|
||||
local_20.unk0 = 0;
|
||||
local_20.unk4 = 0;
|
||||
local_20.unk8 = 1;
|
||||
sub_8090E14(gUnknown_202DEA8,(struct Item *)&item,&local_20);
|
||||
sub_8090E14(gUnknown_202DEA8,&item,&local_20);
|
||||
if (gUnknown_203B310->displayClientDialogueSprite) {
|
||||
sub_80141B4(gUnknown_80E0640,0,&gUnknown_203B310->faceFile,0x10d);
|
||||
gUnknown_203B310->nextState = 5;
|
||||
|
||||
Reference in New Issue
Block a user