fix merge conflicts

This commit is contained in:
DizzyEggg 2017-10-19 19:46:37 +02:00
commit dee6133076
39 changed files with 1929 additions and 4080 deletions

View File

@ -59,13 +59,13 @@ _08056F3E:
bl AllocZeroed
ldr r1, [r5]
str r0, [r1, 0x1C]
ldr r4, =gUnknown_020244A0
ldr r4, =gLinkBattleSendBuffer
movs r5, 0x80
lsls r5, 5
adds r0, r5, 0
bl AllocZeroed
str r0, [r4]
ldr r4, =gUnknown_020244A4
ldr r4, =gLinkBattleRecvBuffer
adds r0, r5, 0
bl AllocZeroed
str r0, [r4]
@ -160,11 +160,11 @@ _0805703C:
str r5, [r0, 0x1C]
bl Free
str r5, [r6]
ldr r4, =gUnknown_020244A0
ldr r4, =gLinkBattleSendBuffer
ldr r0, [r4]
bl Free
str r5, [r4]
ldr r4, =gUnknown_020244A4
ldr r4, =gLinkBattleRecvBuffer
ldr r0, [r4]
bl Free
str r5, [r4]

View File

@ -1801,7 +1801,7 @@ _0805E056:
movs r4, 0
cmp r4, r5
bcs _0805E076
ldr r7, =gBanksBySide
ldr r7, =gBanksByIdentity
ldr r6, =gUnknown_0832C108
_0805E060:
adds r0, r4, r7
@ -1874,14 +1874,14 @@ _0805E0F0:
_0805E100:
cmp r4, 0x4
bne _0805E110
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0]
b _0805E198
.pool
_0805E110:
cmp r4, 0x5
bne _0805E1AC
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0, 0x1]
b _0805E198
.pool
@ -1916,28 +1916,28 @@ _0805E150:
_0805E160:
cmp r4, 0x6
bne _0805E170
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0]
b _0805E198
.pool
_0805E170:
cmp r4, 0x7
bne _0805E180
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0, 0x1]
b _0805E198
.pool
_0805E180:
cmp r4, 0x8
bne _0805E190
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0, 0x2]
b _0805E198
.pool
_0805E190:
cmp r5, 0x9
bne _0805E1AC
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0, 0x3]
_0805E198:
lsls r0, 3
@ -2038,7 +2038,7 @@ _0805E252:
_0805E260:
ldrb r0, [r4]
bl SetBankHealthboxSpritePos
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r1, [r4]
adds r0, r1, r0
ldrb r0, [r0]

View File

@ -10676,7 +10676,7 @@ _08103D54:
strh r0, [r3, 0x4]
b _08103DB6
_08103D5C:
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
adds r0, r1
@ -27474,7 +27474,7 @@ sub_810C560: @ 810C560
lsls r0, 8
strh r0, [r5, 0x3C]
_0810C594:
ldr r3, =gBanksBySide
ldr r3, =gBanksByIdentity
ldrb r0, [r7]
adds r0, r3
ldrb r1, [r0]
@ -27699,7 +27699,7 @@ _0810C736:
lsls r0, 24
cmp r0, 0
bne _0810C78C
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
ldrb r0, [r6]
adds r0, r1
ldrb r1, [r0]
@ -27843,7 +27843,7 @@ _0810C85A:
lsls r0, 24
cmp r0, 0
bne _0810C8B4
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
adds r0, r1
@ -28771,7 +28771,7 @@ _0810D000:
negs r0, r0
lsrs r4, r0, 16
_0810D012:
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
add r0, r8
ldrb r1, [r0]
adds r0, r7, 0

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

@ -514,7 +514,7 @@ _08072694:
_08072716:
str r0, [sp]
_08072718:
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
add r0, r10
ldrb r1, [r0]
lsls r0, r1, 1

View File

@ -1980,7 +1980,7 @@ _080B3474:
bl sub_800B524
lsls r0, r4, 24
lsrs r0, 24
bl sub_800A5EC
bl ResetBlockReceivedFlag
adds r5, 0x1C
adds r4, 0x1
_080B349A:

View File

@ -1048,7 +1048,7 @@ _080D8004:
bl sub_80DC594
bl sub_80DC5E8
bl sub_80DC7EC
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
strb r4, [r1]
movs r0, 0x1
strb r0, [r1, 0x1]

