decompile and document battle tv

This commit is contained in:
DizzyEggg 2018-02-27 20:40:09 +01:00
parent a9212eeb66
commit 59ff4aec9b
17 changed files with 1649 additions and 1793 deletions

View File

@ -1,246 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_817F21C
sub_817F21C: @ 817F21C
push {r4-r7,lr}
adds r6, r1, 0
mov r12, r2
lsls r0, 16
lsrs r2, r0, 16
ldr r1, =gBattleMoves
lsls r0, r2, 1
adds r0, r2
lsls r0, 2
adds r0, r1
ldrb r0, [r0, 0x1]
cmp r0, 0
beq _0817F286
movs r4, 0
ldr r5, =gUnknown_0860A4AC
ldr r7, =0x0000ffff
adds r3, r5, 0
adds r1, r5, 0
_0817F240:
ldrh r0, [r1]
cmp r2, r0
beq _0817F252
adds r3, 0x2
adds r1, 0x2
adds r4, 0x1
ldrh r0, [r3]
cmp r0, r7
bne _0817F240
_0817F252:
lsls r0, r4, 1
adds r0, r5
ldrh r1, [r0]
ldr r0, =0x0000ffff
cmp r1, r0
beq _0817F270
movs r0, 0
str r0, [r6]
b _0817F2A0
.pool
_0817F270:
cmp r2, 0x95
bne _0817F294
ldr r2, =gBattleMons
ldr r0, =gBattlerAttacker
ldrb r1, [r0]
movs r0, 0x58
muls r0, r1
adds r0, r2
adds r0, 0x2A
ldrb r0, [r0]
asrs r0, 1
_0817F286:
str r0, [r6]
movs r0, 0
b _0817F2A0
.pool
_0817F294:
cmp r2, 0xDE
bne _0817F29E
movs r0, 0xA
mov r1, r12
strh r0, [r1]
_0817F29E:
movs r0, 0x1
_0817F2A0:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_817F21C
thumb_func_start sub_817F2A8
sub_817F2A8: @ 817F2A8
push {r4,r5,lr}
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x2
ands r0, r1
cmp r0, 0
beq _0817F324
ldr r0, =gBattleStruct
ldr r3, [r0]
ldr r0, =0x0000025b
adds r4, r3, r0
ldrb r2, [r4]
subs r1, 0x21
adds r0, r1, 0
ands r0, r2
strb r0, [r4]
ldr r0, =0x00000267
adds r2, r3, r0
ldrb r0, [r2]
ands r1, r0
strb r1, [r2]
ldrb r5, [r4]
movs r1, 0x1F
adds r0, r1, 0
ands r0, r5
strb r0, [r4]
ldrb r0, [r2]
ands r1, r0
strb r1, [r2]
movs r0, 0x97
lsls r0, 2
adds r4, r3, r0
ldrb r2, [r4]
movs r1, 0x39
negs r1, r1
adds r0, r1, 0
ands r0, r2
strb r0, [r4]
movs r0, 0x9A
lsls r0, 2
adds r3, r0
ldrb r0, [r3]
ands r1, r0
strb r1, [r3]
ldrb r2, [r4]
movs r1, 0x7
negs r1, r1
adds r0, r1, 0
ands r0, r2
strb r0, [r4]
ldrb r0, [r3]
ands r1, r0
strb r1, [r3]
ldrb r2, [r4]
movs r1, 0x2
negs r1, r1
adds r0, r1, 0
ands r0, r2
strb r0, [r4]
ldrb r0, [r3]
ands r1, r0
strb r1, [r3]
_0817F324:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_817F2A8
thumb_func_start GetBattlerMoveSlotId
GetBattlerMoveSlotId: @ 817F33C
push {r4-r7,lr}
lsls r0, 24
lsrs r5, r0, 24
lsls r1, 16
lsrs r7, r1, 16
adds r0, r5, 0
bl GetBattlerSide
lsls r0, 24
ldr r6, =gEnemyParty
cmp r0, 0
bne _0817F356
ldr r6, =gPlayerParty
_0817F356:
movs r4, 0
ldr r1, =gBattlerPartyIndexes
lsls r0, r5, 1
adds r5, r0, r1
b _0817F36E
.pool
_0817F36C:
adds r4, 0x1
_0817F36E:
cmp r4, 0x3
bgt _0817F388
ldrh r1, [r5]
movs r0, 0x64
muls r0, r1
adds r0, r6, r0
adds r1, r4, 0
adds r1, 0xD
movs r2, 0
bl GetMonData
cmp r0, r7
bne _0817F36C
_0817F388:
lsls r0, r4, 24
lsrs r0, 24
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end GetBattlerMoveSlotId
thumb_func_start sub_817F394
sub_817F394: @ 817F394
push {r4-r6,lr}
lsls r0, 16
lsrs r3, r0, 16
adds r4, r3, 0
lsls r1, 16
lsrs r1, 16
adds r6, r1, 0
lsls r2, 24
lsrs r2, 24
adds r5, r2, 0
movs r0, 0x7
ands r0, r3
cmp r0, 0
beq _0817F3B4
movs r0, 0x3
b _0817F3CA
_0817F3B4:
movs r0, 0x60
ands r0, r3
cmp r0, 0
beq _0817F3C0
movs r0, 0x4
b _0817F3CA
_0817F3C0:
movs r0, 0x18
ands r0, r3
cmp r0, 0
beq _0817F3D2
movs r0, 0x5
_0817F3CA:
movs r3, 0
bl sub_817E684
b _0817F3E6
_0817F3D2:
movs r0, 0x80
ands r4, r0
cmp r4, 0
beq _0817F3E6
movs r0, 0x6
adds r1, r6, 0
adds r2, r5, 0
movs r3, 0
bl sub_817E684
_0817F3E6:
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_817F394
.align 2, 0 @ Don't pad with nop.

