battle 4 commands are decompiled

This commit is contained in:
DizzyEggg 2017-09-28 15:34:21 +02:00
parent 69928d3904
commit bc3b4b4d9a
26 changed files with 1456 additions and 2747 deletions

View File

@ -165,7 +165,7 @@ _080368BE:
strh r1, [r0]
ldr r0, =gBattle_BG2_Y
strh r1, [r0]
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
strh r1, [r0]
ldr r0, =gUnknown_02022E22
strh r1, [r0]
@ -191,7 +191,7 @@ _080368FE:
ldr r1, =gReservedSpritePaletteCount
movs r0, 0x4
strb r0, [r1]
ldr r0, =vblank_cb_08078BB4
ldr r0, =VBlankCB_Battle
bl SetVBlankCallback
bl sub_803269C
ldr r2, [r4]
@ -3906,8 +3906,8 @@ _08038A1E:
.pool
thumb_func_end sub_8038A04
thumb_func_start vblank_cb_08078BB4
vblank_cb_08078BB4: @ 8038A28
thumb_func_start VBlankCB_Battle
VBlankCB_Battle: @ 8038A28
push {lr}
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
@ -3941,7 +3941,7 @@ _08038A3A:
ldrh r1, [r0]
movs r0, 0x1A
bl SetGpuReg
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
ldrh r1, [r0]
movs r0, 0x1C
bl SetGpuReg
@ -3972,7 +3972,7 @@ _08038A3A:
pop {r0}
bx r0
.pool
thumb_func_end vblank_cb_08078BB4
thumb_func_end VBlankCB_Battle
thumb_func_start nullsub_17
nullsub_17: @ 8038B00
@ -4379,7 +4379,7 @@ _08038E1A:
strh r4, [r0]
ldr r0, =gBattle_BG2_Y
strh r4, [r0]
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
strh r4, [r0]
ldr r0, =gUnknown_02022E22
strh r4, [r0]
@ -4399,7 +4399,7 @@ _08038E1A:
ldr r1, =gReservedSpritePaletteCount
movs r0, 0x4
strb r0, [r1]
ldr r0, =vblank_cb_08078BB4
ldr r0, =VBlankCB_Battle
bl SetVBlankCallback
ldr r0, =task00_0800F6FC
movs r1, 0
@ -4850,7 +4850,7 @@ sub_80392A8: @ 80392A8
strh r4, [r0]
ldr r0, =gBattle_BG2_Y
strh r4, [r0]
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
strh r4, [r0]
ldr r0, =gUnknown_02022E22
strh r4, [r0]
@ -4873,7 +4873,7 @@ _080392FE:
ldr r1, =gReservedSpritePaletteCount
movs r0, 0x4
strb r0, [r1]
ldr r0, =vblank_cb_08078BB4
ldr r0, =VBlankCB_Battle
bl SetVBlankCallback
ldr r0, =sub_803937C
bl SetMainCallback2
@ -9307,7 +9307,7 @@ _0803B866:
beq _0803B8B2
bl StopCryAndClearCrySongs
ldr r0, =gUnknown_082DB8BE
bl b_call_bc_move_exec
bl BattleScriptExecute
_0803B8B2:
add sp, 0x4
pop {r3-r5}
@ -9561,7 +9561,7 @@ _0803BAE6:
cmp r0, 0
beq _0803BB5C
ldr r0, =gUnknown_082DB881
bl b_call_bc_move_exec
bl BattleScriptExecute
b _0803BB78
.pool
_0803BB5C:
@ -9577,7 +9577,7 @@ _0803BB5C:
cmp r0, 0
bne _0803BB78
ldr r0, =gUnknown_082DB8BE
bl b_call_bc_move_exec
bl BattleScriptExecute
_0803BB78:
pop {r3,r4}
mov r8, r3
@ -10866,7 +10866,7 @@ _0803C720:
cmp r0, 0x3
bne _0803C760
ldr r0, =gUnknown_082DAAFE
bl b_call_bc_move_exec
bl BattleScriptExecute
ldr r1, =gBattleCommunication
ldrb r0, [r4]
adds r0, r1
@ -12739,7 +12739,7 @@ _0803D71C:
cmp r0, 0
blt _0803D7A0
ldr r0, =gUnknown_082DB1FF
bl b_call_bc_move_exec
bl BattleScriptExecute
b _0803D7E8
.pool
_0803D7A0:

File diff suppressed because it is too large Load Diff

View File

@ -30134,7 +30134,7 @@ _0810DB1A:
lsls r0, 24
cmp r0, 0
bne _0810DB50
ldr r1, =gUnknown_02022E20
ldr r1, =gBattle_BG3_X
ldrh r0, [r4, 0x1A]
lsls r0, 16
asrs r0, 24
@ -30145,7 +30145,7 @@ _0810DB1A:
b _0810DB60
.pool
_0810DB50:
ldr r2, =gUnknown_02022E20
ldr r2, =gBattle_BG3_X
ldrh r1, [r4, 0x1A]
lsls r1, 16
asrs r1, 24
@ -44805,7 +44805,7 @@ _08115314:
beq _08115340
cmp r0, 0x5
bne _08115380
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
ldrh r0, [r0]
strh r0, [r4, 0x22]
ldr r0, =sub_81153AC
@ -44907,7 +44907,7 @@ _081153DA:
ands r0, r1
cmp r0, 0
bne _08115404
ldr r1, =gUnknown_02022E20
ldr r1, =gBattle_BG3_X
ldrh r0, [r3, 0x26]
ldrh r2, [r3, 0x22]
adds r0, r2
@ -44915,7 +44915,7 @@ _081153DA:
b _0811540E
.pool
_08115404:
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
ldrh r1, [r3, 0x22]
ldrh r2, [r3, 0x26]
subs r1, r2
@ -44951,7 +44951,7 @@ _08115430:
ands r1, r0
cmp r1, 0
bne _0811545C
ldr r1, =gUnknown_02022E20
ldr r1, =gBattle_BG3_X
ldrh r0, [r3, 0x24]
ldrh r2, [r3, 0x22]
adds r0, r2
@ -44959,7 +44959,7 @@ _08115430:
b _08115466
.pool
_0811545C:
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
ldrh r1, [r3, 0x22]
ldrh r2, [r3, 0x24]
subs r1, r2
@ -44987,7 +44987,7 @@ _08115484:
b _0811549C
.pool
_08115490:
ldr r1, =gUnknown_02022E20
ldr r1, =gBattle_BG3_X
ldrh r0, [r3, 0x22]
strh r0, [r1]
adds r0, r2, 0
@ -45263,7 +45263,7 @@ _0811565A:
movs r0, 0xFF
ands r1, r0
strh r1, [r4, 0xC]
ldr r2, =gUnknown_02022E20
ldr r2, =gBattle_BG3_X
ldrh r0, [r4, 0xA]
strh r0, [r2]
ldr r0, =gUnknown_02022E22
@ -45295,7 +45295,7 @@ sub_81156D0: @ 81156D0
ldrsh r0, [r2, r4]
cmp r1, r0
bne _08115710
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
movs r1, 0
strh r1, [r0]
ldr r0, =gUnknown_02022E22
@ -45305,7 +45305,7 @@ sub_81156D0: @ 81156D0
b _0811571C
.pool
_08115710:
ldr r1, =gUnknown_02022E20
ldr r1, =gBattle_BG3_X
ldrh r0, [r2, 0xA]
strh r0, [r1]
ldr r1, =gUnknown_02022E22
@ -46553,7 +46553,7 @@ _081160DC:
beq _081160F4
b _08116104
_081160E2:
ldr r1, =gUnknown_02022E20
ldr r1, =gBattle_BG3_X
b _081160F6
.pool
_081160EC:
@ -46793,7 +46793,7 @@ sub_81162A4: @ 81162A4
strh r1, [r2, 0xE]
ldrh r1, [r3, 0x6]
strh r1, [r2, 0x18]
ldr r4, =gUnknown_02022E20
ldr r4, =gBattle_BG3_X
ldrh r1, [r3]
strh r1, [r4]
ldr r4, =gUnknown_02022E22
@ -46824,7 +46824,7 @@ sub_81162F8: @ 81162F8
mov r12, r1
cmp r0, 0
bne _0811637E
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
ldrh r2, [r0]
movs r7, 0x8
ldrsh r1, [r3, r7]
@ -49152,7 +49152,7 @@ sub_81176D8: @ 81176D8
ldrh r7, [r1, 0x1E]
adds r2, r7
strh r2, [r1, 0x1E]
ldr r6, =gUnknown_02022E20
ldr r6, =gBattle_BG3_X
lsls r0, r3, 16
asrs r0, 24
ldrh r4, [r6]

