Document bag_cursor.h

This commit is contained in:
PikalaxALT 2021-11-09 08:45:24 -05:00
parent a3cca46e03
commit 66af980452
5 changed files with 149 additions and 19 deletions

View File

@ -3806,7 +3806,7 @@ _0221DBF0:
bl ov12_0223AA84
add r1, r4, #0
add r2, r6, #0
bl BagCursor_SetLastUsedItem
bl BagCursor_Battle_SetLastUsedItem
pop {r3, r4, r5, r6, r7, pc}
thumb_func_end ov08_0221DBCC
@ -14436,7 +14436,7 @@ ov08_02223390: ; 0x02223390
bl ov12_0223AA84
add r1, r5, #0
add r2, r7, #0
bl BagCursor_SetLastUsedItem
bl BagCursor_Battle_SetLastUsedItem
pop {r3, r4, r5, r6, r7, pc}
thumb_func_end ov08_02223390

View File

@ -39380,7 +39380,7 @@ _0224ABC8:
bl ov12_0223AA84
ldrh r1, [r6]
ldrb r2, [r6, #2]
bl BagCursor_SetLastUsedItem
bl BagCursor_Battle_SetLastUsedItem
_0224AC02:
ldrh r1, [r6]
mov r0, #0x4a

View File

@ -29134,7 +29134,7 @@
.public BagCursor_Battle_GetPocket
.public BagCursor_Battle_PocketSetPosition
.public BagCursor_Battle_Init
.public BagCursor_SetLastUsedItem
.public BagCursor_Battle_SetLastUsedItem
.public BagCursor_Battle_SetPocket
.public sub_02078B58
.public sub_02078B78

View File

@ -5,21 +5,21 @@
* Remembers the cursor position in the field bag view
*/
typedef struct BAG_CURSOR_FIELD {
u8 scroll[8];
u8 position[8];
u16 pocket;
u16 padding;
u8 scroll[8]; // How many items are off-screen above
u8 position[8]; // Cursor position within the screen
u16 pocket; // Which pocket was last viewed
u16 padding; // Silence warnings
} BAG_CURSOR_FIELD;
/*
* Remembers the cursor position in the battle bag view
*/
typedef struct BAG_CURSOR_BATTLE {
u8 scroll[5];
u8 position[5];
u16 lastUsedItem;
u16 lastUsedPocket;
u16 pocket;
u8 scroll[5]; // How many items are off-screen above
u8 position[5]; // Cursor position within the screen
u16 lastUsedItem; // ID of last used item
u16 lastUsedPocket; // ID of pocket containing last used item
u16 pocket; // Which pocket was last viewed
} BAG_CURSOR_BATTLE;
/*
@ -30,18 +30,148 @@ typedef struct BAG_CURSOR {
BAG_CURSOR_BATTLE battle;
} BAG_CURSOR;
/*
* BAG_CURSOR *BagCursor_new(u32 heap_id)
*
* Allocates a new BAG_CURSOR
*
* @param heap_id: Heap to allocate from
*
* @returns: Pointer to newly-allocated BAG_CURSOR
*/
BAG_CURSOR *BagCursor_new(u32 heap_id);
/*
* void BagCursor_Field_PocketGetPosition(BAG_CURSOR *cursor, int pocket, u8 *position_p, u8 *scroll_p)
*
* Gets the cursor position for the indicated pocket in the field.
*
* @param cursor: Pointer to BAG_CURSOR
* @param pocket: Which pocket to inspect
* @param position_p: Where the cursor position is returned
* @param scroll_p: Where the screen scroll is returned
*/
void BagCursor_Field_PocketGetPosition(BAG_CURSOR *cursor, int pocket, u8 *position_p, u8 *scroll_p);
/*
* u16 BagCursor_Field_GetPocket(BAG_CURSOR *cursor)
*
* Gets the last viewed pocket in the field
*
* @param cursor: Pointer to BAG_CURSOR
*
* @returns: ID of last viewed pocket
*/
u16 BagCursor_Field_GetPocket(BAG_CURSOR *cursor);
/*
* void BagCursor_Field_PocketSetPosition(BAG_CURSOR *cursor, int pocket, u8 position, u8 scroll)
*
* Sets the cursor position for the indicated pocket in the field.
*
* @param cursor: Pointer to BAG_CURSOR
* @param pocket: Which pocket to inspect
* @param position: The cursor position to set
* @param scroll: The screen scroll to set
*/
void BagCursor_Field_PocketSetPosition(BAG_CURSOR *cursor, int pocket, u8 position, u8 scroll);
void BagCursor_Field_SetPocket(BAG_CURSOR *cursor, u16 a1);
/*
* void BagCursor_Field_SetPocket(BAG_CURSOR *cursor, u16 pocket)
*
* Sets the last viewed pocket in the field.
*
* @param cursor: Pointer to BAG_CURSOR
* @param pocket: ID of last viewed pocket
*/
void BagCursor_Field_SetPocket(BAG_CURSOR *cursor, u16 pocket);
/*
* void BagCursor_Battle_PocketGetPosition(BAG_CURSOR *cursor, int pocket, u8 *position_p, u8 *scroll_p)
*
* Gets the cursor position for the indicated pocket in battle.
*
* @param cursor: Pointer to BAG_CURSOR
* @param pocket: Which pocket to inspect
* @param position_p: Where the cursor position is returned
* @param scroll_p: Where the screen scroll is returned
*/
void BagCursor_Battle_PocketGetPosition(BAG_CURSOR *cursor, int pocket, u8 *position_p, u8 *scroll_p);
/*
* u16 BagCursor_Battle_GetLastUsedItem(BAG_CURSOR *cursor)
*
* Gets the last used item in battle
*
* @param cursor: Pointer to BAG_CURSOR
*
* @returns: ID of last used item
*/
u16 BagCursor_Battle_GetLastUsedItem(BAG_CURSOR *cursor);
/*
* u16 BagCursor_Battle_GetLastUsedPocket(BAG_CURSOR *cursor)
*
* Gets the pocket containing the last used item in battle
*
* @param cursor: Pointer to BAG_CURSOR
*
* @returns: ID of pocket containing last used item
*/
u16 BagCursor_Battle_GetLastUsedPocket(BAG_CURSOR *cursor);
/*
* u16 BagCursor_Battle_GetPocket(BAG_CURSOR *cursor)
*
* Gets the last viewed pocket in battle
*
* @param cursor: Pointer to BAG_CURSOR
*
* @returns: ID of last viewed pocket
*/
u16 BagCursor_Battle_GetPocket(BAG_CURSOR *cursor);
/*
* void BagCursor_Battle_PocketSetPosition(BAG_CURSOR *cursor, int pocket, u8 position, u8 scroll)
*
* Sets the cursor position for the indicated pocket in battle.
*
* @param cursor: Pointer to BAG_CURSOR
* @param pocket: Which pocket to inspect
* @param position: The cursor position to set
* @param scroll: The screen scroll to set
*/
void BagCursor_Battle_PocketSetPosition(BAG_CURSOR *cursor, int pocket, u8 position, u8 scroll);
/*
* void BagCursor_Battle_Init(BAG_CURSOR *cursor)
*
* Initializes the battle cursor data
*
* @param cursor: Pointer to BAG_CURSOR
*/
void BagCursor_Battle_Init(BAG_CURSOR *cursor);
void BagCursor_SetLastUsedItem(BAG_CURSOR *cursor, u16 itemId, u16 usedOnPoke);
/*
* void BagCursor_Battle_SetLastUsedItem(BAG_CURSOR *cursor, u16 itemId, u16 pocket)
*
* Sets the last used item and pocket in battle.
*
* @param cursor: Pointer to BAG_CURSOR
* @param itemId: Last used item
* @param pocket: Pocket containing the item
*/
void BagCursor_Battle_SetLastUsedItem(BAG_CURSOR *cursor, u16 itemId, u16 pocket);
/*
* void BagCursor_Battle_SetPocket(BAG_CURSOR *cursor, u16 pocket)
*
* Sets the last viewed pocket in battle.
*
* @param cursor: Pointer to BAG_CURSOR
* @param pocket: ID of last viewed pocket
*/
void BagCursor_Battle_SetPocket(BAG_CURSOR *cursor, u16 pocket);
#endif //POKEHEARTGOLD_BAG_CURSOR_H

View File

@ -415,8 +415,8 @@ void BagCursor_Field_PocketSetPosition(BAG_CURSOR *cursor, int pocket, u8 positi
cursor->field.scroll[pocket] = scroll;
}
void BagCursor_Field_SetPocket(BAG_CURSOR *cursor, u16 a1) {
cursor->field.pocket = a1;
void BagCursor_Field_SetPocket(BAG_CURSOR *cursor, u16 pocket) {
cursor->field.pocket = pocket;
}
void BagCursor_Battle_PocketGetPosition(BAG_CURSOR *cursor, int pocket, u8 *position_p, u8 *scroll_p) {
@ -450,9 +450,9 @@ void BagCursor_Battle_Init(BAG_CURSOR *cursor) {
BagCursor_Battle_SetPocket(cursor, 0);
}
void BagCursor_SetLastUsedItem(BAG_CURSOR *cursor, u16 itemId, u16 usedOnPoke) {
void BagCursor_Battle_SetLastUsedItem(BAG_CURSOR *cursor, u16 itemId, u16 pocket) {
cursor->battle.lastUsedItem = itemId;
cursor->battle.lastUsedPocket = usedOnPoke;
cursor->battle.lastUsedPocket = pocket;
}
void BagCursor_Battle_SetPocket(BAG_CURSOR *cursor, u16 pocket) {