Skip to content

Commit

Permalink
Merge pull request #307 from Viperio19/overworld-renaming
Browse files Browse the repository at this point in the history
Renaming variables and functions related to overworld poison damage and FieldOverworldState
  • Loading branch information
ravepossum authored Nov 23, 2024
2 parents 13fe3e1 + da15089 commit 73de609
Show file tree
Hide file tree
Showing 35 changed files with 567 additions and 639 deletions.
8 changes: 8 additions & 0 deletions include/constants/field_poison.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef POKEPLATINUM_CONSTANTS_FIELD_POISON_H
#define POKEPLATINUM_CONSTANTS_FIELD_POISON_H

#define FLDPSN_NONE 0
#define FLDPSN_POISONED 1
#define FLDPSN_FAINTED 2

#endif // POKEPLATINUM_CONSTANTS_FIELD_POISON_H
24 changes: 12 additions & 12 deletions include/field_map_change.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ void sub_02053494(FieldSystem *fieldSystem);
void FieldSystem_SetLoadNewGameSpawnTask(FieldSystem *fieldSystem);
void FieldSystem_SetLoadSavedGameMapTask(FieldSystem *fieldSystem);
void FieldSystem_StartLoadMapFromErrorTask(FieldSystem *fieldSystem);
void FieldSystem_StartChangeMapTask(FieldTask *param0, const Location *param1);
void FieldTask_ChangeMapByLocation(FieldTask *param0, const Location *param1);
void FieldTask_ChangeMapToLocation(FieldTask *param0, int param1, int param2, int param3, int param4, int param5);
void FieldTask_StartMapChangeFull(FieldTask *param0, int param1, int param2, int param3, int param4, int param5);
void FieldSystem_StartChangeMapTask(FieldTask *task, const Location *param1);
void FieldTask_ChangeMapByLocation(FieldTask *task, const Location *param1);
void FieldTask_ChangeMapToLocation(FieldTask *task, int param1, int param2, int param3, int param4, int param5);
void FieldTask_StartMapChangeFull(FieldTask *task, int param1, int param2, int param3, int param4, int param5);
void FieldTask_StartMapChangeFly(FieldSystem *fieldSystem, int param1, int param2, int param3, int param4, int param5);
void FieldTask_ChangeMapChangeFly(FieldTask *param0, int param1, int param2, int param3, int param4, int param5);
void FieldTask_ChangeMapChangeByDig(FieldTask *param0, const Location *param1, u32 param2);
void FieldTask_ChangeMapChangeFly(FieldTask *task, int param1, int param2, int param3, int param4, int param5);
void FieldTask_ChangeMapChangeByDig(FieldTask *task, const Location *location, u32 param2);
void FieldSystem_StartMapChangeWarpTask(FieldSystem *fieldSystem, int param1, int param2);
void *sub_02053FAC(FieldSystem *fieldSystem);
void FieldTask_SetUndergroundMapChange(FieldSystem *fieldSystem);
BOOL FieldTask_MapChangeToUnderground(FieldTask *param0);
BOOL sub_0205430C(FieldTask *param0);
BOOL FieldTask_MapChangeToUnderground(FieldTask *task);
BOOL sub_0205430C(FieldTask *task);
FieldTaskFunc FieldMapChange_GetMapChangeUndergroundTask(const FieldSystem *fieldSystem);
void sub_020544F0(FieldTask *param0, const Location *param1);
void sub_020544F0(FieldTask *task, const Location *param1);
void sub_020545EC(FieldSystem *fieldSystem);
void sub_02054708(FieldTask *param0);
void sub_02054800(FieldTask *param0, int param1, int param2, int param3, int param4, int param5);
void sub_02054864(FieldTask *param0);
void sub_02054708(FieldTask *task);
void sub_02054800(FieldTask *task, int param1, int param2, int param3, int param4, int param5);
void sub_02054864(FieldTask *task);

#endif // POKEPLATINUM_FIELD_MAP_CHANGE_H
44 changes: 22 additions & 22 deletions include/field_overworld_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@