View File

@ -50,7 +50,7 @@ sub_80FC530: @ 80FC530
cmp r4, 0
beq _080FC552
adds r0, r5, 0
bl sub_800A5EC
bl ResetBlockReceivedFlag
movs r0, 0x1
b _080FC554
_080FC552:

View File

@ -5,127 +5,6 @@
.text
thumb_func_start GetStringCenterAlignXOffset
@ s32 GetStringCenterAlignXOffset(u8 fontId, u8 *str, s32 totalWidth)
GetStringCenterAlignXOffset: @ 81DB35C
push {lr}
movs r3, 0
bl GetStringCenterAlignXOffsetWithLetterSpacing
pop {r1}
bx r1
thumb_func_end GetStringCenterAlignXOffset
thumb_func_start GetStringRightAlignXOffset
@ s32 GetStringRightAlignXOffset(u8 fontId, u8 *str, s32 totalWidth)
GetStringRightAlignXOffset: @ 81DB368
push {lr}
movs r3, 0
bl GetStringWidthDifference
pop {r1}
bx r1
thumb_func_end GetStringRightAlignXOffset
thumb_func_start GetStringCenterAlignXOffsetWithLetterSpacing
@ s32 GetStringCenterAlignXOffsetWithLetterSpacing(u8 fontId, u8 *str, s32 totalWidth, s16 letterSpacing)
GetStringCenterAlignXOffsetWithLetterSpacing: @ 81DB374
push {lr}
bl GetStringWidthDifference
lsrs r1, r0, 31
adds r0, r1
asrs r0, 1
pop {r1}
bx r1
thumb_func_end GetStringCenterAlignXOffsetWithLetterSpacing
thumb_func_start GetStringWidthDifference
@ s32 GetStringWidthDifference(u8 fontId, u8 *str, s32 totalWidth, s16 letterSpacing)
GetStringWidthDifference: @ 81DB384
push {r4,lr}
adds r4, r2, 0
adds r2, r3, 0
lsls r0, 24
lsrs r0, 24
lsls r2, 16
asrs r2, 16
bl GetStringWidth
cmp r4, r0
bgt _081DB39E
movs r0, 0
b _081DB3A0
_081DB39E:
subs r0, r4, r0
_081DB3A0:
pop {r4}
pop {r1}
bx r1
thumb_func_end GetStringWidthDifference
thumb_func_start GetMaxWidthInMenuTable
GetMaxWidthInMenuTable: @ 81DB3A8
push {r4-r6,lr}
movs r6, 0
cmp r6, r1
bge _081DB3CC
adds r5, r0, 0
adds r4, r1, 0
_081DB3B4:
ldr r1, [r5]
movs r0, 0x1
movs r2, 0
bl GetStringWidth
cmp r0, r6
ble _081DB3C4
adds r6, r0, 0
_081DB3C4:
adds r5, 0x8
subs r4, 0x1
cmp r4, 0
bne _081DB3B4
_081DB3CC:
adds r0, r6, 0
bl convert_pixel_width_to_tile_width
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end GetMaxWidthInMenuTable
thumb_func_start sub_81DB3D8
sub_81DB3D8: @ 81DB3D8
push {r4-r7,lr}
mov r7, r8
push {r7}
mov r8, r0
adds r7, r1, 0
adds r5, r2, 0
movs r6, 0
movs r4, 0
cmp r6, r5
bge _081DB40A
_081DB3EC:
adds r0, r7, r4
ldrb r0, [r0]
lsls r0, 3
add r0, r8
ldr r1, [r0]
movs r0, 0x1
movs r2, 0
bl GetStringWidth
cmp r0, r6
ble _081DB404
adds r6, r0, 0
_081DB404:
adds r4, 0x1
cmp r4, r5
blt _081DB3EC
_081DB40A:
adds r0, r6, 0
bl convert_pixel_width_to_tile_width
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_81DB3D8
thumb_func_start sub_81DB41C
sub_81DB41C: @ 81DB41C

View File

