rom3 is decompiled

This commit is contained in:
DizzyEggg 2017-10-14 11:34:26 +02:00
parent 72ed861715
commit 14e41d6c50
18 changed files with 514 additions and 1106 deletions

View File

@ -1572,7 +1572,7 @@ _0806513A:
lsrs r1, 16
movs r0, 0x1
mov r2, sp
bl dp01_build_cmdbuf_x1D_1D_numargs_varargs
bl EmitDataTransfer
bl LinkOpponentBufferExecCompleted
add sp, 0x100
pop {r4-r6}

View File

@ -1113,7 +1113,7 @@ _0814B872:
lsrs r1, 16
movs r0, 0x1
mov r2, sp
bl dp01_build_cmdbuf_x1D_1D_numargs_varargs
bl EmitDataTransfer
bl LinkPartnerBufferExecCompleted
add sp, 0x100
pop {r4-r6}

View File

@ -1666,7 +1666,7 @@ _0805FFEA:
lsrs r1, 16
movs r0, 0x1
mov r2, sp
bl dp01_build_cmdbuf_x1D_1D_numargs_varargs
bl EmitDataTransfer
bl OpponentBufferExecCompleted
add sp, 0x100
pop {r4-r6}
@ -2607,7 +2607,7 @@ _08060806:
ldrb r1, [r0]
movs r0, 0x1
adds r2, r4, 0
bl dp01_build_cmdbuf_x1D_1D_numargs_varargs
bl EmitDataTransfer
bl OpponentBufferExecCompleted
add sp, 0x58
pop {r4-r7}
@ -5243,7 +5243,7 @@ sub_8061FB8: @ 8061FB8
movs r0, 0x1
movs r1, 0xA
_08061FD6:
bl EmitCmd_x21
bl EmitCmd33
_08061FDA:
bl OpponentBufferExecCompleted
b _08062156
@ -5347,7 +5347,7 @@ _0806209C:
movs r0, 0x1
movs r1, 0xA
adds r2, r4, 0
bl EmitCmd_x21
bl EmitCmd33
b _08061FDA
.pool
_080620C4:
@ -5378,7 +5378,7 @@ _080620C6:
movs r0, 0x1
movs r1, 0xA
adds r2, r4, 0
bl EmitCmd_x21
bl EmitCmd33
b _08062152
.pool
_08062108:
@ -5401,7 +5401,7 @@ _08062108:
orrs r2, r4
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
b _08062152
.pool
_0806213C:
@ -5413,7 +5413,7 @@ _0806213C:
orrs r2, r4
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
_08062152:
bl OpponentBufferExecCompleted
_08062156:
@ -5435,7 +5435,7 @@ sub_806215C: @ 806215C
adds r0, 0xC0
ldrb r1, [r0]
movs r0, 0x1
bl dp01_build_cmdbuf_x23_aa_0
bl EmitCmd35
bl OpponentBufferExecCompleted
pop {r0}
bx r0
@ -5550,7 +5550,7 @@ _0806225A:
lsrs r1, 24
movs r0, 0x1
movs r2, 0
bl dp01_build_cmdbuf_x22_a_three_bytes
bl EmitCmd34
bl OpponentBufferExecCompleted
pop {r4-r7}
pop {r0}

View File

@ -226,7 +226,7 @@ _0805764C:
movs r0, 0x1
movs r1, 0x3
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
b _080577C2
_08057658:
movs r0, 0x20
@ -393,7 +393,7 @@ _080577B2:
movs r1, 0xC
_080577BC:
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
_080577C2:
bl PlayerBufferExecCompleted
b _080577E8
@ -518,7 +518,7 @@ _080578A0:
orrs r2, r0
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
ldrb r0, [r4]
movs r1, 0x1
bl dp11b_obj_free
@ -1086,7 +1086,7 @@ _08057E14:
_08057E1C:
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
bl PlayerBufferExecCompleted
b _08057F9E
.pool
@ -3413,7 +3413,7 @@ _080591FE:
lsrs r2, 16
movs r0, 0x1
movs r1, 0xB
bl EmitCmd_x21
bl EmitCmd33
strb r5, [r4]
bl IsDoubleBattle
lsls r0, 24
@ -3686,7 +3686,7 @@ _08059430:
lsrs r2, 16
movs r0, 0x1
movs r1, 0xB
bl EmitCmd_x21
bl EmitCmd33
strb r5, [r4]
ldr r0, =sub_8059544
str r0, [r6]
@ -4059,14 +4059,14 @@ sub_8059828: @ 8059828
ldrb r1, [r0]
ldr r2, =gUnknown_0203CF00
movs r0, 0x1
bl dp01_build_cmdbuf_x22_a_three_bytes
bl EmitCmd34
b _0805987A
.pool
_08059870:
movs r0, 0x1
movs r1, 0x6
movs r2, 0
bl dp01_build_cmdbuf_x22_a_three_bytes
bl EmitCmd34
_0805987A:
ldr r1, =gBattleBufferA
ldr r0, =gActiveBank
@ -4130,7 +4130,7 @@ sub_80598E0: @ 80598E0
ldr r0, =gScriptItemId
ldrh r1, [r0]
movs r0, 0x1
bl dp01_build_cmdbuf_x23_aa_0
bl EmitCmd35
bl PlayerBufferExecCompleted
_08059906:
pop {r0}
@ -4291,14 +4291,14 @@ _08059A2C:
movs r0, 0x1
movs r1, 0xE
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
b _08059A76
.pool
_08059A6C:
movs r0, 0x1
movs r1, 0xD
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
_08059A76:
bl PlayerBufferExecCompleted
_08059A7A:
@ -4772,7 +4772,7 @@ _08059E4E:
lsrs r1, 16
movs r0, 0x1
mov r2, sp
bl dp01_build_cmdbuf_x1D_1D_numargs_varargs
bl EmitDataTransfer
bl PlayerBufferExecCompleted
add sp, 0x100
pop {r4-r6}
@ -5713,7 +5713,7 @@ _0805A66A:
ldrb r1, [r0]
movs r0, 0x1
adds r2, r4, 0
bl dp01_build_cmdbuf_x1D_1D_numargs_varargs
bl EmitDataTransfer
bl PlayerBufferExecCompleted
add sp, 0x58
pop {r4-r7}
@ -8658,7 +8658,7 @@ sub_805C158: @ 805C158
lsrs r2, 16
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
bl PlayerBufferExecCompleted
_0805C194:
pop {r0}
@ -8826,7 +8826,7 @@ _0805C2C8:
lsrs r1, 24
movs r0, 0x1
mov r2, r12
bl dp01_build_cmdbuf_x22_a_three_bytes
bl EmitCmd34
bl PlayerBufferExecCompleted
b _0805C3BC
.pool
@ -9378,7 +9378,7 @@ sub_805C80C: @ 805C80C
movs r0, 0x1
movs r1, 0
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
bl PlayerBufferExecCompleted
pop {r0}
bx r0
@ -9390,7 +9390,7 @@ sub_805C820: @ 805C820
movs r0, 0x1
movs r1, 0
movs r2, 0
bl dp01_build_cmdbuf_x22_a_three_bytes
bl EmitCmd34
bl PlayerBufferExecCompleted
pop {r0}
bx r0
@ -9401,7 +9401,7 @@ sub_805C834: @ 805C834
push {lr}
movs r0, 0x1
movs r1, 0
bl dp01_build_cmdbuf_x23_aa_0
bl EmitCmd35
bl PlayerBufferExecCompleted
pop {r0}
bx r0
@ -9412,7 +9412,7 @@ sub_805C848: @ 805C848
push {lr}
movs r0, 0x1
movs r1, 0
bl dp01_build_cmdbuf_x24_aa_0
bl EmitCmd36
bl PlayerBufferExecCompleted
pop {r0}
bx r0

View File

