Skip to content

Commit

Permalink
Format the code tree
Browse files Browse the repository at this point in the history
  • Loading branch information
lhearachel committed Jun 23, 2024
1 parent 967ec90 commit 2c2ef24
Show file tree
Hide file tree
Showing 2,672 changed files with 134,034 additions and 132,254 deletions.
5 changes: 3 additions & 2 deletions include/ascii_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
#define POKEPLATINUM_ASCII_UTIL_H

#include <nnsys.h>

#include "charcode.h"

#define MAX_STRING_COPY_LEN 256
#define MAX_STRING_COPY_LEN 256

int Ascii_Length(char *str);
char* Ascii_CopyToTerminator(char *src, char *dst, char terminator);
char *Ascii_CopyToTerminator(char *src, char *dst, char terminator);
int Ascii_ConvertToInt(char *str);
void Ascii_SetResourceName(NNSG3dResName *resource, const char *src);
BOOL IsFullWidthChar(charcode_t character);
Expand Down
29 changes: 15 additions & 14 deletions include/bag.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef POKEPLATINUM_BAG_H
#define POKEPLATINUM_BAG_H

#include "savedata.h"
#include "constants/heap.h"

#include "savedata.h"

#define ITEM_POCKET_SIZE 165
#define KEY_ITEM_POCKET_SIZE 50
#define TMHM_POCKET_SIZE 100
Expand Down Expand Up @@ -69,18 +70,18 @@ void Pocket_Sort(BagItem *pocket, const u32 size); // Same as Pocket_SortEmpty,
void *sub_0207D824(Bag *bag, const u8 *pockets, enum HeapId heapID);
BagItem *Bag_GetItemSlot(Bag *bag, u16 pocketID, u16 slot);
Bag *SaveData_GetBag(SaveData *saveData);
UnkStruct_0207D99C * sub_0207D99C(u32 param0);
void sub_0207D9B4(UnkStruct_0207D99C * param0, u32 param1, u8 * param2, u8 * param3);
u16 sub_0207D9C4(UnkStruct_0207D99C * param0);
void sub_0207D9C8(UnkStruct_0207D99C * param0, u32 param1, u8 param2, u8 param3);
void sub_0207D9D4(UnkStruct_0207D99C * param0, u16 param1);
void sub_0207D9D8(UnkStruct_0207D99C * param0, u32 param1, u8 * param2, u8 * param3);
u16 sub_0207D9E4(UnkStruct_0207D99C * param0);
u16 sub_0207D9E8(UnkStruct_0207D99C * param0);
u16 sub_0207D9EC(UnkStruct_0207D99C * param0);
void sub_0207D9F0(UnkStruct_0207D99C * param0, u32 param1, u8 param2, u8 param3);
void sub_0207D9F8(UnkStruct_0207D99C * param0);
void Bag_SetLastItemUsed(UnkStruct_0207D99C * param0, u16 param1, u16 param2);
void sub_0207DA24(UnkStruct_0207D99C * param0, u16 param1);
UnkStruct_0207D99C *sub_0207D99C(u32 param0);
void sub_0207D9B4(UnkStruct_0207D99C *param0, u32 param1, u8 *param2, u8 *param3);
u16 sub_0207D9C4(UnkStruct_0207D99C *param0);
void sub_0207D9C8(UnkStruct_0207D99C *param0, u32 param1, u8 param2, u8 param3);
void sub_0207D9D4(UnkStruct_0207D99C *param0, u16 param1);
void sub_0207D9D8(UnkStruct_0207D99C *param0, u32 param1, u8 *param2, u8 *param3);
u16 sub_0207D9E4(UnkStruct_0207D99C *param0);
u16 sub_0207D9E8(UnkStruct_0207D99C *param0);
u16 sub_0207D9EC(UnkStruct_0207D99C *param0);
void sub_0207D9F0(UnkStruct_0207D99C *param0, u32 param1, u8 param2, u8 param3);
void sub_0207D9F8(UnkStruct_0207D99C *param0);
void Bag_SetLastItemUsed(UnkStruct_0207D99C *param0, u16 param1, u16 param2);
void sub_0207DA24(UnkStruct_0207D99C *param0, u16 param1);