@ -545,7 +545,7 @@ _08009888:
movs r6, 0
strh r0, [r4]
adds r0, r5, 0
bl sub_800A5EC
bl ResetBlockReceivedFlag
ldrh r0, [r4]
cmp r0, r8
beq _080098C4
@ -2181,8 +2181,8 @@ _0800A5E2:
.pool
thumb_func_end ResetBlockReceivedFlags
thumb_func_start sub_800A5EC
sub_800A5EC: @ 800A5EC
thumb_func_start ResetBlockReceivedFlag
ResetBlockReceivedFlag: @ 800A5EC
push {lr}
lsls r0, 24
lsrs r1, r0, 24
@ -2206,7 +2206,7 @@ _0800A616:
pop {r0}
bx r0
.pool
thumb_func_end sub_800A5EC
thumb_func_end ResetBlockReceivedFlag
thumb_func_start sub_800A620
sub_800A620: @ 800A620
@ -14607,7 +14607,7 @@ sub_8010A70: @ 8010A70
adds r1, r4, 0
bl CpuSet
movs r0, 0
bl sub_800A5EC
bl ResetBlockReceivedFlag
_08010A9C:
add sp, 0x4
pop {r4,r5}
@ -14683,7 +14683,7 @@ _08010B40:
b _08010CF0
_08010B4A:
adds r0, r4, 0
bl sub_800A5EC
bl ResetBlockReceivedFlag
movs r0, 0xF0
lsls r0, 7
bl sub_800FD14
@ -14713,7 +14713,7 @@ _08010B78:
b _08010CF0
_08010B8C:
adds r0, r4, 0
bl sub_800A5EC
bl ResetBlockReceivedFlag
lsls r2, r4, 8
ldr r0, =gBlockRecvBuffer
adds r2, r0
@ -14845,7 +14845,7 @@ _08010C94:
ldr r2, =0x0100007e
bl CpuSet
movs r0, 0
bl sub_800A5EC
bl ResetBlockReceivedFlag
ldr r1, =gUnknown_03005000
ldr r5, =0x00000ce8
adds r0, r1, r5
@ -14947,7 +14947,7 @@ _08010D82:
ldr r0, =gBlockRecvBuffer
bl sub_8010A14
movs r0, 0
bl sub_800A5EC
bl ResetBlockReceivedFlag
ldr r0, =gReceivedRemoteLinkPlayers
strb r4, [r0]
adds r0, r5, 0
@ -39108,7 +39108,7 @@ sub_801D978: @ 801D978
push {lr}
lsls r0, 24
lsrs r0, 24
bl sub_800A5EC
bl ResetBlockReceivedFlag
pop {r0}
bx r0
thumb_func_end sub_801D978
@ -42361,7 +42361,7 @@ _0801F3A2:
strh r1, [r4, 0x4]
lsls r0, r1, 24
lsrs r0, 24
bl sub_800A5EC
bl ResetBlockReceivedFlag
movs r1, 0x2
ldrsh r0, [r4, r1]
lsls r0, 8

View File

@ -1135,7 +1135,7 @@ _080E76DC:
bl memcpy
_080E76E4:
mov r0, r8
bl sub_800A5EC
bl ResetBlockReceivedFlag
mov r0, r9
lsls r1, r0, 1
adds r1, r5, r1

3775
asm/rom3.s

File diff suppressed because it is too large Load Diff

View File

@ -11676,7 +11676,7 @@ _0813B62E:
ldrh r0, [r0]
strh r0, [r5]
movs r0, 0x1
bl sub_800A5EC
bl ResetBlockReceivedFlag
ldr r0, =gSpecialVar_0x8004
ldrh r0, [r0]
cmp r0, 0x1
@ -11756,7 +11756,7 @@ _0813B6E4:
ldrh r0, [r0]
strh r0, [r1]
movs r0, 0
bl sub_800A5EC
bl ResetBlockReceivedFlag
_0813B708:
ldr r1, =gTasks
lsls r0, r4, 2

View File

@ -1810,7 +1810,7 @@ _080A6A04:
GetBankSide: @ 80A6A30
lsls r0, 24
lsrs r0, 24
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
adds r0, r1
ldrb r1, [r0]
movs r0, 0x1
@ -1823,7 +1823,7 @@ GetBankSide: @ 80A6A30
GetBankIdentity: @ 80A6A44
lsls r0, 24
lsrs r0, 24
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
adds r0, r1
ldrb r0, [r0]
bx lr
@ -1840,7 +1840,7 @@ GetBankByIdentity: @ 80A6A54
ldrb r2, [r0]
cmp r1, r2
bcs _080A6A7E
ldr r4, =gBanksBySide
ldr r4, =gBanksByIdentity
ldrb r0, [r4]
cmp r0, r3
beq _080A6A7E
@ -1883,7 +1883,7 @@ AnimBankSpriteExists: @ 80A6A90
b _080A6B18
.pool
_080A6ABC:
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
adds r0, r4, r0
ldrb r0, [r0]
cmp r0, 0xFF

