Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General renaming and small structural changes in berry_patches.c - item.c #310

Merged
merged 11 commits into from
Nov 25, 2024
92 changes: 46 additions & 46 deletions include/comm_player_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,69 +60,69 @@ typedef struct CommPlayerManager {
} CommPlayerManager;

CommPlayerManager *CommPlayerMan_Get(void);
BOOL CommPlayerMan_Init(void *param0, FieldSystem *fieldSystem, BOOL param2);
BOOL CommPlayerMan_Init(void *dest, FieldSystem *fieldSystem, BOOL isUnderground);
void CommPlayerMan_Reset(void);
void CommPlayerMan_Restart(void);
void CommPlayerMan_Delete(BOOL param0);
void CommPlayerMan_Delete(BOOL deletePlayerData);
void CommPlayerMan_Reinit(void);
void CommPlayerMan_Stop(void);
void CommPlayer_InitPersonal(void);
void CommPlayer_CopyPersonal(int param0);
void CommPlayer_SendXZPos(BOOL param0, int param1, int param2);
void CommPlayer_CopyPersonal(int netJd);
void CommPlayer_SendXZPos(BOOL param0, int x, int z);
void CommPlayer_SendPos(BOOL param0);
void CommPlayer_SendPosServer(BOOL param0);
u32 CommPlayer_Size(void);
void CommPlayer_Destroy(u8 param0, BOOL param1, BOOL param2);
void CommPlayer_Destroy(u8 netId, BOOL param1, BOOL param2);
BOOL sub_02057FAC(void);
void sub_02057FC4(BOOL param0);
void sub_02058018(int param0, int param1, void *param2, void *param3);
void sub_02058018(int netId, int param1, void *param2, void *unused);
void sub_0205805C(FieldSystem *fieldSystem, BOOL param1);
BOOL CommPlayer_CheckNPCCollision(int param0, int param1);
void CommPlayer_RecvLocation(int param0, int param1, void *param2, void *param3);
void CommPlayer_RecvDelete(int param0, int param1, void *param2, void *param3);
BOOL CommPlayer_CheckNPCCollision(int x, int z);
void CommPlayer_RecvLocation(int netId, int unused0, void *src, void *unused1);
void CommPlayer_RecvDelete(int unused0, int unused1, void *src, void *unused2);
int CommPacketSizeOf_RecvLocation(void);
void CommPlayer_RecvLocationAndInit(int param0, int param1, void *param2, void *param3);
void sub_02058B0C(int param0, int param1, BOOL param2);
void sub_02058B7C(int param0);
void sub_02058B94(int param0);
void CommPlayer_StartBlowAnimation(int param0, int param1, BOOL param2);
void CommPlayer_StopBlowAnimation(int param0);
void CommPlayer_RecvLocationAndInit(int netId, int size, void *src, void *unused);
void sub_02058B0C(int netId, int param1, BOOL param2);
void sub_02058B7C(int netId);
void sub_02058B94(int netId);
void CommPlayer_StartBlowAnimation(int netId, int param1, BOOL unused);
void CommPlayer_StopBlowAnimation(int netId);
int CommPacketSizeOf_RecvLocationAndInit(void);
BOOL sub_02058C40(void);
BOOL CommPlayer_IsActive(int param0);
int CommPlayer_XPos(int param0);
int CommPlayer_ZPos(int param0);
int sub_02058D48(int param0);
int sub_02058D68(int param0);
int sub_02058D88(int param0);
int sub_02058DC0(int param0);
int CommPlayer_GetXServer(int param0);
int CommPlayer_GetZServer(int param0);
int sub_02058EA0(int param0);
int sub_02058EC0(int param0);
int CommPlayer_AddXServer(int param0);
int CommPlayer_AddZServer(int param0);
int CommPlayer_Dir(int param0);
int CommPlayer_DirServer(int param0);
void CommPlayer_LookTowardsServer(int param0, int param1);
void CommPlayer_LookTowards(int param0, int param1);
int sub_0205900C(int param0, int param1);
void sub_02059058(int param0, BOOL param1);
BOOL sub_02059094(int param0);
BOOL CommPlayer_IsActive(int netId);
int CommPlayer_XPos(int netId);
int CommPlayer_ZPos(int netId);
int sub_02058D48(int netId);
int sub_02058D68(int netId);
int sub_02058D88(int netId);
int sub_02058DC0(int netId);
int CommPlayer_GetXServer(int netId);
int CommPlayer_GetZServer(int netId);
int sub_02058EA0(int netId);
int sub_02058EC0(int netId);
int CommPlayer_AddXServer(int netId);
int CommPlayer_AddZServer(int netId);
int CommPlayer_Dir(int netId);
int CommPlayer_DirServer(int netId);
void CommPlayer_LookTowardsServer(int netIdTarget, int netIdSet);
void CommPlayer_LookTowards(int netIdTarget, int netIdSet);
int sub_0205900C(int xPos, int yPos);
void sub_02059058(int netId, BOOL param1);
BOOL sub_02059094(int netId);
BOOL sub_020590C4(void);
void sub_02059180(int param0, int param1, void *param2, void *param3);
void sub_02059180(int netId, int unused0, void *src, void *unused3);
void CommPlayer_SetBattleDir(void);
BOOL sub_0205928C(void);
int CommPlayer_GetOppositeDir(int param0);
void sub_02059354(int param0, int param1);
void sub_02059378(int param0);
void sub_02059390(int param0, int param1);
void sub_020593B4(int param0);
int CommPlayer_GetMovementTimer(int param0);
int CommPlayer_GetMovementTimerServer(int param0);
void CommPlayer_SetDir(int param0);
void CommPlayer_SetDirClient(int param0, int param1);
int CommPlayer_DirClient(int param0);
int CommPlayer_GetOppositeDir(int dir);
void sub_02059354(int netId, int param1);
void sub_02059378(int netId);
void sub_02059390(int netId, int param1);
void sub_020593B4(int netId);
int CommPlayer_GetMovementTimer(int netId);
int CommPlayer_GetMovementTimerServer(int netId);
void CommPlayer_SetDir(int dir);
void CommPlayer_SetDirClient(int netId, int dir);
int CommPlayer_DirClient(int netId);
void sub_02059464(int param0);
void sub_0205948C(int param0);
void sub_020594EC(void);
Expand Down
14 changes: 7 additions & 7 deletions include/comm_ring.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef POKEPLATINUM_UNK_02032188_H
#define POKEPLATINUM_UNK_02032188_H
#ifndef POKEPLATINUM_COMM_RING_H
#define POKEPLATINUM_COMM_RING_H

