mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 19:24:16 +01:00
more list menu work
This commit is contained in:
parent
ae29f35afd
commit
87274b9eed
171
asm/list_menu.s
171
asm/list_menu.s
@ -6,177 +6,6 @@
|
||||
.text
|
||||
|
||||
|
||||
|
||||
|
||||
thumb_func_start ListMenuDrawCursor
|
||||
@ void ListMenuDrawCursor(struct ListMenu *listMenu)
|
||||
ListMenuDrawCursor: @ 81AEB20
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
adds r6, r0, 0
|
||||
ldrb r0, [r6, 0x17]
|
||||
lsls r0, 26
|
||||
lsrs r0, 26
|
||||
movs r1, 0x1
|
||||
bl GetFontAttribute
|
||||
ldrb r1, [r6, 0x16]
|
||||
lsls r1, 26
|
||||
lsrs r1, 29
|
||||
adds r0, r1
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldrb r1, [r6, 0x13]
|
||||
mov r8, r1
|
||||
ldrh r1, [r6, 0x1A]
|
||||
muls r1, r0
|
||||
ldrb r0, [r6, 0x14]
|
||||
lsls r0, 28
|
||||
lsrs r0, 28
|
||||
adds r0, r1
|
||||
lsls r0, 24
|
||||
lsrs r7, r0, 24
|
||||
ldrb r0, [r6, 0x17]
|
||||
lsrs r0, 6
|
||||
cmp r0, 0x1
|
||||
beq _081AEC0C
|
||||
cmp r0, 0x1
|
||||
bgt _081AEB66
|
||||
cmp r0, 0
|
||||
beq _081AEB70
|
||||
b _081AEC0C
|
||||
_081AEB66:
|
||||
cmp r0, 0x2
|
||||
beq _081AEB84
|
||||
cmp r0, 0x3
|
||||
beq _081AEBCC
|
||||
b _081AEC0C
|
||||
_081AEB70:
|
||||
ldr r1, =gText_SelectorArrow2
|
||||
adds r0, r6, 0
|
||||
mov r2, r8
|
||||
adds r3, r7, 0
|
||||
bl ListMenuPrint
|
||||
b _081AEC0C
|
||||
.pool
|
||||
_081AEB84:
|
||||
ldrb r0, [r6, 0x1E]
|
||||
cmp r0, 0xFF
|
||||
bne _081AEB94
|
||||
adds r0, r6, 0
|
||||
movs r1, 0
|
||||
bl ListMenuAddCursorObject
|
||||
strb r0, [r6, 0x1E]
|
||||
_081AEB94:
|
||||
ldrb r5, [r6, 0x1E]
|
||||
ldrb r0, [r6, 0x10]
|
||||
movs r1, 0x1
|
||||
bl GetWindowAttribute
|
||||
adds r4, r0, 0
|
||||
lsls r4, 19
|
||||
ldr r0, =0xffff0000
|
||||
adds r4, r0
|
||||
lsrs r4, 16
|
||||
ldrb r0, [r6, 0x10]
|
||||
movs r1, 0x2
|
||||
bl GetWindowAttribute
|
||||
adds r2, r0, 0
|
||||
lsls r2, 3
|
||||
adds r2, r7
|
||||
subs r2, 0x1
|
||||
lsls r2, 16
|
||||
lsrs r2, 16
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
movs r3, 0
|
||||
bl ListMenuUpdateCursorObject
|
||||
b _081AEC0C
|
||||
.pool
|
||||
_081AEBCC:
|
||||
ldrb r0, [r6, 0x1E]
|
||||
cmp r0, 0xFF
|
||||
bne _081AEBDC
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x1
|
||||
bl ListMenuAddCursorObject
|
||||
strb r0, [r6, 0x1E]
|
||||
_081AEBDC:
|
||||
ldrb r5, [r6, 0x1E]
|
||||
ldrb r0, [r6, 0x10]
|
||||
movs r1, 0x1
|
||||
bl GetWindowAttribute
|
||||
adds r4, r0, 0
|
||||
lsls r4, 3
|
||||
add r4, r8
|
||||
lsls r4, 16
|
||||
lsrs r4, 16
|
||||
ldrb r0, [r6, 0x10]
|
||||
movs r1, 0x2
|
||||
bl GetWindowAttribute
|
||||
adds r2, r0, 0
|
||||
lsls r2, 3
|
||||
adds r2, r7
|
||||
lsls r2, 16
|
||||
lsrs r2, 16
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
movs r3, 0x1
|
||||
bl ListMenuUpdateCursorObject
|
||||
_081AEC0C:
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end ListMenuDrawCursor
|
||||
|
||||
thumb_func_start ListMenuAddCursorObject
|
||||
ListMenuAddCursorObject: @ 81AEC18
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0xC
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
mov r1, sp
|
||||
movs r0, 0
|
||||
strb r0, [r1]
|
||||
movs r0, 0xA0
|
||||
strb r0, [r1, 0x1]
|
||||
ldrb r0, [r4, 0x10]
|
||||
movs r1, 0x3
|
||||
bl GetWindowAttribute
|
||||
mov r1, sp
|
||||
lsls r0, 3
|
||||
adds r0, 0x2
|
||||
strh r0, [r1, 0x2]
|
||||
ldrb r0, [r4, 0x17]
|
||||
lsls r0, 26
|
||||
lsrs r0, 26
|
||||
movs r1, 0x1
|
||||
bl GetFontAttribute
|
||||
mov r1, sp
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r0, 0x2
|
||||
strh r0, [r1, 0x4]
|
||||
movs r0, 0x80
|
||||
lsls r0, 7
|
||||
strh r0, [r1, 0x6]
|
||||
ldr r0, =0x0000ffff
|
||||
strh r0, [r1, 0x8]
|
||||
movs r0, 0xF
|
||||
strb r0, [r1, 0xA]
|
||||
mov r0, sp
|
||||
adds r1, r5, 0
|
||||
bl ListMenuAddCursorObjectInternal
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
add sp, 0xC
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end ListMenuAddCursorObject
|
||||
|
||||
thumb_func_start ListMenuErasePrintedCursor
|
||||
ListMenuErasePrintedCursor: @ 81AEC78
|
||||
push {r4-r7,lr}
|
||||
|
@ -7,17 +7,31 @@
|
||||
|
||||
// Exported ROM declarations
|
||||
|
||||
struct ArrowStruct {
|
||||
struct ArrowStruct
|
||||
{
|
||||
u8 unk0[6];
|
||||
u16 unk6[4];
|
||||
u8 unkE;
|
||||
};
|
||||
|
||||
struct CursorStruct
|
||||
{
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u16 unk2;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
u16 unk8;
|
||||
u8 unkA;
|
||||
};
|
||||
|
||||
void Task_ScrollIndicatorArrowPairOnMainMenu(u8);
|
||||
u8 AddScrollIndicatorArrowPairParametrized(u8, u8, u8, u8, s32, u16, u16, u16 *);
|
||||
void RemoveScrollIndicatorArrowPair(u8);
|
||||
u8 AddScrollIndicatorArrowPair(const struct ArrowStruct*, void*);
|
||||
void sub_81AF15C(u8, u8, u8);
|
||||
void ListMenuRemoveCursorObject(u8 taskId, u32 cursorKind);
|
||||
void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 cursorKind);
|
||||
u8 ListMenuAddCursorObjectInternal(struct CursorStruct *cursor, u32 cursorKind);
|
||||
|
||||
#endif //GUARD_MENU_INDICATORS_H
|
||||
|
@ -32,6 +32,7 @@ bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAndCallCa
|
||||
void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u16 count);
|
||||
void ListMenuDrawCursor(struct ListMenu *list);
|
||||
void ListMenuCallSelectionChangedCallback(struct ListMenu *list, u8 a2);
|
||||
u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind);
|
||||
|
||||
// code
|
||||
void ListMenuDummyTask(u8 taskId)
|
||||
@ -376,3 +377,49 @@ void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u1
|
||||
startIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
extern const u8 gText_SelectorArrow2[];
|
||||
|
||||
void ListMenuDrawCursor(struct ListMenu *list)
|
||||
{
|
||||
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
|
||||
u8 x = list->template.cursor_Y;
|
||||
u8 y = list->selectedRow * yMultiplier + list->template.upText_Y;
|
||||
switch (list->template.cursorKind)
|
||||
{
|
||||
case 0:
|
||||
ListMenuPrint(list, gText_SelectorArrow2, x, y);
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
if (list->unk_1E == 0xFF)
|
||||
list->unk_1E = ListMenuAddCursorObject(list, 0);
|
||||
ListMenuUpdateCursorObject(list->unk_1E,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT) * 8 - 1,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y - 1, 0);
|
||||
break;
|
||||
case 3:
|
||||
if (list->unk_1E == 0xFF)
|
||||
list->unk_1E = ListMenuAddCursorObject(list, 1);
|
||||
ListMenuUpdateCursorObject(list->unk_1E,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT) * 8 + x,
|
||||
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind)
|
||||
{
|
||||
struct CursorStruct cursor;
|
||||
|
||||
cursor.unk0 = 0;
|
||||
cursor.unk1 = 0xA0;
|
||||
cursor.unk2 = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8 + 2;
|
||||
cursor.unk4 = GetFontAttribute(list->template.fontId, 1) + 2;
|
||||
cursor.unk6 = 0x4000;
|
||||
cursor.unk8 = 0xFFFF;
|
||||
cursor.unkA = 0xF;
|
||||
|
||||
return ListMenuAddCursorObjectInternal(&cursor, cursorKind);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user