Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Un-invert mouse when used for movement #2269

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/g_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ CVAR (Float, m_forward, 1.f, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
CVAR (Float, m_side, 2.f, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)

int turnheld; // for accelerative turning


EXTERN_CVAR (Bool, invertmouse)
EXTERN_CVAR (Bool, invertmousex)

// mouse values are used once
float mousex;
float mousey;
Expand Down Expand Up @@ -1035,9 +1038,23 @@ bool G_Responder (event_t *ev)
break;

// [RH] mouse buttons are sent as key up/down events
case EV_Mouse:
mousex = ev->x;
mousey = ev->y;
case EV_Mouse:
if(invertmousex)
{
mousex = -ev->x;
}
else
{
mousex = ev->x;
}
if(invertmouse)
{
mousey = -ev->y;
}
else
{
mousey = ev->y;
}
break;
}

Expand Down
Loading