Disable mouse on Android, don't change viewangles while dead

This commit is contained in:
a1batross 2016-03-12 22:34:43 +03:00
parent a41b3d7f58
commit f3168aa727
5 changed files with 27 additions and 9 deletions

View File

@ -286,11 +286,11 @@ public:
void Scroll( float amount );
float scroll;
bool m_bShow;
cvar_t *cl_hide_motd;
protected:
static int MOTD_DISPLAY_TIME;
char m_szMOTD[ MAX_MOTD_LENGTH ];
cvar_t *cl_hide_motd;
int m_iLines;
int m_iMaxLength;
@ -590,6 +590,7 @@ public:
class CHudMessage: public CHudBase
{
public:
friend class CHudTextMessage;
int Init( void );
int VidInit( void );
int Draw(float flTime);

View File

@ -19,10 +19,12 @@
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT
#ifndef PORT_H
typedef struct point_s{
int x;
int y;
} POINT;
#endif
#define GetCursorPos(x)
#define SetCursorPos(x,y)
#endif

View File

@ -29,7 +29,6 @@
#ifndef VGUI_PARSER_H
#define VGUI_PARSER_H
#define MAX_LOCALIZED_TITLES 2048
#define MAX_TOLOCALIZE_STRING_SIZE 256
#define MAX_LOCALIZEDSTRING_SIZE 2048

View File

@ -768,9 +768,9 @@ CL_IsDead
Returns 1 if health is <= 0
============
*/
int CL_IsDead( void )
bool CL_IsDead( void )
{
return ( gHUD.m_Health.m_iHealth <= 0 ) ? 1 : 0;
return gHUD.m_Health.m_iHealth <= 0;
}
/*

View File

@ -10,7 +10,7 @@ cvar_t *in_joystick;
#define YAW 1
#define ROLL 2
extern "C" void DLLEXPORT IN_ClientMoveEvent( float forwardmove, float sidemove );
extern "C" void DLLEXPORT IN_ClientMoveEvent( float forwardmove, float sidemove );
extern "C" void DLLEXPORT IN_ClientLookEvent( float relyaw, float relpitch );
extern kbutton_t in_strafe;
@ -43,6 +43,7 @@ float ac_sidemove;
int ac_movecount;
float rel_yaw;
float rel_pitch;
bool bMouseInUse = false;
#define F 1<<0 // Forward
#define B 1<<1 // Back
@ -55,6 +56,7 @@ float rel_pitch;
#define IMPULSE_DOWN 2
#define IMPULSE_UP 4
bool CL_IsDead();
void IN_ToggleButtons( float forwardmove, float sidemove )
{
@ -152,10 +154,17 @@ void IN_ClientLookEvent( float relyaw, float relpitch )
// Rotate camera and add move values to usercmd
void IN_Move( float frametime, usercmd_t *cmd )
{
#ifdef __ANDROID__
if( bMouseInUse )
return;
#endif
Vector viewangles;
gEngfuncs.GetViewAngles( viewangles );
bool fLadder = false;
if( cl_laddermode->value !=2 ) fLadder = gEngfuncs.GetLocalPlayer()->curstate.movetype == MOVETYPE_FLY;
if( cl_laddermode->value != 2 )
fLadder = gEngfuncs.GetLocalPlayer()->curstate.movetype == MOVETYPE_FLY;
//if(ac_forwardmove || ac_sidemove)
//gEngfuncs.Con_Printf("Move: %f %f %f %f\n", ac_forwardmove, ac_sidemove, rel_pitch, rel_yaw);
#if 0
@ -164,7 +173,7 @@ void IN_Move( float frametime, usercmd_t *cmd )
V_StopPitchDrift();
}
#endif
if( gHUD.m_iIntermission )
if( gHUD.m_iIntermission || CL_IsDead() )
return;
if( gHUD.GetSensitivity() != 0 )
@ -177,11 +186,11 @@ void IN_Move( float frametime, usercmd_t *cmd )
rel_yaw *= sensitivity->value;
rel_pitch *= sensitivity->value;
}
/*if(gHUD.m_MOTD.m_bShow)
if(gHUD.m_MOTD.cl_hide_motd->value == 0.0f && gHUD.m_MOTD.m_bShow)
{
gHUD.m_MOTD.scroll += rel_pitch;
}
else*/
else
{
viewangles[PITCH] += rel_pitch;
viewangles[YAW] += rel_yaw;
@ -229,6 +238,7 @@ extern "C" void IN_MouseEvent( int mstate )
}
mouse_oldbuttonstate = mstate;
bMouseInUse = true;
}
// Stubs
@ -267,5 +277,11 @@ void IN_Init( void )
sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity", "3", FCVAR_ARCHIVE );
in_joystick = gEngfuncs.pfnRegisterVariable ( "joystick", "0", FCVAR_ARCHIVE );
cl_laddermode = gEngfuncs.pfnRegisterVariable ( "cl_laddermode", "2", FCVAR_ARCHIVE );
#ifdef __ANDROID__
gEngfuncs.Cvar_SetValue("m_yaw", -1);
gEngfuncs.Cvar_SetValue("m_pitch", -1);
#endif
ac_forwardmove = ac_sidemove = rel_yaw = rel_pitch = 0;
}