View File

@ -3169,7 +3169,7 @@ _0819044E:
strh r4, [r0]
ldr r0, =gBattle_BG1_Y
strh r4, [r0]
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
strh r4, [r0]
ldr r0, =gUnknown_02022E22
strh r4, [r0]

View File

@ -58,7 +58,7 @@ sub_80D7678: @ 80D7678
strh r1, [r0]
ldr r0, =gBattle_BG2_Y
strh r1, [r0]
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
strh r1, [r0]
ldr r0, =gUnknown_02022E22
strh r1, [r0]
@ -1340,7 +1340,7 @@ vblank_cb_battle: @ 80D827C
ldrh r1, [r0]
movs r0, 0x1A
bl SetGpuReg
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
ldrh r1, [r0]
movs r0, 0x1C
bl SetGpuReg

View File

@ -105,7 +105,7 @@ _080F57E0:
strh r1, [r0]
ldr r0, =gBattle_BG2_Y
strh r1, [r0]
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
strh r1, [r0]
ldr r0, =gUnknown_02022E22
strh r1, [r0]
@ -465,7 +465,7 @@ sub_80F5C24: @ 80F5C24
ldrh r1, [r0]
movs r0, 0x1A
bl SetGpuReg
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
ldrh r1, [r0]
movs r0, 0x1C
bl SetGpuReg
@ -1838,7 +1838,7 @@ _080F68A8:
thumb_func_start sub_80F68B4
sub_80F68B4: @ 80F68B4
push {r4,r5,lr}
ldr r2, =gUnknown_02022E20
ldr r2, =gBattle_BG3_X
ldrh r3, [r2]
adds r0, r3, 0x2
strh r0, [r2]

View File

@ -178,7 +178,7 @@ evolution_cutscene: @ 813DA8C
strh r2, [r0]
ldr r0, =gBattle_BG2_Y
strh r2, [r0]
ldr r1, =gUnknown_02022E20
ldr r1, =gBattle_BG3_X
movs r2, 0x80
lsls r2, 1
adds r0, r2, 0
@ -472,7 +472,7 @@ sub_813DD7C: @ 813DD7C
strh r4, [r0]
ldr r0, =gBattle_BG2_Y
strh r4, [r0]
ldr r1, =gUnknown_02022E20
ldr r1, =gBattle_BG3_X
movs r2, 0x80
lsls r2, 1
adds r0, r2, 0
@ -642,7 +642,7 @@ _0813DFE0:
strh r1, [r0]
ldr r0, =gBattle_BG2_Y
strh r1, [r0]
ldr r2, =gUnknown_02022E20
ldr r2, =gBattle_BG3_X
movs r3, 0x80
lsls r3, 1
adds r0, r3, 0
@ -953,7 +953,7 @@ sub_813E1D4: @ 813E1D4
strh r4, [r0]
ldr r0, =gBattle_BG2_Y
strh r4, [r0]
ldr r1, =gUnknown_02022E20
ldr r1, =gBattle_BG3_X
movs r2, 0x80
lsls r2, 1
adds r0, r2, 0
@ -3654,7 +3654,7 @@ sub_813FCDC: @ 813FCDC
ldrh r1, [r0]
movs r0, 0x1A
bl SetGpuReg
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
ldrh r1, [r0]
movs r0, 0x1C
bl SetGpuReg
@ -3698,7 +3698,7 @@ sub_813FD64: @ 813FD64
ldrh r1, [r0]
movs r0, 0x1A
bl SetGpuReg
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
ldrh r1, [r0]
movs r0, 0x1C
bl SetGpuReg
@ -3870,7 +3870,7 @@ sub_813FEE8: @ 813FEE8
b _0813FF2C
.pool
_0813FF28:
ldr r7, =gUnknown_02022E20
ldr r7, =gBattle_BG3_X
ldr r6, =gUnknown_02022E22
_0813FF2C:
lsls r4, r5, 2

View File

@ -840,7 +840,7 @@ pokemon_transfer_to_pc_with_message: @ 80E34E4
bl VarGet
lsls r0, 24
lsrs r0, 24
bl sav3_get_box_name
bl GetBoxNamePtr
adds r1, r0, 0
adds r0, r4, 0
bl StringCopy
@ -859,7 +859,7 @@ _080E3534:
bl VarGet
lsls r0, 24
lsrs r0, 24
bl sav3_get_box_name
bl GetBoxNamePtr
adds r1, r0, 0
adds r0, r4, 0
bl StringCopy
@ -874,7 +874,7 @@ _080E3534:
bl get_unknown_box_id
lsls r0, 24
lsrs r0, 24
bl sav3_get_box_name
bl GetBoxNamePtr
adds r1, r0, 0
adds r0, r4, 0
bl StringCopy

View File

@ -8429,8 +8429,8 @@ _080BFDB4:
.pool
thumb_func_end sub_80BFD7C
thumb_func_start sub_80BFDF4
sub_80BFDF4: @ 80BFDF4
thumb_func_start CreateDexDisplayMonDataTask
CreateDexDisplayMonDataTask: @ 80BFDF4
push {r4-r6,lr}
adds r4, r0, 0
adds r5, r1, 0
@ -8460,7 +8460,7 @@ sub_80BFDF4: @ 80BFDF4
pop {r1}
bx r1
.pool
thumb_func_end sub_80BFDF4
thumb_func_end CreateDexDisplayMonDataTask
thumb_func_start sub_80BFE38
sub_80BFE38: @ 80BFE38

View File

