Fix use action when controlling droid; fix droid view help

This commit is contained in:
Petr Bartos 2023-04-12 22:26:44 +02:00
parent b9d0314a6a
commit 7680cb1288
12 changed files with 44 additions and 16 deletions

View file

@ -346,7 +346,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
pOffTrackedRemoteOld->Buttons |= xrButton_Trigger; pOffTrackedRemoteOld->Buttons |= xrButton_Trigger;
} }
} }
else if (vr.misc_camera) else if (vr.misc_camera && !vr.remote_droid)
{ {
if (between(-0.2f, primaryJoystickX, 0.2f)) { if (between(-0.2f, primaryJoystickX, 0.2f)) {
sendButtonAction("+use", pPrimaryJoystick->y < -0.8f || pPrimaryJoystick->y > 0.8f); sendButtonAction("+use", pPrimaryJoystick->y < -0.8f || pPrimaryJoystick->y > 0.8f);

View file

@ -280,8 +280,12 @@ void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity )
} }
if ( !self->s.number ) if ( !self->s.number )
{ {
if (viewEntity->client && viewEntity->client->NPC_class == CLASS_MOUSE) {
CG_CenterPrint( "@VR_INGAME_EXIT_DROID_VIEW", SCREEN_HEIGHT * 0.95 );
} else {
CG_CenterPrint( "@VR_INGAME_EXIT_CAMERA_VIEW", SCREEN_HEIGHT * 0.95 ); CG_CenterPrint( "@VR_INGAME_EXIT_CAMERA_VIEW", SCREEN_HEIGHT * 0.95 );
} }
}
} }
qboolean G_ControlledByPlayer( gentity_t *self ) qboolean G_ControlledByPlayer( gentity_t *self )
@ -1462,7 +1466,7 @@ void G_TouchTriggersLerped( gentity_t *ent ) {
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer; bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h
bool useGestureAllowed = useGestureEnabled && !thirdPersonActive; bool useGestureAllowed = useGestureEnabled && !thirdPersonActive && !(vr && vr->remote_droid);
for ( curDist = 0; !done && ent->maxs[1]>0; curDist += (float)ent->maxs[1]/2.0f ) for ( curDist = 0; !done && ent->maxs[1]>0; curDist += (float)ent->maxs[1]/2.0f )
{ {

View file

@ -256,7 +256,7 @@ void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace )
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer; bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h
bool useGestureAllowed = useGestureEnabled && !thirdPersonActive; bool useGestureAllowed = useGestureEnabled && !thirdPersonActive && !vr->remote_droid;
if ( (self->spawnflags & 2) && ( !( self->spawnflags & 4 ) || ( ( self->spawnflags & 4) && !useGestureAllowed ) ) ) if ( (self->spawnflags & 2) && ( !( self->spawnflags & 4 ) || ( ( self->spawnflags & 4) && !useGestureAllowed ) ) )
{ // FACING and... ...is not USE_BUTTON or... ...is USE_BUTTON but use gestures are not active { // FACING and... ...is not USE_BUTTON or... ...is USE_BUTTON but use gestures are not active
// In case of buttons activated by use gesture, we do not need to check if we are facing them as we are touching them by hand. // In case of buttons activated by use gesture, we do not need to check if we are facing them as we are touching them by hand.
@ -264,9 +264,9 @@ void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace )
if ( other->client ) if ( other->client )
{ {
if ( (other->client->ps.clientNum == 0) && (self->spawnflags & 4) && !thirdPersonActive ) if ( (other->client->ps.clientNum == 0) && (self->spawnflags & 4) && !thirdPersonActive && !vr->remote_droid )
{ {
// In case of USE_BUTTON, check facing by controller and not by head (if not in 3rd person) // In case of USE_BUTTON, check facing by controller and not by head (if not in 3rd person or controlling droid)
vec3_t origin, angles; vec3_t origin, angles;
BG_CalculateVRWeaponPosition(origin, angles); BG_CalculateVRWeaponPosition(origin, angles);
AngleVectors( angles, forward, NULL, NULL ); AngleVectors( angles, forward, NULL, NULL );

View file

@ -1784,7 +1784,7 @@ void TryUse_Internal( bool offHand, gentity_t *ent, vec3_t src, vec3_t vf )
//extend to find end of use trace //extend to find end of use trace
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer; bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h
bool useGestureAllowed = useGestureEnabled && !thirdPersonActive; bool useGestureAllowed = useGestureEnabled && !thirdPersonActive && !vr->remote_droid;
float useOffset = useGestureAllowed ? USE_OFFSET : 0.0f; float useOffset = useGestureAllowed ? USE_OFFSET : 0.0f;
float useDistance = useGestureAllowed ? USE_DISTANCE_GESTURE : USE_DISTANCE_BUTTON; float useDistance = useGestureAllowed ? USE_DISTANCE_GESTURE : USE_DISTANCE_BUTTON;
VectorMA( src, useOffset, vf, src ); VectorMA( src, useOffset, vf, src );
@ -1881,7 +1881,7 @@ void TryUse( gentity_t *ent ) {
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer; bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
vec3_t src, angles, vf; vec3_t src, angles, vf;
if (ent->client->ps.clientNum == 0) { if (ent->client->ps.clientNum == 0 && !(vr && vr->remote_droid)) {
if (thirdPersonActive) { if (thirdPersonActive) {
VectorCopy(ent->currentOrigin, src); VectorCopy(ent->currentOrigin, src);
AngleVectors(ent->currentAngles, vf, NULL, NULL); AngleVectors(ent->currentAngles, vf, NULL, NULL);

View file

@ -237,8 +237,12 @@ void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity )
} }
if ( !self->s.number ) if ( !self->s.number )
{ {
if (viewEntity->client && viewEntity->client->NPC_class == CLASS_MOUSE) {
CG_CenterPrint( "@VR_INGAME_EXIT_DROID_VIEW", SCREEN_HEIGHT * 0.95 );
} else {
CG_CenterPrint( "@VR_INGAME_EXIT_CAMERA_VIEW", SCREEN_HEIGHT * 0.95 ); CG_CenterPrint( "@VR_INGAME_EXIT_CAMERA_VIEW", SCREEN_HEIGHT * 0.95 );
} }
}
} }
qboolean G_ControlledByPlayer( gentity_t *self ) qboolean G_ControlledByPlayer( gentity_t *self )
@ -924,7 +928,7 @@ void G_TouchTriggersLerped( gentity_t *ent ) {
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer; bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h
bool useGestureAllowed = useGestureEnabled && !thirdPersonActive; bool useGestureAllowed = useGestureEnabled && !thirdPersonActive && !(vr && vr->remote_droid);
for ( curDist = 0; !done && ent->maxs[1]>0; curDist += (float)ent->maxs[1]/2.0f ) for ( curDist = 0; !done && ent->maxs[1]>0; curDist += (float)ent->maxs[1]/2.0f )
{ {

View file

@ -226,7 +226,7 @@ void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace )
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer; bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h
bool useGestureAllowed = useGestureEnabled && !thirdPersonActive; bool useGestureAllowed = useGestureEnabled && !thirdPersonActive && !vr->remote_droid;
if ( (self->spawnflags & 2) && ( !( self->spawnflags & 4 ) || ( ( self->spawnflags & 4) && !useGestureAllowed ) ) ) if ( (self->spawnflags & 2) && ( !( self->spawnflags & 4 ) || ( ( self->spawnflags & 4) && !useGestureAllowed ) ) )
{ // FACING and... ...is not USE_BUTTON or... ...is USE_BUTTON but use gestures are not active { // FACING and... ...is not USE_BUTTON or... ...is USE_BUTTON but use gestures are not active
// In case of buttons activated by use gesture, we do not need to check if we are facing them as we are touching them by hand. // In case of buttons activated by use gesture, we do not need to check if we are facing them as we are touching them by hand.
@ -234,9 +234,9 @@ void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace )
if ( other->client ) if ( other->client )
{ {
if ( (other->client->ps.clientNum == 0) && (self->spawnflags & 4) && !thirdPersonActive ) if ( (other->client->ps.clientNum == 0) && (self->spawnflags & 4) && !thirdPersonActive && !vr->remote_droid )
{ {
// In case of USE_BUTTON, check facing by controller and not by head (if not in 3rd person) // In case of USE_BUTTON, check facing by controller and not by head (if not in 3rd person or controlling droid)
vec3_t origin, angles; vec3_t origin, angles;
BG_CalculateVRWeaponPosition(origin, angles); BG_CalculateVRWeaponPosition(origin, angles);
AngleVectors( angles, forward, NULL, NULL ); AngleVectors( angles, forward, NULL, NULL );

View file

@ -1549,7 +1549,7 @@ void TryUse_Internal( bool offHand, gentity_t *ent, vec3_t src, vec3_t vf ) {
//extend to find end of use trace //extend to find end of use trace
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer; bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h bool useGestureEnabled = gi.cvar("vr_gesture_triggered_use", "1", CVAR_ARCHIVE)->integer; // defined in VrCvars.h
bool useGestureAllowed = useGestureEnabled && !thirdPersonActive; bool useGestureAllowed = useGestureEnabled && !thirdPersonActive && !vr->remote_droid;
float useOffset = useGestureAllowed ? USE_OFFSET : 0.0f; float useOffset = useGestureAllowed ? USE_OFFSET : 0.0f;
float useDistance = useGestureAllowed ? USE_DISTANCE_GESTURE : USE_DISTANCE_BUTTON; float useDistance = useGestureAllowed ? USE_DISTANCE_GESTURE : USE_DISTANCE_BUTTON;
VectorMA( src, useOffset, vf, src ); VectorMA( src, useOffset, vf, src );
@ -1627,7 +1627,7 @@ void TryUse( gentity_t *ent ) {
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer; bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
vec3_t src, angles, vf; vec3_t src, angles, vf;
if (ent->client->ps.clientNum == 0) { if (ent->client->ps.clientNum == 0 && !(vr && vr->remote_droid)) {
if (thirdPersonActive) { if (thirdPersonActive) {
VectorCopy(ent->currentOrigin, src); VectorCopy(ent->currentOrigin, src);
AngleVectors(ent->currentAngles, vf, NULL, NULL); AngleVectors(ent->currentAngles, vf, NULL, NULL);

View file

@ -16,4 +16,7 @@ FILENOTES ""
REFERENCE EXIT_CAMERA_VIEW REFERENCE EXIT_CAMERA_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view." LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view."
REFERENCE EXIT_DROID_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, press 'USE' to activate buttons."
ENDMARKER ENDMARKER

View file

@ -17,4 +17,8 @@ REFERENCE EXIT_CAMERA_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view." LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view."
LANG_FRENCH "#same" LANG_FRENCH "#same"
REFERENCE EXIT_DROID_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, press 'USE' to activate buttons."
LANG_FRENCH "#same"
ENDMARKER ENDMARKER

View file

@ -17,4 +17,8 @@ REFERENCE EXIT_CAMERA_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view." LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view."
LANG_GERMAN "#same" LANG_GERMAN "#same"
REFERENCE EXIT_DROID_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, press 'USE' to activate buttons."
LANG_GERMAN "#same"
ENDMARKER ENDMARKER

View file

@ -17,4 +17,8 @@ REFERENCE EXIT_CAMERA_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view." LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view."
LANG_SPANISH "#same" LANG_SPANISH "#same"
REFERENCE EXIT_DROID_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, press 'USE' to activate buttons."
LANG_SPANISH "#same"
ENDMARKER ENDMARKER

View file

@ -3,9 +3,14 @@ CONFIG W:\bin\striped.cfg
ID 999 ID 999
REFERENCE VR_INGAME REFERENCE VR_INGAME
DESCRIPTION "customized in game text for VR port" DESCRIPTION "customized in game text for VR port"
COUNT 1 COUNT 2
INDEX 0 INDEX 0
{ {
REFERENCE EXIT_CAMERA_VIEW REFERENCE EXIT_CAMERA_VIEW
TEXT_LANGUAGE1 "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view." TEXT_LANGUAGE1 "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view."
} }
INDEX 1
{
REFERENCE EXIT_DROID_VIEW
TEXT_LANGUAGE1 "Press 'JUMP' to exit, press 'USE' to activate buttons."
}