View File

@ -125,7 +125,7 @@ sub_8077234: @ 8077234
_08077250:
lsls r0, r4, 24
lsrs r0, 24
bl sub_800A5EC
bl ResetBlockReceivedFlag
_08077258:
pop {r4}
pop {r0}
@ -12903,7 +12903,7 @@ _0807E504:
strb r6, [r0]
_0807E514:
movs r0, 0
bl sub_800A5EC
bl ResetBlockReceivedFlag
_0807E51A:
movs r0, 0x2
ands r0, r5
@ -12924,7 +12924,7 @@ _0807E51A:
strb r1, [r0]
_0807E53C:
movs r0, 0x1
bl sub_800A5EC
bl ResetBlockReceivedFlag
_0807E542:
pop {r4-r6}
pop {r0}

View File

@ -27,7 +27,9 @@
#define BIT_SIDE 0x1
#define BIT_MON 0x2
#define GET_BANK_IDENTITY(bank)((gBanksByIdentity[bank]))
#define GET_BANK_SIDE(bank)((GetBankIdentity(bank) & BIT_SIDE))
#define GET_BANK_SIDE2(bank)((GET_BANK_IDENTITY(bank) & BIT_SIDE))
#define BATTLE_TYPE_DOUBLE 0x0001
#define BATTLE_TYPE_LINK 0x0002
@ -655,7 +657,9 @@ struct BattleStruct
u8 field_1A1;
bool8 overworldWeatherDone;
u8 atkCancellerTracker;
u8 field_1A4[240];
u8 field_1A4[96];
u8 field_204[104];
u8 field_26C[40];
u8 field_294[4];
u8 field_298[8];
u8 field_2A0;
@ -915,6 +919,11 @@ struct BattleSpriteData
extern struct BattleSpriteData *gBattleSpritesDataPtr;
#define BATTLE_BUFFER_LINK_SIZE 0x1000
extern u8 *gLinkBattleSendBuffer;
extern u8 *gLinkBattleRecvBuffer;
// Move this somewhere else
#include "sprite.h"

View File

@ -17,6 +17,8 @@ void RunBattleScriptCommands_PopCallbacksStack(void);
void RunBattleScriptCommands(void);
u32 sub_80397C4(u32 setId, u32 tableId);
void sub_8039E9C(struct Sprite *sprite);
void nullsub_20(void);
void BeginBattleIntro(void);
extern const u8 gStatusConditionString_PoisonJpn[8];
extern const u8 gStatusConditionString_SleepJpn[8];

View File

@ -1,7 +0,0 @@
#ifndef GUARD_BATTLE_CONTROLLER_PLAYER_H
#define GUARD_BATTLE_CONTROLLER_PLAYER_H
void ActionSelectionCreateCursorAt(u8 cursorPos, u8 unused);
void ActionSelectionDestroyCursorAt(u8 cursorPos);
#endif // GUARD_BATTLE_CONTROLLER_PLAYER_H

View File

