haptics for flamethrower and tesla

This commit is contained in:
Simon 2020-07-14 20:27:41 +01:00
parent fc3a941f1f
commit 565efdc14b
11 changed files with 29 additions and 16 deletions

View file

@ -878,7 +878,7 @@ RTCWVR_Vibrate
float vibration_channel_duration[2] = {0.0f, 0.0f};
float vibration_channel_intensity[2] = {0.0f, 0.0f};
void RTCWVR_Vibrate( float duration, int channel, float intensity )
void RTCWVR_Vibrate( int duration, int channel, float intensity )
{
if (vibration_channel_duration[channel] > 0.0f)
return;

View file

@ -59,7 +59,7 @@ void interactWithTouchScreen(qboolean reset, ovrInputStateTrackedRemote *newStat
//Called from engine code
qboolean RTCWVR_useScreenLayer();
void RTCWVR_GetScreenRes(int *width, int *height);
void RTCWVR_Vibrate(float duration, int channel, float intensity );
void RTCWVR_Vibrate(int duration, int channel, float intensity );
qboolean RTCWVR_processMessageQueue();
void RTCWVR_FrameSetup();
void RTCWVR_setUseScreenLayer(qboolean use);

View file

@ -2293,7 +2293,7 @@ static void CG_DrawCrosshair( void ) {
case WP_FG42SCOPE:
// JPW NERVE -- don't let players run with rifles -- speed 80 == crouch, 128 == walk, 256 == run
if ( cg_gameType.integer != GT_SINGLE_PLAYER ) {
/* if ( cg_gameType.integer != GT_SINGLE_PLAYER ) {
if ( VectorLength( cg.snap->ps.velocity ) > 127.0f ) {
if ( cg.snap->ps.weapon == WP_SNIPERRIFLE ) {
CG_FinishWeaponChange( WP_SNIPERRIFLE, WP_MAUSER );
@ -2302,7 +2302,7 @@ static void CG_DrawCrosshair( void ) {
CG_FinishWeaponChange( WP_SNOOPERSCOPE, WP_GARAND );
}
}
}
}*/
// jpw
CG_DrawWeapReticle();

View file

@ -2452,6 +2452,8 @@ int trap_Key_GetCatcher( void );
void trap_Key_SetCatcher( int catcher );
int trap_Key_GetKey( const char *binding );
int trap_Vibrate(int duration, int channel, float intensity );
// RF
void trap_SendMoveSpeedsToGame( int entnum, char *movespeeds );

View file

@ -545,6 +545,6 @@ qboolean trap_GetModelInfo( int clientNum, char *modelName, animModelInfo_t **mo
return syscall( CG_GETMODELINFO, clientNum, modelName, modelInfo );
}
qboolean trap_Vibrate( float duration, int channel, float intensity ) {
return syscall( CG_HAPTIC, PASSFLOAT(duration), channel, PASSFLOAT(intensity) );
int trap_Vibrate( int duration, int channel, float intensity ) {
return syscall( CG_HAPTIC, duration, channel, PASSFLOAT(intensity) );
}

View file

@ -3228,7 +3228,9 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
if ( ps || cg.renderingThirdPerson || !isPlayer ) {
static qboolean wasfiring = qfalse;
if ( firing ) {
wasfiring = qtrue;
// Ridah, Flamethrower effect
CG_FlamethrowerFlame( cent, flash.origin );
@ -3246,6 +3248,13 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
AxisToAngles( flash.axis, angles );
CG_FireFlameChunks( cent, flash.origin, angles, 1.0, qfalse, 0 );
}
if (wasfiring) {
//Stop haptics
trap_Vibrate(0, 0, 0.0);
trap_Vibrate(0, 1, 0.0);
wasfiring = qfalse;
}
}
}
}

View file

@ -44,7 +44,7 @@ extern qboolean getCameraInfo( int camNum, int time, vec3_t *origin, vec3_t *ang
// RF, this is only used when running a local server
extern void SV_SendMoveSpeedsToGame( int entnum, char *text );
extern qboolean SV_GetModelInfo( int clientNum, char *modelName, animModelInfo_t **modelInfo );
void RTCWVR_Vibrate(float duration, int channel, float intensity );
void RTCWVR_Vibrate(int duration, int channel, float intensity );
/*
@ -855,7 +855,7 @@ int CL_CgameSystemCalls( int *args ) {
return SV_GetModelInfo( args[1], VMA( 2 ), VMA( 3 ) );
case CG_HAPTIC:
RTCWVR_Vibrate( VMF(1), args[2], VMF( 3 ) );
RTCWVR_Vibrate( args[1], args[2], VMF( 3 ) );
return 0;
default:

View file

@ -1218,7 +1218,7 @@ void trap_GetUsercmd( int clientNum, usercmd_t *cmd );
qboolean trap_GetEntityToken( char *buffer, int bufferSize );
qboolean trap_GetTag( int clientNum, char *tagName, orientation_t * or );
int trap_Vibrate(float duration, int channel, float intensity );
int trap_Vibrate(int duration, int channel, float intensity );
int trap_DebugPolygonCreate( int color, int numPoints, vec3_t *points );
void trap_DebugPolygonDelete( int id );

View file

@ -255,8 +255,8 @@ qboolean trap_GetTag( int clientNum, char *tagName, orientation_t *or ) {
return syscall( G_GETTAG, clientNum, tagName, or );
}
int trap_Vibrate(float duration, int channel, float intensity ) {
return syscall( G_HAPTIC, PASSFLOAT(duration), channel, PASSFLOAT(intensity) );
int trap_Vibrate(int duration, int channel, float intensity ) {
return syscall( G_HAPTIC, duration, channel, PASSFLOAT(intensity) );
}
// BotLib traps start here

View file

@ -1601,8 +1601,9 @@ void Weapon_RocketLauncher_Fire( gentity_t *ent, float aimSpreadScale ) {
m = fire_rocket( ent, launchpos, dir );
//DON'T DO THIS BIT IN VR - COULD RESULT IN NAUSEA
// add kick-back
VectorMA( ent->client->ps.velocity, -64, forward, ent->client->ps.velocity );
// VectorMA( ent->client->ps.velocity, -64, forward, ent->client->ps.velocity );
} else {
m = fire_rocket( ent, muzzleEffect, forward );
@ -2076,8 +2077,9 @@ void FireWeapon( gentity_t *ent ) {
Tesla_Fire( ent );
}
//DON'T DO THIS BIT IN VR - COULD RESULT IN NAUSEA
// push the player back a bit
if ( !ent->aiCharacter ) {
/* if ( !ent->aiCharacter ) {
vec3_t forward, vangle;
VectorCopy( ent->client->ps.viewangles, vangle );
vangle[PITCH] = 0; // nullify pitch so you can't lightning jump
@ -2088,7 +2090,7 @@ void FireWeapon( gentity_t *ent ) {
} else {
VectorMA( ent->client->ps.velocity, -100, forward, ent->client->ps.velocity );
}
}
}*/
break;
case WP_GAUNTLET:
Weapon_Gauntlet( ent );

View file

@ -303,7 +303,7 @@ static int FloatAsInt( float f ) {
return temp;
}
void RTCWVR_Vibrate(float duration, int channel, float intensity );
void RTCWVR_Vibrate(int duration, int channel, float intensity );
/*
====================
@ -472,7 +472,7 @@ int SV_GameSystemCalls( int *args ) {
case G_GETTAG:
return SV_GetTag( args[1], VMA( 2 ), VMA( 3 ) );
case G_HAPTIC:
RTCWVR_Vibrate( VMF(1), args[2], VMF( 3 ) );
RTCWVR_Vibrate( args[1], args[2], VMF( 3 ) );
return 0;
//====================================