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;
}
}
else if (vr.misc_camera)
else if (vr.misc_camera && !vr.remote_droid)
{
if (between(-0.2f, primaryJoystickX, 0.2f)) {
sendButtonAction("+use", pPrimaryJoystick->y < -0.8f || pPrimaryJoystick->y > 0.8f);

View File

@ -280,7 +280,11 @@ void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity )
}
if ( !self->s.number )
{
CG_CenterPrint( "@VR_INGAME_EXIT_CAMERA_VIEW", SCREEN_HEIGHT * 0.95 );
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 );
}
}
}
@ -1462,7 +1466,7 @@ void G_TouchTriggersLerped( gentity_t *ent ) {
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 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 )
{

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 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 ) ) )
{ // 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.
@ -264,9 +264,9 @@ void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace )
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;
BG_CalculateVRWeaponPosition(origin, angles);
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
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 useGestureAllowed = useGestureEnabled && !thirdPersonActive;
bool useGestureAllowed = useGestureEnabled && !thirdPersonActive && !vr->remote_droid;
float useOffset = useGestureAllowed ? USE_OFFSET : 0.0f;
float useDistance = useGestureAllowed ? USE_DISTANCE_GESTURE : USE_DISTANCE_BUTTON;
VectorMA( src, useOffset, vf, src );
@ -1881,7 +1881,7 @@ void TryUse( gentity_t *ent ) {
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
vec3_t src, angles, vf;
if (ent->client->ps.clientNum == 0) {
if (ent->client->ps.clientNum == 0 && !(vr && vr->remote_droid)) {
if (thirdPersonActive) {
VectorCopy(ent->currentOrigin, src);
AngleVectors(ent->currentAngles, vf, NULL, NULL);

View File

@ -237,7 +237,11 @@ void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity )
}
if ( !self->s.number )
{
CG_CenterPrint( "@VR_INGAME_EXIT_CAMERA_VIEW", SCREEN_HEIGHT * 0.95 );
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 );
}
}
}
@ -924,7 +928,7 @@ void G_TouchTriggersLerped( gentity_t *ent ) {
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 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 )
{

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 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 ) ) )
{ // 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.
@ -234,9 +234,9 @@ void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace )
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;
BG_CalculateVRWeaponPosition(origin, angles);
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
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 useGestureAllowed = useGestureEnabled && !thirdPersonActive;
bool useGestureAllowed = useGestureEnabled && !thirdPersonActive && !vr->remote_droid;
float useOffset = useGestureAllowed ? USE_OFFSET : 0.0f;
float useDistance = useGestureAllowed ? USE_DISTANCE_GESTURE : USE_DISTANCE_BUTTON;
VectorMA( src, useOffset, vf, src );
@ -1627,7 +1627,7 @@ void TryUse( gentity_t *ent ) {
bool thirdPersonActive = gi.cvar("cg_thirdPerson", "0", CVAR_TEMP)->integer;
vec3_t src, angles, vf;
if (ent->client->ps.clientNum == 0) {
if (ent->client->ps.clientNum == 0 && !(vr && vr->remote_droid)) {
if (thirdPersonActive) {
VectorCopy(ent->currentOrigin, src);
AngleVectors(ent->currentAngles, vf, NULL, NULL);

View File

@ -16,4 +16,7 @@ FILENOTES ""
REFERENCE EXIT_CAMERA_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

View File

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

View File

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

View File

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

View File

@ -3,9 +3,14 @@ CONFIG W:\bin\striped.cfg
ID 999
REFERENCE VR_INGAME
DESCRIPTION "customized in game text for VR port"
COUNT 1
COUNT 2
INDEX 0
{
REFERENCE EXIT_CAMERA_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."
}