mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-04-22 23:11:02 +00:00
Use gesture
This commit is contained in:
parent
53a36c1ca3
commit
a0730801a5
24 changed files with 280 additions and 32 deletions
|
@ -928,14 +928,20 @@ void RTCWVR_Haptic( int duration, int channel, float intensity, char *descriptio
|
|||
RTCWVR_HapticEvent("weapon_reload", channel == 1 ? 2 : 1, 0, 100.0f * intensity, 0, 0);
|
||||
}
|
||||
else if(strcmp(description,"door_open") == 0) {
|
||||
RTCWVR_HapticEvent("open_door", 0, 0, 100.0f * intensity, yaw, height);
|
||||
// Replaced by "use trigger" haptics
|
||||
// RTCWVR_HapticEvent("open_door", 0, 0, 100.0f * intensity, yaw, height);
|
||||
}
|
||||
else if(strcmp(description,"alarm_on") == 0) {
|
||||
RTCWVR_HapticEvent("heartbeat", 0, 0, 100.0f * intensity, yaw, height);
|
||||
// Replaced by "use trigger" haptics
|
||||
// RTCWVR_HapticEvent("heartbeat", 0, 0, 100.0f * intensity, yaw, height);
|
||||
}
|
||||
else if(strcmp(description,"end_alarm") == 0) {
|
||||
RTCWVR_HapticStopEvent("heartbeat");
|
||||
}
|
||||
// Replaced by "use trigger" haptics
|
||||
// RTCWVR_HapticStopEvent("heartbeat");
|
||||
}
|
||||
else if(strcmp(description,"use_trigger") == 0) {
|
||||
RTCWVR_HapticEvent("use_trigger", channel == 1 ? 2 : 1, 0, 100.0f * intensity, yaw, height);
|
||||
}
|
||||
else if(strcmp(description,"switch_weapon") == 0 || strcmp(description,"pickup_item") == 0) {
|
||||
RTCWVR_HapticEvent(description, channel == 1 ? 2 : 1, 0, 100.0f * intensity, 0, 0);
|
||||
}
|
||||
|
@ -1493,8 +1499,10 @@ void RTCWVR_Init()
|
|||
vr_weapon_pitchadjust = Cvar_Get( "vr_weapon_pitchadjust", "-20.0", CVAR_ARCHIVE);
|
||||
vr_lasersight = Cvar_Get( "vr_lasersight", "0", CVAR_ARCHIVE);
|
||||
vr_teleport = Cvar_Get( "vr_teleport", "0", CVAR_ARCHIVE);
|
||||
vr_virtual_stock = Cvar_Get( "vr_virtual_stock", "0", CVAR_ARCHIVE);
|
||||
vr_comfort_vignette = Cvar_Get ("vr_comfort_vignette", "0.0", CVAR_ARCHIVE);
|
||||
vr_virtual_stock = Cvar_Get( "vr_virtual_stock", "0", CVAR_ARCHIVE);
|
||||
vr_comfort_vignette = Cvar_Get ("vr_comfort_vignette", "0.0", CVAR_ARCHIVE);
|
||||
vr_gesture_triggered_use = Cvar_Get ("vr_gesture_triggered_use", "1", CVAR_ARCHIVE);
|
||||
vr_use_gesture_boundary = Cvar_Get ("vr_use_gesture_boundary", "0.35", CVAR_ARCHIVE);
|
||||
|
||||
//Defaults
|
||||
vr_control_scheme = Cvar_Get( "vr_control_scheme", "0", CVAR_ARCHIVE);
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
#define NUM_WEAPON_SAMPLES 10
|
||||
#define WEAPON_RECOIL 15.0f;
|
||||
|
||||
#define USE_GESTURE_OFF_HAND 1
|
||||
#define USE_GESTURE_WEAPON_HAND 2
|
||||
|
||||
typedef struct {
|
||||
qboolean screen;
|
||||
float fov;
|
||||
|
@ -29,6 +32,7 @@ typedef struct {
|
|||
vec3_t weaponangles;
|
||||
vec3_t weaponangles_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t weaponangles_delta;
|
||||
vec3_t dominanthandangles;
|
||||
|
||||
float weapon_recoil; // recoil effect to improve the default
|
||||
|
||||
|
@ -69,7 +73,7 @@ typedef struct {
|
|||
vec3_t teleportdest; // teleport destination
|
||||
qboolean teleportexecute; // execute the teleport
|
||||
|
||||
|
||||
int useGestureState;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Test stuff for weapon alignment
|
||||
|
|
|
@ -13,4 +13,6 @@ cvar_t *vr_comfort_vignette;
|
|||
cvar_t *vr_switch_sticks;
|
||||
cvar_t *vr_cinematic_stereo;
|
||||
cvar_t *vr_screen_dist;
|
||||
cvar_t *vr_gesture_triggered_use;
|
||||
cvar_t *vr_use_gesture_boundary;
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ inline float clamp(float _min, float _val, float _max)
|
|||
|
||||
void interactWithTouchScreen(float menuYaw, vec3_t controllerAngles) {
|
||||
float cursorX = -sinf(DEG2RAD(controllerAngles[YAW] - menuYaw)) + 0.5f;
|
||||
float cursorY = (float)(controllerAngles[PITCH] / 90.0) + 0.5f;
|
||||
float cursorY = (float)((controllerAngles[PITCH] - 15) / 90.0) + 0.5f;
|
||||
|
||||
PortableMouseAbs(cursorX, cursorY);
|
||||
}
|
|
@ -107,6 +107,8 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
{
|
||||
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
vec3_t rotation = {0};
|
||||
rotation[PITCH] = -25;
|
||||
QuatToYawPitchRoll(pDominantTracking->HeadPose.Pose.Orientation, rotation, vr.dominanthandangles);
|
||||
rotation[PITCH] = 30;
|
||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles_knife);
|
||||
rotation[PITCH] = vr_weapon_pitchadjust->value +
|
||||
|
@ -122,7 +124,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
|
||||
//GB Also set offhand angles just in case we want to use those.
|
||||
vec3_t rotation_off = {0};
|
||||
rotation_off[PITCH] = vr_weapon_pitchadjust->value;
|
||||
rotation_off[PITCH] = -25;
|
||||
QuatToYawPitchRoll(pOff->HeadPose.Pose.Orientation, rotation_off, vr.offhandangles);
|
||||
|
||||
VectorSubtract(vr.offhandangles_last, vr.offhandangles, vr.offhandangles_delta);
|
||||
|
@ -146,7 +148,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
switchedMenuControls = !switchedMenuControls;
|
||||
}
|
||||
} else {
|
||||
interactWithTouchScreen(menuYaw, vr.weaponangles);
|
||||
interactWithTouchScreen(menuYaw, vr.dominanthandangles);
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, domButton1, K_MOUSE1);
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, ovrButton_Trigger, K_MOUSE1);
|
||||
handleTrackedControllerButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, domButton2, K_ESCAPE);
|
||||
|
@ -368,6 +370,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
vr.offhandoffset[2] = pOff->HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
|
||||
vec3_t rotation = {0};
|
||||
rotation[PITCH] = -25;
|
||||
QuatToYawPitchRoll(pOff->HeadPose.Pose.Orientation, rotation, vr.offhandangles);
|
||||
|
||||
if (vr_walkdirection->value == 0) {
|
||||
|
@ -812,6 +815,46 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
updateScopeAngles();
|
||||
}
|
||||
|
||||
// Process "use" gesture
|
||||
if (vr_gesture_triggered_use->integer) {
|
||||
int thirdPersonActive = Cvar_VariableIntegerValue("cg_thirdPerson");
|
||||
bool gestureUseAllowed = !vr.weapon_stabilised && !vr.mountedgun && !vr.scopeengaged && !thirdPersonActive;
|
||||
// Off-hand gesture
|
||||
float distanceToBody = sqrt(vr.offhandoffset[0]*vr.offhandoffset[0] + vr.offhandoffset[2]*vr.offhandoffset[2]);
|
||||
if (gestureUseAllowed && (distanceToBody > vr_use_gesture_boundary->value)) {
|
||||
if (!(vr.useGestureState & USE_GESTURE_OFF_HAND)) {
|
||||
sendButtonAction("+activate2", true);
|
||||
}
|
||||
vr.useGestureState |= USE_GESTURE_OFF_HAND;
|
||||
} else {
|
||||
if (vr.useGestureState & USE_GESTURE_OFF_HAND) {
|
||||
sendButtonAction("+activate2", false);
|
||||
}
|
||||
vr.useGestureState &= ~USE_GESTURE_OFF_HAND;
|
||||
}
|
||||
// Weapon-hand gesture
|
||||
distanceToBody = sqrt(vr.current_weaponoffset[0]*vr.current_weaponoffset[0] + vr.current_weaponoffset[2]*vr.current_weaponoffset[2]);
|
||||
if (gestureUseAllowed && (distanceToBody > vr_use_gesture_boundary->value)) {
|
||||
if (!(vr.useGestureState & USE_GESTURE_WEAPON_HAND)) {
|
||||
sendButtonAction("+activate", true);
|
||||
}
|
||||
vr.useGestureState |= USE_GESTURE_WEAPON_HAND;
|
||||
} else {
|
||||
if (vr.useGestureState & USE_GESTURE_WEAPON_HAND) {
|
||||
sendButtonAction("+activate", false);
|
||||
}
|
||||
vr.useGestureState &= ~USE_GESTURE_WEAPON_HAND;
|
||||
}
|
||||
} else {
|
||||
if (vr.useGestureState & USE_GESTURE_OFF_HAND) {
|
||||
sendButtonAction("+activate2", false);
|
||||
}
|
||||
if (vr.useGestureState & USE_GESTURE_WEAPON_HAND) {
|
||||
sendButtonAction("+activate", false);
|
||||
}
|
||||
vr.useGestureState = 0;
|
||||
}
|
||||
|
||||
//Save state
|
||||
rightTrackedRemoteState_old = rightTrackedRemoteState_new;
|
||||
leftTrackedRemoteState_old = leftTrackedRemoteState_new;
|
||||
|
|
|
@ -1473,6 +1473,8 @@ typedef struct {
|
|||
|
||||
// comfort vignette
|
||||
qhandle_t vignetteShader;
|
||||
// left hand
|
||||
qhandle_t handModel;
|
||||
|
||||
} cgMedia_t;
|
||||
|
||||
|
@ -2065,6 +2067,7 @@ void CG_AddViewWeapon( playerState_t *ps );
|
|||
void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent );
|
||||
void CG_DrawWeaponSelect( void );
|
||||
void CG_DrawHoldableSelect( void );
|
||||
void CG_AddViewHand( playerState_t *ps );
|
||||
|
||||
void CG_OutOfAmmoChange( void );
|
||||
void CG_HoldableUsedupChange( void ); //----(SA) added
|
||||
|
|
|
@ -1568,6 +1568,7 @@ static void CG_RegisterGraphics( void ) {
|
|||
cgs.media.selectCursor = trap_R_RegisterShaderNoMip( "ui/assets/selectcursor.tga" );
|
||||
|
||||
cgs.media.vignetteShader = trap_R_RegisterShaderNoMip( "gfx/vignette" );
|
||||
cgs.media.handModel = trap_R_RegisterModel("models/players/bj/hand.md3");
|
||||
|
||||
CG_LoadingString( " - game media done" );
|
||||
|
||||
|
|
|
@ -1606,6 +1606,9 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo
|
|||
|
||||
CG_AddViewWeapon( &cg.predictedPlayerState );
|
||||
|
||||
if (trap_Cvar_VariableIntegerValue("vr_gesture_triggered_use") && !cgVR->weapon_stabilised && !cg.renderingThirdPerson) {
|
||||
CG_AddViewHand( &cg.predictedPlayerState);
|
||||
}
|
||||
|
||||
DEBUGTIME
|
||||
|
||||
|
|
|
@ -2001,6 +2001,14 @@ void CG_CalculateVRWeaponPosition( int weaponNum, vec3_t origin, vec3_t angles )
|
|||
angles[YAW] += cg.refdefViewAngles[YAW] - cgVR->hmdorientation[YAW];
|
||||
}
|
||||
|
||||
void CG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles ) {
|
||||
convertFromVR(cgVR->offhandoffset, cg.refdef.vieworg, origin);
|
||||
origin[2] -= 64;
|
||||
origin[2] += (cgVR->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
|
||||
VectorCopy(cgVR->offhandangles, angles);
|
||||
angles[YAW] += cg.refdefViewAngles[YAW] - cgVR->hmdorientation[YAW];
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CG_CalculateWeaponPositionAndScale
|
||||
|
@ -3713,6 +3721,24 @@ void CG_AddViewWeapon( playerState_t *ps ) {
|
|||
cg.predictedPlayerEntity.lastWeaponClientFrame = cg.clientFrame;
|
||||
}
|
||||
|
||||
void CG_AddViewHand( playerState_t *ps ) {
|
||||
vec3_t end, forward, angles;
|
||||
refEntity_t handEnt;
|
||||
memset( &handEnt, 0, sizeof(refEntity_t) );
|
||||
CG_CalculateVROffHandPosition( handEnt.origin, angles );
|
||||
|
||||
vec3_t axis[3];
|
||||
AnglesToAxis(angles, handEnt.axis);
|
||||
for ( int i = 0; i < 3; i++ ) {
|
||||
VectorScale( handEnt.axis[i], (cgVR->right_handed || i != 1) ? 1.0f : -1.0f, handEnt.axis[i] );
|
||||
}
|
||||
|
||||
handEnt.renderfx = RF_DEPTHHACK; //| RF_VRVIEWMODEL;
|
||||
handEnt.hModel = cgs.media.handModel;
|
||||
|
||||
trap_R_AddRefEntityToScene( &handEnt );
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
|
|
|
@ -337,10 +337,10 @@ void IN_LeanLeftDown( void ) { IN_KeyDown( &kb[KB_WBUTTONS4] ); } //----(S
|
|||
void IN_LeanLeftUp( void ) { IN_KeyUp( &kb[KB_WBUTTONS4] ); }
|
||||
void IN_LeanRightDown( void ) { IN_KeyDown( &kb[KB_WBUTTONS5] ); } //----(SA) lean right
|
||||
void IN_LeanRightUp( void ) { IN_KeyUp( &kb[KB_WBUTTONS5] ); }
|
||||
void IN_Activate2Down( void ) {IN_KeyDown( &kb[KB_WBUTTONS6] );}
|
||||
void IN_Activate2Up( void ) {IN_KeyUp( &kb[KB_WBUTTONS6] );}
|
||||
|
||||
// unused
|
||||
void IN_Wbutton6Down( void ) { IN_KeyDown( &kb[KB_WBUTTONS6] ); }
|
||||
void IN_Wbutton6Up( void ) { IN_KeyUp( &kb[KB_WBUTTONS6] ); }
|
||||
void IN_Wbutton7Down( void ) { IN_KeyDown( &kb[KB_WBUTTONS7] ); }
|
||||
void IN_Wbutton7Up( void ) { IN_KeyUp( &kb[KB_WBUTTONS7] ); }
|
||||
|
||||
|
@ -491,7 +491,7 @@ void CL_KeyMove( usercmd_t *cmd ) {
|
|||
side -= movespeed * CL_KeyState( &kb[KB_MOVELEFT] );
|
||||
|
||||
//----(SA) added
|
||||
if ( cmd->buttons & BUTTON_ACTIVATE ) {
|
||||
if ( (cmd->buttons & BUTTON_ACTIVATE) || (cmd->wbuttons & WBUTTON_ACTIVATE2) ) {
|
||||
if ( side > 0 ) {
|
||||
cmd->wbuttons |= WBUTTON_LEANRIGHT;
|
||||
} else if ( side < 0 ) {
|
||||
|
@ -1227,8 +1227,8 @@ void CL_InitInput( void ) {
|
|||
Cmd_AddCommand( "-leanleft", IN_LeanLeftUp );
|
||||
Cmd_AddCommand( "+leanright", IN_LeanRightDown );
|
||||
Cmd_AddCommand( "-leanright", IN_LeanRightUp );
|
||||
Cmd_AddCommand( "+wbutton6", IN_Wbutton6Down ); //
|
||||
Cmd_AddCommand( "-wbutton6", IN_Wbutton6Up );
|
||||
Cmd_AddCommand( "+activate2", IN_Activate2Down );
|
||||
Cmd_AddCommand( "-activate2", IN_Activate2Up );
|
||||
Cmd_AddCommand( "+wbutton7", IN_Wbutton7Down ); //
|
||||
Cmd_AddCommand( "-wbutton7", IN_Wbutton7Up );
|
||||
//----(SA) end
|
||||
|
|
|
@ -1295,9 +1295,9 @@ typedef struct playerState_s {
|
|||
#define WBUTTON_RELOAD 8
|
||||
#define WBUTTON_LEANLEFT 16
|
||||
#define WBUTTON_LEANRIGHT 32
|
||||
#define WBUTTON_ACTIVATE2 64
|
||||
|
||||
// unused
|
||||
#define WBUTTON_EXTRA6 64
|
||||
#define WBUTTON_EXTRA7 128
|
||||
//----(SA) end
|
||||
|
||||
|
|
|
@ -540,6 +540,9 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) {
|
|||
if ( client->latched_buttons & BUTTON_ACTIVATE ) {
|
||||
Cmd_Activate_f( ent );
|
||||
}
|
||||
if ( client->latched_wbuttons & WBUTTON_ACTIVATE2 ) {
|
||||
Cmd_Activate2_f( ent );
|
||||
}
|
||||
|
||||
// save results of pmove
|
||||
VectorCopy( client->ps.origin, ent->s.origin );
|
||||
|
@ -1511,6 +1514,9 @@ void ClientThink_real( gentity_t *ent ) {
|
|||
if ( client->latched_buttons & BUTTON_ACTIVATE ) {
|
||||
Cmd_Activate_f( ent );
|
||||
}
|
||||
if ( client->latched_wbuttons & WBUTTON_ACTIVATE2 ) {
|
||||
Cmd_Activate2_f( ent );
|
||||
}
|
||||
|
||||
if ( ent->flags & FL_NOFATIGUE ) {
|
||||
ent->client->ps.sprintTime = 20000;
|
||||
|
|
|
@ -163,8 +163,8 @@ void alarmbox_use( gentity_t *ent, gentity_t *other, gentity_t *foo ) {
|
|||
alarmbox_updateparts( ent, qtrue );
|
||||
if ( other->client ) {
|
||||
G_AddEvent( ent, EV_GENERAL_SOUND, ent->soundPos3 );
|
||||
//TODO GB Add heartbeat
|
||||
trap_Haptic(1, 0, 1.0f, "alarm_on", 0.0f, 0.0f);
|
||||
// Replaced by "use trigger" haptics
|
||||
//trap_Haptic(1, 0, 1.0f, "alarm_on", 0.0f, 0.0f);
|
||||
}
|
||||
// G_Printf("touched alarmbox\n");
|
||||
|
||||
|
@ -185,7 +185,8 @@ void alarmbox_die( gentity_t *ent, gentity_t *inflictor, gentity_t *attacker, in
|
|||
ent->takedamage = qfalse;
|
||||
alarmbox_updateparts( ent, qtrue );
|
||||
|
||||
trap_Haptic(1, 0, 1.0f, "end_alarm", 0.0f, 0.0f);
|
||||
// Replaced by "use trigger" haptics
|
||||
//trap_Haptic(1, 0, 1.0f, "end_alarm", 0.0f, 0.0f);
|
||||
|
||||
// fire 'death' targets
|
||||
if ( ent->targetdeath ) {
|
||||
|
|
|
@ -1366,10 +1366,36 @@ Cmd_Activate_f
|
|||
==================
|
||||
*/
|
||||
void Cmd_Activate_f( gentity_t *ent ) {
|
||||
vec3_t forward, right, up, offset, end;
|
||||
|
||||
if (ent->s.number == 0 && trap_Cvar_VariableIntegerValue("vr_gesture_triggered_use")) {
|
||||
CalcMuzzlePointForHandActivate(ent, qfalse, offset, forward, end);
|
||||
Cmd_ActivateInternal_f(ent, offset, forward, end, qfalse);
|
||||
} else {
|
||||
AngleVectors( ent->client->ps.viewangles, forward, right, up );
|
||||
CalcMuzzlePointForActivate( ent, forward, right, up, offset );
|
||||
VectorMA( offset, 96, forward, end );
|
||||
Cmd_ActivateInternal_f(ent, offset, forward, end, qfalse);
|
||||
}
|
||||
}
|
||||
|
||||
void Cmd_Activate2_f( gentity_t *ent ) {
|
||||
vec3_t forward, right, up, offset, end;
|
||||
|
||||
if (ent->s.number == 0 && trap_Cvar_VariableIntegerValue("vr_gesture_triggered_use")) {
|
||||
CalcMuzzlePointForHandActivate(ent, qtrue, offset, forward, end);
|
||||
Cmd_ActivateInternal_f(ent, offset, forward, end, qtrue);
|
||||
} else {
|
||||
AngleVectors( ent->client->ps.viewangles, forward, right, up );
|
||||
CalcMuzzlePointForActivate( ent, forward, right, up, offset );
|
||||
VectorMA( offset, 96, forward, end );
|
||||
Cmd_ActivateInternal_f(ent, offset, forward, end, qfalse);
|
||||
}
|
||||
}
|
||||
|
||||
void Cmd_ActivateInternal_f( gentity_t *ent, vec3_t offset, vec3_t forward, vec3_t end, qboolean offhand ) {
|
||||
trace_t tr;
|
||||
vec3_t end;
|
||||
gentity_t *traceEnt;
|
||||
vec3_t forward, right, up, offset;
|
||||
static int oldactivatetime = 0;
|
||||
int activatetime = level.time;
|
||||
qboolean walking = qfalse;
|
||||
|
@ -1378,12 +1404,6 @@ void Cmd_Activate_f( gentity_t *ent ) {
|
|||
walking = qtrue;
|
||||
}
|
||||
|
||||
AngleVectors( ent->client->ps.viewangles, forward, right, up );
|
||||
|
||||
CalcMuzzlePointForActivate( ent, forward, right, up, offset );
|
||||
|
||||
VectorMA( offset, 96, forward, end );
|
||||
|
||||
trap_Trace( &tr, offset, NULL, NULL, end, ent->s.number, ( CONTENTS_SOLID | CONTENTS_BODY | CONTENTS_CORPSE | CONTENTS_TRIGGER ) );
|
||||
|
||||
//----(SA) removed erroneous code
|
||||
|
@ -1395,9 +1415,15 @@ void Cmd_Activate_f( gentity_t *ent ) {
|
|||
traceEnt = &g_entities[ tr.entityNum ];
|
||||
|
||||
// G_Printf( "%s activate %s\n", ent->classname, traceEnt->classname);
|
||||
int controlScheme = trap_Cvar_VariableIntegerValue("vr_control_scheme");
|
||||
qboolean rightHanded = controlScheme < 10 || controlScheme == 99;
|
||||
int hapticChannel = offhand ? (rightHanded ? 0 : 1) : (rightHanded ? 1 : 0);
|
||||
|
||||
// Ridah, check for using a friendly AI
|
||||
if ( traceEnt->aiCharacter ) {
|
||||
if (ent->s.number == 0) {
|
||||
trap_Vibrate(1, hapticChannel, 0.5f, "use_trigger", 0, 0);
|
||||
}
|
||||
AICast_Activate( ent->s.number, traceEnt->s.number );
|
||||
return;
|
||||
}
|
||||
|
@ -1411,11 +1437,17 @@ void Cmd_Activate_f( gentity_t *ent ) {
|
|||
if ( walking || 1 == 1) {
|
||||
traceEnt->flags |= FL_SOFTACTIVATE; // no noise
|
||||
}
|
||||
if (ent->s.number == 0) {
|
||||
trap_Vibrate(1, hapticChannel, 0.5f, "use_trigger", 0, 0);
|
||||
}
|
||||
G_TryDoor( traceEnt, ent, ent ); // (door,other,activator)
|
||||
//----(SA) end
|
||||
} else if ( ( Q_stricmp( traceEnt->classname, "func_button" ) == 0 )
|
||||
&& ( traceEnt->s.apos.trType == TR_STATIONARY && traceEnt->s.pos.trType == TR_STATIONARY )
|
||||
&& traceEnt->active == qfalse ) {
|
||||
if (ent->s.number == 0) {
|
||||
trap_Vibrate(1, hapticChannel, 0.5f, "use_trigger", 0, 0);
|
||||
}
|
||||
G_TryDoor( traceEnt, ent, ent ); // (door,other,activator)
|
||||
// Use_BinaryMover (traceEnt, ent, ent);
|
||||
// traceEnt->active = qtrue;
|
||||
|
@ -1423,10 +1455,19 @@ void Cmd_Activate_f( gentity_t *ent ) {
|
|||
if ( walking || 1 == 1) {
|
||||
traceEnt->flags |= FL_SOFTACTIVATE; // no noise
|
||||
}
|
||||
if (ent->s.number == 0) {
|
||||
trap_Vibrate(1, hapticChannel, 0.5f, "use_trigger", 0, 0);
|
||||
}
|
||||
traceEnt->use( traceEnt, ent, ent );
|
||||
} else if ( !Q_stricmp( traceEnt->classname, "props_footlocker" ) ) {
|
||||
if (ent->s.number == 0) {
|
||||
trap_Vibrate(1, hapticChannel, 0.5f, "use_trigger", 0, 0);
|
||||
}
|
||||
traceEnt->use( traceEnt, ent, ent );
|
||||
} else if ( !Q_stricmp( traceEnt->classname, "script_mover" ) ) {
|
||||
if (ent->s.number == 0) {
|
||||
trap_Vibrate(1, hapticChannel, 0.5f, "use_trigger", 0, 0);
|
||||
}
|
||||
G_Script_ScriptEvent( traceEnt, "activate", ent->aiName );
|
||||
} else if ( traceEnt->s.eType == ET_ALARMBOX ) {
|
||||
trace_t trace;
|
||||
|
@ -1438,6 +1479,9 @@ void Cmd_Activate_f( gentity_t *ent ) {
|
|||
memset( &trace, 0, sizeof( trace ) );
|
||||
|
||||
if ( traceEnt->use ) {
|
||||
if (ent->s.number == 0) {
|
||||
trap_Vibrate(1, hapticChannel, 0.5f, "use_trigger", 0, 0);
|
||||
}
|
||||
traceEnt->use( traceEnt, ent, 0 );
|
||||
}
|
||||
} else if ( traceEnt->s.eType == ET_ITEM ) {
|
||||
|
@ -1453,6 +1497,9 @@ void Cmd_Activate_f( gentity_t *ent ) {
|
|||
if ( ent->client->pers.autoActivate == PICKUP_ACTIVATE ) {
|
||||
ent->client->pers.autoActivate = PICKUP_FORCE; //----(SA) force the pickup of a normally autoactivate only item
|
||||
}
|
||||
if (ent->s.number == 0) {
|
||||
trap_Vibrate(1, hapticChannel, 0.5f, "use_trigger", 0, 0);
|
||||
}
|
||||
traceEnt->active = qtrue;
|
||||
traceEnt->touch( traceEnt, ent, &trace );
|
||||
}
|
||||
|
@ -1489,6 +1536,9 @@ void Cmd_Activate_f( gentity_t *ent ) {
|
|||
VectorCopy( traceEnt->s.angles, traceEnt->TargetAngles );
|
||||
|
||||
if ( !( ent->r.svFlags & SVF_CASTAI ) ) {
|
||||
if (ent->s.number == 0) {
|
||||
trap_Vibrate(1, hapticChannel, 0.5f, "use_trigger", 0, 0);
|
||||
}
|
||||
G_UseTargets( traceEnt, ent ); //----(SA) added for Mike so mounting an MG42 can be a trigger event (let me know if there's any issues with this)
|
||||
|
||||
}
|
||||
|
|
|
@ -1108,6 +1108,7 @@ extern void Cmd_ClientDamage_f ( gentity_t * clent ) ;
|
|||
extern void ClientDamage ( gentity_t * clent , int entnum , int enemynum , int id ) ;
|
||||
extern int Cmd_WolfKick_f ( gentity_t * ent ) ;
|
||||
extern void Cmd_Activate_f ( gentity_t * ent ) ;
|
||||
extern void Cmd_Activate2_f ( gentity_t * ent ) ;
|
||||
extern qboolean G_ThrowChair ( gentity_t * ent , vec3_t dir , qboolean force ) ;
|
||||
extern void Cmd_InterruptCamera_f ( gentity_t * ent ) ;
|
||||
extern void Cmd_SetCameraOrigin_f ( gentity_t * ent ) ;
|
||||
|
|
|
@ -1108,6 +1108,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
{"ClientDamage", (byte *)ClientDamage},
|
||||
{"Cmd_WolfKick_f", (byte *)Cmd_WolfKick_f},
|
||||
{"Cmd_Activate_f", (byte *)Cmd_Activate_f},
|
||||
{"Cmd_Activate2_f", (byte *)Cmd_Activate2_f},
|
||||
{"G_ThrowChair", (byte *)G_ThrowChair},
|
||||
{"Cmd_InterruptCamera_f", (byte *)Cmd_InterruptCamera_f},
|
||||
{"Cmd_SetCameraOrigin_f", (byte *)Cmd_SetCameraOrigin_f},
|
||||
|
|
|
@ -916,6 +916,7 @@ void CalcMuzzlePoints( gentity_t *ent, int weapon );
|
|||
|
||||
// Rafael - for activate
|
||||
void CalcMuzzlePointForActivate( gentity_t *ent, vec3_t forward, vec3_t right, vec3_t up, vec3_t muzzlePoint );
|
||||
void CalcMuzzlePointForHandActivate( gentity_t *ent, qboolean offHand, vec3_t offset, vec3_t forward, vec3_t end );
|
||||
// done.
|
||||
|
||||
//
|
||||
|
@ -1052,6 +1053,8 @@ void BotTestAAS( vec3_t origin );
|
|||
|
||||
// g_cmd.c
|
||||
void Cmd_Activate_f( gentity_t *ent );
|
||||
void Cmd_Activate2_f( gentity_t *ent );
|
||||
void Cmd_ActivateInternal_f( gentity_t *ent, vec3_t offset, vec3_t forward, vec3_t end, qboolean offhand );
|
||||
int Cmd_WolfKick_f( gentity_t *ent );
|
||||
// Ridah
|
||||
|
||||
|
|
|
@ -2212,11 +2212,13 @@ void G_TryDoor( gentity_t *ent, gentity_t *other, gentity_t *activator ) {
|
|||
ent->active = qtrue;
|
||||
if ( walking || 1 == 1) {
|
||||
ent->flags |= FL_SOFTACTIVATE; // no noise
|
||||
if(gVR)
|
||||
trap_Vibrate(1, gVR->right_handed ? 0 : 1, 0.3f, "door_open", 0, 0); //I've reversed the hands as I presume you will open it with the hand your gun isn't in.
|
||||
// Replaced by "use trigger" haptics
|
||||
//if(gVR)
|
||||
// trap_Vibrate(1, gVR->right_handed ? 0 : 1, 0.3f, "door_open", 0, 0); //I've reversed the hands as I presume you will open it with the hand your gun isn't in.
|
||||
} else {
|
||||
if(gVR)
|
||||
trap_Vibrate(1, gVR->right_handed ? 0 : 1, 0.5f, "door_open", 0, 0); //I've reversed the hands as I presume you will open it with the hand your gun isn't in.
|
||||
// Replaced by "use trigger" haptics
|
||||
//if(gVR)
|
||||
// trap_Vibrate(1, gVR->right_handed ? 0 : 1, 0.5f, "door_open", 0, 0); //I've reversed the hands as I presume you will open it with the hand your gun isn't in.
|
||||
if ( activator ) {
|
||||
soundrange = HEAR_RANGE_DOOR_OPEN;
|
||||
}
|
||||
|
|
|
@ -1816,6 +1816,32 @@ void CalcMuzzlePointForActivate( gentity_t *ent, vec3_t forward, vec3_t right, v
|
|||
// done.
|
||||
|
||||
|
||||
|
||||
void CalcMuzzlePointForHandActivate( gentity_t *ent, qboolean offHand, vec3_t offset, vec3_t forward, vec3_t end ) {
|
||||
vec3_t angles, right, up;
|
||||
if (gVR != NULL)
|
||||
{
|
||||
float worldscale = 0;
|
||||
trap_Cvar_VariableValue("cg_worldScale", &worldscale);
|
||||
float heightAdjust = 0;
|
||||
trap_Cvar_VariableValue("cg_heightAdjust", &heightAdjust);
|
||||
if (offHand) {
|
||||
convertFromVR(worldscale, ent, gVR->offhandoffset, ent->r.currentOrigin, offset);
|
||||
VectorCopy(gVR->offhandangles, angles);
|
||||
} else {
|
||||
convertFromVR(worldscale, ent, gVR->calculated_weaponoffset, ent->r.currentOrigin, offset);
|
||||
VectorCopy(gVR->dominanthandangles, angles);
|
||||
}
|
||||
offset[2] -= 24;
|
||||
offset[2] += (gVR->hmdposition[1] + heightAdjust) * worldscale;
|
||||
angles[YAW] += ent->client->ps.viewangles[YAW] - gVR->hmdorientation[YAW];
|
||||
AngleVectors( angles, forward, right, up );
|
||||
VectorMA( offset, 24, forward, end );
|
||||
// start trace between body and hand to avoid reaching through
|
||||
VectorMA( offset, -8, forward, offset );
|
||||
}
|
||||
}
|
||||
|
||||
// Ridah
|
||||
void CalcMuzzlePoints( gentity_t *ent, int weapon ) {
|
||||
vec3_t viewang;
|
||||
|
|
|
@ -1308,9 +1308,9 @@ typedef struct playerState_s {
|
|||
#define WBUTTON_RELOAD 8
|
||||
#define WBUTTON_LEANLEFT 16
|
||||
#define WBUTTON_LEANRIGHT 32
|
||||
#define WBUTTON_ACTIVATE2 64
|
||||
|
||||
// unused
|
||||
#define WBUTTON_EXTRA6 64
|
||||
#define WBUTTON_EXTRA7 128
|
||||
//----(SA) end
|
||||
|
||||
|
|
BIN
Projects/Android/z_vr_assets/models/players/bj/hand.jpg
Normal file
BIN
Projects/Android/z_vr_assets/models/players/bj/hand.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
BIN
Projects/Android/z_vr_assets/models/players/bj/hand.md3
Normal file
BIN
Projects/Android/z_vr_assets/models/players/bj/hand.md3
Normal file
Binary file not shown.
|
@ -362,6 +362,40 @@ itemDef
|
|||
visible 1
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name vr
|
||||
group grpControls
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Gesture Triggered Use: "
|
||||
cvar "vr_gesture_triggered_use"
|
||||
rect 82 240 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
textscale .23
|
||||
style WINDOW_STYLE_FILLED
|
||||
backcolor 1 1 1 .07
|
||||
forecolor 1 1 1 1
|
||||
visible 1
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name vr
|
||||
group grpControls
|
||||
type ITEM_TYPE_SLIDER
|
||||
text "Use Gesture Boundary:"
|
||||
cvarfloat "vr_use_gesture_boundary" 0 0.20 0.50
|
||||
rect 82 255 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
textscale .23
|
||||
style WINDOW_STYLE_FILLED
|
||||
backcolor 1 1 1 .07
|
||||
forecolor 1 1 1 1
|
||||
visible 1
|
||||
}
|
||||
|
||||
// TOOLS MESSAGE //
|
||||
|
||||
itemDef
|
||||
|
|
|
@ -335,6 +335,40 @@ itemDef
|
|||
visible 1
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name ingame_vr
|
||||
group grpControls
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Gesture Triggered Use: "
|
||||
cvar "vr_gesture_triggered_use"
|
||||
rect 82 240 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
textscale .23
|
||||
style WINDOW_STYLE_FILLED
|
||||
backcolor 1 1 1 .07
|
||||
forecolor 1 1 1 1
|
||||
visible 1
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name ingame_vr
|
||||
group grpControls
|
||||
type ITEM_TYPE_SLIDER
|
||||
text "Use Gesture Boundary:"
|
||||
cvarfloat "vr_use_gesture_boundary" 0 0.20 0.50
|
||||
rect 82 255 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
textscale .23
|
||||
style WINDOW_STYLE_FILLED
|
||||
backcolor 1 1 1 .07
|
||||
forecolor 1 1 1 1
|
||||
visible 1
|
||||
}
|
||||
|
||||
|
||||
itemDef {
|
||||
name yesno_message
|
||||
|
|
Loading…
Reference in a new issue