forked from Ports/perfect_dark
Merge branch 'port' into port-debugger
This commit is contained in:
commit
7f886a817c
2 files changed
+30
-2
No files matched your search
+2
-2
@@ -1361,8 +1361,8 @@ bool dialogChangeItemFocusWithMouse(struct menudialog *dialog, s32 mx, s32 my)
|
|||||||
s32 curx, cury;
|
s32 curx, cury;
|
||||||
s32 colwidth = 0;
|
s32 colwidth = 0;
|
||||||
|
|
||||||
// only allow mouse control of player 1 menus
|
// only allow mouse control of player 1 menus; ignore mouse if navigating with keyboard
|
||||||
if (menu->playernum != 0) {
|
if (menu->playernum != 0 || !dialog->usingmouse) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1366,6 +1366,34 @@ bool menuitemKeyboardTick(struct menuitem *item, struct menuinputs *inputs, u32
|
|||||||
s16 prevcol = kb->col;
|
s16 prevcol = kb->col;
|
||||||
s16 prevrow = kb->row;
|
s16 prevrow = kb->row;
|
||||||
|
|
||||||
|
#ifndef PLATFORM_N64
|
||||||
|
// handle mouse
|
||||||
|
struct menudialog *dialog = g_Menus[g_MpPlayerNum].curdialog;
|
||||||
|
if (dialog && dialog->usingmouse && !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 dbottom = dtop + 11 * 5;
|
||||||
|
const s32 mx = inputs->mousex;
|
||||||
|
const s32 my = inputs->mousey;
|
||||||
|
if (mx > dleft && mx < dright && my > dtop && my < dbottom) {
|
||||||
|
kb->row = (my - dtop) / 11;
|
||||||
|
kb->col = (mx - dleft) / 12;
|
||||||
|
if (kb->row == 4) {
|
||||||
|
if (kb->col < 2) {
|
||||||
|
kb->col = 0;
|
||||||
|
} else if (kb->col < 5) {
|
||||||
|
kb->col = 2;
|
||||||
|
} else if (kb->col < 8) {
|
||||||
|
kb->col = 5;
|
||||||
|
} else {
|
||||||
|
kb->col = 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Handle left/right movement
|
// Handle left/right movement
|
||||||
// In most cases the loop only runs once, but on row 4 the buttons span
|
// In most cases the loop only runs once, but on row 4 the buttons span
|
||||||
// across multiple columns so the loop will run again until the column
|
// across multiple columns so the loop will run again until the column
|
||||||
|
|||||||
Reference in new issue
Block a user