@ -1019,7 +1019,7 @@ _080C777E:
_080C779E:
lsls r0, r5, 24
lsrs r0, 24
bl sav3_get_box_name
bl GetBoxNamePtr
ldr r1, =gText_Box
bl StringCopy
adds r4, r5, 0x1
@ -1566,7 +1566,7 @@ sub_80C7BE4: @ 80C7BE4
lsls r4, 2
adds r0, r4
ldrb r0, [r0]
bl sav3_get_box_name
bl GetBoxNamePtr
mov r10, r0
mov r1, r9
ldr r0, [r1]
@ -5424,7 +5424,7 @@ _080C9F1C:
bl StorageGetCurrentBox
lsls r0, 24
lsrs r0, 24
bl sav3_get_box_name
bl GetBoxNamePtr
adds r1, r0, 0
movs r0, 0
str r0, [sp]
@ -10831,7 +10831,7 @@ sub_80CCB50: @ 80CCB50
ldr r5, =0x000021b8
adds r4, r5
mov r0, r8
bl sav3_get_box_name
bl GetBoxNamePtr
adds r1, r0, 0
adds r0, r4, 0
movs r2, 0
@ -10852,7 +10852,7 @@ sub_80CCB50: @ 80CCB50
ldr r0, [sp, 0x2C]
bl LoadSpriteSheet
mov r0, r8
bl sav3_get_box_name
bl GetBoxNamePtr
bl sub_80CD00C
movs r4, 0
lsls r0, 16
@ -10997,7 +10997,7 @@ _080CCDB0:
ldr r5, =0x000021b8
adds r4, r5
ldr r0, [sp, 0x28]
bl sav3_get_box_name
bl GetBoxNamePtr
adds r1, r0, 0
adds r0, r4, 0
movs r2, 0
@ -11027,7 +11027,7 @@ _080CCDB0:
movs r2, 0x4
bl LoadPalette
ldr r0, [sp, 0x28]
bl sav3_get_box_name
bl GetBoxNamePtr
bl sub_80CD00C
lsls r0, 16
mov r1, r10
@ -21085,8 +21085,8 @@ _080D20CA:
bx r1
thumb_func_end GetBoxedMonPtr
thumb_func_start sav3_get_box_name
sav3_get_box_name: @ 80D20D0
thumb_func_start GetBoxNamePtr
GetBoxNamePtr: @ 80D20D0
push {lr}
lsls r0, 24
lsrs r2, r0, 24
@ -21106,7 +21106,7 @@ _080D20EC:
pop {r1}
bx r1
.pool
thumb_func_end sav3_get_box_name
thumb_func_end GetBoxNamePtr
thumb_func_start sub_80D20F8
sub_80D20F8: @ 80D20F8

View File

@ -13136,7 +13136,7 @@ _081CD8E4:
ldr r2, =0x00006325
adds r4, r2
adds r0, r3, 0
bl sav3_get_box_name
bl GetBoxNamePtr
adds r1, r0, 0
adds r0, r4, 0
_081CD8F4:
@ -24164,7 +24164,7 @@ _081D2F2C:
adds r4, r5, 0x5
lsls r0, r7, 24
lsrs r0, 24
bl sav3_get_box_name
bl GetBoxNamePtr
adds r1, r0, 0
adds r0, r4, 0
_081D2F3A:

View File

@ -111,7 +111,7 @@ _080A93B0:
strh r1, [r0]
ldr r0, =gBattle_BG2_Y
strh r1, [r0]
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
strh r1, [r0]
ldr r0, =gUnknown_02022E22
strh r1, [r0]
@ -286,7 +286,7 @@ _080A955C:
b _080A95D2
.pool
_080A95A4:
ldr r0, =vblank_cb_08078BB4
ldr r0, =VBlankCB_Battle
bl SetVBlankCallback
bl sub_80A95F4
movs r0, 0x1

View File

@ -2337,8 +2337,8 @@ EmitTrainerSlide: @ 8033A04
.pool
thumb_func_end EmitTrainerSlide
thumb_func_start dp01_build_cmdbuf_x09_9_9_9
dp01_build_cmdbuf_x09_9_9_9: @ 8033A24
thumb_func_start EmitTrainerSlideBack
EmitTrainerSlideBack: @ 8033A24
push {lr}
lsls r0, 24
lsrs r0, 24
@ -2353,7 +2353,7 @@ dp01_build_cmdbuf_x09_9_9_9: @ 8033A24
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x09_9_9_9
thumb_func_end EmitTrainerSlideBack
thumb_func_start EmitFaintAnimation
EmitFaintAnimation: @ 8033A44
@ -2409,8 +2409,8 @@ dp01_build_cmdbuf_x0C_C_C_C: @ 8033A84
.pool
thumb_func_end dp01_build_cmdbuf_x0C_C_C_C
thumb_func_start dp01_build_cmdbuf_x0D_a
dp01_build_cmdbuf_x0D_a: @ 8033AA4
thumb_func_start EmitBallThrow
EmitBallThrow: @ 8033AA4
push {lr}
adds r3, r1, 0
lsls r0, 24
@ -2424,7 +2424,7 @@ dp01_build_cmdbuf_x0D_a: @ 8033AA4
pop {r0}
bx r0
.pool
thumb_func_end dp01_build_cmdbuf_x0D_a
thumb_func_end EmitBallThrow
thumb_func_start sub_8033AC4
sub_8033AC4: @ 8033AC4

View File

@ -4183,7 +4183,7 @@ sC6_load_textvar_box_label: @ 809B2C8
ldr r4, [r4]
lsls r0, 24
lsrs r0, 24
bl sav3_get_box_name
bl GetBoxNamePtr
adds r1, r0, 0
adds r0, r4, 0
bl StringCopy

View File

@ -291,7 +291,7 @@ _080BA23C:
b _080BA24E
.pool
_080BA244:
ldr r0, =gUnknown_02022E20
ldr r0, =gBattle_BG3_X
b _080BA24E
.pool
_080BA24C:

View File

@ -16,14 +16,14 @@ gUnknown_082DBD54:: @ 82DBD54
gUnknown_082DBD58:: @ 82DBD58
.incbin "baserom.gba", 0x2dbd58, 0x2c
gUnknown_082DBD84:: @ 82DBD84
BattleScript_SuccessBallThrow:: @ 82DBD84
.incbin "baserom.gba", 0x2dbd84, 0x46
gUnknown_082DBDCA:: @ 82DBDCA
BattleScript_WallyBallThrow:: @ 82DBDCA
.incbin "baserom.gba", 0x2dbdca, 0xa
gUnknown_082DBDD4:: @ 82DBDD4
BattleScript_ShakeBallThrow:: @ 82DBDD4
.incbin "baserom.gba", 0x2dbdd4, 0x2e
gUnknown_082DBE02:: @ 82DBE02
BattleScript_TrainerBallBlock:: @ 82DBE02
.incbin "baserom.gba", 0x2dbe02, 0xf6

View File