int FieldOverworldState_Size(void);
int FieldOverworldSave_Size(void);
void FieldOverworldSave_Init(FieldOverworldSave *param0);
void FieldOverworldState_Init(FieldOverworldState *param0);
Location *FieldOverworldState_GetPlayerLocation(FieldOverworldState *param0);
Location *FieldOverworldState_GetEntranceLocation(FieldOverworldState *param0);
Location *FieldOverworldState_GetPrevLocation(FieldOverworldState *param0);
Location *sub_0203A72C(FieldOverworldState *param0);
Location *FieldOverworldState_GetSpecialLocation(FieldOverworldState *param0);
void FieldOverworldState_SetSpecialLocation(FieldOverworldState *param0, Location *param1);
u16 *sub_0203A748(FieldOverworldState *param0);
u16 FieldOverworldState_GetWeather(const FieldOverworldState *param0);
void FieldOverworldState_SetWeather(FieldOverworldState *param0, u16 param1);
u16 FieldOverworldState_GetWarpId(const FieldOverworldState *param0);
void FieldOverworldState_SetWarpId(FieldOverworldState *param0, u16 param1);
UnkStruct_020556C4 *sub_0203A76C(FieldOverworldState *param0);
int FieldOverworldState_GetCameraType(const FieldOverworldState *param0);
void FieldOverworldState_SetCameraType(FieldOverworldState *param0, int param1);
PlayerData *FieldOverworldState_GetPlayerData(FieldOverworldState *param0);
u16 *sub_0203A784(FieldOverworldState *param0);
u16 *sub_0203A788(FieldOverworldState *param0);
u16 *sub_0203A78C(FieldOverworldState *param0);
FieldOverworldState *SaveData_GetFieldOverworldState(SaveData *param0);
FieldOverworldSave *SaveData_GetFieldOverworldSave(SaveData *param0);
void FieldOverworldSave_Init(FieldOverworldSave *fieldSave);
void FieldOverworldState_Init(FieldOverworldState *fieldState);
Location *FieldOverworldState_GetPlayerLocation(FieldOverworldState *fieldState);
Location *FieldOverworldState_GetEntranceLocation(FieldOverworldState *fieldState);
Location *FieldOverworldState_GetPrevLocation(FieldOverworldState *fieldState);
Location *FieldOverworldState_GetExitLocation(FieldOverworldState *fieldState);
Location *FieldOverworldState_GetSpecialLocation(FieldOverworldState *fieldState);
void FieldOverworldState_SetSpecialLocation(FieldOverworldState *fieldState, Location *location);
u16 *FieldOverworldState_GetSpecialBGM(FieldOverworldState *fieldState);
u16 FieldOverworldState_GetWeather(const FieldOverworldState *fieldState);
void FieldOverworldState_SetWeather(FieldOverworldState *fieldState, u16 weather);
u16 FieldOverworldState_GetWarpId(const FieldOverworldState *fieldState);
void FieldOverworldState_SetWarpId(FieldOverworldState *fieldState, u16 warpId);
UnkStruct_020556C4 *sub_0203A76C(FieldOverworldState *fieldState);
int FieldOverworldState_GetCameraType(const FieldOverworldState *fieldState);
void FieldOverworldState_SetCameraType(FieldOverworldState *fieldState, int type);
PlayerData *FieldOverworldState_GetPlayerData(FieldOverworldState *fieldState);
u16 *FieldOverworldState_GetSafariBallCount(FieldOverworldState *fieldState);
u16 *FieldOverworldState_GetSafariStepCount(FieldOverworldState *fieldState);
u16 *FieldOverworldState_GetPoisonStepCount(FieldOverworldState *fieldState);
FieldOverworldState *SaveData_GetFieldOverworldState(SaveData *saveData);
FieldOverworldSave *SaveData_GetFieldOverworldSave(SaveData *saveData);
void FieldSystem_SaveObjects(FieldSystem *fieldSystem);
void FieldSystem_LoadObjects(FieldSystem *fieldSystem);

