Skip to content

Commit

Permalink
document poffin.c and poffin case struct
Browse files Browse the repository at this point in the history
  • Loading branch information
fakuzatsu committed Jan 17, 2025
1 parent 9299eb7 commit 0bba4d7
Show file tree
Hide file tree
Showing 19 changed files with 148 additions and 138 deletions.
4 changes: 2 additions & 2 deletions include/overlay082/struct_ov82_0223B164.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_STRUCT_OV82_0223B164_H
#define POKEPLATINUM_STRUCT_OV82_0223B164_H

#include "struct_decls/struct_0202AB28_decl.h"
#include "struct_decls/poffin_case_decl.h"

#include "bag.h"
#include "game_options.h"
Expand All @@ -12,7 +12,7 @@
typedef struct {
u8 padding_00[4];
int unk_04;
UnkStruct_0202AB28 *unk_08;
PoffinCase *unk_08;
SaveData *unk_0C;
TrainerInfo *unk_10;
Bag *unk_14;
Expand Down
2 changes: 1 addition & 1 deletion include/overlay083/ov83_0223F7F4.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_OV83_0223F7F4_H
#define POKEPLATINUM_OV83_0223F7F4_H

#include "struct_defs/struct_0202A93C.h"
#include "struct_defs/poffin.h"

#include "overlay083/struct_ov83_0223F820.h"
#include "overlay083/struct_ov83_0223F88C.h"
Expand Down
2 changes: 1 addition & 1 deletion include/overlay083/struct_ov83_0223FE50.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_STRUCT_OV83_0223FE50_H
#define POKEPLATINUM_STRUCT_OV83_0223FE50_H

#include "struct_defs/struct_0202A93C.h"
#include "struct_defs/poffin.h"

#include "overlay083/struct_ov83_0223D2E8.h"
#include "overlay083/struct_ov83_0223DB4C.h"
Expand Down
29 changes: 16 additions & 13 deletions include/poffin.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#ifndef POKEPLATINUM_POFFIN_H
#define POKEPLATINUM_POFFIN_H

#include "struct_decls/struct_0202AB28_decl.h"
#include "struct_defs/struct_0202A93C.h"
#include "struct_decls/poffin_case_decl.h"
#include "struct_defs/poffin.h"

#include "savedata.h"

#define POFFIN_NONE 0xFFFF
#define MAX_POFFINS 100

typedef enum {
POFFIN_ATTRIBUTEID_FLAVOR,
POFFIN_ATTRIBUTEID_SPICINESS,
Expand All @@ -18,24 +21,24 @@ typedef enum {
} PoffinAttributeID;

int Poffin_sizeof(void);
BOOL sub_0202A914(Poffin *poffin);
BOOL Poffin_HasValidFlavor(Poffin *poffin);
void Poffin_clear(Poffin *poffin);
Poffin *Poffin_malloc(int heapID);
void Poffin_copy(Poffin *src, Poffin *dest);
u8 Poffin_GetAttribute(Poffin *poffin, PoffinAttributeID attributeID);
int sub_0202A9E4(Poffin *poffin, u8 *param1, u8 param2, BOOL isFoul);
void Poffin_StoreAttributesToArray(Poffin *poffin, u8 *dest);
u8 Poffin_CalcLevel(Poffin *poffin);
UnkStruct_0202AB28 *Poffin_GetSavedataBlock(SaveData *savedata);
PoffinCase *Poffin_GetSavedataBlock(SaveData *savedata);
int Poffin_SaveSize(void);
void Poffin_Init(UnkStruct_0202AB28 *param0);
u16 sub_0202AB54(UnkStruct_0202AB28 *param0);
u16 sub_0202AB74(UnkStruct_0202AB28 *param0, Poffin *param1);
BOOL sub_0202AB98(UnkStruct_0202AB28 *param0, u16 param1);
void sub_0202ABD4(UnkStruct_0202AB28 *param0);
void sub_0202AC54(UnkStruct_0202AB28 *param0, u16 param1, Poffin *param2);
Poffin *sub_0202AC70(UnkStruct_0202AB28 *param0, u16 param1, int param2);
u16 sub_0202AC98(UnkStruct_0202AB28 *param0);
u16 sub_0202ACC0(UnkStruct_0202AB28 *param0);
void Poffin_Init(PoffinCase *poffinCase);
u16 Poffin_GetEmptyCaseSlot(PoffinCase *poffinCase);
u16 Poffin_AddToCase(PoffinCase *poffinCase, Poffin *poffin);
BOOL Poffin_ClearCaseSlot(PoffinCase *poffinCase, u16 slot);
void Poffin_CompactCase(PoffinCase *poffinCase);
void Poffin_CopyToCaseSlot(PoffinCase *poffinCase, u16 destSlot, Poffin *poffin);
Poffin *Poffin_AllocateForCaseSlot(PoffinCase *poffinCase, u16 destSlot, int heapID);
u16 Poffin_GetNumberOfFilledSlots(PoffinCase *poffinCase);
u16 Poffin_GetNumberOfEmptySlots(PoffinCase *poffinCase);

#endif // POKEPLATINUM_POFFIN_H
6 changes: 6 additions & 0 deletions include/struct_decls/poffin_case_decl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef POKEPLATINUM_POFFIN_CASE_DECL_H
#define POKEPLATINUM_POFFIN_CASE_DECL_H

typedef struct PoffinCase PoffinCase;

#endif // POKEPLATINUM_POFFIN_CASE_DECL_H
6 changes: 0 additions & 6 deletions include/struct_decls/struct_0202AB28_decl.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef POKEPLATINUM_STRUCT_0202A93C_H
#define POKEPLATINUM_STRUCT_0202A93C_H
#ifndef POKEPLATINUM_STRUCT_POFFIN_H
#define POKEPLATINUM_STRUCT_POFFIN_H

typedef struct {
union {
Expand All @@ -17,4 +17,4 @@ typedef struct {
};
} Poffin;

#endif // POKEPLATINUM_STRUCT_0202A93C_H
#endif // POKEPLATINUM_STRUCT_POFFIN_H
10 changes: 10 additions & 0 deletions include/struct_defs/poffin_case.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef POKEPLATINUM_STRUCT_POFFIN_CASE_H
#define POKEPLATINUM_STRUCT_POFFIN_CASE_H

#include "poffin.h"

typedef struct PoffinCase {
Poffin slot[MAX_POFFINS];
} PoffinCase;

#endif // POKEPLATINUM_STRUCT_POFFIN_CASE_H
10 changes: 0 additions & 10 deletions include/struct_defs/struct_0202AB28.h

This file was deleted.

4 changes: 2 additions & 2 deletions include/struct_defs/struct_0203D9B8.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_STRUCT_0203D9B8_H
#define POKEPLATINUM_STRUCT_0203D9B8_H

#include "struct_decls/struct_0202AB28_decl.h"
#include "struct_decls/poffin_case_decl.h"
#include "struct_decls/struct_party_decl.h"
#include "struct_defs/struct_020989DC.h"

Expand All @@ -16,7 +16,7 @@ typedef struct {
u8 unk_03;
u16 unk_04;
u16 unk_06;
UnkStruct_0202AB28 *unk_08;
PoffinCase *unk_08;
TrainerInfo *unk_0C;
Party *unk_10;
Bag *unk_14;
Expand Down
2 changes: 1 addition & 1 deletion include/struct_defs/struct_02098DE8.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_STRUCT_02098DE8_H
#define POKEPLATINUM_STRUCT_02098DE8_H

#include "struct_defs/struct_0202A93C.h"
#include "struct_defs/poffin.h"

#include "pokemon.h"

Expand Down
2 changes: 1 addition & 1 deletion include/unk_020989DC.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_UNK_020989DC_H
#define POKEPLATINUM_UNK_020989DC_H

#include "struct_defs/struct_0202A93C.h"
#include "struct_defs/poffin.h"
#include "struct_defs/struct_0203D9B8.h"

#include "enums.h"
Expand Down
2 changes: 1 addition & 1 deletion src/overlay065/ov65_0222DCE0.c
Original file line number Diff line number Diff line change
Expand Up @@ -3797,7 +3797,7 @@ static u32 ov65_022319B8 (UnkStruct_ov65_0222EBE0 * param0)
return 3;
}

if (sub_0202AC98(Poffin_GetSavedataBlock(param0->unk_160)) >= 100) {
if (Poffin_GetNumberOfFilledSlots(Poffin_GetSavedataBlock(param0->unk_160)) >= MAX_POFFINS) {
return 2;
}

Expand Down
8 changes: 4 additions & 4 deletions src/overlay083/ov83_0223B5A0.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "struct_decls/struct_0202440C_decl.h"
#include "struct_decls/struct_0202B370_decl.h"
#include "struct_defs/struct_0202A93C.h"
#include "struct_defs/poffin.h"

#include "overlay004/ov4_021D0D80.h"
#include "overlay083/ov83_0223C958.h"
Expand Down Expand Up @@ -713,7 +713,7 @@ static int ov83_0223BF74(UnkStruct_ov83_0223C344 *param0, UnkStruct_ov83_0223B78

if ((v0 == 1) || (v0 == 2)) {
if (v0 == 1) {
if (sub_0202AC98(param0->unk_10->unk_08) >= 100) {
if (Poffin_GetNumberOfFilledSlots(param0->unk_10->unk_08) >= MAX_POFFINS) {
ov83_0223EC8C(&param1->unk_6A0, 2);
(*param2) = 10;
param1->unk_1C = (30 * 5);
Expand Down Expand Up @@ -1092,9 +1092,9 @@ static BOOL ov83_0223C8B0(UnkStruct_ov83_0223C344 *param0, Poffin *param1, int p
TVBroadcast *v4 = SaveData_TVBroadcast(param0->unk_10->unk_0C);

for (v0 = 0; v0 < param2; v0++) {
v1 = sub_0202AB74(param0->unk_10->unk_08, param1);
v1 = Poffin_AddToCase(param0->unk_10->unk_08, param1);

if (v1 == 0xFFFF) {
if (v1 == POFFIN_NONE) {
v3 = 0;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/overlay083/ov83_0223F7F4.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <nitro.h>
#include <string.h>

#include "struct_defs/struct_0202A93C.h"
#include "struct_defs/poffin.h"

#include "overlay083/struct_ov83_0223DB4C_sub1.h"
#include "overlay083/struct_ov83_0223F820.h"
Expand Down
2 changes: 1 addition & 1 deletion src/overlay084/ov84_0223F040.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ void ov84_02240328(UnkStruct_ov84_0223B5A0 *param0)
Strbuf_Free(v1);

v1 = MessageLoader_GetNewStrbuf(param0->unk_114, 109);
StringTemplate_SetNumber(param0->unk_118, 0, sub_0202AC98(Poffin_GetSavedataBlock(param0->unk_C4->unk_00)), 3, 1, 1);
StringTemplate_SetNumber(param0->unk_118, 0, Poffin_GetNumberOfFilledSlots(Poffin_GetSavedataBlock(param0->unk_C4->unk_00)), 3, 1, 1);
StringTemplate_Format(param0->unk_118, param0->unk_3F8, v1);
Strbuf_Free(v1);

Expand Down
Loading

0 comments on commit 0bba4d7

Please sign in to comment.