View File

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

View File

@ -368,7 +368,7 @@ struct BattleResults
u8 catchAttempts[11]; // 0x36 u8 catchAttempts[11]; // 0x36
}; };
struct BattleLinkStringSide struct BattleTv_Side
{ {
u32 spikesMonId:3; u32 spikesMonId:3;
u32 reflectMonId:3; u32 reflectMonId:3;
@ -380,7 +380,7 @@ struct BattleLinkStringSide
u32 perishSongMonId:3; u32 perishSongMonId:3;
u32 wishMonId:3; u32 wishMonId:3;
u32 grudgeMonId:3; u32 grudgeMonId:3;
u32 field_8_6:2; u32 usedMoveSlot:2;
u32 spikesMoveSlot:2; u32 spikesMoveSlot:2;
u32 reflectMoveSlot:2; u32 reflectMoveSlot:2;
u32 lightScreenMoveSlot:2; u32 lightScreenMoveSlot:2;
@ -393,18 +393,15 @@ struct BattleLinkStringSide
u32 grudgeMoveSlot:2; u32 grudgeMoveSlot:2;
u32 destinyBondMonId:3; u32 destinyBondMonId:3;
u32 destinyBondMoveSlot:2; u32 destinyBondMoveSlot:2;
u32 field_3_0:4; u32 faintCause:4;
u32 field_3_1:3; u32 faintCauseMonId:3;
u32 explosion:1; u32 explosion:1;
u32 explosionMoveSlot:2; u32 explosionMoveSlot:2;
u32 explosionMonId:3; u32 explosionMonId:3;
u32 perishSong:1; u32 perishSong:1;
u32 field_4_2:1;
u32 field_5_0:3;
u32 field_5_1:2;
}; };
struct BattleLinkStringPosition struct BattleTv_Position
{ {
u32 curseMonId:3; u32 curseMonId:3;
u32 leechSeedMonId:3; u32 leechSeedMonId:3;
@ -424,11 +421,11 @@ struct BattleLinkStringPosition
u32 mudSportMoveSlot:2; u32 mudSportMoveSlot:2;
u32 ingrainMonId:3; u32 ingrainMonId:3;
u32 ingrainMoveSlot:2; u32 ingrainMoveSlot:2;
u32 field_5_5:3; u32 attackedByMonId:3;
u32 field_6_0:2; u32 attackedByMoveSlot:2;
}; };
struct BattleLinkStringMon struct BattleTv_Mon
{ {
u32 psnMonId:3; u32 psnMonId:3;
u32 badPsnMonId:3; u32 badPsnMonId:3;
@ -444,16 +441,16 @@ struct BattleLinkStringMon
u32 frzMoveSlot:2; u32 frzMoveSlot:2;
}; };
struct UnknownBattleLinkStruct struct BattleTv
{ {
struct BattleLinkStringMon mon[2][6]; // [side][partyId] struct BattleTv_Mon mon[2][6]; // [side][partyId]
struct BattleLinkStringPosition pos[2][2]; // [side][flank] struct BattleTv_Position pos[2][2]; // [side][flank]
struct BattleLinkStringSide side[2]; // [side] struct BattleTv_Side side[2]; // [side]
}; };
struct UnknownBattleLinkArrayStruct struct BattleTvMovePoints
{ {
s16 unk0[2][6*4]; s16 points[2][PARTY_SIZE * 4];
}; };
struct BattleStruct struct BattleStruct
@ -535,7 +532,7 @@ struct BattleStruct
u8 field_B0; u8 field_B0;
u8 hpScale; u8 hpScale;
u8 synchronizeMoveEffect; u8 synchronizeMoveEffect;
u8 field_B3; bool8 anyMonHasTransformed;
void (*savedCallback)(void); void (*savedCallback)(void);
u16 usedHeldItems[MAX_BATTLERS_COUNT]; u16 usedHeldItems[MAX_BATTLERS_COUNT];
u8 chosenItem[4]; // why is this an u8? u8 chosenItem[4]; // why is this an u8?
@ -560,8 +557,8 @@ struct BattleStruct
u8 wishPerishSongBattlerId; u8 wishPerishSongBattlerId;
bool8 overworldWeatherDone; bool8 overworldWeatherDone;
u8 atkCancellerTracker; u8 atkCancellerTracker;
struct UnknownBattleLinkArrayStruct field_1A4; struct BattleTvMovePoints tvMovePoints;
struct UnknownBattleLinkStruct field_204; struct BattleTv tv;
u8 notSureWhatFieldLol[0x28]; u8 notSureWhatFieldLol[0x28];
u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT]; u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT];
u8 field_298[8]; u8 field_298[8];

