mirror of
https://github.com/DrBeef/JKXR.git
synced 2025-01-19 06:51:06 +00:00
Use primary hand direction/location as trigger for buttons
This commit is contained in:
parent
f014078518
commit
85f642e9e7
3 changed files with 34 additions and 12 deletions
|
@ -414,6 +414,9 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
VectorSet(vr.weaponangles, -degrees(atanf(y / zxDist)),
|
||||
-degrees(atan2f(x, -z)), vr.weaponangles[ROLL] /
|
||||
2.0f); //Dampen roll on stabilised weapon
|
||||
|
||||
VectorCopy(vr.hmdposition, vr.weaponposition);
|
||||
VectorClear(vr.weaponoffset);
|
||||
vr.weaponposition[1] += 0.1;
|
||||
}
|
||||
}
|
||||
|
@ -585,7 +588,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
if ((primaryButtonsNew & primaryButton2) != (primaryButtonsOld & primaryButton2)) {
|
||||
if (vr.cgzoommode)
|
||||
{
|
||||
sendButtonActionSimple("exitzoom");
|
||||
sendButtonActionSimple("exitscope");
|
||||
}
|
||||
else if (cl.frame.ps.weapon == WP_SABER && vr.velocitytriggered)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "g_functions.h"
|
||||
#include "b_local.h"
|
||||
#include "anims.h"
|
||||
#include "bg_local.h"
|
||||
|
||||
#define ENTDIST_PLAYER 1
|
||||
#define ENTDIST_NPC 2
|
||||
|
@ -228,7 +229,16 @@ void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace )
|
|||
|
||||
if ( other->client )
|
||||
{
|
||||
AngleVectors( other->client->ps.viewangles, forward, NULL, NULL );
|
||||
if (other->client->ps.clientNum == 0)
|
||||
{
|
||||
vec3_t origin, angles;
|
||||
BG_CalculateVRWeaponPosition(origin, angles);
|
||||
AngleVectors( angles, forward, NULL, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
AngleVectors( other->client->ps.viewangles, forward, NULL, NULL );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -230,6 +230,8 @@ void G_PlayEffect( const char *name, const int modelIndex, const int boltIndex,
|
|||
|
||||
extern void cgi_S_StartSound( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx );
|
||||
#include "../cgame/cg_media.h" //access to cgs
|
||||
#include "bg_local.h"
|
||||
|
||||
extern void CG_TryPlayCustomSound( vec3_t origin, int entityNum, soundChannel_t channel, const char *soundName, int customSoundSet );
|
||||
//NOTE: Do NOT Try to use this before the cgame DLL is valid, it will NOT work!
|
||||
void G_SoundOnEnt (gentity_t *ent, soundChannel_t channel, const char *soundPath)
|
||||
|
@ -1267,22 +1269,29 @@ Try and use an entity in the world, directly ahead of us
|
|||
|
||||
#define USE_DISTANCE 64.0f
|
||||
|
||||
void TryUse( gentity_t *ent )
|
||||
{
|
||||
gentity_t *target;
|
||||
trace_t trace;
|
||||
vec3_t src, dest, vf;
|
||||
void TryUse( gentity_t *ent ) {
|
||||
gentity_t *target;
|
||||
trace_t trace;
|
||||
vec3_t src, dest, vf;
|
||||
|
||||
if ( ent->s.number == 0 && ent->client->NPC_class == CLASS_ATST )
|
||||
{//a player trying to get out of his ATST
|
||||
GEntity_UseFunc( ent->activator, ent, ent );
|
||||
if (ent->s.number == 0 &&
|
||||
ent->client->NPC_class == CLASS_ATST) {//a player trying to get out of his ATST
|
||||
GEntity_UseFunc(ent->activator, ent, ent);
|
||||
return;
|
||||
}
|
||||
//FIXME: this does not match where the new accurate crosshair aims...
|
||||
//cg.refdef.vieworg, basically
|
||||
VectorCopy( ent->client->renderInfo.eyePoint, src );
|
||||
if (ent->client->ps.clientNum == 0) {
|
||||
vec3_t angles;
|
||||
BG_CalculateVRWeaponPosition(src, angles);
|
||||
AngleVectors(angles, vf, NULL, NULL);
|
||||
} else {
|
||||
VectorCopy(ent->client->renderInfo.eyePoint, src);
|
||||
|
||||
AngleVectors(ent->client->ps.viewangles, vf, NULL,
|
||||
NULL);//ent->client->renderInfo.eyeAngles was cg.refdef.viewangles, basically
|
||||
}
|
||||
|
||||
AngleVectors( ent->client->ps.viewangles, vf, NULL, NULL );//ent->client->renderInfo.eyeAngles was cg.refdef.viewangles, basically
|
||||
//extend to find end of use trace
|
||||
VectorMA( src, USE_DISTANCE, vf, dest );
|
||||
|
||||
|
|
Loading…
Reference in a new issue