@MuadDib's Improve-security-camera-controls

This commit is contained in:
Simon 2023-03-05 08:51:50 +00:00
parent 5ba176fced
commit 9e00445947
11 changed files with 130 additions and 5 deletions

View file

@ -245,7 +245,13 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
sendButtonActionSimple("exitscope");
}
if (vr.cgzoommode)
if (vr.misc_camera)
{
if (between(-0.2f, primaryJoystickX, 0.2f)) {
sendButtonAction("+use", pPrimaryJoystick->y < -0.8f || pPrimaryJoystick->y > 0.8f);
}
}
else if (vr.cgzoommode)
{
if (between(-0.2f, primaryJoystickX, 0.2f)) {
if (vr.cgzoommode == 2)

View file

@ -279,7 +279,7 @@ void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity )
}
if ( !self->s.number )
{
CG_CenterPrint( "@SP_INGAME_EXIT_VIEW", SCREEN_HEIGHT * 0.95 );
CG_CenterPrint( "@VR_INGAME_EXIT_CAMERA_VIEW", SCREEN_HEIGHT * 0.95 );
}
}

View file

@ -731,11 +731,15 @@ void SP_misc_skyportal (gentity_t *ent)
extern qboolean G_ClearViewEntity( gentity_t *ent );
extern void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity );
extern void SP_fx_runner( gentity_t *ent );
gentity_t *first_camera_view = NULL;
void camera_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod,int dFlags,int hitLoc )
{
if ( player && player->client && player->client->ps.viewEntity == self->s.number )
{
G_UseTargets2( self, player, self->target4 );
first_camera_view = NULL;
G_UseTargets2( self, player, self->target4 );
G_ClearViewEntity( player );
G_Sound( player, self->soundPos2 );
}
@ -776,6 +780,10 @@ void camera_use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
next = G_Find( NULL, FOFS(targetname), self->target2 );
}
if ( !next && first_camera_view )
{// loop through camera views
next = first_camera_view;
}
if ( next )
{//found another one
if ( !Q_stricmp( "misc_camera", next->classname ) )
@ -785,6 +793,7 @@ void camera_use( gentity_t *self, gentity_t *other, gentity_t *activator )
}
else //if ( self->health > 0 )
{//I was the last (only?) one, clear out the viewentity
first_camera_view = NULL;
G_UseTargets2( self, activator, self->target4 );
G_ClearViewEntity( activator );
G_Sound( activator, self->soundPos2 );
@ -792,6 +801,10 @@ void camera_use( gentity_t *self, gentity_t *other, gentity_t *activator )
}
else
{//set me as view entity
if ( !first_camera_view)
{
first_camera_view = self;
}
G_UseTargets2( self, activator, self->target3 );
self->s.eFlags |= EF_NODRAW;
self->s.modelindex = 0;
@ -807,6 +820,7 @@ void camera_aim( gentity_t *self )
{//I am the viewEntity
if ( /* player->client->usercmd.forwardmove || player->client->usercmd.rightmove ||*/ player->client->usercmd.upmove )
{//player wants to back out of camera
first_camera_view = NULL;
G_UseTargets2( self, player, self->target4 );
G_ClearViewEntity( player );
G_Sound( player, self->soundPos2 );

View file

@ -1890,6 +1890,7 @@ void CG_Init( int serverCommandSequence ) {
}
cgi_SP_Register("SP_INGAME", qtrue); //require load and keep around
cgi_SP_Register("VR_INGAME", qtrue); //require load and keep around
cgi_SP_Register("OBJECTIVES", qtrue); //require load and keep around
CG_LoadHudMenu(); // load new hud stuff

View file

@ -237,7 +237,7 @@ void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity )
}
if ( !self->s.number )
{
CG_CenterPrint( "@INGAME_EXIT_VIEW", SCREEN_HEIGHT * 0.95 );
CG_CenterPrint( "@VR_INGAME_EXIT_CAMERA_VIEW", SCREEN_HEIGHT * 0.95 );
}
}

View file

