forked from Ports/perfect_dark
port: make menu mouse flag global
This commit is contained in:
1 parent
bf8192ee84
commit
2ba192d411
4 files changed
+10
-14
No files matched your search
+7
-10
@@ -139,6 +139,7 @@ s32 g_MpPlayerNum = 0;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
s32 g_MenuMouseControl = true;
|
||||
s32 g_MenuUsingMouse = false;
|
||||
#endif
|
||||
|
||||
void menuPlaySound(s32 menusound)
|
||||
@@ -1362,7 +1363,7 @@ bool dialogChangeItemFocusWithMouse(struct menudialog *dialog, s32 mx, s32 my)
|
||||
s32 colwidth = 0;
|
||||
|
||||
// only allow mouse control of player 1 menus; ignore mouse if navigating with keyboard
|
||||
if (menu->playernum != 0 || !dialog->usingmouse) {
|
||||
if (menu->playernum != 0 || !g_MenuUsingMouse) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1501,10 +1502,6 @@ void menuOpenDialog(struct menudialogdef *dialogdef, struct menudialog *dialog,
|
||||
dialog->y = dialog->dsty;
|
||||
dialog->width = dialog->dstwidth;
|
||||
dialog->height = dialog->dstheight;
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
dialog->usingmouse = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void menuPushDialog(struct menudialogdef *dialogdef)
|
||||
@@ -4511,7 +4508,7 @@ void dialogTick(struct menudialog *dialog, struct menuinputs *inputs, u32 tickfl
|
||||
|
||||
if ((dialog->focuseditem->flags & MENUITEMFLAG_00010000) == 0) {
|
||||
#ifndef PLATFORM_N64
|
||||
if (dialog->usingmouse) {
|
||||
if (g_MenuUsingMouse) {
|
||||
dstscroll = dialog->dstscroll - inputs->mousescroll * LINEHEIGHT;
|
||||
} else
|
||||
#endif
|
||||
@@ -4683,7 +4680,7 @@ void menuProcessInput(void)
|
||||
inputs.mousex = (f32)(SCREEN_WIDTH_LO / 2) + cx;
|
||||
}
|
||||
if (dialog && inputs.mousemoved) {
|
||||
dialog->usingmouse = true;
|
||||
g_MenuUsingMouse = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -4750,7 +4747,7 @@ void menuProcessInput(void)
|
||||
}
|
||||
|
||||
// don't back out on weapon back when using mouse because it's likely bound to wheel
|
||||
if (!dialog->usingmouse && (buttonsnow & BUTTON_WPNBACK)) {
|
||||
if (!g_MenuUsingMouse && (buttonsnow & BUTTON_WPNBACK)) {
|
||||
inputs.back = 1;
|
||||
}
|
||||
#endif
|
||||
@@ -5096,10 +5093,10 @@ void menuProcessInput(void)
|
||||
#ifndef PLATFORM_N64
|
||||
// if we haven't been using the mouse but we have been keyboard scrolling disable the mouse
|
||||
if (!inputs.mousemoved && (inputs.leftright || inputs.updown || inputs.leftrightheld || inputs.updownheld)) {
|
||||
dialog->usingmouse = false;
|
||||
g_MenuUsingMouse = false;
|
||||
}
|
||||
// otherwise rotate left/right by clicking on the side of the menu
|
||||
if (dialog->usingmouse && inputs.select && !inputs.leftright && !inputs.leftrightheld) {
|
||||
if (g_MenuUsingMouse && inputs.select && !inputs.leftright && !inputs.leftrightheld) {
|
||||
if (inputs.mousey > dialog->y && inputs.mousey < dialog->y + dialog->height) {
|
||||
if (inputs.mousex < dialog->x) {
|
||||
inputs.leftright = -1;
|
||||
|
||||
+1
-1
@@ -1369,7 +1369,7 @@ bool menuitemKeyboardTick(struct menuitem *item, struct menuinputs *inputs, u32
|
||||
#ifndef PLATFORM_N64
|
||||
// handle mouse
|
||||
struct menudialog *dialog = g_Menus[g_MpPlayerNum].curdialog;
|
||||
if (dialog && dialog->usingmouse && !inputs->leftright && !inputs->updown) {
|
||||
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;
|
||||
|
||||
@@ -537,6 +537,8 @@ extern struct weathercfg g_WeatherConfig[WEATHERCFG_MAX_STAGES];
|
||||
extern const struct weathercfg g_DefaultWeatherConfig;
|
||||
extern const struct weathercfg *g_CurWeatherConfig;
|
||||
|
||||
extern s32 g_MenuUsingMouse;
|
||||
|
||||
extern f32 g_ViShakeIntensityMult;
|
||||
extern u32 g_TexFilter2D;
|
||||
extern s32 g_HudCenter;
|
||||
|
||||
@@ -3739,9 +3739,6 @@ struct menudialog {
|
||||
/*0x6c*/ u8 unk6c;
|
||||
/*0x6d*/ s8 swipedir;
|
||||
/*0x6e*/ u8 unk6e;
|
||||
#ifndef PLATFORM_N64
|
||||
/*0x6f*/ u8 usingmouse;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct menudfc {
|
||||
|
||||
Reference in new issue
Block a user