@ -205,6 +205,7 @@
#define WEATHER_SUN_ANY ((WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT))
#define WEATHER_HAIL (1 << 7)
#define WEATHER_HAIL_ANY ((WEATHER_HAIL))
#define WEATHER_ANY ((WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY))
#define BATTLE_TERRAIN_GRASS 0
#define BATTLE_TERRAIN_LONG_GRASS 1
@ -216,7 +217,9 @@
#define BATTLE_TERRAIN_CAVE 7
// array entries for battle communication
#define MULTIUSE_STATE 0x0
#define CURSOR_POSITION 0x1
#define TASK_ID 0x1 // task Id and cursor position share the same field
#define MOVE_EFFECT_BYTE 0x3
#define MULTISTRING_CHOOSER 0x5
#define MSG_DISPLAY 0x7
@ -531,6 +534,9 @@ struct BattleResults
u8 unk4; // 0x4
u8 unk5_0:1; // 0x5
u8 unk5_1:1; // 0x5
u8 caughtMonBall:4; // 0x5
u8 unk5_6:1; // 0x5
u8 unk5_7:1; // 0x5
u16 poke1Species; // 0x6
u8 pokeString1[10]; // 0x8
u8 unk12;
@ -542,10 +548,10 @@ struct BattleResults
u16 lastUsedMove; // 0x22
u16 opponentMove; // 0x24
u16 opponentSpecies; // 0x26
u16 caughtPoke; // 0x28
u8 caughtNick[10]; // 0x2A
u16 caughtMonSpecies; // 0x28
u8 caughtMonNick[10]; // 0x2A
u8 filler34[2];
u8 unk36[10]; // usedBalls?
u8 catchAttempts[10]; // 0x36
};
extern struct BattleResults gBattleResults;
@ -588,17 +594,7 @@ struct BattleStruct
u8 field_5C[4];
u8 field_60[4][3];
u8 field_6C;
u8 field_6D;
u8 field_6E;
u8 field_6F;
u8 field_70;
u8 field_71;
u8 field_72;
u8 field_73;
u8 field_74;
u8 field_75;
u8 field_76;
u8 field_77;
u8 caughtMonNick[11];
u8 field_78;
u8 field_79;
u8 field_7A;
@ -845,6 +841,7 @@ struct BattleScripting
u8 field_1D;
u8 atk6C_state;
u8 learnMoveState;
u8 field_20;
};
extern struct BattleScripting gBattleScripting;
@ -862,6 +859,7 @@ void SwitchInClearStructs(void);
void sub_803BDA0(u8 bank);
void sub_803FA70(u8 bank);
void BattleMainCB2(void);
void VBlankCB_Battle(void);
void ResetSentPokesToOpponentValue(void);
bool8 CanRunFromBattle(u8 bank);
bool8 IsRunningFromBattleImpossible(void);
@ -892,8 +890,8 @@ u8 AtkCanceller_UnableToUseMove(void);
bool8 sub_80423F4(u8 bank, u8 r1, u8 r2);
u8 CastformDataTypeChange(u8 bank);
u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg);
void b_call_bc_move_exec(const u8* BS_ptr);
void b_push_move_exec(const u8* BS_ptr);
void BattleScriptExecute(const u8* BS_ptr);
void BattleScriptPushCursorAndCallback(const u8* BS_ptr);
u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn);
void sub_8045868(u8 bank);
void sub_80458B4(void);
@ -905,9 +903,12 @@ void AI_CalcDmg(u8 bankAtk, u8 bankDef);
u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef);
u8 AI_TypeCalc(u16 move, u16 species, u8 ability);
u8 BankGetTurnOrder(u8 bank);
void SetMoveEffect(bool8 primary, u8 certain);
void BattleDestroyCursorAt(u8 cursorPosition);
void BattleCreateCursorAt(u8 cursorPosition);
void BufferMoveToLearnIntoBattleTextBuff2(void);
void sub_8056A3C(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags);
bool8 UproarWakeUpCheck(u8 bank);
// battle_5
void AdjustFriendshipOnBattleFaint(u8 bank);

View File

@ -43,6 +43,7 @@ void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit);
void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, const u8* arg4);
void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, u8 arg2);
void EmitTrainerSlide(u8 bufferId);
void EmitTrainerSlideBack(u8 bufferId);
void EmitFaintingCry(u8 bufferId);
void Emit_x37(u8 bufferId, u8 arg1);
void EmitHitAnimation(u8 bufferId);
@ -51,12 +52,22 @@ void EmitCmd49(u8 bufferId);
void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status);
void EmitCmd13(u8 bufferId);
void EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2);
void EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
#define RESET_ACTION_MOVE_SELECTION 0
#define RESET_ACTION_SELECTION 1
#define RESET_MOVE_SELECTION 2
void EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
#define BALL_NO_SHAKES 0
#define BALL_1_SHAKE 1
#define BALL_2_SHAKES 2
#define BALL_3_SHAKES_FAIL 3
#define BALL_3_SHAKES_SUCCESS 4
#define BALL_TRAINER_BLOCK 5
void EmitBallThrow(u8 bufferId, u8 caseId);
void MarkBufferBankForExecution(u8 bank);
#endif // GUARD_BATTLE_CONTROLLERS_H

View File

@ -211,4 +211,6 @@ extern u8 gBattleTextBuff2[];
extern u8 gBattleTextBuff3[];
extern u8 gDisplayedStringBattle[];
extern const u8* const gRefereeStringsTable[];
#endif // GUARD_BATTLE_MESSAGE_H

12
include/naming_screen.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef GUARD_NAMING_SCREEN_H
#define GUARD_NAMING_SCREEN_H
#define NAMING_SCREEN_PLAYER 0
#define NAMING_SCREEN_BOX 1
#define NAMING_SCREEN_CAUGHT_MON 2
#define NAMING_SCREEN_3 3
#define NAMING_SCREEN_WANDA 4
void DoNamingScreen(u8 caseId, u8* dst, u16 monSpecies, u8 monGender, u32 monPersonality, void (*callback)(void));
#endif // GUARD_NAMING_SCREEN_H

View File