@ -522,11 +522,15 @@ void SP_misc_portal_camera(gentity_t *ent) {
extern qboolean G_ClearViewEntity( gentity_t *ent );
extern void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity );
extern void SP_fx_runner( gentity_t *ent );
gentity_t *first_camera_view = NULL;
void camera_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod,int dFlags,int hitLoc )
{
if ( player && player->client && player->client->ps.viewEntity == self->s.number )
{
G_UseTargets2( self, player, self->target4 );
first_camera_view = NULL;
G_UseTargets2( self, player, self->target4 );
G_ClearViewEntity( player );
G_Sound( player, self->soundPos2 );
}
@ -567,6 +571,10 @@ void camera_use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
next = G_Find( NULL, FOFS(targetname), self->target2 );
}
if ( !next && first_camera_view )
{// loop through camera views
next = first_camera_view;
}
if ( next )
{//found another one
if ( !Q_stricmp( "misc_camera", next->classname ) )
@ -576,6 +584,7 @@ void camera_use( gentity_t *self, gentity_t *other, gentity_t *activator )
}
else //if ( self->health > 0 )
{//I was the last (only?) one, clear out the viewentity
first_camera_view = NULL;
G_UseTargets2( self, activator, self->target4 );
G_ClearViewEntity( activator );
G_Sound( activator, self->soundPos2 );
@ -583,6 +592,10 @@ void camera_use( gentity_t *self, gentity_t *other, gentity_t *activator )
}
else
{//set me as view entity
if ( !first_camera_view)
{
first_camera_view = self;
}
G_UseTargets2( self, activator, self->target3 );
self->s.eFlags |= EF_NODRAW;
self->s.modelindex = 0;
@ -598,6 +611,7 @@ void camera_aim( gentity_t *self )
{//I am the viewEntity
if ( (player->client->usercmd.buttons&BUTTON_BLOCKING) || player->client->usercmd.upmove)// || player->client->usercmd.forwardmove || player->client->usercmd.rightmove )
{//player wants to back out of camera
first_camera_view = NULL;
G_UseTargets2( self, player, self->target4 );
G_ClearViewEntity( player );
G_Sound( player, self->soundPos2 );

View file

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

View file

@ -0,0 +1,19 @@
// Note to translators:
// If a sentence is the same in your language then please change it to "#same"
//
// eg:
// LANG_ENGLISH "HALT"
// LANG_GERMAN"#same"
//
// (This is so we can tell which strings have been signed-off as ok to be the same words for QA
// and because we do not store duplicate strings, which will then get exported again next time
// as being untranslated.)
//
VERSION "1"
CONFIG "W:\bin\stringed.cfg"
FILENOTES ""
REFERENCE EXIT_CAMERA_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view."
ENDMARKER

View file

@ -0,0 +1,20 @@
// Note to translators:
// If a sentence is the same in your language then please change it to "#same"
//
// eg:
// LANG_ENGLISH "HALT"
// LANG_GERMAN"#same"
//
// (This is so we can tell which strings have been signed-off as ok to be the same words for QA
// and because we do not store duplicate strings, which will then get exported again next time
// as being untranslated.)
//
VERSION "1"
CONFIG "W:\bin\stringed.cfg"
FILENOTES ""
REFERENCE EXIT_CAMERA_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view."
LANG_FRENCH "#same"
ENDMARKER

View file

@ -0,0 +1,20 @@
// Note to translators:
// If a sentence is the same in your language then please change it to "#same"
//
// eg:
// LANG_ENGLISH "HALT"
// LANG_GERMAN"#same"
//
// (This is so we can tell which strings have been signed-off as ok to be the same words for QA
// and because we do not store duplicate strings, which will then get exported again next time
// as being untranslated.)
//
VERSION "1"
CONFIG "W:\bin\stringed.cfg"
FILENOTES ""
REFERENCE EXIT_CAMERA_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view."
LANG_GERMAN "#same"
ENDMARKER

View file

@ -0,0 +1,20 @@
// Note to translators:
// If a sentence is the same in your language then please change it to "#same"
//
// eg:
// LANG_ENGLISH "HALT"
// LANG_GERMAN"#same"
//
// (This is so we can tell which strings have been signed-off as ok to be the same words for QA
// and because we do not store duplicate strings, which will then get exported again next time
// as being untranslated.)
//
VERSION "1"
CONFIG "W:\bin\stringed.cfg"
FILENOTES ""
REFERENCE EXIT_CAMERA_VIEW
LANG_ENGLISH "Press 'JUMP' to exit, thumbstick 'UP/DOWN' to switch view."
LANG_SPANISH "#same"
ENDMARKER