#endif // POKEPLATINUM_BAG_H
2 changes: 1 addition & 1 deletion include/battle/ai_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ typedef struct AIContext {
int padding0014; // this does not match with a u32, weird

u8 moveDamageRolls[LEARNED_MOVES_MAX];

u16 battlerMoves[MAX_BATTLERS][LEARNED_MOVES_MAX];
u8 battlerAbilities[MAX_BATTLERS];
u16 battlerHeldItems[MAX_BATTLERS];
Expand Down
24 changes: 12 additions & 12 deletions include/battle/battle_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
#include "constants/battle.h"
#include "constants/pokemon.h"

#include "battle/ai_context.h"
#include "battle/battle_message.h"
#include "battle/battle_mon.h"

#include "struct_decls/battle_system.h"
#include "struct_decls/cell_actor_data.h"
#include "struct_decls/font_oam.h"
#include "struct_defs/sprite_manager_allocation.h"
#include "struct_decls/battle_system.h"

#include "battle/ai_context.h"
#include "battle/battle_message.h"
#include "battle/battle_mon.h"
#include "overlay012/struct_ball_rotation_decl.h"

typedef struct BattleContext BattleContext;
Expand Down Expand Up @@ -161,7 +161,7 @@ struct BattleContext {
int sideEffectFlags;
int sideEffectMon;
int lastBattlerId;

int gainedExp;
int sharedExp;
u32 sideGetExpMask[2];
Expand Down Expand Up @@ -197,13 +197,13 @@ struct BattleContext {

BattleScriptTaskData *taskData;
void *tmpData;

u32 fieldConditionsMask;
FieldConditions fieldConditions;

u32 sideConditionsMask[NUM_BATTLE_SIDES];
SideConditions sideConditions[NUM_BATTLE_SIDES];

TurnFlags turnFlags[MAX_BATTLERS];
SelfTurnFlags selfTurnFlags[MAX_BATTLERS];
MoveFailFlags moveFailFlags[MAX_BATTLERS];
Expand All @@ -214,7 +214,7 @@ struct BattleContext {

u32 battleStatusMask;
u32 battleStatusMask2;

int damage;
int hitDamage;
int criticalBoosts;
Expand Down Expand Up @@ -243,12 +243,12 @@ struct BattleContext {
u8 selectedPartySlot[MAX_BATTLERS];
u8 switchedPartySlot[MAX_BATTLERS];
u8 aiSwitchedPartySlot[MAX_BATTLERS];

u32 battlerActions[MAX_BATTLERS][MAX_BATTLE_ACTIONS];
u8 battlerActionOrder[MAX_BATTLERS];
u8 monSpeedOrder[MAX_BATTLERS];
u32 monSpeedValues[MAX_BATTLERS];

u8 ioQueue[MAX_LINK_BATTLERS][MAX_BATTLERS][BATTLE_IO_QUEUE_SIZE];
u8 ioBuffer[MAX_BATTLERS][BATTLE_IO_BUFFER_SIZE];
int battleScript[BATTLE_SCRIPT_SIZE_MAX];
Expand Down Expand Up @@ -282,7 +282,7 @@ struct BattleContext {
u16 padding310A;

u16 speedRand[MAX_BATTLERS];

int flingTemp;
int flingScript;

Expand Down
41 changes: 21 additions & 20 deletions include/battle/battle_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define POKEPLATINUM_BATTLE_CONTROLLER_H

#include "struct_decls/battle_system.h"

#include "battle/battle_context.h"

enum BattleControlSequence {
Expand Down Expand Up @@ -37,15 +38,15 @@ enum BattleControlSequence {
BATTLE_CONTROL_USE_MOVE,
BATTLE_CONTROL_UPDATE_HP,
BATTLE_CONTROL_AFTER_MOVE_MESSAGE,
// 29 is an unused state
// 29 is an unused state
BATTLE_CONTROL_AFTER_MOVE_EFFECT = 30,
BATTLE_CONTROL_LOOP_MULTI_HIT,
// 32 is an unused state
// 32 is an unused state
BATTLE_CONTROL_LOOP_FAINTED = 33,
BATTLE_CONTROL_LOOP_SPREAD_MOVES,
BATTLE_CONTROL_FAINT_AFTER_SELFDESTRUCT,
BATTLE_CONTROL_TRIGGER_AFTER_HIT_EFFECTS,
// 37 is an unused state
// 37 is an unused state
BATTLE_CONTROL_UPDATE_MOVE_BUFFERS = 38,
BATTLE_CONTROL_MOVE_END,
BATTLE_CONTROL_CHECK_ANY_FAINTED,
Expand Down Expand Up @@ -92,50 +93,50 @@ enum {

/**
* @brief Create a new BattleContext struct from the given BattleSystem.
*
*
* The context itself will be initialized along with its state-counters, its AI
* context, the move data table, and the item data table. Memory for the new
* structure will always be allocated from the Battle heap.
*
* @param battleSys
*
* @param battleSys
* @return Address of the newly-allocated BattleContext struct.
*/
void* BattleContext_New(BattleSystem *battleSys);
void *BattleContext_New(BattleSystem *battleSys);

/**
* @brief Main executor for the battle state machine.
*
*
* If the battle is deemed to not yet be complete, then a command will be
* loaded from the parent context struct and the respective state machine
* function will be invoked.
*
*
* For the sequence of states in the machine, see enum BattleControlSequence.
*
* @param battleSys
* @param battleCtx
*
* @param battleSys
* @param battleCtx
* @return TRUE if the battle for this state machine is complete; FALSE
* otherwise.
*/
BOOL BattleController_Main(BattleSystem *battleSys, BattleContext *battleCtx);

/**
* @brief Free the child memory blocks allocated for a BattleContext struct.
*
* @param battleCtx
*
* @param battleCtx
*/
void BattleContext_Free(BattleContext *battleCtx);

/**
* @brief Determine if a move used by the attacking battler will hit its target.
*
*
* This routine will account for both the standard accuracy formula and any
* effects which would otherwise override that formula. Move status flags will
* be updated with information about the move's result.
*
* @param battleSys
* @param battleCtx
* @param attacker
* @param defender
*
* @param battleSys
* @param battleCtx
* @param attacker
* @param defender
* @param move
*/
void BattleController_CheckMoveHit(BattleSystem *battleSys, BattleContext *battleCtx, int attacker, int defender, int move);
Expand Down
Loading

0 comments on commit 2c2ef24

Please sign in to comment.