Merge pull request #222 from DizzyEggg/decompile_battle_link_817C95C

Decompile battle_tv previously known as battle_link_817C95C
This commit is contained in:
Diegoisawesome 2018-02-28 18:18:51 -06:00 committed by GitHub
commit c0357cea46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 2352 additions and 5756 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3388,7 +3388,7 @@ _0813980C:
_0813981C: _0813981C:
ldrh r5, [r2] ldrh r5, [r2]
adds r0, r5, 0 adds r0, r5, 0
bl sub_80EF370 bl CountDigits
adds r3, r0, 0 adds r3, r0, 0
lsls r3, 24 lsls r3, 24
lsrs r3, 24 lsrs r3, 24
@ -3408,7 +3408,7 @@ _0813983C:
adds r4, 0x4 adds r4, 0x4
ldrh r5, [r2] ldrh r5, [r2]
adds r0, r5, 0 adds r0, r5, 0
bl sub_80EF370 bl CountDigits
adds r3, r0, 0 adds r3, r0, 0
lsls r3, 24 lsls r3, 24
lsrs r3, 24 lsrs r3, 24

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

@ -353,6 +353,91 @@ struct BattleResults
u8 catchAttempts[11]; // 0x36 u8 catchAttempts[11]; // 0x36
}; };
struct BattleTv_Side
{
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 usedMoveSlot: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 faintCause:4;
u32 faintCauseMonId:3;
u32 explosion:1;
u32 explosionMoveSlot:2;
u32 explosionMonId:3;
u32 perishSong:1;
};
struct BattleTv_Position
{
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 attackedByMonId:3;
u32 attackedByMoveSlot:2;
};
struct BattleTv_Mon
{
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 BattleTv
{
struct BattleTv_Mon mon[2][6]; // [side][partyId]
struct BattleTv_Position pos[2][2]; // [side][flank]
struct BattleTv_Side side[2]; // [side]
};
struct BattleTvMovePoints
{
s16 points[2][PARTY_SIZE * 4];
};
struct BattleStruct struct BattleStruct
{ {
u8 turnEffectsTracker; u8 turnEffectsTracker;
@ -432,7 +517,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?
@ -457,9 +542,9 @@ struct BattleStruct
u8 wishPerishSongBattlerId; u8 wishPerishSongBattlerId;
bool8 overworldWeatherDone; bool8 overworldWeatherDone;
u8 atkCancellerTracker; u8 atkCancellerTracker;
u8 field_1A4[96]; struct BattleTvMovePoints tvMovePoints;
u8 field_204[104]; struct BattleTv tv;
u8 field_26C[40]; u8 notSureWhatFieldLol[0x28];
u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT]; u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT];
u8 field_298[8]; u8 field_298[8];
u8 field_2A0; u8 field_2A0;
@ -478,6 +563,7 @@ struct BattleStruct
#define IS_MOVE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY) #define IS_MOVE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
#define IS_MOVE_SPECIAL(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_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40 #define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40
#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit #define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit

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

View File

@ -4,16 +4,16 @@
#define WINDOW_CLEAR 0x1 #define WINDOW_CLEAR 0x1
#define WINDOW_x80 0x80 #define WINDOW_x80 0x80
void AI_CalcDmg(u8 bankAtk, u8 bankDef); void AI_CalcDmg(u8 battlerIdAtk, u8 battlerIdDef);
u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef); u8 TypeCalc(u16 move, u8 battlerIdAtk, u8 battlerIdDef);
u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility); u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility);
u8 GetBattlerTurnOrderNum(u8 bank); u8 GetBattlerTurnOrderNum(u8 battlerId);
void SetMoveEffect(bool8 primary, u8 certain); void SetMoveEffect(bool8 primary, u8 certain);
void BattleDestroyYesNoCursorAt(u8 cursorPosition); void BattleDestroyYesNoCursorAt(u8 cursorPosition);
void BattleCreateYesNoCursorAt(u8 cursorPosition); void BattleCreateYesNoCursorAt(u8 cursorPosition);
void BufferMoveToLearnIntoBattleTextBuff2(void); void BufferMoveToLearnIntoBattleTextBuff2(void);
void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags); 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 void (* const gBattleScriptingCommandsTable[])(void);
extern const u8 gUnknown_0831C494[][4]; extern const u8 gUnknown_0831C494[][4];

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

@ -4,17 +4,46 @@
extern u8 *const gTVStringVarPtrs[3]; extern u8 *const gTVStringVarPtrs[3];
void ClearTVShowData(void); 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); u32 GetPlayerIDAsU32(void);
bool8 GetPriceReduction(u8 newsKind); 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); void sub_80F14F8(TVShow *shows);
size_t sub_80EF370(int value); size_t CountDigits(int value);
bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language); 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);
void SetPokemonAnglerSpecies(u16 species); void SetPokemonAnglerSpecies(u16 species);
void UpdateTVShowsPerDay(u16 days); void UpdateTVShowsPerDay(u16 days);
void PutPokemonTodayCaughtOnAir(void);
void TV_PutSecretBaseVisitOnTheAir(void);
bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language);
void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlayer, u16 speciesOpponent);
#endif //GUARD_TV_H #endif //GUARD_TV_H

