port: fix mouse controls in combat sim keyboard

This commit is contained in:
fgsfds committed 2024-05-31 11:23:48 +02:00
1 parent 07e6fdc1e0
commit b523b1e076
2 files changed
+30 -1

No files matched your search

+26 -1
View File
@@ -1372,7 +1372,7 @@ bool menuitemKeyboardTick(struct menuitem *item, struct menuinputs *inputs, u32
if (dialog && g_MenuUsingMouse && !inputs->leftright && !inputs->updown) {
const s32 dleft = dialog->x + 4;
const s32 dright = dleft + 12 * 10;
const s32 dtop = dialog->y + 13 + 12;
const s32 dtop = menuitemGetTop(item, dialog) + 12;
const s32 dbottom = dtop + 11 * 5;
const s32 mx = inputs->mousex;
const s32 my = inputs->mousey;
@@ -4514,3 +4514,28 @@ Gfx *menuitemOverlay(Gfx *gdl, s16 x, s16 y, s16 x2, s16 y2, struct menuitem *it
return gdl;
}
#ifndef PLATFORM_N64
s32 menuitemGetTop(struct menuitem *item, struct menudialog *dialog)
{
struct menu *menu = &g_Menus[g_MpPlayerNum];
s32 dtop = dialog->y + LINEHEIGHT + 1;
for (s32 i = 0; i < dialog->numcols; ++i) {
const s32 colindex = i + dialog->colstart;
for (s32 j = 0; j < menu->cols[colindex].numrows; ++j) {
const s32 rowindex = j + menu->cols[colindex].rowstart;
struct menuitem *pitem = &dialog->definition->items[menu->rows[rowindex].itemindex];
if (pitem == item) {
return dtop;
}
dtop += menu->rows[rowindex].height;
}
}
return dtop;
}
#endif
+4
View File
@@ -83,4 +83,8 @@ bool menuitemTick(struct menuitem *item, struct menudialog *dialog, struct menui
void menuitemInit(struct menuitem *item, union menuitemdata *data);
Gfx *menuitemOverlay(Gfx *gdl, s16 x, s16 y, s16 x2, s16 y2, struct menuitem *item, struct menudialog *dialog, union menuitemdata *data);
#ifndef PLATFORM_N64
s32 menuitemGetTop(struct menuitem *item, struct menudialog *dialog);
#endif
#endif