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

Document field_battle_data_transfer.c #293

Merged
merged 9 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ target: $(BUILD)/build.ninja
$(MESON) compile -C $(BUILD) $(MESON_TARGET)

format: $(BUILD)/build.ninja
$(MESON) compile -C $(BUILD) clang-format
$(NINJA) -C $(BUILD) clang-format

clean: $(BUILD)/build.ninja
$(MESON) compile -C $(BUILD) --clean
Expand Down
29 changes: 29 additions & 0 deletions consts/battle.json
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,35 @@
"TERRAIN_MAX"
]
},
"@BattleBackground": {
"type": "enum",
"values": [
"BACKGROUND_PLAIN",
"BACKGROUND_WATER",
"BACKGROUND_CITY",
"BACKGROUND_FOREST",
"BACKGROUND_MOUNTAIN",
"BACKGROUND_SNOW",
"BACKGROUND_INDOORS_1",
"BACKGROUND_INDOORS_2",
"BACKGROUND_INDOORS_3",
"BACKGROUND_CAVE_1",
"BACKGROUND_CAVE_2",
"BACKGROUND_CAVE_3",
"BACKGROUND_AARON",
"BACKGROUND_BERTHA",
"BACKGROUND_FLINT",
"BACKGROUND_LUCIAN",
"BACKGROUND_CYNTHIA",
"BACKGROUND_DISTORTION_WORLD",
"BACKGROUND_BATTLE_TOWER",
"BACKGROUND_BATTLE_FACTORY",
"BACKGROUND_BATTLE_ARCADE",
"BACKGROUND_BATTLE_CASTLE",
"BACKGROUND_BATTLE_HALL",
"BACKGROUND_MAX"
]
},
"@BattleAnimation": {
"type": "enum",
"values": [
Expand Down
61 changes: 31 additions & 30 deletions include/bag.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define POKEPLATINUM_BAG_H

#include "constants/heap.h"
#include "constants/items.h"

#include "savedata.h"

Expand Down Expand Up @@ -31,25 +32,25 @@ typedef struct Bag {
u32 registeredItem;
} Bag;

typedef struct {
u8 unk_00[8];
u8 unk_08[8];
u16 unk_10;
u16 unk_12;
} UnkStruct_0207D99C_sub1;
typedef struct FieldBagCursor {
u8 scroll[POCKET_MAX];
u8 index[POCKET_MAX];
u16 pocket;
u16 dummy12;
} FieldBagCursor;

typedef struct {
u8 unk_00[5];
u8 unk_05[5];
u16 unk_0A;
u16 unk_0C;
u16 unk_0E;
} UnkStruct_0207D99C_sub2;
typedef struct BattleBagCursor {
u8 scroll[BATTLE_ITEM_CATEGORY_MAX + 1];
u8 index[BATTLE_ITEM_CATEGORY_MAX + 1];
u16 lastUsedItemID;
u16 lastUsedCategory;
u16 currentCategory;
} BattleBagCursor;

typedef struct UnkStruct_0207D99C_t {
UnkStruct_0207D99C_sub1 unk_00;
UnkStruct_0207D99C_sub2 unk_14;
} UnkStruct_0207D99C;
typedef struct BagCursor {
FieldBagCursor field;
BattleBagCursor battle;
} BagCursor;

int Bag_SaveSize(void);
Bag *Bag_New(enum HeapId heapID);
Expand All @@ -70,18 +71,18 @@ void Pocket_Sort(BagItem *pocket, const u32 size); // Same as Pocket_SortEmpty,
void *sub_0207D824(Bag *bag, const u8 *pockets, enum HeapId heapID);
BagItem *Bag_GetItemSlot(Bag *bag, u16 pocketID, u16 slot);
Bag *SaveData_GetBag(SaveData *saveData);
UnkStruct_0207D99C *sub_0207D99C(u32 param0);
void sub_0207D9B4(UnkStruct_0207D99C *param0, u32 param1, u8 *param2, u8 *param3);
u16 sub_0207D9C4(UnkStruct_0207D99C *param0);
void sub_0207D9C8(UnkStruct_0207D99C *param0, u32 param1, u8 param2, u8 param3);
void sub_0207D9D4(UnkStruct_0207D99C *param0, u16 param1);
void sub_0207D9D8(UnkStruct_0207D99C *param0, u32 param1, u8 *param2, u8 *param3);
u16 sub_0207D9E4(UnkStruct_0207D99C *param0);
u16 sub_0207D9E8(UnkStruct_0207D99C *param0);
u16 sub_0207D9EC(UnkStruct_0207D99C *param0);
void sub_0207D9F0(UnkStruct_0207D99C *param0, u32 param1, u8 param2, u8 param3);
void sub_0207D9F8(UnkStruct_0207D99C *param0);
void Bag_SetLastItemUsed(UnkStruct_0207D99C *param0, u16 param1, u16 param2);
void sub_0207DA24(UnkStruct_0207D99C *param0, u16 param1);
BagCursor *BagCursor_New(u32 heapID);
void BagCursor_GetFieldPocketPosition(BagCursor *cursor, u32 pocket, u8 *outIndex, u8 *outScroll);
u16 BagCursor_GetFieldPocket(BagCursor *cursor);
void BagCursor_SetFieldPocketPosition(BagCursor *cursor, u32 pocket, u8 index, u8 scroll);
void BagCursor_SetFieldPocket(BagCursor *cursor, u16 pocket);
void BagCursor_GetBattleCategoryPosition(BagCursor *cursor, u32 category, u8 *outIndex, u8 *outScroll);
u16 BagCursor_GetLastUsedBattleItem(BagCursor *cursor);
u16 BagCursor_GetLastUsedBattleItemCategory(BagCursor *cursor);
u16 BagCursor_GetBattleCurrentCategory(BagCursor *cursor);
void BagCursor_SetBattleCategoryPosition(BagCursor *cursor, u32 category, u8 index, u8 scroll);
void BagCursor_ResetBattle(BagCursor *cursor);
void Bag_SetLastBattleItemUsed(BagCursor *cursor, u16 itemID, u16 category);
void BagCursor_SetBattleCurrentCategory(BagCursor *cursor, u16 category);

#endif // POKEPLATINUM_BAG_H
6 changes: 3 additions & 3 deletions include/battle/ov16_0223DF00.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
#include "battle/struct_ov16_02268520.h"
#include "battle/struct_ov16_02268A14_decl.h"
#include "battle/struct_ov16_0226D160_decl.h"
#include "overlay006/battle_params.h"
#include "overlay012/struct_ov12_0221FCDC_decl.h"

#include "bag.h"
#include "bg_window.h"
#include "field_battle_data_transfer.h"
#include "game_options.h"
#include "message.h"
#include "palette.h"
Expand Down Expand Up @@ -129,7 +129,7 @@ TrainerData *BattleSystem_TrainerData(BattleSystem *param0, int param1);
*/
TrainerInfo *BattleSystem_TrainerInfo(BattleSystem *battleSys, int battler);
Bag *BattleSystem_Bag(BattleSystem *param0);
UnkStruct_0207D99C *BattleSystem_BagCursor(BattleSystem *param0);
BagCursor *BattleSystem_BagCursor(BattleSystem *param0);
u32 ov16_0223E1B4(BattleSystem *param0, int param1);

/**
Expand Down Expand Up @@ -192,7 +192,7 @@ u32 BattleSystem_BattleStatus(BattleSystem *param0);
enum Time BattleSystem_Time(BattleSystem *battleSys);
int ov16_0223EC04(BattleSystem *param0);
u8 ov16_0223EC58(BattleSystem *param0, int param1, u8 param2);
u16 ov16_0223ECC4(BattleParams *param0, int *param1, int *param2);
u16 ov16_0223ECC4(FieldBattleDTO *param0, int *param1, int *param2);
u8 ov16_0223ED60(BattleSystem *param0);
u8 ov16_0223ED6C(BattleSystem *param0);
int BattleSystem_NumSafariBalls(BattleSystem *param0);
Expand Down
3 changes: 1 addition & 2 deletions include/battle/ov16_0226871C.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define POKEPLATINUM_OV16_0226871C_H

#include "struct_decls/battle_system.h"
#include "struct_defs/struct_0209C370.h"

#include "battle/struct_ov16_02268A14_decl.h"
#include "battle/struct_ov16_0226AC98.h"
Expand All @@ -12,7 +11,7 @@

void ov16_02268744(BgConfig *param0);
void ov16_022687A0(BgConfig *param0);
void *ov16_022687C8(NARC *param0, NARC *param1, BattleSystem *param2, int param3, UnkStruct_0209C370 *param4);
void *ov16_022687C8(NARC *param0, NARC *param1, BattleSystem *param2, int param3, u8 *param4);
void ov16_02268A14(UnkStruct_ov16_02268A14 *param0);
void ov16_02268A88(UnkStruct_ov16_02268A14 *param0);
void ov16_02268B8C(UnkStruct_ov16_02268A14 *param0);
Expand Down
2 changes: 1 addition & 1 deletion include/battle/struct_ov16_0224DDA8.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

typedef struct {
u16 item;
u8 pocket;
u8 category;
u8 target;
} BattleItemUse;

Expand Down
Loading
Loading