-
Notifications
You must be signed in to change notification settings - Fork 125
Document box user input handling #533
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
Conversation
8504d9b
to
a9c14f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly looks good, just some little quibbles for polish and consistency.
include/overlay019/struct_box_menu.h
Outdated
BOX_MENU_HEART, | ||
BOX_MENU_STAR, | ||
BOX_MENU_DIAMOND | ||
} BoxMenuItem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: We don't typedef enum
in this project.
include/overlay019/struct_box_menu.h
Outdated
|
||
#define MAX_MENU_ITEMS 8 | ||
|
||
typedef struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Tag the struct
with the same name as its typedef
.
u8 unk_02[2]; | ||
BOOL compareButtonAnimationPressed; | ||
PCCompareMon compareMons[2]; | ||
} UnkStruct_ov19_021D4EE4; | ||
} UnkStruct_ov19_021D4EE4; // BoxCompareMode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Feel free to name the struct if it feels apt.
@@ -8,7 +8,7 @@ | |||
typedef struct { | |||
SaveData *saveData; | |||
enum BoxMode boxMode; | |||
BOOL unk_08; | |||
BOOL RecordBoxUseInJournal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish: camelCase
src/overlay019/box_menu.c
Outdated
|
||
void BoxMenu_FillYesNo(UnkStruct_ov19_021D4DF0 *param0, u32 menuItemIndex) | ||
{ | ||
BoxMenu *menu = &(param0->boxMenu); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish: Unnecessary parens.
src/overlay019/box_menu.c
Outdated
|
||
BoxMenu_AddMenuItem(menu, BOX_MENU_SUMMARY); | ||
|
||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish: Unnecessary scope block.
src/overlay019/box_menu.c
Outdated
static const u16 v0[][4] = { | ||
{ BOX_MENU_FOREST, BOX_MENU_CITY, BOX_MENU_DESERT, BOX_MENU_SAVANNA }, | ||
{ BOX_MENU_CRAG, BOX_MENU_VOLCANO, BOX_MENU_SNOW, BOX_MENU_CAVE }, | ||
{ BOX_MENU_BEACH, BOX_MENU_SEAFLOOR, BOX_MENU_RIVER, BOX_MENU_SKY }, | ||
{ BOX_MENU_POKECENTER, BOX_MENU_MACHINE, BOX_MENU_CHECKS, BOX_MENU_SIMPLE }, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
static const u16 v0[][4] = { | |
{ BOX_MENU_FOREST, BOX_MENU_CITY, BOX_MENU_DESERT, BOX_MENU_SAVANNA }, | |
{ BOX_MENU_CRAG, BOX_MENU_VOLCANO, BOX_MENU_SNOW, BOX_MENU_CAVE }, | |
{ BOX_MENU_BEACH, BOX_MENU_SEAFLOOR, BOX_MENU_RIVER, BOX_MENU_SKY }, | |
{ BOX_MENU_POKECENTER, BOX_MENU_MACHINE, BOX_MENU_CHECKS, BOX_MENU_SIMPLE }, | |
}; | |
static const u16 sWallpaperPages[][4] = { | |
{ BOX_MENU_FOREST, BOX_MENU_CITY, BOX_MENU_DESERT, BOX_MENU_SAVANNA }, | |
{ BOX_MENU_CRAG, BOX_MENU_VOLCANO, BOX_MENU_SNOW, BOX_MENU_CAVE }, | |
{ BOX_MENU_BEACH, BOX_MENU_SEAFLOOR, BOX_MENU_RIVER, BOX_MENU_SKY }, | |
{ BOX_MENU_POKECENTER, BOX_MENU_MACHINE, BOX_MENU_CHECKS, BOX_MENU_SIMPLE }, | |
}; |
I also see a few raw 4
s here that seem to be related to the number of items on a given page, so I think that's worth a shared constant.
a9c14f9
to
f97880a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some additional preliminary feedback.
include/overlay019/struct_box_menu.h
Outdated
@@ -0,0 +1,91 @@ | |||
#ifndef POKEPLATINUM_STRUCT_OV19_021DF964_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish: Update include guards on documented files.
include/overlay019/ov19_021D61B0.h
Outdated
void ov19_021D6594(UnkStruct_ov19_021D61B0 *param0, u32 param1); | ||
BOOL ov19_021D6600(UnkStruct_ov19_021D61B0 *param0, u32 param1); | ||
BOOL ov19_021D6628(UnkStruct_ov19_021D61B0 *param0); | ||
enum BoxFunctions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Do all of these relate to graphics?
I also wouldn't mind these just being the function name prefixed with a tight abbreviation like FN
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't confirmed in-depth every one of these functions, but I think it's safe to say that yes, these are probably all going to be box graphics functions.
src/overlay019/ov19_021D0D80.c
Outdated
void (*boxApplicationAction)(struct UnkStruct_ov19_021D5DF8_t *param0, u32 *param1); | ||
u32 cursorLocationHandlerState; | ||
u32 boxApplicationActionState; | ||
enum BoxMenuItem menuItem; // This stops being a BoxMenuItem in ov19_ReleaseMon, where it does something completely different and unrelated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Given the comment here, maybe it's best to use an anonymous union
for this field.
union {
enum BoxMenuItem menuItem;
int unk_1B8;
};
Then, you can replace the uses in ov19_ReleaseMon
, which makes it apparent that the usage is unknown.
src/overlay019/ov19_021D61B0.c
Outdated
u32 unk_04; | ||
} v0[] = { | ||
} functions[] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
- Pull this
static
table into module-level scope and prefix the name withs
(e.g.,sBoxTaskHandlers
). - Use array-initializers so that the association with the parent
enum
is clear at-a-glance.
c5157d8
to
567d82c
Compare
Declaring this ready for review now. I have cut out the non-trivial compare mode user input handling and touch screen user input handling, because properly documenting those would have involved more scope creep than I was prepared to deal with in the current PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; one polish-comment below. 😁
Rename bopx actions to have -Action suffix to avoid duplicate function names
Reorganize state machine enums
5d22645
to
abba461
Compare
Initial box user input handling documentation
Document UnkEnum_021DFB94 as BoxMenuItem
Document ov19_021DF964 as box_menu
Document release mon state machine