Skip to content

Commit fe12f2f

Browse files
committed
Document and cleanup some decoration code
1 parent 6a14cd4 commit fe12f2f

12 files changed

+1015
-1075
lines changed
File renamed without changes.

include/decoration.h

+36-38
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
#ifndef GUARD_DECORATION_H
22
#define GUARD_DECORATION_H
33

4-
enum DecorPerm {
4+
enum DecorationPermission
5+
{
56
/*
67
* The nomenclature here describes collision and placement permissions, in that order.
78
*/
89
DECORPERM_SOLID_FLOOR,
910
DECORPERM_PASS_FLOOR,
1011
DECORPERM_BEHIND_FLOOR,
1112
DECORPERM_NA_WALL,
12-
DECORPERM_SPRITE
13+
DECORPERM_SPRITE,
1314
};
1415

15-
enum DecorShape {
16-
/*
17-
* Width-x-height
18-
*/
16+
enum DecorationShape
17+
{
1918
DECORSHAPE_1x1,
2019
DECORSHAPE_2x1,
2120
DECORSHAPE_3x1, // unused
@@ -25,53 +24,52 @@ enum DecorShape {
2524
DECORSHAPE_1x3, // unused
2625
DECORSHAPE_2x4,
2726
DECORSHAPE_3x3,
28-
DECORSHAPE_3x2
27+
DECORSHAPE_3x2,
2928
};
3029

31-
enum DecorCat {
32-
/*
33-
* In which category you can find the decoration in the PC.
34-
*/
35-
/*0*/ DECORCAT_DESK,
36-
/*1*/ DECORCAT_CHAIR,
37-
/*2*/ DECORCAT_PLANT,
38-
/*3*/ DECORCAT_ORNAMENT,
39-
/*4*/ DECORCAT_MAT,
40-
/*5*/ DECORCAT_POSTER,
41-
/*6*/ DECORCAT_DOLL,
42-
/*7*/ DECORCAT_CUSHION
30+
enum DecorationCategory
31+
{
32+
DECORCAT_DESK,
33+
DECORCAT_CHAIR,
34+
DECORCAT_PLANT,
35+
DECORCAT_ORNAMENT,
36+
DECORCAT_MAT,
37+
DECORCAT_POSTER,
38+
DECORCAT_DOLL,
39+
DECORCAT_CUSHION,
40+
DECORCAT_COUNT,
4341
};
4442

4543
struct Decoration
4644
{
47-
/*0x00*/ u8 id;
48-
/*0x01*/ u8 name[16];
49-
/*0x11*/ u8 permission;
50-
/*0x12*/ u8 shape;
51-
/*0x13*/ u8 category;
52-
/*0x14*/ u16 price;
53-
/*0x18*/ const u8 *description;
54-
/*0x1c*/ const u16 *tiles;
45+
u8 id;
46+
u8 name[16];
47+
u8 permission;
48+
u8 shape;
49+
u8 category;
50+
u16 price;
51+
const u8 *description;
52+
const u16 *tiles;
5553
};
5654

57-
struct DecorPCPointers
55+
struct DecorationPCContext
5856
{
59-
/* 0x00 */ u8 *items;
60-
/* 0x04 */ u8 *pos;
61-
/* 0x08 */ u8 size;
62-
/* 0x09 */ u8 isPlayerRoom;
57+
u8 *items;
58+
u8 *pos;
59+
u8 size;
60+
u8 isPlayerRoom;
6361
};
6462

6563
extern const struct Decoration gDecorations[];
66-
extern EWRAM_DATA u8 *gCurDecorInventoryItems;
64+
extern EWRAM_DATA u8 *gCurDecorationItems;
6765
extern EWRAM_DATA u8 gCurDecorationIndex;
6866

69-
void sub_8126968(void);
70-
void sub_8126AD8(u8 taskId);
67+
void InitDecorationContextItems(void);
68+
void DoSecretBaseDecorationMenu(u8 taskId);
7169
void ShowDecorationOnMap(u16 mapX, u16 mapY, u16 decor);
72-
void sub_8126B2C(u8 taskId);
73-
void sub_8127208(u8 taskId);
74-
void sub_8127250(u8 *dest, u8 decorCat);
70+
void DoPlayerRoomDecorationMenu(u8 taskId);
71+
void ShowDecorationCategoriesWindow(u8 taskId);
72+
void CopyDecorationCategoryName(u8 *dest, u8 decorCat);
7573
bool8 IsSelectedDecorInThePC(void);
7674
u8 AddDecorationIconObject(u8 decor, s16 x, s16 y, u8 priority, u16 tilesTag, u16 paletteTag);
7775

include/decoration_inventory.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ extern struct DecorationInventory gDecorationInventories[];
1111

1212
void SetDecorationInventoriesPointers(void);
1313
void ClearDecorationInventories(void);
14-
s8 GetFirstEmptyDecorSlot(u8 idx);
14+
s8 GetFirstEmptyDecorSlot(u8 category);
1515
u8 CheckHasDecoration(u8);
1616
u8 DecorationAdd(u8);
1717
u8 DecorationCheckSpace(u8);
1818
s8 DecorationRemove(u8);
19-
void CondenseDecorationCategoryN(u8);
20-
u8 CountDecorationCategoryN(u8 idx);
21-
u8 CountDecorations(void);
19+
void CondenseDecorationsInCategory(u8 category);
20+
u8 GetNumOwnedDecorationsInCategory(u8 category);
21+
u8 GetNumOwnedDecorations(void);
2222

2323
#endif // GUARD_DECORATION_INVENTORY_H

include/gba/types.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ struct OamData
107107
#define SPRITE_SIZE_16x32 ((ST_OAM_SIZE_2 << 2) | (ST_OAM_V_RECTANGLE))
108108
#define SPRITE_SIZE_32x64 ((ST_OAM_SIZE_3 << 2) | (ST_OAM_V_RECTANGLE))
109109

110-
#define SPRITE_SIZE(dim) (SPRITE_SIZE_##dim >> 2)
111-
#define SPRITE_SHAPE(dim) (SPRITE_SIZE_##dim & 0xFF)
110+
#define SPRITE_SIZE(dim) ((SPRITE_SIZE_##dim >> 2) & 0x03)
111+
#define SPRITE_SHAPE(dim) (SPRITE_SIZE_##dim & 0x03)
112112

113113
struct BgAffineSrcData
114114
{

include/menu_helpers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ bool8 itemid_80BF6D8_mail_related(u16 itemId);
3030
bool8 sub_81221AC(void);
3131
bool8 sub_81221EC(void);
3232
void sub_812220C(struct ItemSlot *slots, u8 count, u8 *arg2, u8 *usedSlotsCount, u8 maxUsedSlotsCount);
33-
void sub_812225C(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3);
33+
void sub_812225C(u16 *scrollOffset, u16 *cursorPos, u8 maxShownItems, u8 numItems);
3434
void sub_8122298(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3, u8 arg4);
3535
void LoadListMenuArrowsGfx(void);
3636
void sub_8122344(u8 *spriteIds, u8 count);

include/trader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#define GUARD_TRADER_H
77

88
void sub_8133DA0(u8 taskId);
9-
void sub_8133E1C(u8 taskId);
9+
void ExitTraderMenu(u8 taskId);
1010
void TraderSetup(void);
1111
void Trader_ResetFlag(void);
1212

0 commit comments

Comments
 (0)