diff --git a/include/constants/battle.h b/include/constants/battle.h index b919210923..c6fc9f39ba 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -50,6 +50,7 @@ enum BattlerBootState { #define BATTLE_TYPE_NO_ITEMS (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER) #define BATTLE_TYPE_AI_PARTNER (BATTLE_TYPE_DOUBLES | BATTLE_TYPE_2vs2 | BATTLE_TYPE_AI) #define BATTLE_TYPE_TRAINER_WITH_AI_PARTNER (BATTLE_TYPE_TRAINER | BATTLE_TYPE_AI_PARTNER) +#define BATTLE_TYPE_FRONTIER_WITH_AI_PARTNER (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_TRAINER_WITH_AI_PARTNER) #define BATTLE_TYPE_SPECIAL_WILD (BATTLE_TYPE_SAFARI | BATTLE_TYPE_ROAMER | BATTLE_TYPE_PAL_PARK | BATTLE_TYPE_CATCH_TUTORIAL) #define BATTLE_TYPE_NO_OBEDIENCE_CHECK (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER) #define BATTLE_TYPE_FORCED_SET_MODE (BATTLE_TYPE_DOUBLES | BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER) diff --git a/include/constants/battle/battle_io.h b/include/constants/battle/battle_io.h new file mode 100644 index 0000000000..7303b2ddb1 --- /dev/null +++ b/include/constants/battle/battle_io.h @@ -0,0 +1,17 @@ +#ifndef POKEPLATINUM_CONSTANTS_BATTLE_BATTLE_IO_H +#define POKEPLATINUM_CONSTANTS_BATTLE_BATTLE_IO_H + +enum BattleIOCommand { + BTLIOCMD_SHOW_BATTLE_START_PARTY_GAUGE = 48, + BTLIOCMD_HIDE_BATTLE_START_PARTY_GAUGE, + BTLIOCMD_SHOW_PARTY_GAUGE, + BTLIOCMD_HIDE_PARTY_GAUGE, + BTLIOCMD_LOAD_PARTY_GAUGE_GRAPHICS, + BTLIOCMD_FREE_PARTY_GAUGE_GRAPHICS, +}; + +enum BattleIORecipient { + BTLIO_RECIPIENT_ENQUEUE = 1, +}; + +#endif // POKEPLATINUM_CONSTANTS_BATTLE_BATTLE_IO_H diff --git a/include/enums.h b/include/enums.h index 66f7bc77d0..40bd0ee27f 100644 --- a/include/enums.h +++ b/include/enums.h @@ -268,32 +268,6 @@ typedef enum { UnkEnum_ov66_022324D0_12 = UnkEnum_ov66_022324D0_02 + 1, } UnkEnum_ov66_022324D0; -typedef enum { - UnkEnum_ov16_0226D194_00, - UnkEnum_ov16_0226D194_01, -} UnkEnum_ov16_0226D194; - -typedef enum { - UnkEnum_ov16_0226D220_00, - UnkEnum_ov16_0226D220_01, -} UnkEnum_ov16_0226D220; - -typedef enum { - UnkEnum_ov16_0226D194_1_00, - UnkEnum_ov16_0226D194_1_01, -} UnkEnum_ov16_0226D194_1; - -typedef enum { - UnkEnum_ov16_0226D194_2_00, - UnkEnum_ov16_0226D194_2_01, -} UnkEnum_ov16_0226D194_2; - -typedef enum { - UnkEnum_ov16_0226D194_3_00, - UnkEnum_ov16_0226D194_3_01, - UnkEnum_ov16_0226D194_3_02, -} UnkEnum_ov16_0226D194_3; - enum { GX_BLEND_BGALL = GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3, GX_BLEND_ALL = GX_BLEND_BGALL | GX_BLEND_PLANEMASK_OBJ | GX_BLEND_PLANEMASK_BD, diff --git a/include/overlay016/ov16_0223DF00.h b/include/overlay016/ov16_0223DF00.h index 313b51b9ef..cb84725f58 100644 --- a/include/overlay016/ov16_0223DF00.h +++ b/include/overlay016/ov16_0223DF00.h @@ -37,6 +37,8 @@ #include "overlay016/struct_ov16_02268A14_decl.h" #include "overlay016/struct_ov16_0226D160_decl.h" +#include "overlay016/ov16_0226D094.h" + #include "enums.h" #define ENEMY_IN_SLOT_RIGHT 0 @@ -84,8 +86,8 @@ CellTransferStateData * ov16_0223E010(BattleSystem * param0); AnimationResourceCollection * ov16_0223E018(BattleSystem * param0); UnkStruct_ov16_02268520 * ov16_0223E020(BattleSystem * param0, int param1); UnkStruct_ov16_02268A14 * ov16_0223E02C(BattleSystem * param0); -UnkStruct_ov16_0226D160 * ov16_0223E034(BattleSystem * param0, UnkEnum_ov16_0226D194 param1); -void ov16_0223E040(BattleSystem * param0, UnkEnum_ov16_0226D194 param1, UnkStruct_ov16_0226D160 * param2); +PartyGauge * ov16_0223E034(BattleSystem * param0, enum PartyGaugeSide param1); +void ov16_0223E040(BattleSystem * param0, enum PartyGaugeSide param1, PartyGauge * param2); UnkStruct_0200C440 * ov16_0223E04C(BattleSystem * param0); UnkStruct_0200C440 * ov16_0223E054(BattleSystem * param0); MessageLoader * BattleSystem_MessageLoader(BattleSystem * param0); diff --git a/include/overlay016/ov16_0225CBB8.h b/include/overlay016/ov16_0225CBB8.h index 99f487bbc7..d981b414be 100644 --- a/include/overlay016/ov16_0225CBB8.h +++ b/include/overlay016/ov16_0225CBB8.h @@ -27,7 +27,7 @@ #include "overlay016/struct_ov16_0225C454.h" #include "overlay016/struct_ov16_0225C468.h" #include "overlay016/struct_ov16_0225C65C.h" -#include "overlay016/struct_ov16_0225C840.h" +#include "struct_defs/battle_io.h" #include "overlay016/struct_ov16_0225C9F0.h" #include "overlay016/struct_ov16_0225CA4C.h" #include "overlay016/struct_ov16_0225CA60.h" @@ -81,10 +81,42 @@ void ov16_0225DF6C(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0 void ov16_0225E008(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C468 * param2); void ov16_0225E0BC(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C65C * param2); void ov16_0225E0F4(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_022664F8 * param2); -void ov16_0225E134(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2); -void ov16_0225E17C(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2); -void ov16_0225E1B4(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2); -void ov16_0225E200(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2); + +/** + * @brief Show the start-of-battle party gauge. + * + * @param battleSys + * @param battlerData + * @param partyGauge + */ +void Battler_ShowBattleStartPartyGauge(BattleSystem *battleSys, BattlerData *battlerData, PartyGaugeData *partyGauge); + +/** + * @brief Hide the start-of-battle party gauge. + * + * @param battleSys + * @param battlerData + * @param partyGauge + */ +void Battler_HideBattleStartPartyGauge(BattleSystem *battleSys, BattlerData *battlerData, PartyGaugeData *partyGauge); + +/** + * @brief Show the mid-battle party gauge. + * + * @param battleSys + * @param battlerData + * @param partyGauge + */ +void Battler_ShowPartyGauge(BattleSystem *battleSys, BattlerData *battlerData, PartyGaugeData *partyGauge); + +/** + * @brief Hide the mid-battle party gauge. + * + * @param battleSys + * @param battlerData + * @param partyGauge + */ +void Battler_HidePartyGauge(BattleSystem *battleSys, BattlerData *battlerData, PartyGaugeData *partyGauge); void ov16_0225E23C(BattleSystem * param0, BattlerData * param1); void ov16_0225E294(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_02265BBC * param2); void ov16_0225E2C8(BattleSystem * param0, BattlerData * param1); diff --git a/include/overlay016/ov16_0226485C.h b/include/overlay016/ov16_0226485C.h index 4e903b100f..06cabc9a5b 100644 --- a/include/overlay016/ov16_0226485C.h +++ b/include/overlay016/ov16_0226485C.h @@ -64,12 +64,54 @@ void BattleIO_SetMosaic(BattleSystem * param0, int param1, int param2, int param void BattleIO_ChangeWeatherForm(BattleSystem * param0, int param1); void BattleIO_UpdateBG(BattleSystem * param0, int param1); void BattleIO_ClearTouchScreen(BattleSystem * param0, int param1); -void BattleIO_ShowBattleStartPartyGauge(BattleSystem * param0, int param1); -void BattleIO_HideBattleStartPartyGauge(BattleSystem * param0, int param1); -void BattleIO_ShowPartyGauge(BattleSystem * param0, int param1); -void BattleIO_HidePartyGauge(BattleSystem * param0, int param1); -void BattleIO_LoadPartyGaugeGraphics(BattleSystem * param0); -void BattleIO_FreePartyGaugeGraphics(BattleSystem * param0); + +/** + * @brief Push a command to the I/O queue to show the party gauge at the start of a battle for a + * given battler. + * + * @param battleSys + * @param battler + */ +void BattleIO_ShowBattleStartPartyGauge(BattleSystem *battleSys, int battler); + +/** + * @brief Push a command to the I/O queue to hide the party gauge at the start of a battle for a + * given battler. + * + * @param battleSys + * @param battler + */ +void BattleIO_HideBattleStartPartyGauge(BattleSystem *battleSys, int battler); + +/** + * @brief Push a command to the I/O queue to show the party gauge for a given battler. + * + * @param battleSys + * @param battler + */ +void BattleIO_ShowPartyGauge(BattleSystem *battleSys, int battler); + +/** + * @brief Push a command to the I/O queue to hide the party gauge for a given battler. + * + * @param battleSys + * @param battler + */ +void BattleIO_HidePartyGauge(BattleSystem *battleSys, int battler); + +/** + * @brief Push a command to the I/O queue to load the graphics resources for the party gauge. + * + * @param battleSys + */ +void BattleIO_LoadPartyGaugeGraphics(BattleSystem *battleSys); + +/** + * @brief Push a command to the I/O queue to free the graphics resources for the party gauge. + * + * @param battleSys + */ +void BattleIO_FreePartyGaugeGraphics(BattleSystem *battleSys); void BattleIO_IncrementRecord(BattleSystem * param0, int param1, int param2, int param3); void BattleIO_LinkWaitMessage(BattleSystem *battleSys, int battler); void BattleIO_RestoreSprite(BattleSystem * param0, BattleContext * param1, int param2); @@ -83,7 +125,7 @@ void BattleIO_PlayMoveHitSoundEffect(BattleSystem * param0, BattleContext * para void BattleIO_PlayMusic(BattleSystem * param0, int param1, int param2); void BattleIO_SubmitResult(BattleSystem * param0); void BattleIO_ClearMessageBox(BattleSystem * param0); -void ov16_02266ABC(BattleSystem * param0, int param1, int param2); +void ClearCommand(BattleSystem * param0, int param1, int param2); BOOL ov16_02266AE4(BattleSystem * param0, void * param1); void ov16_02266B78(BattleSystem * param0, BattleContext * param1, UnkStruct_ov16_02265BBC * param2, int param3, int param4, int param5, int param6, u16 param7); diff --git a/include/overlay016/ov16_0226D094.h b/include/overlay016/ov16_0226D094.h index 9630cfbef2..68cf9327b3 100644 --- a/include/overlay016/ov16_0226D094.h +++ b/include/overlay016/ov16_0226D094.h @@ -8,12 +8,38 @@ #include "enums.h" +enum PartyGaugeSide { + PARTY_GAUGE_OURS, + PARTY_GAUGE_THEIRS, +}; + +enum ShowPartyGaugeType { + SHOW_PARTY_GAUGE_BATTLE_START, + SHOW_PARTY_GAUGE_MID_BATTLE, +}; + +enum HidePartyGaugeType { + HIDE_PARTY_GAUGE_BATTLE_START, + HIDE_PARTY_GAUGE_MID_BATTLE, +}; + +enum PartyGaugePosition { + PARTY_GAUGE_POSITION_HIGH, + PARTY_GAUGE_POSITION_MIDDLE, + PARTY_GAUGE_POSITION_LOW, +}; + +enum HideArrowType { + HIDE_ARROW_FADE_AND_SCROLL, + HIDE_ARROW_FADE_IN_PLACE, +}; + void ov16_0226D094(CellTransferStateData * param0, AnimationResourceCollection * param1, PaletteSys * param2); void ov16_0226D12C(AnimationResourceCollection * param0); -UnkStruct_ov16_0226D160 * ov16_0226D194(u8 param0[], UnkEnum_ov16_0226D194 param1, UnkEnum_ov16_0226D194_1 param2, UnkEnum_ov16_0226D194_3 param3, CellTransferStateData * param4, AnimationResourceCollection * param5); -BOOL ov16_0226D1FC(UnkStruct_ov16_0226D160 * param0); -void ov16_0226D220(UnkStruct_ov16_0226D160 * param0, UnkEnum_ov16_0226D220 param1, UnkEnum_ov16_0226D194_2 param2); -BOOL ov16_0226D258(UnkStruct_ov16_0226D160 * param0); -void ov16_0226D27C(UnkStruct_ov16_0226D160 * param0); +PartyGauge * ov16_0226D194(u8 param0[], enum PartyGaugeSide param1, enum ShowPartyGaugeType param2, enum PartyGaugePosition param3, CellTransferStateData * param4, AnimationResourceCollection * param5); +BOOL ov16_0226D1FC(PartyGauge * param0); +void ov16_0226D220(PartyGauge * param0, enum HideArrowType param1, enum HidePartyGaugeType param2); +BOOL ov16_0226D258(PartyGauge * param0); +void ov16_0226D27C(PartyGauge * param0); #endif // POKEPLATINUM_OV16_0226D094_H diff --git a/include/overlay016/struct_ov16_0225BFFC_t.h b/include/overlay016/struct_ov16_0225BFFC_t.h index 77f0bb2d8f..0534bdb766 100644 --- a/include/overlay016/struct_ov16_0225BFFC_t.h +++ b/include/overlay016/struct_ov16_0225BFFC_t.h @@ -12,6 +12,8 @@ #include "overlay016/struct_ov16_022674C4.h" #include "overlay016/struct_ov16_0226C378.h" +#define DATA_BUF_SIZE 256 + struct BattlerData { UnkStruct_ov16_0225BFFC_sub1 unk_00; CellActorData * unk_18; @@ -23,8 +25,8 @@ struct BattlerData { BallRotation * unk_84; UnkStruct_ov12_02223764 * unk_88; void * unk_8C; - u8 unk_90[256]; - u8 unk_190; + u8 data[DATA_BUF_SIZE]; + u8 battler; u8 battlerType; u8 bootState; u8 unk_193; diff --git a/include/overlay016/struct_ov16_0225C840.h b/include/overlay016/struct_ov16_0225C840.h deleted file mode 100644 index 2fffa0f9d4..0000000000 --- a/include/overlay016/struct_ov16_0225C840.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_OV16_0225C840_H -#define POKEPLATINUM_STRUCT_OV16_0225C840_H - -typedef struct { - u8 unk_00; - u8 padding_01; - u8 unk_02[6]; -} UnkStruct_ov16_0225C840; - -#endif // POKEPLATINUM_STRUCT_OV16_0225C840_H diff --git a/include/overlay016/struct_ov16_0225E134.h b/include/overlay016/struct_ov16_0225E134.h deleted file mode 100644 index 16050abda6..0000000000 --- a/include/overlay016/struct_ov16_0225E134.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_OV16_0225E134_H -#define POKEPLATINUM_STRUCT_OV16_0225E134_H - -#include "struct_decls/battle_system.h" - -typedef struct { - BattleSystem * unk_00; - u8 unk_04; - u8 unk_05; - u8 unk_06; - u8 unk_07; - u8 unk_08[6]; - u8 unk_0E; - u8 unk_0F[1]; -} UnkStruct_ov16_0225E134; - -#endif // POKEPLATINUM_STRUCT_OV16_0225E134_H diff --git a/include/overlay016/struct_ov16_0226D160_decl.h b/include/overlay016/struct_ov16_0226D160_decl.h index 0dd5dc5b80..3d294563d7 100644 --- a/include/overlay016/struct_ov16_0226D160_decl.h +++ b/include/overlay016/struct_ov16_0226D160_decl.h @@ -1,6 +1,6 @@ #ifndef POKEPLATINUM_STRUCT_OV16_0226D160_DECL_H #define POKEPLATINUM_STRUCT_OV16_0226D160_DECL_H -typedef struct UnkStruct_ov16_0226D160_t UnkStruct_ov16_0226D160; +typedef struct PartyGauge PartyGauge; #endif // POKEPLATINUM_STRUCT_OV16_0226D160_DECL_H diff --git a/include/struct_defs/battle_io.h b/include/struct_defs/battle_io.h new file mode 100644 index 0000000000..7d568956ee --- /dev/null +++ b/include/struct_defs/battle_io.h @@ -0,0 +1,20 @@ +#ifndef POKEPLATINUM_STRUCT_BATTLE_IO_H +#define POKEPLATINUM_STRUCT_BATTLE_IO_H + +#include "constants/pokemon.h" + +enum PartyGaugeBallStatus { + BALL_STATUS_NO_MON = 0, + BALL_STATUS_MON_ALIVE, + BALL_STATUS_MON_FAINTED, + BALL_STATUS_HAS_STATUS_CONDITION, +}; + +typedef struct PartyGaugeData { + u8 command; + u8 padding_01; + + u8 status[MAX_PARTY_SIZE]; +} PartyGaugeData; + +#endif // POKEPLATINUM_STRUCT_BATTLE_IO_H diff --git a/include/struct_defs/battle_system.h b/include/struct_defs/battle_system.h index 76f1dfbdc6..3732bcf726 100644 --- a/include/struct_defs/battle_system.h +++ b/include/struct_defs/battle_system.h @@ -77,7 +77,7 @@ struct BattleSystem { TrainerData trainers[4]; UnkStruct_ov16_02268520 unk_17C[2]; UnkStruct_ov16_02268A14 * unk_198; - UnkStruct_ov16_0226D160 * unk_19C[2]; + PartyGauge * unk_19C[2]; UnkStruct_0200C440 * unk_1A4; UnkStruct_0200C440 * unk_1A8; void * unk_1AC; diff --git a/src/overlay016/ov16_0223DF00.c b/src/overlay016/ov16_0223DF00.c index 62ab361cf0..298e02431d 100644 --- a/src/overlay016/ov16_0223DF00.c +++ b/src/overlay016/ov16_0223DF00.c @@ -331,12 +331,12 @@ UnkStruct_ov16_02268A14 * ov16_0223E02C (BattleSystem * param0) return param0->unk_198; } -UnkStruct_ov16_0226D160 * ov16_0223E034 (BattleSystem * param0, UnkEnum_ov16_0226D194 param1) +PartyGauge * ov16_0223E034 (BattleSystem * param0, enum PartyGaugeSide param1) { return param0->unk_19C[param1]; } -void ov16_0223E040 (BattleSystem * param0, UnkEnum_ov16_0226D194 param1, UnkStruct_ov16_0226D160 * param2) +void ov16_0223E040 (BattleSystem * param0, enum PartyGaugeSide param1, PartyGauge * param2) { param0->unk_19C[param1] = param2; } diff --git a/src/overlay016/ov16_0225BFFC.c b/src/overlay016/ov16_0225BFFC.c index a18ef51804..cc86faa2d5 100644 --- a/src/overlay016/ov16_0225BFFC.c +++ b/src/overlay016/ov16_0225BFFC.c @@ -1,6 +1,8 @@ #include #include +#include "constants/battle/battle_io.h" + #include "struct_decls/struct_02002F38_decl.h" #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" @@ -40,7 +42,7 @@ #include "overlay016/struct_ov16_0225C468.h" #include "overlay016/struct_ov16_0225C65C.h" #include "overlay016/struct_ov16_0225C684.h" -#include "overlay016/struct_ov16_0225C840.h" +#include "struct_defs/battle_io.h" #include "overlay016/struct_ov16_0225C988.h" #include "overlay016/struct_ov16_0225C9F0.h" #include "overlay016/struct_ov16_0225CA14.h" @@ -154,7 +156,7 @@ static void ov16_0225CA4C(BattleSystem * param0, BattlerData * param1); static void ov16_0225CA60(BattleSystem * param0, BattlerData * param1); static void ov16_0225CA74(BattleSystem * param0, BattlerData * param1); static void ov16_0225CB80(BattleSystem * param0, BattlerData * param1); -static void ov16_0225CBB0(BattlerData * param0); +static void ZeroDataBuffer(BattlerData * param0); extern const u8 Unk_ov16_0226F174[]; @@ -166,7 +168,7 @@ BattlerData * ov16_0225BFFC (BattleSystem * param0, UnkStruct_ov16_0223C2C0 * pa v0 = Heap_AllocFromHeap(5, sizeof(BattlerData)); MI_CpuClearFast(v0, sizeof(BattlerData)); - v0->unk_190 = param1->unk_00; + v0->battler = param1->unk_00; v0->battlerType = param1->unk_01; v0->unk_1A0 = NARC_ctor(NARC_INDEX_POKETOOL__POKE_EDIT__PL_POKE_DATA, 5); @@ -189,7 +191,7 @@ void ov16_0225C038 (BattleSystem * param0, BattlerData * param1, int param2, int v0.type = Unk_ov16_0226F174[param1->battlerType]; v0.heapID = 5; v0.mode = 4; - v0.target = param1->unk_190; + v0.target = param1->battler; v0.ballID = param2; v0.cellActorSys = ov16_0223E010(param0); v0.paletteSys = BattleSystem_PaletteSys(param0); @@ -253,12 +255,12 @@ static const UnkFuncPtr_ov16_0226F068 Unk_ov16_0226F068[] = { ov16_0225C684, ov16_0225C77C, ov16_0225C79C, - ov16_0225C840, - ov16_0225C854, - ov16_0225C868, - ov16_0225C8A4, - ov16_0225C8E0, - ov16_0225C91C, + [BTLIOCMD_SHOW_BATTLE_START_PARTY_GAUGE] = ov16_0225C840, + [BTLIOCMD_HIDE_BATTLE_START_PARTY_GAUGE] = ov16_0225C854, + [BTLIOCMD_SHOW_PARTY_GAUGE] = ov16_0225C868, + [BTLIOCMD_HIDE_PARTY_GAUGE] = ov16_0225C8A4, + [BTLIOCMD_LOAD_PARTY_GAUGE_GRAPHICS] = ov16_0225C8E0, + [BTLIOCMD_FREE_PARTY_GAUGE_GRAPHICS] = ov16_0225C91C, ov16_0225C940, ov16_0225C988, ov16_0225C9AC, @@ -276,9 +278,9 @@ static const UnkFuncPtr_ov16_0226F068 Unk_ov16_0226F068[] = { void ov16_0225C0DC (BattleSystem * param0, BattlerData * param1) { - if (param1->unk_90[0]) { + if (param1->data[0]) { param1->unk_1A4 = 0; - Unk_ov16_0226F068[param1->unk_90[0]](param0, param1); + Unk_ov16_0226F068[param1->data[0]](param0, param1); } } @@ -305,310 +307,310 @@ static void ov16_0225C138 (BattleSystem * param0, BattlerData * param1) static void ov16_0225C13C (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_02264A8C * v0 = (UnkStruct_ov16_02264A8C *)¶m1->unk_90[0]; + UnkStruct_ov16_02264A8C * v0 = (UnkStruct_ov16_02264A8C *)¶m1->data[0]; ov16_0223F4F4(param0, v0->unk_04); ov16_0225CBB8(param0, param1); - ov16_02266ABC(param0, param1->unk_190, 1); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, 1); + ZeroDataBuffer(param1); } static void ov16_0225C168 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C168 * v0 = (UnkStruct_ov16_0225C168 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C168 * v0 = (UnkStruct_ov16_0225C168 *)¶m1->data[0]; ov16_0225CBDC(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C17C (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C17C * v0 = (UnkStruct_ov16_0225C17C *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C17C * v0 = (UnkStruct_ov16_0225C17C *)¶m1->data[0]; ov16_0225CE1C(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C190 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C17C * v0 = (UnkStruct_ov16_0225C17C *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C17C * v0 = (UnkStruct_ov16_0225C17C *)¶m1->data[0]; ov16_0225CF70(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C1A4 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_02264EF8 * v0 = (UnkStruct_ov16_02264EF8 *)¶m1->unk_90[0]; + UnkStruct_ov16_02264EF8 * v0 = (UnkStruct_ov16_02264EF8 *)¶m1->data[0]; ov16_0225D118(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C1B8 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_02265050 * v0 = (UnkStruct_ov16_02265050 *)¶m1->unk_90[0]; + UnkStruct_ov16_02265050 * v0 = (UnkStruct_ov16_02265050 *)¶m1->data[0]; ov16_0225D1C4(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C1CC (BattleSystem * param0, BattlerData * param1) { sub_02007DC8(param1->unk_20); - ov16_02266ABC(param0, param1->unk_190, 7); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, 7); + ZeroDataBuffer(param1); } static void ov16_0225C1F0 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_02265124 * v0 = (UnkStruct_ov16_02265124 *)¶m1->unk_90[0]; + UnkStruct_ov16_02265124 * v0 = (UnkStruct_ov16_02265124 *)¶m1->data[0]; ov16_0225D228(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C204 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_02265154 * v0 = (UnkStruct_ov16_02265154 *)¶m1->unk_90[0]; + UnkStruct_ov16_02265154 * v0 = (UnkStruct_ov16_02265154 *)¶m1->data[0]; ov16_0225D360(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C218 (BattleSystem * param0, BattlerData * param1) { ov16_0225D3CC(param0, param1); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C228 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_022651A8 * v0 = (UnkStruct_ov16_022651A8 *)¶m1->unk_90[0]; + UnkStruct_ov16_022651A8 * v0 = (UnkStruct_ov16_022651A8 *)¶m1->data[0]; ov16_0225D414(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C23C (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C23C * v0 = (UnkStruct_ov16_0225C23C *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C23C * v0 = (UnkStruct_ov16_0225C23C *)¶m1->data[0]; ov16_0225D4A8(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C250 (BattleSystem * param0, BattlerData * param1) { ov16_0225D570(param0, param1); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C260 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C260 * v0 = (UnkStruct_ov16_0225C260 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C260 * v0 = (UnkStruct_ov16_0225C260 *)¶m1->data[0]; ov16_0223F290(param0, v0->unk_29); ov16_0225D5B8(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C288 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_022656F0 * v0 = (UnkStruct_ov16_022656F0 *)¶m1->unk_90[0]; + UnkStruct_ov16_022656F0 * v0 = (UnkStruct_ov16_022656F0 *)¶m1->data[0]; ov16_0225D698(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C29C (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C29C * v0 = (UnkStruct_ov16_0225C29C *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C29C * v0 = (UnkStruct_ov16_0225C29C *)¶m1->data[0]; ov16_0225D708(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C2B0 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C2B0 * v0 = (UnkStruct_ov16_0225C2B0 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C2B0 * v0 = (UnkStruct_ov16_0225C2B0 *)¶m1->data[0]; ov16_0225D794(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C2C4 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C2C4 * v0 = (UnkStruct_ov16_0225C2C4 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C2C4 * v0 = (UnkStruct_ov16_0225C2C4 *)¶m1->data[0]; ov16_0225D840(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C2D8 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C2D8 * v0 = (UnkStruct_ov16_0225C2D8 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C2D8 * v0 = (UnkStruct_ov16_0225C2D8 *)¶m1->data[0]; ov16_0225D8AC(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C2EC (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C2EC * v0 = (UnkStruct_ov16_0225C2EC *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C2EC * v0 = (UnkStruct_ov16_0225C2EC *)¶m1->data[0]; ov16_0225D8F0(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C300 (BattleSystem * param0, BattlerData * param1) { - BattleMessage * v0 = (BattleMessage *)¶m1->unk_90[0]; + BattleMessage * v0 = (BattleMessage *)¶m1->data[0]; ov16_0225D958(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C314 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_02265BBC * v0 = (UnkStruct_ov16_02265BBC *)¶m1->unk_90[0]; + UnkStruct_ov16_02265BBC * v0 = (UnkStruct_ov16_02265BBC *)¶m1->data[0]; ov16_0225D9A8(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C328 (BattleSystem * param0, BattlerData * param1) { if (sub_020080C0(param1->unk_20, 6) == 1) { - ov16_02266ABC(param0, param1->unk_190, 23); + ClearCommand(param0, param1->battler, 23); } else { ov16_0225DA44(param0, param1); } - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C35C (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C35C * v0 = (UnkStruct_ov16_0225C35C *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C35C * v0 = (UnkStruct_ov16_0225C35C *)¶m1->data[0]; ov16_0225DA74(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C370 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C370 * v0 = (UnkStruct_ov16_0225C370 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C370 * v0 = (UnkStruct_ov16_0225C370 *)¶m1->data[0]; ov16_0225DB00(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C384 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C384 * v0 = (UnkStruct_ov16_0225C384 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C384 * v0 = (UnkStruct_ov16_0225C384 *)¶m1->data[0]; ov16_0225DB74(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C398 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C398 * v0 = (UnkStruct_ov16_0225C398 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C398 * v0 = (UnkStruct_ov16_0225C398 *)¶m1->data[0]; ov16_0225DC4C(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C3AC (BattleSystem * param0, BattlerData * param1) { ov16_0225DC7C(param0, param1); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C3BC (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C3BC * v0 = (UnkStruct_ov16_0225C3BC *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C3BC * v0 = (UnkStruct_ov16_0225C3BC *)¶m1->data[0]; ov16_0225DCB0(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C3D0 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C3D0 * v0 = (UnkStruct_ov16_0225C3D0 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C3D0 * v0 = (UnkStruct_ov16_0225C3D0 *)¶m1->data[0]; ov16_0225DD44(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C3E4 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C3E4 * v0 = (UnkStruct_ov16_0225C3E4 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C3E4 * v0 = (UnkStruct_ov16_0225C3E4 *)¶m1->data[0]; ov16_0225DD7C(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C3F8 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C3F8 * v0 = (UnkStruct_ov16_0225C3F8 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C3F8 * v0 = (UnkStruct_ov16_0225C3F8 *)¶m1->data[0]; ov16_0225DDD8(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C40C (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C40C * v0 = (UnkStruct_ov16_0225C40C *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C40C * v0 = (UnkStruct_ov16_0225C40C *)¶m1->data[0]; ov16_0225DE30(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C420 (BattleSystem * param0, BattlerData * param1) { ov16_0225DE88(param0, param1); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C430 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C430 * v0 = (UnkStruct_ov16_0225C430 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C430 * v0 = (UnkStruct_ov16_0225C430 *)¶m1->data[0]; ov16_0225DEDC(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C444 (BattleSystem * param0, BattlerData * param1) { ov16_0225DF34(param0, param1); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C454 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C454 * v0 = (UnkStruct_ov16_0225C454 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C454 * v0 = (UnkStruct_ov16_0225C454 *)¶m1->data[0]; ov16_0225DF6C(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C468 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C468 * v0 = (UnkStruct_ov16_0225C468 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C468 * v0 = (UnkStruct_ov16_0225C468 *)¶m1->data[0]; ov16_0225E008(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C47C (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_022662FC * v0 = (UnkStruct_ov16_022662FC *)¶m1->unk_90[0]; + UnkStruct_ov16_022662FC * v0 = (UnkStruct_ov16_022662FC *)¶m1->data[0]; int v1; Pokemon * v2; - v2 = BattleSystem_PartyPokemon(param0, param1->unk_190, v0->unk_01_0); + v2 = BattleSystem_PartyPokemon(param0, param1->battler, v0->unk_01_0); if ((v0->unk_18 & 0x200000) == 0) { for (v1 = 0; v1 < 4; v1++) { @@ -635,8 +637,8 @@ static void ov16_0225C47C (BattleSystem * param0, BattlerData * param1) Pokemon_CalcLevelAndStats(v2); } - ov16_02266ABC(param0, param1->unk_190, v0->unk_00); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, v0->unk_00); + ZeroDataBuffer(param1); } static void ov16_0225C558 (BattleSystem * param0, BattlerData * param1) @@ -653,30 +655,30 @@ static void ov16_0225C558 (BattleSystem * param0, BattlerData * param1) } } - ov16_02266ABC(param0, param1->unk_190, param1->unk_90[0]); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, param1->data[0]); + ZeroDataBuffer(param1); } static void ov16_0225C5B0 (BattleSystem * param0, BattlerData * param1) { ov16_022675AC(¶m1->unk_28); ov16_022647D8(param1); - ov16_02266ABC(param0, param1->unk_190, param1->unk_90[0]); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, param1->data[0]); + ZeroDataBuffer(param1); } static void ov16_0225C5E0 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_02266498 * v0 = (UnkStruct_ov16_02266498 *)¶m1->unk_90[0]; + UnkStruct_ov16_02266498 * v0 = (UnkStruct_ov16_02266498 *)¶m1->data[0]; Pokemon * v1; int v2, v3, v4; u32 v5; v5 = 0; - v3 = BattleSystem_PartyCount(param0, param1->unk_190); + v3 = BattleSystem_PartyCount(param0, param1->battler); for (v2 = 0; v2 < v3; v2++) { - v1 = BattleSystem_PartyPokemon(param0, param1->unk_190, v2); + v1 = BattleSystem_PartyPokemon(param0, param1->battler, v2); if (v0->unk_01 == 104) { v4 = 0; @@ -689,29 +691,29 @@ static void ov16_0225C5E0 (BattleSystem * param0, BattlerData * param1) } } - ov16_02266ABC(param0, param1->unk_190, v0->unk_00); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, v0->unk_00); + ZeroDataBuffer(param1); } static void ov16_0225C65C (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C65C * v0 = (UnkStruct_ov16_0225C65C *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C65C * v0 = (UnkStruct_ov16_0225C65C *)¶m1->data[0]; ov16_0225E0BC(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C670 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_022664F8 * v0 = (UnkStruct_ov16_022664F8 *)¶m1->unk_90[0]; + UnkStruct_ov16_022664F8 * v0 = (UnkStruct_ov16_022664F8 *)¶m1->data[0]; ov16_0225E0F4(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C684 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C684 * v0 = (UnkStruct_ov16_0225C684 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C684 * v0 = (UnkStruct_ov16_0225C684 *)¶m1->data[0]; ArchivedSprite v1; ArchivedSprite * v2; int v3; @@ -729,26 +731,26 @@ static void ov16_0225C684 (BattleSystem * param0, BattlerData * param1) *v2 = v1; sub_020089A0(param1->unk_20); - sub_02013750(v2->archive, v2->character, 5, ov16_0223F2B8(ov16_0223E0C8(param0), param1->unk_190), v0->unk_08, 0, v4, v2->spindaSpots); + sub_02013750(v2->archive, v2->character, 5, ov16_0223F2B8(ov16_0223E0C8(param0), param1->battler), v0->unk_08, 0, v4, v2->spindaSpots); - ov16_0223F2CC(ov16_0223E0C8(param0), param1->unk_190, v2->archive); - ov16_0223F2E4(ov16_0223E0C8(param0), param1->unk_190, v2->palette); + ov16_0223F2CC(ov16_0223E0C8(param0), param1->battler, v2->archive); + ov16_0223F2E4(ov16_0223E0C8(param0), param1->battler, v2->palette); v3 = LoadPokemonSpriteYOffset(v0->unk_02, v0->unk_04, v4, v0->unk_01, v0->unk_08); - ov16_0223F2FC(ov16_0223E0C8(param0), param1->unk_190, v3); + ov16_0223F2FC(ov16_0223E0C8(param0), param1->battler, v3); v3 = ov12_022384CC(param1->battlerType, 1) + v3; sub_02007DEC(param1->unk_20, 1, v3); - ov16_02266ABC(param0, param1->unk_190, v0->unk_00); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, v0->unk_00); + ZeroDataBuffer(param1); } static void ov16_0225C77C (BattleSystem * param0, BattlerData * param1) { ov16_0223EF8C(param0); - ov16_02266ABC(param0, param1->unk_190, 46); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, 46); + ZeroDataBuffer(param1); } static void ov16_0225C79C (BattleSystem * param0, BattlerData * param1) @@ -771,9 +773,9 @@ static void ov16_0225C79C (BattleSystem * param0, BattlerData * param1) NARC_dtor(v3); NARC_dtor(v4); - v1 = BattleSystem_Partner(param0, param1->unk_190); + v1 = BattleSystem_Partner(param0, param1->battler); - if (v1 != param1->unk_190) { + if (v1 != param1->battler) { v2 = ov16_0223F35C(param0, v1); ov16_0226846C(v2); } @@ -784,50 +786,50 @@ static void ov16_0225C79C (BattleSystem * param0, BattlerData * param1) } } - ov16_02266ABC(param0, param1->unk_190, 47); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, 47); + ZeroDataBuffer(param1); } static void ov16_0225C840 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C840 * v0 = (UnkStruct_ov16_0225C840 *)¶m1->unk_90[0]; + PartyGaugeData * v0 = (PartyGaugeData *)¶m1->data[0]; - ov16_0225E134(param0, param1, v0); - ov16_0225CBB0(param1); + Battler_ShowBattleStartPartyGauge(param0, param1, v0); + ZeroDataBuffer(param1); } static void ov16_0225C854 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C840 * v0 = (UnkStruct_ov16_0225C840 *)¶m1->unk_90[0]; + PartyGaugeData * v0 = (PartyGaugeData *)¶m1->data[0]; - ov16_0225E17C(param0, param1, v0); - ov16_0225CBB0(param1); + Battler_HideBattleStartPartyGauge(param0, param1, v0); + ZeroDataBuffer(param1); } static void ov16_0225C868 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C840 * v0 = (UnkStruct_ov16_0225C840 *)¶m1->unk_90[0]; + PartyGaugeData * v0 = (PartyGaugeData *)¶m1->data[0]; - if (Battler_Side(param0, param1->unk_190)) { - ov16_0225E1B4(param0, param1, v0); + if (Battler_Side(param0, param1->battler)) { + Battler_ShowPartyGauge(param0, param1, v0); } else { - ov16_02266ABC(param0, param1->unk_190, 50); + ClearCommand(param0, param1->battler, 50); } - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C8A4 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C840 * v0 = (UnkStruct_ov16_0225C840 *)¶m1->unk_90[0]; + PartyGaugeData * v0 = (PartyGaugeData *)¶m1->data[0]; - if (Battler_Side(param0, param1->unk_190)) { - ov16_0225E200(param0, param1, v0); + if (Battler_Side(param0, param1->battler)) { + Battler_HidePartyGauge(param0, param1, v0); } else { - ov16_02266ABC(param0, param1->unk_190, 51); + ClearCommand(param0, param1->battler, 51); } - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C8E0 (BattleSystem * param0, BattlerData * param1) @@ -841,8 +843,8 @@ static void ov16_0225C8E0 (BattleSystem * param0, BattlerData * param1) v2 = BattleSystem_PaletteSys(param0); ov16_0226D094(v0, v1, v2); - ov16_02266ABC(param0, param1->unk_190, 52); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, 52); + ZeroDataBuffer(param1); } static void ov16_0225C91C (BattleSystem * param0, BattlerData * param1) @@ -852,13 +854,13 @@ static void ov16_0225C91C (BattleSystem * param0, BattlerData * param1) v0 = ov16_0223E018(param0); ov16_0226D12C(v0); - ov16_02266ABC(param0, param1->unk_190, 53); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, 53); + ZeroDataBuffer(param1); } static void ov16_0225C940 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_022666BC * v0 = (UnkStruct_ov16_022666BC *)¶m1->unk_90[0]; + UnkStruct_ov16_022666BC * v0 = (UnkStruct_ov16_022666BC *)¶m1->data[0]; if (v0->unk_01 == 0) { if (param1->bootState == 0x0) { @@ -870,90 +872,90 @@ static void ov16_0225C940 (BattleSystem * param0, BattlerData * param1) } } - ov16_02266ABC(param0, param1->unk_190, v0->unk_00); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, v0->unk_00); + ZeroDataBuffer(param1); } static void ov16_0225C988 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C988 * v0 = (UnkStruct_ov16_0225C988 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C988 * v0 = (UnkStruct_ov16_0225C988 *)¶m1->data[0]; ov16_0223F638(param0, v0->unk_02, v0->unk_04); ov16_0225E23C(param0, param1); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C9AC (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_02265BBC * v0 = (UnkStruct_ov16_02265BBC *)¶m1->unk_90[0]; + UnkStruct_ov16_02265BBC * v0 = (UnkStruct_ov16_02265BBC *)¶m1->data[0]; ov16_0225E294(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C9C0 (BattleSystem * param0, BattlerData * param1) { ov16_0225E2C8(param0, param1); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C9D0 (BattleSystem * param0, BattlerData * param1) { ov16_0225E300(param0, param1); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C9E0 (BattleSystem * param0, BattlerData * param1) { ov16_0225E338(param0, param1); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225C9F0 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225C9F0 * v0 = (UnkStruct_ov16_0225C9F0 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225C9F0 * v0 = (UnkStruct_ov16_0225C9F0 *)¶m1->data[0]; ov16_0223F638(param0, v0->unk_02, v0->unk_04); ov16_0225E38C(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225CA14 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225CA14 * v0 = (UnkStruct_ov16_0225CA14 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225CA14 * v0 = (UnkStruct_ov16_0225CA14 *)¶m1->data[0]; ov16_0223F638(param0, v0->unk_02, v0->unk_04); ov16_0225E3E0(param0, param1); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225CA38 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_02265BBC * v0 = (UnkStruct_ov16_02265BBC *)¶m1->unk_90[0]; + UnkStruct_ov16_02265BBC * v0 = (UnkStruct_ov16_02265BBC *)¶m1->data[0]; ov16_0225E434(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225CA4C (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225CA4C * v0 = (UnkStruct_ov16_0225CA4C *)¶m1->unk_90[0]; + UnkStruct_ov16_0225CA4C * v0 = (UnkStruct_ov16_0225CA4C *)¶m1->data[0]; ov16_0225E468(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225CA60 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_0225CA60 * v0 = (UnkStruct_ov16_0225CA60 *)¶m1->unk_90[0]; + UnkStruct_ov16_0225CA60 * v0 = (UnkStruct_ov16_0225CA60 *)¶m1->data[0]; ov16_0225E4C8(param0, param1, v0); - ov16_0225CBB0(param1); + ZeroDataBuffer(param1); } static void ov16_0225CA74 (BattleSystem * param0, BattlerData * param1) { - UnkStruct_ov16_02266A38 * v0 = (UnkStruct_ov16_02266A38 *)¶m1->unk_90[0]; + UnkStruct_ov16_02266A38 * v0 = (UnkStruct_ov16_02266A38 *)¶m1->data[0]; Party * v1; Pokemon * v2; int v3; @@ -992,8 +994,8 @@ static void ov16_0225CA74 (BattleSystem * param0, BattlerData * param1) } } - ov16_02266ABC(param0, param1->unk_190, v0->unk_00); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, v0->unk_00); + ZeroDataBuffer(param1); } static void ov16_0225CB80 (BattleSystem * param0, BattlerData * param1) @@ -1003,11 +1005,11 @@ static void ov16_0225CB80 (BattleSystem * param0, BattlerData * param1) BGL_FillWindow(v0, 0xff); sub_0201ACCC(v0); - ov16_02266ABC(param0, param1->unk_190, 66); - ov16_0225CBB0(param1); + ClearCommand(param0, param1->battler, 66); + ZeroDataBuffer(param1); } -static void ov16_0225CBB0 (BattlerData * param0) +static void ZeroDataBuffer (BattlerData * param0) { - param0->unk_90[0] = 0; + param0->data[0] = 0; } diff --git a/src/overlay016/ov16_0225CBB8.c b/src/overlay016/ov16_0225CBB8.c index 32497c1b9d..8efd78408b 100644 --- a/src/overlay016/ov16_0225CBB8.c +++ b/src/overlay016/ov16_0225CBB8.c @@ -6,6 +6,8 @@ #include "core_sys.h" #include "assert.h" +#include "constants/heap.h" + #include "struct_decls/struct_02002F38_decl.h" #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02007768_decl.h" @@ -65,7 +67,7 @@ #include "overlay016/struct_ov16_0225C454.h" #include "overlay016/struct_ov16_0225C468.h" #include "overlay016/struct_ov16_0225C65C.h" -#include "overlay016/struct_ov16_0225C840.h" +#include "struct_defs/battle_io.h" #include "overlay016/struct_ov16_0225C9F0.h" #include "overlay016/struct_ov16_0225CA4C.h" #include "overlay016/struct_ov16_0225CA60.h" @@ -89,7 +91,6 @@ #include "overlay016/struct_ov16_0225DF6C.h" #include "overlay016/struct_ov16_0225E0BC.h" #include "overlay016/struct_ov16_0225E0F4.h" -#include "overlay016/struct_ov16_0225E134.h" #include "overlay016/struct_ov16_0225E2C8.h" #include "overlay016/struct_ov16_0225E300.h" #include "overlay016/struct_ov16_0225E4E8.h" @@ -194,10 +195,10 @@ void ov16_0225DF6C(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0 void ov16_0225E008(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C468 * param2); void ov16_0225E0BC(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C65C * param2); void ov16_0225E0F4(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_022664F8 * param2); -void ov16_0225E134(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2); -void ov16_0225E17C(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2); -void ov16_0225E1B4(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2); -void ov16_0225E200(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2); +void Battler_ShowBattleStartPartyGauge(BattleSystem * param0, BattlerData * param1, PartyGaugeData * param2); +void Battler_HideBattleStartPartyGauge(BattleSystem * param0, BattlerData * param1, PartyGaugeData * param2); +void Battler_ShowPartyGauge(BattleSystem * param0, BattlerData * param1, PartyGaugeData * param2); +void Battler_HidePartyGauge(BattleSystem * param0, BattlerData * param1, PartyGaugeData * param2); void ov16_0225E23C(BattleSystem * param0, BattlerData * param1); void ov16_0225E294(BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_02265BBC * param2); void ov16_0225E2C8(BattleSystem * param0, BattlerData * param1); @@ -259,8 +260,8 @@ static void ov16_02262FC0(SysTask * param0, void * param1); static void ov16_02263014(SysTask * param0, void * param1); static void ov16_022633A4(SysTask * param0, void * param1); static void ov16_022634DC(SysTask * param0, void * param1); -static void ov16_0226354C(SysTask * param0, void * param1); -static void ov16_02263604(SysTask * param0, void * param1); +static void ShowPartyGaugeTask(SysTask * param0, void * param1); +static void HidePartyGaugeTask(SysTask * param0, void * param1); static void ov16_02263688(SysTask * param0, void * param1); static void ov16_022636D4(SysTask * param0, void * param1); void ov16_02263730(BattleSystem * param0, BattlerData * param1); @@ -366,7 +367,7 @@ void ov16_0225CBDC (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ PokeSprite_LoadShadowSize(param1->unk_1A0, &v9, param2->unk_02); PokeSprite_LoadAnimationFrames(param1->unk_1A0, &v3[0], param2->unk_02, param1->battlerType); - v4->unk_08 = param1->unk_20 = ov16_02263B30(param0, v2, &v1, Unk_ov12_0223B0B8[param1->battlerType][0], Unk_ov12_0223B0B8[param1->battlerType][1], Unk_ov12_0223B0B8[param1->battlerType][2], v6, v7, v8, v9, param1->unk_190, &v3[0], NULL); + v4->unk_08 = param1->unk_20 = ov16_02263B30(param0, v2, &v1, Unk_ov12_0223B0B8[param1->battlerType][0], Unk_ov12_0223B0B8[param1->battlerType][1], Unk_ov12_0223B0B8[param1->battlerType][2], v6, v7, v8, v9, param1->battler, &v3[0], NULL); if (v4->unk_13 == 2) { sub_020086FC(v4->unk_08, 8, 8, 0, 0x0); @@ -390,7 +391,7 @@ void ov16_0225CBDC (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v4->unk_00 = param0; v4->unk_04 = param1; v4->unk_10 = param2->unk_00; - v4->unk_11 = param1->unk_190; + v4->unk_11 = param1->battler; v4->unk_16 = param2->unk_02; v4->unk_2C = param2->unk_01_3; v4->unk_18 = param2->unk_08; @@ -442,7 +443,7 @@ void ov16_0225CE1C (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v1->unk_83 = 0; v1->unk_96 = 0; v1->unk_80 = param2->unk_00; - v1->unk_81 = param1->unk_190; + v1->unk_81 = param1->battler; v1->unk_86 = param2->unk_02; v1->unk_97 = param2->unk_01_3; v1->unk_82 = param1->battlerType; @@ -492,7 +493,7 @@ void ov16_0225CF70 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v2->unk_00 = param0; v2->unk_04 = param1; v2->unk_80 = param2->unk_00; - v2->unk_81 = param1->unk_190; + v2->unk_81 = param1->battler; v2->unk_86 = param2->unk_02; v2->unk_97 = param2->unk_01_3; v2->unk_82 = param1->battlerType; @@ -526,7 +527,7 @@ void ov16_0225D118 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v1->unk_04 = param1; v1->unk_08 = param1->unk_20; v1->unk_68 = param2->unk_00; - v1->unk_69 = param1->unk_190; + v1->unk_69 = param1->battler; v1->unk_6A = param1->battlerType; v1->unk_6B = 0; v1->unk_6C = param2->unk_01; @@ -553,7 +554,7 @@ void ov16_0225D1C4 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_04 = param1->unk_20; v0->unk_08 = param2->unk_00; - v0->unk_09 = param1->unk_190; + v0->unk_09 = param1->battler; v0->unk_0A = param1->battlerType; v0->unk_0B = 0; v0->unk_0C = param2->unk_01; @@ -588,13 +589,13 @@ void ov16_0225D228 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v2 = param1->battlerType & 1; } - param2->unk_02 = ov16_02264768(param0, param1->unk_190, param2->unk_02); + param2->unk_02 = ov16_02264768(param0, param1->battler, param2->unk_02); v1->unk_08 = param1->unk_18 = ov16_022643B8(param0, v2, param2->unk_02, param1->battlerType, Unk_ov12_0223B0B8[v2][0], Unk_ov12_0223B0B8[v2][1]); v1->unk_10 = Unk_ov12_0223B0A0[v2][0]; v1->unk_00 = param0; v1->unk_0C = param2->unk_00; - v1->unk_0D = param1->unk_190; + v1->unk_0D = param1->battler; v1->unk_14 = param1->battlerType; v1->unk_1C = 0; @@ -615,7 +616,7 @@ void ov16_0225D360 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_08 = param2->unk_00; v0->unk_10 = param2->unk_01; - v0->unk_09 = param1->unk_190; + v0->unk_09 = param1->battler; v0->unk_04 = param1; if (param1->battlerType & 0x1) { @@ -625,9 +626,9 @@ void ov16_0225D360 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ { TrainerData * v1; - v1 = BattleSystem_TrainerData(param0, param1->unk_190); + v1 = BattleSystem_TrainerData(param0, param1->battler); v0->unk_0B = 0; - v0->unk_0C = sub_020788D0(ov16_02264768(param0, param1->unk_190, v1->class)); + v0->unk_0C = sub_020788D0(ov16_02264768(param0, param1->battler, v1->class)); } } @@ -642,8 +643,8 @@ void ov16_0225D3CC (BattleSystem * param0, BattlerData * param1) v0->unk_0A = 0; v0->unk_00 = param0; - v0->unk_08 = param1->unk_90[0]; - v0->unk_09 = param1->unk_190; + v0->unk_08 = param1->data[0]; + v0->unk_09 = param1->battler; v0->unk_04 = param1; if (param1->battlerType & 0x1) { @@ -677,7 +678,7 @@ void ov16_0225D414 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v3->unk_0C = Unk_ov12_0223B0A0[param1->battlerType & 1][param2->unk_04]; v3->unk_00 = param0; v3->unk_08 = param2->unk_00; - v3->unk_09 = param1->unk_190; + v3->unk_09 = param1->battler; SysTask_Start(ov16_02260384, v3, 0); } @@ -690,7 +691,7 @@ void ov16_0225D4A8 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ MI_CpuClearFast(&v0->unk_00, sizeof(UnkStruct_ov16_022674C4_sub1)); v0->unk_0C = param0; - v0->unk_24 = param1->unk_190; + v0->unk_24 = param1->battler; v0->unk_25 = ov16_0226825C(param1->battlerType, BattleSystem_BattleType(param0)); v0->unk_4C = param2->unk_00; v0->unk_28 = param2->unk_02; @@ -719,8 +720,8 @@ void ov16_0225D570 (BattleSystem * param0, BattlerData * param1) v0 = ¶m1->unk_28; MI_CpuClearFast(&v0->unk_00, sizeof(UnkStruct_ov16_022674C4_sub1)); v0->unk_0C = param0; - v0->unk_24 = param1->unk_190; - v0->unk_4C = param1->unk_90[0]; + v0->unk_24 = param1->battler; + v0->unk_4C = param1->data[0]; ov16_022676A8(v0, 1); v0->unk_10 = SysTask_Start(ov16_02260480, v0, 1000); @@ -738,7 +739,7 @@ void ov16_0225D5B8 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_0B = 0; v0->unk_00 = param0; v0->unk_08 = param2->unk_00; - v0->unk_09 = param1->unk_190; + v0->unk_09 = param1->battler; v0->unk_34 = param1->battlerType; v0->unk_04 = ¶m1->unk_28; v0->unk_23 = param2->unk_01; @@ -783,8 +784,8 @@ void ov16_0225D698 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_20 = 0; v0->unk_00 = param0; - v0->unk_1C = param1->unk_90[0]; - v0->unk_1D = param1->unk_190; + v0->unk_1C = param1->data[0]; + v0->unk_1D = param1->battler; v0->unk_1E = param1->battlerType; v0->unk_04 = ¶m1->unk_28; v0->unk_1F = param2->unk_01; @@ -811,8 +812,8 @@ void ov16_0225D708 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_0F = 0; v0->unk_00 = param0; - v0->unk_0C = param1->unk_90[0]; - v0->unk_0D = param1->unk_190; + v0->unk_0C = param1->data[0]; + v0->unk_0D = param1->battler; v0->unk_0E = param1->battlerType; v0->unk_30 = param2->unk_02; v0->unk_04 = ¶m1->unk_28; @@ -843,7 +844,7 @@ void ov16_0225D794 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_0E = 0; v0->unk_00 = param0; v0->unk_0C = param2->unk_00; - v0->unk_0D = param1->unk_190; + v0->unk_0D = param1->battler; v0->unk_0F = param1->battlerType; v0->unk_14 = param2->unk_01; v0->unk_15 = param2->unk_02; @@ -899,7 +900,7 @@ void ov16_0225D8AC (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_0E = 0; v0->unk_00 = param0; v0->unk_0C = param2->unk_00; - v0->unk_0D = param1->unk_190; + v0->unk_0D = param1->battler; v0->unk_04 = ¶m1->unk_28; v0->unk_10 = param2->unk_02; v0->unk_0F = param2->unk_01; @@ -920,11 +921,11 @@ void ov16_0225D8F0 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_04 = param2->unk_00; - v0->unk_05 = param1->unk_190; + v0->unk_05 = param1->battler; v2.id = 0 + param2->unk_02 * 3; v2.tags = 2; - v2.params[0] = param1->unk_190 | (param2->unk_01 << 8); + v2.params[0] = param1->battler | (param2->unk_01 << 8); v0->unk_06 = BattleMessage_Print(param0, v1, &v2, BattleSystem_TextSpeed(param0)); @@ -940,8 +941,8 @@ void ov16_0225D958 (BattleSystem * param0, BattlerData * param1, BattleMessage * v0 = (UnkStruct_ov16_0225D8F0 *)Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_0225D8F0)); v0->unk_00 = param0; - v0->unk_04 = param1->unk_90[0]; - v0->unk_05 = param1->unk_190; + v0->unk_04 = param1->data[0]; + v0->unk_05 = param1->battler; v0->unk_06 = BattleMessage_Print(param0, v1, param2, BattleSystem_TextSpeed(param0)); SysTask_Start(ov16_02262F7C, v0, 0); @@ -956,8 +957,8 @@ void ov16_0225D9A8 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_6A = 0; v0->unk_00 = param0; v0->unk_04 = param1; - v0->unk_68 = param1->unk_90[0]; - v0->unk_69 = param1->unk_190; + v0->unk_68 = param1->data[0]; + v0->unk_69 = param1->battler; v0->unk_0C = ov16_0223E008(param0); v0->unk_10 = *param2; v0->unk_08 = param1->unk_20; @@ -983,7 +984,7 @@ void ov16_0225DA44 (BattleSystem * param0, BattlerData * param1) v0->unk_09 = 0; v0->unk_00 = param0; v0->unk_04 = param1->unk_20; - v0->unk_08 = param1->unk_190; + v0->unk_08 = param1->battler; v0->unk_0A = 0; SysTask_Start(ov16_0226292C, v0, 0); @@ -1000,7 +1001,7 @@ void ov16_0225DA74 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_0C = param0; v0->unk_4C = param2->unk_00; - v0->unk_24 = param1->unk_190; + v0->unk_24 = param1->battler; v0->unk_25 = ov16_0226825C(param1->battlerType, BattleSystem_BattleType(param0)); v0->unk_28 = param2->unk_02; v0->unk_2C = param2->unk_04; @@ -1027,7 +1028,7 @@ void ov16_0225DB00 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov v0->unk_0C = param0; v0->unk_4C = param2->unk_00; - v0->unk_24 = param1->unk_190; + v0->unk_24 = param1->battler; v0->unk_38 = param2->unk_04; v0->unk_3C = param2->unk_0C; v0->unk_40 = param2->unk_08 - v0->unk_38; @@ -1036,7 +1037,7 @@ void ov16_0225DB00 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov v0->unk_10 = SysTask_Start(ov16_022629DC, v0, 1000); return; } else { - ov16_02266ABC(v0->unk_0C, v0->unk_24, v0->unk_4C); + ClearCommand(v0->unk_0C, v0->unk_24, v0->unk_4C); } } @@ -1057,7 +1058,7 @@ void ov16_0225DB74 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_04 = param1; v0->unk_64 = param2->unk_00; - v0->unk_65 = param1->unk_190; + v0->unk_65 = param1->battler; v0->unk_08 = param1->unk_20; v0->unk_68 = param2->unk_02; v0->unk_6A = param2->unk_01; @@ -1087,7 +1088,7 @@ void ov16_0225DC4C (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0 = -117; } - ov16_02266ABC(param0, param1->unk_190, param2->unk_00); + ClearCommand(param0, param1->battler, param2->unk_00); sub_02005728(param2->unk_04, v0); } @@ -1099,8 +1100,8 @@ void ov16_0225DC7C (BattleSystem * param0, BattlerData * param1) v0->unk_06 = 0; v0->unk_00 = param0; - v0->unk_04 = param1->unk_90[0]; - v0->unk_05 = param1->unk_190; + v0->unk_04 = param1->data[0]; + v0->unk_05 = param1->battler; SysTask_Start(ov16_02262D28, v0, 0); } @@ -1115,7 +1116,7 @@ void ov16_0225DCB0 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_04 = param1; v0->unk_60 = param2->unk_00; - v0->unk_61 = param1->unk_190; + v0->unk_61 = param1->battler; v0->unk_62 = 0; v0->unk_63 = param2->unk_01; v0->unk_64 = param2->unk_02; @@ -1138,7 +1139,7 @@ void ov16_0225DD44 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ param1->unk_28.unk_4A = param2->unk_01; ov16_02267084(¶m1->unk_28, param1->unk_28.unk_28, (1 << 8)); - ov16_02266ABC(param0, param1->unk_190, param2->unk_00); + ClearCommand(param0, param1->battler, param2->unk_00); } void ov16_0225DD7C (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C3E4 * param2) @@ -1146,13 +1147,13 @@ void ov16_0225DD7C (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ UnkStruct_ov16_0225D8F0 * v0; int v1; - v1 = Battler_TrainerID(param0, param1->unk_190); + v1 = Battler_TrainerID(param0, param1->battler); v0 = (UnkStruct_ov16_0225D8F0 *)Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_0225D8F0)); v0->unk_00 = param0; v0->unk_04 = param2->unk_00; - v0->unk_05 = param1->unk_190; - v0->unk_06 = ov16_0223F9FC(param0, v1, param1->unk_190, param2->unk_01, BattleSystem_TextSpeed(param0)); + v0->unk_05 = param1->battler; + v0->unk_06 = ov16_0223F9FC(param0, v1, param1->battler, param2->unk_01, BattleSystem_TextSpeed(param0)); SysTask_Start(ov16_02262F7C, v0, 0); } @@ -1170,7 +1171,7 @@ void ov16_0225DDD8 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_04 = param2->unk_00; - v0->unk_05 = param1->unk_190; + v0->unk_05 = param1->battler; v0->unk_06 = BattleMessage_Print(param0, v1, &v2, BattleSystem_TextSpeed(param0)); SysTask_Start(ov16_02262F7C, v0, 0); @@ -1189,7 +1190,7 @@ void ov16_0225DE30 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_04 = param2->unk_00; - v0->unk_05 = param1->unk_190; + v0->unk_05 = param1->battler; v0->unk_06 = BattleMessage_Print(param0, v1, &v2, BattleSystem_TextSpeed(param0)); SysTask_Start(ov16_02262F7C, v0, 0); @@ -1208,7 +1209,7 @@ void ov16_0225DE88 (BattleSystem * param0, BattlerData * param1) v0->unk_00 = param0; v0->unk_04 = 34; - v0->unk_05 = param1->unk_190; + v0->unk_05 = param1->battler; v0->unk_06 = BattleMessage_Print(param0, v1, &v2, BattleSystem_TextSpeed(param0)); SysTask_Start(ov16_02262F7C, v0, 0); @@ -1227,7 +1228,7 @@ void ov16_0225DEDC (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_04 = param2->unk_00; - v0->unk_05 = param1->unk_190; + v0->unk_05 = param1->battler; v0->unk_06 = BattleMessage_Print(param0, v1, &v2, BattleSystem_TextSpeed(param0)); SysTask_Start(ov16_02262F7C, v0, 0); @@ -1240,8 +1241,8 @@ void ov16_0225DF34 (BattleSystem * param0, BattlerData * param1) v0 = (UnkStruct_ov16_0225DF34 *)Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_0225DF34)); v0->unk_00 = param0; - v0->unk_08 = param1->unk_90[0]; - v0->unk_09 = param1->unk_190; + v0->unk_08 = param1->data[0]; + v0->unk_09 = param1->battler; v0->unk_0A = 0; v0->unk_04 = ¶m1->unk_28; @@ -1259,20 +1260,20 @@ void ov16_0225DF6C (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_04 = param2->unk_00; - v0->unk_05 = param1->unk_190; + v0->unk_05 = param1->battler; v0->unk_07 = 0; v0->unk_06 = BattleMessage_Print(param0, v1, ¶m2->unk_04, BattleSystem_TextSpeed(param0)); SysTask_Start(ov16_02262FC0, v0, 0); } else if (param1->bootState == 0x1) { - ov16_022661B0(param0, param1->unk_190); - ov16_02266ABC(param0, param1->unk_190, param2->unk_00); + ov16_022661B0(param0, param1->battler); + ClearCommand(param0, param1->battler, param2->unk_00); } else { if ((BattleSystem_BattleType(param0) & 0x4) == 0) { - ov16_022661B0(param0, param1->unk_190); + ov16_022661B0(param0, param1->battler); } - ov16_02266ABC(param0, param1->unk_190, param2->unk_00); + ClearCommand(param0, param1->battler, param2->unk_00); } } @@ -1285,7 +1286,7 @@ void ov16_0225E008 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ MI_CpuClearFast(&v0->unk_00, sizeof(UnkStruct_ov16_022674C4_sub1)); v0->unk_0C = param0; - v0->unk_24 = param1->unk_190; + v0->unk_24 = param1->battler; v0->unk_25 = ov16_0226825C(param1->battlerType, BattleSystem_BattleType(param0)); v0->unk_4C = param2->unk_00; v0->unk_28 = param2->unk_02; @@ -1301,7 +1302,7 @@ void ov16_0225E008 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_27 = param2->unk_10; ov16_02267084(v0, v0->unk_28, 0xffffffff ^ (1 << 5)); - ov16_02266ABC(v0->unk_0C, v0->unk_24, v0->unk_4C); + ClearCommand(v0->unk_0C, v0->unk_24, v0->unk_4C); } void ov16_0225E0BC (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C65C * param2) @@ -1313,7 +1314,7 @@ void ov16_0225E0BC (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_0A = 0; v0->unk_00 = param0; v0->unk_08 = param2->unk_00; - v0->unk_09 = param1->unk_190; + v0->unk_09 = param1->battler; v0->unk_0C = param2->unk_02; v0->unk_0E = param2->unk_01; @@ -1330,7 +1331,7 @@ void ov16_0225E0F4 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_04 = param1->unk_20; v0->unk_08 = param2->unk_00; - v0->unk_09 = param1->unk_190; + v0->unk_09 = param1->battler; v0->unk_0B = param2->unk_01; v0->unk_0C = 0; v0->unk_0D = param2->unk_02; @@ -1338,81 +1339,78 @@ void ov16_0225E0F4 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ SysTask_Start(ov16_022634DC, v0, 0); } -void ov16_0225E134 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2) +typedef struct PartyGaugeTask { + BattleSystem *battleSys; + u8 command; + u8 battler; + u8 battlerType; + u8 state; + u8 status[MAX_PARTY_SIZE]; + u8 midBattle; +} PartyGaugeTask; + +void Battler_ShowBattleStartPartyGauge(BattleSystem *battleSys, BattlerData *battlerData, PartyGaugeData *partyGauge) { - UnkStruct_ov16_0225E134 * v0; - int v1; + PartyGaugeTask *task = Heap_AllocFromHeap(HEAP_ID_BATTLE, sizeof(PartyGaugeTask)); - v0 = (UnkStruct_ov16_0225E134 *)Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_0225E134)); + task->state = 0; + task->battleSys = battleSys; + task->command = partyGauge->command; + task->battler = battlerData->battler; + task->battlerType = battlerData->battlerType; - v0->unk_07 = 0; - v0->unk_00 = param0; - v0->unk_04 = param2->unk_00; - v0->unk_05 = param1->unk_190; - v0->unk_06 = param1->battlerType; - - for (v1 = 0; v1 < 6; v1++) { - v0->unk_08[v1] = param2->unk_02[v1]; + for (int i = 0; i < MAX_PARTY_SIZE; i++) { + task->status[i] = partyGauge->status[i]; } - v0->unk_0E = 0; - SysTask_Start(ov16_0226354C, v0, 0); + task->midBattle = FALSE; + SysTask_Start(ShowPartyGaugeTask, task, 0); } -void ov16_0225E17C (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2) +void Battler_HideBattleStartPartyGauge(BattleSystem *battleSys, BattlerData *battlerData, PartyGaugeData *partyGauge) { - UnkStruct_ov16_0225E134 * v0; - int v1; + PartyGaugeTask *task = Heap_AllocFromHeap(HEAP_ID_BATTLE, sizeof(PartyGaugeTask)); - v0 = (UnkStruct_ov16_0225E134 *)Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_0225E134)); + task->state = 0; + task->battleSys = battleSys; + task->command = partyGauge->command; + task->battler = battlerData->battler; + task->battlerType = battlerData->battlerType; + task->midBattle = FALSE; - v0->unk_07 = 0; - v0->unk_00 = param0; - v0->unk_04 = param2->unk_00; - v0->unk_05 = param1->unk_190; - v0->unk_06 = param1->battlerType; - v0->unk_0E = 0; - - SysTask_Start(ov16_02263604, v0, 0); + SysTask_Start(HidePartyGaugeTask, task, 0); } -void ov16_0225E1B4 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2) +void Battler_ShowPartyGauge(BattleSystem *battleSys, BattlerData *battlerData, PartyGaugeData *partyGauge) { - UnkStruct_ov16_0225E134 * v0; - int v1; + PartyGaugeTask *task = Heap_AllocFromHeap(HEAP_ID_BATTLE, sizeof(PartyGaugeTask)); - v0 = (UnkStruct_ov16_0225E134 *)Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_0225E134)); + task->state = 0; + task->battleSys = battleSys; + task->command = partyGauge->command; + task->battler = battlerData->battler; + task->battlerType = battlerData->battlerType; - v0->unk_07 = 0; - v0->unk_00 = param0; - v0->unk_04 = param2->unk_00; - v0->unk_05 = param1->unk_190; - v0->unk_06 = param1->battlerType; - - for (v1 = 0; v1 < 6; v1++) { - v0->unk_08[v1] = param2->unk_02[v1]; + for (int i = 0; i < MAX_PARTY_SIZE; i++) { + task->status[i] = partyGauge->status[i]; } - v0->unk_0E = 1; - - SysTask_Start(ov16_0226354C, v0, 0); + task->midBattle = TRUE; + SysTask_Start(ShowPartyGaugeTask, task, 0); } -void ov16_0225E200 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225C840 * param2) +void Battler_HidePartyGauge(BattleSystem *battleSys, BattlerData *battlerData, PartyGaugeData *partyGauge) { - UnkStruct_ov16_0225E134 * v0; - int v1; + PartyGaugeTask *task = Heap_AllocFromHeap(HEAP_ID_BATTLE, sizeof(PartyGaugeTask)); - v0 = (UnkStruct_ov16_0225E134 *)Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_0225E134)); + task->state = 0; + task->battleSys = battleSys; + task->command = partyGauge->command; + task->battler = battlerData->battler; + task->battlerType = battlerData->battlerType; + task->midBattle = TRUE; - v0->unk_07 = 0; - v0->unk_00 = param0; - v0->unk_04 = param2->unk_00; - v0->unk_05 = param1->unk_190; - v0->unk_06 = param1->battlerType; - v0->unk_0E = 1; - - SysTask_Start(ov16_02263604, v0, 0); + SysTask_Start(HidePartyGaugeTask, task, 0); } void ov16_0225E23C (BattleSystem * param0, BattlerData * param1) @@ -1430,16 +1428,16 @@ void ov16_0225E23C (BattleSystem * param0, BattlerData * param1) ov16_0223F2A4(param0, sub_0200E7FC(BattleSystem_Window(param0, 0), 1)); } - ov16_02266ABC(param0, param1->unk_190, 55); + ClearCommand(param0, param1->battler, 55); } void ov16_0225E294 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_02265BBC * param2) { UnkStruct_ov12_022380DC v0; - ov16_02264530(param0, param2, &v0, param1->unk_190); + ov16_02264530(param0, param2, &v0, param1->battler); ov12_022382BC(&v0, 5); - ov16_02266ABC(param0, param1->unk_190, param2->unk_00); + ClearCommand(param0, param1->battler, param2->unk_00); } void ov16_0225E2C8 (BattleSystem * param0, BattlerData * param1) @@ -1451,8 +1449,8 @@ void ov16_0225E2C8 (BattleSystem * param0, BattlerData * param1) v0->unk_0E = 0; v0->unk_00 = param0; v0->unk_04 = param1; - v0->unk_0C = param1->unk_90[0]; - v0->unk_0D = param1->unk_190; + v0->unk_0C = param1->data[0]; + v0->unk_0D = param1->battler; v0->unk_08 = param1->unk_20; SysTask_Start(ov16_02263688, v0, 0); @@ -1467,8 +1465,8 @@ void ov16_0225E300 (BattleSystem * param0, BattlerData * param1) v0->unk_0E = 0; v0->unk_00 = param0; v0->unk_04 = param1; - v0->unk_0C = param1->unk_90[0]; - v0->unk_0D = param1->unk_190; + v0->unk_0C = param1->data[0]; + v0->unk_0D = param1->battler; v0->unk_08 = param1->unk_20; SysTask_Start(ov16_022636D4, v0, 0); @@ -1487,7 +1485,7 @@ void ov16_0225E338 (BattleSystem * param0, BattlerData * param1) v0->unk_00 = param0; v0->unk_04 = 59; - v0->unk_05 = param1->unk_190; + v0->unk_05 = param1->battler; v0->unk_06 = BattleMessage_Print(param0, v1, &v2, BattleSystem_TextSpeed(param0)); SysTask_Start(ov16_02262F7C, v0, 0); @@ -1506,7 +1504,7 @@ void ov16_0225E38C (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ v0->unk_00 = param0; v0->unk_04 = 60; - v0->unk_05 = param1->unk_190; + v0->unk_05 = param1->battler; v0->unk_06 = BattleMessage_Print(param0, v1, &v2, BattleSystem_TextSpeed(param0)); SysTask_Start(ov16_02262F7C, v0, 0); @@ -1525,7 +1523,7 @@ void ov16_0225E3E0 (BattleSystem * param0, BattlerData * param1) v0->unk_00 = param0; v0->unk_04 = 61; - v0->unk_05 = param1->unk_190; + v0->unk_05 = param1->battler; v0->unk_06 = BattleMessage_Print(param0, v1, &v2, BattleSystem_TextSpeed(param0)); SysTask_Start(ov16_02262F7C, v0, 0); @@ -1535,9 +1533,9 @@ void ov16_0225E434 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ { UnkStruct_ov12_022380DC v0; - ov16_02264530(param0, param2, &v0, param1->unk_190); + ov16_02264530(param0, param2, &v0, param1->battler); ov12_02238390(&v0, 5); - ov16_02266ABC(param0, param1->unk_190, param2->unk_00); + ClearCommand(param0, param1->battler, param2->unk_00); } void ov16_0225E468 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225CA4C * param2) @@ -1562,13 +1560,13 @@ void ov16_0225E468 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_ break; } - ov16_02266ABC(param0, param1->unk_190, param2->unk_00); + ClearCommand(param0, param1->battler, param2->unk_00); } void ov16_0225E4C8 (BattleSystem * param0, BattlerData * param1, UnkStruct_ov16_0225CA60 * param2) { Sound_PlayBGM(param2->unk_02); - ov16_02266ABC(param0, param1->unk_190, param2->unk_00); + ClearCommand(param0, param1->battler, param2->unk_00); } static void ov16_0225E4E8 (SysTask * param0, void * param1) @@ -1704,7 +1702,7 @@ static void ov16_0225E4E8 (SysTask * param0, void * param1) break; default: sub_02005454(0); - ov16_02266ABC(v0->unk_00, v0->unk_11, v0->unk_10); + ClearCommand(v0->unk_00, v0->unk_11, v0->unk_10); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -1786,7 +1784,7 @@ static void ov16_0225E894 (SysTask * param0, void * param1) break; default: sub_02005454(0); - ov16_02266ABC(v0->unk_00, v0->unk_11, v0->unk_10); + ClearCommand(v0->unk_00, v0->unk_11, v0->unk_10); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -2001,7 +1999,7 @@ static void ov16_0225EA80 (SysTask * param0, void * param1) break; default: sub_02005454(0); - ov16_02266ABC(v0->unk_00, v0->unk_81, v0->unk_80); + ClearCommand(v0->unk_00, v0->unk_81, v0->unk_80); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -2220,7 +2218,7 @@ static void ov16_0225F0C0 (SysTask * param0, void * param1) v0->unk_83++; break; default: - ov16_02266ABC(v0->unk_00, v0->unk_81, v0->unk_80); + ClearCommand(v0->unk_00, v0->unk_81, v0->unk_80); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -2346,7 +2344,7 @@ static void ov16_0225F764 (SysTask * param0, void * param1) } break; case 8: - ov16_02266ABC(v0->unk_00, v0->unk_69, v0->unk_68); + ClearCommand(v0->unk_00, v0->unk_69, v0->unk_68); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -2373,7 +2371,7 @@ static void ov16_0225FA00 (SysTask * param0, void * param1) } break; case 1: - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -2502,7 +2500,7 @@ static void ov16_0225FA70 (SysTask * param0, void * param1) v0->unk_0E = 4; case 4: - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -2786,7 +2784,7 @@ static void ov16_0225FD5C (SysTask * param0, void * param1) v0->unk_0A = 6; break; case 6: - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -2830,7 +2828,7 @@ static void ov16_02260284 (SysTask * param0, void * param1) sub_0200D090(v3, 20007 + v0->unk_04->battlerType); sub_0200D0A0(v3, 20007 + v0->unk_04->battlerType); } - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -2865,7 +2863,7 @@ static void ov16_02260384 (SysTask * param0, void * param1) sub_0200D4C4(v0->unk_04, v1, v2); break; case 1: - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -2893,7 +2891,7 @@ static void ov16_0226040C (SysTask * param0, void * param1) } break; default: - ov16_02266ABC(v0->unk_0C, v0->unk_24, v0->unk_4C); + ClearCommand(v0->unk_0C, v0->unk_24, v0->unk_4C); v0->unk_10 = NULL; SysTask_Done(param0); break; @@ -2911,7 +2909,7 @@ static void ov16_02260480 (SysTask * param0, void * param1) } break; default: - ov16_02266ABC(v0->unk_0C, v0->unk_24, v0->unk_4C); + ClearCommand(v0->unk_0C, v0->unk_24, v0->unk_4C); v0->unk_10 = NULL; SysTask_Done(param0); ov16_02267620(v0, 0); @@ -3177,7 +3175,7 @@ static void ov16_022604C8 (SysTask * param0, void * param1) case 8: if (ov16_0226BCD0(v2) == 1) { ov16_022656D4(v0->unk_00, v0->unk_09, v0->unk_0C); - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); } @@ -3193,7 +3191,7 @@ static void ov16_02260AB4 (SysTask * param0, void * param1) v1 = TrainerAI_PickCommand(v0->unk_00, v0->unk_09); ov16_022656D4(v0->unk_00, v0->unk_09, v1); - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -3203,7 +3201,7 @@ static void ov16_02260AE4 (SysTask * param0, void * param1) { UnkStruct_ov16_0225D5B8 * v0 = (UnkStruct_ov16_0225D5B8 *)param1; - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); } @@ -3242,7 +3240,7 @@ static void ov16_02260B04 (SysTask * param0, void * param1) ov16_022656D4(v0->unk_00, v0->unk_09, 5); } - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -3253,7 +3251,7 @@ static void ov16_02260B84 (SysTask * param0, void * param1) UnkStruct_ov16_0225D5B8 * v0 = (UnkStruct_ov16_0225D5B8 *)param1; ov16_022656D4(v0->unk_00, v0->unk_09, 4); - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -3273,7 +3271,7 @@ static void ov16_02260BAC (SysTask * param0, void * param1) } ov16_022656D4(v0->unk_00, v0->unk_09, v1); - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -3366,7 +3364,7 @@ static void ov16_02260C00 (SysTask * param0, void * param1) default: if (ov16_0226BCD0(v2) == 1) { ov16_0223F234(v0->unk_00, 1); - ov16_02266ABC(v0->unk_00, v0->unk_1D, v0->unk_1C); + ClearCommand(v0->unk_00, v0->unk_1D, v0->unk_1C); Heap_FreeToHeap(param1); SysTask_Done(param0); } @@ -3417,7 +3415,7 @@ static void ov16_02260DB0 (SysTask * param0, void * param1) } ov16_02265790(v0->unk_00, v0->unk_1D, v2); - ov16_02266ABC(v0->unk_00, v0->unk_1D, v0->unk_1C); + ClearCommand(v0->unk_00, v0->unk_1D, v0->unk_1C); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -3427,7 +3425,7 @@ static void ov16_02260E78 (SysTask * param0, void * param1) { UnkStruct_ov16_0225D698 * v0 = (UnkStruct_ov16_0225D698 *)param1; - ov16_02266ABC(v0->unk_00, v0->unk_1D, v0->unk_1C); + ClearCommand(v0->unk_00, v0->unk_1D, v0->unk_1C); Heap_FreeToHeap(param1); SysTask_Done(param0); } @@ -3456,7 +3454,7 @@ static void ov16_02260E98 (SysTask * param0, void * param1) } ov16_02265790(v0->unk_00, v0->unk_1D, v1); - ov16_02266ABC(v0->unk_00, v0->unk_1D, v0->unk_1C); + ClearCommand(v0->unk_00, v0->unk_1D, v0->unk_1C); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -3553,7 +3551,7 @@ static void ov16_02260F14 (SysTask * param0, void * param1) } ov16_022658CC(v0->unk_00, v0->unk_0D, v12); - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); } @@ -3574,7 +3572,7 @@ static void ov16_022610A8 (SysTask * param0, void * param1) GF_ASSERT(v2 < 5); ov16_022658CC(v0->unk_00, v0->unk_0D, v2); - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -3584,7 +3582,7 @@ static void ov16_022610EC (SysTask * param0, void * param1) { UnkStruct_ov16_0225D708 * v0 = (UnkStruct_ov16_0225D708 *)param1; - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -3634,7 +3632,7 @@ static void ov16_0226110C (SysTask * param0, void * param1) } ov16_022658CC(v0->unk_00, v0->unk_0D, v1); - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -3863,7 +3861,7 @@ static void ov16_022611DC (SysTask * param0, void * param1) } ov16_02265A70(v0->unk_00, v0->unk_0D, v7); - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(v0->unk_08->unk_04->unk_00); Heap_FreeToHeap(v0->unk_08->unk_04); @@ -4187,7 +4185,7 @@ static void ov16_02261D50 (SysTask * param0, void * param1) v1.item = 1; ov16_02265A70(v0->unk_00, v0->unk_0D, v1); - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(v0->unk_08->unk_04->unk_00); Heap_FreeToHeap(v0->unk_08->unk_04); @@ -4200,7 +4198,7 @@ static void ov16_02261DA8 (SysTask * param0, void * param1) { UnkStruct_ov16_0225D794 * v0 = (UnkStruct_ov16_0225D794 *)param1; - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(v0->unk_08->unk_04->unk_00); Heap_FreeToHeap(v0->unk_08->unk_04); @@ -4235,7 +4233,7 @@ static void ov16_02261DE0 (SysTask * param0, void * param1) v1.target = (v2 & 0xf0) >> 8; ov16_02265A70(v0->unk_00, v0->unk_0D, v1); - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(v0->unk_08->unk_04->unk_00); Heap_FreeToHeap(v0->unk_08->unk_04); @@ -4388,7 +4386,7 @@ static void ov16_02261E8C (SysTask * param0, void * param1) ov16_02265B10(v0->unk_00, v0->unk_09, 1 + v0->unk_04->unk_2C[v0->unk_04->unk_11]); } - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(v0->unk_04->unk_00); Heap_FreeToHeap(v0->unk_04); Heap_FreeToHeap(param1); @@ -4435,7 +4433,7 @@ static void ov16_02262258 (SysTask * param0, void * param1) } ov16_02265B10(v0->unk_00, v0->unk_09, 1 + v1); - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -4445,7 +4443,7 @@ static void ov16_0226230C (SysTask * param0, void * param1) { UnkStruct_ov16_0225D840 * v0 = (UnkStruct_ov16_0225D840 *)param1; - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -4489,7 +4487,7 @@ static void ov16_0226232C (SysTask * param0, void * param1) } ov16_02265B10(v0->unk_00, v0->unk_09, v1); - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -4615,7 +4613,7 @@ static void ov16_022623F0 (SysTask * param0, void * param1) case 4: if (ov16_0226BCD0(v2) == 1) { ov16_022656D4(v0->unk_00, v0->unk_0D, v0->unk_08); - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); } @@ -4627,7 +4625,7 @@ static void ov16_0226262C (SysTask * param0, void * param1) { UnkStruct_ov16_0225D8AC * v0 = (UnkStruct_ov16_0225D8AC *)param1; - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -4637,7 +4635,7 @@ static void ov16_0226264C (SysTask * param0, void * param1) { UnkStruct_ov16_0225D8AC * v0 = (UnkStruct_ov16_0225D8AC *)param1; - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -4657,7 +4655,7 @@ static void ov16_0226266C (SysTask * param0, void * param1) } ov16_022656D4(v0->unk_00, v0->unk_0D, v1); - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -4747,7 +4745,7 @@ static void ov16_022626C0 (SysTask * param0, void * param1) v0->unk_6A++; break; case 10: - ov16_02266ABC(v0->unk_00, v0->unk_69, v0->unk_68); + ClearCommand(v0->unk_00, v0->unk_69, v0->unk_68); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -4784,7 +4782,7 @@ static void ov16_0226292C (SysTask * param0, void * param1) } else { v1 = 0; sub_02007DEC(v0->unk_04, 6, v1); - ov16_02266ABC(v0->unk_00, v0->unk_08, 23); + ClearCommand(v0->unk_00, v0->unk_08, 23); Heap_FreeToHeap(param1); SysTask_Done(param0); } @@ -4807,7 +4805,7 @@ static void ov16_02262988 (SysTask * param0, void * param1) } break; default: - ov16_02266ABC(v0->unk_0C, v0->unk_24, v0->unk_4C); + ClearCommand(v0->unk_0C, v0->unk_24, v0->unk_4C); v0->unk_10 = NULL; SysTask_Done(param0); return; @@ -4850,7 +4848,7 @@ static void ov16_022629DC (SysTask * param0, void * param1) } break; default: - ov16_02266ABC(v0->unk_0C, v0->unk_24, v0->unk_4C); + ClearCommand(v0->unk_0C, v0->unk_24, v0->unk_4C); v0->unk_10 = NULL; SysTask_Done(param0); break; @@ -4972,7 +4970,7 @@ static void ov16_02262A9C (SysTask * param0, void * param1) } break; case 10: - ov16_02266ABC(v0->unk_00, v0->unk_65, v0->unk_64); + ClearCommand(v0->unk_00, v0->unk_65, v0->unk_64); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -5001,7 +4999,7 @@ static void ov16_02262D28 (SysTask * param0, void * param1) } break; case 2: - ov16_02266ABC(v0->unk_00, v0->unk_05, v0->unk_04); + ClearCommand(v0->unk_00, v0->unk_05, v0->unk_04); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -5067,7 +5065,7 @@ static void ov16_02262DC4 (SysTask * param0, void * param1) } break; default: - ov16_02266ABC(v0->unk_00, v0->unk_61, v0->unk_60); + ClearCommand(v0->unk_00, v0->unk_61, v0->unk_60); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -5086,7 +5084,7 @@ static void ov16_02262F30 (SysTask * param0, void * param1) break; case 1: if (v0->unk_0B == 1) { - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); } @@ -5104,7 +5102,7 @@ static void ov16_02262F7C (SysTask * param0, void * param1) } if (Message_Printing(v0->unk_06) == 0) { - ov16_02266ABC(v0->unk_00, v0->unk_05, v0->unk_04); + ClearCommand(v0->unk_00, v0->unk_05, v0->unk_04); Heap_FreeToHeap(param1); SysTask_Done(param0); } @@ -5124,7 +5122,7 @@ static void ov16_02262FC0 (SysTask * param0, void * param1) case 1: if (++v0->unk_08 == 40) { ov16_022661B0(v0->unk_00, v0->unk_05); - ov16_02266ABC(v0->unk_00, v0->unk_05, v0->unk_04); + ClearCommand(v0->unk_00, v0->unk_05, v0->unk_04); Heap_FreeToHeap(param1); SysTask_Done(param0); } @@ -5363,7 +5361,7 @@ static void ov16_022633A4 (SysTask * param0, void * param1) ov16_02265B10(v0->unk_00, v0->unk_09, v0->unk_04->unk_34 + 1); } - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(v0->unk_04); Heap_FreeToHeap(param1); @@ -5400,107 +5398,107 @@ static void ov16_022634DC (SysTask * param0, void * param1) } break; case 1: - ov16_02266ABC(v0->unk_00, v0->unk_09, v0->unk_08); + ClearCommand(v0->unk_00, v0->unk_09, v0->unk_08); Heap_FreeToHeap(param1); SysTask_Done(param0); break; } } -static void ov16_0226354C (SysTask * param0, void * param1) +static void ShowPartyGaugeTask (SysTask * param0, void * param1) { - UnkStruct_ov16_0225E134 * v0 = (UnkStruct_ov16_0225E134 *)param1; - UnkEnum_ov16_0226D194 v1; - UnkEnum_ov16_0226D194_1 v2; + PartyGaugeTask * v0 = (PartyGaugeTask *)param1; + enum PartyGaugeSide v1; + enum ShowPartyGaugeType v2; - if (Battler_Side(v0->unk_00, v0->unk_05) == 0) { - v1 = UnkEnum_ov16_0226D194_00; + if (Battler_Side(v0->battleSys, v0->battler) == 0) { + v1 = PARTY_GAUGE_OURS; } else { - v1 = UnkEnum_ov16_0226D194_01; + v1 = PARTY_GAUGE_THEIRS; } - switch (v0->unk_07) { + switch (v0->state) { case 0: { - UnkStruct_ov16_0226D160 * v3; - UnkEnum_ov16_0226D194_1 v4; - UnkEnum_ov16_0226D194_3 v5; + PartyGauge * v3; + enum ShowPartyGaugeType v4; + enum PartyGaugePosition v5; - if (v0->unk_0E == 0) { - v4 = UnkEnum_ov16_0226D194_1_00; - v5 = UnkEnum_ov16_0226D194_3_01; + if (v0->midBattle == 0) { + v4 = SHOW_PARTY_GAUGE_BATTLE_START; + v5 = PARTY_GAUGE_POSITION_MIDDLE; } else { - v4 = UnkEnum_ov16_0226D194_1_01; + v4 = SHOW_PARTY_GAUGE_MID_BATTLE; - switch (v0->unk_06) { + switch (v0->battlerType) { case 3: - v5 = UnkEnum_ov16_0226D194_3_00; + v5 = PARTY_GAUGE_POSITION_HIGH; break; case 5: - v5 = UnkEnum_ov16_0226D194_3_02; + v5 = PARTY_GAUGE_POSITION_LOW; break; default: - v5 = UnkEnum_ov16_0226D194_3_01; + v5 = PARTY_GAUGE_POSITION_MIDDLE; break; } } - v3 = ov16_0226D194(v0->unk_08, v1, v4, v5, ov16_0223E010(v0->unk_00), ov16_0223E018(v0->unk_00)); - ov16_0223E040(v0->unk_00, v1, v3); + v3 = ov16_0226D194(v0->status, v1, v4, v5, ov16_0223E010(v0->battleSys), ov16_0223E018(v0->battleSys)); + ov16_0223E040(v0->battleSys, v1, v3); } - v0->unk_07++; + v0->state++; break; case 1: - if (ov16_0226D1FC(ov16_0223E034(v0->unk_00, v1)) == 1) { - v0->unk_07++; + if (ov16_0226D1FC(ov16_0223E034(v0->battleSys, v1)) == 1) { + v0->state++; } break; default: - ov16_02266ABC(v0->unk_00, v0->unk_05, v0->unk_04); + ClearCommand(v0->battleSys, v0->battler, v0->command); Heap_FreeToHeap(param1); SysTask_Done(param0); break; } } -static void ov16_02263604 (SysTask * param0, void * param1) +static void HidePartyGaugeTask (SysTask * param0, void * param1) { - UnkStruct_ov16_0225E134 * v0 = (UnkStruct_ov16_0225E134 *)param1; - UnkEnum_ov16_0226D194 v1; - UnkStruct_ov16_0226D160 * v2; - UnkEnum_ov16_0226D220 v3; - UnkEnum_ov16_0226D194_2 v4; + PartyGaugeTask * v0 = (PartyGaugeTask *)param1; + enum PartyGaugeSide v1; + PartyGauge * v2; + enum HideArrowType v3; + enum HidePartyGaugeType v4; - if (Battler_Side(v0->unk_00, v0->unk_05) == 0) { - v1 = UnkEnum_ov16_0226D194_00; + if (Battler_Side(v0->battleSys, v0->battler) == 0) { + v1 = PARTY_GAUGE_OURS; } else { - v1 = UnkEnum_ov16_0226D194_01; + v1 = PARTY_GAUGE_THEIRS; } - v2 = ov16_0223E034(v0->unk_00, v1); + v2 = ov16_0223E034(v0->battleSys, v1); - switch (v0->unk_07) { + switch (v0->state) { case 0: - if (v0->unk_0E == 0) { - v3 = UnkEnum_ov16_0226D220_00; - v4 = UnkEnum_ov16_0226D194_2_00; + if (v0->midBattle == 0) { + v3 = HIDE_ARROW_FADE_AND_SCROLL; + v4 = HIDE_PARTY_GAUGE_BATTLE_START; } else { - v3 = UnkEnum_ov16_0226D220_01; - v4 = UnkEnum_ov16_0226D194_2_01; + v3 = HIDE_ARROW_FADE_IN_PLACE; + v4 = HIDE_PARTY_GAUGE_MID_BATTLE; } ov16_0226D220(v2, v3, v4); - v0->unk_07++; + v0->state++; break; case 1: if (ov16_0226D258(v2) == 1) { ov16_0226D27C(v2); - ov16_0223E040(v0->unk_00, v1, NULL); - v0->unk_07++; + ov16_0223E040(v0->battleSys, v1, NULL); + v0->state++; } break; default: - ov16_02266ABC(v0->unk_00, v0->unk_05, v0->unk_04); + ClearCommand(v0->battleSys, v0->battler, v0->command); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -5518,7 +5516,7 @@ static void ov16_02263688 (SysTask * param0, void * param1) v0->unk_0E++; break; default: - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); break; @@ -5540,7 +5538,7 @@ static void ov16_022636D4 (SysTask * param0, void * param1) ov12_022237A4(v0->unk_04->unk_88, v0->unk_0D); v0->unk_04->unk_88 = NULL; - ov16_02266ABC(v0->unk_00, v0->unk_0D, v0->unk_0C); + ClearCommand(v0->unk_00, v0->unk_0D, v0->unk_0C); Heap_FreeToHeap(param1); SysTask_Done(param0); @@ -5552,7 +5550,7 @@ void ov16_02263730 (BattleSystem * param0, BattlerData * param1) u32 v1 = BattleSystem_BattleStatus(param0); if (v0 & 0x40) { - if (param1->unk_190) { + if (param1->battler) { param1->unk_00.unk_00 = &ov16_02260AB4; param1->unk_00.unk_04 = &ov16_02260DB0; param1->unk_00.unk_08 = &ov16_022610A8; @@ -5829,14 +5827,14 @@ static void ov16_02263C1C (BattleSystem * param0, BattlerData * param1, UnkStruc if (BattleSystem_BattleType(param0) & 0x4) { param3->id = 990; param3->tags = 27; - param3->params[0] = param1->unk_190; - param3->params[1] = param1->unk_190 | (param2->unk_01 << 8); + param3->params[0] = param1->battler; + param3->params[1] = param1->battler | (param2->unk_01 << 8); } else { param3->id = 989; param3->tags = 50; - param3->params[0] = param1->unk_190; - param3->params[1] = param1->unk_190; - param3->params[2] = param1->unk_190 | (param2->unk_01 << 8); + param3->params[0] = param1->battler; + param3->params[1] = param1->battler; + param3->params[2] = param1->battler | (param2->unk_01 << 8); } } else { if (((BattleSystem_BattleType(param0) & 0x2) == 0) && ((BattleSystem_BattleType(param0) & 0x4) == 0)) { @@ -5856,7 +5854,7 @@ static void ov16_02263C1C (BattleSystem * param0, BattlerData * param1, UnkStruc } param3->tags = 2; - param3->params[0] = param1->unk_190 | (param2->unk_01 << 8); + param3->params[0] = param1->battler | (param2->unk_01 << 8); } } @@ -5866,14 +5864,14 @@ static void ov16_02263CF0 (BattleSystem * param0, BattlerData * param1, UnkStruc if ((BattleSystem_BattleType(param0) & 0x4) == 0) { param3->id = 972; param3->tags = 50; - param3->params[0] = param1->unk_190; - param3->params[1] = param1->unk_190; - param3->params[2] = param1->unk_190 | (param2->unk_01 << 8); + param3->params[0] = param1->battler; + param3->params[1] = param1->battler; + param3->params[2] = param1->battler | (param2->unk_01 << 8); } else { param3->id = 974; param3->tags = 27; - param3->params[0] = param1->unk_190; - param3->params[1] = param1->unk_190 | (param2->unk_01 << 8); + param3->params[0] = param1->battler; + param3->params[1] = param1->battler | (param2->unk_01 << 8); } } else { if (((BattleSystem_BattleType(param0) & 0x2) == 0) && ((BattleSystem_BattleType(param0) & 0x4) == 0)) { @@ -5893,7 +5891,7 @@ static void ov16_02263CF0 (BattleSystem * param0, BattlerData * param1, UnkStruc } param3->tags = 2; - param3->params[0] = param1->unk_190 | (param2->unk_01 << 8); + param3->params[0] = param1->battler | (param2->unk_01 << 8); } } @@ -5958,10 +5956,10 @@ static void ov16_02263E7C (BattleSystem * param0, BattlerData * param1, UnkStruc if (param1->battlerType & 0x1) { if (v0 & 0x2) { - v1 = param1->unk_190; - v2 = BattleSystem_Partner(param0, param1->unk_190); + v1 = param1->battler; + v2 = BattleSystem_Partner(param0, param1->battler); } else { - v1 = param1->unk_190; + v1 = param1->battler; v2 = v1; } @@ -6046,13 +6044,13 @@ static void ov16_02263E7C (BattleSystem * param0, BattlerData * param1, UnkStruc } } } else if (v0 & 0x8) { - v1 = BattleSystem_Partner(param0, param1->unk_190); - v2 = param1->unk_190; + v1 = BattleSystem_Partner(param0, param1->battler); + v2 = param1->battler; } else if (v0 & 0x2) { v1 = BattleSystem_BattlerOfType(param0, 2); v2 = BattleSystem_BattlerOfType(param0, 4); } else { - v1 = param1->unk_190; + v1 = param1->battler; v2 = v1; } @@ -6209,7 +6207,7 @@ static void ov16_02264360 (BattleSystem * param0, BattlerData * param1, BattleMe param2->params[0] = BattleSystem_BattlerOfType(param0, 2); } } else { - param2->params[0] = param1->unk_190; + param2->params[0] = param1->battler; } BattleSystem_SetResultFlag(param0, 0x2 | 0x80 | 0x40); @@ -6270,7 +6268,7 @@ static void ov16_02264408 (BattleSystem * param0, BattlerData * param1, UnkStruc ov16_0223F8AC(param0, &(v0.unk_20[0])); v0.unk_30 = BattleSystem_BattleType(param0); - v0.unk_6C = BattleSystem_ChatotVoice(param0, param1->unk_190); + v0.unk_6C = BattleSystem_ChatotVoice(param0, param1->battler); v0.unk_70 = ov16_0223F1E8(param0); v0.unk_74 = ov16_0223F1F0(param0); v0.unk_54.unk_00 = 7; diff --git a/src/overlay016/ov16_0226485C.c b/src/overlay016/ov16_0226485C.c index 717c700fdf..705cc70849 100644 --- a/src/overlay016/ov16_0226485C.c +++ b/src/overlay016/ov16_0226485C.c @@ -2,6 +2,8 @@ #include #include "constants/pokemon.h" +#include "constants/species.h" +#include "constants/battle/battle_io.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/battle_system.h" @@ -37,7 +39,7 @@ #include "overlay016/struct_ov16_0225C468.h" #include "overlay016/struct_ov16_0225C65C.h" #include "overlay016/struct_ov16_0225C684.h" -#include "overlay016/struct_ov16_0225C840.h" +#include "struct_defs/battle_io.h" #include "overlay016/struct_ov16_0225C988.h" #include "overlay016/struct_ov16_0225C9F0.h" #include "overlay016/struct_ov16_0225CA14.h" @@ -69,87 +71,9 @@ #include "battle/battle_lib.h" #include "overlay016/ov16_0226485C.h" -void BattleIO_SetupBattleUI(BattleSystem * param0, int param1); -void BattleIO_SetEncounter(BattleSystem * param0, int param1); -void BattleIO_ShowEncounter(BattleSystem * param0, int param1); -void BattleIO_ShowPokemon(BattleSystem * param0, int param1, int param2, int param3); -void BattleIO_ReturnPokemon(BattleSystem * param0, BattleContext * param1, int param2); -void ov16_02265050(BattleSystem * param0, int param1, int param2); -void BattleIO_DeletePokemon(BattleSystem * param0, int param1); -void BattleIO_SetTrainerEncounter(BattleSystem * param0, int param1); -void BattleIO_ThrowTrainerBall(BattleSystem * param0, int param1, int param2); -void BattleIO_SlideTrainerOut(BattleSystem * param0, int param1); -void BattleIO_SlideTrainerIn(BattleSystem * param0, int param1, int param2); -void BattleIO_SlideHPGaugeIn(BattleSystem * param0, BattleContext * param1, int param2, int param3); -void BattleIO_SlideHPGaugeOut(BattleSystem * param0, int param1); -void BattleIO_SetCommandSelection(BattleSystem *battleSys, BattleContext *battleCtx, int battler, int partySlot); -void ov16_022656D4(BattleSystem * param0, int param1, int param2); -void BattleIO_ShowMoveSelectScreen(BattleSystem *battleSys, BattleContext *battleCtx, int battler); -void ov16_02265790(BattleSystem * param0, int param1, int param2); -void BattleIO_ShowTargetSelection(BattleSystem *battleSys, BattleContext *battleCtx, int range, int battler); -void ov16_022658CC(BattleSystem * param0, int param1, int param2); -void BattleIO_ShowBagScreen(BattleSystem *battleSys, BattleContext *battleCtx, int battler); -void ov16_02265A70(BattleSystem * param0, int param1, BattleItemUse param2); -void BattleIO_ShowPartyScreen(BattleSystem *battleSys, BattleContext *battleCtx, int battler, int listMode, int canSwitch, int doubles); -void ov16_02265B10(BattleSystem * param0, int param1, int param2); -void BattleIO_ShowYesNoScreen(BattleSystem *battleSys, BattleContext *battleCtx, int battler, int promptMsg, int yesnoType, int move, int nickname); -void BattleIO_PrintAttackMessage(BattleSystem * param0, BattleContext * param1); -void BattleIO_PrintMessage(BattleSystem * param0, BattleContext * param1, BattleMessage * param2); -void BattleIO_PlayMoveAnimation(BattleSystem * param0, BattleContext * param1, u16 param2); -void BattleIO_PlayMoveAnimationA2D(BattleSystem * param0, BattleContext * param1, u16 param2, int param3, int param4); -void BattleIO_FlickerBattler(BattleSystem * param0, int param1, u32 param2); -void BattleIO_UpdateHPGauge(BattleSystem * param0, BattleContext * param1, int param2); -void BattleIO_UpdateExpGauge(BattleSystem * param0, BattleContext * param1, int param2, int param3); -void BattleIO_PlayFaintingSequence(BattleSystem * param0, BattleContext * param1, int param2); -void BattleIO_PlaySound(BattleSystem * param0, BattleContext * param1, int param2, int param3); -void BattleIO_FadeOut(BattleSystem * param0, BattleContext * param1); -void BattleIO_ToggleVanish(BattleSystem * param0, int param1, int param2); -void BattleIO_SetStatusIcon(BattleSystem * param0, int param1, int param2); -void BattleIO_TrainerMessage(BattleSystem * param0, int param1, int param2); -void BattleIO_PlayStatusEffect(BattleSystem * param0, BattleContext * param1, int param2, int param3); -void BattleIO_PlayStatusEffectAToD(BattleSystem * param0, BattleContext * param1, int param2, int param3, int param4); -void BattleIO_PrintRecallMessage(BattleSystem * param0, BattleContext * param1, int param2, int param3); -void BattleIO_PrintSendOutMessage(BattleSystem * param0, BattleContext * param1, int param2, int param3); -void BattleIO_PrintBattleStartMessage(BattleSystem * param0, BattleContext * param1, int param2); -void BattleIO_PrintLeadMonMessage(BattleSystem * param0, BattleContext * param1, int param2); -void BattleIO_PlayLevelUpAnimation(BattleSystem * param0, int param1); -void BattleIO_SetAlertMessage(BattleSystem *battleSys, int battler, BattleMessage msg); -void ov16_022661B0(BattleSystem * param0, int param1); -void BattleIO_RefreshHPGauge(BattleSystem * param0, BattleContext * param1, int param2); -void BattleIO_UpdatePartyMon(BattleSystem * param0, BattleContext * param1, int param2); -void ov16_02266460(BattleSystem * param0, int param1); -void BattleIO_StopGaugeAnimation(BattleSystem *battleSys, int battler); -void BattleIO_RefreshPartyStatus(BattleSystem * param0, BattleContext * param1, int param2, int param3); -void BattleIO_ForgetMove(BattleSystem * param0, int param1, int param2, int param3); -void BattleIO_SetMosaic(BattleSystem * param0, int param1, int param2, int param3); -void BattleIO_ChangeWeatherForm(BattleSystem * param0, int param1); -void BattleIO_UpdateBG(BattleSystem * param0, int param1); -void BattleIO_ClearTouchScreen(BattleSystem * param0, int param1); -void BattleIO_ShowBattleStartPartyGauge(BattleSystem * param0, int param1); -void BattleIO_HideBattleStartPartyGauge(BattleSystem * param0, int param1); -void BattleIO_ShowPartyGauge(BattleSystem * param0, int param1); -void BattleIO_HidePartyGauge(BattleSystem * param0, int param1); -void BattleIO_LoadPartyGaugeGraphics(BattleSystem * param0); -void BattleIO_FreePartyGaugeGraphics(BattleSystem * param0); -void BattleIO_IncrementRecord(BattleSystem * param0, int param1, int param2, int param3); -void BattleIO_LinkWaitMessage(BattleSystem *battleSys, int battler); -void BattleIO_RestoreSprite(BattleSystem * param0, BattleContext * param1, int param2); -void BattleIO_SpriteToOAM(BattleSystem * param0, int param1); -void BattleIO_OAMToSprite(BattleSystem * param0, int param1); -void BattleIO_ResultMessage(BattleSystem * param0); -void BattleIO_EscapeMessage(BattleSystem * param0, BattleContext * param1); -void BattleIO_ForfeitMessage(BattleSystem * param0); -void BattleIO_RefreshSprite(BattleSystem * param0, BattleContext * param1, int param2); -void BattleIO_PlayMoveHitSoundEffect(BattleSystem * param0, BattleContext * param1, int param2); -void BattleIO_PlayMusic(BattleSystem * param0, int param1, int param2); -void BattleIO_SubmitResult(BattleSystem * param0); -void ov16_02266ABC(BattleSystem * param0, int param1, int param2); -BOOL ov16_02266AE4(BattleSystem * param0, void * param1); -void ov16_02266B78(BattleSystem * param0, BattleContext * param1, UnkStruct_ov16_02265BBC * param2, int param3, int param4, int param5, int param6, u16 param7); -void ov16_02264988(BattleSystem * param0, int param1); static void ov16_0226485C(BattleSystem * param0, int param1, int param2, void * param3, u8 param4); -static void ov16_02264A04(BattleSystem * param0, int param1, int param2, void * param3, u8 param4); -static void ov16_02266CF0(BattleSystem * param0, BattleContext * param1, UnkStruct_ov16_0225C840 * param2, int param3, int param4); +static void SendMessage(BattleSystem *battleSys, int recipient, int message, void *body, u8 bodySize); +static void PartyGaugeData_New(BattleSystem *battleSys, BattleContext *battleCtx, PartyGaugeData *partyGauge, int command, int battler); static void ov16_0226485C (BattleSystem * param0, int param1, int param2, void * param3, u8 param4) { @@ -218,9 +142,9 @@ static BOOL ov16_022648F4 (BattleSystem * param0, void * param1) v5 = 1; } } else if (v1 == 1) { - if (param0->battlers[v2]->unk_90[0] == 0) { + if (param0->battlers[v2]->data[0] == 0) { for (v4 = 0; v4 < v3; v4++) { - param0->battlers[v2]->unk_90[v4] = v0[v4]; + param0->battlers[v2]->data[v4] = v0[v4]; } v5 = 1; @@ -280,29 +204,24 @@ void ov16_02264988 (BattleSystem * param0, int param1) } } -static void ov16_02264A04 (BattleSystem * param0, int param1, int param2, void * param3, u8 param4) +static void SendMessage(BattleSystem *battleSys, int recipient, int message, void *body, u8 bodySize) { - int v0; - u8 * v1 = (u8 *)param3; - - if ((param0->battleType & 0x4) && ((param0->battleStatusMask & 0x10) == 0)) { - if (param1 == 1) { - { - int v2; + u8 *data = body; - for (v2 = 0; v2 < sub_02035E18(); v2++) { - BattleIO_EnqueueVal(param0->battleCtx, v2, param2, v1[0]); - } + if ((battleSys->battleType & BATTLE_TYPE_LINK) && (battleSys->battleStatusMask & BATTLE_TYPE_TAG) == FALSE) { + if (recipient == 1) { + for (int i = 0; i < sub_02035E18(); i++) { + BattleIO_EnqueueVal(battleSys->battleCtx, i, message, *data); } } - sub_0207A81C(param0, param1, param2, param3, param4); + sub_0207A81C(battleSys, recipient, message, body, bodySize); } else { - if (param1 == 1) { - BattleIO_EnqueueVal(param0->battleCtx, 0, param2, v1[0]); + if (recipient == 1) { + BattleIO_EnqueueVal(battleSys->battleCtx, 0, message, *data); } - ov16_0226485C(param0, param1, param2, param3, param4); + ov16_0226485C(battleSys, recipient, message, body, bodySize); } } @@ -313,7 +232,7 @@ void BattleIO_SetupBattleUI (BattleSystem * param0, int param1) v0.unk_00 = 1; v0.unk_04 = ov16_0223F4E8(param0); - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_02264A8C)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_02264A8C)); } void BattleIO_SetEncounter (BattleSystem * param0, int param1) @@ -336,7 +255,7 @@ void BattleIO_SetEncounter (BattleSystem * param0, int param1) } BattleMon_Get(param0->battleCtx, param1, 45, &v0.unk_24); - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C168)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C168)); } void BattleIO_ShowEncounter (BattleSystem * param0, int param1) @@ -364,7 +283,7 @@ void BattleIO_ShowEncounter (BattleSystem * param0, int param1) } BattleMon_Get(param0->battleCtx, param1, 45, &v0.unk_30); - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C17C)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C17C)); } void BattleIO_ShowPokemon (BattleSystem * param0, int param1, int param2, int param3) @@ -421,7 +340,7 @@ void BattleIO_ShowPokemon (BattleSystem * param0, int param1, int param2, int pa } } - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C17C)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C17C)); } void BattleIO_ReturnPokemon (BattleSystem * param0, BattleContext * param1, int param2) @@ -463,7 +382,7 @@ void BattleIO_ReturnPokemon (BattleSystem * param0, BattleContext * param1, int } } - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_02264EF8)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_02264EF8)); } void ov16_02265050 (BattleSystem * param0, int param1, int param2) @@ -488,13 +407,13 @@ void ov16_02265050 (BattleSystem * param0, int param1, int param2) } v0.unk_02 = param2; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_02265050)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_02265050)); } void BattleIO_DeletePokemon (BattleSystem * param0, int param1) { int v0 = 7; - ov16_02264A04(param0, 1, param1, &v0, 4); + SendMessage(param0, 1, param1, &v0, 4); } void BattleIO_SetTrainerEncounter (BattleSystem * param0, int param1) @@ -505,7 +424,7 @@ void BattleIO_SetTrainerEncounter (BattleSystem * param0, int param1) v0.unk_02 = param0->trainers[param1].class; v0.unk_01 = param0->unk_A8[param1]; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_02265124)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_02265124)); } void BattleIO_ThrowTrainerBall (BattleSystem * param0, int param1, int param2) @@ -516,14 +435,14 @@ void BattleIO_ThrowTrainerBall (BattleSystem * param0, int param1, int param2) v0.unk_01 = param2; v0.unk_02 = param0->battleCtx->selectedPartySlot[BattleSystem_Partner(param0, param1)]; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_02265154)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_02265154)); } void BattleIO_SlideTrainerOut (BattleSystem * param0, int param1) { int v0 = 10; - ov16_02264A04(param0, 1, param1, &v0, 4); + SendMessage(param0, 1, param1, &v0, 4); } void BattleIO_SlideTrainerIn (BattleSystem * param0, int param1, int param2) @@ -535,7 +454,7 @@ void BattleIO_SlideTrainerIn (BattleSystem * param0, int param1, int param2) v0.unk_01 = param0->unk_A8[param1]; v0.unk_04 = param2; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_022651A8)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_022651A8)); } void BattleIO_SlideHPGaugeIn (BattleSystem * param0, BattleContext * param1, int param2, int param3) @@ -568,13 +487,13 @@ void BattleIO_SlideHPGaugeIn (BattleSystem * param0, BattleContext * param1, int v0.unk_10 = BattleSystem_NumSafariBalls(param0); v0.unk_14 = param3; - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C23C)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C23C)); } void BattleIO_SlideHPGaugeOut (BattleSystem * param0, int param1) { int v0 = 13; - ov16_02264A04(param0, 1, param1, &v0, 4); + SendMessage(param0, 1, param1, &v0, 4); } void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battleCtx, int battler, int partySlot) @@ -741,12 +660,12 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl v0.unk_28 = 2; } - ov16_02264A04(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C260)); + SendMessage(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C260)); } void ov16_022656D4 (BattleSystem * param0, int param1, int param2) { - ov16_02264A04(param0, 0, param1, ¶m2, 4); + SendMessage(param0, 0, param1, ¶m2, 4); } void BattleIO_ShowMoveSelectScreen (BattleSystem *battleSys, BattleContext *battleCtx, int battler) @@ -765,12 +684,12 @@ void BattleIO_ShowMoveSelectScreen (BattleSystem *battleSys, BattleContext *batt v0.unk_02 = BattleSystem_CheckInvalidMoves(battleSys, battleCtx, battler, 0, CHECK_INVALID_ALL); - ov16_02264A04(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_022656F0)); + SendMessage(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_022656F0)); } void ov16_02265790 (BattleSystem * param0, int param1, int param2) { - ov16_02264A04(param0, 0, param1, ¶m2, 4); + SendMessage(param0, 0, param1, ¶m2, 4); } void BattleIO_ShowTargetSelection (BattleSystem *battleSys, BattleContext *battleCtx, int range, int battler) @@ -817,12 +736,12 @@ void BattleIO_ShowTargetSelection (BattleSystem *battleSys, BattleContext *battl } } - ov16_02264A04(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C29C)); + SendMessage(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C29C)); } void ov16_022658CC (BattleSystem * param0, int param1, int param2) { - ov16_02264A04(param0, 0, param1, ¶m2, 4); + SendMessage(param0, 0, param1, ¶m2, 4); } void BattleIO_ShowBagScreen (BattleSystem *battleSys, BattleContext *battleCtx, int battler) @@ -895,12 +814,12 @@ void BattleIO_ShowBagScreen (BattleSystem *battleSys, BattleContext *battleCtx, v0.unk_03 = 0; } - ov16_02264A04(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C2B0)); + SendMessage(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C2B0)); } void ov16_02265A70 (BattleSystem * param0, int param1, BattleItemUse param2) { - ov16_02264A04(param0, 0, param1, ¶m2, sizeof(BattleItemUse)); + SendMessage(param0, 0, param1, ¶m2, sizeof(BattleItemUse)); } void BattleIO_ShowPartyScreen (BattleSystem *battleSys, BattleContext *battleCtx, int battler, int listMode, int canSwitch, int doubles) @@ -925,12 +844,12 @@ void BattleIO_ShowPartyScreen (BattleSystem *battleSys, BattleContext *battleCtx } } - ov16_02264A04(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C2C4)); + SendMessage(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C2C4)); } void ov16_02265B10 (BattleSystem * param0, int param1, int param2) { - ov16_02264A04(param0, 0, param1, ¶m2, 4); + SendMessage(param0, 0, param1, ¶m2, 4); } void BattleIO_ShowYesNoScreen (BattleSystem *battleSys, BattleContext *battleCtx, int battler, int promptMsg, int yesnoType, int move, int nickname) @@ -945,7 +864,7 @@ void BattleIO_ShowYesNoScreen (BattleSystem *battleSys, BattleContext *battleCtx v0.unk_04 = move; v0.unk_08 = nickname; - ov16_02264A04(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C2D8)); + SendMessage(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C2D8)); } void BattleIO_PrintAttackMessage (BattleSystem * param0, BattleContext * param1) @@ -956,13 +875,13 @@ void BattleIO_PrintAttackMessage (BattleSystem * param0, BattleContext * param1) v0.unk_01 = param1->selectedPartySlot[param1->attacker]; v0.unk_02 = param1->moveCur; - ov16_02264A04(param0, 1, param1->attacker, &v0, sizeof(UnkStruct_ov16_0225C2EC)); + SendMessage(param0, 1, param1->attacker, &v0, sizeof(UnkStruct_ov16_0225C2EC)); } void BattleIO_PrintMessage (BattleSystem * param0, BattleContext * param1, BattleMessage * param2) { param2->commandCode = 21; - ov16_02264A04(param0, 1, param1->attacker, param2, sizeof(BattleMessage)); + SendMessage(param0, 1, param1->attacker, param2, sizeof(BattleMessage)); } void BattleIO_PlayMoveAnimation (BattleSystem * param0, BattleContext * param1, u16 param2) @@ -970,7 +889,7 @@ void BattleIO_PlayMoveAnimation (BattleSystem * param0, BattleContext * param1, UnkStruct_ov16_02265BBC v0; ov16_02266B78(param0, param1, &v0, 0, NULL, param1->attacker, param1->defender, param2); - ov16_02264A04(param0, 1, param1->attacker, &v0, sizeof(UnkStruct_ov16_02265BBC)); + SendMessage(param0, 1, param1->attacker, &v0, sizeof(UnkStruct_ov16_02265BBC)); } void BattleIO_PlayMoveAnimationA2D (BattleSystem * param0, BattleContext * param1, u16 param2, int param3, int param4) @@ -978,13 +897,13 @@ void BattleIO_PlayMoveAnimationA2D (BattleSystem * param0, BattleContext * param UnkStruct_ov16_02265BBC v0; ov16_02266B78(param0, param1, &v0, 0, NULL, param3, param4, param2); - ov16_02264A04(param0, 1, param3, &v0, sizeof(UnkStruct_ov16_02265BBC)); + SendMessage(param0, 1, param3, &v0, sizeof(UnkStruct_ov16_02265BBC)); } void BattleIO_FlickerBattler (BattleSystem * param0, int param1, u32 param2) { int v0 = 23; - ov16_02264A04(param0, 1, param1, &v0, 4); + SendMessage(param0, 1, param1, &v0, 4); } void BattleIO_UpdateHPGauge (BattleSystem * param0, BattleContext * param1, int param2) @@ -1013,7 +932,7 @@ void BattleIO_UpdateHPGauge (BattleSystem * param0, BattleContext * param1, int v0.unk_0C = param1->battleMons[param2].exp - Pokemon_GetSpeciesBaseExpAt(v2, v3); v0.unk_10 = Pokemon_GetSpeciesBaseExpAt(v2, v3 + 1) - Pokemon_GetSpeciesBaseExpAt(v2, v3); - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C35C)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C35C)); } void BattleIO_UpdateExpGauge (BattleSystem * param0, BattleContext * param1, int param2, int param3) @@ -1032,7 +951,7 @@ void BattleIO_UpdateExpGauge (BattleSystem * param0, BattleContext * param1, int v0.unk_08 = param1->battleMons[param2].exp - Pokemon_GetSpeciesBaseExpAt(v2, v3); v0.unk_0C = Pokemon_GetSpeciesBaseExpAt(v2, v3 + 1) - Pokemon_GetSpeciesBaseExpAt(v2, v3); - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C370)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C370)); } void BattleIO_PlayFaintingSequence (BattleSystem * param0, BattleContext * param1, int param2) @@ -1068,7 +987,7 @@ void BattleIO_PlayFaintingSequence (BattleSystem * param0, BattleContext * param } } - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C384)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C384)); } void BattleIO_PlaySound (BattleSystem * param0, BattleContext * param1, int param2, int param3) @@ -1078,14 +997,14 @@ void BattleIO_PlaySound (BattleSystem * param0, BattleContext * param1, int para v0.unk_00 = 27; v0.unk_04 = param2; - ov16_02264A04(param0, 1, param3, &v0, sizeof(UnkStruct_ov16_0225C398)); + SendMessage(param0, 1, param3, &v0, sizeof(UnkStruct_ov16_0225C398)); } void BattleIO_FadeOut (BattleSystem * param0, BattleContext * param1) { int v0 = 28; - ov16_02264A04(param0, 1, 0, &v0, 4); + SendMessage(param0, 1, 0, &v0, 4); } void BattleIO_ToggleVanish (BattleSystem * param0, int param1, int param2) @@ -1111,7 +1030,7 @@ void BattleIO_ToggleVanish (BattleSystem * param0, int param1, int param2) } } - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C3BC)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C3BC)); } void BattleIO_SetStatusIcon (BattleSystem * param0, int param1, int param2) @@ -1121,7 +1040,7 @@ void BattleIO_SetStatusIcon (BattleSystem * param0, int param1, int param2) v0.unk_00 = 30; v0.unk_01 = param2; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C3D0)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C3D0)); } void BattleIO_TrainerMessage (BattleSystem * param0, int param1, int param2) @@ -1131,7 +1050,7 @@ void BattleIO_TrainerMessage (BattleSystem * param0, int param1, int param2) v0.unk_00 = 31; v0.unk_01 = param2; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C3E4)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C3E4)); } void BattleIO_PlayStatusEffect (BattleSystem * param0, BattleContext * param1, int param2, int param3) @@ -1139,7 +1058,7 @@ void BattleIO_PlayStatusEffect (BattleSystem * param0, BattleContext * param1, i UnkStruct_ov16_02265BBC v0; ov16_02266B78(param0, param1, &v0, 1, param3, param2, param2, NULL); - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_02265BBC)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_02265BBC)); } void BattleIO_PlayStatusEffectAToD (BattleSystem * param0, BattleContext * param1, int param2, int param3, int param4) @@ -1147,7 +1066,7 @@ void BattleIO_PlayStatusEffectAToD (BattleSystem * param0, BattleContext * param UnkStruct_ov16_02265BBC v0; ov16_02266B78(param0, param1, &v0, 1, param4, param2, param3, NULL); - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_02265BBC)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_02265BBC)); } void BattleIO_PrintRecallMessage (BattleSystem * param0, BattleContext * param1, int param2, int param3) @@ -1158,7 +1077,7 @@ void BattleIO_PrintRecallMessage (BattleSystem * param0, BattleContext * param1, v0.unk_01 = param3; v0.unk_02 = (param1->hpTemp - param1->battleMons[1].curHP) * 100 / param1->hpTemp; - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C3F8)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C3F8)); } void BattleIO_PrintSendOutMessage (BattleSystem * param0, BattleContext * param1, int param2, int param3) @@ -1174,14 +1093,14 @@ void BattleIO_PrintSendOutMessage (BattleSystem * param0, BattleContext * param1 v0.unk_02 = param1->battleMons[1].curHP * 1000 / param1->battleMons[1].maxHP; } - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C40C)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C40C)); } void BattleIO_PrintBattleStartMessage (BattleSystem * param0, BattleContext * param1, int param2) { int v0 = 34; - ov16_02264A04(param0, 1, param2, &v0, 4); + SendMessage(param0, 1, param2, &v0, 4); } void BattleIO_PrintLeadMonMessage (BattleSystem * param0, BattleContext * param1, int param2) @@ -1195,14 +1114,14 @@ void BattleIO_PrintLeadMonMessage (BattleSystem * param0, BattleContext * param1 v0.unk_04[v1] = param1->selectedPartySlot[v1]; } - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C430)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C430)); } void BattleIO_PlayLevelUpAnimation (BattleSystem * param0, int param1) { int v0 = 36; - ov16_02264A04(param0, 1, param1, &v0, 4); + SendMessage(param0, 1, param1, &v0, 4); } void BattleIO_SetAlertMessage (BattleSystem *battleSys, int battler, BattleMessage msg) @@ -1214,7 +1133,7 @@ void BattleIO_SetAlertMessage (BattleSystem *battleSys, int battler, BattleMessa v0.unk_00 = 37; v0.unk_04 = msg; - ov16_02264A04(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C454)); + SendMessage(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C454)); } void ov16_022661B0 (BattleSystem * param0, int param1) @@ -1222,7 +1141,7 @@ void ov16_022661B0 (BattleSystem * param0, int param1) int v0; v0 = 1; - ov16_02264A04(param0, 0, param1, &v0, 4); + SendMessage(param0, 0, param1, &v0, 4); } void BattleIO_RefreshHPGauge (BattleSystem * param0, BattleContext * param1, int param2) @@ -1254,7 +1173,7 @@ void BattleIO_RefreshHPGauge (BattleSystem * param0, BattleContext * param1, int v0.unk_07_7 = BattleSystem_CaughtSpecies(param0, param1->battleMons[param2].species); v0.unk_10 = BattleSystem_NumSafariBalls(param0); - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C468)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C468)); } void BattleIO_UpdatePartyMon (BattleSystem * param0, BattleContext * param1, int param2) @@ -1299,19 +1218,19 @@ void BattleIO_UpdatePartyMon (BattleSystem * param0, BattleContext * param1, int v0.unk_24 = 0; } - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_022662FC)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_022662FC)); } void ov16_02266460 (BattleSystem * param0, int param1) { int v0 = 40; - ov16_02264A04(param0, 1, param1, &v0, 4); + SendMessage(param0, 1, param1, &v0, 4); } void BattleIO_StopGaugeAnimation (BattleSystem *battleSys, int battler) { int v0 = 41; - ov16_02264A04(battleSys, 1, battler, &v0, 4); + SendMessage(battleSys, 1, battler, &v0, 4); } void BattleIO_RefreshPartyStatus (BattleSystem * param0, BattleContext * param1, int param2, int param3) @@ -1322,7 +1241,7 @@ void BattleIO_RefreshPartyStatus (BattleSystem * param0, BattleContext * param1, v0.unk_02 = param3; v0.unk_01 = param1->battleMons[param2].ability; - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_02266498)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_02266498)); } void BattleIO_ForgetMove (BattleSystem * param0, int param1, int param2, int param3) @@ -1335,7 +1254,7 @@ void BattleIO_ForgetMove (BattleSystem * param0, int param1, int param2, int par v0.unk_02 = param2; v0.unk_01 = param3; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_02266498)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_02266498)); } void BattleIO_SetMosaic (BattleSystem * param0, int param1, int param2, int param3) @@ -1346,7 +1265,7 @@ void BattleIO_SetMosaic (BattleSystem * param0, int param1, int param2, int para v0.unk_01 = param2; v0.unk_02 = param3; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_022664F8)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_022664F8)); } void BattleIO_ChangeWeatherForm (BattleSystem * param0, int param1) @@ -1367,63 +1286,59 @@ void BattleIO_ChangeWeatherForm (BattleSystem * param0, int param1) v0.unk_01 = param0->battleCtx->battleMons[param1].formNum; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C684)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C684)); } void BattleIO_UpdateBG (BattleSystem * param0, int param1) { int v0 = 46; - ov16_02264A04(param0, 1, param1, &v0, 4); + SendMessage(param0, 1, param1, &v0, 4); } void BattleIO_ClearTouchScreen (BattleSystem *battleSys, int battler) { int v0 = 47; - ov16_02264A04(battleSys, 1, battler, &v0, 4); + SendMessage(battleSys, 1, battler, &v0, 4); } -void BattleIO_ShowBattleStartPartyGauge (BattleSystem * param0, int param1) +void BattleIO_ShowBattleStartPartyGauge(BattleSystem *battleSys, int battler) { - UnkStruct_ov16_0225C840 v0; - - ov16_02266CF0(param0, param0->battleCtx, &v0, 48, param1); - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C840)); + PartyGaugeData gauge; + PartyGaugeData_New(battleSys, battleSys->battleCtx, &gauge, BTLIOCMD_SHOW_BATTLE_START_PARTY_GAUGE, battler); + SendMessage(battleSys, BTLIO_RECIPIENT_ENQUEUE, battler, &gauge, sizeof(PartyGaugeData)); } -void BattleIO_HideBattleStartPartyGauge (BattleSystem * param0, int param1) +void BattleIO_HideBattleStartPartyGauge(BattleSystem *battleSys, int battler) { - UnkStruct_ov16_0225C840 v0; - - ov16_02266CF0(param0, param0->battleCtx, &v0, 49, param1); - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C840)); + PartyGaugeData gauge; + PartyGaugeData_New(battleSys, battleSys->battleCtx, &gauge, BTLIOCMD_HIDE_BATTLE_START_PARTY_GAUGE, battler); + SendMessage(battleSys, BTLIO_RECIPIENT_ENQUEUE, battler, &gauge, sizeof(PartyGaugeData)); } -void BattleIO_ShowPartyGauge (BattleSystem * param0, int param1) +void BattleIO_ShowPartyGauge(BattleSystem *battleSys, int battler) { - UnkStruct_ov16_0225C840 v0; - - ov16_02266CF0(param0, param0->battleCtx, &v0, 50, param1); - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C840)); + PartyGaugeData gauge; + PartyGaugeData_New(battleSys, battleSys->battleCtx, &gauge, BTLIOCMD_SHOW_PARTY_GAUGE, battler); + SendMessage(battleSys, BTLIO_RECIPIENT_ENQUEUE, battler, &gauge, sizeof(PartyGaugeData)); } -void BattleIO_HidePartyGauge (BattleSystem * param0, int param1) +void BattleIO_HidePartyGauge(BattleSystem *battleSys, int battler) { - UnkStruct_ov16_0225C840 v0; - - ov16_02266CF0(param0, param0->battleCtx, &v0, 51, param1); - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225C840)); + PartyGaugeData gauge; + PartyGaugeData_New(battleSys, battleSys->battleCtx, &gauge, BTLIOCMD_HIDE_PARTY_GAUGE, battler); + SendMessage(battleSys, BTLIO_RECIPIENT_ENQUEUE, battler, &gauge, sizeof(PartyGaugeData)); } -void BattleIO_LoadPartyGaugeGraphics (BattleSystem * param0) +void BattleIO_LoadPartyGaugeGraphics(BattleSystem *battleSys) { - int v0 = 52; - ov16_02264A04(param0, 1, 0, &v0, 4); + int command = BTLIOCMD_LOAD_PARTY_GAUGE_GRAPHICS; + SendMessage(battleSys, BTLIO_RECIPIENT_ENQUEUE, NULL, &command, sizeof(int)); } -void BattleIO_FreePartyGaugeGraphics (BattleSystem * param0) +void BattleIO_FreePartyGaugeGraphics(BattleSystem *battleSys) { - int v0 = 53; - ov16_02264A04(param0, 1, 0, &v0, 4); + int command = BTLIOCMD_FREE_PARTY_GAUGE_GRAPHICS; + SendMessage(battleSys, BTLIO_RECIPIENT_ENQUEUE, NULL, &command, sizeof(int)); } void BattleIO_IncrementRecord (BattleSystem * param0, int param1, int param2, int param3) @@ -1434,7 +1349,7 @@ void BattleIO_IncrementRecord (BattleSystem * param0, int param1, int param2, in v0.unk_01 = param2; v0.unk_02 = param3; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_022666BC)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_022666BC)); } void BattleIO_LinkWaitMessage (BattleSystem *battleSys, int battler) @@ -1448,7 +1363,7 @@ void BattleIO_LinkWaitMessage (BattleSystem *battleSys, int battler) if ((v1 & 0x4) && (sub_0202F250() == 1) && ((battleSys->battleStatusMask & 0x10) == 0)) { v0.unk_02 = ov16_0223F58C(battleSys, &v0.unk_04[0]); GF_ASSERT(v0.unk_02 < 28); - ov16_02264A04(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C988)); + SendMessage(battleSys, 1, battler, &v0, sizeof(UnkStruct_ov16_0225C988)); } } @@ -1473,25 +1388,25 @@ void BattleIO_RestoreSprite (BattleSystem * param0, BattleContext * param1, int } } - ov16_02264A04(param0, 1, param2, &v1, sizeof(UnkStruct_ov16_02265BBC)); + SendMessage(param0, 1, param2, &v1, sizeof(UnkStruct_ov16_02265BBC)); } void BattleIO_SpriteToOAM (BattleSystem * param0, int param1) { int v0 = 57; - ov16_02264A04(param0, 1, param1, &v0, 4); + SendMessage(param0, 1, param1, &v0, 4); } void BattleIO_OAMToSprite (BattleSystem * param0, int param1) { int v0 = 58; - ov16_02264A04(param0, 1, param1, &v0, 4); + SendMessage(param0, 1, param1, &v0, 4); } void BattleIO_ResultMessage (BattleSystem * param0) { int v0 = 59; - ov16_02264A04(param0, 1, 0, &v0, 4); + SendMessage(param0, 1, 0, &v0, 4); } void BattleIO_EscapeMessage (BattleSystem * param0, BattleContext * param1) @@ -1515,7 +1430,7 @@ void BattleIO_EscapeMessage (BattleSystem * param0, BattleContext * param1) GF_ASSERT(v0.unk_02 < 28); } - ov16_02264A04(param0, 1, 0, &v0, sizeof(UnkStruct_ov16_0225C9F0)); + SendMessage(param0, 1, 0, &v0, sizeof(UnkStruct_ov16_0225C9F0)); } void BattleIO_ForfeitMessage (BattleSystem * param0) @@ -1531,7 +1446,7 @@ void BattleIO_ForfeitMessage (BattleSystem * param0) GF_ASSERT(v0.unk_02 < 28); } - ov16_02264A04(param0, 1, 0, &v0, sizeof(UnkStruct_ov16_0225CA14)); + SendMessage(param0, 1, 0, &v0, sizeof(UnkStruct_ov16_0225CA14)); } void BattleIO_RefreshSprite (BattleSystem * param0, BattleContext * param1, int param2) @@ -1555,7 +1470,7 @@ void BattleIO_RefreshSprite (BattleSystem * param0, BattleContext * param1, int } } - ov16_02264A04(param0, 1, param2, &v1, sizeof(UnkStruct_ov16_02265BBC)); + SendMessage(param0, 1, param2, &v1, sizeof(UnkStruct_ov16_02265BBC)); } void BattleIO_PlayMoveHitSoundEffect (BattleSystem * param0, BattleContext * param1, int param2) @@ -1572,7 +1487,7 @@ void BattleIO_PlayMoveHitSoundEffect (BattleSystem * param0, BattleContext * par v0.unk_01 = 0; } - ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225CA4C)); + SendMessage(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225CA4C)); } void BattleIO_PlayMusic (BattleSystem * param0, int param1, int param2) @@ -1582,7 +1497,7 @@ void BattleIO_PlayMusic (BattleSystem * param0, int param1, int param2) v0.unk_00 = 64; v0.unk_02 = param2; - ov16_02264A04(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225CA60)); + SendMessage(param0, 1, param1, &v0, sizeof(UnkStruct_ov16_0225CA60)); } void BattleIO_SubmitResult (BattleSystem * param0) @@ -1599,23 +1514,23 @@ void BattleIO_SubmitResult (BattleSystem * param0) GF_ASSERT(v0.unk_02 <= 28); } - ov16_02264A04(param0, 1, 0, &v0, sizeof(UnkStruct_ov16_02266A38)); + SendMessage(param0, 1, 0, &v0, sizeof(UnkStruct_ov16_02266A38)); } void BattleIO_ClearMessageBox (BattleSystem * param0) { int v0 = 66; - ov16_02264A04(param0, 1, 0, &v0, 4); + SendMessage(param0, 1, 0, &v0, 4); } -void ov16_02266ABC (BattleSystem * param0, int param1, int param2) +void ClearCommand (BattleSystem * param0, int param1, int param2) { UnkStruct_ov16_02266ABC v0; v0.unk_00 = param2; v0.unk_01 = sub_0203608C(); - ov16_02264A04(param0, 2, param1, &v0, sizeof(UnkStruct_ov16_02266ABC)); + SendMessage(param0, 2, param1, &v0, sizeof(UnkStruct_ov16_02266ABC)); } BOOL ov16_02266AE4 (BattleSystem * param0, void * param1) @@ -1642,7 +1557,7 @@ BOOL ov16_02266AE4 (BattleSystem * param0, void * param1) param0->battlers[v2]->unk_1A4 = 1; for (v4 = 0; v4 < v3; v4++) { - param0->battlers[v2]->unk_90[v4] = v0[v4]; + param0->battlers[v2]->data[v4] = v0[v4]; } } else { v5 = 0; @@ -1716,100 +1631,64 @@ void ov16_02266B78 (BattleSystem * param0, BattleContext * param1, UnkStruct_ov1 } } -static void ov16_02266CF0 (BattleSystem * param0, BattleContext * param1, UnkStruct_ov16_0225C840 * param2, int param3, int param4) +static inline void PartyGaugeData_Fill(BattleContext *battleCtx, PartyGaugeData *partyGauge, Party *party, int battler, int slot) { - int v0; - int v1, v2; - int v3; - int v4; - u32 v5; - Party * v6; - Pokemon * v7; + for (int i = 0; i < Party_GetCurrentCount(party); i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, battleCtx->partyOrder[battler][i]); + int species = Pokemon_GetValue(mon, MON_DATA_SPECIES_EGG, NULL); - MI_CpuClearFast(param2, sizeof(UnkStruct_ov16_0225C840)); - - v5 = BattleSystem_BattleType(param0); - param2->unk_00 = param3; - - if (((v5 & (0x4 | 0x8)) == (0x4 | 0x8)) || ((v5 & 0x10) && (Battler_Side(param0, param4))) || ((v5 == ((0x2 | 0x1) | 0x8 | 0x40)) && (Battler_Side(param0, param4))) || ((v5 == (((0x2 | 0x1) | 0x8 | 0x40) | 0x80)))) { - if ((BattleSystem_BattlerSlot(param0, param4) == 2) || (BattleSystem_BattlerSlot(param0, param4) == 3)) { - v1 = param4; - v2 = BattleSystem_Partner(param0, param4); - } else { - v1 = BattleSystem_Partner(param0, param4); - v2 = param4; - } - - v6 = BattleSystem_Party(param0, v1); - v4 = 0; - - for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { - v7 = Party_GetPokemonBySlotIndex(v6, param1->partyOrder[v1][v0]); - v3 = Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL); - - if ((v3) && (v3 != 494)) { - if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL)) { - if (Pokemon_GetValue(v7, MON_DATA_STATUS_CONDITION, NULL)) { - param2->unk_02[v4] = 3; - } else { - param2->unk_02[v4] = 1; - } + if (species && species != SPECIES_EGG) { + if (Pokemon_GetValue(mon, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(mon, MON_DATA_STATUS_CONDITION, NULL)) { + partyGauge->status[slot] = BALL_STATUS_HAS_STATUS_CONDITION; } else { - param2->unk_02[v4] = 2; + partyGauge->status[slot] = BALL_STATUS_MON_ALIVE; } - - v4++; + } else { + partyGauge->status[slot] = BALL_STATUS_MON_FAINTED; } + + slot++; } + } +} - v6 = BattleSystem_Party(param0, v2); - v4 = 3; +static void PartyGaugeData_New(BattleSystem *battleSys, BattleContext *battleCtx, PartyGaugeData *partyGauge, int command, int battler) +{ + MI_CpuClearFast(partyGauge, sizeof(PartyGaugeData)); + u32 battleType = BattleSystem_BattleType(battleSys); + partyGauge->command = command; + + // must make declarations here to match + int battler1, battler2; + Party *party; + + if ((battleType & (BATTLE_TYPE_LINK | BATTLE_TYPE_2vs2)) == (BATTLE_TYPE_LINK | BATTLE_TYPE_2vs2) // 2vs2 link battle + || ((battleType & BATTLE_TYPE_TAG) && Battler_Side(battleSys, battler)) // either of the two opponents on the enemy side + || ((battleType == BATTLE_TYPE_TRAINER_WITH_AI_PARTNER) && Battler_Side(battleSys, battler)) // either of the two opponents on the enemy side + || battleType == BATTLE_TYPE_FRONTIER_WITH_AI_PARTNER) { // frontier, AI partner + if (BattleSystem_BattlerSlot(battleSys, battler) == BATTLER_PLAYER_SLOT_2 + || BattleSystem_BattlerSlot(battleSys, battler) == BATTLER_ENEMY_SLOT_2) { + battler1 = battler; + battler2 = BattleSystem_Partner(battleSys, battler); + } else { + battler1 = BattleSystem_Partner(battleSys, battler); + battler2 = battler; + } - for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { - v7 = Party_GetPokemonBySlotIndex(v6, param1->partyOrder[v2][v0]); - v3 = Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL); + party = BattleSystem_Party(battleSys, battler1); + PartyGaugeData_Fill(battleCtx, partyGauge, party, battler1, 0); - if ((v3) && (v3 != 494)) { - if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL)) { - if (Pokemon_GetValue(v7, MON_DATA_STATUS_CONDITION, NULL)) { - param2->unk_02[v4] = 3; - } else { - param2->unk_02[v4] = 1; - } - } else { - param2->unk_02[v4] = 2; - } - - v4++; - } - } + party = BattleSystem_Party(battleSys, battler2); + PartyGaugeData_Fill(battleCtx, partyGauge, party, battler2, 3); } else { - if ((v5 & 0x2) && ((v5 & 0x8) == 0)) { - param4 = param4 & 1; + if ((battleType & BATTLE_TYPE_DOUBLES) && (battleType & BATTLE_TYPE_2vs2) == FALSE) { + battler = battler & 1; } else { - param4 = param4; + battler = battler; } - v6 = BattleSystem_Party(param0, param4); - v4 = 0; - - for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { - v7 = Party_GetPokemonBySlotIndex(v6, param1->partyOrder[param4][v0]); - v3 = Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL); - - if ((v3) && (v3 != 494)) { - if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL)) { - if (Pokemon_GetValue(v7, MON_DATA_STATUS_CONDITION, NULL)) { - param2->unk_02[v4] = 3; - } else { - param2->unk_02[v4] = 1; - } - } else { - param2->unk_02[v4] = 2; - } - - v4++; - } - } + party = BattleSystem_Party(battleSys, battler); + PartyGaugeData_Fill(battleCtx, partyGauge, party, battler, 0); } } diff --git a/src/overlay016/ov16_0226D094.c b/src/overlay016/ov16_0226D094.c index 88b3edcdfb..b65c232d2c 100644 --- a/src/overlay016/ov16_0226D094.c +++ b/src/overlay016/ov16_0226D094.c @@ -24,56 +24,56 @@ #include "overlay016/ov16_0226D094.h" typedef struct { - CellActorData * unk_00; - SysTask * unk_04; - UnkEnum_ov16_0226D220 unk_08; - UnkEnum_ov16_0226D194 unk_0C; - UnkEnum_ov16_0226D194_3 unk_10; - s32 unk_14; - s16 unk_18; - u8 unk_1A; - u8 unk_1B; -} UnkStruct_ov16_0226D2A0; + CellActorData *cells; + SysTask *task; + enum HideArrowType hideType; + enum PartyGaugeSide side; + enum PartyGaugePosition position; + s32 x; + s16 alpha; + u8 state; + u8 delay; +} PartyGaugeArrow; typedef struct { - CellActorData * unk_00; - SysTask * unk_04; - UnkEnum_ov16_0226D194 unk_08; - UnkEnum_ov16_0226D194_3 unk_0C; - UnkEnum_ov16_0226D194_2 unk_10; - s8 * unk_14; - s16 * unk_18; - s32 unk_1C; - s32 unk_20; - s32 unk_24; - s16 unk_28; - u16 unk_2A; - u8 unk_2C; - u8 unk_2D; - u8 unk_2E; - u8 unk_2F; -} UnkStruct_ov16_0226D540; - -typedef struct UnkStruct_ov16_0226D160_t { - UnkStruct_ov16_0226D2A0 unk_00; - UnkStruct_ov16_0226D540 unk_1C[6]; - s8 unk_13C; -} UnkStruct_ov16_0226D160; - -static void ov16_0226D2A0(UnkStruct_ov16_0226D2A0 * param0, UnkEnum_ov16_0226D194 param1, UnkEnum_ov16_0226D194_3 param2, CellTransferStateData * param3, AnimationResourceCollection * param4); -static void ov16_0226D3F8(UnkStruct_ov16_0226D2A0 * param0, UnkEnum_ov16_0226D220 param1); -static void ov16_0226D540(UnkStruct_ov16_0226D540 * param0, s8 * param1, UnkEnum_ov16_0226D194 param2, UnkEnum_ov16_0226D194_1 param3, UnkEnum_ov16_0226D194_3 param4, int param5, int param6, CellTransferStateData * param7, AnimationResourceCollection * param8); -static void ov16_0226D938(UnkStruct_ov16_0226D540 * param0, int param1, UnkEnum_ov16_0226D194_2 param2, s16 * param3); + CellActorData *cells; + SysTask *task; + enum PartyGaugeSide side; + enum PartyGaugePosition position; + enum HidePartyGaugeType hideType; + s8 *pokeballCount; + s16 *arrowAlpha; + s32 xStart; + s32 xEnd; + s32 xOverflow; + s16 delay; + u16 sdatID; + u8 state; + u8 ballSlot; + u8 flipAnimation; + u8 startDelay; +} PartyGaugePokeballs; + +typedef struct PartyGauge { + PartyGaugeArrow arrow; + PartyGaugePokeballs pokeballs[MAX_PARTY_SIZE]; + s8 pokeballCount; +} PartyGauge; + +static void ov16_0226D2A0(PartyGaugeArrow * param0, enum PartyGaugeSide param1, enum PartyGaugePosition param2, CellTransferStateData * param3, AnimationResourceCollection * param4); +static void ov16_0226D3F8(PartyGaugeArrow * param0, enum HideArrowType param1); +static void ov16_0226D540(PartyGaugePokeballs * param0, s8 * param1, enum PartyGaugeSide param2, enum ShowPartyGaugeType param3, enum PartyGaugePosition param4, int param5, int param6, CellTransferStateData * param7, AnimationResourceCollection * param8); +static void ov16_0226D938(PartyGaugePokeballs * param0, int param1, enum HidePartyGaugeType param2, s16 * param3); static void ov16_0226D34C(SysTask * param0, void * param1); static void ov16_0226D434(SysTask * param0, void * param1); static void ov16_0226D654(SysTask * param0, void * param1); static void ov16_0226D854(SysTask * param0, void * param1); static void ov16_0226D99C(SysTask * param0, void * param1); static void ov16_0226DAAC(SysTask * param0, void * param1); -static int ov16_0226DB04(int param0, UnkEnum_ov16_0226D194 param1); +static int ov16_0226DB04(int param0, enum PartyGaugeSide param1); static int ov16_0226DB44(int param0); -static UnkStruct_ov16_0226D160 * ov16_0226D160(void); -static void ov16_0226D17C(UnkStruct_ov16_0226D160 * param0); +static PartyGauge * ov16_0226D160(void); +static void ov16_0226D17C(PartyGauge * param0); static const UnkStruct_ov104_0223F9E0 Unk_ov16_02270A3C = { 0x0, @@ -146,44 +146,44 @@ void ov16_0226D12C (AnimationResourceCollection * param0) sub_0200D0A0(param0, 20396); } -static UnkStruct_ov16_0226D160 * ov16_0226D160 (void) +static PartyGauge * ov16_0226D160 (void) { - UnkStruct_ov16_0226D160 * v0; + PartyGauge * v0; - v0 = Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_0226D160)); - MI_CpuClear8(v0, sizeof(UnkStruct_ov16_0226D160)); + v0 = Heap_AllocFromHeap(5, sizeof(PartyGauge)); + MI_CpuClear8(v0, sizeof(PartyGauge)); return v0; } -static void ov16_0226D17C (UnkStruct_ov16_0226D160 * param0) +static void ov16_0226D17C (PartyGauge * param0) { - GF_ASSERT(param0->unk_00.unk_04 == NULL); + GF_ASSERT(param0->arrow.task == NULL); Heap_FreeToHeap(param0); } -UnkStruct_ov16_0226D160 * ov16_0226D194 (u8 param0[], UnkEnum_ov16_0226D194 param1, UnkEnum_ov16_0226D194_1 param2, UnkEnum_ov16_0226D194_3 param3, CellTransferStateData * param4, AnimationResourceCollection * param5) +PartyGauge * ov16_0226D194 (u8 param0[], enum PartyGaugeSide param1, enum ShowPartyGaugeType param2, enum PartyGaugePosition param3, CellTransferStateData * param4, AnimationResourceCollection * param5) { - UnkStruct_ov16_0226D160 * v0; + PartyGauge * v0; int v1, v2; v0 = ov16_0226D160(); - ov16_0226D2A0(&v0->unk_00, param1, param3, param4, param5); + ov16_0226D2A0(&v0->arrow, param1, param3, param4, param5); for (v1 = 0; v1 < 6; v1++) { v2 = ov16_0226DB04(param0[v1], param1); - ov16_0226D540(&v0->unk_1C[v1], &v0->unk_13C, param1, param2, param3, v1, v2, param4, param5); + ov16_0226D540(&v0->pokeballs[v1], &v0->pokeballCount, param1, param2, param3, v1, v2, param4, param5); } return v0; } -BOOL ov16_0226D1FC (UnkStruct_ov16_0226D160 * param0) +BOOL ov16_0226D1FC (PartyGauge * param0) { int v0; - if (param0->unk_00.unk_04 == NULL) { + if (param0->arrow.task == NULL) { for (v0 = 0; v0 < 6; v0++) { - if (param0->unk_1C[v0].unk_04 != NULL) { + if (param0->pokeballs[v0].task != NULL) { break; } } @@ -196,26 +196,26 @@ BOOL ov16_0226D1FC (UnkStruct_ov16_0226D160 * param0) return 0; } -void ov16_0226D220 (UnkStruct_ov16_0226D160 * param0, UnkEnum_ov16_0226D220 param1, UnkEnum_ov16_0226D194_2 param2) +void ov16_0226D220 (PartyGauge * param0, enum HideArrowType param1, enum HidePartyGaugeType param2) { int v0; GF_ASSERT(param0 != NULL); - ov16_0226D3F8(¶m0->unk_00, param1); + ov16_0226D3F8(¶m0->arrow, param1); for (v0 = 0; v0 < 6; v0++) { - ov16_0226D938(¶m0->unk_1C[v0], v0, param2, ¶m0->unk_00.unk_18); + ov16_0226D938(¶m0->pokeballs[v0], v0, param2, ¶m0->arrow.alpha); } } -BOOL ov16_0226D258 (UnkStruct_ov16_0226D160 * param0) +BOOL ov16_0226D258 (PartyGauge * param0) { int v0; - if (param0->unk_00.unk_04 == NULL) { + if (param0->arrow.task == NULL) { for (v0 = 0; v0 < 6; v0++) { - if (param0->unk_1C[v0].unk_04 != NULL) { + if (param0->pokeballs[v0].task != NULL) { break; } } @@ -228,443 +228,443 @@ BOOL ov16_0226D258 (UnkStruct_ov16_0226D160 * param0) return 0; } -void ov16_0226D27C (UnkStruct_ov16_0226D160 * param0) +void ov16_0226D27C (PartyGauge * param0) { int v0; - sub_0200D0F4(param0->unk_00.unk_00); + sub_0200D0F4(param0->arrow.cells); for (v0 = 0; v0 < 6; v0++) { - sub_0200D0F4(param0->unk_1C[v0].unk_00); + sub_0200D0F4(param0->pokeballs[v0].cells); } ov16_0226D17C(param0); } -static void ov16_0226D2A0 (UnkStruct_ov16_0226D2A0 * param0, UnkEnum_ov16_0226D194 param1, UnkEnum_ov16_0226D194_3 param2, CellTransferStateData * param3, AnimationResourceCollection * param4) +static void ov16_0226D2A0 (PartyGaugeArrow * param0, enum PartyGaugeSide param1, enum PartyGaugePosition param2, CellTransferStateData * param3, AnimationResourceCollection * param4) { - GF_ASSERT(param0->unk_00 == NULL && param0->unk_04 == NULL); + GF_ASSERT(param0->cells == NULL && param0->task == NULL); - MI_CpuClear8(param0, sizeof(UnkStruct_ov16_0226D2A0)); + MI_CpuClear8(param0, sizeof(PartyGaugeArrow)); - param0->unk_00 = sub_0200CE6C(param3, param4, &Unk_ov16_02270A3C); + param0->cells = sub_0200CE6C(param3, param4, &Unk_ov16_02270A3C); - if (param1 == UnkEnum_ov16_0226D194_00) { - sub_0200D4C4(param0->unk_00, (256 + 96), Unk_ov16_02270A2C[param2]); - sub_02021D6C(param0->unk_00->unk_00, 8); + if (param1 == PARTY_GAUGE_OURS) { + sub_0200D4C4(param0->cells, (256 + 96), Unk_ov16_02270A2C[param2]); + sub_02021D6C(param0->cells->unk_00, 8); } else { - sub_0200D4C4(param0->unk_00, -96, Unk_ov16_02270A24[param2]); - sub_02021D6C(param0->unk_00->unk_00, 7); + sub_0200D4C4(param0->cells, -96, Unk_ov16_02270A24[param2]); + sub_02021D6C(param0->cells->unk_00, 7); } - sub_0200D324(param0->unk_00->unk_00); + sub_0200D324(param0->cells->unk_00); - param0->unk_0C = param1; - param0->unk_10 = param2; - param0->unk_1A = 0; - param0->unk_04 = SysTask_Start(ov16_0226D34C, param0, 500); + param0->side = param1; + param0->position = param2; + param0->state = 0; + param0->task = SysTask_Start(ov16_0226D34C, param0, 500); Sound_PlayEffect(1809); } static void ov16_0226D34C (SysTask * param0, void * param1) { - UnkStruct_ov16_0226D2A0 * v0 = param1; + PartyGaugeArrow * v0 = param1; - switch (v0->unk_1A) { + switch (v0->state) { case 0: { s16 v1, v2; - sub_0200D550(v0->unk_00, &v1, &v2); - v0->unk_14 = v1 << 8; + sub_0200D550(v0->cells, &v1, &v2); + v0->x = v1 << 8; } - v0->unk_1A++; + v0->state++; case 1: - if (v0->unk_0C == UnkEnum_ov16_0226D194_00) { - v0->unk_14 -= 0x1200; + if (v0->side == PARTY_GAUGE_OURS) { + v0->x -= 0x1200; - if (v0->unk_14 <= (256 - 32) << 8) { - v0->unk_14 = (256 - 32) << 8; - v0->unk_1A++; + if (v0->x <= (256 - 32) << 8) { + v0->x = (256 - 32) << 8; + v0->state++; } - sub_0200D4C4(v0->unk_00, v0->unk_14 >> 8, Unk_ov16_02270A2C[v0->unk_10]); + sub_0200D4C4(v0->cells, v0->x >> 8, Unk_ov16_02270A2C[v0->position]); } else { - v0->unk_14 += 0x1200; + v0->x += 0x1200; - if (v0->unk_14 >= 32 << 8) { - v0->unk_14 = 32 << 8; - v0->unk_1A++; + if (v0->x >= 32 << 8) { + v0->x = 32 << 8; + v0->state++; } - sub_0200D4C4(v0->unk_00, v0->unk_14 >> 8, Unk_ov16_02270A24[v0->unk_10]); + sub_0200D4C4(v0->cells, v0->x >> 8, Unk_ov16_02270A24[v0->position]); } break; default: SysTask_Done(param0); - v0->unk_04 = NULL; + v0->task = NULL; return; } } -static void ov16_0226D3F8 (UnkStruct_ov16_0226D2A0 * param0, UnkEnum_ov16_0226D220 param1) +static void ov16_0226D3F8 (PartyGaugeArrow * param0, enum HideArrowType param1) { - GF_ASSERT(param0->unk_00 != NULL && param0->unk_04 == NULL); + GF_ASSERT(param0->cells != NULL && param0->task == NULL); - param0->unk_1A = 0; - param0->unk_08 = param1; + param0->state = 0; + param0->hideType = param1; - if (param1 == UnkEnum_ov16_0226D220_00) { - param0->unk_1B = 4; + if (param1 == HIDE_ARROW_FADE_AND_SCROLL) { + param0->delay = 4; } else { - param0->unk_1B = 0; + param0->delay = 0; } - param0->unk_04 = SysTask_Start(ov16_0226D434, param0, 500); + param0->task = SysTask_Start(ov16_0226D434, param0, 500); } static void ov16_0226D434 (SysTask * param0, void * param1) { - UnkStruct_ov16_0226D2A0 * v0 = param1; + PartyGaugeArrow * v0 = param1; - switch (v0->unk_1A) { + switch (v0->state) { case 0: { s16 v1, v2; - sub_0200D550(v0->unk_00, &v1, &v2); - v0->unk_14 = v1 << 8; + sub_0200D550(v0->cells, &v1, &v2); + v0->x = v1 << 8; } - sub_0200D810(v0->unk_00, GX_OAM_MODE_XLU); + sub_0200D810(v0->cells, GX_OAM_MODE_XLU); - v0->unk_18 = 16 << 8; - G2_SetBlendAlpha(GX_BLEND_PLANEMASK_NONE, GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_OBJ | GX_BLEND_PLANEMASK_BD, (v0->unk_18 >> 8), 16 - (v0->unk_18 >> 8)); - v0->unk_1A++; + v0->alpha = 16 << 8; + G2_SetBlendAlpha(GX_BLEND_PLANEMASK_NONE, GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2 | GX_BLEND_PLANEMASK_BG3 | GX_BLEND_PLANEMASK_OBJ | GX_BLEND_PLANEMASK_BD, (v0->alpha >> 8), 16 - (v0->alpha >> 8)); + v0->state++; case 1: - if (v0->unk_1B > 0) { - v0->unk_1B--; + if (v0->delay > 0) { + v0->delay--; break; } - v0->unk_1A++; + v0->state++; case 2: - if (v0->unk_08 == UnkEnum_ov16_0226D220_00) { - if (v0->unk_0C == UnkEnum_ov16_0226D194_00) { - v0->unk_14 -= 0x400; - sub_0200D4C4(v0->unk_00, v0->unk_14 >> 8, Unk_ov16_02270A2C[v0->unk_10]); + if (v0->hideType == HIDE_ARROW_FADE_AND_SCROLL) { + if (v0->side == PARTY_GAUGE_OURS) { + v0->x -= 0x400; + sub_0200D4C4(v0->cells, v0->x >> 8, Unk_ov16_02270A2C[v0->position]); } else { - v0->unk_14 += 0x400; - sub_0200D4C4(v0->unk_00, v0->unk_14 >> 8, Unk_ov16_02270A24[v0->unk_10]); + v0->x += 0x400; + sub_0200D4C4(v0->cells, v0->x >> 8, Unk_ov16_02270A24[v0->position]); } } - v0->unk_18 -= 0x100; + v0->alpha -= 0x100; - if (v0->unk_18 <= 0) { - v0->unk_18 = 0; - sub_0200D3EC(v0->unk_00->unk_00, 0); - v0->unk_1A++; + if (v0->alpha <= 0) { + v0->alpha = 0; + sub_0200D3EC(v0->cells->unk_00, 0); + v0->state++; } - G2_ChangeBlendAlpha(v0->unk_18 >> 8, 16 - (v0->unk_18 >> 8)); + G2_ChangeBlendAlpha(v0->alpha >> 8, 16 - (v0->alpha >> 8)); break; default: ov16_0223F9F0(); SysTask_Done(param0); - v0->unk_04 = NULL; + v0->task = NULL; return; } } -static void ov16_0226D540 (UnkStruct_ov16_0226D540 * param0, s8 * param1, UnkEnum_ov16_0226D194 param2, UnkEnum_ov16_0226D194_1 param3, UnkEnum_ov16_0226D194_3 param4, int param5, int param6, CellTransferStateData * param7, AnimationResourceCollection * param8) +static void ov16_0226D540 (PartyGaugePokeballs * param0, s8 * param1, enum PartyGaugeSide param2, enum ShowPartyGaugeType param3, enum PartyGaugePosition param4, int param5, int param6, CellTransferStateData * param7, AnimationResourceCollection * param8) { - GF_ASSERT(param0->unk_00 == NULL && param0->unk_04 == NULL); + GF_ASSERT(param0->cells == NULL && param0->task == NULL); - MI_CpuClear8(param0, sizeof(UnkStruct_ov16_0226D540)); - param0->unk_00 = sub_0200CE6C(param7, param8, &Unk_ov16_02270A70); + MI_CpuClear8(param0, sizeof(PartyGaugePokeballs)); + param0->cells = sub_0200CE6C(param7, param8, &Unk_ov16_02270A70); - if (param2 == UnkEnum_ov16_0226D194_00) { - sub_0200D4C4(param0->unk_00, (256 + 20), Unk_ov16_02270A34[param4]); + if (param2 == PARTY_GAUGE_OURS) { + sub_0200D4C4(param0->cells, (256 + 20), Unk_ov16_02270A34[param4]); } else { - sub_0200D4C4(param0->unk_00, -20, Unk_ov16_02270A1C[param4]); + sub_0200D4C4(param0->cells, -20, Unk_ov16_02270A1C[param4]); } - sub_02021D6C(param0->unk_00->unk_00, param6); - sub_0200D324(param0->unk_00->unk_00); + sub_02021D6C(param0->cells->unk_00, param6); + sub_0200D324(param0->cells->unk_00); - param0->unk_08 = param2; - param0->unk_2D = param5; - param0->unk_0C = param4; - param0->unk_2E = ov16_0226DB44(param6); - param0->unk_14 = param1; - param0->unk_2A = ((param6 == 6) ? 1811 : 1810); + param0->side = param2; + param0->ballSlot = param5; + param0->position = param4; + param0->flipAnimation = ov16_0226DB44(param6); + param0->pokeballCount = param1; + param0->sdatID = ((param6 == 6) ? 1811 : 1810); - if (param2 == UnkEnum_ov16_0226D194_00) { - param0->unk_20 = (256 - 128 + 20 + 14) + param5 * 16; - param0->unk_24 = (256 - 128 + 20 + 14) + param5 * 15 - 6; + if (param2 == PARTY_GAUGE_OURS) { + param0->xEnd = (256 - 128 + 20 + 14) + param5 * 16; + param0->xOverflow = (256 - 128 + 20 + 14) + param5 * 15 - 6; } else { - param0->unk_20 = (128 - 20 - 14) - param5 * 16; - param0->unk_24 = (128 - 20 - 14) - param5 * 15 + 6; + param0->xEnd = (128 - 20 - 14) - param5 * 16; + param0->xOverflow = (128 - 20 - 14) - param5 * 15 + 6; } - param0->unk_2C = 0; + param0->state = 0; - if (param3 == UnkEnum_ov16_0226D194_1_00) { - param0->unk_28 = 3 * param5 + 5; - param0->unk_04 = SysTask_Start(ov16_0226D654, param0, (500 + 1)); + if (param3 == SHOW_PARTY_GAUGE_BATTLE_START) { + param0->delay = 3 * param5 + 5; + param0->task = SysTask_Start(ov16_0226D654, param0, (500 + 1)); } else { - param0->unk_28 = 0; - param0->unk_04 = SysTask_Start(ov16_0226D854, param0, (500 + 1)); + param0->delay = 0; + param0->task = SysTask_Start(ov16_0226D854, param0, (500 + 1)); } } static void ov16_0226D654 (SysTask * param0, void * param1) { - UnkStruct_ov16_0226D540 * v0 = param1; + PartyGaugePokeballs * v0 = param1; - switch (v0->unk_2C) { + switch (v0->state) { case 0: { s16 v1, v2; - sub_0200D550(v0->unk_00, &v1, &v2); - v0->unk_1C = v1 << 8; + sub_0200D550(v0->cells, &v1, &v2); + v0->xStart = v1 << 8; } - v0->unk_2C++; + v0->state++; case 1: - if (v0->unk_28 > 0) { - v0->unk_28--; + if (v0->delay > 0) { + v0->delay--; break; } case 2: - if (v0->unk_08 == UnkEnum_ov16_0226D194_00) { - v0->unk_1C -= 0x1200; + if (v0->side == PARTY_GAUGE_OURS) { + v0->xStart -= 0x1200; - if (v0->unk_1C <= v0->unk_24 << 8) { - v0->unk_1C = v0->unk_24 << 8; - Sound_PlayEffect(v0->unk_2A); - v0->unk_2C++; + if (v0->xStart <= v0->xOverflow << 8) { + v0->xStart = v0->xOverflow << 8; + Sound_PlayEffect(v0->sdatID); + v0->state++; } - sub_0200D4C4(v0->unk_00, v0->unk_1C >> 8, Unk_ov16_02270A34[v0->unk_0C]); + sub_0200D4C4(v0->cells, v0->xStart >> 8, Unk_ov16_02270A34[v0->position]); } else { - v0->unk_1C += 0x1200; + v0->xStart += 0x1200; - if (v0->unk_1C >= v0->unk_24 << 8) { - v0->unk_1C = v0->unk_24 << 8; - v0->unk_2C++; + if (v0->xStart >= v0->xOverflow << 8) { + v0->xStart = v0->xOverflow << 8; + v0->state++; } - sub_0200D4C4(v0->unk_00, v0->unk_1C >> 8, Unk_ov16_02270A1C[v0->unk_0C]); + sub_0200D4C4(v0->cells, v0->xStart >> 8, Unk_ov16_02270A1C[v0->position]); } - sub_0200D324(v0->unk_00->unk_00); + sub_0200D324(v0->cells->unk_00); break; case 3: - (*(v0->unk_14))++; - v0->unk_2C++; + (*(v0->pokeballCount))++; + v0->state++; case 4: - if (*(v0->unk_14) != 6) { - sub_0200D324(v0->unk_00->unk_00); + if (*(v0->pokeballCount) != 6) { + sub_0200D324(v0->cells->unk_00); break; } - if (v0->unk_08 == UnkEnum_ov16_0226D194_00) { - sub_02021E50(v0->unk_00->unk_00, 1); + if (v0->side == PARTY_GAUGE_OURS) { + sub_02021E50(v0->cells->unk_00, 1); } else { - sub_02021E50(v0->unk_00->unk_00, 1); + sub_02021E50(v0->cells->unk_00, 1); } - v0->unk_28 = 0; - v0->unk_2C++; + v0->delay = 0; + v0->state++; case 5: - v0->unk_28++; + v0->delay++; - if (v0->unk_28 < 0) { + if (v0->delay < 0) { break; } - sub_02021D6C(v0->unk_00->unk_00, v0->unk_2E); - v0->unk_28 = 0; - v0->unk_2C++; + sub_02021D6C(v0->cells->unk_00, v0->flipAnimation); + v0->delay = 0; + v0->state++; case 6: - if (v0->unk_08 == UnkEnum_ov16_0226D194_00) { - v0->unk_1C += 0x600; + if (v0->side == PARTY_GAUGE_OURS) { + v0->xStart += 0x600; - if (v0->unk_1C >= v0->unk_20 << 8) { - v0->unk_1C = v0->unk_20 << 8; - v0->unk_2C++; + if (v0->xStart >= v0->xEnd << 8) { + v0->xStart = v0->xEnd << 8; + v0->state++; } - sub_0200D4C4(v0->unk_00, v0->unk_1C >> 8, Unk_ov16_02270A34[v0->unk_0C]); + sub_0200D4C4(v0->cells, v0->xStart >> 8, Unk_ov16_02270A34[v0->position]); } else { - v0->unk_1C -= 0x600; + v0->xStart -= 0x600; - if (v0->unk_1C <= v0->unk_20 << 8) { - v0->unk_1C = v0->unk_20 << 8; - v0->unk_2C++; + if (v0->xStart <= v0->xEnd << 8) { + v0->xStart = v0->xEnd << 8; + v0->state++; } - sub_0200D4C4(v0->unk_00, v0->unk_1C >> 8, Unk_ov16_02270A1C[v0->unk_0C]); + sub_0200D4C4(v0->cells, v0->xStart >> 8, Unk_ov16_02270A1C[v0->position]); } - sub_0200D324(v0->unk_00->unk_00); + sub_0200D324(v0->cells->unk_00); break; default: - sub_02021E50(v0->unk_00->unk_00, 0); + sub_02021E50(v0->cells->unk_00, 0); SysTask_Done(param0); - v0->unk_04 = NULL; + v0->task = NULL; return; } } static void ov16_0226D854 (SysTask * param0, void * param1) { - UnkStruct_ov16_0226D540 * v0 = param1; + PartyGaugePokeballs * v0 = param1; - switch (v0->unk_2C) { + switch (v0->state) { case 0: { s16 v1, v2; - sub_0200D550(v0->unk_00, &v1, &v2); - v0->unk_1C = v1 << 8; + sub_0200D550(v0->cells, &v1, &v2); + v0->xStart = v1 << 8; } - sub_02021E50(v0->unk_00->unk_00, 0); - v0->unk_2C++; + sub_02021E50(v0->cells->unk_00, 0); + v0->state++; case 1: - if (v0->unk_28 > 0) { - v0->unk_28--; + if (v0->delay > 0) { + v0->delay--; break; } case 2: - if (v0->unk_08 == UnkEnum_ov16_0226D194_00) { - v0->unk_1C -= 0x1200; + if (v0->side == PARTY_GAUGE_OURS) { + v0->xStart -= 0x1200; - if (v0->unk_1C <= v0->unk_20 << 8) { - v0->unk_1C = v0->unk_20 << 8; - v0->unk_2C++; + if (v0->xStart <= v0->xEnd << 8) { + v0->xStart = v0->xEnd << 8; + v0->state++; } - sub_0200D4C4(v0->unk_00, v0->unk_1C >> 8, Unk_ov16_02270A34[v0->unk_0C]); + sub_0200D4C4(v0->cells, v0->xStart >> 8, Unk_ov16_02270A34[v0->position]); } else { - v0->unk_1C += 0x1200; + v0->xStart += 0x1200; - if (v0->unk_1C >= v0->unk_20 << 8) { - v0->unk_1C = v0->unk_20 << 8; - v0->unk_2C++; + if (v0->xStart >= v0->xEnd << 8) { + v0->xStart = v0->xEnd << 8; + v0->state++; } - sub_0200D4C4(v0->unk_00, v0->unk_1C >> 8, Unk_ov16_02270A1C[v0->unk_0C]); + sub_0200D4C4(v0->cells, v0->xStart >> 8, Unk_ov16_02270A1C[v0->position]); } break; default: SysTask_Done(param0); - v0->unk_04 = NULL; + v0->task = NULL; return; } } -static void ov16_0226D938 (UnkStruct_ov16_0226D540 * param0, int param1, UnkEnum_ov16_0226D194_2 param2, s16 * param3) +static void ov16_0226D938 (PartyGaugePokeballs * param0, int param1, enum HidePartyGaugeType param2, s16 * param3) { - GF_ASSERT(param0->unk_00 != NULL && param0->unk_04 == NULL); + GF_ASSERT(param0->cells != NULL && param0->task == NULL); - param0->unk_2C = 0; + param0->state = 0; - if (param2 == UnkEnum_ov16_0226D194_2_00) { - param0->unk_18 = param3; - param0->unk_28 = 3 * param1; - param0->unk_2F = 4; - param0->unk_04 = SysTask_Start(ov16_0226D99C, param0, (500 + 1)); + if (param2 == HIDE_PARTY_GAUGE_BATTLE_START) { + param0->arrowAlpha = param3; + param0->delay = 3 * param1; + param0->startDelay = 4; + param0->task = SysTask_Start(ov16_0226D99C, param0, (500 + 1)); } else { - param0->unk_18 = param3; - param0->unk_28 = 0; - param0->unk_2F = 0; - param0->unk_04 = SysTask_Start(ov16_0226DAAC, param0, (500 + 1)); + param0->arrowAlpha = param3; + param0->delay = 0; + param0->startDelay = 0; + param0->task = SysTask_Start(ov16_0226DAAC, param0, (500 + 1)); } } static void ov16_0226D99C (SysTask * param0, void * param1) { - UnkStruct_ov16_0226D540 * v0 = param1; + PartyGaugePokeballs * v0 = param1; - if ((*(v0->unk_18)) == 0) { - v0->unk_2C = 100; + if ((*(v0->arrowAlpha)) == 0) { + v0->state = 100; } - switch (v0->unk_2C) { + switch (v0->state) { case 0: { s16 v1, v2; - sub_0200D550(v0->unk_00, &v1, &v2); - v0->unk_1C = v1 << 8; + sub_0200D550(v0->cells, &v1, &v2); + v0->xStart = v1 << 8; } - sub_0200D810(v0->unk_00, GX_OAM_MODE_XLU); - v0->unk_2C++; + sub_0200D810(v0->cells, GX_OAM_MODE_XLU); + v0->state++; case 1: - if (v0->unk_2F > 0) { - v0->unk_2F--; + if (v0->startDelay > 0) { + v0->startDelay--; break; } - if (v0->unk_28 > 0) { - v0->unk_28--; + if (v0->delay > 0) { + v0->delay--; break; } case 2: - if (v0->unk_08 == UnkEnum_ov16_0226D194_00) { - v0->unk_1C -= 0xc00; - sub_0200D4C4(v0->unk_00, v0->unk_1C >> 8, Unk_ov16_02270A34[v0->unk_0C]); + if (v0->side == PARTY_GAUGE_OURS) { + v0->xStart -= 0xc00; + sub_0200D4C4(v0->cells, v0->xStart >> 8, Unk_ov16_02270A34[v0->position]); } else { - v0->unk_1C += 0xc00; - sub_0200D4C4(v0->unk_00, v0->unk_1C >> 8, Unk_ov16_02270A1C[v0->unk_0C]); + v0->xStart += 0xc00; + sub_0200D4C4(v0->cells, v0->xStart >> 8, Unk_ov16_02270A1C[v0->position]); } - if ((v0->unk_1C < -16 * 0x100) || (v0->unk_1C > ((256 + 16) << 8))) { - v0->unk_2C++; + if ((v0->xStart < -16 * 0x100) || (v0->xStart > ((256 + 16) << 8))) { + v0->state++; } - sub_0200D324(v0->unk_00->unk_00); + sub_0200D324(v0->cells->unk_00); break; case 100: default: - sub_0200D3EC(v0->unk_00->unk_00, 0); + sub_0200D3EC(v0->cells->unk_00, 0); SysTask_Done(param0); - v0->unk_04 = NULL; + v0->task = NULL; return; } } static void ov16_0226DAAC (SysTask * param0, void * param1) { - UnkStruct_ov16_0226D540 * v0 = param1; + PartyGaugePokeballs * v0 = param1; - if ((*(v0->unk_18)) == 0) { - v0->unk_2C = 100; + if ((*(v0->arrowAlpha)) == 0) { + v0->state = 100; } - switch (v0->unk_2C) { + switch (v0->state) { case 0: - sub_0200D810(v0->unk_00, GX_OAM_MODE_XLU); - v0->unk_2C++; + sub_0200D810(v0->cells, GX_OAM_MODE_XLU); + v0->state++; case 1: break; case 100: default: - sub_0200D3EC(v0->unk_00->unk_00, 0); + sub_0200D3EC(v0->cells->unk_00, 0); SysTask_Done(param0); - v0->unk_04 = NULL; + v0->task = NULL; return; } } -static int ov16_0226DB04 (int param0, UnkEnum_ov16_0226D194 param1) +static int ov16_0226DB04 (int param0, enum PartyGaugeSide param1) { int v0; @@ -674,13 +674,13 @@ static int ov16_0226DB04 (int param0, UnkEnum_ov16_0226D194 param1) v0 = 6; break; case 1: - v0 = (param1 == UnkEnum_ov16_0226D194_00) ? 3 : 0; + v0 = (param1 == PARTY_GAUGE_OURS) ? 3 : 0; break; case 2: - v0 = (param1 == UnkEnum_ov16_0226D194_00) ? 5 : 2; + v0 = (param1 == PARTY_GAUGE_OURS) ? 5 : 2; break; case 3: - v0 = (param1 == UnkEnum_ov16_0226D194_00) ? 4 : 1; + v0 = (param1 == PARTY_GAUGE_OURS) ? 4 : 1; break; }