@ -645,7 +645,7 @@ _081BB2E2:
lsrs r2, 16
movs r0, 0x1
movs r1, 0xB
bl EmitCmd_x21
bl EmitCmd33
strb r5, [r4]
bl IsDoubleBattle
lsls r0, 24
@ -918,7 +918,7 @@ _081BB514:
lsrs r2, 16
movs r0, 0x1
movs r1, 0xB
bl EmitCmd_x21
bl EmitCmd33
strb r5, [r4]
ldr r0, =sub_81BB628
str r0, [r6]
@ -1688,7 +1688,7 @@ _081BBCBE:
lsrs r1, 16
movs r0, 0x1
mov r2, sp
bl dp01_build_cmdbuf_x1D_1D_numargs_varargs
bl EmitDataTransfer
bl PlayerPartnerBufferExecCompleted
add sp, 0x100
pop {r4-r6}
@ -5068,7 +5068,7 @@ _081BDB3C:
orrs r2, r5
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
bl PlayerPartnerBufferExecCompleted
pop {r4-r6}
pop {r0}
@ -5138,7 +5138,7 @@ _081BDBD0:
lsrs r1, 24
movs r0, 0x1
movs r2, 0
bl dp01_build_cmdbuf_x22_a_three_bytes
bl EmitCmd34
bl PlayerPartnerBufferExecCompleted
pop {r4-r6}
pop {r0}

View File

@ -1553,7 +1553,7 @@ _0818727E:
lsrs r1, 16
movs r0, 0x1
mov r2, sp
bl dp01_build_cmdbuf_x1D_1D_numargs_varargs
bl EmitDataTransfer
bl RecordedOpponentBufferExecCompleted
add sp, 0x100
pop {r4-r6}
@ -4754,7 +4754,7 @@ sub_8188EF0: @ 8188EF0
lsrs r1, 24
movs r0, 0x1
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
bl RecordedOpponentBufferExecCompleted
pop {r0}
bx r0
@ -4785,7 +4785,7 @@ sub_8188F20: @ 8188F20
lsrs r2, 16
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
b _08188F6C
.pool
_08188F48:
@ -4803,7 +4803,7 @@ _08188F48:
orrs r2, r4
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
_08188F6C:
bl RecordedOpponentBufferExecCompleted
pop {r4,r5}
@ -4839,7 +4839,7 @@ sub_8188F88: @ 8188F88
ldrb r1, [r0]
movs r0, 0x1
movs r2, 0
bl dp01_build_cmdbuf_x22_a_three_bytes
bl EmitCmd34
bl RecordedOpponentBufferExecCompleted
pop {r4}
pop {r0}

View File

@ -1489,7 +1489,7 @@ _0818A646:
lsrs r1, 16
movs r0, 0x1
mov r2, sp
bl dp01_build_cmdbuf_x1D_1D_numargs_varargs
bl EmitDataTransfer
bl RecordedPlayerBufferExecCompleted
add sp, 0x100
pop {r4-r6}
@ -4861,7 +4861,7 @@ sub_818C49C: @ 818C49C
lsrs r1, 24
movs r0, 0x1
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
bl RecordedPlayerBufferExecCompleted
_0818C4C6:
pop {r0}
@ -4897,7 +4897,7 @@ _0818C508:
lsrs r1, 24
movs r0, 0x1
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
bl RecordedPlayerBufferExecCompleted
_0818C522:
pop {r0}
@ -4929,7 +4929,7 @@ sub_818C538: @ 818C538
lsrs r2, 16
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
b _0818C584
.pool
_0818C560:
@ -4947,7 +4947,7 @@ _0818C560:
orrs r2, r4
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
_0818C584:
bl RecordedPlayerBufferExecCompleted
pop {r4,r5}
@ -4983,7 +4983,7 @@ sub_818C5A0: @ 818C5A0
ldrb r1, [r0]
movs r0, 0x1
movs r2, 0
bl dp01_build_cmdbuf_x22_a_three_bytes
bl EmitCmd34
bl RecordedPlayerBufferExecCompleted
pop {r4}
pop {r0}

View File

@ -103,13 +103,13 @@ _0815942A:
movs r1, 0x7
_0815942E:
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
b _08159440
_08159436:
movs r0, 0x1
movs r1, 0x8
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
_08159440:
bl SafariBufferExecCompleted
b _0815954E
@ -399,7 +399,7 @@ sub_8159698: @ 8159698
ldr r0, =gScriptItemId
ldrh r1, [r0]
movs r0, 0x1
bl dp01_build_cmdbuf_x23_aa_0
bl EmitCmd35
bl SafariBufferExecCompleted
_081596BE:
pop {r0}

View File

@ -153,7 +153,7 @@ _081684CE:
movs r1, 0x9
_081684E4:
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
bl WallyBufferExecCompleted
ldr r1, [r4]
adds r1, 0x94
@ -208,7 +208,7 @@ _08168540:
movs r0, 0x1
movs r1, 0x1
movs r2, 0
bl EmitCmd_x21
bl EmitCmd33
bl WallyBufferExecCompleted
_08168564:
pop {r4,r5}
@ -311,7 +311,7 @@ sub_8168610: @ 8168610
ldr r0, =gScriptItemId
ldrh r1, [r0]
movs r0, 0x1
bl dp01_build_cmdbuf_x23_aa_0
bl EmitCmd35
bl WallyBufferExecCompleted
_08168636:
pop {r0}
@ -975,7 +975,7 @@ _08168BFA:
lsrs r1, 16
movs r0, 0x1
mov r2, sp
bl dp01_build_cmdbuf_x1D_1D_numargs_varargs
bl EmitDataTransfer
bl WallyBufferExecCompleted
add sp, 0x100
pop {r4-r6}
@ -3777,7 +3777,7 @@ _0816A550:
lsls r2, 1
movs r0, 0x1
movs r1, 0xA
bl EmitCmd_x21
bl EmitCmd33
bl WallyBufferExecCompleted
_0816A574:
pop {r4}

View File

