-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
228 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#ifndef POKEPLATINUM_BERRY_DATA_H | ||
#define POKEPLATINUM_BERRY_DATA_H | ||
|
||
#include "struct_decls/struct_02006C24_decl.h" | ||
#include "struct_decls/struct_02023790_decl.h" | ||
#include "struct_decls/struct_berry_data_decl.h" | ||
|
||
/* | ||
* Constructs a new NARC which contains an open FSFile to the berry data archive. | ||
* | ||
* @param heapID: ID of the heap to alloc from | ||
* | ||
* @returns: Pointer to the newly-allocated NARC | ||
*/ | ||
NARC * BerryData_NARC_ctor(u32 heapID); | ||
|
||
BerryData * sub_020973A8(NARC * param0, u32 param1, u32 param2); | ||
|
||
/* | ||
* Closes the wrapped FSFile and returns the NARC allocation to the heap from whence it came. | ||
* | ||
* @param narc: Pointer to the NARC | ||
*/ | ||
void BerryData_NARC_dtor(NARC * narc); | ||
|
||
/* | ||
* Creates a new buffer large enough to hold the data of the specified | ||
* NARC member in 'nuts_data.narc', then reads the data. | ||
* | ||
* @param index: Index of the NARC member within 'nuts_data.narc' which contains the berry's data | ||
* @param heapID: ID of the heap to alloc from | ||
* | ||
* @returns: Pointer to the allocated buffer which contains the data that was read. | ||
*/ | ||
BerryData * BerryData_LoadDataByNarcMemberIndex(u32 index, u32 heapID); | ||
|
||
/* | ||
* Creates a new buffer large enough to hold the data of the | ||
* specified berry, then reads the data from nuts_data.narc | ||
* | ||
* @param itemID: Item ID of the berry for which to read the data | ||
* @param heapID: ID of the heap to alloc from | ||
* | ||
* @returns: Pointer to the allocated buffer which contains the data that was read. | ||
*/ | ||
BerryData * BerryData_LoadDataByItemID(u32 itemID, u32 heapID); | ||
|
||
/* | ||
* Retrieves the value of the specified attribute from a BerryData buffer | ||
* | ||
* @param berryData: Pointer to the buffer holding the berry data | ||
* @param attributeID: ID of the attribute to retrieve the value for | ||
* | ||
* @returns: The value of the specified attribute | ||
*/ | ||
u32 BerryData_GetAttribute(BerryData * berryData, u32 attributeID); | ||
|
||
/* | ||
* Creates a new string buffer large enough to hold the | ||
* name of the specified berry, then reads the string. | ||
* | ||
* @param index: Index of the NARC member within 'nuts_data.narc' which contains the berry's data | ||
* @param heapID: ID of the heap to alloc from | ||
* | ||
* @returns: Pointer to the allocated buffer which contains the string that was read. | ||
*/ | ||
Strbuf* BerryData_AllocAndGetName(u16 index, u32 heapID); | ||
|
||
/* | ||
* Creates a new string buffer large enough to hold the | ||
* description of the specified berry, then reads the string. | ||
* | ||
* @param index: Index of the NARC member within 'nuts_data.narc' which contains the berry's data | ||
* @param heapID: ID of the heap to alloc from | ||
* | ||
* @returns: Pointer to the allocated buffer which contains the string that was read. | ||
*/ | ||
Strbuf* BerryData_AllocAndGetDescription(u16 index, u16 heapID); | ||
|
||
#endif // POKEPLATINUM_BERRY_DATA_H |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef POKEPLATINUM_STRUCT_BERRY_DATA_DECL_H | ||
#define POKEPLATINUM_STRUCT_BERRY_DATA_DECL_H | ||
|
||
typedef struct BerryData BerryData; | ||
|
||
#endif // POKEPLATINUM_STRUCT_BERRY_DATA_DECL_H |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#include <nitro.h> | ||
#include <string.h> | ||
|
||
#include "struct_decls/struct_02006C24_decl.h" | ||
#include "struct_decls/struct_0200B144_decl.h" | ||
#include "struct_decls/struct_02023790_decl.h" | ||
|
||
#include "narc.h" | ||
#include "unk_0200AC5C.h" | ||
#include "berry_data.h" | ||
|
||
typedef struct BerryData { | ||
u16 size; | ||
u8 firmness; | ||
u8 yieldCategory; | ||
u8 stageDuration; | ||
u8 moistureDrainRate; | ||
u8 spiciness; | ||
u8 dryness; | ||
u8 sweetness; | ||
u8 bitterness; | ||
u8 sourness; | ||
u8 smoothness; | ||
} BerryData; | ||
|
||
NARC * BerryData_NARC_ctor (u32 heapID) | ||
{ | ||
return NARC_ctor(68, heapID); | ||
} | ||
|
||
BerryData * sub_020973A8 (NARC * param0, u32 param1, u32 param2) | ||
{ | ||
return NARC_AllocAndReadWholeMember(param0, 0 + param1, param2); | ||
} | ||
|
||
void BerryData_NARC_dtor (NARC * narc) | ||
{ | ||
NARC_dtor(narc); | ||
} | ||
|
||
BerryData * BerryData_LoadDataByNarcMemberIndex (u32 index, u32 heapID) | ||
{ | ||
return NARC_AllocAndReadWholeMemberByIndexPair(68, 0 + index, heapID); | ||
} | ||
|
||
BerryData * BerryData_LoadDataByItemID (u32 itemID, u32 heapID) | ||
{ | ||
return BerryData_LoadDataByNarcMemberIndex(itemID - 149, heapID); | ||
} | ||
|
||
u32 BerryData_GetAttribute (BerryData * berryData, u32 attributeID) | ||
{ | ||
switch (attributeID) { | ||
case 0: | ||
return berryData->size; | ||
case 1: | ||
return berryData->firmness; | ||
case 2: | ||
return berryData->yieldCategory; | ||
case 3: | ||
return berryData->stageDuration; | ||
case 4: | ||
return berryData->moistureDrainRate; | ||
case 5: | ||
return berryData->spiciness; | ||
case 6: | ||
return berryData->dryness; | ||
case 7: | ||
return berryData->sweetness; | ||
case 8: | ||
return berryData->bitterness; | ||
case 9: | ||
return berryData->sourness; | ||
case 10: | ||
return berryData->smoothness; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
Strbuf* BerryData_AllocAndGetName (u16 berryID, u32 heapID) | ||
{ | ||
UnkStruct_0200B144 * v0; | ||
Strbuf* v1; | ||
|
||
v0 = sub_0200B144(1, 26, 424, heapID); | ||
v1 = sub_0200B1EC(v0, berryID); | ||
|
||
sub_0200B190(v0); | ||
return v1; | ||
} | ||
|
||
Strbuf* BerryData_AllocAndGetDescription (u16 berryID, u16 heapID) | ||
{ | ||
UnkStruct_0200B144 * v0; | ||
Strbuf* v1; | ||
|
||
v0 = sub_0200B144(1, 26, 423, heapID); | ||
v1 = sub_0200B1EC(v0, berryID); | ||
|
||
sub_0200B190(v0); | ||
return v1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.