From a9212eeb664efcdfb74a2f4bbc5e94f37e27e748 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 27 Feb 2018 18:13:28 +0100 Subject: [PATCH] battle file more done and clean up tv --- asm/battle_link_817C95C.s | 1433 ------------------------------ asm/field_specials.s | 4 +- include/battle.h | 95 +- include/battle_script_commands.h | 8 +- include/tv.h | 43 +- src/battle_controllers.c | 4 +- src/battle_link_817C95C.c | 461 +++++++--- src/pokemon.c | 20 +- src/scrcmd.c | 2 +- src/tv.c | 456 +++++----- 10 files changed, 719 insertions(+), 1807 deletions(-) diff --git a/asm/battle_link_817C95C.s b/asm/battle_link_817C95C.s index 7db185572..91406075d 100644 --- a/asm/battle_link_817C95C.s +++ b/asm/battle_link_817C95C.s @@ -5,1439 +5,6 @@ .text - - thumb_func_start sub_817E684 -sub_817E684: @ 817E684 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - lsls r1, 16 - lsrs r6, r1, 16 - lsls r2, 24 - lsrs r5, r2, 24 - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - ldr r0, =gBattleStruct - ldr r0, [r0] - movs r1, 0xD2 - lsls r1, 1 - adds r1, r0 - mov r8, r1 - movs r2, 0x81 - lsls r2, 2 - adds r7, r0, r2 - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattlerTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - lsrs r3, r0, 24 - mov r0, r10 - cmp r0, 0x1B - bls _0817E6D4 - b _0817EA6C -_0817E6D4: - lsls r0, 2 - ldr r1, =_0817E6F0 - adds r1, r0, r1 - ldr r1, [r1] - mov r12, r0 - mov pc, r1 - .pool - .align 2, 0 -_0817E6F0: - .4byte _0817E760 - .4byte _0817E760 - .4byte _0817E85C - .4byte _0817E79C - .4byte _0817E79C - .4byte _0817E79C - .4byte _0817E79C - .4byte _0817E79C - .4byte _0817E8A0 - .4byte _0817E8A0 - .4byte _0817E8CC - .4byte _0817E8F0 - .4byte _0817E978 - .4byte _0817E9E0 - .4byte _0817EA28 - .4byte _0817E8A0 - .4byte _0817E8A0 - .4byte _0817E880 - .4byte _0817E760 - .4byte _0817E80A - .4byte _0817E848 - .4byte _0817E8A0 - .4byte _0817E760 - .4byte _0817E760 - .4byte _0817E760 - .4byte _0817E760 - .4byte _0817E760 - .4byte _0817E760 -_0817E760: - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - lsls r1, 2 - adds r1, r6 - lsls r1, 1 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 4 - adds r1, r0 - add r1, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r2, [r0] - lsls r0, r5, 1 - adds r0, r2 - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - b _0817EA6A - .pool -_0817E79C: - ldr r1, =gUnknown_0860A834 - add r1, r12 - ldr r7, =gBattlerPartyIndexes - lsls r0, r4, 1 - adds r0, r4 - lsls r2, r0, 4 - ldr r4, =0x0000ffff - ldr r1, [r1] - ldr r3, =gBattlerAttacker - ldrh r0, [r1] - cmp r6, r0 - bne _0817E7E0 - ldrb r0, [r3] - lsls r0, 1 - adds r0, r7 - ldrh r0, [r0] - lsls r0, 2 - adds r0, r5 - lsls r0, 1 - adds r0, r2 - add r0, r8 - ldrh r1, [r1, 0x2] - ldrh r2, [r0] - adds r1, r2 - strh r1, [r0] - b _0817EA6C - .pool -_0817E7E0: - adds r1, 0x4 - ldrh r0, [r1] - cmp r0, r4 - bne _0817E7EA - b _0817EA6C -_0817E7EA: - cmp r6, r0 - bne _0817E7E0 - ldrb r0, [r3] - lsls r0, 1 - adds r0, r7 - ldrh r0, [r0] - lsls r0, 2 - adds r0, r5 - lsls r0, 1 - adds r0, r2 - add r0, r8 - ldrh r1, [r1, 0x2] - ldrh r5, [r0] - adds r1, r5 - strh r1, [r0] - b _0817EA6C -_0817E80A: - movs r0, 0x1 - adds r1, r5, 0 - eors r1, r0 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r7, r0 - adds r0, 0x57 - ldrb r2, [r0] - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - strb r1, [r0] - mov r0, r9 - lsls r1, r0, 1 - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 4 - adds r1, r0 - add r1, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r2, [r0] - lsls r0, r6, 1 - adds r0, r2 - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - b _0817EA6A - .pool -_0817E848: - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 2 - adds r0, r7, r0 - adds r0, 0x57 - ldrb r2, [r0] - movs r1, 0x1F - negs r1, r1 - ands r1, r2 - strb r1, [r0] -_0817E85C: - mov r0, r9 - lsls r1, r0, 1 - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 4 - adds r1, r0 - add r1, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r2, [r0] - lsls r0, r6, 1 - adds r0, r2 - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - b _0817EA6A - .pool -_0817E880: - lsls r1, r5, 2 - add r1, r9 - lsls r1, 1 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 4 - adds r1, r0 - add r1, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r2, [r0] - lsls r0, r6, 1 - adds r0, r2 - b _0817EA64 - .pool -_0817E8A0: - lsls r2, r5, 2 - add r2, r9 - lsls r2, 1 - movs r1, 0x1 - eors r1, r4 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 4 - adds r2, r0 - add r2, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r1, [r0] - lsls r0, r6, 1 - adds r0, r1 - ldrh r0, [r0] - ldrh r1, [r2] - adds r0, r1 - strh r0, [r2] - b _0817EA6C - .pool -_0817E8CC: - lsls r1, r5, 2 - add r1, r9 - lsls r1, 1 - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 4 - adds r1, r0 - add r1, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r0, [r0] - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - b _0817EA6A - .pool -_0817E8F0: - lsls r0, r3, 4 - adds r2, r7, r0 - adds r0, r2, 0 - adds r0, 0x34 - ldrb r0, [r0] - lsls r0, 29 - lsrs r1, r0, 29 - adds r4, r2, 0 - adds r4, 0x3C - ldrb r0, [r4] - lsls r0, 29 - lsrs r0, 29 - cmn r1, r0 - bne _0817E90E - b _0817EA6C -_0817E90E: - cmp r6, 0xA - beq _0817E914 - b _0817EA6C -_0817E914: - cmp r1, 0 - beq _0817E940 - subs r1, 0x1 - lsls r1, 2 - adds r0, r2, 0 - adds r0, 0x33 - ldrb r0, [r0] - lsrs r0, 6 - adds r1, r0 - lsls r1, 1 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 4 - adds r1, r0 - add r1, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r0, [r0] - ldrh r0, [r0] - ldrh r5, [r1] - adds r0, r5 - strh r0, [r1] -_0817E940: - ldrb r0, [r4] - lsls r0, 29 - lsrs r0, 29 - cmp r0, 0 - bne _0817E94C - b _0817EA6C -_0817E94C: - subs r1, r0, 0x1 - lsls r1, 2 - adds r0, r2, 0 - adds r0, 0x3B - ldrb r0, [r0] - lsrs r0, 6 - adds r1, r0 - lsls r1, 1 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 4 - adds r1, r0 - add r1, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r0, [r0] - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - b _0817EA6A - .pool -_0817E978: - lsls r1, r3, 4 - adds r1, r7, r1 - adds r0, r1, 0 - adds r0, 0x34 - ldrb r4, [r0] - lsls r0, r4, 26 - lsrs r2, r0, 29 - adds r5, r1, 0 - adds r5, 0x3C - ldrb r0, [r5] - lsls r0, 26 - lsrs r0, 29 - cmn r2, r0 - beq _0817EA6C - cmp r6, 0xD - bne _0817EA6C - cmp r2, 0 - beq _0817E9BE - subs r1, r2, 0x1 - lsls r1, 2 - lsrs r0, r4, 6 - adds r1, r0 - lsls r1, 1 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 4 - adds r1, r0 - add r1, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r0, [r0] - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - strh r0, [r1] -_0817E9BE: - ldrb r2, [r5] - lsls r0, r2, 26 - lsrs r0, 29 - cmp r0, 0 - beq _0817EA6C - subs r1, r0, 0x1 - lsls r1, 2 - lsrs r0, r2, 6 - adds r1, r0 - lsls r1, 1 - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 4 - b _0817EA5A - .pool -_0817E9E0: - cmp r6, 0x8 - bhi _0817EA6C - cmp r5, 0 - beq _0817EA6C - lsls r0, r3, 1 - adds r3, r0, r3 - lsls r0, r3, 2 - adds r2, r7, r0 - adds r0, r2, 0 - adds r0, 0x50 - ldrb r0, [r0] - lsls r0, 26 - lsrs r0, 29 - cmp r0, 0 - beq _0817EA6C - subs r1, r0, 0x1 - lsls r1, 2 - adds r0, r2, 0 - adds r0, 0x54 - ldrb r0, [r0] - lsls r0, 28 - lsrs r0, 30 - adds r1, r0 - lsls r1, 1 - lsls r0, r3, 4 - adds r1, r0 - add r1, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r0, [r0] - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - b _0817EA6A - .pool -_0817EA28: - cmp r6, 0x8 - bls _0817EA6C - cmp r5, 0 - beq _0817EA6C - lsls r0, r3, 1 - adds r3, r0, r3 - lsls r0, r3, 2 - adds r2, r7, r0 - adds r0, r2, 0 - adds r0, 0x50 - ldrh r0, [r0] - lsls r0, 23 - lsrs r0, 29 - cmp r0, 0 - beq _0817EA6C - subs r1, r0, 0x1 - lsls r1, 2 - adds r0, r2, 0 - adds r0, 0x54 - ldrb r0, [r0] - lsls r0, 26 - lsrs r0, 30 - adds r1, r0 - lsls r1, 1 - lsls r0, r3, 4 -_0817EA5A: - adds r1, r0 - add r1, r8 - ldr r0, =gUnknown_0860A834 - add r0, r12 - ldr r0, [r0] -_0817EA64: - ldrh r0, [r0] - ldrh r5, [r1] - adds r0, r5 -_0817EA6A: - strh r0, [r1] -_0817EA6C: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817E684 - - thumb_func_start sub_817EA80 -sub_817EA80: @ 817EA80 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gBattleStruct - ldr r0, [r0] - movs r1, 0x81 - lsls r1, 2 - adds r5, r0, r1 - ldr r3, =gBattlerAttacker - mov r8, r3 - ldrb r0, [r3] - bl GetBattlerSide - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gBattlerTarget - ldrb r0, [r0] - bl GetBattlerSide - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r6, r5, r0 - adds r0, r6, 0 - adds r0, 0x57 - ldrb r0, [r0] - lsrs r3, r0, 5 - lsls r0, 27 - lsrs r0, 28 - cmp r0, 0 - bne _0817EAC8 - b _0817EE50 -_0817EAC8: - subs r0, 0x1 - cmp r0, 0xE - bls _0817EAD0 - b _0817EEBC -_0817EAD0: - lsls r0, 2 - ldr r1, =_0817EAEC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0817EAEC: - .4byte _0817EB28 - .4byte _0817EB54 - .4byte _0817EB80 - .4byte _0817EBD4 - .4byte _0817EBFE - .4byte _0817EC26 - .4byte _0817EC4E - .4byte _0817EC6C - .4byte _0817EC9A - .4byte _0817ECCC - .4byte _0817ED54 - .4byte _0817ED82 - .4byte _0817EDC2 - .4byte _0817EE1C - .4byte _0817EEBC -_0817EB28: - lsls r0, r3, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r3, r5, r0 - adds r0, r3, 0 - adds r0, 0x30 - ldrb r0, [r0] - lsls r0, 29 - lsrs r1, r0, 29 - cmp r1, 0 - bne _0817EB40 - b _0817EEBC -_0817EB40: - movs r0, 0x1 - adds r2, r4, 0 - eors r2, r0 - subs r1, 0x1 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x32 - ldrb r3, [r0] - lsls r3, 28 - b _0817EE84 -_0817EB54: - lsls r0, r3, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r3, r5, r0 - adds r0, r3, 0 - adds r0, 0x30 - ldrb r0, [r0] - lsls r0, 26 - lsrs r1, r0, 29 - cmp r1, 0 - bne _0817EB6C - b _0817EEBC -_0817EB6C: - movs r0, 0x1 - adds r2, r4, 0 - eors r2, r0 - subs r1, 0x1 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x32 - ldrb r3, [r0] - lsls r3, 26 - b _0817EE84 -_0817EB80: - lsls r0, r3, 2 - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 3 - adds r0, r1 - adds r5, r0 - ldrb r0, [r5] - lsls r0, 29 - lsrs r1, r0, 29 - cmp r1, 0 - beq _0817EBB4 - movs r0, 0x1 - adds r2, r4, 0 - eors r2, r0 - subs r0, r1, 0x1 - lsls r0, 2 - ldrb r3, [r5, 0x2] - lsls r3, 28 - lsrs r3, 30 - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x13 - movs r1, 0 - bl sub_817E684 -_0817EBB4: - ldrb r0, [r5] - lsls r0, 26 - lsrs r1, r0, 29 - cmp r1, 0 - bne _0817EBC0 - b _0817EEBC -_0817EBC0: - movs r0, 0x1 - adds r2, r4, 0 - eors r2, r0 - subs r0, r1, 0x1 - lsls r0, 2 - ldrb r3, [r5, 0x2] - lsls r3, 26 - lsrs r3, 30 - adds r3, r0 - b _0817EE88 -_0817EBD4: - lsls r0, r3, 2 - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 3 - adds r0, r1 - adds r1, r5, r0 - ldrh r0, [r1] - lsls r0, 23 - lsrs r3, r0, 29 - cmp r3, 0 - bne _0817EBEC - b _0817EEBC -_0817EBEC: - movs r0, 0x1 - adds r2, r4, 0 - eors r2, r0 - subs r0, r3, 0x1 - lsls r0, 2 - ldrb r3, [r1, 0x2] - lsrs r3, 6 - adds r3, r0 - b _0817EE88 -_0817EBFE: - lsls r0, r3, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r3, r5, r0 - ldrh r0, [r3, 0x30] - lsls r0, 23 - lsrs r1, r0, 29 - cmp r1, 0 - bne _0817EC12 - b _0817EEBC -_0817EC12: - movs r0, 0x1 - adds r2, r4, 0 - eors r2, r0 - subs r1, 0x1 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x32 - ldrb r3, [r0] - lsrs r3, 6 - b _0817EE86 -_0817EC26: - lsls r0, r3, 3 - lsls r1, r4, 4 - adds r0, r1 - adds r3, r5, r0 - adds r0, r3, 0 - adds r0, 0x31 - ldrb r0, [r0] - lsls r0, 28 - lsrs r1, r0, 29 - cmp r1, 0 - bne _0817EC3E - b _0817EEBC -_0817EC3E: - movs r0, 0x1 - adds r2, r4, 0 - eors r2, r0 - subs r1, 0x1 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x33 - b _0817EE80 -_0817EC4E: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r3, r5, r0 - adds r0, r3, 0 - adds r0, 0x50 - ldrb r0, [r0] - lsls r0, 29 - lsrs r1, r0, 29 - cmp r1, 0 - bne _0817EC66 - b _0817EEBC -_0817EC66: - movs r0, 0x1 - adds r2, r4, 0 - b _0817EE76 -_0817EC6C: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r3, r5, r0 - ldr r0, [r3, 0x50] - lsls r0, 14 - lsrs r0, 29 - cmp r0, 0 - bne _0817EC80 - b _0817EEBC -_0817EC80: - adds r2, r4, 0 - subs r1, r0, 0x1 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x55 - ldrb r3, [r0] - lsls r3, 28 - lsrs r3, 30 - adds r3, r1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x14 - b _0817EE8E -_0817EC9A: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r3, r5, r0 - adds r0, r3, 0 - adds r0, 0x52 - ldrb r0, [r0] - lsls r0, 27 - lsrs r0, 29 - cmp r0, 0 - bne _0817ECB2 - b _0817EEBC -_0817ECB2: - adds r2, r4, 0 - subs r1, r0, 0x1 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x55 - ldrb r3, [r0] - lsls r3, 26 - lsrs r3, 30 - adds r3, r1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x14 - b _0817EE8E -_0817ECCC: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r3, r5, r0 - adds r0, r3, 0 - adds r0, 0x58 - ldrb r0, [r0] - lsls r0, 25 - cmp r0, 0 - bge _0817ED14 - adds r0, r3, 0 - adds r0, 0x52 - ldrb r0, [r0] - lsrs r0, 5 - subs r6, r0, 0x1 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - cmp r6, r0 - beq _0817ED14 - adds r2, r4, 0 - lsls r1, r6, 2 - adds r0, r3, 0 - adds r0, 0x55 - ldrb r3, [r0] - lsrs r3, 6 - adds r3, r1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x13 - movs r1, 0 - bl sub_817E684 -_0817ED14: - movs r1, 0x1 - eors r1, r4 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r1, r5, r0 - adds r0, r1, 0 - adds r0, 0x58 - ldrb r0, [r0] - lsls r0, 25 - cmp r0, 0 - blt _0817ED2E - b _0817EEBC -_0817ED2E: - movs r0, 0x1 - adds r2, r4, 0 - eors r2, r0 - adds r0, r1, 0 - adds r0, 0x52 - ldrb r0, [r0] - lsrs r0, 5 - subs r0, 0x1 - lsls r0, 2 - adds r1, 0x55 - ldrb r3, [r1] - lsrs r3, 6 - adds r3, r0 - b _0817EE88 - .pool -_0817ED54: - movs r0, 0x1 - eors r0, r4 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r5, r1 - adds r1, 0x56 - ldrb r0, [r1] - lsls r0, 25 - lsrs r5, r0, 29 - cmp r5, 0 - bne _0817ED6E - b _0817EEBC -_0817ED6E: - movs r0, 0x1 - adds r2, r4, 0 - eors r2, r0 - subs r0, r5, 0x1 - lsls r0, 2 - ldrh r3, [r1] - lsls r3, 23 - lsrs r3, 30 - adds r3, r0 - b _0817EE88 -_0817ED82: - lsls r2, r4, 4 - movs r1, 0x1 - adds r0, r4, 0 - eors r0, r1 - lsls r6, r0, 24 - adds r0, r5, 0 - adds r0, 0x30 - adds r4, r2, r0 - movs r5, 0x1 -_0817ED94: - ldr r0, [r4] - lsls r0, 14 - lsrs r0, 29 - cmp r0, 0 - beq _0817EDB8 - subs r0, 0x1 - lsls r0, 2 - ldrb r3, [r4, 0x3] - lsls r3, 26 - lsrs r3, 30 - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x13 - movs r1, 0 - lsrs r2, r6, 24 - bl sub_817E684 -_0817EDB8: - adds r4, 0x8 - subs r5, 0x1 - cmp r5, 0 - bge _0817ED94 - b _0817EEBC -_0817EDC2: - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r5, r0 - adds r0, 0x58 - ldrb r3, [r0] - lsls r0, r3, 31 - cmp r0, 0 - beq _0817EDF0 - adds r2, r4, 0 - lsls r0, r3, 26 - lsrs r0, 29 - subs r0, 0x1 - lsls r0, 2 - lsls r3, 29 - lsrs r3, 30 - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x13 - movs r1, 0 - bl sub_817E684 -_0817EDF0: - movs r0, 0x1 - eors r0, r4 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r5, r1 - adds r1, 0x58 - ldrb r1, [r1] - lsls r0, r1, 31 - cmp r0, 0 - beq _0817EEBC - movs r0, 0x1 - adds r2, r4, 0 - eors r2, r0 - lsls r0, r1, 26 - lsrs r0, 29 - subs r0, 0x1 - lsls r0, 2 - lsls r3, r1, 29 - lsrs r3, 30 - adds r3, r0 - b _0817EE88 -_0817EE1C: - cmp r7, 0x1 - bne _0817EEBC - adds r2, r4, 0 - ldr r1, =gBattlerPartyIndexes - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - lsls r1, 2 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r0, r5, r0 - adds r0, 0x53 - ldrb r3, [r0] - lsrs r3, 6 - adds r3, r1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x14 - b _0817EE8E - .pool -_0817EE50: - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, r5, r0 - adds r0, r3, 0 - adds r0, 0x57 - ldrb r0, [r0] - lsls r0, 27 - lsrs r0, 28 - cmp r0, 0x7 - bne _0817EE96 - adds r0, r3, 0 - adds r0, 0x50 - ldrb r0, [r0] - lsls r0, 29 - lsrs r1, r0, 29 - cmp r1, 0 - beq _0817EEBC - movs r0, 0x1 -_0817EE76: - eors r2, r0 - subs r1, 0x1 - lsls r1, 2 - adds r0, r3, 0 - adds r0, 0x54 -_0817EE80: - ldrb r3, [r0] - lsls r3, 30 -_0817EE84: - lsrs r3, 30 -_0817EE86: - adds r3, r1 -_0817EE88: - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x13 -_0817EE8E: - movs r1, 0 - bl sub_817E684 - b _0817EEBC -_0817EE96: - adds r2, r4, 0 - ldr r1, =gBattlerPartyIndexes - mov r3, r8 - ldrb r0, [r3] - lsls r0, 1 - adds r0, r1 - ldrh r1, [r0] - lsls r1, 2 - adds r0, r6, 0 - adds r0, 0x53 - ldrb r3, [r0] - lsrs r3, 6 - adds r3, r1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x14 - movs r1, 0 - bl sub_817E684 -_0817EEBC: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817EA80 - - thumb_func_start sub_817EECC -sub_817EECC: @ 817EECC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x28 - ldr r7, =gBattleTypeFlags - ldr r0, [r7] - ldr r1, =0x02000003 - ands r0, r1 - cmp r0, 0 - beq _0817EEE6 - b _0817F1FA -_0817EEE6: - ldr r4, =gBattlerAttacker - ldrb r0, [r4] - bl GetBattlerSide - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0817EEF8 - b _0817F1FA -_0817EEF8: - ldr r5, =gBattleMons - ldrb r4, [r4] - movs r1, 0x58 - adds r6, r4, 0 - muls r6, r1 - adds r0, r6, r5 - ldrb r0, [r0, 0x1E] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x5 - bgt _0817EF10 - b _0817F1FA -_0817EF10: - ldr r0, =gBattlerTarget - ldrb r0, [r0] - muls r0, r1 - adds r0, r5 - ldrb r0, [r0, 0x1F] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x6 - ble _0817EF24 - b _0817F1FA -_0817EF24: - ldr r0, =gCurrentMove - ldrh r1, [r0] - cmp r1, 0xED - bne _0817EF2E - b _0817F1FA -_0817EF2E: - ldr r0, =0x00000137 - cmp r1, r0 - bne _0817EF36 - b _0817F1FA -_0817EF36: - ldr r0, [r7] - movs r1, 0xC8 - lsls r1, 14 - ands r0, r1 - cmp r0, 0 - beq _0817EF44 - b _0817F1FA -_0817EF44: - ldr r3, =gBattleMoves - ldr r2, =gMoveSelectionCursor - adds r0, r4, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r0, r6 - adds r1, r5, 0 - adds r1, 0xC - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x1] - adds r6, r2, 0 - cmp r0, 0 - bne _0817EF6A - b _0817F1FA -_0817EF6A: - movs r5, 0 - str r1, [sp, 0x24] - ldr r1, =gUnknown_0860A4AC - ldr r4, =0x0000ffff - adds r3, r1, 0 - adds r2, r1, 0 -_0817EF76: - ldr r0, [sp, 0x24] - ldrh r7, [r2] - cmp r0, r7 - beq _0817EF8A - adds r3, 0x2 - adds r2, 0x2 - adds r5, 0x1 - ldrh r0, [r3] - cmp r0, r4 - bne _0817EF76 -_0817EF8A: - lsls r0, r5, 1 - adds r0, r1 - ldrh r1, [r0] - ldr r0, =0x0000ffff - cmp r1, r0 - beq _0817EF98 - b _0817F1FA -_0817EF98: - ldr r2, =gBattlerAttacker - ldrb r0, [r2] - adds r0, r6 - ldrb r0, [r0] - lsls r0, 2 - mov r1, sp - adds r1, r0 - adds r1, 0x10 - ldr r0, =gBattleMoveDamage - ldr r0, [r0] - str r0, [r1] - ldr r0, =gCurrentMove - ldrh r1, [r0] - str r1, [sp, 0x24] - movs r5, 0 - add r3, sp, 0x20 - mov r10, r3 - mov r8, r0 - add r7, sp, 0x10 - ldr r4, =gBattlerTarget - mov r9, r4 -_0817EFC2: - lsls r1, r5, 1 - ldr r6, =gBattlerAttacker - ldrb r0, [r6] - movs r2, 0x58 - muls r0, r2 - adds r1, r0 - ldr r0, =gBattleMons - adds r0, 0xC - adds r1, r0 - ldrh r0, [r1] - mov r3, r8 - strh r0, [r3] - movs r6, 0 - mov r4, r10 - strh r6, [r4] - ldrh r0, [r3] - adds r1, r7, 0 - mov r2, r10 - bl sub_817F21C - lsls r0, 24 - cmp r0, 0 - beq _0817F0B4 - ldr r4, =gSideStatuses - mov r1, r9 - ldrb r0, [r1] - bl GetBattlerPosition - movs r1, 0x1 - ands r1, r0 - lsls r1, 1 - adds r1, r4 - ldrh r3, [r1] - ldr r2, =gBattlerAttacker - ldrb r0, [r2] - movs r4, 0x58 - muls r0, r4 - ldr r6, =gBattleMons - adds r0, r6 - mov r2, r9 - ldrb r1, [r2] - muls r1, r4 - adds r1, r6 - mov r4, r8 - ldrh r2, [r4] - mov r6, r10 - ldrh r4, [r6] - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r6, =gBattlerAttacker - ldrb r4, [r6] - str r4, [sp, 0x8] - mov r6, r9 - ldrb r4, [r6] - str r4, [sp, 0xC] - bl CalculateBaseDamage - adds r3, r0, 0 - ldr r4, =gBattleMoveDamage - str r3, [r4] - ldr r1, =gStatuses3 - ldr r2, =gBattlerAttacker - ldrb r0, [r2] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 2 - ands r0, r1 - cmp r0, 0 - beq _0817F06A - ldr r2, =gBattleMoves - mov r6, r8 - ldrh r1, [r6] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x2] - cmp r0, 0xD - bne _0817F06A - lsls r0, r3, 1 - str r0, [r4] -_0817F06A: - ldr r0, =gProtectStructs - ldr r6, =gBattlerAttacker - ldrb r1, [r6] - lsls r1, 4 - adds r1, r0 - ldrb r0, [r1] - lsls r0, 28 - cmp r0, 0 - bge _0817F08C - ldr r4, =gBattleMoveDamage - ldr r1, [r4] - lsls r0, r1, 4 - subs r0, r1 - movs r1, 0xA - bl __divsi3 - str r0, [r4] -_0817F08C: - mov r1, r8 - ldrh r0, [r1] - ldrb r1, [r6] - mov r3, r9 - ldrb r2, [r3] - bl TypeCalc - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gBattleMoveDamage - ldr r0, [r0] - str r0, [r7] - cmp r0, 0 - bne _0817F0B4 - movs r0, 0x29 - ands r0, r1 - cmp r0, 0 - bne _0817F0B4 - movs r0, 0x1 - str r0, [r7] -_0817F0B4: - adds r7, 0x4 - adds r5, 0x1 - cmp r5, 0x3 - ble _0817EFC2 - movs r5, 0 - ldr r3, =gBattlerAttacker - ldr r6, =gMoveSelectionCursor - ldr r4, =gBattlerPartyIndexes - mov r8, r4 - movs r7, 0x64 - mov r9, r7 - mov r10, r6 -_0817F0CC: - ldrb r0, [r3] - adds r0, r6 - ldrb r2, [r0] - cmp r5, r2 - bne _0817F0D8 - b _0817F1D4 -_0817F0D8: - lsls r0, r5, 2 - mov r1, sp - adds r1, r0 - adds r1, 0x10 - lsls r0, r2, 2 - add r0, sp - adds r0, 0x10 - ldr r1, [r1] - ldr r0, [r0] - cmp r1, r0 - ble _0817F1D4 - movs r7, 0x1 - cmp r2, 0 - beq _0817F0F6 - movs r7, 0 -_0817F0F6: - movs r5, 0 - ldr r4, =gBattlerTarget - ldr r6, =gEnemyParty - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - add r0, r10 - ldrb r3, [r0] - add r2, sp, 0x10 -_0817F106: - cmp r5, r3 - beq _0817F11A - lsls r0, r7, 2 - add r0, sp - adds r0, 0x10 - ldr r1, [r2] - ldr r0, [r0] - cmp r1, r0 - ble _0817F11A - adds r7, r5, 0 -_0817F11A: - adds r2, 0x4 - adds r5, 0x1 - cmp r5, 0x3 - ble _0817F106 - ldrb r0, [r4] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - mov r1, r9 - muls r1, r0 - adds r0, r1, 0 - adds r0, r6 - movs r1, 0xB - movs r2, 0 - bl GetMonData - adds r6, r0, 0 - lsls r6, 16 - lsrs r6, 16 - ldr r2, =gBattlerAttacker - ldrb r0, [r2] - lsls r0, 1 - add r0, r8 - ldrh r0, [r0] - mov r3, r9 - muls r3, r0 - adds r0, r3, 0 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - movs r2, 0 - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldr r4, =gBattlerAttacker - ldrb r3, [r4] - mov r2, r10 - adds r0, r3, r2 - ldrb r2, [r0] - movs r0, 0x58 - adds r4, r3, 0 - muls r4, r0 - ldr r5, =gBattleMons + 0xC - adds r3, r4, r5 - lsls r0, r7, 1 - adds r0, r4 - adds r0, r5 - ldrh r0, [r0] - str r0, [sp] - adds r0, r6, 0 - bl sub_80EE35C - b _0817F1DC - .pool -_0817F1D4: - adds r5, 0x1 - cmp r5, 0x3 - bgt _0817F1DC - b _0817F0CC -_0817F1DC: - ldr r2, =gBattleMoveDamage - ldr r1, =gMoveSelectionCursor - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - adds r0, r1 - ldrb r0, [r0] - lsls r0, 2 - add r0, sp - adds r0, 0x10 - ldr r0, [r0] - str r0, [r2] - ldr r0, =gCurrentMove - mov r3, sp - ldrh r3, [r3, 0x24] - strh r3, [r0] -_0817F1FA: - add sp, 0x28 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817EECC - thumb_func_start sub_817F21C sub_817F21C: @ 817F21C push {r4-r7,lr} diff --git a/asm/field_specials.s b/asm/field_specials.s index 29c6dc800..6200123ac 100644 --- a/asm/field_specials.s +++ b/asm/field_specials.s @@ -3388,7 +3388,7 @@ _0813980C: _0813981C: ldrh r5, [r2] adds r0, r5, 0 - bl sub_80EF370 + bl CountDigits adds r3, r0, 0 lsls r3, 24 lsrs r3, 24 @@ -3408,7 +3408,7 @@ _0813983C: adds r4, 0x4 ldrh r5, [r2] adds r0, r5, 0 - bl sub_80EF370 + bl CountDigits adds r3, r0, 0 lsls r3, 24 lsrs r3, 24 diff --git a/include/battle.h b/include/battle.h index 71e8f336d..8c819f047 100644 --- a/include/battle.h +++ b/include/battle.h @@ -368,6 +368,94 @@ struct BattleResults u8 catchAttempts[11]; // 0x36 }; +struct BattleLinkStringSide +{ + u32 spikesMonId:3; + u32 reflectMonId:3; + u32 lightScreenMonId:3; + u32 safeguardMonId:3; + u32 mistMonId:3; + u32 futureSightMonId:3; + u32 doomDesireMonId:3; + u32 perishSongMonId:3; + u32 wishMonId:3; + u32 grudgeMonId:3; + u32 field_8_6:2; + u32 spikesMoveSlot:2; + u32 reflectMoveSlot:2; + u32 lightScreenMoveSlot:2; + u32 safeguardMoveSlot:2; + u32 mistMoveSlot:2; + u32 futureSightMoveSlot:2; + u32 doomDesireMoveSlot:2; + u32 perishSongMoveSlot:2; + u32 wishMoveSlot:2; + u32 grudgeMoveSlot:2; + u32 destinyBondMonId:3; + u32 destinyBondMoveSlot:2; + u32 field_3_0:4; + u32 field_3_1:3; + u32 explosion:1; + u32 explosionMoveSlot:2; + u32 explosionMonId:3; + u32 perishSong:1; + u32 field_4_2:1; + u32 field_5_0:3; + u32 field_5_1:2; +}; + +struct BattleLinkStringPosition +{ + u32 curseMonId:3; + u32 leechSeedMonId:3; + u32 nightmareMonId:3; + u32 wrapMonId:3; + u32 attractMonId:3; + u32 confusionMonId:3; + u32 curseMoveSlot:2; + u32 leechSeedMoveSlot:2; + u32 nightmareMoveSlot:2; + u32 wrapMoveSlot:2; + u32 attractMoveSlot:2; + u32 confusionMoveSlot:2; + u32 waterSportMoveSlot:2; + u32 waterSportMonId:3; + u32 mudSportMonId:3; + u32 mudSportMoveSlot:2; + u32 ingrainMonId:3; + u32 ingrainMoveSlot:2; + u32 field_5_5:3; + u32 field_6_0:2; +}; + +struct BattleLinkStringMon +{ + u32 psnMonId:3; + u32 badPsnMonId:3; + u32 brnMonId:3; + u32 prlzMonId:3; + u32 slpMonId:3; + u32 frzMonId:3; + u32 psnMoveSlot:2; + u32 badPsnMoveSlot:2; + u32 brnMoveSlot:2; + u32 prlzMoveSlot:2; + u32 slpMoveSlot:2; + u32 frzMoveSlot:2; +}; + +struct UnknownBattleLinkStruct +{ + struct BattleLinkStringMon mon[2][6]; // [side][partyId] + struct BattleLinkStringPosition pos[2][2]; // [side][flank] + struct BattleLinkStringSide side[2]; // [side] +}; + +struct UnknownBattleLinkArrayStruct +{ + s16 unk0[2][6*4]; +}; + struct BattleStruct { u8 turnEffectsTracker; @@ -472,9 +560,9 @@ struct BattleStruct u8 wishPerishSongBattlerId; bool8 overworldWeatherDone; u8 atkCancellerTracker; - s16 field_1A4[2][PARTY_SIZE * 4]; - u8 field_204[104]; - u8 field_26C[40]; + struct UnknownBattleLinkArrayStruct field_1A4; + struct UnknownBattleLinkStruct field_204; + u8 notSureWhatFieldLol[0x28]; u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT]; u8 field_298[8]; u8 field_2A0; @@ -493,6 +581,7 @@ struct BattleStruct #define IS_MOVE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY) #define IS_MOVE_SPECIAL(moveType)(moveType > TYPE_MYSTERY) + #define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8 #define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40 #define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index 6c84d1f0f..142ac1f7b 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -4,16 +4,16 @@ #define WINDOW_CLEAR 0x1 #define WINDOW_x80 0x80 -void AI_CalcDmg(u8 bankAtk, u8 bankDef); -u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef); +void AI_CalcDmg(u8 battlerIdAtk, u8 battlerIdDef); +u8 TypeCalc(u16 move, u8 battlerIdAtk, u8 battlerIdDef); u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility); -u8 GetBattlerTurnOrderNum(u8 bank); +u8 GetBattlerTurnOrderNum(u8 battlerId); void SetMoveEffect(bool8 primary, u8 certain); void BattleDestroyYesNoCursorAt(u8 cursorPosition); void BattleCreateYesNoCursorAt(u8 cursorPosition); void BufferMoveToLearnIntoBattleTextBuff2(void); void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); -bool8 UproarWakeUpCheck(u8 bank); +bool8 UproarWakeUpCheck(u8 battlerId); extern void (* const gBattleScriptingCommandsTable[])(void); extern const u8 gUnknown_0831C494[][4]; diff --git a/include/tv.h b/include/tv.h index 8235373ae..93854be56 100644 --- a/include/tv.h +++ b/include/tv.h @@ -3,19 +3,40 @@ extern u8 *const gTVStringVarPtrs[3]; -void ClearTVShowData(void); -void PutPokemonTodayCaughtOnAir(void); +void sub_80EE184(void); +void sub_80EE35C(u16 foeSpecies, u16 species, u8 moveIdx, const u16 *movePtr, u16 betterMove); +void sub_80EE8C8(u16 winStreak, u8 facility); +void DoTVShow(void); +void DoTVShowInSearchOfTrainers(void); +void sub_80EDCE8(void); +void sub_80EE2CC(void); +void sub_80EE72C(void); +void sub_80EED10(void); +void sub_80EED34(void); +void sub_80EED60(u16 delta); +void sub_80F01B8(void); +void sub_80F01E8(void *src, u32 size, u8 masterIdx); +void sub_80EE4DC(struct Pokemon *pokemon, u8 ribbonMonDataIdx); u32 GetPlayerIDAsU32(void); bool8 GetPriceReduction(u8 newsKind); -u8 GetRibbonCount(struct Pokemon *pokemon); -void TV_PutSecretBaseVisitOnTheAir(void); -void sub_80EE184(void); -void sub_80EEA70(void); void sub_80F14F8(TVShow *shows); -size_t sub_80EF370(int value); -bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language); -void SetPokemonAnglerSpecies(u16 species); -void UpdateTVShowsPerDay(u16 days); -void PutBattleUpdateOnTheAir(u8 a0, u16 a1, u16 a2, u16 a3); +size_t CountDigits(int value); +u8 GetRibbonCount(struct Pokemon *pokemon); +void sub_80EDE70(u16 nCoinsSpent); +void sub_80EDE84(u16 nCoinsSpent); +void sub_80EDD78(u16 nCoinsPaidOut); +void sub_80EEA70(void); +void sub_80EDB44(void); +void sub_80EDC60(const u16 *words); +void sub_80EDA80(void); +void sub_80F0C7C(void *src, u32 size, u8 masterIdx); +void sub_80F0BB8(void); +void sub_80ED950(bool8 flag); +void sub_80EEC80(void); +void sub_80EECA4(void); +void sub_80EECC8(void); +void sub_80EECEC(void); +void sub_80F1208(TVShow *shows); +void sub_80EE44C(u8 nMonsCaught, u8 nPkblkUsed); #endif //GUARD_TV_H diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 3c8b1563f..3d5ffeb3a 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -121,10 +121,10 @@ void sub_8032768(void) } for (i = 0; i < sizeof(gBattleStruct->field_1A4); i++) - *(gBattleStruct->field_1A4 + i) = 0; + *((u8*)(&gBattleStruct->field_1A4) + i) = 0; for (i = 0; i < sizeof(gBattleStruct->field_204); i++) - *(gBattleStruct->field_204 + i) = 0; + *((u8*)(&gBattleStruct->field_204) + i) = 0; } static void InitSinglePlayerBtlControllers(void) diff --git a/src/battle_link_817C95C.c b/src/battle_link_817C95C.c index c92a963eb..1a8a201aa 100644 --- a/src/battle_link_817C95C.c +++ b/src/battle_link_817C95C.c @@ -9,89 +9,6 @@ #include "battle_message.h" #include "tv.h" -struct BattleLinkStringSide -{ - u32 spikesMonId:3; - u32 reflectMoveId:3; - u32 lightScreenMonId:3; - u32 safeguardMonId:3; - u32 mistMonId:3; - u32 futureSightMonId:3; - u32 doomDesireMonId:3; - u32 perishSongMonId:3; - u32 wishMonId:3; - u32 grudgeMonId:3; - u32 field_8_6:2; - u32 spikesMoveSlot:2; - u32 reflectMoveSlot:2; - u32 lightScreenMoveSlot:2; - u32 safeguardMoveSlot:2; - u32 mistMoveSlot:2; - u32 futureSightMoveSlot:2; - u32 doomDesireMoveSlot:2; - u32 perishSongMoveSlot:2; - u32 wishMoveSlot:2; - u32 grudgeMoveSlot:2; - u32 destinyBondMonId:3; - u32 destinyBondMoveSlot:2; - u32 field_3_0:4; - u32 field_3_1:3; - u32 field_4_0_0:1; - u32 field_4_0:2; - u32 field_4_0_b:3; - u32 field_4_1:1; - u32 field_4_2:1; - u32 field_5_0:3; - u32 field_5_1:2; -}; - -struct BattleLinkStringPosition -{ - u32 curseMonId:3; - u32 leechSeedMonId:3; - u32 nightmareMonId:3; - u32 wrapMonId:3; - u32 attractMonId:3; - u32 confusionMonId:3; - u32 curseMoveSlot:2; - u32 leechSeedMoveSlot:2; - u32 nightmareMoveSlot:2; - u32 wrapMoveSlot:2; - u32 attractMoveSlot:2; - u32 confusionMoveSlot:2; - u32 waterSportMoveSlot:2; - u32 waterSportMonId:3; - u32 mudSportMonId:3; - u32 mudSportMoveSlot:2; - u32 ingrainMonId:3; - u32 ingrainMoveSlot:2; - u32 field_5_5:3; - u32 field_6_0:2; -}; - -struct BattleLinkStringMon -{ - u32 psnMonId:3; - u32 badPsnMonId:3; - u32 brnMonId:3; - u32 prlzMonId:3; - u32 slpMonId:3; - u32 frzMonId:3; - u32 psnMoveSlot:2; - u32 badPsnMoveSlot:2; - u32 brnMoveSlot:2; - u32 prlzMoveSlot:2; - u32 slpMoveSlot:2; - u32 frzMoveSlot:2; -}; - -struct UnknownBattleLinkStruct -{ - struct BattleLinkStringMon mon[2][6]; // [side][partyId] - struct BattleLinkStringPosition pos[2][2]; // [side][flank] - struct BattleLinkStringSide side[2]; // [side] -}; - extern struct StringInfoBattle *gStringInfo; extern const struct BattleMove gBattleMoves[]; @@ -102,9 +19,12 @@ void sub_817E684(u8 arg0, u16 arg1, u8 arg2, u8 arg3); void sub_817EECC(void); void sub_817EA80(u8 arg0); void sub_817F394(u16 weatherFlags, u16 moveId, u8 moveSlot); +bool8 sub_817F21C(u16 moveId, s32 *dmg, u16 *powerOverride); // const rom data +extern const u16 *const gUnknown_0860A834[]; extern const u16 gUnknown_0860A8A4[]; +extern const u16 gUnknown_0860A4AC[]; // code void sub_817C95C(u16 stringId) @@ -120,7 +40,7 @@ void sub_817C95C(u16 stringId) if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && stringId != STRINGID_ITDOESNTAFFECT && stringId != STRINGID_NOTVERYEFFECTIVE) return; - structPtr = (struct UnknownBattleLinkStruct*)(&gBattleStruct->field_204); + structPtr = &gBattleStruct->field_204; atkSide = GetBattlerSide(gBattlerAttacker); defSide = GetBattlerSide(gBattlerTarget); @@ -179,7 +99,7 @@ void sub_817C95C(u16 stringId) case STRINGID_FAINTINTHREE: structPtr->side[atkSide].perishSongMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; structPtr->side[atkSide].perishSongMoveSlot = moveSlot; - structPtr->side[atkSide].field_4_1 = 1; + structPtr->side[atkSide].perishSong = 1; break; case STRINGID_PKMNPERISHCOUNTFELL: if (*perishCount == 0) @@ -455,7 +375,7 @@ void sub_817C95C(u16 stringId) break; case STRINGID_PKMNRAISEDDEF: case STRINGID_PKMNRAISEDDEFALITTLE: - structPtr->side[atkSide].reflectMoveId = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->side[atkSide].reflectMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; structPtr->side[atkSide].reflectMoveSlot = moveSlot; break; case STRINGID_PKMNRAISEDSPDEF: @@ -466,7 +386,7 @@ void sub_817C95C(u16 stringId) case STRINGID_PKMNSXWOREOFF: if (*finishedMoveId == MOVE_REFLECT) { - structPtr->side[atkSide].reflectMoveId = 0; + structPtr->side[atkSide].reflectMonId = 0; structPtr->side[atkSide].reflectMoveSlot = 0; } if (*finishedMoveId == MOVE_LIGHT_SCREEN) @@ -501,7 +421,7 @@ void sub_817C95C(u16 stringId) sub_817E684(16, 0, structPtr->side[defSide].mistMonId - 1, structPtr->side[defSide].mistMoveSlot); break; case STRINGID_THEWALLSHATTERED: - structPtr->side[defSide].reflectMoveId = 0; + structPtr->side[defSide].reflectMonId = 0; structPtr->side[defSide].reflectMoveSlot = 0; structPtr->side[defSide].lightScreenMonId = 0; structPtr->side[defSide].lightScreenMoveSlot = 0; @@ -548,7 +468,7 @@ void sub_817E0FC(u16 move, u16 weatherFlags, struct DisableStruct *disableStruct if (!(gBattleTypeFlags & BATTLE_TYPE_LINK)) return; - structPtr = (struct UnknownBattleLinkStruct*)(&gBattleStruct->field_204); + structPtr = &gBattleStruct->field_204; atkSide = GetBattlerSide(gBattlerAttacker); defSide = GetBattlerSide(gBattlerTarget); @@ -575,10 +495,10 @@ void sub_817E0FC(u16 move, u16 weatherFlags, struct DisableStruct *disableStruct } if (move == MOVE_SELF_DESTRUCT || move == MOVE_EXPLOSION) { - structPtr->side[atkSide ^ BIT_SIDE].field_4_0_b = gBattlerPartyIndexes[gBattlerAttacker] + 1; - structPtr->side[atkSide ^ BIT_SIDE].field_4_0 = moveSlot; + structPtr->side[atkSide ^ BIT_SIDE].explosionMonId = gBattlerPartyIndexes[gBattlerAttacker] + 1; + structPtr->side[atkSide ^ BIT_SIDE].explosionMoveSlot = moveSlot; structPtr->side[atkSide ^ BIT_SIDE].field_3_0 = 13; - structPtr->side[atkSide ^ BIT_SIDE].field_4_0_0 = 1; + structPtr->side[atkSide ^ BIT_SIDE].explosion = 1; } sub_817E684(13, gBattleMoves[move].type, gBattleMoves[move].power, 0); @@ -595,7 +515,7 @@ void sub_817E32C(u8 animationId) if (!(gBattleTypeFlags & BATTLE_TYPE_LINK)) return; - structPtr = (struct UnknownBattleLinkStruct*)(&gBattleStruct->field_204); + structPtr = &gBattleStruct->field_204; atkSide = GetBattlerSide(gBattlerAttacker); switch (animationId) { @@ -625,7 +545,7 @@ void sub_817E3F4(void) u16 playerBestSpecies = 0, opponentBestSpecies = 0; s16 playerBestSum = 0, opponentBestSum = SHRT_MAX; u8 playerBestMonId = 0, opponentBestMonId = 0; - s16 *array = NULL; + struct UnknownBattleLinkArrayStruct *array = NULL; u8 countPlayer = 0, countOpponent = 0; s16 sum = 0; u16 species = 0; @@ -635,7 +555,7 @@ void sub_817E3F4(void) if (gBattleStruct->field_B3) return; - array = (void*) &gBattleStruct->field_1A4[0]; + array = &gBattleStruct->field_1A4; for (i = 0; i < PARTY_SIZE; i++) { if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) != SPECIES_NONE) @@ -653,7 +573,7 @@ void sub_817E3F4(void) if (species != SPECIES_NONE && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG, NULL)) { for (sum = 0, j = 0; j < 4; j++) - sum += array[i * 4 + j]; + sum += array->unk0[0][i * 4 + j]; if (playerBestSum < sum) { @@ -666,8 +586,9 @@ void sub_817E3F4(void) species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES, NULL); if (species != SPECIES_NONE && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG, NULL)) { + s32 id = 1; for (sum = 0, j = 0; j < 4; j++) - sum += array[i * 4 + j]; + sum += array->unk0[id][i * 4 + j]; if (opponentBestSum == sum) { @@ -689,9 +610,9 @@ void sub_817E3F4(void) for (sum = 0, i = 0, j = 0; j < 4; j++) { - if (sum < array[playerBestMonId * 4 + j]) + if (sum < array->unk0[0][playerBestMonId * 4 + j]) { - sum = array[playerBestMonId * 4 + j]; + sum = array->unk0[0][playerBestMonId * 4 + j]; i = j; } } @@ -1041,3 +962,345 @@ _0817E670:\n\ .pool"); } #endif + +void sub_817E684(u8 caseId, u16 arg1, u8 arg2, u8 arg3) +{ + struct UnknownBattleLinkArrayStruct *array = &gBattleStruct->field_1A4; + struct UnknownBattleLinkStruct *structPtr = &gBattleStruct->field_204; + u32 atkSide = GetBattlerSide(gBattlerAttacker); + u32 defSide = GetBattlerSide(gBattlerTarget); + const u16 *ptr; + s32 i; + + switch (caseId) + { + case 0: + case 1: + case 18: + case 22 ... 27: + array->unk0[atkSide][gBattlerPartyIndexes[gBattlerAttacker] * 4 + arg1] += gUnknown_0860A834[caseId][arg2]; + break; + case 3 ... 7: + i = 0; + ptr = gUnknown_0860A834[caseId]; + do + { + if (arg1 == ptr[i]) + { + array->unk0[atkSide][gBattlerPartyIndexes[gBattlerAttacker] * 4 + arg2] += ptr[i+1]; + break; + } + i += 2; + } while (ptr[i] != 0xFFFF); + break; + case 19: + structPtr->side[arg2 ^ 1].field_3_0 = 0; + array->unk0[arg2][0 * 4 + arg3] += gUnknown_0860A834[caseId][arg1]; + break; + case 20: + structPtr->side[arg2].field_3_0 = 0; + case 2: + array->unk0[arg2][0 * 4 + arg3] += gUnknown_0860A834[caseId][arg1]; + break; + case 17: + array->unk0[atkSide][arg2 * 4 + arg3] += gUnknown_0860A834[caseId][arg1]; + break; + case 8: + case 9: + case 15: + case 16: + case 21: + array->unk0[atkSide ^ BIT_SIDE][arg2 * 4 + arg3] += gUnknown_0860A834[caseId][arg1]; + break; + case 10: + array->unk0[arg1][arg2 * 4 + arg3] += gUnknown_0860A834[caseId][0]; + break; + case 11: + if (structPtr->pos[defSide][0].waterSportMonId != -(structPtr->pos[defSide][1].waterSportMonId) && arg1 == 10) + { + if (structPtr->pos[defSide][0].waterSportMonId != 0) + { + u32 id = (structPtr->pos[defSide][0].waterSportMonId - 1) * 4; + array->unk0[defSide][id + structPtr->pos[defSide][0].waterSportMoveSlot] += gUnknown_0860A834[caseId][0]; + } + if (structPtr->pos[defSide][1].waterSportMonId != 0) + { + u32 id = (structPtr->pos[defSide][1].waterSportMonId - 1) * 4; + array->unk0[defSide][id + structPtr->pos[defSide][1].waterSportMoveSlot] += gUnknown_0860A834[caseId][0]; + } + } + break; + case 12: + if (structPtr->pos[defSide][0].mudSportMonId != -(structPtr->pos[defSide][1].mudSportMonId) && arg1 == 13) + { + if (structPtr->pos[defSide][0].mudSportMonId != 0) + { + u32 id = (structPtr->pos[defSide][0].mudSportMonId - 1) * 4; + array->unk0[defSide][id + structPtr->pos[defSide][0].mudSportMoveSlot] += gUnknown_0860A834[caseId][0]; + } + if (structPtr->pos[defSide][1].mudSportMonId != 0) + { + u32 id = (structPtr->pos[defSide][1].mudSportMonId - 1) * 4; + array->unk0[defSide][id + structPtr->pos[defSide][1].mudSportMoveSlot] += gUnknown_0860A834[caseId][0]; + } + } + break; + case 13: + if (arg1 <= 8 && arg2 != 0 && structPtr->side[defSide].reflectMonId != 0) + { + u32 id = (structPtr->side[defSide].reflectMonId - 1) * 4; + array->unk0[defSide][id + structPtr->side[defSide].reflectMoveSlot] += gUnknown_0860A834[caseId][0]; + } + break; + case 14: + if (arg1 > 8 && arg2 != 0 && structPtr->side[defSide].lightScreenMonId != 0) + { + u32 id = (structPtr->side[defSide].lightScreenMonId - 1) * 4; + array->unk0[defSide][id + structPtr->side[defSide].lightScreenMoveSlot] += gUnknown_0860A834[caseId][0]; + } + break; + break; + } +} + +void sub_817EA80(u8 arg0) +{ + struct UnknownBattleLinkStruct *structPtr = &gBattleStruct->field_204; + u32 atkSide = GetBattlerSide(gBattlerAttacker); + u32 defSide = GetBattlerSide(gBattlerTarget); + u32 atkArrId = structPtr->side[atkSide].field_3_1; + s32 i; + + if (structPtr->side[atkSide].field_3_0 != 0) + { + switch (structPtr->side[atkSide].field_3_0) + { + case 1: + if (structPtr->pos[atkSide][atkArrId].curseMonId != 0) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->pos[atkSide][atkArrId].curseMonId - 1) * 4 + structPtr->pos[atkSide][atkArrId].curseMoveSlot); + } + break; + case 2: + if (structPtr->pos[atkSide][atkArrId].leechSeedMonId != 0) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->pos[atkSide][atkArrId].leechSeedMonId - 1) * 4 + structPtr->pos[atkSide][atkArrId].leechSeedMoveSlot); + } + break; + case 3: + if (structPtr->mon[atkSide][atkArrId].psnMonId != 0) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->mon[atkSide][atkArrId].psnMonId - 1) * 4 + structPtr->mon[atkSide][atkArrId].psnMoveSlot); + } + if (structPtr->mon[atkSide][atkArrId].badPsnMonId != 0) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->mon[atkSide][atkArrId].badPsnMonId - 1) * 4 + structPtr->mon[atkSide][atkArrId].badPsnMoveSlot); + } + break; + case 4: + if (structPtr->mon[atkSide][atkArrId].brnMonId != 0) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->mon[atkSide][atkArrId].brnMonId - 1) * 4 + structPtr->mon[atkSide][atkArrId].brnMoveSlot); + } + break; + case 5: + if (structPtr->pos[atkSide][atkArrId].nightmareMonId != 0) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->pos[atkSide][atkArrId].nightmareMonId - 1) * 4 + structPtr->pos[atkSide][atkArrId].nightmareMoveSlot); + } + break; + case 6: + if (structPtr->pos[atkSide][atkArrId].wrapMonId != 0) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->pos[atkSide][atkArrId].wrapMonId - 1) * 4 + structPtr->pos[atkSide][atkArrId].wrapMoveSlot); + } + break; + case 7: + if (structPtr->side[atkSide].spikesMonId != 0) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->side[atkSide].spikesMonId - 1) * 4 + structPtr->side[atkSide].spikesMoveSlot); + } + break; + case 8: + if (structPtr->side[atkSide].futureSightMonId != 0) + { + sub_817E684(20, 0, atkSide, + (structPtr->side[atkSide].futureSightMonId - 1) * 4 + structPtr->side[atkSide].futureSightMoveSlot); + } + break; + case 9: + if (structPtr->side[atkSide].doomDesireMonId != 0) + { + sub_817E684(20, 0, atkSide, + (structPtr->side[atkSide].doomDesireMonId - 1) * 4 + structPtr->side[atkSide].doomDesireMoveSlot); + } + break; + case 10: + if (structPtr->side[atkSide].perishSong + && structPtr->side[atkSide].perishSongMonId - 1 != gBattlerPartyIndexes[gBattlerAttacker]) + { + sub_817E684(19, 0, atkSide, + (structPtr->side[atkSide].perishSongMonId - 1) * 4 + structPtr->side[atkSide].perishSongMoveSlot); + } + if (structPtr->side[atkSide ^ BIT_SIDE].perishSong) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->side[atkSide ^ BIT_SIDE].perishSongMonId - 1) * 4 + structPtr->side[atkSide ^ BIT_SIDE].perishSongMoveSlot); + } + break; + case 11: + if (structPtr->side[atkSide ^ BIT_SIDE].destinyBondMonId != 0) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->side[atkSide ^ BIT_SIDE].destinyBondMonId - 1) * 4 + structPtr->side[atkSide ^ BIT_SIDE].destinyBondMoveSlot); + } + break; + case 12: + for (i = 0; i < 2; i++) + { + if (structPtr->pos[atkSide][i].confusionMonId != 0) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->pos[atkSide][i].confusionMonId - 1) * 4 + structPtr->pos[atkSide][i].confusionMoveSlot); + } + } + break; + case 13: + if (structPtr->side[atkSide].explosion) + { + sub_817E684(19, 0, atkSide, + (structPtr->side[atkSide].explosionMonId - 1) * 4 + structPtr->side[atkSide].explosionMoveSlot); + } + if (structPtr->side[atkSide ^ BIT_SIDE].explosion) + { + sub_817E684(19, 0, atkSide ^ BIT_SIDE, + (structPtr->side[atkSide ^ BIT_SIDE].explosionMonId - 1) * 4 + structPtr->side[atkSide ^ BIT_SIDE].explosionMoveSlot); + } + break; + case 14: + if (arg0 == 1) + { + sub_817E684(20, 0, atkSide, + (gBattlerPartyIndexes[gBattlerAttacker]) * 4 + structPtr->side[atkSide].field_8_6); + } + break; + case 15: + break; + } + } + else + { + if (structPtr->side[defSide].field_3_0 == 7) + { + if (structPtr->side[defSide].spikesMonId != 0) + { + sub_817E684(19, 0, defSide ^ BIT_SIDE, + (structPtr->side[defSide].spikesMonId - 1) * 4 + structPtr->side[defSide].spikesMoveSlot); + } + } + else + { + sub_817E684(20, 0, atkSide, + (gBattlerPartyIndexes[gBattlerAttacker]) * 4 + structPtr->side[atkSide].field_8_6); + } + } +} + +void sub_817EECC(void) +{ + s32 i; + s32 dmgByMove[4]; + u16 powerOverride; + u16 currMoveSaved; + + if (gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000)) + return; + if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT) + return; + if (gBattleMons[gBattlerAttacker].statStages[STAT_ACC] <= 5) + return; + if (gBattleMons[gBattlerTarget].statStages[STAT_EVASION] > 6) + return; + if (gCurrentMove == MOVE_HIDDEN_POWER || gCurrentMove == MOVE_WEATHER_BALL) + return; + if (gBattleTypeFlags & (BATTLE_TYPE_PALACE | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)) + return; + if (gBattleMoves[gBattleMons[gBattlerAttacker].moves[gMoveSelectionCursor[gBattlerAttacker]]].power == 0) + return; + + i = 0; + currMoveSaved = gBattleMons[gBattlerAttacker].moves[gMoveSelectionCursor[gBattlerAttacker]]; + while (1) + { + if (currMoveSaved == gUnknown_0860A4AC[i]) + break; + i++; + if (gUnknown_0860A4AC[i] == 0xFFFF) + break; + } + + if (gUnknown_0860A4AC[i] != 0xFFFF) + return; + + dmgByMove[gMoveSelectionCursor[gBattlerAttacker]] = gBattleMoveDamage; + currMoveSaved = gCurrentMove; + for (i = 0; i < 4; i++) + { + gCurrentMove = gBattleMons[gBattlerAttacker].moves[i]; + powerOverride = 0; + if (sub_817F21C(gCurrentMove, &dmgByMove[i], &powerOverride)) + { + u8 moveResultFlags; + u16 sideStatus = gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)]; + gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattlerAttacker], &gBattleMons[gBattlerTarget], gCurrentMove, + sideStatus, powerOverride, + 0, gBattlerAttacker, gBattlerTarget); + + if (gStatuses3[gBattlerAttacker] & STATUS3_CHARGED_UP && gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC) + gBattleMoveDamage *= 2; + if (gProtectStructs[gBattlerAttacker].helpingHand) + gBattleMoveDamage = gBattleMoveDamage * 15 / 10; + + moveResultFlags = TypeCalc(gCurrentMove, gBattlerAttacker, gBattlerTarget); + dmgByMove[i] = gBattleMoveDamage; + if (dmgByMove[i] == 0 && !(moveResultFlags & MOVE_RESULT_NO_EFFECT)) + dmgByMove[i] = 1; + } + } + + for (i = 0; i < 4; i++) + { + if (i != gMoveSelectionCursor[gBattlerAttacker] && dmgByMove[i] > dmgByMove[gMoveSelectionCursor[gBattlerAttacker]]) + { + u16 opponentSpecies, playerSpecies; + s32 bestMoveId; + + if (gMoveSelectionCursor[gBattlerAttacker] != 0) + bestMoveId = 0; + else + bestMoveId = 1; + + for (i = 0; i < 4; i++) + { + if (i != gMoveSelectionCursor[gBattlerAttacker] && dmgByMove[i] > dmgByMove[bestMoveId]) + bestMoveId = i; + } + + opponentSpecies = GetMonData(&gEnemyParty [gBattlerPartyIndexes[gBattlerTarget]], MON_DATA_SPECIES, NULL); + playerSpecies = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]], MON_DATA_SPECIES, NULL); + sub_80EE35C(opponentSpecies, playerSpecies, gMoveSelectionCursor[gBattlerAttacker], gBattleMons[gBattlerAttacker].moves, gBattleMons[gBattlerAttacker].moves[bestMoveId]); + break; + } + } + + gBattleMoveDamage = dmgByMove[gMoveSelectionCursor[gBattlerAttacker]]; + gCurrentMove = currMoveSaved; +} diff --git a/src/pokemon.c b/src/pokemon.c index 25d532204..9c55fb84d 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2196,7 +2196,7 @@ void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move) (var) /= (gStatStageRatios)[(mon)->statStages[(statIndex)]][1]; \ } -s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 bankAtk, u8 bankDef) +s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 battlerIdAtk, u8 battlerIdDef) { u32 i; s32 damage = 0; @@ -2226,8 +2226,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if (attacker->item == ITEM_ENIGMA_BERRY) { - attackerHoldEffect = gEnigmaBerries[bankAtk].holdEffect; - attackerHoldEffectParam = gEnigmaBerries[bankAtk].holdEffectParam; + attackerHoldEffect = gEnigmaBerries[battlerIdAtk].holdEffect; + attackerHoldEffectParam = gEnigmaBerries[battlerIdAtk].holdEffectParam; } else { @@ -2237,8 +2237,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if (defender->item == ITEM_ENIGMA_BERRY) { - defenderHoldEffect = gEnigmaBerries[bankDef].holdEffect; - defenderHoldEffectParam = gEnigmaBerries[bankDef].holdEffectParam; + defenderHoldEffect = gEnigmaBerries[battlerIdDef].holdEffect; + defenderHoldEffectParam = gEnigmaBerries[battlerIdDef].holdEffectParam; } else { @@ -2249,13 +2249,13 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de if (attacker->ability == ABILITY_HUGE_POWER || attacker->ability == ABILITY_PURE_POWER) attack *= 2; - if (ShouldGetStatBadgeBoost(FLAG_BADGE01_GET, bankAtk)) + if (ShouldGetStatBadgeBoost(FLAG_BADGE01_GET, battlerIdAtk)) attack = (110 * attack) / 100; - if (ShouldGetStatBadgeBoost(FLAG_BADGE05_GET, bankDef)) + if (ShouldGetStatBadgeBoost(FLAG_BADGE05_GET, battlerIdDef)) defense = (110 * defense) / 100; - if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, bankAtk)) + if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerIdAtk)) spAttack = (110 * spAttack) / 100; - if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, bankDef)) + if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerIdDef)) spDefense = (110 * spDefense) / 100; for (i = 0; i < ARRAY_COUNT(sHoldEffectToType); i++) @@ -2440,7 +2440,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de } // flash fire triggered - if ((gBattleResources->flags->flags[bankAtk] & UNKNOWN_FLAG_FLASH_FIRE) && type == TYPE_FIRE) + if ((gBattleResources->flags->flags[battlerIdAtk] & UNKNOWN_FLAG_FLASH_FIRE) && type == TYPE_FIRE) damage = (15 * damage) / 10; } diff --git a/src/scrcmd.c b/src/scrcmd.c index b7e2474d4..a29e64979 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1612,7 +1612,7 @@ bool8 ScrCmd_buffernumberstring(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 v1 = VarGet(ScriptReadHalfword(ctx)); - u8 v2 = sub_80EF370(v1); + u8 v2 = CountDigits(v1); ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], v1, 0, v2); return FALSE; diff --git a/src/tv.c b/src/tv.c index 83cb18b3f..03d564828 100644 --- a/src/tv.c +++ b/src/tv.c @@ -36,9 +36,7 @@ #include "decoration.h" #include "secret_base.h" #include "tv.h" - -extern const u8 gSpeciesNames[][11]; -extern const u8 gMoveNames[][13]; +#include "data2.h" // Static type declarations @@ -87,101 +85,100 @@ void tv_store_id_3x(TVShow *show); void DeleteTVShowInArrayByIdx(TVShow *shows, u8 idx); s8 FindEmptyTVSlotWithinFirstFiveShowsOfArray(TVShow *shows); void FindActiveBroadcastByShowType_SetScriptResult(u8 kind); -void InterviewBefore_BravoTrainerPkmnProfile(void); -void InterviewBefore_NameRater(void); +static void InterviewBefore_BravoTrainerPkmnProfile(void); +static void InterviewBefore_NameRater(void); u16 TV_GetSomeOtherSpeciesAlreadySeenByPlayer(u16 passedSpecies); -void sub_80EFA88(void); -void sub_80EF93C(TVShow *shows); +static void sub_80EFA88(void); +static void sub_80EF93C(TVShow *shows); s8 sub_80EEE30(PokeNews *pokeNews); bool8 sub_80EF0E4(u8 newsKind); void ClearPokemonNewsI(u8 i); -void sub_80F1254(TVShow *shows); -void sub_80F12A4(TVShow *shows); -void sub_80F0358(TVShow *player1, TVShow *player2, TVShow *player3, TVShow *player4); -void sub_80F0C04(void); -void sub_80F0708(void); -void sub_80F0B64(void); -s8 sub_80F06D0(TVShow *tvShows); -bool8 sub_80F049C(TVShow *dest[], TVShow *src[], u8 idx); -bool8 sub_80F0580(TVShow *tv1, TVShow *tv2, u8 idx); -bool8 sub_80F05E8(TVShow *tv1, TVShow *tv2, u8 idx); -bool8 sub_80F0668(TVShow *tv1, TVShow *tv2, u8 idx); -void sub_80F0B00(u8 showIdx); -void sub_80F0B24(u16 species, u8 showIdx); -void sub_80F0D60(PokeNews *player1, PokeNews *player2, PokeNews *player3, PokeNews *player4); -void sub_80F0EEC(void); -void sub_80F0F24(void); -s8 sub_80F0ECC(PokeNews *pokeNews, u8 idx); -void sub_80F0E58(PokeNews *dest[], PokeNews *src[]); -bool8 sub_80F0E84(PokeNews *dest, PokeNews *src, s8 slot); +static void sub_80F1254(TVShow *shows); +static void sub_80F12A4(TVShow *shows); +static void sub_80F0358(TVShow *player1, TVShow *player2, TVShow *player3, TVShow *player4); +static void sub_80F0C04(void); +static void sub_80F0708(void); +static void sub_80F0B64(void); +static s8 sub_80F06D0(TVShow *tvShows); +static bool8 sub_80F049C(TVShow *dest[], TVShow *src[], u8 idx); +static bool8 sub_80F0580(TVShow *tv1, TVShow *tv2, u8 idx); +static bool8 sub_80F05E8(TVShow *tv1, TVShow *tv2, u8 idx); +static bool8 sub_80F0668(TVShow *tv1, TVShow *tv2, u8 idx); +void SetTvShowInactive(u8 showIdx); +static void sub_80F0B24(u16 species, u8 showIdx); +static void sub_80F0D60(PokeNews *player1, PokeNews *player2, PokeNews *player3, PokeNews *player4); +static void sub_80F0EEC(void); +static void sub_80F0F24(void); +static s8 sub_80F0ECC(PokeNews *pokeNews, u8 idx); +static void sub_80F0E58(PokeNews *dest[], PokeNews *src[]); +static bool8 sub_80F0E84(PokeNews *dest, PokeNews *src, s8 slot); void TVShowDone(void); -void InterviewAfter_FanClubLetter(void); -void InterviewAfter_RecentHappenings(void); -void InterviewAfter_PkmnFanClubOpinions(void); -void InterviewAfter_DummyShow4(void); -void InterviewAfter_BravoTrainerPokemonProfile(void); -void InterviewAfter_BravoTrainerBattleTowerProfile(void); -void InterviewAfter_ContestLiveUpdates(void); +static void InterviewAfter_FanClubLetter(void); +static void InterviewAfter_RecentHappenings(void); +static void InterviewAfter_PkmnFanClubOpinions(void); +static void InterviewAfter_DummyShow4(void); +static void InterviewAfter_BravoTrainerPokemonProfile(void); +static void InterviewAfter_BravoTrainerBattleTowerProfile(void); +static void InterviewAfter_ContestLiveUpdates(void); void UpdateWorldOfMastersAndPutItOnTheAir(void); void PutPokemonTodayFailedOnTheAir(void); -void sub_80ED718(void); -void sub_80EED88(void); +static void sub_80ED718(void); +static void sub_80EED88(void); void TV_SortPurchasesByQuantity(void); -void sub_80ED8B4(u16 days); +static void sub_80ED8B4(u16 days); void UpdateMassOutbreakTimeLeft(u16 days); -void sub_80EF120(u16 days); -void sub_80EDA48(u16 days); -void sub_80EEB98(u16 days); +static void sub_80EF120(u16 days); +static void sub_80EDA48(u16 days); +static void sub_80EEB98(u16 days); void PutFishingAdviceShowOnTheAir(void); -void sub_80EDA80(void); u8 TV_MonDataIdxToRibbon(u8 monDataIdx); -void sub_80EEBF4(u8 actionIdx); +static void sub_80EEBF4(u8 actionIdx); bool8 IsPriceDiscounted(u8 newsKind); -void InterviewBefore_FanClubLetter(void); -void InterviewBefore_RecentHappenings(void); -void InterviewBefore_PkmnFanClubOpinions(void); -void InterviewBefore_Dummy(void); -void InterviewBefore_BravoTrainerBTProfile(void); -void InterviewBefore_ContestLiveUpdates(void); -void InterviewBefore_3CheersForPokeblocks(void); -void InterviewBefore_FanClubSpecial(void); +static void InterviewBefore_FanClubLetter(void); +static void InterviewBefore_RecentHappenings(void); +static void InterviewBefore_PkmnFanClubOpinions(void); +static void InterviewBefore_Dummy(void); +static void InterviewBefore_BravoTrainerBTProfile(void); +static void InterviewBefore_ContestLiveUpdates(void); +static void InterviewBefore_3CheersForPokeblocks(void); +static void InterviewBefore_FanClubSpecial(void); void ChangeBoxPokemonNickname_CB(void); -void DoTVShowPokemonFanClubLetter(void); -void DoTVShowRecentHappenings(void); -void DoTVShowPokemonFanClubOpinions(void); -void DoTVShowDummiedOut(void); -void DoTVShowPokemonNewsMassOutbreak(void); -void DoTVShowBravoTrainerPokemonProfile(void); -void DoTVShowBravoTrainerBattleTower(void); -void DoTVShowPokemonTodaySuccessfulCapture(void); -void DoTVShowTodaysSmartShopper(void); -void DoTVShowTheNameRaterShow(void); -void DoTVShowPokemonContestLiveUpdates(void); -void DoTVShowPokemonBattleUpdate(void); -void DoTVShow3CheersForPokeblocks(void); -void DoTVShowPokemonTodayFailedCapture(void); -void DoTVShowPokemonAngler(void); -void DoTVShowTheWorldOfMasters(void); -void DoTVShowTodaysRivalTrainer(void); -void DoTVShowDewfordTrendWatcherNetwork(void); -void DoTVShowHoennTreasureInvestigators(void); -void DoTVShowFindThatGamer(void); -void DoTVShowBreakingNewsTV(void); -void DoTVShowSecretBaseVisit(void); -void DoTVShowPokemonLotteryWinnerFlashReport(void); -void DoTVShowThePokemonBattleSeminar(void); -void DoTVShowTrainerFanClubSpecial(void); -void DoTVShowTrainerFanClub(void); -void DoTVShowSpotTheCuties(void); -void DoTVShowPokemonNewsBattleFrontier(void); -void DoTVShowWhatsNo1InHoennToday(void); -void DoTVShowSecretBaseSecrets(void); -void DoTVShowSafariFanClub(void); -void DoTVShowPokemonContestLiveUpdates2(void); +static void DoTVShowPokemonFanClubLetter(void); +static void DoTVShowRecentHappenings(void); +static void DoTVShowPokemonFanClubOpinions(void); +static void DoTVShowDummiedOut(void); +static void DoTVShowPokemonNewsMassOutbreak(void); +static void DoTVShowBravoTrainerPokemonProfile(void); +static void DoTVShowBravoTrainerBattleTower(void); +static void DoTVShowPokemonTodaySuccessfulCapture(void); +static void DoTVShowTodaysSmartShopper(void); +static void DoTVShowTheNameRaterShow(void); +static void DoTVShowPokemonContestLiveUpdates(void); +static void DoTVShowPokemonBattleUpdate(void); +static void DoTVShow3CheersForPokeblocks(void); +static void DoTVShowPokemonTodayFailedCapture(void); +static void DoTVShowPokemonAngler(void); +static void DoTVShowTheWorldOfMasters(void); +static void DoTVShowTodaysRivalTrainer(void); +static void DoTVShowDewfordTrendWatcherNetwork(void); +static void DoTVShowHoennTreasureInvestigators(void); +static void DoTVShowFindThatGamer(void); +static void DoTVShowBreakingNewsTV(void); +static void DoTVShowSecretBaseVisit(void); +static void DoTVShowPokemonLotteryWinnerFlashReport(void); +static void DoTVShowThePokemonBattleSeminar(void); +static void DoTVShowTrainerFanClubSpecial(void); +static void DoTVShowTrainerFanClub(void); +static void DoTVShowSpotTheCuties(void); +static void DoTVShowPokemonNewsBattleFrontier(void); +static void DoTVShowWhatsNo1InHoennToday(void); +static void DoTVShowSecretBaseSecrets(void); +static void DoTVShowSafariFanClub(void); +static void DoTVShowPokemonContestLiveUpdates2(void); // .rodata -const struct { +static const struct { u16 species; u16 moves[4]; u8 level; @@ -214,8 +211,7 @@ const struct { } }; -// TODO: Figure out what these are, and define constants in include/flags.h -const u16 sGoldSymbolFlags[] = { +static const u16 sGoldSymbolFlags[] = { FLAG_SYS_TOWER_GOLD, FLAG_SYS_DOME_GOLD, FLAG_SYS_PALACE_GOLD, @@ -225,7 +221,7 @@ const u16 sGoldSymbolFlags[] = { FLAG_SYS_PYRAMID_GOLD }; -const u16 sSilverSymbolFlags[] = { +static const u16 sSilverSymbolFlags[] = { FLAG_SYS_TOWER_SILVER, FLAG_SYS_DOME_SILVER, FLAG_SYS_PALACE_SILVER, @@ -235,8 +231,7 @@ const u16 sSilverSymbolFlags[] = { FLAG_SYS_PYRAMID_SILVER }; -// TODO: Figure out what these are, and define constants in include/vars.h -const u16 sNumberOneVarsAndThresholds[][2] = { +static const u16 sNumberOneVarsAndThresholds[][2] = { {VAR_DAILY_SLOTS, 100}, {VAR_DAILY_ROULETTE, 50}, {VAR_DAILY_WILDS, 100}, @@ -246,7 +241,7 @@ const u16 sNumberOneVarsAndThresholds[][2] = { {VAR_DAILY_BP, 30} }; -const u8 *const sPokeNewsTextGroup_Upcoming[] = { +static const u8 *const sPokeNewsTextGroup_Upcoming[] = { NULL, gPokeNewsTextSlateport_Upcoming, gPokeNewsTextGameCorner_Upcoming, @@ -254,7 +249,7 @@ const u8 *const sPokeNewsTextGroup_Upcoming[] = { gPokeNewsTextBlendMaster_Upcoming }; -const u8 *const sPokeNewsTextGroup_Ongoing[] = { +static const u8 *const sPokeNewsTextGroup_Ongoing[] = { NULL, gPokeNewsTextSlateport_Ongoing, gPokeNewsTextGameCorner_Ongoing, @@ -262,7 +257,7 @@ const u8 *const sPokeNewsTextGroup_Ongoing[] = { gPokeNewsTextBlendMaster_Ongoing }; -const u8 *const sPokeNewsTextGroup_Ending[] = { +static const u8 *const sPokeNewsTextGroup_Ending[] = { NULL, gPokeNewsTextSlateport_Ending, gPokeNewsTextGameCorner_Ending, @@ -276,7 +271,7 @@ u8 *const gTVStringVarPtrs[] = { gStringVar3 }; -const u8 *const sTVFanClubTextGroup[] = { +static const u8 *const sTVFanClubTextGroup[] = { gTVFanClubText00, gTVFanClubText01, gTVFanClubText02, @@ -287,7 +282,7 @@ const u8 *const sTVFanClubTextGroup[] = { gTVFanClubText07 }; -const u8 *const sTVRecentHappeninssTextGroup[] = { +static const u8 *const sTVRecentHappeninssTextGroup[] = { gTVRecentHappeningsText00, gTVRecentHappeningsText01, gTVRecentHappeningsText02, @@ -296,7 +291,7 @@ const u8 *const sTVRecentHappeninssTextGroup[] = { gTVRecentHappeningsText05 }; -const u8 *const sTVFanClubOpinionsTextGroup[] = { +static const u8 *const sTVFanClubOpinionsTextGroup[] = { gTVFanClubOpinionsText00, gTVFanClubOpinionsText01, gTVFanClubOpinionsText02, @@ -304,11 +299,11 @@ const u8 *const sTVFanClubOpinionsTextGroup[] = { gTVFanClubOpinionsText04 }; -const u8 *const sTVMassOutbreakTextGroup[] = { +static const u8 *const sTVMassOutbreakTextGroup[] = { gTVMassOutbreakText00 }; -const u8 *const sTVPokemonTodaySuccessfulTextGroup[] = { +static const u8 *const sTVPokemonTodaySuccessfulTextGroup[] = { gTVPokemonTodaySuccessfulText00, gTVPokemonTodaySuccessfulText01, gTVPokemonTodaySuccessfulText02, @@ -323,7 +318,7 @@ const u8 *const sTVPokemonTodaySuccessfulTextGroup[] = { gTVPokemonTodaySuccessfulText11 }; -const u8 *const sTVTodaysSmartShopperTextGroup[] = { +static const u8 *const sTVTodaysSmartShopperTextGroup[] = { gTVTodaysSmartShopperText00, gTVTodaysSmartShopperText01, gTVTodaysSmartShopperText02, @@ -339,7 +334,7 @@ const u8 *const sTVTodaysSmartShopperTextGroup[] = { gTVTodaysSmartShopperText12 }; -const u8 *const sTVBravoTrainerTextGroup[] = { +static const u8 *const sTVBravoTrainerTextGroup[] = { gTVBravoTrainerText00, gTVBravoTrainerText01, gTVBravoTrainerText02, @@ -351,7 +346,7 @@ const u8 *const sTVBravoTrainerTextGroup[] = { gTVBravoTrainerText08 }; -const u8 *const sTV3CheersForPokeblocksTextGroup[] = { +static const u8 *const sTV3CheersForPokeblocksTextGroup[] = { gTV3CheersForPokeblocksText00, gTV3CheersForPokeblocksText01, gTV3CheersForPokeblocksText02, @@ -360,7 +355,7 @@ const u8 *const sTV3CheersForPokeblocksTextGroup[] = { gTV3CheersForPokeblocksText05 }; -const u8 *const sTVBravoTrainerBattleTowerTextGroup[] = { +static const u8 *const sTVBravoTrainerBattleTowerTextGroup[] = { gTVBravoTrainerBattleTowerText00, gTVBravoTrainerBattleTowerText01, gTVBravoTrainerBattleTowerText02, @@ -378,7 +373,7 @@ const u8 *const sTVBravoTrainerBattleTowerTextGroup[] = { gTVBravoTrainerBattleTowerText14 }; -const u8 *const sTVContestLiveUpdatesTextGroup[] = { +static const u8 *const sTVContestLiveUpdatesTextGroup[] = { gTVContestLiveUpdatesText00, gTVContestLiveUpdatesText01, gTVContestLiveUpdatesText02, @@ -414,7 +409,7 @@ const u8 *const sTVContestLiveUpdatesTextGroup[] = { gTVContestLiveUpdatesText32 }; -const u8 *const sTVPokemonBattleUpdateTextGroup[] = { +static const u8 *const sTVPokemonBattleUpdateTextGroup[] = { gTVPokemonBattleUpdateText00, gTVPokemonBattleUpdateText01, gTVPokemonBattleUpdateText02, @@ -425,7 +420,7 @@ const u8 *const sTVPokemonBattleUpdateTextGroup[] = { gTVPokemonBattleUpdateText07 }; -const u8 *const sTVTrainerFanClubSpecialTextGroup[] = { +static const u8 *const sTVTrainerFanClubSpecialTextGroup[] = { gTVTrainerFanClubSpecialText00, gTVTrainerFanClubSpecialText01, gTVTrainerFanClubSpecialText02, @@ -434,7 +429,7 @@ const u8 *const sTVTrainerFanClubSpecialTextGroup[] = { gTVTrainerFanClubSpecialText05 }; -const u8 *const sTVNameRaterTextGroup[] = { +static const u8 *const sTVNameRaterTextGroup[] = { gTVNameRaterText00, gTVNameRaterText01, gTVNameRaterText02, @@ -456,14 +451,14 @@ const u8 *const sTVNameRaterTextGroup[] = { gTVNameRaterText18 }; -const u8 *const sTVPokemonContestLiveUpdates2TextGroup[] = { +static const u8 *const sTVPokemonContestLiveUpdates2TextGroup[] = { gTVPokemonContestLiveUpdates2Text00, gTVPokemonContestLiveUpdates2Text01, gTVPokemonContestLiveUpdates2Text02, gTVPokemonContestLiveUpdates2Text03 }; -const u8 *const sTVPokemonTodayFailedTextGroup[] = { +static const u8 *const sTVPokemonTodayFailedTextGroup[] = { gTVPokemonTodayFailedText00, gTVPokemonTodayFailedText01, gTVPokemonTodayFailedText02, @@ -473,18 +468,18 @@ const u8 *const sTVPokemonTodayFailedTextGroup[] = { gTVPokemonTodayFailedText06 }; -const u8 *const sTVPokemonAnslerTextGroup[] = { +static const u8 *const sTVPokemonAnslerTextGroup[] = { gTVPokemonAnglerText00, gTVPokemonAnglerText01 }; -const u8 *const sTVWorldOfMastersTextGroup[] = { +static const u8 *const sTVWorldOfMastersTextGroup[] = { gTVWorldOfMastersText00, gTVWorldOfMastersText01, gTVWorldOfMastersText02 }; -const u8 *const sTVTodaysRivalTrainerTextGroup[] = { +static const u8 *const sTVTodaysRivalTrainerTextGroup[] = { gTVTodaysRivalTrainerText00, gTVTodaysRivalTrainerText01, gTVTodaysRivalTrainerText02, @@ -498,7 +493,7 @@ const u8 *const sTVTodaysRivalTrainerTextGroup[] = { gTVTodaysRivalTrainerText10 }; -const u8 *const sTVDewfordTrendWatcherNetworkTextGroup[] = { +static const u8 *const sTVDewfordTrendWatcherNetworkTextGroup[] = { gTVDewfordTrendWatcherNetworkText00, gTVDewfordTrendWatcherNetworkText01, gTVDewfordTrendWatcherNetworkText02, @@ -508,20 +503,20 @@ const u8 *const sTVDewfordTrendWatcherNetworkTextGroup[] = { gTVDewfordTrendWatcherNetworkText06 }; -const u8 *const sTVHoennTreasureInvestisatorsTextGroup[] = { +static const u8 *const sTVHoennTreasureInvestisatorsTextGroup[] = { gTVHoennTreasureInvestigatorsText00, gTVHoennTreasureInvestigatorsText01, gTVHoennTreasureInvestigatorsText02 }; -const u8 *const sTVFindThatGamerTextGroup[] = { +static const u8 *const sTVFindThatGamerTextGroup[] = { gTVFindThatGamerText00, gTVFindThatGamerText01, gTVFindThatGamerText02, gTVFindThatGamerText03 }; -const u8 *const sTVBreakinsNewsTextGroup[] = { +static const u8 *const sTVBreakinsNewsTextGroup[] = { gTVBreakingNewsText00, gTVBreakingNewsText01, gTVBreakingNewsText02, @@ -537,7 +532,7 @@ const u8 *const sTVBreakinsNewsTextGroup[] = { gTVBreakingNewsText12 }; -const u8 *const sTVSecretBaseVisitTextGroup[] = { +static const u8 *const sTVSecretBaseVisitTextGroup[] = { gTVSecretBaseVisitText00, gTVSecretBaseVisitText01, gTVSecretBaseVisitText02, @@ -554,11 +549,11 @@ const u8 *const sTVSecretBaseVisitTextGroup[] = { gTVSecretBaseVisitText13 }; -const u8 *const sTVPokemonLotteryWinnerFlashReportTextGroup[] = { +static const u8 *const sTVPokemonLotteryWinnerFlashReportTextGroup[] = { gTVPokemonLotteryWinnerFlashReportText00 }; -const u8 *const sTVThePokemonBattleSeminarTextGroup[] = { +static const u8 *const sTVThePokemonBattleSeminarTextGroup[] = { gTVThePokemonBattleSeminarText00, gTVThePokemonBattleSeminarText01, gTVThePokemonBattleSeminarText02, @@ -568,7 +563,7 @@ const u8 *const sTVThePokemonBattleSeminarTextGroup[] = { gTVThePokemonBattleSeminarText06 }; -const u8 *const sTVTrainerFanClubTextGroup[] = { +static const u8 *const sTVTrainerFanClubTextGroup[] = { gTVTrainerFanClubText00, gTVTrainerFanClubText01, gTVTrainerFanClubText02, @@ -583,7 +578,7 @@ const u8 *const sTVTrainerFanClubTextGroup[] = { gTVTrainerFanClubText11 }; -const u8 *const sTVCutiesTextGroup[] = { +static const u8 *const sTVCutiesTextGroup[] = { gTVCutiesText00, gTVCutiesText01, gTVCutiesText02, @@ -602,7 +597,7 @@ const u8 *const sTVCutiesTextGroup[] = { gTVCutiesText15 }; -const u8 *const sTVPokemonNewsBattleFrontierTextGroup[] = { +static const u8 *const sTVPokemonNewsBattleFrontierTextGroup[] = { gTVPokemonNewsBattleFrontierText00, gTVPokemonNewsBattleFrontierText01, gTVPokemonNewsBattleFrontierText02, @@ -624,7 +619,7 @@ const u8 *const sTVPokemonNewsBattleFrontierTextGroup[] = { gTVPokemonNewsBattleFrontierText18 }; -const u8 *const sTVWhatsNo1InHoennTodayTextGroup[] = { +static const u8 *const sTVWhatsNo1InHoennTodayTextGroup[] = { gTVWhatsNo1InHoennTodayText00, gTVWhatsNo1InHoennTodayText01, gTVWhatsNo1InHoennTodayText02, @@ -636,7 +631,7 @@ const u8 *const sTVWhatsNo1InHoennTodayTextGroup[] = { gTVWhatsNo1InHoennTodayText08 }; -const u8 *const sTVSecretBaseSecretsTextGroup[] = { +static const u8 *const sTVSecretBaseSecretsTextGroup[] = { gTVSecretBaseSecretsText00, gTVSecretBaseSecretsText01, gTVSecretBaseSecretsText02, @@ -682,7 +677,7 @@ const u8 *const sTVSecretBaseSecretsTextGroup[] = { gTVSecretBaseSecretsText42 }; -const u8 *const sTVSafariFanClubTextGroup[] = { +static const u8 *const sTVSafariFanClubTextGroup[] = { gTVSafariFanClubText00, gTVSafariFanClubText01, gTVSafariFanClubText02, @@ -696,7 +691,7 @@ const u8 *const sTVSafariFanClubTextGroup[] = { gTVSafariFanClubText10 }; -const u8 *const sTVInSearchOfTrainersTextGroup[] = { +static const u8 *const sTVInSearchOfTrainersTextGroup[] = { gTVInSearchOfTrainersText00, gTVInSearchOfTrainersText01, gTVInSearchOfTrainersText02, @@ -1253,7 +1248,7 @@ void tv_store_id_2x(TVShow *show) show->common.trainerIdHi = id >> 8; } -void InterviewAfter_ContestLiveUpdates(void) +static void InterviewAfter_ContestLiveUpdates(void) { TVShow *show; TVShow *show2; @@ -1472,7 +1467,7 @@ void ContestLiveUpdates_BeforeInterview_5(u8 a0, u8 a1) } } -void InterviewAfter_BravoTrainerPokemonProfile(void) +static void InterviewAfter_BravoTrainerPokemonProfile(void) { TVShow *show; TVShow *show2; @@ -1538,7 +1533,7 @@ void BravoTrainerPokemonProfile_BeforeInterview2(u8 a0) } } -void InterviewAfter_BravoTrainerBattleTowerProfile(void) +static void InterviewAfter_BravoTrainerBattleTowerProfile(void) { TVShow *show; @@ -1671,7 +1666,7 @@ void PutLilycoveContestLadyShowOnTheAir(void) } } -void InterviewAfter_FanClubLetter(void) +static void InterviewAfter_FanClubLetter(void) { TVShow *show; @@ -1684,7 +1679,7 @@ void InterviewAfter_FanClubLetter(void) show->fanclubLetter.language = gGameLanguage; } -void InterviewAfter_RecentHappenings(void) +static void InterviewAfter_RecentHappenings(void) { TVShow *show; @@ -1697,7 +1692,7 @@ void InterviewAfter_RecentHappenings(void) show->recentHappenings.language = gGameLanguage; } -void InterviewAfter_PkmnFanClubOpinions(void) +static void InterviewAfter_PkmnFanClubOpinions(void) { TVShow *show; @@ -1722,14 +1717,14 @@ void InterviewAfter_PkmnFanClubOpinions(void) } } -void InterviewAfter_DummyShow4() +static void InterviewAfter_DummyShow4(void) { TVShow *show; show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot]; } -void sub_80ED718(void) +static void sub_80ED718(void) { u8 i; u16 outbreakIdx; @@ -1802,7 +1797,7 @@ void UpdateTVShowsPerDay(u16 days) sub_80EEB98(days); } -void sub_80ED8B4(u16 days) +static void sub_80ED8B4(u16 days) { u8 i; TVShow *show; @@ -1872,7 +1867,7 @@ void PutFishingAdviceShowOnTheAir(void) { TVShow *show; - sCurTVShowSlot = FindEmptyTVSlotBeyondFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows); + sCurTVShowSlot = FindEmptyTVSlotBeyondFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows); if (sCurTVShowSlot != -1 && HasMixableShowAlreadyBeenSpawnedWithPlayerID(TVSHOW_FISHING_ADVICE, FALSE) != TRUE) { show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot]; @@ -1892,7 +1887,7 @@ void SetPokemonAnglerSpecies(u16 species) sPokemonAnglerSpecies = species; } -void sub_80EDA48(u16 days) +static void sub_80EDA48(u16 days) { TVShow *show; @@ -2088,7 +2083,7 @@ void sub_80EDE84(u16 nCoinsSpent) sFindThatGamerCoinsSpent = nCoinsSpent; } -void sub_80EDE98(TVShow *show) +static void sub_80EDE98(TVShow *show) { u8 i; u8 j; @@ -2153,7 +2148,7 @@ void sub_80EDE98(TVShow *show) } } -void sub_80EDFB4(TVShow *show) +static void sub_80EDFB4(TVShow *show) { u8 i; u16 move; @@ -2590,7 +2585,7 @@ void sub_80EEA70(void) } } -void sub_80EEB98(u16 days) +static void sub_80EEB98(u16 days) { u8 i; @@ -2608,7 +2603,7 @@ void sub_80EEB98(u16 days) } } -void sub_80EEBF4(u8 actionIdx) +static void sub_80EEBF4(u8 actionIdx) { TVShow *show; @@ -2664,7 +2659,7 @@ void sub_80EED60(u16 delta) // PokeNews -void sub_80EED88(void) +static void sub_80EED88(void) { u8 newsKind; @@ -2715,7 +2710,7 @@ void ClearPokemonNewsI(u8 i) gSaveBlock1Ptr->pokeNews[i].days = 0; } -void sub_80EEEB8(void) +static void sub_80EEEB8(void) { u8 i; u8 j; @@ -2845,7 +2840,7 @@ bool8 sub_80EF0E4(u8 newsKind) return FALSE; } -void sub_80EF120(u16 days) +static void sub_80EF120(u16 days) { u8 i; @@ -2923,48 +2918,25 @@ void TV_PrintIntToStringVar(u8 varIdx, int value) { int nDigits; - nDigits = sub_80EF370(value); + nDigits = CountDigits(value); ConvertIntToDecimalStringN(gTVStringVarPtrs[varIdx], value, STR_CONV_MODE_LEFT_ALIGN, nDigits); } -size_t sub_80EF370(int value) +size_t CountDigits(int value) { - if (value / 10 == 0) - { - return 1; - } - if (value / 100 == 0) - { - return 2; - } - if (value / 1000 == 0) - { - return 3; - } - if (value / 10000 == 0) - { - return 4; - } - if (value / 100000 == 0) - { - return 5; - } - if (value / 1000000 == 0) - { - return 6; - } - if (value / 10000000 == 0) - { - return 7; - } - if (value / 100000000 == 0) - { - return 8; - } + if (value / 10 == 0) return 1; + if (value / 100 == 0) return 2; + if (value / 1000 == 0) return 3; + if (value / 10000 == 0) return 4; + if (value / 100000 == 0) return 5; + if (value / 1000000 == 0) return 6; + if (value / 10000000 == 0) return 7; + if (value / 100000000 == 0) return 8; + return 1; } -void sub_80EF40C(u8 varIdx, TVShow *show) +static void sub_80EF40C(u8 varIdx, TVShow *show) { u8 i; int price; @@ -3095,7 +3067,7 @@ void InterviewBefore(void) } } -void InterviewBefore_FanClubLetter(void) +static void InterviewBefore_FanClubLetter(void) { FindActiveBroadcastByShowType_SetScriptResult(TVSHOW_FAN_CLUB_LETTER); if (!gSpecialVar_Result) @@ -3105,7 +3077,7 @@ void InterviewBefore_FanClubLetter(void) } } -void InterviewBefore_RecentHappenings(void) +static void InterviewBefore_RecentHappenings(void) { FindActiveBroadcastByShowType_SetScriptResult(TVSHOW_RECENT_HAPPENINGS); if (!gSpecialVar_Result) @@ -3114,7 +3086,7 @@ void InterviewBefore_RecentHappenings(void) } } -void InterviewBefore_PkmnFanClubOpinions(void) +static void InterviewBefore_PkmnFanClubOpinions(void) { FindActiveBroadcastByShowType_SetScriptResult(TVSHOW_PKMN_FAN_CLUB_OPINIONS); if (!gSpecialVar_Result) @@ -3126,17 +3098,17 @@ void InterviewBefore_PkmnFanClubOpinions(void) } } -void InterviewBefore_Dummy(void) +static void InterviewBefore_Dummy(void) { gSpecialVar_Result = TRUE; } -void InterviewBefore_NameRater(void) +static void InterviewBefore_NameRater(void) { FindActiveBroadcastByShowType_SetScriptResult(TVSHOW_NAME_RATER_SHOW); } -void InterviewBefore_BravoTrainerPkmnProfile(void) +static void InterviewBefore_BravoTrainerPkmnProfile(void) { FindActiveBroadcastByShowType_SetScriptResult(TVSHOW_BRAVO_TRAINER_POKEMON_PROFILE); if (!gSpecialVar_Result) @@ -3145,17 +3117,17 @@ void InterviewBefore_BravoTrainerPkmnProfile(void) } } -void InterviewBefore_ContestLiveUpdates(void) +static void InterviewBefore_ContestLiveUpdates(void) { FindActiveBroadcastByShowType_SetScriptResult(TVSHOW_CONTEST_LIVE_UPDATES); } -void InterviewBefore_3CheersForPokeblocks(void) +static void InterviewBefore_3CheersForPokeblocks(void) { FindActiveBroadcastByShowType_SetScriptResult(TVSHOW_3_CHEERS_FOR_POKEBLOCKS); } -void InterviewBefore_BravoTrainerBTProfile(void) +static void InterviewBefore_BravoTrainerBTProfile(void) { FindActiveBroadcastByShowType_SetScriptResult(TVSHOW_BRAVO_TRAINER_BATTLE_TOWER_PROFILE); if (!gSpecialVar_Result) @@ -3164,7 +3136,7 @@ void InterviewBefore_BravoTrainerBTProfile(void) } } -void InterviewBefore_FanClubSpecial(void) +static void InterviewBefore_FanClubSpecial(void) { FindActiveBroadcastByShowType_SetScriptResult(TVSHOW_FAN_CLUB_SPECIAL); if (!gSpecialVar_Result) @@ -3205,7 +3177,7 @@ void DeleteTVShowInArrayByIdx(TVShow *shows, u8 idx) } } -void sub_80EF93C(TVShow *shows) +static void sub_80EF93C(TVShow *shows) { u8 i; u8 j; @@ -3277,7 +3249,7 @@ u16 TV_GetSomeOtherSpeciesAlreadySeenByPlayer(u16 passedSpecies) return species; } -void sub_80EFA88(void) +static void sub_80EFA88(void) { sCurTVShowSlot = FindEmptyTVSlotWithinFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows); gSpecialVar_0x8006 = sCurTVShowSlot; @@ -3686,7 +3658,7 @@ void sub_80F01E8(void *src, u32 size, u8 masterIdx) } } -void sub_80F0358(TVShow player1[25], TVShow player2[25], TVShow player3[25], TVShow player4[25]) +static void sub_80F0358(TVShow player1[25], TVShow player2[25], TVShow player3[25], TVShow player4[25]) { u8 i; u8 j; @@ -3734,7 +3706,7 @@ void sub_80F0358(TVShow player1[25], TVShow player2[25], TVShow player3[25], TVS } } -bool8 sub_80F049C(TVShow *dest[25], TVShow *src[25], u8 idx) +static bool8 sub_80F049C(TVShow *dest[25], TVShow *src[25], u8 idx) { u8 value; u8 switchval; @@ -3765,7 +3737,7 @@ bool8 sub_80F049C(TVShow *dest[25], TVShow *src[25], u8 idx) return FALSE; } -u8 sub_80F0580(TVShow *tv1, TVShow *tv2, u8 idx) +static bool8 sub_80F0580(TVShow *tv1, TVShow *tv2, u8 idx) { u32 linkTrainerId = GetLinkPlayerTrainerId(idx); @@ -3782,7 +3754,7 @@ u8 sub_80F0580(TVShow *tv1, TVShow *tv2, u8 idx) return TRUE; } -u8 sub_80F05E8(TVShow *tv1, TVShow *tv2, u8 idx) +static bool8 sub_80F05E8(TVShow *tv1, TVShow *tv2, u8 idx) { u32 linkTrainerId = GetLinkPlayerTrainerId(idx); if ((linkTrainerId & 0xFF) == tv2->common.srcTrainerIdLo && ((linkTrainerId >> 8) & 0xFF) == tv2->common.srcTrainerIdHi) @@ -3802,7 +3774,7 @@ u8 sub_80F05E8(TVShow *tv1, TVShow *tv2, u8 idx) return TRUE; } -u8 sub_80F0668(TVShow *tv1, TVShow *tv2, u8 idx) +static bool8 sub_80F0668(TVShow *tv1, TVShow *tv2, u8 idx) { u32 linkTrainerId = GetLinkPlayerTrainerId(idx); if ((linkTrainerId & 0xFF) == tv2->common.trainerIdLo && ((linkTrainerId >> 8) & 0xFF) == tv2->common.trainerIdHi) @@ -3819,7 +3791,7 @@ u8 sub_80F0668(TVShow *tv1, TVShow *tv2, u8 idx) return TRUE; } -s8 sub_80F06D0(TVShow *tvShows) +static s8 sub_80F06D0(TVShow *tvShows) { u8 i; @@ -3834,7 +3806,7 @@ s8 sub_80F06D0(TVShow *tvShows) } #ifdef NONMATCHING -void sub_80F0708(void) // FIXME: register allocation shenanigans +static void sub_80F0708(void) // FIXME: register allocation shenanigans { u16 i; TVShow *show; @@ -3954,13 +3926,13 @@ void sub_80F0708(void) // FIXME: register allocation shenanigans break; default: - sub_80F0B00(i); + SetTvShowInactive(i); break; } } } #else -ASM_DIRECT void sub_80F0708(void) +ASM_DIRECT static void sub_80F0708(void) { asm_unified("\tpush {r4-r7,lr}\n" "\tmov r7, r9\n" @@ -4377,7 +4349,7 @@ ASM_DIRECT void sub_80F0708(void) "\tmov r2, r9\n" "\tlsls r0, r2, 24\n" "\tlsrs r0, 24\n" - "\tbl sub_80F0B00\n" + "\tbl SetTvShowInactive\n" "_080F0AE2_break:\n" "\tmov r0, r9\n" "\tadds r0, 0x1\n" @@ -4398,12 +4370,12 @@ ASM_DIRECT void sub_80F0708(void) } #endif -void sub_80F0B00(u8 showIdx) +void SetTvShowInactive(u8 showIdx) { gSaveBlock1Ptr->tvShows[showIdx].common.active = FALSE; } -void sub_80F0B24(u16 species, u8 showIdx) +static void sub_80F0B24(u16 species, u8 showIdx) { if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), 0) == 0) { @@ -4411,7 +4383,7 @@ void sub_80F0B24(u16 species, u8 showIdx) } } -void sub_80F0B64(void) +static void sub_80F0B64(void) { u16 i; @@ -4444,7 +4416,7 @@ void sub_80F0BB8(void) } } -void sub_80F0C04(void) +static void sub_80F0C04(void) { s8 i; s8 ct; @@ -4498,7 +4470,7 @@ void sub_80F0C7C(void *src, u32 size, u8 masterIdx) } } -void sub_80F0D60(PokeNews player1[16], PokeNews player2[16], PokeNews player3[16], PokeNews player4[16]) +static void sub_80F0D60(PokeNews player1[16], PokeNews player2[16], PokeNews player3[16], PokeNews player4[16]) { u8 i; u8 j; @@ -4530,7 +4502,7 @@ void sub_80F0D60(PokeNews player1[16], PokeNews player2[16], PokeNews player3[16 } } -void sub_80F0E58(PokeNews *dest[16], PokeNews *src[16]) +static void sub_80F0E58(PokeNews *dest[16], PokeNews *src[16]) { PokeNews *ptr1; PokeNews *ptr2; @@ -4541,7 +4513,7 @@ void sub_80F0E58(PokeNews *dest[16], PokeNews *src[16]) sub_80F0E84(ptr1, ptr2, sCurTVShowSlot); } -bool8 sub_80F0E84(PokeNews *dest, PokeNews *src, s8 slot) +static bool8 sub_80F0E84(PokeNews *dest, PokeNews *src, s8 slot) { u8 i; u8 kind; @@ -4563,7 +4535,7 @@ bool8 sub_80F0E84(PokeNews *dest, PokeNews *src, s8 slot) return TRUE; } -s8 sub_80F0ECC(PokeNews *pokeNews, u8 idx) +static s8 sub_80F0ECC(PokeNews *pokeNews, u8 idx) { if (pokeNews[idx].kind == POKENEWS_NONE) { @@ -4572,7 +4544,7 @@ s8 sub_80F0ECC(PokeNews *pokeNews, u8 idx) return idx; } -void sub_80F0EEC(void) +static void sub_80F0EEC(void) { u8 i; @@ -4586,7 +4558,7 @@ void sub_80F0EEC(void) sub_80EEEB8(); } -void sub_80F0F24(void) +static void sub_80F0F24(void) { u8 i; @@ -4609,7 +4581,7 @@ else \ (langptr) = langfix; \ } -void sub_80F0F64(TVShow *show, u32 language) +static void sub_80F0F64(TVShow *show, u32 language) { int i; TVShow **r4; @@ -4691,7 +4663,7 @@ void sub_80F1208(TVShow *shows) } } -void sub_80F1254(TVShow *shows) +static void sub_80F1254(TVShow *shows) { TVShow *curShow; @@ -4716,7 +4688,7 @@ u8 TV_GetStringLanguage(u8 *str) return IsStringJapanese(str) ? LANGUAGE_JAPANESE : LANGUAGE_ENGLISH; } -void sub_80F12A4(TVShow *shows) +static void sub_80F12A4(TVShow *shows) { TVShow *curShow; @@ -4956,7 +4928,7 @@ void DoTVShow(void) } } -void DoTVShowBravoTrainerPokemonProfile(void) +static void DoTVShowBravoTrainerPokemonProfile(void) { TVShow *show; u8 state; @@ -5028,7 +5000,7 @@ void DoTVShowBravoTrainerPokemonProfile(void) ShowFieldMessage(sTVBravoTrainerTextGroup[state]); } -void DoTVShowBravoTrainerBattleTower(void) +static void DoTVShowBravoTrainerBattleTower(void) { TVShow *show; u8 state; @@ -5125,7 +5097,7 @@ void DoTVShowBravoTrainerBattleTower(void) ShowFieldMessage(sTVBravoTrainerBattleTowerTextGroup[state]); } -void DoTVShowTodaysSmartShopper(void) +static void DoTVShowTodaysSmartShopper(void) { TVShow *show; u8 state; @@ -5248,7 +5220,7 @@ void DoTVShowTodaysSmartShopper(void) ShowFieldMessage(sTVTodaysSmartShopperTextGroup[state]); } -void DoTVShowTheNameRaterShow(void) +static void DoTVShowTheNameRaterShow(void) { TVShow *show; u8 state; @@ -5346,7 +5318,7 @@ void DoTVShowTheNameRaterShow(void) ShowFieldMessage(sTVNameRaterTextGroup[state]); } -void DoTVShowPokemonTodaySuccessfulCapture(void) +static void DoTVShowPokemonTodaySuccessfulCapture(void) { TVShow *show; u8 state; @@ -5424,7 +5396,7 @@ void DoTVShowPokemonTodaySuccessfulCapture(void) ShowFieldMessage(sTVPokemonTodaySuccessfulTextGroup[state]); } -void DoTVShowPokemonTodayFailedCapture(void) +static void DoTVShowPokemonTodayFailedCapture(void) { TVShow *show; u8 state; @@ -5477,7 +5449,7 @@ void DoTVShowPokemonTodayFailedCapture(void) ShowFieldMessage(sTVPokemonTodayFailedTextGroup[state]); } -void DoTVShowPokemonFanClubLetter(void) +static void DoTVShowPokemonFanClubLetter(void) { TVShow *show; u8 state; @@ -5531,7 +5503,7 @@ void DoTVShowPokemonFanClubLetter(void) ShowFieldMessage(sTVFanClubTextGroup[state]); } -void DoTVShowRecentHappenings(void) +static void DoTVShowRecentHappenings(void) { TVShow *show; u8 state; @@ -5566,7 +5538,7 @@ void DoTVShowRecentHappenings(void) ShowFieldMessage(sTVRecentHappeninssTextGroup[state]); } -void DoTVShowPokemonFanClubOpinions(void) +static void DoTVShowPokemonFanClubOpinions(void) { TVShow *show; u8 state; @@ -5599,12 +5571,12 @@ void DoTVShowPokemonFanClubOpinions(void) ShowFieldMessage(sTVFanClubOpinionsTextGroup[state]); } -void DoTVShowDummiedOut(void) +static void DoTVShowDummiedOut(void) { } -void DoTVShowPokemonNewsMassOutbreak(void) +static void DoTVShowPokemonNewsMassOutbreak(void) { TVShow *show; @@ -5616,7 +5588,7 @@ void DoTVShowPokemonNewsMassOutbreak(void) ShowFieldMessage(sTVMassOutbreakTextGroup[sTVShowState]); } -void DoTVShowPokemonContestLiveUpdates(void) +static void DoTVShowPokemonContestLiveUpdates(void) { TVShow *show; u8 state; @@ -5963,7 +5935,7 @@ void DoTVShowPokemonContestLiveUpdates(void) ShowFieldMessage(sTVContestLiveUpdatesTextGroup[state]); } -void DoTVShowPokemonBattleUpdate(void) +static void DoTVShowPokemonBattleUpdate(void) { TVShow *show; u8 state; @@ -6035,7 +6007,7 @@ void DoTVShowPokemonBattleUpdate(void) ShowFieldMessage(sTVPokemonBattleUpdateTextGroup[state]); } -void DoTVShow3CheersForPokeblocks(void) +static void DoTVShow3CheersForPokeblocks(void) { TVShow *show; u8 state; @@ -6206,7 +6178,7 @@ void DoTVShowInSearchOfTrainers(void) ShowFieldMessage(sTVInSearchOfTrainersTextGroup[state]); } -void DoTVShowPokemonAngler(void) +static void DoTVShowPokemonAngler(void) { TVShow *show; u8 state; @@ -6240,7 +6212,7 @@ void DoTVShowPokemonAngler(void) ShowFieldMessage(sTVPokemonAnslerTextGroup[state]); } -void DoTVShowTheWorldOfMasters(void) +static void DoTVShowTheWorldOfMasters(void) { TVShow *show; u8 state; @@ -6270,7 +6242,7 @@ void DoTVShowTheWorldOfMasters(void) ShowFieldMessage(sTVWorldOfMastersTextGroup[state]); } -void DoTVShowTodaysRivalTrainer(void) +static void DoTVShowTodaysRivalTrainer(void) { TVShow *show; u8 state; @@ -6419,7 +6391,7 @@ void DoTVShowTodaysRivalTrainer(void) ShowFieldMessage(sTVTodaysRivalTrainerTextGroup[state]); } -void DoTVShowDewfordTrendWatcherNetwork(void) +static void DoTVShowDewfordTrendWatcherNetwork(void) { TVShow *show; u8 state; @@ -6475,7 +6447,7 @@ void DoTVShowDewfordTrendWatcherNetwork(void) ShowFieldMessage(sTVDewfordTrendWatcherNetworkTextGroup[state]); } -void DoTVShowHoennTreasureInvestigators(void) +static void DoTVShowHoennTreasureInvestigators(void) { TVShow *show; u8 state; @@ -6519,7 +6491,7 @@ void DoTVShowHoennTreasureInvestigators(void) ShowFieldMessage(sTVHoennTreasureInvestisatorsTextGroup[state]); } -void DoTVShowFindThatGamer(void) +static void DoTVShowFindThatGamer(void) { TVShow *show; u8 state; @@ -6593,7 +6565,7 @@ void DoTVShowFindThatGamer(void) ShowFieldMessage(sTVFindThatGamerTextGroup[state]); } -void DoTVShowBreakingNewsTV(void) +static void DoTVShowBreakingNewsTV(void) { TVShow *show; u8 state; @@ -6696,7 +6668,7 @@ void DoTVShowBreakingNewsTV(void) ShowFieldMessage(sTVBreakinsNewsTextGroup[state]); } -void DoTVShowSecretBaseVisit(void) +static void DoTVShowSecretBaseVisit(void) { TVShow *show; u8 state; @@ -6792,7 +6764,7 @@ void DoTVShowSecretBaseVisit(void) ShowFieldMessage(sTVSecretBaseVisitTextGroup[state]); } -void DoTVShowPokemonLotteryWinnerFlashReport(void) +static void DoTVShowPokemonLotteryWinnerFlashReport(void) { TVShow *show; u8 state; @@ -6822,7 +6794,7 @@ void DoTVShowPokemonLotteryWinnerFlashReport(void) ShowFieldMessage(sTVPokemonLotteryWinnerFlashReportTextGroup[state]); } -void DoTVShowThePokemonBattleSeminar(void) +static void DoTVShowThePokemonBattleSeminar(void) { TVShow *show; u8 state; @@ -6886,7 +6858,7 @@ void DoTVShowThePokemonBattleSeminar(void) ShowFieldMessage(sTVThePokemonBattleSeminarTextGroup[state]); } -void DoTVShowTrainerFanClubSpecial(void) +static void DoTVShowTrainerFanClubSpecial(void) { TVShow *show; u8 state; @@ -6951,7 +6923,7 @@ void DoTVShowTrainerFanClubSpecial(void) ShowFieldMessage(sTVTrainerFanClubSpecialTextGroup[state]); } -void DoTVShowTrainerFanClub(void) +static void DoTVShowTrainerFanClub(void) { TVShow *show; u8 state; @@ -7038,7 +7010,7 @@ void DoTVShowTrainerFanClub(void) ShowFieldMessage(sTVTrainerFanClubTextGroup[state]); } -void DoTVShowSpotTheCuties(void) +static void DoTVShowSpotTheCuties(void) { TVShow *show; u8 state; @@ -7143,7 +7115,7 @@ void DoTVShowSpotTheCuties(void) ShowFieldMessage(sTVCutiesTextGroup[state]); } -void DoTVShowPokemonNewsBattleFrontier(void) +static void DoTVShowPokemonNewsBattleFrontier(void) { TVShow *show; u8 state; @@ -7292,7 +7264,7 @@ void DoTVShowPokemonNewsBattleFrontier(void) ShowFieldMessage(sTVPokemonNewsBattleFrontierTextGroup[state]); } -void DoTVShowWhatsNo1InHoennToday(void) +static void DoTVShowWhatsNo1InHoennToday(void) { TVShow *show; u8 state; @@ -7407,7 +7379,7 @@ u8 sub_80F51AC(TVShow *show, u8 a1) return 0; } -void DoTVShowSecretBaseSecrets(void) +static void DoTVShowSecretBaseSecrets(void) { TVShow *show; u8 state; @@ -7645,7 +7617,7 @@ void DoTVShowSecretBaseSecrets(void) ShowFieldMessage(sTVSecretBaseSecretsTextGroup[state]); } -void DoTVShowSafariFanClub(void) +static void DoTVShowSafariFanClub(void) { TVShow *show; u8 state; @@ -7732,7 +7704,7 @@ void DoTVShowSafariFanClub(void) ShowFieldMessage(sTVSafariFanClubTextGroup[state]); } -void DoTVShowPokemonContestLiveUpdates2(void) +static void DoTVShowPokemonContestLiveUpdates2(void) { TVShow *show; u8 state;