View File

@ -236,7 +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);
asm/battle_link_817C95C.o(.text); src/battle_tv.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);
@ -510,7 +510,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"
@ -1413,7 +1413,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);
} }
} }
} }
@ -1477,7 +1477,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)
@ -1830,7 +1830,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"
@ -1237,7 +1237,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);
} }
} }
} }
@ -1301,7 +1301,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)
@ -1665,7 +1665,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"
@ -879,7 +879,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();
} }
} }
@ -892,7 +892,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();
} }
} }
@ -2482,7 +2482,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);
} }
} }
} }
@ -2546,7 +2546,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);
} }
@ -2573,7 +2573,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++)
@ -3067,7 +3067,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"

View File

@ -96,7 +96,6 @@ void SetUpBattleVarsAndBirchZigzagoon(void)
void sub_8032768(void) void sub_8032768(void)
{ {
s32 i; s32 i;
u8 *data;
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
sub_8184DA4(1); sub_8184DA4(1);
@ -119,11 +118,11 @@ void sub_8032768(void)
sub_81B8D64(i, 0); sub_81B8D64(i, 0);
} }
for (i = 0; i < sizeof(gBattleStruct->field_1A4); i++) for (i = 0; i < sizeof(gBattleStruct->tvMovePoints); i++)
*(gBattleStruct->field_1A4 + i) = 0; *((u8*)(&gBattleStruct->tvMovePoints) + i) = 0;
for (i = 0; i < sizeof(gBattleStruct->field_204); i++) for (i = 0; i < sizeof(gBattleStruct->tv); i++)
*(gBattleStruct->field_204 + i) = 0; *((u8*)(&gBattleStruct->tv) + i) = 0;
} }
static void InitSinglePlayerBtlControllers(void) static void InitSinglePlayerBtlControllers(void)

View File