View File

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

11
include/battle_tv.h Normal file
View File

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

View File

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

View File

@ -38,5 +38,6 @@ void sub_80EECC8(void);
void sub_80EECEC(void); void sub_80EECEC(void);
void sub_80F1208(TVShow *shows); void sub_80F1208(TVShow *shows);
void sub_80EE44C(u8 nMonsCaught, u8 nPkblkUsed); void sub_80EE44C(u8 nMonsCaught, u8 nPkblkUsed);
void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlayer, u16 speciesOpponent);
#endif //GUARD_TV_H #endif //GUARD_TV_H

View File

@ -236,8 +236,7 @@ SECTIONS {
src/evolution_graphics.o(.text); src/evolution_graphics.o(.text);
src/bard_music.o(.text); src/bard_music.o(.text);
src/fldeff_teleport.o(.text); src/fldeff_teleport.o(.text);
src/battle_link_817C95C.o(.text); src/battle_tv.o(.text);
asm/battle_link_817C95C.o(.text);
src/pokemon_animation.o(.text); src/pokemon_animation.o(.text);
src/recorded_battle.o(.text); src/recorded_battle.o(.text);
src/battle_controller_recorded_opponent.o(.text); src/battle_controller_recorded_opponent.o(.text);
@ -512,7 +511,7 @@ SECTIONS {
src/intro_credits_graphics.o(.rodata); src/intro_credits_graphics.o(.rodata);
src/evolution_graphics.o(.rodata); src/evolution_graphics.o(.rodata);
src/bard_music.o(.rodata); src/bard_music.o(.rodata);
data/battle_link_817C95C.o(.rodata); src/battle_tv.o(.rodata);
src/pokemon_animation.o(.rodata); src/pokemon_animation.o(.rodata);
src/battle_controller_recorded_opponent.o(.rodata); src/battle_controller_recorded_opponent.o(.rodata);
src/battle_controller_recorded_player.o(.rodata); src/battle_controller_recorded_player.o(.rodata);

View File

@ -6,7 +6,7 @@
#include "battle_anim.h" #include "battle_anim.h"
#include "constants/battle_anim.h" #include "constants/battle_anim.h"
#include "battle_ai_script_commands.h" #include "battle_ai_script_commands.h"
#include "battle_link_817C95C.h" #include "battle_tv.h"
#include "pokemon.h" #include "pokemon.h"
#include "link.h" #include "link.h"
#include "util.h" #include "util.h"
@ -1414,7 +1414,7 @@ static void LinkOpponentHandleMoveAnimation(void)
{ {
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = LinkOpponentDoMoveAnimation; gBattlerControllerFuncs[gActiveBattler] = LinkOpponentDoMoveAnimation;
sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
} }
} }
} }
@ -1478,7 +1478,7 @@ static void LinkOpponentHandlePrintString(void)
BufferStringBattle(*stringId); BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
sub_817C95C(*stringId); BattleTv_SetDataBasedOnString(*stringId);
} }
static void LinkOpponentHandlePrintSelectionString(void) static void LinkOpponentHandlePrintSelectionString(void)
@ -1831,7 +1831,7 @@ static void LinkOpponentHandleBattleAnimation(void)
else else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
sub_817E32C(animationId); BattleTv_SetDataBasedOnAnimation(animationId);
} }
} }

