Skip to content

Commit

Permalink
Merge pull request #91 from lhearachel/battle-dev
Browse files Browse the repository at this point in the history
Document the capture formula
  • Loading branch information
lhearachel authored Oct 23, 2023
2 parents 23e118d + 7584276 commit 830bcf1
Show file tree
Hide file tree
Showing 23 changed files with 412 additions and 317 deletions.
2 changes: 1 addition & 1 deletion include/battle/battle_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ struct BattleContext {
int flingTemp;
int flingScript;

u8 safariCatchCount;
u8 safariCatchStage;
u8 safariEscapeCount;
u8 runAttempts;
u8 battleEndFlag;
Expand Down
1 change: 1 addition & 0 deletions include/constants/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define BATTLE_TYPE_NO_EXPERIENCE (BATTLE_TYPE_LINK | BATTLE_TYPE_SAFARI | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_PAL_PARK)
#define BATTLE_TYPE_NO_ABILITIES (BATTLE_TYPE_SAFARI | BATTLE_TYPE_PAL_PARK)
#define BATTLE_TYPE_2vs2_TAG (BATTLE_TYPE_2vs2 | BATTLE_TYPE_TAG)
#define BATTLE_TYPE_ALWAYS_CATCH (BATTLE_TYPE_PAL_PARK | BATTLE_TYPE_CATCH_TUTORIAL)

#define MAX_LINK_BATTLERS 4
#define MAX_BATTLERS 4
Expand Down
35 changes: 35 additions & 0 deletions include/constants/battle/terrain.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef POKEPLATINUM_CONSTANTS_BATTLE_TERRAIN_H
#define POKEPLATINUM_CONSTANTS_BATTLE_TERRAIN_H

enum Terrain {
TERRAIN_PLAIN = 0,
TERRAIN_SAND,
TERRAIN_GRASS,
TERRAIN_PUDDLE,
TERRAIN_MOUNTAIN,
TERRAIN_CAVE,
TERRAIN_SNOW,
TERRAIN_WATER,
TERRAIN_ICE,
TERRAIN_BUILDING,
TERRAIN_GREAT_MARSH,
TERRAIN_BRIDGE,

TERRAIN_AARON,
TERRAIN_BERTHA,
TERRAIN_FLINT,
TERRAIN_LUCIAN,
TERRAIN_CYNTHIA,

TERRAIN_DISTORTION_WORLD,
TERRAIN_BATTLE_TOWER,
TERRAIN_BATTLE_FACTORY,
TERRAIN_BATTLE_ARCADE,
TERRAIN_BATTLE_CASTLE,
TERRAIN_BATTLE_HALL,
TERRAIN_GIRATINA,

TERRAIN_MAX
};

#endif // POKEPLATINUM_CONSTANTS_BATTLE_TERRAIN_H
12 changes: 12 additions & 0 deletions include/constants/time.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef POKEPLATINUM_CONSTANTS_TIME_H
#define POKEPLATINUM_CONSTANTS_TIME_H

enum Time {
TIME_MORNING = 0,
TIME_DAY,
TIME_DUSK,
TIME_NIGHT,
TIME_MIDNIGHT,
};

#endif // POKEPLATINUM_CONSTANTS_TIME_H
2 changes: 1 addition & 1 deletion include/overlay012/ov12_02235E94.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BOOL ov12_02236764(UnkStruct_ov12_02236648 * param0);
void ov12_02236780(UnkStruct_ov12_02236648 * param0);
void ov12_022368C8(BallRotation * param0, int param1);
BOOL ov12_022368D0(BallRotation * param0, int param1);
BallRotation * ov12_02237728(UnkStruct_ov12_02237728 * param0);
BallRotation * ov12_02237728(BallThrow * param0);
BOOL ov12_022377F8(BallRotation * param0);
BOOL ov12_02237810(BallRotation * param0);
void ov12_02237828(BallRotation * param0, int param1);
Expand Down
24 changes: 12 additions & 12 deletions include/overlay012/struct_ov12_02237728.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
#include "struct_decls/struct_0200C6E4_decl.h"
#include "struct_decls/battle_system.h"

typedef struct {
int unk_00;
int unk_04;
int unk_08;
int unk_0C;
int unk_10;
int unk_14;
int unk_18;
UnkStruct_0200C6E4 * unk_1C;
PaletteSys * unk_20;
BattleSystem * unk_24;
} UnkStruct_ov12_02237728;
typedef struct BallThrow {
int type;
int heapID;
int mode;
int target;
int ballID;
int bgPrio;
int surface;
UnkStruct_0200C6E4 *cellActorSys;
PaletteSys *paletteSys;
BattleSystem *battleSys;
} BallThrow;

#endif // POKEPLATINUM_STRUCT_OV12_02237728_H
32 changes: 29 additions & 3 deletions include/overlay016/ov16_0223DF00.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef POKEPLATINUM_OV16_0223DF00_H
#define POKEPLATINUM_OV16_0223DF00_H

#include "constants/battle/terrain.h"
#include "constants/time.h"

#include "struct_decls/struct_02002F38_decl.h"
#include "struct_decls/struct_02007768_decl.h"
#include "struct_decls/struct_02007C7C_decl.h"
Expand Down Expand Up @@ -119,7 +122,14 @@ u8 BattleSystem_BattlerSlot(BattleSystem * param0, int param1);
u8 Battler_Side(BattleSystem * param0, int param1);
void * ov16_0223E220(BattleSystem * param0);
PCBoxes * ov16_0223E228(BattleSystem * param0);
int ov16_0223E22C(BattleSystem * param0);

/**
* @brief Get the terrain type for the battle.
*
* @param battleSys
* @return The battle's terrain.
*/
enum Terrain BattleSystem_Terrain(BattleSystem *battleSys);
int ov16_0223E240(BattleSystem * param0);
int BattleSystem_MapHeader(BattleSystem * param0);
int BattleSystem_Partner(BattleSystem * param0, int param1);
Expand All @@ -139,7 +149,14 @@ int BattleSystem_Partner(BattleSystem * param0, int param1);
int BattleSystem_EnemyInSlot(BattleSystem *battleSys, int attacker, int slot);
BOOL ov16_0223E30C(BattleSystem * param0, int param1, int param2, int param3, int param4);
u32 BattleSystem_BattleStatus(BattleSystem * param0);
int ov16_0223EBF8(BattleSystem * param0);

/**
* @brief Get the time of day.
*
* @param battleSys
* @return The time of day (e.g., morning, day, night)
*/
enum Time BattleSystem_Time(BattleSystem *battleSys);
int ov16_0223EC04(BattleSystem * param0);
u8 ov16_0223EC58(BattleSystem * param0, int param1, u8 param2);
u16 ov16_0223ECC4(BattleParams * param0, int * param1, int * param2);
Expand Down Expand Up @@ -226,7 +243,16 @@ void BattleSystem_SetGaugePriority(BattleSystem * param0, int param1);
u32 ov16_0223F904(Party * param0, TrainerInfo * param1);
void BattleSystem_DexFlagSeen(BattleSystem * param0, int param1);
void ov16_0223F9A0(BattleSystem * param0, int param1);
BOOL ov16_0223F9E0(BattleSystem * param0, int param1);

/**
* @brief Checks if the player has previously caught a member of this species.
*
* @param battleSys
* @param species
* @return TRUE if the player has previously caught a member of the given species,
* FALSE if not.
*/
BOOL BattleSystem_CaughtSpecies(BattleSystem *battleSys, int species);
void ov16_0223F9F0(void);
u8 ov16_0223F9FC(BattleSystem * param0, int param1, int param2, int param3, int param4);
u8 BattleMessage_Print(BattleSystem * param0, MessageLoader * param1, BattleMessage * param2, int param3);
Expand Down
9 changes: 6 additions & 3 deletions include/struct_defs/battle_system.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef POKEPLATINUM_STRUCT_BATTLE_SYSTEM_T_H
#define POKEPLATINUM_STRUCT_BATTLE_SYSTEM_T_H

#include "constants/battle/terrain.h"
#include "constants/time.h"

#include "struct_decls/struct_02002F38_decl.h"
#include "struct_decls/struct_02007768_decl.h"
#include "message.h"
Expand Down Expand Up @@ -59,7 +62,7 @@ struct BattleSystem {
TrainerInfo * unk_48[4];
UnkStruct_0207D3C0 * unk_58;
UnkStruct_0207D99C * unk_5C;
UnkStruct_02026324 * unk_60;
UnkStruct_02026324 *pokedex;
PCBoxes * unk_64;
Party *parties[4];
UnkStruct_0202CC84 * unk_78[4];
Expand Down Expand Up @@ -110,11 +113,11 @@ struct BattleSystem {
u8 unk_23FB_2 : 1;
u8 unk_23FB_3 : 2;
u8 unk_23FB_5 : 3;
int unk_23FC;
enum Terrain terrain;
int unk_2400;
int unk_2404;
u32 battleStatusMask;
int unk_240C;
enum Time time;
int safariBalls;
u8 unk_2414[4];
u32 unk_2418;
Expand Down
2 changes: 1 addition & 1 deletion include/unk_0202631C.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BOOL sub_02026EF4(const UnkStruct_02026324 * param0);
BOOL sub_02026F0C(const UnkStruct_02026324 * param0);
u16 sub_02026F20(const UnkStruct_02026324 * param0);
u16 sub_02026F58(const UnkStruct_02026324 * param0);
BOOL sub_02026F9C(const UnkStruct_02026324 * param0, u16 param1);
BOOL Pokedex_CaughtSpecies(const UnkStruct_02026324 * param0, u16 param1);
BOOL sub_02026FE8(const UnkStruct_02026324 * param0, u16 param1);
u32 sub_0202702C(const UnkStruct_02026324 * param0, u8 param1);
u32 sub_02027058(const UnkStruct_02026324 * param0, u16 param1, int param2);
Expand Down
Loading

0 comments on commit 830bcf1

Please sign in to comment.