@ -1,8 +1,6 @@
#ifndef GUARD_BATTLE_CONTROLLERS_H
#define GUARD_BATTLE_CONTROLLERS_H
#include "battle_controller_player.h"
#define REQUEST_ALL_BATTLE 0x0
#define REQUEST_SPECIES_BATTLE 0x1
#define REQUEST_HELDITEM_BATTLE 0x2
@ -48,44 +46,162 @@ struct ChooseMoveStruct
u8 monType2;
};
// rom3.s, emitters
void EmitSetMonData(u8 bufferId, u8 request, u8 c, u8 bytes, void *data);
void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct* disableStructPtr, u8 multihit);
void EmitHealthBarUpdate(u8 bufferId, u16 hpValue);
void EmitEffectivenessSound(u8 bufferId, u16 songId);
void EmitPlaySound(u8 bufferId, u16 songId, u8 arg2);
void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringId);
void EmitFaintAnimation(u8 bufferId);
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 EmitReturnPokeToBall(u8 bufferId, u8 arg1);
enum
{
CONTROLLER_GETMONDATA,
CONTROLLER_GETRAWMONDATA,
CONTROLLER_SETMONDATA,
CONTROLLER_SETRAWMONDATA,
CONTROLLER_LOADMONSPRITE,
CONTROLLER_SWITCHINANIM,
CONTROLLER_RETURNMONTOBALL,
CONTROLLER_DRAWTRAINERPIC,
CONTROLLER_TRAINERSLIDE,
CONTROLLER_TRAINERSLIDEBACK,
CONTROLLER_FAINTANIMATION,
CONTROLLER_11,
CONTROLLER_12,
CONTROLLER_BALLTHROW,
CONTROLLER_PAUSE,
CONTROLLER_MOVEANIMATION,
CONTROLLER_PRINTSTRING,
CONTROLLER_PRINTSTRINGPLAYERONLY,
CONTROLLER_CHOOSEACTION,
CONTROLLER_19,
CONTROLLER_CHOOSEMOVE,
CONTROLLER_OPENBAG,
CONTROLLER_CHOOSEPOKEMON,
CONTROLLER_23,
CONTROLLER_HEALTHBARUPDATE,
CONTROLLER_EXPUPDATE,
CONTROLLER_STATUSICONUPDATE,
CONTROLLER_STATUSANIMATION,
CONTROLLER_STATUSXOR,
CONTROLLER_DATATRANSFER,
CONTROLLER_DMA3TRANSFER,
CONTROLLER_31,
CONTROLLER_32,
CONTROLLER_33,
CONTROLLER_34,
CONTROLLER_35,
CONTROLLER_36,
CONTROLLER_37,
CONTROLLER_38,
CONTROLLER_39,
CONTROLLER_40,
CONTROLLER_HITANIMATION,
CONTROLLER_42,
CONTROLLER_EFFECTIVENESSSOUND,
CONTROLLER_PLAYFANFAREORBGM,
CONTROLLER_FAINTINGCRY,
CONTROLLER_INTROSLIDE,
CONTROLLER_INTROTRAINERBALLTHROW,
CONTROLLER_DRAWPARTYSTATUSSUMMARY,
CONTROLLER_49,
CONTROLLER_50,
CONTROLLER_SPRITEINVISIBILITY,
CONTROLLER_BATTLEANIMATION,
CONTROLLER_LINKSTANDBYMSG,
CONTROLLER_RESETACTIONMOVESELECTION,
CONTROLLER_55,
CONTROLLER_56
};
#define LAST_CONTROLLER_CMD_ID CONTROLLER_56 + 1
// general functions
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);
void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused
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 EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4);
void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2);
void EmitReturnMonToBall(u8 bufferId, u8 arg1);
void EmitDrawTrainerPic(u8 bufferId);
void EmitTrainerSlide(u8 bufferId);
void EmitTrainerSlideBack(u8 bufferId);
void EmitFaintingCry(u8 bufferId);
void Emit_x37(u8 bufferId, u8 arg1);
void EmitFaintAnimation(u8 bufferId);
void EmitCmd11(u8 bufferId); // unused
void EmitCmd12(u8 bufferId); // unused
void EmitBallThrow(u8 bufferId, u8 caseId);
void EmitPause(u8 bufferId, u8 toWait, void *data); // unused
void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit);
void EmitPrintString(u8 bufferId, u16 stringId);
void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringId);
void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2);
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 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 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 EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2);
void EmitIntroSlide(u8 bufferId, u8 terrainId);
void EmitDrawTrainerPic(u8 bufferId);
void EmitLoadMonSprite(u8 bufferId);
void EmitIntroTrainerBallThrow(u8 bufferId);
void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2);
void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct* movePpData);
void EmitOpenBag(u8 bufferId, u8* arg1);
void Emit_x32(u8 bufferId);
void EmitPrintString(u8 bufferId, u16 stringId);
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 EmitBallThrow(u8 bufferId, u8 caseId);
void EmitCmd_x21(u8 bufferId, u8 arg1, u16 arg2);
void EmitCmd55(u8 bufferId, u8 arg1);
// player controller
void SetBankFuncToPlayerBufferRunCommand(void);
void nullsub_21(void);
void ActionSelectionCreateCursorAt(u8 cursorPos, u8 unused);
void ActionSelectionDestroyCursorAt(u8 cursorPos);
// recorded player controller
void SetBankFuncToRecordedPlayerBufferRunCommand(void);
// opponent controller
void SetBankFuncToOpponentBufferRunCommand(void);
// player partner controller
void SetBankFuncToPlayerPartnerBufferRunCommand(void);
// safari controller
void SetBankFuncToSafariBufferRunCommand(void);
// wally controller
void SetBankFuncToWallyBufferRunCommand(void);
// recorded opponent controller
void SetBankFuncToRecordedOpponentBufferRunCommand(void);
// link opponent
void SetBankFuncToLinkOpponentBufferRunCommand(void);
// link partner
void SetBankFuncToLinkPartnerBufferRunCommand(void);
#endif // GUARD_BATTLE_CONTROLLERS_H