@ -1,971 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start EmitCmd13
EmitCmd13: @ 8033E10
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x13
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end EmitCmd13
thumb_func_start EmitChooseMove
EmitChooseMove: @ 8033E30
push {r4-r6,lr}
adds r5, r3, 0
lsls r0, 24
lsrs r6, r0, 24
ldr r3, =gBattleBuffersTransferData
movs r4, 0
movs r0, 0x14
strb r0, [r3]
strb r1, [r3, 0x1]
strb r2, [r3, 0x2]
strb r4, [r3, 0x3]
movs r2, 0
adds r1, r3, 0
adds r4, r1, 0x4
_08033E4C:
adds r0, r5, r2
ldrb r0, [r0]
strb r0, [r4]
adds r4, 0x1
adds r2, 0x1
cmp r2, 0x13
bls _08033E4C
adds r0, r6, 0
movs r2, 0x18
bl PrepareBufferDataTransfer
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end EmitChooseMove
thumb_func_start EmitOpenBag
EmitOpenBag: @ 8033E6C
push {r4,r5,lr}
adds r4, r1, 0
lsls r0, 24
lsrs r5, r0, 24
ldr r1, =gBattleBuffersTransferData
movs r0, 0x15
strb r0, [r1]
movs r2, 0
adds r3, r1, 0x1
_08033E7E:
adds r0, r4, r2
ldrb r0, [r0]
strb r0, [r3]
adds r3, 0x1
adds r2, 0x1
cmp r2, 0x2
ble _08033E7E
adds r0, r5, 0
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end EmitOpenBag
thumb_func_start EmitChoosePokemon
EmitChoosePokemon: @ 8033EA0
push {r4-r6,lr}
ldr r6, [sp, 0x10]
lsls r0, 24
lsrs r5, r0, 24
ldr r4, =gBattleBuffersTransferData
movs r0, 0x16
strb r0, [r4]
strb r1, [r4, 0x1]
strb r2, [r4, 0x2]
strb r3, [r4, 0x3]
movs r2, 0
adds r1, r4, 0
adds r3, r1, 0x4
_08033EBA:
adds r0, r6, r2
ldrb r0, [r0]
strb r0, [r3]
adds r3, 0x1
adds r2, 0x1
cmp r2, 0x2
ble _08033EBA
adds r0, r5, 0
movs r2, 0x8
bl PrepareBufferDataTransfer
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end EmitChoosePokemon
thumb_func_start dp01_build_cmdbuf_x17_17_17_17
dp01_build_cmdbuf_x17_17_17_17: @ 8033EDC
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x17
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x17_17_17_17
thumb_func_start EmitHealthBarUpdate
EmitHealthBarUpdate: @ 8033EFC
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 16
lsrs r1, 16
ldr r3, =gBattleBuffersTransferData
movs r4, 0
movs r2, 0x18
strb r2, [r3]
strb r4, [r3, 0x1]
strb r1, [r3, 0x2]
lsls r1, 16
asrs r1, 16
movs r2, 0xFF
lsls r2, 8
ands r1, r2
asrs r1, 8
strb r1, [r3, 0x3]
adds r1, r3, 0
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end EmitHealthBarUpdate
thumb_func_start EmitExpUpdate
EmitExpUpdate: @ 8033F34
push {r4,lr}
adds r4, r1, 0
lsls r0, 24
lsrs r0, 24
lsls r2, 16
lsrs r2, 16
ldr r1, =gBattleBuffersTransferData
movs r3, 0x19
strb r3, [r1]
strb r4, [r1, 0x1]
strb r2, [r1, 0x2]
lsls r2, 16
asrs r2, 16
movs r3, 0xFF
lsls r3, 8
ands r2, r3
asrs r2, 8
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end EmitExpUpdate
thumb_func_start EmitStatusIconUpdate
EmitStatusIconUpdate: @ 8033F68
push {r4-r6,lr}
adds r4, r1, 0
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r3, 0x1A
strb r3, [r1]
strb r4, [r1, 0x1]
movs r6, 0xFF
lsls r6, 8
adds r3, r4, 0
ands r3, r6
lsrs r3, 8
strb r3, [r1, 0x2]
movs r5, 0xFF
lsls r5, 16
adds r3, r4, 0
ands r3, r5
lsrs r3, 16
strb r3, [r1, 0x3]
lsrs r4, 24
strb r4, [r1, 0x4]
strb r2, [r1, 0x5]
adds r3, r2, 0
ands r3, r6
lsrs r3, 8
strb r3, [r1, 0x6]
adds r3, r2, 0
ands r3, r5
lsrs r3, 16
strb r3, [r1, 0x7]
lsrs r2, 24
strb r2, [r1, 0x8]
movs r2, 0x9
bl PrepareBufferDataTransfer
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end EmitStatusIconUpdate
thumb_func_start EmitStatusAnimation
EmitStatusAnimation: @ 8033FBC
push {r4,lr}
adds r4, r1, 0
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r3, 0x1B
strb r3, [r1]
strb r4, [r1, 0x1]
strb r2, [r1, 0x2]
movs r3, 0xFF
lsls r3, 8
ands r3, r2
lsrs r3, 8
strb r3, [r1, 0x3]
movs r3, 0xFF
lsls r3, 16
ands r3, r2
lsrs r3, 16
strb r3, [r1, 0x4]
lsrs r2, 24
strb r2, [r1, 0x5]
movs r2, 0x6
bl PrepareBufferDataTransfer
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end EmitStatusAnimation
thumb_func_start dp01_build_cmdbuf_x1C_a
dp01_build_cmdbuf_x1C_a: @ 8033FF8
push {lr}
adds r3, r1, 0
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x1C
strb r2, [r1]
strb r3, [r1, 0x1]
movs r2, 0x2
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x1C_a
thumb_func_start dp01_build_cmdbuf_x1D_1D_numargs_varargs
dp01_build_cmdbuf_x1D_1D_numargs_varargs: @ 8034018
push {r4-r6,lr}
lsls r0, 24
lsrs r6, r0, 24
lsls r1, 16
lsrs r4, r1, 16
ldr r1, =gBattleBuffersTransferData
movs r0, 0x1D
strb r0, [r1]
strb r0, [r1, 0x1]
strb r4, [r1, 0x2]
lsrs r0, r4, 8
strb r0, [r1, 0x3]
adds r5, r1, 0
cmp r4, 0
beq _08034048
adds r1, r5, 0x4
adds r3, r4, 0
_0803403A:
ldrb r0, [r2]
strb r0, [r1]
adds r2, 0x1
adds r1, 0x1
subs r3, 0x1
cmp r3, 0
bne _0803403A
_08034048:
adds r2, r4, 0x4
lsls r2, 16
lsrs r2, 16
adds r0, r6, 0
adds r1, r5, 0
bl PrepareBufferDataTransfer
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x1D_1D_numargs_varargs
thumb_func_start sub_8034060
sub_8034060: @ 8034060
push {r4-r6,lr}
adds r4, r3, 0
lsls r0, 24
lsrs r6, r0, 24
lsls r2, 16
lsrs r5, r2, 16
ldr r2, =gBattleBuffersTransferData
movs r0, 0x1E
strb r0, [r2]
strb r1, [r2, 0x1]
movs r3, 0xFF
lsls r3, 8
adds r0, r1, 0
ands r0, r3
lsrs r0, 8
strb r0, [r2, 0x2]
movs r0, 0xFF
lsls r0, 16
ands r0, r1
lsrs r0, 16
strb r0, [r2, 0x3]
lsrs r1, 24
strb r1, [r2, 0x4]
strb r5, [r2, 0x5]
adds r0, r5, 0
ands r0, r3
lsrs r0, 8
strb r0, [r2, 0x6]
adds r1, r2, 0
cmp r5, 0
beq _080340B0
adds r3, r1, 0x7
adds r2, r5, 0
_080340A2:
ldrb r0, [r4]
strb r0, [r3]
adds r4, 0x1
adds r3, 0x1
subs r2, 0x1
cmp r2, 0
bne _080340A2
_080340B0:
adds r2, r5, 0x7
lsls r2, 16
lsrs r2, 16
adds r0, r6, 0
bl PrepareBufferDataTransfer
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8034060
thumb_func_start sub_80340C8
sub_80340C8: @ 80340C8
push {r4-r6,lr}
lsls r0, 24
lsrs r6, r0, 24
lsls r1, 16
lsrs r4, r1, 16
ldr r1, =gBattleBuffersTransferData
movs r0, 0x1F
strb r0, [r1]
strb r4, [r1, 0x1]
lsrs r0, r4, 8
strb r0, [r1, 0x2]
adds r5, r1, 0
cmp r4, 0
beq _080340F6
adds r1, r5, 0x3
adds r3, r4, 0
_080340E8:
ldrb r0, [r2]
strb r0, [r1]
adds r2, 0x1
adds r1, 0x1
subs r3, 0x1
cmp r3, 0
bne _080340E8
_080340F6:
adds r2, r4, 0x3
lsls r2, 16
lsrs r2, 16
adds r0, r6, 0
adds r1, r5, 0
bl PrepareBufferDataTransfer
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_80340C8
thumb_func_start sub_8034110
sub_8034110: @ 8034110
push {r4-r6,lr}
lsls r0, 24
lsrs r6, r0, 24
lsls r1, 16
lsrs r4, r1, 16
ldr r1, =gBattleBuffersTransferData
movs r0, 0x20
strb r0, [r1]
strb r4, [r1, 0x1]
lsrs r0, r4, 8
strb r0, [r1, 0x2]
adds r5, r1, 0
cmp r4, 0
beq _0803413E
adds r1, r5, 0x3
adds r3, r4, 0
_08034130:
ldrb r0, [r2]
strb r0, [r1]
adds r2, 0x1
adds r1, 0x1
subs r3, 0x1
cmp r3, 0
bne _08034130
_0803413E:
adds r2, r4, 0x3
lsls r2, 16
lsrs r2, 16
adds r0, r6, 0
adds r1, r5, 0
bl PrepareBufferDataTransfer
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8034110
thumb_func_start EmitCmd_x21
EmitCmd_x21: @ 8034158
push {r4,lr}
adds r4, r1, 0
lsls r0, 24
lsrs r0, 24
lsls r2, 16
lsrs r2, 16
ldr r1, =gBattleBuffersTransferData
movs r3, 0x21
strb r3, [r1]
strb r4, [r1, 0x1]
strb r2, [r1, 0x2]
lsrs r2, 8
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end EmitCmd_x21
thumb_func_start dp01_build_cmdbuf_x22_a_three_bytes
dp01_build_cmdbuf_x22_a_three_bytes: @ 8034184
push {r4,r5,lr}
adds r4, r2, 0
lsls r0, 24
lsrs r5, r0, 24
ldr r2, =gBattleBuffersTransferData
movs r0, 0x22
strb r0, [r2]
strb r1, [r2, 0x1]
movs r3, 0
adds r1, r2, 0x2
_08034198:
adds r0, r4, r3
ldrb r0, [r0]
strb r0, [r1]
adds r1, 0x1
adds r3, 0x1
cmp r3, 0x2
ble _08034198
adds r0, r5, 0
adds r1, r2, 0
movs r2, 0x5
bl PrepareBufferDataTransfer
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x22_a_three_bytes
thumb_func_start dp01_build_cmdbuf_x23_aa_0
dp01_build_cmdbuf_x23_aa_0: @ 80341BC
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 16
lsrs r1, 16
ldr r3, =gBattleBuffersTransferData
movs r4, 0
movs r2, 0x23
strb r2, [r3]
strb r1, [r3, 0x1]
lsrs r1, 8
strb r1, [r3, 0x2]
strb r4, [r3, 0x3]
adds r1, r3, 0
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x23_aa_0
thumb_func_start dp01_build_cmdbuf_x24_aa_0
dp01_build_cmdbuf_x24_aa_0: @ 80341E8
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 16
lsrs r1, 16
ldr r3, =gBattleBuffersTransferData
movs r4, 0
movs r2, 0x24
strb r2, [r3]
strb r1, [r3, 0x1]
lsrs r1, 8
strb r1, [r3, 0x2]
strb r4, [r3, 0x3]
adds r1, r3, 0
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x24_aa_0
thumb_func_start dp01_build_cmdbuf_x25_25_25_25
dp01_build_cmdbuf_x25_25_25_25: @ 8034214
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x25
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x25_25_25_25
thumb_func_start dp01_build_cmdbuf_x26_a
dp01_build_cmdbuf_x26_a: @ 8034234
push {lr}
adds r3, r1, 0
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x26
strb r2, [r1]
strb r3, [r1, 0x1]
movs r2, 0x2
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x26_a
thumb_func_start dp01_build_cmdbuf_x27_27_27_27
dp01_build_cmdbuf_x27_27_27_27: @ 8034254
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x27
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x27_27_27_27
thumb_func_start dp01_build_cmdbuf_x28_28_28_28
dp01_build_cmdbuf_x28_28_28_28: @ 8034274
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x28
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x28_28_28_28
thumb_func_start EmitHitAnimation
EmitHitAnimation: @ 8034294
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x29
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end EmitHitAnimation
thumb_func_start Emit_x2A
Emit_x2A: @ 80342B4
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x2A
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end Emit_x2A
thumb_func_start EmitEffectivenessSound
EmitEffectivenessSound: @ 80342D4
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 16
lsrs r1, 16
ldr r3, =gBattleBuffersTransferData
movs r4, 0
movs r2, 0x2B
strb r2, [r3]
strb r1, [r3, 0x1]
lsrs r1, 8
strb r1, [r3, 0x2]
strb r4, [r3, 0x3]
adds r1, r3, 0
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end EmitEffectivenessSound
thumb_func_start EmitPlaySound
EmitPlaySound: @ 8034300
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 16
lsrs r1, 16
ldr r4, =gBattleBuffersTransferData
movs r3, 0x2C
strb r3, [r4]
strb r1, [r4, 0x1]
lsrs r1, 8
strb r1, [r4, 0x2]
strb r2, [r4, 0x3]
adds r1, r4, 0
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end EmitPlaySound
thumb_func_start EmitFaintingCry
EmitFaintingCry: @ 803432C
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x2D
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end EmitFaintingCry
thumb_func_start EmitIntroSlide
EmitIntroSlide: @ 803434C
push {lr}
adds r3, r1, 0
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x2E
strb r2, [r1]
strb r3, [r1, 0x1]
movs r2, 0x2
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end EmitIntroSlide
thumb_func_start EmitIntroTrainerBallThrow
EmitIntroTrainerBallThrow: @ 803436C
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x2F
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end EmitIntroTrainerBallThrow
thumb_func_start EmitDrawPartyStatusSummary
EmitDrawPartyStatusSummary: @ 803438C
push {r4,r5,lr}
adds r4, r1, 0
lsls r0, 24
lsrs r5, r0, 24
lsls r2, 24
lsrs r2, 24
ldr r1, =gBattleBuffersTransferData
movs r3, 0x30
strb r3, [r1]
movs r0, 0x7F
ands r0, r2
strb r0, [r1, 0x1]
movs r0, 0x80
ands r0, r2
lsls r0, 24
lsrs r0, 31
strb r0, [r1, 0x2]
strb r3, [r1, 0x3]
movs r2, 0
adds r3, r1, 0x4
_080343B4:
adds r0, r4, r2
ldrb r0, [r0]
strb r0, [r3]
adds r3, 0x1
adds r2, 0x1
cmp r2, 0x2F
ble _080343B4
adds r0, r5, 0
movs r2, 0x34
bl PrepareBufferDataTransfer
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end EmitDrawPartyStatusSummary
thumb_func_start EmitCmd49
EmitCmd49: @ 80343D4
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x31
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end EmitCmd49
thumb_func_start Emit_x32
Emit_x32: @ 80343F4
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x32
strb r2, [r1]
strb r2, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end Emit_x32
thumb_func_start EmitSpriteInvisibility
EmitSpriteInvisibility: @ 8034414
push {lr}
adds r3, r1, 0
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x33
strb r2, [r1]
strb r3, [r1, 0x1]
strb r2, [r1, 0x2]
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end EmitSpriteInvisibility
thumb_func_start EmitBattleAnimation
EmitBattleAnimation: @ 8034438
push {r4,lr}
adds r4, r1, 0
lsls r0, 24
lsrs r0, 24
lsls r2, 16
lsrs r2, 16
ldr r1, =gBattleBuffersTransferData
movs r3, 0x34
strb r3, [r1]
strb r4, [r1, 0x1]
strb r2, [r1, 0x2]
lsrs r2, 8
strb r2, [r1, 0x3]
movs r2, 0x4
bl PrepareBufferDataTransfer
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end EmitBattleAnimation
thumb_func_start EmitLinkStandbyMsg
EmitLinkStandbyMsg: @ 8034464
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
lsls r2, 24
lsrs r2, 24
ldr r4, =gBattleBuffersTransferData
movs r0, 0x35
strb r0, [r4]
strb r1, [r4, 0x1]
cmp r2, 0
beq _0803448C
adds r0, r4, 0x4
bl sub_81850DC
strb r0, [r4, 0x2]
strb r0, [r4, 0x3]
b _08034490
.pool
_0803448C:
strb r2, [r4, 0x2]
strb r2, [r4, 0x3]
_08034490:
ldr r1, =gBattleBuffersTransferData
ldrb r2, [r1, 0x2]
adds r2, 0x4
adds r0, r5, 0
bl PrepareBufferDataTransfer
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end EmitLinkStandbyMsg
thumb_func_start EmitResetActionMoveSelection
EmitResetActionMoveSelection: @ 80344A8
push {lr}
adds r3, r1, 0
lsls r0, 24
lsrs r0, 24
ldr r1, =gBattleBuffersTransferData
movs r2, 0x36
strb r2, [r1]
strb r3, [r1, 0x1]
movs r2, 0x2
bl PrepareBufferDataTransfer
pop {r0}
bx r0
.pool
thumb_func_end EmitResetActionMoveSelection
thumb_func_start Emit_x37
Emit_x37: @ 80344C8
push {r4,r5,lr}
adds r5, r0, 0
lsls r5, 24
lsrs r5, 24
ldr r4, =gBattleBuffersTransferData
movs r0, 0x37
strb r0, [r4]
strb r1, [r4, 0x1]
ldr r0, =gSaveBlock2Ptr
ldr r1, [r0]
ldr r0, =0x00000ca9
adds r1, r0
ldrb r0, [r1]
lsls r0, 28
lsrs r0, 31
strb r0, [r4, 0x2]
ldrb r0, [r1]
lsls r0, 28
lsrs r0, 31
strb r0, [r4, 0x3]
adds r0, r4, 0x6
bl sub_81850DC
strb r0, [r4, 0x4]
strb r0, [r4, 0x5]
ldrb r2, [r4, 0x4]
adds r2, 0x6
adds r0, r5, 0
adds r1, r4, 0
bl PrepareBufferDataTransfer
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end Emit_x37
.align 2, 0 @ Don't pad with nop.

