Skip to content

Commit

Permalink
Merge branch 'main' into general-renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Viperio19 authored Nov 23, 2024
2 parents 52b8f53 + 73de609 commit b1df4a0
Show file tree
Hide file tree
Showing 1,147 changed files with 3,553 additions and 1,721 deletions.
4 changes: 3 additions & 1 deletion asm/macros/scrcmd.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
.include "consts/sdat.inc"
.include "consts/species.inc"

#include "res/trainers/trdata.naix"

.macro Noop
.short 0
.endm
Expand Down Expand Up @@ -1263,7 +1265,7 @@
.short \arg0
.endm

.macro StartTrainerBattle enemyTrainer1, enemyTrainer2
.macro StartTrainerBattle enemyTrainer1, enemyTrainer2=0
.short 229
.short \enemyTrainer1
.short \enemyTrainer2
Expand Down
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
8 changes: 3 additions & 5 deletions include/inlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
#include "heap.h"
#include "location.h"
#include "map_header.h"
#include "math.h"
#include "narc.h"
#include "palette.h"
#include "script_manager.h"
#include "sys_task.h"
#include "sys_task_manager.h"
#include "system_flags.h"
#include "unk_0201D15C.h"
#include "vars_flags.h"

static inline void inline_ov61_0222C3B0_sub_1(UnkStruct_ov61_0222C3B0 *);
static inline void inline_ov61_0222C3B0_sub(SysTask *, void *);
Expand Down Expand Up @@ -131,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
41 changes: 41 additions & 0 deletions include/math.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#ifndef POKEPLATINUM_MATH_H
#define POKEPLATINUM_MATH_H

#include <nitro/fx/fx.h>

#include "constants/heap.h"

enum AffineTransformationMatrixMode {
AFFINE_MODE_NORMAL = 0,
AFFINE_MODE_MAX_256,
AFFINE_MODE_MAX_360,
};

fx32 CalcSineDegrees(u16 degrees);
fx32 CalcCosineDegrees(u16 degrees);
fx32 CalcSineDegrees_Wraparound(u16 degrees);
fx32 CalcCosineDegrees_Wraparound(u16 degrees);
u16 CalcAngleRotationIdx(u16 degrees);
u16 CalcAngleRotationIdx_Wraparound(u16 degrees);
fx32 CalcSineDegrees_FX32(fx32 degrees);
fx32 CalcCosineDegrees_FX32(fx32 degrees);

u32 LCRNG_GetSeed(void);
void LCRNG_SetSeed(u32 seed);
u16 LCRNG_Next(void);
u32 ARNG_Next(u32 seed);
void MTRNG_SetSeed(u32 seed);
u32 MTRNG_Next(void);

void CreateAffineTransformationMatrix(MtxFx22 *matrix, u16 degrees, fx32 xScale, fx32 yScale, u8 mode);

s32 CalcDotProduct2D(s32 x0, s32 y0, s32 x1, s32 y1, u32 unused);
s32 CalcRadialAngle(u16 radius, s32 distance);

u32 SumBytes(const void *data, u32 size);
void EncodeData(void *data, u32 size, u32 seed);
void DecodeData(void *data, u32 size, u32 seed);
u16 CalcCRC16Checksum(const void *data, u32 dataLen);
void InitCRC16Table(enum HeapId heapID);

#endif // POKEPLATINUM_MATH_H
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
29 changes: 0 additions & 29 deletions include/unk_0201D15C.h

This file was deleted.

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
2 changes: 1 addition & 1 deletion platinum.us/main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Static main
Object main.nef.p/src_sys_task_manager.c.o
Object main.nef.p/src_unk_0201CED8.c.o
Object main.nef.p/src_charcode.c.o
Object main.nef.p/src_unk_0201D15C.c.o
Object main.nef.p/src_math.c.o
Object main.nef.p/src_text.c.o
Object main.nef.p/src_unk_0201DBEC.c.o
Object main.nef.p/src_unk_0201DD00.c.o
Expand Down
8 changes: 5 additions & 3 deletions res/field/scripts/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -1148,9 +1148,11 @@ scr_seq_narc = custom_target('scr_seq.narc',
'-p', '@OUTPUT0@',
'-o', scr_seq_narc_order,
'-n'
]
],
depends: [
trdata_narc,
],
)

nitrofs_files += scr_seq_narc

nitrofs_files += scr_seq_narc[0]
naix_headers += scr_seq_narc[1]
28 changes: 14 additions & 14 deletions res/field/scripts/scripts_battleground.s
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ _032F:
CloseMessage
IncrementGameRecord RECORD_UNK_057
Call _0605
StartTrainerBattle 0x4005, 0
StartTrainerBattle 0x4005
CheckWonBattle 0x8000
Return

Expand Down Expand Up @@ -396,55 +396,55 @@ _0605:
Return

_06B0:
SetVar 0x4005, 0x35A
SetVar 0x4005, trainer_leader_roark_rematch
Return

_06B8:
SetVar 0x4005, 0x359
SetVar 0x4005, trainer_leader_gardenia_rematch
Return

_06C0:
SetVar 0x4005, 0x35B
SetVar 0x4005, trainer_leader_wake_rematch
Return

_06C8:
SetVar 0x4005, 0x356
SetVar 0x4005, trainer_leader_maylene_rematch
Return

_06D0:
SetVar 0x4005, 0x35C
SetVar 0x4005, trainer_leader_fantina_rematch
Return

_06D8:
SetVar 0x4005, 0x355
SetVar 0x4005, trainer_leader_candice_rematch
Return

_06E0:
SetVar 0x4005, 0x358
SetVar 0x4005, trainer_leader_byron_rematch
Return

_06E8:
SetVar 0x4005, 0x357
SetVar 0x4005, trainer_leader_volkner_rematch
Return

_06F0:
SetVar 0x4005, 0x361
SetVar 0x4005, trainer_trainer_cheryl_battleground
Return

_06F8:
SetVar 0x4005, 0x35D
SetVar 0x4005, trainer_trainer_riley_battleground
Return

_0700:
SetVar 0x4005, 0x35F
SetVar 0x4005, trainer_trainer_marley_battleground
Return

_0708:
SetVar 0x4005, 0x35E
SetVar 0x4005, trainer_trainer_buck_battleground
Return

_0710:
SetVar 0x4005, 0x360
SetVar 0x4005, trainer_trainer_mira_battleground
Return

_0718:
Expand Down
Loading

0 comments on commit b1df4a0

Please sign in to comment.