View File

@ -33,6 +33,7 @@
#define ITEMEFFECT_ON_SWITCH_IN 0x0
#define WEATHER_HAS_EFFECT ((!AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, ABILITY_CLOUD_NINE, 0, 0) && !AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, ABILITY_AIR_LOCK, 0, 0)))
#define WEATHER_HAS_EFFECT2 ((!AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_CLOUD_NINE, 0, 0) && !AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_AIR_LOCK, 0, 0)))
#define BS_GET_TARGET 0
#define BS_GET_ATTACKER 1

View File

@ -1,13 +1,21 @@
#ifndef GUARD_international_string_util_H
#define GUARD_international_string_util_H
#ifndef GUARD_INTERNATIONAL_STRING_UTIL_H
#define GUARD_INTERNATIONAL_STRING_UTIL_H
// Exported type declarations
// Exported RAM declarations
// Exported ROM declarations
void TVShowConvertInternationalString(void *dest, const void *src, u8 language);
s32 GetStringCenterAlignXOffset(s32 fontId, const u8 *str, s32 totalWidth);
s32 GetStringRightAlignXOffset(s32 fontId, const u8 *str, s32 totalWidth);
s32 GetStringCenterAlignXOffsetWithLetterSpacing(s32 fontId, const u8 *str, s32 totalWidth, s32 letterSpacing);
s32 GetStringWidthDifference(s32 fontId, const u8 *str, s32 totalWidth, s32 letterSpacing);
s32 GetMaxWidthInMenuTable(const u8 **str, s32 arg1);
s32 sub_81DB3D8(const u8 **str, u8* arg1, s32 arg2);
// sub_81DB41C
// sub_81DB468
// sub_81DB494
// sub_81DB4DC
// sub_81DB52C
// sub_81DB554
// sub_81DB5AC
void TVShowConvertInternationalString(u8 *dest, const u8 *src, u8 language);
u32 sub_81DB604(const u8 *);
// sub_81DB620
#endif //GUARD_international_string_util_H
#endif // GUARD_INTERNATIONAL_STRING_UTIL_H

View File

@ -141,6 +141,7 @@ extern u8 gShouldAdvanceLinkState;
extern struct LinkPlayer gLinkPlayers[];
extern u16 word_3002910[];
extern bool8 gReceivedRemoteLinkPlayers;
extern bool8 gLinkVSyncDisabled;
void Task_DestroySelf(u8);
void OpenLink(void);
@ -184,5 +185,11 @@ bool8 sub_800A520(void);
bool8 sub_8010500(void);
void sub_800DFB4(u8, u8);
void sub_800ADF8(void);
void sub_800B488(void);
void sub_8009734(void);
void sub_800A620(void);
void sub_8011BD0(void);
u8 sub_800ABAC(void);
u8 sub_800ABBC(void);
#endif // GUARD_LINK_H

View File

@ -3,6 +3,7 @@
extern u32 gRecordedBattleRngSeed;
void sub_8184DA4(u8 arg0);
void sub_8185F84(void);
void sub_8184E58(void);
void RecordedBattle_SetBankAction(u8 bank, u8 action);
@ -15,5 +16,7 @@ u8 MoveRecordedBattleToSaveData(void);
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