View File

@ -6,7 +6,7 @@
#include "battle_anim.h" #include "battle_anim.h"
#include "constants/battle_anim.h" #include "constants/battle_anim.h"
#include "battle_ai_script_commands.h" #include "battle_ai_script_commands.h"
#include "battle_link_817C95C.h" #include "battle_tv.h"
#include "pokemon.h" #include "pokemon.h"
#include "link.h" #include "link.h"
#include "util.h" #include "util.h"
@ -1238,7 +1238,7 @@ static void LinkPartnerHandleMoveAnimation(void)
{ {
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = LinkPartnerDoMoveAnimation; gBattlerControllerFuncs[gActiveBattler] = LinkPartnerDoMoveAnimation;
sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
} }
} }
} }
@ -1302,7 +1302,7 @@ static void LinkPartnerHandlePrintString(void)
BufferStringBattle(*stringId); BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter; gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
sub_817C95C(*stringId); BattleTv_SetDataBasedOnString(*stringId);
} }
static void LinkPartnerHandlePrintSelectionString(void) static void LinkPartnerHandlePrintSelectionString(void)
@ -1666,7 +1666,7 @@ static void LinkPartnerHandleBattleAnimation(void)
else else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
sub_817E32C(animationId); BattleTv_SetDataBasedOnAnimation(animationId);
} }
} }

View File

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

View File