View File

@ -54,7 +54,7 @@ enum
CONTROLLER_SETRAWMONDATA,
CONTROLLER_LOADMONSPRITE,
CONTROLLER_SWITCHINANIM,
CONTROLLER_RETURNPOKETOBALL,
CONTROLLER_RETURNMONTOBALL,
CONTROLLER_DRAWTRAINERPIC,
CONTROLLER_TRAINERSLIDE,
CONTROLLER_TRAINERSLIDEBACK,
@ -68,17 +68,17 @@ enum
CONTROLLER_PRINTSTRINGPLAYERONLY,
CONTROLLER_CHOOSEACTION,
CONTROLLER_19,
CONTROLLER_20,
CONTROLLER_CHOOSEMOVE,
CONTROLLER_OPENBAG,
CONTROLLER_22,
CONTROLLER_CHOOSEPOKEMON,
CONTROLLER_23,
CONTROLLER_HEALTHBARUPDATE,
CONTROLLER_EXPBARUPDATE,
CONTROLLER_EXPUPDATE,
CONTROLLER_STATUSICONUPDATE,
CONTROLLER_STATUSANIMATION,
CONTROLLER_STATUSXOR,
CONTROLLER_29,
CONTROLLER_DMATRANSFER,
CONTROLLER_DATATRANSFER,
CONTROLLER_DMA3TRANSFER,
CONTROLLER_31,
CONTROLLER_32,
CONTROLLER_33,
@ -92,11 +92,11 @@ enum
CONTROLLER_HITANIMATION,
CONTROLLER_42,
CONTROLLER_EFFECTIVENESSSOUND,
CONTROLLER_44,
CONTROLLER_PLAYFANFAREORBGM,
CONTROLLER_FAINTINGCRY,
CONTROLLER_INTROSLIDE,
CONTROLLER_TRAINERBALLTHROW,
CONTROLLER_48,
CONTROLLER_INTROTRAINERBALLTHROW,
CONTROLLER_DRAWPARTYSTATUSSUMMARY,
CONTROLLER_49,
CONTROLLER_50,
CONTROLLER_SPRITEINVISIBILITY,
@ -114,6 +114,7 @@ void HandleLinkBattleSetup(void);
void SetUpBattleVarsAndBirchZigzagoon(void);
void sub_8032768(void);
void sub_8033648(void);
void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data);
// emitters
void EmitGetMonData(u8 bufferId, u8 arg1, u8 arg2);
@ -122,7 +123,7 @@ void EmitSetMonData(u8 bufferId, u8 request, u8 c, u8 bytes, void *data);
void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused
void EmitLoadMonSprite(u8 bufferId);
void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit);
void EmitReturnPokeToBall(u8 bufferId, u8 arg1);
void EmitReturnMonToBall(u8 bufferId, u8 arg1);
void EmitDrawTrainerPic(u8 bufferId);
void EmitTrainerSlide(u8 bufferId);
void EmitTrainerSlideBack(u8 bufferId);
@ -135,33 +136,43 @@ void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32
void EmitPrintString(u8 bufferId, u16 stringId);
void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringId);
void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2);
void EmitHealthBarUpdate(u8 bufferId, u16 hpValue);
void EmitEffectivenessSound(u8 bufferId, u16 songId);
void EmitPlaySound(u8 bufferId, u16 songId, u8 arg2);
void Emit_x2A(u8 bufferId);
void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints);
void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
void EmitCmd19(u8 bufferId);
void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData);
void EmitOpenBag(u8 bufferId, u8* arg1);
void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4);
void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2);
void EmitFaintingCry(u8 bufferId);
void Emit_x37(u8 bufferId, u8 arg1);
void EmitHitAnimation(u8 bufferId);
void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2);
void EmitCmd49(u8 bufferId);
void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status);
void EmitCmd13(u8 bufferId);
void EmitCmd23(u8 bufferId); // unused
void EmitHealthBarUpdate(u8 bufferId, u16 hpValue);
void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints);
void EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2);
void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status);
void EmitStatusXor(u8 bufferId, u8 b); // unused
void EmitDataTransfer(u8 bufferId, u16 size, void *data);
void EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused
void EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter); // unused
void EmitCmd32(u8 bufferId, u16 size, void *c); // unused
void EmitCmd33(u8 bufferId, u8 arg1, u16 arg2);
void EmitCmd34(u8 bufferId, u8 b, u8 *c);
void EmitCmd35(u8 bufferId, u16 b);
void EmitCmd36(u8 bufferId, u16 b);
void EmitCmd37(u8 bufferId);
void EmitCmd38(u8 bufferId, u8 b);
void EmitCmd39(u8 bufferId);
void EmitCmd40(u8 bufferId);
void EmitHitAnimation(u8 bufferId);
void EmitCmd42(u8 bufferId);
void EmitEffectivenessSound(u8 bufferId, u16 songId);
void EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM);
void EmitFaintingCry(u8 bufferId);
void EmitIntroSlide(u8 bufferId, u8 terrainId);
void EmitIntroTrainerBallThrow(u8 bufferId);
void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct* movePpData);
void EmitOpenBag(u8 bufferId, u8* arg1);
void Emit_x32(u8 bufferId);
void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2);
void EmitCmd49(u8 bufferId);
void EmitCmd50(u8 bufferId);
void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2);
void EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
void EmitCmd_x21(u8 bufferId, u8 arg1, u16 arg2);
void EmitCmd55(u8 bufferId, u8 arg1);
// player controller
void SetBankFuncToPlayerBufferRunCommand(void);

