mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 21:41:03 +00:00
- keep mouse coordinates as floats for as long as possible.
This commit is contained in:
parent
3cfd19b2ef
commit
92d630eb45
5 changed files with 15 additions and 15 deletions
|
@ -155,17 +155,17 @@ void PostMouseMove(int xx, int yy)
|
|||
|
||||
if (m_filter)
|
||||
{
|
||||
ev.x = xs_CRoundToInt((x + lastx) / 2);
|
||||
ev.y = xs_CRoundToInt((y + lasty) / 2);
|
||||
ev.x = (x + lastx) / 2;
|
||||
ev.y = (y + lasty) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ev.x = xs_CRoundToInt(x);
|
||||
ev.y = xs_CRoundToInt(y);
|
||||
ev.x = x;
|
||||
ev.y = y;
|
||||
}
|
||||
lastx = x;
|
||||
lasty = y;
|
||||
if (ev.x | ev.y)
|
||||
if (ev.x || ev.y)
|
||||
{
|
||||
ev.type = EV_Mouse;
|
||||
D_PostEvent(&ev);
|
||||
|
@ -192,8 +192,8 @@ FInputEvent::FInputEvent(const event_t *ev)
|
|||
KeyString = FString(char(ev->data1));
|
||||
break;
|
||||
case EV_Mouse:
|
||||
MouseX = ev->x;
|
||||
MouseY = ev->y;
|
||||
MouseX = int(ev->x);
|
||||
MouseY = int(ev->y);
|
||||
break;
|
||||
default:
|
||||
break; // EV_DeviceChange = wat?
|
||||
|
|
|
@ -22,8 +22,8 @@ struct event_t
|
|||
int16_t data1; // keys / mouse/joystick buttons
|
||||
int16_t data2;
|
||||
int16_t data3;
|
||||
int x; // mouse/joystick x move
|
||||
int y; // mouse/joystick y move
|
||||
float x; // mouse/joystick x move
|
||||
float y; // mouse/joystick y move
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2724,7 +2724,7 @@ static bool System_DispatchEvent(event_t* ev)
|
|||
G_AddViewAngle(turn, true);
|
||||
ev->x = 0;
|
||||
}
|
||||
if ((ev->x | ev->y) == 0)
|
||||
if (ev->x == 0 && ev->y == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -212,8 +212,8 @@ CVAR (Float, m_side, 2.f, CVAR_GLOBALCONFIG|CVAR_ARCHIVE)
|
|||
int turnheld; // for accelerative turning
|
||||
|
||||
// mouse values are used once
|
||||
int mousex;
|
||||
int mousey;
|
||||
float mousex;
|
||||
float mousey;
|
||||
|
||||
FString savegamefile;
|
||||
FString savedescription;
|
||||
|
@ -721,7 +721,7 @@ void G_BuildTiccmd (ticcmd_t *cmd)
|
|||
// Handle mice.
|
||||
if (!buttonMap.ButtonDown(Button_Mlook) && !freelook)
|
||||
{
|
||||
forward += (int)((float)mousey * m_forward);
|
||||
forward += xs_CRoundToInt(mousey * m_forward);
|
||||
}
|
||||
|
||||
cmd->ucmd.pitch = LocalViewPitch >> 16;
|
||||
|
@ -733,7 +733,7 @@ void G_BuildTiccmd (ticcmd_t *cmd)
|
|||
}
|
||||
|
||||
if (strafe || lookstrafe)
|
||||
side += (int)((float)mousex * m_side);
|
||||
side += xs_CRoundToInt(mousex * m_side);
|
||||
|
||||
mousex = mousey = 0;
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ extern FString BackupSaveName;
|
|||
bool savegamerestore;
|
||||
int finishstate = FINISH_NoHub;
|
||||
|
||||
extern int mousex, mousey;
|
||||
extern float mousex, mousey;
|
||||
extern bool sendpause, sendsave, sendturn180, SendLand;
|
||||
|
||||
void *statcopy; // for statistics driver
|
||||
|
|
Loading…
Reference in a new issue