Make chat & console disallow mouse look

This commit is contained in:
Agent X 2023-11-19 22:24:07 -05:00
parent d45ab95b2d
commit 092a5fab32
7 changed files with 10 additions and 10 deletions

View file

@ -412,7 +412,7 @@ static void newcam_rotate_button(void) {
newcam_tilt_acc -= (newcam_tilt_acc*((f32)newcam_degrade/100));
}
if ((newcam_mouse == 1) && !gDjuiInMainMenu) {
if ((newcam_mouse == 1) && !gDjuiInMainMenu && !gDjuiChatBoxFocus && !gDjuiConsoleFocus) {
newcam_yaw += ivrt(0) * mouse_x * 16;
newcam_tilt += ivrt(1) * mouse_y * 16;
}

View file

@ -10,6 +10,7 @@
#include "engine/math_util.h"
#include "pc/controller/controller_mouse.h"
#include "pc/djui/djui.h"
#include "pc/djui/djui_hud_utils.h"
#include "pc/lua/utils/smlua_misc_utils.h"
#include "pc/lua/smlua_hooks.h"
@ -62,7 +63,7 @@ void first_person_camera_update(void) {
u8 invX = camera_config_is_x_inverted() ? 1 : -1;
u8 invY = camera_config_is_y_inverted() ? 1 : -1;
if (gMenuMode == -1) {
if (gMenuMode == -1 && !gDjuiChatBoxFocus && !gDjuiConsoleFocus) {
// update pitch
gFirstPersonCamera.pitch -= sensY * (invY * m->controller->extStickY - 1.5f * mouse_y);
gFirstPersonCamera.pitch = CLAMP(gFirstPersonCamera.pitch, -0x3F00, 0x3F00);
@ -154,8 +155,6 @@ void first_person_update(void) {
m->area->camera->mode = CAMERA_MODE_FREE_ROAM;
}
gDjuiHudLockMouse = gMenuMode == -1;
m->marioBodyState->modelState = 0x100;
if (m->heldObj) {
Vec3f camDir = {

View file

@ -147,10 +147,11 @@ static inline int16_t get_axis(const int i) {
return 0;
}
extern s16 gMenuMode;
static void controller_sdl_read(OSContPad *pad) {
if (!init_ok) return;
if (newcam_mouse == 1 && sCurrPlayMode != 2)
if (newcam_mouse == 1 && gMenuMode == -1 && !gDjuiChatBoxFocus && !gDjuiConsoleFocus)
SDL_WM_GrabInput(SDL_GRAB_ON);
else
SDL_WM_GrabInput(SDL_GRAB_OFF);

View file

@ -169,14 +169,15 @@ static inline void update_button(const int i, const bool new) {
}
}
u8 ignore_lock = FALSE;
extern s16 gMenuMode;
bool ignore_lock = false;
static void controller_sdl_read(OSContPad *pad) {
if (!init_ok) {
return;
}
if (!gDjuiHudLockMouse) {
if (newcam_mouse == 1 && (!is_game_paused() || sCurrPlayMode != 2) && !gDjuiInMainMenu) {
if (newcam_mouse == 1 && gMenuMode == -1 && !gDjuiInMainMenu && !gDjuiChatBoxFocus && !gDjuiConsoleFocus) {
SDL_SetRelativeMouseMode(SDL_TRUE);
ignore_lock = true;
} else {
@ -196,7 +197,7 @@ static void controller_sdl_read(OSContPad *pad) {
last_mouse = (mouse_buttons ^ mouse) & mouse;
mouse_buttons = mouse;
if (!ignore_lock && (!is_game_paused() || sCurrPlayMode != 2) && !gDjuiInMainMenu) {
if (!ignore_lock && gMenuMode == -1 && !gDjuiInMainMenu && !gDjuiChatBoxFocus && !gDjuiConsoleFocus) {
SDL_SetRelativeMouseMode(gDjuiHudLockMouse ? SDL_TRUE : SDL_FALSE);
}

View file

@ -5,7 +5,6 @@
#include "djui_panel_pause.h"
#include "djui_panel_join.h"
#include "djui_panel_join_message.h"
#include "djui_console.h"
#include "../debuglog.h"
#include "pc/cliopts.h"
#include "game/level_update.h"

View file

@ -33,6 +33,7 @@
#include "djui_popup.h"
#include "djui_chat_box.h"
#include "djui_chat_message.h"
#include "djui_console.h"
#include "djui_paginated.h"
extern struct DjuiRoot* gDjuiRoot;

View file

@ -4,7 +4,6 @@
#include "djui_panel_pause.h"
#include "djui_panel_modlist.h"
#include "djui_panel_playerlist.h"
#include "djui_console.h"
#include "src/pc/controller/controller_sdl.h"
#include "src/pc/controller/controller_mouse.h"