Skip to content

Commit

Permalink
Merge pull request #140 from lhearachel/party-gauge
Browse files Browse the repository at this point in the history
Document entrypoint for showing/hiding the Party Gauge
  • Loading branch information
lhearachel authored Feb 9, 2024
2 parents 393b24a + 9ae0a1e commit 7dac66b
Show file tree
Hide file tree
Showing 18 changed files with 1,002 additions and 1,034 deletions.
1 change: 1 addition & 0 deletions include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions include/constants/battle/battle_io.h
Original file line number Diff line number Diff line change
@@ -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
26 changes: 0 additions & 26 deletions include/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions include/overlay016/ov16_0223DF00.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
42 changes: 37 additions & 5 deletions include/overlay016/ov16_0225CBB8.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
56 changes: 49 additions & 7 deletions include/overlay016/ov16_0226485C.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down
36 changes: 31 additions & 5 deletions include/overlay016/ov16_0226D094.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions include/overlay016/struct_ov16_0225BFFC_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
10 changes: 0 additions & 10 deletions include/overlay016/struct_ov16_0225C840.h

This file was deleted.

17 changes: 0 additions & 17 deletions include/overlay016/struct_ov16_0225E134.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/overlay016/struct_ov16_0226D160_decl.h
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions include/struct_defs/battle_io.h
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion include/struct_defs/battle_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/overlay016/ov16_0223DF00.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit 7dac66b

Please sign in to comment.