Expand Down
4 changes: 2 additions & 2 deletions include/inlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ static inline void inline_ov61_0222C3B0_sub(SysTask *param0, void *param1)

static inline void inline_ov47_0225621C_sub(FieldSystem *fieldSystem, int *param1, int *param2)
{
FieldOverworldState *v0 = SaveData_GetFieldOverworldState(fieldSystem->saveData);
Location *location = sub_0203A72C(v0);
FieldOverworldState *fieldState = SaveData_GetFieldOverworldState(fieldSystem->saveData);
Location *location = FieldOverworldState_GetExitLocation(fieldState);

if (MapHeader_IsOnMainMatrix(fieldSystem->location->mapId)) {
*param1 = fieldSystem->location->x;
Expand Down
2 changes: 1 addition & 1 deletion include/overlay005/ov5_021EF4BC.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

UnkStruct_ov5_021EF4F8 *ov5_021EF4BC(u32 param0, HBlankSystem *param1);
void ov5_021EF4F8(UnkStruct_ov5_021EF4F8 *param0);
void ov5_021EF518(UnkStruct_ov5_021EF4F8 *param0);
void Field_DoPoisonEffect(UnkStruct_ov5_021EF4F8 *param0);

#endif // POKEPLATINUM_OV5_021EF4BC_H
8 changes: 4 additions & 4 deletions include/overlay006/ov6_02247100.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
#include "pokemon.h"

void *ov6_02247100(FieldSystem *fieldSystem, u32 param1);
BOOL ov6_02247120(FieldTask *param0);
BOOL ov6_02247120(FieldTask *task);
void *ov6_022472C8(FieldSystem *fieldSystem, u32 param1, int param2);
BOOL ov6_022472E8(FieldTask *param0);
BOOL ov6_022472E8(FieldTask *task);
void *ov6_02247488(FieldSystem *, Pokemon *, u32 param0);
BOOL ov6_022474AC(FieldTask *param0);
BOOL ov6_022474AC(FieldTask *task);
void *ov6_02247530(FieldSystem *fieldSystem, Pokemon *param1, u32 param2);
BOOL ov6_02247554(FieldTask *param0);
BOOL ov6_02247554(FieldTask *task);

#endif // POKEPLATINUM_OV6_02247100_H
2 changes: 1 addition & 1 deletion include/struct_decls/struct_0203A790_decl.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef POKEPLATINUM_STRUCT_0203A790_DECL_H
#define POKEPLATINUM_STRUCT_0203A790_DECL_H

typedef struct UnkStruct_0203A790_t FieldOverworldState;
typedef struct FieldOverworldState FieldOverworldState;

#endif // POKEPLATINUM_STRUCT_0203A790_DECL_H
4 changes: 2 additions & 2 deletions include/unk_020528D0.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "field_task.h"

BOOL sub_02052B2C(FieldTask *param0);
void sub_02052C5C(FieldTask *param0);
BOOL sub_02052B2C(FieldTask *task);
void sub_02052C5C(FieldTask *task);

#endif // POKEPLATINUM_UNK_020528D0_H
8 changes: 4 additions & 4 deletions include/unk_02054884.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
#define PARTY_SLOT_NONE 0xFF

BOOL Pokemon_CanBattle(Pokemon *mon);
BOOL sub_020548B0(int param0, SaveData *param1, u16 param2, u8 param3, u16 param4, int param5, int param6);
BOOL sub_02054930(int param0, SaveData *param1, u16 param2, u8 param3, int param4, int param5);
void sub_02054988(Party *param0, int param1, int param2, u16 param3);
BOOL sub_020548B0(int heapID, SaveData *saveData, u16 param2, u8 param3, u16 param4, int param5, int param6);
BOOL sub_02054930(int unused, SaveData *saveData, u16 param2, u8 param3, int param4, int param5);
void sub_02054988(Party *party, int param1, int param2, u16 param3);
int Party_HasMonWithMove(Party *party, u16 moveID);
int Party_AliveMonsCount(const Party *party);
Pokemon *Party_FindFirstEligibleBattler(const Party *party);
Pokemon *Party_FindFirstHatchedMon(const Party *party);
BOOL Party_HasTwoAliveMons(const Party *party);
void Party_GiveChampionRibbons(Party *party);
int sub_02054B04(Party *param0, u16 param1);
int Pokemon_DoPoisonDamage(Party *party, u16 mapLabelTextID);
BOOL Pokemon_TrySurvivePoison(Pokemon *mon);

#endif // POKEPLATINUM_UNK_02054884_H
6 changes: 3 additions & 3 deletions include/unk_020553DC.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#include "field/field_system_decl.h"

void sub_020553DC(void);
void sub_020553F0(FieldSystem *fieldSystem, u16 param1);
u16 sub_02055404(FieldSystem *fieldSystem);
void Sound_SetSpecialBGM(FieldSystem *fieldSystem, u16 sdatID);
u16 Sound_GetSpecialBGM(FieldSystem *fieldSystem);
void Sound_ClearSpecialBGM(FieldSystem *fieldSystem);
u16 sub_02055428(FieldSystem *fieldSystem, int param1);
u16 sub_020554A4(FieldSystem *fieldSystem, int param1);
u16 sub_020554A4(FieldSystem *fieldSystem, int headerID);
BOOL sub_02055554(FieldSystem *fieldSystem, u16 param1, int param2);
u16 sub_0205560C(int param0);
void Sound_TryFadeInBGM(FieldSystem *fieldSystem, int param1);
Expand Down
6 changes: 3 additions & 3 deletions src/comm_player_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,13 +631,13 @@ static int CommPlayer_Direction(u16 unused, u16 keys)
BOOL CommPlayer_CheckNPCCollision(int x, int z)
{
int npcCnt, i;
const ObjectEvent *npcList;
const ObjectEvent *objEventList;

npcCnt = MapHeaderData_GetNumObjectEvents(sCommPlayerManager->fieldSystem);
npcList = MapHeaderData_GetObjectEvents(sCommPlayerManager->fieldSystem);
objEventList = MapHeaderData_GetObjectEvents(sCommPlayerManager->fieldSystem);

for (i = 0; i < npcCnt; i++) {
if ((npcList[i].x == x) && (npcList[i].z == z)) {
if ((objEventList[i].x == x) && (objEventList[i].z == z)) {
return 1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/encounter.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ static BOOL FieldTask_SafariEncounter(FieldTask *task)
FieldSystem *fieldSystem = FieldTask_GetFieldSystem(task);
Encounter *encounter = FieldTask_GetEnv(task);
int *state = FieldTask_GetState(task);
u16 *ballCount = sub_0203A784(SaveData_GetFieldOverworldState(fieldSystem->saveData));
u16 *ballCount = FieldOverworldState_GetSafariBallCount(SaveData_GetFieldOverworldState(fieldSystem->saveData));

switch (*state) {
case 0:
Expand Down
2 changes: 1 addition & 1 deletion src/field_battle_data_transfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ void FieldBattleDTO_UpdateFieldSystem(const FieldBattleDTO *dto, FieldSystem *fi
Party *party = Party_GetFromSavedata(fieldSystem->saveData);
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
PokedexData *pokedex = SaveData_Pokedex(fieldSystem->saveData);
u16 *fieldSysSafariBalls = sub_0203A784(SaveData_GetFieldOverworldState(fieldSystem->saveData));
u16 *fieldSysSafariBalls = FieldOverworldState_GetSafariBallCount(SaveData_GetFieldOverworldState(fieldSystem->saveData));

TrainerInfo_Copy(dto->trainerInfo[BATTLER_PLAYER_SLOT_1], trainerInfo);
Party_cpy(dto->parties[BATTLER_PLAYER_SLOT_1], party);
Expand Down
Loading

0 comments on commit 73de609

Please sign in to comment.