@ -54,7 +54,7 @@ SECTIONS {
asm/link.o(.text);
src/rtc.o(.text);
asm/main_menu.o(.text);
asm/rom3.o(.text);
src/battle_controllers.o(.text);
src/decompress.o(.text);
asm/battle_1.o(.text);
src/battle_2.o(.text);
@ -263,6 +263,7 @@ SECTIONS {
asm/unk_sprite_file.o(.text);
asm/unk_transition.o(.text);
asm/unk_transition_2.o(.text);
src/international_string_util.o(.text);
asm/international_string_util.o(.text);
} =0

View File

@ -204,9 +204,6 @@ extern const u8 BattleScript_ActionSwitch[];
extern const u8 BattleScript_PrintFailedToRunString[];
// functions
extern void HandleLinkBattleSetup(void); // rom_3
extern void SetUpBattleVarsAndBirchZigzagoon(void); // rom_3
extern void sub_8032768(void); // rom_3
extern void dp12_8087EA4(void);
extern void sub_80356D0(void);
extern void GetFrontierTrainerName(u8* dst, u16 trainerId); // battle tower
@ -4083,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;
}
@ -4111,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;

1551
src/battle_controllers.c Normal file

File diff suppressed because it is too large Load Diff

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;
}

View File

@ -5,12 +5,12 @@
#include "text_window.h"
#include "string_util.h"
#include "menu.h"
#include "international_string_util.h"
#define MAX_COINS 9999
EWRAM_DATA u8 sCoinsWindowId = 0;
extern s32 GetStringRightAlignXOffset(u8 fontId, u8 *str, s32 totalWidth);
extern void sub_819746C(u8 windowId, bool8 copyToVram);
extern const u8 gText_Coins[];

View File

@ -0,0 +1,57 @@
#include "global.h"
#include "international_string_util.h"
#include "text.h"
extern s32 convert_pixel_width_to_tile_width(s32 a0); // script menu
s32 GetStringCenterAlignXOffset(s32 fontId, const u8 *str, s32 totalWidth)
{
return GetStringCenterAlignXOffsetWithLetterSpacing(fontId, str, totalWidth, 0);
}
s32 GetStringRightAlignXOffset(s32 fontId, const u8 *str, s32 totalWidth)
{
return GetStringWidthDifference(fontId, str, totalWidth, 0);
}
s32 GetStringCenterAlignXOffsetWithLetterSpacing(s32 fontId, const u8 *str, s32 totalWidth, s32 letterSpacing)
{
return GetStringWidthDifference(fontId, str, totalWidth, letterSpacing) / 2;
}
s32 GetStringWidthDifference(s32 fontId, const u8 *str, s32 totalWidth, s32 letterSpacing)
{
s32 stringWidth = GetStringWidth(fontId, str, letterSpacing);
if (totalWidth > stringWidth)
return totalWidth - stringWidth;
else
return 0;
}
s32 GetMaxWidthInMenuTable(const u8 **str, s32 arg1)
{
s32 i, var;
for (var = 0, i = 0; i < arg1; i++)
{
s32 stringWidth = GetStringWidth(1, str[i * 2], 0);
if (stringWidth > var)
var = stringWidth;
}
return convert_pixel_width_to_tile_width(var);
}
s32 sub_81DB3D8(const u8 **str, u8* arg1, s32 arg2)
{
s32 i, var;
for (var = 0, i = 0; i < arg2; i++)
{
s32 stringWidth = GetStringWidth(1, str[arg1[i] * 2], 0);
if (stringWidth > var)
var = stringWidth;
}
return convert_pixel_width_to_tile_width(var);
}

View File

@ -196,7 +196,7 @@ gUnknown_02022D0A: @ 2022D0A
gUnknown_02022D0C: @ 2022D0C
.space 0x4
gUnknown_02022D10: @ 2022D10
gBattleBuffersTransferData: @ 2022D10
.space 0x100
gUnknown_02022E10: @ 2022E10
@ -282,7 +282,7 @@ gNoOfAllBanks: @ 202406C
gBattlePartyID: @ 202406E
.space 0x8
gBanksBySide: @ 2024076
gBanksByIdentity: @ 2024076
.space 0x4
gActionsByTurnOrder: @ 202407A
@ -471,10 +471,10 @@ gBattleScripting: @ 2024474
gBattleStruct: @ 202449C
.space 0x4
gUnknown_020244A0: @ 20244A0
gLinkBattleSendBuffer: @ 20244A0
.space 0x4
gUnknown_020244A4: @ 20244A4
gLinkBattleRecvBuffer: @ 20244A4
.space 0x4
gBattleResources: @ 20244A8