diff --git a/asm/include/overlay_12_battle_system.inc b/asm/include/overlay_12_battle_system.inc deleted file mode 100644 index 9bc5714c5..000000000 --- a/asm/include/overlay_12_battle_system.inc +++ /dev/null @@ -1,222 +0,0 @@ -#include -#pragma once -.public FontID_String_GetWidth -.public PaletteData_GetUnfadedBuf -.public Sound_SetMasterVolume -.public Sound_Stop -.public PlaySE -.public GF_IsAnySEPlaying -.public PlayFanfare -.public IsFanfarePlaying -.public NewMsgDataFromNarc -.public DestroyMsgData -.public NewString_ReadMsgData -.public BufferBoxMonSpeciesName -.public BufferBoxMonNickname -.public BufferIntegerAsString -.public BufferMoveName -.public BufferAbilityName -.public BufferItemName -.public BufferTypeName -.public BufferStatName -.public BufferStatusName -.public BufferFlavorDislikeText -.public BufferTrainerClassNameFromDataStruct -.public BufferTrainerNameFromDataStruct -.public BufferPCBoxName -.public StringExpandPlaceholders -.public BeginNormalPaletteFade -.public MailMsg_GetExpandedString -.public AllocFromHeap -.public BG_LoadCharTilesData -.public FillWindowPixelBuffer -.public AddTextPrinterParameterized -.public sub_02024B1C -.public GF_AssertFail -.public String_Delete -.public String_Copy -.public PlayerProfile_GetTrainerGender -.public PlayerProfile_CountBadges -.public PlayerProfile_GetMoney -.public PlayerProfile_GetVersion -.public Pokedex_CheckMonCaughtFlag -.public Pokedex_SetMonSeenFlag -.public Pokedex_SetMonCaughtFlag -.public Options_GetTextFrameDelay -.public Options_GetBattleScene -.public Options_GetBattleStyle -.public Options_GetFrame -.public GameStats_Inc -.public GameStats_AddSpecial -.public sub_02030260 -.public sub_0203027C -.public GetMonData -.public SetMonData -.public AddMonData -.public GetMonEvolution -.public Party_GetMaxLevel -.public MaskOfFlagNo -.public GetTrainerMessageByIdPair -.public Party_GetCount -.public Party_GetMonByIndex -.public GetItemAttr -.public BallToItemId -.public ApplyItemEffectOnMonMood -.public MIi_CpuCopy32 -.public _s32_div_f -.public _u32_div_f -.public BattleSystem_GetBgConfig -.public BattleSystem_GetWindow -.public BattleSystem_GetBattleType -.public BattleSystem_GetBattleContext -.public BattleSystem_GetOpponentData -.public BattleSystem_GetMaxBattlers -.public BattleSystem_GetParty -.public BattleSystem_GetPartySize -.public BattleSystem_GetPartyMon -.public ov12_0223A8D4 -.public ov12_0223A8DC -.public ov12_0223A8E4 -.public ov12_0223A8EC -.public ov12_0223A8F4 -.public ov12_0223A900 -.public ov12_0223A908 -.public ov12_0223A914 -.public BattleSystem_GetHpFont -.public BattleSystem_GetLevelFont -.public BattleSystem_GetMessageData -.public ov12_0223A934 -.public BattleSystem_GetPaletteData -.public BattleSystem_GetPokedex -.public BattleSystem_GetSendBufferPtr -.public BattleSystem_GetRecvBufferPtr -.public ov12_0223A954 -.public ov12_0223A960 -.public ov12_0223A96C -.public ov12_0223A978 -.public ov12_0223A984 -.public ov12_0223A990 -.public ov12_0223A99C -.public BattleSystem_GetMessageFormat -.public BattleSystem_GetMessageBuffer -.public BattleSystem_GetTrainerIndex -.public BattleSystem_GetTrainer -.public BattleSystem_GetPlayerProfile -.public BattleSystem_GetBag -.public BattleSystem_GetBagCursor -.public BattleSystem_GetMonBall -.public ov12_0223AAB8 -.public BattleSystem_GetTrainerGender -.public ov12_0223AAD8 -.public ov12_0223AB0C -.public BattleSystem_GetFieldSide -.public BattleSystem_GetMessageIcon -.public BattleSystem_GetPcStorage -.public BattleSystem_GetTerrainId -.public ov12_0223AB54 -.public BattleSystem_GetLocation -.public BattleSystem_GetBattlerIdPartner -.public ov12_0223ABB8 -.public BattleSystem_RecoverStatus -.public BattleSystem_GetBattleSpecial -.public BattleSystem_GetTimezone -.public ov12_0223B52C -.public ov12_0223B580 -.public BattleSystem_CheckEvolution -.public ov12_0223B688 -.public ov12_0223B694 -.public BattleSystem_GetSafariBallCount -.public BattleSystem_SetSafariBallCount -.public BattleSystem_GetOptions -.public BattleSystem_AreBattleAnimationsOn -.public BattleSystem_GetFrame -.public BattleSystem_GetTextFrameDelay -.public BattleSystem_GetBattleStyle -.public ov12_0223B750 -.public BattleSystem_GetChatotVoice -.public BattleSystem_TryChangeForm -.public ov12_0223B854 -.public ov12_0223B870 -.public BattleSystem_SetBackground -.public ov12_0223BAD0 -.public ov12_0223BAD8 -.public ov12_0223BAE0 -.public ov12_0223BAEC -.public BattleSystem_GetWeather -.public ov12_0223BB04 -.public ov12_0223BB10 -.public ov12_0223BB1C -.public BattleSystem_GameStatIncrement -.public ov12_0223BB44 -.public ov12_0223BB64 -.public ov12_0223BB6C -.public ov12_0223BB78 -.public ov12_0223BB80 -.public ov12_0223BB88 -.public ov12_0223BB94 -.public ov12_0223BBA8 -.public ov12_0223BBC0 -.public ov12_0223BBD8 -.public ov12_0223BBF0 -.public ov12_0223BBFC -.public ov12_0223BC08 -.public ov12_0223BC14 -.public ov12_0223BC20 -.public ov12_0223BC2C -.public BattleSystem_GetHpBar -.public BattleSystem_HpBar_Init -.public BattleSystem_SetHpBarEnabled -.public BattleSystem_SetHpBarDisabled -.public BattleSystem_HpBar_Delete -.public BattleSystem_GetBattleOutcomeFlags -.public BattleSystem_SetBattleOutcomeFlags -.public BattleSystem_GetCriticalHpMusicFlag -.public BattleSystem_SetCriticalHpMusicFlag -.public BattleSystem_GetCriticalHpMusicDelay -.public BattleSystem_SetCriticalHpMusicDelay -.public ov12_0223BD8C -.public BattleSystem_Random -.public BattleSystem_GetRandTemp -.public BattleSystem_SetRandTemp -.public ov12_0223BDDC -.public ov12_0223BE0C -.public ov12_0223BE68 -.public ov12_0223BF14 -.public ov12_0223BFC0 -.public ov12_0223BFCC -.public BattleSystem_GetTrainerItem -.public ov12_0223BFEC -.public ov12_0223BFFC -.public ov12_0223C080 -.public ov12_0223C0C4 -.public BattleSystem_GetChatotVoiceParam -.public ov12_0223C134 -.public ov12_0223C140 -.public ov12_0223C1A0 -.public ov12_0223C1C4 -.public ov12_0223C1F4 -.public ov12_0223C224 -.public CalcMoneyLoss -.public BattleSystem_SetPokedexSeen -.public BattleSystem_SetPokedexCaught -.public BattleSystem_CheckMonCaught -.public BattleSystem_SetDefaultBlend -.public BattleSystem_PrintTrainerMessage -.public BattleSystem_PrintBattleMessage -.public ov12_0223C4E8 -.public GetBattlerVar -.public SetBattlerVar -.public AddBattlerVar -.public ov12_022581D4 -.public ov12_022582B8 -.public ov12_02261258 -.public ov12_02261270 -.public OpponentData_GetHpBar -.public BattleHpBar_LoadResources -.public BattleHpBar_FreeResources -.public ov12_02264EE0 -.public BattleHpBar_SetEnabled -.public ov12_02265B64 -.public ov12_02266008 -.public ov12_0226AA8C -.public ov12_0226BEC4 diff --git a/asm/overlay_12_battle_system.s b/asm/overlay_12_battle_system.s deleted file mode 100644 index af117d27a..000000000 --- a/asm/overlay_12_battle_system.s +++ /dev/null @@ -1,221 +0,0 @@ -#include "constants/pokemon.h" -#include "constants/sndseq.h" - .include "asm/macros.inc" - .include "overlay_12_battle_system.inc" - .include "global.inc" - - .text - - thumb_func_start BattleMessage_BufferNumber -BattleMessage_BufferNumber: ; 0x0223CE0C - push {r3, lr} - sub sp, #8 - mov r3, #0 - str r3, [sp] - mov r3, #1 - str r3, [sp, #4] - ldr r0, [r0, #0x14] - mov r3, #5 - bl BufferIntegerAsString - add sp, #8 - pop {r3, pc} - thumb_func_end BattleMessage_BufferNumber - - thumb_func_start BattleMessage_BufferNumbers -BattleMessage_BufferNumbers: ; 0x0223CE24 - push {r4, lr} - sub sp, #8 - cmp r3, #0 - beq _0223CE3C - mov r4, #1 - str r4, [sp] - str r4, [sp, #4] - ldr r0, [r0, #0x14] - bl BufferIntegerAsString - add sp, #8 - pop {r4, pc} -_0223CE3C: - mov r3, #1 - str r3, [sp] - str r3, [sp, #4] - ldr r0, [r0, #0x14] - mov r3, #5 - bl BufferIntegerAsString - add sp, #8 - pop {r4, pc} - .balign 4, 0 - thumb_func_end BattleMessage_BufferNumbers - - thumb_func_start BattleMessage_BufferType -BattleMessage_BufferType: ; 0x0223CE50 - ldr r3, _0223CE58 ; =BufferTypeName - ldr r0, [r0, #0x14] - bx r3 - nop -_0223CE58: .word BufferTypeName - thumb_func_end BattleMessage_BufferType - - thumb_func_start BattleMessage_BufferAbility -BattleMessage_BufferAbility: ; 0x0223CE5C - ldr r3, _0223CE64 ; =BufferAbilityName - ldr r0, [r0, #0x14] - bx r3 - nop -_0223CE64: .word BufferAbilityName - thumb_func_end BattleMessage_BufferAbility - - thumb_func_start BattleMessage_BufferStat -BattleMessage_BufferStat: ; 0x0223CE68 - ldr r3, _0223CE70 ; =BufferStatName - ldr r0, [r0, #0x14] - bx r3 - nop -_0223CE70: .word BufferStatName - thumb_func_end BattleMessage_BufferStat - - thumb_func_start BattleMessage_BufferStatus -BattleMessage_BufferStatus: ; 0x0223CE74 - ldr r3, _0223CE7C ; =BufferStatusName - ldr r0, [r0, #0x14] - bx r3 - nop -_0223CE7C: .word BufferStatusName - thumb_func_end BattleMessage_BufferStatus - - thumb_func_start BattleMessage_BufferPokemon -BattleMessage_BufferPokemon: ; 0x0223CE80 - push {r3, r4, r5, lr} - mov r3, #0xff - lsl r3, r3, #8 - add r4, r1, #0 - lsl r1, r2, #0x18 - and r2, r3 - add r5, r0, #0 - lsr r1, r1, #0x18 - asr r2, r2, #8 - bl BattleSystem_GetPartyMon - add r2, r0, #0 - ldr r0, [r5, #0x14] - add r1, r4, #0 - bl BufferBoxMonSpeciesName - pop {r3, r4, r5, pc} - .balign 4, 0 - thumb_func_end BattleMessage_BufferPokemon - - thumb_func_start BattleMessage_BufferPoffin -BattleMessage_BufferPoffin: ; 0x0223CEA4 - bx lr - .balign 4, 0 - thumb_func_end BattleMessage_BufferPoffin - - thumb_func_start BattleMessage_BufferFlavorPreference -BattleMessage_BufferFlavorPreference: ; 0x0223CEA8 - ldr r3, _0223CEB0 ; =BufferFlavorDislikeText - ldr r0, [r0, #0x14] - bx r3 - nop -_0223CEB0: .word BufferFlavorDislikeText - thumb_func_end BattleMessage_BufferFlavorPreference - - thumb_func_start BattleMessage_BufferTrainerClass -BattleMessage_BufferTrainerClass: ; 0x0223CEB4 - push {r3, r4, r5, lr} - add r4, r1, #0 - add r5, r0, #0 - add r1, r2, #0 - bl BattleSystem_GetTrainer - add r2, r0, #0 - ldr r0, [r5, #0x14] - add r1, r4, #0 - bl BufferTrainerClassNameFromDataStruct - pop {r3, r4, r5, pc} - thumb_func_end BattleMessage_BufferTrainerClass - - thumb_func_start BattleMessage_BufferTrainerName -BattleMessage_BufferTrainerName: ; 0x0223CECC - push {r3, r4, r5, lr} - add r4, r1, #0 - add r5, r0, #0 - add r1, r2, #0 - bl BattleSystem_GetTrainer - add r2, r0, #0 - ldr r0, [r5, #0x14] - add r1, r4, #0 - bl BufferTrainerNameFromDataStruct - pop {r3, r4, r5, pc} - thumb_func_end BattleMessage_BufferTrainerName - - thumb_func_start BattleMessage_BufferBoxName -BattleMessage_BufferBoxName: ; 0x0223CEE4 - push {r4, lr} - add r4, r0, #0 - add r3, r2, #0 - ldr r0, [r4, #0x14] - ldr r2, [r4, #0x64] - bl BufferPCBoxName - pop {r4, pc} - thumb_func_end BattleMessage_BufferBoxName - - thumb_func_start ov12_0223CEF4 -ov12_0223CEF4: ; 0x0223CEF4 - push {r3, r4, r5, lr} - add r5, r0, #0 - add r0, r1, #0 - ldrh r1, [r2, #2] - bl NewString_ReadMsgData - add r4, r0, #0 - ldr r0, [r5, #0x14] - ldr r1, [r5, #0x18] - add r2, r4, #0 - bl StringExpandPlaceholders - add r0, r4, #0 - bl String_Delete - pop {r3, r4, r5, pc} - thumb_func_end ov12_0223CEF4 - - thumb_func_start ov12_0223CF14 -ov12_0223CF14: ; 0x0223CF14 - push {r4, lr} - mov r4, #0 - cmp r1, #5 - bhi _0223CF5C - add r0, r1, r1 - add r0, pc - ldrh r0, [r0, #6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_0223CF28: ; jump table - .short _0223CF5C - _0223CF28 - 2 ; case 0 - .short _0223CF34 - _0223CF28 - 2 ; case 1 - .short _0223CF3C - _0223CF28 - 2 ; case 2 - .short _0223CF44 - _0223CF28 - 2 ; case 3 - .short _0223CF4C - _0223CF28 - 2 ; case 4 - .short _0223CF54 - _0223CF28 - 2 ; case 5 -_0223CF34: - bl GF_IsAnySEPlaying - add r4, r0, #0 - b _0223CF5C -_0223CF3C: - bl IsFanfarePlaying - add r4, r0, #0 - b _0223CF5C -_0223CF44: - ldr r0, _0223CF60 ; =0x000004A3 - bl PlayFanfare - b _0223CF5C -_0223CF4C: - ldr r0, _0223CF64 ; =0x000005E6 - bl PlaySE - b _0223CF5C -_0223CF54: - mov r0, #0x4a - lsl r0, r0, #4 - bl PlayFanfare -_0223CF5C: - add r0, r4, #0 - pop {r4, pc} - .balign 4, 0 -_0223CF60: .word 0x000004A3 -_0223CF64: .word 0x000005E6 - thumb_func_end ov12_0223CF14 diff --git a/include/battle/battle_022378C0.h b/include/battle/battle_022378C0.h index e06220d38..030ca51fe 100644 --- a/include/battle/battle_022378C0.h +++ b/include/battle/battle_022378C0.h @@ -31,5 +31,6 @@ void ov12_0223A620(BattleSystem *bsys); //the following functions aren't static/haven't been checked to their status and are yet to be decompiled void ov12_02238A30(BgConfig *config); void ov12_02238A64(BattleSystem *bsys); +void ov12_02237ED0(BattleSystem *bsys, int a1); #endif diff --git a/include/battle/battle_02265E28.h b/include/battle/battle_02265E28.h new file mode 100644 index 000000000..73866e7ce --- /dev/null +++ b/include/battle/battle_02265E28.h @@ -0,0 +1,8 @@ +#ifndef POKEHEARTGOLD_BATTLE_02265E28_H +#define POKEHEARTGOLD_BATTLE_02265E28_H + +#include "battle.h" + +void ov12_02266008(UnkBattleSystemSub17C *a0); + +#endif diff --git a/include/battle/battle_controller.h b/include/battle/battle_controller.h index 2bf3a5573..b0bb89716 100644 --- a/include/battle/battle_controller.h +++ b/include/battle/battle_controller.h @@ -77,5 +77,6 @@ void ov12_02263564(BattleSystem *bsys, BattleContext *ctx, int battlerId, u32 a3 void ov12_0226399C(BattleSystem *bsys, int battlerId); void ov12_02263A1C(BattleSystem *bsys, BattleContext *ctx, int battlerId); void ov12_02263D14(BattleSystem *bsys, int battlerId, u32 a2, int slot); +void ov12_022642F0(BattleSystem *bsys); #endif diff --git a/include/battle/battle_controller_opponent.h b/include/battle/battle_controller_opponent.h index 188a5c556..5cf6139ae 100644 --- a/include/battle/battle_controller_opponent.h +++ b/include/battle/battle_controller_opponent.h @@ -6,5 +6,6 @@ u8 ov12_02261258(OpponentData *opponentData); void *ov12_02261270(OpponentData *opponentData); u32 ov12_02261264(OpponentData *opponentData); +BattleHpBar *OpponentData_GetHpBar(OpponentData *opponentData); #endif diff --git a/include/battle/battle_system.h b/include/battle/battle_system.h index 02c9c2c8b..404b4ea9c 100644 --- a/include/battle/battle_system.h +++ b/include/battle/battle_system.h @@ -147,30 +147,4 @@ u8 BattleSystem_PrintTrainerMessage(BattleSystem *bsys, int trainerId, int battl u32 BattleSystem_PrintBattleMessage(BattleSystem *bsys, MsgData *data, BattleMessage *msg, u8 delay); u32 ov12_0223C4E8(BattleSystem *bsys, Window *window, MsgData *data, BattleMessage *msg, int x, int y, int flag, int width, int delay); -//These functions haven't been decompiled -BOOL Link_QueueNotEmpty(BattleContext *ctx); -void ov12_02237ED0(BattleSystem *bsys, int a1); -void ov12_022642F0(BattleSystem *bsys); -BOOL ov12_022581BC(BattleSystem *bsys, BattleContext *ctx); -void ov12_02263A1C(BattleSystem *bsys, BattleContext *ctx, int battlerId); -void ov12_02266008(UnkBattleSystemSub17C *a0); -BattleHpBar *OpponentData_GetHpBar(OpponentData *opponentData); -void ov12_0226AA8C(u32 *a1, u32 flag); -BOOL ov12_0223CF14(struct TextPrinterTemplate *template, u16 glyphId); - -//These functions haven't been decompiled AND are confirmed to be static -void ov12_0223CEF4(BattleSystem *bsys, MsgData *data, BattleMessage *msg); -void BattleMessage_BufferStat(BattleSystem *bsys, int a1, int param); -void BattleMessage_BufferNumber(BattleSystem *bsys, int a1, int param); -void BattleMessage_BufferNumbers(BattleSystem *bsys, int a1, int param, int a3); -void BattleMessage_BufferTrainerName(BattleSystem *bsys, int a1, int param); -void BattleMessage_BufferAbility(BattleSystem *bsys, int a1, int param); -void BattleMessage_BufferType(BattleSystem *bsys, int a1, int param); -void BattleMessage_BufferPokemon(BattleSystem *bsys, int a1, int param); -void BattleMessage_BufferPoffin(BattleSystem *bsys, int a1, int param); -void BattleMessage_BufferTrainerClass(BattleSystem *bsys, int a1, int param); -void BattleMessage_BufferBoxName(BattleSystem *bsys, int a1, int param); -void BattleMessage_BufferStatus(BattleSystem *bsys, int a1, int param); -void BattleMessage_BufferFlavorPreference(BattleSystem *bsys, int a1, int param); - #endif diff --git a/include/battle/overlay_12_02266024.h b/include/battle/overlay_12_02266024.h index 57b0ef454..2c4c259be 100644 --- a/include/battle/overlay_12_02266024.h +++ b/include/battle/overlay_12_02266024.h @@ -10,5 +10,6 @@ BOOL ov12_02266B78(u32 *a0); void ov12_02266390(void *); void ov12_02266508(NARC *a0, NARC *a1, void *a2, int a3, BOOL a4, void *a5); void ov12_02266644(NARC *a0, void *a1); +void ov12_0226AA8C(u32 *a1, u32 flag); #endif diff --git a/main.lsf b/main.lsf index 0f8c036d8..1a31af576 100644 --- a/main.lsf +++ b/main.lsf @@ -570,7 +570,6 @@ Overlay OVY_12 Object src/battle/battle_022378C0.o Object asm/overlay_12_022378C0.o Object src/battle/battle_system.o - Object asm/overlay_12_battle_system.o Object src/battle/battle_command.o Object asm/overlay_12_battle_command.o Object src/battle/battle_controller_player.o diff --git a/src/battle/battle_controller_player.c b/src/battle/battle_controller_player.c index 31f8331ff..f516766da 100644 --- a/src/battle/battle_controller_player.c +++ b/src/battle/battle_controller_player.c @@ -4,6 +4,7 @@ #include "battle/battle_controller_opponent.h" #include "battle/battle_system.h" #include "battle/overlay_12_0224E4FC.h" +#include "battle/battle_022378C0.h" #include "heap.h" #include "constants/abilities.h" #include "constants/items.h" diff --git a/src/battle/battle_system.c b/src/battle/battle_system.c index 189b57b8c..260b25987 100644 --- a/src/battle/battle_system.c +++ b/src/battle/battle_system.c @@ -1,15 +1,20 @@ #include "global.h" #include "battle/battle_hp_bar.h" +#include "battle/battle_controller.h" #include "battle/battle_controller_opponent.h" #include "battle/battle_system.h" +#include "battle/battle_022378C0.h" +#include "battle/battle_02265E28.h" #include "msgdata.h" #include "party.h" #include "pokemon_mood.h" #include "text.h" #include "battle/overlay_12_0224E4FC.h" #include "battle/overlay_12_0226BEC4.h" +#include "battle/overlay_12_02266024.h" #include "constants/game_stats.h" #include "constants/message_tags.h" +#include "constants/sndseq.h" #include "unk_0202FBCC.h" #include "unk_0200FA24.h" #include "unk_02005D10.h" @@ -20,6 +25,20 @@ static void BattleSystem_BufferMessage(BattleSystem *bsys, BattleMessage *msg); static void BattleMessage_BufferNickname(BattleSystem *bsys, int bufferIndex, int param); static void BattleMessage_BufferMove(BattleSystem *bsys, int bufferIndex, int param); static void BattleMessage_BufferItem(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferNumber(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferNumbers(BattleSystem *bsys, int bufferIndex, int param, int a3); +static void BattleMessage_BufferType(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferAbility(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferStat(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferStatus(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferPokemon(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferPoffin(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferFlavorPreference(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferTrainerClass(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferTrainerName(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_BufferBoxName(BattleSystem *bsys, int bufferIndex, int param); +static void BattleMessage_ExpandPlaceholders(BattleSystem *bsys, MsgData *data, BattleMessage *msg); +static BOOL ov12_0223CF14(struct TextPrinterTemplate *template, u16 glyphId); BgConfig *BattleSystem_GetBgConfig(BattleSystem *bsys) { return bsys->bgConfig; @@ -1406,7 +1425,7 @@ u32 BattleSystem_PrintBattleMessage(BattleSystem *bsys, MsgData *data, BattleMes Window *window = BattleSystem_GetWindow(bsys, 0); BattleSystem_AdjustMessageForSide(bsys, msg); BattleSystem_BufferMessage(bsys, msg); - ov12_0223CEF4(bsys, data, msg); + BattleMessage_ExpandPlaceholders(bsys, data, msg); FillWindowPixelBuffer(window, 0xFF); return AddTextPrinterParameterized(window, 1, bsys->msgBuffer, 0, 0, delay, ov12_0223CF14); } @@ -1416,7 +1435,7 @@ u32 ov12_0223C4E8(BattleSystem *bsys, Window *window, MsgData *data, BattleMessa BattleSystem_AdjustMessageForSide(bsys, msg); BattleSystem_BufferMessage(bsys, msg); - ov12_0223CEF4(bsys, data, msg); + BattleMessage_ExpandPlaceholders(bsys, data, msg); if (flag & 1) { FillWindowPixelBuffer(window, 0xFF); @@ -1854,3 +1873,91 @@ static void BattleMessage_BufferMove(BattleSystem *bsys, int bufferIndex, int pa static void BattleMessage_BufferItem(BattleSystem *bsys, int bufferIndex, int param) { BufferItemName(bsys->msgFormat, bufferIndex, param); } + +static void BattleMessage_BufferNumber(BattleSystem *bsys, int bufferIndex, int param) { + BufferIntegerAsString(bsys->msgFormat, bufferIndex, param, 5, PRINTING_MODE_LEFT_ALIGN, TRUE); +} + +static void BattleMessage_BufferNumbers(BattleSystem *bsys, int bufferIndex, int param, int a3) { + if (a3) { + BufferIntegerAsString(bsys->msgFormat, bufferIndex, param, a3, PRINTING_MODE_RIGHT_ALIGN, TRUE); + } else { + BufferIntegerAsString(bsys->msgFormat, bufferIndex, param, 5, PRINTING_MODE_RIGHT_ALIGN, TRUE); + } + +} + +static void BattleMessage_BufferType(BattleSystem *bsys, int bufferIndex, int param) { + BufferTypeName(bsys->msgFormat, bufferIndex, param); +} + +static void BattleMessage_BufferAbility(BattleSystem *bsys, int bufferIndex, int param) { + BufferAbilityName(bsys->msgFormat, bufferIndex, param); +} + +static void BattleMessage_BufferStat(BattleSystem *bsys, int bufferIndex, int param) { + BufferStatName(bsys->msgFormat, bufferIndex, param); +} + +static void BattleMessage_BufferStatus(BattleSystem *bsys, int bufferIndex, int param) { + BufferStatusName(bsys->msgFormat, bufferIndex, param); +} + +static void BattleMessage_BufferPokemon(BattleSystem *bsys, int bufferIndex, int param) { + Pokemon *mon = BattleSystem_GetPartyMon(bsys, param & 0xFF, (param & 0xFF00) >> 8); + BufferBoxMonSpeciesName(bsys->msgFormat, bufferIndex, &mon->box); +} + +static void BattleMessage_BufferPoffin(BattleSystem *bsys, int bufferIndex, int param) { + //poffins don't exist in HGSS +} + +static void BattleMessage_BufferFlavorPreference(BattleSystem *bsys, int bufferIndex, int param) { + BufferFlavorDislikeText(bsys->msgFormat, bufferIndex, param); +} + +static void BattleMessage_BufferTrainerClass(BattleSystem *bsys, int bufferIndex, int param) { + Trainer *trainer = BattleSystem_GetTrainer(bsys, param); + BufferTrainerClassNameFromDataStruct(bsys->msgFormat, bufferIndex, trainer); +} + +static void BattleMessage_BufferTrainerName(BattleSystem *bsys, int bufferIndex, int param) { + Trainer *trainer = BattleSystem_GetTrainer(bsys, param); + BufferTrainerNameFromDataStruct(bsys->msgFormat, bufferIndex, trainer); +} + +static void BattleMessage_BufferBoxName(BattleSystem *bsys, int bufferIndex, int param) { + BufferPCBoxName(bsys->msgFormat, bufferIndex, bsys->storage, param); +} + +static void BattleMessage_ExpandPlaceholders(BattleSystem *bsys, MsgData *data, BattleMessage *msg) { + String *str = NewString_ReadMsgData(data, msg->id); + StringExpandPlaceholders(bsys->msgFormat, bsys->msgBuffer, str); + String_Delete(str); +} + +static BOOL ov12_0223CF14(struct TextPrinterTemplate *template, u16 glyphId) { + BOOL ret = FALSE; + + switch (glyphId) { + case 1: + ret = GF_IsAnySEPlaying(); + break; + case 2: + ret = IsFanfarePlaying(); + break; + case 3: + PlayFanfare(0x4A3); + break; + case 4: + PlaySE(SEQ_SE_DP_KON); + break; + case 5: + PlayFanfare(0x4A0); + break; + default: + break; + } + + return ret; +}