@ -514,375 +514,375 @@ const u8 gText_Trainer2LoseText[];
const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT] = const u8 * const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{ {
gText_Trainer1LoseText, gText_Trainer1LoseText, // 12
gText_PkmnGainedEXP, gText_PkmnGainedEXP, // 13
gText_PkmnGrewToLv, gText_PkmnGrewToLv, // 14
gText_PkmnLearnedMove, gText_PkmnLearnedMove, // 15
gText_TryToLearnMove1, gText_TryToLearnMove1, // 16
gText_TryToLearnMove2, gText_TryToLearnMove2, // 17
gText_TryToLearnMove3, gText_TryToLearnMove3, // 18
gText_PkmnForgotMove, gText_PkmnForgotMove, // 19
gText_StopLearningMove, gText_StopLearningMove, // 20
gText_DidNotLearnMove, gText_DidNotLearnMove, // 21
gText_PkmnLearnedMove2, gText_PkmnLearnedMove2, // 22
gText_AttackMissed, gText_AttackMissed, // 23
gText_PkmnProtectedItself, gText_PkmnProtectedItself, // 24
gText_StatsWontIncrease2, gText_StatsWontIncrease2, // 25
gText_AvoidedDamage, gText_AvoidedDamage, // 26
gText_ItDoesntAffect, gText_ItDoesntAffect, // 27
gText_AttackerFainted, gText_AttackerFainted, // 28
gText_TargetFainted, gText_TargetFainted, // 29
gText_PlayerGotMoney, gText_PlayerGotMoney, // 30
gText_PlayerWhiteout, gText_PlayerWhiteout, // 31
gText_PlayerWhiteout2, gText_PlayerWhiteout2, // 32
gText_PreventsEscape, gText_PreventsEscape, // 33
gText_HitXTimes, gText_HitXTimes, // 34
gText_PkmnFellAsleep, gText_PkmnFellAsleep, // 35
gText_PkmnMadeSleep, gText_PkmnMadeSleep, // 36
gText_PkmnAlreadyAsleep, gText_PkmnAlreadyAsleep, // 37
gText_PkmnAlreadyAsleep2, gText_PkmnAlreadyAsleep2, // 38
gText_PkmnWasntAffected, gText_PkmnWasntAffected, // 39
gText_PkmnWasPoisoned, gText_PkmnWasPoisoned, // 40
gText_PkmnPoisonedBy, gText_PkmnPoisonedBy, // 41
gText_PkmnHurtByPoison, gText_PkmnHurtByPoison, // 42
gText_PkmnAlreadyPoisoned, gText_PkmnAlreadyPoisoned, // 43
gText_PkmnBadlyPoisoned, gText_PkmnBadlyPoisoned, // 44
gText_PkmnEnergyDrained, gText_PkmnEnergyDrained, // 45
gText_PkmnWasBurned, gText_PkmnWasBurned, // 46
gText_PkmnBurnedBy, gText_PkmnBurnedBy, // 47
gText_PkmnHurtByBurn, gText_PkmnHurtByBurn, // 48
gText_PkmnWasFrozen, gText_PkmnWasFrozen, // 49
gText_PkmnFrozenBy, gText_PkmnFrozenBy, // 50
gText_PkmnIsFrozen, gText_PkmnIsFrozen, // 51
gText_PkmnWasDefrosted, gText_PkmnWasDefrosted, // 52
gText_PkmnWasDefrosted2, gText_PkmnWasDefrosted2, // 53
gText_PkmnWasDefrostedBy, gText_PkmnWasDefrostedBy, // 54
gText_PkmnWasParalyzed, gText_PkmnWasParalyzed, // 55
gText_PkmnWasParalyzedBy, gText_PkmnWasParalyzedBy, // 56
gText_PkmnIsParalyzed, gText_PkmnIsParalyzed, // 57
gText_PkmnIsAlreadyParalyzed, gText_PkmnIsAlreadyParalyzed, // 58
gText_PkmnHealedParalysis, gText_PkmnHealedParalysis, // 59
gText_PkmnDreamEaten, gText_PkmnDreamEaten, // 60
gText_StatsWontIncrease, gText_StatsWontIncrease, // 61
gText_StatsWontDecrease, gText_StatsWontDecrease, // 62
gText_TeamStoppedWorking, gText_TeamStoppedWorking, // 63
gText_FoeStoppedWorking, gText_FoeStoppedWorking, // 64
gText_PkmnIsConfused, gText_PkmnIsConfused, // 65
gText_PkmnHealedConfusion, gText_PkmnHealedConfusion, // 66
gText_PkmnWasConfused, gText_PkmnWasConfused, // 67
gText_PkmnAlreadyConfused, gText_PkmnAlreadyConfused, // 68
gText_PkmnFellInLove, gText_PkmnFellInLove, // 69
gText_PkmnInLove, gText_PkmnInLove, // 70
gText_PkmnImmobilizedByLove, gText_PkmnImmobilizedByLove, // 71
gText_PkmnBlownAway, gText_PkmnBlownAway, // 72
gText_PkmnChangedType, gText_PkmnChangedType, // 73
gText_PkmnFlinched, gText_PkmnFlinched, // 74
gText_PkmnRegainedHealth, gText_PkmnRegainedHealth, // 75
gText_PkmnHPFull, gText_PkmnHPFull, // 76
gText_PkmnRaisedSpDef, gText_PkmnRaisedSpDef, // 77
gText_PkmnRaisedDef, gText_PkmnRaisedDef, // 78
gText_PkmnCoveredByVeil, gText_PkmnCoveredByVeil, // 79
gText_PkmnUsedSafeguard, gText_PkmnUsedSafeguard, // 80
gText_PkmnSafeguardExpired, gText_PkmnSafeguardExpired, // 81
gText_PkmnWentToSleep, gText_PkmnWentToSleep, // 82
gText_PkmnSleptHealthy, gText_PkmnSleptHealthy, // 83
gText_PkmnWhippedWhirlwind, gText_PkmnWhippedWhirlwind, // 84
gText_PkmnTookSunlight, gText_PkmnTookSunlight, // 85
gText_PkmnLoweredHead, gText_PkmnLoweredHead, // 86
gText_PkmnIsGlowing, gText_PkmnIsGlowing, // 87
gText_PkmnFlewHigh, gText_PkmnFlewHigh, // 88
gText_PkmnDugHole, gText_PkmnDugHole, // 89
gText_PkmnSqueezedByBind, gText_PkmnSqueezedByBind, // 90
gText_PkmnTrappedInVortex, gText_PkmnTrappedInVortex, // 91
gText_PkmnWrappedBy, gText_PkmnWrappedBy, // 92
gText_PkmnClamped, gText_PkmnClamped, // 93
gText_PkmnHurtBy, gText_PkmnHurtBy, // 94
gText_PkmnFreedFrom, gText_PkmnFreedFrom, // 95
gText_PkmnCrashed, gText_PkmnCrashed, // 96
gText_PkmnShroudedInMist, gText_PkmnShroudedInMist, // 97
gText_PkmnProtectedByMist, gText_PkmnProtectedByMist, // 98
gText_PkmnGettingPumped, gText_PkmnGettingPumped, // 99
gText_PkmnHitWithRecoil, gText_PkmnHitWithRecoil, // 100
gText_PkmnProtectedItself2, gText_PkmnProtectedItself2, // 101
gText_PkmnBuffetedBySandstorm, gText_PkmnBuffetedBySandstorm, // 102
gText_PkmnPeltedByHail, gText_PkmnPeltedByHail, // 103
gText_PkmnSeeded, gText_PkmnSeeded, // 104
gText_PkmnEvadedAttack, gText_PkmnEvadedAttack, // 105
gText_PkmnSappedByLeechSeed, gText_PkmnSappedByLeechSeed, // 106
gText_PkmnFastAsleep, gText_PkmnFastAsleep, // 107
gText_PkmnWokeUp, gText_PkmnWokeUp, // 108
gText_PkmnUproarKeptAwake, gText_PkmnUproarKeptAwake, // 109
gText_PkmnWokeUpInUproar, gText_PkmnWokeUpInUproar, // 110
gText_PkmnCausedUproar, gText_PkmnCausedUproar, // 111
gText_PkmnMakingUproar, gText_PkmnMakingUproar, // 112
gText_PkmnCalmedDown, gText_PkmnCalmedDown, // 113
gText_PkmnCantSleepInUproar, gText_PkmnCantSleepInUproar, // 114
gText_PkmnStockpiled, gText_PkmnStockpiled, // 115
gText_PkmnCantStockpile, gText_PkmnCantStockpile, // 116
gText_PkmnCantSleepInUproar2, gText_PkmnCantSleepInUproar2, // 117
gText_UproarKeptPkmnAwake, gText_UproarKeptPkmnAwake, // 118
gText_PkmnStayedAwakeUsing, gText_PkmnStayedAwakeUsing, // 119
gText_PkmnStoringEnergy, gText_PkmnStoringEnergy, // 120
gText_PkmnUnleashedEnergy, gText_PkmnUnleashedEnergy, // 121
gText_PkmnFatigueConfusion, gText_PkmnFatigueConfusion, // 122
gText_PkmnPickedUpItem, gText_PkmnPickedUpItem, // 123
gText_PkmnUnaffected, gText_PkmnUnaffected, // 124
gText_PkmnTransformedInto, gText_PkmnTransformedInto, // 125
gText_PkmnMadeSubstitute, gText_PkmnMadeSubstitute, // 126
gText_PkmnHasSubstitute, gText_PkmnHasSubstitute, // 127
gText_SubstituteDamaged, gText_SubstituteDamaged, // 128
gText_PkmnSubstituteFaded, gText_PkmnSubstituteFaded, // 129
gText_PkmnMustRecharge, gText_PkmnMustRecharge, // 130
gText_PkmnRageBuilding, gText_PkmnRageBuilding, // 131
gText_PkmnMoveWasDisabled, gText_PkmnMoveWasDisabled, // 132
gText_PkmnMoveIsDisabled, gText_PkmnMoveIsDisabled, // 133
gText_PkmnMoveDisabledNoMore, gText_PkmnMoveDisabledNoMore, // 134
gText_PkmnGotEncore, gText_PkmnGotEncore, // 135
gText_PkmnEncoreEnded, gText_PkmnEncoreEnded, // 136
gText_PkmnTookAim, gText_PkmnTookAim, // 137
gText_PkmnSketchedMove, gText_PkmnSketchedMove, // 138
gText_PkmnTryingToTakeFoe, gText_PkmnTryingToTakeFoe, // 139
gText_PkmnTookFoe, gText_PkmnTookFoe, // 140
gText_PkmnReducedPP, gText_PkmnReducedPP, // 141
gText_PkmnStoleItem, gText_PkmnStoleItem, // 142
gText_TargetCantEscapeNow, gText_TargetCantEscapeNow, // 143
gText_PkmnFellIntoNightmare, gText_PkmnFellIntoNightmare, // 144
gText_PkmnLockedInNightmare, gText_PkmnLockedInNightmare, // 145
gText_PkmnLaidCurse, gText_PkmnLaidCurse, // 146
gText_PkmnAfflictedByCurse, gText_PkmnAfflictedByCurse, // 147
gText_SpikesScattered, gText_SpikesScattered, // 148
gText_PkmnHurtBySpikes, gText_PkmnHurtBySpikes, // 149
gText_PkmnIdentified, gText_PkmnIdentified, // 150
gText_PkmnPerishCountFell, gText_PkmnPerishCountFell, // 151
gText_PkmnBracedItself, gText_PkmnBracedItself, // 152
gText_PkmnEnduredHit, gText_PkmnEnduredHit, // 153
gText_MagnitudeStrength, gText_MagnitudeStrength, // 154
gText_PkmnCutHPMaxedAttack, gText_PkmnCutHPMaxedAttack, // 155
gText_PkmnCopiedStatChanges, gText_PkmnCopiedStatChanges, // 156
gText_PkmnGotFree, gText_PkmnGotFree, // 157
gText_PkmnShedLeechSeed, gText_PkmnShedLeechSeed, // 158
gText_PkmnBlewAwaySpikes, gText_PkmnBlewAwaySpikes, // 159
gText_PkmnFledFromBattle, gText_PkmnFledFromBattle, // 160
gText_PkmnForesawAttack, gText_PkmnForesawAttack, // 161
gText_PkmnTookAttack, gText_PkmnTookAttack, // 162
gText_PkmnAttack, gText_PkmnAttack, // 163
gText_PkmnCenterAttention, gText_PkmnCenterAttention, // 164
gText_PkmnChargingPower, gText_PkmnChargingPower, // 165
gText_NaturePowerTurnedInto, gText_NaturePowerTurnedInto, // 166
gText_PkmnStatusNormal, gText_PkmnStatusNormal, // 167
gText_PkmnHasNoMovesLeft, gText_PkmnHasNoMovesLeft, // 168
gText_PkmnSubjectedToTorment, gText_PkmnSubjectedToTorment, // 169
gText_PkmnCantUseMoveTorment, gText_PkmnCantUseMoveTorment, // 170
gText_PkmnTighteningFocus, gText_PkmnTighteningFocus, // 171
gText_PkmnFellForTaunt, gText_PkmnFellForTaunt, // 172
gText_PkmnCantUseMoveTaunt, gText_PkmnCantUseMoveTaunt, // 173
gText_PkmnReadyToHelp, gText_PkmnReadyToHelp, // 174
gText_PkmnSwitchedItems, gText_PkmnSwitchedItems, // 175
gText_PkmnCopiedFoe, gText_PkmnCopiedFoe, // 176
gText_PkmnMadeWish, gText_PkmnMadeWish, // 177
gText_PkmnWishCameTrue, gText_PkmnWishCameTrue, // 178
gText_PkmnPlantedRoots, gText_PkmnPlantedRoots, // 179
gText_PkmnAbsorbedNutrients, gText_PkmnAbsorbedNutrients, // 180
gText_PkmnAnchoredItself, gText_PkmnAnchoredItself, // 181
gText_PkmnWasMadeDrowsy, gText_PkmnWasMadeDrowsy, // 182
gText_PkmnKnockedOff, gText_PkmnKnockedOff, // 183
gText_PkmnSwappedAbilities, gText_PkmnSwappedAbilities, // 184
gText_PkmnSealedOpponentMove, gText_PkmnSealedOpponentMove, // 185
gText_PkmnCantUseMoveSealed, gText_PkmnCantUseMoveSealed, // 186
gText_PkmnWantsGrudge, gText_PkmnWantsGrudge, // 187
gText_PkmnLostPPGrudge, gText_PkmnLostPPGrudge, // 188
gText_PkmnShroudedItself, gText_PkmnShroudedItself, // 189
gText_PkmnMoveBounced, gText_PkmnMoveBounced, // 190
gText_PkmnWaitsForTarget, gText_PkmnWaitsForTarget, // 191
gText_PkmnSnatchedMove, gText_PkmnSnatchedMove, // 192
gText_PkmnMadeItRain, gText_PkmnMadeItRain, // 193
gText_PkmnRaisedSpeed, gText_PkmnRaisedSpeed, // 194
gText_PkmnProtectedBy, gText_PkmnProtectedBy, // 195
gText_PkmnPreventsUsage, gText_PkmnPreventsUsage, // 196
gText_PkmnRestoredHPUsing, gText_PkmnRestoredHPUsing, // 197
gText_PkmnChangedTypeWith, gText_PkmnChangedTypeWith, // 198
gText_PkmnPreventsParalysisWith, gText_PkmnPreventsParalysisWith, // 199
gText_PkmnPreventsRomanceWith, gText_PkmnPreventsRomanceWith, // 200
gText_PkmnPreventsPoisoningWith, gText_PkmnPreventsPoisoningWith, // 201
gText_PkmnPreventsConfusionWith, gText_PkmnPreventsConfusionWith, // 202
gText_PkmnRaisedFirePowerWith, gText_PkmnRaisedFirePowerWith, // 203
gText_PkmnAnchorsItselfWith, gText_PkmnAnchorsItselfWith, // 204
gText_PkmnCutsAttackWith, gText_PkmnCutsAttackWith, // 205
gText_PkmnPreventsStatLossWith, gText_PkmnPreventsStatLossWith, // 206
gText_PkmnHurtsWith, gText_PkmnHurtsWith, // 207
gText_PkmnTraced, gText_PkmnTraced, // 208
gText_StatSharply, gText_StatSharply, // 209
gText_StatRose, gText_StatRose, // 210
gText_StatHarshly, gText_StatHarshly, // 211
gText_StatFell, gText_StatFell, // 212
gText_PkmnsStatChanged, gText_PkmnsStatChanged, // 213
gText_PkmnsStatChanged2, gText_PkmnsStatChanged2, // 214
gText_PkmnsStatChanged3, gText_PkmnsStatChanged3, // 215
gText_PkmnsStatChanged4, gText_PkmnsStatChanged4, // 216
gText_CriticalHit, gText_CriticalHit, // 217
gText_OneHitKO, gText_OneHitKO, // 218
gText_123Poof, gText_123Poof, // 219
gText_AndEllipsis, gText_AndEllipsis, // 220
gText_NotVeryEffective, gText_NotVeryEffective, // 221
gText_SuperEffective, gText_SuperEffective, // 222
gText_GotAwaySafely, gText_GotAwaySafely, // 223
gText_WildPkmnFled, gText_WildPkmnFled, // 224
gText_NoRunningFromTrainers, gText_NoRunningFromTrainers, // 225
gText_CantEscape, gText_CantEscape, // 226
gText_DontLeaveBirch, gText_DontLeaveBirch, // 227
gText_ButNothingHappened, gText_ButNothingHappened, // 228
gText_ButItFailed, gText_ButItFailed, // 229
gText_ItHurtConfusion, gText_ItHurtConfusion, // 230
gText_MirrorMoveFailed, gText_MirrorMoveFailed, // 231
gText_StartedToRain, gText_StartedToRain, // 232
gText_DownpourStarted, gText_DownpourStarted, // 233
gText_RainContinues, gText_RainContinues, // 234
gText_DownpourContinues, gText_DownpourContinues, // 235
gText_RainStopped, gText_RainStopped, // 236
gText_SandstormBrewed, gText_SandstormBrewed, // 237
gText_SandstormRages, gText_SandstormRages, // 238
gText_SandstormSubsided, gText_SandstormSubsided, // 239
gText_SunlightGotBright, gText_SunlightGotBright, // 240
gText_SunlightStrong, gText_SunlightStrong, // 241
gText_SunlightFaded, gText_SunlightFaded, // 242
gText_StartedHail, gText_StartedHail, // 243
gText_HailContinues, gText_HailContinues, // 244
gText_HailStopped, gText_HailStopped, // 245
gText_FailedToSpitUp, gText_FailedToSpitUp, // 246
gText_FailedToSwallow, gText_FailedToSwallow, // 247
gText_WindBecameHeatWave, gText_WindBecameHeatWave, // 248
gText_StatChangesGone, gText_StatChangesGone, // 249
gText_CoinsScattered, gText_CoinsScattered, // 250
gText_TooWeakForSubstitute, gText_TooWeakForSubstitute, // 251
gText_SharedPain, gText_SharedPain, // 252
gText_BellChimed, gText_BellChimed, // 253
gText_FaintInThree, gText_FaintInThree, // 254
gText_NoPPLeft, gText_NoPPLeft, // 255
gText_ButNoPPLeft, gText_ButNoPPLeft, // 256
gText_PlayerUsedItem, gText_PlayerUsedItem, // 257
gText_WallyUsedItem, gText_WallyUsedItem, // 258
gText_TrainerBlockedBall, gText_TrainerBlockedBall, // 259
gText_DontBeAThief, gText_DontBeAThief, // 260
gText_ItDodgedBall, gText_ItDodgedBall, // 261
gText_YouMissedPkmn, gText_YouMissedPkmn, // 262
gText_PkmnBrokeFree, gText_PkmnBrokeFree, // 263
gText_ItAppearedCaught, gText_ItAppearedCaught, // 264
gText_AarghAlmostHadIt, gText_AarghAlmostHadIt, // 265
gText_ShootSoClose, gText_ShootSoClose, // 266
gText_GotchaPkmnCaught, gText_GotchaPkmnCaught, // 267
gText_GotchaPkmnCaught2, gText_GotchaPkmnCaught2, // 268
gText_GiveNicknameCaptured, gText_GiveNicknameCaptured, // 269
gText_PkmnSentToPC, gText_PkmnSentToPC, // 270
gText_PkmnDataAddedToDex, gText_PkmnDataAddedToDex, // 271
gText_ItIsRaining, gText_ItIsRaining, // 272
gText_SandstormIsRaging, gText_SandstormIsRaging, // 273
gText_CantEscape2, gText_CantEscape2, // 274
gText_PkmnIgnoresAsleep, gText_PkmnIgnoresAsleep, // 275
gText_PkmnIgnoredOrders, gText_PkmnIgnoredOrders, // 276
gText_PkmnBeganToNap, gText_PkmnBeganToNap, // 277
gText_PkmnLoafing, gText_PkmnLoafing, // 278
gText_PkmnWontObey, gText_PkmnWontObey, // 279
gText_PkmnTurnedAway, gText_PkmnTurnedAway, // 280
gText_PkmnPretendNotNotice, gText_PkmnPretendNotNotice, // 281
gText_EnemyAboutToSwitchPkmn, gText_EnemyAboutToSwitchPkmn, // 282
gText_CreptCloser, gText_CreptCloser, // 283
gText_CantGetCloser, gText_CantGetCloser, // 284
gText_PkmnWatchingCarefully, gText_PkmnWatchingCarefully, // 285
gText_PkmnCuriousAboutX, gText_PkmnCuriousAboutX, // 286
gText_PkmnEnthralledByX, gText_PkmnEnthralledByX, // 287
gText_PkmnIgnoredX, gText_PkmnIgnoredX, // 288
gText_ThrewPokeblockAtPkmn, gText_ThrewPokeblockAtPkmn, // 289
gText_OutOfSafariBalls, gText_OutOfSafariBalls, // 290
gText_PkmnsItemCuredParalysis, gText_PkmnsItemCuredParalysis, // 291
gText_PkmnsItemCuredPoison, gText_PkmnsItemCuredPoison, // 292
gText_PkmnsItemHealedBurn, gText_PkmnsItemHealedBurn, // 293
gText_PkmnsItemDefrostedIt, gText_PkmnsItemDefrostedIt, // 294
gText_PkmnsItemWokeIt, gText_PkmnsItemWokeIt, // 295
gText_PkmnsItemSnappedOut, gText_PkmnsItemSnappedOut, // 296
gText_PkmnsItemCuredProblem, gText_PkmnsItemCuredProblem, // 297
gText_PkmnsItemRestoredHealth, gText_PkmnsItemRestoredHealth, // 298
gText_PkmnsItemRestoredPP, gText_PkmnsItemRestoredPP, // 299
gText_PkmnsItemRestoredStatus, gText_PkmnsItemRestoredStatus, // 300
gText_PkmnsItemRestoredHPALittle, gText_PkmnsItemRestoredHPALittle, // 301
gText_ItemAllowsOnlyYMove, gText_ItemAllowsOnlyYMove, // 302
gText_PkmnHungOnWithX, gText_PkmnHungOnWithX, // 303
gText_EmptyString3, gText_EmptyString3, // 304
gText_PkmnsXPreventsBurns, gText_PkmnsXPreventsBurns, // 305
gText_PkmnsXBlocksY, gText_PkmnsXBlocksY, // 306
gText_PkmnsXRestoredHPALittle2, gText_PkmnsXRestoredHPALittle2, // 307
gText_PkmnsXWhippedUpSandstorm, gText_PkmnsXWhippedUpSandstorm, // 308
gText_PkmnsXPreventsYLoss, gText_PkmnsXPreventsYLoss, // 309
gText_PkmnsXInfatuatedY, gText_PkmnsXInfatuatedY, // 310
gText_PkmnsXMadeYIneffective, gText_PkmnsXMadeYIneffective, // 311
gText_PkmnsXCuredYProblem, gText_PkmnsXCuredYProblem, // 312
gText_ItSuckedLiquidOoze, gText_ItSuckedLiquidOoze, // 313
gText_PkmnTransformed, gText_PkmnTransformed, // 314
gText_ElectricityWeakened, gText_ElectricityWeakened, // 315
gText_FireWeakened, gText_FireWeakened, // 316
gText_PkmnHidUnderwater, gText_PkmnHidUnderwater, // 317
gText_PkmnSprangUp, gText_PkmnSprangUp, // 318
gText_HMMovesCantBeForgotten, gText_HMMovesCantBeForgotten, // 319
gText_XFoundOneY, gText_XFoundOneY, // 320
gText_PlayerDefeatedLinkTrainerTrainer1, gText_PlayerDefeatedLinkTrainerTrainer1, // 321
gText_SoothingAroma, gText_SoothingAroma, // 322
gText_ItemsCantBeUsedNow, gText_ItemsCantBeUsedNow, // 323
gText_ForXCommaYZ, gText_ForXCommaYZ, // 324
gText_UsingXTheYOfZN, gText_UsingXTheYOfZN, // 325
gText_PkmnUsedXToGetPumped, gText_PkmnUsedXToGetPumped, // 326
gText_PkmnsXMadeYUseless, gText_PkmnsXMadeYUseless, // 327
gText_PkmnTrappedBySandTomb, gText_PkmnTrappedBySandTomb, // 328
gText_EmptyString4, gText_EmptyString4, // 329
gText_ABoosted, gText_ABoosted, // 330
gText_PkmnsXIntensifiedSun, gText_PkmnsXIntensifiedSun, // 331
gText_PkmnMakesGroundMiss, gText_PkmnMakesGroundMiss, // 332
gText_YouThrowABallNowRight, gText_YouThrowABallNowRight, // 333
gText_PkmnsXTookAttack, gText_PkmnsXTookAttack, // 334
gText_PkmnChoseXAsDestiny, gText_PkmnChoseXAsDestiny, // 335
gText_PkmnLostFocus, gText_PkmnLostFocus, // 336
gText_UseNextPkmn, gText_UseNextPkmn, // 337
gText_PkmnFledUsingIts, gText_PkmnFledUsingIts, // 338
gText_PkmnFledUsing, gText_PkmnFledUsing, // 339
gText_PkmnWasDraggedOut, gText_PkmnWasDraggedOut, // 340
gText_PreventedFromWorking, gText_PreventedFromWorking, // 341
gText_PkmnsItemNormalizedStatus, gText_PkmnsItemNormalizedStatus, // 342
gText_Trainer1UsedItem, gText_Trainer1UsedItem, // 343
gText_BoxIsFull, gText_BoxIsFull, // 344
gText_PkmnAvoidedAttack, gText_PkmnAvoidedAttack, // 345
gText_PkmnsXMadeItIneffective, gText_PkmnsXMadeItIneffective, // 346
gText_PkmnsXPreventsFlinching, gText_PkmnsXPreventsFlinching, // 347
gText_PkmnAlreadyHasBurn, gText_PkmnAlreadyHasBurn, // 348
gText_StatsWontDecrease2, gText_StatsWontDecrease2, // 349
gText_PkmnsXBlocksY2, gText_PkmnsXBlocksY2, // 350
gText_PkmnsXWoreOff, gText_PkmnsXWoreOff, // 351
gText_PkmnRaisedDefALittle, gText_PkmnRaisedDefALittle, // 352
gText_PkmnRaisedSpDefALittle, gText_PkmnRaisedSpDefALittle, // 353
gText_TheWallShattered, gText_TheWallShattered, // 354
gText_PkmnsXPreventsYsZ, gText_PkmnsXPreventsYsZ, // 355
gText_PkmnsXCuredItsYProblem, gText_PkmnsXCuredItsYProblem, // 356
gText_AttackerCantEscape, gText_AttackerCantEscape, // 357
gText_PkmnObtainedX, gText_PkmnObtainedX, // 358
gText_PkmnObtainedX2, gText_PkmnObtainedX2, // 359
gText_PkmnObtainedXYObtainedZ, gText_PkmnObtainedXYObtainedZ, // 360
gText_ButNoEffect, gText_ButNoEffect, // 361
gText_PkmnsXHadNoEffectOnY, gText_PkmnsXHadNoEffectOnY, // 362
gText_TwoInGameTrainersDefeated, gText_TwoInGameTrainersDefeated, // 363
gText_Trainer2LoseText, gText_Trainer2LoseText, // 364
gText_PkmnIncapableOfPower, gText_PkmnIncapableOfPower, // 365
gText_GlintAppearsInEye, gText_GlintAppearsInEye, // 366
gText_PkmnGettingIntoPosition, gText_PkmnGettingIntoPosition, // 367
gText_PkmnBeganGrowlingDeeply, gText_PkmnBeganGrowlingDeeply, // 368
gText_PkmnEagerForMore, gText_PkmnEagerForMore, // 369
gText_DefeatedOpponentByReferee, gText_DefeatedOpponentByReferee, // 370
gText_LostToOpponentByReferee, gText_LostToOpponentByReferee, // 371
gText_TiedOpponentByReferee, gText_TiedOpponentByReferee, // 372
gText_QuestionForfeitMatch, gText_QuestionForfeitMatch, // 373
gText_ForfeitedMatch, gText_ForfeitedMatch, // 374
gText_PkmnTransferredSomeonesPC, gText_PkmnTransferredSomeonesPC, // 375
gText_PkmnTransferredLanettesPC, gText_PkmnTransferredLanettesPC, // 376
gText_PkmnBoxSomeonesPCFull, gText_PkmnBoxSomeonesPCFull, // 377
gText_PkmnBoxLanettesPCFull, gText_PkmnBoxLanettesPCFull, // 378
gText_Trainer1WinText, gText_Trainer1WinText, // 379
gText_Trainer2WinText, gText_Trainer2WinText, // 380
}; };
const u16 gMissStringIds[] = const u16 gMissStringIds[] =

