diff --git a/asm/include/overlay_07.inc b/asm/include/overlay_07.inc index 2121cdf62f..657b90afcd 100644 --- a/asm/include/overlay_07.inc +++ b/asm/include/overlay_07.inc @@ -236,7 +236,7 @@ .public ov07_022377F4 .public ov12_0223A8E4 .public ov12_0223A8EC -.public ov12_0223A938 +.public BattleSystem_GetPaletteData .public ov12_0223BB88 .public ov12_0223C1C4 .public ov12_0223C1F4 diff --git a/asm/include/overlay_08.inc b/asm/include/overlay_08.inc index a2688c5e6c..d4877e5740 100644 --- a/asm/include/overlay_08.inc +++ b/asm/include/overlay_08.inc @@ -164,22 +164,22 @@ .public _u32_div_f .public gSystem .public ov08_022225D4 -.public ov12_0223A7D4 +.public BattleSystem_GetBgConfig .public BattleSystem_GetBattleType -.public ov12_0223A7E4 +.public BattleSystem_GetBattleContext .public BattleSystem_GetParty .public BattleSystem_GetPartyMon .public ov12_0223A8E4 -.public ov12_0223A938 -.public ov12_0223A9F4 -.public ov12_0223AA80 -.public ov12_0223AA84 +.public BattleSystem_GetPaletteData +.public BattleSystem_GetTrainer +.public BattleSystem_GetBag +.public BattleSystem_GetBagCursor .public ov12_0223AB0C -.public ov12_0223AB3C +.public BattleSystem_GetPcStorage .public BattleSystem_GetBattlerIdPartner .public BattleSystem_RecoverStatus -.public ov12_0223B708 -.public ov12_0223B718 +.public BattleSystem_GetFrame +.public BattleSystem_GetTextFrameDelay .public ov12_022581D4 .public BattleCursor_LoadResources .public BattleCursor_FreeResources diff --git a/asm/include/overlay_12_022378C0.inc b/asm/include/overlay_12_022378C0.inc index bf149eec74..941ba2b883 100644 --- a/asm/include/overlay_12_022378C0.inc +++ b/asm/include/overlay_12_022378C0.inc @@ -198,31 +198,31 @@ .public ov12_02237ED0 .public ov12_022399BC .public BattleSystem_GetBattleType -.public ov12_0223A7E4 -.public BattleSystem_GetOpponentDataByBattlerId +.public BattleSystem_GetBattleContext +.public BattleSystem_GetOpponentData .public BattleSystem_GetMaxBattlers .public BattleSystem_GetPartySize .public BattleSystem_GetPartyMon .public BattleSystem_GetPlayerProfile -.public ov12_0223AA84 +.public BattleSystem_GetBagCursor .public BattleSystem_GetMonBall -.public ov12_0223AAC8 +.public BattleSystem_GetTrainerGender .public BattleSystem_GetFieldSide .public BattleSystem_GetTerrainId .public BattleSystem_GetBattlerIdPartner .public BattleSystem_GetBattleSpecial .public ov12_0223B52C -.public ov12_0223B5EC -.public ov12_0223B708 -.public ov12_0223B798 +.public BattleSystem_CheckEvolution +.public BattleSystem_GetFrame +.public BattleSystem_TryChangeForm .public ov12_0223B870 .public ov12_0223BBF0 -.public ov12_0223BC48 -.public ov12_0223BCC8 -.public ov12_0223BD2C -.public ov12_0223BD3C -.public ov12_0223BD58 -.public ov12_0223BD68 +.public BattleSystem_HpBar_Init +.public BattleSystem_SetHpBarDisabled +.public BattleSystem_GetCriticalHpMusicFlag +.public BattleSystem_SetCriticalHpMusicFlag +.public BattleSystem_GetCriticalHpMusicDelay +.public BattleSystem_SetCriticalHpMusicDelay .public ov12_0223BFC0 .public ov12_0223BFCC .public ov12_0223BFEC @@ -238,7 +238,7 @@ .public ov12_02258E7C .public ov12_02260EA4 .public ov12_02261264 -.public ov12_0226127C +.public OpponentData_GetHpBar .public ov12_022621C4 .public ov12_02265FD4 .public ov12_0226604C diff --git a/asm/include/overlay_12_02264824.inc b/asm/include/overlay_12_02264824.inc index 7f290f94f9..90acd46d6a 100644 --- a/asm/include/overlay_12_02264824.inc +++ b/asm/include/overlay_12_02264824.inc @@ -47,19 +47,19 @@ .public _ll_mul .public _s32_div_f .public _u32_div_f -.public ov12_0223A7D4 +.public BattleSystem_GetBgConfig .public BattleSystem_GetBattleType .public BattleSystem_GetPartyMon .public ov12_0223A8E4 .public ov12_0223A8EC -.public ov12_0223A920 -.public ov12_0223A928 +.public BattleSystem_GetHpFont +.public BattleSystem_GetLevelFont .public ov12_0223A930 -.public ov12_0223A938 +.public BattleSystem_GetPaletteData .public ov12_0223A9A4 .public ov12_0226498C -.public ov12_02264BCC -.public ov12_02264C68 +.public BattleHpBar_LoadResources +.public BattleHpBar_FreeResources .public ov12_02264C84 .public ov12_02264DCC .public ov12_02264E00 @@ -68,7 +68,7 @@ .public ov12_02264E84 .public ov12_02264EB4 .public ov12_02264EE0 -.public ov12_02264F28 +.public BattleHpBar_SetEnabled .public ov12_02264FB0 .public ov12_02265B64 .public ov12_02265C54 diff --git a/asm/include/overlay_12_02265E28.inc b/asm/include/overlay_12_02265E28.inc index 5f33bfc053..d4833bbdec 100644 --- a/asm/include/overlay_12_02265E28.inc +++ b/asm/include/overlay_12_02265E28.inc @@ -19,7 +19,7 @@ .public MIi_CpuClearFast .public ov12_0223A8E4 .public ov12_0223A8EC -.public ov12_0223A938 +.public BattleSystem_GetPaletteData .public ov12_0223B52C .public ov12_02265FC4 .public ov12_02265FD4 diff --git a/asm/include/overlay_12_02266024.inc b/asm/include/overlay_12_02266024.inc index 6917db9f7c..32199e90e8 100644 --- a/asm/include/overlay_12_02266024.inc +++ b/asm/include/overlay_12_02266024.inc @@ -129,18 +129,18 @@ .public _s32_div_f .public gSystem .public ov06_0221BA1C -.public ov12_0223A7D4 +.public BattleSystem_GetBgConfig .public BattleSystem_GetBattleType -.public BattleSystem_GetOpponentDataByBattlerId +.public BattleSystem_GetOpponentData .public BattleSystem_GetPartyMon .public ov12_0223A8E4 .public ov12_0223A8EC .public ov12_0223A930 -.public ov12_0223A938 +.public BattleSystem_GetPaletteData .public ov12_0223A9A4 .public ov12_0223AAD8 .public ov12_0223AB54 -.public ov12_0223B6B4 +.public BattleSystem_GetSafariBallCount .public ov12_0223BB04 .public ov12_0223BB64 .public ov12_0223C134 diff --git a/asm/include/overlay_12_battle_command.inc b/asm/include/overlay_12_battle_command.inc index 207a2e0a01..91de137738 100644 --- a/asm/include/overlay_12_battle_command.inc +++ b/asm/include/overlay_12_battle_command.inc @@ -114,10 +114,10 @@ .public ov12_02237B6C .public ov12_02237CC4 .public ov12_02237D00 -.public ov12_0223A7D4 -.public ov12_0223A7D8 +.public BattleSystem_GetBgConfig +.public BattleSystem_GetWindow .public BattleSystem_GetBattleType -.public BattleSystem_GetOpponentDataByBattlerId +.public BattleSystem_GetOpponentData .public BattleSystem_GetMaxBattlers .public BattleSystem_GetParty .public BattleSystem_GetPartySize @@ -127,27 +127,27 @@ .public ov12_0223A8EC .public ov12_0223A8F4 .public ov12_0223A930 -.public ov12_0223A938 -.public ov12_0223A93C +.public BattleSystem_GetPaletteData +.public BattleSystem_GetPokedex .public ov12_0223A9A4 -.public ov12_0223A9A8 +.public BattleSystem_GetMessageBuffer .public ov12_0223AAB8 .public ov12_0223AAD8 .public BattleSystem_GetFieldSide -.public ov12_0223AB34 -.public ov12_0223AB3C +.public BattleSystem_GetMessageIcon +.public BattleSystem_GetPcStorage .public BattleSystem_GetTerrainId -.public ov12_0223AB60 -.public ov12_0223B520 -.public ov12_0223B6CC -.public ov12_0223B718 +.public BattleSystem_GetLocation +.public BattleSystem_GetTimezone +.public BattleSystem_GetOptions +.public BattleSystem_GetTextFrameDelay .public ov12_0223B870 .public ov12_0223BB1C -.public ov12_0223BB28 +.public BattleSystem_GameStatIncrement .public ov12_0223BB44 .public ov12_0223BBF0 -.public ov12_0223BCF0 -.public ov12_0223BD3C +.public BattleSystem_HpBar_Delete +.public BattleSystem_SetCriticalHpMusicFlag .public ov12_0223BD8C .public BattleSystem_Random .public ov12_0223C134 diff --git a/asm/include/overlay_12_battle_controller.inc b/asm/include/overlay_12_battle_controller.inc index 181abf23a2..70c3cf069d 100644 --- a/asm/include/overlay_12_battle_controller.inc +++ b/asm/include/overlay_12_battle_controller.inc @@ -18,7 +18,7 @@ .public _s32_div_f .public _u32_div_f .public BattleSystem_GetBattleType -.public ov12_0223A7E4 +.public BattleSystem_GetBattleContext .public BattleSystem_GetMaxBattlers .public BattleSystem_GetParty .public BattleSystem_GetPartyMon @@ -37,10 +37,10 @@ .public BattleSystem_GetBattlerIdPartner .public ov12_0223ABB8 .public ov12_0223B688 -.public ov12_0223B6B4 +.public BattleSystem_GetSafariBallCount .public ov12_0223B854 -.public BattleSystem_GetWinLoseFlags -.public ov12_0223BDC4 +.public BattleSystem_GetBattleOutcomeFlags +.public BattleSystem_GetRandTemp .public ov12_0223BE68 .public ov12_0223C140 .public ov12_0223C330 diff --git a/asm/include/overlay_12_battle_controller_opponent.inc b/asm/include/overlay_12_battle_controller_opponent.inc index 69c5da6760..4a663c9e4b 100644 --- a/asm/include/overlay_12_battle_controller_opponent.inc +++ b/asm/include/overlay_12_battle_controller_opponent.inc @@ -146,11 +146,11 @@ .public ov12_02237B0C .public ov12_02237BB8 .public ov12_02237ED0 -.public ov12_0223A7D4 -.public ov12_0223A7D8 +.public BattleSystem_GetBgConfig +.public BattleSystem_GetWindow .public BattleSystem_GetBattleType -.public ov12_0223A7E4 -.public BattleSystem_GetOpponentDataByBattlerId +.public BattleSystem_GetBattleContext +.public BattleSystem_GetOpponentData .public BattleSystem_GetMaxBattlers .public BattleSystem_GetParty .public BattleSystem_GetPartySize @@ -165,17 +165,17 @@ .public ov12_0223A914 .public ov12_0223A930 .public ov12_0223A934 -.public ov12_0223A938 +.public BattleSystem_GetPaletteData .public ov12_0223A99C .public BattleSystem_GetTrainerIndex -.public ov12_0223A9F4 +.public BattleSystem_GetTrainer .public BattleSystem_GetPlayerProfile -.public ov12_0223AA80 -.public ov12_0223AAC8 +.public BattleSystem_GetBag +.public BattleSystem_GetTrainerGender .public ov12_0223AAD8 .public ov12_0223AB0C .public BattleSystem_GetFieldSide -.public ov12_0223AB34 +.public BattleSystem_GetMessageIcon .public BattleSystem_GetTerrainId .public ov12_0223AB54 .public BattleSystem_GetBattlerIdPartner @@ -185,17 +185,17 @@ .public ov12_0223B688 .public ov12_0223B694 .public BattleSystem_AreBattleAnimationsOn -.public ov12_0223B718 +.public BattleSystem_GetTextFrameDelay .public ov12_0223B750 .public BattleSystem_GetChatotVoice -.public ov12_0223B874 +.public BattleSystem_SetBackground .public ov12_0223BAD0 .public ov12_0223BAD8 .public ov12_0223BAE0 .public ov12_0223BAEC .public ov12_0223BB04 .public ov12_0223BB10 -.public ov12_0223BB28 +.public BattleSystem_GameStatIncrement .public ov12_0223BB64 .public ov12_0223BB6C .public ov12_0223BB78 @@ -205,14 +205,14 @@ .public ov12_0223BBA8 .public ov12_0223BBC0 .public ov12_0223BBD8 -.public ov12_0223BC38 -.public ov12_0223BC98 -.public ov12_0223BCC8 -.public BattleSystem_GetWinLoseFlags -.public ov12_0223BD20 -.public ov12_0223BD3C +.public BattleSystem_GetHpBar +.public BattleSystem_SetHpBarEnabled +.public BattleSystem_SetHpBarDisabled +.public BattleSystem_GetBattleOutcomeFlags +.public BattleSystem_SetBattleOutcomeFlags +.public BattleSystem_SetCriticalHpMusicFlag .public BattleSystem_Random -.public ov12_0223BDD0 +.public BattleSystem_SetRandTemp .public ov12_0223BE0C .public ov12_0223BF14 .public ov12_0223BFC0 @@ -248,7 +248,7 @@ .public ov12_02261258 .public ov12_02261264 .public ov12_02261270 -.public ov12_0226127C +.public OpponentData_GetHpBar .public ov12_02261280 .public ov12_02261294 .public ov12_02261FD4 @@ -262,7 +262,7 @@ .public ov12_0226430C .public ov12_022643C8 .public ov12_0226498C -.public ov12_02264C68 +.public BattleHpBar_FreeResources .public ov12_02264C84 .public ov12_02264DCC .public ov12_02264E00 @@ -270,7 +270,7 @@ .public ov12_02264E68 .public ov12_02264E84 .public ov12_02264EB4 -.public ov12_02264F28 +.public BattleHpBar_SetEnabled .public ov12_02264FB0 .public ov12_02265B64 .public ov12_02265C54 diff --git a/asm/include/overlay_12_battle_controller_player.inc b/asm/include/overlay_12_battle_controller_player.inc index 1a481feb2f..a490e3fc55 100644 --- a/asm/include/overlay_12_battle_controller_player.inc +++ b/asm/include/overlay_12_battle_controller_player.inc @@ -26,25 +26,25 @@ .public ov10_02220AAC .public ov12_02237ED0 .public BattleSystem_GetBattleType -.public ov12_0223A7E4 -.public BattleSystem_GetOpponentDataByBattlerId +.public BattleSystem_GetBattleContext +.public BattleSystem_GetOpponentData .public BattleSystem_GetMaxBattlers .public BattleSystem_GetParty -.public ov12_0223A9F4 +.public BattleSystem_GetTrainer .public BattleSystem_GetPlayerProfile -.public ov12_0223AA80 -.public ov12_0223AA84 +.public BattleSystem_GetBag +.public BattleSystem_GetBagCursor .public ov12_0223AB0C .public BattleSystem_GetFieldSide .public BattleSystem_GetBattlerIdPartner .public BattleSystem_GetBattleSpecial -.public ov12_0223B6B4 -.public ov12_0223B6C0 -.public ov12_0223B740 +.public BattleSystem_GetSafariBallCount +.public BattleSystem_SetSafariBallCount +.public BattleSystem_GetBattleStyle .public ov12_0223BB64 -.public BattleSystem_GetWinLoseFlags -.public ov12_0223BD20 -.public ov12_0223BD3C +.public BattleSystem_GetBattleOutcomeFlags +.public BattleSystem_SetBattleOutcomeFlags +.public BattleSystem_SetCriticalHpMusicFlag .public BattleSystem_Random .public ov12_0223BDDC .public ov12_0223BFDC diff --git a/asm/include/overlay_12_battle_system.inc b/asm/include/overlay_12_battle_system.inc index 5fbc12777c..6de3304cc8 100644 --- a/asm/include/overlay_12_battle_system.inc +++ b/asm/include/overlay_12_battle_system.inc @@ -65,11 +65,11 @@ .public MIi_CpuCopy32 .public _s32_div_f .public _u32_div_f -.public ov12_0223A7D4 -.public ov12_0223A7D8 +.public BattleSystem_GetBgConfig +.public BattleSystem_GetWindow .public BattleSystem_GetBattleType -.public ov12_0223A7E4 -.public BattleSystem_GetOpponentDataByBattlerId +.public BattleSystem_GetBattleContext +.public BattleSystem_GetOpponentData .public BattleSystem_GetMaxBattlers .public BattleSystem_GetParty .public BattleSystem_GetPartySize @@ -82,12 +82,12 @@ .public ov12_0223A900 .public ov12_0223A908 .public ov12_0223A914 -.public ov12_0223A920 -.public ov12_0223A928 +.public BattleSystem_GetHpFont +.public BattleSystem_GetLevelFont .public ov12_0223A930 .public ov12_0223A934 -.public ov12_0223A938 -.public ov12_0223A93C +.public BattleSystem_GetPaletteData +.public BattleSystem_GetPokedex .public BattleSystem_GetSendBufferPtr .public BattleSystem_GetRecvBufferPtr .public ov12_0223A954 @@ -98,46 +98,46 @@ .public ov12_0223A990 .public ov12_0223A99C .public ov12_0223A9A4 -.public ov12_0223A9A8 +.public BattleSystem_GetMessageBuffer .public BattleSystem_GetTrainerIndex -.public ov12_0223A9F4 +.public BattleSystem_GetTrainer .public BattleSystem_GetPlayerProfile -.public ov12_0223AA80 -.public ov12_0223AA84 +.public BattleSystem_GetBag +.public BattleSystem_GetBagCursor .public BattleSystem_GetMonBall .public ov12_0223AAB8 -.public ov12_0223AAC8 +.public BattleSystem_GetTrainerGender .public ov12_0223AAD8 .public ov12_0223AB0C .public BattleSystem_GetFieldSide -.public ov12_0223AB34 -.public ov12_0223AB3C +.public BattleSystem_GetMessageIcon +.public BattleSystem_GetPcStorage .public BattleSystem_GetTerrainId .public ov12_0223AB54 -.public ov12_0223AB60 +.public BattleSystem_GetLocation .public BattleSystem_GetBattlerIdPartner .public ov12_0223ABB8 .public BattleSystem_RecoverStatus .public BattleSystem_GetBattleSpecial -.public ov12_0223B520 +.public BattleSystem_GetTimezone .public ov12_0223B52C .public ov12_0223B580 -.public ov12_0223B5EC +.public BattleSystem_CheckEvolution .public ov12_0223B688 .public ov12_0223B694 -.public ov12_0223B6B4 -.public ov12_0223B6C0 -.public ov12_0223B6CC +.public BattleSystem_GetSafariBallCount +.public BattleSystem_SetSafariBallCount +.public BattleSystem_GetOptions .public BattleSystem_AreBattleAnimationsOn -.public ov12_0223B708 -.public ov12_0223B718 -.public ov12_0223B740 +.public BattleSystem_GetFrame +.public BattleSystem_GetTextFrameDelay +.public BattleSystem_GetBattleStyle .public ov12_0223B750 .public BattleSystem_GetChatotVoice -.public ov12_0223B798 +.public BattleSystem_TryChangeForm .public ov12_0223B854 .public ov12_0223B870 -.public ov12_0223B874 +.public BattleSystem_SetBackground .public ov12_0223BAD0 .public ov12_0223BAD8 .public ov12_0223BAE0 @@ -146,7 +146,7 @@ .public ov12_0223BB04 .public ov12_0223BB10 .public ov12_0223BB1C -.public ov12_0223BB28 +.public BattleSystem_GameStatIncrement .public ov12_0223BB44 .public ov12_0223BB64 .public ov12_0223BB6C @@ -163,21 +163,21 @@ .public ov12_0223BC14 .public ov12_0223BC20 .public ov12_0223BC2C -.public ov12_0223BC38 -.public ov12_0223BC48 -.public ov12_0223BC98 -.public ov12_0223BCC8 -.public ov12_0223BCF0 -.public BattleSystem_GetWinLoseFlags -.public ov12_0223BD20 -.public ov12_0223BD2C -.public ov12_0223BD3C -.public ov12_0223BD58 -.public ov12_0223BD68 +.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 ov12_0223BDC4 -.public ov12_0223BDD0 +.public BattleSystem_GetRandTemp +.public BattleSystem_SetRandTemp .public ov12_0223BDDC .public ov12_0223BE0C .public ov12_0223BE68 @@ -206,16 +206,16 @@ .public ov12_0223C4E8 .public GetBattlerVar .public SetBattlerVar -.public ov12_0224F794 +.public AddBattlerVar .public ov12_022581D4 .public ov12_022582B8 .public ov12_02261258 .public ov12_02261270 -.public ov12_0226127C -.public ov12_02264BCC -.public ov12_02264C68 +.public OpponentData_GetHpBar +.public BattleHpBar_LoadResources +.public BattleHpBar_FreeResources .public ov12_02264EE0 -.public ov12_02264F28 +.public BattleHpBar_SetEnabled .public ov12_02265B64 .public ov12_02266008 .public ov12_0226AA8C diff --git a/asm/overlay_07.s b/asm/overlay_07.s index b6156f05dc..7aed3dd060 100644 --- a/asm/overlay_07.s +++ b/asm/overlay_07.s @@ -8512,7 +8512,7 @@ ov07_0221FB90: ; 0x0221FB90 bl ov12_0223A8EC str r0, [r4, #0xc] add r0, r7, #0 - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [r4, #0x10] mov r6, #0 add r5, r4, #0 diff --git a/asm/overlay_08.s b/asm/overlay_08.s index ffbf94bb6f..06efbb3fdb 100644 --- a/asm/overlay_08.s +++ b/asm/overlay_08.s @@ -27,12 +27,12 @@ _0221BE2E: bl memset str r5, [r4] ldr r0, [r5, #8] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r1, #0x79 lsl r1, r1, #2 str r0, [r4, r1] ldr r0, [r5, #8] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData mov r1, #0x7a lsl r1, r1, #2 str r0, [r4, r1] @@ -2295,7 +2295,7 @@ ov08_0221CF38: ; 0x0221CF38 bl PaletteData_LoadNarc ldr r0, [r5] ldr r0, [r0, #8] - bl ov12_0223B708 + bl BattleSystem_GetFrame add r4, r0, #0 bl sub_0200E63C add r1, r0, #0 @@ -3461,7 +3461,7 @@ ov08_0221D91C: ; 0x0221D91C add r1, r0, #0 ldr r0, [r5] ldr r0, [r0, #8] - bl ov12_0223A9F4 + bl BattleSystem_GetTrainer add r2, r0, #0 ldr r0, _0221DABC ; =0x00001FAC mov r1, #0 @@ -3798,14 +3798,14 @@ ov08_0221DBCC: ; 0x0221DBCC beq _0221DBF0 cmp r4, #0x42 beq _0221DBF0 - bl ov12_0223AA80 + bl BattleSystem_GetBag add r1, r4, #0 mov r2, #1 add r3, r7, #0 bl Bag_TakeItem _0221DBF0: add r0, r5, #0 - bl ov12_0223AA84 + bl BattleSystem_GetBagCursor add r1, r4, #0 add r2, r6, #0 bl BagCursor_Battle_SetLastUsedItem @@ -8273,7 +8273,7 @@ ov08_022201E8: ; 0x022201E8 bl TextFlags_SetCanABSpeedUpPrint ldr r0, [r4] ldr r0, [r0, #8] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay mov r3, #0 str r3, [sp] str r0, [sp, #4] @@ -12728,16 +12728,16 @@ ov08_022225D4: ; 0x022225D4 bl memset str r5, [r4] ldr r0, [r5] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig str r0, [r4, #4] ldr r0, [r5] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [r4, #8] ldr r0, _0222266C ; =0x0000114A mov r1, #0 strb r1, [r4, r0] ldr r0, [r5] - bl ov12_0223AA84 + bl BattleSystem_GetBagCursor add r6, r0, #0 mov r5, #0 _02222614: @@ -12938,7 +12938,7 @@ ov08_0222276C: ; 0x0222276C bl FontID_Alloc ldr r0, [r4] ldr r0, [r0] - bl ov12_0223AA84 + bl BattleSystem_GetBagCursor bl BagCursor_Battle_GetPocket ldr r1, _02222834 ; =0x0000114D strb r0, [r4, r1] @@ -13614,7 +13614,7 @@ _02222D26: bl BattleSystem_GetParty add r6, r0, #0 ldr r0, [r4] - bl ov12_0223AB3C + bl BattleSystem_GetPcStorage add r4, r0, #0 add r0, r6, #0 bl GetPartyCount @@ -13794,7 +13794,7 @@ _02222E40: cmp r0, #0 beq _02222EAC ldr r0, [r1] - bl ov12_0223AA84 + bl BattleSystem_GetBagCursor add r6, r0, #0 mov r4, #0 _02222E82: @@ -14174,7 +14174,7 @@ ov08_022230F4: ; 0x022230F4 bl PaletteData_LoadNarc ldr r0, [r5] ldr r0, [r0] - bl ov12_0223B708 + bl BattleSystem_GetFrame add r4, r0, #0 bl sub_0200E63C add r1, r0, #0 @@ -14412,7 +14412,7 @@ ov08_02223374: ; 0x02223374 add r5, r0, #0 ldr r4, [r5] ldr r0, [r4] - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext add r1, r0, #0 ldr r0, [r5] ldr r3, [r4, #0x10] @@ -14429,13 +14429,13 @@ ov08_02223390: ; 0x02223390 add r4, r3, #0 add r6, r0, #0 add r7, r2, #0 - bl ov12_0223AA80 + bl BattleSystem_GetBag add r1, r5, #0 mov r2, #1 add r3, r4, #0 bl Bag_TakeItem add r0, r6, #0 - bl ov12_0223AA84 + bl BattleSystem_GetBagCursor add r1, r5, #0 add r2, r7, #0 bl BagCursor_Battle_SetLastUsedItem @@ -15402,7 +15402,7 @@ ov08_02223B48: ; 0x02223B48 bl TextFlags_SetCanABSpeedUpPrint ldr r0, [r4] ldr r0, [r0] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay mov r3, #0 str r3, [sp] str r0, [sp, #4] diff --git a/asm/overlay_12_022378C0.s b/asm/overlay_12_022378C0.s index 8866796596..e32ecc09b7 100644 --- a/asm/overlay_12_022378C0.s +++ b/asm/overlay_12_022378C0.s @@ -220,7 +220,7 @@ _02237A64: _02237A6A: add r1, sp, #0x20 add r2, sp, #0x1c - bl ov12_0223B5EC + bl BattleSystem_CheckEvolution add r6, r0, #0 beq _02237ACC mov r0, #3 @@ -413,7 +413,7 @@ _02237BDE: bl ov12_0223BFC0 add r1, r0, #0 add r0, r5, #0 - bl ov12_0223AAC8 + bl BattleSystem_GetTrainerGender add r3, r0, #0 mov r0, #7 lsl r0, r0, #6 @@ -505,7 +505,7 @@ ov12_02237CC4: ; 0x02237CC4 mov r1, #3 bl FreeBgTilemapBuffer add r0, r4, #0 - bl ov12_0223BCC8 + bl BattleSystem_SetHpBarDisabled pop {r4, pc} .balign 4, 0 thumb_func_end ov12_02237CC4 @@ -566,7 +566,7 @@ _02237D1A: add r1, r0, #0 bl GX_EngineAToggleLayers add r0, r5, #0 - bl ov12_0223B708 + bl BattleSystem_GetFrame add r4, r0, #0 lsl r0, r4, #0x18 lsr r0, r0, #0x18 @@ -855,7 +855,7 @@ _02237FD8: bl ov12_0223BFC0 add r1, r0, #0 add r0, r4, #0 - bl ov12_0223AAC8 + bl BattleSystem_GetTrainerGender add r3, r0, #0 mov r0, #7 lsl r0, r0, #6 @@ -989,7 +989,7 @@ _02237FD8: mov r2, #0xc0 bl sub_02009408 add r0, r4, #0 - bl ov12_0223BC48 + bl BattleSystem_HpBar_Init bl ov12_022396F0 mov r0, #5 bl ov07_0221BEDC @@ -1147,7 +1147,7 @@ _02237FD8: add r0, r4, #0 bl ov12_0223A620 add r0, r4, #0 - bl ov12_0223AA84 + bl BattleSystem_GetBagCursor bl BagCursor_Battle_Init mov r0, #5 mov r1, #4 @@ -1376,7 +1376,7 @@ _022384A0: add r1, r5, #0 bl sub_0200FBF4 add r0, r4, #0 - bl ov12_0223B798 + bl BattleSystem_TryChangeForm ldr r0, _02238784 ; =0x00002420 ldrb r0, [r4, r0] cmp r0, #4 @@ -1643,7 +1643,7 @@ _022386C0: ldr r0, [r4, r0] bl SetLCRNGSeed add r0, r4, #0 - bl ov12_0223BD2C + bl BattleSystem_GetCriticalHpMusicFlag cmp r0, #0 beq _0223872E ldr r0, _0223879C ; =0x00000704 @@ -1804,7 +1804,7 @@ _02238838: add r0, r4, #0 bl ov12_0226604C add r0, r5, #0 - bl ov12_0223B708 + bl BattleSystem_GetFrame add r7, r0, #0 lsl r0, r7, #0x18 lsr r0, r0, #0x18 @@ -1948,7 +1948,7 @@ ov12_022389B8: ; 0x022389B8 add r3, r4, #0 bl ov12_02265FD4 add r0, r5, #0 - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext str r0, [sp] ldr r0, [r5, #0x44] mov r4, #0 @@ -3759,7 +3759,7 @@ ov12_02239854: ; 0x02239854 str r0, [sp] add r0, r5, #0 mov r6, #0 - bl ov12_0223BD2C + bl BattleSystem_GetCriticalHpMusicFlag add r4, r0, #0 add r0, r5, #0 bl BattleSystem_GetBattleType @@ -3780,7 +3780,7 @@ _0223987A: bl StopSE add r0, r5, #0 mov r1, #2 - bl ov12_0223BD3C + bl BattleSystem_SetCriticalHpMusicFlag pop {r3, r4, r5, r6, r7, pc} _02239898: ldr r0, [sp] @@ -3790,7 +3790,7 @@ _02239898: _022398A0: add r0, r5, #0 add r1, r4, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r7, r0, #0 bl ov12_02261264 cmp r0, #0 @@ -3813,7 +3813,7 @@ _022398BE: beq _022398FE _022398D6: add r0, r7, #0 - bl ov12_0226127C + bl OpponentData_GetHpBar add r1, r0, #0 beq _022398FE ldr r0, [r1, #0x28] @@ -3838,23 +3838,23 @@ _02239906: cmp r6, #0 beq _0223992C add r0, r5, #0 - bl ov12_0223BD2C + bl BattleSystem_GetCriticalHpMusicFlag cmp r0, #0 bne _0223992C ldr r0, _02239988 ; =0x00000704 bl PlaySE add r0, r5, #0 mov r1, #1 - bl ov12_0223BD3C + bl BattleSystem_SetCriticalHpMusicFlag add r0, r5, #0 mov r1, #4 - bl ov12_0223BD68 + bl BattleSystem_SetCriticalHpMusicDelay b _0223994A _0223992C: cmp r6, #0 bne _0223994A add r0, r5, #0 - bl ov12_0223BD2C + bl BattleSystem_GetCriticalHpMusicFlag cmp r0, #0 beq _0223994A ldr r0, _02239988 ; =0x00000704 @@ -3862,14 +3862,14 @@ _0223992C: bl StopSE add r0, r5, #0 mov r1, #0 - bl ov12_0223BD3C + bl BattleSystem_SetCriticalHpMusicFlag _0223994A: add r0, r5, #0 - bl ov12_0223BD2C + bl BattleSystem_GetCriticalHpMusicFlag cmp r0, #0 beq _02239984 add r0, r5, #0 - bl ov12_0223BD58 + bl BattleSystem_GetCriticalHpMusicDelay add r4, r0, #0 ldr r0, _02239988 ; =0x00000704 bl IsSEPlaying @@ -3881,13 +3881,13 @@ _0223994A: bl PlaySE add r0, r5, #0 mov r1, #4 - bl ov12_0223BD68 + bl BattleSystem_SetCriticalHpMusicDelay pop {r3, r4, r5, r6, r7, pc} _0223997A: lsl r1, r1, #0x18 add r0, r5, #0 lsr r1, r1, #0x18 - bl ov12_0223BD68 + bl BattleSystem_SetCriticalHpMusicDelay _02239984: pop {r3, r4, r5, r6, r7, pc} nop diff --git a/asm/overlay_12_02265E28.s b/asm/overlay_12_02265E28.s index 28963acd2f..76fcda03e0 100644 --- a/asm/overlay_12_02265E28.s +++ b/asm/overlay_12_02265E28.s @@ -58,7 +58,7 @@ _02265E82: add r2, r4, #0 bl sub_0200D504 ldr r0, [r5, #4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r4, [sp] ldrb r1, [r5, #9] mov r2, #6 @@ -81,7 +81,7 @@ _02265E82: mov r1, #2 bl sub_0200D68C ldr r0, [r5, #4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData mov r1, #0 str r1, [sp] mov r1, #0x20 diff --git a/asm/overlay_12_02266024.s b/asm/overlay_12_02266024.s index f1ce06c27e..482ad796cb 100644 --- a/asm/overlay_12_02266024.s +++ b/asm/overlay_12_02266024.s @@ -27,7 +27,7 @@ ov12_022660D0: ; 0x022660D0 strb r1, [r6, r0] _022660F4: ldr r0, [sp, #0xc] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #0x18] ldr r0, [sp, #0xc] bl ov12_0223AB54 @@ -341,10 +341,10 @@ ov12_02266390: ; 0x02266390 bl ov12_0223A8EC add r4, r0, #0 ldr r0, [r7] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig add r5, r0, #0 ldr r0, [r7] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #0x14] ldr r0, [r7] bl ov12_0226ADC4 @@ -374,7 +374,7 @@ _022663C6: add r3, r2, #0 bl sub_0207775C ldr r0, [r7] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData mov r1, #2 str r1, [sp] ldr r1, _02266478 ; =0x00004E34 @@ -520,7 +520,7 @@ _02266526: mov r1, #0 strb r1, [r7, r0] ldr r0, [r7] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig str r0, [sp, #0x28] ldr r0, [r7] bl ov12_0223A8E4 @@ -551,7 +551,7 @@ _02266560: add r0, r2, r1 str r0, [sp, #0x2c] ldr r0, [r7] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData mov r1, #2 lsl r1, r1, #8 str r1, [sp] @@ -595,7 +595,7 @@ _022665BC: cmp r4, #4 blt _02266586 ldr r0, [r7] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData ldr r1, [sp, #0x18] ldr r2, [sp, #0x24] str r1, [sp] @@ -799,7 +799,7 @@ _02266774: str r0, [r1, #8] add r0, r1, #0 ldr r0, [r0] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData ldr r1, _022667F4 ; =0x00004FBD add r2, r0, #0 ldr r0, _022667F8 ; =0x00004E43 @@ -1630,7 +1630,7 @@ ov12_02266DC4: ; 0x02266DC4 str r0, [sp] ldr r0, [r5] mov r4, #0 - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig add r7, r0, #0 ldr r0, _02266E58 ; =0x000006CC add r1, r0, #4 @@ -2209,7 +2209,7 @@ _02267252: bl ov12_02268440 _022672B6: ldr r0, [r5] - bl ov12_0223B6B4 + bl BattleSystem_GetSafariBallCount mov r1, #0 add r2, r0, #0 str r1, [sp] @@ -2303,7 +2303,7 @@ ov12_0226739C: ; 0x0226739C add r5, r0, #0 bl ov12_02266F84 ldr r0, [r5] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r1, #0x10 str r1, [sp] mov r1, #0x20 @@ -2360,7 +2360,7 @@ ov12_02267418: ; 0x02267418 add r5, r0, #0 bl ov12_02266F84 ldr r0, [r5] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r1, #0x10 str r1, [sp] mov r1, #0xa @@ -2649,7 +2649,7 @@ _0226767A: blt _02267654 _0226767E: ldr r0, [r5] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldrh r0, [r6] cmp r0, #0 bne _022676AA @@ -3013,7 +3013,7 @@ ov12_02267984: ; 0x02267984 add r0, r6, #0 bl FreeToHeap ldr r0, [r5] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r1, #4 ldr r2, [r5, #0x58] add r6, r0, #0 @@ -3023,7 +3023,7 @@ ov12_02267984: ; 0x02267984 mov r1, #4 bl ScheduleBgTilemapBufferTransfer ldr r0, [r5] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r2, #2 add r6, r0, #0 ldr r1, [r5, #0x50] @@ -3884,7 +3884,7 @@ _0226809E: pop {r3, r4, r5, r6, pc} _022680E4: ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldr r2, _02268124 ; =0x000002FF add r6, r0, #0 mov r1, #5 @@ -3976,7 +3976,7 @@ ov12_02268194: ; 0x02268194 bl ov12_0223A8EC add r6, r0, #0 ldr r0, [r5] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r5, r0, #0 bl sub_02074490 mov r1, #0x14 @@ -4455,7 +4455,7 @@ _0226856A: bl ov12_0223A8EC str r0, [sp, #0x20] ldr r0, [r7] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig str r0, [sp, #0x24] cmp r4, #0 bne _0226858C @@ -4622,7 +4622,7 @@ ov12_022686BC: ; 0x022686BC sub sp, #8 add r7, r0, #0 ldr r0, [r7] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r1, #5 bl GetBgTilemapBuffer add r4, r0, #0 @@ -5117,7 +5117,7 @@ _02268A90: add r0, r4, #0 bl InitWindow ldr r0, [r5] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r1, #0 str r1, [sp] str r1, [sp, #4] @@ -5323,7 +5323,7 @@ ov12_02268C30: ; 0x02268C30 ldr r0, [r0] add r5, r1, #0 add r4, r2, #0 - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r4, #8 add r1, r5, #0 mov r2, #5 @@ -5339,7 +5339,7 @@ ov12_02268C4C: ; 0x02268C4C add r5, r0, #0 ldr r0, [r5] add r4, r1, #0 - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r6, r0, #0 mov r7, #0 b _02268C92 @@ -5394,10 +5394,10 @@ ov12_02268CA0: ; 0x02268CA0 strb r2, [r0, #2] strb r1, [r0, #3] ldr r0, [r5] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig add r6, r0, #0 ldr r0, [r5] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r7, r0, #0 mov r0, #0 str r0, [sp] @@ -5699,7 +5699,7 @@ ov12_02268EE4: ; 0x02268EE4 add r6, r1, #0 add r4, r2, #0 add r7, r3, #0 - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r1, #4 str r0, [sp, #4] bl GetBgTilemapBuffer @@ -5759,7 +5759,7 @@ ov12_02268F58: ; 0x02268F58 sub sp, #0xc add r4, r1, #0 ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldr r3, _0226909C ; =0x0000069C ldrsh r0, [r4, r3] cmp r0, #0 @@ -5925,7 +5925,7 @@ ov12_022690A8: ; 0x022690A8 sub sp, #0x24 add r4, r1, #0 ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldr r0, _02269350 ; =0x000006A8 add r1, r4, #0 ldr r0, [r4, r0] @@ -6267,7 +6267,7 @@ ov12_02269360: ; 0x02269360 sub sp, #0x10 add r4, r1, #0 ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldr r1, _022694F0 ; =0x0000069C ldrsh r0, [r4, r1] cmp r0, #3 @@ -6540,7 +6540,7 @@ ov12_02269568: ; 0x02269568 add r6, r0, #0 ldr r0, [r5] ldr r0, [r0] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig add r4, r0, #0 ldrb r0, [r5, #0x13] cmp r0, #0 @@ -6659,7 +6659,7 @@ ov12_02269668: ; 0x02269668 add r5, r1, #0 ldr r0, [r5] ldr r0, [r0] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig add r6, r0, #0 ldrb r0, [r5, #0x12] cmp r0, #4 @@ -6800,7 +6800,7 @@ ov12_02269774: ; 0x02269774 bne _022697BE ldr r0, [r4] ldr r0, [r0] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r2, #0 mov r1, #4 add r3, r2, #0 @@ -6829,7 +6829,7 @@ _022697BE: ble _02269828 ldr r0, [r4] ldr r0, [r0] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldrb r1, [r4, #0x12] add r5, r0, #0 cmp r1, #4 @@ -6972,7 +6972,7 @@ ov12_022698C4: ; 0x022698C4 sub sp, #8 add r5, r1, #0 ldr r0, [r5] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r4, r0, #0 bl sub_02003B44 cmp r0, #0 @@ -7052,7 +7052,7 @@ ov12_02269954: ; 0x02269954 bl sub_02002BD4 bl sub_02002BF4 ldr r0, [r5] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r4, r0, #0 bl sub_02003B44 cmp r0, #0 @@ -7220,7 +7220,7 @@ ov12_02269A9C: ; 0x02269A9C bl ov12_0223AAD8 add r1, r0, #0 ldr r0, [r6] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData bl ov12_02261280 ldr r1, [sp, #8] cmp r1, #1 @@ -7462,7 +7462,7 @@ ov12_02269C7C: ; 0x02269C7C bne _02269CCE _02269C9A: ldr r0, [r5] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData bl ov12_02261280 mov r5, #0 ldr r1, _02269CD8 ; =ov12_0226E220 @@ -7639,7 +7639,7 @@ ov12_02269DD4: ; 0x02269DD4 bl ov12_0223AAD8 add r1, r0, #0 ldr r0, [r5] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData bl ov12_02261280 ldr r1, _02269F44 ; =0x000006DC add r3, r0, #0 @@ -7838,7 +7838,7 @@ ov12_02269F54: ; 0x02269F54 bl ov12_0223AAD8 add r1, r0, #0 ldr r0, [r5] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData bl ov12_02261280 mov r3, #0 ldr r7, _02269FA0 ; =ov12_0226E218 @@ -7886,7 +7886,7 @@ ov12_02269FA4: ; 0x02269FA4 bl ov12_0223AAD8 add r1, r0, #0 ldr r0, [r6] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData bl ov12_02261280 ldr r1, _0226A288 ; =0x000006DC str r0, [sp, #0x1c] @@ -8690,7 +8690,7 @@ ov12_0226A594: ; 0x0226A594 bl ov12_0223AAD8 add r1, r0, #0 ldr r0, [r5] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData bl ov12_02261280 ldr r1, _0226A5E8 ; =0x0000068C mov r3, #0 @@ -9165,7 +9165,7 @@ ov12_0226A8F4: ; 0x0226A8F4 ldr r0, [r4] bl ov12_0223A8EC ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData ldr r0, [r4] bl ov12_0223BB04 cmp r0, #0 @@ -9372,11 +9372,11 @@ ov12_0226AA8C: ; 0x0226AA8C str r0, [sp, #0x1c] ldr r0, [r0] add r4, r1, #0 - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig add r5, r0, #0 ldr r0, [sp, #0x1c] ldr r0, [r0] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r6, r0, #0 ldr r1, _0226AC50 ; =0x0000068B ldr r0, [sp, #0x1c] diff --git a/asm/overlay_12_battle_command.s b/asm/overlay_12_battle_command.s index aef400e790..71759f949c 100644 --- a/asm/overlay_12_battle_command.s +++ b/asm/overlay_12_battle_command.s @@ -186,7 +186,7 @@ _022459AC: str r2, [r1, r0] ldr r0, [r4] mov r1, #2 - bl ov12_0223BD3C + bl BattleSystem_SetCriticalHpMusicFlag _02245A0A: mov r0, #0 str r0, [sp, #0x38] @@ -351,7 +351,7 @@ _02245B3E: ldr r0, [sp, #0x38] str r0, [sp, #0xbc] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -515,7 +515,7 @@ _02245C88: cmp r1, #6 blt _02245C88 ldr r0, [r4] - bl ov12_0223AB60 + bl BattleSystem_GetLocation add r2, r0, #0 lsl r2, r2, #0x10 add r0, r6, #0 @@ -559,7 +559,7 @@ _02245CDE: ldr r0, [sp, #0x34] str r0, [sp, #0xbc] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -603,14 +603,14 @@ _02245D5A: pop {r3, r4, r5, r6, r7, pc} _02245D62: ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig add r6, r0, #0 ldr r0, [r4] mov r1, #1 - bl ov12_0223A7D8 + bl BattleSystem_GetWindow add r5, r0, #0 ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r7, r0, #0 ldr r0, _02246018 ; =0x04000008 mov r2, #3 @@ -693,7 +693,7 @@ _02245E0A: stmia r2!, {r0, r1} ldr r0, [r4] mov r1, #1 - bl ov12_0223A7D8 + bl BattleSystem_GetWindow add r7, r0, #0 mov r0, #0x5f ldr r1, [r4, #4] @@ -778,7 +778,7 @@ _02245EC8: stmia r2!, {r0, r1} ldr r0, [r4] mov r1, #1 - bl ov12_0223A7D8 + bl BattleSystem_GetWindow mov r1, #0x24 str r1, [sp] mov r1, #0x60 @@ -850,7 +850,7 @@ _02245F5C: _02245F6C: ldr r0, [r4] mov r1, #1 - bl ov12_0223A7D8 + bl BattleSystem_GetWindow add r6, r0, #0 mov r1, #0 bl sub_0200E5D4 @@ -892,7 +892,7 @@ _02245FBA: pop {r3, r4, r5, r6, r7, pc} _02245FCE: ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig add r1, r4, #0 add r0, r6, #0 add r1, #0x38 @@ -961,7 +961,7 @@ _02246050: ldrh r0, [r0] str r0, [sp, #0xbc] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -984,7 +984,7 @@ _02246082: ldr r0, [r4, #0x40] str r0, [sp, #0xbc] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -1006,7 +1006,7 @@ _022460B4: orr r0, r7 str r0, [sp, #0xb8] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -1071,7 +1071,7 @@ _0224613C: mov r1, #0 strb r1, [r0, #1] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -1135,7 +1135,7 @@ _022461BE: mov r1, #0 strb r1, [r0, #1] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -1191,7 +1191,7 @@ _0224622A: ldr r0, [r4, #0x40] str r0, [sp, #0xbc] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -1223,7 +1223,7 @@ _02246272: mov r1, #0 strb r1, [r0, #1] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -1251,7 +1251,7 @@ _0224629A: bl GetMonData str r0, [sp, #0xbc] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -1270,7 +1270,7 @@ _022462D6: mov r1, #0 strb r1, [r0, #1] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -1294,7 +1294,7 @@ _022462FE: ldr r0, [r4, #0x40] str r0, [sp, #0xbc] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x40] @@ -1625,7 +1625,7 @@ Task_GetPokemon: ; 0x022465A8 bl ov12_0223A930 str r0, [sp, #0x20] ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r5, r0, #0 ldr r0, [r4] bl ov12_0223A8D4 @@ -1703,7 +1703,7 @@ _02246636: bl ov12_0223A8E4 str r0, [sp, #0x14c] ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #0x150] mov r0, #1 str r0, [sp, #0x144] @@ -1748,7 +1748,7 @@ _0224668A: _022466B0: ldr r0, [r4] mov r1, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r5, r0, #0 add r0, #0x88 ldr r0, [r0] @@ -1940,7 +1940,7 @@ _02246826: strb r1, [r0, #1] str r7, [sp, #0x110] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x20] @@ -1955,7 +1955,7 @@ _02246826: bl PlayBGM ldr r0, [r4] mov r1, #2 - bl ov12_0223BD3C + bl BattleSystem_SetCriticalHpMusicFlag add sp, #0x158 pop {r3, r4, r5, r6, r7, pc} _0224686C: @@ -2014,7 +2014,7 @@ _022468A2: ldr r1, [r4, #4] bl ov12_022567D4 ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C mov r1, #0 @@ -2070,7 +2070,7 @@ _02246950: tst r0, r1 ldr r0, [r4] beq _022469B0 - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C mov r1, #0 @@ -2096,7 +2096,7 @@ _02246950: str r0, [r4, #0x40] pop {r3, r4, r5, r6, r7, pc} _022469B0: - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C mov r1, #0 @@ -2127,7 +2127,7 @@ _022469E6: strb r1, [r0, #1] str r7, [sp, #0xec] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x20] @@ -2172,7 +2172,7 @@ _02246A18: add r3, r1, #0 bl sub_020090E4 ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C add sp, #0x158 @@ -2203,14 +2203,14 @@ _02246A72: bl ov12_02265FC4 ldr r0, [r4] mov r1, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData mov r1, #0 bl ov12_02261294 ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig str r0, [sp, #0xd0] ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #0xd4] ldr r0, [sp, #0x24] add r1, r7, #0 @@ -2225,7 +2225,7 @@ _02246A72: bl BattleSystem_GetPartyMon str r0, [sp, #0xdc] ldr r0, [r4] - bl ov12_0223A93C + bl BattleSystem_GetPokedex bl Pokedex_IsNatDexEnabled str r0, [sp, #0xe0] bl sub_02021BD0 @@ -2374,7 +2374,7 @@ _02246C00: bl sub_0200878C ldr r0, [r4] mov r1, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData mov r1, #0 bl ov12_02261294 ldr r0, [r4] @@ -2423,7 +2423,7 @@ _02246C84: mov r0, #0x12 str r0, [r4, #0x28] ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #0 bl sub_0201649C add r0, r5, #0 @@ -2476,7 +2476,7 @@ _02246CEA: pop {r3, r4, r5, r6, r7, pc} _02246D0A: ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C mov r1, #0 @@ -2526,7 +2526,7 @@ _02246D4E: bl GetMonData add r5, r0, #0 ldr r0, [r4] - bl ov12_0223B6CC + bl BattleSystem_GetOptions str r0, [sp] mov r0, #0 str r0, [sp, #4] @@ -2557,7 +2557,7 @@ _02246DB0: bl GetMonData str r0, [r5, #8] ldr r0, [r4] - bl ov12_0223AB3C + bl BattleSystem_GetPcStorage str r0, [r5, #0x48] add r0, r6, #0 mov r1, #0x6f @@ -2572,7 +2572,7 @@ _02246DB0: mov r0, #0x15 str r0, [r4, #0x28] ldr r0, [r4] - bl ov12_0223BCF0 + bl BattleSystem_HpBar_Delete ldr r0, [r4] mov r5, #0 bl BattleSystem_GetMaxBattlers @@ -2582,7 +2582,7 @@ _02246DB0: _02246DF6: ldr r0, [r4] add r1, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r6, r0, #0 ldr r0, [r6, #0x18] cmp r0, #0 @@ -2624,7 +2624,7 @@ _02246E2A: bl SetMonData ldr r0, [r4] mov r1, #0x32 - bl ov12_0223BB28 + bl BattleSystem_GameStatIncrement _02246E5C: add r0, r5, #0 bl sub_0208311C @@ -2697,7 +2697,7 @@ _02246EEC: cmp r0, #0x16 bne _02246F0C ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C _02246F0C: @@ -2715,7 +2715,7 @@ _02246F14: cmp r0, #0x16 bne _02246F56 ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C mov r1, #0 @@ -2741,7 +2741,7 @@ _02246F56: pop {r3, r4, r5, r6, r7, pc} _02246F5E: ldr r0, [r4] - bl ov12_0223AB3C + bl BattleSystem_GetPcStorage str r0, [sp, #0x1c] bl PCStorage_GetActiveBox str r0, [sp, #0x18] @@ -2817,7 +2817,7 @@ _02246FEC: str r0, [sp, #0xa8] _02247006: ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x20] @@ -2847,7 +2847,7 @@ _0224702E: str r0, [r4, #0x34] bne _022470E6 ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C mov r1, #0 @@ -2892,7 +2892,7 @@ _02247094: mov r1, #0 strb r1, [r0, #1] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x20] @@ -2927,7 +2927,7 @@ _022470E8: add r0, sp, #0x54 strb r1, [r0, #1] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x20] @@ -2998,7 +2998,7 @@ _02247174: mov r1, #0 strb r1, [r0, #5] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] ldr r1, [sp, #0x20] @@ -3304,11 +3304,11 @@ _022473C8: b _02247512 _022473DC: add r0, r7, #0 - bl ov12_0223B520 + bl BattleSystem_GetTimezone cmp r0, #3 beq _022473FC add r0, r7, #0 - bl ov12_0223B520 + bl BattleSystem_GetTimezone cmp r0, #4 beq _022473FC add r0, r7, #0 @@ -3734,7 +3734,7 @@ _022476F8: _02247706: add r0, r4, #0 add r1, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData ldr r1, _022478F0 ; =0x00000195 ldrb r0, [r0, r1] tst r0, r7 @@ -3754,7 +3754,7 @@ _0224771E: _0224772C: add r0, r4, #0 add r1, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData ldrb r0, [r0, r7] cmp r0, #3 beq _02247744 @@ -3784,7 +3784,7 @@ _02247756: _02247764: add r0, r4, #0 add r1, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData ldr r1, _022478F0 ; =0x00000195 ldrb r0, [r0, r1] cmp r0, r6 @@ -3804,7 +3804,7 @@ _0224777C: _0224778A: add r0, r4, #0 add r1, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData ldr r1, _022478F0 ; =0x00000195 ldrb r0, [r0, r1] tst r0, r7 @@ -3824,7 +3824,7 @@ _022477A2: _022477B0: add r0, r4, #0 add r1, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData ldrb r0, [r0, r7] cmp r0, #2 beq _022477C8 @@ -3854,7 +3854,7 @@ _022477DA: _022477E8: add r0, r4, #0 add r1, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData ldr r1, _022478F0 ; =0x00000195 ldrb r0, [r0, r1] cmp r0, r6 @@ -5167,13 +5167,13 @@ ov12_02248228: ; 0x02248228 bl ov12_0223A930 str r0, [sp, #0x28] add r0, r7, #0 - bl ov12_0223A9A8 + bl BattleSystem_GetMessageBuffer str r0, [sp, #0x20] add r0, r7, #0 bl ov12_0223A9A4 str r0, [sp, #0x24] add r0, r7, #0 - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig str r0, [sp, #0x1c] add r0, r7, #0 bl ov12_0223A8E4 @@ -5182,7 +5182,7 @@ ov12_02248228: ; 0x02248228 bl ov12_0223A8EC add r4, r0, #0 add r0, r7, #0 - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r7, r0, #0 mov r0, #1 str r0, [sp] @@ -5570,7 +5570,7 @@ _022485B4: cmp r0, #0x1e blt _02248602 add r0, r5, #0 - bl ov12_0223AB60 + bl BattleSystem_GetLocation add r2, r0, #0 lsl r2, r2, #0x10 add r0, r7, #0 @@ -5583,7 +5583,7 @@ _022485B4: pop {r3, r4, r5, r6, r7, pc} _02248602: add r0, r5, #0 - bl ov12_0223AB60 + bl BattleSystem_GetLocation add r2, r0, #0 lsl r2, r2, #0x10 add r0, r7, #0 @@ -5596,7 +5596,7 @@ _02248602: pop {r3, r4, r5, r6, r7, pc} _02248620: add r0, r5, #0 - bl ov12_0223AB60 + bl BattleSystem_GetLocation add r2, r0, #0 lsl r2, r2, #0x10 add r0, r7, #0 diff --git a/asm/overlay_12_battle_controller.s b/asm/overlay_12_battle_controller.s index be1561dba8..276eadf556 100644 --- a/asm/overlay_12_battle_controller.s +++ b/asm/overlay_12_battle_controller.s @@ -306,7 +306,7 @@ BattleController_EmitPlayEncounterAnimation: ; 0x022622C8 mov r1, #1 add r5, r0, #0 str r1, [sp, #4] - bl ov12_0223BDC4 + bl BattleSystem_GetRandTemp str r0, [sp, #8] mov r0, #8 str r0, [sp] @@ -1383,7 +1383,7 @@ _02262AE2: orr r0, r1 strb r0, [r3, #7] ldr r0, [sp, #4] - bl ov12_0223B6B4 + bl BattleSystem_GetSafariBallCount str r0, [sp, #0x24] ldr r0, [sp, #8] add r1, sp, #0x14 @@ -1435,7 +1435,7 @@ ov12_02262B80: ; 0x02262B80 add r6, r3, #0 bl MIi_CpuClearFast ldr r0, [sp, #4] - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext ldr r1, [sp, #0xc] bl ov12_0224EDC0 mov r5, #0 @@ -1905,7 +1905,7 @@ ov12_02262F40: ; 0x02262F40 str r2, [sp, #0xc] str r0, [sp, #4] str r1, [sp, #8] - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext ldr r1, [sp, #0xc] bl ov12_0224EDC0 mov r0, #0xf @@ -3307,7 +3307,7 @@ ov12_022639B8: ; 0x022639B8 sub sp, #0x2c add r4, r1, #0 add r5, r0, #0 - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext add r1, r4, #0 bl ov12_0224EDC0 mov r1, #0x25 @@ -3480,7 +3480,7 @@ _02263AD0: orr r0, r1 strb r0, [r3, #7] ldr r0, [sp, #4] - bl ov12_0223B6B4 + bl BattleSystem_GetSafariBallCount str r0, [sp, #0x20] mov r0, #0x14 str r0, [sp] @@ -3743,7 +3743,7 @@ ov12_02263D14: ; 0x02263D14 add r7, r0, #0 add r4, r2, #0 add r6, r3, #0 - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext add r1, r5, #0 bl ov12_0224EDC0 mov r1, #0x2b @@ -4496,7 +4496,7 @@ BattleController_EmitSetBattleResults: ; 0x02264288 add r0, sp, #4 strb r1, [r0] add r0, r5, #0 - bl BattleSystem_GetWinLoseFlags + bl BattleSystem_GetBattleOutcomeFlags str r0, [sp, #8] mov r1, #0 add r0, sp, #4 diff --git a/asm/overlay_12_battle_controller_opponent.s b/asm/overlay_12_battle_controller_opponent.s index 60aa909689..3c2317b3a4 100644 --- a/asm/overlay_12_battle_controller_opponent.s +++ b/asm/overlay_12_battle_controller_opponent.s @@ -12,7 +12,7 @@ ov12_02258800: ; 0x02258800 sub sp, #0x94 str r1, [sp, #0x18] add r7, r0, #0 - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext add r5, r0, #0 ldr r0, [sp, #0x18] lsl r0, r0, #0x18 @@ -461,7 +461,7 @@ _02258B9C: .word 0x00140808 ov12_02258BA0: ; 0x02258BA0 push {r4, lr} add r4, r1, #0 - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext add r1, r0, r4 ldr r0, _02258BB0 ; =0x000021A4 ldrb r0, [r1, r0] @@ -785,7 +785,7 @@ _02258DDC: bl ov12_0223A8E4 str r0, [sp, #0x1c] add r0, r5, #0 - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #0x20] mov r0, #0 str r0, [sp, #0x18] @@ -856,7 +856,7 @@ ov12_02258E7C: ; 0x02258E7C beq _02258E8C add r0, r4, #0 add r0, #0x28 - bl ov12_02264C68 + bl BattleHpBar_FreeResources _02258E8C: ldr r0, [r4, #0x18] cmp r0, #0 @@ -888,7 +888,7 @@ ov12_02258EB4: ; 0x02258EB4 add r1, #0x98 ldr r1, [r1] add r5, r0, #0 - bl ov12_0223BDD0 + bl BattleSystem_SetRandTemp add r0, r5, #0 add r1, r4, #0 bl ov12_02259944 @@ -1750,7 +1750,7 @@ ov12_022594F4: ; 0x022594F4 push {r3, r4, r5, lr} add r5, r0, #0 add r4, r1, #0 - bl ov12_0223B874 + bl BattleSystem_SetBackground mov r1, #0x65 lsl r1, r1, #2 ldrb r1, [r4, r1] @@ -1809,7 +1809,7 @@ ov12_02259514: ; 0x02259514 cmp r1, r0 beq _02259586 add r0, r5, #0 - bl ov12_0223BC38 + bl BattleSystem_GetHpBar bl ov12_02265D74 _02259586: add r0, r4, #0 @@ -1933,7 +1933,7 @@ ov12_02259658: ; 0x02259658 bl ov12_0223A8EC add r7, r0, #0 add r0, r5, #0 - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r2, r0, #0 add r0, r6, #0 add r1, r7, #0 @@ -1983,14 +1983,14 @@ ov12_022596B8: ; 0x022596B8 cmp r1, #0 bne _022596E4 ldrh r1, [r4, #2] - bl ov12_0223BB28 + bl BattleSystem_GameStatIncrement b _022596E4 _022596D8: ldrb r1, [r5, r1] cmp r1, #0 beq _022596E4 ldrh r1, [r4, #2] - bl ov12_0223BB28 + bl BattleSystem_GameStatIncrement _022596E4: mov r1, #0x65 lsl r1, r1, #2 @@ -2165,7 +2165,7 @@ ov12_022597EC: ; 0x022597EC ldr r1, [r1, #4] lsl r1, r1, #0x18 lsr r1, r1, #0x18 - bl ov12_0223BD20 + bl BattleSystem_SetBattleOutcomeFlags b _022598DC _02259824: add r0, r7, #0 @@ -2241,19 +2241,19 @@ _022598B2: bne _022598C6 ldr r0, [sp] mov r1, #3 - bl ov12_0223BD20 + bl BattleSystem_SetBattleOutcomeFlags b _022598DC _022598C6: cmp r7, #0 bne _022598D4 ldr r0, [sp] mov r1, #2 - bl ov12_0223BD20 + bl BattleSystem_SetBattleOutcomeFlags b _022598DC _022598D4: ldr r0, [sp] mov r1, #1 - bl ov12_0223BD20 + bl BattleSystem_SetBattleOutcomeFlags _022598DC: mov r2, #0x65 ldr r1, [sp, #4] @@ -2275,7 +2275,7 @@ ov12_022598F8: ; 0x022598F8 add r4, r1, #0 mov r1, #0 add r5, r0, #0 - bl ov12_0223A7D8 + bl BattleSystem_GetWindow add r6, r0, #0 mov r1, #0xff bl FillWindowPixelBuffer @@ -3450,7 +3450,7 @@ _0225A23E: bne _0225A27A _0225A26A: add r0, r6, #0 - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r1, #3 mov r2, #2 mov r3, #0x84 @@ -3504,7 +3504,7 @@ ov12_0225A2A0: ; 0x0225A2A0 _0225A2DA: ldrb r1, [r5, r1] add r0, r6, #0 - bl ov12_0223A9F4 + bl BattleSystem_GetTrainer add r2, r0, #0 mov r0, #0 strb r0, [r4, #0xb] @@ -3732,7 +3732,7 @@ ov12_0225A414: ; 0x0225A414 add r0, #0x27 strb r2, [r0] add r0, r4, #0 - bl ov12_02264F28 + bl BattleHpBar_SetEnabled mov r2, #0 ldr r1, [r4, #0x28] add r0, r4, #0 @@ -4250,7 +4250,7 @@ ov12_0225A85C: ; 0x0225A85C orr r0, r1 str r0, [sp, #8] add r0, r6, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r1, [sp] add r0, r6, #0 @@ -4289,7 +4289,7 @@ ov12_0225A8C4: ; 0x0225A8C4 ldrb r0, [r6, r0] strb r0, [r4, #5] add r0, r5, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r1, [sp] add r0, r5, #0 @@ -4837,7 +4837,7 @@ ov12_0225ACE8: ; 0x0225ACE8 ldrb r0, [r5, r0] strb r0, [r4, #5] add r0, r6, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay str r0, [sp] mov r2, #0x65 lsl r2, r2, #2 @@ -4881,7 +4881,7 @@ ov12_0225AD44: ; 0x0225AD44 ldrb r0, [r6, r0] strb r0, [r4, #5] add r0, r5, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r1, [sp] add r0, r5, #0 @@ -4922,7 +4922,7 @@ ov12_0225AD9C: ; 0x0225AD9C ldrb r0, [r6, r0] strb r0, [r4, #5] add r0, r5, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r1, [sp] add r0, r5, #0 @@ -4962,7 +4962,7 @@ ov12_0225ADF4: ; 0x0225ADF4 ldrb r0, [r6, r0] strb r0, [r4, #5] add r0, r5, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 add r0, r5, #0 add r1, r7, #0 @@ -5003,7 +5003,7 @@ ov12_0225AE48: ; 0x0225AE48 ldrb r0, [r6, r0] strb r0, [r4, #5] add r0, r5, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r1, [sp] add r0, r5, #0 @@ -5075,7 +5075,7 @@ ov12_0225AED8: ; 0x0225AED8 mov r0, #0 strb r0, [r7, #7] add r0, r6, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r1, [sp] add r0, r6, #0 @@ -5437,7 +5437,7 @@ ov12_0225B1A8: ; 0x0225B1A8 bl ov12_0223C494 add r0, r5, #0 mov r1, #0 - bl ov12_0223A7D8 + bl BattleSystem_GetWindow mov r1, #1 bl WaitingIcon_New add r1, r0, #0 @@ -5567,7 +5567,7 @@ ov12_0225B2A4: ; 0x0225B2A4 ldrb r0, [r6, r0] strb r0, [r4, #5] add r0, r5, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 add r0, r5, #0 add r1, r7, #0 @@ -5607,7 +5607,7 @@ ov12_0225B2F8: ; 0x0225B2F8 ldrb r0, [r6, r0] strb r0, [r4, #5] add r0, r5, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 add r0, r5, #0 add r1, r7, #0 @@ -5647,7 +5647,7 @@ ov12_0225B34C: ; 0x0225B34C ldrb r0, [r6, r0] strb r0, [r4, #5] add r0, r5, #0 - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 add r0, r5, #0 add r1, r7, #0 @@ -7443,7 +7443,7 @@ _0225C1CC: bl ov12_0223A8E4 str r0, [sp, #0x74] ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #0x78] mov r2, #1 mov r1, #0 @@ -8547,7 +8547,7 @@ _0225CABE: bl ov12_0223A8E4 str r0, [sp, #0x6c] ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #0x70] mov r0, #1 str r0, [sp, #0x64] @@ -8584,7 +8584,7 @@ _0225CB06: bl ov12_0223A8E4 str r0, [sp, #0x44] ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #0x48] mov r0, #1 str r0, [sp, #0x3c] @@ -8968,7 +8968,7 @@ ov12_0225CE28: ; 0x0225CE28 bne _0225CE64 _0225CE4E: ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig mov r1, #3 mov r2, #1 mov r3, #4 @@ -9437,7 +9437,7 @@ _0225D1CA: bl ov12_0223A8E4 str r0, [sp, #0x24] ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #0x28] mov r0, #0 str r0, [sp, #0x20] @@ -9526,7 +9526,7 @@ _0225D244: bl BattleSystem_GetBattlerIdPartner add r1, r0, #0 ldr r0, [r4] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r4, r0, #0 add r0, #0x88 ldr r0, [r0] @@ -9704,7 +9704,7 @@ _0225D368: bl BattleSystem_GetBattlerIdPartner add r1, r0, #0 ldr r0, [r4] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData ldr r1, [r4, #0xc] add r6, r0, #0 add r3, r1, #0 @@ -10089,7 +10089,7 @@ _0225D71C: bl BattleSystem_GetBattlerIdPartner add r1, r0, #0 ldr r0, [r5] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r4, r0, #0 cmp r7, #3 bne _0225D7F2 @@ -10430,7 +10430,7 @@ _0225DA42: bl ov12_02264FB0 add r0, r4, #0 mov r1, #1 - bl ov12_02264F28 + bl BattleHpBar_SetEnabled ldrb r0, [r4] add r0, r0, #1 strb r0, [r4] @@ -10496,7 +10496,7 @@ _0225DAAC: bl DestroySysTask add r0, r4, #0 mov r1, #0 - bl ov12_02264F28 + bl BattleHpBar_SetEnabled _0225DAD0: pop {r3, r4, r5, pc} .balign 4, 0 @@ -10509,13 +10509,13 @@ ov12_0225DAD4: ; 0x0225DAD4 add r4, r1, #0 add r7, r0, #0 ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldr r0, [r4] bl ov12_0223A900 add r6, r0, #0 ldrb r1, [r4, #9] ldr r0, [r4] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData str r0, [sp, #0xc] ldr r0, [r4] bl BattleSystem_GetBattleType @@ -10528,7 +10528,7 @@ ov12_0225DAD4: ; 0x0225DAD4 cmp r1, r0 beq _0225DB16 ldr r0, [r4] - bl ov12_0223BC38 + bl BattleSystem_GetHpBar str r0, [sp, #8] b _0225DB1A _0225DB16: @@ -10630,13 +10630,13 @@ _0225DBCC: add r0, sp, #0x10 strb r1, [r0, #0xd] ldr r0, [r4] - bl ov12_0223AAC8 + bl BattleSystem_GetTrainerGender ldr r1, _0225DEDC ; =0x000004CA add r1, r0, r1 add r0, sp, #0x10 strh r1, [r0, #0xe] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] add r1, r6, #0 @@ -11019,7 +11019,7 @@ _0225DEF0: _0225DF04: ldr r0, [r4] add r1, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r0, #0x28 bl ov12_02264C84 ldr r0, [r4] @@ -11290,7 +11290,7 @@ ov12_0225E154: ; 0x0225E154 bl ov12_0223B694 add r5, r0, #0 ldr r0, [r4] - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext mov r2, #0 ldrb r1, [r4, #9] add r3, r2, #0 @@ -11407,13 +11407,13 @@ ov12_0225E250: ; 0x0225E250 add r4, r1, #0 add r6, r0, #0 ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldr r0, [r4] bl ov12_0223A900 add r7, r0, #0 ldrb r1, [r4, #0x1d] ldr r0, [r4] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData str r0, [sp, #0x10] ldrb r1, [r4, #0x1d] ldr r0, [r4] @@ -11423,7 +11423,7 @@ ov12_0225E250: ; 0x0225E250 cmp r1, r0 beq _0225E28A ldr r0, [r4] - bl ov12_0223BC38 + bl BattleSystem_GetHpBar add r5, r0, #0 b _0225E28C _0225E28A: @@ -11617,7 +11617,7 @@ ov12_0225E404: ; 0x0225E404 bl BattleSystem_GetBattleType add r4, r0, #0 ldr r0, [r6] - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext str r0, [sp, #0xc] ldr r0, _0225E4C8 ; =0x00000101 tst r0, r4 @@ -11746,7 +11746,7 @@ _0225E514: b _0225E53E _0225E51C: ldr r0, [r5] - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext ldrb r1, [r5, #0x1d] add r2, r4, #5 mov r3, #0 @@ -11787,10 +11787,10 @@ ov12_0225E568: ; 0x0225E568 add r4, r1, #0 str r0, [sp, #8] ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldrb r1, [r4, #0xd] ldr r0, [r4] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r7, r0, #0 ldr r0, [r4] bl ov12_0223A900 @@ -11803,7 +11803,7 @@ ov12_0225E568: ; 0x0225E568 cmp r1, r0 beq _0225E5A2 ldr r0, [r4] - bl ov12_0223BC38 + bl BattleSystem_GetHpBar add r6, r0, #0 b _0225E5A4 _0225E5A2: @@ -11981,7 +11981,7 @@ ov12_0225E6FC: ; 0x0225E6FC add r5, r1, #0 add r6, r0, #0 ldr r0, [r5] - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext add r1, r0, #0 ldrb r3, [r5, #0xd] ldr r0, [r5] @@ -12140,7 +12140,7 @@ ov12_0225E830: ; 0x0225E830 add r4, r1, #0 add r7, r0, #0 ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData ldrb r1, [r4, #0xe] add r5, r0, #0 cmp r1, #0x1e @@ -12191,7 +12191,7 @@ _0225E896: bl ov12_0226A8E4 strb r0, [r4, #0x10] ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C mov r1, #0 @@ -12252,7 +12252,7 @@ _0225E8EC: add r0, #0x26 strb r1, [r0] ldr r0, [r4] - bl ov12_0223AA80 + bl BattleSystem_GetBag ldr r1, [r4, #4] str r0, [r1, #8] ldrb r1, [r4, #0xd] @@ -12585,7 +12585,7 @@ _0225EBC6: b _0225F376 _0225EBC8: ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #0 bl sub_0201649C ldr r0, [r4, #4] @@ -12865,7 +12865,7 @@ _0225EDE0: bl ov12_0223A930 add r5, r0, #0 ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] add r1, r5, #0 @@ -12913,7 +12913,7 @@ _0225EE3E: bl ov12_022643C8 ldrb r1, [r4, #0xd] ldr r0, [r4] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r5, r0, #0 ldr r0, [r4] bl ov12_0223A8DC @@ -12945,7 +12945,7 @@ _0225EE7E: bl ov12_022643C8 ldr r0, [r4] add r1, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r5, r0, #0 ldr r0, [r4] bl ov12_0223A8DC @@ -12978,7 +12978,7 @@ _0225EEC4: bl ov12_022643C8 ldrb r1, [r4, #0xd] ldr r0, [r4] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r5, r0, #0 ldr r0, [r4] bl ov12_0223A8DC @@ -13003,7 +13003,7 @@ _0225EF02: bl ov12_022643C8 ldrb r1, [r4, #0xd] ldr r0, [r4] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r5, r0, #0 ldr r0, [r4] bl ov12_0223A8DC @@ -13026,7 +13026,7 @@ _0225EF3A: bl ov12_022643C8 ldrb r1, [r4, #0xd] ldr r0, [r4] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r5, r0, #0 ldr r0, [r4] bl ov12_0223A8DC @@ -13122,7 +13122,7 @@ _0225EFFE: bl ov12_0223A930 add r5, r0, #0 ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] add r1, r5, #0 @@ -13154,7 +13154,7 @@ _0225F02A: bl ov12_022643C8 ldr r0, [r4] add r1, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r5, r0, #0 ldr r0, [r4] bl ov12_0223A8DC @@ -13179,7 +13179,7 @@ _0225F070: ldrb r7, [r0] ldr r0, [r4] add r1, r6, #0 - bl ov12_0223BC38 + bl BattleSystem_GetHpBar mov r1, #0 mov r2, #1 add r5, r0, #0 @@ -13244,7 +13244,7 @@ _0225F10A: ldr r1, [r1, #4] ldrb r1, [r1, #0x11] lsl r1, r1, #1 - bl ov12_0223BC38 + bl BattleSystem_GetHpBar add r5, r0, #0 bl ov12_02264E00 mov r1, #0 @@ -13306,7 +13306,7 @@ _0225F178: str r0, [sp, #0x48] _0225F18E: ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] add r1, r5, #0 @@ -13329,7 +13329,7 @@ _0225F1B2: lsl r7, r0, #1 ldr r0, [r4] add r1, r7, #0 - bl ov12_0223BC38 + bl BattleSystem_GetHpBar str r0, [sp, #0x10] ldr r0, [r4, #8] add r1, r7, #0 @@ -13497,7 +13497,7 @@ _0225F2FA: bl ov12_0223A930 add r5, r0, #0 ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] add r1, r5, #0 @@ -13717,7 +13717,7 @@ ov12_0225F4E0: ; 0x0225F4E0 add r4, r1, #0 add r6, r0, #0 ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData ldrb r1, [r4, #0xa] add r5, r0, #0 cmp r1, #3 @@ -13736,7 +13736,7 @@ _0225F502: ; jump table _0225F50A: ldr r0, [r4] mov r1, #0 - bl ov12_0223A7D8 + bl BattleSystem_GetWindow add r6, r0, #0 mov r1, #0xff bl FillWindowPixelBuffer @@ -13747,7 +13747,7 @@ _0225F50A: bl ov12_0226A8E4 strb r0, [r4, #0x17] ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C mov r1, #0 @@ -14127,7 +14127,7 @@ _0225F846: cmp r0, #0 bne _0225F8A6 ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #0 bl sub_0201649C ldr r3, [r4, #4] @@ -14372,13 +14372,13 @@ ov12_0225FA44: ; 0x0225FA44 add r4, r1, #0 add r6, r0, #0 ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldr r0, [r4] bl ov12_0223A900 add r5, r0, #0 ldrb r1, [r4, #0xd] ldr r0, [r4] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData str r0, [sp, #0xc] ldrb r1, [r4, #0xd] ldr r0, [r4] @@ -14388,7 +14388,7 @@ ov12_0225FA44: ; 0x0225FA44 cmp r1, r0 beq _0225FA7E ldr r0, [r4] - bl ov12_0223BC38 + bl BattleSystem_GetHpBar add r7, r0, #0 b _0225FA80 _0225FA7E: @@ -14437,7 +14437,7 @@ _0225FACA: add r0, sp, #0x10 strh r1, [r0, #6] ldr r0, [r4] - bl ov12_0223B718 + bl BattleSystem_GetTextFrameDelay add r3, r0, #0 ldr r0, [r4] add r1, r5, #0 @@ -14836,14 +14836,14 @@ _0225FDA6: _0225FE02: ldr r0, [r4] mov r1, #2 - bl ov12_0223BD3C + bl BattleSystem_SetCriticalHpMusicFlag add r0, r4, #0 add r0, #0x6b ldrb r0, [r0] cmp r0, #0 beq _0225FE1A ldr r0, [r4] - bl ov12_0223BCC8 + bl BattleSystem_SetHpBarDisabled _0225FE1A: add r0, r4, #0 add r0, #0x6c @@ -14873,14 +14873,14 @@ _0225FE30: _0225FE50: ldr r0, [r4] mov r1, #0 - bl ov12_0223BD3C + bl BattleSystem_SetCriticalHpMusicFlag add r0, r4, #0 add r0, #0x6b ldrb r0, [r0] cmp r0, #0 beq _0225FE68 ldr r0, [r4] - bl ov12_0223BC98 + bl BattleSystem_SetHpBarEnabled _0225FE68: add r0, r4, #0 add r0, #0x6c @@ -15538,7 +15538,7 @@ ov12_0226037C: ; 0x0226037C add r5, r1, #0 add r6, r0, #0 ldr r0, [r5] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r4, r0, #0 ldr r0, [r5] bl ov12_0223A8D4 @@ -15554,7 +15554,7 @@ ov12_0226037C: ; 0x0226037C pop {r4, r5, r6, r7, pc} _022603A6: ldr r0, [r5] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C mov r1, #0 @@ -15910,9 +15910,9 @@ ov12_02260668: ; 0x02260668 add r4, r1, #0 add r6, r0, #0 ldr r0, [r4] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r7, r0, #0 ldr r0, [r4] bl BattleSystem_GetTerrainId @@ -16193,7 +16193,7 @@ _022608BC: pop {r3, r4, r5, r6, r7, pc} _022608CC: ldr r0, [r4] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #0 bl sub_0201649C add r0, r4, #0 @@ -16325,7 +16325,7 @@ ov12_022609F8: ; 0x022609F8 add r4, r1, #0 add r5, r0, #0 ldr r0, [r4] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData ldrb r1, [r4, #0xa] add r6, r0, #0 cmp r1, #3 @@ -16790,7 +16790,7 @@ ov12_02260D84: ; 0x02260D84 add r5, r1, #0 add r6, r0, #0 ldr r0, [r5] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r4, r0, #0 ldr r0, [r5] bl ov12_0223A8D4 @@ -16809,7 +16809,7 @@ _02260DAE: cmp r0, #0 bne _02260DD2 ldr r0, [r5] - bl ov12_0223AB34 + bl BattleSystem_GetMessageIcon mov r1, #1 bl sub_0201649C ldr r0, _02260EA0 ; =0x0000FFFF @@ -17416,11 +17416,11 @@ _02261278: bx lr thumb_func_end ov12_02261270 - thumb_func_start ov12_0226127C -ov12_0226127C: ; 0x0226127C + thumb_func_start OpponentData_GetHpBar +OpponentData_GetHpBar: ; 0x0226127C add r0, #0x28 bx lr - thumb_func_end ov12_0226127C + thumb_func_end OpponentData_GetHpBar thumb_func_start ov12_02261280 ov12_02261280: ; 0x02261280 @@ -18300,7 +18300,7 @@ ov12_02261928: ; 0x02261928 bl BattleSystem_GetBattleType add r6, r0, #0 ldr r0, [sp] - bl BattleSystem_GetWinLoseFlags + bl BattleSystem_GetBattleOutcomeFlags add r7, r0, #0 mov r0, #2 tst r0, r6 @@ -18438,7 +18438,7 @@ _02261A2C: mov r0, #0 strb r0, [r7, #1] add r0, r5, #0 - bl ov12_0223BD20 + bl BattleSystem_SetBattleOutcomeFlags add sp, #8 pop {r3, r4, r5, r6, r7, pc} _02261A4A: @@ -18450,7 +18450,7 @@ _02261A4A: mov r0, #0 strb r0, [r7, #1] add r0, r5, #0 - bl ov12_0223BD20 + bl BattleSystem_SetBattleOutcomeFlags add sp, #8 pop {r3, r4, r5, r6, r7, pc} _02261A62: @@ -18499,7 +18499,7 @@ _02261AAE: _02261ABE: add r0, r5, #0 mov r1, #0xc1 - bl ov12_0223BD20 + bl BattleSystem_SetBattleOutcomeFlags add sp, #8 pop {r3, r4, r5, r6, r7, pc} nop @@ -18548,7 +18548,7 @@ _02261B1A: _02261B22: add r0, r5, #0 mov r1, #0xc2 - bl ov12_0223BD20 + bl BattleSystem_SetBattleOutcomeFlags pop {r4, r5, r6, pc} thumb_func_end ov12_02261AD4 @@ -18566,7 +18566,7 @@ ov12_02261B2C: ; 0x02261B2C bl ov12_0223A8EC str r0, [sp, #0x18] add r0, r5, #0 - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r2, r0, #0 mov r0, #1 tst r0, r4 @@ -18621,10 +18621,10 @@ _02261B9E: str r0, [sp, #0x18] _02261BA8: ldr r0, [sp] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig str r0, [sp, #0x20] ldr r0, [sp] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #0x24] ldr r0, [sp] bl ov12_0223A8E4 @@ -19024,7 +19024,7 @@ ov12_02261EB8: ; 0x02261EB8 mov r1, #1 bl ov12_0223BFFC add r0, r4, #0 - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext add r1, r0, #0 add r0, r4, #0 bl ov12_022581BC @@ -19039,7 +19039,7 @@ ov12_02261ED4: ; 0x02261ED4 mov r1, #2 bl ov12_0223BFFC add r0, r4, #0 - bl ov12_0223A7E4 + bl BattleSystem_GetBattleContext add r1, r0, #0 add r0, r4, #0 bl ov12_022581BC diff --git a/asm/overlay_12_battle_controller_player.s b/asm/overlay_12_battle_controller_player.s index e1759f264f..ad86f79c83 100644 --- a/asm/overlay_12_battle_controller_player.s +++ b/asm/overlay_12_battle_controller_player.s @@ -15,2186 +15,14 @@ .public ov12_0224930C .public ov12_02249460 .public BattleControllerPlayer_UpdateFieldCondition - - thumb_func_start ov12_02249CC4 -ov12_02249CC4: ; 0x02249CC4 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x18 - add r4, r1, #0 - mov r1, #0 - str r1, [sp, #0x10] - str r0, [sp, #4] - bl BattleSystem_GetMaxBattlers - ldr r1, [r4, #8] - str r0, [sp, #0xc] - add r0, r4, #0 - add r2, r1, #0 - mov r3, #1 - bl ov12_0224DC74 - cmp r0, #1 - beq _02249D00 - ldr r1, [r4, #8] - add r0, r4, #0 - add r2, r1, #0 - bl ov12_0224DD18 - cmp r0, #1 - beq _02249D00 - ldr r0, [sp, #4] - add r1, r4, #0 - bl ov12_0224D7EC - cmp r0, #1 - bne _02249D04 -_02249D00: - bl ov12_0224A6E0 -_02249D04: - ldr r1, [r4, #0x1c] - ldr r0, [sp, #0xc] - cmp r1, r0 - blt _02249D10 - bl _0224A6D6 -_02249D10: - ldr r0, _0224A040 ; =0x000021EC - add r1, r4, r1 - ldrb r5, [r1, r0] - add r0, r5, #0 - bl MaskOfFlagNo - ldr r1, _0224A044 ; =0x00003108 - ldrb r1, [r4, r1] - tst r0, r1 - beq _02249D2E - ldr r0, [r4, #0x1c] - add r0, r0, #1 - str r0, [r4, #0x1c] - bl _0224A6CA -_02249D2E: - ldr r0, [r4, #0x18] - cmp r0, #0x1a - bls _02249D38 - bl _0224A6BA -_02249D38: - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_02249D44: ; jump table - .short _02249D7A - _02249D44 - 2 ; case 0 - .short _02249DE2 - _02249D44 - 2 ; case 1 - .short _02249E64 - _02249D44 - 2 ; case 2 - .short _02249E80 - _02249D44 - 2 ; case 3 - .short _02249E9C - _02249D44 - 2 ; case 4 - .short _02249EB8 - _02249D44 - 2 ; case 5 - .short _02249F22 - _02249D44 - 2 ; case 6 - .short _02249F74 - _02249D44 - 2 ; case 7 - .short _02249FF4 - _02249D44 - 2 ; case 8 - .short _0224A030 - _02249D44 - 2 ; case 9 - .short _0224A09E - _02249D44 - 2 ; case 10 - .short _0224A0DC - _02249D44 - 2 ; case 11 - .short _0224A154 - _02249D44 - 2 ; case 12 - .short _0224A1D8 - _02249D44 - 2 ; case 13 - .short _0224A2D8 - _02249D44 - 2 ; case 14 - .short _0224A340 - _02249D44 - 2 ; case 15 - .short _0224A3F4 - _02249D44 - 2 ; case 16 - .short _0224A484 - _02249D44 - 2 ; case 17 - .short _0224A4A2 - _02249D44 - 2 ; case 18 - .short _0224A4E8 - _02249D44 - 2 ; case 19 - .short _0224A534 - _02249D44 - 2 ; case 20 - .short _0224A57E - _02249D44 - 2 ; case 21 - .short _0224A5C8 - _02249D44 - 2 ; case 22 - .short _0224A612 - _02249D44 - 2 ; case 23 - .short _0224A662 - _02249D44 - 2 ; case 24 - .short _0224A696 - _02249D44 - 2 ; case 25 - .short _0224A6B0 - _02249D44 - 2 ; case 26 -_02249D7A: - mov r6, #0xc0 - add r0, r5, #0 - mul r0, r6 - add r3, r4, r0 - mov r0, #0xb7 - lsl r0, r0, #6 - mov r1, #1 - ldr r2, [r3, r0] - lsl r1, r1, #0xa - tst r1, r2 - beq _02249DD8 - add r1, r0, #0 - sub r1, #0x34 - ldr r2, [r3, r1] - add r1, r0, #0 - sub r1, #0x30 - ldr r1, [r3, r1] - cmp r2, r1 - beq _02249DD8 - cmp r2, #0 - beq _02249DD8 - add r0, #0xc - ldr r0, [r3, r0] - lsl r0, r0, #0xd - lsr r0, r0, #0x1d - beq _02249DBE - add r6, #0x58 - add r0, r4, #0 - mov r1, #1 - mov r2, #0xef - str r5, [r4, r6] - bl ReadBattleScriptFromNarc - b _02249DCC -_02249DBE: - add r6, #0x58 - add r0, r4, #0 - mov r1, #1 - mov r2, #0x89 - str r5, [r4, r6] - bl ReadBattleScriptFromNarc -_02249DCC: - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_02249DD8: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - bl _0224A6BA -_02249DE2: - mov r6, #0xc0 - add r0, r5, #0 - mul r0, r6 - add r3, r4, r0 - mov r0, #0xb7 - lsl r0, r0, #6 - mov r1, #1 - ldr r2, [r3, r0] - lsl r1, r1, #0x18 - tst r1, r2 - beq _02249E5A - add r1, r0, #0 - sub r1, #0x34 - ldr r2, [r3, r1] - add r1, r0, #0 - sub r1, #0x30 - ldr r1, [r3, r1] - cmp r2, r1 - beq _02249E5A - cmp r2, #0 - beq _02249E5A - add r1, r0, #0 - add r1, #0xc - ldr r1, [r3, r1] - lsl r1, r1, #0xd - lsr r1, r1, #0x1d - beq _02249E28 - add r6, #0x58 - add r0, r4, #0 - mov r1, #1 - mov r2, #0xef - str r5, [r4, r6] - bl ReadBattleScriptFromNarc - b _02249E4E -_02249E28: - add r1, r6, #0 - add r1, #0x58 - str r5, [r4, r1] - add r1, r6, #0 - add r1, #0xc8 - add r6, #0x64 - str r1, [r4, r6] - sub r0, #0x30 - ldr r0, [r3, r0] - mov r1, #0x10 - bl DamageDivide - ldr r1, _0224A048 ; =0x0000215C - mov r2, #0xa9 - str r0, [r4, r1] - add r0, r4, #0 - mov r1, #1 - bl ReadBattleScriptFromNarc -_02249E4E: - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_02249E5A: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - bl _0224A6BA -_02249E64: - ldr r0, [sp, #4] - add r1, r4, #0 - add r2, r5, #0 - bl ov12_02253068 - cmp r0, #1 - bne _02249E76 - mov r0, #1 - str r0, [sp, #0x10] -_02249E76: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - bl _0224A6BA -_02249E80: - ldr r0, [sp, #4] - add r1, r4, #0 - add r2, r5, #0 - bl TryUseHeldItem - cmp r0, #1 - bne _02249E92 - mov r0, #1 - str r0, [sp, #0x10] -_02249E92: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - bl _0224A6BA -_02249E9C: - ldr r0, [sp, #4] - add r1, r4, #0 - add r2, r5, #0 - bl CheckItemGradualHPRestore - cmp r0, #1 - bne _02249EAE - mov r0, #1 - str r0, [sp, #0x10] -_02249EAE: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - bl _0224A6BA -_02249EB8: - mov r3, #0xc0 - add r0, r5, #0 - mul r0, r3 - mov r2, #0xb7 - add r6, r4, r0 - lsl r2, r2, #6 - ldr r0, [r6, r2] - mov r1, #4 - tst r1, r0 - beq _02249F1A - mov r1, #3 - and r0, r1 - add r1, r0, #0 - mul r1, r3 - add r0, r4, r1 - sub r2, #0x34 - ldr r0, [r0, r2] - cmp r0, #0 - beq _02249F1A - add r0, r4, #0 - add r1, r5, #0 - bl GetBattlerAbility - cmp r0, #0x62 - beq _02249F1A - ldr r0, _0224A04C ; =0x00002D8C - ldr r1, [r6, r0] - cmp r1, #0 - beq _02249F1A - add r0, #0x34 - ldr r1, [r6, r0] - mov r0, #3 - and r1, r0 - mov r0, #0x47 - lsl r0, r0, #2 - str r1, [r4, r0] - add r0, r0, #4 - str r5, [r4, r0] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x45 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_02249F1A: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_02249F22: - mov r2, #0xc0 - add r0, r5, #0 - mul r0, r2 - ldr r3, _0224A050 ; =0x00002DAC - add r0, r4, r0 - ldr r1, [r0, r3] - mov r6, #8 - tst r1, r6 - beq _02249F6C - add r1, r3, #0 - sub r1, #0x20 - ldr r1, [r0, r1] - cmp r1, #0 - beq _02249F6C - add r2, #0x58 - str r5, [r4, r2] - sub r3, #0x1c - ldr r1, [r0, r3] - add r0, r6, #0 - sub r0, #9 - mul r0, r1 - add r1, r6, #0 - bl DamageDivide - ldr r1, _0224A048 ; =0x0000215C - mov r2, #0x17 - str r0, [r4, r1] - add r0, r4, #0 - mov r1, #1 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_02249F6C: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_02249F74: - mov r0, #0xc0 - mul r0, r5 - ldr r1, _0224A050 ; =0x00002DAC - add r6, r4, r0 - ldr r0, [r6, r1] - mov r2, #0x80 - tst r0, r2 - beq _02249FEC - add r0, r1, #0 - sub r0, #0x20 - ldr r0, [r6, r0] - cmp r0, #0 - beq _02249FEC - add r2, #0x98 - str r5, [r4, r2] - sub r1, #0x1c - ldr r0, [r6, r1] - mov r1, #0x10 - bl DamageDivide - ldr r1, _0224A048 ; =0x0000215C - str r0, [r4, r1] - ldr r1, _0224A050 ; =0x00002DAC - mov r0, #0xf - ldr r2, [r6, r1] - lsl r0, r0, #8 - add r3, r2, #0 - and r3, r0 - cmp r3, r0 - beq _02249FB8 - mov r0, #1 - lsl r0, r0, #8 - add r0, r2, r0 - str r0, [r6, r1] -_02249FB8: - ldr r2, _0224A050 ; =0x00002DAC - ldr r0, _0224A048 ; =0x0000215C - ldr r3, [r6, r2] - mov r2, #0xf - lsl r2, r2, #8 - and r2, r3 - ldr r1, [r4, r0] - lsr r2, r2, #8 - mul r2, r1 - str r2, [r4, r0] - mov r1, #0 - ldr r2, [r4, r0] - mvn r1, r1 - mul r1, r2 - str r1, [r4, r0] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x17 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_02249FEC: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_02249FF4: - mov r0, #0xc0 - add r1, r5, #0 - mul r1, r0 - add r6, r4, r1 - ldr r1, _0224A050 ; =0x00002DAC - mov r2, #0x10 - ldr r3, [r6, r1] - tst r2, r3 - beq _0224A028 - sub r1, #0x20 - ldr r1, [r6, r1] - cmp r1, #0 - beq _0224A028 - add r0, #0x58 - str r5, [r4, r0] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x1a - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A028: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A030: - mov r6, #0xc0 - add r0, r5, #0 - mul r0, r6 - add r3, r4, r0 - ldr r7, _0224A054 ; =0x00002DB0 - ldr r0, _0224A044 ; =0x00003108 - b _0224A058 - nop -_0224A040: .word 0x000021EC -_0224A044: .word 0x00003108 -_0224A048: .word 0x0000215C -_0224A04C: .word 0x00002D8C -_0224A050: .word 0x00002DAC -_0224A054: .word 0x00002DB0 -_0224A058: - ldr r2, [r3, r7] - lsl r0, r0, #0x18 - tst r0, r2 - beq _0224A096 - add r0, r7, #0 - sub r0, #0x24 - ldr r0, [r3, r0] - cmp r0, #0 - beq _0224A096 - sub r0, r7, #4 - ldr r1, [r3, r0] - mov r0, #7 - tst r0, r1 - beq _0224A090 - add r6, #0x58 - str r5, [r4, r6] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x5e - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] - b _0224A096 -_0224A090: - ldr r0, _0224A398 ; =0xF7FFFFFF - and r0, r2 - str r0, [r3, r7] -_0224A096: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A09E: - mov r0, #0xc0 - add r1, r5, #0 - mul r1, r0 - add r6, r4, r1 - ldr r1, _0224A39C ; =0x00002DB0 - mov r2, #1 - ldr r3, [r6, r1] - lsl r2, r2, #0x1c - tst r2, r3 - beq _0224A0D4 - sub r1, #0x24 - ldr r1, [r6, r1] - cmp r1, #0 - beq _0224A0D4 - add r0, #0x58 - str r5, [r4, r0] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x62 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A0D4: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A0DC: - mov r0, #0xc0 - add r1, r5, #0 - mul r1, r0 - add r6, r4, r1 - ldr r1, _0224A39C ; =0x00002DB0 - mov r7, #0xe - ldr r3, [r6, r1] - lsl r7, r7, #0xc - add r2, r3, #0 - tst r2, r7 - beq _0224A14C - add r2, r1, #0 - sub r2, #0x24 - ldr r2, [r6, r2] - cmp r2, #0 - beq _0224A14C - mov r2, #2 - lsl r2, r2, #0xc - sub r2, r3, r2 - str r2, [r6, r1] - ldr r2, [r6, r1] - tst r2, r7 - beq _0224A128 - sub r1, #0x20 - ldr r1, [r6, r1] - sub r0, #0xc1 - mul r0, r1 - mov r1, #0x10 - bl DamageDivide - ldr r1, _0224A3A0 ; =0x0000215C - mov r2, #0x3b - str r0, [r4, r1] - add r0, r4, #0 - mov r1, #1 - bl ReadBattleScriptFromNarc - b _0224A132 -_0224A128: - add r0, r4, #0 - mov r1, #1 - mov r2, #0x3c - bl ReadBattleScriptFromNarc -_0224A132: - ldr r0, _0224A3A4 ; =0x00002DEA - ldrh r1, [r6, r0] - mov r0, #0x49 - lsl r0, r0, #2 - str r1, [r4, r0] - sub r0, #0xc - str r5, [r4, r0] - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A14C: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A154: - mov r0, #0x7b - str r0, [sp] - ldr r0, [sp, #4] - add r1, r4, #0 - mov r2, #4 - add r3, r5, #0 - bl CheckAbilityActive - mov r1, #0x4e - lsl r1, r1, #2 - str r0, [r4, r1] - mov r0, #0xc0 - mul r0, r5 - add r6, r4, r0 - ldr r0, _0224A3A8 ; =0x00002DAC - ldr r1, [r6, r0] - mov r0, #7 - tst r0, r1 - beq _0224A1D0 - add r0, r4, #0 - add r1, r5, #0 - bl GetBattlerAbility - cmp r0, #0x62 - beq _0224A1D0 - ldr r1, _0224A3AC ; =0x00002D8C - ldr r0, [r6, r1] - cmp r0, #0 - beq _0224A1D0 - mov r0, #0x4e - lsl r0, r0, #2 - ldr r0, [r4, r0] - cmp r0, #0 - beq _0224A1D0 - add r0, r1, #4 - ldr r1, [r6, r0] - mov r0, #0 - mvn r0, r0 - mul r0, r1 - mov r1, #8 - bl DamageDivide - ldr r1, _0224A3A0 ; =0x0000215C - ldr r2, _0224A3B0 ; =0x00000107 - str r0, [r4, r1] - add r0, r4, #0 - mov r1, #1 - bl ReadBattleScriptFromNarc - ldr r0, _0224A3B4 ; =0x0000213C - mov r1, #0x40 - ldr r2, [r4, r0] - orr r2, r1 - str r2, [r4, r0] - add r1, #0xd8 - str r5, [r4, r1] - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A1D0: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A1D8: - mov r0, #0xc0 - mul r0, r5 - add r7, r4, r0 - ldr r0, _0224A39C ; =0x00002DB0 - ldr r1, [r7, r0] - mov r0, #0x70 - tst r0, r1 - beq _0224A2C8 - ldr r0, [sp, #0xc] - mov r6, #0 - cmp r0, #0 - ble _0224A23A -_0224A1F0: - mov r0, #0xc0 - mul r0, r6 - add r2, r4, r0 - ldr r0, _0224A3A8 ; =0x00002DAC - ldr r1, [r2, r0] - mov r0, #7 - tst r0, r1 - beq _0224A22E - ldr r0, _0224A3AC ; =0x00002D8C - ldr r0, [r2, r0] - cmp r0, #0 - beq _0224A22E - add r0, r4, #0 - add r1, r6, #0 - bl GetBattlerAbility - cmp r0, #0x2b - beq _0224A22E - mov r0, #0x46 - lsl r0, r0, #2 - str r6, [r4, r0] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x13 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - b _0224A23A -_0224A22E: - add r0, r6, #1 - lsl r0, r0, #0x18 - lsr r6, r0, #0x18 - ldr r0, [sp, #0xc] - cmp r6, r0 - blt _0224A1F0 -_0224A23A: - ldr r0, [sp, #0xc] - cmp r6, r0 - beq _0224A246 - mov r0, #2 - str r0, [sp, #0x10] - b _0224A6BA -_0224A246: - ldr r0, _0224A39C ; =0x00002DB0 - ldr r1, [r7, r0] - sub r1, #0x10 - str r1, [r7, r0] - add r0, r4, #0 - add r1, r5, #0 - bl ov12_02252218 - cmp r0, #0 - ldr r2, _0224A39C ; =0x00002DB0 - beq _0224A280 - ldr r1, [r7, r2] - mov r0, #0x70 - bic r1, r0 - mov r6, #0xf1 - add r0, r5, #0 - str r1, [r7, r2] - bl MaskOfFlagNo - add r3, r6, #0 - add r3, #0x8f - lsl r2, r0, #8 - add r0, r6, #0 - sub r0, #0xf2 - ldr r1, [r4, r3] - eor r0, r2 - and r0, r1 - str r0, [r4, r3] - b _0224A2AC -_0224A280: - ldr r1, [r7, r2] - mov r0, #0x70 - tst r0, r1 - beq _0224A28C - mov r6, #0xf0 - b _0224A2AC -_0224A28C: - mov r0, #0x70 - bic r1, r0 - mov r6, #0xf1 - add r0, r5, #0 - str r1, [r7, r2] - bl MaskOfFlagNo - add r3, r6, #0 - add r3, #0x8f - lsl r2, r0, #8 - add r0, r6, #0 - sub r0, #0xf2 - ldr r1, [r4, r3] - eor r0, r2 - and r0, r1 - str r0, [r4, r3] -_0224A2AC: - mov r0, #0x46 - lsl r0, r0, #2 - str r5, [r4, r0] - add r0, r4, #0 - mov r1, #1 - add r2, r6, #0 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A2C8: - ldr r0, [sp, #0x10] - cmp r0, #2 - bne _0224A2D0 - b _0224A6BA -_0224A2D0: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A2D8: - mov r2, #0xc0 - add r0, r5, #0 - mul r0, r2 - add r6, r4, r0 - ldr r0, _0224A39C ; =0x00002DB0 - lsl r2, r2, #4 - ldr r1, [r6, r0] - tst r2, r1 - beq _0224A338 - mov r2, #1 - lsl r2, r2, #0xa - sub r1, r1, r2 - str r1, [r6, r0] - add r0, r4, #0 - add r1, r5, #0 - bl ov12_02252218 - cmp r0, #0 - beq _0224A30A - ldr r1, _0224A39C ; =0x00002DB0 - ldr r0, _0224A3B8 ; =0xFFFFF3FF - ldr r2, [r6, r1] - and r0, r2 - str r0, [r6, r1] - b _0224A338 -_0224A30A: - ldr r0, _0224A39C ; =0x00002DB0 - ldr r1, [r6, r0] - mov r0, #3 - lsl r0, r0, #0xa - tst r0, r1 - bne _0224A338 - mov r0, #7 - tst r0, r1 - bne _0224A338 - add r0, r4, #0 - add r0, #0x94 - str r5, [r0] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x33 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A338: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A340: - mov r0, #0xc0 - add r6, r5, #0 - mul r6, r0 - add r0, r4, r6 - ldr r1, _0224A3BC ; =0x00002DE8 - mov ip, r0 - ldrh r3, [r0, r1] - cmp r3, #0 - beq _0224A3EC - ldr r7, _0224A3C0 ; =0x00002D4C - mov r2, #0 - mov r1, ip -_0224A358: - ldrh r0, [r1, r7] - cmp r3, r0 - beq _0224A366 - add r2, r2, #1 - add r1, r1, #2 - cmp r2, #4 - blt _0224A358 -_0224A366: - cmp r2, #4 - bne _0224A376 - ldr r0, _0224A3C4 ; =0x00002DC8 - add r1, r4, r0 - ldr r2, [r1, r6] - mov r0, #7 - bic r2, r0 - str r2, [r1, r6] -_0224A376: - ldr r1, _0224A3C4 ; =0x00002DC8 - add r0, r4, r6 - ldr r0, [r0, r1] - lsl r0, r0, #0x1d - lsr r0, r0, #0x1d - beq _0224A3C8 - add r2, r4, r1 - ldr r1, [r2, r6] - mov r3, #7 - bic r1, r3 - sub r3, r0, #1 - mov r0, #7 - and r0, r3 - orr r0, r1 - str r0, [r2, r6] - b _0224A3EC - nop -_0224A398: .word 0xF7FFFFFF -_0224A39C: .word 0x00002DB0 -_0224A3A0: .word 0x0000215C -_0224A3A4: .word 0x00002DEA -_0224A3A8: .word 0x00002DAC -_0224A3AC: .word 0x00002D8C -_0224A3B0: .word 0x00000107 -_0224A3B4: .word 0x0000213C -_0224A3B8: .word 0xFFFFF3FF -_0224A3BC: .word 0x00002DE8 -_0224A3C0: .word 0x00002D4C -_0224A3C4: .word 0x00002DC8 -_0224A3C8: - mov r2, #0 - add r1, #0x20 - mov r0, ip - strh r2, [r0, r1] - mov r0, #0x46 - lsl r0, r0, #2 - str r5, [r4, r0] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x48 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A3EC: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A3F4: - mov r0, #0xc0 - add r6, r5, #0 - mul r6, r0 - add r0, r4, r6 - ldr r1, _0224A6E4 ; =0x00002DEC - str r0, [sp, #8] - ldrh r2, [r0, r1] - cmp r2, #0 - beq _0224A47C - ldr r7, _0224A6E8 ; =0x00002D4C - mov r3, #0 - add r1, r0, #0 -_0224A40C: - ldrh r0, [r1, r7] - cmp r2, r0 - beq _0224A41A - add r3, r3, #1 - add r1, r1, #2 - cmp r3, #4 - blt _0224A40C -_0224A41A: - cmp r3, #4 - beq _0224A42C - beq _0224A438 - ldr r0, [sp, #8] - add r1, r0, r3 - ldr r0, _0224A6EC ; =0x00002D6C - ldrb r0, [r1, r0] - cmp r0, #0 - bne _0224A438 -_0224A42C: - ldr r0, _0224A6F0 ; =0x00002DC8 - add r2, r4, r0 - ldr r1, [r2, r6] - mov r0, #0x38 - bic r1, r0 - str r1, [r2, r6] -_0224A438: - ldr r1, _0224A6F0 ; =0x00002DC8 - add r0, r4, r6 - ldr r0, [r0, r1] - lsl r0, r0, #0x1a - lsr r2, r0, #0x1d - beq _0224A458 - add r1, r4, r1 - sub r2, r2, #1 - lsl r2, r2, #0x1d - ldr r0, [r1, r6] - mov r3, #0x38 - bic r0, r3 - lsr r2, r2, #0x1a - orr r0, r2 - str r0, [r1, r6] - b _0224A47C -_0224A458: - ldr r0, [sp, #8] - mov r2, #0 - add r1, #0x24 - strh r2, [r0, r1] - mov r0, #0x46 - lsl r0, r0, #2 - str r5, [r4, r0] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x4a - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A47C: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A484: - mov r0, #0xc0 - mul r0, r5 - add r3, r4, r0 - mov r0, #0xb7 - lsl r0, r0, #6 - ldr r2, [r3, r0] - mov r1, #0x18 - tst r1, r2 - beq _0224A49A - sub r2, #8 - str r2, [r3, r0] -_0224A49A: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A4A2: - mov r0, #0xc0 - mul r0, r5 - ldr r2, _0224A6F0 ; =0x00002DC8 - add r5, r4, r0 - ldr r1, [r5, r2] - lsl r1, r1, #0x18 - lsr r1, r1, #0x1e - beq _0224A4E0 - add r3, r4, r2 - ldr r6, [r3, r0] - mov r1, #0xc0 - add r7, r6, #0 - bic r7, r1 - lsl r1, r6, #0x18 - lsr r1, r1, #0x1e - sub r1, r1, #1 - lsl r1, r1, #0x1e - lsr r1, r1, #0x18 - orr r1, r7 - str r1, [r3, r0] - ldr r0, [r3, r0] - lsl r0, r0, #0x18 - lsr r0, r0, #0x1e - bne _0224A4E0 - add r0, r2, #0 - sub r0, #8 - ldr r1, [r5, r0] - ldr r0, _0224A6F4 ; =0xFFFFFDFF - sub r2, #8 - and r0, r1 - str r0, [r5, r2] -_0224A4E0: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A4E8: - ldr r0, _0224A6F0 ; =0x00002DC8 - mov r2, #0xc0 - add r3, r5, #0 - mul r3, r2 - add r1, r4, r0 - ldr r7, [r1, r3] - lsl r0, r7, #0x15 - lsr r6, r0, #0x1d - beq _0224A52C - ldr r0, _0224A6F8 ; =0xFFFFF8FF - and r7, r0 - sub r0, r6, #1 - lsl r0, r0, #0x1d - lsr r0, r0, #0x15 - orr r0, r7 - str r0, [r1, r3] - ldr r0, [r1, r3] - lsl r0, r0, #0x15 - lsr r0, r0, #0x1d - bne _0224A52C - add r0, r2, #0 - add r0, #0x58 - str r5, [r4, r0] - add r0, r4, #0 - mov r1, #1 - add r2, #0x60 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A52C: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A534: - ldr r0, _0224A6FC ; =0x00002DCC - mov r1, #0xc0 - add r3, r5, #0 - mul r3, r1 - add r2, r4, r0 - ldr r7, [r2, r3] - lsl r0, r7, #0x10 - lsr r6, r0, #0x1d - beq _0224A576 - ldr r0, _0224A700 ; =0xFFFF1FFF - and r7, r0 - sub r0, r6, #1 - lsl r0, r0, #0x1d - lsr r0, r0, #0x10 - orr r0, r7 - str r0, [r2, r3] - ldr r0, [r2, r3] - lsl r0, r0, #0x10 - lsr r0, r0, #0x1d - bne _0224A576 - add r1, #0x58 - str r5, [r4, r1] - add r0, r4, #0 - mov r1, #1 - mov r2, #0xf2 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A576: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A57E: - ldr r0, _0224A6FC ; =0x00002DCC - mov r1, #0xc0 - add r3, r5, #0 - mul r3, r1 - add r2, r4, r0 - ldr r7, [r2, r3] - lsl r0, r7, #0xd - lsr r6, r0, #0x1d - beq _0224A5C0 - ldr r0, _0224A704 ; =0xFFF8FFFF - and r7, r0 - sub r0, r6, #1 - lsl r0, r0, #0x1d - lsr r0, r0, #0xd - orr r0, r7 - str r0, [r2, r3] - ldr r0, [r2, r3] - lsl r0, r0, #0xd - lsr r0, r0, #0x1d - bne _0224A5C0 - add r1, #0x58 - str r5, [r4, r1] - add r0, r4, #0 - mov r1, #1 - mov r2, #0xf3 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A5C0: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A5C8: - ldr r0, _0224A6FC ; =0x00002DCC - mov r1, #0xc0 - add r3, r5, #0 - mul r3, r1 - add r2, r4, r0 - ldr r7, [r2, r3] - lsl r0, r7, #0xa - lsr r6, r0, #0x1d - beq _0224A60A - ldr r0, _0224A708 ; =0xFFC7FFFF - and r7, r0 - sub r0, r6, #1 - lsl r0, r0, #0x1d - lsr r0, r0, #0xa - orr r0, r7 - str r0, [r2, r3] - ldr r0, [r2, r3] - lsl r0, r0, #0xa - lsr r0, r0, #0x1d - bne _0224A60A - add r1, #0x58 - str r5, [r4, r1] - add r0, r4, #0 - mov r1, #1 - mov r2, #0xf4 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A60A: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A612: - mov r6, #0xc0 - add r0, r5, #0 - mul r0, r6 - mov r3, #0xb7 - add r1, r4, r0 - lsl r3, r3, #6 - ldr r0, [r1, r3] - lsl r2, r6, #5 - tst r2, r0 - beq _0224A65A - mov r2, #2 - lsl r2, r2, #0xa - sub r0, r0, r2 - str r0, [r1, r3] - ldr r1, [r1, r3] - lsl r0, r6, #5 - tst r0, r1 - bne _0224A65A - add r0, r4, #0 - add r0, #0x94 - str r5, [r0] - add r0, r4, #0 - mov r1, #4 - add r0, #0x88 - str r1, [r0] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x12 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A65A: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A662: - ldr r0, [sp, #4] - add r1, r4, #0 - add r2, r5, #0 - add r3, sp, #0x14 - bl CheckUseHeldItem - cmp r0, #1 - bne _0224A68E - mov r0, #0x46 - lsl r0, r0, #2 - str r5, [r4, r0] - ldr r2, [sp, #0x14] - add r0, r4, #0 - mov r1, #1 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #1 - str r0, [sp, #0x10] -_0224A68E: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A696: - ldr r0, [sp, #4] - add r1, r4, #0 - add r2, r5, #0 - bl TryHeldItemNegativeEffect - cmp r0, #1 - bne _0224A6A8 - mov r0, #1 - str r0, [sp, #0x10] -_0224A6A8: - ldr r0, [r4, #0x18] - add r0, r0, #1 - str r0, [r4, #0x18] - b _0224A6BA -_0224A6B0: - mov r0, #0 - str r0, [r4, #0x18] - ldr r0, [r4, #0x1c] - add r0, r0, #1 - str r0, [r4, #0x1c] -_0224A6BA: - ldr r0, [sp, #0x10] - cmp r0, #0 - beq _0224A6CA - ldr r0, [sp, #4] - bl ov12_022642F0 - add sp, #0x18 - pop {r3, r4, r5, r6, r7, pc} -_0224A6CA: - ldr r1, [r4, #0x1c] - ldr r0, [sp, #0xc] - cmp r1, r0 - bge _0224A6D6 - bl _02249D10 -_0224A6D6: - mov r0, #0 - str r0, [r4, #0x18] - str r0, [r4, #0x1c] - mov r0, #0xb - str r0, [r4, #8] - thumb_func_end ov12_02249CC4 - - thumb_func_start ov12_0224A6E0 -ov12_0224A6E0: ; 0x0224A6E0 - add sp, #0x18 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_0224A6E4: .word 0x00002DEC -_0224A6E8: .word 0x00002D4C -_0224A6EC: .word 0x00002D6C -_0224A6F0: .word 0x00002DC8 -_0224A6F4: .word 0xFFFFFDFF -_0224A6F8: .word 0xFFFFF8FF -_0224A6FC: .word 0x00002DCC -_0224A700: .word 0xFFFF1FFF -_0224A704: .word 0xFFF8FFFF -_0224A708: .word 0xFFC7FFFF - thumb_func_end ov12_0224A6E0 - - thumb_func_start ov12_0224A70C -ov12_0224A70C: ; 0x0224A70C - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - add r4, r1, #0 - str r0, [sp] - bl BattleSystem_GetMaxBattlers - ldr r1, [r4, #8] - add r7, r0, #0 - add r0, r4, #0 - add r2, r1, #0 - mov r3, #1 - bl ov12_0224DC74 - cmp r0, #1 - bne _0224A72C - b _0224A93C -_0224A72C: - ldr r0, [sp] - bl ov12_022642F0 - ldr r0, [r4, #0x20] - cmp r0, #0 - beq _0224A744 - cmp r0, #1 - beq _0224A82E - cmp r0, #2 - bne _0224A742 - b _0224A8F4 -_0224A742: - b _0224A932 -_0224A744: - ldr r0, [r4, #0x24] - cmp r0, r7 - bge _0224A824 - add r5, r4, #0 - add r5, #0x24 -_0224A74E: - add r1, r4, r0 - ldr r0, _0224A940 ; =0x000021EC - ldrb r6, [r1, r0] - add r0, r6, #0 - bl MaskOfFlagNo - ldr r1, _0224A944 ; =0x00003108 - ldrb r1, [r4, r1] - tst r0, r1 - ldr r0, [r5] - beq _0224A76A - add r0, r0, #1 - str r0, [r5] - b _0224A81E -_0224A76A: - add r0, r0, #1 - mov r1, #0x62 - str r0, [r5] - add r0, r4, r6 - lsl r1, r1, #2 - ldrb r1, [r0, r1] - cmp r1, #0 - beq _0224A81E - mov r1, #0x62 - lsl r1, r1, #2 - ldrb r1, [r0, r1] - sub r2, r1, #1 - mov r1, #0x62 - lsl r1, r1, #2 - strb r2, [r0, r1] - ldrb r0, [r0, r1] - cmp r0, #0 - bne _0224A81E - mov r0, #0xc0 - mul r0, r6 - add r1, r4, r0 - ldr r0, _0224A948 ; =0x00002D8C - ldr r0, [r1, r0] - cmp r0, #0 - beq _0224A81E - ldr r0, [sp] - add r1, r6, #0 - bl BattleSystem_GetFieldSide - mov r2, #0x6f - lsl r2, r2, #2 - add r1, r4, r2 - lsl r5, r0, #2 - ldr r3, [r1, r5] - mov r0, #0x10 - bic r3, r0 - add r0, r4, #0 - str r3, [r1, r5] - add r2, #0x1f - add r0, #0xf6 - strh r2, [r0] - add r0, r4, #0 - mov r1, #0xa - add r0, #0xf5 - strb r1, [r0] - add r0, r4, #0 - add r1, r6, #0 - bl CreateNicknameTag - add r1, r4, #0 - add r1, #0xf8 - str r0, [r1] - mov r0, #0x19 - lsl r0, r0, #4 - add r1, r4, #0 - add r3, r4, r0 - lsl r2, r6, #1 - ldrh r5, [r3, r2] - add r1, #0xfc - str r5, [r1] - add r1, r0, #0 - sub r1, #0x78 - str r6, [r4, r1] - lsl r1, r6, #2 - add r5, r0, #0 - add r1, r4, r1 - add r5, #8 - ldr r6, [r1, r5] - add r5, r0, #0 - sub r5, #0x74 - str r6, [r4, r5] - ldrh r3, [r3, r2] - add r2, r0, #0 - sub r2, #0x6c - str r3, [r4, r2] - add r0, #0x18 - ldr r1, [r1, r0] - ldr r0, _0224A94C ; =0x0000215C - mov r2, #0x79 - str r1, [r4, r0] - add r0, r4, #0 - mov r1, #1 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - add sp, #8 - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - pop {r3, r4, r5, r6, r7, pc} -_0224A81E: - ldr r0, [r4, #0x24] - cmp r0, r7 - blt _0224A74E -_0224A824: - ldr r0, [r4, #0x20] - add r0, r0, #1 - str r0, [r4, #0x20] - mov r0, #0 - str r0, [r4, #0x24] -_0224A82E: - ldr r0, [r4, #0x24] - cmp r0, r7 - bge _0224A8EA - add r5, r4, #0 - add r5, #0x24 -_0224A838: - add r1, r4, r0 - ldr r0, _0224A940 ; =0x000021EC - ldrb r6, [r1, r0] - add r0, r6, #0 - bl MaskOfFlagNo - ldr r1, _0224A944 ; =0x00003108 - ldrb r1, [r4, r1] - tst r0, r1 - ldr r0, [r5] - beq _0224A854 - add r0, r0, #1 - str r0, [r5] - b _0224A8E4 -_0224A854: - add r0, r0, #1 - str r0, [r5] - mov r0, #0xc0 - mul r0, r6 - mov r1, #0xb7 - add r3, r4, r0 - lsl r1, r1, #6 - ldr r2, [r3, r1] - mov r1, #0x20 - tst r1, r2 - beq _0224A8E4 - ldr r7, _0224A950 ; =0x00002DC8 - add r2, r4, r7 - ldr r1, [r2, r0] - lsl r1, r1, #0x11 - lsr r1, r1, #0x1e - bne _0224A8AE - add r1, r7, #0 - sub r1, #8 - add r1, r4, r1 - str r1, [sp, #4] - ldr r1, [r1, r0] - mov r5, #0x20 - bic r1, r5 - ldr r5, [sp, #4] - sub r7, #0x3c - str r1, [r5, r0] - ldr r0, [r2, r0] - lsl r0, r0, #0x11 - lsr r1, r0, #0x1e - mov r0, #0x13 - lsl r0, r0, #4 - str r1, [r4, r0] - ldr r0, [r3, r7] - ldr r1, _0224A94C ; =0x0000215C - neg r0, r0 - str r0, [r4, r1] - add r0, r1, #0 - sub r0, #0x20 - ldr r2, [r4, r0] - mov r0, #0x40 - orr r0, r2 - sub r1, #0x20 - str r0, [r4, r1] - b _0224A8C8 -_0224A8AE: - mov r3, #0x13 - lsl r3, r3, #4 - str r1, [r4, r3] - ldr r3, [r2, r0] - ldr r1, _0224A954 ; =0xFFFF9FFF - and r1, r3 - lsl r3, r3, #0x11 - lsr r3, r3, #0x1e - sub r3, r3, #1 - lsl r3, r3, #0x1e - lsr r3, r3, #0x11 - orr r1, r3 - str r1, [r2, r0] -_0224A8C8: - mov r0, #0x46 - lsl r0, r0, #2 - str r6, [r4, r0] - add r0, r4, #0 - mov r1, #1 - mov r2, #0x66 - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - add sp, #8 - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - pop {r3, r4, r5, r6, r7, pc} -_0224A8E4: - ldr r0, [r4, #0x24] - cmp r0, r7 - blt _0224A838 -_0224A8EA: - ldr r0, [r4, #0x20] - add r0, r0, #1 - str r0, [r4, #0x20] - mov r0, #0 - str r0, [r4, #0x24] -_0224A8F4: - mov r1, #6 - lsl r1, r1, #6 - ldr r3, [r4, r1] - mov r2, #7 - lsl r2, r2, #0x10 - add r0, r3, #0 - tst r0, r2 - beq _0224A928 - mov r0, #1 - lsl r0, r0, #0x10 - sub r0, r3, r0 - str r0, [r4, r1] - ldr r0, [r4, r1] - tst r0, r2 - bne _0224A928 - add r0, r4, #0 - mov r1, #1 - mov r2, #0xfb - bl ReadBattleScriptFromNarc - ldr r0, [r4, #8] - add sp, #8 - str r0, [r4, #0xc] - mov r0, #0x16 - str r0, [r4, #8] - pop {r3, r4, r5, r6, r7, pc} -_0224A928: - ldr r0, [r4, #0x20] - add r0, r0, #1 - str r0, [r4, #0x20] - mov r0, #0 - str r0, [r4, #0x24] -_0224A932: - mov r0, #0 - str r0, [r4, #0x20] - str r0, [r4, #0x24] - mov r0, #0xc - str r0, [r4, #8] -_0224A93C: - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_0224A940: .word 0x000021EC -_0224A944: .word 0x00003108 -_0224A948: .word 0x00002D8C -_0224A94C: .word 0x0000215C -_0224A950: .word 0x00002DC8 -_0224A954: .word 0xFFFF9FFF - thumb_func_end ov12_0224A70C - - thumb_func_start ov12_0224A958 -ov12_0224A958: ; 0x0224A958 - push {r3, r4, r5, lr} - add r4, r1, #0 - ldr r1, [r4, #8] - add r5, r0, #0 - add r0, r4, #0 - add r2, r1, #0 - bl ov12_0224DD18 - cmp r0, #1 - beq _0224A9AC - add r0, r5, #0 - add r1, r4, #0 - bl ov12_0224D7EC - cmp r0, #1 - beq _0224A9AC - add r0, r5, #0 - add r1, r4, #0 - bl ov12_0224D540 - cmp r0, #1 - beq _0224A9AC - mov r1, #0x15 - lsl r1, r1, #4 - ldr r0, [r4, r1] - add r0, r0, #1 - str r0, [r4, r1] - add r0, r1, #0 - add r0, #0x24 - ldr r0, [r4, r0] - add r1, #0x24 - add r0, r0, #1 - str r0, [r4, r1] - add r0, r4, #0 - bl BattleContext_Init - add r0, r5, #0 - add r1, r4, #0 - bl ov12_02251710 - mov r0, #2 - str r0, [r4, #8] -_0224A9AC: - pop {r3, r4, r5, pc} - .balign 4, 0 - thumb_func_end ov12_0224A958 - - thumb_func_start ov12_0224A9B0 -ov12_0224A9B0: ; 0x0224A9B0 - push {r4, r5, r6, r7, lr} - sub sp, #0xc - add r5, r1, #0 - str r0, [sp, #8] - add r0, r5, #0 - add r0, #0xec - ldr r0, [r0] - mov r4, #0 - add r1, r5, r0 - ldr r0, _0224AAD8 ; =0x000021E8 - ldrb r2, [r1, r0] - lsl r0, r2, #6 - add r1, r5, r0 - mov r0, #0x75 - str r2, [r5, #0x64] - lsl r0, r0, #2 - ldr r0, [r1, r0] - lsl r0, r0, #0x1f - lsr r0, r0, #0x1f - beq _0224A9E4 - mov r0, #0xc1 - mov r1, #0xa5 - lsl r0, r0, #6 - str r1, [r5, r0] - mov r4, #1 - b _0224AAA8 -_0224A9E4: - mov r0, #0xc0 - mul r0, r2 - ldr r6, _0224AADC ; =0x00002DEC - add r0, r5, r0 - ldrh r1, [r0, r6] - cmp r1, #0 - beq _0224AA0C - add r3, r6, #2 - ldrh r3, [r0, r3] - sub r6, #0xa0 - lsl r3, r3, #1 - add r0, r0, r3 - ldrh r0, [r0, r6] - cmp r1, r0 - bne _0224AA0C - mov r0, #0xc1 - lsl r0, r0, #6 - str r1, [r5, r0] - mov r4, #1 - b _0224AAA8 -_0224AA0C: - cmp r1, #0 - beq _0224AA5E - mov r7, #0xc0 - add r0, r2, #0 - mul r0, r7 - ldr r3, _0224AAE0 ; =0x00002DEE - add r0, r5, r0 - ldrh r6, [r0, r3] - lsl r6, r6, #1 - add r6, r0, r6 - add r0, r3, #0 - sub r0, #0xa2 - ldrh r0, [r6, r0] - cmp r1, r0 - beq _0224AA5E - mov r1, #0xc1 - lsl r1, r1, #6 - str r0, [r5, r1] - ldr r1, [r5, #0x64] - mov r0, #0 - add r2, r1, #0 - mul r2, r7 - add r2, r5, r2 - sub r1, r3, #2 - strh r0, [r2, r1] - ldr r1, [r5, #0x64] - mov r4, #1 - add r2, r1, #0 - mul r2, r7 - add r1, r5, r2 - strh r0, [r1, r3] - ldr r0, [r5, #0x64] - sub r3, #0x26 - add r2, r0, #0 - add r3, r5, r3 - mul r2, r7 - ldr r1, [r3, r2] - mov r0, #0x38 - bic r1, r0 - str r1, [r3, r2] - b _0224AAA8 -_0224AA5E: - add r0, r5, #0 - add r1, r2, #0 - bl Battler_CanSelectAction - cmp r0, #0 - bne _0224AA7A - ldr r0, [r5, #0x64] - lsl r0, r0, #2 - add r1, r5, r0 - ldr r0, _0224AAE4 ; =0x0000304C - ldr r1, [r1, r0] - sub r0, #0xc - str r1, [r5, r0] - b _0224AAA8 -_0224AA7A: - ldr r2, [r5, #0x64] - mov r0, #0xc0 - mul r0, r2 - lsl r1, r2, #1 - add r3, r5, r0 - add r0, r5, r1 - ldr r1, _0224AAE8 ; =0x000030BC - ldrh r2, [r0, r1] - lsl r2, r2, #1 - add r3, r3, r2 - ldr r2, _0224AAEC ; =0x00002D4C - ldrh r3, [r3, r2] - add r2, r1, #0 - sub r2, #8 - ldrh r0, [r0, r2] - cmp r0, r3 - beq _0224AAA4 - sub r1, #0x7c - str r3, [r5, r1] - mov r4, #1 - b _0224AAA8 -_0224AAA4: - sub r1, #0x7c - str r3, [r5, r1] -_0224AAA8: - mov r3, #0xc1 - lsl r3, r3, #6 - ldr r1, [r5, r3] - add r0, r3, #4 - str r1, [r5, r0] - mov r0, #0x17 - str r0, [r5, #8] - str r4, [sp] - mov r0, #0 - str r0, [sp, #4] - ldr r3, [r5, r3] - ldr r0, [sp, #8] - lsl r3, r3, #0x10 - ldr r2, [r5, #0x64] - add r1, r5, #0 - lsr r3, r3, #0x10 - bl ov12_022506D4 - str r0, [r5, #0x6c] - ldr r0, [sp, #8] - bl ov12_022642F0 - add sp, #0xc - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_0224AAD8: .word 0x000021E8 -_0224AADC: .word 0x00002DEC -_0224AAE0: .word 0x00002DEE -_0224AAE4: .word 0x0000304C -_0224AAE8: .word 0x000030BC -_0224AAEC: .word 0x00002D4C - thumb_func_end ov12_0224A9B0 - - thumb_func_start ov12_0224AAF0 -ov12_0224AAF0: ; 0x0224AAF0 - push {r3, r4, r5, r6, r7, lr} - add r4, r1, #0 - add r2, r4, #0 - add r2, #0xec - ldr r2, [r2] - add r7, r0, #0 - add r3, r4, r2 - ldr r2, _0224AC2C ; =0x000021E8 - ldrb r2, [r3, r2] - str r2, [r4, #0x64] - bl ov12_02253DA0 - str r0, [r4, #0x6c] - ldr r0, _0224AC30 ; =0x000021B0 - ldr r1, [r4, #0x64] - add r2, r4, r0 - lsl r0, r1, #4 - add r6, r2, r0 - add r0, r7, #0 - bl BattleSystem_GetFieldSide - cmp r0, #0 - beq _0224AB98 - ldr r0, [r4, #0x64] - asr r0, r0, #1 - add r1, r4, r0 - ldr r0, _0224AC34 ; =0x000003D1 - ldrb r2, [r1, r0] - cmp r2, #4 - bhi _0224AB84 - add r2, r2, r2 - add r2, pc - ldrh r2, [r2, #6] - lsl r2, r2, #0x10 - asr r2, r2, #0x10 - add pc, r2 -_0224AB38: ; jump table - .short _0224AB42 - _0224AB38 - 2 ; case 0 - .short _0224AB46 - _0224AB38 - 2 ; case 1 - .short _0224AB4A - _0224AB38 - 2 ; case 2 - .short _0224AB74 - _0224AB38 - 2 ; case 3 - .short _0224AB82 - _0224AB38 - 2 ; case 4 -_0224AB42: - ldr r5, _0224AC38 ; =0x00000121 - b _0224AB84 -_0224AB46: - ldr r5, _0224AC3C ; =0x0000010B - b _0224AB84 -_0224AB4A: - add r0, r0, #2 - ldrb r0, [r1, r0] - mov r1, #1 - tst r1, r0 - beq _0224AB64 - mov r1, #0x3e - add r2, r0, #0 - tst r2, r1 - beq _0224AB64 - mov r0, #6 - add r1, #0xf2 - str r0, [r4, r1] - b _0224AB6E -_0224AB64: - bl LowestFlagNo - mov r1, #0x13 - lsl r1, r1, #4 - str r0, [r4, r1] -_0224AB6E: - mov r5, #0x43 - lsl r5, r5, #2 - b _0224AB84 -_0224AB74: - add r0, r0, #2 - ldrb r0, [r1, r0] - mov r5, #0x13 - lsl r5, r5, #4 - str r0, [r4, r5] - sub r5, #0x23 - b _0224AB84 -_0224AB82: - ldr r5, _0224AC40 ; =0x0000010E -_0224AB84: - ldr r1, [r4, #0x64] - mov r0, #1 - bic r1, r0 - ldr r0, _0224AC44 ; =0x000003D6 - add r1, r4, r1 - ldrh r1, [r1, r0] - mov r0, #0x4a - lsl r0, r0, #2 - str r1, [r4, r0] - b _0224AC0A -_0224AB98: - ldrb r0, [r6, #2] - cmp r0, #3 - bhi _0224AC02 - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_0224ABAA: ; jump table - .short _0224ABB2 - _0224ABAA - 2 ; case 0 - .short _0224ABB2 - _0224ABAA - 2 ; case 1 - .short _0224ABC8 - _0224ABAA - 2 ; case 2 - .short _0224ABB2 - _0224ABAA - 2 ; case 3 -_0224ABB2: - ldrh r1, [r6] - ldr r0, _0224AC48 ; =0x0000FFC1 - add r0, r1, r0 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - cmp r0, #1 - bhi _0224ABC4 - mov r5, #0xde - b _0224AC02 -_0224ABC4: - mov r5, #0xdf - b _0224AC02 -_0224ABC8: - add r0, r7, #0 - mov r5, #0xb - bl BattleSystem_GetBattleType - mov r1, #1 - tst r0, r1 - bne _0224AC02 - add r0, r7, #0 - bl BattleSystem_GetBattleType - mov r1, #1 - lsl r1, r1, #0xa - tst r0, r1 - bne _0224AC02 - add r0, r7, #0 - bl ov12_0223AA80 - ldrh r1, [r6] - mov r2, #1 - mov r3, #5 - bl Bag_TakeItem - add r0, r7, #0 - bl ov12_0223AA84 - ldrh r1, [r6] - ldrb r2, [r6, #2] - bl BagCursor_Battle_SetLastUsedItem -_0224AC02: - ldrh r1, [r6] - mov r0, #0x4a - lsl r0, r0, #2 - str r1, [r4, r0] -_0224AC0A: - add r0, r4, #0 - mov r1, #1 - add r2, r5, #0 - bl ReadBattleScriptFromNarc - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #0x28 - str r0, [r4, #0xc] - ldr r1, _0224AC4C ; =0x0000216C - mov r0, #2 - ldr r2, [r4, r1] - lsl r0, r0, #0x1e - orr r0, r2 - str r0, [r4, r1] - pop {r3, r4, r5, r6, r7, pc} - nop -_0224AC2C: .word 0x000021E8 -_0224AC30: .word 0x000021B0 -_0224AC34: .word 0x000003D1 -_0224AC38: .word 0x00000121 -_0224AC3C: .word 0x0000010B -_0224AC40: .word 0x0000010E -_0224AC44: .word 0x000003D6 -_0224AC48: .word 0x0000FFC1 -_0224AC4C: .word 0x0000216C - thumb_func_end ov12_0224AAF0 - - thumb_func_start ov12_0224AC50 -ov12_0224AC50: ; 0x0224AC50 - push {r4, lr} - add r4, r1, #0 - add r0, r4, #0 - mov r1, #1 - mov r2, #9 - bl ReadBattleScriptFromNarc - add r0, r4, #0 - add r0, #0xec - ldr r0, [r0] - ldr r1, _0224AC90 ; =0x000021E8 - add r0, r4, r0 - ldrb r0, [r0, r1] - mov r2, #0 - str r0, [r4, #0x64] - str r0, [r4, #0x78] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #0x29 - str r0, [r4, #0xc] - mov r0, #0x4e - lsl r0, r0, #2 - str r2, [r4, r0] - add r0, r1, #0 - sub r0, #0x7c - ldr r2, [r4, r0] - mov r0, #2 - lsl r0, r0, #0x1e - orr r0, r2 - sub r1, #0x7c - str r0, [r4, r1] - pop {r4, pc} - .balign 4, 0 -_0224AC90: .word 0x000021E8 - thumb_func_end ov12_0224AC50 - - thumb_func_start ov12_0224AC94 -ov12_0224AC94: ; 0x0224AC94 - push {r3, r4, r5, lr} - add r4, r1, #0 - add r1, #0xec - ldr r1, [r1] - add r5, r0, #0 - add r2, r4, r1 - ldr r1, _0224AD4C ; =0x000021E8 - ldrb r1, [r2, r1] - str r1, [r4, #0x64] - bl BattleSystem_GetFieldSide - cmp r0, #0 - beq _0224AD06 - add r0, r5, #0 - bl BattleSystem_GetBattleType - mov r1, #4 - tst r0, r1 - bne _0224AD06 - ldr r0, [r4, #0x64] - mov r2, #0xc0 - add r1, r0, #0 - mul r1, r2 - ldr r0, _0224AD50 ; =0x00002DB0 - add r1, r4, r1 - ldr r1, [r1, r0] - ldr r0, _0224AD54 ; =0x0400E000 - tst r0, r1 - beq _0224ACEA - add r0, r4, #0 - mov r1, #1 - add r2, #0x5e - bl ReadBattleScriptFromNarc - add r0, r4, #0 - mov r1, #0 - add r0, #0xb4 - str r1, [r0] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #0x28 - str r0, [r4, #0xc] - pop {r3, r4, r5, pc} -_0224ACEA: - add r0, r4, #0 - mov r1, #1 - mov r2, #0xe6 - bl ReadBattleScriptFromNarc - add r0, r4, #0 - mov r1, #0 - add r0, #0xb4 - str r1, [r0] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #0x2c - str r0, [r4, #0xc] - pop {r3, r4, r5, pc} -_0224AD06: - ldr r2, [r4, #0x64] - add r0, r5, #0 - add r1, r4, #0 - bl BattleTryRun - cmp r0, #0 - beq _0224AD30 - add r0, r4, #0 - mov r1, #1 - mov r2, #3 - bl ReadBattleScriptFromNarc - add r0, r4, #0 - mov r1, #0 - add r0, #0xb4 - str r1, [r0] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #0x2c - str r0, [r4, #0xc] - pop {r3, r4, r5, pc} -_0224AD30: - add r0, r4, #0 - mov r1, #1 - mov r2, #8 - bl ReadBattleScriptFromNarc - add r0, r4, #0 - mov r1, #0 - add r0, #0xb4 - str r1, [r0] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #0x28 - str r0, [r4, #0xc] - pop {r3, r4, r5, pc} - .balign 4, 0 -_0224AD4C: .word 0x000021E8 -_0224AD50: .word 0x00002DB0 -_0224AD54: .word 0x0400E000 - thumb_func_end ov12_0224AC94 - - thumb_func_start ov12_0224AD58 -ov12_0224AD58: ; 0x0224AD58 - push {r3, r4, r5, lr} - add r4, r1, #0 - add r5, r0, #0 - ldr r2, _0224AD9C ; =0x00000113 - add r0, r4, #0 - mov r1, #1 - bl ReadBattleScriptFromNarc - mov r0, #0 - str r0, [r4, #0x64] - mov r0, #1 - str r0, [r4, #0x6c] - mov r0, #0x16 - str r0, [r4, #8] - mov r0, #0x28 - str r0, [r4, #0xc] - mov r0, #0x4a - mov r1, #5 - lsl r0, r0, #2 - str r1, [r4, r0] - add r0, r5, #0 - bl ov12_0223B6B4 - sub r1, r0, #1 - add r0, r5, #0 - bl ov12_0223B6C0 - add r0, r5, #0 - add r1, r4, #0 - mov r2, #0 - bl ov12_02263A1C - pop {r3, r4, r5, pc} - nop -_0224AD9C: .word 0x00000113 - thumb_func_end ov12_0224AD58 + .public BattleControllerPlayer_UpdateMonCondition + .public BattleControllerPlayer_UpdateFieldConditionExtra + .public BattleControllerPlayer_TurnEnd + .public BattleControllerPlayer_FightInput + .public BattleControllerPlayer_ItemInput + .public BattleControllerPlayer_PokemonInput + .public BattleControllerPlayer_RunInput + .public BattleControllerPlayer_SafariBallInput thumb_func_start ov12_0224ADA0 ov12_0224ADA0: ; 0x0224ADA0 @@ -2338,10 +166,10 @@ ov12_0224AE84: ; 0x0224AE84 sub r0, #0xcb str r1, [r4, r0] add r0, r5, #0 - bl ov12_0223B6B4 + bl BattleSystem_GetSafariBallCount sub r1, r0, #1 add r0, r5, #0 - bl ov12_0223B6C0 + bl BattleSystem_SetSafariBallCount ldr r1, _0224AECC ; =0x0000216C mov r0, #2 ldr r2, [r4, r1] @@ -6732,7 +4560,7 @@ _0224D060: bl BattleSystem_GetMaxBattlers ldr r1, [r4, #0x64] add r0, r5, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData bl ov12_02261258 mov r1, #1 add r7, r0, #0 @@ -6763,7 +4591,7 @@ _0224D0AE: beq _0224D116 add r0, r5, #0 add r1, r6, #0 - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData str r0, [sp] cmp r7, #0 beq _0224D0F6 @@ -7227,7 +5055,7 @@ ov12_0224D464: ; 0x0224D464 push {r3, r4, r5, lr} add r5, r0, #0 add r4, r1, #0 - bl BattleSystem_GetWinLoseFlags + bl BattleSystem_GetBattleOutcomeFlags mov r1, #0x80 tst r0, r1 beq _0224D47A @@ -7236,11 +5064,11 @@ ov12_0224D464: ; 0x0224D464 b _0224D4E2 _0224D47A: add r0, r5, #0 - bl BattleSystem_GetWinLoseFlags + bl BattleSystem_GetBattleOutcomeFlags cmp r0, #2 beq _0224D48E add r0, r5, #0 - bl BattleSystem_GetWinLoseFlags + bl BattleSystem_GetBattleOutcomeFlags cmp r0, #3 bne _0224D4A2 _0224D48E: @@ -7255,7 +5083,7 @@ _0224D48E: b _0224D4E2 _0224D4A2: add r0, r5, #0 - bl BattleSystem_GetWinLoseFlags + bl BattleSystem_GetBattleOutcomeFlags cmp r0, #1 bne _0224D4C0 add r0, r4, #0 @@ -7269,7 +5097,7 @@ _0224D4A2: b _0224D4E2 _0224D4C0: add r0, r5, #0 - bl BattleSystem_GetWinLoseFlags + bl BattleSystem_GetBattleOutcomeFlags cmp r0, #4 bne _0224D4D4 mov r0, #0x16 @@ -7279,7 +5107,7 @@ _0224D4C0: b _0224D4E2 _0224D4D4: add r0, r5, #0 - bl BattleSystem_GetWinLoseFlags + bl BattleSystem_GetBattleOutcomeFlags cmp r0, #5 bne _0224D4E2 mov r0, #0x2c @@ -7438,7 +5266,7 @@ _0224D5E6: add r6, r0, #0 ldr r0, [sp] ldr r1, [sp, #0x2c] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r0, r6, #0 add r5, r7, #0 bl GetPartyCount @@ -7531,7 +5359,7 @@ _0224D69E: add r6, r0, #0 ldr r0, [sp] ldr r1, [sp, #0x2c] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r0, r6, #0 add r5, r7, #0 bl GetPartyCount @@ -7621,7 +5449,7 @@ _0224D75E: tst r0, r1 bne _0224D7C6 ldr r0, [sp] - bl ov12_0223B740 + bl BattleSystem_GetBattleStyle cmp r0, #0 bne _0224D7C6 mov r1, #0x4f @@ -7737,7 +5565,7 @@ _0224D820: add r6, r0, #0 ldr r0, [sp] ldr r1, [sp, #0x28] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData add r0, r6, #0 add r4, r7, #0 bl GetPartyCount @@ -7816,7 +5644,7 @@ _0224D8DE: str r0, [sp, #0x18] ldr r0, [sp] ldr r1, [sp, #0x28] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData str r0, [sp, #0x14] add r0, r7, #0 add r5, r4, #0 @@ -7920,7 +5748,7 @@ _0224D9C4: add r6, r0, #0 ldr r0, [sp] ldr r1, [sp, #0x28] - bl BattleSystem_GetOpponentDataByBattlerId + bl BattleSystem_GetOpponentData str r0, [sp, #0x10] add r0, r6, #0 add r4, r7, #0 @@ -8014,7 +5842,7 @@ _0224DA80: _0224DA96: ldr r0, [sp] mov r1, #1 - bl ov12_0223A9F4 + bl BattleSystem_GetTrainer ldrb r0, [r0, #1] sub r0, #0x42 cmp r0, #0x2e @@ -8095,14 +5923,14 @@ _0224DB38: _0224DB3C: ldr r0, [sp] mov r1, #2 - bl ov12_0223BD3C + bl BattleSystem_SetCriticalHpMusicFlag _0224DB44: ldr r0, [sp, #0x1c] cmp r0, #0 beq _0224DB52 ldr r0, [sp] ldr r1, [sp, #0x1c] - bl ov12_0223BD20 + bl BattleSystem_SetBattleOutcomeFlags _0224DB52: ldr r0, [sp, #0x1c] cmp r0, #0 @@ -9405,14 +7233,14 @@ sPlayerBattleCommands: ; 0x0226CA90 .word ov12_0224930C .word ov12_02249460 .word BattleControllerPlayer_UpdateFieldCondition - .word ov12_02249CC4 - .word ov12_0224A70C - .word ov12_0224A958 - .word ov12_0224A9B0 - .word ov12_0224AAF0 - .word ov12_0224AC50 - .word ov12_0224AC94 - .word ov12_0224AD58 + .word BattleControllerPlayer_UpdateMonCondition + .word BattleControllerPlayer_UpdateFieldConditionExtra + .word BattleControllerPlayer_TurnEnd + .word BattleControllerPlayer_FightInput + .word BattleControllerPlayer_ItemInput + .word BattleControllerPlayer_PokemonInput + .word BattleControllerPlayer_RunInput + .word BattleControllerPlayer_SafariBallInput .word ov12_0224ADA0 .word ov12_0224AE04 .word ov12_0224AE64 diff --git a/asm/overlay_12_battle_system.s b/asm/overlay_12_battle_system.s index f313b62e9d..ef7b30f9df 100644 --- a/asm/overlay_12_battle_system.s +++ b/asm/overlay_12_battle_system.s @@ -6,3197 +6,6 @@ .text - thumb_func_start ov12_0223A7D4 -ov12_0223A7D4: ; 0x0223A7D4 - ldr r0, [r0, #4] - bx lr - thumb_func_end ov12_0223A7D4 - - thumb_func_start ov12_0223A7D8 -ov12_0223A7D8: ; 0x0223A7D8 - ldr r2, [r0, #8] - lsl r0, r1, #4 - add r0, r2, r0 - bx lr - thumb_func_end ov12_0223A7D8 - - thumb_func_start BattleSystem_GetBattleType -BattleSystem_GetBattleType: ; 0x0223A7E0 - ldr r0, [r0, #0x2c] - bx lr - thumb_func_end BattleSystem_GetBattleType - - thumb_func_start ov12_0223A7E4 -ov12_0223A7E4: ; 0x0223A7E4 - ldr r0, [r0, #0x30] - bx lr - thumb_func_end ov12_0223A7E4 - - thumb_func_start BattleSystem_GetOpponentDataByBattlerId -BattleSystem_GetOpponentDataByBattlerId: ; 0x0223A7E8 - lsl r1, r1, #2 - add r0, r0, r1 - ldr r0, [r0, #0x34] - bx lr - thumb_func_end BattleSystem_GetOpponentDataByBattlerId - - thumb_func_start BattleSystem_GetMaxBattlers -BattleSystem_GetMaxBattlers: ; 0x0223A7F0 - ldr r0, [r0, #0x44] - bx lr - thumb_func_end BattleSystem_GetMaxBattlers - - thumb_func_start BattleSystem_GetParty -BattleSystem_GetParty: ; 0x0223A7F4 - push {r3, r4, r5, lr} - add r5, r0, #0 - ldr r2, [r5, #0x2c] - mov r3, #8 - add r4, r1, #0 - tst r3, r2 - bne _0223A812 - mov r3, #0x10 - tst r2, r3 - beq _0223A81A - bl ov12_0223AB0C - mov r1, #1 - tst r0, r1 - beq _0223A81A -_0223A812: - lsl r0, r4, #2 - add r0, r5, r0 - ldr r0, [r0, #0x68] - pop {r3, r4, r5, pc} -_0223A81A: - ldr r1, [r5, #0x2c] - mov r0, #2 - tst r0, r1 - beq _0223A82C - lsl r0, r4, #0x1f - lsr r0, r0, #0x1d - add r0, r5, r0 - ldr r0, [r0, #0x68] - pop {r3, r4, r5, pc} -_0223A82C: - lsl r0, r4, #2 - add r0, r5, r0 - ldr r0, [r0, #0x68] - pop {r3, r4, r5, pc} - thumb_func_end BattleSystem_GetParty - - thumb_func_start BattleSystem_GetPartySize -BattleSystem_GetPartySize: ; 0x0223A834 - push {r3, r4, r5, lr} - add r5, r0, #0 - ldr r2, [r5, #0x2c] - mov r3, #8 - add r4, r1, #0 - tst r3, r2 - bne _0223A852 - mov r3, #0x10 - tst r2, r3 - beq _0223A85E - bl ov12_0223AB0C - mov r1, #1 - tst r0, r1 - beq _0223A85E -_0223A852: - lsl r0, r4, #2 - add r0, r5, r0 - ldr r0, [r0, #0x68] - bl GetPartyCount - pop {r3, r4, r5, pc} -_0223A85E: - ldr r1, [r5, #0x2c] - mov r0, #2 - tst r0, r1 - beq _0223A874 - lsl r0, r4, #0x1f - lsr r0, r0, #0x1d - add r0, r5, r0 - ldr r0, [r0, #0x68] - bl GetPartyCount - pop {r3, r4, r5, pc} -_0223A874: - lsl r0, r4, #2 - add r0, r5, r0 - ldr r0, [r0, #0x68] - bl GetPartyCount - pop {r3, r4, r5, pc} - thumb_func_end BattleSystem_GetPartySize - - thumb_func_start BattleSystem_GetPartyMon -BattleSystem_GetPartyMon: ; 0x0223A880 - push {r4, r5, r6, lr} - add r5, r0, #0 - add r6, r2, #0 - ldr r2, [r5, #0x2c] - mov r3, #8 - add r4, r1, #0 - tst r3, r2 - bne _0223A8A0 - mov r3, #0x10 - tst r2, r3 - beq _0223A8AE - bl ov12_0223AB0C - mov r1, #1 - tst r0, r1 - beq _0223A8AE -_0223A8A0: - lsl r0, r4, #2 - add r0, r5, r0 - ldr r0, [r0, #0x68] - add r1, r6, #0 - bl GetPartyMonByIndex - pop {r4, r5, r6, pc} -_0223A8AE: - ldr r1, [r5, #0x2c] - mov r0, #2 - tst r0, r1 - beq _0223A8C6 - lsl r0, r4, #0x1f - lsr r0, r0, #0x1d - add r0, r5, r0 - ldr r0, [r0, #0x68] - add r1, r6, #0 - bl GetPartyMonByIndex - pop {r4, r5, r6, pc} -_0223A8C6: - lsl r0, r4, #2 - add r0, r5, r0 - ldr r0, [r0, #0x68] - add r1, r6, #0 - bl GetPartyMonByIndex - pop {r4, r5, r6, pc} - thumb_func_end BattleSystem_GetPartyMon - - thumb_func_start ov12_0223A8D4 -ov12_0223A8D4: ; 0x0223A8D4 - add r0, #0x88 - ldr r0, [r0] - bx lr - .balign 4, 0 - thumb_func_end ov12_0223A8D4 - - thumb_func_start ov12_0223A8DC -ov12_0223A8DC: ; 0x0223A8DC - add r0, #0x8c - ldr r0, [r0] - bx lr - .balign 4, 0 - thumb_func_end ov12_0223A8DC - - thumb_func_start ov12_0223A8E4 -ov12_0223A8E4: ; 0x0223A8E4 - add r0, #0x90 - ldr r0, [r0] - bx lr - .balign 4, 0 - thumb_func_end ov12_0223A8E4 - - thumb_func_start ov12_0223A8EC -ov12_0223A8EC: ; 0x0223A8EC - add r0, #0x94 - ldr r0, [r0] - bx lr - .balign 4, 0 - thumb_func_end ov12_0223A8EC - - thumb_func_start ov12_0223A8F4 -ov12_0223A8F4: ; 0x0223A8F4 - mov r2, #0x5f - lsl r2, r2, #2 - add r2, r0, r2 - lsl r0, r1, #4 - add r0, r2, r0 - bx lr - thumb_func_end ov12_0223A8F4 - - thumb_func_start ov12_0223A900 -ov12_0223A900: ; 0x0223A900 - mov r1, #0x67 - lsl r1, r1, #2 - ldr r0, [r0, r1] - bx lr - thumb_func_end ov12_0223A900 - - thumb_func_start ov12_0223A908 -ov12_0223A908: ; 0x0223A908 - lsl r1, r1, #2 - add r1, r0, r1 - mov r0, #0x1a - lsl r0, r0, #4 - ldr r0, [r1, r0] - bx lr - thumb_func_end ov12_0223A908 - - thumb_func_start ov12_0223A914 -ov12_0223A914: ; 0x0223A914 - lsl r1, r1, #2 - add r1, r0, r1 - mov r0, #0x1a - lsl r0, r0, #4 - str r2, [r1, r0] - bx lr - thumb_func_end ov12_0223A914 - - thumb_func_start ov12_0223A920 -ov12_0223A920: ; 0x0223A920 - mov r1, #0x6a - lsl r1, r1, #2 - ldr r0, [r0, r1] - bx lr - thumb_func_end ov12_0223A920 - - thumb_func_start ov12_0223A928 -ov12_0223A928: ; 0x0223A928 - mov r1, #0x6b - lsl r1, r1, #2 - ldr r0, [r0, r1] - bx lr - thumb_func_end ov12_0223A928 - - thumb_func_start ov12_0223A930 -ov12_0223A930: ; 0x0223A930 - ldr r0, [r0, #0xc] - bx lr - thumb_func_end ov12_0223A930 - - thumb_func_start ov12_0223A934 -ov12_0223A934: ; 0x0223A934 - ldr r0, [r0, #0x10] - bx lr - thumb_func_end ov12_0223A934 - - thumb_func_start ov12_0223A938 -ov12_0223A938: ; 0x0223A938 - ldr r0, [r0, #0x28] - bx lr - thumb_func_end ov12_0223A938 - - thumb_func_start ov12_0223A93C -ov12_0223A93C: ; 0x0223A93C - ldr r0, [r0, #0x60] - bx lr - thumb_func_end ov12_0223A93C - - thumb_func_start BattleSystem_GetSendBufferPtr -BattleSystem_GetSendBufferPtr: ; 0x0223A940 - mov r1, #0x8a - lsl r1, r1, #2 - add r0, r0, r1 - bx lr - thumb_func_end BattleSystem_GetSendBufferPtr - - thumb_func_start BattleSystem_GetRecvBufferPtr -BattleSystem_GetRecvBufferPtr: ; 0x0223A948 - ldr r1, _0223A950 ; =0x00001228 - add r0, r0, r1 - bx lr - nop -_0223A950: .word 0x00001228 - thumb_func_end BattleSystem_GetRecvBufferPtr - - thumb_func_start ov12_0223A954 -ov12_0223A954: ; 0x0223A954 - ldr r1, _0223A95C ; =0x000023E8 - add r0, r0, r1 - bx lr - nop -_0223A95C: .word 0x000023E8 - thumb_func_end ov12_0223A954 - - thumb_func_start ov12_0223A960 -ov12_0223A960: ; 0x0223A960 - ldr r1, _0223A968 ; =0x000023EA - add r0, r0, r1 - bx lr - nop -_0223A968: .word 0x000023EA - thumb_func_end ov12_0223A960 - - thumb_func_start ov12_0223A96C -ov12_0223A96C: ; 0x0223A96C - ldr r1, _0223A974 ; =0x000023EC - add r0, r0, r1 - bx lr - nop -_0223A974: .word 0x000023EC - thumb_func_end ov12_0223A96C - - thumb_func_start ov12_0223A978 -ov12_0223A978: ; 0x0223A978 - ldr r1, _0223A980 ; =0x000023EE - add r0, r0, r1 - bx lr - nop -_0223A980: .word 0x000023EE - thumb_func_end ov12_0223A978 - - thumb_func_start ov12_0223A984 -ov12_0223A984: ; 0x0223A984 - ldr r1, _0223A98C ; =0x000023F0 - add r0, r0, r1 - bx lr - nop -_0223A98C: .word 0x000023F0 - thumb_func_end ov12_0223A984 - - thumb_func_start ov12_0223A990 -ov12_0223A990: ; 0x0223A990 - ldr r1, _0223A998 ; =0x000023F2 - add r0, r0, r1 - bx lr - nop -_0223A998: .word 0x000023F2 - thumb_func_end ov12_0223A990 - - thumb_func_start ov12_0223A99C -ov12_0223A99C: ; 0x0223A99C - mov r1, #0x1d - lsl r1, r1, #4 - add r0, r0, r1 - bx lr - thumb_func_end ov12_0223A99C - - thumb_func_start ov12_0223A9A4 -ov12_0223A9A4: ; 0x0223A9A4 - ldr r0, [r0, #0x14] - bx lr - thumb_func_end ov12_0223A9A4 - - thumb_func_start ov12_0223A9A8 -ov12_0223A9A8: ; 0x0223A9A8 - ldr r0, [r0, #0x18] - bx lr - thumb_func_end ov12_0223A9A8 - - thumb_func_start BattleSystem_GetTrainerIndex -BattleSystem_GetTrainerIndex: ; 0x0223A9AC - push {r3, r4, r5, lr} - add r5, r0, #0 - ldr r2, [r5, #0x2c] - mov r3, #8 - add r4, r1, #0 - tst r3, r2 - bne _0223A9CA - mov r3, #0x10 - tst r2, r3 - beq _0223A9D4 - bl ov12_0223AB0C - mov r1, #1 - tst r0, r1 - beq _0223A9D4 -_0223A9CA: - lsl r0, r4, #1 - add r0, r5, r0 - add r0, #0xa0 - ldrh r0, [r0] - pop {r3, r4, r5, pc} -_0223A9D4: - ldr r1, [r5, #0x2c] - mov r0, #2 - tst r0, r1 - beq _0223A9E8 - lsl r0, r4, #0x1f - lsr r0, r0, #0x1e - add r0, r5, r0 - add r0, #0xa0 - ldrh r0, [r0] - pop {r3, r4, r5, pc} -_0223A9E8: - lsl r0, r4, #1 - add r0, r5, r0 - add r0, #0xa0 - ldrh r0, [r0] - pop {r3, r4, r5, pc} - .balign 4, 0 - thumb_func_end BattleSystem_GetTrainerIndex - - thumb_func_start ov12_0223A9F4 -ov12_0223A9F4: ; 0x0223A9F4 - push {r3, r4, r5, lr} - add r5, r0, #0 - ldr r2, [r5, #0x2c] - mov r3, #8 - add r4, r1, #0 - tst r3, r2 - bne _0223AA12 - mov r3, #0x10 - tst r2, r3 - beq _0223AA1C - bl ov12_0223AB0C - mov r1, #1 - tst r0, r1 - beq _0223AA1C -_0223AA12: - mov r0, #0x34 - add r5, #0xac - mul r0, r4 - add r0, r5, r0 - pop {r3, r4, r5, pc} -_0223AA1C: - ldr r1, [r5, #0x2c] - mov r0, #2 - tst r0, r1 - beq _0223AA34 - mov r0, #1 - add r1, r4, #0 - and r1, r0 - mov r0, #0x34 - add r5, #0xac - mul r0, r1 - add r0, r5, r0 - pop {r3, r4, r5, pc} -_0223AA34: - mov r0, #0x34 - add r5, #0xac - mul r0, r4 - add r0, r5, r0 - pop {r3, r4, r5, pc} - .balign 4, 0 - thumb_func_end ov12_0223A9F4 - - thumb_func_start BattleSystem_GetPlayerProfile -BattleSystem_GetPlayerProfile: ; 0x0223AA40 - push {r3, r4, r5, lr} - add r5, r0, #0 - ldr r2, [r5, #0x2c] - mov r3, #8 - add r4, r1, #0 - tst r3, r2 - bne _0223AA5E - mov r3, #0x10 - tst r2, r3 - beq _0223AA66 - bl ov12_0223AB0C - mov r1, #1 - tst r0, r1 - beq _0223AA66 -_0223AA5E: - lsl r0, r4, #2 - add r0, r5, r0 - ldr r0, [r0, #0x48] - pop {r3, r4, r5, pc} -_0223AA66: - ldr r1, [r5, #0x2c] - mov r0, #2 - tst r0, r1 - beq _0223AA78 - lsl r0, r4, #0x1f - lsr r0, r0, #0x1d - add r0, r5, r0 - ldr r0, [r0, #0x48] - pop {r3, r4, r5, pc} -_0223AA78: - lsl r0, r4, #2 - add r0, r5, r0 - ldr r0, [r0, #0x48] - pop {r3, r4, r5, pc} - thumb_func_end BattleSystem_GetPlayerProfile - - thumb_func_start ov12_0223AA80 -ov12_0223AA80: ; 0x0223AA80 - ldr r0, [r0, #0x58] - bx lr - thumb_func_end ov12_0223AA80 - - thumb_func_start ov12_0223AA84 -ov12_0223AA84: ; 0x0223AA84 - ldr r0, [r0, #0x5c] - bx lr - thumb_func_end ov12_0223AA84 - - thumb_func_start BattleSystem_GetMonBall -BattleSystem_GetMonBall: ; 0x0223AA88 - push {r3, lr} - ldr r2, _0223AAB4 ; =0x00002478 - ldr r0, [r0, r2] - lsl r0, r0, #0x1d - lsr r0, r0, #0x1f - beq _0223AAA4 - add r0, r1, #0 - mov r1, #0xb4 - mov r2, #0 - bl GetMonData - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - pop {r3, pc} -_0223AAA4: - add r0, r1, #0 - mov r1, #0x9b - mov r2, #0 - bl GetMonData - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - pop {r3, pc} - .balign 4, 0 -_0223AAB4: .word 0x00002478 - thumb_func_end BattleSystem_GetMonBall - - thumb_func_start ov12_0223AAB8 -ov12_0223AAB8: ; 0x0223AAB8 - ldr r1, _0223AAC4 ; =0x00002478 - ldr r0, [r0, r1] - lsl r0, r0, #0x1c - lsr r0, r0, #0x1f - bx lr - nop -_0223AAC4: .word 0x00002478 - thumb_func_end ov12_0223AAB8 - - thumb_func_start ov12_0223AAC8 -ov12_0223AAC8: ; 0x0223AAC8 - lsl r1, r1, #2 - add r0, r0, r1 - ldr r3, _0223AAD4 ; =PlayerProfile_GetTrainerGender - ldr r0, [r0, #0x48] - bx r3 - nop -_0223AAD4: .word PlayerProfile_GetTrainerGender - thumb_func_end ov12_0223AAC8 - - thumb_func_start ov12_0223AAD8 -ov12_0223AAD8: ; 0x0223AAD8 - push {r3, r4, r5, r6, r7, lr} - add r6, r0, #0 - ldr r0, [r6, #0x44] - add r7, r1, #0 - mov r4, #0 - cmp r0, #0 - ble _0223AAFC - add r5, r6, #0 -_0223AAE8: - ldr r0, [r5, #0x34] - bl ov12_02261258 - cmp r7, r0 - beq _0223AAFC - ldr r0, [r6, #0x44] - add r4, r4, #1 - add r5, r5, #4 - cmp r4, r0 - blt _0223AAE8 -_0223AAFC: - ldr r0, [r6, #0x44] - cmp r4, r0 - blt _0223AB06 - bl GF_AssertFail -_0223AB06: - add r0, r4, #0 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 - thumb_func_end ov12_0223AAD8 - - thumb_func_start ov12_0223AB0C -ov12_0223AB0C: ; 0x0223AB0C - lsl r1, r1, #2 - add r0, r0, r1 - ldr r3, _0223AB18 ; =ov12_02261258 - ldr r0, [r0, #0x34] - bx r3 - nop -_0223AB18: .word ov12_02261258 - thumb_func_end ov12_0223AB0C - - thumb_func_start BattleSystem_GetFieldSide -BattleSystem_GetFieldSide: ; 0x0223AB1C - push {r3, lr} - lsl r1, r1, #2 - add r0, r0, r1 - ldr r0, [r0, #0x34] - bl ov12_02261258 - mov r1, #1 - and r0, r1 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - pop {r3, pc} - .balign 4, 0 - thumb_func_end BattleSystem_GetFieldSide - - thumb_func_start ov12_0223AB34 -ov12_0223AB34: ; 0x0223AB34 - mov r1, #0x1b - lsl r1, r1, #4 - ldr r0, [r0, r1] - bx lr - thumb_func_end ov12_0223AB34 - - thumb_func_start ov12_0223AB3C -ov12_0223AB3C: ; 0x0223AB3C - ldr r0, [r0, #0x64] - bx lr - thumb_func_end ov12_0223AB3C - - thumb_func_start BattleSystem_GetTerrainId -BattleSystem_GetTerrainId: ; 0x0223AB40 - mov r1, #9 - lsl r1, r1, #0xa - ldr r0, [r0, r1] - cmp r0, #0x18 - bgt _0223AB4E - cmp r0, #0 - bge _0223AB50 -_0223AB4E: - mov r0, #0x18 -_0223AB50: - bx lr - .balign 4, 0 - thumb_func_end BattleSystem_GetTerrainId - - thumb_func_start ov12_0223AB54 -ov12_0223AB54: ; 0x0223AB54 - ldr r1, _0223AB5C ; =0x00002404 - ldr r0, [r0, r1] - bx lr - nop -_0223AB5C: .word 0x00002404 - thumb_func_end ov12_0223AB54 - - thumb_func_start ov12_0223AB60 -ov12_0223AB60: ; 0x0223AB60 - ldr r1, _0223AB68 ; =0x00002408 - ldr r0, [r0, r1] - bx lr - nop -_0223AB68: .word 0x00002408 - thumb_func_end ov12_0223AB60 - - thumb_func_start BattleSystem_GetBattlerIdPartner -BattleSystem_GetBattlerIdPartner: ; 0x0223AB6C - push {r3, r4, r5, r6, r7, lr} - add r6, r0, #0 - add r5, r1, #0 - bl BattleSystem_GetMaxBattlers - str r0, [sp] - add r0, r6, #0 - bl BattleSystem_GetBattleType - mov r1, #2 - tst r0, r1 - bne _0223AB88 - add r0, r5, #0 - pop {r3, r4, r5, r6, r7, pc} -_0223AB88: - ldr r0, [sp] - mov r4, #0 - cmp r0, #0 - ble _0223ABB2 -_0223AB90: - cmp r4, r5 - beq _0223ABAA - add r0, r6, #0 - add r1, r4, #0 - bl BattleSystem_GetFieldSide - add r7, r0, #0 - add r0, r6, #0 - add r1, r5, #0 - bl BattleSystem_GetFieldSide - cmp r7, r0 - beq _0223ABB2 -_0223ABAA: - ldr r0, [sp] - add r4, r4, #1 - cmp r4, r0 - blt _0223AB90 -_0223ABB2: - add r0, r4, #0 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 - thumb_func_end BattleSystem_GetBattlerIdPartner - - thumb_func_start ov12_0223ABB8 -ov12_0223ABB8: ; 0x0223ABB8 - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - add r5, r0, #0 - add r6, r1, #0 - str r2, [sp] - bl BattleSystem_GetMaxBattlers - str r0, [sp, #4] - add r0, r5, #0 - bl BattleSystem_GetBattleType - mov r1, #2 - tst r0, r1 - bne _0223ABDC - mov r0, #1 - add sp, #8 - eor r0, r6 - pop {r3, r4, r5, r6, r7, pc} -_0223ABDC: - ldr r0, [sp, #4] - mov r4, #0 - cmp r0, #0 - ble _0223AC18 -_0223ABE4: - cmp r4, r6 - beq _0223AC10 - add r0, r5, #0 - add r1, r4, #0 - bl ov12_0223AB0C - mov r1, #2 - and r1, r0 - ldr r0, [sp] - cmp r0, r1 - bne _0223AC10 - add r0, r5, #0 - add r1, r4, #0 - bl BattleSystem_GetFieldSide - add r7, r0, #0 - add r0, r5, #0 - add r1, r6, #0 - bl BattleSystem_GetFieldSide - cmp r7, r0 - bne _0223AC18 -_0223AC10: - ldr r0, [sp, #4] - add r4, r4, #1 - cmp r4, r0 - blt _0223ABE4 -_0223AC18: - add r0, r4, #0 - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 - thumb_func_end ov12_0223ABB8 - - thumb_func_start BattleSystem_RecoverStatus -BattleSystem_RecoverStatus: ; 0x0223AC20 - push {r4, r5, r6, r7, lr} - sub sp, #0x24 - add r7, r1, #0 - ldr r1, [sp, #0x38] - add r6, r2, #0 - str r1, [sp, #0x38] - add r1, r0, #0 - ldr r1, [r1, #0x30] - add r4, r3, #0 - str r1, [sp, #0x1c] - mov r1, #0 - str r1, [sp, #0x14] - ldr r1, [sp, #0x1c] - str r0, [sp, #4] - mov r2, #2 - add r3, r7, #0 - bl ov12_022581D4 - str r0, [sp, #0x10] - ldr r0, [sp, #4] - bl BattleSystem_GetBattleType - cmp r0, #3 - beq _0223AC6A - ldr r0, [sp, #4] - bl BattleSystem_GetBattleType - mov r1, #0x10 - tst r0, r1 - beq _0223AC90 - ldr r0, [sp, #4] - add r1, r7, #0 - bl ov12_0223AB0C - mov r1, #1 - tst r0, r1 - bne _0223AC90 -_0223AC6A: - ldr r0, [sp, #4] - add r1, r7, #0 - bl BattleSystem_GetBattlerIdPartner - add r3, r0, #0 - ldr r0, [sp, #4] - ldr r1, [sp, #0x1c] - mov r2, #2 - bl ov12_022581D4 - str r0, [sp, #0xc] - cmp r0, r6 - bne _0223AC94 - ldr r0, [sp, #4] - add r1, r7, #0 - bl BattleSystem_GetBattlerIdPartner - add r7, r0, #0 - b _0223AC94 -_0223AC90: - ldr r0, [sp, #0x10] - str r0, [sp, #0xc] -_0223AC94: - ldr r0, [sp, #4] - add r1, r7, #0 - add r2, r6, #0 - bl BattleSystem_GetPartyMon - str r0, [sp, #0x18] - mov r0, #0 - str r0, [sp, #8] - ldr r0, [sp, #0x38] - mov r1, #0xf - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223AD28 - ldr r0, [sp, #0x18] - mov r1, #0xa0 - mov r2, #0 - bl GetMonData - mov r1, #7 - str r0, [sp, #0x20] - tst r1, r0 - beq _0223AD28 - mov r1, #7 - bic r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x18] - mov r1, #0xa0 - add r2, sp, #0x20 - bl SetMonData - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223ACE4 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223AD24 -_0223ACE4: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x34 - mov r3, #0 - bl GetBattlerVar - mov r1, #7 - str r0, [sp, #0x20] - bic r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x34 - add r3, sp, #0x20 - bl SetBattlerVar - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x35 - mov r3, #0 - bl GetBattlerVar - ldr r1, _0223AF38 ; =0xF7FFFFFF - str r0, [sp, #0x20] - and r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x35 - add r3, sp, #0x20 - bl SetBattlerVar -_0223AD24: - mov r0, #1 - str r0, [sp, #0x14] -_0223AD28: - ldr r0, [sp, #0x38] - mov r1, #0x10 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223AD8C - ldr r0, [sp, #0x18] - mov r1, #0xa0 - mov r2, #0 - bl GetMonData - ldr r1, _0223AF3C ; =0x00000F88 - str r0, [sp, #0x20] - tst r1, r0 - beq _0223AD8C - ldr r1, _0223AF40 ; =0xFFFFF077 - add r2, sp, #0x20 - and r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x18] - mov r1, #0xa0 - bl SetMonData - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223AD68 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223AD88 -_0223AD68: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x34 - mov r3, #0 - bl GetBattlerVar - ldr r1, _0223AF40 ; =0xFFFFF077 - str r0, [sp, #0x20] - and r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x34 - add r3, sp, #0x20 - bl SetBattlerVar -_0223AD88: - mov r0, #1 - str r0, [sp, #0x14] -_0223AD8C: - ldr r0, [sp, #0x38] - mov r1, #0x11 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223ADF0 - ldr r0, [sp, #0x18] - mov r1, #0xa0 - mov r2, #0 - bl GetMonData - mov r1, #0x10 - str r0, [sp, #0x20] - tst r1, r0 - beq _0223ADF0 - mov r1, #0x10 - bic r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x18] - mov r1, #0xa0 - add r2, sp, #0x20 - bl SetMonData - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223ADCC - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223ADEC -_0223ADCC: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x34 - mov r3, #0 - bl GetBattlerVar - mov r1, #0x10 - str r0, [sp, #0x20] - bic r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x34 - add r3, sp, #0x20 - bl SetBattlerVar -_0223ADEC: - mov r0, #1 - str r0, [sp, #0x14] -_0223ADF0: - ldr r0, [sp, #0x38] - mov r1, #0x12 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223AE54 - ldr r0, [sp, #0x18] - mov r1, #0xa0 - mov r2, #0 - bl GetMonData - mov r1, #0x20 - str r0, [sp, #0x20] - tst r1, r0 - beq _0223AE54 - mov r1, #0x20 - bic r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x18] - mov r1, #0xa0 - add r2, sp, #0x20 - bl SetMonData - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223AE30 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223AE50 -_0223AE30: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x34 - mov r3, #0 - bl GetBattlerVar - mov r1, #0x20 - str r0, [sp, #0x20] - bic r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x34 - add r3, sp, #0x20 - bl SetBattlerVar -_0223AE50: - mov r0, #1 - str r0, [sp, #0x14] -_0223AE54: - ldr r0, [sp, #0x38] - mov r1, #0x13 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223AEB8 - ldr r0, [sp, #0x18] - mov r1, #0xa0 - mov r2, #0 - bl GetMonData - mov r1, #0x40 - str r0, [sp, #0x20] - tst r1, r0 - beq _0223AEB8 - mov r1, #0x40 - bic r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x18] - mov r1, #0xa0 - add r2, sp, #0x20 - bl SetMonData - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223AE94 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223AEB4 -_0223AE94: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x34 - mov r3, #0 - bl GetBattlerVar - mov r1, #0x40 - str r0, [sp, #0x20] - bic r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x34 - add r3, sp, #0x20 - bl SetBattlerVar -_0223AEB4: - mov r0, #1 - str r0, [sp, #0x14] -_0223AEB8: - ldr r0, [sp, #0x38] - mov r1, #0x14 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223AF00 - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223AED6 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223AF00 -_0223AED6: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x35 - mov r3, #0 - bl GetBattlerVar - mov r1, #7 - str r0, [sp, #0x20] - tst r1, r0 - beq _0223AF00 - mov r1, #7 - bic r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x35 - add r3, sp, #0x20 - bl SetBattlerVar - mov r0, #1 - str r0, [sp, #0x14] -_0223AF00: - ldr r0, [sp, #0x38] - mov r1, #0x15 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223AF5C - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223AF1E - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223AF5C -_0223AF1E: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x35 - mov r3, #0 - bl GetBattlerVar - mov r1, #0xf - lsl r1, r1, #0x10 - str r0, [sp, #0x20] - tst r1, r0 - beq _0223AF5C - ldr r1, _0223AF44 ; =0xFFF0FFFF - b _0223AF48 - .balign 4, 0 -_0223AF38: .word 0xF7FFFFFF -_0223AF3C: .word 0x00000F88 -_0223AF40: .word 0xFFFFF077 -_0223AF44: .word 0xFFF0FFFF -_0223AF48: - mov r2, #0x35 - and r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x1c] - add r1, r7, #0 - add r3, sp, #0x20 - bl SetBattlerVar - mov r0, #1 - str r0, [sp, #0x14] -_0223AF5C: - ldr r0, [sp, #0x38] - mov r1, #0x16 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223AFB6 - ldr r0, [sp, #4] - ldr r1, [sp, #0x1c] - mov r2, #1 - add r3, r7, #0 - bl ov12_022581D4 - str r0, [sp, #0x20] - cmp r0, #0 - bne _0223AFB6 - ldr r0, [sp, #4] - ldr r1, [sp, #0x1c] - mov r2, #0 - add r3, r7, #0 - bl ov12_022581D4 - mov r1, #0x40 - str r0, [sp, #0x20] - orr r0, r1 - str r0, [sp, #0x20] - str r0, [sp] - ldr r0, [sp, #4] - ldr r1, [sp, #0x1c] - mov r2, #0 - add r3, r7, #0 - bl ov12_022582B8 - mov r0, #5 - str r0, [sp] - ldr r0, [sp, #4] - ldr r1, [sp, #0x1c] - mov r2, #1 - add r3, r7, #0 - bl ov12_022582B8 - mov r0, #1 - str r0, [sp, #0x14] -_0223AFB6: - ldr r0, [sp, #0x38] - mov r1, #0x1b - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223AFF4 - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223AFD4 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223AFF4 -_0223AFD4: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x13 - mov r3, #0 - bl GetBattlerVar - cmp r0, #0xc - bge _0223AFF4 - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x13 - mov r3, #1 - bl ov12_0224F794 - mov r0, #1 - str r0, [sp, #0x14] -_0223AFF4: - ldr r0, [sp, #0x38] - mov r1, #0x1c - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B032 - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223B012 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223B032 -_0223B012: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x14 - mov r3, #0 - bl GetBattlerVar - cmp r0, #0xc - bge _0223B032 - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x14 - mov r3, #1 - bl ov12_0224F794 - mov r0, #1 - str r0, [sp, #0x14] -_0223B032: - ldr r0, [sp, #0x38] - mov r1, #0x1d - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B070 - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223B050 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223B070 -_0223B050: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x16 - mov r3, #0 - bl GetBattlerVar - cmp r0, #0xc - bge _0223B070 - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x16 - mov r3, #1 - bl ov12_0224F794 - mov r0, #1 - str r0, [sp, #0x14] -_0223B070: - ldr r0, [sp, #0x38] - mov r1, #0x1e - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B0AE - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223B08E - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223B0AE -_0223B08E: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x17 - mov r3, #0 - bl GetBattlerVar - cmp r0, #0xc - bge _0223B0AE - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x17 - mov r3, #1 - bl ov12_0224F794 - mov r0, #1 - str r0, [sp, #0x14] -_0223B0AE: - ldr r0, [sp, #0x38] - mov r1, #0x1f - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B0EC - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223B0CC - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223B0EC -_0223B0CC: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x15 - mov r3, #0 - bl GetBattlerVar - cmp r0, #0xc - bge _0223B0EC - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x15 - mov r3, #1 - bl ov12_0224F794 - mov r0, #1 - str r0, [sp, #0x14] -_0223B0EC: - ldr r0, [sp, #0x38] - mov r1, #0x20 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B12A - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223B10A - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223B12A -_0223B10A: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x18 - mov r3, #0 - bl GetBattlerVar - cmp r0, #0xc - bge _0223B12A - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x18 - mov r3, #1 - bl ov12_0224F794 - mov r0, #1 - str r0, [sp, #0x14] -_0223B12A: - ldr r0, [sp, #0x38] - mov r1, #0x21 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B174 - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223B148 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223B174 -_0223B148: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x35 - mov r3, #0 - bl GetBattlerVar - mov r1, #1 - lsl r1, r1, #0x14 - add r2, r0, #0 - str r0, [sp, #0x20] - tst r2, r1 - bne _0223B174 - orr r0, r1 - str r0, [sp, #0x20] - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x35 - add r3, sp, #0x20 - bl SetBattlerVar - mov r0, #1 - str r0, [sp, #0x14] -_0223B174: - ldr r0, [sp, #0x38] - mov r1, #0x24 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B20A - ldr r0, [sp, #0x38] - mov r1, #0x37 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - str r0, [sp, #0x20] - add r1, r4, #0 - ldr r0, [sp, #0x18] - add r1, #0x3a - mov r2, #0 - bl GetMonData - add r5, r0, #0 - add r1, r4, #0 - ldr r0, [sp, #0x18] - add r1, #0x42 - mov r2, #0 - bl GetMonData - cmp r5, r0 - beq _0223B20A - add r1, r4, #0 - ldr r0, [sp, #0x18] - ldr r2, [sp, #0x20] - add r1, #0x3a - bl AddMonData - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223B1CC - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223B206 -_0223B1CC: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x35 - mov r3, #0 - bl GetBattlerVar - mov r1, #2 - lsl r1, r1, #0x14 - tst r0, r1 - bne _0223B206 - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x4b - mov r3, #0 - bl GetBattlerVar - add r5, r0, #0 - add r0, r4, #0 - bl MaskOfFlagNo - tst r0, r5 - bne _0223B206 - add r4, #0x1f - ldr r0, [sp, #0x1c] - ldr r3, [sp, #0x20] - add r1, r7, #0 - add r2, r4, #0 - bl ov12_0224F794 -_0223B206: - mov r0, #1 - str r0, [sp, #0x14] -_0223B20A: - ldr r0, [sp, #0x38] - mov r1, #0x25 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B2A8 - ldr r0, [sp, #0x38] - mov r1, #0x37 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - str r0, [sp, #0x20] - mov r4, #0 -_0223B22E: - add r1, r4, #0 - ldr r0, [sp, #0x18] - add r1, #0x3a - mov r2, #0 - bl GetMonData - add r5, r0, #0 - add r1, r4, #0 - ldr r0, [sp, #0x18] - add r1, #0x42 - mov r2, #0 - bl GetMonData - cmp r5, r0 - beq _0223B2A2 - add r1, r4, #0 - ldr r0, [sp, #0x18] - ldr r2, [sp, #0x20] - add r1, #0x3a - bl AddMonData - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223B264 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223B29E -_0223B264: - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x35 - mov r3, #0 - bl GetBattlerVar - mov r1, #2 - lsl r1, r1, #0x14 - tst r0, r1 - bne _0223B29E - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x4b - mov r3, #0 - bl GetBattlerVar - add r5, r0, #0 - add r0, r4, #0 - bl MaskOfFlagNo - tst r0, r5 - bne _0223B29E - add r2, r4, #0 - ldr r0, [sp, #0x1c] - ldr r3, [sp, #0x20] - add r1, r7, #0 - add r2, #0x1f - bl ov12_0224F794 -_0223B29E: - mov r0, #1 - str r0, [sp, #0x14] -_0223B2A2: - add r4, r4, #1 - cmp r4, #4 - blt _0223B22E -_0223B2A8: - ldr r0, [sp, #0x38] - mov r1, #0x26 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - bne _0223B2BC - b _0223B3C4 -_0223B2BC: - mov r0, #0 - str r0, [sp, #0x20] - ldr r0, [sp, #0x38] - mov r1, #0x17 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B2E6 - ldr r0, [sp, #0x18] - mov r1, #0xa3 - mov r2, #0 - bl GetMonData - cmp r0, #0 - bne _0223B2F2 - mov r0, #1 - str r0, [sp, #0x20] - b _0223B2F2 -_0223B2E6: - ldr r0, [sp, #0x18] - mov r1, #0xa3 - mov r2, #0 - bl GetMonData - str r0, [sp, #0x20] -_0223B2F2: - ldr r0, [sp, #0x20] - cmp r0, #0 - beq _0223B3C4 - ldr r0, [sp, #0x18] - mov r1, #0xa3 - mov r2, #0 - bl GetMonData - add r4, r0, #0 - ldr r0, [sp, #0x18] - mov r1, #0xa4 - mov r2, #0 - bl GetMonData - cmp r4, r0 - beq _0223B3C4 - ldr r0, [sp, #0x38] - mov r1, #0x36 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - str r0, [sp, #0x20] - cmp r0, #0xfd - beq _0223B352 - cmp r0, #0xfe - beq _0223B33C - cmp r0, #0xff - bne _0223B372 - ldr r0, [sp, #0x18] - mov r1, #0xa4 - mov r2, #0 - bl GetMonData - str r0, [sp, #0x20] - b _0223B372 -_0223B33C: - ldr r0, [sp, #0x18] - mov r1, #0xa4 - mov r2, #0 - bl GetMonData - lsr r0, r0, #1 - str r0, [sp, #0x20] - bne _0223B372 - mov r0, #1 - str r0, [sp, #0x20] - b _0223B372 -_0223B352: - ldr r0, [sp, #0x18] - mov r1, #0xa4 - mov r2, #0 - bl GetMonData - mov r1, #0x19 - mul r1, r0 - add r0, r1, #0 - mov r1, #0x64 - bl _u32_div_f - str r0, [sp, #0x20] - cmp r0, #0 - bne _0223B372 - mov r0, #1 - str r0, [sp, #0x20] -_0223B372: - ldr r0, [sp, #0x18] - ldr r2, [sp, #0x20] - mov r1, #0xa3 - bl AddMonData - ldr r0, [sp, #0x38] - mov r1, #0x17 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - bne _0223B3C0 - ldr r0, [sp, #4] - add r1, r7, #0 - bl BattleSystem_GetFieldSide - cmp r0, #0 - beq _0223B3A8 - ldr r0, [sp, #0x1c] - add r1, r7, #0 - mov r2, #0x5f - add r3, sp, #0x20 - bl SetBattlerVar - b _0223B3C0 -_0223B3A8: - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223B3B4 - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223B3C0 -_0223B3B4: - ldr r0, [sp, #0x1c] - ldr r3, [sp, #0x20] - add r1, r7, #0 - mov r2, #0x2f - bl ov12_0224F794 -_0223B3C0: - mov r0, #1 - str r0, [sp, #0x14] -_0223B3C4: - ldr r0, [sp, #0x38] - mov r1, #0x2d - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B3FA - ldr r0, [sp, #0x18] - mov r1, #9 - mov r2, #0 - bl GetMonData - cmp r0, #0x64 - bhs _0223B3FA - ldr r0, [sp, #0x14] - cmp r0, #1 - bne _0223B3FA - ldr r0, [sp, #0x38] - mov r1, #0x38 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - str r0, [sp, #8] -_0223B3FA: - ldr r0, [sp, #0x38] - mov r1, #0x2e - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B43E - ldr r0, [sp, #0x18] - mov r1, #9 - mov r2, #0 - bl GetMonData - cmp r0, #0x64 - blo _0223B43E - ldr r0, [sp, #0x18] - mov r1, #9 - mov r2, #0 - bl GetMonData - cmp r0, #0xc8 - bhs _0223B43E - ldr r0, [sp, #0x14] - cmp r0, #1 - bne _0223B43E - ldr r0, [sp, #0x38] - mov r1, #0x39 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - str r0, [sp, #8] -_0223B43E: - ldr r0, [sp, #0x38] - mov r1, #0x2f - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - cmp r0, #0 - beq _0223B474 - ldr r0, [sp, #0x18] - mov r1, #9 - mov r2, #0 - bl GetMonData - cmp r0, #0xc8 - blo _0223B474 - ldr r0, [sp, #0x14] - cmp r0, #1 - bne _0223B474 - ldr r0, [sp, #0x38] - mov r1, #0x3a - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r2, #5 - bl GetItemAttr - str r0, [sp, #8] -_0223B474: - ldr r0, [sp, #8] - cmp r0, #0 - beq _0223B4FA - ble gApp_MainMenu_SelectOption_MigrateFromAgb - ldr r0, [sp, #4] - ldr r1, [sp, #0x18] - bl BattleSystem_GetMonBall - bl BallToItemId - cmp r0, #0xb - bne _0223B492 - ldr r0, [sp, #8] - add r0, r0, #1 - str r0, [sp, #8] -_0223B492: - ldr r0, [sp, #0x18] - mov r1, #0x98 - mov r2, #0 - bl GetMonData - add r4, r0, #0 - ldr r0, [sp, #4] - bl ov12_0223AB60 - cmp r4, r0 - bne _0223B4AE - ldr r0, [sp, #8] - add r0, r0, #1 - str r0, [sp, #8] -_0223B4AE: - ldr r0, [sp, #0x18] - mov r1, #6 - mov r2, #0 - bl GetMonData - str r0, [sp, #0x20] - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - mov r1, #1 - mov r2, #5 - bl GetItemAttr - cmp r0, #0x35 - bne gApp_MainMenu_SelectOption_MigrateFromAgb - ldr r1, [sp, #8] - mov r0, #0x96 - mul r0, r1 - mov r1, #0x64 - bl _s32_div_f - str r0, [sp, #8] -gApp_MainMenu_SelectOption_MigrateFromAgb: - ldr r0, [sp, #0x18] - ldr r2, [sp, #8] - mov r1, #9 - bl AddMonData - ldr r0, [sp, #0x10] - cmp r0, r6 - beq _0223B4EE - ldr r0, [sp, #0xc] - cmp r0, r6 - bne _0223B4FA -_0223B4EE: - ldr r0, [sp, #0x1c] - ldr r3, [sp, #8] - add r1, r7, #0 - mov r2, #0x2c - bl ov12_0224F794 -_0223B4FA: - ldr r0, [sp, #0x14] - cmp r0, #1 - bne _0223B50C - ldr r1, [sp, #0x38] - ldr r0, [sp, #0x18] - lsl r1, r1, #0x10 - lsr r1, r1, #0x10 - bl ApplyItemEffectOnMonMood -_0223B50C: - ldr r0, [sp, #0x14] - add sp, #0x24 - pop {r4, r5, r6, r7, pc} - .balign 4, 0 - thumb_func_end BattleSystem_RecoverStatus - - thumb_func_start BattleSystem_GetBattleSpecial -BattleSystem_GetBattleSpecial: ; 0x0223B514 - ldr r1, _0223B51C ; =0x0000240C - ldr r0, [r0, r1] - bx lr - nop -_0223B51C: .word 0x0000240C - thumb_func_end BattleSystem_GetBattleSpecial - - thumb_func_start ov12_0223B520 -ov12_0223B520: ; 0x0223B520 - ldr r1, _0223B528 ; =0x00002410 - ldr r0, [r0, r1] - bx lr - nop -_0223B528: .word 0x00002410 - thumb_func_end ov12_0223B520 - - thumb_func_start ov12_0223B52C -ov12_0223B52C: ; 0x0223B52C - ldr r2, _0223B57C ; =0x00002404 - ldr r1, [r0, r2] - cmp r1, #5 - bhi _0223B576 - add r1, r1, r1 - add r1, pc - ldrh r1, [r1, #6] - lsl r1, r1, #0x10 - asr r1, r1, #0x10 - add pc, r1 -_0223B540: ; jump table - .short _0223B54C - _0223B540 - 2 ; case 0 - .short _0223B54C - _0223B540 - 2 ; case 1 - .short _0223B54C - _0223B540 - 2 ; case 2 - .short _0223B54C - _0223B540 - 2 ; case 3 - .short _0223B54C - _0223B540 - 2 ; case 4 - .short _0223B54C - _0223B540 - 2 ; case 5 -_0223B54C: - add r2, #0xc - ldr r1, [r0, r2] - cmp r1, #4 - bhi _0223B578 - add r1, r1, r1 - add r1, pc - ldrh r1, [r1, #6] - lsl r1, r1, #0x10 - asr r1, r1, #0x10 - add pc, r1 -_0223B560: ; jump table - .short _0223B56A - _0223B560 - 2 ; case 0 - .short _0223B56A - _0223B560 - 2 ; case 1 - .short _0223B56E - _0223B560 - 2 ; case 2 - .short _0223B572 - _0223B560 - 2 ; case 3 - .short _0223B572 - _0223B560 - 2 ; case 4 -_0223B56A: - mov r0, #0 - bx lr -_0223B56E: - mov r0, #1 - bx lr -_0223B572: - mov r0, #2 - bx lr -_0223B576: - mov r0, #0 -_0223B578: - bx lr - nop -_0223B57C: .word 0x00002404 - thumb_func_end ov12_0223B52C - - thumb_func_start ov12_0223B580 -ov12_0223B580: ; 0x0223B580 - push {r4, r5, r6, lr} - add r5, r0, #0 - add r6, r1, #0 - add r4, r2, #0 - bl ov12_0223AB0C - cmp r0, #4 - bne _0223B5E8 - ldr r1, [r5, #0x2c] - mov r0, #8 - tst r0, r1 - bne _0223B5E8 - mov r0, #4 - tst r0, r1 - beq _0223B5B2 - add r0, r5, #0 - add r1, r6, #0 - bl BattleSystem_GetBattlerIdPartner - bl MaskOfFlagNo - tst r0, r4 - bne _0223B5E8 - mov r0, #1 - pop {r4, r5, r6, pc} -_0223B5B2: - ldr r1, [r5, #0x30] - add r0, r5, #0 - mov r2, #0xc - mov r3, #0 - bl ov12_022581D4 - lsl r0, r0, #0x10 - lsr r6, r0, #0x10 - ldr r1, [r5, #0x30] - add r0, r5, #0 - mov r2, #8 - mov r3, #0 - bl ov12_022581D4 - cmp r0, #0xe - bne _0223B5D6 - cmp r6, #0x10 - bhi _0223B5E0 -_0223B5D6: - mov r0, #0 - bl MaskOfFlagNo - tst r0, r4 - beq _0223B5E4 -_0223B5E0: - mov r0, #0 - pop {r4, r5, r6, pc} -_0223B5E4: - mov r0, #1 - pop {r4, r5, r6, pc} -_0223B5E8: - mov r0, #0 - pop {r4, r5, r6, pc} - thumb_func_end ov12_0223B580 - - thumb_func_start ov12_0223B5EC -ov12_0223B5EC: ; 0x0223B5EC - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - add r5, r0, #0 - mov r0, #0 - str r0, [sp, #4] - ldr r0, [r5, #0x14] - add r4, r1, #0 - add r7, r2, #0 - cmp r0, #1 - beq _0223B60E - cmp r0, #4 - beq _0223B60E - cmp r0, #5 - beq _0223B60E - ldr r0, [sp, #4] - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} -_0223B60E: - mov r0, #0x5e - lsl r0, r0, #2 - ldr r0, [r5, r0] - cmp r0, #0 - beq _0223B682 -_0223B618: - mov r0, #0 - str r0, [r4] - cmp r0, #6 - bge _0223B650 - mov r6, #0x5e - lsl r6, r6, #2 -_0223B624: - bl MaskOfFlagNo - ldr r1, [r5, r6] - tst r0, r1 - beq _0223B646 - ldr r0, [r4] - bl MaskOfFlagNo - mov r3, #0x5e - lsl r3, r3, #2 - mov r2, #0 - mvn r2, r2 - ldr r1, [r5, r3] - eor r0, r2 - and r0, r1 - str r0, [r5, r3] - b _0223B650 -_0223B646: - ldr r0, [r4] - add r0, r0, #1 - str r0, [r4] - cmp r0, #6 - blt _0223B624 -_0223B650: - ldr r1, [r4] - cmp r1, #6 - bge _0223B678 - ldr r0, [r5, #4] - bl GetPartyMonByIndex - mov r3, #0x16 - str r7, [sp] - lsl r3, r3, #4 - ldr r3, [r5, r3] - add r1, r0, #0 - lsl r3, r3, #0x10 - ldr r0, [r5, #4] - mov r2, #0 - lsr r3, r3, #0x10 - bl GetMonEvolution - str r0, [sp, #4] - cmp r0, #0 - bne _0223B684 -_0223B678: - mov r0, #0x5e - lsl r0, r0, #2 - ldr r0, [r5, r0] - cmp r0, #0 - bne _0223B618 -_0223B682: - ldr r0, [sp, #4] -_0223B684: - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} - thumb_func_end ov12_0223B5EC - - thumb_func_start ov12_0223B688 -ov12_0223B688: ; 0x0223B688 - ldr r1, _0223B690 ; =0x000023FC - ldrb r0, [r0, r1] - bx lr - nop -_0223B690: .word 0x000023FC - thumb_func_end ov12_0223B688 - - thumb_func_start ov12_0223B694 -ov12_0223B694: ; 0x0223B694 - push {r4, lr} - add r4, r0, #0 - ldr r0, [r4, #0x30] - cmp r0, #0 - bne _0223B6A2 - bl GF_AssertFail -_0223B6A2: - ldr r1, [r4, #0x30] - add r0, r4, #0 - mov r2, #5 - mov r3, #0 - bl ov12_022581D4 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - pop {r4, pc} - thumb_func_end ov12_0223B694 - - thumb_func_start ov12_0223B6B4 -ov12_0223B6B4: ; 0x0223B6B4 - ldr r1, _0223B6BC ; =0x00002414 - ldr r0, [r0, r1] - bx lr - nop -_0223B6BC: .word 0x00002414 - thumb_func_end ov12_0223B6B4 - - thumb_func_start ov12_0223B6C0 -ov12_0223B6C0: ; 0x0223B6C0 - ldr r2, _0223B6C8 ; =0x00002414 - str r1, [r0, r2] - bx lr - nop -_0223B6C8: .word 0x00002414 - thumb_func_end ov12_0223B6C0 - - thumb_func_start ov12_0223B6CC -ov12_0223B6CC: ; 0x0223B6CC - mov r1, #0x6d - lsl r1, r1, #2 - ldr r0, [r0, r1] - bx lr - thumb_func_end ov12_0223B6CC - - thumb_func_start BattleSystem_AreBattleAnimationsOn -BattleSystem_AreBattleAnimationsOn: ; 0x0223B6D4 - push {r3, lr} - ldr r2, [r0, #0x2c] - mov r1, #4 - tst r1, r2 - beq _0223B6EC - ldr r1, _0223B704 ; =0x0000240C - ldr r2, [r0, r1] - mov r1, #0x10 - tst r1, r2 - bne _0223B6EC - mov r0, #1 - pop {r3, pc} -_0223B6EC: - mov r1, #0x6d - lsl r1, r1, #2 - ldr r0, [r0, r1] - bl Options_GetBattleScene - cmp r0, #0 - bne _0223B6FE - mov r0, #1 - pop {r3, pc} -_0223B6FE: - mov r0, #0 - pop {r3, pc} - nop -_0223B704: .word 0x0000240C - thumb_func_end BattleSystem_AreBattleAnimationsOn - - thumb_func_start ov12_0223B708 -ov12_0223B708: ; 0x0223B708 - mov r1, #0x6d - lsl r1, r1, #2 - ldr r3, _0223B714 ; =Options_GetFrame - ldr r0, [r0, r1] - bx r3 - nop -_0223B714: .word Options_GetFrame - thumb_func_end ov12_0223B708 - - thumb_func_start ov12_0223B718 -ov12_0223B718: ; 0x0223B718 - push {r3, lr} - ldr r2, [r0, #0x2c] - mov r1, #4 - tst r1, r2 - beq _0223B730 - ldr r1, _0223B73C ; =0x0000240C - ldr r2, [r0, r1] - mov r1, #0x10 - tst r1, r2 - bne _0223B730 - mov r0, #1 - pop {r3, pc} -_0223B730: - mov r1, #0x6d - lsl r1, r1, #2 - ldr r0, [r0, r1] - bl Options_GetTextFrameDelay - pop {r3, pc} - .balign 4, 0 -_0223B73C: .word 0x0000240C - thumb_func_end ov12_0223B718 - - thumb_func_start ov12_0223B740 -ov12_0223B740: ; 0x0223B740 - mov r1, #0x6d - lsl r1, r1, #2 - ldr r3, _0223B74C ; =Options_GetBattleStyle - ldr r0, [r0, r1] - bx r3 - nop -_0223B74C: .word Options_GetBattleStyle - thumb_func_end ov12_0223B740 - - thumb_func_start ov12_0223B750 -ov12_0223B750: ; 0x0223B750 - mov r1, #0x72 - lsl r1, r1, #2 - ldr r0, [r0, r1] - bx lr - thumb_func_end ov12_0223B750 - - thumb_func_start BattleSystem_GetChatotVoice -BattleSystem_GetChatotVoice: ; 0x0223B758 - push {r3, r4, r5, lr} - add r5, r0, #0 - ldr r2, [r5, #0x2c] - mov r3, #8 - add r4, r1, #0 - tst r3, r2 - bne _0223B776 - mov r3, #0x10 - tst r2, r3 - beq _0223B77E - bl ov12_0223AB0C - mov r1, #1 - tst r0, r1 - beq _0223B77E -_0223B776: - lsl r0, r4, #2 - add r0, r5, r0 - ldr r0, [r0, #0x78] - pop {r3, r4, r5, pc} -_0223B77E: - ldr r1, [r5, #0x2c] - mov r0, #2 - tst r0, r1 - beq _0223B790 - lsl r0, r4, #0x1f - lsr r0, r0, #0x1d - add r0, r5, r0 - ldr r0, [r0, #0x78] - pop {r3, r4, r5, pc} -_0223B790: - lsl r0, r4, #2 - add r0, r5, r0 - ldr r0, [r0, #0x78] - pop {r3, r4, r5, pc} - thumb_func_end BattleSystem_GetChatotVoice - - thumb_func_start ov12_0223B798 -ov12_0223B798: ; 0x0223B798 - push {r3, r4, r5, r6, r7, lr} - add r5, r0, #0 - mov r1, #0xa9 - ldr r2, [r5, #0x2c] - lsl r1, r1, #2 - tst r1, r2 - bne _0223B84E - mov r4, #0 - add r1, r4, #0 - bl BattleSystem_GetPartySize - cmp r0, #0 - ble _0223B84E - add r7, r4, #0 -_0223B7B4: - add r0, r5, #0 - mov r1, #0 - add r2, r4, #0 - bl BattleSystem_GetPartyMon - mov r1, #0xae - mov r2, #0 - add r6, r0, #0 - bl GetMonData - lsl r0, r0, #0x10 - lsr r1, r0, #0x10 - mov r0, #0x67 - lsl r0, r0, #2 - cmp r1, r0 - bne _0223B840 - add r0, r4, #0 - bl MaskOfFlagNo - ldr r1, _0223B850 ; =0x00002418 - ldrb r1, [r5, r1] - tst r0, r1 - beq _0223B840 - add r0, r5, #0 - bl BattleSystem_GetTerrainId - cmp r0, #0x17 - bhi _0223B828 - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_0223B7F8: ; jump table - .short _0223B82C - _0223B7F8 - 2 ; case 0 - .short _0223B82C - _0223B7F8 - 2 ; case 1 - .short _0223B828 - _0223B7F8 - 2 ; case 2 - .short _0223B828 - _0223B7F8 - 2 ; case 3 - .short _0223B82C - _0223B7F8 - 2 ; case 4 - .short _0223B82C - _0223B7F8 - 2 ; case 5 - .short _0223B828 - _0223B7F8 - 2 ; case 6 - .short _0223B828 - _0223B7F8 - 2 ; case 7 - .short _0223B828 - _0223B7F8 - 2 ; case 8 - .short _0223B832 - _0223B7F8 - 2 ; case 9 - .short _0223B828 - _0223B7F8 - 2 ; case 10 - .short _0223B832 - _0223B7F8 - 2 ; case 11 - .short _0223B832 - _0223B7F8 - 2 ; case 12 - .short _0223B832 - _0223B7F8 - 2 ; case 13 - .short _0223B832 - _0223B7F8 - 2 ; case 14 - .short _0223B832 - _0223B7F8 - 2 ; case 15 - .short _0223B832 - _0223B7F8 - 2 ; case 16 - .short _0223B82C - _0223B7F8 - 2 ; case 17 - .short _0223B832 - _0223B7F8 - 2 ; case 18 - .short _0223B832 - _0223B7F8 - 2 ; case 19 - .short _0223B832 - _0223B7F8 - 2 ; case 20 - .short _0223B832 - _0223B7F8 - 2 ; case 21 - .short _0223B832 - _0223B7F8 - 2 ; case 22 - .short _0223B82C - _0223B7F8 - 2 ; case 23 -_0223B828: - str r7, [sp] - b _0223B836 -_0223B82C: - mov r0, #1 - str r0, [sp] - b _0223B836 -_0223B832: - mov r0, #2 - str r0, [sp] -_0223B836: - add r0, r6, #0 - mov r1, #0x70 - add r2, sp, #0 - bl SetMonData -_0223B840: - add r0, r5, #0 - mov r1, #0 - add r4, r4, #1 - bl BattleSystem_GetPartySize - cmp r4, r0 - blt _0223B7B4 -_0223B84E: - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_0223B850: .word 0x00002418 - thumb_func_end ov12_0223B798 - - thumb_func_start ov12_0223B854 -ov12_0223B854: ; 0x0223B854 - push {r3, r4, r5, lr} - add r5, r0, #0 - add r0, r2, #0 - add r4, r1, #0 - bl MaskOfFlagNo - ldr r1, _0223B86C ; =0x00002418 - add r2, r5, r1 - ldrb r1, [r2, r4] - orr r0, r1 - strb r0, [r2, r4] - pop {r3, r4, r5, pc} - .balign 4, 0 -_0223B86C: .word 0x00002418 - thumb_func_end ov12_0223B854 - - thumb_func_start ov12_0223B870 -ov12_0223B870: ; 0x0223B870 - bx lr - .balign 4, 0 - thumb_func_end ov12_0223B870 - - thumb_func_start ov12_0223B874 -ov12_0223B874: ; 0x0223B874 - push {r4, r5, r6, r7, lr} - sub sp, #0x2c - mov r1, #1 - add r4, r0, #0 - mov r0, #5 - lsl r1, r1, #0x10 - bl AllocFromHeap - mov r1, #0x22 - lsl r1, r1, #4 - str r0, [r4, r1] - mov r0, #5 - sub r1, #0x20 - bl AllocFromHeap - mov r1, #0x89 - lsl r1, r1, #2 - str r0, [r4, r1] - sub r1, r1, #4 - mov r2, #1 - ldr r0, _0223BACC ; =0x06010000 - ldr r1, [r4, r1] - lsl r2, r2, #0x10 - bl MIi_CpuCopy32 - mov r0, #0x89 - lsl r0, r0, #2 - ldr r5, [r4, r0] - ldr r0, [r4, #0x28] - mov r1, #0 - bl PaletteData_GetUnfadedBuf - mov r2, #2 - add r1, r5, #0 - lsl r2, r2, #8 - bl MIi_CpuCopy32 - mov r0, #0x19 - lsl r0, r0, #0x16 - str r0, [sp, #0x24] - mov r0, #0x63 - lsl r0, r0, #2 - ldr r0, [r4, r0] - ldr r0, [r0] - bl sub_02024B1C - ldr r1, [r0, #4] - ldr r0, [sp, #0x24] - add r0, r0, r1 - str r0, [sp, #0x24] - mov r0, #0x14 - str r0, [sp, #0x28] - lsl r0, r0, #0xb - str r0, [sp, #0xc] -_0223B8E0: - mov r0, #0x10 - mov ip, r0 - lsl r0, r0, #6 - str r0, [sp, #0x14] - ldr r0, [sp, #0x28] - mov r7, #1 - sub r0, #0x14 - lsl r1, r0, #8 - ldr r0, [sp, #0x24] - add r0, r0, r1 - str r0, [sp, #0x10] -_0223B8F6: - mov r0, ip - sub r0, #0x10 - ldr r1, [sp, #0x10] - lsl r3, r0, #5 - add r3, r1, r3 - ldr r5, [sp, #0xc] - ldr r1, [sp, #0x14] - mov r2, #0 - add r6, r5, r1 -_0223B908: - cmp r0, #8 - bge _0223B930 - add r1, r2, #0 - tst r1, r7 - beq _0223B922 - lsr r1, r2, #0x1f - add r1, r2, r1 - asr r1, r1, #1 - ldrb r5, [r3, r1] - mov r1, #0xf0 - and r1, r5 - asr r1, r1, #4 - b _0223B95E -_0223B922: - lsr r1, r2, #0x1f - add r1, r2, r1 - asr r1, r1, #1 - ldrb r5, [r3, r1] - mov r1, #0xf - and r1, r5 - b _0223B95E -_0223B930: - mov r1, #1 - tst r1, r2 - beq _0223B94C - lsr r1, r2, #0x1f - add r1, r2, r1 - asr r1, r1, #1 - add r5, r3, r1 - mov r1, #7 - lsl r1, r1, #8 - ldrb r5, [r5, r1] - mov r1, #0xf0 - and r1, r5 - asr r1, r1, #4 - b _0223B95E -_0223B94C: - lsr r1, r2, #0x1f - add r1, r2, r1 - asr r1, r1, #1 - add r5, r3, r1 - mov r1, #7 - lsl r1, r1, #8 - ldrb r5, [r5, r1] - mov r1, #0xf - and r1, r5 -_0223B95E: - cmp r1, #0 - beq _0223B96E - mov r5, #0x22 - lsl r5, r5, #4 - ldr r5, [r4, r5] - add r1, #0x70 - add r5, r6, r5 - strb r1, [r2, r5] -_0223B96E: - add r2, r2, #1 - cmp r2, #0x40 - blt _0223B908 - ldr r0, [sp, #0x14] - add r0, #0x40 - str r0, [sp, #0x14] - mov r0, ip - add r0, r0, #1 - mov ip, r0 - cmp r0, #0x20 - blt _0223B8F6 - mov r1, #2 - ldr r0, [sp, #0xc] - lsl r1, r1, #0xa - add r0, r0, r1 - str r0, [sp, #0xc] - ldr r0, [sp, #0x28] - add r0, r0, #1 - str r0, [sp, #0x28] - cmp r0, #0x1c - blt _0223B8E0 - mov r0, #0x19 - lsl r0, r0, #0x16 - str r0, [sp, #8] - mov r0, #0x5f - lsl r0, r0, #2 - ldr r0, [r4, r0] - ldr r0, [r0] - bl sub_02024B1C - ldr r1, [r0, #4] - ldr r0, [sp, #8] - mov r7, #0x26 - add r0, r0, r1 - str r0, [sp, #8] - mov r3, #0 - mov r0, #0xf - mov r1, #0xf0 - lsl r7, r7, #0xa - mov r2, #1 -_0223B9BE: - add r5, r3, #0 - tst r5, r2 - beq _0223B9D4 - lsr r5, r3, #0x1f - add r5, r3, r5 - asr r6, r5, #1 - ldr r5, [sp, #8] - ldrb r5, [r5, r6] - and r5, r1 - asr r5, r5, #4 - b _0223B9E0 -_0223B9D4: - lsr r5, r3, #0x1f - add r5, r3, r5 - asr r6, r5, #1 - ldr r5, [sp, #8] - ldrb r5, [r5, r6] - and r5, r0 -_0223B9E0: - cmp r5, #0 - beq _0223B9F0 - mov r6, #0x22 - lsl r6, r6, #4 - ldr r6, [r4, r6] - add r5, #0x70 - add r6, r6, r3 - strb r5, [r6, r7] -_0223B9F0: - mov r5, #2 - add r3, r3, #1 - lsl r5, r5, #0xa - cmp r3, r5 - blt _0223B9BE - mov r0, #0x1c - str r0, [sp, #4] - lsl r0, r0, #0xb - str r0, [sp, #0x18] -_0223BA02: - ldr r0, [sp, #4] - mov r2, #0 - sub r0, #0x1c - lsl r1, r0, #8 - ldr r0, [sp, #8] - str r2, [sp, #0x20] - add r0, r0, r1 - str r0, [sp, #0x1c] - mov r7, #1 -_0223BA14: - asr r0, r2, #2 - lsr r0, r0, #0x1d - add r0, r2, r0 - asr r0, r0, #3 - lsl r1, r0, #0xa - ldr r0, [sp, #0x1c] - lsr r5, r2, #0x1f - add r6, r0, r1 - lsl r1, r2, #0x1d - sub r1, r1, r5 - mov r0, #0x1d - ror r1, r0 - add r0, r5, r1 - lsl r0, r0, #5 - ldr r5, [sp, #0x18] - ldr r1, [sp, #0x20] - mov r3, #0 - add r0, r6, r0 - add r1, r5, r1 -_0223BA3A: - add r5, r3, #0 - tst r5, r7 - beq _0223BA56 - lsr r5, r3, #0x1f - add r5, r3, r5 - asr r5, r5, #1 - add r6, r0, r5 - mov r5, #1 - lsl r5, r5, #0xa - ldrb r6, [r6, r5] - mov r5, #0xf0 - and r5, r6 - asr r5, r5, #4 - b _0223BA68 -_0223BA56: - lsr r5, r3, #0x1f - add r5, r3, r5 - asr r5, r5, #1 - add r6, r0, r5 - mov r5, #1 - lsl r5, r5, #0xa - ldrb r6, [r6, r5] - mov r5, #0xf - and r5, r6 -_0223BA68: - cmp r5, #0 - beq _0223BA78 - mov r6, #0x22 - lsl r6, r6, #4 - ldr r6, [r4, r6] - add r5, #0x70 - add r6, r1, r6 - strb r5, [r3, r6] -_0223BA78: - add r3, r3, #1 - cmp r3, #0x40 - blt _0223BA3A - ldr r0, [sp, #0x20] - add r2, r2, #1 - add r0, #0x40 - str r0, [sp, #0x20] - cmp r2, #0x18 - blt _0223BA14 - mov r3, #2 - ldr r0, [sp, #0x18] - lsl r3, r3, #0xa - add r0, r0, r3 - str r0, [sp, #0x18] - ldr r0, [sp, #4] - add r0, r0, #1 - str r0, [sp, #4] - cmp r0, #0x20 - blt _0223BA02 - mov r0, #0 - mov r2, #0x22 - str r0, [sp] - lsl r2, r2, #4 - ldr r0, [r4, #4] - ldr r2, [r4, r2] - mov r1, #3 - lsl r3, r3, #5 - bl BG_LoadCharTilesData - mov r0, #0x5f - lsl r0, r0, #2 - add r0, r4, r0 - bl ov12_02266008 - mov r0, #0x63 - lsl r0, r0, #2 - add r0, r4, r0 - bl ov12_02266008 - add sp, #0x2c - pop {r4, r5, r6, r7, pc} - nop -_0223BACC: .word 0x06010000 - thumb_func_end ov12_0223B874 - - thumb_func_start ov12_0223BAD0 -ov12_0223BAD0: ; 0x0223BAD0 - mov r1, #0x22 - lsl r1, r1, #4 - ldr r0, [r0, r1] - bx lr - thumb_func_end ov12_0223BAD0 - - thumb_func_start ov12_0223BAD8 -ov12_0223BAD8: ; 0x0223BAD8 - mov r1, #0x89 - lsl r1, r1, #2 - ldr r0, [r0, r1] - bx lr - thumb_func_end ov12_0223BAD8 - - thumb_func_start ov12_0223BAE0 -ov12_0223BAE0: ; 0x0223BAE0 - ldr r1, _0223BAE8 ; =0x00002228 - add r0, r0, r1 - bx lr - nop -_0223BAE8: .word 0x00002228 - thumb_func_end ov12_0223BAE0 - - thumb_func_start ov12_0223BAEC -ov12_0223BAEC: ; 0x0223BAEC - ldr r1, _0223BAF4 ; =0x00002308 - add r0, r0, r1 - bx lr - nop -_0223BAF4: .word 0x00002308 - thumb_func_end ov12_0223BAEC - - thumb_func_start BattleSystem_GetWeather -BattleSystem_GetWeather: ; 0x0223BAF8 - ldr r1, _0223BB00 ; =0x0000242C - ldr r0, [r0, r1] - bx lr - nop -_0223BB00: .word 0x0000242C - thumb_func_end BattleSystem_GetWeather - - thumb_func_start ov12_0223BB04 -ov12_0223BB04: ; 0x0223BB04 - ldr r1, _0223BB0C ; =0x00002421 - ldrb r0, [r0, r1] - bx lr - nop -_0223BB0C: .word 0x00002421 - thumb_func_end ov12_0223BB04 - - thumb_func_start ov12_0223BB10 -ov12_0223BB10: ; 0x0223BB10 - ldr r2, _0223BB18 ; =0x00002421 - strb r1, [r0, r2] - bx lr - nop -_0223BB18: .word 0x00002421 - thumb_func_end ov12_0223BB10 - - thumb_func_start ov12_0223BB1C -ov12_0223BB1C: ; 0x0223BB1C - ldr r1, _0223BB24 ; =0x00002430 - ldr r0, [r0, r1] - bx lr - nop -_0223BB24: .word 0x00002430 - thumb_func_end ov12_0223BB1C - - thumb_func_start ov12_0223BB28 -ov12_0223BB28: ; 0x0223BB28 - push {r3, lr} - ldr r2, _0223BB40 ; =0x0000240C - ldr r3, [r0, r2] - mov r2, #0x10 - tst r2, r3 - bne _0223BB3E - mov r2, #0x87 - lsl r2, r2, #2 - ldr r0, [r0, r2] - bl GameStats_Inc -_0223BB3E: - pop {r3, pc} - .balign 4, 0 -_0223BB40: .word 0x0000240C - thumb_func_end ov12_0223BB28 - - thumb_func_start ov12_0223BB44 -ov12_0223BB44: ; 0x0223BB44 - push {r3, lr} - ldr r1, _0223BB60 ; =0x0000240C - ldr r2, [r0, r1] - mov r1, #0x10 - tst r1, r2 - bne _0223BB5C - mov r1, #0x87 - lsl r1, r1, #2 - ldr r0, [r0, r1] - mov r1, #0x15 - bl GameStats_AddSpecial -_0223BB5C: - pop {r3, pc} - nop -_0223BB60: .word 0x0000240C - thumb_func_end ov12_0223BB44 - - thumb_func_start ov12_0223BB64 -ov12_0223BB64: ; 0x0223BB64 - mov r2, #0x91 - lsl r2, r2, #6 - str r1, [r0, r2] - bx lr - thumb_func_end ov12_0223BB64 - - thumb_func_start ov12_0223BB6C -ov12_0223BB6C: ; 0x0223BB6C - ldr r2, _0223BB74 ; =0x00002444 - strb r1, [r0, r2] - bx lr - nop -_0223BB74: .word 0x00002444 - thumb_func_end ov12_0223BB6C - - thumb_func_start ov12_0223BB78 -ov12_0223BB78: ; 0x0223BB78 - mov r1, #0x6f - lsl r1, r1, #2 - ldr r0, [r0, r1] - bx lr - thumb_func_end ov12_0223BB78 - - thumb_func_start ov12_0223BB80 -ov12_0223BB80: ; 0x0223BB80 - mov r2, #0x6f - lsl r2, r2, #2 - str r1, [r0, r2] - bx lr - thumb_func_end ov12_0223BB80 - - thumb_func_start ov12_0223BB88 -ov12_0223BB88: ; 0x0223BB88 - mov r2, #0x1d - lsl r2, r2, #4 - add r2, r0, r2 - lsl r0, r1, #4 - add r0, r2, r0 - bx lr - thumb_func_end ov12_0223BB88 - - thumb_func_start ov12_0223BB94 -ov12_0223BB94: ; 0x0223BB94 - push {r3, r4, r5, lr} - add r5, r1, #0 - add r4, r0, #0 - cmp r5, #4 - blt _0223BBA2 - bl GF_AssertFail -_0223BBA2: - lsl r0, r5, #4 - ldr r0, [r4, r0] - pop {r3, r4, r5, pc} - thumb_func_end ov12_0223BB94 - - thumb_func_start ov12_0223BBA8 -ov12_0223BBA8: ; 0x0223BBA8 - push {r4, r5, r6, lr} - add r4, r1, #0 - add r5, r0, #0 - add r6, r2, #0 - cmp r4, #4 - blt _0223BBB8 - bl GF_AssertFail -_0223BBB8: - lsl r0, r4, #4 - add r0, r5, r0 - str r6, [r0, #4] - pop {r4, r5, r6, pc} - thumb_func_end ov12_0223BBA8 - - thumb_func_start ov12_0223BBC0 -ov12_0223BBC0: ; 0x0223BBC0 - push {r4, r5, r6, lr} - add r4, r1, #0 - add r5, r0, #0 - add r6, r2, #0 - cmp r4, #4 - blt _0223BBD0 - bl GF_AssertFail -_0223BBD0: - lsl r0, r4, #4 - add r0, r5, r0 - str r6, [r0, #8] - pop {r4, r5, r6, pc} - thumb_func_end ov12_0223BBC0 - - thumb_func_start ov12_0223BBD8 -ov12_0223BBD8: ; 0x0223BBD8 - push {r4, r5, r6, lr} - add r4, r1, #0 - add r5, r0, #0 - add r6, r2, #0 - cmp r4, #4 - blt _0223BBE8 - bl GF_AssertFail -_0223BBE8: - lsl r0, r4, #4 - add r0, r5, r0 - str r6, [r0, #0xc] - pop {r4, r5, r6, pc} - thumb_func_end ov12_0223BBD8 - - thumb_func_start ov12_0223BBF0 -ov12_0223BBF0: ; 0x0223BBF0 - ldr r2, _0223BBF8 ; =0x000023FD - strb r1, [r0, r2] - bx lr - nop -_0223BBF8: .word 0x000023FD - thumb_func_end ov12_0223BBF0 - - thumb_func_start ov12_0223BBFC -ov12_0223BBFC: ; 0x0223BBFC - ldr r2, _0223BC04 ; =0x000023F4 - str r1, [r0, r2] - bx lr - nop -_0223BC04: .word 0x000023F4 - thumb_func_end ov12_0223BBFC - - thumb_func_start ov12_0223BC08 -ov12_0223BC08: ; 0x0223BC08 - ldr r2, _0223BC10 ; =0x000023F8 - str r1, [r0, r2] - bx lr - nop -_0223BC10: .word 0x000023F8 - thumb_func_end ov12_0223BC08 - - thumb_func_start ov12_0223BC14 -ov12_0223BC14: ; 0x0223BC14 - ldr r2, _0223BC1C ; =0x000023F4 - ldr r0, [r0, r2] - strb r1, [r0] - bx lr - .balign 4, 0 -_0223BC1C: .word 0x000023F4 - thumb_func_end ov12_0223BC14 - - thumb_func_start ov12_0223BC20 -ov12_0223BC20: ; 0x0223BC20 - ldr r2, _0223BC28 ; =0x000023F8 - ldr r0, [r0, r2] - strb r1, [r0] - bx lr - .balign 4, 0 -_0223BC28: .word 0x000023F8 - thumb_func_end ov12_0223BC20 - - thumb_func_start ov12_0223BC2C -ov12_0223BC2C: ; 0x0223BC2C - ldr r2, _0223BC34 ; =0x000023FE - strb r1, [r0, r2] - bx lr - nop -_0223BC34: .word 0x000023FE - thumb_func_end ov12_0223BC2C - - thumb_func_start ov12_0223BC38 -ov12_0223BC38: ; 0x0223BC38 - lsl r1, r1, #2 - add r0, r0, r1 - ldr r3, _0223BC44 ; =ov12_0226127C - ldr r0, [r0, #0x34] - bx r3 - nop -_0223BC44: .word ov12_0226127C - thumb_func_end ov12_0223BC38 - - thumb_func_start ov12_0223BC48 -ov12_0223BC48: ; 0x0223BC48 - push {r3, r4, r5, r6, r7, lr} - add r6, r0, #0 - ldr r0, [r6, #0x44] - mov r7, #0 - cmp r0, #0 - ble _0223BC94 - add r5, r6, #0 -_0223BC56: - ldr r0, [r5, #0x34] - bl ov12_0226127C - add r4, r0, #0 - str r6, [r4, #0xc] - ldr r0, [r5, #0x34] - bl ov12_02261258 - str r0, [sp] - add r0, r6, #0 - bl BattleSystem_GetBattleType - add r1, r0, #0 - ldr r0, [sp] - bl ov12_02265B64 - add r1, r4, #0 - add r1, #0x25 - strb r0, [r1] - add r0, r4, #0 - bl ov12_02264BCC - add r0, r4, #0 - mov r1, #0 - bl ov12_02264F28 - ldr r0, [r6, #0x44] - add r7, r7, #1 - add r5, r5, #4 - cmp r7, r0 - blt _0223BC56 -_0223BC94: - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 - thumb_func_end ov12_0223BC48 - - thumb_func_start ov12_0223BC98 -ov12_0223BC98: ; 0x0223BC98 - push {r3, r4, r5, r6, r7, lr} - add r6, r0, #0 - ldr r0, [r6, #0x44] - mov r4, #0 - cmp r0, #0 - ble _0223BCC4 - add r5, r6, #0 - mov r7, #1 -_0223BCA8: - ldr r0, [r5, #0x34] - bl ov12_0226127C - ldr r1, [r0, #0x28] - cmp r1, #0 - beq _0223BCBA - add r1, r7, #0 - bl ov12_02264F28 -_0223BCBA: - ldr r0, [r6, #0x44] - add r4, r4, #1 - add r5, r5, #4 - cmp r4, r0 - blt _0223BCA8 -_0223BCC4: - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 - thumb_func_end ov12_0223BC98 - - thumb_func_start ov12_0223BCC8 -ov12_0223BCC8: ; 0x0223BCC8 - push {r3, r4, r5, r6, r7, lr} - add r6, r0, #0 - ldr r0, [r6, #0x44] - mov r4, #0 - cmp r0, #0 - ble _0223BCEE - add r5, r6, #0 - add r7, r4, #0 -_0223BCD8: - ldr r0, [r5, #0x34] - bl ov12_0226127C - add r1, r7, #0 - bl ov12_02264F28 - ldr r0, [r6, #0x44] - add r4, r4, #1 - add r5, r5, #4 - cmp r4, r0 - blt _0223BCD8 -_0223BCEE: - pop {r3, r4, r5, r6, r7, pc} - thumb_func_end ov12_0223BCC8 - - thumb_func_start ov12_0223BCF0 -ov12_0223BCF0: ; 0x0223BCF0 - push {r4, r5, r6, lr} - add r6, r0, #0 - ldr r0, [r6, #0x44] - mov r4, #0 - cmp r0, #0 - ble _0223BD12 - add r5, r6, #0 -_0223BCFE: - ldr r0, [r5, #0x34] - bl ov12_0226127C - bl ov12_02264C68 - ldr r0, [r6, #0x44] - add r4, r4, #1 - add r5, r5, #4 - cmp r4, r0 - blt _0223BCFE -_0223BD12: - pop {r4, r5, r6, pc} - thumb_func_end ov12_0223BCF0 - - thumb_func_start BattleSystem_GetWinLoseFlags -BattleSystem_GetWinLoseFlags: ; 0x0223BD14 - ldr r1, _0223BD1C ; =0x00002420 - ldrb r0, [r0, r1] - bx lr - nop -_0223BD1C: .word 0x00002420 - thumb_func_end BattleSystem_GetWinLoseFlags - - thumb_func_start ov12_0223BD20 -ov12_0223BD20: ; 0x0223BD20 - ldr r2, _0223BD28 ; =0x00002420 - strb r1, [r0, r2] - bx lr - nop -_0223BD28: .word 0x00002420 - thumb_func_end ov12_0223BD20 - - thumb_func_start ov12_0223BD2C -ov12_0223BD2C: ; 0x0223BD2C - ldr r1, _0223BD38 ; =0x000023FF - ldrb r0, [r0, r1] - lsl r0, r0, #0x1b - lsr r0, r0, #0x1e - bx lr - nop -_0223BD38: .word 0x000023FF - thumb_func_end ov12_0223BD2C - - thumb_func_start ov12_0223BD3C -ov12_0223BD3C: ; 0x0223BD3C - push {r3, r4} - ldr r3, _0223BD54 ; =0x000023FF - lsl r1, r1, #0x1e - ldrb r4, [r0, r3] - mov r2, #0x18 - lsr r1, r1, #0x1b - bic r4, r2 - orr r1, r4 - strb r1, [r0, r3] - pop {r3, r4} - bx lr - nop -_0223BD54: .word 0x000023FF - thumb_func_end ov12_0223BD3C - - thumb_func_start ov12_0223BD58 -ov12_0223BD58: ; 0x0223BD58 - ldr r1, _0223BD64 ; =0x000023FF - ldrb r0, [r0, r1] - lsl r0, r0, #0x18 - lsr r0, r0, #0x1d - bx lr - nop -_0223BD64: .word 0x000023FF - thumb_func_end ov12_0223BD58 - - thumb_func_start ov12_0223BD68 -ov12_0223BD68: ; 0x0223BD68 - push {r3, r4, r5, lr} - add r4, r1, #0 - add r5, r0, #0 - cmp r4, #0xf - blo _0223BD76 - bl GF_AssertFail -_0223BD76: - ldr r1, _0223BD88 ; =0x000023FF - mov r0, #0xe0 - ldrb r2, [r5, r1] - bic r2, r0 - lsl r0, r4, #0x1d - lsr r0, r0, #0x18 - orr r0, r2 - strb r0, [r5, r1] - pop {r3, r4, r5, pc} - .balign 4, 0 -_0223BD88: .word 0x000023FF - thumb_func_end ov12_0223BD68 - - thumb_func_start ov12_0223BD8C -ov12_0223BD8C: ; 0x0223BD8C - ldr r2, _0223BD94 ; =0x0000243C - str r1, [r0, r2] - bx lr - nop -_0223BD94: .word 0x0000243C - thumb_func_end ov12_0223BD8C - - thumb_func_start BattleSystem_Random -BattleSystem_Random: ; 0x0223BD98 - push {r3, r4} - ldr r2, _0223BDB8 ; =0x00002448 - ldr r1, _0223BDBC ; =0x41C64E6D - ldr r3, [r0, r2] - add r4, r3, #0 - mul r4, r1 - ldr r1, _0223BDC0 ; =0x00006073 - add r1, r4, r1 - str r1, [r0, r2] - ldr r0, [r0, r2] - lsr r0, r0, #0x10 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - pop {r3, r4} - bx lr - nop -_0223BDB8: .word 0x00002448 -_0223BDBC: .word 0x41C64E6D -_0223BDC0: .word 0x00006073 - thumb_func_end BattleSystem_Random - - thumb_func_start ov12_0223BDC4 -ov12_0223BDC4: ; 0x0223BDC4 - ldr r1, _0223BDCC ; =0x0000244C - ldr r0, [r0, r1] - bx lr - nop -_0223BDCC: .word 0x0000244C - thumb_func_end ov12_0223BDC4 - - thumb_func_start ov12_0223BDD0 -ov12_0223BDD0: ; 0x0223BDD0 - ldr r2, _0223BDD8 ; =0x0000244C - str r1, [r0, r2] - bx lr - nop -_0223BDD8: .word 0x0000244C - thumb_func_end ov12_0223BDD0 - thumb_func_start ov12_0223BDDC ov12_0223BDDC: ; 0x0223BDDC push {r4, r5, r6, lr} @@ -3824,7 +633,7 @@ ov12_0223C224: ; 0x0223C224 add r5, r6, #0 _0223C234: ldr r0, [r5, #0x34] - bl ov12_0226127C + bl OpponentData_GetHpBar add r1, r7, #0 bl ov12_02264EE0 ldr r0, [r6, #0x44] @@ -3984,7 +793,7 @@ ov12_0223C34C: ; 0x0223C34C mov r1, #0 str r2, [sp, #0xc] add r5, r3, #0 - bl ov12_0223A7D8 + bl BattleSystem_GetWindow add r7, r0, #0 ldr r0, [r6, #0x2c] mov r2, #0x80 @@ -4144,7 +953,7 @@ ov12_0223C494: ; 0x0223C494 add r4, r2, #0 mov r1, #0 add r6, r3, #0 - bl ov12_0223A7D8 + bl BattleSystem_GetWindow add r7, r0, #0 add r0, r5, #0 add r1, r4, #0 @@ -5395,7 +2204,7 @@ ov12_0223CEB4: ; 0x0223CEB4 add r4, r1, #0 add r5, r0, #0 add r1, r2, #0 - bl ov12_0223A9F4 + bl BattleSystem_GetTrainer add r2, r0, #0 ldr r0, [r5, #0x14] add r1, r4, #0 @@ -5409,7 +2218,7 @@ ov12_0223CECC: ; 0x0223CECC add r4, r1, #0 add r5, r0, #0 add r1, r2, #0 - bl ov12_0223A9F4 + bl BattleSystem_GetTrainer add r2, r0, #0 ldr r0, [r5, #0x14] add r1, r4, #0 diff --git a/asm/overlay_12_02264824.s b/asm/overlay_12_hp_bar.s similarity index 99% rename from asm/overlay_12_02264824.s rename to asm/overlay_12_hp_bar.s index accfdcfcd3..6e9b9b866e 100644 --- a/asm/overlay_12_02264824.s +++ b/asm/overlay_12_hp_bar.s @@ -484,8 +484,8 @@ _02264BC8: .balign 4, 0 thumb_func_end ov12_02264B94 - thumb_func_start ov12_02264BCC -ov12_02264BCC: ; 0x02264BCC + thumb_func_start BattleHpBar_LoadResources +BattleHpBar_LoadResources: ; 0x02264BCC push {r4, r5, r6, r7, lr} sub sp, #0xc add r5, r0, #0 @@ -500,7 +500,7 @@ ov12_02264BCC: ; 0x02264BCC bl ov12_0223A8EC str r0, [sp, #4] ldr r0, [r5, #0xc] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData str r0, [sp, #8] add r0, r5, #0 add r0, #0x25 @@ -555,10 +555,10 @@ _02264C5A: pop {r4, r5, r6, r7, pc} .balign 4, 0 _02264C64: .word ov12_0226D368 - thumb_func_end ov12_02264BCC + thumb_func_end BattleHpBar_LoadResources - thumb_func_start ov12_02264C68 -ov12_02264C68: ; 0x02264C68 + thumb_func_start BattleHpBar_FreeResources +BattleHpBar_FreeResources: ; 0x02264C68 push {r4, lr} add r4, r0, #0 bl ov12_02264B28 @@ -569,7 +569,7 @@ ov12_02264C68: ; 0x02264C68 add r0, r4, #0 bl ov12_02264B94 pop {r4, pc} - thumb_func_end ov12_02264C68 + thumb_func_end BattleHpBar_FreeResources thumb_func_start ov12_02264C84 ov12_02264C84: ; 0x02264C84 @@ -928,8 +928,8 @@ _02264F26: pop {r3, r4, r5, pc} thumb_func_end ov12_02264F00 - thumb_func_start ov12_02264F28 -ov12_02264F28: ; 0x02264F28 + thumb_func_start BattleHpBar_SetEnabled +BattleHpBar_SetEnabled: ; 0x02264F28 push {r3, r4, r5, lr} add r5, r0, #0 ldr r0, [r5, #4] @@ -943,7 +943,7 @@ ov12_02264F28: ; 0x02264F28 _02264F40: pop {r3, r4, r5, pc} .balign 4, 0 - thumb_func_end ov12_02264F28 + thumb_func_end BattleHpBar_SetEnabled thumb_func_start ov12_02264F44 ov12_02264F44: ; 0x02264F44 @@ -1238,7 +1238,7 @@ ov12_0226516C: ; 0x0226516C sub sp, #0x34 add r5, r0, #0 ldr r0, [r5, #0xc] - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig add r6, r0, #0 ldr r0, [r5, #0xc] bl ov12_0223A930 @@ -1471,7 +1471,7 @@ ov12_02265354: ; 0x02265354 bl MI_CpuFill8 ldr r0, [sp, #4] ldr r0, [r0, #0xc] - bl ov12_0223A928 + bl BattleSystem_GetLevelFont ldr r1, [sp, #4] str r4, [sp] add r1, #0x48 @@ -1599,7 +1599,7 @@ ov12_02265474: ; 0x02265474 add r4, r0, #0 bl MI_CpuFill8 ldr r0, [r5, #0xc] - bl ov12_0223A920 + bl BattleSystem_GetHpFont str r4, [sp] add r1, r6, #0 mov r2, #3 @@ -1660,7 +1660,7 @@ ov12_02265500: ; 0x02265500 add r4, r0, #0 bl MI_CpuFill8 ldr r0, [r5, #0xc] - bl ov12_0223A920 + bl BattleSystem_GetHpFont str r4, [sp] ldr r1, [r5, #0x2c] mov r2, #3 @@ -1770,7 +1770,7 @@ ov12_022655F0: ; 0x022655F0 add r4, r0, #0 ldr r0, [r4, #0xc] add r5, r1, #0 - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig add r6, r0, #0 ldr r0, [r4, #0xc] bl ov12_0223A930 @@ -1872,7 +1872,7 @@ ov12_022656CC: ; 0x022656CC add r4, r0, #0 ldr r0, [r4, #0xc] add r5, r1, #0 - bl ov12_0223A7D4 + bl BattleSystem_GetBgConfig str r0, [sp, #0x1c] ldr r0, [r4, #0xc] bl ov12_0223A930 @@ -2668,7 +2668,7 @@ ov12_02265C88: ; 0x02265C88 add r5, r0, #0 ldr r0, [r4] ldr r0, [r0, #0xc] - bl ov12_0223A938 + bl BattleSystem_GetPaletteData add r6, r0, #0 ldrb r0, [r4, #8] cmp r0, #0 diff --git a/include/battle.h b/include/battle.h index c59a862693..fd28d156e0 100644 --- a/include/battle.h +++ b/include/battle.h @@ -1,11 +1,22 @@ #ifndef POKEHEARTGOLD_BATTLE_H #define POKEHEARTGOLD_BATTLE_H +#include "bag.h" +#include "bag_cursor.h" +#include "bg_window.h" #include "item.h" +#include "font.h" +#include "game_stats.h" #include "move.h" +#include "options.h" +#include "palette.h" +#include "player_data.h" +#include "pokedex.h" #include "pokemon_storage_system.h" +#include "sav_chatot.h" #include "trainer_data.h" #include "filesystem.h" +#include "unk_02023694.h" #include "constants/battle.h" #include "constants/moves.h" @@ -254,10 +265,10 @@ typedef struct BATTLECONTEXT { ControllerCommand commandNext; int stateFieldConditionUpdate; int fieldConditionUpdateData; - int unk_18; - int unk_1C; - int unk_20; - int unk_24; + int stateUpdateMonCondition; + int updateMonConditionData; + int stateUpdateFieldConditionExtra; + int updateFieldConditionExtraData; int unk_28; int unk_2C; int unk_30; @@ -408,35 +419,38 @@ typedef struct BATTLECONTEXT { typedef struct BattleSystem BattleSystem; -typedef struct OpponentData_UnkSub_28 { - u8 unk0; - u32 unk4; - u32 unk8; +typedef struct BattleHpBar { + u8 script; + void *unk4; + void *unk8; BattleSystem *bsys; - u32 unk10; - u8 unk14; - u8 unk15; - u8 unk16; - u8 unk17; - int unk18; - int unk1C; - int unk20; - int unk24; - int unk28; - int unk2C; - int unk30; - int unk34; - u8 unk38; - u8 unk39; - u8 unk3A; + void *unk10; + s32 exp; + s32 maxExp; + s32 damage; + s32 hpCalc; + u8 battlerId; + u8 type; + u8 unk26; + u8 unk27; + s32 hp; + s32 maxHp; + s32 gainedExp; + s32 expCalc; + u8 level; + u8 gender; + u8 status; u8 unk3B; u8 unk3C; u8 unk3D; u8 unk3E; - u8 unk3F_0:1, unk3F_1:1, unk3F_2:1, unk3F_3:1; - u32 unk40; + u8 unk3F_0:1; + u8 unk3F_1:1; + u8 unk3F_2:1; + u8 unk3F_3:1; + void *unk40; u16 unk44; -} OpponentData_UnkSub_28; +} BattleHpBar; typedef struct OpponentData_UnkSub_70 { s8 unk0; @@ -455,7 +469,7 @@ typedef struct OpponentData { u32 *unk1C; u32 *unk20; u32 *unk24; - OpponentData_UnkSub_28 unk28; + BattleHpBar hpBar; OpponentData_UnkSub_70 unk70; u32 unk78; u32 *unk7C; @@ -474,7 +488,7 @@ typedef struct OpponentData { } OpponentData; typedef struct UnkBattleSystemSub17C { - u32 unk0; + UnkImageStruct *unk0; BattleSystem *bsys; u8 unk8; u8 unk9; @@ -498,56 +512,56 @@ typedef struct UnkBattleSystemSub220 { struct BattleSystem { u32 *unk0; - u32 *unk4; - u32 *unk8; + BgConfig *bgConfig; + Window *window; u32 *unkC; u32 *unk10; u32 *unk14; - u32 *unk18; + String *msgBuffer; u32 unk1C; u32 unk20; u32 unk24; - u32 unk28; - u32 battleTypeFlags; + PaletteData *palette; + u32 battleType; BATTLECONTEXT *ctx; OpponentData *opponentData[4]; - int unk44; //offset labels wrong from here until unk23E8 - u32 *unk48[4]; - u32 *unk58; - u32 *unk5C; - u32 *unk60; + int maxBattlers; + PlayerProfile *playerProfile[4]; + Bag *bag; + BagCursor *bagCursor; + Pokedex *pokedex; PC_STORAGE *storage; PARTY *trainerParty[4]; - u32 *unk78[4]; + SOUND_CHATOT *chatotVoice[4]; u32 *unk88; - u32 unk8C; - u32 unk90; - u32 unk94; + u32 *unk8C; + u32 *unk90; + u32 *unk94; u32 *unk98; u32 *unk9C; u16 trainerId[4]; u8 trainerGender[4]; TRAINER trainers[4]; - UnkBattleSystemSub17C unk17C[2]; - u32 unk19C; - u32 unk1A0[2]; - u32 *unk1A8; - u32 *unk1AC; - void *unk1B0; - u32 *unk1B4; + UnkBattleSystemSub17C unk17C[2]; //Battle Background..? + u32 *unk19C; + u32 *unk1A0[2]; + FontID *hpFont; + FontID *levelFont; + void *msgIcon; + OPTIONS *options; u32 *unk1B8; void *unk1BC; u32 *unk1C0; u32 *unk1C4; - u32 unk1C8; + void *unk1C8; //related to animations u32 *unk1CC; UnkBattleSystemSub1D0 unk1D0[4]; UnkBattleSystemSub220 unk220; - u32 *unk22C; + GAME_STATS *gameStats; u8 *unk230; u16 *unk234; - u8 unk238[0x1000]; - u8 unk1238[0x1000]; + u8 sendBuffer[0x1000]; + u8 recvBuffer[0x1000]; u16 unk2238[0x70]; u16 unk2318[0x70]; u16 unk23E8; //labeling may be wrong before here @@ -561,12 +575,16 @@ struct BattleSystem { u8 unk23FC; u8 unk23FD; u8 unk23FE; - u8 unk240F_0:1, unk240F_1:1, unk240E_F:1, unk240F_3:2, unk240F_5:3; - int unk2400; + u8 unk240F_0:1; + u8 unk240F_1:1; + u8 unk240E_F:1; + u8 criticalHpMusic:2; + u8 criticalHpMusicDelay:3; + Terrain terrain; int unk2404; - int unk2408; - u32 unk240C; - int unk2410; + int location; + u32 battleSpecial; + int timezone; //might be timeOfDay? unclear int safariBallCnt; u8 unk2418[4]; u32 unk241C; @@ -575,21 +593,25 @@ struct BattleSystem { u16 unk2422; int unk2424; int unk2428; - int unk242C; + int weather; int unk2430; u32 unk2434; int unk2438; int unk243C; - u8 unk2440; - u8 unk2441; - u32 unk2442; - u32 unk2444; - u32 unk2448; + int unk2440; + u8 unk2442; + u8 unk2445; + u32 rand; + u32 randTemp; u16 unk244C[4]; u16 unk2454[4]; u16 unk245C[4]; int unk2464[4]; - u32 unk2474_0:1, unk2474_1:1, unk2474_2:30; + u32 unk2474_0:1, + unk2474_1:1, + unk2474_2:1, + unk2474_3:1, + unk2474_4:28; u32 unk2478; u8 unk247C[4]; }; @@ -631,4 +653,11 @@ typedef struct TargetPokemon { u16 hpMax; } TargetPokemon; +//Information used for selecting an item on the bottom screen +typedef struct BattleItem { + u16 id; + u8 page; + u8 monIndex; +} BattleItem; + #endif diff --git a/include/battle/battle_hp_bar.h b/include/battle/battle_hp_bar.h new file mode 100644 index 0000000000..fd18dd8411 --- /dev/null +++ b/include/battle/battle_hp_bar.h @@ -0,0 +1,11 @@ +#ifndef POKEHEARTGOLD_BATTLE_HP_BAR_H +#define POKEHEARTGOLD_BATTLE_HP_BAR_H + +#include "battle.h" + +void BattleHpBar_LoadResources(BattleHpBar *hpBar); +void BattleHpBar_FreeResources(BattleHpBar *hpBar); +void BattleHpBar_SetEnabled(BattleHpBar *hpBar, BOOL a1); +u8 ov12_02265B64(u8 a0, u32 battleType); + +#endif diff --git a/include/battle_controller_player.h b/include/battle_controller_player.h index f7474a1c6e..8d9ba93993 100644 --- a/include/battle_controller_player.h +++ b/include/battle_controller_player.h @@ -19,6 +19,14 @@ void ov12_02249190(BattleSystem *bsys, BATTLECONTEXT *ctx); void ov12_0224930C(BattleSystem *bsys, BATTLECONTEXT *ctx); void ov12_02249460(BattleSystem *bsys, BATTLECONTEXT *ctx); void BattleControllerPlayer_UpdateFieldCondition(BattleSystem *bsys, BATTLECONTEXT *ctx); +void BattleControllerPlayer_UpdateMonCondition(BattleSystem *bsys, BATTLECONTEXT *ctx); +void BattleControllerPlayer_UpdateFieldConditionExtra(BattleSystem *bsys, BATTLECONTEXT *ctx); +void BattleControllerPlayer_TurnEnd(BattleSystem *bsys, BATTLECONTEXT *ctx); +void BattleControllerPlayer_FightInput(BattleSystem *bsys, BATTLECONTEXT *ctx); +void BattleControllerPlayer_ItemInput(BattleSystem *bsys, BATTLECONTEXT *ctx); +void BattleControllerPlayer_PokemonInput(BattleSystem *bsys, BATTLECONTEXT *ctx); +void BattleControllerPlayer_RunInput(BattleSystem *bsys, BATTLECONTEXT *ctx); +void BattleControllerPlayer_SafariBallInput(BattleSystem *bsys, BATTLECONTEXT *ctx); //The following functions haven't been decompiled yet void ov12_0224E384(BattleSystem *bsys, BATTLECONTEXT *ctx); @@ -27,5 +35,6 @@ void BattleSystem_CheckMoveEffect(BattleSystem *bsys, BATTLECONTEXT *ctx, int ba BOOL ov12_0224DC74(BATTLECONTEXT *ctx, ControllerCommand a1, ControllerCommand a2, int a3); BOOL ov12_0224DD18(BATTLECONTEXT *ctx, ControllerCommand a1, ControllerCommand a2); BOOL ov12_0224D7EC(BattleSystem *bsys, BATTLECONTEXT *ctx); +BOOL ov12_0224D540(BattleSystem *bsys, BATTLECONTEXT *ctx); #endif diff --git a/include/battle_setup.h b/include/battle_setup.h index 1bf78f7d7d..2bad3bd087 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -32,10 +32,11 @@ struct BATTLE_SETUP { //declared in trainer_data.h int unk94; int unk98; int unk9C; - int unkA0; + int evolutionLocation; int unkA4; int unkA8; - u32 unkAC[4]; + u32 unkAC[3]; + int levelUpFlag; u32 unkBC; int unkC0; u32 unkC4; diff --git a/include/battle_system.h b/include/battle_system.h index c7f4ce1870..6f8bf9c4dc 100644 --- a/include/battle_system.h +++ b/include/battle_system.h @@ -1,46 +1,139 @@ #ifndef POKEHEARTGOLD_BATTLE_SYSTEM_H #define POKEHEARTGOLD_BATTLE_SYSTEM_H +#include "bag.h" #include "battle.h" -#include "player_data.h" +#include "battle_setup.h" #include "pokemon.h" -#include "sav_chatot.h" -u16 BattleSystem_GetBattleType(BattleSystem *bsys); -u32 BattleSystem_GetFieldSide(BattleSystem *bsys, int battlerId); +BgConfig *BattleSystem_GetBgConfig(BattleSystem *bsys); +Window *BattleSystem_GetWindow(BattleSystem *bsys, int index); +u32 BattleSystem_GetBattleType(BattleSystem *bsys); +BATTLECONTEXT *BattleSystem_GetBattleContext(BattleSystem *bsys); +OpponentData *BattleSystem_GetOpponentData(BattleSystem *bsys, int battlerId); int BattleSystem_GetMaxBattlers(BattleSystem *bsys); -int BattleSystem_Random(BattleSystem *bsys); -PlayerProfile *BattleSystem_GetPlayerProfile(BattleSystem *bsys, int a1); PARTY *BattleSystem_GetParty(BattleSystem *bsys, int battlerId); int BattleSystem_GetPartySize(BattleSystem *bsys, int battlerId); Pokemon *BattleSystem_GetPartyMon(BattleSystem *bsys, int battlerId, int index); -int BattleSystem_GetTerrainId(BattleSystem *bsys); -int ov12_0223ABB8(BattleSystem *bsys, int battlerId, int a2); -void BattleSystem_RecoverStatus(BattleSystem *bsys, int battlerIdA, int battlerIdB, int a2, int itemWork); +u32 *ov12_0223A8D4(BattleSystem *bsys); +u32 *ov12_0223A8DC(BattleSystem *bsys); +u32 *ov12_0223A8E4(BattleSystem *bsys); +u32 *ov12_0223A8EC(BattleSystem *bsys); +UnkBattleSystemSub17C *ov12_0223A8F4(BattleSystem *bsys, int index); +u32 *ov12_0223A900(BattleSystem *bsys); +u32 *ov12_0223A908(BattleSystem *bsys, int index); +void ov12_0223A914(BattleSystem *bsys, int index, u32 *a2); +FontID *BattleSystem_GetHpFont(BattleSystem *bsys); +FontID *BattleSystem_GetLevelFont(BattleSystem *bsys); +u32 *ov12_0223A930(BattleSystem *bsys); +u32 *ov12_0223A934(BattleSystem *bsys); +PaletteData *BattleSystem_GetPaletteData(BattleSystem *bsys); +Pokedex *BattleSystem_GetPokedex(BattleSystem *bsys); +u8 *BattleSystem_GetSendBufferPtr(BattleSystem *bsys); +u8 *BattleSystem_GetRecvBufferPtr(BattleSystem *bsys); +u16 *ov12_0223A954(BattleSystem *bsys); +u16 *ov12_0223A960(BattleSystem *bsys); +u16 *ov12_0223A96C(BattleSystem *bsys); +u16 *ov12_0223A978(BattleSystem *bsys); +u16 *ov12_0223A984(BattleSystem *bsys); +u16 *ov12_0223A990(BattleSystem *bsys); +UnkBattleSystemSub1D0 *ov12_0223A99C(BattleSystem *bsys); +u32 *ov12_0223A9A4(BattleSystem *bsys); +String *BattleSystem_GetMessageBuffer(BattleSystem *bsys); +u16 BattleSystem_GetTrainerIndex(BattleSystem *bsys, int battlerId); +TRAINER *BattleSystem_GetTrainer(BattleSystem *bsys, int battlerId); +PlayerProfile *BattleSystem_GetPlayerProfile(BattleSystem *bsys, int a1); +Bag *BattleSystem_GetBag(BattleSystem *bsys); +BagCursor *BattleSystem_GetBagCursor(BattleSystem *bsys); +u16 BattleSystem_GetMonBall(BattleSystem *bsys, Pokemon *mon); +u32 ov12_0223AAB8(BattleSystem *bsys); +u32 BattleSystem_GetTrainerGender(BattleSystem *bsys, int battlerId); +int ov12_0223AAD8(BattleSystem *bsys, int a1); +u8 ov12_0223AB0C(BattleSystem *bsys, int battlerId); +u8 BattleSystem_GetFieldSide(BattleSystem *bsys, int battlerId); +void *BattleSystem_GetMessageIcon(BattleSystem *bsys); +PC_STORAGE *BattleSystem_GetPcStorage(BattleSystem *bsys); +Terrain BattleSystem_GetTerrainId(BattleSystem *bsys); +int ov12_0223AB54(BattleSystem *bsys); +int BattleSystem_GetLocation(BattleSystem *bsys); +int BattleSystem_GetBattlerIdPartner(BattleSystem *bsys, int battlerId); +int ov12_0223ABB8(BattleSystem *bsys, int battlerId, int side); +BOOL BattleSystem_RecoverStatus(BattleSystem *bsys, int battlerId, int selectedMonIndex, int movePos, int item); +u32 BattleSystem_GetBattleSpecial(BattleSystem *bsys); +int BattleSystem_GetTimezone(BattleSystem *bsys); +int ov12_0223B52C(BattleSystem *bsys); +u8 ov12_0223B580(BattleSystem *bsys, int battlerId, u8 a2); +u16 BattleSystem_CheckEvolution(BATTLE_SETUP *setup, int *selectedMonIndex, int *evolutionCondition); +u8 ov12_0223B688(BattleSystem *bsys); +u8 ov12_0223B694(BattleSystem *bsys); +int BattleSystem_GetSafariBallCount(BattleSystem *bsys); +void BattleSystem_SetSafariBallCount(BattleSystem *bsys, int item); +OPTIONS *BattleSystem_GetOptions(BattleSystem *bsys); +BOOL BattleSystem_AreBattleAnimationsOn(BattleSystem *bsys); +u16 BattleSystem_GetFrame(BattleSystem *bsys); +u8 BattleSystem_GetTextFrameDelay(BattleSystem *bsys); +u16 BattleSystem_GetBattleStyle(BattleSystem *bsys); +void *ov12_0223B750(BattleSystem *bsys); +SOUND_CHATOT *BattleSystem_GetChatotVoice(BattleSystem *bsys, int battlerId); +void BattleSystem_TryChangeForm(BattleSystem *bsys); +void ov12_0223B854(BattleSystem *bsys, int battlerId, int selectedMonIndex); +void ov12_0223B870(); +void BattleSystem_SetBackground(BattleSystem *bsys); +u8 *ov12_0223BAD0(BattleSystem *bsys); +u16 *ov12_0223BAD8(BattleSystem *bsys); +u16 *ov12_0223BAE0(BattleSystem *bsys); +u16 *ov12_0223BAEC(BattleSystem *bsys); +int BattleSystem_GetWeather(BattleSystem *bsys); +u8 ov12_0223BB04(BattleSystem *bsys); +void ov12_0223BB10(BattleSystem *bsys, u8 a1); +int ov12_0223BB1C(BattleSystem *bsys); +void BattleSystem_GameStatIncrement(BattleSystem *bsys, int id); +void ov12_0223BB44(BattleSystem *bsys); +void ov12_0223BB64(BattleSystem *bsys, int a1); +void ov12_0223BB6C(BattleSystem *bsys, u8 a1); +void *ov12_0223BB78(BattleSystem *bsys); +void ov12_0223BB80(BattleSystem *bsys, void *a1); +UnkBattleSystemSub1D0 *ov12_0223BB88(BattleSystem *bsys, int index); +u8 *ov12_0223BB94(UnkBattleSystemSub1D0 *ptr, int index); +void ov12_0223BBA8(UnkBattleSystemSub1D0 *ptr, int index, int a2); +void ov12_0223BBC0(UnkBattleSystemSub1D0 *ptr, int index, int a2); +void ov12_0223BBD8(UnkBattleSystemSub1D0 *ptr, int index, int a2); +void ov12_0223BBF0(BattleSystem *bsys, u8 a1); +void ov12_0223BBFC(BattleSystem *bsys, u8 *a1); +void ov12_0223BC08(BattleSystem *bsys, u8 *a1); +void ov12_0223BC14(BattleSystem *bsys, u8 a1); +void ov12_0223BC20(BattleSystem *bsys, u8 a1); +void ov12_0223BC2C(BattleSystem *bsys, u8 a1); +BattleHpBar *BattleSystem_GetHpBar(BattleSystem *bsys, int battlerId); +void BattleSystem_HpBar_Init(BattleSystem *bsys); +void BattleSystem_SetHpBarEnabled(BattleSystem *bsys); +void BattleSystem_SetHpBarDisabled(BattleSystem *bsys); +void BattleSystem_HpBar_Delete(BattleSystem *bsys); +u8 BattleSystem_GetBattleOutcomeFlags(BattleSystem *bsys); +void BattleSystem_SetBattleOutcomeFlags(BattleSystem *bsys, u8 battleOutcomeFlag); +u8 BattleSystem_GetCriticalHpMusicFlag(BattleSystem *bsys); +u8 BattleSystem_SetCriticalHpMusicFlag(BattleSystem *bsys, u8 flag); +u8 BattleSystem_GetCriticalHpMusicDelay(BattleSystem *bsys); +void BattleSystem_SetCriticalHpMusicDelay(BattleSystem *bsys, u8 delay); +void ov12_0223BD8C(BattleSystem *bsys, int a1); +u16 BattleSystem_Random(BattleSystem *bsys); +u32 BattleSystem_GetRandTemp(BattleSystem *bsys); +void BattleSystem_SetRandTemp(BattleSystem *bsys, u32 temp); + +//These functions haven't been decompiled void ov12_0223BDDC(BattleSystem *bsys, int battlerId, u8 a2); void PokedexSetBattlerSeen(BattleSystem *bsys, int battlerId); -OpponentData *BattleSystem_GetOpponentDataByBattlerId(BattleSystem *bsys, int battlerId); -SOUND_CHATOT *BattleSystem_GetChatotVoice(BattleSystem *bsys, int battlerId); int BattleSystem_GetChatotVoiceParam(BattleSystem *bsys, int battlerId); -int BattleSystem_GetBattlerIdPartner(BattleSystem *bsys, int battlerId); -int BattleSystem_GetTrainerIndex(BattleSystem *bsys, int battlerId); BOOL Link_QueueNotEmpty(BATTLECONTEXT *ctx); -BOOL BattleSystem_AreBattleAnimationsOn(BattleSystem *bsys); -u32 *ov12_0223A900(BattleSystem *bsys); BOOL ov12_0223C080(BattleSystem *bsys); void ov12_0223BFFC(BattleSystem *bsys, u32 a1); -void *ov12_0223A938(BattleSystem *bsys); -int ov12_0223AB54(BattleSystem *bsys); -u8 BattleSystem_GetMonBall(BattleSystem *bsys, Pokemon *mon); -u32 BattleSystem_GetWinLoseFlags(BattleSystem *bsys); void ov12_0223C0C4(BattleSystem *bsys); -int BattleSystem_GetWeather(BattleSystem *bsys); -int ov12_0223AB60(BattleSystem *bsys); BOOL ov12_0223BFEC(BattleSystem *bsys); -void ov12_0223BB64(BattleSystem *bsys, int a1); void ov12_02237ED0(BattleSystem *bsys, int a1); -BATTLECONTEXT *ov12_0223A7E4(BattleSystem *bsys); 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); #endif diff --git a/include/constants/battle.h b/include/constants/battle.h index e0fa0bfa05..77fde49c61 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -30,7 +30,7 @@ enum BattleSide { B_SIDE_18 }; -enum Terrain { +typedef enum Terrain { TERRAIN_PLAIN, TERRAIN_SAND, TERRAIN_GRASS, @@ -44,11 +44,23 @@ enum Terrain { TERRAIN_MARSH, TERRAIN_BRIDGE, TERRAIN_LINK, + TERRAIN_END, + //Special terrains + TERRAIN_ELITE_4_WILL, + TERRAIN_ELITE_4_KOGA, + TERRAIN_ELITE_4_BRUNO, + TERRAIN_ELITE_4_KAREN, + TERRAIN_CHAMPION_LANCE, + TERRAIN_17, + TERRAIN_TOWER, + TERRAIN_ARCADE, + TERRAIN_CASTLE, + TERRAIN_22, TERRAIN_MAX -}; +} Terrain; //Battle Type -#define BATTLE_TYPE_SINGLES (1 << 0) +#define BATTLE_TYPE_TRAINER (1 << 0) #define BATTLE_TYPE_DOUBLES (1 << 1) #define BATTLE_TYPE_LINK (1 << 2) #define BATTLE_TYPE_MULTI (1 << 3) @@ -59,17 +71,18 @@ enum Terrain { #define BATTLE_TYPE_8 (1 << 8) #define BATTLE_TYPE_PAL_PARK (1 << 9) #define BATTLE_TYPE_TUTORIAL (1 << 10) +#define BATTLE_TYPE_11 (1 << 11) +#define BATTLE_TYPE_DEBUG (1 << 31) #define BATTLE_TYPE_NO_EXP (BATTLE_TYPE_LINK | BATTLE_TYPE_SAFARI | BATTLE_TYPE_TOWER | BATTLE_TYPE_PAL_PARK) -//Battle Status Flags +//Battle Special Flags #define BATTLE_SPECIAL_FIRST_RIVAL (1 << 0) #define BATTLE_SPECIAL_RECORDED (1 << 4) #define BATTLE_SPECIAL_DISTORTION_WORLD (1 << 7) //Move Effects Flags -#define MOVE_EFFECT_FLAG_0 (1 << 0) -#define MOVE_EFFECT_FLAG_1 (1 << 1) +#define MOVE_EFFECT_FLAG_LEECH_SEED_BATTLER (3 << 0) #define MOVE_EFFECT_FLAG_LEECH_SEED (1 << 2) #define MOVE_EFFECT_FLAG_LOCK_ON (3 << 3) #define MOVE_EFFECT_FLAG_LOCK_ON_SET (1 << 4) @@ -79,8 +92,7 @@ enum Terrain { #define MOVE_EFFECT_FLAG_8 (1 << 8) #define MOVE_EFFECT_FLAG_CHARGE (1 << 9) #define MOVE_EFFECT_FLAG_INGRAIN (1 << 10) -#define MOVE_EFFECT_FLAG_11 (1 << 11) -#define MOVE_EFFECT_FLAG_YAWN (1 << 12) +#define MOVE_EFFECT_FLAG_YAWN (3 << 11) #define MOVE_EFFECT_FLAG_IMPRISON_USER (1 << 13) #define MOVE_EFFECT_FLAG_GRUDGE (1 << 14) #define MOVE_EFFECT_FLAG_LUCKY_CHANT (1 << 15) @@ -100,8 +112,12 @@ enum Terrain { #define MOVE_EFFECT_FLAG_PHANTOM_FORCE (1 << 29) #define MOVE_EFFECT_FLAG_IMPRISON (1 << 30) -#define MOVE_EFFECT_FLAG_BATON_PASSABLE (MOVE_EFFECT_FLAG_0 | MOVE_EFFECT_FLAG_1 | MOVE_EFFECT_FLAG_LEECH_SEED | MOVE_EFFECT_FLAG_LOCK_ON | MOVE_EFFECT_FLAG_PERISH_SONG | MOVE_EFFECT_FLAG_INGRAIN | MOVE_EFFECT_FLAG_LUCKY_CHANT | MOVE_EFFECT_FLAG_MUD_SPORT | MOVE_EFFECT_FLAG_WATER_SPORT | MOVE_EFFECT_FLAG_GASTRO_ACID | MOVE_EFFECT_FLAG_POWER_TRICK | MOVE_EFFECT_FLAG_AQUA_RING | MOVE_EFFECT_FLAG_HEAL_BLOCK | MOVE_EFFECT_FLAG_EMBARGO | MOVE_EFFECT_FLAG_MAGNET_RISE) +#define MOVE_EFFECT_FLAG_BATON_PASSABLE (MOVE_EFFECT_FLAG_LEECH_SEED_BATTLER | MOVE_EFFECT_FLAG_LEECH_SEED | MOVE_EFFECT_FLAG_LOCK_ON | MOVE_EFFECT_FLAG_PERISH_SONG | MOVE_EFFECT_FLAG_INGRAIN | MOVE_EFFECT_FLAG_LUCKY_CHANT | MOVE_EFFECT_FLAG_MUD_SPORT | MOVE_EFFECT_FLAG_WATER_SPORT | MOVE_EFFECT_FLAG_GASTRO_ACID | MOVE_EFFECT_FLAG_POWER_TRICK | MOVE_EFFECT_FLAG_AQUA_RING | MOVE_EFFECT_FLAG_HEAL_BLOCK | MOVE_EFFECT_FLAG_EMBARGO | MOVE_EFFECT_FLAG_MAGNET_RISE) #define MOVE_EFFECT_FLAG_HIDE_SUBSTITUTE (MOVE_EFFECT_FLAG_6 | MOVE_EFFECT_FLAG_7 | MOVE_EFFECT_FLAG_DIVE | MOVE_EFFECT_FLAG_PHANTOM_FORCE) + +#define MOVE_EFFECT_FLAG_LOCK_ON_SHIFT 3 +#define MOVE_EFFECT_FLAG_YAWN_SHIFT 11 + //Move status #define MOVE_STATUS_MISS (1 << 0) #define MOVE_STATUS_SUPER_EFFECTIVE (1 << 1) @@ -152,6 +168,7 @@ enum Terrain { #define FIELD_CONDITION_WEATHER (FIELD_CONDITION_RAIN_ALL | FIELD_CONDITION_SANDSTORM_ALL | FIELD_CONDITION_SUN_ALL | FIELD_CONDITION_HAIL_ALL | FIELD_CONDITION_FOG) #define FIELD_CONDITION_GRAVITY_SHIFT 12 +#define FIELD_CONDITION_TRICK_ROOM_SHIFT 16 //Field Side Conditions #define SIDE_CONDITION_REFLECT (1 << 0) @@ -182,6 +199,8 @@ enum Terrain { #define STATUS_POISON_ALL (STATUS_POISON | STATUS_BAD_POISON | STATUS_POISON_COUNT) #define STATUS_ALL (STATUS_SLEEP | STATUS_POISON | STATUS_BURN | STATUS_FREEZE | STATUS_PARALYSIS | STATUS_BAD_POISON) +#define STATUS_POISON_COUNT_SHIFT 8 + //Status Conditions #define CONDITION_NONE 0 #define CONDITION_SLEEP 1 @@ -195,11 +214,9 @@ enum Terrain { #define STATUS2_FLINCH (1 << 3) #define STATUS2_UPROAR (7 << 4) #define STATUS2_8 (3 << 8) -#define STATUS2_RAGE (3 << 10) +#define STATUS2_RAMPAGE_TURNS (3 << 10) #define STATUS2_LOCKED_INTO_MOVE (1 << 12) -#define STATUS2_13 (1 << 13) -#define STATUS2_14 (1 << 14) -#define STATUS2_15 (1 << 15) +#define STATUS2_BINDING_TURNS (7 << 13) #define STATUS2_ATTRACT_BATTLER1 (1 << 16) #define STATUS2_ATTRACT_BATTLER2 (1 << 17) #define STATUS2_ATTRACT_BATTLER3 (1 << 18) @@ -210,18 +227,20 @@ enum Terrain { #define STATUS2_23 (1 << 23) #define STATUS2_SUBSTITUTE (1 << 24) #define STATUS2_MEAN_LOOK (1 << 26) -#define STATUS2_27 (1 << 27) -#define STATUS2_28 (1 << 28) +#define STATUS2_NIGHTMARE (1 << 27) +#define STATUS2_CURSE (1 << 28) #define STATUS2_FORESIGHT (1 << 29) #define STATUS2_DEFENCE_CURL (1 << 30) #define STATUS2_TORMENT (1 << 31) -#define STATUS2_BINDING_ALL (STATUS2_13 | STATUS2_14 | STATUS2_15) #define STATUS2_ATTRACT_ALL (STATUS2_ATTRACT_BATTLER1 | STATUS2_ATTRACT_BATTLER2 | STATUS2_ATTRACT_BATTLER3 | STATUS2_ATTRACT_BATTLER4) +#define STATUS2_UPROAR_SHIFT 4 +#define STATUS2_RAMPAGE_SHIFT 10 +#define STATUS2_BINDING_SHIFT 13 #define STATUS2_ATTRACT_SHIFT 16 -#define STATUS2_BATON_PASSABLE (STATUS2_CONFUSION | STATUS2_FOCUS_ENERGY | STATUS2_SUBSTITUTE | STATUS2_MEAN_LOOK | STATUS2_28) +#define STATUS2_BATON_PASSABLE (STATUS2_CONFUSION | STATUS2_FOCUS_ENERGY | STATUS2_SUBSTITUTE | STATUS2_MEAN_LOOK | STATUS2_CURSE) //Struggle Checks #define STRUGGLE_CHECK_NO_MOVES (1 << 0) @@ -374,7 +393,7 @@ enum Terrain { #define BATTLE_STATUS_NO_MOVE_SET (1 << 20) #define BATTLE_STATUS_MESSAGES_OFF (1 << 21) #define BATTLE_STATUS_22 (1 << 22) -#define BATTLE_STATUS_MOLD_BREAKER (1 << 23) +#define BATTLE_STATUS_MOLD_BREAKER (1 << 23) #define BATTLE_STATUS_FAINTED_SHIFT 24 @@ -389,6 +408,21 @@ enum Terrain { #define BATTLE_STATUS2_EXP_GAIN_SHIFT 28 +//Stat Changes +#define STAT_DOWN_6 0 +#define STAT_DOWN_5 1 +#define STAT_DOWN_4 2 +#define STAT_DOWN_3 3 +#define STAT_DOWN_2 4 +#define STAT_DOWN_1 5 +#define STAT_NEUTRAL 6 +#define STAT_UP_1 7 +#define STAT_UP_2 8 +#define STAT_UP_3 9 +#define STAT_UP_4 10 +#define STAT_UP_5 11 +#define STAT_UP_6 12 + //Battle Controller Commands typedef enum ControllerCommand { CONTROLLER_COMMAND_GET_BATTLE_MON, diff --git a/include/constants/battle_script.h b/include/constants/battle_script.h index 6d84780599..534023a430 100644 --- a/include/constants/battle_script.h +++ b/include/constants/battle_script.h @@ -63,7 +63,7 @@ #define BSCRIPT_VAR_59 59 #define BSCRIPT_VAR_BATTLE_STATUS_2 60 #define BSCRIPT_VAR_61 61 -#define BSCRIPT_VAR_62 62 +#define BSCRIPT_VAR_MAX_BATTLERS 62 #define BSCRIPT_VAR_BATTLER_ATTACKER_TEMP 63 #define BSCRIPT_VAR_BATTLER_TARGET_TEMP 64 #define BSCRIPT_VAR_PHYSICAL_DAMAGE_TAKEN 65 diff --git a/include/constants/game_stat.h b/include/constants/game_stat.h index 0b6409092a..94731c9366 100644 --- a/include/constants/game_stat.h +++ b/include/constants/game_stat.h @@ -3,6 +3,13 @@ #define GAME_STAT_APRICORN_GET 1 #define GAME_STAT_UNK2 2 +#define GAME_STAT_UNK6 6 +#define GAME_STAT_UNK9 9 +#define GAME_STAT_UNK10 10 +#define GAME_STAT_UNK11 11 +#define GAME_STAT_UNK12 12 +#define GAME_STAT_UNK20 20 +#define GAME_STAT_UNK21 21 #define GAME_STAT_BADGE_GET 22 #define GAME_STAT_UNK46 46 #define GAME_STAT_BATTLE_POINTS 69 diff --git a/include/constants/moves.h b/include/constants/moves.h index e84404e8fd..7f08d9654c 100644 --- a/include/constants/moves.h +++ b/include/constants/moves.h @@ -1,8 +1,6 @@ #ifndef POKEHEARTGOLD_CONSTANTS_MOVES_H #define POKEHEARTGOLD_CONSTANTS_MOVES_H -#define LEARNED_MOVES_MAX 4 - #define MOVE_NONE 0 #define MOVE_POUND 1 #define MOVE_KARATE_CHOP 2 diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index ced419ae4d..318996e449 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -155,7 +155,6 @@ // Shiny odds #define SHINY_ODDS 8 // Actual probability is SHINY_ODDS/65536 - #define MON_DATA_PERSONALITY 0 #define MON_DATA_PARTY_LOCK 1 #define MON_DATA_BOX_LOCK 2 diff --git a/include/overlay_12_0224E4FC.h b/include/overlay_12_0224E4FC.h index c5b92e25e6..2367a15e1c 100644 --- a/include/overlay_12_0224E4FC.h +++ b/include/overlay_12_0224E4FC.h @@ -15,8 +15,8 @@ BOOL Link_QueueNotEmpty(BATTLECONTEXT *ctx); void ov12_0224EDC0(BATTLECONTEXT *ctx, int battlerId); int GetBattlerVar(BATTLECONTEXT *ctx, int battlerId, u32 varId, void *data); void SetBattlerVar(BATTLECONTEXT *ctx, int battlerId, u32 varId, void *data); -void ov12_0224F794(BATTLECONTEXT *ctx, int battlerId, u32 varId, int data); -void AddBattlerVar(BattleMon *mon, u32 varId, int data); +void AddBattlerVar(BATTLECONTEXT *ctx, int battlerId, u32 varId, int data); +void BattleMon_AddVar(BattleMon *mon, u32 varId, int data); u8 CheckSortSpeed(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId1, int battlerId2, int flag); void BattleSystem_ClearExperienceEarnFlags(BATTLECONTEXT *ctx, int battlerId); void BattleSystem_SetExperienceEarnFlags(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId); @@ -128,9 +128,7 @@ BOOL ov12_02251C74(BATTLECONTEXT *ctx, int battlerIdAttacker, int battlerIdTarge void Link_CheckTimeout(BATTLECONTEXT *ctx); BOOL CheckLegalMeFirstMove(BATTLECONTEXT *ctx, u16 move); int ov12_02253DA0(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId); -u32 BattleSystem_GetBattleSpecial(BattleSystem *bsys); -u32 ov12_0223C24C(PARTY *party, u32 *a1); -int ov12_0223AB0C(BattleSystem *bsys, int battlerId); +u32 ov12_0223C24C(PARTY *party, PlayerProfile *profile); int ov12_02251D28(BattleSystem *bsys, BATTLECONTEXT *ctx, int moveNo, int moveType, int battlerIdAttacker, int battlerIdTarget, int dmg, u32 *statusFlag); void ov12_02252D14(BattleSystem *bsys, BATTLECONTEXT *ctx); void ov12_0225859C(BATTLECONTEXT *ctx, u8 battlerId); diff --git a/include/unk_02023694.h b/include/unk_02023694.h index 2a72463686..84ae3b7991 100644 --- a/include/unk_02023694.h +++ b/include/unk_02023694.h @@ -21,6 +21,41 @@ typedef struct Unk122_021E7F64 { int unk10; } Unk122_021E7F64; +typedef struct UnkImageSubstruct { + VecFx32 matrix; + VecFx32 affineMatrix; + VecFx32 scale; + u16 rotation; + u8 affine; + u8 flip; + u8 overwrite; + u8 palIndex; + u8 palOffset; + BOOL mosaic; + GXOamMode mode; + u8 drawFlag; + u8 animationFrame; + fx32 frame; + void *unkPtr; + u32 animationData[29]; + NNSG2dImageProxy imageProxy; + NNSG2dImagePaletteProxy paletteProxy; + u32 flag; + u16 animationNo; + u8 priority; + u16 drawPriority; + NNS_G2D_VRAM_TYPE type; + struct UnkImageSubstruct *prev; + struct UnkImageSubstruct *next; +} UnkImageSubstruct; + +typedef struct UnkImageStruct { + UnkImageSubstruct *unk0; + void *unk4; + void *unk8; + int vramTransfer; +} UnkImageStruct; + void sub_02024AA8(void *, s32); void sub_02024504(SpriteList *); void sub_0202457C(SpriteList *); @@ -37,5 +72,6 @@ VecFx32 *sub_020248AC(Sprite *); void sub_02024868(Sprite *, int); void sub_02024950(Sprite *, int); void sub_02023EA4(Sprite *, int); +NNSG2dImageProxy *sub_02024B1C(UnkImageSubstruct *); #endif //POKEHEARTGOLD_UNK_02023694_H diff --git a/main.lsf b/main.lsf index 9bdee5afd4..a171d83bd9 100644 --- a/main.lsf +++ b/main.lsf @@ -565,6 +565,7 @@ Overlay OVY_12 { After OVY_7 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 @@ -574,7 +575,7 @@ Overlay OVY_12 Object asm/overlay_12_battle_controller_opponent.o Object asm/overlay_12_02261FD4.o Object asm/overlay_12_battle_controller.o - Object asm/overlay_12_02264824.o + Object asm/overlay_12_hp_bar.o Object asm/overlay_12_02265E28.o Object src/battle/battle_input.o Object asm/overlay_12_02266024.o diff --git a/src/battle/battle_command.c b/src/battle/battle_command.c index 9043aca3c0..f96a230bdc 100644 --- a/src/battle/battle_command.c +++ b/src/battle/battle_command.c @@ -64,7 +64,7 @@ BOOL BtlCmd_PokemonEncounter(BattleSystem *bsys, BATTLECONTEXT *ctx) { case B_SIDE_OPPONENT: OpponentData *opponentData; for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { BattleController_EmitPokemonEncounter(bsys, battlerId); PokedexSetBattlerSeen(bsys, battlerId); @@ -93,7 +93,7 @@ BOOL BtlCmd_PokemonSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_PLAYER: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (!(opponentData->unk195 & 1)) { BattleController_EmitPokemonSlideIn(bsys, battlerId); PokedexSetBattlerSeen(bsys, battlerId); @@ -104,7 +104,7 @@ BOOL BtlCmd_PokemonSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_OPPONENT: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { BattleSystem_ClearExperienceEarnFlags(ctx, battlerId); BattleSystem_SetExperienceEarnFlags(bsys, ctx, battlerId); @@ -114,7 +114,7 @@ BOOL BtlCmd_PokemonSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { } break; case B_SIDE_1: - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, ctx->battlerIdAttacker); + opponentData = BattleSystem_GetOpponentData(bsys, ctx->battlerIdAttacker); if (!(opponentData->unk195 & 1)) { BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY); BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY2); @@ -126,7 +126,7 @@ BOOL BtlCmd_PokemonSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { BattleController_EmitPokemonSlideIn(bsys, ctx->battlerIdAttacker); break; case B_SIDE_2: - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, ctx->battlerIdTarget); + opponentData = BattleSystem_GetOpponentData(bsys, ctx->battlerIdTarget); if (!(opponentData->unk195 & 1)) { BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY); BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY2); @@ -138,7 +138,7 @@ BOOL BtlCmd_PokemonSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { BattleController_EmitPokemonSlideIn(bsys, ctx->battlerIdTarget); break; case B_SIDE_6: - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, ctx->battlerIdSwitch); + opponentData = BattleSystem_GetOpponentData(bsys, ctx->battlerIdSwitch); if (!(opponentData->unk195 & 1)) { BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY); BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY2); @@ -171,7 +171,7 @@ BOOL BtlCmd_PokemonSendOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 3: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (!(opponentData->unk195 & 1)) { BattleController_EmitPokemonSendOut(bsys, battlerId, 0, 0); PokedexSetBattlerSeen(bsys, battlerId); @@ -182,7 +182,7 @@ BOOL BtlCmd_PokemonSendOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 4: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { BattleSystem_ClearExperienceEarnFlags(ctx, battlerId); BattleSystem_SetExperienceEarnFlags(bsys, ctx, battlerId); @@ -192,7 +192,7 @@ BOOL BtlCmd_PokemonSendOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { } break; case 1: - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, ctx->battlerIdAttacker); + opponentData = BattleSystem_GetOpponentData(bsys, ctx->battlerIdAttacker); if (!(opponentData->unk195 & 1)) { BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY); BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY2); @@ -204,7 +204,7 @@ BOOL BtlCmd_PokemonSendOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { BattleController_EmitPokemonSendOut(bsys, ctx->battlerIdAttacker, 0, 0); break; case 2: - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, ctx->battlerIdTarget); + opponentData = BattleSystem_GetOpponentData(bsys, ctx->battlerIdTarget); if (!(opponentData->unk195 & 1)) { BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY); BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY2); @@ -216,7 +216,7 @@ BOOL BtlCmd_PokemonSendOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { BattleController_EmitPokemonSendOut(bsys, ctx->battlerIdTarget, 0, 0); break; case 6: - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, ctx->battlerIdSwitch); + opponentData = BattleSystem_GetOpponentData(bsys, ctx->battlerIdSwitch); if (!(opponentData->unk195 & 1)) { BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY); BattleSystem_SetExperienceEarnFlags(bsys, ctx, BATTLER_ENEMY2); @@ -248,7 +248,7 @@ BOOL BtlCmd_RecallPokemon(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_PLAYER: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if ((opponentData->unk195 & 1) == 0) { BattleController_EmitRecallPokemon(bsys, ctx, battlerId); } @@ -256,7 +256,7 @@ BOOL BtlCmd_RecallPokemon(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_OPPONENT: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1 && !(ctx->unk_3108 & MaskOfFlagNo(battlerId))) { BattleController_EmitRecallPokemon(bsys, ctx, battlerId); } @@ -291,7 +291,7 @@ BOOL BtlCmd_TrainerEncounter(BattleSystem *bsys, BATTLECONTEXT *ctx) { default: if (BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_INGAME_PARTNER) { for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 != 4) { BattleController_EmitTrainerEncounter(bsys, battlerId); } @@ -309,7 +309,7 @@ BOOL BtlCmd_TrainerEncounter(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 3: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if ((opponentData->unk195 & 1) == FALSE) { BattleController_EmitTrainerEncounter(bsys, battlerId); if ((BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_MULTI) == 0 && @@ -321,7 +321,7 @@ BOOL BtlCmd_TrainerEncounter(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 4: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { BattleController_EmitTrainerEncounter(bsys, battlerId); if ((BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_MULTI) == 0 && @@ -361,7 +361,7 @@ BOOL BtlCmd_ThrowPokeball(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 3: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if ((opponentData->unk195 & 1) == FALSE) { BattleController_EmitThrowPokeball(bsys, battlerId, unkC); if ((BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_MULTI) == 0 && @@ -373,7 +373,7 @@ BOOL BtlCmd_ThrowPokeball(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 4: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { BattleController_EmitThrowPokeball(bsys, battlerId, unkC); if ((BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_MULTI) == 0 && @@ -414,7 +414,7 @@ BOOL BtlCmd_TrainerSlideOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 3: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if ((opponentData->unk195 & 1) == FALSE) { BattleController_EmitTrainerSlideOut(bsys, battlerId); if ((BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_MULTI) == 0 && @@ -426,7 +426,7 @@ BOOL BtlCmd_TrainerSlideOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 4: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { BattleController_EmitTrainerSlideOut(bsys, battlerId); if ((BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_MULTI) == 0 && @@ -439,7 +439,7 @@ BOOL BtlCmd_TrainerSlideOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 9: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 == 0 || opponentData->unk195 == 2) { BattleController_EmitTrainerSlideOut(bsys, battlerId); break; @@ -448,7 +448,7 @@ BOOL BtlCmd_TrainerSlideOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 10: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 == 1 || opponentData->unk195 == 3) { BattleController_EmitTrainerSlideOut(bsys, battlerId); break; @@ -457,7 +457,7 @@ BOOL BtlCmd_TrainerSlideOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 11: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 == 4) { BattleController_EmitTrainerSlideOut(bsys, battlerId); break; @@ -466,7 +466,7 @@ BOOL BtlCmd_TrainerSlideOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 12: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 == 5) { BattleController_EmitTrainerSlideOut(bsys, battlerId); break; @@ -500,7 +500,7 @@ BOOL BtlCmd_TrainerSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_PLAYER: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if ((opponentData->unk195 & 1) == FALSE) { BattleController_EmitTrainerSlideIn(bsys, battlerId, index); if ((BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_DOUBLES)) { @@ -511,7 +511,7 @@ BOOL BtlCmd_TrainerSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_OPPONENT: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { BattleController_EmitTrainerSlideIn(bsys, battlerId, index); if ((BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_DOUBLES)) { @@ -522,7 +522,7 @@ BOOL BtlCmd_TrainerSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_9: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 == 0 || opponentData->unk195 == 2) { BattleController_EmitTrainerSlideIn(bsys, battlerId, index); break; @@ -531,7 +531,7 @@ BOOL BtlCmd_TrainerSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_10: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 == 1 || opponentData->unk195 == 3) { BattleController_EmitTrainerSlideIn(bsys, battlerId, index); break; @@ -540,7 +540,7 @@ BOOL BtlCmd_TrainerSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_11: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 == 4) { BattleController_EmitTrainerSlideIn(bsys, battlerId, index); break; @@ -549,7 +549,7 @@ BOOL BtlCmd_TrainerSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_12: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 == 5) { BattleController_EmitTrainerSlideIn(bsys, battlerId, index); break; @@ -589,7 +589,7 @@ BOOL BtlCmd_HealthbarSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_PLAYER: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if ((opponentData->unk195 & 1) == 0) { BattleController_EmitHealthbarSlideIn(bsys, ctx, battlerId, 0); } @@ -597,7 +597,7 @@ BOOL BtlCmd_HealthbarSlideIn(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_OPPONENT: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { BattleController_EmitHealthbarSlideIn(bsys, ctx, battlerId, 0); } @@ -630,7 +630,7 @@ BOOL BtlCmd_HealthbarSlideInDelay(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_PLAYER: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if ((opponentData->unk195 & 1) == 0) { BattleController_EmitHealthbarSlideIn(bsys, ctx, battlerId, delay); delay += 4; @@ -639,7 +639,7 @@ BOOL BtlCmd_HealthbarSlideInDelay(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_OPPONENT: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { BattleController_EmitHealthbarSlideIn(bsys, ctx, battlerId, delay); delay += 4; @@ -670,7 +670,7 @@ BOOL BtlCmd_HealthbarSlideOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_PLAYER: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if ((opponentData->unk195 & 1) == 0 && (ctx->unk_3108 & MaskOfFlagNo(battlerId)) == 0) { BattleController_EmitHealthbarSlideOut(bsys, battlerId); } @@ -678,7 +678,7 @@ BOOL BtlCmd_HealthbarSlideOut(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case B_SIDE_OPPONENT: for (battlerId = 0; battlerId < battlersMax; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { BattleController_EmitHealthbarSlideOut(bsys, battlerId); } @@ -977,7 +977,7 @@ BOOL BtlCmd_Wait(BattleSystem *bsys, BATTLECONTEXT *ctx) { } } - if (bsys->battleTypeFlags & BATTLE_TYPE_LINK && !(bsys->unk240C & 16)) { + if (bsys->battleType & BATTLE_TYPE_LINK && !(bsys->battleSpecial & BATTLE_SPECIAL_RECORDED)) { waitIncrement = 2; } else { waitIncrement = 1; @@ -1182,7 +1182,7 @@ BOOL BtlCmd_CritCalc(BattleSystem *bsys, BATTLECONTEXT *ctx) { BOOL BtlCmd_ShouldGetExp(BattleSystem *bsys, BATTLECONTEXT *ctx) { int adrs; u32 battleType = BattleSystem_GetBattleType(bsys); - OpponentData *opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, ctx->battlerIdFainted); + OpponentData *opponentData = BattleSystem_GetOpponentData(bsys, ctx->battlerIdFainted); BattleScriptIncrementPointer(ctx, 1); @@ -1282,7 +1282,7 @@ BOOL BtlCmd_ShowParty(BattleSystem *bsys, BATTLECONTEXT *ctx) { } for (battlerId = 0; battlerId < maxBattlers; battlerId++) { - if (BattleSystem_GetBattleType(bsys) == (BATTLE_TYPE_SINGLES | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_LINK)) { + if (BattleSystem_GetBattleType(bsys) == (BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_LINK)) { unkA = BattleSystem_GetBattlerIdPartner(bsys, battlerId); if (!(unkB & MaskOfFlagNo(battlerId)) && !(unkB & MaskOfFlagNo(unkA))) { unkB |= MaskOfFlagNo(battlerId); @@ -2145,10 +2145,10 @@ u32 CalcPrizeMoney(BattleSystem *bsys, BATTLECONTEXT *ctx, int trainerIndex) { if (i >= (int)NELEMS(sPrizeMoneyTbl)) { i = 2; } - if (bsys->battleTypeFlags & BATTLE_TYPE_INGAME_PARTNER || bsys->battleTypeFlags == (BATTLE_TYPE_SINGLES | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_MULTI | BATTLE_TYPE_6)) { + if (bsys->battleType & BATTLE_TYPE_INGAME_PARTNER || bsys->battleType == (BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_MULTI | BATTLE_TYPE_6)) { prizeMoney = level*4*ctx->prizeMoneyValue*sPrizeMoneyTbl[i][1]; break; - } else if (bsys->battleTypeFlags & BATTLE_TYPE_DOUBLES) { + } else if (bsys->battleType & BATTLE_TYPE_DOUBLES) { prizeMoney = level*4*ctx->prizeMoneyValue*2*sPrizeMoneyTbl[i][1]; break; } else { @@ -2170,12 +2170,12 @@ BOOL BtlCmd_CalcPrizeMoney(BattleSystem *bsys, BATTLECONTEXT *ctx) { if (bsys->battleOutcomeFlag == 1) { prizeMoney = CalcPrizeMoney(bsys, ctx, 1); - if (bsys->battleTypeFlags & 16 || bsys->battleTypeFlags == 0x4b) { + if (bsys->battleType & BATTLE_TYPE_INGAME_PARTNER || bsys->battleType == (BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_MULTI | BATTLE_TYPE_6)) { prizeMoney += CalcPrizeMoney(bsys, ctx, 3); } PlayerProfile_AddMoney(BattleSystem_GetPlayerProfile(bsys, 0), prizeMoney); } else { - prizeMoney = ov12_0223C24C(bsys->trainerParty[0], bsys->unk48[0]); + prizeMoney = ov12_0223C24C(bsys->trainerParty[0], bsys->playerProfile[0]); PlayerProfile_SubMoney(BattleSystem_GetPlayerProfile(bsys, 0), prizeMoney); } @@ -2649,7 +2649,7 @@ BOOL BtlCmd_TryMimic(BattleSystem *bsys, BATTLECONTEXT *ctx) { int moveIndex = 0; int mimicIndex = -1; - for (moveIndex = 0; moveIndex < LEARNED_MOVES_MAX; moveIndex++) { + for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { if (ctx->battleMons[ctx->battlerIdAttacker].moves[moveIndex] == ctx->moveNoBattlerPrev[ctx->battlerIdTarget]) { break; } @@ -2658,7 +2658,7 @@ BOOL BtlCmd_TryMimic(BattleSystem *bsys, BATTLECONTEXT *ctx) { } } - if (moveIndex == LEARNED_MOVES_MAX) { + if (moveIndex == MAX_MON_MOVES) { ctx->moveTemp = ctx->moveNoBattlerPrev[ctx->battlerIdTarget]; ctx->battleMons[ctx->battlerIdAttacker].moves[mimicIndex] = ctx->moveTemp; if (ctx->unk_334.moveData[ctx->moveTemp].pp < 5) { @@ -2799,10 +2799,10 @@ BOOL BtlCmd_TryEncore(BattleSystem *bsys, BATTLECONTEXT *ctx) { int encoredMoveIndex = BattleMon_GetMoveIndex(&ctx->battleMons[ctx->battlerIdTarget], ctx->moveNoBattlerPrev[ctx->battlerIdTarget]); if (IsMoveEncored(ctx, ctx->moveNoBattlerPrev[ctx->battlerIdTarget]) == FALSE) { - encoredMoveIndex = LEARNED_MOVES_MAX; + encoredMoveIndex = MAX_MON_MOVES; } - if (ctx->battleMons[ctx->battlerIdTarget].unk88.encoredMove == 0 && encoredMoveIndex != LEARNED_MOVES_MAX && + if (ctx->battleMons[ctx->battlerIdTarget].unk88.encoredMove == 0 && encoredMoveIndex != MAX_MON_MOVES && ctx->battleMons[ctx->battlerIdTarget].movePPCur[encoredMoveIndex] && ctx->moveNoBattlerPrev[ctx->battlerIdTarget]) { ctx->moveTemp = ctx->moveNoBattlerPrev[ctx->battlerIdTarget]; ctx->battleMons[ctx->battlerIdTarget].unk88.encoredMove = ctx->moveTemp; @@ -2875,7 +2875,7 @@ BOOL BtlCmd_TrySketch(BattleSystem *bsys, BATTLECONTEXT *ctx) { if (ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_TRANSFORMED || ctx->moveNoSketch[ctx->battlerIdTarget] == MOVE_STRUGGLE || ctx->moveNoSketch[ctx->battlerIdTarget] == MOVE_SKETCH || ctx->moveNoSketch[ctx->battlerIdTarget] == MOVE_CHATTER || ctx->moveNoSketch[ctx->battlerIdTarget] == 0) { BattleScriptIncrementPointer(ctx, adrs); } else { - for (moveIndex = 0; moveIndex < LEARNED_MOVES_MAX; moveIndex++) { + for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { if (ctx->battleMons[ctx->battlerIdAttacker].moves[moveIndex] != MOVE_SKETCH && ctx->battleMons[ctx->battlerIdAttacker].moves[moveIndex] == ctx->moveNoSketch[ctx->battlerIdTarget]) { break; } @@ -2883,7 +2883,7 @@ BOOL BtlCmd_TrySketch(BattleSystem *bsys, BATTLECONTEXT *ctx) { sketchIndex = moveIndex; } } - if (moveIndex == LEARNED_MOVES_MAX) { + if (moveIndex == MAX_MON_MOVES) { ctx->battleMons[ctx->battlerIdAttacker].moves[sketchIndex] = ctx->moveNoSketch[ctx->battlerIdTarget]; ctx->battleMons[ctx->battlerIdAttacker].movePPCur[sketchIndex] = ctx->unk_334.moveData[ctx->moveNoSketch[ctx->battlerIdTarget]].pp; BattleController_EmitBattleMonToPartyMonCopy(bsys, ctx, ctx->battlerIdAttacker); @@ -2908,7 +2908,7 @@ BOOL BtlCmd_TrySleepTalk(BattleSystem *bsys, BATTLECONTEXT *ctx) { nonSelectableMoves = 0; - for (moveIndex = 0; moveIndex < LEARNED_MOVES_MAX; moveIndex++) { + for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { if (CheckMoveCallsOtherMove(ctx->battleMons[ctx->battlerIdAttacker].moves[moveIndex]) || ctx->battleMons[ctx->battlerIdAttacker].moves[moveIndex] == MOVE_FOCUS_PUNCH || ctx->battleMons[ctx->battlerIdAttacker].moves[moveIndex] == MOVE_UPROAR || @@ -2962,7 +2962,7 @@ BOOL BtlCmd_TrySpite(BattleSystem *bsys, BATTLECONTEXT *ctx) { if (ctx->moveNoBattlerPrev[ctx->battlerIdTarget]) { moveIndex = BattleMon_GetMoveIndex(&ctx->battleMons[ctx->battlerIdTarget], ctx->moveNoBattlerPrev[ctx->battlerIdTarget]); - if (moveIndex == LEARNED_MOVES_MAX || ctx->battleMons[ctx->battlerIdTarget].movePPCur[moveIndex] == 0) { + if (moveIndex == MAX_MON_MOVES || ctx->battleMons[ctx->battlerIdTarget].movePPCur[moveIndex] == 0) { BattleScriptIncrementPointer(ctx, adrs); } else { ppLoss = 4; @@ -2993,7 +2993,7 @@ BOOL BtlCmd_HealBell(BattleSystem *bsys, BATTLECONTEXT *ctx) { ctx->moveTemp = ctx->moveNoCur; if (GetBattlerAbility(ctx, ctx->battlerIdAttacker) != ABILITY_SOUNDPROOF) { ctx->battleMons[ctx->battlerIdAttacker].status = STATUS_NONE; - ctx->battleMons[ctx->battlerIdAttacker].status2 &= ~STATUS2_27; + ctx->battleMons[ctx->battlerIdAttacker].status2 &= ~STATUS2_NIGHTMARE; } else { ctx->calcTemp |= 5; } @@ -3003,7 +3003,7 @@ BOOL BtlCmd_HealBell(BattleSystem *bsys, BATTLECONTEXT *ctx) { if (!(ctx->unk_3108 & MaskOfFlagNo(battlerId))) { if (!CheckBattlerAbilityIfNotIgnored(ctx, ctx->battlerIdAttacker, battlerId, ABILITY_SOUNDPROOF)) { ctx->battleMons[battlerId].status = STATUS_NONE; - ctx->battleMons[battlerId].status2 &= ~STATUS2_27; + ctx->battleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; } else { ctx->battlerIdTemp = battlerId; ctx->calcTemp |= 10; @@ -3014,12 +3014,12 @@ BOOL BtlCmd_HealBell(BattleSystem *bsys, BATTLECONTEXT *ctx) { } } else { //aromatherapy ctx->battleMons[ctx->battlerIdAttacker].status = STATUS_NONE; - ctx->battleMons[ctx->battlerIdAttacker].status2 &= ~STATUS2_27; + ctx->battleMons[ctx->battlerIdAttacker].status2 &= ~STATUS2_NIGHTMARE; if (battleType & BATTLE_TYPE_DOUBLES) { battlerId = GetBattlerIDBySide(bsys, ctx, B_SIDE_16); if (!(ctx->unk_3108 & MaskOfFlagNo(battlerId))) { ctx->battleMons[battlerId].status = STATUS_NONE; - ctx->battleMons[battlerId].status2 &= ~STATUS2_27; + ctx->battleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; } } else { ctx->calcTemp |= 8; @@ -3117,7 +3117,7 @@ BOOL BtlCmd_TrySubstitute(BattleSystem *bsys, BATTLECONTEXT *ctx) { } else { ctx->hpCalc = -subHp; ctx->battleMons[ctx->battlerIdAttacker].unk88.substituteHp = subHp; - ctx->battleMons[ctx->battlerIdAttacker].status2 &= ~STATUS2_BINDING_ALL; + ctx->battleMons[ctx->battlerIdAttacker].status2 &= ~STATUS2_BINDING_TURNS; } return FALSE; @@ -3130,7 +3130,7 @@ BOOL BtlCmd_TryWhirlwind(BattleSystem *bsys, BATTLECONTEXT *ctx) { u32 battleType = BattleSystem_GetBattleType(bsys); - if (battleType & BATTLE_TYPE_SINGLES) { + if (battleType & BATTLE_TYPE_TRAINER) { PARTY *party; Pokemon *mon; int partySize; @@ -3233,7 +3233,7 @@ BOOL BtlCmd_Transform(BattleSystem *bsys, BATTLECONTEXT *ctx) { ctx->battleMons[ctx->battlerIdAttacker].slowStartFlag = 0; ctx->battleMons[ctx->battlerIdAttacker].slowStartEnded = 0; - for (i = 0; (int) i < LEARNED_MOVES_MAX; i++) { + for (i = 0; (int) i < MAX_MON_MOVES; i++) { if (ctx->unk_334.moveData[ctx->battleMons[ctx->battlerIdAttacker].moves[i]].pp < 5) { ctx->battleMons[ctx->battlerIdAttacker].movePPCur[i] = ctx->unk_334.moveData[ctx->battleMons[ctx->battlerIdAttacker].moves[i]].pp; } else { @@ -3566,8 +3566,8 @@ BOOL BtlCmd_RapidSpin(BattleSystem *bsys, BATTLECONTEXT *ctx) { int side = BattleSystem_GetFieldSide(bsys, ctx->battlerIdAttacker); //Binding Moves - if (ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_BINDING_ALL) { - ctx->battleMons[ctx->battlerIdAttacker].status2 &= ~STATUS2_BINDING_ALL; + if (ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_BINDING_TURNS) { + ctx->battleMons[ctx->battlerIdAttacker].status2 &= ~STATUS2_BINDING_TURNS; ctx->battlerIdTemp = ctx->battleMons[ctx->battlerIdAttacker].unk88.battlerIdBinding; ctx->moveTemp = ctx->battleMons[ctx->battlerIdAttacker].unk88.bindingMove; BattleScriptGotoSubscript(ctx, NARC_a_0_0_1, 116); @@ -3975,7 +3975,6 @@ BOOL BtlCmd_TryBreakScreens(BattleSystem *bsys, BATTLECONTEXT *ctx) { int adrs = BattleScriptReadWord(ctx); int side = BattleSystem_GetFieldSide(bsys, ctx->battlerIdTarget); - //in order flags are: reflect, light screen if ((ctx->fieldSideConditionFlags[side] & SIDE_CONDITION_REFLECT) || (ctx->fieldSideConditionFlags[side] & SIDE_CONDITION_LIGHT_SCREEN)) { ctx->fieldSideConditionFlags[side] &= ~SIDE_CONDITION_REFLECT; ctx->fieldSideConditionFlags[side] &= ~SIDE_CONDITION_LIGHT_SCREEN; @@ -3991,10 +3990,10 @@ BOOL BtlCmd_TryBreakScreens(BattleSystem *bsys, BATTLECONTEXT *ctx) { BOOL BtlCmd_TryYawn(BattleSystem *bsys, BATTLECONTEXT *ctx) { BattleScriptIncrementPointer(ctx, 1); u32 adrs = BattleScriptReadWord(ctx); - if (ctx->battleMons[ctx->battlerIdTarget].moveEffectFlags & (192 << 5)) { + if (ctx->battleMons[ctx->battlerIdTarget].moveEffectFlags & MOVE_EFFECT_FLAG_YAWN) { BattleScriptIncrementPointer(ctx, adrs); } else { - ctx->battleMons[ctx->battlerIdTarget].moveEffectFlags |= MOVE_EFFECT_FLAG_YAWN; + ctx->battleMons[ctx->battlerIdTarget].moveEffectFlags |= (2 << MOVE_EFFECT_FLAG_YAWN_SHIFT); } return FALSE; @@ -4062,17 +4061,17 @@ BOOL BtlCmd_TryImprison(BattleSystem *bsys, BATTLECONTEXT *ctx) { maxBattlers = BattleSystem_GetMaxBattlers(bsys); for (battlerId = 0; battlerId < maxBattlers; battlerId++) { if (side != BattleSystem_GetFieldSide(bsys, battlerId)) { - for (i = 0; i < LEARNED_MOVES_MAX; i++) { - for (j = 0; j < LEARNED_MOVES_MAX; j++) { + for (i = 0; i < MAX_MON_MOVES; i++) { + for (j = 0; j < MAX_MON_MOVES; j++) { if ((ctx->battleMons[ctx->battlerIdAttacker].moves[i] == ctx->battleMons[battlerId].moves[j]) && ctx->battleMons[ctx->battlerIdAttacker].moves[i] && ctx->battleMons[battlerId].moves[j]) { break; } } - if (j != LEARNED_MOVES_MAX) { + if (j != MAX_MON_MOVES) { break; } } - if (j != LEARNED_MOVES_MAX) { + if (j != MAX_MON_MOVES) { break; } } @@ -5003,9 +5002,9 @@ BOOL BtlCmd_TryCamouflage(BattleSystem *bsys, BATTLECONTEXT *ctx) { return FALSE; } - int terrain = BattleSystem_GetTerrainId(bsys); - if (terrain > TERRAIN_MAX-1) { - terrain = TERRAIN_MAX-1; + Terrain terrain = BattleSystem_GetTerrainId(bsys); + if (terrain > TERRAIN_END - 1) { + terrain = (Terrain) (TERRAIN_END - 1); } int type = sCamouflageTypeTable[terrain]; @@ -5435,7 +5434,7 @@ BOOL BtlCmd_198(BattleSystem *bsys, BATTLECONTEXT *ctx) { switch (side) { case 3: for (battlerId = 0; battlerId < maxBattlers; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (!(opponentData->unk195 & 1)) { ov12_02264038(bsys, battlerId); } @@ -5443,7 +5442,7 @@ BOOL BtlCmd_198(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 4: for (battlerId = 0; battlerId < maxBattlers; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { ov12_02264038(bsys, battlerId); } @@ -5470,7 +5469,7 @@ BOOL BtlCmd_199(BattleSystem *bsys, BATTLECONTEXT *ctx) { switch (side) { case 3: for (battlerId = 0; battlerId < maxBattlers; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (!(opponentData->unk195 & 1)) { ov12_02264054(bsys, battlerId); } @@ -5478,7 +5477,7 @@ BOOL BtlCmd_199(BattleSystem *bsys, BATTLECONTEXT *ctx) { break; case 4: for (battlerId = 0; battlerId < maxBattlers; battlerId++) { - opponentData = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponentData = BattleSystem_GetOpponentData(bsys, battlerId); if (opponentData->unk195 & 1) { ov12_02264054(bsys, battlerId); } @@ -5513,7 +5512,7 @@ BOOL BtlCmd_CheckWhiteout(BattleSystem *bsys, BATTLECONTEXT *ctx) { PARTY *party1 = BattleSystem_GetParty(bsys, battlerId); PARTY *party2 = BattleSystem_GetParty(bsys, BattleSystem_GetBattlerIdPartner(bsys, battlerId)); - BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + BattleSystem_GetOpponentData(bsys, battlerId); for (i = 0; i < GetPartyCount(party1); i++) { mon = GetPartyMonByIndex(party1, i); @@ -5539,7 +5538,7 @@ BOOL BtlCmd_CheckWhiteout(BattleSystem *bsys, BATTLECONTEXT *ctx) { } else { PARTY *party = BattleSystem_GetParty(bsys, battlerId); - BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + BattleSystem_GetOpponentData(bsys, battlerId); for (i = 0; i < GetPartyCount(party); i++) { mon = GetPartyMonByIndex(party, i); @@ -5799,7 +5798,7 @@ BOOL BtlCmd_WaitWithoutInterrupt(BattleSystem *bsys, BATTLECONTEXT *ctx) { int wait = BattleScriptReadWord(ctx); - if ((bsys->battleTypeFlags & 4) && !(bsys->unk240C & 16)) { + if ((bsys->battleType & BATTLE_TYPE_LINK) && !(bsys->battleSpecial & BATTLE_SPECIAL_RECORDED)) { tSpeed = 2; } else { tSpeed = 1; @@ -5911,7 +5910,7 @@ static void BattleScriptGotoSubscript(BATTLECONTEXT *ctx, NarcId narcId, int adr static void *BattleScriptGetVarPointer(BattleSystem *bsys, BATTLECONTEXT *ctx, int var) { switch (var) { case BSCRIPT_VAR_BATTLE_FLAGS: - return &bsys->battleTypeFlags; + return &bsys->battleType; case BSCRIPT_VAR_CRIT_COUNT: return &ctx->criticalCnt; case BSCRIPT_VAR_2: @@ -6015,7 +6014,7 @@ static void *BattleScriptGetVarPointer(BattleSystem *bsys, BATTLECONTEXT *ctx, i case BSCRIPT_VAR_FLING_SCRIPT: return &ctx->flingScript; case BSCRIPT_VAR_52: - return &bsys->unk240C; + return &bsys->battleSpecial; case BSCRIPT_VAR_MOVE_LOCKED_INTO_ATTACKER: return &ctx->moveNoLockedInto[ctx->battlerIdAttacker]; case BSCRIPT_VAR_HIT_DAMAGE: @@ -6034,8 +6033,8 @@ static void *BattleScriptGetVarPointer(BattleSystem *bsys, BATTLECONTEXT *ctx, i return &ctx->battleStatus2; case BSCRIPT_VAR_61: return &ctx->unk_EC; - case BSCRIPT_VAR_62: - return &bsys->unk44; + case BSCRIPT_VAR_MAX_BATTLERS: + return &bsys->maxBattlers; case BSCRIPT_VAR_BATTLER_ATTACKER_TEMP: return &ctx->battlerIdAttackerTemp; case BSCRIPT_VAR_BATTLER_TARGET_TEMP: diff --git a/src/battle/battle_controller_player.c b/src/battle/battle_controller_player.c index 672e05f2c3..b87375952d 100644 --- a/src/battle/battle_controller_player.c +++ b/src/battle/battle_controller_player.c @@ -5,6 +5,8 @@ #include "battle_system.h" #include "overlay_12_0224E4FC.h" #include "heap.h" +#include "constants/abilities.h" +#include "constants/items.h" #include "msgdata/msg/msg_0197.h" extern ControllerFunction sPlayerBattleCommands[]; @@ -24,7 +26,7 @@ BATTLECONTEXT *BattleContext_New(BattleSystem *bsys) { BOOL BattleMain(BattleSystem *bsys, BATTLECONTEXT *ctx) { if (!ctx->battleEndFlag) { - if (BattleSystem_GetWinLoseFlags(bsys) && !(BattleSystem_GetWinLoseFlags(bsys) & 0x40)) { + if (BattleSystem_GetBattleOutcomeFlags(bsys) && !(BattleSystem_GetBattleOutcomeFlags(bsys) & 0x40)) { ctx->command = CONTROLLER_COMMAND_42; } } @@ -112,24 +114,24 @@ void BattleControllerPlayer_SelectionScreenInit(BattleSystem *bsys, BATTLECONTEX } typedef enum BattleSelectState { - BS_STATE_0, - BS_STATE_1, - BS_STATE_2, - BS_STATE_3, - BS_STATE_4, - BS_STATE_5, - BS_STATE_6, - BS_STATE_7, - BS_STATE_8, - BS_STATE_9, - BS_STATE_10, - BS_STATE_11, - BS_STATE_12, - BS_STATE_13, - BS_STATE_14, - BS_STATE_15, - BS_STATE_16, - BS_STATE_END + SSI_STATE_0, + SSI_STATE_1, + SSI_STATE_2, + SSI_STATE_3, + SSI_STATE_4, + SSI_STATE_5, + SSI_STATE_6, + SSI_STATE_7, + SSI_STATE_8, + SSI_STATE_9, + SSI_STATE_10, + SSI_STATE_11, + SSI_STATE_12, + SSI_STATE_13, + SSI_STATE_14, + SSI_STATE_15, + SSI_STATE_NO_MOVES, + SSI_STATE_END } BattleSelectState; //static @@ -137,7 +139,7 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BATTLECONTE int battlerId; int battlersMax; int var; - u16 battleType; + s32 battleType; BATTLEMSG msg; battlersMax = BattleSystem_GetMaxBattlers(bsys); @@ -147,29 +149,29 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BATTLECONTE for (battlerId = 0; battlerId < battlersMax; battlerId++) { switch (ctx->unk_0[battlerId]) { - case BS_STATE_0: + case SSI_STATE_0: if ((battleType & BATTLE_TYPE_DOUBLES) && !(battleType & BATTLE_TYPE_MULTI) && ((battlerId == BATTLER_PLAYER2) && (ctx->unk_0[0] != 14) || (battlerId == BATTLER_ENEMY2) && (ctx->unk_0[1] != 14))) { break; } if (ctx->unk_3108 & MaskOfFlagNo(battlerId)) { - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_13; ctx->unk_21A8[battlerId][0] = 40; break; } else if (Battler_CanSelectAction(ctx, battlerId) == 0) { ctx->turnData[battlerId].unk0_1 = 1; - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_13; ctx->unk_21A8[battlerId][0] = 13; break; } - if ((ov12_02261264(BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId)) == 1) || (ctx->totalTurns)) { + if ((ov12_02261264(BattleSystem_GetOpponentData(bsys, battlerId)) == 1) || (ctx->totalTurns)) { ov12_02262B80(bsys, ctx, battlerId, ctx->selectedMonIndex[battlerId]); - ctx->unk_0[battlerId] = BS_STATE_1; + ctx->unk_0[battlerId] = SSI_STATE_1; } else { - ctx->unk_0[battlerId] = BS_STATE_2; + ctx->unk_0[battlerId] = SSI_STATE_2; } break; - case BS_STATE_2: + case SSI_STATE_2: int battlerIdCheck; for (battlerIdCheck = 0; battlerIdCheck < battlersMax; battlerIdCheck++) { @@ -177,64 +179,64 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BATTLECONTE continue; } - if (ov12_02261264(BattleSystem_GetOpponentDataByBattlerId(bsys, battlerIdCheck)) != 0x1) { + if (ov12_02261264(BattleSystem_GetOpponentData(bsys, battlerIdCheck)) != 0x1) { continue; } - if (ctx->unk_0[battlerIdCheck] != BS_STATE_14) { + if (ctx->unk_0[battlerIdCheck] != SSI_STATE_14) { break; } } if (battlerIdCheck == battlersMax) { ov12_02262B80(bsys, ctx, battlerId, ctx->selectedMonIndex[battlerId]); - ctx->unk_0[battlerId] = BS_STATE_1; + ctx->unk_0[battlerId] = SSI_STATE_1; } else { break; } //fallthrough - case BS_STATE_1: + case SSI_STATE_1: if (ov12_0225682C(ctx, battlerId)) { ctx->unk_21A8[battlerId][3] = ctx->unk_2300[battlerId][0]; if (battleType & BATTLE_TYPE_PAL_PARK) { switch (ov12_0225682C(ctx, battlerId)) { case 1: - ctx->unk_0[battlerId] = BS_STATE_END; - ctx->unk_4[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_END; + ctx->unk_4[battlerId] = SSI_STATE_13; ctx->unk_21A8[battlerId][0] = 17; break; case 4: - ctx->unk_0[battlerId] = BS_STATE_END; - ctx->unk_4[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_END; + ctx->unk_4[battlerId] = SSI_STATE_13; ctx->unk_21A8[battlerId][0] = 16; break; } } else if (battleType & BATTLE_TYPE_SAFARI) { switch (ov12_0225682C(ctx, battlerId)) { case 1: - ctx->unk_0[battlerId] = BS_STATE_END; - ctx->unk_4[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_END; + ctx->unk_4[battlerId] = SSI_STATE_13; ctx->unk_21A8[battlerId][0] = 17; break; case 2: - ctx->unk_0[battlerId] = BS_STATE_END; - ctx->unk_4[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_END; + ctx->unk_4[battlerId] = SSI_STATE_13; ctx->unk_21A8[battlerId][0] = 18; break; case 3: - ctx->unk_0[battlerId] = BS_STATE_END; - ctx->unk_4[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_END; + ctx->unk_4[battlerId] = SSI_STATE_13; ctx->unk_21A8[battlerId][0] = 19; break; case 4: - ctx->unk_0[battlerId] = BS_STATE_END; - ctx->unk_4[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_END; + ctx->unk_4[battlerId] = SSI_STATE_13; ctx->unk_21A8[battlerId][0] = 16; break; case 5: - ctx->unk_0[battlerId] = BS_STATE_END; - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_END; + ctx->unk_0[battlerId] = SSI_STATE_13; ctx->unk_21A8[battlerId][0] = 20; break; } @@ -249,10 +251,10 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BATTLECONTE ctx->turnData[battlerId].struggleFlag = 1; if (BattleSystem_GetBattleSpecial(bsys) & BATTLE_SPECIAL_RECORDED) { - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_13; } else { - ctx->unk_0[battlerId] = BS_STATE_END; - ctx->unk_4[battlerId] = BS_STATE_16; + ctx->unk_0[battlerId] = SSI_STATE_END; + ctx->unk_4[battlerId] = SSI_STATE_NO_MOVES; } } else if (ctx->battleMons[battlerId].unk88.encoredMove) { ctx->movePos[battlerId] = ctx->battleMons[battlerId].unk88.encoredMoveIndex; @@ -260,28 +262,28 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BATTLECONTE ctx->unk_21A8[battlerId][2] = 0; if (BattleSystem_GetBattleSpecial(bsys) & BATTLE_SPECIAL_RECORDED) { - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_13; } else { - ctx->unk_0[battlerId] = BS_STATE_END; - ctx->unk_4[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_END; + ctx->unk_4[battlerId] = SSI_STATE_13; } } else { - ctx->unk_0[battlerId] = BS_STATE_3; + ctx->unk_0[battlerId] = SSI_STATE_3; } ctx->unk_21A8[battlerId][0] = 13; break; case 2: //Item if (BattleSystem_GetBattleType(bsys) & (1 << 12)) { - ctx->unk_0[battlerId] = BS_STATE_END; - ctx->unk_4[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_END; + ctx->unk_4[battlerId] = SSI_STATE_13; ctx->unk_21A8[battlerId][0] = 21; } else if (BattleSystem_GetBattleType(bsys) & (BATTLE_TYPE_LINK | BATTLE_TYPE_TOWER)) { msg.id = msg_0197_00593; //Items can't be used here msg.tag = 0; ov12_022639B8(bsys, battlerId, msg); - ctx->unk_0[battlerId] = BS_STATE_15; - ctx->unk_4[battlerId] = BS_STATE_0; + ctx->unk_0[battlerId] = SSI_STATE_15; + ctx->unk_4[battlerId] = SSI_STATE_0; } else { ctx->unk_21A8[battlerId][0] = 14; ctx->unk_0[battlerId] = 7; @@ -289,99 +291,99 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BATTLECONTE break; case 3: //Pokemon ctx->unk_21A8[battlerId][0] = 15; - ctx->unk_0[battlerId] = BS_STATE_9; + ctx->unk_0[battlerId] = SSI_STATE_9; break; case 4: //Run ctx->unk_21A8[battlerId][0] = 16; - ctx->unk_0[battlerId] = BS_STATE_11; + ctx->unk_0[battlerId] = SSI_STATE_11; break; case 0xff: //Cancel if (battleType & BATTLE_TYPE_LINK) { ov12_02263CCC(bsys, battlerId); - ctx->unk_0[battlerId] = BS_STATE_0; + ctx->unk_0[battlerId] = SSI_STATE_0; ctx->unk_0[BattleSystem_GetBattlerIdPartner(bsys, battlerId)] = 0; } else if ((battleType & BATTLE_TYPE_DOUBLES) && (battlerId == BATTLER_PLAYER2)) { ov12_02263CCC(bsys, battlerId); - ctx->unk_0[0] = BS_STATE_0; - ctx->unk_0[2] = BS_STATE_0; + ctx->unk_0[0] = SSI_STATE_0; + ctx->unk_0[2] = SSI_STATE_0; } break; } } } break; - case BS_STATE_3: + case SSI_STATE_3: ov12_02262F40(bsys, ctx, battlerId); - ctx->unk_0[battlerId] = BS_STATE_4; + ctx->unk_0[battlerId] = SSI_STATE_4; //fallthrough - case BS_STATE_4: + case SSI_STATE_4: if (ov12_0225682C(ctx, battlerId) == 0xff) { - ctx->unk_0[battlerId] = BS_STATE_0; + ctx->unk_0[battlerId] = SSI_STATE_0; } else if (ov12_0225682C(ctx, battlerId)) { if ((ctx->unk_2300[battlerId][0] - 1) == 4) { ctx->unk_21A8[battlerId][0] = 16; - ctx->unk_0[battlerId] = BS_STATE_11; + ctx->unk_0[battlerId] = SSI_STATE_11; break; } else if (ov12_02251A28(bsys, ctx, battlerId, ctx->unk_2300[battlerId][0] - 1, &msg) == 0) { if (BattleSystem_GetBattleSpecial(bsys) & BATTLE_SPECIAL_RECORDED) { ov12_0223BFFC(bsys, 1); - ov12_022581BC(bsys, ov12_0223A7E4(bsys)); + ov12_022581BC(bsys, BattleSystem_GetBattleContext(bsys)); } else { ov12_022639B8(bsys, battlerId, msg); - ctx->unk_0[battlerId] = BS_STATE_15; - ctx->unk_4[battlerId] = BS_STATE_3; + ctx->unk_0[battlerId] = SSI_STATE_15; + ctx->unk_4[battlerId] = SSI_STATE_3; } } else { ctx->unk_21A8[battlerId][2] = ctx->unk_2300[battlerId][0]; ctx->movePos[battlerId] = ctx->unk_2300[battlerId][0] - 1; ctx->unk_30B4[battlerId] = ctx->battleMons[battlerId].moves[ctx->movePos[battlerId]]; - ctx->unk_0[battlerId] = BS_STATE_5; + ctx->unk_0[battlerId] = SSI_STATE_5; ctx->unk_314C[battlerId] |= 0x2; } } break; - case BS_STATE_5: + case SSI_STATE_5: int out; if (ov12_0224DB64(bsys, ctx, battlerId, battleType, &out, ctx->movePos[battlerId], &ctx->unk_21A8[battlerId][1])) { ov12_02262FFC(bsys, ctx, out, battlerId); - ctx->unk_0[battlerId] = BS_STATE_6; + ctx->unk_0[battlerId] = SSI_STATE_6; } else { - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_13; } break; - case BS_STATE_6: + case SSI_STATE_6: if (ov12_0225682C(ctx, battlerId) == 0xff) { - ctx->unk_0[battlerId] = BS_STATE_3; + ctx->unk_0[battlerId] = SSI_STATE_3; } else if (ov12_0225682C(ctx, battlerId)) { ctx->unk_21A8[battlerId][1] = ctx->unk_2300[battlerId][0] - 1; - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_13; ctx->unk_314C[battlerId] |= 0x4; } break; - case BS_STATE_7: + case SSI_STATE_7: ov12_02263138(bsys, ctx, battlerId); - ctx->unk_0[battlerId] = BS_STATE_8; - case BS_STATE_8: + ctx->unk_0[battlerId] = SSI_STATE_8; + case SSI_STATE_8: if (ov12_0225682C(ctx, battlerId) == 0xff) { - ctx->unk_0[battlerId] = BS_STATE_0; + ctx->unk_0[battlerId] = SSI_STATE_0; } else if (ov12_0225682C(ctx, battlerId)) { u32 *unkPtr; unkPtr = (u32 *)&ctx->unk_2300[battlerId][0]; ctx->unk_21A8[battlerId][2] = unkPtr[0]; - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_13; } break; - case BS_STATE_9: //switching..? + case SSI_STATE_9: //switching..? int v8; int v9 = 6; int partnerId; v8 = BattlerCanSwitch(bsys, ctx, battlerId); - if (((ov12_0223AB0C(bsys, battlerId) == 4) || (ov12_0223AB0C(bsys, battlerId) == 5)) && ((battleType == (BATTLE_TYPE_SINGLES | BATTLE_TYPE_DOUBLES)) || (battleType == (BATTLE_TYPE_SINGLES | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_LINK)) || (battleType == (BATTLE_TYPE_SINGLES | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_TOWER)) || ((battleType == (BATTLE_TYPE_SINGLES | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_INGAME_PARTNER)) && (ov12_0223AB0C(bsys, battlerId) == 4)))) { + if (((ov12_0223AB0C(bsys, battlerId) == 4) || (ov12_0223AB0C(bsys, battlerId) == 5)) && ((battleType == (BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLES)) || (battleType == (BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_LINK)) || (battleType == (BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_TOWER)) || ((battleType == (BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_INGAME_PARTNER)) && (ov12_0223AB0C(bsys, battlerId) == 4)))) { partnerId = BattleSystem_GetBattlerIdPartner(bsys, battlerId); if (ctx->unk_21A8[partnerId][0] == 15) { @@ -390,96 +392,96 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BATTLECONTE } BattleController_EmitShowMonList(bsys, ctx, battlerId, 0, v8, v9); - ctx->unk_0[battlerId] = BS_STATE_10; + ctx->unk_0[battlerId] = SSI_STATE_10; //fallthrough - case BS_STATE_10: + case SSI_STATE_10: if (ov12_0225682C(ctx, battlerId) == 0xff) { - ctx->unk_0[battlerId] = BS_STATE_0; + ctx->unk_0[battlerId] = SSI_STATE_0; } else if (ov12_0225682C(ctx, battlerId)) { ctx->unk_21A8[battlerId][2] = ctx->unk_2300[battlerId][0] - 1; ctx->unk_21A0[battlerId] = ctx->unk_2300[battlerId][0] - 1; - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_13; } break; - case BS_STATE_11: //Flee after a mon fainted..? + case SSI_STATE_11: //Flee after a mon fainted..? if (battleType & BATTLE_TYPE_TOWER) { BattleController_EmitDrawYesNoBox(bsys, ctx, battlerId, 955, 0, 0, 0); - ctx->unk_0[battlerId] = BS_STATE_12; - } else if ((battleType & BATTLE_TYPE_SINGLES) && !(battleType & BATTLE_TYPE_LINK)) { + ctx->unk_0[battlerId] = SSI_STATE_12; + } else if ((battleType & BATTLE_TYPE_TRAINER) && !(battleType & BATTLE_TYPE_LINK)) { if (BattleSystem_GetBattleSpecial(bsys) & BATTLE_SPECIAL_RECORDED) { ov12_0223BFFC(bsys, 1); - ov12_022581BC(bsys, ov12_0223A7E4(bsys)); + ov12_022581BC(bsys, BattleSystem_GetBattleContext(bsys)); } else { msg.tag = 0; msg.id = msg_0197_00793; //There's no running from a Trainer battle! ov12_022639B8(bsys, battlerId, msg); - ctx->unk_0[battlerId] = BS_STATE_15; - ctx->unk_4[battlerId] = BS_STATE_0; + ctx->unk_0[battlerId] = SSI_STATE_15; + ctx->unk_4[battlerId] = SSI_STATE_0; } } else if (CantEscape(bsys, ctx, battlerId, &msg)) { if (BattleSystem_GetBattleSpecial(bsys) & BATTLE_SPECIAL_RECORDED) { ov12_0223BFFC(bsys, 1); - ov12_022581BC(bsys, ov12_0223A7E4(bsys)); + ov12_022581BC(bsys, BattleSystem_GetBattleContext(bsys)); } else { ov12_022639B8(bsys, battlerId, msg); - ctx->unk_0[battlerId] = BS_STATE_15; - ctx->unk_4[battlerId] = BS_STATE_0; + ctx->unk_0[battlerId] = SSI_STATE_15; + ctx->unk_4[battlerId] = SSI_STATE_0; } } else { - ctx->unk_0[battlerId] = BS_STATE_12; + ctx->unk_0[battlerId] = SSI_STATE_12; } break; - case BS_STATE_12: + case SSI_STATE_12: if (battleType & BATTLE_TYPE_TOWER) { if (ov12_0225682C(ctx, battlerId)) { if (ov12_0225682C(ctx, battlerId) == 0xff) { - ctx->unk_0[battlerId] = BS_STATE_0; + ctx->unk_0[battlerId] = SSI_STATE_0; } else { - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_13; } } } else { - ctx->unk_0[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_13; } if ((battleType & BATTLE_TYPE_DOUBLES) && !(battleType & BATTLE_TYPE_MULTI) && (ctx->unk_0[battlerId] == 13)) { - ctx->unk_0[BattleSystem_GetBattlerIdPartner(bsys, battlerId)] = BS_STATE_13; + ctx->unk_0[BattleSystem_GetBattlerIdPartner(bsys, battlerId)] = SSI_STATE_13; } break; - case BS_STATE_13: //WIFI wait for partner to make a move..? + case SSI_STATE_13: //WIFI wait for partner to make a move..? ov12_02263CCC(bsys, battlerId); - if (battleType == (BATTLE_TYPE_SINGLES | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_LINK)) { + if (battleType == (BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_LINK)) { int partnerId; partnerId = BattleSystem_GetBattlerIdPartner(bsys, battlerId); - if (ctx->unk_0[partnerId] == BS_STATE_14) { + if (ctx->unk_0[partnerId] == SSI_STATE_14) { BattleController_EmitShowWaitMessage(bsys, battlerId); } } else { BattleController_EmitShowWaitMessage(bsys, battlerId); } - ctx->unk_0[battlerId] = BS_STATE_14; - case BS_STATE_14: + ctx->unk_0[battlerId] = SSI_STATE_14; + case SSI_STATE_14: var++; //this might be counting the number of players who have selected their final action? break; - case BS_STATE_15: + case SSI_STATE_15: if (ov12_0225682C(ctx, battlerId)) { ov12_0224EDC0(ctx, battlerId); ctx->unk_0[battlerId] = ctx->unk_4[battlerId]; } break; - case BS_STATE_16: + case SSI_STATE_NO_MOVES: msg.tag = 2; msg.id = msg_0197_00608; //Spheal has no moves left! msg.param[0] = CreateNicknameTag(ctx, battlerId); ov12_022639B8(bsys, battlerId, msg); - ctx->unk_0[battlerId] = BS_STATE_15; - ctx->unk_4[battlerId] = BS_STATE_13; + ctx->unk_0[battlerId] = SSI_STATE_15; + ctx->unk_4[battlerId] = SSI_STATE_13; break; - case BS_STATE_END: + case SSI_STATE_END: ov12_02263E18(bsys, battlerId); ctx->unk_0[battlerId] = ctx->unk_4[battlerId]; break; @@ -1006,3 +1008,696 @@ void BattleControllerPlayer_UpdateFieldCondition(BattleSystem *bsys, BATTLECONTE ctx->command = CONTROLLER_COMMAND_10; } } + +typedef enum UpdateMonConditionState { + UMC_STATE_INGRAIN, + UMC_STATE_AQUA_RING, + UMC_STATE_ABILITY, + UMC_STATE_HELD_ITEM, + UMC_STATE_LEFTOVERS_RECOVERY, + UMC_STATE_LEECH_SEED, + UMC_STATE_POISON, + UMC_STATE_BAD_POISON, + UMC_STATE_BURN, + UMC_STATE_NIGHTMARE, + UMC_STATE_CURSE, + UMC_STATE_BINDING, + UMC_STATE_BAD_DREAMS, + UMC_STATE_UPROAR, + UMC_STATE_RAMPAGE, + UMC_STATE_DISABLE, + UMC_STATE_ENCORE, + UMC_STATE_LOCK_ON, + UMC_STATE_CHARGE, + UMC_STATE_TAUNT, + UMC_STATE_MAGNET_RISE, + UMC_STATE_HEALBLOCK, + UMC_STATE_EMBARGO, + UMC_STATE_YAWN, + UMC_STATE_HELD_ITEM_STATUS, + UMC_STATE_HELD_ITEM_DAMAGE, + UMC_STATE_END +} UpdateMonConditionState; + +//static +void BattleControllerPlayer_UpdateMonCondition(BattleSystem *bsys, BATTLECONTEXT *ctx) { + int i; + u8 flag = 0; + int maxBattlers; + int battlerId; + + maxBattlers = BattleSystem_GetMaxBattlers(bsys); + + if (ov12_0224DC74(ctx, ctx->command, ctx->command, 1) == TRUE) { + return; + } + + if (ov12_0224DD18(ctx, ctx->command, ctx->command) == TRUE) { + return; + } + + if (ov12_0224D7EC(bsys, ctx) == TRUE) { + return; + } + + while (ctx->updateMonConditionData < maxBattlers) { + battlerId = ctx->turnOrder[ctx->updateMonConditionData]; + if (ctx->unk_3108 & MaskOfFlagNo(battlerId)) { + ctx->updateMonConditionData++; + continue; + } + switch (ctx->stateUpdateMonCondition) { + case UMC_STATE_INGRAIN: + if ((ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_INGRAIN) && ctx->battleMons[battlerId].hp != ctx->battleMons[battlerId].maxHp && ctx->battleMons[battlerId].hp) { + if (ctx->battleMons[battlerId].unk88.healBlockTurns) { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 239); + } else { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 137); + } + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_AQUA_RING: + if ((ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_AQUA_RING) && ctx->battleMons[battlerId].hp != ctx->battleMons[battlerId].maxHp && ctx->battleMons[battlerId].hp) { + if (ctx->battleMons[battlerId].unk88.healBlockTurns) { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 239); + } else { + ctx->battlerIdTemp = battlerId; + ctx->moveTemp = MOVE_AQUA_RING; + ctx->hpCalc = DamageDivide(ctx->battleMons[battlerId].maxHp, 16); + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 169); + } + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_ABILITY: + if (ov12_02253068(bsys, ctx, battlerId) == TRUE) { + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_HELD_ITEM: + if (TryUseHeldItem(bsys, ctx, battlerId) == TRUE) { + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_LEFTOVERS_RECOVERY: + if (CheckItemGradualHPRestore(bsys, ctx, battlerId) == TRUE) { + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_LEECH_SEED: + if ((ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_LEECH_SEED) && ctx->battleMons[ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_LEECH_SEED_BATTLER].hp && + GetBattlerAbility(ctx, battlerId) != ABILITY_MAGIC_GUARD && ctx->battleMons[battlerId].hp) { + ctx->unk_11C = ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_LEECH_SEED_BATTLER; + ctx->unk_120 = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 69); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_POISON: + if ((ctx->battleMons[battlerId].status & STATUS_POISON) && ctx->battleMons[battlerId].hp) { + ctx->battlerIdTemp = battlerId; + ctx->hpCalc = DamageDivide(ctx->battleMons[battlerId].maxHp * -1, 8); + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 23); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_BAD_POISON: + if ((ctx->battleMons[battlerId].status & STATUS_BAD_POISON) && ctx->battleMons[battlerId].hp) { + ctx->battlerIdTemp = battlerId; + ctx->hpCalc = DamageDivide(ctx->battleMons[battlerId].maxHp, 16); + if ((ctx->battleMons[battlerId].status & STATUS_POISON_COUNT) != STATUS_POISON_COUNT) { + ctx->battleMons[battlerId].status += 1 << STATUS_POISON_COUNT_SHIFT; + } + ctx->hpCalc *= ((ctx->battleMons[battlerId].status & STATUS_POISON_COUNT) >> STATUS_POISON_COUNT_SHIFT); + ctx->hpCalc *= -1; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 23); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_BURN: + if ((ctx->battleMons[battlerId].status & STATUS_BURN) && ctx->battleMons[battlerId].hp) { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 26); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_NIGHTMARE: + if ((ctx->battleMons[battlerId].status2 & STATUS2_NIGHTMARE) && ctx->battleMons[battlerId].hp) { + if (ctx->battleMons[battlerId].status & STATUS_SLEEP) { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 94); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } else { + ctx->battleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; + } + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_CURSE: + if ((ctx->battleMons[battlerId].status2 & STATUS2_CURSE) && ctx->battleMons[battlerId].hp) { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 98); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_BINDING: + if ((ctx->battleMons[battlerId].status2 & STATUS2_BINDING_TURNS) && ctx->battleMons[battlerId].hp) { + ctx->battleMons[battlerId].status2 -= 1 << STATUS2_BINDING_SHIFT; + if (ctx->battleMons[battlerId].status2 & STATUS2_BINDING_TURNS) { + ctx->hpCalc = DamageDivide(ctx->battleMons[battlerId].maxHp * -1, 16); + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 59); + } else { + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 60); + } + ctx->moveTemp = ctx->battleMons[battlerId].unk88.bindingMove; + ctx->battlerIdTemp = battlerId; + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_BAD_DREAMS: + ctx->tempData = CheckAbilityActive(bsys, ctx, CHECK_ABILITY_OPPOSING_SIDE_HP_RET, battlerId, ABILITY_BAD_DREAMS); + if ((ctx->battleMons[battlerId].status & STATUS_SLEEP) && GetBattlerAbility(ctx, battlerId) != ABILITY_MAGIC_GUARD && + ctx->battleMons[battlerId].hp && ctx->tempData) { + ctx->hpCalc = DamageDivide(ctx->battleMons[battlerId].maxHp * -1, 8); + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 263); + ctx->battleStatus |= BATTLE_STATUS_NO_BLINK; + ctx->battlerIdTemp = battlerId; + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_UPROAR: + if (ctx->battleMons[battlerId].status2 & STATUS2_UPROAR) { + u8 battlerIdSleep; + for (battlerIdSleep = 0; battlerIdSleep < maxBattlers; battlerIdSleep++) { + if ((ctx->battleMons[battlerIdSleep].status & STATUS_SLEEP) && ctx->battleMons[battlerIdSleep].hp && GetBattlerAbility(ctx, battlerIdSleep) != ABILITY_SOUNDPROOF) { + ctx->battlerIdTemp = battlerIdSleep; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 19); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + break; + } + } + if (battlerIdSleep != maxBattlers) { + flag = 2; + break; + } + ctx->battleMons[battlerId].status2 -= 1 << STATUS2_UPROAR_SHIFT; + if (ov12_02252218(ctx, battlerId)) { + i = 241; + ctx->battleMons[battlerId].status2 &= ~STATUS2_UPROAR; + ctx->fieldCondition &= (MaskOfFlagNo(battlerId) << 8) ^ 0xFFFFFFFF; + } else if (ctx->battleMons[battlerId].status2 & STATUS2_UPROAR) { + i = 240; + } else { + i = 241; + ctx->battleMons[battlerId].status2 &= ~STATUS2_UPROAR; + ctx->fieldCondition &= (MaskOfFlagNo(battlerId) << 8) ^ 0xFFFFFFFF; + } + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, i); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + if (flag != 2) { + ctx->stateUpdateMonCondition++; + } + break; + case UMC_STATE_RAMPAGE: + if (ctx->battleMons[battlerId].status2 & STATUS2_RAMPAGE_TURNS) { + ctx->battleMons[battlerId].status2 -= 1 << STATUS2_RAMPAGE_SHIFT; + if (ov12_02252218(ctx, battlerId)) { + ctx->battleMons[battlerId].status2 &= ~STATUS2_RAMPAGE_TURNS; + } else if (!(ctx->battleMons[battlerId].status2 & STATUS2_RAMPAGE_TURNS) && !(ctx->battleMons[battlerId].status2 & STATUS2_CONFUSION)) { + ctx->battlerIdStatChange = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 51); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_DISABLE: + if (ctx->battleMons[battlerId].unk88.disabledMove) { + for (i = 0; i < MAX_MON_MOVES; i++) { + if (ctx->battleMons[battlerId].unk88.disabledMove == ctx->battleMons[battlerId].moves[i]) { + break; + } + } + if (i == MAX_MON_MOVES) { + ctx->battleMons[battlerId].unk88.disabledTurns = 0; + } + if (ctx->battleMons[battlerId].unk88.disabledTurns) { + ctx->battleMons[battlerId].unk88.disabledTurns--; + } else { + ctx->battleMons[battlerId].unk88.disabledMove = 0; + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 72); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_ENCORE: + if (ctx->battleMons[battlerId].unk88.encoredMove) { + for (i = 0; i < MAX_MON_MOVES; i++) { + if (ctx->battleMons[battlerId].unk88.encoredMove == ctx->battleMons[battlerId].moves[i]) { + break; + } + } + if (i == MAX_MON_MOVES || (i != MAX_MON_MOVES && !ctx->battleMons[battlerId].movePPCur[i])) { + ctx->battleMons[battlerId].unk88.encoredTurns = 0; + } + if (ctx->battleMons[battlerId].unk88.encoredTurns) { + ctx->battleMons[battlerId].unk88.encoredTurns--; + } else { + ctx->battleMons[battlerId].unk88.encoredMove = 0; + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 74); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_LOCK_ON: + if (ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_LOCK_ON) { + ctx->battleMons[battlerId].moveEffectFlags -= 1 << MOVE_EFFECT_FLAG_LOCK_ON_SHIFT; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_CHARGE: + if (ctx->battleMons[battlerId].unk88.isCharged) { + if (--ctx->battleMons[battlerId].unk88.isCharged == 0) { + ctx->battleMons[battlerId].moveEffectFlags &= ~MOVE_EFFECT_FLAG_CHARGE; + } + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_TAUNT: + if (ctx->battleMons[battlerId].unk88.tauntTurns) { + ctx->battleMons[battlerId].unk88.tauntTurns--; + if (ctx->battleMons[battlerId].unk88.tauntTurns == 0) { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 288); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_MAGNET_RISE: + if (ctx->battleMons[battlerId].unk88.magnetRiseTurns) { + if (--ctx->battleMons[battlerId].unk88.magnetRiseTurns == 0) { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 242); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_HEALBLOCK: + if (ctx->battleMons[battlerId].unk88.healBlockTurns) { + if (--ctx->battleMons[battlerId].unk88.healBlockTurns == 0) { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 243); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_EMBARGO: + if (ctx->battleMons[battlerId].unk88.embargoFlag) { + if (--ctx->battleMons[battlerId].unk88.embargoFlag == 0) { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 244); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_YAWN: + if (ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_YAWN) { + ctx->battleMons[battlerId].moveEffectFlags -= 1 << MOVE_EFFECT_FLAG_YAWN_SHIFT; + if ((ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_YAWN) == 0) { + ctx->battlerIdStatChange = battlerId; + ctx->statChangeType = 4; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 18); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_HELD_ITEM_STATUS: + int script; + + if (CheckUseHeldItem(bsys, ctx, battlerId, &script) == TRUE) { + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, script); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_HELD_ITEM_DAMAGE: + if (TryHeldItemNegativeEffect(bsys, ctx, battlerId) == TRUE) { + flag = 1; + } + ctx->stateUpdateMonCondition++; + break; + case UMC_STATE_END: + ctx->stateUpdateMonCondition = 0; + ctx->updateMonConditionData++; + break; + } + if (flag) { + ov12_022642F0(bsys); + return; + } + } + ctx->stateUpdateMonCondition = 0; + ctx->updateMonConditionData = 0; + ctx->command = CONTROLLER_COMMAND_11; +} + +typedef enum UpdateFieldConditionExtraState { + UFCE_STATE_FUTURE_SIGHT, + UFCE_STATE_PERISH_SONG, + UFCE_STATE_TRICK_ROOM, + UFCE_STATE_END +} UpdateFieldConditionExtraState; + +//Future sight and doom desire are here due to mons being able to faint simulataneously, which means exp shouldn't be awarded like when a mon faints due to burn +//Trick room is here due to every other update function being reliant on turn order, meaning it must be updated last +//static +void BattleControllerPlayer_UpdateFieldConditionExtra(BattleSystem *bsys, BATTLECONTEXT *ctx) { + int maxBattlers = BattleSystem_GetMaxBattlers(bsys); + int battlerId; + + if (ov12_0224DC74(ctx, ctx->command, ctx->command, 1) == TRUE) { + return; + } + + ov12_022642F0(bsys); + + switch (ctx->stateUpdateFieldConditionExtra) { + case UFCE_STATE_FUTURE_SIGHT: + while (ctx->updateFieldConditionExtraData < maxBattlers) { + battlerId = ctx->turnOrder[ctx->updateFieldConditionExtraData]; + if (ctx->unk_3108 & MaskOfFlagNo(battlerId)) { + ctx->updateFieldConditionExtraData++; + continue; + } + ctx->updateFieldConditionExtraData++; + if (ctx->fieldConditionData.futureSightTurns[battlerId]) { + if (!(--ctx->fieldConditionData.futureSightTurns[battlerId]) && ctx->battleMons[battlerId].hp) { + ctx->fieldSideConditionFlags[BattleSystem_GetFieldSide(bsys, battlerId)] &= ~SIDE_CONDITION_FUTURE_SIGHT; + ctx->buffMsg.id = msg_0197_00475; //Seadra took the Doom Desire attack! + ctx->buffMsg.tag = 10; + ctx->buffMsg.param[0] = CreateNicknameTag(ctx, battlerId); + ctx->buffMsg.param[1] = ctx->fieldConditionData.futureSightMoveNo[battlerId]; + ctx->battlerIdTemp = battlerId; + ctx->unk_11C = ctx->fieldConditionData.battlerIdFutureSight[battlerId]; + ctx->moveTemp = ctx->fieldConditionData.futureSightMoveNo[battlerId]; + ctx->hpCalc = ctx->fieldConditionData.futureSightDamage[battlerId]; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 121); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + return; + } + } + } + ctx->stateUpdateFieldConditionExtra++; + ctx->updateFieldConditionExtraData = 0; + case UFCE_STATE_PERISH_SONG: + while (ctx->updateFieldConditionExtraData < maxBattlers) { + battlerId = ctx->turnOrder[ctx->updateFieldConditionExtraData]; + if (ctx->unk_3108 & MaskOfFlagNo(battlerId)) { + ctx->updateFieldConditionExtraData++; + continue; + } + ctx->updateFieldConditionExtraData++; + if (ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_PERISH_SONG) { + if (ctx->battleMons[battlerId].unk88.perishSongTurns == 0) { + ctx->battleMons[battlerId].moveEffectFlags &= ~MOVE_EFFECT_FLAG_PERISH_SONG; + ctx->msgTemp = ctx->battleMons[battlerId].unk88.perishSongTurns; + ctx->hpCalc = ctx->battleMons[battlerId].hp * -1; + ctx->battleStatus |= BATTLE_STATUS_NO_BLINK; + } else { + ctx->msgTemp = ctx->battleMons[battlerId].unk88.perishSongTurns; + ctx->battleMons[battlerId].unk88.perishSongTurns--; + } + ctx->battlerIdTemp = battlerId; + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 102); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + return; + } + } + ctx->stateUpdateFieldConditionExtra++; + ctx->updateFieldConditionExtraData = 0; + case UFCE_STATE_TRICK_ROOM: + if (ctx->fieldCondition & FIELD_CONDITION_TRICK_ROOM) { + ctx->fieldCondition -= 1 << FIELD_CONDITION_TRICK_ROOM_SHIFT; + if (!(ctx->fieldCondition & FIELD_CONDITION_TRICK_ROOM)) { + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 251); + ctx->commandNext = ctx->command; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + return; + } + } + ctx->stateUpdateFieldConditionExtra++; + ctx->updateFieldConditionExtraData = 0; + break; + default: + break; + } + ctx->stateUpdateFieldConditionExtra = 0; + ctx->updateFieldConditionExtraData = 0; + ctx->command = CONTROLLER_COMMAND_12; +} + +//static +void BattleControllerPlayer_TurnEnd(BattleSystem *bsys, BATTLECONTEXT *ctx) { + if (ov12_0224DD18(ctx, ctx->command, ctx->command) == TRUE) { + return; + } + + if (ov12_0224D7EC(bsys, ctx) == TRUE) { + return; + } + + if (ov12_0224D540(bsys, ctx) == TRUE) { + return; + } + + ctx->totalTurns++; + ctx->meFirstTotal++; + + BattleContext_Init(ctx); + ov12_02251710(bsys, ctx); + ctx->command = CONTROLLER_COMMAND_TRAINER_MESSAGE; +} + +//static +void BattleControllerPlayer_FightInput(BattleSystem *bsys, BATTLECONTEXT *ctx) { + int flag = 0; + + ctx->battlerIdAttacker = ctx->unk_21E8[ctx->unk_EC]; + + if (ctx->turnData[ctx->battlerIdAttacker].struggleFlag) { + ctx->moveNoTemp = MOVE_STRUGGLE; + flag = 1; + } else if (ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredMove && + ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredMove == ctx->battleMons[ctx->battlerIdAttacker].moves[ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredMoveIndex]) { + ctx->moveNoTemp = ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredMove; + flag = 1; + } else if (ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredMove && + ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredMove != ctx->battleMons[ctx->battlerIdAttacker].moves[ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredMoveIndex]) { + ctx->moveNoTemp = ctx->battleMons[ctx->battlerIdAttacker].moves[ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredMoveIndex]; + ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredMove = 0; + ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredMoveIndex = 0; + ctx->battleMons[ctx->battlerIdAttacker].unk88.encoredTurns = 0; + flag = 1; + } else if (!Battler_CanSelectAction(ctx, ctx->battlerIdAttacker)) { + ctx->moveNoTemp = ctx->moveNoLockedInto[ctx->battlerIdAttacker]; + } else if (ctx->unk_30B4[ctx->battlerIdAttacker] != ctx->battleMons[ctx->battlerIdAttacker].moves[ctx->movePos[ctx->battlerIdAttacker]]) { + ctx->moveNoTemp = ctx->battleMons[ctx->battlerIdAttacker].moves[ctx->movePos[ctx->battlerIdAttacker]]; + flag = 1; + } else { + ctx->moveNoTemp = ctx->battleMons[ctx->battlerIdAttacker].moves[ctx->movePos[ctx->battlerIdAttacker]]; + } + ctx->moveNoCur = ctx->moveNoTemp; + ctx->command = CONTROLLER_COMMAND_23; + ctx->battlerIdTarget = ov12_022506D4(bsys, ctx, ctx->battlerIdAttacker, ctx->moveNoTemp, flag, 0); + ov12_022642F0(bsys); +} + +//static +void BattleControllerPlayer_ItemInput(BattleSystem *bsys, BATTLECONTEXT *ctx) { + BattleItem *item; + int script; + + ctx->battlerIdAttacker = ctx->unk_21E8[ctx->unk_EC]; + ctx->battlerIdTarget = ov12_02253DA0(bsys, ctx, ctx->battlerIdAttacker); + item = (BattleItem *)&ctx->unk_21A8[ctx->battlerIdAttacker][2]; + + if (BattleSystem_GetFieldSide(bsys, ctx->battlerIdAttacker)) { + switch (ctx->unk_334.unk9D[ctx->battlerIdAttacker >> 1]) { + case 0: + script = 289; + break; + case 1: + script = 267; + break; + case 2: + if ((ctx->unk_334.unk9F[ctx->battlerIdAttacker >> 1] & 1) && (ctx->unk_334.unk9F[ctx->battlerIdAttacker >> 1] & 0x3e)) { + ctx->msgTemp = 6; + } else { + ctx->msgTemp = LowestFlagNo(ctx->unk_334.unk9F[ctx->battlerIdAttacker >> 1]); + } + script = 268; + break; + case 3: + ctx->msgTemp = ctx->unk_334.unk9F[ctx->battlerIdAttacker >> 1]; + script = 269; + break; + case 4: + script = 270; + break; + } + ctx->itemTemp = ctx->unk_334.unkA0[ctx->battlerIdAttacker >> 1]; + } else { + switch (item->page) { + case BTLPOCKETLIST_HP_PP_RESTORE: + case BTLPOCKETLIST_STATUS_RESTORE: + case BTLPOCKETLIST_BATTLE_ITEMS: + if (item->id == ITEM_POKE_DOLL || item->id == ITEM_FLUFFY_TAIL) { + script = 222; + } else { + script = 223; + } + break; + case BTLPOCKETLIST_BALLS: + script = 11; + if (!(BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_TRAINER) && !(BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_TUTORIAL)) { + Bag_TakeItem(BattleSystem_GetBag(bsys), item->id, 1, HEAP_ID_BATTLE); + BagCursor_Battle_SetLastUsedItem(BattleSystem_GetBagCursor(bsys), item->id, item->page); + } + break; + } + ctx->itemTemp = item->id; + } + + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, script); + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + ctx->commandNext = CONTROLLER_COMMAND_40; + ctx->moveStatusFlag |= MOVE_STATUS_31; +} + +//static +void BattleControllerPlayer_PokemonInput(BattleSystem *bsys, BATTLECONTEXT *ctx) { + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 9); + ctx->battlerIdAttacker = ctx->unk_21E8[ctx->unk_EC]; + ctx->battlerIdSwitch = ctx->battlerIdAttacker; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + ctx->commandNext = CONTROLLER_COMMAND_41; + ctx->tempData = 0; + ctx->moveStatusFlag |= MOVE_STATUS_31; +} + +//static +void BattleControllerPlayer_RunInput(BattleSystem *bsys, BATTLECONTEXT *ctx) { + ctx->battlerIdAttacker = ctx->unk_21E8[ctx->unk_EC]; + + if (BattleSystem_GetFieldSide(bsys, ctx->battlerIdAttacker) && !(BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_LINK)) { + if (ctx->battleMons[ctx->battlerIdAttacker].status2 & (STATUS2_BINDING_TURNS | STATUS2_MEAN_LOOK)) { + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 286); + ctx->scriptSeqNo = 0; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + ctx->commandNext = CONTROLLER_COMMAND_40; + } else { + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 230); + ctx->scriptSeqNo = 0; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + ctx->commandNext = CONTROLLER_COMMAND_44; + } + } else { + if (BattleTryRun(bsys, ctx, ctx->battlerIdAttacker)) { + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 3); + ctx->scriptSeqNo = 0; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + ctx->commandNext = CONTROLLER_COMMAND_44; + } else { + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 8); + ctx->scriptSeqNo = 0; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + ctx->commandNext = CONTROLLER_COMMAND_40; + } + } +} + +//static +void BattleControllerPlayer_SafariBallInput(BattleSystem *bsys, BATTLECONTEXT *ctx) { + int cnt; + + ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 275); + ctx->battlerIdAttacker = BATTLER_PLAYER; + ctx->battlerIdTarget = BATTLER_ENEMY; + ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT; + ctx->commandNext = CONTROLLER_COMMAND_40; + ctx->itemTemp = ITEM_SAFARI_BALL; + cnt = BattleSystem_GetSafariBallCount(bsys) - 1; + BattleSystem_SetSafariBallCount(bsys, cnt); + ov12_02263A1C(bsys, ctx, BATTLER_PLAYER); +} diff --git a/src/battle/battle_system.c b/src/battle/battle_system.c new file mode 100644 index 0000000000..98f3912772 --- /dev/null +++ b/src/battle/battle_system.c @@ -0,0 +1,1086 @@ +#include "global.h" +#include "battle/battle_hp_bar.h" +#include "battle_controller_opponent.h" +#include "battle_system.h" +#include "party.h" +#include "pokemon_mood.h" +#include "overlay_12_0224E4FC.h" +#include "constants/game_stat.h" + +BgConfig *BattleSystem_GetBgConfig(BattleSystem *bsys) { + return bsys->bgConfig; +} + +Window *BattleSystem_GetWindow(BattleSystem *bsys, int index) { + return &bsys->window[index]; +} + +u32 BattleSystem_GetBattleType(BattleSystem *bsys) { + return bsys->battleType; +} + +BATTLECONTEXT *BattleSystem_GetBattleContext(BattleSystem *bsys) { + return bsys->ctx; +} + +OpponentData *BattleSystem_GetOpponentData(BattleSystem *bsys, int battlerId) { + return bsys->opponentData[battlerId]; +} + +int BattleSystem_GetMaxBattlers(BattleSystem *bsys) { + return bsys->maxBattlers; +} + +PARTY *BattleSystem_GetParty(BattleSystem *bsys, int battlerId) { + if ((bsys->battleType & BATTLE_TYPE_MULTI) || ((bsys->battleType & BATTLE_TYPE_INGAME_PARTNER) && (ov12_0223AB0C(bsys, battlerId) & 1))) { + return bsys->trainerParty[battlerId]; + } else if (bsys->battleType & BATTLE_TYPE_DOUBLES) { + return bsys->trainerParty[battlerId & 1]; + } else { + return bsys->trainerParty[battlerId]; + } +} + +int BattleSystem_GetPartySize(BattleSystem *bsys, int battlerId) { + if ((bsys->battleType & BATTLE_TYPE_MULTI) || ((bsys->battleType & BATTLE_TYPE_INGAME_PARTNER) && (ov12_0223AB0C(bsys, battlerId) & 1))) { + return GetPartyCount(bsys->trainerParty[battlerId]); + } else if (bsys->battleType & BATTLE_TYPE_DOUBLES) { + return GetPartyCount(bsys->trainerParty[battlerId & 1]); + } else { + return GetPartyCount(bsys->trainerParty[battlerId]); + } +} + +Pokemon *BattleSystem_GetPartyMon(BattleSystem *bsys, int battlerId, int index) { + if ((bsys->battleType & BATTLE_TYPE_MULTI) || ((bsys->battleType & BATTLE_TYPE_INGAME_PARTNER) && (ov12_0223AB0C(bsys, battlerId) & 1))) { + return GetPartyMonByIndex(bsys->trainerParty[battlerId], index); + } else if (bsys->battleType & BATTLE_TYPE_DOUBLES) { + return GetPartyMonByIndex(bsys->trainerParty[battlerId & 1], index); + } else { + return GetPartyMonByIndex(bsys->trainerParty[battlerId], index); + } +} + +u32 *ov12_0223A8D4(BattleSystem *bsys) { + return bsys->unk88; +} + +u32 *ov12_0223A8DC(BattleSystem *bsys) { + return bsys->unk8C; +} + +u32 *ov12_0223A8E4(BattleSystem *bsys) { + return bsys->unk90; +} + +u32 *ov12_0223A8EC(BattleSystem *bsys) { + return bsys->unk94; +} + +UnkBattleSystemSub17C *ov12_0223A8F4(BattleSystem *bsys, int index) { + return &bsys->unk17C[index]; +} + +u32 *ov12_0223A900(BattleSystem *bsys) { + return bsys->unk19C; +} + +u32 *ov12_0223A908(BattleSystem *bsys, int index) { + return bsys->unk1A0[index]; +} + +void ov12_0223A914(BattleSystem *bsys, int index, u32 *a2) { + bsys->unk1A0[index] = a2; +} + +FontID *BattleSystem_GetHpFont(BattleSystem *bsys) { + return bsys->hpFont; +} + +FontID *BattleSystem_GetLevelFont(BattleSystem *bsys) { + return bsys->levelFont; +} + +u32 *ov12_0223A930(BattleSystem *bsys) { + return bsys->unkC; +} + +u32 *ov12_0223A934(BattleSystem *bsys) { + return bsys->unk10; +} + +PaletteData *BattleSystem_GetPaletteData(BattleSystem *bsys) { + return bsys->palette; +} + +Pokedex *BattleSystem_GetPokedex(BattleSystem *bsys) { + return bsys->pokedex; +} + +u8 *BattleSystem_GetSendBufferPtr(BattleSystem *bsys) { + return &bsys->sendBuffer[0]; +} + +u8 *BattleSystem_GetRecvBufferPtr(BattleSystem *bsys) { + return &bsys->recvBuffer[0]; +} + +u16 *ov12_0223A954(BattleSystem *bsys) { + return &bsys->unk23E8; +} + +u16 *ov12_0223A960(BattleSystem *bsys) { + return &bsys->unk23EA; +} + +u16 *ov12_0223A96C(BattleSystem *bsys) { + return &bsys->unk23EC; +} + +u16 *ov12_0223A978(BattleSystem *bsys) { + return &bsys->unk23EE; +} + +u16 *ov12_0223A984(BattleSystem *bsys) { + return &bsys->unk23F0; +} + +u16 *ov12_0223A990(BattleSystem *bsys) { + return &bsys->unk23F2; +} + +UnkBattleSystemSub1D0 *ov12_0223A99C(BattleSystem *bsys) { + return &bsys->unk1D0[0]; +} + +u32 *ov12_0223A9A4(BattleSystem *bsys) { + return bsys->unk14; +} + +String *BattleSystem_GetMessageBuffer(BattleSystem *bsys) { + return bsys->msgBuffer; +} + +u16 BattleSystem_GetTrainerIndex(BattleSystem *bsys, int battlerId) { + if ((bsys->battleType & BATTLE_TYPE_MULTI) || ((bsys->battleType & BATTLE_TYPE_INGAME_PARTNER) && (ov12_0223AB0C(bsys, battlerId) & 1))) { + return bsys->trainerId[battlerId]; + } else if (bsys->battleType & BATTLE_TYPE_DOUBLES) { + return bsys->trainerId[battlerId & 1]; + } else { + return bsys->trainerId[battlerId]; + } +} + +TRAINER *BattleSystem_GetTrainer(BattleSystem *bsys, int battlerId) { + if ((bsys->battleType & BATTLE_TYPE_MULTI) || ((bsys->battleType & BATTLE_TYPE_INGAME_PARTNER) && (ov12_0223AB0C(bsys, battlerId) & 1))) { + return &bsys->trainers[battlerId]; + } else if (bsys->battleType & BATTLE_TYPE_DOUBLES) { + return &bsys->trainers[battlerId & 1]; + } else { + return &bsys->trainers[battlerId]; + } +} + +PlayerProfile *BattleSystem_GetPlayerProfile(BattleSystem *bsys, int battlerId) { + if ((bsys->battleType & BATTLE_TYPE_MULTI) || ((bsys->battleType & BATTLE_TYPE_INGAME_PARTNER) && (ov12_0223AB0C(bsys, battlerId) & 1))) { + return bsys->playerProfile[battlerId]; + } else if (bsys->battleType & BATTLE_TYPE_DOUBLES) { + return bsys->playerProfile[battlerId & 1]; + } else { + return bsys->playerProfile[battlerId]; + } +} + +Bag *BattleSystem_GetBag(BattleSystem *bsys) { + return bsys->bag; +} + +BagCursor *BattleSystem_GetBagCursor(BattleSystem *bsys) { + return bsys->bagCursor; +} + +u16 BattleSystem_GetMonBall(BattleSystem *bsys, Pokemon *mon) { + if (bsys->unk2474_2) { + return GetMonData(mon, MON_DATA_DP_POKEBALL, NULL); + } else { + return GetMonData(mon, MON_DATA_POKEBALL, NULL); + } +} + +u32 ov12_0223AAB8(BattleSystem *bsys) { + return bsys->unk2474_3; +} + +u32 BattleSystem_GetTrainerGender(BattleSystem *bsys, int battlerId) { + return PlayerProfile_GetTrainerGender(bsys->playerProfile[battlerId]); +} + +int ov12_0223AAD8(BattleSystem *bsys, int a1) { + int battlerId; + for (battlerId = 0; battlerId < bsys->maxBattlers; battlerId++) { + if (ov12_02261258(bsys->opponentData[battlerId]) == a1) { + break; + } + } + + GF_ASSERT(battlerId < bsys->maxBattlers); + + return battlerId; +} + +u8 ov12_0223AB0C(BattleSystem *bsys, int battlerId) { + return ov12_02261258(bsys->opponentData[battlerId]); +} + +u8 BattleSystem_GetFieldSide(BattleSystem *bsys, int battlerId) { + return ov12_02261258(bsys->opponentData[battlerId]) & 1; +} + +void *BattleSystem_GetMessageIcon(BattleSystem *bsys) { + return bsys->msgIcon; +} + +PC_STORAGE *BattleSystem_GetPcStorage(BattleSystem *bsys) { + return bsys->storage; +} + +Terrain BattleSystem_GetTerrainId(BattleSystem *bsys) { + if (bsys->terrain > TERRAIN_MAX || bsys->terrain < 0) { + return TERRAIN_MAX; + } + return bsys->terrain; +} + +int ov12_0223AB54(BattleSystem *bsys) { + return bsys->unk2404; +} + +int BattleSystem_GetLocation(BattleSystem *bsys) { + return bsys->location; +} + +int BattleSystem_GetBattlerIdPartner(BattleSystem *bsys, int battlerId) { + int battlerIdPartner; + int maxBattlers = BattleSystem_GetMaxBattlers(bsys); + u32 battleType = BattleSystem_GetBattleType(bsys); + + if (!(battleType & BATTLE_TYPE_DOUBLES)) { + return battlerId; + } + + for (battlerIdPartner = 0; battlerIdPartner < maxBattlers; battlerIdPartner++) { + if (battlerIdPartner != battlerId && BattleSystem_GetFieldSide(bsys, battlerIdPartner) == BattleSystem_GetFieldSide(bsys, battlerId)) { + break; + } + } + + return battlerIdPartner; +} + +int ov12_0223ABB8(BattleSystem *bsys, int battlerId, int side) { + int battlerIdOpponent; + int maxBattlers = BattleSystem_GetMaxBattlers(bsys); + u32 battleType = BattleSystem_GetBattleType(bsys); + + if (!(battleType & BATTLE_TYPE_DOUBLES)) { + return battlerId ^ 1; + } + + for (battlerIdOpponent = 0; battlerIdOpponent < maxBattlers; battlerIdOpponent++) { + if (battlerIdOpponent != battlerId && (ov12_0223AB0C(bsys, battlerIdOpponent) & 2) == side && BattleSystem_GetFieldSide(bsys, battlerIdOpponent) != BattleSystem_GetFieldSide(bsys, battlerId)) { + break; + } + } + + return battlerIdOpponent; +} + +BOOL BattleSystem_RecoverStatus(BattleSystem *bsys, int battlerId, int selectedMonIndex, int movePos, int item) { + BATTLECONTEXT *ctx = bsys->ctx; + Pokemon *mon; + BOOL ret = FALSE; + int data; + int index1 = ov12_022581D4(bsys, ctx, 2, battlerId); + int index2; + int friendship; + + if (BattleSystem_GetBattleType(bsys) == (BATTLE_TYPE_DOUBLES | BATTLE_TYPE_TRAINER) || ((BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_INGAME_PARTNER) && !(ov12_0223AB0C(bsys, battlerId) & 1))) { + index2 = ov12_022581D4(bsys, ctx, 2, BattleSystem_GetBattlerIdPartner(bsys, battlerId)); + if (index2 == selectedMonIndex) { + battlerId = BattleSystem_GetBattlerIdPartner(bsys, battlerId); + } + } else { + index2 = index1; + } + mon = BattleSystem_GetPartyMon(bsys, battlerId, selectedMonIndex); + friendship = 0; + + if (GetItemAttr(item, ITEMATTR_SLP_HEAL, HEAP_ID_BATTLE)) { + data = GetMonData(mon, MON_DATA_STATUS, NULL); + if (data & STATUS_SLEEP) { + data &= ~STATUS_SLEEP; + SetMonData(mon, MON_DATA_STATUS, &data); + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + data = GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS, NULL); + data &= ~STATUS_SLEEP; + SetBattlerVar(ctx, battlerId, BMON_DATA_STATUS, &data); + data = GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS2, NULL); + data &= ~STATUS2_NIGHTMARE; + SetBattlerVar(ctx, battlerId, BMON_DATA_STATUS2, &data); + } + ret = TRUE; + } + } + + if (GetItemAttr(item, ITEMATTR_PSN_HEAL, HEAP_ID_BATTLE)) { + data = GetMonData(mon, MON_DATA_STATUS, NULL); + if (data & STATUS_POISON_ALL) { + data &= ~STATUS_POISON_ALL; + SetMonData(mon, MON_DATA_STATUS, &data); + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + data = GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS, NULL); + data &= ~STATUS_POISON_ALL; + SetBattlerVar(ctx, battlerId, BMON_DATA_STATUS, &data); + } + ret = TRUE; + } + } + + if (GetItemAttr(item, ITEMATTR_BRN_HEAL, HEAP_ID_BATTLE)) { + data = GetMonData(mon, MON_DATA_STATUS, NULL); + if (data & STATUS_BURN) { + data &= ~STATUS_BURN; + SetMonData(mon, MON_DATA_STATUS, &data); + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + data = GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS, NULL); + data &= ~STATUS_BURN; + SetBattlerVar(ctx, battlerId, BMON_DATA_STATUS, &data); + } + ret = TRUE; + } + } + + if (GetItemAttr(item, ITEMATTR_FRZ_HEAL, HEAP_ID_BATTLE)) { + data = GetMonData(mon, MON_DATA_STATUS, NULL); + if (data & STATUS_FREEZE) { + data &= ~STATUS_FREEZE; + SetMonData(mon, MON_DATA_STATUS, &data); + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + data = GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS, NULL); + data &= ~STATUS_FREEZE; + SetBattlerVar(ctx, battlerId, BMON_DATA_STATUS, &data); + } + ret = TRUE; + } + } + + if (GetItemAttr(item, ITEMATTR_PRZ_HEAL, HEAP_ID_BATTLE)) { + data = GetMonData(mon, MON_DATA_STATUS, NULL); + if (data & STATUS_PARALYSIS) { + data &= ~STATUS_PARALYSIS; + SetMonData(mon, MON_DATA_STATUS, &data); + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + data = GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS, NULL); + data &= ~STATUS_PARALYSIS; + SetBattlerVar(ctx, battlerId, BMON_DATA_STATUS, &data); + } + ret = TRUE; + } + } + + if (GetItemAttr(item, ITEMATTR_CFS_HEAL, HEAP_ID_BATTLE)) { + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + data = GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS2, NULL); + if (data & STATUS2_CONFUSION) { + data &= ~STATUS2_CONFUSION; + SetBattlerVar(ctx, battlerId, BMON_DATA_STATUS2, &data); + ret = TRUE; + } + } + } + + if (GetItemAttr(item, ITEMATTR_INF_HEAL, HEAP_ID_BATTLE)) { + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + data = GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS2, NULL); + if (data & STATUS2_ATTRACT_ALL) { + data &= ~STATUS2_ATTRACT_ALL; + SetBattlerVar(ctx, battlerId, BMON_DATA_STATUS2, &data); + ret = TRUE; + } + } + } + + if (GetItemAttr(item, ITEMATTR_GUARD_SPEC, HEAP_ID_BATTLE)) { + data = ov12_022581D4(bsys, ctx, 1, battlerId); + if (!data) { + data = ov12_022581D4(bsys, ctx, 0, battlerId); + data |= SIDE_CONDITION_MIST; + ov12_022582B8(bsys, ctx, 0, battlerId, data); + ov12_022582B8(bsys, ctx, 1, battlerId, 5); + ret = TRUE; + } + } + + if (GetItemAttr(item, ITEMATTR_ATK_STAGES, HEAP_ID_BATTLE)) { + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + if (GetBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_ATK, NULL) < STAT_UP_6) { + AddBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_ATK, 1); + ret = TRUE; + } + } + } + + if (GetItemAttr(item, ITEMATTR_DEF_STAGES, HEAP_ID_BATTLE)) { + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + if (GetBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_DEF, NULL) < STAT_UP_6) { + AddBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_DEF, 1); + ret = TRUE; + } + } + } + + if (GetItemAttr(item, ITEMATTR_SPATK_STAGES, HEAP_ID_BATTLE)) { + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + if (GetBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_SPATK, NULL) < STAT_UP_6) { + AddBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_SPATK, 1); + ret = TRUE; + } + } + } + + if (GetItemAttr(item, ITEMATTR_SPDEF_STAGES, HEAP_ID_BATTLE)) { + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + if (GetBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_SPDEF, NULL) < STAT_UP_6) { + AddBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_SPDEF, 1); + ret = TRUE; + } + } + } + + if (GetItemAttr(item, ITEMATTR_SPEED_STAGES, HEAP_ID_BATTLE)) { + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + if (GetBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_SPEED, NULL) < STAT_UP_6) { + AddBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_SPEED, 1); + ret = TRUE; + } + } + } + + if (GetItemAttr(item, ITEMATTR_ACCURACY_STAGES, HEAP_ID_BATTLE)) { + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + if (GetBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_ACC, NULL) < STAT_UP_6) { + AddBattlerVar(ctx, battlerId, BMON_DATA_STAT_CHANGE_ACC, 1); + ret = TRUE; + } + } + } + + if (GetItemAttr(item, ITEMATTR_CRITRATE_STAGES, HEAP_ID_BATTLE)) { + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + data = GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS2, NULL); + if (!(data & STATUS2_FOCUS_ENERGY)) { + data |= STATUS2_FOCUS_ENERGY; + SetBattlerVar(ctx, battlerId, BMON_DATA_STATUS2, &data); + ret = TRUE; + } + } + } + + if (GetItemAttr(item, ITEMATTR_PP_RESTORE, HEAP_ID_BATTLE)) { + data = GetItemAttr(item, ITEMATTR_PP_RESTORE_PARAM, HEAP_ID_BATTLE); + if (GetMonData(mon, MON_DATA_MOVE1PP + movePos, NULL) != GetMonData(mon, MON_DATA_MOVE1MAXPP + movePos, NULL)) { + AddMonData(mon, MON_DATA_MOVE1PP + movePos, data); + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + if (!(GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS2, NULL) & STATUS2_TRANSFORMED) && !(GetBattlerVar(ctx, battlerId, BMON_DATA_MIMICED_MOVE, NULL) & MaskOfFlagNo(movePos))) { + AddBattlerVar(ctx, battlerId, BMON_DATA_MOVE1PP + movePos, data); + } + } + ret = TRUE; + } + } + + if (GetItemAttr(item, ITEMATTR_PP_RESTORE_ALL, HEAP_ID_BATTLE)) { + data = GetItemAttr(item, ITEMATTR_PP_RESTORE_PARAM, HEAP_ID_BATTLE); + for (movePos = 0; movePos < MAX_MON_MOVES; movePos++) { + if (GetMonData(mon, MON_DATA_MOVE1PP + movePos, NULL) != GetMonData(mon, MON_DATA_MOVE1MAXPP + movePos, NULL)) { + AddMonData(mon, MON_DATA_MOVE1PP + movePos, data); + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + if (!(GetBattlerVar(ctx, battlerId, BMON_DATA_STATUS2, NULL) & STATUS2_TRANSFORMED) && !(GetBattlerVar(ctx, battlerId, BMON_DATA_MIMICED_MOVE, NULL) & MaskOfFlagNo(movePos))) { + AddBattlerVar(ctx, battlerId, BMON_DATA_MOVE1PP + movePos, data); + } + } + ret = TRUE; + } + } + } + + if (GetItemAttr(item, ITEMATTR_HP_RESTORE, HEAP_ID_BATTLE)) { + data = 0; + if (GetItemAttr(item, ITEMATTR_REVIVE, HEAP_ID_BATTLE)) { + if (GetMonData(mon, MON_DATA_HP, NULL) == 0) { + data = 1; + } + } else { + data = GetMonData(mon, MON_DATA_HP, NULL); + } + if (data && GetMonData(mon, MON_DATA_HP, NULL) != GetMonData(mon, MON_DATA_MAXHP, NULL)) { + data = GetItemAttr(item, ITEMATTR_HP_RESTORE_PARAM, HEAP_ID_BATTLE); + switch (data) { + case HP_RESTORE_ALL: + data = GetMonData(mon, MON_DATA_MAXHP, NULL); + break; + case HP_RESTORE_HALF: + data = GetMonData(mon, MON_DATA_MAXHP, NULL) / 2; + if (data == 0) { + data = 1; + } + break; + case HP_RESTORE_QTR: + data = GetMonData(mon, MON_DATA_MAXHP, NULL) *25 / 100; + if (data == 0) { + data = 1; + } + break; + default: + break; + } + AddMonData(mon, MON_DATA_HP, data); + if (!GetItemAttr(item, ITEMATTR_REVIVE, HEAP_ID_BATTLE)) { + if (BattleSystem_GetFieldSide(bsys, battlerId)) { + SetBattlerVar(ctx, battlerId, BMON_DATA_HELD_ITEM_RESTORE_HP, &data); + } else if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + AddBattlerVar(ctx, battlerId, BMON_DATA_HP, data); + } + } + ret = TRUE; + } + } + + if (GetItemAttr(item, ITEMATTR_FRIENDSHIP_MOD_LO, HEAP_ID_BATTLE)) { + if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 100 && ret == TRUE) { + friendship = GetItemAttr(item, ITEMATTR_FRIENDSHIP_MOD_LO_PARAM, HEAP_ID_BATTLE); + } + } + + if (GetItemAttr(item, ITEMATTR_FRIENDSHIP_MOD_MED, HEAP_ID_BATTLE)) { + if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 100 && GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 200 && ret == TRUE) { + friendship = GetItemAttr(item, ITEMATTR_FRIENDSHIP_MOD_MED_PARAM, HEAP_ID_BATTLE); + } + } + + if (GetItemAttr(item, ITEMATTR_FRIENDSHIP_MOD_HI, HEAP_ID_BATTLE)) { + if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 200 && ret == TRUE) { + friendship = GetItemAttr(item, ITEMATTR_FRIENDSHIP_MOD_HI_PARAM, HEAP_ID_BATTLE); + } + } + + if (friendship) { + if (friendship > 0) { + if (BallToItemId(BattleSystem_GetMonBall(bsys, mon)) == ITEM_LUXURY_BALL) { + friendship++; + } + if (GetMonData(mon, MON_DATA_EGG_MET_LOCATION, NULL) == BattleSystem_GetLocation(bsys)) { + friendship++; + } + data = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); + if (GetItemAttr(data, ITEMATTR_HOLD_EFFECT, HEAP_ID_BATTLE) == HOLD_EFFECT_FRIENDSHIP_UP) { + friendship = friendship * 150 / 100; + } + } + AddMonData(mon, MON_DATA_FRIENDSHIP, friendship); + if (index1 == selectedMonIndex || index2 == selectedMonIndex) { + AddBattlerVar(ctx, battlerId, BMON_DATA_FRIENDSHIP, friendship); + } + } + + if (ret == TRUE) { + ApplyItemEffectOnMonMood(mon, item); + } + + return ret; +} + +u32 BattleSystem_GetBattleSpecial(BattleSystem *bsys) { + return bsys->battleSpecial; +} + +int BattleSystem_GetTimezone(BattleSystem *bsys) { + return bsys->timezone; +} + +int ov12_0223B52C(BattleSystem *bsys) { + int ret; + + switch (bsys->unk2404) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + switch (bsys->timezone) { + case 0: + case 1: + ret = 0; + break; + case 2: + ret = 1; + break; + case 3: + case 4: + ret = 2; + break; + } + break; + default: + ret = 0; + break; + } + + return ret; +} + +u8 ov12_0223B580(BattleSystem *bsys, int battlerId, u8 a2) { + u16 item; + + if (ov12_0223AB0C(bsys, battlerId) == 4 && !(bsys->battleType & BATTLE_TYPE_MULTI)) { + if (bsys->battleType & BATTLE_TYPE_LINK) { + if (!(a2 & MaskOfFlagNo(BattleSystem_GetBattlerIdPartner(bsys, battlerId)))) { + return 1; + } + } else { + item = ov12_022581D4(bsys, bsys->ctx, 12, 0); + if ((ov12_022581D4(bsys, bsys->ctx, 8, 0) == 14 && item > ITEM_CHERISH_BALL) || (a2 & MaskOfFlagNo(0))) { + return 0; + } else { + return 1; + } + } + } + return 0; +} + +u16 BattleSystem_CheckEvolution(BATTLE_SETUP *setup, int *selectedMonIndex, int *evolutionCondition) { + Pokemon *mon; + u16 species = 0; + + if (setup->winFlag != 1 && setup->winFlag != 4 && setup->winFlag != 5) { + return 0; + } + + while (setup->levelUpFlag) { + for (*selectedMonIndex = 0; *selectedMonIndex < PARTY_SIZE; (*selectedMonIndex)++) { + if (setup->levelUpFlag & MaskOfFlagNo(*selectedMonIndex)) { + setup->levelUpFlag &= MaskOfFlagNo(*selectedMonIndex) ^ 0xFFFFFFFF; + break; + } + } + if (*selectedMonIndex < PARTY_SIZE) { + mon = GetPartyMonByIndex(setup->party[0], *selectedMonIndex); + species = GetMonEvolution(setup->party[0], mon, EVOCTX_LEVELUP, setup->evolutionLocation, evolutionCondition); + if (species) { + return species; + } + } + } + return species; +} + +u8 ov12_0223B688(BattleSystem *bsys) { + return bsys->unk23FC; +} + +u8 ov12_0223B694(BattleSystem *bsys) { + GF_ASSERT(bsys->ctx != NULL); + return ov12_022581D4(bsys, bsys->ctx, 5, 0); +} + +int BattleSystem_GetSafariBallCount(BattleSystem *bsys) { + return bsys->safariBallCnt; +} + +void BattleSystem_SetSafariBallCount(BattleSystem *bsys, int cnt) { + bsys->safariBallCnt = cnt; +} + +OPTIONS *BattleSystem_GetOptions(BattleSystem *bsys) { + return bsys->options; +} + +BOOL BattleSystem_AreBattleAnimationsOn(BattleSystem *bsys) { + if ((bsys->battleType & BATTLE_TYPE_LINK) && !(bsys->battleSpecial & BATTLE_SPECIAL_RECORDED)) { + return TRUE; + } + return (Options_GetBattleScene(bsys->options) == 0); +} + +u16 BattleSystem_GetFrame(BattleSystem *bsys) { + return Options_GetFrame(bsys->options); +} + +u8 BattleSystem_GetTextFrameDelay(BattleSystem *bsys) { + if ((bsys->battleType & BATTLE_TYPE_LINK) && !(bsys->battleSpecial & BATTLE_SPECIAL_RECORDED)) { + return 1; + } + return Options_GetTextFrameDelay(bsys->options); +} + +u16 BattleSystem_GetBattleStyle(BattleSystem *bsys) { + return Options_GetBattleStyle(bsys->options); +} + +void *ov12_0223B750(BattleSystem *bsys) { + return bsys->unk1C8; +} + +SOUND_CHATOT *BattleSystem_GetChatotVoice(BattleSystem *bsys, int battlerId) { + if ((bsys->battleType & BATTLE_TYPE_MULTI) || ((bsys->battleType & BATTLE_TYPE_INGAME_PARTNER) && (ov12_0223AB0C(bsys, battlerId) & 1))) { + return bsys->chatotVoice[battlerId]; + } else if (bsys->battleType & BATTLE_TYPE_DOUBLES) { + return bsys->chatotVoice[battlerId & 1]; + } else { + return bsys->chatotVoice[battlerId]; + } +} + +void BattleSystem_TryChangeForm(BattleSystem *bsys) { + int i; + AlternateForms form; + Pokemon *mon; + u16 species; + + if (bsys->battleType & BATTLE_TYPE_NO_EXP) { + return; + } + + for (i = 0; i < BattleSystem_GetPartySize(bsys, BATTLER_PLAYER); i++) { + mon = BattleSystem_GetPartyMon(bsys, BATTLER_PLAYER, i); + species = GetMonData(mon, MON_DATA_SPECIES_OR_EGG, NULL); + if (species == SPECIES_BURMY && bsys->unk2418[BATTLER_PLAYER] & MaskOfFlagNo(i)) { + switch (BattleSystem_GetTerrainId(bsys)) { + case TERRAIN_GRASS: + case TERRAIN_PUDDLE: + case TERRAIN_SNOW: + case TERRAIN_WATER: + case TERRAIN_ICE: + case TERRAIN_MARSH: + default: + form = BURMY_PLANT; + break; + case TERRAIN_PLAIN: + case TERRAIN_SAND: + case TERRAIN_CAVE: + case TERRAIN_ROCKS: + case TERRAIN_ELITE_4_KAREN: + case TERRAIN_22: + form = BURMY_SANDY; + break; + case TERRAIN_BUILDING: + case TERRAIN_BRIDGE: + case TERRAIN_LINK: + case TERRAIN_END: + case TERRAIN_ELITE_4_WILL: + case TERRAIN_ELITE_4_KOGA: + case TERRAIN_ELITE_4_BRUNO: + case TERRAIN_CHAMPION_LANCE: + case TERRAIN_17: + case TERRAIN_TOWER: + case TERRAIN_ARCADE: + case TERRAIN_CASTLE: + form = BURMY_TRASH; + break; + } + SetMonData(mon, MON_DATA_FORM, &form); + } + } +} + +void ov12_0223B854(BattleSystem *bsys, int battlerId, int selectedMonIndex) { + bsys->unk2418[battlerId] |= MaskOfFlagNo(selectedMonIndex); +} + +//used to be related to poketch in dppt +void ov12_0223B870() { + +} + +void BattleSystem_SetBackground(BattleSystem *bsys) { + NNSG2dImageProxy *image; + int bgX, bgY, objX, objY, data, i; + u8 *vram; + u32* src; + u32* dst; + + bsys->unk230 = AllocFromHeap(HEAP_ID_BATTLE, 0x10000); + bsys->unk234 = AllocFromHeap(HEAP_ID_BATTLE, 0x200); + + MIi_CpuCopy32((void *)0x6010000, (u32 *)bsys->unk230, 0x10000); + dst = (u32 *)bsys->unk234; + src = (u32 *)PaletteData_GetUnfadedBuf(bsys->palette, 0); + MIi_CpuCopy32(src, dst, 0x200); + + vram = (u8 *)0x6400000; + image = sub_02024B1C(bsys->unk17C[1].unk0->unk0); + vram += image->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]; + + for (bgY = 20; bgY < 28; bgY++) { + for (bgX = 16; bgX < 32; bgX++) { + objX = bgX - 16; + objY = bgY - 20; + for (i = 0; i < 64; i++) { + if (objX < 8) { + if (i & 1) { + data = (vram[objY * 0x100 + objX * 0x20 + i / 2] & 0xF0) >> 4; + } else { + data = (vram[objY * 0x100 + objX * 0x20 + i / 2] & 0xF); + } + } else if (i & 1) { + data = (vram[0x700 + objY * 0x100 + objX * 0x20 + i / 2] & 0xF0) >> 4; + } else { + data = (vram[0x700 + objY * 0x100 + objX * 0x20 + i / 2] & 0xF); + } + if (data) { + bsys->unk230[bgY * 0x800 + bgX * 0x40 + i] = data + 0x70; + } + } + } + } + + vram = (u8 *)0x6400000; + image = sub_02024B1C(bsys->unk17C[0].unk0->unk0); + vram += image->vramLocation.baseAddrOfVram[NNS_G2D_VRAM_TYPE_2DMAIN]; + + for (i = 0; i < 0x800; i++) { + if (i & 1) { + data = (vram[i / 2] & 0xF0) >> 4; + } else { + data = (vram[i / 2] & 0xF); + } + if (data) { + bsys->unk230[0x9800 + i] = data + 0x70; + } + } + + for (bgY = 28; bgY < 32; bgY++) { + for (bgX = 0; bgX < 24; bgX++) { + objX = bgX; + objY = bgY - 28; + for (i = 0; i < 0x40; i++) { + if (i & 1) { + data = (vram[0x400 + (objX / 8) * 0x400 + (objX % 8) * 0x20 + objY * 0x100 + i / 2] & 0xF0) >> 4; + } else { + data = (vram[0x400 + (objX / 8) * 0x400 + (objX % 8) * 0x20 + objY * 0x100 + i / 2] & 0xF); + } + if (data) { + bsys->unk230[bgY * 0x800 + bgX * 0x40 + i] = data + 0x70; + } + } + } + } + + BG_LoadCharTilesData(bsys->bgConfig, 3, bsys->unk230, 0x10000, 0); + + ov12_02266008(&bsys->unk17C[0]); + ov12_02266008(&bsys->unk17C[1]); +} + +u8 *ov12_0223BAD0(BattleSystem *bsys) { + return bsys->unk230; +} + +u16 *ov12_0223BAD8(BattleSystem *bsys) { + return bsys->unk234; +} + +u16 *ov12_0223BAE0(BattleSystem *bsys) { + return &bsys->unk2238[0]; +} + +u16 *ov12_0223BAEC(BattleSystem *bsys) { + return &bsys->unk2318[0]; +} + +int BattleSystem_GetWeather(BattleSystem *bsys) { + return bsys->weather; +} + +u8 ov12_0223BB04(BattleSystem *bsys) { + return bsys->unk2421; +} + +void ov12_0223BB10(BattleSystem *bsys, u8 a1) { + bsys->unk2421 = a1; +} + +int ov12_0223BB1C(BattleSystem *bsys) { + return bsys->unk2430; +} + +void BattleSystem_GameStatIncrement(BattleSystem *bsys, int id) { + if (bsys->battleSpecial & BATTLE_SPECIAL_RECORDED) { + return; + } + GameStats_Inc(bsys->gameStats, id); +} + +void ov12_0223BB44(BattleSystem *bsys) { + if (bsys->battleSpecial & BATTLE_SPECIAL_RECORDED) { + return; + } + GameStats_AddSpecial(bsys->gameStats, GAME_STAT_UNK21); +} + +void ov12_0223BB64(BattleSystem *bsys, int a1) { + bsys->unk2440 = a1; +} + +void ov12_0223BB6C(BattleSystem *bsys, u8 a1) { + bsys->unk2442 = a1; +} + +void *ov12_0223BB78(BattleSystem *bsys) { + return bsys->unk1BC; +} + +void ov12_0223BB80(BattleSystem *bsys, void *a1) { + bsys->unk1BC = a1; +} + +UnkBattleSystemSub1D0 *ov12_0223BB88(BattleSystem *bsys, int index) { + return &bsys->unk1D0[index]; +} + +u8 *ov12_0223BB94(UnkBattleSystemSub1D0 *ptr, int index) { + GF_ASSERT(index < 4); + return ptr[index].unk0; +} + +void ov12_0223BBA8(UnkBattleSystemSub1D0 *ptr, int index, int a2) { + GF_ASSERT(index < 4); + ptr[index].unk4 = a2; +} + +void ov12_0223BBC0(UnkBattleSystemSub1D0 *ptr, int index, int a2) { + GF_ASSERT(index < 4); + ptr[index].unk8 = a2; +} + +void ov12_0223BBD8(UnkBattleSystemSub1D0 *ptr, int index, int a2) { + GF_ASSERT(index < 4); + ptr[index].unkC = a2; +} + +void ov12_0223BBF0(BattleSystem *bsys, u8 a1) { + bsys->unk23FD = a1; +} + +void ov12_0223BBFC(BattleSystem *bsys, u8 *a1) { + bsys->unk23F4 = a1; +} + +void ov12_0223BC08(BattleSystem *bsys, u8 *a1) { + bsys->unk23F8 = a1; +} + +void ov12_0223BC14(BattleSystem *bsys, u8 a1) { + *bsys->unk23F4 = a1; +} + +void ov12_0223BC20(BattleSystem *bsys, u8 a1) { + *bsys->unk23F8 = a1; +} + +void ov12_0223BC2C(BattleSystem *bsys, u8 a1) { + bsys->unk23FE = a1; +} + +BattleHpBar *BattleSystem_GetHpBar(BattleSystem *bsys, int battlerId) { + return OpponentData_GetHpBar(bsys->opponentData[battlerId]); +} + +void BattleSystem_HpBar_Init(BattleSystem *bsys) { + int i; + BattleHpBar *hpBar; + + for (i = 0; i < bsys->maxBattlers; i++) { + hpBar = OpponentData_GetHpBar(bsys->opponentData[i]); + hpBar->bsys = bsys; + hpBar->type = ov12_02265B64(ov12_02261258(bsys->opponentData[i]), BattleSystem_GetBattleType(bsys)); + BattleHpBar_LoadResources(hpBar); + BattleHpBar_SetEnabled(hpBar, FALSE); + } +} + +void BattleSystem_SetHpBarEnabled(BattleSystem *bsys) { + int i; + BattleHpBar *hpBar; + + for (i = 0; i < bsys->maxBattlers; i++) { + hpBar = OpponentData_GetHpBar(bsys->opponentData[i]); + if (hpBar->hp) { + BattleHpBar_SetEnabled(hpBar, TRUE); + } + } +} + +void BattleSystem_SetHpBarDisabled(BattleSystem *bsys) { + int i; + BattleHpBar *hpBar; + + for (i = 0; i < bsys->maxBattlers; i++) { + hpBar = OpponentData_GetHpBar(bsys->opponentData[i]); + BattleHpBar_SetEnabled(hpBar, FALSE); + } +} + +void BattleSystem_HpBar_Delete(BattleSystem *bsys) { + int i; + BattleHpBar *hpBar; + + for (i = 0; i < bsys->maxBattlers; i++) { + hpBar = OpponentData_GetHpBar(bsys->opponentData[i]); + BattleHpBar_FreeResources(hpBar); + } +} + +u8 BattleSystem_GetBattleOutcomeFlags(BattleSystem *bsys) { + return bsys->battleOutcomeFlag; +} + +void BattleSystem_SetBattleOutcomeFlags(BattleSystem *bsys, u8 battleOutcomeFlag) { + bsys->battleOutcomeFlag = battleOutcomeFlag; +} + +u8 BattleSystem_GetCriticalHpMusicFlag(BattleSystem *bsys) { + return bsys->criticalHpMusic; +} + +u8 BattleSystem_SetCriticalHpMusicFlag(BattleSystem *bsys, u8 flag) { + bsys->criticalHpMusic = flag; +} + +u8 BattleSystem_GetCriticalHpMusicDelay(BattleSystem *bsys) { + return bsys->criticalHpMusicDelay; +} + +void BattleSystem_SetCriticalHpMusicDelay(BattleSystem *bsys, u8 delay) { + GF_ASSERT(delay < 15); + bsys->criticalHpMusicDelay = delay; +} + +void ov12_0223BD8C(BattleSystem *bsys, int a1) { + bsys->unk243C = a1; +} + +u16 BattleSystem_Random(BattleSystem *bsys) { + bsys->rand = bsys->rand * 1103515245L + 24691; + return bsys->rand / 65536L; +} + +u32 BattleSystem_GetRandTemp(BattleSystem *bsys) { + return bsys->randTemp; +} + +void BattleSystem_SetRandTemp(BattleSystem *bsys, u32 temp) { + bsys->randTemp = temp; +} diff --git a/src/battle/overlay_12_0224E4FC.c b/src/battle/overlay_12_0224E4FC.c index 84c457ae0e..c8c1df8c1c 100644 --- a/src/battle/overlay_12_0224E4FC.c +++ b/src/battle/overlay_12_0224E4FC.c @@ -780,11 +780,11 @@ void SetBattlerVar(BATTLECONTEXT *ctx, int battlerId, u32 id, void *data) { } } -void ov12_0224F794(BATTLECONTEXT *ctx, int battlerId, u32 varId, int data) { - AddBattlerVar(&ctx->battleMons[battlerId], varId, data); +void AddBattlerVar(BATTLECONTEXT *ctx, int battlerId, u32 varId, int data) { + BattleMon_AddVar(&ctx->battleMons[battlerId], varId, data); } -void AddBattlerVar(BattleMon *mon, u32 varId, int data) { +void BattleMon_AddVar(BattleMon *mon, u32 varId, int data) { switch (varId) { case BMON_DATA_ATK: mon->atk += data; @@ -1388,13 +1388,13 @@ int ov12_022506D4(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerIdAttacker, if (moveRange == RANGE_ADJACENT_OPPONENTS) { int battlerId; int maxBattlers = BattleSystem_GetMaxBattlers(bsys); - OpponentData *opponent = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerIdAttacker); + OpponentData *opponent = BattleSystem_GetOpponentData(bsys, battlerIdAttacker); u8 flag = ov12_02261258(opponent); for (ctx->unk_217E = 0; ctx->unk_217E < maxBattlers; ctx->unk_217E++) { battlerId = ctx->turnOrder[ctx->unk_217E]; if (ctx->battleMons[battlerId].hp) { - opponent = BattleSystem_GetOpponentDataByBattlerId(bsys, battlerId); + opponent = BattleSystem_GetOpponentData(bsys, battlerId); if (((flag & 1) && !(ov12_02261258(opponent) & 1)) || (!(flag & 1) && (ov12_02261258(opponent) & 1))) { battlerIdTarget = battlerId; @@ -1630,7 +1630,7 @@ BOOL CheckTrainerMessage(BattleSystem *bsys, BATTLECONTEXT *ctx) { return FALSE; } - if (!(state & BATTLE_TYPE_SINGLES)) { + if (!(state & BATTLE_TYPE_TRAINER)) { return FALSE; } @@ -1753,8 +1753,8 @@ void BattleContext_Init(BATTLECONTEXT *ctx) { //unidentified states for different state machines ctx->stateFieldConditionUpdate = 0; - ctx->unk_18 = 0; - ctx->unk_20 = 0; + ctx->stateUpdateMonCondition = 0; + ctx->stateUpdateFieldConditionExtra = 0; ctx->unk_28 = 0; ctx->unk_30 = 0; ctx->unk_3C = 0; @@ -1836,8 +1836,8 @@ void InitSwitchWork(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId) { if (ctx->battleMons[i].status2 & (MaskOfFlagNo(battlerId) << STATUS2_ATTRACT_SHIFT)) { ctx->battleMons[i].status2 &= (MaskOfFlagNo(battlerId) << STATUS2_ATTRACT_SHIFT) ^ 0xFFFFFFFF; } - if ((ctx->battleMons[i].status2 & STATUS2_BINDING_ALL) && ctx->battleMons[i].unk88.battlerIdBinding == battlerId) { - ctx->battleMons[i].status2 &= ~STATUS2_BINDING_ALL; + if ((ctx->battleMons[i].status2 & STATUS2_BINDING_TURNS) && ctx->battleMons[i].unk88.battlerIdBinding == battlerId) { + ctx->battleMons[i].status2 &= ~STATUS2_BINDING_TURNS; } } @@ -1917,8 +1917,8 @@ void InitFaintedWork(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId) { if (ctx->battleMons[i].status2 & (MaskOfFlagNo(battlerId) << STATUS2_ATTRACT_SHIFT)) { ctx->battleMons[i].status2 &= (MaskOfFlagNo(battlerId) << STATUS2_ATTRACT_SHIFT) ^ 0xFFFFFFFF; } - if ((ctx->battleMons[i].status2 & STATUS2_BINDING_ALL) && ctx->battleMons[i].unk88.battlerIdBinding == battlerId) { - ctx->battleMons[i].status2 &= STATUS2_BINDING_ALL ^ 0xFFFFFFFF; + if ((ctx->battleMons[i].status2 & STATUS2_BINDING_TURNS) && ctx->battleMons[i].unk88.battlerIdBinding == battlerId) { + ctx->battleMons[i].status2 &= STATUS2_BINDING_TURNS ^ 0xFFFFFFFF; } } @@ -1982,8 +1982,8 @@ void ov12_02251710(BattleSystem *bsys, BATTLECONTEXT *ctx) { if ((ctx->battleMons[battlerId].status & STATUS_SLEEP) && (ctx->battleMons[battlerId].status2 & STATUS2_LOCKED_INTO_MOVE)) { UnlockBattlerOutOfCurrentMove(bsys, ctx, battlerId); } - if ((ctx->battleMons[battlerId].status & STATUS_SLEEP) && (ctx->battleMons[battlerId].status2 & STATUS2_RAGE)) { - ctx->battleMons[battlerId].status2 &= ~STATUS2_RAGE; + if ((ctx->battleMons[battlerId].status & STATUS_SLEEP) && (ctx->battleMons[battlerId].status2 & STATUS2_RAMPAGE_TURNS)) { + ctx->battleMons[battlerId].status2 &= ~STATUS2_RAMPAGE_TURNS; } } @@ -3202,7 +3202,7 @@ BOOL CantEscape(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, BATTLEMSG return TRUE; } - if ((ctx->battleMons[battlerId].status2 & (STATUS2_BINDING_ALL | STATUS2_MEAN_LOOK)) || (ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_INGRAIN)){ + if ((ctx->battleMons[battlerId].status2 & (STATUS2_BINDING_TURNS | STATUS2_MEAN_LOOK)) || (ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_INGRAIN)){ if (msg == NULL) { return TRUE; } @@ -3276,12 +3276,12 @@ BOOL BattleContext_CheckMoveImprisoned(BattleSystem *bsys, BATTLECONTEXT *ctx, i for (battlerIdCur = 0; battlerIdCur < maxBattlers; battlerIdCur++) { if ((side != BattleSystem_GetFieldSide(bsys, battlerIdCur)) && (ctx->battleMons[battlerIdCur].moveEffectFlags & MOVE_EFFECT_FLAG_IMPRISON_USER)) { - for (i = 0; i < LEARNED_MOVES_MAX; i++) { + for (i = 0; i < MAX_MON_MOVES; i++) { if (moveNo == ctx->battleMons[battlerIdCur].moves[i]) { break; } } - if (i != LEARNED_MOVES_MAX) { + if (i != MAX_MON_MOVES) { ret = TRUE; } } @@ -3459,7 +3459,7 @@ BOOL BattleContext_CheckMoveHealBlocked(BattleSystem *bsys, BATTLECONTEXT *ctx, void ov12_02252E30(BattleSystem *bsys, BATTLECONTEXT *ctx) { int i; - if (ctx->moveNoTemp == MOVE_LAST_RESORT || ctx->battleMons[ctx->battlerIdAttacker].unk88.lastResortCount == LEARNED_MOVES_MAX) { + if (ctx->moveNoTemp == MOVE_LAST_RESORT || ctx->battleMons[ctx->battlerIdAttacker].unk88.lastResortCount == MAX_MON_MOVES) { return; } @@ -3476,7 +3476,7 @@ void ov12_02252E30(BattleSystem *bsys, BATTLECONTEXT *ctx) { int GetBattlerLearnedMoveCount(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId) { int cnt; - for (cnt = 0; cnt < LEARNED_MOVES_MAX; cnt++) { + for (cnt = 0; cnt < MAX_MON_MOVES; cnt++) { if (ctx->battleMons[battlerId].moves[cnt] == MOVE_NONE) { break; } @@ -3797,7 +3797,7 @@ int TryAbilityOnEntry(BattleSystem *bsys, BATTLECONTEXT *ctx) { u32 moveStatus; for (battlerIdCheck = 0; battlerIdCheck < maxBattlers; battlerIdCheck++) { if (BattleSystem_GetFieldSide(bsys, battlerId) != BattleSystem_GetFieldSide(bsys, battlerIdCheck) && ctx->battleMons[battlerIdCheck].hp) { - for (index = 0; index < LEARNED_MOVES_MAX; index++) { + for (index = 0; index < MAX_MON_MOVES; index++) { moveNo = ctx->battleMons[battlerIdCheck].moves[index]; if (moveNo) { moveStatus = 0; @@ -3843,7 +3843,7 @@ int TryAbilityOnEntry(BattleSystem *bsys, BATTLECONTEXT *ctx) { for (battlerIdCheck = 0; battlerIdCheck < maxBattlers; battlerIdCheck++) { if (BattleSystem_GetFieldSide(bsys, battlerId) != BattleSystem_GetFieldSide(bsys, battlerIdCheck) && ctx->battleMons[battlerIdCheck].hp) { hp += ctx->battleMons[battlerIdCheck].hp; - for (index = 0; index < LEARNED_MOVES_MAX; index++) { + for (index = 0; index < MAX_MON_MOVES; index++) { moveNo = ctx->battleMons[battlerIdCheck].moves[index]; power = ctx->unk_334.moveData[moveNo].power; switch (power) { @@ -4455,13 +4455,13 @@ BOOL TryUseHeldItem(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId) { break; case HOLD_EFFECT_PP_RESTORE: //leppa berry int index; - for (index = 0; index < LEARNED_MOVES_MAX; index++) { + for (index = 0; index < MAX_MON_MOVES; index++) { if (ctx->battleMons[battlerId].moves[index] && !ctx->battleMons[battlerId].movePPCur[index]) { break; } } - if (index != LEARNED_MOVES_MAX) { - AddBattlerVar(&ctx->battleMons[battlerId], BMON_DATA_MOVE1PP + index, boost); + if (index != MAX_MON_MOVES) { + BattleMon_AddVar(&ctx->battleMons[battlerId], BMON_DATA_MOVE1PP + index, boost); CopyBattleMonToPartyMon(bsys, ctx, battlerId); ctx->moveTemp = ctx->battleMons[battlerId].moves[index]; script = 204; @@ -4782,13 +4782,13 @@ BOOL CheckUseHeldItem(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId, u32 break; case HOLD_EFFECT_PP_RESTORE: //leppa berry int index; - for (index = 0; index < LEARNED_MOVES_MAX; index++) { + for (index = 0; index < MAX_MON_MOVES; index++) { if (ctx->battleMons[battlerId].moves[index] && !ctx->battleMons[battlerId].movePPCur[index]) { break; } } - if (index != LEARNED_MOVES_MAX) { - AddBattlerVar(&ctx->battleMons[battlerId], BMON_DATA_MOVE1PP + index, boost); + if (index != MAX_MON_MOVES) { + BattleMon_AddVar(&ctx->battleMons[battlerId], BMON_DATA_MOVE1PP + index, boost); CopyBattleMonToPartyMon(bsys, ctx, battlerId); ctx->moveTemp = ctx->battleMons[battlerId].moves[index]; *script = 204; @@ -5189,7 +5189,7 @@ BOOL BattlerCanSwitch(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId) { return FALSE; } - if ((ctx->battleMons[battlerId].status2 & (STATUS2_BINDING_ALL | STATUS2_MEAN_LOOK)) || (ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_INGRAIN)) { + if ((ctx->battleMons[battlerId].status2 & (STATUS2_BINDING_TURNS | STATUS2_MEAN_LOOK)) || (ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_INGRAIN)) { ret = TRUE; } @@ -5270,7 +5270,7 @@ BOOL TryEatOpponentBerry(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId) int index; int max = 0; int maxIndex; - for (index = 0; index < LEARNED_MOVES_MAX; index++) { + for (index = 0; index < MAX_MON_MOVES; index++) { if (ctx->battleMons[ctx->battlerIdAttacker].moves[index]) { ppCalc = GetMoveMaxPP(ctx->battleMons[ctx->battlerIdAttacker].moves[index], ctx->battleMons[ctx->battlerIdAttacker].movePP[index]) - ctx->battleMons[ctx->battlerIdAttacker].movePPCur[index]; if (ppCalc > max) { @@ -5280,7 +5280,7 @@ BOOL TryEatOpponentBerry(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId) } } - AddBattlerVar(&ctx->battleMons[ctx->battlerIdAttacker], BMON_DATA_MOVE1PP + maxIndex, mod); + BattleMon_AddVar(&ctx->battleMons[ctx->battlerIdAttacker], BMON_DATA_MOVE1PP + maxIndex, mod); CopyBattleMonToPartyMon(bsys, ctx, ctx->battlerIdAttacker); ctx->moveTemp = ctx->battleMons[ctx->battlerIdAttacker].moves[maxIndex]; script = 204; @@ -5510,7 +5510,7 @@ BOOL TryFling(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId) { int index; int max = 0; int maxIndex; - for (index = 0; index < LEARNED_MOVES_MAX; index++) { + for (index = 0; index < MAX_MON_MOVES; index++) { if (ctx->battleMons[ctx->battlerIdTarget].moves[index]) { ppCalc = GetMoveMaxPP(ctx->battleMons[ctx->battlerIdTarget].moves[index], ctx->battleMons[ctx->battlerIdTarget].movePP[index]) - ctx->battleMons[ctx->battlerIdTarget].movePPCur[index]; if (ppCalc > max) { @@ -5520,7 +5520,7 @@ BOOL TryFling(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId) { } } if (max) { - AddBattlerVar(&ctx->battleMons[ctx->battlerIdTarget], BMON_DATA_MOVE1PP + maxIndex, mod); + BattleMon_AddVar(&ctx->battleMons[ctx->battlerIdTarget], BMON_DATA_MOVE1PP + maxIndex, mod); CopyBattleMonToPartyMon(bsys, ctx, ctx->battlerIdTarget); ctx->moveTemp = ctx->battleMons[ctx->battlerIdTarget].moves[maxIndex]; ctx->flingScript = 204; @@ -5715,7 +5715,7 @@ BOOL TryFling(BattleSystem *bsys, BATTLECONTEXT *ctx, int battlerId) { void ov12_022565E0(BattleSystem *bsys, BATTLECONTEXT *ctx) { if (GetBattlerHeldItemEffect(ctx, ctx->battlerIdAttacker) == HOLD_EFFECT_BOOST_REPEATED) { - if (!(ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_RAGE) && + if (!(ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_RAMPAGE_TURNS) && !(ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_UPROAR) && !(ctx->battleStatus & BATTLE_STATUS_CHARGE_MOVE_HIT) && !(ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_LOCKED_INTO_MOVE)) { @@ -5739,7 +5739,7 @@ void ov12_02256694(BattleSystem *bsys, BATTLECONTEXT *ctx) { ctx->moveNoMetronome[ctx->battlerIdAttacker] == ctx->moveNoTemp && ctx->battleMons[ctx->battlerIdAttacker].unk88.metronomeTurns && !(ctx->selfTurnData[ctx->battlerIdAttacker].rolloutCount) && - !(ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_RAGE) && + !(ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_RAMPAGE_TURNS) && !(ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_UPROAR) && !(ctx->battleStatus & BATTLE_STATUS_CHARGE_MOVE_HIT) && !(ctx->battleMons[ctx->battlerIdAttacker].status2 & STATUS2_LOCKED_INTO_MOVE)) { @@ -5781,7 +5781,7 @@ BOOL Battler_CanSelectAction(BATTLECONTEXT *ctx, int battlerId) { BOOL ret = TRUE; if ((ctx->battleMons[battlerId].status2 & STATUS2_RECHARGE) || - (ctx->battleMons[battlerId].status2 & STATUS2_RAGE) || + (ctx->battleMons[battlerId].status2 & STATUS2_RAMPAGE_TURNS) || (ctx->battleMons[battlerId].status2 & STATUS2_UPROAR) || (ctx->battleMons[battlerId].status2 & STATUS2_LOCKED_INTO_MOVE)) { ret = FALSE; @@ -5792,7 +5792,7 @@ BOOL Battler_CanSelectAction(BATTLECONTEXT *ctx, int battlerId) { void ov12_022567D4(BattleSystem *bsys, BATTLECONTEXT *ctx, Pokemon *mon) { PlayerProfile *profile = BattleSystem_GetPlayerProfile(bsys, BATTLER_PLAYER); - int a3 = ov12_0223AB60(bsys); + int location = BattleSystem_GetLocation(bsys); int terrain = BattleSystem_GetTerrainId(bsys); int ballId; @@ -5802,7 +5802,7 @@ void ov12_022567D4(BattleSystem *bsys, BATTLECONTEXT *ctx, Pokemon *mon) { ballId = ctx->itemTemp; } - sub_020720FC(mon, profile, ballId, a3, terrain, HEAP_ID_BATTLE); + sub_020720FC(mon, profile, ballId, location, terrain, HEAP_ID_BATTLE); } u8 ov12_0225682C(BATTLECONTEXT *ctx, int battlerId) { @@ -7181,7 +7181,7 @@ static u8 Battler_GetType(BATTLECONTEXT *ctx, int battlerId, int var) { } static void ov12_02258584(BATTLECONTEXT *ctx, u8 battlerId) { - for (int i = 0; i < LEARNED_MOVES_MAX; i++) { + for (int i = 0; i < MAX_MON_MOVES; i++) { ctx->unk_334.unk1C[battlerId][i] = 0; } } @@ -7345,4 +7345,3 @@ static int GetDynamicMoveType(BattleSystem *bsys, BATTLECONTEXT *ctx, int battle return type; } - diff --git a/src/encounter.c b/src/encounter.c index ef74f6b107..a38a2cab75 100644 --- a/src/encounter.c +++ b/src/encounter.c @@ -40,6 +40,8 @@ #include "field_warp_tasks.h" #include "unk_02058034.h" #include "pokedex_util.h" +#include "constants/battle.h" +#include "constants/game_stat.h" static void sub_02051660(FieldSystem *fsys, BATTLE_SETUP *setup); @@ -94,7 +96,7 @@ static BOOL sub_020506F4(ENCOUNTER *work, FieldSystem *fsys) { } static void sub_02050724(BATTLE_SETUP *setup, FieldSystem *fsys) { - if (!(setup->flags & (1 << 31))) { + if (!(setup->flags & BATTLE_TYPE_DEBUG)) { sub_0205239C(setup, fsys); } } @@ -198,7 +200,7 @@ static BOOL sub_020508B8(TaskManager *man) { case 3: sub_0205087C(encounter->setup->winFlag, fsys); sub_02052444(encounter->setup, fsys); - GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), 20); + GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), GAME_STAT_UNK20); sub_020506F4(encounter, fsys); sub_020552A4(man); (*state)++; @@ -226,7 +228,7 @@ static BOOL sub_02050960(TaskManager *man) { case 1: sub_0205087C(encounter->setup->winFlag, fsys); sub_02052444(encounter->setup, fsys); - GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), 20); + GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), GAME_STAT_UNK20); sub_020506F4(encounter, fsys); (*state)++; break; @@ -690,26 +692,26 @@ void SetupAndStartTutorialBattle(TaskManager *man) { } void SetupAndStartTrainerBattle(TaskManager *man, u32 opponentTrainer1, u32 opponentTrainer2, u32 followerTrainerNum, u32 a4, u32 a5, HeapID heapId, u32 *winFlag) { - u32 battleFlags; + u32 battleType; BATTLE_SETUP *setup; FieldSystem *fsys = TaskManager_GetFieldSystem(man); if (opponentTrainer2 != 0 && opponentTrainer1 != opponentTrainer2) { if (followerTrainerNum == 0) { - battleFlags = 0x13; + battleType = (BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLES | BATTLE_TYPE_INGAME_PARTNER); } else { - battleFlags = 0x4b; + battleType = 0x4b; } } else if (opponentTrainer1 == opponentTrainer2) { - battleFlags = 3; + battleType = 3; } else { - battleFlags = 1; + battleType = 1; if (a4) { - battleFlags |= (1 << 11); + battleType |= BATTLE_TYPE_11; } } - setup = BattleSetup_New(HEAP_ID_FIELD, battleFlags); + setup = BattleSetup_New(HEAP_ID_FIELD, battleType); BattleSetup_InitFromFsys(setup, fsys); setup->trainerId[1] = opponentTrainer1; @@ -718,12 +720,12 @@ void SetupAndStartTrainerBattle(TaskManager *man, u32 opponentTrainer1, u32 oppo EnemyTrainerSet_Init(setup, fsys->savedata, heapId); - GameStats_Inc(Save_GameStats_Get(fsys->savedata), 9); + GameStats_Inc(Save_GameStats_Get(fsys->savedata), GAME_STAT_UNK9); if (a5) { - if (battleFlags & 8) { + if (battleType & BATTLE_TYPE_MULTI) { setup->unk1CE = 0; - } else if (!(battleFlags & 2)) { + } else if (!(battleType & BATTLE_TYPE_DOUBLES)) { setup->unk1CD = 0; } } @@ -733,13 +735,13 @@ void SetupAndStartTrainerBattle(TaskManager *man, u32 opponentTrainer1, u32 oppo static BOOL sub_020508B8(TaskManager *man); -void sub_02051428(TaskManager *man, void *a1, int battleFlags) { +void sub_02051428(TaskManager *man, void *a1, int battleType) { FieldSystem *fsys; ENCOUNTER *encounter; BATTLE_SETUP *setup; fsys = TaskManager_GetFieldSystem(man); - setup = BattleSetup_New(HEAP_ID_FIELD, battleFlags); + setup = BattleSetup_New(HEAP_ID_FIELD, battleType); sub_020522F0(setup, fsys, a1); @@ -747,13 +749,13 @@ void sub_02051428(TaskManager *man, void *a1, int battleFlags) { TaskManager_Call(man, sub_020508B8, encounter); } -static int sub_02051474(void *a0, int battleFlags) { +static int sub_02051474(void *a0, int battleType) { int var = sub_02029264(a0); int mode; - if (battleFlags & 8) { + if (battleType & BATTLE_TYPE_MULTI) { mode = 14; - } else if (battleFlags & 2) { + } else if (battleType & BATTLE_TYPE_DOUBLES) { mode = 7; } else { mode = 0; @@ -821,32 +823,32 @@ static BOOL sub_02051540(TaskManager *man) { return FALSE; } -void sub_02051598(FieldSystem *fsys, void *a1, int battleFlags) { +void sub_02051598(FieldSystem *fsys, void *a1, int battleType) { ENCOUNTER *encounter; BATTLE_SETUP *setup; int var; - setup = BattleSetup_New(HEAP_ID_FIELD, battleFlags); + setup = BattleSetup_New(HEAP_ID_FIELD, battleType); sub_020522F0(setup, fsys, a1); sub_0202FBF0(fsys->savedata, HEAP_ID_FIELD, &var); - setup->unk1B2 = sub_02051474(fsys->unkA4, battleFlags); + setup->unk1B2 = sub_02051474(fsys->unkA4, battleType); encounter = Encounter_New(setup, sub_020517E8(setup), sub_020517FC(setup), NULL); FieldSys_CreateTask(fsys, sub_02051540, encounter); } -void sub_020515FC(FieldSystem *fsys, PARTY *party, int battleFlags) { +void sub_020515FC(FieldSystem *fsys, PARTY *party, int battleType) { ENCOUNTER *encounter; BATTLE_SETUP *setup; int var; - setup = BattleSetup_New(HEAP_ID_FIELD, battleFlags); + setup = BattleSetup_New(HEAP_ID_FIELD, battleType); sub_020520B0(setup, fsys, party, NULL); sub_0202FBF0(fsys->savedata, HEAP_ID_FIELD, &var); - setup->unk1B2 = sub_02051474(fsys->unkA4, battleFlags); + setup->unk1B2 = sub_02051474(fsys->unkA4, battleType); encounter = Encounter_New(setup, sub_020517E8(setup), sub_020517FC(setup), NULL); @@ -855,34 +857,34 @@ void sub_020515FC(FieldSystem *fsys, PARTY *party, int battleFlags) { static void sub_02051660(FieldSystem *fsys, BATTLE_SETUP *setup) { Pokemon *mon; - u32 battleFlags = setup->flags; + u32 battleType = setup->flags; int winFlag = setup->winFlag; - if (battleFlags & 4 || battleFlags & 0x80) { + if (battleType & BATTLE_TYPE_LINK || battleType & BATTLE_TYPE_TOWER) { return; } - if (battleFlags == 0 || battleFlags == 0x100 || battleFlags == 0x4A) { + if (battleType == 0 || battleType == BATTLE_TYPE_8 || battleType == (BATTLE_TYPE_DOUBLES | BATTLE_TYPE_MULTI | BATTLE_TYPE_6)) { if (winFlag == 1) { - GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), 9); + GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), GAME_STAT_UNK9); } else if (winFlag == 4) { mon = GetPartyMonByIndex(setup->party[1], 0); - if (Pokedex_ConvertToCurrentDexNo(0, GetMonData(mon, 5, NULL)) != 0) { - GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), 10); + if (Pokedex_ConvertToCurrentDexNo(0, GetMonData(mon, MON_DATA_SPECIES, NULL)) != 0) { + GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), GAME_STAT_UNK10); } else { - GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), 11); + GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), GAME_STAT_UNK11); } } - } else if ((battleFlags & 1) || (battleFlags & 0x10)) { + } else if ((battleType & BATTLE_TYPE_TRAINER) || (battleType & BATTLE_TYPE_INGAME_PARTNER)) { if (winFlag == 1) { - GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), 12); + GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), GAME_STAT_UNK12); } - } else if ((battleFlags & 0x20 || battleFlags & 0x200) && winFlag == 4) { + } else if ((battleType & BATTLE_TYPE_SAFARI || battleType & BATTLE_TYPE_PAL_PARK) && winFlag == 4) { mon = GetPartyMonByIndex(setup->party[1], 0); - if (Pokedex_ConvertToCurrentDexNo(0, GetMonData(mon, 5, NULL)) != 0) { - GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), 10); + if (Pokedex_ConvertToCurrentDexNo(0, GetMonData(mon, MON_DATA_SPECIES, NULL)) != 0) { + GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), GAME_STAT_UNK10); } else { - GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), 11); + GameStats_AddSpecial(Save_GameStats_Get(fsys->savedata), GAME_STAT_UNK11); } } } diff --git a/src/voltorb_flip/voltorb_flip.c b/src/voltorb_flip/voltorb_flip.c index f57ab2b734..0341511edf 100644 --- a/src/voltorb_flip/voltorb_flip.c +++ b/src/voltorb_flip/voltorb_flip.c @@ -26,6 +26,7 @@ #include "unk_02025154.h" #include "bg_window.h" #include "constants/sndseq.h" +#include "constants/game_stat.h" #include "msgdata/msg/msg_0039.h" #include "voltorb_flip/voltorb_flip.h" #include "voltorb_flip/voltorb_flip_data.h" @@ -2054,7 +2055,7 @@ static void ov122_021E8094(OVY_MANAGER *man) { sub_02002B8C(TRUE); Main_SetVBlankIntrCB((GFIntrCB)ov122_021E8004, work); - GameStats_AddSpecial(Save_GameStats_Get(args->savedata), 6); + GameStats_AddSpecial(Save_GameStats_Get(args->savedata), GAME_STAT_UNK6); } static void FreeOverlayData(OVY_MANAGER *man) {