View File

@ -185,7 +185,6 @@ bool8 sub_800A520(void);
bool8 sub_8010500(void);
void sub_800DFB4(u8, u8);
void sub_800ADF8(void);
u8 GetLinkPlayerCount(void);
void sub_800B488(void);
void sub_8009734(void);
void sub_800A620(void);

View File

@ -17,5 +17,6 @@ void sub_818603C(u8);
void sub_8185FD0(void);
void sub_8186444(void);
void sub_8185EB8(void);
u8 sub_81850DC(u8 *arg0);
#endif // GUARD_RECORDED_BATTLE_H

View File

@ -55,7 +55,6 @@ SECTIONS {
src/rtc.o(.text);
asm/main_menu.o(.text);
src/battle_controllers.o(.text);
asm/rom3.o(.text);
src/decompress.o(.text);
asm/battle_1.o(.text);
src/battle_2.o(.text);

View File

@ -4080,7 +4080,7 @@ static void HandleTurnActionSelectionState(void)
if (gBattleMons[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)].status2 & STATUS2_MULTIPLETURNS
|| gBattleMons[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)].status2 & STATUS2_RECHARGE)
{
Emit_x32(0);
EmitCmd50(0);
MarkBufferBankForExecution(gActiveBank);
return;
}
@ -4108,7 +4108,7 @@ static void HandleTurnActionSelectionState(void)
{
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON), 3);
}
Emit_x32(0);
EmitCmd50(0);
MarkBufferBankForExecution(gActiveBank);
return;
}