@ -6,6 +6,7 @@ const u8 *GetPokemonCategory(u16);
u16 GetPokedexHeightWeight(u16 dexNum, u8 data);
u16 GetNationalPokedexCount(u8);
u16 GetHoennPokedexCount(u8);
u8 CreateDexDisplayMonDataTask(u16 dexNum, u32 trainerId, u32 personality);
enum
{

View File

@ -0,0 +1,6 @@
#ifndef GUARD_POKEMON_STORAGE_SYSTEM_H
#define GUARD_POKEMON_STORAGE_SYSTEM_H
u8* GetBoxNamePtr(u8 boxNumber);
#endif // GUARD_POKEMON_STORAGE_SYSTEM_H

View File

@ -60,7 +60,6 @@ SECTIONS {
asm/battle_2.o(.text);
src/battle_3.o(.text);
src/battle_4.o(.text);
asm/battle_4.o(.text);
asm/battle_5.o(.text);
asm/battle_controller_player.o(.text);
asm/battle_7.o(.text);

View File

@ -179,13 +179,9 @@ extern const u8 gStatusConditionString_ConfusionJpn[];
extern const u8 gStatusConditionString_LoveJpn[];
extern const u16 gSoundMovesTable[];
extern void CancelMultiTurnMoves(u8 bank);
extern u8 b_first_side(u8, u8, u8);
extern void sub_803CEDC(u8, u8);
extern void b_call_bc_move_exec(const u8 *);
extern void BattleTurnPassed(void);
extern void SetMoveEffect(bool8 primary, u8 certainArg);
extern bool8 UproarWakeUpCheck(u8 bank);
extern void sub_803F9EC();
extern bool8 sub_80423F4(u8 bank, u8, u8);
extern u8 weather_get_current(void);
@ -441,7 +437,7 @@ u8 UpdateTurnCounters(void)
if (--gSideTimers[sideBank].reflectTimer == 0)
{
gSideAffecting[sideBank] &= ~SIDE_STATUS_REFLECT;
b_call_bc_move_exec(gUnknown_082DACFA);
BattleScriptExecute(gUnknown_082DACFA);
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
gBattleTextBuff1[2] = MOVE_REFLECT;
@ -470,7 +466,7 @@ u8 UpdateTurnCounters(void)
if (--gSideTimers[sideBank].lightscreenTimer == 0)
{
gSideAffecting[sideBank] &= ~SIDE_STATUS_LIGHTSCREEN;
b_call_bc_move_exec(gUnknown_082DACFA);
BattleScriptExecute(gUnknown_082DACFA);
gBattleCommunication[MULTISTRING_CHOOSER] = sideBank;
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
@ -499,7 +495,7 @@ u8 UpdateTurnCounters(void)
&& --gSideTimers[sideBank].mistTimer == 0)
{
gSideAffecting[sideBank] &= ~SIDE_STATUS_MIST;
b_call_bc_move_exec(gUnknown_082DACFA);
BattleScriptExecute(gUnknown_082DACFA);
gBattleCommunication[MULTISTRING_CHOOSER] = sideBank;
gBattleTextBuff1[0] = 0xFD;
gBattleTextBuff1[1] = 2;
@ -528,7 +524,7 @@ u8 UpdateTurnCounters(void)
if (--gSideTimers[sideBank].safeguardTimer == 0)
{
gSideAffecting[sideBank] &= ~SIDE_STATUS_SAFEGUARD;
b_call_bc_move_exec(gUnknown_082DAD0B);
BattleScriptExecute(gUnknown_082DAD0B);
effect++;
}
}
@ -551,7 +547,7 @@ u8 UpdateTurnCounters(void)
&& gBattleMons[gActiveBank].hp != 0)
{
gBankTarget = gActiveBank;
b_call_bc_move_exec(BattleScript_WishComesTrue);
BattleScriptExecute(BattleScript_WishComesTrue);
effect++;
}
gBattleStruct->turnSideTracker++;
@ -583,7 +579,7 @@ u8 UpdateTurnCounters(void)
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
else
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
b_call_bc_move_exec(gUnknown_082DAC2C);
BattleScriptExecute(gUnknown_082DAC2C);
effect++;
}
gBattleStruct->turncountersTracker++;
@ -601,7 +597,7 @@ u8 UpdateTurnCounters(void)
gBattleScripting.animArg1 = 0xC;
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
b_call_bc_move_exec(gBattlescriptCurrInstr);
BattleScriptExecute(gBattlescriptCurrInstr);
effect++;
}
gBattleStruct->turncountersTracker++;
@ -617,7 +613,7 @@ u8 UpdateTurnCounters(void)
else
gBattlescriptCurrInstr = gUnknown_082DACD2;
b_call_bc_move_exec(gBattlescriptCurrInstr);
BattleScriptExecute(gBattlescriptCurrInstr);
effect++;
}
gBattleStruct->turncountersTracker++;
@ -635,7 +631,7 @@ u8 UpdateTurnCounters(void)
gBattleScripting.animArg1 = 0xD;
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
b_call_bc_move_exec(gBattlescriptCurrInstr);
BattleScriptExecute(gBattlescriptCurrInstr);
effect++;
}
gBattleStruct->turncountersTracker++;
@ -675,7 +671,7 @@ u8 TurnBasedEffects(void)
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
gBattleMoveDamage *= -1;
b_call_bc_move_exec(BattleScript_IngrainTurnHeal);
BattleScriptExecute(BattleScript_IngrainTurnHeal);
effect++;
}
gBattleStruct->turnEffectsTracker++;
@ -706,7 +702,7 @@ u8 TurnBasedEffects(void)
gBattleMoveDamage = 1;
gBattleScripting.animArg1 = gBankTarget;
gBattleScripting.animArg2 = gBankAttacker;
b_call_bc_move_exec(BattleScript_LeechSeedTurnDrain);
BattleScriptExecute(BattleScript_LeechSeedTurnDrain);
effect++;
}
gBattleStruct->turnEffectsTracker++;
@ -717,7 +713,7 @@ u8 TurnBasedEffects(void)
gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 8;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
b_call_bc_move_exec(BattleScript_PoisonTurnDmg);
BattleScriptExecute(BattleScript_PoisonTurnDmg);
effect++;
}
gBattleStruct->turnEffectsTracker++;
@ -731,7 +727,7 @@ u8 TurnBasedEffects(void)
if ((gBattleMons[gActiveBank].status1 & 0xF00) != 0xF00) //not 16 turns
gBattleMons[gActiveBank].status1 += 0x100;
gBattleMoveDamage *= (gBattleMons[gActiveBank].status1 & 0xF00) >> 8;
b_call_bc_move_exec(BattleScript_PoisonTurnDmg);
BattleScriptExecute(BattleScript_PoisonTurnDmg);
effect++;
}
gBattleStruct->turnEffectsTracker++;
@ -742,7 +738,7 @@ u8 TurnBasedEffects(void)
gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 8;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
b_call_bc_move_exec(BattleScript_BurnTurnDmg);
BattleScriptExecute(BattleScript_BurnTurnDmg);
effect++;
}
gBattleStruct->turnEffectsTracker++;
@ -757,7 +753,7 @@ u8 TurnBasedEffects(void)
gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 4;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
b_call_bc_move_exec(BattleScript_NightmareTurnDmg);
BattleScriptExecute(BattleScript_NightmareTurnDmg);
effect++;
}
else
@ -773,7 +769,7 @@ u8 TurnBasedEffects(void)
gBattleMoveDamage = gBattleMons[gActiveBank].maxHP / 4;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
b_call_bc_move_exec(BattleScript_CurseTurnDmg);
BattleScriptExecute(BattleScript_CurseTurnDmg);
effect++;
}
gBattleStruct->turnEffectsTracker++;
@ -806,7 +802,7 @@ u8 TurnBasedEffects(void)
gBattleTextBuff1[4] = EOS;
gBattlescriptCurrInstr = BattleScript_WrapEnds;
}
b_call_bc_move_exec(gBattlescriptCurrInstr);
BattleScriptExecute(gBattlescriptCurrInstr);
effect++;
}
gBattleStruct->turnEffectsTracker++;
@ -822,7 +818,7 @@ u8 TurnBasedEffects(void)
gBattleMons[gBankAttacker].status1 &= ~(STATUS_SLEEP);
gBattleMons[gBankAttacker].status2 &= ~(STATUS2_NIGHTMARE);
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
b_call_bc_move_exec(gUnknown_082DB234);
BattleScriptExecute(gUnknown_082DB234);
gActiveBank = gBankAttacker;
EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBank].status1);
MarkBufferBankForExecution(gActiveBank);
@ -853,7 +849,7 @@ u8 TurnBasedEffects(void)
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
CancelMultiTurnMoves(gActiveBank);
}
b_call_bc_move_exec(gUnknown_082DB2A6);
BattleScriptExecute(gUnknown_082DB2A6);
effect = 1;
}
}
@ -875,7 +871,7 @@ u8 TurnBasedEffects(void)
gBattleCommunication[MOVE_EFFECT_BYTE] = 0x47;
SetMoveEffect(1, 0);
if (gBattleMons[gActiveBank].status2 & STATUS2_CONFUSION)
b_call_bc_move_exec(BattleScript_ThrashConfuses);
BattleScriptExecute(BattleScript_ThrashConfuses);
effect++;
}
}
@ -899,7 +895,7 @@ u8 TurnBasedEffects(void)
else if (--gDisableStructs[gActiveBank].disableTimer1 == 0) // disable ends
{
gDisableStructs[gActiveBank].disabledMove = 0;
b_call_bc_move_exec(BattleScript_DisabledNoMore);
BattleScriptExecute(BattleScript_DisabledNoMore);
effect++;
}
}
@ -918,7 +914,7 @@ u8 TurnBasedEffects(void)
{
gDisableStructs[gActiveBank].encoredMove = 0;
gDisableStructs[gActiveBank].encoreTimer1 = 0;
b_call_bc_move_exec(BattleScript_EncoredNoMore);
BattleScriptExecute(BattleScript_EncoredNoMore);
effect++;
}
}
@ -952,7 +948,7 @@ u8 TurnBasedEffects(void)
EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBank].status1);
MarkBufferBankForExecution(gActiveBank);
gEffectBank = gActiveBank;
b_call_bc_move_exec(BattleScript_YawnMakesAsleep);
BattleScriptExecute(BattleScript_YawnMakesAsleep);
effect++;
}
}
@ -1006,7 +1002,7 @@ bool8 sub_8041364(void)
gBankAttacker = gWishFutureKnock.futureSightAttacker[gActiveBank];
gBattleMoveDamage = gWishFutureKnock.futureSightDmg[gActiveBank];
gSpecialStatuses[gBankTarget].moveturnLostHP = 0xFFFF;
b_call_bc_move_exec(gUnknown_082DAFE4);
BattleScriptExecute(gUnknown_082DAFE4);
if (gWishFutureKnock.futureSightCounter[gActiveBank] == 0
&& gWishFutureKnock.futureSightCounter[gActiveBank ^ 2] == 0)
@ -1052,7 +1048,7 @@ bool8 sub_8041364(void)
gDisableStructs[gActiveBank].perishSong1--;
gBattlescriptCurrInstr = gUnknown_082DAF20;
}
b_call_bc_move_exec(gBattlescriptCurrInstr);
BattleScriptExecute(gBattlescriptCurrInstr);
return 1;
}
}
@ -1074,7 +1070,7 @@ bool8 sub_8041364(void)
CancelMultiTurnMoves(i);
gBattlescriptCurrInstr = gUnknown_082DB8F3;
b_call_bc_move_exec(gUnknown_082DB8F3);
BattleScriptExecute(gUnknown_082DB8F3);
gBattleStruct->field_1A0++;
return 1;
}
@ -1114,7 +1110,7 @@ bool8 sub_8041728(void)
&& !(gBattleStruct->field_DF & gBitTable[gBattlePartyID[gBattleStruct->field_4E]])
&& !(gAbsentBankFlags & gBitTable[gBattleStruct->field_4E]))
{
b_call_bc_move_exec(gUnknown_082DA7C4);
BattleScriptExecute(gUnknown_082DA7C4);
gBattleStruct->field_4D = 2;
return TRUE;
}
@ -1139,7 +1135,7 @@ bool8 sub_8041728(void)
if (gBattleMons[gBattleStruct->field_4E].hp == 0
&& !(gAbsentBankFlags & gBitTable[gBattleStruct->field_4E]))
{
b_call_bc_move_exec(gUnknown_082DA7CD);
BattleScriptExecute(gUnknown_082DA7CD);
gBattleStruct->field_4D = 5;
return TRUE;
}
@ -1709,7 +1705,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
if (effect)
{
gBattleCommunication[MULTISTRING_CHOOSER] = weather_get_current();
b_push_move_exec(gUnknown_082DACE7);
BattleScriptPushCursorAndCallback(gUnknown_082DACE7);
}
break;
case ABILITY_DRIZZLE:
@ -1717,7 +1713,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
if (!(gBattleWeather & WEATHER_RAIN_PERMANENT))
{
gBattleWeather = (WEATHER_RAIN_PERMANENT | WEATHER_RAIN_TEMPORARY);
b_push_move_exec(BattleScript_DrizzleActivates);
BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates);
gBattleScripting.bank = bank;
effect++;
}
@ -1727,7 +1723,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
if (!(gBattleWeather & WEATHER_SANDSTORM_PERMANENT))
{
gBattleWeather = (WEATHER_SANDSTORM_PERMANENT | WEATHER_SANDSTORM_TEMPORARY);
b_push_move_exec(BattleScript_SandstreamActivates);
BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates);
gBattleScripting.bank = bank;
effect++;
}
@ -1737,7 +1733,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
if (!(gBattleWeather & WEATHER_SUN_PERMANENT))
{
gBattleWeather = (WEATHER_SUN_PERMANENT | WEATHER_SUN_TEMPORARY);
b_push_move_exec(BattleScript_DroughtActivates);
BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates);
gBattleScripting.bank = bank;
effect++;
}
@ -1755,7 +1751,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
effect = CastformDataTypeChange(bank);
if (effect != 0)
{
b_push_move_exec(BattleScript_CastformChange);
BattleScriptPushCursorAndCallback(BattleScript_CastformChange);
gBattleScripting.bank = bank;
gBattleStruct->formToChangeInto = effect - 1;
}
@ -1779,7 +1775,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
effect = CastformDataTypeChange(i);
if (effect != 0)
{
b_push_move_exec(BattleScript_CastformChange);
BattleScriptPushCursorAndCallback(BattleScript_CastformChange);
gBattleScripting.bank = i;
gBattleStruct->formToChangeInto = effect - 1;
break;
@ -1802,7 +1798,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
&& gBattleMons[bank].maxHP > gBattleMons[bank].hp)
{
gLastUsedAbility = ABILITY_RAIN_DISH; //why
b_push_move_exec(BattleScript_RainDishActivates);
BattleScriptPushCursorAndCallback(BattleScript_RainDishActivates);
gBattleMoveDamage = gBattleMons[bank].maxHP / 16;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
@ -1827,7 +1823,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleMons[bank].status1 = 0;
gBattleMons[bank].status2 &= ~(STATUS2_NIGHTMARE); // fix nighmare glitch
gBattleScripting.bank = gActiveBank = bank;
b_push_move_exec(BattleScript_ShedSkinActivates);
BattleScriptPushCursorAndCallback(BattleScript_ShedSkinActivates);
EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[bank].status1);
MarkBufferBankForExecution(gActiveBank);
effect++;
@ -1840,7 +1836,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
gBattleMons[bank].statStages[STAT_STAGE_SPEED]++;
gBattleScripting.animArg1 = 0x11;
gBattleScripting.animArg2 = 0;
b_push_move_exec(BattleScript_SpeedBoostActivates);
BattleScriptPushCursorAndCallback(BattleScript_SpeedBoostActivates);
gBattleScripting.bank = bank;
effect++;
}
@ -2167,7 +2163,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
effect = CastformDataTypeChange(i);
if (effect)
{
b_push_move_exec(BattleScript_CastformChange);
BattleScriptPushCursorAndCallback(BattleScript_CastformChange);
gBattleScripting.bank = i;
gBattleStruct->formToChangeInto = effect - 1;
return effect;
@ -2215,7 +2211,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
{
gLastUsedAbility = ABILITY_INTIMIDATE;
gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES);
b_push_move_exec(gUnknown_082DB4B8);
BattleScriptPushCursorAndCallback(gUnknown_082DB4B8);
gBattleStruct->intimidateBank = i;
effect++;
break;
@ -2267,7 +2263,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
}
if (effect)
{
b_push_move_exec(BattleScript_TraceActivates);
BattleScriptPushCursorAndCallback(BattleScript_TraceActivates);
gStatuses3[i] &= ~(STATUS3_TRACE);
gBattleScripting.bank = i;
@ -2774,7 +2770,7 @@ _08042B56:\n\
ldr r1, =gBattleCommunication\n\
strb r0, [r1, 0x5]\n\
ldr r0, =gUnknown_082DACE7\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
bl _0804441E\n\
.pool\n\
_08042B78:\n\
@ -2789,7 +2785,7 @@ _08042B88:\n\
movs r0, 0x5\n\
strh r0, [r2]\n\
ldr r0, =BattleScript_DrizzleActivates\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
ldr r0, =gBattleScripting\n\
mov r1, r10\n\
strb r1, [r0, 0x17]\n\
@ -2807,7 +2803,7 @@ _08042BB8:\n\
movs r0, 0x18\n\
strh r0, [r2]\n\
ldr r0, =BattleScript_SandstreamActivates\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
ldr r0, =gBattleScripting\n\
mov r2, r10\n\
strb r2, [r0, 0x17]\n\
@ -2825,7 +2821,7 @@ _08042BE8:\n\
movs r0, 0x60\n\
strh r0, [r2]\n\
ldr r0, =BattleScript_DroughtActivates\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
ldr r0, =gBattleScripting\n\
mov r3, r10\n\
strb r3, [r0, 0x17]\n\
@ -2866,7 +2862,7 @@ _08042C3C:\n\
bl _0804443A\n\
_08042C50:\n\
ldr r0, =BattleScript_CastformChange\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
ldr r0, =gBattleScripting\n\
mov r1, r10\n\
strb r1, [r0, 0x17]\n\
@ -2999,7 +2995,7 @@ _08042D66:\n\
_08042D72:\n\
strb r5, [r7]\n\
ldr r0, =BattleScript_RainDishActivates\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
ldr r1, =gBattleMoveDamage\n\
ldrh r0, [r4, 0x2C]\n\
lsrs r0, 4\n\
@ -3093,7 +3089,7 @@ _08042E24:\n\
strb r3, [r4]\n\
strb r3, [r0, 0x17]\n\
ldr r0, =BattleScript_ShedSkinActivates\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
str r5, [sp]\n\
movs r0, 0\n\
movs r1, 0x28\n\
@ -3131,7 +3127,7 @@ _08042EA8:\n\
strb r0, [r4, 0x10]\n\
strb r1, [r4, 0x11]\n\
ldr r0, =BattleScript_SpeedBoostActivates\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
strb r5, [r4, 0x17]\n\
bl _080443D0\n\
.pool\n\
@ -5288,7 +5284,7 @@ _080442C0:\n\
.pool\n\
_080442D8:\n\
ldr r0, =BattleScript_CastformChange\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
ldr r0, =gBattleScripting\n\
strb r6, [r0, 0x17]\n\
_080442E2:\n\
@ -5302,7 +5298,7 @@ _080442E2:\n\
.pool\n\
_080442FC:\n\
ldr r0, =BattleScript_CastformChange\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
ldr r0, =gBattleScripting\n\
mov r5, r10\n\
strb r5, [r0, 0x17]\n\
@ -5321,12 +5317,12 @@ _08044324:\n\
ands r0, r1\n\
str r0, [r2]\n\
ldr r0, =gUnknown_082DB4B8\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
b _080443C8\n\
.pool\n\
_08044340:\n\
ldr r0, =BattleScript_TraceActivates\n\
bl b_push_move_exec\n\
bl BattleScriptPushCursorAndCallback\n\
ldr r1, =gStatuses3\n\
ldr r0, [sp, 0x18]\n\
adds r1, r0, r1\n\
@ -5445,7 +5441,7 @@ _0804443A:\n\
}
#endif // NONMATCHING
void b_call_bc_move_exec(const u8* BS_ptr)
void BattleScriptExecute(const u8* BS_ptr)
{
gBattlescriptCurrInstr = BS_ptr;
BATTLE_CALLBACKS_STACK->function[BATTLE_CALLBACKS_STACK->size++] = gBattleMainFunc;
@ -5453,7 +5449,7 @@ void b_call_bc_move_exec(const u8* BS_ptr)
gFightStateTracker = 0;
}
void b_push_move_exec(const u8* BS_ptr)
void BattleScriptPushCursorAndCallback(const u8* BS_ptr)
{
BattleScriptPushCursor();
gBattlescriptCurrInstr = BS_ptr;
@ -5549,7 +5545,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleScripting.bank = bank;
gStringBank = bank;
gActiveBank = gBankAttacker = bank;
b_call_bc_move_exec(BattleScript_WhiteHerbEnd2);
BattleScriptExecute(BattleScript_WhiteHerbEnd2);
}
break;
}
@ -5566,7 +5562,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].hp + bankQuality > gBattleMons[bank].maxHP)
gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp;
gBattleMoveDamage *= -1;
b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem);
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
effect = 4;
}
break;
@ -5601,7 +5597,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleTextBuff1[2] = move;
gBattleTextBuff1[3] = move >> 8;
gBattleTextBuff1[4] = 0xFF;
b_call_bc_move_exec(BattleScript_BerryPPHealEnd2);
BattleScriptExecute(BattleScript_BerryPPHealEnd2);
EmitSetMonData(0, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP);
MarkBufferBankForExecution(gActiveBank);
effect = ITEM_PP_CHANGE;
@ -5622,7 +5618,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleScripting.bank = bank;
gStringBank = bank;
gActiveBank = gBankAttacker = bank;
b_call_bc_move_exec(BattleScript_WhiteHerbEnd2);
BattleScriptExecute(BattleScript_WhiteHerbEnd2);
}
break;
case HOLD_EFFECT_LEFTOVERS:
@ -5634,7 +5630,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].hp + gBattleMoveDamage > gBattleMons[bank].maxHP)
gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp;
gBattleMoveDamage *= -1;
b_call_bc_move_exec(BattleScript_ItemHealHP_End2);
BattleScriptExecute(BattleScript_ItemHealHP_End2);
effect = ITEM_HP_CHANGE;
RecordItemEffectBattle(bank, bankHoldEffect);
}
@ -5654,9 +5650,9 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp;
gBattleMoveDamage *= -1;
if (GetFlavourRelationByPersonality(gBattleMons[bank].personality, FLAVOR_SPICY) < 0)
b_call_bc_move_exec(BattleScript_BerryConfuseHealEnd2);
BattleScriptExecute(BattleScript_BerryConfuseHealEnd2);
else
b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem);
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
effect = ITEM_HP_CHANGE;
}
break;
@ -5674,9 +5670,9 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp;
gBattleMoveDamage *= -1;
if (GetFlavourRelationByPersonality(gBattleMons[bank].personality, FLAVOR_DRY) < 0)
b_call_bc_move_exec(BattleScript_BerryConfuseHealEnd2);
BattleScriptExecute(BattleScript_BerryConfuseHealEnd2);
else
b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem);
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
effect = ITEM_HP_CHANGE;
}
break;
@ -5694,9 +5690,9 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp;
gBattleMoveDamage *= -1;
if (GetFlavourRelationByPersonality(gBattleMons[bank].personality, FLAVOR_SWEET) < 0)
b_call_bc_move_exec(BattleScript_BerryConfuseHealEnd2);
BattleScriptExecute(BattleScript_BerryConfuseHealEnd2);
else
b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem);
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
effect = ITEM_HP_CHANGE;
}
break;
@ -5714,9 +5710,9 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp;
gBattleMoveDamage *= -1;
if (GetFlavourRelationByPersonality(gBattleMons[bank].personality, FLAVOR_BITTER) < 0)
b_call_bc_move_exec(BattleScript_BerryConfuseHealEnd2);
BattleScriptExecute(BattleScript_BerryConfuseHealEnd2);
else
b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem);
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
effect = ITEM_HP_CHANGE;
}
break;
@ -5734,9 +5730,9 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleMoveDamage = gBattleMons[bank].maxHP - gBattleMons[bank].hp;
gBattleMoveDamage *= -1;
if (GetFlavourRelationByPersonality(gBattleMons[bank].personality, FLAVOR_SOUR) < 0)
b_call_bc_move_exec(BattleScript_BerryConfuseHealEnd2);
BattleScriptExecute(BattleScript_BerryConfuseHealEnd2);
else
b_call_bc_move_exec(BattleScript_ItemHealHP_RemoveItem);
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
effect = ITEM_HP_CHANGE;
}
break;
@ -5759,7 +5755,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleScripting.statChanger = 0x10 + STAT_STAGE_ATK;
gBattleScripting.animArg1 = 0xE + STAT_STAGE_ATK;
gBattleScripting.animArg2 = 0;
b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2);
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
effect = ITEM_STATS_CHANGE;
}
break;
@ -5775,7 +5771,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleScripting.statChanger = 0x10 + STAT_STAGE_DEF;
gBattleScripting.animArg1 = 0xE + STAT_STAGE_DEF;
gBattleScripting.animArg2 = 0;
b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2);
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
effect = ITEM_STATS_CHANGE;
}
break;
@ -5791,7 +5787,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleScripting.statChanger = 0x10 + STAT_STAGE_SPEED;
gBattleScripting.animArg1 = 0xE + STAT_STAGE_SPEED;
gBattleScripting.animArg2 = 0;
b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2);
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
effect = ITEM_STATS_CHANGE;
}
break;
@ -5807,7 +5803,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleScripting.statChanger = 0x10 + STAT_STAGE_SPATK;
gBattleScripting.animArg1 = 0xE + STAT_STAGE_SPATK;
gBattleScripting.animArg2 = 0;
b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2);
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
effect = ITEM_STATS_CHANGE;
}
break;
@ -5823,7 +5819,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleScripting.statChanger = 0x10 + STAT_STAGE_SPDEF;
gBattleScripting.animArg1 = 0xE + STAT_STAGE_SPDEF;
gBattleScripting.animArg2 = 0;
b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2);
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
effect = ITEM_STATS_CHANGE;
}
break;
@ -5831,7 +5827,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].hp <= gBattleMons[bank].maxHP / bankQuality && !moveTurn && !(gBattleMons[bank].status2 & STATUS2_FOCUS_ENERGY))
{
gBattleMons[bank].status2 |= STATUS2_FOCUS_ENERGY;
b_call_bc_move_exec(BattleScript_BerryFocusEnergyEnd2);
BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2);
effect = ITEM_EFFECT_OTHER;
}
break;
@ -5868,7 +5864,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleScripting.statChanger = 0x21 + i;
gBattleScripting.animArg1 = 0x21 + i + 6;
gBattleScripting.animArg2 = 0;
b_call_bc_move_exec(BattleScript_BerryStatRaiseEnd2);
BattleScriptExecute(BattleScript_BerryStatRaiseEnd2);
effect = ITEM_STATS_CHANGE;
}
}
@ -5877,7 +5873,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].status1 & STATUS_PARALYSIS)
{
gBattleMons[bank].status1 &= ~(STATUS_PARALYSIS);
b_call_bc_move_exec(BattleScript_BerryCurePrlzEnd2);
BattleScriptExecute(BattleScript_BerryCurePrlzEnd2);
effect = ITEM_STATUS_CHANGE;
}
break;
@ -5885,7 +5881,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].status1 & STATUS_PSN_ANY)
{
gBattleMons[bank].status1 &= ~(STATUS_PSN_ANY | STATUS_TOXIC_COUNTER);
b_call_bc_move_exec(BattleScript_BerryCurePsnEnd2);
BattleScriptExecute(BattleScript_BerryCurePsnEnd2);
effect = ITEM_STATUS_CHANGE;
}
break;
@ -5893,7 +5889,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].status1 & STATUS_BURN)
{
gBattleMons[bank].status1 &= ~(STATUS_BURN);
b_call_bc_move_exec(BattleScript_BerryCureBrnEnd2);
BattleScriptExecute(BattleScript_BerryCureBrnEnd2);
effect = ITEM_STATUS_CHANGE;
}
break;
@ -5901,7 +5897,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].status1 & STATUS_FREEZE)
{
gBattleMons[bank].status1 &= ~(STATUS_FREEZE);
b_call_bc_move_exec(BattleScript_BerryCureFrzEnd2);
BattleScriptExecute(BattleScript_BerryCureFrzEnd2);
effect = ITEM_STATUS_CHANGE;
}
break;
@ -5910,7 +5906,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
{
gBattleMons[bank].status1 &= ~(STATUS_SLEEP);
gBattleMons[bank].status2 &= ~(STATUS2_NIGHTMARE);
b_call_bc_move_exec(BattleScript_BerryCureSlpEnd2);
BattleScriptExecute(BattleScript_BerryCureSlpEnd2);
effect = ITEM_STATUS_CHANGE;
}
break;
@ -5918,7 +5914,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
if (gBattleMons[bank].status2 & STATUS2_CONFUSION)
{
gBattleMons[bank].status2 &= ~(STATUS2_CONFUSION);
b_call_bc_move_exec(BattleScript_BerryCureConfusionEnd2);
BattleScriptExecute(BattleScript_BerryCureConfusionEnd2);
effect = ITEM_EFFECT_OTHER;
}
break;
@ -5963,7 +5959,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
gBattleMons[bank].status1 = 0;
gBattleMons[bank].status2 &= ~(STATUS2_CONFUSION);
b_call_bc_move_exec(BattleScript_BerryCureChosenStatusEnd2);
BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2);
effect = ITEM_STATUS_CHANGE;
}
break;
@ -5972,7 +5968,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
{
gBattleMons[bank].status2 &= ~(STATUS2_INFATUATION);
StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn);
b_call_bc_move_exec(BattleScript_BerryCureChosenStatusEnd2);
BattleScriptExecute(BattleScript_BerryCureChosenStatusEnd2);
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
effect = ITEM_EFFECT_OTHER;
}

File diff suppressed because it is too large Load Diff

View File

@ -223,7 +223,7 @@ gBattle_BG2_X: @ 2022E1C
gBattle_BG2_Y: @ 2022E1E
.space 0x2
gUnknown_02022E20: @ 2022E20
gBattle_BG3_X: @ 2022E20
.space 0x2
gUnknown_02022E22: @ 2022E22