@ -5,7 +5,7 @@
#include "battle_interface.h" #include "battle_interface.h"
#include "battle_anim.h" #include "battle_anim.h"
#include "constants/battle_anim.h" #include "constants/battle_anim.h"
#include "battle_link_817C95C.h" #include "battle_tv.h"
#include "pokemon.h" #include "pokemon.h"
#include "link.h" #include "link.h"
#include "util.h" #include "util.h"
@ -881,7 +881,7 @@ static void sub_80586F8(void)
gMain.callback1 = gPreBattleCallback1; gMain.callback1 = gPreBattleCallback1;
SetMainCallback2(sub_8038D64); SetMainCallback2(sub_8038D64);
if (gBattleOutcome == B_OUTCOME_WON) if (gBattleOutcome == B_OUTCOME_WON)
sub_817E3F4(); TryPutLinkBattleTvShowOnAir();
FreeAllWindowBuffers(); FreeAllWindowBuffers();
} }
} }
@ -894,7 +894,7 @@ static void sub_80586F8(void)
gMain.callback1 = gPreBattleCallback1; gMain.callback1 = gPreBattleCallback1;
SetMainCallback2(sub_8038D64); SetMainCallback2(sub_8038D64);
if (gBattleOutcome == B_OUTCOME_WON) if (gBattleOutcome == B_OUTCOME_WON)
sub_817E3F4(); TryPutLinkBattleTvShowOnAir();
FreeAllWindowBuffers(); FreeAllWindowBuffers();
} }
} }
@ -2484,7 +2484,7 @@ static void PlayerHandleMoveAnimation(void)
{ {
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = PlayerDoMoveAnimation; gBattlerControllerFuncs[gActiveBattler] = PlayerDoMoveAnimation;
sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr); BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
} }
} }
} }
@ -2548,7 +2548,7 @@ static void PlayerHandlePrintString(void)
BufferStringBattle(*stringId); BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2; gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2;
sub_817C95C(*stringId); BattleTv_SetDataBasedOnString(*stringId);
sub_81A57E4(gActiveBattler, *stringId); sub_81A57E4(gActiveBattler, *stringId);
} }
@ -2575,7 +2575,7 @@ static void PlayerHandleChooseAction(void)
s32 i; s32 i;
gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3; gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3;
sub_817F2A8(); BattleTv_ClearExplosionFaintCause();
BattleHandleAddTextPrinter(gText_BattleMenu, 2); BattleHandleAddTextPrinter(gText_BattleMenu, 2);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -3069,7 +3069,7 @@ static void PlayerHandleBattleAnimation(void)
else else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation; gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
sub_817E32C(animationId); BattleTv_SetDataBasedOnAnimation(animationId);
} }
} }

View File

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

View File

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

File diff suppressed because it is too large Load Diff