1576
src/battle_tv.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2198,7 +2198,7 @@ void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
(var) /= (gStatStageRatios)[(mon)->statStages[(statIndex)]][1]; \ (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; u32 i;
s32 damage = 0; s32 damage = 0;
@ -2228,8 +2228,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (attacker->item == ITEM_ENIGMA_BERRY) if (attacker->item == ITEM_ENIGMA_BERRY)
{ {
attackerHoldEffect = gEnigmaBerries[bankAtk].holdEffect; attackerHoldEffect = gEnigmaBerries[battlerIdAtk].holdEffect;
attackerHoldEffectParam = gEnigmaBerries[bankAtk].holdEffectParam; attackerHoldEffectParam = gEnigmaBerries[battlerIdAtk].holdEffectParam;
} }
else else
{ {
@ -2239,8 +2239,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (defender->item == ITEM_ENIGMA_BERRY) if (defender->item == ITEM_ENIGMA_BERRY)
{ {
defenderHoldEffect = gEnigmaBerries[bankDef].holdEffect; defenderHoldEffect = gEnigmaBerries[battlerIdDef].holdEffect;
defenderHoldEffectParam = gEnigmaBerries[bankDef].holdEffectParam; defenderHoldEffectParam = gEnigmaBerries[battlerIdDef].holdEffectParam;
} }
else else
{ {
@ -2251,13 +2251,13 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
if (attacker->ability == ABILITY_HUGE_POWER || attacker->ability == ABILITY_PURE_POWER) if (attacker->ability == ABILITY_HUGE_POWER || attacker->ability == ABILITY_PURE_POWER)
attack *= 2; attack *= 2;
if (ShouldGetStatBadgeBoost(FLAG_BADGE01_GET, bankAtk)) if (ShouldGetStatBadgeBoost(FLAG_BADGE01_GET, battlerIdAtk))
attack = (110 * attack) / 100; attack = (110 * attack) / 100;
if (ShouldGetStatBadgeBoost(FLAG_BADGE05_GET, bankDef)) if (ShouldGetStatBadgeBoost(FLAG_BADGE05_GET, battlerIdDef))
defense = (110 * defense) / 100; defense = (110 * defense) / 100;
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, bankAtk)) if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerIdAtk))
spAttack = (110 * spAttack) / 100; spAttack = (110 * spAttack) / 100;
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, bankDef)) if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerIdDef))
spDefense = (110 * spDefense) / 100; spDefense = (110 * spDefense) / 100;
for (i = 0; i < ARRAY_COUNT(sHoldEffectToType); i++) for (i = 0; i < ARRAY_COUNT(sHoldEffectToType); i++)
@ -2442,7 +2442,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
} }
// flash fire triggered // 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; damage = (15 * damage) / 10;
} }

View File

@ -1612,7 +1612,7 @@ bool8 ScrCmd_buffernumberstring(struct ScriptContext *ctx)
{ {
u8 stringVarIndex = ScriptReadByte(ctx); u8 stringVarIndex = ScriptReadByte(ctx);
u16 v1 = VarGet(ScriptReadHalfword(ctx)); u16 v1 = VarGet(ScriptReadHalfword(ctx));
u8 v2 = sub_80EF370(v1); u8 v2 = CountDigits(v1);
ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], v1, 0, v2); ConvertIntToDecimalStringN(sScriptStringVars[stringVarIndex], v1, 0, v2);
return FALSE; return FALSE;

483
src/tv.c

File diff suppressed because it is too large Load Diff