Merge branch 'master' into pokenav_match_call

This commit is contained in:
PikalaxALT 2018-03-02 21:49:09 -05:00
commit df128cbfed
84 changed files with 9045 additions and 14516 deletions

View File

@ -13,7 +13,7 @@ cache:
apt: true
install:
- pushd $HOME
- travis_retry wget http://download.sourceforge.net/devkitpro/devkitARM_r47-x86_64-linux.tar.bz2
- travis_retry wget https://downloads.sourceforge.net/project/devkitpro/devkitARM/devkitARM_r47/devkitARM_r47-x86_64-linux.tar.bz2
- tar xf devkitARM*.tar.bz2
- travis_retry git clone https://github.com/pret/agbcc.git
- cd agbcc && ./build.sh && ./install.sh $TRAVIS_BUILD_DIR

File diff suppressed because it is too large Load Diff

View File

@ -3134,7 +3134,7 @@ _081639FC:
bl __umodsi3
cmp r0, 0
bne _08163A78
bl sub_81DA57C
bl UpdateGymLeaderRematch
b _08163A78
.pool
_08163A2C:

View File

@ -1,823 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start BlitBitmapRect4BitWithoutColorKey
@ void BlitBitmapRect4BitWithoutColorKey(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height)
BlitBitmapRect4BitWithoutColorKey: @ 8002BDC
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x14
ldr r4, [sp, 0x2C]
ldr r5, [sp, 0x30]
ldr r6, [sp, 0x34]
ldr r7, [sp, 0x38]
lsls r2, 16
lsrs r2, 16
lsls r3, 16
lsrs r3, 16
lsls r4, 16
lsrs r4, 16
lsls r5, 16
lsrs r5, 16
lsls r6, 16
lsrs r6, 16
lsls r7, 16
lsrs r7, 16
str r4, [sp]
str r5, [sp, 0x4]
str r6, [sp, 0x8]
str r7, [sp, 0xC]
movs r4, 0xFF
str r4, [sp, 0x10]
bl BlitBitmapRect4Bit
add sp, 0x14
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end BlitBitmapRect4BitWithoutColorKey
thumb_func_start BlitBitmapRect4Bit
@ void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height, u8 colorKey)
BlitBitmapRect4Bit: @ 8002C20
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x2C
str r0, [sp]
str r1, [sp, 0x4]
ldr r0, [sp, 0x4C]
ldr r1, [sp, 0x50]
ldr r4, [sp, 0x54]
ldr r5, [sp, 0x58]
ldr r6, [sp, 0x5C]
lsls r2, 16
lsrs r2, 16
str r2, [sp, 0x8]
lsls r3, 16
lsrs r7, r3, 16
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0xC]
lsls r1, 16
lsrs r1, 16
mov r9, r1
lsls r4, 16
lsrs r4, 16
lsls r5, 16
lsrs r5, 16
lsls r6, 24
lsrs r6, 24
str r6, [sp, 0x10]
ldr r0, [sp, 0x4]
ldrh r3, [r0, 0x4]
ldr r1, [sp, 0xC]
subs r0, r3, r1
adds r2, r4
mov r8, r2
cmp r0, r4
bge _08002C74
ldr r2, [sp, 0x8]
adds r0, r2
mov r8, r0
_08002C74:
ldr r4, [sp, 0x4]
ldrh r0, [r4, 0x6]
mov r1, r9
subs r0, r1
adds r2, r5, r7
str r2, [sp, 0x14]
cmp r0, r5
bge _08002C88
adds r0, r7
str r0, [sp, 0x14]
_08002C88:
ldr r4, [sp]
ldrh r1, [r4, 0x4]
movs r2, 0x7
adds r0, r1, 0
ands r0, r2
adds r1, r0
asrs r1, 3
str r1, [sp, 0x18]
adds r0, r3, 0
ands r0, r2
adds r0, r3, r0
asrs r0, 3
str r0, [sp, 0x1C]
ldr r0, [sp, 0x10]
cmp r0, 0xFF
bne _08002D46
adds r3, r7, 0
mov r1, r9
ldr r2, [sp, 0x14]
cmp r3, r2
blt _08002CB4
b _08002DEE
_08002CB4:
ldr r5, [sp, 0x8]
ldr r6, [sp, 0xC]
adds r4, r3, 0x1
str r4, [sp, 0x24]
adds r0, r1, 0x1
str r0, [sp, 0x28]
cmp r5, r8
bge _08002D3A
movs r7, 0x3
asrs r0, r3, 3
ldr r2, [sp, 0x18]
muls r0, r2
lsls r0, 5
mov r10, r0
lsls r0, r3, 29
lsrs r0, 27
mov r9, r0
asrs r0, r1, 3
ldr r4, [sp, 0x1C]
muls r0, r4
lsls r0, 5
mov r12, r0
lsls r0, r1, 29
lsrs r3, r0, 27
_08002CE4:
asrs r0, r5, 1
ands r0, r7
ldr r2, [sp]
ldr r1, [r2]
adds r1, r0
asrs r0, r5, 3
lsls r0, 5
adds r1, r0
add r1, r10
mov r4, r9
adds r2, r1, r4
asrs r0, r6, 1
ands r0, r7
ldr r4, [sp, 0x4]
ldr r1, [r4]
adds r1, r0
asrs r0, r6, 3
lsls r0, 5
adds r1, r0
add r1, r12
adds r4, r1, r3
ldrb r2, [r2]
adds r0, r5, 0
movs r1, 0x1
ands r0, r1
lsls r0, 2
asrs r2, r0
movs r0, 0xF
ands r2, r0
adds r0, r6, 0
ands r0, r1
lsls r1, r0, 2
lsls r2, r1
movs r0, 0xF0
asrs r0, r1
ldrb r1, [r4]
ands r0, r1
orrs r2, r0
strb r2, [r4]
adds r5, 0x1
adds r6, 0x1
cmp r5, r8
blt _08002CE4
_08002D3A:
ldr r3, [sp, 0x24]
ldr r1, [sp, 0x28]
ldr r2, [sp, 0x14]
cmp r3, r2
blt _08002CB4
b _08002DEE
_08002D46:
adds r3, r7, 0
mov r1, r9
ldr r4, [sp, 0x14]
cmp r3, r4
bge _08002DEE
_08002D50:
ldr r5, [sp, 0x8]
ldr r6, [sp, 0xC]
adds r0, r3, 0x1
str r0, [sp, 0x24]
adds r2, r1, 0x1
str r2, [sp, 0x28]
cmp r5, r8
bge _08002DE4
movs r4, 0x3
mov r9, r4
asrs r0, r3, 3
ldr r2, [sp, 0x18]
muls r0, r2
lsls r0, 5
str r0, [sp, 0x20]
lsls r0, r3, 29
lsrs r0, 27
mov r10, r0
movs r3, 0x1
asrs r0, r1, 3
ldr r4, [sp, 0x1C]
muls r0, r4
lsls r0, 5
mov r12, r0
lsls r0, r1, 29
lsrs r7, r0, 27
_08002D84:
asrs r0, r5, 1
mov r1, r9
ands r0, r1
ldr r2, [sp]
ldr r1, [r2]
adds r1, r0
asrs r0, r5, 3
lsls r0, 5
adds r1, r0
ldr r4, [sp, 0x20]
adds r1, r4
mov r0, r10
adds r2, r1, r0
asrs r0, r6, 1
mov r1, r9
ands r0, r1
ldr r4, [sp, 0x4]
ldr r1, [r4]
adds r1, r0
asrs r0, r6, 3
lsls r0, 5
adds r1, r0
add r1, r12
adds r4, r1, r7
ldrb r2, [r2]
adds r0, r5, 0
ands r0, r3
lsls r0, 2
asrs r2, r0
movs r0, 0xF
ands r2, r0
ldr r0, [sp, 0x10]
cmp r2, r0
beq _08002DDC
adds r0, r6, 0
ands r0, r3
lsls r1, r0, 2
lsls r2, r1
movs r0, 0xF0
asrs r0, r1
ldrb r1, [r4]
ands r0, r1
orrs r2, r0
strb r2, [r4]
_08002DDC:
adds r5, 0x1
adds r6, 0x1
cmp r5, r8
blt _08002D84
_08002DE4:
ldr r3, [sp, 0x24]
ldr r1, [sp, 0x28]
ldr r2, [sp, 0x14]
cmp r3, r2
blt _08002D50
_08002DEE:
add sp, 0x2C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end BlitBitmapRect4Bit
thumb_func_start FillBitmapRect4Bit
@ void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue)
FillBitmapRect4Bit: @ 8002E00
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
mov r9, r0
ldr r0, [sp, 0x28]
ldr r4, [sp, 0x2C]
lsls r1, 16
lsrs r1, 16
str r1, [sp]
lsls r2, 16
lsrs r2, 16
adds r6, r2, 0
lsls r3, 16
lsrs r3, 16
lsls r0, 16
lsrs r0, 16
lsls r4, 24
lsrs r5, r4, 24
adds r4, r1, r3
mov r3, r9
ldrh r1, [r3, 0x4]
cmp r4, r1
ble _08002E36
adds r4, r1, 0
_08002E36:
adds r2, r0
mov r12, r2
mov r2, r9
ldrh r0, [r2, 0x6]
cmp r12, r0
ble _08002E44
mov r12, r0
_08002E44:
movs r0, 0x7
ands r0, r1
adds r0, r1, r0
asrs r0, 3
str r0, [sp, 0x4]
lsls r0, r5, 28
lsrs r0, 24
mov r8, r0
movs r3, 0xF
mov r10, r3
mov r0, r10
ands r0, r5
mov r10, r0
adds r1, r6, 0
cmp r1, r12
bge _08002EB6
_08002E64:
ldr r3, [sp]
adds r7, r1, 0x1
cmp r3, r4
bge _08002EB0
asrs r0, r1, 3
ldr r2, [sp, 0x4]
muls r0, r2
lsls r6, r0, 5
lsls r0, r1, 29
lsrs r5, r0, 27
_08002E78:
asrs r2, r3, 1
movs r0, 0x3
ands r2, r0
mov r0, r9
ldr r1, [r0]
adds r1, r2
asrs r0, r3, 3
lsls r0, 5
adds r1, r0
adds r1, r6
adds r2, r1, r5
lsls r0, r3, 31
cmp r0, 0
beq _08002E9E
ldrb r1, [r2]
movs r0, 0xF
ands r0, r1
mov r1, r8
b _08002EA6
_08002E9E:
ldrb r1, [r2]
movs r0, 0xF0
ands r0, r1
mov r1, r10
_08002EA6:
orrs r0, r1
strb r0, [r2]
adds r3, 0x1
cmp r3, r4
blt _08002E78
_08002EB0:
adds r1, r7, 0
cmp r1, r12
blt _08002E64
_08002EB6:
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end FillBitmapRect4Bit
thumb_func_start BlitBitmapRect4BitTo8Bit
@ void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height, u8 colorKey, u8 paletteOffset)
BlitBitmapRect4BitTo8Bit: @ 8002EC8
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x3C
str r0, [sp]
str r1, [sp, 0x4]
ldr r0, [sp, 0x5C]
ldr r1, [sp, 0x60]
ldr r5, [sp, 0x64]
ldr r4, [sp, 0x68]
ldr r6, [sp, 0x6C]
ldr r7, [sp, 0x70]
mov r8, r7
lsls r2, 16
lsrs r2, 16
str r2, [sp, 0x8]
lsls r3, 16
lsrs r3, 16
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0xC]
lsls r1, 16
lsrs r7, r1, 16
lsls r5, 16
lsrs r5, 16
lsls r4, 16
lsrs r4, 16
lsls r6, 24
lsrs r6, 24
str r6, [sp, 0x10]
mov r0, r8
lsls r0, 28
lsrs r0, 24
str r0, [sp, 0x14]
lsls r0, r6, 28
lsrs r0, 24
str r0, [sp, 0x28]
ldr r1, [sp, 0x4]
ldrh r0, [r1, 0x4]
ldr r2, [sp, 0xC]
subs r0, r2
ldr r1, [sp, 0x8]
adds r1, r5, r1
str r1, [sp, 0x18]
cmp r0, r5
bge _08002F2E
ldr r2, [sp, 0x8]
adds r0, r2
str r0, [sp, 0x18]
_08002F2E:
ldr r5, [sp, 0x4]
ldrh r1, [r5, 0x6]
subs r0, r1, r7
cmp r0, r4
bge _08002F40
adds r0, r3, r1
subs r0, r7
str r0, [sp, 0x1C]
b _08002F44
_08002F40:
adds r4, r3, r4
str r4, [sp, 0x1C]
_08002F44:
ldr r0, [sp]
ldrh r1, [r0, 0x4]
movs r2, 0x7
adds r0, r1, 0
ands r0, r2
adds r1, r0
asrs r1, 3
str r1, [sp, 0x20]
ldr r5, [sp, 0x4]
ldrh r1, [r5, 0x4]
adds r0, r1, 0
ands r0, r2
adds r1, r0
asrs r1, 3
str r1, [sp, 0x24]
ldr r0, [sp, 0x10]
cmp r0, 0xFF
bne _08003024
adds r2, r3, 0
adds r5, r7, 0
ldr r1, [sp, 0x1C]
cmp r2, r1
blt _08002F74
b _08003106
_08002F74:
ldr r3, [sp, 0x8]
lsrs r3, 1
str r3, [sp, 0x2C]
movs r0, 0x3
ands r3, r0
str r3, [sp, 0x2C]
ldr r7, [sp, 0x8]
lsrs r0, r7, 3
lsls r0, 5
str r0, [sp, 0x30]
_08002F88:
ldr r0, [sp]
ldr r1, [r0]
ldr r3, [sp, 0x2C]
adds r1, r3
ldr r7, [sp, 0x30]
adds r1, r7
asrs r0, r2, 3
ldr r3, [sp, 0x20]
muls r0, r3
lsls r0, 5
mov r8, r0
add r1, r8
lsls r0, r2, 29
lsrs r7, r0, 27
adds r6, r1, r7
ldr r3, [sp, 0x8]
ldr r4, [sp, 0xC]
adds r2, 0x1
mov r10, r2
adds r0, r5, 0x1
str r0, [sp, 0x38]
ldr r1, [sp, 0x18]
cmp r3, r1
bge _08003018
asrs r0, r5, 3
ldr r2, [sp, 0x24]
muls r0, r2
lsls r0, 6
mov r12, r0
lsls r0, r5, 29
lsrs r0, 26
mov r9, r0
_08002FC8:
movs r0, 0x7
ands r0, r4
ldr r5, [sp, 0x4]
ldr r1, [r5]
adds r1, r0
asrs r0, r4, 3
lsls r0, 6
adds r1, r0
add r1, r12
mov r0, r9
adds r5, r1, r0
movs r0, 0x1
ands r0, r3
cmp r0, 0
beq _08002FEC
ldrb r0, [r6]
lsrs r0, 4
b _08003008
_08002FEC:
asrs r2, r3, 1
movs r0, 0x3
ands r2, r0
ldr r0, [sp]
ldr r1, [r0]
adds r1, r2
asrs r0, r3, 3
lsls r0, 5
adds r1, r0
add r1, r8
adds r6, r1, r7
ldrb r1, [r6]
movs r0, 0xF
ands r0, r1
_08003008:
ldr r1, [sp, 0x14]
adds r0, r1, r0
strb r0, [r5]
adds r3, 0x1
adds r4, 0x1
ldr r2, [sp, 0x18]
cmp r3, r2
blt _08002FC8
_08003018:
mov r2, r10
ldr r5, [sp, 0x38]
ldr r3, [sp, 0x1C]
cmp r2, r3
blt _08002F88
b _08003106
_08003024:
adds r2, r3, 0
adds r5, r7, 0
ldr r7, [sp, 0x1C]
cmp r2, r7
bge _08003106
ldr r0, [sp, 0x8]
lsrs r0, 1
str r0, [sp, 0x34]
movs r0, 0x3
ldr r1, [sp, 0x34]
ands r1, r0
str r1, [sp, 0x34]
_0800303C:
ldr r3, [sp]
ldr r1, [r3]
ldr r7, [sp, 0x34]
adds r1, r7
ldr r3, [sp, 0x8]
lsrs r0, r3, 3
lsls r0, 5
adds r1, r0
asrs r0, r2, 3
ldr r7, [sp, 0x20]
muls r0, r7
lsls r0, 5
mov r8, r0
add r1, r8
lsls r0, r2, 29
lsrs r7, r0, 27
adds r6, r1, r7
ldr r4, [sp, 0xC]
adds r2, 0x1
mov r10, r2
adds r0, r5, 0x1
str r0, [sp, 0x38]
ldr r1, [sp, 0x18]
cmp r3, r1
bge _080030FC
asrs r0, r5, 3
ldr r2, [sp, 0x24]
muls r0, r2
lsls r0, 6
mov r9, r0
lsls r0, r5, 29
lsrs r0, 26
mov r12, r0
_0800307E:
movs r0, 0x1
ands r0, r3
cmp r0, 0
beq _080030B2
ldrb r2, [r6]
movs r0, 0xF0
ands r0, r2
ldr r5, [sp, 0x28]
cmp r0, r5
beq _080030F2
adds r0, r4, 0
movs r1, 0x7
ands r0, r1
ldr r5, [sp, 0x4]
ldr r1, [r5]
adds r1, r0
asrs r0, r4, 3
lsls r0, 6
adds r1, r0
add r1, r9
mov r0, r12
adds r5, r1, r0
lsrs r0, r2, 4
ldr r1, [sp, 0x14]
adds r0, r1, r0
b _080030F0
_080030B2:
asrs r2, r3, 1
movs r0, 0x3
ands r2, r0
ldr r5, [sp]
ldr r1, [r5]
adds r1, r2
asrs r0, r3, 3
lsls r0, 5
adds r1, r0
add r1, r8
adds r6, r1, r7
ldrb r0, [r6]
movs r2, 0xF
ands r2, r0
ldr r0, [sp, 0x10]
cmp r2, r0
beq _080030F2
adds r0, r4, 0
movs r1, 0x7
ands r0, r1
ldr r5, [sp, 0x4]
ldr r1, [r5]
adds r1, r0
asrs r0, r4, 3
lsls r0, 6
adds r1, r0
add r1, r9
mov r0, r12
adds r5, r1, r0
ldr r1, [sp, 0x14]
adds r0, r1, r2
_080030F0:
strb r0, [r5]
_080030F2:
adds r3, 0x1
adds r4, 0x1
ldr r2, [sp, 0x18]
cmp r3, r2
blt _0800307E
_080030FC:
mov r2, r10
ldr r5, [sp, 0x38]
ldr r3, [sp, 0x1C]
cmp r2, r3
blt _0800303C
_08003106:
add sp, 0x3C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end BlitBitmapRect4BitTo8Bit
thumb_func_start FillBitmapRect8Bit
@ void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue)
FillBitmapRect8Bit: @ 8003118
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
mov r8, r0
ldr r0, [sp, 0x28]
ldr r4, [sp, 0x2C]
lsls r1, 16
lsrs r1, 16
mov r10, r1
lsls r2, 16
lsrs r2, 16
adds r6, r2, 0
lsls r3, 16
lsrs r3, 16
lsls r0, 16
lsrs r0, 16
lsls r4, 24
lsrs r4, 24
mov r9, r4
adds r5, r1, r3
mov r3, r8
ldrh r1, [r3, 0x4]
cmp r5, r1
ble _08003150
adds r5, r1, 0
_08003150:
adds r7, r2, r0
mov r2, r8
ldrh r0, [r2, 0x6]
cmp r7, r0
ble _0800315C
adds r7, r0, 0
_0800315C:
movs r0, 0x7
ands r0, r1
adds r0, r1, r0
asrs r0, 3
str r0, [sp]
adds r1, r6, 0
cmp r1, r7
bge _080031AC
_0800316C:
mov r3, r10
adds r6, r1, 0x1
str r6, [sp, 0x4]
cmp r3, r5
bge _080031A6
movs r0, 0x7
mov r12, r0
asrs r0, r1, 3
ldr r2, [sp]
muls r0, r2
lsls r4, r0, 6
lsls r0, r1, 29
lsrs r2, r0, 26
_08003186:
adds r0, r3, 0
mov r6, r12
ands r0, r6
mov r6, r8
ldr r1, [r6]
adds r1, r0
asrs r0, r3, 3
lsls r0, 6
adds r1, r0
adds r1, r4
adds r1, r2
mov r0, r9
strb r0, [r1]
adds r3, 0x1
cmp r3, r5
blt _08003186
_080031A6:
ldr r1, [sp, 0x4]
cmp r1, r7
blt _0800316C
_080031AC:
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end FillBitmapRect8Bit
.align 2, 0 @ Don't pad with nop.

View File

@ -3388,7 +3388,7 @@ _0813980C:
_0813981C:
ldrh r5, [r2]
adds r0, r5, 0
bl sub_80EF370
bl CountDigits
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24
@ -3408,7 +3408,7 @@ _0813983C:
adds r4, 0x4
ldrh r5, [r2]
adds r0, r5, 0
bl sub_80EF370
bl CountDigits
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24

View File

@ -1,709 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start SetUpFieldMove_Flash
SetUpFieldMove_Flash: @ 81370FC
push {r4,lr}
bl ShouldDoBrailleFlyEffect
lsls r0, 24
cmp r0, 0
beq _08137134
ldr r4, =gSpecialVar_Result
bl GetCursorSelectionMonId
lsls r0, 24
lsrs r0, 24
strh r0, [r4]
ldr r1, =gUnknown_03005DB0
ldr r0, =FieldCallback_Teleport
str r0, [r1]
ldr r1, =gUnknown_0203CEEC
ldr r0, =sub_8179918
b _08137152
.pool
_08137134:
ldr r0, =gMapHeader
ldrb r0, [r0, 0x15]
cmp r0, 0x1
bne _08137170
ldr r0, =0x00000888
bl FlagGet
lsls r0, 24
cmp r0, 0
bne _08137170
ldr r1, =gUnknown_03005DB0
ldr r0, =FieldCallback_Teleport
str r0, [r1]
ldr r1, =gUnknown_0203CEEC
ldr r0, =hm2_flash
_08137152:
str r0, [r1]
movs r0, 0x1
b _08137172
.pool
_08137170:
movs r0, 0
_08137172:
pop {r4}
pop {r1}
bx r1
thumb_func_end SetUpFieldMove_Flash
thumb_func_start hm2_flash
hm2_flash: @ 8137178
push {r4,lr}
bl oei_task_add
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl GetCursorSelectionMonId
ldr r1, =gFieldEffectArguments
lsls r0, 24
lsrs r0, 24
str r0, [r1]
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r2, =sub_81371B4
lsrs r1, r2, 16
strh r1, [r0, 0x18]
strh r2, [r0, 0x1A]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end hm2_flash
thumb_func_start sub_81371B4
sub_81371B4: @ 81371B4
push {lr}
movs r0, 0xCF
bl PlaySE
ldr r0, =0x00000888
bl FlagSet
ldr r0, =EventScript_2926F8
bl ScriptContext1_SetupScript
pop {r0}
bx r0
.pool
thumb_func_end sub_81371B4
thumb_func_start sub_81371D4
sub_81371D4: @ 81371D4
push {lr}
bl RunTasks
bl AnimateSprites
bl BuildOamBuffer
bl UpdatePaletteFade
pop {r0}
bx r0
thumb_func_end sub_81371D4
thumb_func_start sub_81371EC
sub_81371EC: @ 81371EC
push {lr}
bl LoadOam
bl ProcessSpriteCopyRequests
bl TransferPlttBuffer
pop {r0}
bx r0
thumb_func_end sub_81371EC
thumb_func_start c2_change_map
c2_change_map: @ 8137200
push {r4,lr}
sub sp, 0x8
movs r0, 0
bl SetVBlankCallback
movs r0, 0
movs r1, 0
bl SetGpuReg
movs r0, 0xC
movs r1, 0
bl SetGpuReg
movs r0, 0xA
movs r1, 0
bl SetGpuReg
movs r0, 0x8
movs r1, 0
bl SetGpuReg
movs r0, 0x18
movs r1, 0
bl SetGpuReg
movs r0, 0x1A
movs r1, 0
bl SetGpuReg
movs r0, 0x14
movs r1, 0
bl SetGpuReg
movs r0, 0x16
movs r1, 0
bl SetGpuReg
movs r0, 0x10
movs r1, 0
bl SetGpuReg
movs r0, 0x12
movs r1, 0
bl SetGpuReg
mov r1, sp
movs r0, 0
strh r0, [r1]
ldr r1, =0x040000d4
mov r0, sp
str r0, [r1]
movs r0, 0xC0
lsls r0, 19
str r0, [r1, 0x4]
ldr r0, =0x8100c000
str r0, [r1, 0x8]
ldr r0, [r1, 0x8]
movs r4, 0
str r4, [sp, 0x4]
add r0, sp, 0x4
str r0, [r1]
movs r0, 0xE0
lsls r0, 19
str r0, [r1, 0x4]
ldr r0, =0x85000100
str r0, [r1, 0x8]
ldr r0, [r1, 0x8]
mov r0, sp
strh r4, [r0]
str r0, [r1]
ldr r0, =0x05000002
str r0, [r1, 0x4]
ldr r0, =0x810001ff
str r0, [r1, 0x8]
ldr r0, [r1, 0x8]
bl ResetPaletteFade
bl ResetTasks
bl ResetSpriteData
ldr r3, =0x04000208
ldrh r2, [r3]
strh r4, [r3]
ldr r4, =0x04000200
ldrh r0, [r4]
movs r1, 0x1
orrs r0, r1
strh r0, [r4]
strh r2, [r3]
ldr r0, =sub_81371EC
bl SetVBlankCallback
ldr r0, =sub_81371D4
bl SetMainCallback2
bl sub_8137304
lsls r0, 24
cmp r0, 0
bne _081372D2
ldr r0, =gMain
ldr r0, [r0, 0x8]
bl SetMainCallback2
_081372D2:
add sp, 0x8
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end c2_change_map
thumb_func_start sub_8137304
sub_8137304: @ 8137304
push {r4-r7,lr}
bl get_map_light_from_warp0
lsls r0, 24
lsrs r6, r0, 24
bl Overworld_GetMapTypeOfSaveblockLocation
lsls r0, 24
lsrs r5, r0, 24
movs r3, 0
ldr r4, =gUnknown_085B27C8
ldrb r0, [r4]
cmp r0, 0
beq _08137358
adds r7, r4, 0
adds r0, r4, 0x4
mov r12, r0
_08137326:
lsls r2, r3, 3
adds r1, r2, r7
ldrb r0, [r1]
cmp r0, r6
bne _08137348
ldrb r0, [r1, 0x1]
cmp r0, r5
bne _08137348
mov r1, r12
adds r0, r2, r1
ldr r0, [r0]
bl _call_via_r0
movs r0, 0x1
b _0813735A
.pool
_08137348:
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
lsls r0, r3, 3
adds r0, r4
ldrb r0, [r0]
cmp r0, 0
bne _08137326
_08137358:
movs r0, 0
_0813735A:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8137304
thumb_func_start sub_8137360
sub_8137360: @ 8137360
push {r4-r6,lr}
lsls r0, 24
lsls r1, 24
lsrs r5, r0, 24
lsrs r4, r1, 24
movs r3, 0
ldr r1, =gUnknown_085B27C8
ldrb r0, [r1]
cmp r0, 0
beq _081373A0
adds r6, r1, 0
_08137376:
lsls r0, r3, 3
adds r2, r0, r6
ldrb r0, [r2]
cmp r0, r5
bne _08137390
ldrb r0, [r2, 0x1]
cmp r0, r4
bne _08137390
ldrb r0, [r2, 0x2]
b _081373A2
.pool
_08137390:
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
lsls r0, r3, 3
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _08137376
_081373A0:
movs r0, 0
_081373A2:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_8137360
thumb_func_start fade_type_for_given_maplight_pair
fade_type_for_given_maplight_pair: @ 81373A8
push {r4-r6,lr}
lsls r0, 24
lsls r1, 24
lsrs r5, r0, 24
lsrs r4, r1, 24
movs r3, 0
ldr r1, =gUnknown_085B27C8
ldrb r0, [r1]
cmp r0, 0
beq _081373E8
adds r6, r1, 0
_081373BE:
lsls r0, r3, 3
adds r2, r0, r6
ldrb r0, [r2]
cmp r0, r5
bne _081373D8
ldrb r0, [r2, 0x1]
cmp r0, r4
bne _081373D8
ldrb r0, [r2, 0x3]
b _081373EA
.pool
_081373D8:
adds r0, r3, 0x1
lsls r0, 24
lsrs r3, r0, 24
lsls r0, r3, 3
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _081373BE
_081373E8:
movs r0, 0
_081373EA:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end fade_type_for_given_maplight_pair
thumb_func_start sub_81373F0
sub_81373F0: @ 81373F0
push {lr}
ldr r0, =sub_8137404
movs r1, 0
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81373F0
thumb_func_start sub_8137404
sub_8137404: @ 8137404
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldr r0, =sub_8137420
str r0, [r1]
bx lr
.pool
thumb_func_end sub_8137404
thumb_func_start sub_8137420
sub_8137420: @ 8137420
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0
movs r1, 0
bl SetGpuReg
ldr r0, =gCaveTransitionTiles
ldr r1, =0x0600c000
bl LZ77UnCompVram
ldr r0, =gCaveTransitionTilemap
ldr r1, =0x0600f800
bl LZ77UnCompVram
ldr r0, =gCaveTransitionPalette_White
movs r1, 0xE0
movs r2, 0x20
bl LoadPalette
ldr r0, =gUnknown_085B28A0
movs r1, 0xE0
movs r2, 0x10
bl LoadPalette
ldr r1, =0x00003e41
movs r0, 0x50
bl SetGpuReg
movs r0, 0x52
movs r1, 0
bl SetGpuReg
movs r0, 0x54
movs r1, 0
bl SetGpuReg
ldr r1, =0x00001f0c
movs r0, 0x8
bl SetGpuReg
movs r1, 0x8A
lsls r1, 5
movs r0, 0
bl SetGpuReg
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r1, =sub_81374C4
str r1, [r0]
movs r2, 0
movs r1, 0x10
strh r1, [r0, 0x8]
strh r2, [r0, 0xA]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8137420
thumb_func_start sub_81374C4
sub_81374C4: @ 81374C4
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r5, r1, r2
ldrh r4, [r5, 0xA]
movs r0, 0x80
lsls r0, 5
adds r1, r4, r0
lsls r1, 16
lsrs r1, 16
movs r0, 0x52
bl SetGpuReg
cmp r4, 0x10
bhi _081374F8
ldrh r0, [r5, 0xA]
adds r0, 0x1
strh r0, [r5, 0xA]
b _08137500
.pool
_081374F8:
movs r0, 0
strh r0, [r5, 0xC]
ldr r0, =sub_813750C
str r0, [r5]
_08137500:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81374C4
thumb_func_start sub_813750C
sub_813750C: @ 813750C
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r1, =0x00001010
movs r0, 0x52
bl SetGpuReg
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r4, r0, r1
ldrh r1, [r4, 0xC]
cmp r1, 0x7
bhi _08137554
adds r0, r1, 0x1
strh r0, [r4, 0xC]
lsls r1, 1
ldr r0, =gUnknown_085B28A0
adds r0, r1, r0
movs r2, 0x10
subs r2, r1
lsls r2, 16
lsrs r2, 16
movs r1, 0xE0
bl LoadPalette
b _08137566
.pool
_08137554:
ldr r0, =gCaveTransitionPalette_White
movs r1, 0
movs r2, 0x20
bl LoadPalette
ldr r0, =sub_8137574
str r0, [r4]
movs r0, 0x8
strh r0, [r4, 0xC]
_08137566:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_813750C
thumb_func_start sub_8137574
sub_8137574: @ 8137574
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldrh r2, [r1, 0xC]
movs r3, 0xC
ldrsh r0, [r1, r3]
cmp r0, 0
beq _08137598
subs r0, r2, 0x1
strh r0, [r1, 0xC]
b _081375A0
.pool
_08137598:
ldr r0, =gMain
ldr r0, [r0, 0x8]
bl SetMainCallback2
_081375A0:
pop {r0}
bx r0
.pool
thumb_func_end sub_8137574
thumb_func_start sub_81375A8
sub_81375A8: @ 81375A8
push {lr}
ldr r0, =sub_81375BC
movs r1, 0
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81375A8
thumb_func_start sub_81375BC
sub_81375BC: @ 81375BC
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldr r0, =sub_81375D8
str r0, [r1]
bx lr
.pool
thumb_func_end sub_81375BC
thumb_func_start sub_81375D8
sub_81375D8: @ 81375D8
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0
movs r1, 0
bl SetGpuReg
ldr r0, =gCaveTransitionTiles
ldr r1, =0x0600c000
bl LZ77UnCompVram
ldr r0, =gCaveTransitionTilemap
ldr r1, =0x0600f800
bl LZ77UnCompVram
movs r0, 0x50
movs r1, 0
bl SetGpuReg
movs r0, 0x52
movs r1, 0
bl SetGpuReg
movs r0, 0x54
movs r1, 0
bl SetGpuReg
ldr r1, =0x00001f0c
movs r0, 0x8
bl SetGpuReg
movs r1, 0x8A
lsls r1, 5
movs r0, 0
bl SetGpuReg
ldr r0, =gCaveTransitionPalette_White
movs r1, 0xE0
movs r2, 0x20
bl LoadPalette
ldr r0, =gCaveTransitionPalette_Black
movs r1, 0
movs r2, 0x20
bl LoadPalette
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldr r1, =sub_8137678
str r1, [r0]
movs r2, 0
movs r1, 0x10
strh r1, [r0, 0x8]
strh r2, [r0, 0xA]
strh r2, [r0, 0xC]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81375D8
thumb_func_start sub_8137678
sub_8137678: @ 8137678
push {r4,lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r4, r1, r2
ldrh r1, [r4, 0xC]
cmp r1, 0xF
bhi _081376B4
adds r2, r1, 0x1
adds r0, r2, 0x1
strh r0, [r4, 0xC]
movs r0, 0xF
subs r0, r1
lsls r0, 1
ldr r1, =gUnknown_085B2890
adds r0, r1
lsls r2, 17
lsrs r2, 16
movs r1, 0xE0
bl LoadPalette
b _081376C8
.pool
_081376B4:
ldr r1, =0x00001010
movs r0, 0x52
bl SetGpuReg
ldr r1, =0x00003e41
movs r0, 0x50
bl SetGpuReg
ldr r0, =sub_81376DC
str r0, [r4]
_081376C8:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8137678
thumb_func_start sub_81376DC
sub_81376DC: @ 81376DC
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r5, r1, r2
ldrh r0, [r5, 0xA]
movs r1, 0x10
subs r1, r0
lsls r1, 16
lsrs r4, r1, 16
movs r0, 0x80
lsls r0, 21
adds r1, r0
lsrs r1, 16
movs r0, 0x52
bl SetGpuReg
cmp r4, 0
beq _08137714
ldrh r0, [r5, 0xA]
adds r0, 0x1
strh r0, [r5, 0xA]
b _08137726
.pool
_08137714:
ldr r0, =gCaveTransitionPalette_Black
movs r1, 0
movs r2, 0x20
bl LoadPalette
ldr r0, =gMain
ldr r0, [r0, 0x8]
bl SetMainCallback2
_08137726:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81376DC

View File

@ -1,596 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_81BE66C
sub_81BE66C: @ 81BE66C
push {lr}
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrh r1, [r0, 0x4]
movs r0, 0xD0
lsls r0, 5
cmp r1, r0
bne _081BE690
movs r0, 0xA7
lsls r0, 1
bl FlagGet
lsls r0, 24
lsrs r0, 24
b _081BE692
.pool
_081BE690:
movs r0, 0
_081BE692:
pop {r1}
bx r1
thumb_func_end sub_81BE66C
thumb_func_start sub_81BE698
sub_81BE698: @ 81BE698
push {lr}
ldr r0, =gUnknown_0203CF18
ldr r0, [r0]
adds r0, 0x4
bl sub_8151E50
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE698
thumb_func_start sub_81BE6AC
sub_81BE6AC: @ 81BE6AC
ldr r1, =gUnknown_0203CF18
movs r0, 0
str r0, [r1]
bx lr
.pool
thumb_func_end sub_81BE6AC
thumb_func_start sub_81BE6B8
sub_81BE6B8: @ 81BE6B8
push {r4,lr}
ldr r4, =gUnknown_0203CF18
ldr r0, [r4]
cmp r0, 0
beq _081BE6CC
movs r0, 0
str r0, [r4]
b _081BE718
.pool
_081BE6CC:
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrh r1, [r0, 0x4]
movs r0, 0xD0
lsls r0, 5
cmp r1, r0
bne _081BE718
movs r0, 0xA7
lsls r0, 1
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _081BE718
movs r0, 0xC8
bl AllocZeroed
str r0, [r4]
adds r0, 0x4
bl sub_8151B3C
ldr r0, [r4]
adds r0, 0x4
ldr r1, =gUnknown_08617E18
bl sub_8151B68
ldr r0, [r4]
adds r0, 0x4
movs r1, 0x1
movs r2, 0x1
bl sub_8151CA8
ldr r0, =sub_81BE698
movs r1, 0xFF
bl CreateTask
ldr r1, [r4]
strb r0, [r1]
_081BE718:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE6B8
thumb_func_start sub_81BE72C
sub_81BE72C: @ 81BE72C
push {r4,lr}
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrh r1, [r0, 0x4]
movs r0, 0xD0
lsls r0, 5
cmp r1, r0
bne _081BE788
movs r0, 0xA7
lsls r0, 1
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _081BE788
ldr r4, =gUnknown_0203CF18
ldr r0, [r4]
cmp r0, 0
beq _081BE788
ldr r0, =sub_81BE698
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
beq _081BE766
ldr r0, [r4]
ldrb r0, [r0]
bl DestroyTask
_081BE766:
ldr r0, [r4]
adds r0, 0x4
movs r1, 0x1
movs r2, 0x1
bl sub_8151D28
ldr r0, [r4]
adds r0, 0x4
movs r1, 0x1
movs r2, 0x1
bl sub_8151C50
ldr r0, [r4]
bl Free
movs r0, 0
str r0, [r4]
_081BE788:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE72C
thumb_func_start sub_81BE79C
sub_81BE79C: @ 81BE79C
push {r4,lr}
ldr r0, =0x000040cb
bl VarGet
lsls r0, 16
cmp r0, 0
beq _081BE7B8
movs r0, 0xA7
lsls r0, 1
bl FlagClear
b _081BE7EE
.pool
_081BE7B8:
bl Random
lsls r0, 16
lsrs r4, r0, 16
movs r0, 0x1
ands r4, r0
movs r0, 0x9D
bl FlagGet
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _081BE7D4
movs r4, 0x1
_081BE7D4:
cmp r4, 0
beq _081BE7E6
movs r0, 0xA7
lsls r0, 1
bl FlagSet
bl sub_81BE6B8
b _081BE7EE
_081BE7E6:
movs r0, 0xA7
lsls r0, 1
bl FlagClear
_081BE7EE:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_81BE79C
thumb_func_start sub_81BE7F4
sub_81BE7F4: @ 81BE7F4
push {lr}
ldr r0, =sub_81BE808
movs r1, 0x8
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE7F4
thumb_func_start sub_81BE808
sub_81BE808: @ 81BE808
push {r4,r5,lr}
sub sp, 0x4
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrb r1, [r0, 0x5]
ldrb r2, [r0, 0x4]
movs r0, 0x2D
mov r3, sp
bl TryGetFieldObjectIdByLocalIdAndMap
mov r0, sp
ldrb r0, [r0]
lsls r2, r0, 3
adds r2, r0
lsls r2, 2
ldr r4, =gMapObjects
adds r2, r4
ldr r3, =gSprites
ldrb r1, [r2, 0x4]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r3
ldrh r1, [r0, 0x26]
adds r1, 0x4
strh r1, [r0, 0x26]
ldr r0, =gPlayerAvatar
ldrb r0, [r0, 0x5]
lsls r1, r0, 3
adds r1, r0
lsls r1, 2
adds r1, r4
ldrb r2, [r2, 0x4]
lsls r0, r2, 4
adds r0, r2
lsls r0, 2
adds r0, r3
movs r4, 0x22
ldrsh r2, [r0, r4]
movs r4, 0x26
ldrsh r0, [r0, r4]
adds r2, r0
ldrb r1, [r1, 0x4]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r3
movs r3, 0x22
ldrsh r1, [r0, r3]
movs r4, 0x26
ldrsh r0, [r0, r4]
adds r1, r0
cmp r2, r1
blt _081BE882
adds r0, r5, 0
bl DestroyTask
bl EnableBothScriptContexts
_081BE882:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE808
thumb_func_start sp136_strengh_sound
sp136_strengh_sound: @ 81BE89C
push {r4-r6,lr}
mov r6, r8
push {r6}
mov r8, r0
adds r4, r1, 0
adds r5, r2, 0
adds r6, r3, 0
lsls r0, 24
lsrs r0, 24
mov r8, r0
lsls r4, 24
lsrs r4, 24
lsls r5, 24
lsrs r5, 24
lsls r6, 24
lsrs r6, 24
ldr r0, =sub_81BE900
movs r1, 0x9
bl CreateTask
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
movs r0, 0
strh r4, [r1, 0x8]
strh r0, [r1, 0xA]
strh r5, [r1, 0xC]
strh r6, [r1, 0xE]
mov r0, r8
strh r0, [r1, 0x10]
movs r0, 0
bl SetCameraPanningCallback
movs r0, 0xD6
bl PlaySE
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sp136_strengh_sound
thumb_func_start sub_81BE900
sub_81BE900: @ 81BE900
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
ldr r1, =gTasks + 0x8
adds r4, r0, r1
ldrh r0, [r4, 0x2]
adds r0, 0x1
strh r0, [r4, 0x2]
movs r1, 0x2
ldrsh r0, [r4, r1]
movs r2, 0x6
ldrsh r1, [r4, r2]
bl __modsi3
cmp r0, 0
bne _081BE95C
strh r0, [r4, 0x2]
ldrh r0, [r4, 0x4]
subs r0, 0x1
strh r0, [r4, 0x4]
ldrh r0, [r4]
negs r0, r0
strh r0, [r4]
ldrh r0, [r4, 0x8]
negs r0, r0
strh r0, [r4, 0x8]
movs r1, 0
ldrsh r0, [r4, r1]
movs r2, 0x8
ldrsh r1, [r4, r2]
bl SetCameraPanning
movs r1, 0x4
ldrsh r0, [r4, r1]
cmp r0, 0
bne _081BE95C
bl sub_81BE968
adds r0, r5, 0
bl DestroyTask
bl InstallCameraPanAheadCallback
_081BE95C:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE900
thumb_func_start sub_81BE968
sub_81BE968: @ 81BE968
push {lr}
ldr r0, =sub_81BE9C0
bl FindTaskIdByFunc
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0xFF
beq _081BE988
ldr r0, =gTasks
lsls r1, r2, 2
adds r1, r2
lsls r1, 3
adds r1, r0
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
_081BE988:
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE968
thumb_func_start sub_81BE994
sub_81BE994: @ 81BE994
push {lr}
ldr r0, =gUnknown_08617D94
bl LoadSpriteSheets
bl sub_81BEA20
ldr r0, =sub_81BE9C0
movs r1, 0x8
bl CreateTask
movs r0, 0x2
movs r1, 0x1
movs r2, 0x10
movs r3, 0x3
bl sp136_strengh_sound
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE994
thumb_func_start sub_81BE9C0
sub_81BE9C0: @ 81BE9C0
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r3, r1, 3
ldr r4, =gTasks + 0x8
adds r2, r3, r4
ldrh r0, [r2, 0x2]
adds r0, 0x1
strh r0, [r2, 0x2]
lsls r0, 16
movs r1, 0xFA
lsls r1, 18
cmp r0, r1
beq _081BE9E6
ldrh r0, [r2]
cmp r0, 0x11
bne _081BE9F0
_081BE9E6:
adds r0, r4, 0
subs r0, 0x8
adds r0, r3, r0
ldr r1, =sub_81BEA00
str r1, [r0]
_081BE9F0:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BE9C0
thumb_func_start sub_81BEA00
sub_81BEA00: @ 81BEA00
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
movs r0, 0xFA
lsls r0, 4
bl FreeSpriteTilesByTag
adds r0, r4, 0
bl DestroyTask
bl EnableBothScriptContexts
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_81BEA00
thumb_func_start sub_81BEA20
sub_81BEA20: @ 81BEA20
push {r4-r7,lr}
movs r4, 0
ldr r5, =gUnknown_08617D64
adds r7, r5, 0x2
ldr r6, =gSprites
_081BEA2A:
lsls r0, r4, 1
adds r0, r4
lsls r0, 1
adds r1, r0, r5
ldrh r1, [r1]
adds r1, 0x78
lsls r1, 16
asrs r1, 16
adds r0, r7
movs r3, 0
ldrsh r2, [r0, r3]
ldr r0, =gUnknown_08617E60
movs r3, 0x8
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r6
ldrb r2, [r0, 0x5]
movs r3, 0xD
negs r3, r3
adds r1, r3, 0
ands r2, r1
movs r1, 0xF
ands r2, r1
strb r2, [r0, 0x5]
strh r4, [r0, 0x2E]
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x7
bls _081BEA2A
movs r4, 0
ldr r5, =gUnknown_08617D64
adds r7, r5, 0x2
ldr r6, =gSprites
_081BEA78:
lsls r0, r4, 1
adds r0, r4
lsls r0, 1
adds r1, r0, r5
ldrh r1, [r1]
adds r1, 0x73
lsls r1, 16
asrs r1, 16
adds r0, r7
ldrh r2, [r0]
subs r2, 0x3
lsls r2, 16
asrs r2, 16
ldr r0, =gUnknown_08617E34
movs r3, 0x8
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r6
ldrb r2, [r0, 0x5]
movs r3, 0xD
negs r3, r3
adds r1, r3, 0
ands r2, r1
movs r1, 0xF
ands r2, r1
strb r2, [r0, 0x5]
strh r4, [r0, 0x2E]
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x7
bls _081BEA78
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEA20
thumb_func_start sub_81BEAD8
sub_81BEAD8: @ 81BEAD8
push {r4,lr}
adds r4, r0, 0
ldrh r0, [r4, 0x30]
adds r0, 0x2
strh r0, [r4, 0x30]
movs r1, 0x30
ldrsh r0, [r4, r1]
lsrs r1, r0, 31
adds r0, r1
asrs r0, 1
strh r0, [r4, 0x26]
movs r0, 0x22
ldrsh r3, [r4, r0]
movs r1, 0x26
ldrsh r0, [r4, r1]
adds r3, r0
ldr r2, =gUnknown_08617D64
movs r0, 0x2E
ldrsh r1, [r4, r0]
lsls r0, r1, 1
adds r0, r1
lsls r0, 1
adds r2, 0x4
adds r0, r2
movs r1, 0
ldrsh r0, [r0, r1]
cmp r3, r0
ble _081BEB1A
adds r0, r4, 0
bl DestroySprite
bl sub_81BE968
_081BEB1A:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEAD8
.align 2, 0 @ Don't pad with nop.

View File

@ -5,893 +5,6 @@
.text
thumb_func_start sub_81BEB24
sub_81BEB24: @ 81BEB24
push {r4,r5,lr}
movs r4, 0
ldr r5, =gUnknown_08617DA4
_081BEB2A:
lsls r2, r4, 2
adds r2, r5
ldrb r0, [r2]
adds r0, 0x7
ldrb r1, [r2, 0x1]
adds r1, 0x7
ldrh r2, [r2, 0x2]
bl MapGridSetMetatileIdAt
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x11
bls _081BEB2A
bl DrawWholeMapView
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEB24
thumb_func_start sub_81BEB54
sub_81BEB54: @ 81BEB54
push {lr}
ldr r0, =sub_81BED50
movs r1, 0x9
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEB54
thumb_func_start sub_81BEB68
sub_81BEB68: @ 81BEB68
push {lr}
ldr r0, =sub_81BEBF4
movs r1, 0x9
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEB68
thumb_func_start sub_81BEB7C
sub_81BEB7C: @ 81BEB7C
push {lr}
ldr r0, =sub_81BF028
movs r1, 0x9
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEB7C
thumb_func_start sub_81BEB90
sub_81BEB90: @ 81BEB90
push {r4,lr}
ldr r4, =gUnknown_0203CF14
ldr r0, [r4]
ldrh r1, [r0]
movs r0, 0x10
bl SetGpuReg
ldr r0, [r4]
ldrh r1, [r0, 0x2]
movs r0, 0x12
bl SetGpuReg
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEB90
thumb_func_start sub_81BEBB4
sub_81BEBB4: @ 81BEBB4
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r2, r1, r2
ldrh r1, [r2, 0x8]
movs r3, 0x8
ldrsh r0, [r2, r3]
cmp r0, 0
bne _081BEBEC
ldr r0, =gUnknown_0203CF14
ldr r1, [r0]
ldrh r0, [r1]
negs r0, r0
strh r0, [r1]
movs r0, 0x2
strh r0, [r2, 0x8]
bl sub_81BEB90
b _081BEBF0
.pool
_081BEBEC:
subs r0, r1, 0x1
strh r0, [r2, 0x8]
_081BEBF0:
pop {r0}
bx r0
thumb_func_end sub_81BEBB4
thumb_func_start sub_81BEBF4
sub_81BEBF4: @ 81BEBF4
push {r4,r5,lr}
sub sp, 0xC
lsls r0, 24
lsrs r5, r0, 24
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r1
movs r1, 0x8
ldrsh r0, [r0, r1]
cmp r0, 0x6
bls _081BEC10
b _081BED40
_081BEC10:
lsls r0, 2
ldr r1, =_081BEC24
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081BEC24:
.4byte _081BEC40
.4byte _081BEC50
.4byte _081BEC88
.4byte _081BECB0
.4byte _081BECF8
.4byte _081BED00
.4byte _081BED1C
_081BEC40:
bl FreeAllWindowBuffers
movs r0, 0
movs r1, 0x7
movs r2, 0x2
bl SetBgAttribute
b _081BED04
_081BEC50:
ldr r4, =gUnknown_0203CF04
movs r0, 0x92
lsls r0, 4
bl AllocZeroed
str r0, [r4]
ldr r4, =gUnknown_0203CF08
movs r0, 0x80
lsls r0, 4
bl AllocZeroed
str r0, [r4]
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgY
b _081BECD8
.pool
_081BEC88:
ldr r0, =gUnknown_08617274
ldr r4, =gUnknown_0203CF04
ldr r1, [r4]
movs r2, 0x92
lsls r2, 3
bl CpuSet
ldr r1, [r4]
movs r2, 0x92
lsls r2, 4
movs r0, 0
movs r3, 0
bl LoadBgTiles
b _081BECD8
.pool
_081BECB0:
ldr r0, =gUnknown_0203CF08
ldr r1, [r0]
movs r0, 0
bl SetBgTilemapBuffer
ldr r1, =gUnknown_08617B94
movs r0, 0x6
str r0, [sp]
movs r0, 0xC
str r0, [sp, 0x4]
movs r0, 0x11
str r0, [sp, 0x8]
movs r0, 0
movs r2, 0xC
movs r3, 0x1D
bl CopyToBgTilemapBufferRect_ChangePalette
movs r0, 0
bl CopyBgTilemapBufferToVram
_081BECD8:
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r1
ldrh r1, [r0, 0x8]
adds r1, 0x1
strh r1, [r0, 0x8]
b _081BED40
.pool
_081BECF8:
movs r0, 0
bl ShowBg
b _081BED04
_081BED00:
bl sub_81BEB24
_081BED04:
ldr r0, =gTasks
lsls r1, r5, 2
adds r1, r5
lsls r1, 3
adds r1, r0
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
b _081BED40
.pool
_081BED1C:
ldr r4, =gUnknown_0203CF14
movs r0, 0x4
bl Alloc
str r0, [r4]
movs r2, 0
movs r1, 0x2
strh r1, [r0]
strh r2, [r0, 0x2]
ldr r0, =sub_81BEBB4
movs r1, 0xA
bl CreateTask
adds r0, r5, 0
bl DestroyTask
bl EnableBothScriptContexts
_081BED40:
add sp, 0xC
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BEBF4
thumb_func_start sub_81BED50
sub_81BED50: @ 81BED50
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x10
lsls r0, 24
lsrs r0, 24
mov r10, r0
ldr r1, =gTasks
lsls r0, 2
add r0, r10
lsls r0, 3
adds r0, r1
ldrh r0, [r0, 0x8]
subs r0, 0x1
lsls r0, 16
asrs r0, 16
adds r6, r1, 0
cmp r0, 0x7
bls _081BED7C
b _081BF002
_081BED7C:
lsls r0, 2
ldr r1, =_081BED90
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081BED90:
.4byte _081BEDB0
.4byte _081BF002
.4byte _081BEDC4
.4byte _081BEF64
.4byte _081BEF94
.4byte _081BEFD0
.4byte _081BEFF0
.4byte _081BEFF8
_081BEDB0:
ldr r4, =gUnknown_0203CF10
movs r0, 0xC0
lsls r0, 2
bl AllocZeroed
str r0, [r4]
b _081BF002
.pool
_081BEDC4:
mov r1, r10
lsls r0, r1, 2
adds r1, r0, r1
lsls r1, 3
adds r2, r1, r6
ldrh r3, [r2, 0xE]
movs r4, 0xE
ldrsh r1, [r2, r4]
str r0, [sp, 0x8]
cmp r1, 0x5F
bgt _081BEE8A
movs r1, 0xA
ldrsh r0, [r2, r1]
cmp r0, 0x1
ble _081BEE7C
lsls r0, r3, 24
lsrs r4, r0, 24
movs r0, 0x30
bl Alloc
ldr r3, =gUnknown_0203CF10
ldr r1, [r3]
lsls r2, r4, 3
adds r1, r2, r1
str r0, [r1]
movs r5, 0
adds r4, r2, 0
_081BEDFA:
ldr r0, [r3]
adds r0, r4, r0
ldr r0, [r0]
adds r0, r5
strb r5, [r0]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x2F
bls _081BEDFA
movs r5, 0
ldr r7, =gUnknown_0203CF10
adds r6, r2, 0
_081BEE14:
bl Random
lsls r0, 16
lsrs r0, 16
movs r1, 0x30
bl __umodsi3
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
bl Random
lsls r0, 16
lsrs r0, 16
movs r1, 0x30
bl __umodsi3
lsls r0, 16
lsrs r0, 16
ldr r1, [r7]
adds r1, r6, r1
ldr r1, [r1]
adds r0, r1, r0
ldrb r2, [r0]
adds r1, r4
ldrb r1, [r1]
strb r1, [r0]
ldr r0, [r7]
adds r0, r6, r0
ldr r0, [r0]
adds r0, r4
strb r2, [r0]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x2F
bls _081BEE14
ldr r0, =gTasks
ldr r1, [sp, 0x8]
add r1, r10
lsls r1, 3
adds r2, r1, r0
ldrh r3, [r2, 0xE]
movs r4, 0xE
ldrsh r1, [r2, r4]
adds r6, r0, 0
cmp r1, 0x5F
bgt _081BEE78
adds r0, r3, 0x1
strh r0, [r2, 0xE]
_081BEE78:
movs r0, 0
strh r0, [r2, 0xA]
_081BEE7C:
ldr r1, [sp, 0x8]
add r1, r10
lsls r1, 3
adds r1, r6
ldrh r0, [r1, 0xA]
adds r0, 0x1
strh r0, [r1, 0xA]
_081BEE8A:
ldr r0, [sp, 0x8]
add r0, r10
lsls r0, 3
adds r0, r6
ldrb r4, [r0, 0xE]
ldrb r5, [r0, 0xC]
lsls r0, r4, 16
cmp r5, r4
bcs _081BEF32
str r0, [sp, 0xC]
_081BEE9E:
movs r6, 0
adds r0, r5, 0x1
str r0, [sp, 0x4]
lsls r4, r5, 3
movs r2, 0x5F
subs r1, r2, r5
lsls r0, r1, 1
adds r0, r1
lsls r0, 4
mov r9, r0
_081BEEB2:
ldr r0, =gUnknown_0203CF04
ldr r0, [r0]
ldr r7, =gUnknown_0203CF10
ldr r3, [r7]
adds r3, r4, r3
ldrb r2, [r3, 0x4]
adds r1, r2, 0x1
strb r1, [r3, 0x4]
lsls r2, 24
lsrs r2, 24
ldr r1, [r3]
adds r1, r2
ldrb r1, [r1]
add r1, r9
lsls r1, 16
lsrs r1, 16
movs r2, 0x1
mov r8, r2
str r2, [sp]
movs r2, 0
movs r3, 0x30
bl sub_81BF2B8
adds r0, r6, 0x1
lsls r0, 24
lsrs r6, r0, 24
cmp r6, 0
beq _081BEEB2
ldr r0, [r7]
adds r1, r4, r0
ldrb r0, [r1, 0x4]
cmp r0, 0x2F
bls _081BEF24
ldr r0, [r1]
bl Free
ldr r0, [r7]
adds r0, r4, r0
movs r1, 0
str r1, [r0]
ldr r1, [sp, 0x8]
add r1, r10
lsls r1, 3
ldr r4, =gTasks
adds r1, r4
ldrh r0, [r1, 0xC]
adds r0, 0x1
strh r0, [r1, 0xC]
mov r0, r8
ands r5, r0
cmp r5, 0x1
bne _081BEF24
ldr r0, =gUnknown_0203CF14
ldr r1, [r0]
ldrh r0, [r1, 0x2]
subs r0, 0x1
strh r0, [r1, 0x2]
_081BEF24:
ldr r1, [sp, 0x4]
lsls r0, r1, 16
lsrs r5, r0, 16
ldr r2, [sp, 0xC]
lsrs r0, r2, 16
cmp r5, r0
bcc _081BEE9E
_081BEF32:
ldr r0, =gUnknown_0203CF04
ldr r1, [r0]
movs r2, 0x92
lsls r2, 4
movs r0, 0
movs r3, 0
bl LoadBgTiles
ldr r0, =gUnknown_0203CF10
ldr r0, [r0]
movs r4, 0xBE
lsls r4, 2
adds r0, r4
ldrb r0, [r0, 0x4]
cmp r0, 0x2F
bhi _081BF002
b _081BF014
.pool
_081BEF64:
movs r0, 0
bl UnsetBgTilemapBuffer
ldr r0, =sub_81BEBB4
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
cmp r0, 0xFF
beq _081BEF7C
bl DestroyTask
_081BEF7C:
ldr r0, =gUnknown_0203CF14
ldr r1, [r0]
movs r0, 0
strh r0, [r1]
strh r0, [r1, 0x2]
bl sub_81BEB90
b _081BF002
.pool
_081BEF94:
ldr r4, =gUnknown_0203CF14
ldr r0, [r4]
bl Free
movs r5, 0
str r5, [r4]
ldr r4, =gUnknown_0203CF10
ldr r0, [r4]
bl Free
str r5, [r4]
ldr r4, =gUnknown_0203CF04
ldr r0, [r4]
bl Free
str r5, [r4]
ldr r4, =gUnknown_0203CF08
ldr r0, [r4]
bl Free
str r5, [r4]
b _081BF002
.pool
_081BEFD0:
movs r0, 0xC
movs r1, 0x2
bl SetGpuRegBits
movs r0, 0x8
movs r1, 0
bl SetGpuRegBits
movs r0, 0
movs r1, 0x7
movs r2, 0
bl SetBgAttribute
bl sub_81971D0
b _081BF002
_081BEFF0:
movs r0, 0
bl ShowBg
b _081BF002
_081BEFF8:
mov r0, r10
bl DestroyTask
bl EnableBothScriptContexts
_081BF002:
ldr r0, =gTasks
mov r2, r10
lsls r1, r2, 2
add r1, r10
lsls r1, 3
adds r1, r0
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
_081BF014:
add sp, 0x10
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BED50
thumb_func_start sub_81BF028
sub_81BF028: @ 81BF028
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x18
lsls r0, 24
lsrs r7, r0, 24
ldr r1, =gTasks
lsls r0, r7, 2
adds r0, r7
lsls r0, 3
adds r0, r1
ldrh r0, [r0, 0x8]
subs r0, 0x1
lsls r0, 16
asrs r0, 16
cmp r0, 0x7
bls _081BF04C
b _081BF228
_081BF04C:
lsls r0, 2
ldr r1, =_081BF060
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081BF060:
.4byte _081BF080
.4byte _081BF0B4
.4byte _081BF0DC
.4byte _081BF0F0
.4byte _081BF148
.4byte _081BF170
.4byte _081BF1CC
.4byte _081BF224
_081BF080:
ldr r4, =gUnknown_0203CF0C
movs r0, 0x14
bl AllocZeroed
str r0, [r4]
movs r0, 0x80
bl AllocZeroed
ldr r1, [r4]
str r0, [r1]
movs r0, 0x8
bl AllocZeroed
ldr r1, [r4]
str r0, [r1, 0x4]
movs r0, 0x80
lsls r0, 2
bl AllocZeroed
ldr r1, [r4]
str r0, [r1, 0xC]
movs r0, 0
strh r0, [r1, 0x10]
b _081BF228
.pool
_081BF0B4:
ldr r0, =gUnknown_0203CF0C
ldr r0, [r0]
ldr r1, [r0]
movs r5, 0
ldr r2, =gRootFossil_Gfx
_081BF0BE:
adds r0, r5, r2
ldrb r0, [r0]
strb r0, [r1]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
adds r1, 0x1
cmp r5, 0x7F
bls _081BF0BE
b _081BF228
.pool
_081BF0DC:
ldr r0, =gUnknown_0203CF0C
ldr r0, [r0]
ldr r1, [r0, 0x4]
ldr r0, [r0]
str r0, [r1]
movs r0, 0x80
strh r0, [r1, 0x4]
b _081BF228
.pool
_081BF0F0:
mov r1, sp
ldr r0, =gUnknown_08617E00
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
ldr r4, =gUnknown_0203CF0C
ldr r0, [r4]
ldr r0, [r0, 0x4]
str r0, [sp, 0xC]
movs r2, 0x10
negs r2, r2
mov r0, sp
movs r1, 0x80
movs r3, 0x1
bl CreateSprite
ldr r1, [r4]
movs r3, 0
strb r0, [r1, 0x8]
ldr r2, =gSprites
ldr r0, [r4]
ldrb r1, [r0, 0x8]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
adds r0, 0x28
strb r3, [r0]
ldr r3, [r4]
ldrb r1, [r3, 0x8]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
ldrh r1, [r0, 0x20]
strh r1, [r0, 0x2E]
ldrb r1, [r3, 0x8]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
movs r1, 0x1
strh r1, [r0, 0x30]
_081BF148:
movs r5, 0
ldr r2, =gUnknown_0203CF0C
_081BF14C:
ldr r0, [r2]
ldr r1, [r0, 0xC]
lsls r0, r5, 1
adds r0, r1
strh r5, [r0]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0xFF
bls _081BF14C
b _081BF228
.pool
_081BF170:
movs r5, 0
movs r6, 0xFF
ldr r0, =0x000001ff
mov r8, r0
_081BF178:
bl Random
adds r4, r6, 0
ands r4, r0
bl Random
adds r1, r6, 0
ands r1, r0
ldr r0, =gUnknown_0203CF0C
ldr r3, [r0]
ldr r0, [r3, 0xC]
lsls r1, 1
adds r1, r0
ldrh r2, [r1]
lsls r4, 1
adds r4, r0
ldrh r0, [r4]
strh r0, [r1]
strh r2, [r4]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, r8
bls _081BF178
ldr r2, =gSprites
ldrb r1, [r3, 0x8]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r2, 0x1C
adds r0, r2
ldr r1, =sub_81BF248
str r1, [r0]
b _081BF228
.pool
_081BF1CC:
ldr r3, =gSprites
ldr r5, =gUnknown_0203CF0C
ldr r0, [r5]
ldrb r1, [r0, 0x8]
lsls r0, r1, 4
adds r0, r1
lsls r2, r0, 2
adds r0, r3, 0
adds r0, 0x1C
adds r0, r2, r0
ldr r1, [r0]
ldr r0, =SpriteCallbackDummy
cmp r1, r0
bne _081BF238
adds r0, r2, r3
bl DestroySprite
ldr r0, [r5]
ldr r0, [r0, 0xC]
bl Free
ldr r0, [r5]
movs r4, 0
str r4, [r0, 0xC]
ldr r0, [r0, 0x4]
bl Free
ldr r0, [r5]
str r4, [r0, 0x4]
ldr r0, [r0]
bl Free
ldr r0, [r5]
str r4, [r0]
bl Free
str r4, [r5]
b _081BF228
.pool
_081BF224:
bl EnableBothScriptContexts
_081BF228:
ldr r0, =gTasks
lsls r1, r7, 2
adds r1, r7
lsls r1, 3
adds r1, r0
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
_081BF238:
add sp, 0x18
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81BF028
thumb_func_start sub_81BF248
sub_81BF248: @ 81BF248
push {r4,r5,lr}
sub sp, 0x4
adds r5, r0, 0
ldr r0, =gUnknown_0203CF0C
ldr r0, [r0]
ldrh r0, [r0, 0x10]
cmp r0, 0xFF
bls _081BF268
ldr r0, =SpriteCallbackDummy
str r0, [r5, 0x1C]
b _081BF2B0
.pool
_081BF268:
ldrh r1, [r5, 0x22]
movs r2, 0x22
ldrsh r0, [r5, r2]
cmp r0, 0x5F
ble _081BF2AC
movs r4, 0
_081BF274:
ldr r0, =gUnknown_0203CF0C
ldr r3, [r0]
ldr r0, [r3]
ldrh r1, [r3, 0x10]
adds r2, r1, 0x1
strh r2, [r3, 0x10]
lsls r1, 16
ldr r2, [r3, 0xC]
lsrs r1, 15
adds r1, r2
ldrh r1, [r1]
movs r2, 0
str r2, [sp]
movs r3, 0x10
bl sub_81BF2B8
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x1
bls _081BF274
adds r0, r5, 0
movs r1, 0
bl StartSpriteAnim
b _081BF2B0
.pool
_081BF2AC:
adds r0, r1, 0x1
strh r0, [r5, 0x22]
_081BF2B0:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_81BF248
thumb_func_start sub_81BF2B8
sub_81BF2B8: @ 81BF2B8
push {r4-r7,lr}

View File

@ -1,206 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_81DA57C
sub_81DA57C: @ 81DA57C
push {lr}
ldr r0, =0x00000864
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _081DA5CA
bl Random
lsls r0, 16
lsrs r0, 16
movs r1, 0x64
bl __umodsi3
lsls r0, 16
lsrs r0, 16
cmp r0, 0x1E
bhi _081DA5CA
movs r0, 0x5B
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _081DA5C0
ldr r0, =gUnknown_0862AD34
movs r1, 0x8
movs r2, 0x5
bl sub_81DA5D4
b _081DA5CA
.pool
_081DA5C0:
ldr r0, =gUnknown_0862AD44
movs r1, 0x7
movs r2, 0x1
bl sub_81DA5D4
_081DA5CA:
pop {r0}
bx r0
.pool
thumb_func_end sub_81DA57C
thumb_func_start sub_81DA5D4
sub_81DA5D4: @ 81DA5D4
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
mov r9, r0
adds r7, r1, 0
mov r10, r2
movs r6, 0
movs r0, 0x5
mov r8, r0
movs r5, 0
cmp r5, r7
bcs _081DA61C
mov r4, r9
_081DA5F4:
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrh r1, [r4]
ldr r2, =0x000009ca
adds r0, r2
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _081DA614
adds r0, r1, 0
bl sub_81DA6CC
cmp r8, r0
ble _081DA612
mov r8, r0
_081DA612:
adds r6, 0x1
_081DA614:
adds r4, 0x2
adds r5, 0x1
cmp r5, r7
bcc _081DA5F4
_081DA61C:
cmp r6, 0
beq _081DA6BA
cmp r8, r10
bhi _081DA6BA
movs r6, 0
movs r5, 0
cmp r5, r7
bcs _081DA654
mov r4, r9
_081DA62E:
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldrh r1, [r4]
ldr r2, =0x000009ca
adds r0, r2
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _081DA64C
adds r0, r1, 0
bl sub_81DA6CC
cmp r0, r8
bne _081DA64C
adds r6, 0x1
_081DA64C:
adds r4, 0x2
adds r5, 0x1
cmp r5, r7
bcc _081DA62E
_081DA654:
cmp r6, 0
beq _081DA6BA
bl Random
lsls r0, 16
lsrs r0, 16
adds r1, r6, 0
bl __modsi3
adds r6, r0, 0
movs r5, 0
cmp r5, r7
bcs _081DA6BA
ldr r2, =gSaveBlock1Ptr
ldr r3, =0x000009ca
mov r4, r9
_081DA674:
ldr r0, [r2]
ldrh r1, [r4]
adds r0, r3
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _081DA6B2
adds r0, r1, 0
str r2, [sp]
str r3, [sp, 0x4]
bl sub_81DA6CC
ldr r2, [sp]
ldr r3, [sp, 0x4]
cmp r0, r8
bne _081DA6B2
cmp r6, 0
bne _081DA6B0
ldr r0, [r2]
adds r0, r3
ldrh r4, [r4]
adds r0, r4
mov r1, r8
strb r1, [r0]
b _081DA6BA
.pool
_081DA6B0:
subs r6, 0x1
_081DA6B2:
adds r4, 0x2
adds r5, 0x1
cmp r5, r7
bcc _081DA674
_081DA6BA:
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_81DA5D4
thumb_func_start sub_81DA6CC
sub_81DA6CC: @ 81DA6CC
push {r4-r6,lr}
adds r5, r0, 0
movs r4, 0
ldr r6, =gRematchTable
_081DA6D4:
lsls r0, r4, 1
lsls r1, r5, 4
adds r0, r1
adds r0, r6
ldrh r0, [r0]
bl HasTrainerBeenFought
lsls r0, 24
cmp r0, 0
bne _081DA6F0
adds r0, r4, 0
b _081DA6F8
.pool
_081DA6F0:
adds r4, 0x1
cmp r4, 0x4
ble _081DA6D4
movs r0, 0x5
_081DA6F8:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_81DA6CC
.align 2, 0 @ Don't pad with nop.

View File

@ -1,15 +0,0 @@
.set TARGET_SELECTED_POKEMON, 0
.set F_TARGET_SPECIAL, 1 << 0
.set F_TARGET_RANDOM, 1 << 2
.set F_TARGET_BOTH_ENEMIES, 1 << 3
.set F_TARGET_USER, 1 << 4
.set F_TARGET_ALL_EXCEPT_USER, 1 << 5
.set F_TARGET_ENEMY_SIDE, 1 << 6
.set F_MAKES_CONTACT, 1 << 0
.set F_AFFECTED_BY_PROTECT, 1 << 1
.set F_AFFECTED_BY_MAGIC_COAT, 1 << 2
.set F_AFFECTED_BY_SNATCH, 1 << 3
.set F_MIRROR_MOVE_COMPATIBLE, 1 << 4
.set F_AFFECTED_BY_KINGS_ROCK, 1 << 5

View File

@ -3,7 +3,6 @@
.include "constants/contest_constants.inc"
.include "constants/pokemon_data_constants.inc"
.include "constants/item_data_constants.inc"
.include "constants/battle_move_constants.inc"
.include "constants/battle_frontier_constants.inc"
.include "constants/map_constants.inc"
.include "constants/berry_constants.inc"

View File

@ -1,174 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 1
gUnknown_0860A4AC:: @ 860A4AC
.2byte 0x0044, 0x005a, 0x0075, 0x00f3, 0x0020, 0x00af, 0x00b3, 0x00ed, 0x0149, 0x0108, 0x011c, 0x0143, 0x008a, 0x0137, 0x00ad, 0x00dc
.2byte 0x000c, 0x00da, 0x00d8, 0x011b, 0x00d9, 0x0117, 0xffff, 0x00de, 0x0095, 0xffff
.align 1
gUnknown_0860A4E0:: @ 860A4E0
.2byte 0x0001, 0x0001, 0x0001, 0x0004, 0x0001, 0x0001, 0x0001, 0x0000, 0x0005, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001
.2byte 0x0001, 0x0002, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0005, 0x0005, 0x0004, 0x0005, 0x0001, 0x0003, 0x0001
.2byte 0x0003, 0x0005, 0x0001, 0x0007, 0x0001, 0x0007, 0x0007, 0x0001, 0x0005, 0x0002, 0x0004, 0x0001, 0x0001, 0x0001, 0x0005, 0x0001
.2byte 0x0002, 0x0004, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001
.2byte 0x0001, 0x0007, 0x0004, 0x0004, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0004, 0x0001, 0x0001, 0x0001, 0x0004
.2byte 0x0005, 0x0002, 0x0004, 0x0001, 0x0004, 0x0001, 0x0007, 0x0002, 0x0001, 0x0005, 0x0007, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003
.2byte 0x0003, 0x0003, 0x0003, 0x0002, 0x0004, 0x0001, 0x0005, 0x0001, 0x0001, 0x0004, 0x0005, 0x0003, 0x0001, 0x0002, 0x0001, 0x0005
.2byte 0x0004, 0x0003, 0x0006, 0x0004, 0x0003, 0x0003, 0x0003, 0x0002, 0x0004, 0x0001, 0x0001, 0x0001, 0x0005, 0x0001, 0x0001, 0x0007
.2byte 0x0002, 0x0002, 0x0001, 0x0001, 0x0004, 0x0004, 0x0004, 0x0001, 0x0004, 0x0004, 0x0001, 0x0001, 0x0001, 0x0001, 0x0007, 0x0007
.2byte 0x0006, 0x0003, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0003, 0x0001, 0x0001, 0x0004, 0x0004
.2byte 0x0003, 0x0003, 0x0003, 0x0001, 0x0004, 0x0007, 0x0007, 0x0005, 0x0007, 0x0001, 0x0007, 0x0001, 0x0005, 0x0000, 0x0004, 0x0004
.2byte 0x0004, 0x0004, 0x0004, 0x0002, 0x0002, 0x0006, 0x0003, 0x0006, 0x0004, 0x0004, 0x0002, 0x0005, 0x0002, 0x0001, 0x0001, 0x0006
.2byte 0x0006, 0x0006, 0x0001, 0x0001, 0x0001, 0x0001, 0x0002, 0x0006, 0x0001, 0x0004, 0x0001, 0x0001, 0x0003, 0x0001, 0x0001, 0x0001
.2byte 0x0001, 0x0001, 0x0004, 0x0001, 0x0001, 0x0003
.align 1
gUnknown_0860A68C:: @ 860A68C
.2byte 0x0004, 0xfffd, 0xfffa
.align 1
gUnknown_0860A692:: @ 860A692
.2byte 0x0004, 0x0004, 0x0006, 0x0006, 0x0007, 0x0006, 0x0002
.align 1
gUnknown_0860A6A0:: @ 860A6A0
.2byte 0x0091, 0x0003, 0x00fa, 0x0003, 0x00be, 0x0003, 0x0080, 0x0003, 0x006e, 0x0003, 0x0098, 0x0003, 0x0143, 0x0003, 0x0123, 0x0003
.2byte 0x007f, 0x0003, 0x014a, 0x0003, 0x0039, 0x0003, 0x0134, 0x0003, 0x0038, 0x0003, 0x003d, 0x0003, 0x015a, 0x0000, 0x0037, 0x0003
.2byte 0x0160, 0x0003, 0x0137, 0x0003, 0x0057, 0x0003, 0x004c, 0xfffc, 0x013b, 0xfffc, 0x00ac, 0xfffc, 0x0035, 0xfffc, 0x00dd, 0xfffc
.2byte 0x007e, 0xfffc, 0x0101, 0xfffc, 0x0034, 0xfffc, 0x0133, 0xfffc, 0x012b, 0xfffc, 0x011c, 0xfffc, 0x0053, 0xfffc, 0x0007, 0xfffc
.2byte 0x004c, 0xfffc, 0xffff, 0x0000
.align 1
gUnknown_0860A728:: @ 860A728
.2byte 0x013b, 0x0003, 0x00ac, 0x0003, 0x0035, 0x0003, 0x00dd, 0x0003, 0x007e, 0x0003, 0x0101, 0x0003, 0x0034, 0x0003, 0x0133, 0x0003
.2byte 0x012b, 0x0003, 0x011c, 0x0003, 0x0053, 0x0003, 0x0007, 0x0003, 0x004c, 0x0005, 0x00eb, 0x0003, 0x00ea, 0x0003, 0x00ec, 0x0003
.2byte 0x0137, 0x0003, 0xffff, 0x0000
.align 1
gUnknown_0860A770:: @ 860A770
.2byte 0x0137, 0x0003, 0x004c, 0xfffd, 0xffff, 0x0000
.align 1
gUnknown_0860A77C:: @ 860A77C
.2byte 0x0137, 0x0003, 0x004c, 0xfffd, 0xffff, 0x0000
.align 1
gUnknown_0860A788:: @ 860A788
.2byte 0x0055, 0x0003, 0x0009, 0x0003, 0x00d1, 0x0003, 0x0054, 0x0003, 0x00c0, 0x0003, 0x015f, 0x0003, 0x0056, 0x0000, 0x0057, 0x0003
.2byte 0x0158, 0x0003, 0xffff, 0x0000
.align 1
gUnknown_0860A7B0:: @ 860A7B0
.2byte 0x0005, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003
.align 1
gUnknown_0860A7BE:: @ 860A7BE
.2byte 0x0005, 0x0005, 0x0005, 0x0005, 0x0005
.align 1
gUnknown_0860A7C8:: @ 860A7C8
.2byte 0x0004
.align 1
gUnknown_0860A7CA:: @ 860A7CA
.2byte 0x0005
.align 1
gUnknown_0860A7CC:: @ 860A7CC
.2byte 0x0005
.align 1
gUnknown_0860A7CE:: @ 860A7CE
.2byte 0x0003
.align 1
gUnknown_0860A7D0:: @ 860A7D0
.2byte 0x0003
.align 1
gUnknown_0860A7D2:: @ 860A7D2
.2byte 0x0004
.align 1
gUnknown_0860A7D4:: @ 860A7D4
.2byte 0x0003
.align 1
gUnknown_0860A7D6:: @ 860A7D6
.2byte 0x0006
.align 1
gUnknown_0860A7D8:: @ 860A7D8
.2byte 0x0006
.align 1
gUnknown_0860A7DA:: @ 860A7DA
.2byte 0x0006
.align 1
gUnknown_0860A7DC:: @ 860A7DC
.2byte 0x0004
.align 1
gUnknown_0860A7DE:: @ 860A7DE
.2byte 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002
.align 1
gUnknown_0860A7EC:: @ 860A7EC
.2byte 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004
.align 1
gUnknown_0860A7FA:: @ 860A7FA
.2byte 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
.align 1
gUnknown_0860A808:: @ 860A808
.2byte 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002
.align 1
gUnknown_0860A816:: @ 860A816
.2byte 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004
.align 1
gUnknown_0860A824:: @ 860A824
.2byte 0xfffe, 0xfffe, 0xfffe, 0xfffe, 0xfffe, 0xfffe, 0xfffe
.align 2
gUnknown_0860A834:: @ 860A834
.4byte gUnknown_0860A4E0
.4byte gUnknown_0860A68C
.4byte gUnknown_0860A692
.4byte gUnknown_0860A6A0
.4byte gUnknown_0860A728
.4byte gUnknown_0860A770
.4byte gUnknown_0860A77C
.4byte gUnknown_0860A788
.4byte gUnknown_0860A7B0
.4byte gUnknown_0860A7BE
.4byte gUnknown_0860A7C8
.4byte gUnknown_0860A7CA
.4byte gUnknown_0860A7CC
.4byte gUnknown_0860A7CE
.4byte gUnknown_0860A7D0
.4byte gUnknown_0860A7D2
.4byte gUnknown_0860A7D4
.4byte gUnknown_0860A7D6
.4byte gUnknown_0860A7D8
.4byte gUnknown_0860A7DA
.4byte gUnknown_0860A7DA
.4byte gUnknown_0860A7DC
.4byte gUnknown_0860A7DE
.4byte gUnknown_0860A7EC
.4byte gUnknown_0860A7FA
.4byte gUnknown_0860A808
.4byte gUnknown_0860A816
.4byte gUnknown_0860A824
.align 1
gUnknown_0860A8A4:: @ 860A8A4
.2byte 0x0097, 0x00b2, 0x00bc, 0x008c, 0x00b4, 0x00b5, 0x0093, 0x006a, 0x0091, 0x005e, 0x0030, 0x002a, 0x0095, 0x001c, 0x001d, 0x0064
.2byte 0x0060, 0xffff

File diff suppressed because it is too large Load Diff

View File

@ -4866,21 +4866,3 @@ gUnknown_0831ACDC:: @ 831ACDC
.align 2
gUnknown_0831ACE0:: @ 831ACE0
.byte 0xe0, 0xf0, 0xf0, 0xe0, 0xe0, 0x00, 0x00, 0x00
@ 831ACE8
.include "data/type_effectiveness.inc"
@ 831AE38
.include "data/text/type_names.inc"
@ 831AEB8
.include "data/trainer_money.inc"
@ 831AF98
.include "data/text/ability_descriptions.inc"
@ 831B6DB
.include "data/text/ability_names.inc"
@ 831BAD4
.include "data/text/ability_description_pointers.inc"

View File

@ -1,18 +0,0 @@
#include "constants/abilities.h"
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/species.h"
#include "constants/pokemon.h"
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
@ 831C898
.include "data/battle_moves.inc"
@ 0x31d93c
@ unreferenced unknown data
.byte 0x34, 0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00

View File

@ -1161,7 +1161,7 @@ EventScript_2715DE:: @ 82715DE
setflag FLAG_0x376
setflag FLAG_0x374
setflag FLAG_0x375
setflag FLAG_0x3C1
setflag FLAG_SPRITEVIS_SLATEPORT_MUSEUM_POPULATION
setflag FLAG_0x378
setflag FLAG_0x2F0
setflag FLAG_0x2F5
@ -1177,7 +1177,7 @@ EventScript_2715DE:: @ 82715DE
setflag FLAG_0x38F
setflag FLAG_0x393
setflag FLAG_0x358
setflag FLAG_0x390
setflag FLAG_SPRITEVIS_MAUVILLE_CITY_WATTSON
setflag FLAG_0x2FD
setflag FLAG_0x398
setflag FLAG_0x399

View File

@ -1,81 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_085B27C8:: @ 85B27C8
.byte 0x01, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x02, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x03, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x05, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x06, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x07, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x08, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x09, 0x04, 0x01, 0x00
.4byte sub_81375A8
.byte 0x04, 0x01, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x02, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x03, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x05, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x06, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x07, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x08, 0x00, 0x01
.4byte sub_81373F0
.byte 0x04, 0x09, 0x00, 0x01
.4byte sub_81373F0
.byte 0x00, 0x00, 0x00, 0x00
.4byte NULL
.align 2
gCaveTransitionPalette_White:: @ 85B2850
.incbin "graphics/misc/cave_transition_white.gbapal"
.align 2
gCaveTransitionPalette_Black:: @ 85B2870
.incbin "graphics/misc/cave_transition_black.gbapal"
.align 2
gUnknown_085B2890:: @ 85B2890
.incbin "graphics/misc/85B2890.gbapal"
.align 2
gUnknown_085B28A0:: @ 85B28A0
.incbin "graphics/misc/85B28A0.gbapal"
.align 2
gCaveTransitionTilemap:: @ 85B28B0
.incbin "graphics/misc/cave_transition_map.bin.lz"
.align 2
gCaveTransitionTiles:: @ 85B2A90
.incbin "graphics/misc/cave_transition.4bpp.lz"

View File

@ -1,98 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_08617274:: @ 8617274
.space 0x20
.incbin "graphics/misc/mirage_tower.4bpp"
.align 2
gUnknown_08617B94:: @ 8617B94
.incbin "graphics/misc/mirage_tower.bin"
.align 2
gRootFossil_Pal:: @ 8617C24
.incbin "graphics/misc/fossil.gbapal"
.align 2
gRootFossil_Gfx:: @ 8617C44
.incbin "graphics/misc/fossil.4bpp"
.align 2
gMirageTowerCrumbles_Gfx:: @ 8617CC4
.incbin "graphics/misc/mirage_tower_crumbles.4bpp"
.align 2
gMirageTowerCrumbles_Palette:: @ 8617D44
.incbin "graphics/misc/mirage_tower_crumbles.gbapal"
.align 1
gUnknown_08617D64:: @ 8617D64
.2byte 0x0000, 0x000a, 0x0041, 0x0011, 0x0003, 0x0032, 0xfff4, 0x0000, 0x004b, 0x000a, 0x000f, 0x005a, 0x0007, 0x0008, 0x0041, 0xffee
.2byte 0x0005, 0x004b, 0x0016, 0xfff6, 0x0037, 0xffe8, 0xfffc, 0x0041
.align 2
gUnknown_08617D94:: @ 8617D94
obj_tiles gMirageTowerCrumbles_Gfx, 0x0080, 0x0fa0
null_obj_tiles
.align 2
gUnknown_08617DA4:: @ 8617DA4
.byte 0x12, 0x35, 0x51, 0x02, 0x13, 0x35, 0x51, 0x02, 0x14, 0x35, 0x51, 0x02, 0x12, 0x36, 0x51, 0x02, 0x13, 0x36, 0x51, 0x02, 0x14, 0x36, 0x51, 0x02, 0x12, 0x37, 0x51, 0x02, 0x13, 0x37, 0x51, 0x02
.byte 0x14, 0x37, 0x51, 0x02, 0x12, 0x38, 0x51, 0x02, 0x13, 0x38, 0x51, 0x02, 0x14, 0x38, 0x51, 0x02, 0x12, 0x39, 0x59, 0x02, 0x13, 0x39, 0x59, 0x02, 0x14, 0x39, 0x59, 0x02, 0x12, 0x3a, 0x21, 0x01
.byte 0x13, 0x3a, 0x21, 0x01, 0x14, 0x3a, 0x21, 0x01
.align 2
gSpriteAnim_8617DEC:: @ 8617DEC
.2byte 0x0000, 0x0001, 0xffff, 0x0000
.align 2
gOamData_8617DF4:: @ 8617DF4
.2byte 0x0000, 0x4000, 0x3000, 0x0000
.align 2
gSpriteAnimTable_8617DFC:: @ 8617DFC
.4byte gSpriteAnim_8617DEC
.align 2
gUnknown_08617E00:: @ 8617E00
spr_template 0xffff, 0xffff, gOamData_8617DF4, gSpriteAnimTable_8617DFC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_08617E18:: @ 8617E18
.byte 0x3b, 0x43, 0x61, 0x00, 0x0f, 0x05, 0xff, 0x9b
.align 2
gSpriteAnim_8617E20:: @ 8617E20
.2byte 0x0000, 0x000c, 0xfffe, 0x0000
.align 2
gSpriteAnimTable_8617E28:: @ 8617E28
.4byte gSpriteAnim_8617E20
.align 2
gUnknown_08617E2C:: @ 8617E2C
.2byte 0x0000, 0x0000, 0x0000, 0x0000
.align 2
gUnknown_08617E34:: @ 8617E34
spr_template 0x0fa0, 0xffff, gUnknown_08617E2C, gSpriteAnimTable_8617E28, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8
.align 2
gSpriteAnim_8617E4C:: @ 8617E4C
.2byte 0x0000, 0x000c, 0xfffe, 0x0000
.align 2
gSpriteAnim_8617E54:: @ 8617E54
.4byte gSpriteAnim_8617E4C
.align 2
gOamData_8617E58:: @ 8617E58
.2byte 0x0000, 0x4000, 0x0000, 0x0000
.align 2
gUnknown_08617E60:: @ 8617E60
spr_template 0x0fa0, 0xffff, gOamData_8617E58, gSpriteAnim_8617E54, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8

View File

@ -5,18 +5,18 @@ MauvilleCity_MapScripts:: @ 81DF385
MauvilleCity_MapScript1_1DF38B: @ 81DF38B
setflag FLAG_VISITED_MAUVILLE_CITY
clearflag FLAG_0x09D
clearflag FLAG_0x3C1
clearflag FLAG_SPRITEVIS_SLATEPORT_MUSEUM_POPULATION
setflag FLAG_SYS_TV_START
clearflag FLAG_0x063
setvar VAR_0x4093, 0
checkflag FLAG_0x0D1
checkflag FLAG_GOT_TM24_FROM_WATTSON
call_if 1, MauvilleCity_EventScript_1DF3A9
end
MauvilleCity_EventScript_1DF3A9:: @ 81DF3A9
clearflag FLAG_0x391
setflag FLAG_0x390
setflag FLAG_0x05B
clearflag FLAG_SPRITEVIS_MAUVILLE_GYM_WATTSON
setflag FLAG_SPRITEVIS_MAUVILLE_CITY_WATTSON
setflag FLAG_WATTSON_REMATCH_AVAILABLE
return
MauvilleCity_EventScript_1DF3B3:: @ 81DF3B3
@ -424,15 +424,15 @@ MauvilleCity_Movement_1DF72F: @ 81DF72F
MauvilleCity_EventScript_1DF73A:: @ 81DF73A
lock
faceplayer
checkflag FLAG_0x0D1
checkflag FLAG_GOT_TM24_FROM_WATTSON
goto_eq MauvilleCity_EventScript_1DF7B0
compare VAR_0x40BA, 2
goto_eq MauvilleCity_EventScript_1DF784
checkflag FLAG_0x0D0
checkflag FLAG_GOT_BASEMENT_KEY_FROM_WATTSON
goto_eq MauvilleCity_EventScript_1DF77A
msgbox MauvilleCity_Text_1DFFE4, 4
giveitem_std ITEM_BASEMENT_KEY
setflag FLAG_0x0D0
setflag FLAG_GOT_BASEMENT_KEY_FROM_WATTSON
msgbox MauvilleCity_Text_1E0154, 4
release
end
@ -447,7 +447,7 @@ MauvilleCity_EventScript_1DF784:: @ 81DF784
giveitem_std ITEM_TM24
compare VAR_RESULT, 0
goto_eq MauvilleCity_EventScript_272054
setflag FLAG_0x0D1
setflag FLAG_GOT_TM24_FROM_WATTSON
msgbox MauvilleCity_Text_1E02AA, 4
release
end

View File

@ -423,8 +423,8 @@ PetalburgCity_Gym_EventScript_204E3B:: @ 8204E3B
setflag FLAG_BADGE05_GET
special sub_813B9A0
call PetalburgCity_Gym_EventScript_2721F8
setflag FLAG_0x391
clearflag FLAG_0x390
setflag FLAG_SPRITEVIS_MAUVILLE_GYM_WATTSON
clearflag FLAG_SPRITEVIS_MAUVILLE_CITY_WATTSON
setvar VAR_0x8008, 5
call PetalburgCity_Gym_EventScript_271F43
clearflag FLAG_0x3AC

View File

@ -1,80 +0,0 @@
.align 2
gAbilityDescriptionPointers:: @ 831BAD4
.4byte gNoneAbilityDescription
.4byte gStenchAbilityDescription
.4byte gDrizzleAbilityDescription
.4byte gSpeedBoostAbilityDescription
.4byte gBattleArmorAbilityDescription
.4byte gSturdyAbilityDescription
.4byte gDampAbilityDescription
.4byte gLimberAbilityDescription
.4byte gSandVeilAbilityDescription
.4byte gStaticAbilityDescription
.4byte gVoltAbsorbAbilityDescription
.4byte gWaterAbsorbAbilityDescription
.4byte gObliviousAbilityDescription
.4byte gCloudNineAbilityDescription
.4byte gCompoundEyesAbilityDescription
.4byte gInsomniaAbilityDescription
.4byte gColorChangeAbilityDescription
.4byte gImmunityAbilityDescription
.4byte gFlashFireAbilityDescription
.4byte gShieldDustAbilityDescription
.4byte gOwnTempoAbilityDescription
.4byte gSuctionCupsAbilityDescription
.4byte gIntimidateAbilityDescription
.4byte gShadowTagAbilityDescription
.4byte gRoughSkinAbilityDescription
.4byte gWonderGuardAbilityDescription
.4byte gLevitateAbilityDescription
.4byte gEffectSporeAbilityDescription
.4byte gSynchronizeAbilityDescription
.4byte gClearBodyAbilityDescription
.4byte gNaturalCureAbilityDescription
.4byte gLightningRodAbilityDescription
.4byte gSereneGraceAbilityDescription
.4byte gSwiftSwimAbilityDescription
.4byte gChlorophyllAbilityDescription
.4byte gIlluminateAbilityDescription
.4byte gTraceAbilityDescription
.4byte gHugePowerAbilityDescription
.4byte gPoisonPointAbilityDescription
.4byte gInnerFocusAbilityDescription
.4byte gMagmaArmorAbilityDescription
.4byte gWaterVeilAbilityDescription
.4byte gMagnetPullAbilityDescription
.4byte gSoundproofAbilityDescription
.4byte gRainDishAbilityDescription
.4byte gSandStreamAbilityDescription
.4byte gPressureAbilityDescription
.4byte gThickFatAbilityDescription
.4byte gEarlyBirdAbilityDescription
.4byte gFlameBodyAbilityDescription
.4byte gRunAwayAbilityDescription
.4byte gKeenEyeAbilityDescription
.4byte gHyperCutterAbilityDescription
.4byte gPickupAbilityDescription
.4byte gTruantAbilityDescription
.4byte gHustleAbilityDescription
.4byte gCuteCharmAbilityDescription
.4byte gPlusAbilityDescription
.4byte gMinusAbilityDescription
.4byte gForecastAbilityDescription
.4byte gStickyHoldAbilityDescription
.4byte gShedSkinAbilityDescription
.4byte gGutsAbilityDescription
.4byte gMarvelScaleAbilityDescription
.4byte gLiquidOozeAbilityDescription
.4byte gOvergrowAbilityDescription
.4byte gBlazeAbilityDescription
.4byte gTorrentAbilityDescription
.4byte gSwarmAbilityDescription
.4byte gRockHeadAbilityDescription
.4byte gDroughtAbilityDescription
.4byte gArenaTrapAbilityDescription
.4byte gVitalSpiritAbilityDescription
.4byte gWhiteSmokeAbilityDescription
.4byte gPurePowerAbilityDescription
.4byte gShellArmorAbilityDescription
.4byte gCacophonyAbilityDescription
.4byte gAirLockAbilityDescription

View File

@ -1,233 +0,0 @@
gNoneAbilityDescription:: @ 831AF98
.string "No special ability.$"
gStenchAbilityDescription:: @ 831AFAC
.string "Helps repel wild POKéMON.$"
gDrizzleAbilityDescription:: @ 831AFC6
.string "Summons rain in battle.$"
gSpeedBoostAbilityDescription:: @ 831AFDE
.string "Gradually boosts SPEED.$"
gBattleArmorAbilityDescription:: @ 831AFF6
.string "Blocks critical hits.$"
gSturdyAbilityDescription:: @ 831B00C
.string "Negates 1-hit KO attacks.$"
gDampAbilityDescription:: @ 831B026
.string "Prevents self-destruction.$"
gLimberAbilityDescription:: @ 831B041
.string "Prevents paralysis.$"
gSandVeilAbilityDescription:: @ 831B055
.string "Ups evasion in a sandstorm.$"
gStaticAbilityDescription:: @ 831B071
.string "Paralyzes on contact.$"
gVoltAbsorbAbilityDescription:: @ 831B087
.string "Turns electricity into HP.$"
gWaterAbsorbAbilityDescription:: @ 831B0A2
.string "Changes water into HP.$"
gObliviousAbilityDescription:: @ 831B0B9
.string "Prevents attraction.$"
gCloudNineAbilityDescription:: @ 831B0CE
.string "Negates weather effects.$"
gCompoundEyesAbilityDescription:: @ 831B0E7
.string "Raises accuracy.$"
gInsomniaAbilityDescription:: @ 831B0F8
.string "Prevents sleep.$"
gColorChangeAbilityDescription:: @ 831B108
.string "Changes type to foes move.$"
gImmunityAbilityDescription:: @ 831B124
.string "Prevents poisoning.$"
gFlashFireAbilityDescription:: @ 831B138
.string "Powers up if hit by fire.$"
gShieldDustAbilityDescription:: @ 831B152
.string "Prevents added effects.$"
gOwnTempoAbilityDescription:: @ 831B16A
.string "Prevents confusion.$"
gSuctionCupsAbilityDescription:: @ 831B17E
.string "Firmly anchors the body.$"
gIntimidateAbilityDescription:: @ 831B197
.string "Lowers the foes ATTACK.$"
gShadowTagAbilityDescription:: @ 831B1B0
.string "Prevents the foes escape.$"
gRoughSkinAbilityDescription:: @ 831B1CB
.string "Hurts to touch.$"
gWonderGuardAbilityDescription:: @ 831B1DB
.string "“Super effective” hits.$"
gLevitateAbilityDescription:: @ 831B1F3
.string "Not hit by GROUND attacks.$"
gEffectSporeAbilityDescription:: @ 831B20E
.string "Leaves spores on contact.$"
gSynchronizeAbilityDescription:: @ 831B228
.string "Passes on status problems.$"
gClearBodyAbilityDescription:: @ 831B243
.string "Prevents ability reduction.$"
gNaturalCureAbilityDescription:: @ 831B25F
.string "Heals upon switching out.$"
gLightningRodAbilityDescription:: @ 831B279
.string "Draws electrical moves.$"
gSereneGraceAbilityDescription:: @ 831B291
.string "Promotes added effects.$"
gSwiftSwimAbilityDescription:: @ 831B2A9
.string "Raises SPEED in rain.$"
gChlorophyllAbilityDescription:: @ 831B2BF
.string "Raises SPEED in sunshine.$"
gIlluminateAbilityDescription:: @ 831B2D9
.string "Encounter rate increases.$"
gTraceAbilityDescription:: @ 831B2F3
.string "Copies special ability.$"
gHugePowerAbilityDescription:: @ 831B30B
.string "Raises ATTACK.$"
gPoisonPointAbilityDescription:: @ 831B31A
.string "Poisons foe on contact.$"
gInnerFocusAbilityDescription:: @ 831B332
.string "Prevents flinching.$"
gMagmaArmorAbilityDescription:: @ 831B346
.string "Prevents freezing.$"
gWaterVeilAbilityDescription:: @ 831B359
.string "Prevents burns.$"
gMagnetPullAbilityDescription:: @ 831B369
.string "Traps STEEL-type POKéMON.$"
gSoundproofAbilityDescription:: @ 831B383
.string "Avoids sound-based moves.$"
gRainDishAbilityDescription:: @ 831B39D
.string "Slight HP recovery in rain.$"
gSandStreamAbilityDescription:: @ 831B3B9
.string "Summons a sandstorm.$"
gPressureAbilityDescription:: @ 831B3CE
.string "Raises foes PP usage.$"
gThickFatAbilityDescription:: @ 831B3E5
.string "Heat-and-cold protection.$"
gEarlyBirdAbilityDescription:: @ 831B3FF
.string "Awakens quickly from sleep.$"
gFlameBodyAbilityDescription:: @ 831B41B
.string "Burns the foe on contact.$"
gRunAwayAbilityDescription:: @ 831B435
.string "Makes escaping easier.$"
gKeenEyeAbilityDescription:: @ 831B44C
.string "Prevents loss of accuracy.$"
gHyperCutterAbilityDescription:: @ 831B467
.string "Prevents ATTACK reduction.$"
gPickupAbilityDescription:: @ 831B482
.string "May pick up items.$"
gTruantAbilityDescription:: @ 831B495
.string "Moves only every two turns.$"
gHustleAbilityDescription:: @ 831B4B1
.string "Trades accuracy for power.$"
gCuteCharmAbilityDescription:: @ 831B4CC
.string "Infatuates on contact.$"
gPlusAbilityDescription:: @ 831B4E3
.string "Powers up with MINUS.$"
gMinusAbilityDescription:: @ 831B4F9
.string "Powers up with PLUS.$"
gForecastAbilityDescription:: @ 831B50E
.string "Changes with the weather.$"
gStickyHoldAbilityDescription:: @ 831B528
.string "Prevents item theft.$"
gShedSkinAbilityDescription:: @ 831B53D
.string "Heals the body by shedding.$"
gGutsAbilityDescription:: @ 831B559
.string "Ups ATTACK if suffering.$"
gMarvelScaleAbilityDescription:: @ 831B572
.string "Ups DEFENSE if suffering.$"
gLiquidOozeAbilityDescription:: @ 831B58C
.string "Draining causes injury.$"
gOvergrowAbilityDescription:: @ 831B5A4
.string "Ups GRASS moves in a pinch.$"
gBlazeAbilityDescription:: @ 831B5C0
.string "Ups FIRE moves in a pinch.$"
gTorrentAbilityDescription:: @ 831B5DB
.string "Ups WATER moves in a pinch.$"
gSwarmAbilityDescription:: @ 831B5F7
.string "Ups BUG moves in a pinch.$"
gRockHeadAbilityDescription:: @ 831B611
.string "Prevents recoil damage.$"
gDroughtAbilityDescription:: @ 831B629
.string "Summons sunlight in battle.$"
gArenaTrapAbilityDescription:: @ 831B645
.string "Prevents fleeing.$"
gVitalSpiritAbilityDescription:: @ 831B657
.string "Prevents sleep.$"
gWhiteSmokeAbilityDescription:: @ 831B667
.string "Prevents ability reduction.$"
gPurePowerAbilityDescription:: @ 831B683
.string "Raises ATTACK.$"
gShellArmorAbilityDescription:: @ 831B692
.string "Blocks critical hits.$"
gCacophonyAbilityDescription:: @ 831B6A8
.string "Avoids sound-based moves.$"
gAirLockAbilityDescription:: @ 831B6C2
.string "Negates weather effects.$"

View File

@ -1,79 +0,0 @@
gAbilityNames:: @ 831B6DB
.string "-------$", 13
.string "STENCH$", 13
.string "DRIZZLE$", 13
.string "SPEED BOOST$", 13
.string "BATTLE ARMOR$", 13
.string "STURDY$", 13
.string "DAMP$", 13
.string "LIMBER$", 13
.string "SAND VEIL$", 13
.string "STATIC$", 13
.string "VOLT ABSORB$", 13
.string "WATER ABSORB$", 13
.string "OBLIVIOUS$", 13
.string "CLOUD NINE$", 13
.string "COMPOUNDEYES$", 13
.string "INSOMNIA$", 13
.string "COLOR CHANGE$", 13
.string "IMMUNITY$", 13
.string "FLASH FIRE$", 13
.string "SHIELD DUST$", 13
.string "OWN TEMPO$", 13
.string "SUCTION CUPS$", 13
.string "INTIMIDATE$", 13
.string "SHADOW TAG$", 13
.string "ROUGH SKIN$", 13
.string "WONDER GUARD$", 13
.string "LEVITATE$", 13
.string "EFFECT SPORE$", 13
.string "SYNCHRONIZE$", 13
.string "CLEAR BODY$", 13
.string "NATURAL CURE$", 13
.string "LIGHTNINGROD$", 13
.string "SERENE GRACE$", 13
.string "SWIFT SWIM$", 13
.string "CHLOROPHYLL$", 13
.string "ILLUMINATE$", 13
.string "TRACE$", 13
.string "HUGE POWER$", 13
.string "POISON POINT$", 13
.string "INNER FOCUS$", 13
.string "MAGMA ARMOR$", 13
.string "WATER VEIL$", 13
.string "MAGNET PULL$", 13
.string "SOUNDPROOF$", 13
.string "RAIN DISH$", 13
.string "SAND STREAM$", 13
.string "PRESSURE$", 13
.string "THICK FAT$", 13
.string "EARLY BIRD$", 13
.string "FLAME BODY$", 13
.string "RUN AWAY$", 13
.string "KEEN EYE$", 13
.string "HYPER CUTTER$", 13
.string "PICKUP$", 13
.string "TRUANT$", 13
.string "HUSTLE$", 13
.string "CUTE CHARM$", 13
.string "PLUS$", 13
.string "MINUS$", 13
.string "FORECAST$", 13
.string "STICKY HOLD$", 13
.string "SHED SKIN$", 13
.string "GUTS$", 13
.string "MARVEL SCALE$", 13
.string "LIQUID OOZE$", 13
.string "OVERGROW$", 13
.string "BLAZE$", 13
.string "TORRENT$", 13
.string "SWARM$", 13
.string "ROCK HEAD$", 13
.string "DROUGHT$", 13
.string "ARENA TRAP$", 13
.string "VITAL SPIRIT$", 13
.string "WHITE SMOKE$", 13
.string "PURE POWER$", 13
.string "SHELL ARMOR$", 13
.string "CACOPHONY$", 13
.string "AIR LOCK$", 13

View File

@ -1,19 +0,0 @@
gTypeNames:: @ 831AE38
.string "NORMAL$", 7
.string "FIGHT$", 7
.string "FLYING$", 7
.string "POISON$", 7
.string "GROUND$", 7
.string "ROCK$", 7
.string "BUG$", 7
.string "GHOST$", 7
.string "STEEL$", 7
.string "???$", 7
.string "FIRE$", 7
.string "WATER$", 7
.string "GRASS$", 7
.string "ELECTR$", 7
.string "PSYCHC$", 7
.string "ICE$", 7
.string "DRAGON$", 7
.string "DARK$", 7

View File

@ -1,59 +0,0 @@
@ This is a factor in how much money you get for beating a trainer.
.align 2
gTrainerMoneyTable:: @ 831AEB8
.byte TRAINER_CLASS_TEAM_AQUA, 5, 0, 0
.byte TRAINER_CLASS_AQUA_ADMIN, 10, 0, 0
.byte TRAINER_CLASS_AQUA_LEADER, 20, 0, 0
.byte TRAINER_CLASS_AROMA_LADY, 10, 0, 0
.byte TRAINER_CLASS_RUIN_MANIAC, 15, 0, 0
.byte TRAINER_CLASS_INTERVIEWER, 12, 0, 0
.byte TRAINER_CLASS_TUBER_1, 1, 0, 0
.byte TRAINER_CLASS_TUBER_2, 1, 0, 0
.byte TRAINER_CLASS_SIS_AND_BRO, 3, 0, 0
.byte TRAINER_CLASS_COOLTRAINER_1, 12, 0, 0
.byte TRAINER_CLASS_HEX_MANIAC, 6, 0, 0
.byte TRAINER_CLASS_LADY, 50, 0, 0
.byte TRAINER_CLASS_BEAUTY, 20, 0, 0
.byte TRAINER_CLASS_RICH_BOY, 50, 0, 0
.byte TRAINER_CLASS_POKEMANIAC, 15, 0, 0
.byte TRAINER_CLASS_SWIMMER_M, 2, 0, 0
.byte TRAINER_CLASS_BLACK_BELT, 8, 0, 0
.byte TRAINER_CLASS_GUITARIST, 8, 0, 0
.byte TRAINER_CLASS_KINDLER, 8, 0, 0
.byte TRAINER_CLASS_CAMPER, 4, 0, 0
.byte TRAINER_CLASS_OLD_COUPLE, 10, 0, 0
.byte TRAINER_CLASS_BUG_MANIAC, 15, 0, 0
.byte TRAINER_CLASS_PSYCHIC, 6, 0, 0
.byte TRAINER_CLASS_GENTLEMAN, 20, 0, 0
.byte TRAINER_CLASS_ELITE_FOUR, 25, 0, 0
.byte TRAINER_CLASS_LEADER, 25, 0, 0
.byte TRAINER_CLASS_SCHOOL_KID, 5, 0, 0
.byte TRAINER_CLASS_SR_AND_JR, 4, 0, 0
.byte TRAINER_CLASS_POKEFAN, 20, 0, 0
.byte TRAINER_CLASS_EXPERT, 10, 0, 0
.byte TRAINER_CLASS_YOUNGSTER, 4, 0, 0
.byte TRAINER_CLASS_CHAMPION, 50, 0, 0
.byte TRAINER_CLASS_FISHERMAN, 10, 0, 0
.byte TRAINER_CLASS_TRIATHLETE, 10, 0, 0
.byte TRAINER_CLASS_DRAGON_TAMER, 12, 0, 0
.byte TRAINER_CLASS_BIRD_KEEPER, 8, 0, 0
.byte TRAINER_CLASS_NINJA_BOY, 3, 0, 0
.byte TRAINER_CLASS_BATTLE_GIRL, 6, 0, 0
.byte TRAINER_CLASS_PARASOL_LADY, 10, 0, 0
.byte TRAINER_CLASS_SWIMMER_F, 2, 0, 0
.byte TRAINER_CLASS_PICNICKER, 4, 0, 0
.byte TRAINER_CLASS_TWINS, 3, 0, 0
.byte TRAINER_CLASS_SAILOR, 8, 0, 0
.byte TRAINER_CLASS_COLLECTOR, 15, 0, 0
.byte TRAINER_CLASS_PKMN_TRAINER_3, 15, 0, 0
.byte TRAINER_CLASS_PKMN_BREEDER, 10, 0, 0
.byte TRAINER_CLASS_PKMN_RANGER, 12, 0, 0
.byte TRAINER_CLASS_TEAM_MAGMA, 5, 0, 0
.byte TRAINER_CLASS_MAGMA_ADMIN, 10, 0, 0
.byte TRAINER_CLASS_MAGMA_LEADER, 20, 0, 0
.byte TRAINER_CLASS_LASS, 4, 0, 0
.byte TRAINER_CLASS_BUG_CATCHER, 4, 0, 0
.byte TRAINER_CLASS_HIKER, 10, 0, 0
.byte TRAINER_CLASS_YOUNG_COUPLE, 8, 0, 0
.byte TRAINER_CLASS_WINSTRATE, 10, 0, 0
.byte -1, 5, 0, 0

View File

@ -1,10 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnknown_0862AD34:: @ 862AD34
.2byte 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048
gUnknown_0862AD44:: @ 862AD44
.2byte 0x0041, 0x0042, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0000

View File

@ -1,119 +0,0 @@
@ format: attacking type, defending type, damage multiplier
@ the multiplier is a (decimal) fixed-point number:
@ 20 is ×2.0
@ 05 is ×0.5
@ 00 is ×0
gTypeEffectiveness:: @ 831ACE8
.byte TYPE_NORMAL, TYPE_ROCK, 5
.byte TYPE_NORMAL, TYPE_STEEL, 5
.byte TYPE_FIRE, TYPE_FIRE, 5
.byte TYPE_FIRE, TYPE_WATER, 5
.byte TYPE_FIRE, TYPE_GRASS, 20
.byte TYPE_FIRE, TYPE_ICE, 20
.byte TYPE_FIRE, TYPE_BUG, 20
.byte TYPE_FIRE, TYPE_ROCK, 5
.byte TYPE_FIRE, TYPE_DRAGON, 5
.byte TYPE_FIRE, TYPE_STEEL, 20
.byte TYPE_WATER, TYPE_FIRE, 20
.byte TYPE_WATER, TYPE_WATER, 5
.byte TYPE_WATER, TYPE_GRASS, 5
.byte TYPE_WATER, TYPE_GROUND, 20
.byte TYPE_WATER, TYPE_ROCK, 20
.byte TYPE_WATER, TYPE_DRAGON, 5
.byte TYPE_ELECTRIC, TYPE_WATER, 20
.byte TYPE_ELECTRIC, TYPE_ELECTRIC, 5
.byte TYPE_ELECTRIC, TYPE_GRASS, 5
.byte TYPE_ELECTRIC, TYPE_GROUND, 0
.byte TYPE_ELECTRIC, TYPE_FLYING, 20
.byte TYPE_ELECTRIC, TYPE_DRAGON, 5
.byte TYPE_GRASS, TYPE_FIRE, 5
.byte TYPE_GRASS, TYPE_WATER, 20
.byte TYPE_GRASS, TYPE_GRASS, 5
.byte TYPE_GRASS, TYPE_POISON, 5
.byte TYPE_GRASS, TYPE_GROUND, 20
.byte TYPE_GRASS, TYPE_FLYING, 5
.byte TYPE_GRASS, TYPE_BUG, 5
.byte TYPE_GRASS, TYPE_ROCK, 20
.byte TYPE_GRASS, TYPE_DRAGON, 5
.byte TYPE_GRASS, TYPE_STEEL, 5
.byte TYPE_ICE, TYPE_WATER, 5
.byte TYPE_ICE, TYPE_GRASS, 20
.byte TYPE_ICE, TYPE_ICE, 5
.byte TYPE_ICE, TYPE_GROUND, 20
.byte TYPE_ICE, TYPE_FLYING, 20
.byte TYPE_ICE, TYPE_DRAGON, 20
.byte TYPE_ICE, TYPE_STEEL, 5
.byte TYPE_ICE, TYPE_FIRE, 5
.byte TYPE_FIGHTING, TYPE_NORMAL, 20
.byte TYPE_FIGHTING, TYPE_ICE, 20
.byte TYPE_FIGHTING, TYPE_POISON, 5
.byte TYPE_FIGHTING, TYPE_FLYING, 5
.byte TYPE_FIGHTING, TYPE_PSYCHIC, 5
.byte TYPE_FIGHTING, TYPE_BUG, 5
.byte TYPE_FIGHTING, TYPE_ROCK, 20
.byte TYPE_FIGHTING, TYPE_DARK, 20
.byte TYPE_FIGHTING, TYPE_STEEL, 20
.byte TYPE_POISON, TYPE_GRASS, 20
.byte TYPE_POISON, TYPE_POISON, 5
.byte TYPE_POISON, TYPE_GROUND, 5
.byte TYPE_POISON, TYPE_ROCK, 5
.byte TYPE_POISON, TYPE_GHOST, 5
.byte TYPE_POISON, TYPE_STEEL, 0
.byte TYPE_GROUND, TYPE_FIRE, 20
.byte TYPE_GROUND, TYPE_ELECTRIC, 20
.byte TYPE_GROUND, TYPE_GRASS, 5
.byte TYPE_GROUND, TYPE_POISON, 20
.byte TYPE_GROUND, TYPE_FLYING, 0
.byte TYPE_GROUND, TYPE_BUG, 5
.byte TYPE_GROUND, TYPE_ROCK, 20
.byte TYPE_GROUND, TYPE_STEEL, 20
.byte TYPE_FLYING, TYPE_ELECTRIC, 5
.byte TYPE_FLYING, TYPE_GRASS, 20
.byte TYPE_FLYING, TYPE_FIGHTING, 20
.byte TYPE_FLYING, TYPE_BUG, 20
.byte TYPE_FLYING, TYPE_ROCK, 5
.byte TYPE_FLYING, TYPE_STEEL, 5
.byte TYPE_PSYCHIC, TYPE_FIGHTING, 20
.byte TYPE_PSYCHIC, TYPE_POISON, 20
.byte TYPE_PSYCHIC, TYPE_PSYCHIC, 5
.byte TYPE_PSYCHIC, TYPE_DARK, 0
.byte TYPE_PSYCHIC, TYPE_STEEL, 5
.byte TYPE_BUG, TYPE_FIRE, 5
.byte TYPE_BUG, TYPE_GRASS, 20
.byte TYPE_BUG, TYPE_FIGHTING, 5
.byte TYPE_BUG, TYPE_POISON, 5
.byte TYPE_BUG, TYPE_FLYING, 5
.byte TYPE_BUG, TYPE_PSYCHIC, 20
.byte TYPE_BUG, TYPE_GHOST, 5
.byte TYPE_BUG, TYPE_DARK, 20
.byte TYPE_BUG, TYPE_STEEL, 5
.byte TYPE_ROCK, TYPE_FIRE, 20
.byte TYPE_ROCK, TYPE_ICE, 20
.byte TYPE_ROCK, TYPE_FIGHTING, 5
.byte TYPE_ROCK, TYPE_GROUND, 5
.byte TYPE_ROCK, TYPE_FLYING, 20
.byte TYPE_ROCK, TYPE_BUG, 20
.byte TYPE_ROCK, TYPE_STEEL, 5
.byte TYPE_GHOST, TYPE_NORMAL, 0
.byte TYPE_GHOST, TYPE_PSYCHIC, 20
.byte TYPE_GHOST, TYPE_DARK, 5
.byte TYPE_GHOST, TYPE_STEEL, 5
.byte TYPE_GHOST, TYPE_GHOST, 20
.byte TYPE_DRAGON, TYPE_DRAGON, 20
.byte TYPE_DRAGON, TYPE_STEEL, 5
.byte TYPE_DARK, TYPE_FIGHTING, 5
.byte TYPE_DARK, TYPE_PSYCHIC, 20
.byte TYPE_DARK, TYPE_GHOST, 20
.byte TYPE_DARK, TYPE_DARK, 5
.byte TYPE_DARK, TYPE_STEEL, 5
.byte TYPE_STEEL, TYPE_FIRE, 5
.byte TYPE_STEEL, TYPE_WATER, 5
.byte TYPE_STEEL, TYPE_ELECTRIC, 5
.byte TYPE_STEEL, TYPE_ICE, 20
.byte TYPE_STEEL, TYPE_ROCK, 20
.byte TYPE_STEEL, TYPE_STEEL, 5
.byte 0xFE, 0xFE, 0
.byte TYPE_NORMAL, TYPE_GHOST, 0
.byte TYPE_FIGHTING, TYPE_GHOST, 0
.byte 0xFF, 0xFF, 0

View File

@ -3,6 +3,7 @@
.section .rodata
.align 2, 0
gUnknown_0862AD54:: @ 862AD54
.incbin "graphics/battle_transitions/frontier_transition.4bpp.lz"

View File

@ -3,9 +3,9 @@
// should they be included here or included individually by every file?
#include "constants/battle.h"
#include "battle_main.h"
#include "battle_util.h"
#include "battle_script_commands.h"
#include "battle_main.h"
#include "battle_ai_switch_items.h"
#include "battle_gfx_sfx_util.h"
#include "battle_util2.h"
@ -66,29 +66,14 @@
#define MSG_DISPLAY 0x7
#define BATTLE_COMMUNICATION_ENTRIES_COUNT 0x8
#define MOVE_TARGET_SELECTED 0x0
#define MOVE_TARGET_DEPENDS 0x1
#define MOVE_TARGET_USER 0x2
#define MOVE_TARGET_RANDOM 0x4
#define MOVE_TARGET_x10 0x10
#define MOVE_TARGET_BOTH 0x8
#define MOVE_TARGET_FOES_AND_ALLY 0x20
#define MOVE_TARGET_OPPONENTS_FIELD 0x40
// defines for the u8 array gTypeEffectiveness
#define TYPE_EFFECT_ATK_TYPE(i)((gTypeEffectiveness[i + 0]))
#define TYPE_EFFECT_DEF_TYPE(i)((gTypeEffectiveness[i + 1]))
#define TYPE_EFFECT_MULTIPLIER(i)((gTypeEffectiveness[i + 2]))
// defines for the gTypeEffectiveness multipliers
#define TYPE_MUL_NO_EFFECT 0
#define TYPE_MUL_NOT_EFFECTIVE 5
#define TYPE_MUL_NORMAL 10
#define TYPE_MUL_SUPER_EFFECTIVE 20
// special type table Ids
#define TYPE_FORESIGHT 0xFE
#define TYPE_ENDTABLE 0xFF
#define MOVE_TARGET_SELECTED 0x0
#define MOVE_TARGET_DEPENDS 0x1
#define MOVE_TARGET_USER_OR_SELECTED 0x2
#define MOVE_TARGET_RANDOM 0x4
#define MOVE_TARGET_BOTH 0x8
#define MOVE_TARGET_USER 0x10
#define MOVE_TARGET_FOES_AND_ALLY 0x20
#define MOVE_TARGET_OPPONENTS_FIELD 0x40
#define BATTLE_BUFFER_LINK_SIZE 0x1000
@ -368,6 +353,91 @@ struct BattleResults
u8 catchAttempts[11]; // 0x36
};
struct BattleTv_Side
{
u32 spikesMonId:3;
u32 reflectMonId:3;
u32 lightScreenMonId:3;
u32 safeguardMonId:3;
u32 mistMonId:3;
u32 futureSightMonId:3;
u32 doomDesireMonId:3;
u32 perishSongMonId:3;
u32 wishMonId:3;
u32 grudgeMonId:3;
u32 usedMoveSlot:2;
u32 spikesMoveSlot:2;
u32 reflectMoveSlot:2;
u32 lightScreenMoveSlot:2;
u32 safeguardMoveSlot:2;
u32 mistMoveSlot:2;
u32 futureSightMoveSlot:2;
u32 doomDesireMoveSlot:2;
u32 perishSongMoveSlot:2;
u32 wishMoveSlot:2;
u32 grudgeMoveSlot:2;
u32 destinyBondMonId:3;
u32 destinyBondMoveSlot:2;
u32 faintCause:4;
u32 faintCauseMonId:3;
u32 explosion:1;
u32 explosionMoveSlot:2;
u32 explosionMonId:3;
u32 perishSong:1;
};
struct BattleTv_Position
{
u32 curseMonId:3;
u32 leechSeedMonId:3;
u32 nightmareMonId:3;
u32 wrapMonId:3;
u32 attractMonId:3;
u32 confusionMonId:3;
u32 curseMoveSlot:2;
u32 leechSeedMoveSlot:2;
u32 nightmareMoveSlot:2;
u32 wrapMoveSlot:2;
u32 attractMoveSlot:2;
u32 confusionMoveSlot:2;
u32 waterSportMoveSlot:2;
u32 waterSportMonId:3;
u32 mudSportMonId:3;
u32 mudSportMoveSlot:2;
u32 ingrainMonId:3;
u32 ingrainMoveSlot:2;
u32 attackedByMonId:3;
u32 attackedByMoveSlot:2;
};
struct BattleTv_Mon
{
u32 psnMonId:3;
u32 badPsnMonId:3;
u32 brnMonId:3;
u32 prlzMonId:3;
u32 slpMonId:3;
u32 frzMonId:3;
u32 psnMoveSlot:2;
u32 badPsnMoveSlot:2;
u32 brnMoveSlot:2;
u32 prlzMoveSlot:2;
u32 slpMoveSlot:2;
u32 frzMoveSlot:2;
};
struct BattleTv
{
struct BattleTv_Mon mon[2][6]; // [side][partyId]
struct BattleTv_Position pos[2][2]; // [side][flank]
struct BattleTv_Side side[2]; // [side]
};
struct BattleTvMovePoints
{
s16 points[2][PARTY_SIZE * 4];
};
struct BattleStruct
{
u8 turnEffectsTracker;
@ -447,7 +517,7 @@ struct BattleStruct
u8 field_B0;
u8 hpScale;
u8 synchronizeMoveEffect;
u8 field_B3;
bool8 anyMonHasTransformed;
void (*savedCallback)(void);
u16 usedHeldItems[MAX_BATTLERS_COUNT];
u8 chosenItem[4]; // why is this an u8?
@ -472,9 +542,9 @@ struct BattleStruct
u8 wishPerishSongBattlerId;
bool8 overworldWeatherDone;
u8 atkCancellerTracker;
u8 field_1A4[96];
u8 field_204[104];
u8 field_26C[40];
struct BattleTvMovePoints tvMovePoints;
struct BattleTv tv;
u8 notSureWhatFieldLol[0x28];
u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT];
u8 field_298[8];
u8 field_2A0;
@ -493,6 +563,7 @@ struct BattleStruct
#define IS_MOVE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
#define IS_MOVE_SPECIAL(moveType)(moveType > TYPE_MYSTERY)
#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit

View File

@ -1,11 +0,0 @@
#ifndef GUARD_BATTLE_LINK_817C95C_H
#define GUARD_BATTLE_LINK_817C95C_H
void sub_817C95C(u16 stringId);
void sub_817E0FC(u16 move, u16 weatherFlags, struct DisableStruct *disableStructPtr);
void sub_817E32C(u8 animationId);
void sub_817E3F4(void);
void sub_817F2A8(void);
u8 GetBattlerMoveSlotId(u8 bank, u16 move);
#endif // GUARD_BATTLE_LINK_817C95C_H

View File

@ -1,6 +1,30 @@
#ifndef GUARD_BATTLE_MAIN_H
#define GUARD_BATTLE_MAIN_H
struct TrainerMoney
{
u8 classId;
u8 value;
};
#define TYPE_NAME_LENGTH 6
#define ABILITY_NAME_LENGTH 12
// defines for the u8 array gTypeEffectiveness
#define TYPE_EFFECT_ATK_TYPE(i)((gTypeEffectiveness[i + 0]))
#define TYPE_EFFECT_DEF_TYPE(i)((gTypeEffectiveness[i + 1]))
#define TYPE_EFFECT_MULTIPLIER(i)((gTypeEffectiveness[i + 2]))
// defines for the gTypeEffectiveness multipliers
#define TYPE_MUL_NO_EFFECT 0
#define TYPE_MUL_NOT_EFFECTIVE 5
#define TYPE_MUL_NORMAL 10
#define TYPE_MUL_SUPER_EFFECTIVE 20
// special type table Ids
#define TYPE_FORESIGHT 0xFE
#define TYPE_ENDTABLE 0xFF
void CB2_InitBattle(void);
void BattleMainCB2(void);
void CB2_QuitRecordedBattle(void);
@ -42,6 +66,12 @@ void RunBattleScriptCommands_PopCallbacksStack(void);
void RunBattleScriptCommands(void);
bool8 TryRunFromBattle(u8 battlerId);
extern const u8 gTypeEffectiveness[336];
extern const u8 gTypeNames[][TYPE_NAME_LENGTH + 1];
extern const struct TrainerMoney gTrainerMoneyTable[];
extern const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1];
extern const u8 *const gAbilityDescriptionPointers[];
extern const u8 gStatusConditionString_PoisonJpn[8];
extern const u8 gStatusConditionString_SleepJpn[8];
extern const u8 gStatusConditionString_ParalysisJpn[8];

View File

@ -4,16 +4,16 @@
#define WINDOW_CLEAR 0x1
#define WINDOW_x80 0x80
void AI_CalcDmg(u8 bankAtk, u8 bankDef);
u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef);
void AI_CalcDmg(u8 battlerIdAtk, u8 battlerIdDef);
u8 TypeCalc(u16 move, u8 battlerIdAtk, u8 battlerIdDef);
u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility);
u8 GetBattlerTurnOrderNum(u8 bank);
u8 GetBattlerTurnOrderNum(u8 battlerId);
void SetMoveEffect(bool8 primary, u8 certain);
void BattleDestroyYesNoCursorAt(u8 cursorPosition);
void BattleCreateYesNoCursorAt(u8 cursorPosition);
void BufferMoveToLearnIntoBattleTextBuff2(void);
void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags);
bool8 UproarWakeUpCheck(u8 bank);
bool8 UproarWakeUpCheck(u8 battlerId);
extern void (* const gBattleScriptingCommandsTable[])(void);
extern const u8 gUnknown_0831C494[][4];

11
include/battle_tv.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef GUARD_BATTLE_TV_H
#define GUARD_BATTLE_TV_H
void BattleTv_SetDataBasedOnString(u16 stringId);
void BattleTv_SetDataBasedOnMove(u16 move, u16 weatherFlags, struct DisableStruct *disableStructPtr);
void BattleTv_SetDataBasedOnAnimation(u8 animationId);
void TryPutLinkBattleTvShowOnAir(void);
void BattleTv_ClearExplosionFaintCause(void);
u8 GetBattlerMoveSlotId(u8 battlerId, u16 moveId);
#endif // GUARD_BATTLE_TV_H

10
include/blit.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef GUARD_BLIT_H
#define GUARD_BLIT_H
void BlitBitmapRect4BitWithoutColorKey(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height);
void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey);
void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue);
void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey, u8 paletteOffset);
void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue);
#endif // GUARD_BLIT_H

View File

@ -0,0 +1,7 @@
#ifndef GUARD_BRAILLE_PUZZLES_H
#define GUARD_BRAILLE_PUZZLES_H
bool8 ShouldDoBrailleFlyEffect(void);
void sub_8179918(void);
#endif // GUARD_BRAILLE_PUZZLES_H

View File

@ -5,4 +5,4 @@
void DoTimeBasedEvents(void);
#endif
#endif // GUARD_CLOCK_H

View File

@ -151,7 +151,7 @@
#define EFFECT_EARTHQUAKE 147
#define EFFECT_FUTURE_SIGHT 148
#define EFFECT_GUST 149
#define EFFECT_FLINCH_HIT_2 150 // STOMP ASTONISH EXTRASENSORY NEEDLE_ARM
#define EFFECT_FLINCH_MINIMIZE_HIT 150 // STOMP ASTONISH EXTRASENSORY NEEDLE_ARM
#define EFFECT_SOLARBEAM 151
#define EFFECT_THUNDER 152
#define EFFECT_TELEPORT 153

View File

@ -92,6 +92,6 @@
#define ATK48_STAT_NEGATIVE 0x1
#define ATK48_STAT_BY_TWO 0x2
#define ATK48_BIT_x4 0x4
#define ATK48_LOWER_FAIL_CHECK 0x8
#define ATK48_DONT_CHECK_LOWER 0x8
#endif // GUARD_CONSTANTS_BATTLE_SCRIPT_COMMANDS_H

View File

@ -91,7 +91,7 @@
#define FLAG_0x058 0x58
#define FLAG_0x059 0x59
#define FLAG_0x05A 0x5A
#define FLAG_0x05B 0x5B
#define FLAG_WATTSON_REMATCH_AVAILABLE 0x5B
#define FLAG_0x05C 0x5C
#define FLAG_0x05D 0x5D
#define FLAG_0x05E 0x5E
@ -208,8 +208,8 @@
#define FLAG_0x0CD 0xCD
#define FLAG_0x0CE 0xCE
#define FLAG_0x0CF 0xCF
#define FLAG_0x0D0 0xD0
#define FLAG_0x0D1 0xD1
#define FLAG_GOT_BASEMENT_KEY_FROM_WATTSON 0xD0
#define FLAG_GOT_TM24_FROM_WATTSON 0xD1
#define FLAG_0x0D2 0xD2
#define FLAG_0x0D3 0xD3
#define FLAG_0x0D4 0xD4
@ -913,8 +913,8 @@
#define FLAG_0x38D 0x38D
#define FLAG_0x38E 0x38E
#define FLAG_0x38F 0x38F
#define FLAG_0x390 0x390
#define FLAG_0x391 0x391
#define FLAG_SPRITEVIS_MAUVILLE_CITY_WATTSON 0x390
#define FLAG_SPRITEVIS_MAUVILLE_GYM_WATTSON 0x391
#define FLAG_0x392 0x392
#define FLAG_0x393 0x393
#define FLAG_0x394 0x394
@ -962,7 +962,7 @@
#define FLAG_0x3BE 0x3BE
#define FLAG_0x3BF 0x3BF
#define FLAG_0x3C0 0x3C0
#define FLAG_0x3C1 0x3C1
#define FLAG_SPRITEVIS_SLATEPORT_MUSEUM_POPULATION 0x3C1
#define FLAG_0x3C2 0x3C2
#define FLAG_0x3C3 0x3C3
#define FLAG_0x3C4 0x3C4

3913
include/data/battle_moves.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,247 @@
#ifndef POKEEMERALD_DATA_TEXT_ABILITIES_H
#define POKEEMERALD_DATA_TEXT_ABILITIES_H
static const u8 gNoneAbilityDescription[] = _("No special ability.");
static const u8 gStenchAbilityDescription[] = _("Helps repel wild POKéMON.");
static const u8 gDrizzleAbilityDescription[] = _("Summons rain in battle.");
static const u8 gSpeedBoostAbilityDescription[] = _("Gradually boosts SPEED.");
static const u8 gBattleArmorAbilityDescription[] = _("Blocks critical hits.");
static const u8 gSturdyAbilityDescription[] = _("Negates 1-hit KO attacks.");
static const u8 gDampAbilityDescription[] = _("Prevents self-destruction.");
static const u8 gLimberAbilityDescription[] = _("Prevents paralysis.");
static const u8 gSandVeilAbilityDescription[] = _("Ups evasion in a sandstorm.");
static const u8 gStaticAbilityDescription[] = _("Paralyzes on contact.");
static const u8 gVoltAbsorbAbilityDescription[] = _("Turns electricity into HP.");
static const u8 gWaterAbsorbAbilityDescription[] = _("Changes water into HP.");
static const u8 gObliviousAbilityDescription[] = _("Prevents attraction.");
static const u8 gCloudNineAbilityDescription[] = _("Negates weather effects.");
static const u8 gCompoundEyesAbilityDescription[] = _("Raises accuracy.");
static const u8 gInsomniaAbilityDescription[] = _("Prevents sleep.");
static const u8 gColorChangeAbilityDescription[] = _("Changes type to foes move.");
static const u8 gImmunityAbilityDescription[] = _("Prevents poisoning.");
static const u8 gFlashFireAbilityDescription[] = _("Powers up if hit by fire.");
static const u8 gShieldDustAbilityDescription[] = _("Prevents added effects.");
static const u8 gOwnTempoAbilityDescription[] = _("Prevents confusion.");
static const u8 gSuctionCupsAbilityDescription[] = _("Firmly anchors the body.");
static const u8 gIntimidateAbilityDescription[] = _("Lowers the foes ATTACK.");
static const u8 gShadowTagAbilityDescription[] = _("Prevents the foes escape.");
static const u8 gRoughSkinAbilityDescription[] = _("Hurts to touch.");
static const u8 gWonderGuardAbilityDescription[] = _("“Super effective” hits.");
static const u8 gLevitateAbilityDescription[] = _("Not hit by GROUND attacks.");
static const u8 gEffectSporeAbilityDescription[] = _("Leaves spores on contact.");
static const u8 gSynchronizeAbilityDescription[] = _("Passes on status problems.");
static const u8 gClearBodyAbilityDescription[] = _("Prevents ability reduction.");
static const u8 gNaturalCureAbilityDescription[] = _("Heals upon switching out.");
static const u8 gLightningRodAbilityDescription[] = _("Draws electrical moves.");
static const u8 gSereneGraceAbilityDescription[] = _("Promotes added effects.");
static const u8 gSwiftSwimAbilityDescription[] = _("Raises SPEED in rain.");
static const u8 gChlorophyllAbilityDescription[] = _("Raises SPEED in sunshine.");
static const u8 gIlluminateAbilityDescription[] = _("Encounter rate increases.");
static const u8 gTraceAbilityDescription[] = _("Copies special ability.");
static const u8 gHugePowerAbilityDescription[] = _("Raises ATTACK.");
static const u8 gPoisonPointAbilityDescription[] = _("Poisons foe on contact.");
static const u8 gInnerFocusAbilityDescription[] = _("Prevents flinching.");
static const u8 gMagmaArmorAbilityDescription[] = _("Prevents freezing.");
static const u8 gWaterVeilAbilityDescription[] = _("Prevents burns.");
static const u8 gMagnetPullAbilityDescription[] = _("Traps STEEL-type POKéMON.");
static const u8 gSoundproofAbilityDescription[] = _("Avoids sound-based moves.");
static const u8 gRainDishAbilityDescription[] = _("Slight HP recovery in rain.");
static const u8 gSandStreamAbilityDescription[] = _("Summons a sandstorm.");
static const u8 gPressureAbilityDescription[] = _("Raises foes PP usage.");
static const u8 gThickFatAbilityDescription[] = _("Heat-and-cold protection.");
static const u8 gEarlyBirdAbilityDescription[] = _("Awakens quickly from sleep.");
static const u8 gFlameBodyAbilityDescription[] = _("Burns the foe on contact.");
static const u8 gRunAwayAbilityDescription[] = _("Makes escaping easier.");
static const u8 gKeenEyeAbilityDescription[] = _("Prevents loss of accuracy.");
static const u8 gHyperCutterAbilityDescription[] = _("Prevents ATTACK reduction.");
static const u8 gPickupAbilityDescription[] = _("May pick up items.");
static const u8 gTruantAbilityDescription[] = _("Moves only every two turns.");
static const u8 gHustleAbilityDescription[] = _("Trades accuracy for power.");
static const u8 gCuteCharmAbilityDescription[] = _("Infatuates on contact.");
static const u8 gPlusAbilityDescription[] = _("Powers up with MINUS.");
static const u8 gMinusAbilityDescription[] = _("Powers up with PLUS.");
static const u8 gForecastAbilityDescription[] = _("Changes with the weather.");
static const u8 gStickyHoldAbilityDescription[] = _("Prevents item theft.");
static const u8 gShedSkinAbilityDescription[] = _("Heals the body by shedding.");
static const u8 gGutsAbilityDescription[] = _("Ups ATTACK if suffering.");
static const u8 gMarvelScaleAbilityDescription[] = _("Ups DEFENSE if suffering.");
static const u8 gLiquidOozeAbilityDescription[] = _("Draining causes injury.");
static const u8 gOvergrowAbilityDescription[] = _("Ups GRASS moves in a pinch.");
static const u8 gBlazeAbilityDescription[] = _("Ups FIRE moves in a pinch.");
static const u8 gTorrentAbilityDescription[] = _("Ups WATER moves in a pinch.");
static const u8 gSwarmAbilityDescription[] = _("Ups BUG moves in a pinch.");
static const u8 gRockHeadAbilityDescription[] = _("Prevents recoil damage.");
static const u8 gDroughtAbilityDescription[] = _("Summons sunlight in battle.");
static const u8 gArenaTrapAbilityDescription[] = _("Prevents fleeing.");
static const u8 gVitalSpiritAbilityDescription[] = _("Prevents sleep.");
static const u8 gWhiteSmokeAbilityDescription[] = _("Prevents ability reduction.");
static const u8 gPurePowerAbilityDescription[] = _("Raises ATTACK.");
static const u8 gShellArmorAbilityDescription[] = _("Blocks critical hits.");
static const u8 gCacophonyAbilityDescription[] = _("Avoids sound-based moves.");
static const u8 gAirLockAbilityDescription[] = _("Negates weather effects.");
const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1] =
{
_("-------"),
_("STENCH"),
_("DRIZZLE"),
_("SPEED BOOST"),
_("BATTLE ARMOR"),
_("STURDY"),
_("DAMP"),
_("LIMBER"),
_("SAND VEIL"),
_("STATIC"),
_("VOLT ABSORB"),
_("WATER ABSORB"),
_("OBLIVIOUS"),
_("CLOUD NINE"),
_("COMPOUNDEYES"),
_("INSOMNIA"),
_("COLOR CHANGE"),
_("IMMUNITY"),
_("FLASH FIRE"),
_("SHIELD DUST"),
_("OWN TEMPO"),
_("SUCTION CUPS"),
_("INTIMIDATE"),
_("SHADOW TAG"),
_("ROUGH SKIN"),
_("WONDER GUARD"),
_("LEVITATE"),
_("EFFECT SPORE"),
_("SYNCHRONIZE"),
_("CLEAR BODY"),
_("NATURAL CURE"),
_("LIGHTNINGROD"),
_("SERENE GRACE"),
_("SWIFT SWIM"),
_("CHLOROPHYLL"),
_("ILLUMINATE"),
_("TRACE"),
_("HUGE POWER"),
_("POISON POINT"),
_("INNER FOCUS"),
_("MAGMA ARMOR"),
_("WATER VEIL"),
_("MAGNET PULL"),
_("SOUNDPROOF"),
_("RAIN DISH"),
_("SAND STREAM"),
_("PRESSURE"),
_("THICK FAT"),
_("EARLY BIRD"),
_("FLAME BODY"),
_("RUN AWAY"),
_("KEEN EYE"),
_("HYPER CUTTER"),
_("PICKUP"),
_("TRUANT"),
_("HUSTLE"),
_("CUTE CHARM"),
_("PLUS"),
_("MINUS"),
_("FORECAST"),
_("STICKY HOLD"),
_("SHED SKIN"),
_("GUTS"),
_("MARVEL SCALE"),
_("LIQUID OOZE"),
_("OVERGROW"),
_("BLAZE"),
_("TORRENT"),
_("SWARM"),
_("ROCK HEAD"),
_("DROUGHT"),
_("ARENA TRAP"),
_("VITAL SPIRIT"),
_("WHITE SMOKE"),
_("PURE POWER"),
_("SHELL ARMOR"),
_("CACOPHONY"),
_("AIR LOCK"),
};
const u8 *const gAbilityDescriptionPointers[] =
{
gNoneAbilityDescription,
gStenchAbilityDescription,
gDrizzleAbilityDescription,
gSpeedBoostAbilityDescription,
gBattleArmorAbilityDescription,
gSturdyAbilityDescription,
gDampAbilityDescription,
gLimberAbilityDescription,
gSandVeilAbilityDescription,
gStaticAbilityDescription,
gVoltAbsorbAbilityDescription,
gWaterAbsorbAbilityDescription,
gObliviousAbilityDescription,
gCloudNineAbilityDescription,
gCompoundEyesAbilityDescription,
gInsomniaAbilityDescription,
gColorChangeAbilityDescription,
gImmunityAbilityDescription,
gFlashFireAbilityDescription,
gShieldDustAbilityDescription,
gOwnTempoAbilityDescription,
gSuctionCupsAbilityDescription,
gIntimidateAbilityDescription,
gShadowTagAbilityDescription,
gRoughSkinAbilityDescription,
gWonderGuardAbilityDescription,
gLevitateAbilityDescription,
gEffectSporeAbilityDescription,
gSynchronizeAbilityDescription,
gClearBodyAbilityDescription,
gNaturalCureAbilityDescription,
gLightningRodAbilityDescription,
gSereneGraceAbilityDescription,
gSwiftSwimAbilityDescription,
gChlorophyllAbilityDescription,
gIlluminateAbilityDescription,
gTraceAbilityDescription,
gHugePowerAbilityDescription,
gPoisonPointAbilityDescription,
gInnerFocusAbilityDescription,
gMagmaArmorAbilityDescription,
gWaterVeilAbilityDescription,
gMagnetPullAbilityDescription,
gSoundproofAbilityDescription,
gRainDishAbilityDescription,
gSandStreamAbilityDescription,
gPressureAbilityDescription,
gThickFatAbilityDescription,
gEarlyBirdAbilityDescription,
gFlameBodyAbilityDescription,
gRunAwayAbilityDescription,
gKeenEyeAbilityDescription,
gHyperCutterAbilityDescription,
gPickupAbilityDescription,
gTruantAbilityDescription,
gHustleAbilityDescription,
gCuteCharmAbilityDescription,
gPlusAbilityDescription,
gMinusAbilityDescription,
gForecastAbilityDescription,
gStickyHoldAbilityDescription,
gShedSkinAbilityDescription,
gGutsAbilityDescription,
gMarvelScaleAbilityDescription,
gLiquidOozeAbilityDescription,
gOvergrowAbilityDescription,
gBlazeAbilityDescription,
gTorrentAbilityDescription,
gSwarmAbilityDescription,
gRockHeadAbilityDescription,
gDroughtAbilityDescription,
gArenaTrapAbilityDescription,
gVitalSpiritAbilityDescription,
gWhiteSmokeAbilityDescription,
gPurePowerAbilityDescription,
gShellArmorAbilityDescription,
gCacophonyAbilityDescription,
gAirLockAbilityDescription,
};
#endif // POKEEMERALD_DATA_TEXT_ABILITIES_H

View File

@ -14,8 +14,6 @@ extern struct MonCoords gTrainerFrontPicCoords[];
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
extern const u8 gMoveNames[][13];
extern const u8 gAbilityNames[][13];
extern const u8 gTypeNames[][7];
extern struct CompressedSpriteSheet gUnknown_0831C620;
extern struct CompressedSpritePalette gUnknown_0831C628;
extern const struct SpriteTemplate gUnknown_0831C688;

View File

@ -22,6 +22,7 @@ extern const u8 EventScript_2713D1[];
extern const u8 EventScript_2766A2[];
extern const u8 EventScript_2766A6[];
extern const u8 gTVBravoTrainerText00[];
extern const u8 gTVBravoTrainerText01[];
extern const u8 gTVBravoTrainerText02[];
@ -381,6 +382,9 @@ extern const u8 SecretBase_RedCave1_Text_2751E1[];
extern const u8 SecretBase_RedCave1_Text_2754F6[];
extern const u8 SecretBase_RedCave1_Text_2758CC[];
//field effects
extern const u8 FieryPath_EventScript_2908FD[];
extern const u8 EventScript_290CAE[];
extern const u8 EventScript_2926F8[];
#endif //GUARD_EVENT_SCRIPTS_H

View File

@ -1,7 +0,0 @@
#ifndef GUARD_FLDEFF_GROUNDSHAKE_H
#define GUARD_FLDEFF_GROUNDSHAKE_H
void sub_81BE6B8(void);
void sub_81BE72C(void);
#endif // GUARD_FLDEFF_GROUNDSHAKE_H

View File

@ -188,11 +188,11 @@ typedef union // size = 0x24
struct {
/*0x00*/ u8 kind;
/*0x01*/ bool8 active;
/*0x02*/ u16 species;
/*0x02*/ u16 speciesOpponent;
/*0x04*/ u8 playerName[8];
/*0x0C*/ u8 linkOpponentName[8];
/*0x14*/ u16 move;
/*0x16*/ u16 species2;
/*0x16*/ u16 speciesPlayer;
/*0x18*/ u8 battleType;
/*0x19*/ u8 language;
/*0x1A*/ u8 linkOpponentLanguage;

View File

@ -0,0 +1,87 @@
#ifndef GUARD_TRAINER_REMATCH_H
#define GUARD_TRAINER_REMATCH_H
enum {
REMATCH_ROSE,
REMATCH_ANDRES,
REMATCH_DUSTY,
REMATCH_LOLA,
REMATCH_RICKY,
REMATCH_LILA_AND_ROY,
REMATCH_CRISTIN,
REMATCH_BROOKE,
REMATCH_WILTON,
REMATCH_VALERIE,
REMATCH_CINDY,
REMATCH_THALIA,
REMATCH_JESSICA,
REMATCH_WINSTON,
REMATCH_STEVE,
REMATCH_TONY,
REMATCH_NOB,
REMATCH_KOJI,
REMATCH_FERNANDO,
REMATCH_DALTON,
REMATCH_BERNIE,
REMATCH_ETHAN,
REMATCH_JOHN_AND_JAY,
REMATCH_JEFFREY,
REMATCH_CAMERON,
REMATCH_JACKI,
REMATCH_WALTER,
REMATCH_KAREN,
REMATCH_JERRY,
REMATCH_ANNA_AND_MEG,
REMATCH_ISABEL,
REMATCH_MIGUEL,
REMATCH_TIMOTHY,
REMATCH_SHELBY,
REMATCH_CALVIN,
REMATCH_ELLIOT,
REMATCH_ISAIAH,
REMATCH_MARIA,
REMATCH_ABIGAIL,
REMATCH_DYLAN,
REMATCH_KATELYN,
REMATCH_BENJAMIN,
REMATCH_PABLO,
REMATCH_NICOLAS,
REMATCH_ROBERT,
REMATCH_LAO,
REMATCH_CYNDY,
REMATCH_MADELINE,
REMATCH_JENNY,
REMATCH_DIANA,
REMATCH_AMY_AND_LIV,
REMATCH_ERNEST,
REMATCH_CORY,
REMATCH_EDWIN,
REMATCH_LYDIA,
REMATCH_ISAAC,
REMATCH_GABRIELLE,
REMATCH_CATHERINE,
REMATCH_JACKSON,
REMATCH_HALEY,
REMATCH_JAMES,
REMATCH_TRENT,
REMATCH_SAWYER,
REMATCH_KIRA_AND_DAN,
REMATCH_WALLY_3,
REMATCH_ROXANNE,
REMATCH_BRAWLY,
REMATCH_WATTSON,
REMATCH_FLANNERY,
REMATCH_NORMAN,
REMATCH_WINONA,
REMATCH_TATE_AND_LIZA,
REMATCH_JUAN,
REMATCH_SIDNEY,
REMATCH_PHOEBE,
REMATCH_GLACIA,
REMATCH_DRAKE,
REMATCH_WALLACE
};
void UpdateGymLeaderRematch(void);
#endif //GUARD_TRAINER_REMATCH_H

View File

@ -468,6 +468,7 @@ extern struct Pokemon gEnemyParty[PARTY_SIZE];
extern struct SpriteTemplate gUnknown_0202499C;
extern struct PokemonStorage* gPokemonStoragePtr;
extern const struct BattleMove gBattleMoves[];
extern const u8 gFacilityClassToPicIndex[];
extern const u8 gFacilityClassToTrainerClass[];
extern const struct BaseStats gBaseStats[];

17
include/roulette_util.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef GUARD_ROULETTE_UTIL_H
#define GUARD_ROULETTE_UTIL_H
// structures
struct InnerStruct203CF18
{
u8 filler[0xC4];
};
void sub_8151B68(struct InnerStruct203CF18 *, const u8*);
void sub_8151B3C(struct InnerStruct203CF18 *);
void sub_8151CA8(struct InnerStruct203CF18 *, u8, u8);
void sub_8151C50(struct InnerStruct203CF18 *, u8, u8);
void sub_8151D28(struct InnerStruct203CF18 *, u8, u8);
void sub_8151E50(struct InnerStruct203CF18 *);
#endif // GUARD_ROULETTE_UTIL_H

View File

@ -4,17 +4,46 @@
extern u8 *const gTVStringVarPtrs[3];
void ClearTVShowData(void);
void PutPokemonTodayCaughtOnAir(void);
void sub_80EE184(void);
void sub_80EE35C(u16 foeSpecies, u16 species, u8 moveIdx, const u16 *movePtr, u16 betterMove);
void sub_80EE8C8(u16 winStreak, u8 facility);
void DoTVShow(void);
void DoTVShowInSearchOfTrainers(void);
void sub_80EDCE8(void);
void sub_80EE2CC(void);
void sub_80EE72C(void);
void sub_80EED10(void);
void sub_80EED34(void);
void sub_80EED60(u16 delta);
void sub_80F01B8(void);
void sub_80F01E8(void *src, u32 size, u8 masterIdx);
void sub_80EE4DC(struct Pokemon *pokemon, u8 ribbonMonDataIdx);
u32 GetPlayerIDAsU32(void);
bool8 GetPriceReduction(u8 newsKind);
u8 GetRibbonCount(struct Pokemon *pokemon);
void TV_PutSecretBaseVisitOnTheAir(void);
void sub_80EE184(void);
void sub_80EEA70(void);
void sub_80F14F8(TVShow *shows);
size_t sub_80EF370(int value);
bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language);
size_t CountDigits(int value);
u8 GetRibbonCount(struct Pokemon *pokemon);
void sub_80EDE70(u16 nCoinsSpent);
void sub_80EDE84(u16 nCoinsSpent);
void sub_80EDD78(u16 nCoinsPaidOut);
void sub_80EEA70(void);
void sub_80EDB44(void);
void sub_80EDC60(const u16 *words);
void sub_80EDA80(void);
void sub_80F0C7C(void *src, u32 size, u8 masterIdx);
void sub_80F0BB8(void);
void sub_80ED950(bool8 flag);
void sub_80EEC80(void);
void sub_80EECA4(void);
void sub_80EECC8(void);
void sub_80EECEC(void);
void sub_80F1208(TVShow *shows);
void sub_80EE44C(u8 nMonsCaught, u8 nPkblkUsed);
void SetPokemonAnglerSpecies(u16 species);
void UpdateTVShowsPerDay(u16 days);
void PutPokemonTodayCaughtOnAir(void);
void TV_PutSecretBaseVisitOnTheAir(void);
bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language);
void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlayer, u16 speciesOpponent);
#endif //GUARD_TV_H

View File

@ -47,7 +47,7 @@ SECTIONS {
src/dma3_manager.o(.text);
src/gpu_regs.o(.text);
src/bg.o(.text);
asm/blit.o(.text);
src/blit.o(.text);
src/window.o(.text);
src/text.o(.text);
src/sprite.o(.text);
@ -180,7 +180,7 @@ SECTIONS {
src/wallclock.o(.text);
asm/rom6.o(.text);
src/pokeblock.o(.text);
asm/fldeff_flash.o(.text);
src/fldeff_flash.o(.text);
asm/post_battle_event_funcs.o(.text);
src/time_events.o(.text);
src/birch_pc.o(.text);
@ -236,7 +236,7 @@ SECTIONS {
src/evolution_graphics.o(.text);
src/bard_music.o(.text);
src/fldeff_teleport.o(.text);
asm/battle_link_817C95C.o(.text);
src/battle_tv.o(.text);
src/pokemon_animation.o(.text);
src/recorded_battle.o(.text);
src/battle_controller_recorded_opponent.o(.text);
@ -258,7 +258,8 @@ SECTIONS {
src/multiboot.o(.text);
src/unk_81BAD84.o(.text);
src/battle_controller_player_partner.o(.text);
asm/fldeff_groundshake.o(.text);
src/fldeff_groundshake.o(.text);
src/fossil_specials.o(.text);
asm/fossil_specials.o(.text);
src/berry_fix_program.o(.text);
src/pokemon_summary_screen.o(.text);
@ -270,7 +271,7 @@ SECTIONS {
src/rayquaza_scene.o(.text);
src/walda_phrase.o(.text);
asm/contest_link_81D9DE4.o(.text);
asm/trainer_rematch.o(.text);
src/gym_leader_rematch.o(.text);
src/unk_transition.o(.text);
src/international_string_util.o(.text);
asm/international_string_util.o(.text);
@ -384,7 +385,6 @@ SECTIONS {
data/smokescreen.o(.rodata);
src/battle_controller_opponent.o(.rodata);
src/battle_controller_link_opponent.o(.rodata);
data/data2c.o(.rodata);
src/pokemon.o(.rodata);
src/trig.o(.rodata);
src/util.o(.rodata);
@ -472,7 +472,7 @@ SECTIONS {
data/starter_choose.o(.rodata);
src/wallclock.o(.rodata);
src/pokeblock.o(.rodata);
data/fldeff_flash.o(.rodata);
src/fldeff_flash.o(.rodata);
src/time_events.o(.rodata);
data/field_specials.o(.rodata);
data/battle_records.o(.rodata);
@ -514,7 +514,7 @@ SECTIONS {
src/intro_credits_graphics.o(.rodata);
src/evolution_graphics.o(.rodata);
src/bard_music.o(.rodata);
data/battle_link_817C95C.o(.rodata);
src/battle_tv.o(.rodata);
src/pokemon_animation.o(.rodata);
src/battle_controller_recorded_opponent.o(.rodata);
src/battle_controller_recorded_player.o(.rodata);
@ -533,7 +533,8 @@ SECTIONS {
src/unk_text_util_2.o(.rodata);
src/unk_81BAD84.o(.rodata);
src/battle_controller_player_partner.o(.rodata);
data/fossil_special_fldeff_groundshake.o(.rodata);
src/fossil_specials.o(.rodata);
src/fldeff_groundshake.o(.rodata);
src/berry_fix_program.o(.rodata);
data/pokemon_summary_screen.o(.rodata);
data/pokenav.o(.rodata);
@ -541,7 +542,7 @@ SECTIONS {
data/pokenav.o(.rodata.after.match.call);
src/rayquaza_scene.o(.rodata);
src/walda_phrase.o(.rodata);
data/trainer_rematch.o(.rodata);
src/gym_leader_rematch.o(.rodata);
data/unk_transition.o(.rodata);
src/unk_transition.o(.rodata);
data/text_input_strings.o(.rodata);

View File

@ -45,7 +45,6 @@ in order to read the next command correctly. refer to battle_ai_scripts.s for th
AI scripts.
*/
extern const struct BattleMove gBattleMoves[];
extern const u8 * const gBattleAI_ScriptsTable[];
extern u32 GetAiScriptsInRecordedBattle();
@ -346,7 +345,7 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves)
}
gBattleResources->AI_ScriptsStack->size = 0;
sBattler_AI = gActiveBattler;
// decide a random target bank in doubles
// decide a random target battlerId in doubles
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
gBattlerTarget = (Random() & BIT_FLANK) + (GetBattlerSide(gActiveBattler) ^ BIT_SIDE);
@ -620,32 +619,32 @@ static void RecordLastUsedMoveByTarget(void)
}
}
void ClearBattlerMoveHistory(u8 bank)
void ClearBattlerMoveHistory(u8 battlerId)
{
s32 i;
for (i = 0; i < 4; i++)
gBattleResources->battleHistory->usedMoves[bank].moves[i] = 0;
gBattleResources->battleHistory->usedMoves[battlerId].moves[i] = 0;
}
void RecordAbilityBattle(u8 bank, u8 abilityId)
void RecordAbilityBattle(u8 battlerId, u8 abilityId)
{
gBattleResources->battleHistory->abilities[bank] = abilityId;
gBattleResources->battleHistory->abilities[battlerId] = abilityId;
}
void ClearBattlerAbilityHistory(u8 bank)
void ClearBattlerAbilityHistory(u8 battlerId)
{
gBattleResources->battleHistory->abilities[bank] = 0;
gBattleResources->battleHistory->abilities[battlerId] = 0;
}
void RecordItemEffectBattle(u8 bank, u8 itemEffect)
void RecordItemEffectBattle(u8 battlerId, u8 itemEffect)
{
gBattleResources->battleHistory->itemEffects[bank] = itemEffect;
gBattleResources->battleHistory->itemEffects[battlerId] = itemEffect;
}
void ClearBankItemEffectHistory(u8 bank)
void ClearBankItemEffectHistory(u8 battlerId)
{
gBattleResources->battleHistory->itemEffects[bank] = 0;
gBattleResources->battleHistory->itemEffects[battlerId] = 0;
}
static void BattleAICmd_if_random_less_than(void)
@ -700,14 +699,14 @@ static void BattleAICmd_score(void)
static void BattleAICmd_if_hp_less_than(void)
{
u16 bank;
u16 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) < gAIScriptPtr[2])
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) < gAIScriptPtr[2])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
else
gAIScriptPtr += 7;
@ -715,14 +714,14 @@ static void BattleAICmd_if_hp_less_than(void)
static void BattleAICmd_if_hp_more_than(void)
{
u16 bank;
u16 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) > gAIScriptPtr[2])
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) > gAIScriptPtr[2])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
else
gAIScriptPtr += 7;
@ -730,14 +729,14 @@ static void BattleAICmd_if_hp_more_than(void)
static void BattleAICmd_if_hp_equal(void)
{
u16 bank;
u16 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) == gAIScriptPtr[2])
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) == gAIScriptPtr[2])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
else
gAIScriptPtr += 7;
@ -745,14 +744,14 @@ static void BattleAICmd_if_hp_equal(void)
static void BattleAICmd_if_hp_not_equal(void)
{
u16 bank;
u16 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) != gAIScriptPtr[2])
if ((u32)(100 * gBattleMons[battlerId].hp / gBattleMons[battlerId].maxHP) != gAIScriptPtr[2])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
else
gAIScriptPtr += 7;
@ -760,17 +759,17 @@ static void BattleAICmd_if_hp_not_equal(void)
static void BattleAICmd_if_status(void)
{
u16 bank;
u16 battlerId;
u32 status;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
status = AIScriptRead32(gAIScriptPtr + 2);
if ((gBattleMons[bank].status1 & status) != 0)
if ((gBattleMons[battlerId].status1 & status) != 0)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
else
gAIScriptPtr += 10;
@ -778,17 +777,17 @@ static void BattleAICmd_if_status(void)
static void BattleAICmd_if_not_status(void)
{
u16 bank;
u16 battlerId;
u32 status;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
status = AIScriptRead32(gAIScriptPtr + 2);
if ((gBattleMons[bank].status1 & status) == 0)
if ((gBattleMons[battlerId].status1 & status) == 0)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
else
gAIScriptPtr += 10;
@ -796,17 +795,17 @@ static void BattleAICmd_if_not_status(void)
static void BattleAICmd_if_status2(void)
{
u16 bank;
u16 battlerId;
u32 status;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
status = AIScriptRead32(gAIScriptPtr + 2);
if ((gBattleMons[bank].status2 & status) != 0)
if ((gBattleMons[battlerId].status2 & status) != 0)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
else
gAIScriptPtr += 10;
@ -814,17 +813,17 @@ static void BattleAICmd_if_status2(void)
static void BattleAICmd_if_not_status2(void)
{
u16 bank;
u16 battlerId;
u32 status;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
status = AIScriptRead32(gAIScriptPtr + 2);
if ((gBattleMons[bank].status2 & status) == 0)
if ((gBattleMons[battlerId].status2 & status) == 0)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
else
gAIScriptPtr += 10;
@ -832,17 +831,17 @@ static void BattleAICmd_if_not_status2(void)
static void BattleAICmd_if_status3(void)
{
u16 bank;
u16 battlerId;
u32 status;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
status = AIScriptRead32(gAIScriptPtr + 2);
if ((gStatuses3[bank] & status) != 0)
if ((gStatuses3[battlerId] & status) != 0)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
else
gAIScriptPtr += 10;
@ -850,17 +849,17 @@ static void BattleAICmd_if_status3(void)
static void BattleAICmd_if_not_status3(void)
{
u16 bank;
u16 battlerId;
u32 status;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
status = AIScriptRead32(gAIScriptPtr + 2);
if ((gStatuses3[bank] & status) == 0)
if ((gStatuses3[battlerId] & status) == 0)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 6);
else
gAIScriptPtr += 10;
@ -868,15 +867,15 @@ static void BattleAICmd_if_not_status3(void)
static void BattleAICmd_if_side_affecting(void)
{
u16 bank;
u16 battlerId;
u32 side, status;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
side = GET_BATTLER_SIDE(bank);
side = GET_BATTLER_SIDE(battlerId);
status = AIScriptRead32(gAIScriptPtr + 2);
if ((gSideStatuses[side] & status) != 0)
@ -887,15 +886,15 @@ static void BattleAICmd_if_side_affecting(void)
static void BattleAICmd_if_not_side_affecting(void)
{
u16 bank;
u16 battlerId;
u32 side, status;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
side = GET_BATTLER_SIDE(bank);
side = GET_BATTLER_SIDE(battlerId);
status = AIScriptRead32(gAIScriptPtr + 2);
if ((gSideStatuses[side] & status) == 0)
@ -1123,9 +1122,9 @@ static void BattleAICmd_get_type(void)
gAIScriptPtr += 2;
}
static u8 BattleAI_GetWantedBank(u8 bank)
static u8 BattleAI_GetWantedBank(u8 battlerId)
{
switch (bank)
switch (battlerId)
{
case AI_USER:
return sBattler_AI;
@ -1141,9 +1140,9 @@ static u8 BattleAI_GetWantedBank(u8 bank)
static void BattleAICmd_is_of_type(void)
{
u8 bank = BattleAI_GetWantedBank(gAIScriptPtr[1]);
u8 battlerId = BattleAI_GetWantedBank(gAIScriptPtr[1]);
if(gBattleMons[bank].type1 == gAIScriptPtr[2] || gBattleMons[bank].type2 == gAIScriptPtr[2])
if(gBattleMons[battlerId].type1 == gAIScriptPtr[2] || gBattleMons[battlerId].type2 == gAIScriptPtr[2])
{
AI_THINKING_STRUCT->funcResult = TRUE;
}
@ -1277,7 +1276,7 @@ static void BattleAICmd_nullsub_2B(void)
static void BattleAICmd_count_usable_party_mons(void)
{
u8 bank;
u8 battlerId;
u8 bankOnField1, bankOnField2;
struct Pokemon *party;
int i;
@ -1285,11 +1284,11 @@ static void BattleAICmd_count_usable_party_mons(void)
AI_THINKING_STRUCT->funcResult = 0;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
@ -1297,14 +1296,14 @@ static void BattleAICmd_count_usable_party_mons(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
u32 position;
bankOnField1 = gBattlerPartyIndexes[bank];
position = GetBattlerPosition(bank) ^ BIT_FLANK;
bankOnField1 = gBattlerPartyIndexes[battlerId];
position = GetBattlerPosition(battlerId) ^ BIT_FLANK;
bankOnField2 = gBattlerPartyIndexes[GetBattlerAtPosition(position)];
}
else // in singles there's only one bank by side
else // in singles there's only one battlerId by side
{
bankOnField1 = gBattlerPartyIndexes[bank];
bankOnField2 = gBattlerPartyIndexes[bank];
bankOnField1 = gBattlerPartyIndexes[battlerId];
bankOnField2 = gBattlerPartyIndexes[battlerId];
}
for (i = 0; i < PARTY_SIZE; i++)
@ -1335,110 +1334,110 @@ static void BattleAICmd_get_considered_move_effect(void)
static void BattleAICmd_get_ability(void)
{
u8 bank;
u8 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if (gActiveBattler != bank)
if (gActiveBattler != battlerId)
{
if (BATTLE_HISTORY->abilities[bank] != 0)
if (BATTLE_HISTORY->abilities[battlerId] != 0)
{
AI_THINKING_STRUCT->funcResult = BATTLE_HISTORY->abilities[bank];
AI_THINKING_STRUCT->funcResult = BATTLE_HISTORY->abilities[battlerId];
gAIScriptPtr += 2;
return;
}
// abilities that prevent fleeing.
if (gBattleMons[bank].ability == ABILITY_SHADOW_TAG
|| gBattleMons[bank].ability == ABILITY_MAGNET_PULL
|| gBattleMons[bank].ability == ABILITY_ARENA_TRAP)
if (gBattleMons[battlerId].ability == ABILITY_SHADOW_TAG
|| gBattleMons[battlerId].ability == ABILITY_MAGNET_PULL
|| gBattleMons[battlerId].ability == ABILITY_ARENA_TRAP)
{
AI_THINKING_STRUCT->funcResult = gBattleMons[bank].ability;
AI_THINKING_STRUCT->funcResult = gBattleMons[battlerId].ability;
gAIScriptPtr += 2;
return;
}
if (gBaseStats[gBattleMons[bank].species].ability1 != ABILITY_NONE)
if (gBaseStats[gBattleMons[battlerId].species].ability1 != ABILITY_NONE)
{
if (gBaseStats[gBattleMons[bank].species].ability2 != ABILITY_NONE)
if (gBaseStats[gBattleMons[battlerId].species].ability2 != ABILITY_NONE)
{
// AI has no knowledge of opponent, so it guesses which ability.
if (Random() & 1)
{
AI_THINKING_STRUCT->funcResult = gBaseStats[gBattleMons[bank].species].ability1;
AI_THINKING_STRUCT->funcResult = gBaseStats[gBattleMons[battlerId].species].ability1;
}
else
{
AI_THINKING_STRUCT->funcResult = gBaseStats[gBattleMons[bank].species].ability2;
AI_THINKING_STRUCT->funcResult = gBaseStats[gBattleMons[battlerId].species].ability2;
}
}
else
{
AI_THINKING_STRUCT->funcResult = gBaseStats[gBattleMons[bank].species].ability1; // it's definitely ability 1.
AI_THINKING_STRUCT->funcResult = gBaseStats[gBattleMons[battlerId].species].ability1; // it's definitely ability 1.
}
}
else
{
AI_THINKING_STRUCT->funcResult = gBaseStats[gBattleMons[bank].species].ability2; // AI cant actually reach this part since every mon has at least 1 ability.
AI_THINKING_STRUCT->funcResult = gBaseStats[gBattleMons[battlerId].species].ability2; // AI cant actually reach this part since every mon has at least 1 ability.
}
}
else
{
// The AI knows its own ability.
AI_THINKING_STRUCT->funcResult = gBattleMons[bank].ability;
AI_THINKING_STRUCT->funcResult = gBattleMons[battlerId].ability;
}
gAIScriptPtr += 2;
}
static void BattleAICmd_check_ability(void)
{
u32 bank = BattleAI_GetWantedBank(gAIScriptPtr[1]);
u32 battlerId = BattleAI_GetWantedBank(gAIScriptPtr[1]);
u32 ability = gAIScriptPtr[2];
if (gAIScriptPtr[1] == AI_TARGET || gAIScriptPtr[1] == AI_TARGET_PARTNER)
{
if (BATTLE_HISTORY->abilities[bank] != 0)
if (BATTLE_HISTORY->abilities[battlerId] != 0)
{
ability = BATTLE_HISTORY->abilities[bank];
ability = BATTLE_HISTORY->abilities[battlerId];
AI_THINKING_STRUCT->funcResult = ability;
}
// abilities that prevent fleeing.
else if (gBattleMons[bank].ability == ABILITY_SHADOW_TAG
|| gBattleMons[bank].ability == ABILITY_MAGNET_PULL
|| gBattleMons[bank].ability == ABILITY_ARENA_TRAP)
else if (gBattleMons[battlerId].ability == ABILITY_SHADOW_TAG
|| gBattleMons[battlerId].ability == ABILITY_MAGNET_PULL
|| gBattleMons[battlerId].ability == ABILITY_ARENA_TRAP)
{
ability = gBattleMons[bank].ability;
ability = gBattleMons[battlerId].ability;
}
else if (gBaseStats[gBattleMons[bank].species].ability1 != ABILITY_NONE)
else if (gBaseStats[gBattleMons[battlerId].species].ability1 != ABILITY_NONE)
{
if (gBaseStats[gBattleMons[bank].species].ability2 != ABILITY_NONE)
if (gBaseStats[gBattleMons[battlerId].species].ability2 != ABILITY_NONE)
{
u8 abilityDummyVariable = ability; // needed to match
if (gBaseStats[gBattleMons[bank].species].ability1 != abilityDummyVariable
&& gBaseStats[gBattleMons[bank].species].ability2 != abilityDummyVariable)
if (gBaseStats[gBattleMons[battlerId].species].ability1 != abilityDummyVariable
&& gBaseStats[gBattleMons[battlerId].species].ability2 != abilityDummyVariable)
{
ability = gBaseStats[gBattleMons[bank].species].ability1;
ability = gBaseStats[gBattleMons[battlerId].species].ability1;
}
else
ability = 0;
}
else
{
ability = gBaseStats[gBattleMons[bank].species].ability1;
ability = gBaseStats[gBattleMons[battlerId].species].ability1;
}
}
else
{
ability = gBaseStats[gBattleMons[bank].species].ability2; // AI cant actually reach this part since every mon has at least 1 ability.
ability = gBaseStats[gBattleMons[battlerId].species].ability2; // AI cant actually reach this part since every mon has at least 1 ability.
}
}
else
{
// The AI knows its own or partner's ability.
ability = gBattleMons[bank].ability;
ability = gBattleMons[battlerId].ability;
}
if (ability == 0)
{
@ -1546,19 +1545,19 @@ static void BattleAICmd_if_status_in_party(void)
struct Pokemon *party;
int i;
u32 statusToCompareTo;
u8 bank;
u8 battlerId;
switch(gAIScriptPtr[1])
{
case AI_USER:
bank = sBattler_AI;
battlerId = sBattler_AI;
break;
default:
bank = gBattlerTarget;
battlerId = gBattlerTarget;
break;
}
party = (GetBattlerSide(bank) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
party = (GetBattlerSide(battlerId) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
statusToCompareTo = AIScriptRead32(gAIScriptPtr + 2);
@ -1583,19 +1582,19 @@ static void BattleAICmd_if_status_not_in_party(void)
struct Pokemon *party;
int i;
u32 statusToCompareTo;
u8 bank;
u8 battlerId;
switch(gAIScriptPtr[1])
{
case 1:
bank = sBattler_AI;
battlerId = sBattler_AI;
break;
default:
bank = gBattlerTarget;
battlerId = gBattlerTarget;
break;
}
party = (GetBattlerSide(bank) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
party = (GetBattlerSide(battlerId) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
statusToCompareTo = AIScriptRead32(gAIScriptPtr + 2);
@ -1646,14 +1645,14 @@ static void BattleAICmd_if_not_effect(void)
static void BattleAICmd_if_stat_level_less_than(void)
{
u32 bank;
u32 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] < gAIScriptPtr[3])
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] < gAIScriptPtr[3])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
else
gAIScriptPtr += 8;
@ -1661,14 +1660,14 @@ static void BattleAICmd_if_stat_level_less_than(void)
static void BattleAICmd_if_stat_level_more_than(void)
{
u32 bank;
u32 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] > gAIScriptPtr[3])
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] > gAIScriptPtr[3])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
else
gAIScriptPtr += 8;
@ -1676,14 +1675,14 @@ static void BattleAICmd_if_stat_level_more_than(void)
static void BattleAICmd_if_stat_level_equal(void)
{
u32 bank;
u32 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] == gAIScriptPtr[3])
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] == gAIScriptPtr[3])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
else
gAIScriptPtr += 8;
@ -1691,14 +1690,14 @@ static void BattleAICmd_if_stat_level_equal(void)
static void BattleAICmd_if_stat_level_not_equal(void)
{
u32 bank;
u32 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] != gAIScriptPtr[3])
if (gBattleMons[battlerId].statStages[gAIScriptPtr[2]] != gAIScriptPtr[3])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
else
gAIScriptPtr += 8;
@ -1940,16 +1939,16 @@ static void BattleAICmd_if_doesnt_have_move_with_effect(void)
static void BattleAICmd_if_any_move_disabled_or_encored(void)
{
u8 bank;
u8 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if (gAIScriptPtr[2] == 0)
{
if (gDisableStructs[bank].disabledMove == 0)
if (gDisableStructs[battlerId].disabledMove == 0)
{
gAIScriptPtr += 7;
return;
@ -1962,7 +1961,7 @@ static void BattleAICmd_if_any_move_disabled_or_encored(void)
gAIScriptPtr += 7;
return;
}
else if (gDisableStructs[bank].encoredMove != 0)
else if (gDisableStructs[battlerId].encoredMove != 0)
{
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
return;
@ -2018,31 +2017,31 @@ static void BattleAICmd_watch(void)
static void BattleAICmd_get_hold_effect(void)
{
u8 bank;
u8 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
if (gActiveBattler != bank)
AI_THINKING_STRUCT->funcResult = ItemId_GetHoldEffect(BATTLE_HISTORY->itemEffects[bank]);
if (gActiveBattler != battlerId)
AI_THINKING_STRUCT->funcResult = ItemId_GetHoldEffect(BATTLE_HISTORY->itemEffects[battlerId]);
else
AI_THINKING_STRUCT->funcResult = ItemId_GetHoldEffect(gBattleMons[bank].item);
AI_THINKING_STRUCT->funcResult = ItemId_GetHoldEffect(gBattleMons[battlerId].item);
gAIScriptPtr += 2;
}
static void BattleAICmd_if_holds_item(void)
{
u8 bank = BattleAI_GetWantedBank(gAIScriptPtr[1]);
u8 battlerId = BattleAI_GetWantedBank(gAIScriptPtr[1]);
u16 item;
u8 var1, var2;
if ((bank & BIT_SIDE) == (sBattler_AI & BIT_SIDE))
item = gBattleMons[bank].item;
if ((battlerId & BIT_SIDE) == (sBattler_AI & BIT_SIDE))
item = gBattleMons[battlerId].item;
else
item = BATTLE_HISTORY->itemEffects[bank];
item = BATTLE_HISTORY->itemEffects[battlerId];
// UB: doesn't properly read an unaligned u16
var2 = gAIScriptPtr[2];
@ -2056,42 +2055,42 @@ static void BattleAICmd_if_holds_item(void)
static void BattleAICmd_get_gender(void)
{
u8 bank;
u8 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
AI_THINKING_STRUCT->funcResult = GetGenderFromSpeciesAndPersonality(gBattleMons[bank].species, gBattleMons[bank].personality);
AI_THINKING_STRUCT->funcResult = GetGenderFromSpeciesAndPersonality(gBattleMons[battlerId].species, gBattleMons[battlerId].personality);
gAIScriptPtr += 2;
}
static void BattleAICmd_is_first_turn_for(void)
{
u8 bank;
u8 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].isFirstTurn;
AI_THINKING_STRUCT->funcResult = gDisableStructs[battlerId].isFirstTurn;
gAIScriptPtr += 2;
}
static void BattleAICmd_get_stockpile_count(void)
{
u8 bank;
u8 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].stockpileCounter;
AI_THINKING_STRUCT->funcResult = gDisableStructs[battlerId].stockpileCounter;
gAIScriptPtr += 2;
}
@ -2105,18 +2104,18 @@ static void BattleAICmd_is_double_battle(void)
static void BattleAICmd_get_used_held_item(void)
{
u8 bank;
u8 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
// This is likely a leftover from Ruby's code and its ugly ewram access
#ifdef NONMATCHING
AI_THINKING_STRUCT->funcResult = gBattleStruct->usedHeldItems[bank];
AI_THINKING_STRUCT->funcResult = gBattleStruct->usedHeldItems[battlerId];
#else
AI_THINKING_STRUCT->funcResult = *(u8*)((u8*)(gBattleStruct) + offsetof(struct BattleStruct, usedHeldItems) + (bank * 2));
AI_THINKING_STRUCT->funcResult = *(u8*)((u8*)(gBattleStruct) + offsetof(struct BattleStruct, usedHeldItems) + (battlerId * 2));
#endif // NONMATCHING
gAIScriptPtr += 2;
@ -2145,14 +2144,14 @@ static void BattleAICmd_get_move_effect_from_result(void)
static void BattleAICmd_get_protect_count(void)
{
u8 bank;
u8 battlerId;
if (gAIScriptPtr[1] == AI_USER)
bank = sBattler_AI;
battlerId = sBattler_AI;
else
bank = gBattlerTarget;
battlerId = gBattlerTarget;
AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].protectUses;
AI_THINKING_STRUCT->funcResult = gDisableStructs[battlerId].protectUses;
gAIScriptPtr += 2;
}
@ -2255,9 +2254,9 @@ static void BattleAICmd_if_target_is_ally(void)
static void BattleAICmd_if_flash_fired(void)
{
u8 bank = BattleAI_GetWantedBank(gAIScriptPtr[1]);
u8 battlerId = BattleAI_GetWantedBank(gAIScriptPtr[1]);
if (gBattleResources->flags->flags[bank] & UNKNOWN_FLAG_FLASH_FIRE)
if (gBattleResources->flags->flags[battlerId] & UNKNOWN_FLAG_FLASH_FIRE)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
else
gAIScriptPtr += 6;

View File

@ -9,8 +9,6 @@
#include "util.h"
#include "constants/items.h"
extern const struct BattleMove gBattleMoves[];
extern const u8 gTypeEffectiveness[];
extern const u8 * const gItemEffectTable[]; // todo: fix once struct is declared
// this file's functions

View File

@ -6,7 +6,7 @@
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "battle_ai_script_commands.h"
#include "battle_link_817C95C.h"
#include "battle_tv.h"
#include "pokemon.h"
#include "link.h"
#include "util.h"
@ -32,7 +32,6 @@ extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct BattleMove gBattleMoves[];
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
@ -1414,7 +1413,7 @@ static void LinkOpponentHandleMoveAnimation(void)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = LinkOpponentDoMoveAnimation;
sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr);
BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
}
}
}
@ -1478,7 +1477,7 @@ static void LinkOpponentHandlePrintString(void)
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
sub_817C95C(*stringId);
BattleTv_SetDataBasedOnString(*stringId);
}
static void LinkOpponentHandlePrintSelectionString(void)
@ -1831,7 +1830,7 @@ static void LinkOpponentHandleBattleAnimation(void)
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
sub_817E32C(animationId);
BattleTv_SetDataBasedOnAnimation(animationId);
}
}

View File

@ -6,7 +6,7 @@
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "battle_ai_script_commands.h"
#include "battle_link_817C95C.h"
#include "battle_tv.h"
#include "pokemon.h"
#include "link.h"
#include "util.h"
@ -31,7 +31,6 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern const struct BattleMove gBattleMoves[];
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
@ -1238,7 +1237,7 @@ static void LinkPartnerHandleMoveAnimation(void)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = LinkPartnerDoMoveAnimation;
sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr);
BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
}
}
}
@ -1302,7 +1301,7 @@ static void LinkPartnerHandlePrintString(void)
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
sub_817C95C(*stringId);
BattleTv_SetDataBasedOnString(*stringId);
}
static void LinkPartnerHandlePrintSelectionString(void)
@ -1666,7 +1665,7 @@ static void LinkPartnerHandleBattleAnimation(void)
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
sub_817E32C(animationId);
BattleTv_SetDataBasedOnAnimation(animationId);
}
}

View File

@ -5,7 +5,7 @@
#include "battle_interface.h"
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "battle_link_817C95C.h"
#include "battle_tv.h"
#include "battle_ai_script_commands.h"
#include "pokemon.h"
#include "link.h"
@ -35,7 +35,6 @@ extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct BattleMove gBattleMoves[];
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
@ -1563,7 +1562,7 @@ static void OpponentHandleChooseMove(void)
BtlController_EmitTwoReturnValues(1, 15, gBattlerTarget);
break;
default:
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_x10))
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
gBattlerTarget = gActiveBattler;
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH)
{
@ -1585,7 +1584,7 @@ static void OpponentHandleChooseMove(void)
move = moveInfo->moves[chosenMoveId];
} while (move == MOVE_NONE);
if (gBattleMoves[move].target & (MOVE_TARGET_USER | MOVE_TARGET_x10))
if (gBattleMoves[move].target & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (gActiveBattler << 8));
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8));

View File

@ -5,7 +5,7 @@
#include "battle_interface.h"
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "battle_link_817C95C.h"
#include "battle_tv.h"
#include "pokemon.h"
#include "link.h"
#include "util.h"
@ -42,8 +42,6 @@ extern struct SpriteTemplate gUnknown_0202499C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern const u8 gTypeNames[][7];
extern const struct BattleMove gBattleMoves[];
extern const u8 gText_BattleSwitchWhich[];
extern const u8 gText_MoveInterfacePP[];
@ -432,7 +430,7 @@ static void HandleInputChooseTarget(void)
case B_POSITION_PLAYER_RIGHT:
if (gActiveBattler != gMultiUsePlayerCursor)
i++;
else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER)
else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER_OR_SELECTED)
i++;
break;
case B_POSITION_OPPONENT_LEFT:
@ -474,7 +472,7 @@ static void HandleInputChooseTarget(void)
case B_POSITION_PLAYER_RIGHT:
if (gActiveBattler != gMultiUsePlayerCursor)
i++;
else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER)
else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBattler])].target & MOVE_TARGET_USER_OR_SELECTED)
i++;
break;
case B_POSITION_OPPONENT_LEFT:
@ -508,7 +506,7 @@ static void HandleInputChooseMove(void)
if (moveInfo->moves[gMoveSelectionCursor[gActiveBattler]] == MOVE_CURSE)
{
if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST)
moveTarget = MOVE_TARGET_x10;
moveTarget = MOVE_TARGET_USER;
else
moveTarget = MOVE_TARGET_SELECTED;
}
@ -517,26 +515,26 @@ static void HandleInputChooseMove(void)
moveTarget = gBattleMoves[moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]].target;
}
if (moveTarget & MOVE_TARGET_x10)
if (moveTarget & MOVE_TARGET_USER)
gMultiUsePlayerCursor = gActiveBattler;
else
gMultiUsePlayerCursor = GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) & BIT_SIDE) ^ BIT_SIDE);
if (!gBattleBufferA[gActiveBattler][1]) // not a double battle
{
if (moveTarget & MOVE_TARGET_USER && !gBattleBufferA[gActiveBattler][2])
if (moveTarget & MOVE_TARGET_USER_OR_SELECTED && !gBattleBufferA[gActiveBattler][2])
canSelectTarget++;
}
else // double battle
{
if (!(moveTarget & (MOVE_TARGET_RANDOM | MOVE_TARGET_BOTH | MOVE_TARGET_DEPENDS | MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_x10)))
if (!(moveTarget & (MOVE_TARGET_RANDOM | MOVE_TARGET_BOTH | MOVE_TARGET_DEPENDS | MOVE_TARGET_FOES_AND_ALLY | MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_USER)))
canSelectTarget++; // either selected or user
if (moveInfo->currentPp[gMoveSelectionCursor[gActiveBattler]] == 0)
{
canSelectTarget = FALSE;
}
else if (!(moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) && CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) <= 1)
else if (!(moveTarget & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED)) && CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) <= 1)
{
gMultiUsePlayerCursor = GetDefaultMoveTarget(gActiveBattler);
canSelectTarget = FALSE;
@ -552,7 +550,7 @@ static void HandleInputChooseMove(void)
{
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseTarget;
if (moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER))
if (moveTarget & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED))
gMultiUsePlayerCursor = gActiveBattler;
else if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)])
gMultiUsePlayerCursor = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
@ -881,7 +879,7 @@ static void sub_80586F8(void)
gMain.callback1 = gPreBattleCallback1;
SetMainCallback2(sub_8038D64);
if (gBattleOutcome == B_OUTCOME_WON)
sub_817E3F4();
TryPutLinkBattleTvShowOnAir();
FreeAllWindowBuffers();
}
}
@ -894,7 +892,7 @@ static void sub_80586F8(void)
gMain.callback1 = gPreBattleCallback1;
SetMainCallback2(sub_8038D64);
if (gBattleOutcome == B_OUTCOME_WON)
sub_817E3F4();
TryPutLinkBattleTvShowOnAir();
FreeAllWindowBuffers();
}
}
@ -2484,7 +2482,7 @@ static void PlayerHandleMoveAnimation(void)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = PlayerDoMoveAnimation;
sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr);
BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
}
}
}
@ -2548,7 +2546,7 @@ static void PlayerHandlePrintString(void)
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2;
sub_817C95C(*stringId);
BattleTv_SetDataBasedOnString(*stringId);
sub_81A57E4(gActiveBattler, *stringId);
}
@ -2575,7 +2573,7 @@ static void PlayerHandleChooseAction(void)
s32 i;
gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3;
sub_817F2A8();
BattleTv_ClearExplosionFaintCause();
BattleHandleAddTextPrinter(gText_BattleMenu, 2);
for (i = 0; i < 4; i++)
@ -3069,7 +3067,7 @@ static void PlayerHandleBattleAnimation(void)
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
sub_817E32C(animationId);
BattleTv_SetDataBasedOnAnimation(animationId);
}
}

View File

@ -31,7 +31,6 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern const struct BattleMove gBattleMoves[];
extern void sub_81358F4(void);
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
@ -1521,7 +1520,7 @@ static void PlayerPartnerHandleChooseMove(void)
BattleAI_SetupAIData(0xF);
chosenMoveId = BattleAI_ChooseMoveOrAction();
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_x10 | MOVE_TARGET_USER))
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED))
gBattlerTarget = gActiveBattler;
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH)
{

View File

@ -6,7 +6,7 @@
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "battle_ai_script_commands.h"
#include "battle_link_817C95C.h"
#include "battle_tv.h"
#include "recorded_battle.h"
#include "pokemon.h"
#include "link.h"

View File

@ -34,7 +34,6 @@ extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern const struct BattleMove gBattleMoves[];
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
extern void sub_806A068(u16, u8);

View File

@ -5,7 +5,7 @@
#include "battle_interface.h"
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "battle_link_817C95C.h"
#include "battle_tv.h"
#include "pokemon.h"
#include "link.h"
#include "util.h"

View File

@ -36,7 +36,6 @@ extern u8 gBattleBuffersTransferData[0x100];
static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {};
extern const struct BattleMove gBattleMoves[];
extern void task00_08081A90(u8 taskId); // cable_club
extern void sub_81B8D64(u8 bank, u8 arg1); // party_menu
@ -97,7 +96,6 @@ void SetUpBattleVarsAndBirchZigzagoon(void)
void sub_8032768(void)
{
s32 i;
u8 *data;
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
sub_8184DA4(1);
@ -120,11 +118,11 @@ void sub_8032768(void)
sub_81B8D64(i, 0);
}
for (i = 0; i < sizeof(gBattleStruct->field_1A4); i++)
*(gBattleStruct->field_1A4 + i) = 0;
for (i = 0; i < sizeof(gBattleStruct->tvMovePoints); i++)
*((u8*)(&gBattleStruct->tvMovePoints) + i) = 0;
for (i = 0; i < sizeof(gBattleStruct->field_204); i++)
*(gBattleStruct->field_204 + i) = 0;
for (i = 0; i < sizeof(gBattleStruct->tv); i++)
*((u8*)(&gBattleStruct->tv) + i) = 0;
}
static void InitSinglePlayerBtlControllers(void)

View File

@ -28,7 +28,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern const struct BattleMove gBattleMoves[];
extern const u8 gUnknown_0831C604[];
extern const u8 * const gBattleAnims_VariousTable[];
extern const u8 * const gBattleAnims_Special[];
@ -237,7 +236,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
if (moveInfo->moves[chosenMoveId] == MOVE_CURSE)
{
if (moveInfo->monType1 != TYPE_GHOST && moveInfo->monType2 != TYPE_GHOST)
var1 = MOVE_TARGET_x10;
var1 = MOVE_TARGET_USER;
else
var1 = MOVE_TARGET_SELECTED;
}
@ -246,7 +245,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
var1 = gBattleMoves[moveInfo->moves[chosenMoveId]].target;
}
if (var1 & MOVE_TARGET_x10)
if (var1 & MOVE_TARGET_USER)
chosenMoveId |= (gActiveBattler << 8);
else if (var1 == MOVE_TARGET_SELECTED)
chosenMoveId |= (BattlePalaceGetTargetRetValue());
@ -261,7 +260,7 @@ static u8 sub_805D4A8(u16 move)
switch (gBattleMoves[move].target)
{
case MOVE_TARGET_SELECTED:
case MOVE_TARGET_USER:
case MOVE_TARGET_USER_OR_SELECTED:
case MOVE_TARGET_RANDOM:
case MOVE_TARGET_BOTH:
case MOVE_TARGET_FOES_AND_ALLY:
@ -273,7 +272,7 @@ static u8 sub_805D4A8(u16 move)
case MOVE_TARGET_DEPENDS:
case MOVE_TARGET_OPPONENTS_FIELD:
return 2;
case MOVE_TARGET_x10:
case MOVE_TARGET_USER:
return 1;
default:
return 0;

View File

@ -81,7 +81,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern u8 gUnknown_0203CF00[];
extern const struct BattleMove gBattleMoves[];
extern const u16 gBattleTextboxPalette[]; // battle textbox palette
extern const struct BgTemplate gUnknown_0831AA08[];
extern const struct WindowTemplate * const gUnknown_0831ABA0[];
@ -301,6 +300,214 @@ u8 gNumberOfMovesToChoose;
u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
// rom const data
// format: attacking type, defending type, damage multiplier
// the multiplier is a (decimal) fixed-point number:
// 20 is ×2.0 TYPE_MUL_SUPER_EFFECTIVE
// 10 is ×1.0 TYPE_MUL_NORMAL
// 05 is ×0.5 TYPE_MUL_NOT_EFFECTIVE
// 00 is ×0.0 TYPE_MUL_NO_EFFECT
const u8 gTypeEffectiveness[336] =
{
TYPE_NORMAL, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE,
TYPE_NORMAL, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FIRE, TYPE_FIRE, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FIRE, TYPE_WATER, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FIRE, TYPE_GRASS, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FIRE, TYPE_ICE, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FIRE, TYPE_BUG, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FIRE, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FIRE, TYPE_DRAGON, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FIRE, TYPE_STEEL, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_WATER, TYPE_FIRE, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_WATER, TYPE_WATER, TYPE_MUL_NOT_EFFECTIVE,
TYPE_WATER, TYPE_GRASS, TYPE_MUL_NOT_EFFECTIVE,
TYPE_WATER, TYPE_GROUND, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_WATER, TYPE_ROCK, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_WATER, TYPE_DRAGON, TYPE_MUL_NOT_EFFECTIVE,
TYPE_ELECTRIC, TYPE_WATER, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_ELECTRIC, TYPE_ELECTRIC, TYPE_MUL_NOT_EFFECTIVE,
TYPE_ELECTRIC, TYPE_GRASS, TYPE_MUL_NOT_EFFECTIVE,
TYPE_ELECTRIC, TYPE_GROUND, TYPE_MUL_NO_EFFECT,
TYPE_ELECTRIC, TYPE_FLYING, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_ELECTRIC, TYPE_DRAGON, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GRASS, TYPE_FIRE, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GRASS, TYPE_WATER, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_GRASS, TYPE_GRASS, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GRASS, TYPE_POISON, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GRASS, TYPE_GROUND, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_GRASS, TYPE_FLYING, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GRASS, TYPE_BUG, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GRASS, TYPE_ROCK, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_GRASS, TYPE_DRAGON, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GRASS, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_ICE, TYPE_WATER, TYPE_MUL_NOT_EFFECTIVE,
TYPE_ICE, TYPE_GRASS, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_ICE, TYPE_ICE, TYPE_MUL_NOT_EFFECTIVE,
TYPE_ICE, TYPE_GROUND, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_ICE, TYPE_FLYING, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_ICE, TYPE_DRAGON, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_ICE, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_ICE, TYPE_FIRE, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FIGHTING, TYPE_NORMAL, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FIGHTING, TYPE_ICE, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FIGHTING, TYPE_POISON, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FIGHTING, TYPE_FLYING, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FIGHTING, TYPE_PSYCHIC, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FIGHTING, TYPE_BUG, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FIGHTING, TYPE_ROCK, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FIGHTING, TYPE_DARK, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FIGHTING, TYPE_STEEL, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_POISON, TYPE_GRASS, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_POISON, TYPE_POISON, TYPE_MUL_NOT_EFFECTIVE,
TYPE_POISON, TYPE_GROUND, TYPE_MUL_NOT_EFFECTIVE,
TYPE_POISON, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE,
TYPE_POISON, TYPE_GHOST, TYPE_MUL_NOT_EFFECTIVE,
TYPE_POISON, TYPE_STEEL, TYPE_MUL_NO_EFFECT,
TYPE_GROUND, TYPE_FIRE, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_GROUND, TYPE_ELECTRIC, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_GROUND, TYPE_GRASS, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GROUND, TYPE_POISON, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_GROUND, TYPE_FLYING, TYPE_MUL_NO_EFFECT,
TYPE_GROUND, TYPE_BUG, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GROUND, TYPE_ROCK, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_GROUND, TYPE_STEEL, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FLYING, TYPE_ELECTRIC, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FLYING, TYPE_GRASS, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FLYING, TYPE_FIGHTING, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FLYING, TYPE_BUG, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_FLYING, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FLYING, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_PSYCHIC, TYPE_FIGHTING, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_PSYCHIC, TYPE_POISON, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_PSYCHIC, TYPE_PSYCHIC, TYPE_MUL_NOT_EFFECTIVE,
TYPE_PSYCHIC, TYPE_DARK, TYPE_MUL_NO_EFFECT,
TYPE_PSYCHIC, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_BUG, TYPE_FIRE, TYPE_MUL_NOT_EFFECTIVE,
TYPE_BUG, TYPE_GRASS, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_BUG, TYPE_FIGHTING, TYPE_MUL_NOT_EFFECTIVE,
TYPE_BUG, TYPE_POISON, TYPE_MUL_NOT_EFFECTIVE,
TYPE_BUG, TYPE_FLYING, TYPE_MUL_NOT_EFFECTIVE,
TYPE_BUG, TYPE_PSYCHIC, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_BUG, TYPE_GHOST, TYPE_MUL_NOT_EFFECTIVE,
TYPE_BUG, TYPE_DARK, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_BUG, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_ROCK, TYPE_FIRE, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_ROCK, TYPE_ICE, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_ROCK, TYPE_FIGHTING, TYPE_MUL_NOT_EFFECTIVE,
TYPE_ROCK, TYPE_GROUND, TYPE_MUL_NOT_EFFECTIVE,
TYPE_ROCK, TYPE_FLYING, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_ROCK, TYPE_BUG, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_ROCK, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GHOST, TYPE_NORMAL, TYPE_MUL_NO_EFFECT,
TYPE_GHOST, TYPE_PSYCHIC, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_GHOST, TYPE_DARK, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GHOST, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_GHOST, TYPE_GHOST, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_DRAGON, TYPE_DRAGON, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_DRAGON, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_DARK, TYPE_FIGHTING, TYPE_MUL_NOT_EFFECTIVE,
TYPE_DARK, TYPE_PSYCHIC, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_DARK, TYPE_GHOST, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_DARK, TYPE_DARK, TYPE_MUL_NOT_EFFECTIVE,
TYPE_DARK, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_STEEL, TYPE_FIRE, TYPE_MUL_NOT_EFFECTIVE,
TYPE_STEEL, TYPE_WATER, TYPE_MUL_NOT_EFFECTIVE,
TYPE_STEEL, TYPE_ELECTRIC, TYPE_MUL_NOT_EFFECTIVE,
TYPE_STEEL, TYPE_ICE, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_STEEL, TYPE_ROCK, TYPE_MUL_SUPER_EFFECTIVE,
TYPE_STEEL, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE,
TYPE_FORESIGHT, TYPE_FORESIGHT, TYPE_MUL_NO_EFFECT,
TYPE_NORMAL, TYPE_GHOST, TYPE_MUL_NO_EFFECT,
TYPE_FIGHTING, TYPE_GHOST, TYPE_MUL_NO_EFFECT,
TYPE_ENDTABLE, TYPE_ENDTABLE, TYPE_MUL_NO_EFFECT
};
const u8 gTypeNames[][TYPE_NAME_LENGTH + 1] =
{
_("NORMAL"),
_("FIGHT"),
_("FLYING"),
_("POISON"),
_("GROUND"),
_("ROCK"),
_("BUG"),
_("GHOST"),
_("STEEL"),
_("???"),
_("FIRE"),
_("WATER"),
_("GRASS"),
_("ELECTR"),
_("PSYCHC"),
_("ICE"),
_("DRAGON"),
_("DARK"),
};
// This is a factor in how much money you get for beating a trainer.
const struct TrainerMoney gTrainerMoneyTable[] =
{
{TRAINER_CLASS_TEAM_AQUA, 5},
{TRAINER_CLASS_AQUA_ADMIN, 10},
{TRAINER_CLASS_AQUA_LEADER, 20},
{TRAINER_CLASS_AROMA_LADY, 10},
{TRAINER_CLASS_RUIN_MANIAC, 15},
{TRAINER_CLASS_INTERVIEWER, 12},
{TRAINER_CLASS_TUBER_1, 1},
{TRAINER_CLASS_TUBER_2, 1},
{TRAINER_CLASS_SIS_AND_BRO, 3},
{TRAINER_CLASS_COOLTRAINER_1, 12},
{TRAINER_CLASS_HEX_MANIAC, 6},
{TRAINER_CLASS_LADY, 50},
{TRAINER_CLASS_BEAUTY, 20},
{TRAINER_CLASS_RICH_BOY, 50},
{TRAINER_CLASS_POKEMANIAC, 15},
{TRAINER_CLASS_SWIMMER_M, 2},
{TRAINER_CLASS_BLACK_BELT, 8},
{TRAINER_CLASS_GUITARIST, 8},
{TRAINER_CLASS_KINDLER, 8},
{TRAINER_CLASS_CAMPER, 4},
{TRAINER_CLASS_OLD_COUPLE, 10},
{TRAINER_CLASS_BUG_MANIAC, 15},
{TRAINER_CLASS_PSYCHIC, 6},
{TRAINER_CLASS_GENTLEMAN, 20},
{TRAINER_CLASS_ELITE_FOUR, 25},
{TRAINER_CLASS_LEADER, 25},
{TRAINER_CLASS_SCHOOL_KID, 5},
{TRAINER_CLASS_SR_AND_JR, 4},
{TRAINER_CLASS_POKEFAN, 20},
{TRAINER_CLASS_EXPERT, 10},
{TRAINER_CLASS_YOUNGSTER, 4},
{TRAINER_CLASS_CHAMPION, 50},
{TRAINER_CLASS_FISHERMAN, 10},
{TRAINER_CLASS_TRIATHLETE, 10},
{TRAINER_CLASS_DRAGON_TAMER, 12},
{TRAINER_CLASS_BIRD_KEEPER, 8},
{TRAINER_CLASS_NINJA_BOY, 3},
{TRAINER_CLASS_BATTLE_GIRL, 6},
{TRAINER_CLASS_PARASOL_LADY, 10},
{TRAINER_CLASS_SWIMMER_F, 2},
{TRAINER_CLASS_PICNICKER, 4},
{TRAINER_CLASS_TWINS, 3},
{TRAINER_CLASS_SAILOR, 8},
{TRAINER_CLASS_COLLECTOR, 15},
{TRAINER_CLASS_PKMN_TRAINER_3, 15},
{TRAINER_CLASS_PKMN_BREEDER, 10},
{TRAINER_CLASS_PKMN_RANGER, 12},
{TRAINER_CLASS_TEAM_MAGMA, 5},
{TRAINER_CLASS_MAGMA_ADMIN, 10},
{TRAINER_CLASS_MAGMA_LEADER, 20},
{TRAINER_CLASS_LASS, 4},
{TRAINER_CLASS_BUG_CATCHER, 4},
{TRAINER_CLASS_HIKER, 10},
{TRAINER_CLASS_YOUNG_COUPLE, 8},
{TRAINER_CLASS_WINSTRATE, 10},
{0xFF, 5},
};
#include "data/text/abilities.h"
static void (* const sTurnActionsFuncsTable[])(void) =
{
HandleAction_UseMove, // B_ACTION_USE_MOVE
@ -5133,7 +5340,7 @@ static void HandleAction_UseMove(void)
else if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
&& gSideTimers[side].followmeTimer == 0
&& (gBattleMoves[gCurrentMove].power != 0
|| gBattleMoves[gCurrentMove].target != MOVE_TARGET_x10)
|| gBattleMoves[gCurrentMove].target != MOVE_TARGET_USER)
&& gBattleMons[*(gBattleStruct->moveTarget + gBattlerAttacker)].ability != ABILITY_LIGHTNING_ROD
&& gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC)
{

View File

@ -22,9 +22,7 @@ extern u8 gUnknown_0203C7B4;
extern struct StringInfoBattle *gStringInfo;
extern const u8 gMoveNames[LAST_MOVE_INDEX + 1][13];
extern const u8 gAbilityNames[][13];
extern const u8 gTrainerClassNames[][13];
extern const u8 gTypeNames[][7];
extern const u16 gUnknown_08D85620[];
// strings
@ -516,375 +514,375 @@ const u8 gText_Trainer2LoseText[];
const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
gText_Trainer1LoseText,
gText_PkmnGainedEXP,
gText_PkmnGrewToLv,
gText_PkmnLearnedMove,
gText_TryToLearnMove1,
gText_TryToLearnMove2,
gText_TryToLearnMove3,
gText_PkmnForgotMove,
gText_StopLearningMove,
gText_DidNotLearnMove,
gText_PkmnLearnedMove2,
gText_AttackMissed,
gText_PkmnProtectedItself,
gText_StatsWontIncrease2,
gText_AvoidedDamage,
gText_ItDoesntAffect,
gText_AttackerFainted,
gText_TargetFainted,
gText_PlayerGotMoney,
gText_PlayerWhiteout,
gText_PlayerWhiteout2,
gText_PreventsEscape,
gText_HitXTimes,
gText_PkmnFellAsleep,
gText_PkmnMadeSleep,
gText_PkmnAlreadyAsleep,
gText_PkmnAlreadyAsleep2,
gText_PkmnWasntAffected,
gText_PkmnWasPoisoned,
gText_PkmnPoisonedBy,
gText_PkmnHurtByPoison,
gText_PkmnAlreadyPoisoned,
gText_PkmnBadlyPoisoned,
gText_PkmnEnergyDrained,
gText_PkmnWasBurned,
gText_PkmnBurnedBy,
gText_PkmnHurtByBurn,
gText_PkmnWasFrozen,
gText_PkmnFrozenBy,
gText_PkmnIsFrozen,
gText_PkmnWasDefrosted,
gText_PkmnWasDefrosted2,
gText_PkmnWasDefrostedBy,
gText_PkmnWasParalyzed,
gText_PkmnWasParalyzedBy,
gText_PkmnIsParalyzed,
gText_PkmnIsAlreadyParalyzed,
gText_PkmnHealedParalysis,
gText_PkmnDreamEaten,
gText_StatsWontIncrease,
gText_StatsWontDecrease,
gText_TeamStoppedWorking,
gText_FoeStoppedWorking,
gText_PkmnIsConfused,
gText_PkmnHealedConfusion,
gText_PkmnWasConfused,
gText_PkmnAlreadyConfused,
gText_PkmnFellInLove,
gText_PkmnInLove,
gText_PkmnImmobilizedByLove,
gText_PkmnBlownAway,
gText_PkmnChangedType,
gText_PkmnFlinched,
gText_PkmnRegainedHealth,
gText_PkmnHPFull,
gText_PkmnRaisedSpDef,
gText_PkmnRaisedDef,
gText_PkmnCoveredByVeil,
gText_PkmnUsedSafeguard,
gText_PkmnSafeguardExpired,
gText_PkmnWentToSleep,
gText_PkmnSleptHealthy,
gText_PkmnWhippedWhirlwind,
gText_PkmnTookSunlight,
gText_PkmnLoweredHead,
gText_PkmnIsGlowing,
gText_PkmnFlewHigh,
gText_PkmnDugHole,
gText_PkmnSqueezedByBind,
gText_PkmnTrappedInVortex,
gText_PkmnWrappedBy,
gText_PkmnClamped,
gText_PkmnHurtBy,
gText_PkmnFreedFrom,
gText_PkmnCrashed,
gText_PkmnShroudedInMist,
gText_PkmnProtectedByMist,
gText_PkmnGettingPumped,
gText_PkmnHitWithRecoil,
gText_PkmnProtectedItself2,
gText_PkmnBuffetedBySandstorm,
gText_PkmnPeltedByHail,
gText_PkmnSeeded,
gText_PkmnEvadedAttack,
gText_PkmnSappedByLeechSeed,
gText_PkmnFastAsleep,
gText_PkmnWokeUp,
gText_PkmnUproarKeptAwake,
gText_PkmnWokeUpInUproar,
gText_PkmnCausedUproar,
gText_PkmnMakingUproar,
gText_PkmnCalmedDown,
gText_PkmnCantSleepInUproar,
gText_PkmnStockpiled,
gText_PkmnCantStockpile,
gText_PkmnCantSleepInUproar2,
gText_UproarKeptPkmnAwake,
gText_PkmnStayedAwakeUsing,
gText_PkmnStoringEnergy,
gText_PkmnUnleashedEnergy,
gText_PkmnFatigueConfusion,
gText_PkmnPickedUpItem,
gText_PkmnUnaffected,
gText_PkmnTransformedInto,
gText_PkmnMadeSubstitute,
gText_PkmnHasSubstitute,
gText_SubstituteDamaged,
gText_PkmnSubstituteFaded,
gText_PkmnMustRecharge,
gText_PkmnRageBuilding,
gText_PkmnMoveWasDisabled,
gText_PkmnMoveIsDisabled,
gText_PkmnMoveDisabledNoMore,
gText_PkmnGotEncore,
gText_PkmnEncoreEnded,
gText_PkmnTookAim,
gText_PkmnSketchedMove,
gText_PkmnTryingToTakeFoe,
gText_PkmnTookFoe,
gText_PkmnReducedPP,
gText_PkmnStoleItem,
gText_TargetCantEscapeNow,
gText_PkmnFellIntoNightmare,
gText_PkmnLockedInNightmare,
gText_PkmnLaidCurse,
gText_PkmnAfflictedByCurse,
gText_SpikesScattered,
gText_PkmnHurtBySpikes,
gText_PkmnIdentified,
gText_PkmnPerishCountFell,
gText_PkmnBracedItself,
gText_PkmnEnduredHit,
gText_MagnitudeStrength,
gText_PkmnCutHPMaxedAttack,
gText_PkmnCopiedStatChanges,
gText_PkmnGotFree,
gText_PkmnShedLeechSeed,
gText_PkmnBlewAwaySpikes,
gText_PkmnFledFromBattle,
gText_PkmnForesawAttack,
gText_PkmnTookAttack,
gText_PkmnAttack,
gText_PkmnCenterAttention,
gText_PkmnChargingPower,
gText_NaturePowerTurnedInto,
gText_PkmnStatusNormal,
gText_PkmnHasNoMovesLeft,
gText_PkmnSubjectedToTorment,
gText_PkmnCantUseMoveTorment,
gText_PkmnTighteningFocus,
gText_PkmnFellForTaunt,
gText_PkmnCantUseMoveTaunt,
gText_PkmnReadyToHelp,
gText_PkmnSwitchedItems,
gText_PkmnCopiedFoe,
gText_PkmnMadeWish,
gText_PkmnWishCameTrue,
gText_PkmnPlantedRoots,
gText_PkmnAbsorbedNutrients,
gText_PkmnAnchoredItself,
gText_PkmnWasMadeDrowsy,
gText_PkmnKnockedOff,
gText_PkmnSwappedAbilities,
gText_PkmnSealedOpponentMove,
gText_PkmnCantUseMoveSealed,
gText_PkmnWantsGrudge,
gText_PkmnLostPPGrudge,
gText_PkmnShroudedItself,
gText_PkmnMoveBounced,
gText_PkmnWaitsForTarget,
gText_PkmnSnatchedMove,
gText_PkmnMadeItRain,
gText_PkmnRaisedSpeed,
gText_PkmnProtectedBy,
gText_PkmnPreventsUsage,
gText_PkmnRestoredHPUsing,
gText_PkmnChangedTypeWith,
gText_PkmnPreventsParalysisWith,
gText_PkmnPreventsRomanceWith,
gText_PkmnPreventsPoisoningWith,
gText_PkmnPreventsConfusionWith,
gText_PkmnRaisedFirePowerWith,
gText_PkmnAnchorsItselfWith,
gText_PkmnCutsAttackWith,
gText_PkmnPreventsStatLossWith,
gText_PkmnHurtsWith,
gText_PkmnTraced,
gText_StatSharply,
gText_StatRose,
gText_StatHarshly,
gText_StatFell,
gText_PkmnsStatChanged,
gText_PkmnsStatChanged2,
gText_PkmnsStatChanged3,
gText_PkmnsStatChanged4,
gText_CriticalHit,
gText_OneHitKO,
gText_123Poof,
gText_AndEllipsis,
gText_NotVeryEffective,
gText_SuperEffective,
gText_GotAwaySafely,
gText_WildPkmnFled,
gText_NoRunningFromTrainers,
gText_CantEscape,
gText_DontLeaveBirch,
gText_ButNothingHappened,
gText_ButItFailed,
gText_ItHurtConfusion,
gText_MirrorMoveFailed,
gText_StartedToRain,
gText_DownpourStarted,
gText_RainContinues,
gText_DownpourContinues,
gText_RainStopped,
gText_SandstormBrewed,
gText_SandstormRages,
gText_SandstormSubsided,
gText_SunlightGotBright,
gText_SunlightStrong,
gText_SunlightFaded,
gText_StartedHail,
gText_HailContinues,
gText_HailStopped,
gText_FailedToSpitUp,
gText_FailedToSwallow,
gText_WindBecameHeatWave,
gText_StatChangesGone,
gText_CoinsScattered,
gText_TooWeakForSubstitute,
gText_SharedPain,
gText_BellChimed,
gText_FaintInThree,
gText_NoPPLeft,
gText_ButNoPPLeft,
gText_PlayerUsedItem,
gText_WallyUsedItem,
gText_TrainerBlockedBall,
gText_DontBeAThief,
gText_ItDodgedBall,
gText_YouMissedPkmn,
gText_PkmnBrokeFree,
gText_ItAppearedCaught,
gText_AarghAlmostHadIt,
gText_ShootSoClose,
gText_GotchaPkmnCaught,
gText_GotchaPkmnCaught2,
gText_GiveNicknameCaptured,
gText_PkmnSentToPC,
gText_PkmnDataAddedToDex,
gText_ItIsRaining,
gText_SandstormIsRaging,
gText_CantEscape2,
gText_PkmnIgnoresAsleep,
gText_PkmnIgnoredOrders,
gText_PkmnBeganToNap,
gText_PkmnLoafing,
gText_PkmnWontObey,
gText_PkmnTurnedAway,
gText_PkmnPretendNotNotice,
gText_EnemyAboutToSwitchPkmn,
gText_CreptCloser,
gText_CantGetCloser,
gText_PkmnWatchingCarefully,
gText_PkmnCuriousAboutX,
gText_PkmnEnthralledByX,
gText_PkmnIgnoredX,
gText_ThrewPokeblockAtPkmn,
gText_OutOfSafariBalls,
gText_PkmnsItemCuredParalysis,
gText_PkmnsItemCuredPoison,
gText_PkmnsItemHealedBurn,
gText_PkmnsItemDefrostedIt,
gText_PkmnsItemWokeIt,
gText_PkmnsItemSnappedOut,
gText_PkmnsItemCuredProblem,
gText_PkmnsItemRestoredHealth,
gText_PkmnsItemRestoredPP,
gText_PkmnsItemRestoredStatus,
gText_PkmnsItemRestoredHPALittle,
gText_ItemAllowsOnlyYMove,
gText_PkmnHungOnWithX,
gText_EmptyString3,
gText_PkmnsXPreventsBurns,
gText_PkmnsXBlocksY,
gText_PkmnsXRestoredHPALittle2,
gText_PkmnsXWhippedUpSandstorm,
gText_PkmnsXPreventsYLoss,
gText_PkmnsXInfatuatedY,
gText_PkmnsXMadeYIneffective,
gText_PkmnsXCuredYProblem,
gText_ItSuckedLiquidOoze,
gText_PkmnTransformed,
gText_ElectricityWeakened,
gText_FireWeakened,
gText_PkmnHidUnderwater,
gText_PkmnSprangUp,
gText_HMMovesCantBeForgotten,
gText_XFoundOneY,
gText_PlayerDefeatedLinkTrainerTrainer1,
gText_SoothingAroma,
gText_ItemsCantBeUsedNow,
gText_ForXCommaYZ,
gText_UsingXTheYOfZN,
gText_PkmnUsedXToGetPumped,
gText_PkmnsXMadeYUseless,
gText_PkmnTrappedBySandTomb,
gText_EmptyString4,
gText_ABoosted,
gText_PkmnsXIntensifiedSun,
gText_PkmnMakesGroundMiss,
gText_YouThrowABallNowRight,
gText_PkmnsXTookAttack,
gText_PkmnChoseXAsDestiny,
gText_PkmnLostFocus,
gText_UseNextPkmn,
gText_PkmnFledUsingIts,
gText_PkmnFledUsing,
gText_PkmnWasDraggedOut,
gText_PreventedFromWorking,
gText_PkmnsItemNormalizedStatus,
gText_Trainer1UsedItem,
gText_BoxIsFull,
gText_PkmnAvoidedAttack,
gText_PkmnsXMadeItIneffective,
gText_PkmnsXPreventsFlinching,
gText_PkmnAlreadyHasBurn,
gText_StatsWontDecrease2,
gText_PkmnsXBlocksY2,
gText_PkmnsXWoreOff,
gText_PkmnRaisedDefALittle,
gText_PkmnRaisedSpDefALittle,
gText_TheWallShattered,
gText_PkmnsXPreventsYsZ,
gText_PkmnsXCuredItsYProblem,
gText_AttackerCantEscape,
gText_PkmnObtainedX,
gText_PkmnObtainedX2,
gText_PkmnObtainedXYObtainedZ,
gText_ButNoEffect,
gText_PkmnsXHadNoEffectOnY,
gText_TwoInGameTrainersDefeated,
gText_Trainer2LoseText,
gText_PkmnIncapableOfPower,
gText_GlintAppearsInEye,
gText_PkmnGettingIntoPosition,
gText_PkmnBeganGrowlingDeeply,
gText_PkmnEagerForMore,
gText_DefeatedOpponentByReferee,
gText_LostToOpponentByReferee,
gText_TiedOpponentByReferee,
gText_QuestionForfeitMatch,
gText_ForfeitedMatch,
gText_PkmnTransferredSomeonesPC,
gText_PkmnTransferredLanettesPC,
gText_PkmnBoxSomeonesPCFull,
gText_PkmnBoxLanettesPCFull,
gText_Trainer1WinText,
gText_Trainer2WinText,
gText_Trainer1LoseText, // 12
gText_PkmnGainedEXP, // 13
gText_PkmnGrewToLv, // 14
gText_PkmnLearnedMove, // 15
gText_TryToLearnMove1, // 16
gText_TryToLearnMove2, // 17
gText_TryToLearnMove3, // 18
gText_PkmnForgotMove, // 19
gText_StopLearningMove, // 20
gText_DidNotLearnMove, // 21
gText_PkmnLearnedMove2, // 22
gText_AttackMissed, // 23
gText_PkmnProtectedItself, // 24
gText_StatsWontIncrease2, // 25
gText_AvoidedDamage, // 26
gText_ItDoesntAffect, // 27
gText_AttackerFainted, // 28
gText_TargetFainted, // 29
gText_PlayerGotMoney, // 30
gText_PlayerWhiteout, // 31
gText_PlayerWhiteout2, // 32
gText_PreventsEscape, // 33
gText_HitXTimes, // 34
gText_PkmnFellAsleep, // 35
gText_PkmnMadeSleep, // 36
gText_PkmnAlreadyAsleep, // 37
gText_PkmnAlreadyAsleep2, // 38
gText_PkmnWasntAffected, // 39
gText_PkmnWasPoisoned, // 40
gText_PkmnPoisonedBy, // 41
gText_PkmnHurtByPoison, // 42
gText_PkmnAlreadyPoisoned, // 43
gText_PkmnBadlyPoisoned, // 44
gText_PkmnEnergyDrained, // 45
gText_PkmnWasBurned, // 46
gText_PkmnBurnedBy, // 47
gText_PkmnHurtByBurn, // 48
gText_PkmnWasFrozen, // 49
gText_PkmnFrozenBy, // 50
gText_PkmnIsFrozen, // 51
gText_PkmnWasDefrosted, // 52
gText_PkmnWasDefrosted2, // 53
gText_PkmnWasDefrostedBy, // 54
gText_PkmnWasParalyzed, // 55
gText_PkmnWasParalyzedBy, // 56
gText_PkmnIsParalyzed, // 57
gText_PkmnIsAlreadyParalyzed, // 58
gText_PkmnHealedParalysis, // 59
gText_PkmnDreamEaten, // 60
gText_StatsWontIncrease, // 61
gText_StatsWontDecrease, // 62
gText_TeamStoppedWorking, // 63
gText_FoeStoppedWorking, // 64
gText_PkmnIsConfused, // 65
gText_PkmnHealedConfusion, // 66
gText_PkmnWasConfused, // 67
gText_PkmnAlreadyConfused, // 68
gText_PkmnFellInLove, // 69
gText_PkmnInLove, // 70
gText_PkmnImmobilizedByLove, // 71
gText_PkmnBlownAway, // 72
gText_PkmnChangedType, // 73
gText_PkmnFlinched, // 74
gText_PkmnRegainedHealth, // 75
gText_PkmnHPFull, // 76
gText_PkmnRaisedSpDef, // 77
gText_PkmnRaisedDef, // 78
gText_PkmnCoveredByVeil, // 79
gText_PkmnUsedSafeguard, // 80
gText_PkmnSafeguardExpired, // 81
gText_PkmnWentToSleep, // 82
gText_PkmnSleptHealthy, // 83
gText_PkmnWhippedWhirlwind, // 84
gText_PkmnTookSunlight, // 85
gText_PkmnLoweredHead, // 86
gText_PkmnIsGlowing, // 87
gText_PkmnFlewHigh, // 88
gText_PkmnDugHole, // 89
gText_PkmnSqueezedByBind, // 90
gText_PkmnTrappedInVortex, // 91
gText_PkmnWrappedBy, // 92
gText_PkmnClamped, // 93
gText_PkmnHurtBy, // 94
gText_PkmnFreedFrom, // 95
gText_PkmnCrashed, // 96
gText_PkmnShroudedInMist, // 97
gText_PkmnProtectedByMist, // 98
gText_PkmnGettingPumped, // 99
gText_PkmnHitWithRecoil, // 100
gText_PkmnProtectedItself2, // 101
gText_PkmnBuffetedBySandstorm, // 102
gText_PkmnPeltedByHail, // 103
gText_PkmnSeeded, // 104
gText_PkmnEvadedAttack, // 105
gText_PkmnSappedByLeechSeed, // 106
gText_PkmnFastAsleep, // 107
gText_PkmnWokeUp, // 108
gText_PkmnUproarKeptAwake, // 109
gText_PkmnWokeUpInUproar, // 110
gText_PkmnCausedUproar, // 111
gText_PkmnMakingUproar, // 112
gText_PkmnCalmedDown, // 113
gText_PkmnCantSleepInUproar, // 114
gText_PkmnStockpiled, // 115
gText_PkmnCantStockpile, // 116
gText_PkmnCantSleepInUproar2, // 117
gText_UproarKeptPkmnAwake, // 118
gText_PkmnStayedAwakeUsing, // 119
gText_PkmnStoringEnergy, // 120
gText_PkmnUnleashedEnergy, // 121
gText_PkmnFatigueConfusion, // 122
gText_PkmnPickedUpItem, // 123
gText_PkmnUnaffected, // 124
gText_PkmnTransformedInto, // 125
gText_PkmnMadeSubstitute, // 126
gText_PkmnHasSubstitute, // 127
gText_SubstituteDamaged, // 128
gText_PkmnSubstituteFaded, // 129
gText_PkmnMustRecharge, // 130
gText_PkmnRageBuilding, // 131
gText_PkmnMoveWasDisabled, // 132
gText_PkmnMoveIsDisabled, // 133
gText_PkmnMoveDisabledNoMore, // 134
gText_PkmnGotEncore, // 135
gText_PkmnEncoreEnded, // 136
gText_PkmnTookAim, // 137
gText_PkmnSketchedMove, // 138
gText_PkmnTryingToTakeFoe, // 139
gText_PkmnTookFoe, // 140
gText_PkmnReducedPP, // 141
gText_PkmnStoleItem, // 142
gText_TargetCantEscapeNow, // 143
gText_PkmnFellIntoNightmare, // 144
gText_PkmnLockedInNightmare, // 145
gText_PkmnLaidCurse, // 146
gText_PkmnAfflictedByCurse, // 147
gText_SpikesScattered, // 148
gText_PkmnHurtBySpikes, // 149
gText_PkmnIdentified, // 150
gText_PkmnPerishCountFell, // 151
gText_PkmnBracedItself, // 152
gText_PkmnEnduredHit, // 153
gText_MagnitudeStrength, // 154
gText_PkmnCutHPMaxedAttack, // 155
gText_PkmnCopiedStatChanges, // 156
gText_PkmnGotFree, // 157
gText_PkmnShedLeechSeed, // 158
gText_PkmnBlewAwaySpikes, // 159
gText_PkmnFledFromBattle, // 160
gText_PkmnForesawAttack, // 161
gText_PkmnTookAttack, // 162
gText_PkmnAttack, // 163
gText_PkmnCenterAttention, // 164
gText_PkmnChargingPower, // 165
gText_NaturePowerTurnedInto, // 166
gText_PkmnStatusNormal, // 167
gText_PkmnHasNoMovesLeft, // 168
gText_PkmnSubjectedToTorment, // 169
gText_PkmnCantUseMoveTorment, // 170
gText_PkmnTighteningFocus, // 171
gText_PkmnFellForTaunt, // 172
gText_PkmnCantUseMoveTaunt, // 173
gText_PkmnReadyToHelp, // 174
gText_PkmnSwitchedItems, // 175
gText_PkmnCopiedFoe, // 176
gText_PkmnMadeWish, // 177
gText_PkmnWishCameTrue, // 178
gText_PkmnPlantedRoots, // 179
gText_PkmnAbsorbedNutrients, // 180
gText_PkmnAnchoredItself, // 181
gText_PkmnWasMadeDrowsy, // 182
gText_PkmnKnockedOff, // 183
gText_PkmnSwappedAbilities, // 184
gText_PkmnSealedOpponentMove, // 185
gText_PkmnCantUseMoveSealed, // 186
gText_PkmnWantsGrudge, // 187
gText_PkmnLostPPGrudge, // 188
gText_PkmnShroudedItself, // 189
gText_PkmnMoveBounced, // 190
gText_PkmnWaitsForTarget, // 191
gText_PkmnSnatchedMove, // 192
gText_PkmnMadeItRain, // 193
gText_PkmnRaisedSpeed, // 194
gText_PkmnProtectedBy, // 195
gText_PkmnPreventsUsage, // 196
gText_PkmnRestoredHPUsing, // 197
gText_PkmnChangedTypeWith, // 198
gText_PkmnPreventsParalysisWith, // 199
gText_PkmnPreventsRomanceWith, // 200
gText_PkmnPreventsPoisoningWith, // 201
gText_PkmnPreventsConfusionWith, // 202
gText_PkmnRaisedFirePowerWith, // 203
gText_PkmnAnchorsItselfWith, // 204
gText_PkmnCutsAttackWith, // 205
gText_PkmnPreventsStatLossWith, // 206
gText_PkmnHurtsWith, // 207
gText_PkmnTraced, // 208
gText_StatSharply, // 209
gText_StatRose, // 210
gText_StatHarshly, // 211
gText_StatFell, // 212
gText_PkmnsStatChanged, // 213
gText_PkmnsStatChanged2, // 214
gText_PkmnsStatChanged3, // 215
gText_PkmnsStatChanged4, // 216
gText_CriticalHit, // 217
gText_OneHitKO, // 218
gText_123Poof, // 219
gText_AndEllipsis, // 220
gText_NotVeryEffective, // 221
gText_SuperEffective, // 222
gText_GotAwaySafely, // 223
gText_WildPkmnFled, // 224
gText_NoRunningFromTrainers, // 225
gText_CantEscape, // 226
gText_DontLeaveBirch, // 227
gText_ButNothingHappened, // 228
gText_ButItFailed, // 229
gText_ItHurtConfusion, // 230
gText_MirrorMoveFailed, // 231
gText_StartedToRain, // 232
gText_DownpourStarted, // 233
gText_RainContinues, // 234
gText_DownpourContinues, // 235
gText_RainStopped, // 236
gText_SandstormBrewed, // 237
gText_SandstormRages, // 238
gText_SandstormSubsided, // 239
gText_SunlightGotBright, // 240
gText_SunlightStrong, // 241
gText_SunlightFaded, // 242
gText_StartedHail, // 243
gText_HailContinues, // 244
gText_HailStopped, // 245
gText_FailedToSpitUp, // 246
gText_FailedToSwallow, // 247
gText_WindBecameHeatWave, // 248
gText_StatChangesGone, // 249
gText_CoinsScattered, // 250
gText_TooWeakForSubstitute, // 251
gText_SharedPain, // 252
gText_BellChimed, // 253
gText_FaintInThree, // 254
gText_NoPPLeft, // 255
gText_ButNoPPLeft, // 256
gText_PlayerUsedItem, // 257
gText_WallyUsedItem, // 258
gText_TrainerBlockedBall, // 259
gText_DontBeAThief, // 260
gText_ItDodgedBall, // 261
gText_YouMissedPkmn, // 262
gText_PkmnBrokeFree, // 263
gText_ItAppearedCaught, // 264
gText_AarghAlmostHadIt, // 265
gText_ShootSoClose, // 266
gText_GotchaPkmnCaught, // 267
gText_GotchaPkmnCaught2, // 268
gText_GiveNicknameCaptured, // 269
gText_PkmnSentToPC, // 270
gText_PkmnDataAddedToDex, // 271
gText_ItIsRaining, // 272
gText_SandstormIsRaging, // 273
gText_CantEscape2, // 274
gText_PkmnIgnoresAsleep, // 275
gText_PkmnIgnoredOrders, // 276
gText_PkmnBeganToNap, // 277
gText_PkmnLoafing, // 278
gText_PkmnWontObey, // 279
gText_PkmnTurnedAway, // 280
gText_PkmnPretendNotNotice, // 281
gText_EnemyAboutToSwitchPkmn, // 282
gText_CreptCloser, // 283
gText_CantGetCloser, // 284
gText_PkmnWatchingCarefully, // 285
gText_PkmnCuriousAboutX, // 286
gText_PkmnEnthralledByX, // 287
gText_PkmnIgnoredX, // 288
gText_ThrewPokeblockAtPkmn, // 289
gText_OutOfSafariBalls, // 290
gText_PkmnsItemCuredParalysis, // 291
gText_PkmnsItemCuredPoison, // 292
gText_PkmnsItemHealedBurn, // 293
gText_PkmnsItemDefrostedIt, // 294
gText_PkmnsItemWokeIt, // 295
gText_PkmnsItemSnappedOut, // 296
gText_PkmnsItemCuredProblem, // 297
gText_PkmnsItemRestoredHealth, // 298
gText_PkmnsItemRestoredPP, // 299
gText_PkmnsItemRestoredStatus, // 300
gText_PkmnsItemRestoredHPALittle, // 301
gText_ItemAllowsOnlyYMove, // 302
gText_PkmnHungOnWithX, // 303
gText_EmptyString3, // 304
gText_PkmnsXPreventsBurns, // 305
gText_PkmnsXBlocksY, // 306
gText_PkmnsXRestoredHPALittle2, // 307
gText_PkmnsXWhippedUpSandstorm, // 308
gText_PkmnsXPreventsYLoss, // 309
gText_PkmnsXInfatuatedY, // 310
gText_PkmnsXMadeYIneffective, // 311
gText_PkmnsXCuredYProblem, // 312
gText_ItSuckedLiquidOoze, // 313
gText_PkmnTransformed, // 314
gText_ElectricityWeakened, // 315
gText_FireWeakened, // 316
gText_PkmnHidUnderwater, // 317
gText_PkmnSprangUp, // 318
gText_HMMovesCantBeForgotten, // 319
gText_XFoundOneY, // 320
gText_PlayerDefeatedLinkTrainerTrainer1, // 321
gText_SoothingAroma, // 322
gText_ItemsCantBeUsedNow, // 323
gText_ForXCommaYZ, // 324
gText_UsingXTheYOfZN, // 325
gText_PkmnUsedXToGetPumped, // 326
gText_PkmnsXMadeYUseless, // 327
gText_PkmnTrappedBySandTomb, // 328
gText_EmptyString4, // 329
gText_ABoosted, // 330
gText_PkmnsXIntensifiedSun, // 331
gText_PkmnMakesGroundMiss, // 332
gText_YouThrowABallNowRight, // 333
gText_PkmnsXTookAttack, // 334
gText_PkmnChoseXAsDestiny, // 335
gText_PkmnLostFocus, // 336
gText_UseNextPkmn, // 337
gText_PkmnFledUsingIts, // 338
gText_PkmnFledUsing, // 339
gText_PkmnWasDraggedOut, // 340
gText_PreventedFromWorking, // 341
gText_PkmnsItemNormalizedStatus, // 342
gText_Trainer1UsedItem, // 343
gText_BoxIsFull, // 344
gText_PkmnAvoidedAttack, // 345
gText_PkmnsXMadeItIneffective, // 346
gText_PkmnsXPreventsFlinching, // 347
gText_PkmnAlreadyHasBurn, // 348
gText_StatsWontDecrease2, // 349
gText_PkmnsXBlocksY2, // 350
gText_PkmnsXWoreOff, // 351
gText_PkmnRaisedDefALittle, // 352
gText_PkmnRaisedSpDefALittle, // 353
gText_TheWallShattered, // 354
gText_PkmnsXPreventsYsZ, // 355
gText_PkmnsXCuredItsYProblem, // 356
gText_AttackerCantEscape, // 357
gText_PkmnObtainedX, // 358
gText_PkmnObtainedX2, // 359
gText_PkmnObtainedXYObtainedZ, // 360
gText_ButNoEffect, // 361
gText_PkmnsXHadNoEffectOnY, // 362
gText_TwoInGameTrainersDefeated, // 363
gText_Trainer2LoseText, // 364
gText_PkmnIncapableOfPower, // 365
gText_GlintAppearsInEye, // 366
gText_PkmnGettingIntoPosition, // 367
gText_PkmnBeganGrowlingDeeply, // 368
gText_PkmnEagerForMore, // 369
gText_DefeatedOpponentByReferee, // 370
gText_LostToOpponentByReferee, // 371
gText_TiedOpponentByReferee, // 372
gText_QuestionForfeitMatch, // 373
gText_ForfeitedMatch, // 374
gText_PkmnTransferredSomeonesPC, // 375
gText_PkmnTransferredLanettesPC, // 376
gText_PkmnBoxSomeonesPCFull, // 377
gText_PkmnBoxLanettesPCFull, // 378
gText_Trainer1WinText, // 379
gText_Trainer2WinText, // 380
};
const u16 gMissStringIds[] =

View File

@ -48,15 +48,6 @@ extern u16 gBattle_BG2_Y;
extern u16 gBattle_BG3_X;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
struct TrainerMoney
{
u8 classId;
u8 value;
};
extern const struct BattleMove gBattleMoves[];
extern const u8 gTypeEffectiveness[336];
extern const struct TrainerMoney gTrainerMoneyTable[];
extern const u8* const gBattleScriptsForMoveEffects[];
// functions
@ -4436,31 +4427,34 @@ static void atk47_setgraphicalstatchangevalues(void)
gBattlescriptCurrInstr++;
}
#ifdef NONMATCHING
static void atk48_playstatchangeanimation(void)
{
u32 currStat = 0;
s16 statAnimId = 0;
s16 checkingStatAnimId = 0;
s32 changeableStats = 0;
u32 statsToCheck = 0;
u16 statAnimId = 0;
s32 changeableStatsCount = 0;
u8 statsToCheck = 0;
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
statsToCheck = gBattlescriptCurrInstr[2];
if (gBattlescriptCurrInstr[3] & ATK48_STAT_NEGATIVE) // goes down
{
checkingStatAnimId = (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO) ? 0x2D : 0x15;
s16 startingStatAnimId;
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
startingStatAnimId = 0x2D;
else
startingStatAnimId = 0x15;
while (statsToCheck != 0)
{
if (statsToCheck & 1)
{
if (!(gBattlescriptCurrInstr[3] & ATK48_LOWER_FAIL_CHECK))
if (gBattlescriptCurrInstr[3] & ATK48_DONT_CHECK_LOWER)
{
if (gBattleMons[gActiveBattler].statStages[currStat] > 0)
{
statAnimId = checkingStatAnimId;
changeableStats++;
statAnimId = startingStatAnimId + currStat;
changeableStatsCount++;
}
}
else if (!gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer
@ -4471,15 +4465,15 @@ static void atk48_playstatchangeanimation(void)
{
if (gBattleMons[gActiveBattler].statStages[currStat] > 0)
{
statAnimId = checkingStatAnimId;
changeableStats++;
statAnimId = startingStatAnimId + currStat;
changeableStatsCount++;
}
}
}
statsToCheck >>= 1, checkingStatAnimId++, currStat++;
statsToCheck >>= 1, currStat++;
}
if (changeableStats > 1) // more than one stat, so the color is gray
if (changeableStatsCount > 1) // more than one stat, so the color is gray
{
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
statAnimId = 0x3A;
@ -4489,18 +4483,23 @@ static void atk48_playstatchangeanimation(void)
}
else // goes up
{
checkingStatAnimId = (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO) ? 0x26 : 0xE;
s16 startingStatAnimId;
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
startingStatAnimId = 0x26;
else
startingStatAnimId = 0xE;
while (statsToCheck != 0)
{
if (statsToCheck & 1 && gBattleMons[gActiveBattler].statStages[currStat] < 0xC)
{
statAnimId = checkingStatAnimId;
changeableStats++;
statAnimId = startingStatAnimId + currStat;
changeableStatsCount++;
}
statsToCheck >>= 1, checkingStatAnimId += 1, currStat++;
statsToCheck >>= 1, currStat++;
}
if (changeableStats > 1) // more than one stat, so the color is gray
if (changeableStatsCount > 1) // more than one stat, so the color is gray
{
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
statAnimId = 0x38;
@ -4509,15 +4508,15 @@ static void atk48_playstatchangeanimation(void)
}
}
if (gBattlescriptCurrInstr[3] & ATK48_BIT_x4 && changeableStats < 2)
if (gBattlescriptCurrInstr[3] & ATK48_BIT_x4 && changeableStatsCount < 2)
{
gBattlescriptCurrInstr += 4;
}
else if (changeableStats != 0 && gBattleScripting.field_1B == 0)
else if (changeableStatsCount != 0 && gBattleScripting.field_1B == 0)
{
BtlController_EmitBattleAnimation(0, B_ANIM_STATS_CHANGE, statAnimId);
MarkBattlerForControllerExec(gActiveBattler);
if (gBattlescriptCurrInstr[3] & ATK48_BIT_x4 && changeableStats > 1)
if (gBattlescriptCurrInstr[3] & ATK48_BIT_x4 && changeableStatsCount > 1)
gBattleScripting.field_1B = 1;
gBattlescriptCurrInstr += 4;
}
@ -4526,261 +4525,6 @@ static void atk48_playstatchangeanimation(void)
gBattlescriptCurrInstr += 4;
}
}
#else
ASM_DIRECT
static void atk48_playstatchangeanimation(void)
{
asm("\n\
.syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x4\n\
movs r7, 0\n\
movs r0, 0\n\
mov r8, r0\n\
movs r3, 0\n\
ldr r5, =gBattlescriptCurrInstr\n\
ldr r0, [r5]\n\
ldrb r0, [r0, 0x1]\n\
str r3, [sp]\n\
bl GetBattlerForBattleScript\n\
ldr r2, =gActiveBattler\n\
strb r0, [r2]\n\
ldr r0, [r5]\n\
ldrb r4, [r0, 0x2]\n\
ldrb r1, [r0, 0x3]\n\
movs r0, 0x1\n\
ands r0, r1\n\
ldr r3, [sp]\n\
cmp r0, 0\n\
beq _0804BAEC\n\
movs r0, 0x2\n\
ands r0, r1\n\
movs r1, 0x15\n\
cmp r0, 0\n\
beq _0804BA18\n\
movs r1, 0x2D\n\
_0804BA18:\n\
cmp r4, 0\n\
beq _0804BAC0\n\
movs r0, 0x1\n\
mov r10, r0\n\
ldr r0, =gBattleMons + 0x18\n\
mov r9, r0\n\
lsls r5, r1, 16\n\
_0804BA26:\n\
adds r0, r4, 0\n\
mov r1, r10\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _0804BAB2\n\
ldr r0, =gBattlescriptCurrInstr\n\
ldr r0, [r0]\n\
ldrb r1, [r0, 0x3]\n\
movs r0, 0x8\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _0804BA58\n\
ldr r0, =gActiveBattler\n\
ldrb r1, [r0]\n\
movs r0, 0x58\n\
muls r0, r1\n\
adds r0, r7, r0\n\
b _0804BAA0\n\
.pool\n\
_0804BA58:\n\
ldr r6, =gActiveBattler\n\
ldrb r0, [r6]\n\
str r3, [sp]\n\
bl GetBattlerPosition\n\
mov r1, r10\n\
ands r1, r0\n\
lsls r0, r1, 1\n\
adds r0, r1\n\
lsls r0, 2\n\
ldr r1, =gSideTimers\n\
adds r0, r1\n\
ldrb r0, [r0, 0x4]\n\
ldr r3, [sp]\n\
cmp r0, 0\n\
bne _0804BAB2\n\
ldr r0, =gBattleMons\n\
ldrb r2, [r6]\n\
movs r1, 0x58\n\
muls r2, r1\n\
adds r0, r2, r0\n\
adds r0, 0x20\n\
ldrb r0, [r0]\n\
cmp r0, 0x1D\n\
beq _0804BAB2\n\
cmp r0, 0x49\n\
beq _0804BAB2\n\
cmp r0, 0x33\n\
bne _0804BA96\n\
cmp r7, 0x6\n\
beq _0804BAB2\n\
_0804BA96:\n\
cmp r0, 0x34\n\
bne _0804BA9E\n\
cmp r7, 0x1\n\
beq _0804BAB2\n\
_0804BA9E:\n\
adds r0, r7, r2\n\
_0804BAA0:\n\
add r0, r9\n\
ldrb r0, [r0]\n\
lsls r0, 24\n\
asrs r0, 24\n\
cmp r0, 0\n\
ble _0804BAB2\n\
lsrs r0, r5, 16\n\
mov r8, r0\n\
adds r3, 0x1\n\
_0804BAB2:\n\
lsrs r4, 1\n\
movs r1, 0x80\n\
lsls r1, 9\n\
adds r5, r1\n\
adds r7, 0x1\n\
cmp r4, 0\n\
bne _0804BA26\n\
_0804BAC0:\n\
ldr r0, =gBattlescriptCurrInstr\n\
mov r9, r0\n\
cmp r3, 0x1\n\
ble _0804BB4E\n\
ldr r0, [r0]\n\
ldrb r1, [r0, 0x3]\n\
movs r0, 0x2\n\
ands r0, r1\n\
movs r1, 0x39\n\
mov r8, r1\n\
cmp r0, 0\n\
beq _0804BB4E\n\
movs r0, 0x3A\n\
b _0804BB4C\n\
.pool\n\
_0804BAEC:\n\
movs r0, 0x2\n\
ands r0, r1\n\
movs r1, 0xE\n\
cmp r0, 0\n\
beq _0804BAF8\n\
movs r1, 0x26\n\
_0804BAF8:\n\
mov r9, r5\n\
cmp r4, 0\n\
beq _0804BB34\n\
ldr r6, =gBattleMons + 0x18\n\
adds r5, r2, 0\n\
lsls r2, r1, 16\n\
_0804BB04:\n\
movs r0, 0x1\n\
ands r0, r4\n\
cmp r0, 0\n\
beq _0804BB26\n\
ldrb r1, [r5]\n\
movs r0, 0x58\n\
muls r0, r1\n\
adds r0, r7, r0\n\
adds r0, r6\n\
ldrb r0, [r0]\n\
lsls r0, 24\n\
asrs r0, 24\n\
cmp r0, 0xB\n\
bgt _0804BB26\n\
lsrs r1, r2, 16\n\
mov r8, r1\n\
adds r3, 0x1\n\
_0804BB26:\n\
lsrs r4, 1\n\
movs r0, 0x80\n\
lsls r0, 9\n\
adds r2, r0\n\
adds r7, 0x1\n\
cmp r4, 0\n\
bne _0804BB04\n\
_0804BB34:\n\
cmp r3, 0x1\n\
ble _0804BB4E\n\
mov r1, r9\n\
ldr r0, [r1]\n\
ldrb r1, [r0, 0x3]\n\
movs r0, 0x2\n\
ands r0, r1\n\
movs r1, 0x37\n\
mov r8, r1\n\
cmp r0, 0\n\
beq _0804BB4E\n\
movs r0, 0x38\n\
_0804BB4C:\n\
mov r8, r0\n\
_0804BB4E:\n\
mov r1, r9\n\
ldr r2, [r1]\n\
ldrb r1, [r2, 0x3]\n\
movs r0, 0x4\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _0804BB6C\n\
cmp r3, 0x1\n\
bgt _0804BB6C\n\
adds r0, r2, 0x4\n\
mov r1, r9\n\
b _0804BBBA\n\
.pool\n\
_0804BB6C:\n\
cmp r3, 0\n\
beq _0804BBB4\n\
ldr r4, =gBattleScripting\n\
ldrb r0, [r4, 0x1B]\n\
cmp r0, 0\n\
bne _0804BBB4\n\
movs r0, 0\n\
movs r1, 0x1\n\
mov r2, r8\n\
str r3, [sp]\n\
bl BtlController_EmitBattleAnimation\n\
ldr r0, =gActiveBattler\n\
ldrb r0, [r0]\n\
bl MarkBattlerForControllerExec\n\
ldr r0, =gBattlescriptCurrInstr\n\
ldr r0, [r0]\n\
ldrb r1, [r0, 0x3]\n\
movs r0, 0x4\n\
ands r0, r1\n\
ldr r3, [sp]\n\
cmp r0, 0\n\
beq _0804BBA4\n\
cmp r3, 0x1\n\
ble _0804BBA4\n\
movs r0, 0x1\n\
strb r0, [r4, 0x1B]\n\
_0804BBA4:\n\
ldr r1, =gBattlescriptCurrInstr\n\
b _0804BBB6\n\
.pool\n\
_0804BBB4:\n\
mov r1, r9\n\
_0804BBB6:\n\
ldr r0, [r1]\n\
adds r0, 0x4\n\
_0804BBBA:\n\
str r0, [r1]\n\
add sp, 0x4\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.syntax divided");
}
#endif // NONMATCHING
#define ATK49_LAST_CASE 17
@ -5271,10 +5015,9 @@ static void atk4E_switchinanim(void)
static void atk4F_jumpifcantswitch(void)
{
s32 val = 0;
s32 compareVar = 0;
struct Pokemon *party = NULL;
s32 r7 = 0;
s32 i;
s32 lastMonId;
struct Pokemon *party;
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(ATK4F_DONT_CHECK_STATUSES));
@ -5294,20 +5037,20 @@ static void atk4F_jumpifcantswitch(void)
else
party = gPlayerParty;
val = 0;
if (2 & gActiveBattler)
val = 3;
i = 0;
if (gActiveBattler & 2)
i = 3;
for (compareVar = val + 3; val < compareVar; val++)
for (lastMonId = i + 3; i < lastMonId; i++)
{
if (GetMonData(&party[val], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[val], MON_DATA_IS_EGG)
&& GetMonData(&party[val], MON_DATA_HP) != 0
&& gBattlerPartyIndexes[gActiveBattler] != val)
if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[i], MON_DATA_IS_EGG)
&& GetMonData(&party[i], MON_DATA_HP) != 0
&& gBattlerPartyIndexes[gActiveBattler] != i)
break;
}
if (val == compareVar)
if (i == lastMonId)
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 2);
else
gBattlescriptCurrInstr += 6;
@ -5320,18 +5063,18 @@ static void atk4F_jumpifcantswitch(void)
{
party = gPlayerParty;
val = 0;
i = 0;
if (sub_806D82C(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
val = 3;
i = 3;
}
else
{
party = gEnemyParty;
if (gActiveBattler == 1)
val = 0;
i = 0;
else
val = 3;
i = 3;
}
}
else
@ -5341,22 +5084,21 @@ static void atk4F_jumpifcantswitch(void)
else
party = gPlayerParty;
val = 0;
i = 0;
if (sub_806D82C(GetBattlerMultiplayerId(gActiveBattler)) == TRUE)
val = 3;
i = 3;
}
for (compareVar = val + 3; val < compareVar; val++)
for (lastMonId = i + 3; i < lastMonId; i++)
{
if (GetMonData(&party[val], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[val], MON_DATA_IS_EGG)
&& GetMonData(&party[val], MON_DATA_HP) != 0
&& gBattlerPartyIndexes[gActiveBattler] != val)
if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[i], MON_DATA_IS_EGG)
&& GetMonData(&party[i], MON_DATA_HP) != 0
&& gBattlerPartyIndexes[gActiveBattler] != i)
break;
}
if (val == compareVar)
if (i == lastMonId)
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 2);
else
gBattlescriptCurrInstr += 6;
@ -5365,58 +5107,61 @@ static void atk4F_jumpifcantswitch(void)
{
party = gEnemyParty;
val = 0;
if (gActiveBattler == 3)
val = 3;
i = 0;
if (gActiveBattler == B_POSITION_OPPONENT_RIGHT)
i = 3;
for (compareVar = val + 3; val < compareVar; val++)
for (lastMonId = i + 3; i < lastMonId; i++)
{
if (GetMonData(&party[val], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[val], MON_DATA_IS_EGG)
&& GetMonData(&party[val], MON_DATA_HP) != 0
&& gBattlerPartyIndexes[gActiveBattler] != val)
if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[i], MON_DATA_IS_EGG)
&& GetMonData(&party[i], MON_DATA_HP) != 0
&& gBattlerPartyIndexes[gActiveBattler] != i)
break;
}
if (val == compareVar)
if (i == lastMonId)
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 2);
else
gBattlescriptCurrInstr += 6;
}
else
{
u8 battlerIn1, battlerIn2;
if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT)
{
r7 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
battlerIn1 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
compareVar = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
battlerIn2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
else
compareVar = r7;
battlerIn2 = battlerIn1;
party = gEnemyParty;
}
else
{
r7 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
battlerIn1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
compareVar = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
battlerIn2 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
else
compareVar = r7;
battlerIn2 = battlerIn1;
party = gPlayerParty;
}
for (val = 0; val < 6; val++)
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&party[val], MON_DATA_HP) != 0
&& GetMonData(&party[val], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[val], MON_DATA_IS_EGG)
&& val != gBattlerPartyIndexes[r7] && val != gBattlerPartyIndexes[compareVar])
if (GetMonData(&party[i], MON_DATA_HP) != 0
&& GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[i], MON_DATA_IS_EGG)
&& i != gBattlerPartyIndexes[battlerIn1] && i != gBattlerPartyIndexes[battlerIn2])
break;
}
if (val == 6)
if (i == 6)
gBattlescriptCurrInstr = BSScriptReadPtr(gBattlescriptCurrInstr + 2);
else
gBattlescriptCurrInstr += 6;

View File

@ -31,6 +31,7 @@
#include "string_util.h"
#include "overworld.h"
#include "field_weather.h"
#include "gym_leader_rematch.h"
enum
{
@ -66,7 +67,6 @@ extern void Overworld_ClearSavedMusic(void);
extern void CB2_WhiteOut(void);
extern void sub_80AF6F0(void);
extern void PlayBattleBGM(void);
extern void sub_81DA57C(void);
extern u8 Overworld_GetFlashLevel(void);
extern u16 sub_81A9AA8(u8 localId);
extern u16 sub_81D6180(u8 localId);
@ -252,84 +252,84 @@ static const struct TrainerBattleParameter sTrainerBContinueScriptBattleParams[]
const struct RematchTrainer gRematchTable[REMATCH_TABLE_ENTRIES] =
{
{{0x0025, 0x0028, 0x0029, 0x002a, 0x002b}, 0x0000, 0x0021},
{{0x02e1, 0x032c, 0x032d, 0x032e, 0x032f}, 0x0000, 0x0014},
{{0x002c, 0x002f, 0x0030, 0x0031, 0x0032}, 0x0000, 0x001a},
{{0x0039, 0x003c, 0x003d, 0x003e, 0x003f}, 0x0000, 0x0018},
{{0x0040, 0x0043, 0x0044, 0x0045, 0x0046}, 0x0000, 0x0018},
{{0x02af, 0x02b0, 0x02b1, 0x02b2, 0x02b3}, 0x0000, 0x0027},
{{0x02ff, 0x033c, 0x033d, 0x033e, 0x033f}, 0x0000, 0x0024},
{{0x005e, 0x0065, 0x0066, 0x0067, 0x0068}, 0x0000, 0x001a},
{{0x004e, 0x0054, 0x0055, 0x0056, 0x0057}, 0x0000, 0x001a},
{{0x006c, 0x006e, 0x006f, 0x0070, 0x0071}, 0x0018, 0x0014},
{{0x0072, 0x0078, 0x0079, 0x007a, 0x007b}, 0x0000, 0x0013},
{{0x0090, 0x034c, 0x034d, 0x034e, 0x034f}, 0x0018, 0x0038},
{{0x007f, 0x0084, 0x0085, 0x0086, 0x0087}, 0x0000, 0x0024},
{{0x0088, 0x008b, 0x008c, 0x008d, 0x008e}, 0x0000, 0x0013},
{{0x008f, 0x0093, 0x0094, 0x0095, 0x0096}, 0x0000, 0x001d},
{{0x009b, 0x00af, 0x00b0, 0x00b1, 0x00b2}, 0x0000, 0x0016},
{{0x00b7, 0x00b8, 0x00b9, 0x00ba, 0x00bb}, 0x0000, 0x001e},
{{0x02a0, 0x0338, 0x0339, 0x033a, 0x033b}, 0x0000, 0x002a},
{{0x00c3, 0x0340, 0x0341, 0x0342, 0x0343}, 0x0000, 0x0026},
{{0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8}, 0x0000, 0x0021},
{{0x00ce, 0x00cf, 0x00d0, 0x00d1, 0x00d2}, 0x0000, 0x001d},
{{0x00d8, 0x00db, 0x00dc, 0x00dd, 0x00de}, 0x0018, 0x000d},
{{0x02a9, 0x02aa, 0x02ab, 0x02ac, 0x02ad}, 0x0018, 0x0001},
{{0x00e2, 0x00e4, 0x00e5, 0x00e6, 0x00e7}, 0x0000, 0x0023},
{{0x00ee, 0x00ef, 0x00f0, 0x00f1, 0x00f2}, 0x0000, 0x0026},
{{0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd}, 0x0000, 0x0026},
{{0x00fe, 0x0101, 0x0102, 0x0103, 0x0104}, 0x0000, 0x0024},
{{0x0118, 0x011a, 0x011b, 0x011c, 0x011d}, 0x0000, 0x001f},
{{0x0111, 0x0114, 0x0115, 0x0116, 0x0117}, 0x0000, 0x001f},
{{0x011f, 0x0120, 0x0121, 0x0122, 0x0123}, 0x0000, 0x0020},
{{0x012e, 0x012f, 0x0130, 0x0131, 0x0132}, 0x0000, 0x0019},
{{0x0125, 0x0127, 0x0128, 0x0129, 0x012a}, 0x0000, 0x0012},
{{0x0133, 0x0134, 0x0135, 0x0136, 0x0137}, 0x0000, 0x001e},
{{0x0139, 0x013a, 0x013b, 0x013c, 0x013d}, 0x0018, 0x000c},
{{0x013e, 0x0148, 0x0149, 0x014a, 0x014b}, 0x0000, 0x0011},
{{0x0153, 0x015a, 0x015b, 0x015c, 0x015d}, 0x0000, 0x0015},
{{0x0178, 0x017b, 0x017c, 0x017d, 0x017e}, 0x0000, 0x002b},
{{0x0171, 0x0172, 0x0173, 0x0174, 0x0175}, 0x0000, 0x0020},
{{0x0166, 0x0168, 0x0169, 0x016a, 0x016b}, 0x0000, 0x0019},
{{0x016c, 0x016d, 0x016e, 0x016f, 0x0170}, 0x0000, 0x0020},
{{0x0182, 0x0184, 0x0185, 0x0186, 0x0187}, 0x0000, 0x002b},
{{0x0161, 0x0162, 0x0163, 0x0164, 0x0165}, 0x0000, 0x0019},
{{0x0179, 0x0334, 0x0335, 0x0336, 0x0337}, 0x0000, 0x0029},
{{0x0188, 0x0189, 0x018a, 0x018b, 0x018c}, 0x0018, 0x0001},
{{0x0196, 0x0199, 0x019a, 0x019b, 0x019c}, 0x0000, 0x0023},
{{0x01a3, 0x01a5, 0x01a6, 0x01a7, 0x01a8}, 0x0000, 0x001c},
{{0x01ab, 0x01ae, 0x01af, 0x01b0, 0x01b1}, 0x0000, 0x001e},
{{0x01b2, 0x01b5, 0x01b6, 0x01b7, 0x01b8}, 0x0000, 0x001c},
{{0x01c1, 0x01d1, 0x01d2, 0x01d3, 0x01d4}, 0x0000, 0x0027},
{{0x01da, 0x01dd, 0x01de, 0x01df, 0x01e0}, 0x0018, 0x000d},
{{0x01e1, 0x01e2, 0x01e7, 0x01e8, 0x01e9}, 0x0000, 0x0012},
{{0x01ec, 0x01f1, 0x01f2, 0x01f3, 0x01f4}, 0x0000, 0x0028},
{{0x02e4, 0x0330, 0x0331, 0x0332, 0x0333}, 0x0000, 0x0017},
{{0x0200, 0x0203, 0x0204, 0x0205, 0x0206}, 0x0000, 0x0019},
{{0x0221, 0x0224, 0x0225, 0x0226, 0x0227}, 0x0000, 0x0020},
{{0x021a, 0x021d, 0x021e, 0x021f, 0x0220}, 0x0000, 0x0020},
{{0x0009, 0x0348, 0x0349, 0x034a, 0x034b}, 0x0018, 0x0011},
{{0x022f, 0x0232, 0x0233, 0x0234, 0x0235}, 0x0000, 0x0022},
{{0x0228, 0x022b, 0x022c, 0x022d, 0x022e}, 0x0000, 0x0022},
{{0x025c, 0x025f, 0x0260, 0x0261, 0x0262}, 0x0000, 0x0013},
{{0x026d, 0x026e, 0x026f, 0x0270, 0x0271}, 0x0018, 0x000b},
{{0x0273, 0x027c, 0x027d, 0x027e, 0x027f}, 0x0000, 0x001b},
{{0x0001, 0x0344, 0x0345, 0x0346, 0x0347}, 0x0018, 0x000c},
{{0x0282, 0x0283, 0x0284, 0x0285, 0x0286}, 0x0018, 0x003e},
{{0x0291, 0x0292, 0x0293, 0x0294, 0x0294}, 0x0018, 0x002b},
{{0x0109, 0x0302, 0x0303, 0x0304, 0x0305}, 0x0000, 0x0003},
{{0x010a, 0x0306, 0x0307, 0x0308, 0x0309}, 0x0000, 0x000b},
{{0x010b, 0x030a, 0x030b, 0x030c, 0x030d}, 0x0000, 0x0002},
{{0x010c, 0x030e, 0x030f, 0x0310, 0x0311}, 0x0000, 0x000c},
{{0x010d, 0x0312, 0x0313, 0x0314, 0x0315}, 0x0000, 0x0000},
{{0x010e, 0x0316, 0x0317, 0x0318, 0x0319}, 0x0000, 0x0004},
{{0x010f, 0x031a, 0x031b, 0x031c, 0x031d}, 0x0000, 0x0006},
{{0x0110, 0x031e, 0x031f, 0x0320, 0x0321}, 0x0000, 0x0007},
{{0x0105, 0x0105, 0x0105, 0x0105, 0x0105}, 0x0000, 0x0008},
{{0x0106, 0x0106, 0x0106, 0x0106, 0x0106}, 0x0000, 0x0008},
{{0x0107, 0x0107, 0x0107, 0x0107, 0x0107}, 0x0000, 0x0008},
{{0x0108, 0x0108, 0x0108, 0x0108, 0x0108}, 0x0000, 0x0008},
{{0x014f, 0x014f, 0x014f, 0x014f, 0x014f}, 0x0000, 0x0008},
{{TRAINER_ROSE_1, TRAINER_ROSE_2, TRAINER_ROSE_3, TRAINER_ROSE_4, TRAINER_ROSE_5}, 0x0, 0x21},
{{TRAINER_ANDRES_1, TRAINER_ANDRES_2, TRAINER_ANDRES_3, TRAINER_ANDRES_4, TRAINER_ANDRES_5}, 0x0, 0x14},
{{TRAINER_DUSTY_1, TRAINER_DUSTY_2, TRAINER_DUSTY_3, TRAINER_DUSTY_4, TRAINER_DUSTY_5}, 0x0, 0x1a},
{{TRAINER_LOLA_1, TRAINER_LOLA_2, TRAINER_LOLA_3, TRAINER_LOLA_4, TRAINER_LOLA_5}, 0x0, 0x18},
{{TRAINER_RICKY_1, TRAINER_RICKY_2, TRAINER_RICKY_3, TRAINER_RICKY_4, TRAINER_RICKY_5}, 0x0, 0x18},
{{TRAINER_LILA_AND_ROY_1, TRAINER_LILA_AND_ROY_2, TRAINER_LILA_AND_ROY_3, TRAINER_LILA_AND_ROY_4, TRAINER_LILA_AND_ROY_5}, 0x0, 0x27},
{{TRAINER_CRISTIN_1, TRAINER_CRISTIN_2, TRAINER_CRISTIN_3, TRAINER_CRISTIN_4, TRAINER_CRISTIN_5}, 0x0, 0x24},
{{TRAINER_BROOKE_1, TRAINER_BROOKE_2, TRAINER_BROOKE_3, TRAINER_BROOKE_4, TRAINER_BROOKE_5}, 0x0, 0x1a},
{{TRAINER_WILTON_1, TRAINER_WILTON_2, TRAINER_WILTON_3, TRAINER_WILTON_4, TRAINER_WILTON_5}, 0x0, 0x1a},
{{TRAINER_VALERIE_1, TRAINER_VALERIE_2, TRAINER_VALERIE_3, TRAINER_VALERIE_4, TRAINER_VALERIE_5}, 0x18, 0x14},
{{TRAINER_CINDY_1, TRAINER_CINDY_3, TRAINER_CINDY_4, TRAINER_CINDY_5, TRAINER_CINDY_6}, 0x0, 0x13},
{{TRAINER_THALIA_1, TRAINER_THALIA_2, TRAINER_THALIA_3, TRAINER_THALIA_4, TRAINER_THALIA_5}, 0x18, 0x38},
{{TRAINER_JESSICA_1, TRAINER_JESSICA_2, TRAINER_JESSICA_3, TRAINER_JESSICA_4, TRAINER_JESSICA_5}, 0x0, 0x24},
{{TRAINER_WINSTON_1, TRAINER_WINSTON_2, TRAINER_WINSTON_3, TRAINER_WINSTON_4, TRAINER_WINSTON_5}, 0x0, 0x13},
{{TRAINER_STEVE_1, TRAINER_STEVE_2, TRAINER_STEVE_3, TRAINER_STEVE_4, TRAINER_STEVE_5}, 0x0, 0x1d},
{{TRAINER_TONY_1, TRAINER_TONY_2, TRAINER_TONY_3, TRAINER_TONY_4, TRAINER_TONY_5}, 0x0, 0x16},
{{TRAINER_NOB_1, TRAINER_NOB_2, TRAINER_NOB_3, TRAINER_NOB_4, TRAINER_NOB_5}, 0x0, 0x1e},
{{TRAINER_KOJI_1, TRAINER_KOJI_2, TRAINER_KOJI_3, TRAINER_KOJI_4, TRAINER_KOJI_5}, 0x0, 0x2a},
{{TRAINER_FERNANDO_1, TRAINER_FERNANDO_2, TRAINER_FERNANDO_3, TRAINER_FERNANDO_4, TRAINER_FERNANDO_5}, 0x0, 0x26},
{{TRAINER_DALTON_1, TRAINER_DALTON_2, TRAINER_DALTON_3, TRAINER_DALTON_4, TRAINER_DALTON_5}, 0x0, 0x21},
{{TRAINER_BERNIE_1, TRAINER_BERNIE_2, TRAINER_BERNIE_3, TRAINER_BERNIE_4, TRAINER_BERNIE_5}, 0x0, 0x1d},
{{TRAINER_ETHAN_1, TRAINER_ETHAN_2, TRAINER_ETHAN_3, TRAINER_ETHAN_4, TRAINER_ETHAN_5}, 0x18, 0xd},
{{TRAINER_JOHN_AND_JAY_1, TRAINER_JOHN_AND_JAY_2, TRAINER_JOHN_AND_JAY_3, TRAINER_JOHN_AND_JAY_4, TRAINER_JOHN_AND_JAY_5}, 0x18, 0x1},
{{TRAINER_JEFFREY_1, TRAINER_JEFFREY_2, TRAINER_JEFFREY_3, TRAINER_JEFFREY_4, TRAINER_JEFFREY_5}, 0x0, 0x23},
{{TRAINER_CAMERON_1, TRAINER_CAMERON_2, TRAINER_CAMERON_3, TRAINER_CAMERON_4, TRAINER_CAMERON_5}, 0x0, 0x26},
{{TRAINER_JACKI_1, TRAINER_JACKI_2, TRAINER_JACKI_3, TRAINER_JACKI_4, TRAINER_JACKI_5}, 0x0, 0x26},
{{TRAINER_WALTER_1, TRAINER_WALTER_2, TRAINER_WALTER_3, TRAINER_WALTER_4, TRAINER_WALTER_5}, 0x0, 0x24},
{{TRAINER_KAREN_1, TRAINER_KAREN_2, TRAINER_KAREN_3, TRAINER_KAREN_4, TRAINER_KAREN_5}, 0x0, 0x1f},
{{TRAINER_JERRY_1, TRAINER_JERRY_2, TRAINER_JERRY_3, TRAINER_JERRY_4, TRAINER_JERRY_5}, 0x0, 0x1f},
{{TRAINER_ANNA_AND_MEG_1, TRAINER_ANNA_AND_MEG_2, TRAINER_ANNA_AND_MEG_3, TRAINER_ANNA_AND_MEG_4, TRAINER_ANNA_AND_MEG_5}, 0x0, 0x20},
{{TRAINER_ISABEL_1, TRAINER_ISABEL_2, TRAINER_ISABEL_3, TRAINER_ISABEL_4, TRAINER_ISABEL_5}, 0x0, 0x19},
{{TRAINER_MIGUEL_1, TRAINER_MIGUEL_2, TRAINER_MIGUEL_3, TRAINER_MIGUEL_4, TRAINER_MIGUEL_5}, 0x0, 0x12},
{{TRAINER_TIMOTHY_1, TRAINER_TIMOTHY_2, TRAINER_TIMOTHY_3, TRAINER_TIMOTHY_4, TRAINER_TIMOTHY_5}, 0x0, 0x1e},
{{TRAINER_SHELBY_1, TRAINER_SHELBY_2, TRAINER_SHELBY_3, TRAINER_SHELBY_4, TRAINER_SHELBY_5}, 0x18, 0xc},
{{TRAINER_CALVIN_1, TRAINER_CALVIN_2, TRAINER_CALVIN_3, TRAINER_CALVIN_4, TRAINER_CALVIN_5}, 0x0, 0x11},
{{TRAINER_ELLIOT_1, TRAINER_ELLIOT_2, TRAINER_ELLIOT_3, TRAINER_ELLIOT_4, TRAINER_ELLIOT_5}, 0x0, 0x15},
{{TRAINER_ISAIAH_1, TRAINER_ISAIAH_2, TRAINER_ISAIAH_3, TRAINER_ISAIAH_4, TRAINER_ISAIAH_5}, 0x0, 0x2b},
{{TRAINER_MARIA_1, TRAINER_MARIA_2, TRAINER_MARIA_3, TRAINER_MARIA_4, TRAINER_MARIA_5}, 0x0, 0x20},
{{TRAINER_ABIGAIL_1, TRAINER_ABIGAIL_2, TRAINER_ABIGAIL_3, TRAINER_ABIGAIL_4, TRAINER_ABIGAIL_5}, 0x0, 0x19},
{{TRAINER_DYLAN_1, TRAINER_DYLAN_2, TRAINER_DYLAN_3, TRAINER_DYLAN_4, TRAINER_DYLAN_5}, 0x0, 0x20},
{{TRAINER_KATELYN_1, TRAINER_KATELYN_2, TRAINER_KATELYN_3, TRAINER_KATELYN_4, TRAINER_KATELYN_5}, 0x0, 0x2b},
{{TRAINER_BENJAMIN_1, TRAINER_BENJAMIN_2, TRAINER_BENJAMIN_3, TRAINER_BENJAMIN_4, TRAINER_BENJAMIN_5}, 0x0, 0x19},
{{TRAINER_PABLO_1, TRAINER_PABLO_2, TRAINER_PABLO_3, TRAINER_PABLO_4, TRAINER_PABLO_5}, 0x0, 0x29},
{{TRAINER_NICOLAS_1, TRAINER_NICOLAS_2, TRAINER_NICOLAS_3, TRAINER_NICOLAS_4, TRAINER_NICOLAS_5}, 0x18, 0x1},
{{TRAINER_ROBERT_1, TRAINER_ROBERT_2, TRAINER_ROBERT_3, TRAINER_ROBERT_4, TRAINER_ROBERT_5}, 0x0, 0x23},
{{TRAINER_LAO_1, TRAINER_LAO_2, TRAINER_LAO_3, TRAINER_LAO_4, TRAINER_LAO_5}, 0x0, 0x1c},
{{TRAINER_CYNDY_1, TRAINER_CYNDY_2, TRAINER_CYNDY_3, TRAINER_CYNDY_4, TRAINER_CYNDY_5}, 0x0, 0x1e},
{{TRAINER_MADELINE_1, TRAINER_MADELINE_2, TRAINER_MADELINE_3, TRAINER_MADELINE_4, TRAINER_MADELINE_5}, 0x0, 0x1c},
{{TRAINER_JENNY_1, TRAINER_JENNY_2, TRAINER_JENNY_3, TRAINER_JENNY_4, TRAINER_JENNY_5}, 0x0, 0x27},
{{TRAINER_DIANA_1, TRAINER_DIANA_2, TRAINER_DIANA_3, TRAINER_DIANA_4, TRAINER_DIANA_5}, 0x18, 0xd},
{{TRAINER_AMY_AND_LIV_1, TRAINER_AMY_AND_LIV_2, TRAINER_AMY_AND_LIV_4, TRAINER_AMY_AND_LIV_5, TRAINER_AMY_AND_LIV_6}, 0x0, 0x12},
{{TRAINER_ERNEST_1, TRAINER_ERNEST_2, TRAINER_ERNEST_3, TRAINER_ERNEST_4, TRAINER_ERNEST_5}, 0x0, 0x28},
{{TRAINER_CORY_1, TRAINER_CORY_2, TRAINER_CORY_3, TRAINER_CORY_4, TRAINER_CORY_5}, 0x0, 0x17},
{{TRAINER_EDWIN_1, TRAINER_EDWIN_2, TRAINER_EDWIN_3, TRAINER_EDWIN_4, TRAINER_EDWIN_5}, 0x0, 0x19},
{{TRAINER_LYDIA_1, TRAINER_LYDIA_2, TRAINER_LYDIA_3, TRAINER_LYDIA_4, TRAINER_LYDIA_5}, 0x0, 0x20},
{{TRAINER_ISAAC_1, TRAINER_ISAAC_2, TRAINER_ISAAC_3, TRAINER_ISAAC_4, TRAINER_ISAAC_5}, 0x0, 0x20},
{{TRAINER_GABRIELLE_1, TRAINER_GABRIELLE_2, TRAINER_GABRIELLE_3, TRAINER_GABRIELLE_4, TRAINER_GABRIELLE_5}, 0x18, 0x11},
{{TRAINER_CATHERINE_1, TRAINER_CATHERINE_2, TRAINER_CATHERINE_3, TRAINER_CATHERINE_4, TRAINER_CATHERINE_5}, 0x0, 0x22},
{{TRAINER_JACKSON_1, TRAINER_JACKSON_2, TRAINER_JACKSON_3, TRAINER_JACKSON_4, TRAINER_JACKSON_5}, 0x0, 0x22},
{{TRAINER_HALEY_1, TRAINER_HALEY_2, TRAINER_HALEY_3, TRAINER_HALEY_4, TRAINER_HALEY_5}, 0x0, 0x13},
{{TRAINER_JAMES_1, TRAINER_JAMES_2, TRAINER_JAMES_3, TRAINER_JAMES_4, TRAINER_JAMES_5}, 0x18, 0xb},
{{TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, 0x0, 0x1b},
{{TRAINER_SAWYER_1, TRAINER_SAWYER_2, TRAINER_SAWYER_3, TRAINER_SAWYER_4, TRAINER_SAWYER_5}, 0x18, 0xc},
{{TRAINER_KIRA_AND_DAN_1, TRAINER_KIRA_AND_DAN_2, TRAINER_KIRA_AND_DAN_3, TRAINER_KIRA_AND_DAN_4, TRAINER_KIRA_AND_DAN_5}, 0x18, 0x3e},
{{TRAINER_WALLY_3, 0x292, 0x293, 0x294, 0x294}, 0x18, 0x2b},
{{TRAINER_ROXANNE_1, TRAINER_ROXANNE_2, TRAINER_ROXANNE_3, TRAINER_ROXANNE_4, TRAINER_ROXANNE_5}, 0x0, 0x3},
{{TRAINER_BRAWLY_1, TRAINER_BRAWLY_2, TRAINER_BRAWLY_3, TRAINER_BRAWLY_4, TRAINER_BRAWLY_5}, 0x0, 0xb},
{{TRAINER_WATTSON_1, TRAINER_WATTSON_2, TRAINER_WATTSON_3, TRAINER_WATTSON_4, TRAINER_WATTSON_5}, 0x0, 0x2},
{{TRAINER_FLANNERY_1, TRAINER_FLANNERY_2, TRAINER_FLANNERY_3, TRAINER_FLANNERY_4, TRAINER_FLANNERY_5}, 0x0, 0xc},
{{TRAINER_NORMAN_1, TRAINER_NORMAN_2, TRAINER_NORMAN_3, TRAINER_NORMAN_4, TRAINER_NORMAN_5}, 0x0, 0x0},
{{TRAINER_WINONA_1, TRAINER_WINONA_2, TRAINER_WINONA_3, TRAINER_WINONA_4, TRAINER_WINONA_5}, 0x0, 0x4},
{{TRAINER_TATE_AND_LIZA_1, TRAINER_TATE_AND_LIZA_2, TRAINER_TATE_AND_LIZA_3, TRAINER_TATE_AND_LIZA_4, TRAINER_TATE_AND_LIZA_5}, 0x0, 0x6},
{{TRAINER_JUAN_1, TRAINER_JUAN_2, TRAINER_JUAN_3, TRAINER_JUAN_4, TRAINER_JUAN_5}, 0x0, 0x7},
{{TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY}, 0x0, 0x8},
{{TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE}, 0x0, 0x8},
{{TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA}, 0x0, 0x8},
{{TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE}, 0x0, 0x8},
{{TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE}, 0x0, 0x8},
};
static const u16 sBadgeFlags[8] =
@ -945,13 +945,13 @@ static void CB2_EndFirstBattle(void)
static void sub_80B1218(void)
{
if (GetGameStat(GAME_STAT_WILD_BATTLES) % 60 == 0)
sub_81DA57C();
UpdateGymLeaderRematch();
}
static void sub_80B1234(void)
{
if (GetGameStat(GAME_STAT_TRAINER_BATTLES) % 20 == 0)
sub_81DA57C();
UpdateGymLeaderRematch();
}
// why not just use the macros? maybe its because they didnt want to uncast const every time?

1576
src/battle_tv.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,6 @@
#include "link.h"
#include "berry.h"
extern const struct BattleMove gBattleMoves[];
extern u8 weather_get_current(void);
@ -3255,8 +3254,8 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget)
else
targetBank = GetBattlerAtPosition((GetBattlerPosition(gBattlerAttacker) & BIT_SIDE) ^ BIT_SIDE);
break;
case MOVE_TARGET_USER_OR_SELECTED:
case MOVE_TARGET_USER:
case MOVE_TARGET_x10:
targetBank = gBattlerAttacker;
break;
}

209
src/blit.c Normal file
View File

@ -0,0 +1,209 @@
#include "global.h"
#include "blit.h"
void BlitBitmapRect4BitWithoutColorKey(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height)
{
BlitBitmapRect4Bit(src, dst, srcX, srcY, dstX, dstY, width, height, 0xFF);
}
void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey)
{
s32 xEnd;
s32 yEnd;
s32 multiplierSrcY;
s32 multiplierDstY;
s32 loopSrcY, loopDstY;
s32 loopSrcX, loopDstX;
u8 *pixelsSrc;
u8 *pixelsDst;
s32 toOrr;
s32 toAnd;
s32 toShift;
if (dst->width - dstX < width)
xEnd = (dst->width - dstX) + srcX;
else
xEnd = srcX + width;
if (dst->height - dstY < height)
yEnd = (dst->height - dstY) + srcY;
else
yEnd = height + srcY;
multiplierSrcY = (src->width + (src->width & 7)) >> 3;
multiplierDstY = (dst->width + (dst->width & 7)) >> 3;
if (colorKey == 0xFF)
{
for (loopSrcY = srcY, loopDstY = dstY; loopSrcY < yEnd; loopSrcY++, loopDstY++)
{
for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++)
{
pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1B);
pixelsDst = dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + (((loopDstY >> 3) * multiplierDstY) << 5) + ((u32)(loopDstY << 0x1d) >> 0x1B);
toOrr = ((*pixelsSrc >> ((loopSrcX & 1) << 2)) & 0xF);
toShift = ((loopDstX & 1) << 2);
toOrr <<= toShift;
toAnd = 0xF0 >> (toShift);
*pixelsDst = toOrr | (*pixelsDst & toAnd);
}
}
}
else
{
for (loopSrcY = srcY, loopDstY = dstY; loopSrcY < yEnd; loopSrcY++, loopDstY++)
{
for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++)
{
pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1B);
pixelsDst = dst->pixels + ((loopDstX >> 1) & 3) + ((loopDstX >> 3) << 5) + (((loopDstY >> 3) * multiplierDstY) << 5) + ((u32)(loopDstY << 0x1d) >> 0x1B);
toOrr = ((*pixelsSrc >> ((loopSrcX & 1) << 2)) & 0xF);
if (toOrr != colorKey)
{
toShift = ((loopDstX & 1) << 2);
toOrr <<= toShift;
toAnd = 0xF0 >> (toShift);
*pixelsDst = toOrr | (*pixelsDst & toAnd);
}
}
}
}
}
void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue)
{
s32 xEnd;
s32 yEnd;
s32 multiplierY;
s32 loopX, loopY;
s32 toOrr1, toOrr2;
xEnd = x + width;
if (xEnd > surface->width)
xEnd = surface->width;
yEnd = y + height;
if (yEnd > surface->height)
yEnd = surface->height;
multiplierY = (surface->width + (surface->width & 7)) >> 3;
toOrr1 = (u32)(fillValue << 0x1C) >> 0x18;
toOrr2 = (fillValue & 0xF);
for (loopY = y; loopY < yEnd; loopY++)
{
for (loopX = x; loopX < xEnd; loopX++)
{
u8 *pixels = surface->pixels + ((loopX >> 1) & 3) + ((loopX >> 3) << 5) + (((loopY >> 3) * multiplierY) << 5) + ((u32)(loopY << 0x1d) >> 0x1B);
if ((loopX << 0x1F) != 0)
*pixels = toOrr1 | (*pixels & 0xF);
else
*pixels = toOrr2 | (*pixels & 0xF0);
}
}
}
void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey, u8 paletteOffset)
{
s32 palOffsetBits;
s32 xEnd;
s32 yEnd;
s32 multiplierSrcY;
s32 multiplierDstY;
s32 loopSrcY, loopDstY;
s32 loopSrcX, loopDstX;
u8 *pixelsSrc;
u8 *pixelsDst;
s32 colorKeyBits;
palOffsetBits = (u32)(paletteOffset << 0x1C) >> 0x18;
colorKeyBits = (u32)(colorKey << 0x1C) >> 0x18;
if (dst->width - dstX < width)
xEnd = (dst->width - dstX) + srcX;
else
xEnd = width + srcX;
if (dst->height - dstY < height)
yEnd = (srcY + dst->height) - dstY;
else
yEnd = srcY + height;
multiplierSrcY = (src->width + (src->width & 7)) >> 3;
multiplierDstY = (dst->width + (dst->width & 7)) >> 3;
if (colorKey == 0xFF)
{
for (loopSrcY = srcY, loopDstY = dstY; loopSrcY < yEnd; loopSrcY++, loopDstY++)
{
pixelsSrc = src->pixels + ((srcX >> 1) & 3) + ((srcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1b);
for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++)
{
pixelsDst = dst->pixels + (loopDstX & 7) + ((loopDstX >> 3) << 6) + (((loopDstY >> 3) * multiplierDstY) << 6) + ((u32)(loopDstY << 0x1d) >> 0x1a);
if (loopSrcX & 1)
{
*pixelsDst = palOffsetBits + (*pixelsSrc >> 4);
}
else
{
pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1b);
*pixelsDst = palOffsetBits + (*pixelsSrc & 0xF);
}
}
}
}
else
{
for (loopSrcY = srcY, loopDstY = dstY; loopSrcY < yEnd; loopSrcY++, loopDstY++)
{
pixelsSrc = src->pixels + ((srcX >> 1) & 3) + ((srcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1b);
for (loopSrcX = srcX, loopDstX = dstX; loopSrcX < xEnd; loopSrcX++, loopDstX++)
{
if (loopSrcX & 1)
{
if ((*pixelsSrc & 0xF0) != colorKeyBits)
{
pixelsDst = dst->pixels + (loopDstX & 7) + ((loopDstX >> 3) << 6) + (((loopDstY >> 3) * multiplierDstY) << 6) + ((u32)(loopDstY << 0x1d) >> 0x1a);
*pixelsDst = palOffsetBits + (*pixelsSrc >> 4);
}
}
else
{
pixelsSrc = src->pixels + ((loopSrcX >> 1) & 3) + ((loopSrcX >> 3) << 5) + (((loopSrcY >> 3) * multiplierSrcY) << 5) + ((u32)(loopSrcY << 0x1d) >> 0x1b);
if ((*pixelsSrc & 0xF) != colorKey)
{
pixelsDst = dst->pixels + (loopDstX & 7) + ((loopDstX >> 3) << 6) + (((loopDstY >> 3) * multiplierDstY) << 6) + ((u32)(loopDstY << 0x1d) >> 0x1a);
*pixelsDst = palOffsetBits + (*pixelsSrc & 0xF);
}
}
}
}
}
}
void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue)
{
s32 xEnd;
s32 yEnd;
s32 multiplierY;
s32 loopX, loopY;
xEnd = x + width;
if (xEnd > surface->width)
xEnd = surface->width;
yEnd = y + height;
if (yEnd > surface->height)
yEnd = surface->height;
multiplierY = (surface->width + (surface->width & 7)) >> 3;
for (loopY = y; loopY < yEnd; loopY++)
{
for (loopX = x; loopX < xEnd; loopX++)
{
u8 *pixels = surface->pixels + (loopX & 7) + ((loopX >> 3) << 6) + (((loopY >> 3) * multiplierY) << 6) + ((u32)(loopY << 0x1d) >> 0x1a);
*pixels = fillValue;
}
}
}

367
src/fldeff_flash.c Normal file
View File

@ -0,0 +1,367 @@
#include "global.h"
#include "constants/songs.h"
#include "braille_puzzles.h"
#include "event_data.h"
#include "event_scripts.h"
#include "field_effect.h"
#include "gpu_regs.h"
#include "gba/io_reg.h"
#include "main.h"
#include "palette.h"
#include "party_menu.h"
#include "overworld.h"
#include "rom6.h"
#include "script.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
// structures
struct FlashStruct
{
u8 unk0;
u8 unk1;
bool8 unk2;
bool8 unk3;
void (*func)(void);
};
// static functions
static void hm2_flash(void);
static void sub_81371B4(void);
static bool8 sub_8137304(void);
static void sub_81373F0(void);
static void sub_8137404(u8 taskId);
static void sub_8137420(u8 taskId);
static void sub_81374C4(u8 taskId);
static void sub_813750C(u8 taskId);
static void sub_8137574(u8 taskId);
static void sub_81375A8(void);
static void sub_81375BC(u8 taskId);
static void sub_81375D8(u8 taskId);
static void sub_8137678(u8 taskId);
static void sub_81376DC(u8 taskId);
// rodata
static const struct FlashStruct gUnknown_085B27C8[] =
{
{1, 4, 1, 0, sub_81375A8},
{2, 4, 1, 0, sub_81375A8},
{3, 4, 1, 0, sub_81375A8},
{5, 4, 1, 0, sub_81375A8},
{6, 4, 1, 0, sub_81375A8},
{7, 4, 1, 0, sub_81375A8},
{8, 4, 1, 0, sub_81375A8},
{9, 4, 1, 0, sub_81375A8},
{4, 1, 0, 1, sub_81373F0},
{4, 2, 0, 1, sub_81373F0},
{4, 3, 0, 1, sub_81373F0},
{4, 5, 0, 1, sub_81373F0},
{4, 6, 0, 1, sub_81373F0},
{4, 7, 0, 1, sub_81373F0},
{4, 8, 0, 1, sub_81373F0},
{4, 9, 0, 1, sub_81373F0},
{0, 0, 0, 0, NULL},
};
static const u16 gCaveTransitionPalette_White[] = INCBIN_U16("graphics/misc/cave_transition_white.gbapal");
static const u16 gCaveTransitionPalette_Black[] = INCBIN_U16("graphics/misc/cave_transition_black.gbapal");
static const u16 gUnknown_085B2890[] = INCBIN_U16("graphics/misc/85B2890.gbapal");
static const u16 gUnknown_085B28A0[] = INCBIN_U16("graphics/misc/85B28A0.gbapal");
static const u16 gCaveTransitionTilemap[] = INCBIN_U16("graphics/misc/cave_transition_map.bin.lz");
static const u8 gCaveTransitionTiles[] = INCBIN_U8("graphics/misc/cave_transition.4bpp.lz");
// text
bool8 SetUpFieldMove_Flash(void)
{
if (ShouldDoBrailleFlyEffect())
{
gSpecialVar_Result = GetCursorSelectionMonId();
gUnknown_03005DB0 = FieldCallback_Teleport;
gUnknown_0203CEEC = sub_8179918;
return TRUE;
}
else if (gMapHeader.cave == TRUE && !FlagGet(FLAG_SYS_USE_FLASH))
{
gUnknown_03005DB0 = FieldCallback_Teleport;
gUnknown_0203CEEC = hm2_flash;
return TRUE;
}
return FALSE;
}
static void hm2_flash(void)
{
u8 taskId = oei_task_add();
gFieldEffectArguments[0] = GetCursorSelectionMonId();
gTasks[taskId].data[8] = (uintptr_t)sub_81371B4 >> 16;
gTasks[taskId].data[9] = (uintptr_t)sub_81371B4;
}
static void sub_81371B4(void)
{
PlaySE(SE_W115);
FlagSet(FLAG_SYS_USE_FLASH);
ScriptContext1_SetupScript(EventScript_2926F8);
}
static void sub_81371D4(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
static void sub_81371EC(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
void c2_change_map(void)
{
u16 ime;
SetVBlankCallback(NULL);
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
DmaFill16(3, 0, (void *)VRAM, VRAM_SIZE);
DmaFill32(3, 0, (void *)OAM, OAM_SIZE);
DmaFill16(3, 0, (void *)(PLTT + 2), PLTT_SIZE - 2);
ResetPaletteFade();
ResetTasks();
ResetSpriteData();
ime = REG_IME;
REG_IME = 0;
REG_IE |= INTR_FLAG_VBLANK;
REG_IME = ime;
SetVBlankCallback(sub_81371EC);
SetMainCallback2(sub_81371D4);
if (!sub_8137304())
SetMainCallback2(gMain.savedCallback);
}
static bool8 sub_8137304(void)
{
u8 i;
u8 v0 = get_map_light_from_warp0();
u8 v1 = Overworld_GetMapTypeOfSaveblockLocation();
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
{
if (gUnknown_085B27C8[i].unk0 == v0 && gUnknown_085B27C8[i].unk1 == v1)
{
gUnknown_085B27C8[i].func();
return TRUE;
}
}
return FALSE;
}
bool8 sub_8137360(u8 a1, u8 a2)
{
u8 i;
u8 v0 = a1;
u8 v1 = a2;
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
{
if (gUnknown_085B27C8[i].unk0 == v0 && gUnknown_085B27C8[i].unk1 == v1)
{
return gUnknown_085B27C8[i].unk2;
}
}
return FALSE;
}
bool8 fade_type_for_given_maplight_pair(u8 a1, u8 a2)
{
u8 i;
u8 v0 = a1;
u8 v1 = a2;
for (i = 0; gUnknown_085B27C8[i].unk0; i++)
{
if (gUnknown_085B27C8[i].unk0 == v0 && gUnknown_085B27C8[i].unk1 == v1)
{
return gUnknown_085B27C8[i].unk3;
}
}
return FALSE;
}
static void sub_81373F0(void)
{
CreateTask(sub_8137404, 0);
}
static void sub_8137404(u8 taskId)
{
gTasks[taskId].func = sub_8137420;
}
static void sub_8137420(u8 taskId)
{
SetGpuReg(REG_OFFSET_DISPCNT, 0);
LZ77UnCompVram(gCaveTransitionTiles, (void *)0x600C000);
LZ77UnCompVram(gCaveTransitionTilemap, (void *)0x600F800);
LoadPalette(gCaveTransitionPalette_White, 0xE0, 0x20);
LoadPalette(gUnknown_085B28A0, 0xE0, 0x10);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0
| BLDCNT_EFFECT_BLEND
| BLDCNT_TGT2_BG1
| BLDCNT_TGT2_BG2
| BLDCNT_TGT2_BG3
| BLDCNT_TGT2_OBJ
| BLDCNT_TGT2_BD);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0)
| BGCNT_CHARBASE(3)
| BGCNT_SCREENBASE(31)
| BGCNT_16COLOR
| BGCNT_TXT256x256);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
| DISPCNT_OBJ_1D_MAP
| DISPCNT_BG0_ON
| DISPCNT_OBJ_ON);
gTasks[taskId].func = sub_81374C4;
gTasks[taskId].data[0] = 16;
gTasks[taskId].data[1] = 0;
}
static void sub_81374C4(u8 taskId)
{
u16 count = gTasks[taskId].data[1];
u16 blend = count + 0x1000;
SetGpuReg(REG_OFFSET_BLDALPHA, blend);
if (count <= 0x10)
{
gTasks[taskId].data[1]++;
}
else
{
gTasks[taskId].data[2] = 0;
gTasks[taskId].func = sub_813750C;
}
}
static void sub_813750C(u8 taskId)
{
u16 count;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 16));
count = gTasks[taskId].data[2];
if (count < 8)
{
gTasks[taskId].data[2]++;
LoadPalette(&gUnknown_085B28A0[count], 0xE0, 16 - 2 * count);
}
else
{
LoadPalette(gCaveTransitionPalette_White, 0, 0x20);
gTasks[taskId].func = sub_8137574;
gTasks[taskId].data[2] = 8;
}
}
static void sub_8137574(u8 taskId)
{
if (gTasks[taskId].data[2])
gTasks[taskId].data[2]--;
else
SetMainCallback2(gMain.savedCallback);
}
static void sub_81375A8(void)
{
CreateTask(sub_81375BC, 0);
}
static void sub_81375BC(u8 taskId)
{
gTasks[taskId].func = sub_81375D8;
}
static void sub_81375D8(u8 taskId)
{
SetGpuReg(REG_OFFSET_DISPCNT, 0);
LZ77UnCompVram(gCaveTransitionTiles, (void *)0x600C000);
LZ77UnCompVram(gCaveTransitionTilemap, (void *)0x600F800);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0)
| BGCNT_CHARBASE(3)
| BGCNT_SCREENBASE(31)
| BGCNT_16COLOR
| BGCNT_TXT256x256);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
| DISPCNT_OBJ_1D_MAP
| DISPCNT_BG0_ON
| DISPCNT_OBJ_ON);
LoadPalette(gCaveTransitionPalette_White, 0xE0, 0x20);
LoadPalette(gCaveTransitionPalette_Black, 0, 0x20);
gTasks[taskId].func = sub_8137678;
gTasks[taskId].data[0] = 16;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = 0;
}
static void sub_8137678(u8 taskId)
{
u16 count = gTasks[taskId].data[2];
if (count < 16)
{
gTasks[taskId].data[2]++;
gTasks[taskId].data[2]++;
LoadPalette(&gUnknown_085B2890[15 - count], 0xE0, 2 * (count + 1));
}
else
{
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 16));
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0
| BLDCNT_EFFECT_BLEND
| BLDCNT_TGT2_BG1
| BLDCNT_TGT2_BG2
| BLDCNT_TGT2_BG3
| BLDCNT_TGT2_OBJ
| BLDCNT_TGT2_BD);
gTasks[taskId].func = sub_81376DC;
}
}
static void sub_81376DC(u8 taskId)
{
u16 count = 16 - gTasks[taskId].data[1];
u16 blend = count + 0x1000;
SetGpuReg(REG_OFFSET_BLDALPHA, blend);
if (count)
{
gTasks[taskId].data[1]++;
}
else
{
LoadPalette(gCaveTransitionPalette_Black, 0, 0x20);
SetMainCallback2(gMain.savedCallback);
}
}

299
src/fldeff_groundshake.c Normal file
View File

@ -0,0 +1,299 @@
#include "global.h"
#include "global.fieldmap.h"
#include "constants/flags.h"
#include "constants/songs.h"
#include "event_data.h"
#include "field_camera.h"
#include "field_map_obj.h"
#include "malloc.h"
#include "random.h"
#include "roulette_util.h"
#include "script.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
// structures
struct Struct203CF18 {
u8 taskId;
struct InnerStruct203CF18 unk4;
}; //size = 0xC8
// extern data
extern const struct SpriteSheet gUnknown_08617D94[];
extern const s16 gUnknown_08617D64[][3];
// static functions
static void sub_81BE808(u8 taskId);
static void sub_81BE900(u8 taskId);
static void sub_81BE968(void);
static void sub_81BE9C0(u8 taskId);
static void sub_81BEA00(u8 taskId);
static void sub_81BEA20(void);
static void sub_81BEAD8(struct Sprite* sprite);
// rodata
static const u8 gUnknown_08617E18[] = {0x3b, 0x43, 0x61, 0x00, 0x0f, 0x05, 0xff, 0x9b};
static const union AnimCmd gSpriteAnim_8617E20[] =
{
ANIMCMD_FRAME(0, 12),
ANIMCMD_JUMP(0),
};
static const union AnimCmd *const gSpriteAnimTable_8617E28[] =
{
gSpriteAnim_8617E20,
};
static const struct OamData gUnknown_08617E2C =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 0,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const struct SpriteTemplate gUnknown_08617E34 = {
0x0FA0, 0xFFFF, &gUnknown_08617E2C, gSpriteAnimTable_8617E28, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8
};
static const union AnimCmd gSpriteAnim_8617E4C[] =
{
ANIMCMD_FRAME(0, 12),
ANIMCMD_JUMP(0),
};
static const union AnimCmd *const gSpriteAnim_8617E54[] =
{
gSpriteAnim_8617E4C,
};
static const struct OamData gSpriteAnim_8617E58 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const struct SpriteTemplate gUnknown_08617E60 = {
0x0FA0, 0xFFFF, &gSpriteAnim_8617E58, gSpriteAnim_8617E54, NULL, gDummySpriteAffineAnimTable, sub_81BEAD8
};
// ewram
EWRAM_DATA struct Struct203CF18 *gUnknown_0203CF18 = NULL;
// text
bool8 sub_81BE66C(void)
{
if (!(gSaveBlock1Ptr->location.mapGroup == 0x0 && gSaveBlock1Ptr->location.mapNum == 0x1A))
return 0;
return FlagGet(FLAG_0x14E);
}
void sub_81BE698(u8 taskId)
{
sub_8151E50(&(gUnknown_0203CF18->unk4));
}
void sub_81BE6AC(void)
{
gUnknown_0203CF18 = NULL;
}
void sub_81BE6B8(void)
{
if(gUnknown_0203CF18 != NULL)
{
gUnknown_0203CF18 = NULL;
return;
}
if(!(gSaveBlock1Ptr->location.mapGroup == 0x0 && gSaveBlock1Ptr->location.mapNum == 0x1A) || !FlagGet(FLAG_0x14E))
return;
gUnknown_0203CF18 = (struct Struct203CF18 *)AllocZeroed(sizeof(struct Struct203CF18));
sub_8151B3C(&(gUnknown_0203CF18->unk4));
sub_8151B68(&(gUnknown_0203CF18->unk4), gUnknown_08617E18);
sub_8151CA8(&(gUnknown_0203CF18->unk4), 1, 1);
gUnknown_0203CF18->taskId = CreateTask(sub_81BE698, 0xFF);
}
void sub_81BE72C(void)
{
if(!(gSaveBlock1Ptr->location.mapGroup == 0x0 && gSaveBlock1Ptr->location.mapNum == 0x1A) || !FlagGet(FLAG_0x14E) || gUnknown_0203CF18 == NULL)
return;
if(FuncIsActiveTask(sub_81BE698))
DestroyTask(gUnknown_0203CF18->taskId);
sub_8151D28(&(gUnknown_0203CF18->unk4), 1, 1);
sub_8151C50(&(gUnknown_0203CF18->unk4), 1, 1);
Free(gUnknown_0203CF18);
gUnknown_0203CF18 = NULL;
}
void sub_81BE79C(void)
{
u16 rand;
bool8 chance;
if(VarGet(VAR_0x40CB) != 0)
{
FlagClear(FLAG_0x14E);
return;
}
rand = Random();
chance = rand & 1;
if(FlagGet(FLAG_0x09D) == TRUE)
chance = TRUE;
if(chance)
{
FlagSet(FLAG_0x14E);
sub_81BE6B8();
return;
}
FlagClear(FLAG_0x14E);
}
void sub_81BE7F4(void)
{
CreateTask(sub_81BE808, 0x8);
}
static void sub_81BE808(u8 taskId)
{
u8 mapObjectIdBuffer;
struct MapObject *fieldMapObject;
struct MapObject *playerAvatarMapObject;
TryGetFieldObjectIdByLocalIdAndMap(0x2D, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &mapObjectIdBuffer);
fieldMapObject = &(gMapObjects[mapObjectIdBuffer]);
gSprites[fieldMapObject->spriteId].pos2.y += 4;
playerAvatarMapObject = &(gMapObjects[gPlayerAvatar.mapObjectId]);
if((gSprites[fieldMapObject->spriteId].pos1.y + gSprites[fieldMapObject->spriteId].pos2.y) >=
(gSprites[playerAvatarMapObject->spriteId].pos1.y + gSprites[playerAvatarMapObject->spriteId].pos2.y))
{
DestroyTask(taskId);
EnableBothScriptContexts();
}
}
static void sp136_strengh_sound(u8 a, u8 b, u8 c, u8 d)
{
u8 taskId;
taskId = CreateTask(sub_81BE900, 0x9);
gTasks[taskId].data[0] = b;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = c;
gTasks[taskId].data[3] = d;
gTasks[taskId].data[4] = a;
SetCameraPanningCallback(NULL);
PlaySE(SE_W070);
}
static void sub_81BE900(u8 taskId)
{
s16 *data;
data = gTasks[taskId].data;
data[1]++;
if((data[1] % data[3]) == 0)
{
data[1] = 0;
data[2]--;
data[0] = -data[0];
data[4] = -data[4];
SetCameraPanning(data[0], data[4]);
if(!data[2])
{
sub_81BE968();
DestroyTask(taskId);
InstallCameraPanAheadCallback();
}
}
}
static void sub_81BE968(void)
{
u8 taskId;
taskId = FindTaskIdByFunc(sub_81BE9C0);
if(taskId != 0xFF)
gTasks[taskId].data[0]++;
}
void sub_81BE994(void)
{
LoadSpriteSheets(gUnknown_08617D94);
sub_81BEA20();
CreateTask(sub_81BE9C0, 0x8);
sp136_strengh_sound(2, 1, 16, 3);
}
static void sub_81BE9C0(u8 taskId)
{
u16 *data;
data = gTasks[taskId].data;
data[1]++;
if(data[1] == 1000 || data[0] == 17)
gTasks[taskId].func = sub_81BEA00;
}
static void sub_81BEA00(u8 taskId)
{
FreeSpriteTilesByTag(4000);
DestroyTask(taskId);
EnableBothScriptContexts();
}
static void sub_81BEA20(void)
{
u8 i;
u8 spriteId;
for(i = 0; i < 8; i++)
{
spriteId = CreateSprite(&gUnknown_08617E60, gUnknown_08617D64[i][0] + 120, gUnknown_08617D64[i][1], 8);
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].oam.paletteNum = 0;
gSprites[spriteId].data[0] = i;
}
for(i = 0; i < 8; i++)
{
spriteId = CreateSprite(&gUnknown_08617E34, gUnknown_08617D64[i][0] + 115, gUnknown_08617D64[i][1] - 3, 8);
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].oam.paletteNum = 0;
gSprites[spriteId].data[0] = i;
}
}
static void sub_81BEAD8(struct Sprite* sprite)
{
sprite->data[1] += 2;
sprite->pos2.y = (sprite->data[1] / 2);
if(((sprite->pos1.y) + (sprite->pos2.y)) > gUnknown_08617D64[sprite->data[0]][2])
{
DestroySprite(sprite);
sub_81BE968();
}
}

View File

@ -9,10 +9,10 @@
#include "strings.h"
#include "task.h"
void sub_816166C(u8 taskId);
void sub_81617B8(u8 taskId);
void sub_81616C0(u8 taskId);
void sub_8161724(u8 taskId);
static void sub_816166C(u8 taskId);
static void sub_81616C0(u8 taskId);
static void sub_8161724(u8 taskId);
static void sub_81617B8(u8 taskId);
bool8 SetUpFieldMove_SoftBoiled(void)
{
@ -63,13 +63,13 @@ void sub_81615A8(u8 taskId)
sub_81B1F18(taskId, unk9, -1, GetMonData(&gPlayerParty[unk9], MON_DATA_MAX_HP)/5, sub_816166C);
}
void sub_816166C(u8 taskId)
static void sub_816166C(u8 taskId)
{
PlaySE(SE_KAIFUKU);
sub_81B1F18(taskId, gUnknown_0203CEC8.unkA, 1, GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAX_HP)/5, sub_81616C0);
}
void sub_81616C0(u8 taskId)
static void sub_81616C0(u8 taskId)
{
GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unkA], gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2);
@ -78,7 +78,7 @@ void sub_81616C0(u8 taskId)
gTasks[taskId].func = sub_8161724;
}
void sub_8161724(u8 taskId)
static void sub_8161724(u8 taskId)
{
if(sub_81B1BD4() == 1)
return;
@ -92,7 +92,7 @@ void sub_8161724(u8 taskId)
gTasks[taskId].func = sub_81B1370;
}
void sub_8161784(u8 taskId)
static void sub_8161784(u8 taskId)
{
if(sub_81B1BD4() == 1)
return;
@ -100,7 +100,7 @@ void sub_8161784(u8 taskId)
gTasks[taskId].func = sub_81B1370;
}
void sub_81617B8(u8 taskId)
static void sub_81617B8(u8 taskId)
{
PlaySE(SE_SELECT);
sub_81B1B5C(&gText_CantBeUsedOnPkmn, 0);

View File

@ -7,9 +7,11 @@
#include "script.h"
#include "task.h"
void FldEff_UseStrength(void);
void sub_8145E74(void);
// static functions
static void FldEff_UseStrength(void);
static void sub_8145E74(void);
// text
bool8 SetUpFieldMove_Strength(void)
{
if (npc_before_player_of_type(87) == TRUE)
@ -22,7 +24,7 @@ bool8 SetUpFieldMove_Strength(void)
return FALSE;
}
void FldEff_UseStrength(void)
static void FldEff_UseStrength(void)
{
gFieldEffectArguments[0] = GetCursorSelectionMonId();
ScriptContext1_SetupScript(FieryPath_EventScript_2908FD);
@ -37,7 +39,7 @@ bool8 sub_8145E2C(void)
return FALSE;
}
void sub_8145E74(void)
static void sub_8145E74(void)
{
FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH);
EnableBothScriptContexts();

View File

@ -6,7 +6,6 @@
#include "field_effect.h"
#include "field_player_avatar.h"
#include "field_screen.h"
#include "fldeff_groundshake.h"
#include "palette.h"
#include "party_menu.h"
#include "rom6.h"
@ -20,6 +19,8 @@ void hm2_sweet_scent(void);
void sub_8159F5C(void);
void sub_8159FEC(u8 taskId);
void sub_815A090(u8 taskId);
void sub_81BE6B8(void);
void sub_81BE72C(void);
bool8 SetUpFieldMove_SweetScent(void)
{

770
src/fossil_specials.c Normal file
View File

@ -0,0 +1,770 @@
#include "global.h"
#include "constants/flags.h"
#include "constants/songs.h"
#include "bg.h"
#include "event_data.h"
#include "field_camera.h"
#include "field_map_obj.h"
#include "fieldmap.h"
#include "global.fieldmap.h"
#include "gpu_regs.h"
#include "malloc.h"
#include "menu.h"
#include "random.h"
#include "script.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
#include "window.h"
#define MIRAGE_TOWER_GFX_LENGTH (sizeof(gUnknown_08617274) + sizeof(gMirageTower_Gfx))
#define MIRAGE_TOWER_PALETTE_LENGTH 0x800
#define ROOT_FOSSIL_GFX_LENGTH sizeof(gRootFossil_Gfx)
#define ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH 0x100
//struct
struct Struct8617DA4 {
u8 x;
u8 y;
u16 tileId;
};
struct Struct203CF10 {
u8 *buffer;
u8 curr_buffer_index;
};
struct DynamicSpriteFrameImage{
u8 *data;
u16 size;
};
struct Struct203CF0C {
u8 *frameImageTiles;
struct DynamicSpriteFrameImage *frameImage;
u8 spriteId;
u16 *unkC;
u16 unk10;
};
// static functions
static void sub_81BED50(u8 taskId);
static void sub_81BEBF4(u8 taskId);
static void sub_81BF028(u8 taskId);
static void sub_81BF248(struct Sprite *);
/*static*/ void sub_81BF2B8(u8* a, u16 b, u8 c, u8 d, u8 e);
// .rodata
static const u8 gUnknown_08617274[] = {00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00};
static const u8 gMirageTower_Gfx[] = INCBIN_U8("graphics/misc/mirage_tower.4bpp");
static const u16 gUnknown_08617B94[] = INCBIN_U16("graphics/misc/mirage_tower.bin");
static const u16 gRootFossil_Pal[] = INCBIN_U16("graphics/misc/fossil.gbapal");
static const u8 gRootFossil_Gfx[] = INCBIN_U8("graphics/misc/fossil.4bpp");
static const u8 gMirageTowerCrumbles_Gfx[] = INCBIN_U8("graphics/misc/mirage_tower_crumbles.4bpp");
static const u16 gMirageTowerCrumbles_Palette[] = INCBIN_U16("graphics/misc/mirage_tower_crumbles.gbapal");
const s16 gUnknown_08617D64[][3] =
{
{ 0, 10, 65},
{ 17, 3, 50},
{-12, 0, 75},
{ 10, 15, 90},
{ 7, 8, 65},
{-18, 5, 75},
{ 22, -10, 55},
{-24, -4, 65},
};
const struct SpriteSheet gUnknown_08617D94[] =
{
{gMirageTowerCrumbles_Gfx, 0x0080, 0x0fa0},
{NULL}
};
static const struct Struct8617DA4 gUnknown_08617DA4[] =
{
{0x12, 0x35, 0x251},
{0x13, 0x35, 0x251},
{0x14, 0x35, 0x251},
{0x12, 0x36, 0x251},
{0x13, 0x36, 0x251},
{0x14, 0x36, 0x251},
{0x12, 0x37, 0x251},
{0x13, 0x37, 0x251},
{0x14, 0x37, 0x251},
{0x12, 0x38, 0x251},
{0x13, 0x38, 0x251},
{0x14, 0x38, 0x251},
{0x12, 0x39, 0x259},
{0x13, 0x39, 0x259},
{0x14, 0x39, 0x259},
{0x12, 0x3A, 0x121},
{0x13, 0x3A, 0x121},
{0x14, 0x3A, 0x121},
};
static const union AnimCmd gSpriteAnim_8617DEC[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
static const struct OamData gOamData_8617DF4 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 0,
.paletteNum = 3,
.affineParam = 0,
};
static const union AnimCmd *const gSpriteAnimTable_8617DFC[] =
{
gSpriteAnim_8617DEC,
};
static const struct SpriteTemplate gUnknown_08617E00 = {
0xFFFF, 0xFFFF, &gOamData_8617DF4, gSpriteAnimTable_8617DFC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
};
// ewram
EWRAM_DATA u8* gUnknown_0203CF04 = NULL;
EWRAM_DATA u8* gUnknown_0203CF08 = NULL;
EWRAM_DATA struct Struct203CF0C *gUnknown_0203CF0C = NULL;
EWRAM_DATA struct Struct203CF10 *gUnknown_0203CF10 = NULL;
EWRAM_DATA u16 *gUnknown_0203CF14 = NULL;
// iwram
IWRAM_DATA u16 gUnknown_030012A8[8] = {0, 0, 0, 0, 0, 0, 0, 0};
// text
void sub_81BEB24(void)
{
u8 i;
for(i = 0; i < (sizeof(gUnknown_08617DA4)/sizeof(gUnknown_08617DA4[0])); i++)
MapGridSetMetatileIdAt(gUnknown_08617DA4[i].x + 7, gUnknown_08617DA4[i].y + 7, gUnknown_08617DA4[i].tileId);
DrawWholeMapView();
}
void sub_81BEB54(void)
{
CreateTask(sub_81BED50, 0x9);
}
void sub_81BEB68(void)
{
CreateTask(sub_81BEBF4, 0x9);
}
void sub_81BEB7C(void)
{
CreateTask(sub_81BF028, 0x9);
}
void sub_81BEB90(void)
{
SetGpuReg(REG_OFFSET_BG0HOFS, gUnknown_0203CF14[0]);
SetGpuReg(REG_OFFSET_BG0VOFS, gUnknown_0203CF14[1]);
}
void sub_81BEBB4(u8 taskId)
{
if(!(gTasks[taskId].data[0]))
{
gUnknown_0203CF14[0] = -gUnknown_0203CF14[0];
gTasks[taskId].data[0] = 2;
sub_81BEB90();
}
else
gTasks[taskId].data[0]--;
}
static void sub_81BEBF4(u8 taskId)
{
u8 zero;
switch(gTasks[taskId].data[0])
{
case 0:
FreeAllWindowBuffers();
SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 2);
gTasks[taskId].data[0]++;
break;
case 1:
gUnknown_0203CF04 = (u8 *)AllocZeroed(MIRAGE_TOWER_GFX_LENGTH);
gUnknown_0203CF08 = (u8 *)AllocZeroed(MIRAGE_TOWER_PALETTE_LENGTH);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
gTasks[taskId].data[0]++;
break;
case 2:
CpuSet(gUnknown_08617274, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH / 2);
LoadBgTiles(0, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH, 0);
gTasks[taskId].data[0]++;
break;
case 3:
SetBgTilemapBuffer(0, gUnknown_0203CF08);
CopyToBgTilemapBufferRect_ChangePalette(0, &gUnknown_08617B94, 12, 29, 6, 12, 17);
CopyBgTilemapBufferToVram(0);
gTasks[taskId].data[0]++;
break;
case 4:
ShowBg(0);
gTasks[taskId].data[0]++;
break;
case 5:
sub_81BEB24();
gTasks[taskId].data[0]++;
break;
case 6:
gUnknown_0203CF14 = (u16 *)Alloc(4);
zero = 0;
gUnknown_0203CF14[0] = 2;
gUnknown_0203CF14[1] = zero;
CreateTask(sub_81BEBB4, 0xA);
DestroyTask(taskId);
EnableBothScriptContexts();
break;
}
}
#ifdef NONMATCHING
#define OUTER_BUFFER_LENGTH 0x60
#define INNER_BUFFER_LENGTH 0x30
static void sub_81BED50(u8 taskId)
{
u8 anotherTaskId, j;
switch(gTasks[taskId].data[0])
{
case 1:
gUnknown_0203CF10 = (struct Struct203CF10 *)AllocZeroed(OUTER_BUFFER_LENGTH * sizeof(struct Struct203CF10));
break;
case 3:
{
u16 i;
u16 left;
u32 index, next;
index = (u16)gTasks[taskId].data[3];
if(gTasks[taskId].data[3] <= (OUTER_BUFFER_LENGTH - 1))
{
if(gTasks[taskId].data[1] > 1)
{
index = (u8)index;
gUnknown_0203CF10[index].buffer = (u8 *)Alloc(INNER_BUFFER_LENGTH);
for(i = 0; i <= (INNER_BUFFER_LENGTH - 1); i++)
gUnknown_0203CF10[index].buffer[i] = i;
for(i = 0; i <= (INNER_BUFFER_LENGTH - 1); i++)
{
u16 rand1, rand2, temp;
rand1 = Random() % 0x30;
rand2 = Random() % 0x30;
temp = gUnknown_0203CF10[index].buffer[rand2];
gUnknown_0203CF10[index].buffer[rand2] = gUnknown_0203CF10[index].buffer[rand1];
gUnknown_0203CF10[index].buffer[rand1] = temp;
}
if(gTasks[taskId].data[3] <= (OUTER_BUFFER_LENGTH - 1))
gTasks[taskId].data[3]++;
gTasks[taskId].data[1] = 0;
}
gTasks[taskId].data[1]++;
}
index = (u8)gTasks[taskId].data[3];
for(left = (u8)gTasks[taskId].data[2]; left < (u16)index; left = next)
{
j = 0;
next = left + 1;
while(!j)
{
sub_81BF2B8(gUnknown_0203CF04, ((((OUTER_BUFFER_LENGTH - 1) - left) * INNER_BUFFER_LENGTH) + gUnknown_0203CF10[left].buffer[(gUnknown_0203CF10[left].curr_buffer_index)++]), 0, INNER_BUFFER_LENGTH, 1);
j++;
}
if(gUnknown_0203CF10[left].curr_buffer_index > (INNER_BUFFER_LENGTH - 1))
{
FREE_AND_SET_NULL(gUnknown_0203CF10[left].buffer);
gTasks[taskId].data[2]++;
if((left % 2) == 1)
gUnknown_0203CF14[1]--;
}
}
LoadBgTiles(0, gUnknown_0203CF04, MIRAGE_TOWER_GFX_LENGTH, 0);
if(gUnknown_0203CF10[OUTER_BUFFER_LENGTH - 1].curr_buffer_index > (INNER_BUFFER_LENGTH - 1))
break;
return;
}
case 4:
UnsetBgTilemapBuffer(0);
anotherTaskId = FindTaskIdByFunc(sub_81BEBB4);
if(anotherTaskId != 0xFF)
DestroyTask(anotherTaskId);
gUnknown_0203CF14[1] = gUnknown_0203CF14[0] = 0;
sub_81BEB90();
break;
case 5:
FREE_AND_SET_NULL(gUnknown_0203CF14);
FREE_AND_SET_NULL(gUnknown_0203CF10);
FREE_AND_SET_NULL(gUnknown_0203CF04);
FREE_AND_SET_NULL(gUnknown_0203CF08);
break;
case 6:
SetGpuRegBits(REG_OFFSET_BG2CNT, 0x2);
SetGpuRegBits(REG_OFFSET_BG0CNT, 0x0);
SetBgAttribute(0, BG_CTRL_ATTR_MOSAIC, 0);
sub_81971D0();
break;
case 7:
ShowBg(0);
break;
case 8:
DestroyTask(taskId);
EnableBothScriptContexts();
break;
}
gTasks[taskId].data[0]++;
}
#else
ASM_DIRECT
static void sub_81BED50(u8 taskId)
{
asm("\n\
.syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x10\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r10, r0\n\
ldr r1, =gTasks\n\
lsls r0, 2\n\
add r0, r10\n\
lsls r0, 3\n\
adds r0, r1\n\
ldrh r0, [r0, 0x8]\n\
subs r0, 0x1\n\
lsls r0, 16\n\
asrs r0, 16\n\
adds r6, r1, 0\n\
cmp r0, 0x7\n\
bls _081BED7C\n\
b _081BF002\n\
_081BED7C:\n\
lsls r0, 2\n\
ldr r1, =_081BED90\n\
adds r0, r1\n\
ldr r0, [r0]\n\
mov pc, r0\n\
.pool\n\
.align 2, 0\n\
_081BED90:\n\
.4byte _081BEDB0\n\
.4byte _081BF002\n\
.4byte _081BEDC4\n\
.4byte _081BEF64\n\
.4byte _081BEF94\n\
.4byte _081BEFD0\n\
.4byte _081BEFF0\n\
.4byte _081BEFF8\n\
_081BEDB0:\n\
ldr r4, =gUnknown_0203CF10\n\
movs r0, 0xC0\n\
lsls r0, 2\n\
bl AllocZeroed\n\
str r0, [r4]\n\
b _081BF002\n\
.pool\n\
_081BEDC4:\n\
mov r1, r10\n\
lsls r0, r1, 2\n\
adds r1, r0, r1\n\
lsls r1, 3\n\
adds r2, r1, r6\n\
ldrh r3, [r2, 0xE]\n\
movs r4, 0xE\n\
ldrsh r1, [r2, r4]\n\
str r0, [sp, 0x8]\n\
cmp r1, 0x5F\n\
bgt _081BEE8A\n\
movs r1, 0xA\n\
ldrsh r0, [r2, r1]\n\
cmp r0, 0x1\n\
ble _081BEE7C\n\
lsls r0, r3, 24\n\
lsrs r4, r0, 24\n\
movs r0, 0x30\n\
bl Alloc\n\
ldr r3, =gUnknown_0203CF10\n\
ldr r1, [r3]\n\
lsls r2, r4, 3\n\
adds r1, r2, r1\n\
str r0, [r1]\n\
movs r5, 0\n\
adds r4, r2, 0\n\
_081BEDFA:\n\
ldr r0, [r3]\n\
adds r0, r4, r0\n\
ldr r0, [r0]\n\
adds r0, r5\n\
strb r5, [r0]\n\
adds r0, r5, 0x1\n\
lsls r0, 16\n\
lsrs r5, r0, 16\n\
cmp r5, 0x2F\n\
bls _081BEDFA\n\
movs r5, 0\n\
ldr r7, =gUnknown_0203CF10\n\
adds r6, r2, 0\n\
_081BEE14:\n\
bl Random\n\
lsls r0, 16\n\
lsrs r0, 16\n\
movs r1, 0x30\n\
bl __umodsi3\n\
adds r4, r0, 0\n\
lsls r4, 16\n\
lsrs r4, 16\n\
bl Random\n\
lsls r0, 16\n\
lsrs r0, 16\n\
movs r1, 0x30\n\
bl __umodsi3\n\
lsls r0, 16\n\
lsrs r0, 16\n\
ldr r1, [r7]\n\
adds r1, r6, r1\n\
ldr r1, [r1]\n\
adds r0, r1, r0\n\
ldrb r2, [r0]\n\
adds r1, r4 \n\
ldrb r1, [r1]\n\
strb r1, [r0]\n\
ldr r0, [r7]\n\
adds r0, r6, r0\n\
ldr r0, [r0]\n\
adds r0, r4\n\
strb r2, [r0]\n\
adds r0, r5, 0x1\n\
lsls r0, 16\n\
lsrs r5, r0, 16\n\
cmp r5, 0x2F\n\
bls _081BEE14\n\
ldr r0, =gTasks\n\
ldr r1, [sp, 0x8]\n\
add r1, r10\n\
lsls r1, 3\n\
adds r2, r1, r0\n\
ldrh r3, [r2, 0xE]\n\
movs r4, 0xE\n\
ldrsh r1, [r2, r4]\n\
adds r6, r0, 0\n\
cmp r1, 0x5F\n\
bgt _081BEE78\n\
adds r0, r3, 0x1\n\
strh r0, [r2, 0xE]\n\
_081BEE78:\n\
movs r0, 0\n\
strh r0, [r2, 0xA]\n\
_081BEE7C:\n\
ldr r1, [sp, 0x8]\n\
add r1, r10\n\
lsls r1, 3\n\
adds r1, r6\n\
ldrh r0, [r1, 0xA]\n\
adds r0, 0x1\n\
strh r0, [r1, 0xA]\n\
_081BEE8A:\n\
ldr r0, [sp, 0x8]\n\
add r0, r10\n\
lsls r0, 3\n\
adds r0, r6\n\
ldrb r4, [r0, 0xE]\n\
ldrb r5, [r0, 0xC]\n\
lsls r0, r4, 16\n\
cmp r5, r4\n\
bcs _081BEF32\n\
str r0, [sp, 0xC]\n\
_081BEE9E:\n\
movs r6, 0\n\
adds r0, r5, 0x1\n\
str r0, [sp, 0x4]\n\
lsls r4, r5, 3\n\
movs r2, 0x5F\n\
subs r1, r2, r5\n\
lsls r0, r1, 1\n\
adds r0, r1\n\
lsls r0, 4\n\
mov r9, r0\n\
_081BEEB2:\n\
ldr r0, =gUnknown_0203CF04\n\
ldr r0, [r0]\n\
ldr r7, =gUnknown_0203CF10\n\
ldr r3, [r7]\n\
adds r3, r4, r3\n\
ldrb r2, [r3, 0x4]\n\
adds r1, r2, 0x1\n\
strb r1, [r3, 0x4]\n\
lsls r2, 24\n\
lsrs r2, 24\n\
ldr r1, [r3]\n\
adds r1, r2\n\
ldrb r1, [r1]\n\
add r1, r9\n\
lsls r1, 16\n\
lsrs r1, 16\n\
movs r2, 0x1\n\
mov r8, r2\n\
str r2, [sp]\n\
movs r2, 0\n\
movs r3, 0x30\n\
bl sub_81BF2B8\n\
adds r0, r6, 0x1\n\
lsls r0, 24\n\
lsrs r6, r0, 24\n\
cmp r6, 0\n\
beq _081BEEB2\n\
ldr r0, [r7]\n\
adds r1, r4, r0\n\
ldrb r0, [r1, 0x4]\n\
cmp r0, 0x2F\n\
bls _081BEF24\n\
ldr r0, [r1]\n\
bl Free\n\
ldr r0, [r7]\n\
adds r0, r4, r0\n\
movs r1, 0\n\
str r1, [r0]\n\
ldr r1, [sp, 0x8]\n\
add r1, r10\n\
lsls r1, 3\n\
ldr r4, =gTasks\n\
adds r1, r4\n\
ldrh r0, [r1, 0xC]\n\
adds r0, 0x1\n\
strh r0, [r1, 0xC]\n\
mov r0, r8\n\
ands r5, r0\n\
cmp r5, 0x1\n\
bne _081BEF24\n\
ldr r0, =gUnknown_0203CF14\n\
ldr r1, [r0]\n\
ldrh r0, [r1, 0x2]\n\
subs r0, 0x1\n\
strh r0, [r1, 0x2]\n\
_081BEF24:\n\
ldr r1, [sp, 0x4]\n\
lsls r0, r1, 16\n\
lsrs r5, r0, 16\n\
ldr r2, [sp, 0xC]\n\
lsrs r0, r2, 16\n\
cmp r5, r0\n\
bcc _081BEE9E\n\
_081BEF32:\n\
ldr r0, =gUnknown_0203CF04\n\
ldr r1, [r0]\n\
movs r2, 0x92\n\
lsls r2, 4\n\
movs r0, 0\n\
movs r3, 0\n\
bl LoadBgTiles\n\
ldr r0, =gUnknown_0203CF10\n\
ldr r0, [r0]\n\
movs r4, 0xBE\n\
lsls r4, 2\n\
adds r0, r4\n\
ldrb r0, [r0, 0x4]\n\
cmp r0, 0x2F\n\
bhi _081BF002\n\
b _081BF014\n\
.pool\n\
_081BEF64:\n\
movs r0, 0\n\
bl UnsetBgTilemapBuffer\n\
ldr r0, =sub_81BEBB4\n\
bl FindTaskIdByFunc\n\
lsls r0, 24\n\
lsrs r0, 24\n\
cmp r0, 0xFF\n\
beq _081BEF7C\n\
bl DestroyTask\n\
_081BEF7C:\n\
ldr r0, =gUnknown_0203CF14\n\
ldr r1, [r0]\n\
movs r0, 0\n\
strh r0, [r1]\n\
strh r0, [r1, 0x2]\n\
bl sub_81BEB90\n\
b _081BF002\n\
.pool\n\
_081BEF94:\n\
ldr r4, =gUnknown_0203CF14\n\
ldr r0, [r4]\n\
bl Free\n\
movs r5, 0\n\
str r5, [r4]\n\
ldr r4, =gUnknown_0203CF10\n\
ldr r0, [r4]\n\
bl Free\n\
str r5, [r4]\n\
ldr r4, =gUnknown_0203CF04\n\
ldr r0, [r4]\n\
bl Free\n\
str r5, [r4]\n\
ldr r4, =gUnknown_0203CF08\n\
ldr r0, [r4]\n\
bl Free\n\
str r5, [r4]\n\
b _081BF002\n\
.pool\n\
_081BEFD0:\n\
movs r0, 0xC\n\
movs r1, 0x2\n\
bl SetGpuRegBits\n\
movs r0, 0x8\n\
movs r1, 0\n\
bl SetGpuRegBits\n\
movs r0, 0\n\
movs r1, 0x7\n\
movs r2, 0\n\
bl SetBgAttribute\n\
bl sub_81971D0\n\
b _081BF002\n\
_081BEFF0:\n\
movs r0, 0\n\
bl ShowBg\n\
b _081BF002\n\
_081BEFF8:\n\
mov r0, r10\n\
bl DestroyTask\n\
bl EnableBothScriptContexts\n\
_081BF002:\n\
ldr r0, =gTasks\n\
mov r2, r10\n\
lsls r1, r2, 2\n\
add r1, r10\n\
lsls r1, 3\n\
adds r1, r0\n\
ldrh r0, [r1, 0x8]\n\
adds r0, 0x1\n\
strh r0, [r1, 0x8]\n\
_081BF014:\n\
add sp, 0x10\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided");
}
#endif // NONMATCHING
static void sub_81BF028(u8 taskId)
{
u16 i;
switch(gTasks[taskId].data[0])
{
case 1:
gUnknown_0203CF0C = (struct Struct203CF0C *)AllocZeroed(sizeof(struct Struct203CF0C));
gUnknown_0203CF0C->frameImageTiles = (u8 *)AllocZeroed(ROOT_FOSSIL_GFX_LENGTH);
gUnknown_0203CF0C->frameImage = (struct DynamicSpriteFrameImage *) AllocZeroed(sizeof(struct DynamicSpriteFrameImage));
gUnknown_0203CF0C->unkC = (u16 *)AllocZeroed(ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16));
gUnknown_0203CF0C->unk10 = 0;
break;
case 2:
{
u8 *buffer;
buffer = gUnknown_0203CF0C->frameImageTiles;
for(i = 0; i < ROOT_FOSSIL_GFX_LENGTH; i++, buffer++)
*buffer = gRootFossil_Gfx[i];
}
break;
case 3:
gUnknown_0203CF0C->frameImage->data = gUnknown_0203CF0C->frameImageTiles;
gUnknown_0203CF0C->frameImage->size = ROOT_FOSSIL_GFX_LENGTH;
break;
case 4:
{
u8 spriteId, zero;
struct SpriteTemplate fossilTemplate;
fossilTemplate = gUnknown_08617E00;
fossilTemplate.images = (struct SpriteFrameImage *)(gUnknown_0203CF0C->frameImage);
spriteId = CreateSprite(&fossilTemplate, 128, -16, 1);
gUnknown_0203CF0C->spriteId = spriteId;
zero = 0;
gSprites[gUnknown_0203CF0C->spriteId].centerToCornerVecX = zero;
gSprites[gUnknown_0203CF0C->spriteId].data[0] = gSprites[gUnknown_0203CF0C->spriteId].pos1.x;
gSprites[gUnknown_0203CF0C->spriteId].data[1] = 1;
}
case 5:
for(i = 0; i < ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH; i++)
gUnknown_0203CF0C->unkC[i] = i;
break;
case 6:
{
u16 rand1, rand2, temp, j;
j = (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16)) - 1;
for(i = 0; i <= j; i++)
{
rand1 = Random() % 0x100;
rand2 = Random() % 0x100;
j = (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH * sizeof(u16)) - 1;
temp = gUnknown_0203CF0C->unkC[rand2];
gUnknown_0203CF0C->unkC[rand2] = gUnknown_0203CF0C->unkC[rand1];
gUnknown_0203CF0C->unkC[rand1] = temp;
}
gSprites[gUnknown_0203CF0C->spriteId].callback = sub_81BF248;
break;
}
case 7:
if(gSprites[gUnknown_0203CF0C->spriteId].callback != SpriteCallbackDummy)
return;
DestroySprite(&gSprites[gUnknown_0203CF0C->spriteId]);
FREE_AND_SET_NULL(gUnknown_0203CF0C->unkC);;
FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImage);
FREE_AND_SET_NULL(gUnknown_0203CF0C->frameImageTiles);
FREE_AND_SET_NULL(gUnknown_0203CF0C);
break;
case 8:
EnableBothScriptContexts();
}
++gTasks[taskId].data[0];
}
static void sub_81BF248(struct Sprite *sprite)
{
if (gUnknown_0203CF0C->unk10 >= (ROOT_FOSSIL_GFX_RANDOMIZER_LENGTH))
{
sprite->callback = SpriteCallbackDummy;
}
else if (sprite->pos1.y >= 0x60)
{
u8 i;
for (i = 0; i < 2; i++)
{
sub_81BF2B8(gUnknown_0203CF0C->frameImageTiles, gUnknown_0203CF0C->unkC[gUnknown_0203CF0C->unk10++], 0, 16, 0);
}
StartSpriteAnim(sprite, 0);
}
else
{
sprite->pos1.y++;
}
}

106
src/gym_leader_rematch.c Normal file
View File

@ -0,0 +1,106 @@
#include "global.h"
#include "constants/flags.h"
#include "random.h"
#include "event_data.h"
#include "battle_setup.h"
#include "gym_leader_rematch.h"
static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 maxRematch);
static s32 GetRematchIndex(u32 trainerIdx);
static const u16 GymLeaderRematches_AfterNewMauville[] = {
REMATCH_ROXANNE,
REMATCH_BRAWLY,
REMATCH_WATTSON,
REMATCH_FLANNERY,
REMATCH_NORMAN,
REMATCH_WINONA,
REMATCH_TATE_AND_LIZA,
REMATCH_JUAN
};
static const u16 GymLeaderRematches_BeforeNewMauville[] = {
REMATCH_ROXANNE,
REMATCH_BRAWLY,
// Wattson isn't available at this time
REMATCH_FLANNERY,
REMATCH_NORMAN,
REMATCH_WINONA,
REMATCH_TATE_AND_LIZA,
REMATCH_JUAN
};
void UpdateGymLeaderRematch(void)
{
if (FlagGet(FLAG_SYS_GAME_CLEAR) && (Random() % 100) <= 30)
{
if (FlagGet(FLAG_WATTSON_REMATCH_AVAILABLE))
UpdateGymLeaderRematchFromArray(GymLeaderRematches_AfterNewMauville, ARRAY_COUNT(GymLeaderRematches_AfterNewMauville), 5);
else
UpdateGymLeaderRematchFromArray(GymLeaderRematches_BeforeNewMauville, ARRAY_COUNT(GymLeaderRematches_BeforeNewMauville), 1);
}
}
static void UpdateGymLeaderRematchFromArray(const u16 *data, size_t size, u32 maxRematch)
{
s32 whichLeader = 0;
s32 lowestRematchIndex = 5;
u32 i;
s32 rematchIndex;
for (i = 0; i < size; i++)
{
if (!gSaveBlock1Ptr->trainerRematches[data[i]])
{
rematchIndex = GetRematchIndex(data[i]);
if (lowestRematchIndex > rematchIndex)
lowestRematchIndex = rematchIndex;
whichLeader++;
}
}
if (whichLeader != 0 && lowestRematchIndex <= maxRematch)
{
whichLeader = 0;
for (i = 0; i < size; i++)
{
if (!gSaveBlock1Ptr->trainerRematches[data[i]])
{
rematchIndex = GetRematchIndex(data[i]);
if (rematchIndex == lowestRematchIndex)
whichLeader++;
}
}
if (whichLeader != 0)
{
whichLeader = Random() % whichLeader;
for (i = 0; i < size; i++)
{
if (!gSaveBlock1Ptr->trainerRematches[data[i]])
{
rematchIndex = GetRematchIndex(data[i]);
if (rematchIndex == lowestRematchIndex)
{
if (whichLeader == 0)
{
gSaveBlock1Ptr->trainerRematches[data[i]] = lowestRematchIndex;
break;
}
whichLeader--;
}
}
}
}
}
}
static s32 GetRematchIndex(u32 trainerIdx)
{
s32 i;
for (i = 0; i < 5; i++)
{
if (!HasTrainerBeenFought(gRematchTable[trainerIdx].trainerIds[i]))
{
return i;
}
}
return 5;
}

View File

@ -328,7 +328,6 @@ extern u8* gReturnToXStringsTable[];
extern u32 gUnknown_0203CE5E[];
extern u8 EventScript_2736B3[];
extern const u16 gUnknown_0860F074[];
extern struct BattleMove gBattleMoves[];
void ResetBagScrollPositions(void)
{

View File

@ -606,7 +606,6 @@ u8 sub_818E06C(void)
}
}
#ifdef NONMATCHING
static u8 sub_818E13C(void)
{
u8 retval;
@ -627,9 +626,11 @@ static u8 sub_818E13C(void)
len = sub_818E258(gUnknown_0203CD68->playerName);
if (len == sub_818E258(gSaveBlock2Ptr->playerName))
{
u8 *name = gUnknown_0203CD68->playerName;
for (i = 0; i < len; i ++)
{
if (gUnknown_0203CD68->playerName[i] != gSaveBlock2Ptr->playerName[i])
name = gUnknown_0203CD68->playerName;
if (name[i] != gSaveBlock2Ptr->playerName[i])
{
retval = 2;
break;
@ -640,85 +641,6 @@ static u8 sub_818E13C(void)
}
return retval;
}
#else
ASM_DIRECT static u8 sub_818E13C(void)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tmovs r7, 0x1\n"
"\tldr r5, =gUnknown_0203CD68\n"
"\tldr r0, =gSaveBlock1Ptr\n"
"\tldr r1, [r0]\n"
"\tldr r2, =0x00003b58\n"
"\tadds r0, r1, r2\n"
"\tstr r0, [r5]\n"
"\tldrb r0, [r0, 0x18]\n"
"\tcmp r0, 0xFF\n"
"\tbne _0818E174\n"
"\tldr r0, =gStringVar1\n"
"\tldr r1, =gText_Lady2\n"
"\tbl StringCopy7\n"
"\tmovs r7, 0\n"
"\tb _0818E1DC\n"
"\t.pool\n"
"_0818E174:\n"
"\tldr r4, =gStringVar1\n"
"\tldr r0, =0x00003b70\n"
"\tadds r1, r0\n"
"\tadds r0, r4, 0\n"
"\tbl StringCopy7\n"
"\tldr r0, [r5]\n"
"\tadds r0, 0x2D\n"
"\tldrb r1, [r0]\n"
"\tadds r0, r4, 0\n"
"\tbl ConvertInternationalString\n"
"\tldr r0, [r5]\n"
"\tadds r0, 0x18\n"
"\tbl sub_818E258\n"
"\tlsls r0, 24\n"
"\tlsrs r4, r0, 24\n"
"\tldr r6, =gSaveBlock2Ptr\n"
"\tldr r0, [r6]\n"
"\tbl sub_818E258\n"
"\tlsls r0, 24\n"
"\tlsrs r0, 24\n"
"\tcmp r4, r0\n"
"\tbne _0818E1DC\n"
"\tldr r0, [r5]\n"
"\tmovs r2, 0\n"
"\tcmp r2, r4\n"
"\tbcs _0818E1DC\n"
"\tldr r1, [r6]\n"
"\tldrb r0, [r0, 0x18]\n"
"\tldrb r1, [r1]\n"
"\tcmp r0, r1\n"
"\tbne _0818E1DA\n"
"_0818E1BA:\n"
"\tadds r0, r2, 0x1\n"
"\tlsls r0, 24\n"
"\tlsrs r2, r0, 24\n"
"\tcmp r2, r4\n"
"\tbcs _0818E1DC\n"
"\tldr r0, =gUnknown_0203CD68\n"
"\tldr r1, [r0]\n"
"\tadds r1, 0x18\n"
"\tadds r1, r2\n"
"\tldr r0, =gSaveBlock2Ptr\n"
"\tldr r0, [r0]\n"
"\tadds r0, r2\n"
"\tldrb r1, [r1]\n"
"\tldrb r0, [r0]\n"
"\tcmp r1, r0\n"
"\tbeq _0818E1BA\n"
"_0818E1DA:\n"
"\tmovs r7, 0x2\n"
"_0818E1DC:\n"
"\tadds r0, r7, 0\n"
"\tpop {r4-r7}\n"
"\tpop {r1}\n"
"\tbx r1\n"
"\t.pool");
}
#endif
static u8 sub_818E1F4(void)
{

View File

@ -67,7 +67,6 @@ extern const union AnimCmd *gUnknown_082FF70C[];
extern const union AnimCmd *const *const gMonAnimationsSpriteAnimsPtrTable[];
extern const union AnimCmd *const *const gUnknown_08305D0C[];
extern const union AnimCmd *const *const gUnknown_0830536C[];
extern const struct BattleMove gBattleMoves[];
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
extern const struct UnknownPokemonStruct3 gUnknown_08610970[];
extern const struct CompressedSpritePalette gMonPaletteTable[];
@ -110,6 +109,9 @@ EWRAM_DATA struct SpriteTemplate gUnknown_0202499C = {0};
EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL};
// const rom data
#include "data/battle_moves.h"
static const u8 sUnreferencedData[] = {0x34, 0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00};
const u16 gSpeciesToHoennPokedexNum[] = {203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 156, 157, 112, 113, 227, 228, 229, 230, 231, 232, 233, 234, 153, 154, 138, 139, 63, 64, 88, 89, 90, 235, 236, 237, 238, 239, 240, 241, 242, 158, 159, 243, 244, 245, 246, 247, 248, 249, 39, 40, 41, 73, 74, 75, 250, 251, 252, 66, 67, 57, 58, 59, 253, 254, 255, 256, 82, 83, 257, 92, 93, 258, 259, 106, 107, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 84, 85, 270, 271, 272, 273, 274, 275, 276, 108, 109, 169, 170, 277, 278, 279, 184, 185, 50, 51, 143, 144, 280, 281, 282, 283, 284, 167, 285, 52, 53, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 65, 181, 182, 155, 324, 137, 325, 326, 162, 163, 327, 328, 329, 91, 55, 56, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 161, 164, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 168, 357, 358, 359, 103, 104, 360, 361, 180, 362, 363, 364, 365, 115, 366, 367, 186, 165, 166, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 42, 43, 44, 25, 26, 34, 35, 114, 27, 28, 32, 33, 99, 100, 61, 62, 145, 131, 132, 60, 105, 68, 127, 128, 183, 129, 130, 140, 141, 97, 98, 116, 117, 118, 48, 49, 78, 79, 101, 102, 173, 174, 175, 119, 120, 171, 172, 125, 126, 54, 110, 111, 80, 81, 69, 76, 77, 121, 122, 160, 148, 149, 94, 36, 37, 38, 95, 96, 150, 45, 46, 47, 176, 177, 178, 152, 146, 147, 124, 123, 179, 70, 71, 72, 142, 86, 87, 133, 134, 135, 136, 29, 30, 31, 187, 188, 189, 190, 191, 192, 193, 194, 195, 198, 199, 200, 196, 197, 201, 202, 151};
const u16 gSpeciesToNationalPokedexNum[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 290, 291, 292, 276, 277, 285, 286, 327, 278, 279, 283, 284, 320, 321, 300, 301, 352, 343, 344, 299, 324, 302, 339, 340, 370, 341, 342, 349, 350, 318, 319, 328, 329, 330, 296, 297, 309, 310, 322, 323, 363, 364, 365, 331, 332, 361, 362, 337, 338, 298, 325, 326, 311, 312, 303, 307, 308, 333, 334, 360, 355, 356, 315, 287, 288, 289, 316, 317, 357, 293, 294, 295, 366, 367, 368, 359, 353, 354, 336, 335, 369, 304, 305, 306, 351, 313, 314, 345, 346, 347, 348, 280, 281, 282, 371, 372, 373, 374, 375, 376, 377, 378, 379, 382, 383, 384, 380, 381, 385, 386, 358};
const u16 gHoennToNationalOrder[] = {252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 63, 64, 65, 290, 291, 292, 293, 294, 295, 296, 297, 118, 119, 129, 130, 298, 183, 184, 74, 75, 76, 299, 300, 301, 41, 42, 169, 72, 73, 302, 303, 304, 305, 306, 66, 67, 68, 307, 308, 309, 310, 311, 312, 81, 82, 100, 101, 313, 314, 43, 44, 45, 182, 84, 85, 315, 316, 317, 318, 319, 320, 321, 322, 323, 218, 219, 324, 88, 89, 109, 110, 325, 326, 27, 28, 327, 227, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 174, 39, 40, 349, 350, 351, 120, 121, 352, 353, 354, 355, 356, 357, 358, 359, 37, 38, 172, 25, 26, 54, 55, 360, 202, 177, 178, 203, 231, 232, 127, 214, 111, 112, 361, 362, 363, 364, 365, 366, 367, 368, 369, 222, 170, 171, 370, 116, 117, 230, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 29, 30, 31, 32, 33, 34, 35, 36, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 77, 78, 79, 80, 83, 86, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 102, 103, 104, 105, 106, 107, 108, 113, 114, 115, 122, 123, 124, 125, 126, 128, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 173, 175, 176, 179, 180, 181, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 215, 216, 217, 220, 221, 223, 224, 225, 226, 228, 229, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411};
@ -2196,7 +2198,7 @@ void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
(var) /= (gStatStageRatios)[(mon)->statStages[(statIndex)]][1]; \
}
s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 bankAtk, u8 bankDef)
s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 battlerIdAtk, u8 battlerIdDef)
{
u32 i;
s32 damage = 0;
@ -2226,8 +2228,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (attacker->item == ITEM_ENIGMA_BERRY)
{
attackerHoldEffect = gEnigmaBerries[bankAtk].holdEffect;
attackerHoldEffectParam = gEnigmaBerries[bankAtk].holdEffectParam;
attackerHoldEffect = gEnigmaBerries[battlerIdAtk].holdEffect;
attackerHoldEffectParam = gEnigmaBerries[battlerIdAtk].holdEffectParam;
}
else
{
@ -2237,8 +2239,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (defender->item == ITEM_ENIGMA_BERRY)
{
defenderHoldEffect = gEnigmaBerries[bankDef].holdEffect;
defenderHoldEffectParam = gEnigmaBerries[bankDef].holdEffectParam;
defenderHoldEffect = gEnigmaBerries[battlerIdDef].holdEffect;
defenderHoldEffectParam = gEnigmaBerries[battlerIdDef].holdEffectParam;
}
else
{
@ -2249,13 +2251,13 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (attacker->ability == ABILITY_HUGE_POWER || attacker->ability == ABILITY_PURE_POWER)
attack *= 2;
if (ShouldGetStatBadgeBoost(FLAG_BADGE01_GET, bankAtk))
if (ShouldGetStatBadgeBoost(FLAG_BADGE01_GET, battlerIdAtk))
attack = (110 * attack) / 100;
if (ShouldGetStatBadgeBoost(FLAG_BADGE05_GET, bankDef))
if (ShouldGetStatBadgeBoost(FLAG_BADGE05_GET, battlerIdDef))
defense = (110 * defense) / 100;
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, bankAtk))
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerIdAtk))
spAttack = (110 * spAttack) / 100;
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, bankDef))
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerIdDef))
spDefense = (110 * spDefense) / 100;
for (i = 0; i < ARRAY_COUNT(sHoldEffectToType); i++)
@ -2440,7 +2442,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
}
// flash fire triggered
if ((gBattleResources->flags->flags[bankAtk] & UNKNOWN_FLAG_FLASH_FIRE) && type == TYPE_FIRE)
if ((gBattleResources->flags->flags[battlerIdAtk] & UNKNOWN_FLAG_FLASH_FIRE) && type == TYPE_FIRE)
damage = (15 * damage) / 10;
}

View File

@ -115,8 +115,6 @@ extern u8 gText_Appeal[];
extern u8 gText_Jam[];
extern u8 gText_OTSlash[];
extern u8 gText_UnkCtrlF907F908[];
extern u8 gAbilityNames[][13];
extern u8 *gAbilityDescriptionPointers[];
extern u8 gText_XNature[];
extern u8 gText_XNatureHatchedAtYZ[];
extern u8 gText_XNatureHatchedSomewhereAt[];
@ -146,7 +144,6 @@ extern u8 gText_OneDash[];
extern u8 gText_TwoDashes[];
extern u8 gText_ThreeDashes[];
extern u8 gUnknown_0861CE97[];
extern struct BattleMove gBattleMoves[];
extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f);
extern bool8 sub_81A6BF4();
@ -2539,7 +2536,7 @@ void sub_81C2554()
gUnknown_0203CF1C->unk40CB[i] |= 0xFF;
}
void sub_81C25A4(u8 a, u8 *b, u8 c, u8 d, u8 e, u8 f)
void sub_81C25A4(u8 a, const u8 *b, u8 c, u8 d, u8 e, u8 f)
{
AddTextPrinterParameterized2(a, 1, c, d, 0, e, gUnknown_0861CD2C[f], 0, b);
}

View File

@ -1612,7 +1612,7 @@ bool8 ScrCmd_buffernumberstring(struct ScriptContext *ctx)
{
u8 stringVarIndex = ScriptReadByte(ctx);
u16 v1 = VarGet(ScriptReadHalfword(ctx));
u8 v2 = sub_80EF370(v1);
u8 v2 = CountDigits(v1);
ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], v1, 0, v2);
return FALSE;

View File

@ -4,18 +4,15 @@
#include "m4a.h"
#include "palette.h"
#include "sound.h"
#include "constants/songs.h"
#include "string_util.h"
#include "window.h"
#include "text.h"
#include "blit.h"
extern void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue);
extern void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height);
extern void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight);
extern u8 GetKeypadIconWidth(u8 keypadIconId);
extern void CopyWindowToVram(u8 windowId, u8 mode);
extern u16 Font6Func(struct TextPrinter *textPrinter);
extern u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese);
extern void PlaySE(u16 songNum);
extern u8* UnkTextUtil_GetPtrI(u8 a1);
extern int sub_8197964();
@ -27,7 +24,6 @@ static u16 gLastTextBgColor;
static u16 gLastTextFgColor;
static u16 gLastTextShadowColor;
extern struct Main gMain;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
const struct FontInfo *gFonts;
@ -1986,7 +1982,7 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
result = TRUE;
PlaySE(5);
PlaySE(SE_SELECT);
}
}
return result;
@ -2004,7 +2000,7 @@ bool16 TextPrinterWait(struct TextPrinter *textPrinter)
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
result = TRUE;
PlaySE(5);
PlaySE(SE_SELECT);
}
}
return result;

483
src/tv.c

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,8 @@
#include "global.h"
#include "window.h"
#include "malloc.h"
#include "bg.h"
#include "blit.h"
u32 filler_03002F58;
u32 filler_03002F5C;
@ -15,19 +17,6 @@ EWRAM_DATA struct Window gWindows[WINDOWS_MAX] = {0};
EWRAM_DATA static struct Window* sWindowPtr = NULL;
EWRAM_DATA static u16 sWindowSize = 0;
extern void* GetBgTilemapBuffer(u8 bg);
extern int DummiedOutFireRedLeafGreenTileAllocFunc(int, int, int, int);
extern u16 GetBgAttribute(u8 bg, u8 attributeId);
extern void SetBgTilemapBuffer(u8 bg, void *tilemap);
extern void CopyBgTilemapBufferToVram(u8 bg);
extern u8 LoadBgTiles(u8 bg, void *src, u16 size, u16 destOffset);
extern void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, u16 tileNumDelta);
extern void FillBgTilemapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette);
extern void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height, u8 colorKey);
extern void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dest, u16 srcX, u16 srcY, u16 destX, u16 destY, u16 width, u16 height, u8 colorKey, u8 paletteNum);
extern void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue);
extern void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue);
static u8 GetNumActiveWindowsOnBg(u8 bgId);
static u8 GetNumActiveWindowsOnBg8Bit(u8 bgId);
@ -130,13 +119,13 @@ u16 AddWindow(const struct WindowTemplate *template)
u8 *allocatedTilemapBuffer;
int i;
for (win = 0; win < 0x20; ++win)
for (win = 0; win < WINDOWS_MAX; ++win)
{
if ((bgLayer = gWindows[win].window.priority) == 0xFF)
break;
}
if (win == 0x20)
if (win == WINDOWS_MAX)
return 0xFF;
bgLayer = template->priority;
@ -199,13 +188,13 @@ int AddWindowWithoutTileMap(const struct WindowTemplate *template)
u8 bgLayer;
int allocatedBaseBlock;
for (win = 0; win < 0x20; ++win)
for (win = 0; win < WINDOWS_MAX; ++win)
{
if (gWindows[win].window.priority == 0xFF)
break;
}
if (win == 0x20)
if (win == WINDOWS_MAX)
return 0xFF;
bgLayer = template->priority;