typedef struct {
u8 *buffer;
Expand All @@ -9,13 +9,13 @@ typedef struct {
s16 size;
} CommRing;

void CommRing_Init(CommRing *ring, u8 *param1, int param2);
void CommRring_Write(CommRing *ring, u8 *param1, int param2, int param3);
int CommRing_Read(CommRing *ring, u8 *param1, int param2);
void CommRing_Init(CommRing *ring, u8 *buffer, int size);
void CommRring_Write(CommRing *ring, u8 *buffer, int size, int unused);
int CommRing_Read(CommRing *ring, u8 *buffer, int size);
u8 CommRing_ReadByte(CommRing *ring);
int CommRing_Peek(CommRing *ring, u8 *param1, int param2);
int CommRing_Peek(CommRing *ring, u8 *buffer, int size);
int CommRing_DataSize(CommRing *ring);
int CommRing_RemainingSize(CommRing *ring);
void CommRing_UpdateEndPos(CommRing *ring);

#endif // POKEPLATINUM_UNK_02032188_H
#endif // POKEPLATINUM_COMM_RING_H
2 changes: 1 addition & 1 deletion include/communication_information.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void CommInfo_Delete(void);
BOOL CommInfo_IsInitialized(void);
void CommInfo_SendBattleRegulation(void);
int CommPlayerInfo_Size(void);
void CommunicatitonInformaion_FinishReading(int param0, int param1, void *param2, void *param3);
void CommunicatitonInformaion_FinishReading(int unused0, int unused1, void *unused2, void *unused3);
BOOL CommInfo_IsDataFinishedReading(void);
void CommInfo_RecvPlayerDataArray(int netId, int unused1, void *src, void *unused3);
void CommInfo_RecvPlayerData(int netId, int unused1, void *src, void *unused3);
Expand Down
28 changes: 14 additions & 14 deletions include/communication_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ void CommSys_Reset(void);
void CommSys_ResetDS(void);
void CommSys_ResetBattleClient(void);
void sub_0203509C(u16 param0, u16 *param1, u16 param2);
void sub_020351F8(u16 param0, u16 *param1, u16 param2);
void sub_020351F8(u16 param0, u16 *buffer, u16 param2);
void sub_020352C0(u16 param0, u16 *param1, u16 param2);
void sub_02035664(void);
void sub_02035678(void);
void sub_0203568C(void);
void sub_0203572C(void);
void sub_02035938(u8 param0);
BOOL CommSys_SendDataHuge(int param0, const void *param1, int param2);
BOOL CommSys_SendData(int param0, const void *param1, int param2);
BOOL sub_02035A3C(int param0, const void *param1, int param2);
BOOL CommSys_SendDataServer(int param0, const void *param1, int param2);
BOOL sub_02035B48(int param0, const void *param1);
BOOL CommSys_SendDataHuge(int cmd, const void *data, int param2);
BOOL CommSys_SendData(int cmd, const void *data, int param2);
BOOL sub_02035A3C(int cmd, const void *data, int param2);
BOOL CommSys_SendDataServer(int cmd, const void *data, int param2);
BOOL sub_02035B48(int cmd, const void *data);
int CommSys_SendRingRemainingSize(void);
BOOL CommSys_IsPlayerConnected(u16 param0);
int CommSys_ConnectedCount(void);
Expand All @@ -39,14 +39,14 @@ u16 sub_02035E84(int param0);
void CommSys_EnableSendMovementData(void);
void CommSys_DisableSendMovementData(void);
BOOL CommSys_IsSendingMovementData(void);
BOOL CommSys_WriteToQueueServer(int param0, const void *param1, int param2);
BOOL CommSys_WriteToQueue(int param0, const void *param1, int param2);
void sub_02036008(int param0, int param1, void *param2, void *param3);
void sub_02036030(int param0, int param1, void *param2, void *param3);
void sub_02036058(int param0, int param1, void *param2, void *param3);
BOOL CommSys_WriteToQueueServer(int cmd, const void *data, int param2);
BOOL CommSys_WriteToQueue(int cmd, const void *data, int param2);
void sub_02036008(int unused0, int unused1, void *param2, void *unused3);
void sub_02036030(int unused0, int unused1, void *param2, void *unused3);
void sub_02036058(int unused0, int unused1, void *param2, void *unused3);
u16 CommSys_CurNetId(void);
BOOL CommSys_SendDataFixedSize(int param0, const void *param1);
BOOL Link_Message(int param0);
BOOL CommSys_SendDataFixedSize(int cmd, const void *data);
BOOL Link_Message(int cmd);
BOOL sub_020360E8(void);
BOOL CommSys_CheckError(void);
u16 sub_02036128(u16 param0);
Expand All @@ -63,7 +63,7 @@ BOOL sub_0203629C(void);
void CommSys_SetWifiConnected(BOOL param0);
BOOL CommSys_WifiConnected(void);
void sub_020362DC(int param0, int param1);
int sub_020362F4(int param0);
int sub_020362F4(int networkId);
BOOL sub_02036314(void);
void sub_0203632C(BOOL param0);
void sub_02036378(BOOL param0);
Expand Down
8 changes: 4 additions & 4 deletions include/field_comm_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ void FieldCommMan_ReconnectBattleClient(void);
void FieldCommMan_EnterBattleRoom(FieldSystem *fieldSystem);
void FieldCommMan_EndBattle(void);
void sub_020598A0(void);
void sub_02059D0C(int param0, int param1, void *param2, void *param3);
void sub_02059D0C(int unused0, int unused1, void *param2, void *unused3);
BOOL sub_02059D2C(void);
void sub_02059EAC(int param0, int param1, void *param2, void *param3);
u8 *sub_02059EBC(int param0, void *param1, int param2);
UnkStruct_02029894 *sub_0205A080(SaveData *param0);
void sub_02059EAC(int param0, int unused1, void *unused2, void *unused3);
u8 *sub_02059EBC(int param0, void *unused1, int unused2);
UnkStruct_02029894 *sub_0205A080(SaveData *saveData);
void sub_0205A0A0(void);
void sub_0205A0BC(void);

Expand Down
2 changes: 1 addition & 1 deletion include/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ u16 Item_FileID(u16 item, enum ItemFileType type);
* @param gbaID GBA-era item ID.
* @return ID of the item which corresponds to the given GBA-era ID.
*/
u16 Item_FromGBAID(u16 param0);
u16 Item_FromGBAID(u16 gbaID);

/**
* @brief Get the file index of the global NCER file used by all item icons.
Expand Down
4 changes: 1 addition & 3 deletions src/berry_patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ BerryGrowthData *BerryGrowthData_Init(enum HeapId heapID)
{
BerryGrowthData *growthData;
BerryData *berryData;
NARC *narc;

narc = BerryData_NARC_ctor(heapID);
NARC *narc = BerryData_NARC_ctor(heapID);
growthData = Heap_AllocFromHeap(heapID, sizeof(BerryGrowthData) * NUM_BERRIES);

for (int i = 0; i < NUM_BERRIES; i++) {
Expand Down
50 changes: 17 additions & 33 deletions src/bg_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -1840,13 +1840,12 @@ static void ClearWindowTilemapText(Window *window)
return;
}

u32 x, y, tilemapRight, tilemapBottom, idx, tilemapWidth;
u16 *tilemap;
u32 x, y, tilemapBottom, idx;
u32 tilemapWidth = sScreenSizeToTilemapWidth[window->bgConfig->bgs[window->bgLayer].screenSize];
u16 *tilemap = window->bgConfig->bgs[window->bgLayer].tilemapBuffer;
u32 tilemapRight = window->tilemapLeft + window->width;

tilemapWidth = sScreenSizeToTilemapWidth[window->bgConfig->bgs[window->bgLayer].screenSize];
tilemap = window->bgConfig->bgs[window->bgLayer].tilemapBuffer;
tilemapRight = window->tilemapLeft + window->width;
tilemapBottom = window->tilemapTop + window->height;
tilemapBottom = window->tilemapTop + window->height; // required this way to match

for (y = window->tilemapTop; y < tilemapBottom; y++) {
for (x = window->tilemapLeft; x < tilemapRight; x++) {
Expand All @@ -1862,11 +1861,8 @@ static void ClearWindowTilemapAffine(Window *window)
return;
}

int x, y, tilemapWidth;
u8 *tilemap;

tilemapWidth = sScreenSizeToTilemapWidth[window->bgConfig->bgs[window->bgLayer].screenSize];
tilemap = (u8 *)(window->bgConfig->bgs[window->bgLayer].tilemapBuffer) + window->tilemapTop * tilemapWidth + window->tilemapLeft;
int x, y, tilemapWidth = sScreenSizeToTilemapWidth[window->bgConfig->bgs[window->bgLayer].screenSize];
u8 *tilemap = (u8 *)(window->bgConfig->bgs[window->bgLayer].tilemapBuffer) + window->tilemapTop * tilemapWidth + window->tilemapLeft;

for (y = 0; y < window->height; y++) {
for (x = 0; x < window->width; x++) {
Expand Down Expand Up @@ -2118,15 +2114,11 @@ void Window_FillRectWithColor(Window *window, u8 color, u16 x, u16 y, u16 width,

void Window_CopyGlyph(Window *window, const u8 *glyphPixels, u16 srcWidth, u16 srcHeight, u16 destX, u16 destY, u16 table)
{
u8 *windowPixels;
u16 destWidth, destHeight;
u8 *windowPixels = window->pixels;
u16 destWidth = window->width * 8, destHeight = window->height * 8;
int srcRight, srcBottom;
u8 glyphSizeParam;

windowPixels = window->pixels;
destWidth = window->width * 8;
destHeight = window->height * 8;

if (destWidth - destX < srcWidth) {
srcRight = destWidth - destX;
} else {
Expand Down Expand Up @@ -2208,17 +2200,13 @@ void Window_Scroll(Window *window, u8 direction, u8 distance, u8 fillVal)

static void ScrollWindow4bpp(Window *window, u8 direction, u8 distance, u8 fillVal)
{
u8 *pixels;
u8 *pixels = window->pixels;
int y0, y1, y2;
int fill, size;
u32 width;
int fill = (fillVal << 24) | (fillVal << 16) | (fillVal << 8) | (fillVal << 0);
int size = window->height * window->width * TILE_SIZE_4BPP;
u32 width = window->width;
int i, j;

pixels = window->pixels;
fill = (fillVal << 24) | (fillVal << 16) | (fillVal << 8) | (fillVal << 0);
size = window->height * window->width * TILE_SIZE_4BPP;
width = window->width;

switch (direction) {
case SCROLL_DIRECTION_UP:
for (i = 0; i < size; i += TILE_SIZE_4BPP) {
Expand Down Expand Up @@ -2269,17 +2257,13 @@ static void ScrollWindow4bpp(Window *window, u8 direction, u8 distance, u8 fillV

static void ScrollWindow8bpp(Window *window, u8 direction, u8 distance, u8 fillVal)
{
u8 *pixels;
u8 *pixels = window->pixels;
int y0, y1, y2;
int fill, size;
u32 width;
int fill = (fillVal << 24) | (fillVal << 16) | (fillVal << 8) | fillVal;
int size = window->height * window->width * TILE_SIZE_8BPP;
u32 width = window->width;
int i, j;

pixels = window->pixels;
fill = (fillVal << 24) | (fillVal << 16) | (fillVal << 8) | fillVal;
size = window->height * window->width * TILE_SIZE_8BPP;
width = window->width;

switch (direction) {
case SCROLL_DIRECTION_UP:
for (i = 0; i < size; i += TILE_SIZE_8BPP) {
Expand Down
Loading
Loading