View File

@ -39,7 +39,7 @@ static bool8 ShouldSwitchIfPerishSong(void)
&& gDisableStructs[gActiveBank].perishSong1 == 0)
{
*(gBattleStruct->field_294 + gActiveBank) = 6;
EmitCmd_x21(1, 2, 0);
EmitCmd33(1, 2, 0);
return TRUE;
}
@ -121,7 +121,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
{
// we found a mon
*(gBattleStruct->field_294 + gActiveBank) = i;
EmitCmd_x21(1, 2, 0);
EmitCmd33(1, 2, 0);
return TRUE;
}
}
@ -221,7 +221,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
{
// we found a mon
*(gBattleStruct->field_294 + gActiveBank) = i;
EmitCmd_x21(1, 2, 0);
EmitCmd33(1, 2, 0);
return TRUE;
}
}
@ -241,13 +241,13 @@ static bool8 ShouldSwitchIfNaturalCure(void)
if ((gUnknown_02024250[gActiveBank] == 0 || gUnknown_02024250[gActiveBank] == 0xFFFF) && Random() & 1)
{
*(gBattleStruct->field_294 + gActiveBank) = 6;
EmitCmd_x21(1, 2, 0);
EmitCmd33(1, 2, 0);
return TRUE;
}
else if (gBattleMoves[gUnknown_02024250[gActiveBank]].power == 0 && Random() & 1)
{
*(gBattleStruct->field_294 + gActiveBank) = 6;
EmitCmd_x21(1, 2, 0);
EmitCmd33(1, 2, 0);
return TRUE;
}
@ -258,7 +258,7 @@ static bool8 ShouldSwitchIfNaturalCure(void)
if (Random() & 1)
{
*(gBattleStruct->field_294 + gActiveBank) = 6;
EmitCmd_x21(1, 2, 0);
EmitCmd33(1, 2, 0);
return TRUE;
}
@ -426,7 +426,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
if (moveFlags & MOVESTATUS_SUPEREFFECTIVE && Random() % moduloPercent == 0)
{
*(gBattleStruct->field_294 + gActiveBank) = i;
EmitCmd_x21(1, 2, 0);
EmitCmd33(1, 2, 0);
return TRUE;
}
}
@ -611,7 +611,7 @@ void AI_TrySwitchOrUseItem(void)
}
}
EmitCmd_x21(1, 0, (gActiveBank ^ BIT_SIDE) << 8);
EmitCmd33(1, 0, (gActiveBank ^ BIT_SIDE) << 8);
}
#define TYPE_FORESIGHT 0xFE
@ -940,7 +940,7 @@ static bool8 ShouldUseItem(void)
if (shouldUse)
{
EmitCmd_x21(1, 1, 0);
EmitCmd33(1, 1, 0);
*(gBattleStruct->field_C0 + (gActiveBank / 2) * 2) = item;
gBattleResources->battleHistory->trainerItems[i] = 0;
return shouldUse;

View File

@ -36,6 +36,13 @@ extern u8 gBankTarget;
extern u8 gAbsentBankFlags;
extern u8 gEffectBank;
extern u16 gBattleWeather;
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gCurrentMove;
extern u16 gLastUsedMove;
extern u16 gLastUsedItem;
extern u8 gBattleOutcome;
extern u8 gLastUsedAbility;
extern u8 gStringBank;
extern const struct BattleMove gBattleMoves[];
@ -43,11 +50,10 @@ extern void task00_08081A90(u8 taskId); // cable_club
extern void sub_81B8D64(u8 bank, u8 arg1); // party_menu
// this file's funcionts
static void sub_8033244(void);
static void CreateTasksForSendRecvLinkBuffers(void);
static void SetControllersVariablesInLinkBattle(void);
static void SetControllersVariables(void);
static void sub_8033050(void);
void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data);
static void SetBattlePartyIds(void);
static void Task_HandleSendLinkBuffersData(u8 taskId);
static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId);
@ -60,7 +66,7 @@ void HandleLinkBattleSetup(void)
if (!gReceivedRemoteLinkPlayers)
sub_8009734();
CreateTask(task00_08081A90, 0);
sub_8033244();
CreateTasksForSendRecvLinkBuffers();
}
}
@ -114,7 +120,7 @@ void sub_8032768(void)
else
SetControllersVariables();
sub_8033050();
SetBattlePartyIds();
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
@ -602,7 +608,7 @@ static void SetControllersVariablesInLinkBattle(void)
}
}
static void sub_8033050(void)
static void SetBattlePartyIds(void)
{
s32 i, j;
@ -672,7 +678,7 @@ static void sub_8033050(void)
}
}
void PrepareBufferDataTransfer(u8 bufferId, u8 *data, u16 size)
static void PrepareBufferDataTransfer(u8 bufferId, u8 *data, u16 size)
{
s32 i;
@ -702,7 +708,7 @@ void PrepareBufferDataTransfer(u8 bufferId, u8 *data, u16 size)
}
}
static void sub_8033244(void)
static void CreateTasksForSendRecvLinkBuffers(void)
{
gUnknown_02022D08 = CreateTask(Task_HandleSendLinkBuffersData, 0);
gTasks[gUnknown_02022D08].data[11] = 0;
@ -993,10 +999,9 @@ void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit)
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
// TODO: change Poke to Mon to be consistent
void EmitReturnPokeToBall(u8 bufferId, u8 arg1)
void EmitReturnMonToBall(u8 bufferId, u8 arg1)
{
gBattleBuffersTransferData[0] = CONTROLLER_RETURNPOKETOBALL;
gBattleBuffersTransferData[0] = CONTROLLER_RETURNMONTOBALL;
gBattleBuffersTransferData[1] = arg1;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
}
@ -1103,14 +1108,6 @@ void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 16 + sizeof(struct DisableStruct));
}
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gCurrentMove;
extern u16 gLastUsedMove;
extern u16 gLastUsedItem;
extern u8 gBattleOutcome;
extern u8 gLastUsedAbility;
extern u8 gStringBank;
void EmitPrintString(u8 bufferId, u16 stringID)
{
s32 i;
@ -1180,3 +1177,375 @@ void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2)
gBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitCmd19(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_19;
gBattleBuffersTransferData[1] = 19;
gBattleBuffersTransferData[2] = 19;
gBattleBuffersTransferData[3] = 19;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_CHOOSEMOVE;
gBattleBuffersTransferData[1] = isDoubleBattle;
gBattleBuffersTransferData[2] = NoPpNumber;
gBattleBuffersTransferData[3] = 0;
for (i = 0; i < sizeof(*movePpData); i++)
gBattleBuffersTransferData[4 + i] = *((u8*)(movePpData) + i);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(*movePpData) + 4);
}
void EmitOpenBag(u8 bufferId, u8 *arg1)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_OPENBAG;
for (i = 0; i < 3; i++)
gBattleBuffersTransferData[1 + i] = arg1[i];
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_CHOOSEPOKEMON;
gBattleBuffersTransferData[1] = caseId;
gBattleBuffersTransferData[2] = arg2;
gBattleBuffersTransferData[3] = abilityId;
for (i = 0; i < 3; i++)
gBattleBuffersTransferData[4 + i] = arg4[i];
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 8); // but only 7 bytes were written
}
void EmitCmd23(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_23;
gBattleBuffersTransferData[1] = 23;
gBattleBuffersTransferData[2] = 23;
gBattleBuffersTransferData[3] = 23;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
// why is the argument u16 if it's being cast to s16 anyway?
void EmitHealthBarUpdate(u8 bufferId, u16 hpValue)
{
gBattleBuffersTransferData[0] = CONTROLLER_HEALTHBARUPDATE;
gBattleBuffersTransferData[1] = 0;
gBattleBuffersTransferData[2] = (s16)hpValue;
gBattleBuffersTransferData[3] = ((s16)hpValue & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
// why is the argument u16 if it's being cast to s16 anyway?
void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints)
{
gBattleBuffersTransferData[0] = CONTROLLER_EXPUPDATE;
gBattleBuffersTransferData[1] = partyId;
gBattleBuffersTransferData[2] = (s16)expPoints;
gBattleBuffersTransferData[3] = ((s16)expPoints & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2)
{
gBattleBuffersTransferData[0] = CONTROLLER_STATUSICONUPDATE;
gBattleBuffersTransferData[1] = status1;
gBattleBuffersTransferData[2] = (status1 & 0x0000FF00) >> 8;
gBattleBuffersTransferData[3] = (status1 & 0x00FF0000) >> 16;
gBattleBuffersTransferData[4] = (status1 & 0xFF000000) >> 24;
gBattleBuffersTransferData[5] = status2;
gBattleBuffersTransferData[6] = (status2 & 0x0000FF00) >> 8;
gBattleBuffersTransferData[7] = (status2 & 0x00FF0000) >> 16;
gBattleBuffersTransferData[8] = (status2 & 0xFF000000) >> 24;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 9);
}
void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status)
{
gBattleBuffersTransferData[0] = CONTROLLER_STATUSANIMATION;
gBattleBuffersTransferData[1] = status2;
gBattleBuffersTransferData[2] = status;
gBattleBuffersTransferData[3] = (status & 0x0000FF00) >> 8;
gBattleBuffersTransferData[4] = (status & 0x00FF0000) >> 16;
gBattleBuffersTransferData[5] = (status & 0xFF000000) >> 24;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 6);
}
void EmitStatusXor(u8 bufferId, u8 b)
{
gBattleBuffersTransferData[0] = CONTROLLER_STATUSXOR;
gBattleBuffersTransferData[1] = b;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
}
void EmitDataTransfer(u8 bufferId, u16 size, void *data)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_DATATRANSFER;
gBattleBuffersTransferData[1] = 29;
gBattleBuffersTransferData[2] = size;
gBattleBuffersTransferData[3] = (size & 0xFF00) >> 8;
for (i = 0; i < size; i++)
gBattleBuffersTransferData[4 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 4);
}
void EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_DMA3TRANSFER;
gBattleBuffersTransferData[1] = (u32)(dst);
gBattleBuffersTransferData[2] = ((u32)(dst) & 0x0000FF00) >> 8;
gBattleBuffersTransferData[3] = ((u32)(dst) & 0x00FF0000) >> 16;
gBattleBuffersTransferData[4] = ((u32)(dst) & 0xFF000000) >> 24;
gBattleBuffersTransferData[5] = size;
gBattleBuffersTransferData[6] = (size & 0xFF00) >> 8;
for (i = 0; i < size; i++)
gBattleBuffersTransferData[7 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 7);
}
void EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_31;
gBattleBuffersTransferData[1] = songId;
gBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8;
for (i = 0; i < songId; i++) // ????
gBattleBuffersTransferData[3 + i] = *(u8*)(unusedDumbDataParameter++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, songId + 3);
}
void EmitCmd32(u8 bufferId, u16 size, void *data)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_32;
gBattleBuffersTransferData[1] = size;
gBattleBuffersTransferData[2] = (size & 0xFF00) >> 8;
for (i = 0; i < size; i++)
gBattleBuffersTransferData[3 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 3);
}
void EmitCmd33(u8 bufferId, u8 arg1, u16 arg2)
{
gBattleBuffersTransferData[0] = CONTROLLER_33;
gBattleBuffersTransferData[1] = arg1;
gBattleBuffersTransferData[2] = arg2;
gBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitCmd34(u8 bufferId, u8 b, u8 *c)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_34;
gBattleBuffersTransferData[1] = b;
for (i = 0; i < 3; i++)
gBattleBuffersTransferData[2 + i] = c[i];
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 5);
}
void EmitCmd35(u8 bufferId, u16 b)
{
gBattleBuffersTransferData[0] = CONTROLLER_35;
gBattleBuffersTransferData[1] = b;
gBattleBuffersTransferData[2] = (b & 0xFF00) >> 8;
gBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitCmd36(u8 bufferId, u16 b)
{
gBattleBuffersTransferData[0] = CONTROLLER_36;
gBattleBuffersTransferData[1] = b;
gBattleBuffersTransferData[2] = (b & 0xFF00) >> 8;
gBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitCmd37(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_37;
gBattleBuffersTransferData[1] = 37;
gBattleBuffersTransferData[2] = 37;
gBattleBuffersTransferData[3] = 37;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitCmd38(u8 bufferId, u8 b)
{
gBattleBuffersTransferData[0] = CONTROLLER_38;
gBattleBuffersTransferData[1] = b;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
}
void EmitCmd39(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_39;
gBattleBuffersTransferData[1] = 39;
gBattleBuffersTransferData[2] = 39;
gBattleBuffersTransferData[3] = 39;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitCmd40(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_40;
gBattleBuffersTransferData[1] = 40;
gBattleBuffersTransferData[2] = 40;
gBattleBuffersTransferData[3] = 40;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitHitAnimation(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_HITANIMATION;
gBattleBuffersTransferData[1] = 41;
gBattleBuffersTransferData[2] = 41;
gBattleBuffersTransferData[3] = 41;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitCmd42(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_42;
gBattleBuffersTransferData[1] = 42;
gBattleBuffersTransferData[2] = 42;
gBattleBuffersTransferData[3] = 42;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitEffectivenessSound(u8 bufferId, u16 songId)
{
gBattleBuffersTransferData[0] = CONTROLLER_EFFECTIVENESSSOUND;
gBattleBuffersTransferData[1] = songId;
gBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8;
gBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM)
{
gBattleBuffersTransferData[0] = CONTROLLER_PLAYFANFAREORBGM;
gBattleBuffersTransferData[1] = songId;
gBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8;
gBattleBuffersTransferData[3] = playBGM;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitFaintingCry(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_FAINTINGCRY;
gBattleBuffersTransferData[1] = 45;
gBattleBuffersTransferData[2] = 45;
gBattleBuffersTransferData[3] = 45;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitIntroSlide(u8 bufferId, u8 terrainId)
{
gBattleBuffersTransferData[0] = CONTROLLER_INTROSLIDE;
gBattleBuffersTransferData[1] = terrainId;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
}
void EmitIntroTrainerBallThrow(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_INTROTRAINERBALLTHROW;
gBattleBuffersTransferData[1] = 47;
gBattleBuffersTransferData[2] = 47;
gBattleBuffersTransferData[3] = 47;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY;
gBattleBuffersTransferData[1] = arg2 & 0x7F;
gBattleBuffersTransferData[2] = (arg2 & 0x80) >> 7;
gBattleBuffersTransferData[3] = 48;
for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * 6); i++)
gBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus));
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct HpAndStatus) * 6 + 4);
}
void EmitCmd49(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_49;
gBattleBuffersTransferData[1] = 49;
gBattleBuffersTransferData[2] = 49;
gBattleBuffersTransferData[3] = 49;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitCmd50(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_50;
gBattleBuffersTransferData[1] = 50;
gBattleBuffersTransferData[2] = 50;
gBattleBuffersTransferData[3] = 50;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible)
{
gBattleBuffersTransferData[0] = CONTROLLER_SPRITEINVISIBILITY;
gBattleBuffersTransferData[1] = isInvisible;
gBattleBuffersTransferData[2] = 51;
gBattleBuffersTransferData[3] = 51;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument)
{
gBattleBuffersTransferData[0] = CONTROLLER_BATTLEANIMATION;
gBattleBuffersTransferData[1] = animationId;
gBattleBuffersTransferData[2] = argument;
gBattleBuffersTransferData[3] = (argument & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
}
void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2)
{
bool8 arg2_ = arg2;
gBattleBuffersTransferData[0] = CONTROLLER_LINKSTANDBYMSG;
gBattleBuffersTransferData[1] = arg1;
if (arg2_)
gBattleBuffersTransferData[3] = gBattleBuffersTransferData[2] = sub_81850DC(&gBattleBuffersTransferData[4]);
else
gBattleBuffersTransferData[3] = gBattleBuffersTransferData[2] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, gBattleBuffersTransferData[2] + 4);
}
void EmitResetActionMoveSelection(u8 bufferId, u8 caseId)
{
gBattleBuffersTransferData[0] = CONTROLLER_RESETACTIONMOVESELECTION;
gBattleBuffersTransferData[1] = caseId;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
}
void EmitCmd55(u8 bufferId, u8 arg1)
{
gBattleBuffersTransferData[0] = CONTROLLER_55;
gBattleBuffersTransferData[1] = arg1;
gBattleBuffersTransferData[2] = gSaveBlock2Ptr->field_CA9_b;
gBattleBuffersTransferData[3] = gSaveBlock2Ptr->field_CA9_b;
gBattleBuffersTransferData[5] = gBattleBuffersTransferData[4] = sub_81850DC(&gBattleBuffersTransferData[6]);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, gBattleBuffersTransferData[4] + 6);
}

View File

@ -349,7 +349,7 @@ static void atk51_switch_handle_order(void);
static void atk52_switch_in_effects(void);
static void atk53_trainer_slide(void);
static void atk54_effectiveness_sound(void);
static void atk55_play_sound(void);
static void atk55_play_fanfare(void);
static void atk56_fainting_cry(void);
static void atk57(void);
static void atk58_return_to_ball(void);
@ -601,7 +601,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
atk52_switch_in_effects,
atk53_trainer_slide,
atk54_effectiveness_sound,
atk55_play_sound,
atk55_play_fanfare,
atk56_fainting_cry,
atk57,
atk58_return_to_ball,
@ -5308,7 +5308,7 @@ static void atk4B_return_atk_to_ball(void)
gActiveBank = gBankAttacker;
if (!(gHitMarker & HITMARKER_FAINTED(gActiveBank)))
{
EmitReturnPokeToBall(0, 0);
EmitReturnMonToBall(0, 0);
MarkBufferBankForExecution(gActiveBank);
}
gBattlescriptCurrInstr++;
@ -5627,7 +5627,7 @@ static void atk50_openpartyscreen(void)
{
gAbsentBankFlags |= gBitTable[gActiveBank];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
Emit_x2A(0);
EmitCmd42(0);
MarkBufferBankForExecution(gActiveBank);
}
else if (!gSpecialStatuses[gActiveBank].flag40)
@ -5649,7 +5649,7 @@ static void atk50_openpartyscreen(void)
{
gAbsentBankFlags |= gBitTable[gActiveBank];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
Emit_x2A(0);
EmitCmd42(0);
MarkBufferBankForExecution(gActiveBank);
}
else if (!gSpecialStatuses[gActiveBank].flag40)
@ -5670,7 +5670,7 @@ static void atk50_openpartyscreen(void)
{
gAbsentBankFlags |= gBitTable[gActiveBank];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
Emit_x2A(0);
EmitCmd42(0);
MarkBufferBankForExecution(gActiveBank);
}
else if (!gSpecialStatuses[gActiveBank].flag40)
@ -5692,7 +5692,7 @@ static void atk50_openpartyscreen(void)
{
gAbsentBankFlags |= gBitTable[gActiveBank];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
Emit_x2A(0);
EmitCmd42(0);
MarkBufferBankForExecution(gActiveBank);
}
else if (!gSpecialStatuses[gActiveBank].flag40)
@ -5755,7 +5755,7 @@ static void atk50_openpartyscreen(void)
{
gAbsentBankFlags |= gBitTable[gActiveBank];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
Emit_x2A(0);
EmitCmd42(0);
MarkBufferBankForExecution(gActiveBank);
}
else if (!gSpecialStatuses[gActiveBank].flag40)
@ -5771,7 +5771,7 @@ static void atk50_openpartyscreen(void)
{
gAbsentBankFlags |= gBitTable[gActiveBank];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBank));
Emit_x2A(0);
EmitCmd42(0);
MarkBufferBankForExecution(gActiveBank);
}
else if (!gSpecialStatuses[gActiveBank].flag40)
@ -6031,10 +6031,10 @@ static void atk54_effectiveness_sound(void)
gBattlescriptCurrInstr += 3;
}
static void atk55_play_sound(void)
static void atk55_play_fanfare(void)
{
gActiveBank = gBankAttacker;
EmitPlaySound(0, BS2ScriptRead16(gBattlescriptCurrInstr + 1), 0);
EmitPlayFanfareOrBGM(0, BS2ScriptRead16(gBattlescriptCurrInstr + 1), FALSE);
MarkBufferBankForExecution(gActiveBank);
gBattlescriptCurrInstr += 3;
@ -6052,7 +6052,7 @@ static void atk56_fainting_cry(void)
static void atk57(void)
{
gActiveBank = GetBankByIdentity(0);
Emit_x37(0, gBattleOutcome);
EmitCmd55(0, gBattleOutcome);
MarkBufferBankForExecution(gActiveBank);
gBattlescriptCurrInstr += 1;
@ -6061,7 +6061,7 @@ static void atk57(void)
static void atk58_return_to_ball(void)
{
gActiveBank = GetBattleBank(gBattlescriptCurrInstr[1]);
EmitReturnPokeToBall(0, 1);
EmitReturnMonToBall(0, 1);
MarkBufferBankForExecution(gActiveBank);
gBattlescriptCurrInstr += 2;
@ -7137,7 +7137,7 @@ static void atk76_various(void)
gDisableStructs[1].truantUnknownBit = 1;
break;
case 13:
EmitCmd13(0);
EmitCmd19(0);
MarkBufferBankForExecution(gActiveBank);
break;
case 14:
@ -7162,7 +7162,7 @@ static void atk76_various(void)
gActiveBank = 1;
if (gBattleMons[gActiveBank].hp != 0)
{
EmitReturnPokeToBall(0, 0);
EmitReturnMonToBall(0, 0);
MarkBufferBankForExecution(gActiveBank);
}
break;
@ -7172,7 +7172,7 @@ static void atk76_various(void)
gActiveBank = 3;
if (gBattleMons[gActiveBank].hp != 0)
{
EmitReturnPokeToBall(0, 0);
EmitReturnMonToBall(0, 0);
MarkBufferBankForExecution(gActiveBank);
}
}
@ -7197,7 +7197,7 @@ static void atk76_various(void)
gBattleOutcome = BATTLE_OPPONENT_TELEPORTED;
break;
case VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC:
EmitPlaySound(0, BGM_KACHI1, 1);
EmitPlayFanfareOrBGM(0, BGM_KACHI1, TRUE);
MarkBufferBankForExecution(gActiveBank);
break;
}