1585
src/battle_tv.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1276,7 +1276,7 @@ static void InterviewAfter_ContestLiveUpdates(void)
} }
} }
void PutBattleUpdateOnTheAir(u8 a0, u16 a1, u16 a2, u16 a3) void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlayer, u16 speciesOpponent)
{ {
TVShow *show; TVShow *show;
u8 name[32]; u8 name[32];
@ -1303,21 +1303,21 @@ void PutBattleUpdateOnTheAir(u8 a0, u16 a1, u16 a2, u16 a3)
{ {
show->battleUpdate.battleType = 0; show->battleUpdate.battleType = 0;
} }
show->battleUpdate.move = a1; show->battleUpdate.move = move;
show->battleUpdate.species2 = a2; show->battleUpdate.speciesPlayer = speciesPlayer;
show->battleUpdate.species = a3; show->battleUpdate.speciesOpponent = speciesOpponent;
StringCopy(name, gLinkPlayers[a0].name); StringCopy(name, gLinkPlayers[opponentLinkPlayerId].name);
StripExtCtrlCodes(name); StripExtCtrlCodes(name);
StringCopy(show->battleUpdate.linkOpponentName, name); StringCopy(show->battleUpdate.linkOpponentName, name);
tv_store_id_2x(show); tv_store_id_2x(show);
show->battleUpdate.language = gGameLanguage; show->battleUpdate.language = gGameLanguage;
if (show->battleUpdate.language == LANGUAGE_JAPANESE || gLinkPlayers[a0].language == LANGUAGE_JAPANESE) if (show->battleUpdate.language == LANGUAGE_JAPANESE || gLinkPlayers[opponentLinkPlayerId].language == LANGUAGE_JAPANESE)
{ {
show->battleUpdate.linkOpponentLanguage = LANGUAGE_JAPANESE; show->battleUpdate.linkOpponentLanguage = LANGUAGE_JAPANESE;
} }
else else
{ {
show->battleUpdate.linkOpponentLanguage = gLinkPlayers[a0].language; show->battleUpdate.linkOpponentLanguage = gLinkPlayers[opponentLinkPlayerId].language;
} }
} }
} }
@ -3822,8 +3822,8 @@ static void sub_80F0708(void) // FIXME: register allocation shenanigans
case TVSHOW_3_CHEERS_FOR_POKEBLOCKS: case TVSHOW_3_CHEERS_FOR_POKEBLOCKS:
break; break;
case TVSHOW_BATTLE_UPDATE: case TVSHOW_BATTLE_UPDATE:
sub_80F0B24((&gSaveBlock1Ptr->tvShows[i])->battleUpdate.species2, i); sub_80F0B24((&gSaveBlock1Ptr->tvShows[i])->battleUpdate.speciesPlayer, i);
sub_80F0B24((&gSaveBlock1Ptr->tvShows[i])->battleUpdate.species, i); sub_80F0B24((&gSaveBlock1Ptr->tvShows[i])->battleUpdate.speciesOpponent, i);
break; break;
case TVSHOW_FAN_CLUB_SPECIAL: case TVSHOW_FAN_CLUB_SPECIAL:
break; break;
@ -5972,13 +5972,13 @@ static void DoTVShowPokemonBattleUpdate(void)
break; break;
case 2: case 2:
TVShowConvertInternationalString(gStringVar1, show->battleUpdate.playerName, show->battleUpdate.language); TVShowConvertInternationalString(gStringVar1, show->battleUpdate.playerName, show->battleUpdate.language);
StringCopy(gStringVar2, gSpeciesNames[show->battleUpdate.species2]); StringCopy(gStringVar2, gSpeciesNames[show->battleUpdate.speciesPlayer]);
StringCopy(gStringVar3, gMoveNames[show->battleUpdate.move]); StringCopy(gStringVar3, gMoveNames[show->battleUpdate.move]);
sTVShowState = 3; sTVShowState = 3;
break; break;
case 3: case 3:
TVShowConvertInternationalString(gStringVar1, show->battleUpdate.linkOpponentName, show->battleUpdate.linkOpponentLanguage); TVShowConvertInternationalString(gStringVar1, show->battleUpdate.linkOpponentName, show->battleUpdate.linkOpponentLanguage);
StringCopy(gStringVar2, gSpeciesNames[show->battleUpdate.species]); StringCopy(gStringVar2, gSpeciesNames[show->battleUpdate.speciesOpponent]);
sTVShowState = 4; sTVShowState = 4;
break; break;
case 4: case 4:
@ -5993,14 +5993,14 @@ static void DoTVShowPokemonBattleUpdate(void)
break; break;
case 6: case 6:
TVShowConvertInternationalString(gStringVar1, show->battleUpdate.playerName, show->battleUpdate.language); TVShowConvertInternationalString(gStringVar1, show->battleUpdate.playerName, show->battleUpdate.language);
StringCopy(gStringVar2, gSpeciesNames[show->battleUpdate.species2]); StringCopy(gStringVar2, gSpeciesNames[show->battleUpdate.speciesPlayer]);
StringCopy(gStringVar3, gMoveNames[show->battleUpdate.move]); StringCopy(gStringVar3, gMoveNames[show->battleUpdate.move]);
sTVShowState = 7; sTVShowState = 7;
break; break;
case 7: case 7:
TVShowConvertInternationalString(gStringVar1, show->battleUpdate.playerName, show->battleUpdate.language); TVShowConvertInternationalString(gStringVar1, show->battleUpdate.playerName, show->battleUpdate.language);
TVShowConvertInternationalString(gStringVar2, show->battleUpdate.linkOpponentName, show->battleUpdate.linkOpponentLanguage); TVShowConvertInternationalString(gStringVar2, show->battleUpdate.linkOpponentName, show->battleUpdate.linkOpponentLanguage);
StringCopy(gStringVar3, gSpeciesNames[show->battleUpdate.species]); StringCopy(gStringVar3, gSpeciesNames[show->battleUpdate.speciesOpponent]);
TVShowDone(); TVShowDone();
break; break;
} }