mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-10 06:42:17 +00:00
Big improvement to disruptor
better handling for NPC controlling (though it still doesn't feel very good)
This commit is contained in:
parent
b9b10a9876
commit
52061d9040
33 changed files with 89 additions and 61 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.jk2quest"
|
||||
android:versionCode="28"
|
||||
android:versionName="0.3.9" android:installLocation="auto" >
|
||||
android:versionCode="29"
|
||||
android:versionName="0.4.0" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030002" android:required="true"/>
|
||||
|
|
|
@ -888,7 +888,7 @@ void JKVR_GetMove(float *forward, float *side, float *pos_forward, float *pos_si
|
|||
*up = 0.0f;
|
||||
*side = 0.0f;
|
||||
*pos_side = 0.0f;
|
||||
*yaw = vr.snapTurn + vr.weaponangles[YAW];
|
||||
*yaw = vr.snapTurn;
|
||||
*pitch = vr.weaponangles[PITCH];
|
||||
*roll = vr.hmdorientation[ROLL];
|
||||
}
|
||||
|
@ -898,7 +898,7 @@ void JKVR_GetMove(float *forward, float *side, float *pos_forward, float *pos_si
|
|||
*up = 0.0f;
|
||||
*side = remote_movementSideways;
|
||||
*pos_side = 0.0f;
|
||||
*yaw = vr.hmdorientation[YAW] - vr.hmdorientation_first[YAW];
|
||||
*yaw = vr.snapTurn + vr.hmdorientation[YAW] - vr.hmdorientation_first[YAW];
|
||||
*pitch = vr.hmdorientation[PITCH];
|
||||
*roll = 0.0f;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ typedef struct {
|
|||
vec3_t offhandangles_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t offhandangles_delta;
|
||||
|
||||
vec3_t offhandposition;
|
||||
vec3_t offhandposition[5]; // store last 5
|
||||
vec3_t offhandoffset;
|
||||
|
||||
float maxHeight;
|
||||
|
|
|
@ -383,16 +383,23 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
}
|
||||
}
|
||||
|
||||
vec3_t offhandPositionAverage;
|
||||
VectorClear(offhandPositionAverage);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
VectorAdd(offhandPositionAverage, vr.offhandposition[i], offhandPositionAverage);
|
||||
}
|
||||
VectorScale(offhandPositionAverage, 0.2f, offhandPositionAverage);
|
||||
if (vr.weapon_stabilised) {
|
||||
if (vr_virtual_stock->integer == 1) {
|
||||
//offset to the appropriate eye a little bit
|
||||
vec2_t xy;
|
||||
rotateAboutOrigin(Cvar_VariableValue("cg_stereoSeparation") / 2.0f, 0.0f,
|
||||
-vr.hmdorientation[YAW], xy);
|
||||
float x = pOff->HeadPose.Pose.Position.x - (vr.hmdposition[0] + xy[0]);
|
||||
float y = pOff->HeadPose.Pose.Position.y -
|
||||
float x = offhandPositionAverage[0] - (vr.hmdposition[0] + xy[0]);
|
||||
float y = offhandPositionAverage[1] -
|
||||
(vr.hmdposition[1] - 0.1f); // Use a point lower
|
||||
float z = pOff->HeadPose.Pose.Position.z - (vr.hmdposition[2] + xy[1]);
|
||||
float z = offhandPositionAverage[2] - (vr.hmdposition[2] + xy[1]);
|
||||
float zxDist = length(x, z);
|
||||
|
||||
if (zxDist != 0.0f && z != 0.0f) {
|
||||
|
@ -403,11 +410,11 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
else if (vr.cgzoommode == 2 || vr.cgzoommode == 4)
|
||||
{
|
||||
float x =
|
||||
pOff->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
offhandPositionAverage[0] - vr.hmdposition[0];
|
||||
float y =
|
||||
pOff->HeadPose.Pose.Position.y - (vr.hmdposition[1] - 0.1f);
|
||||
offhandPositionAverage[1] - (vr.hmdposition[1] - 0.1f);
|
||||
float z =
|
||||
pOff->HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
offhandPositionAverage[2] - vr.hmdposition[2];
|
||||
float zxDist = length(x, z);
|
||||
|
||||
if (zxDist != 0.0f && z != 0.0f) {
|
||||
|
@ -472,9 +479,13 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
|
||||
//off-hand stuff (done here as I reference it in the save state thing
|
||||
{
|
||||
vr.offhandposition[0] = pOff->HeadPose.Pose.Position.x;
|
||||
vr.offhandposition[1] = pOff->HeadPose.Pose.Position.y;
|
||||
vr.offhandposition[2] = pOff->HeadPose.Pose.Position.z;
|
||||
for (int i = 4; i > 0; --i)
|
||||
{
|
||||
VectorCopy(vr.offhandposition[i-1], vr.offhandposition[i]);
|
||||
}
|
||||
vr.offhandposition[0][0] = pOff->HeadPose.Pose.Position.x;
|
||||
vr.offhandposition[0][1] = pOff->HeadPose.Pose.Position.y;
|
||||
vr.offhandposition[0][2] = pOff->HeadPose.Pose.Position.z;
|
||||
|
||||
vr.offhandoffset[0] = pOff->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.offhandoffset[1] = pOff->HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
|
@ -731,7 +742,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
(!vr.third_person && vr_turn_mode->integer == 1);
|
||||
|
||||
static int increaseSnap = true;
|
||||
if (!vr.item_selector && !vr.remote_npc) {
|
||||
if (!vr.item_selector) {
|
||||
if (usingSnapTurn) {
|
||||
if (primaryJoystickX > 0.7f) {
|
||||
if (increaseSnap) {
|
||||
|
@ -786,7 +797,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
{
|
||||
if (!vr.secondaryVelocityTriggeredAttack)
|
||||
{
|
||||
VectorCopy(vr.offhandposition, vr.secondaryVelocityTriggerLocation);
|
||||
VectorCopy(vr.offhandposition[0], vr.secondaryVelocityTriggerLocation);
|
||||
vr.secondaryVelocityTriggeredAttack = true;
|
||||
}
|
||||
}
|
||||
|
@ -796,7 +807,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
{
|
||||
vec3_t start, end;
|
||||
VectorSubtract(vr.secondaryVelocityTriggerLocation, vr.hmdposition, start);
|
||||
VectorSubtract(vr.offhandposition, vr.hmdposition, end);
|
||||
VectorSubtract(vr.offhandposition[0], vr.hmdposition, end);
|
||||
float deltaLength = VectorLength(end) - VectorLength(start);
|
||||
if (fabs(deltaLength) > 0.2f) {
|
||||
if (deltaLength < 0) {
|
||||
|
|
|
@ -93,9 +93,9 @@ void HandleInput_WeaponAlign( ovrInputStateTrackedRemote *pDominantTrackedRemote
|
|||
float controllerYawHeading = 0.0f;
|
||||
//off-hand stuff
|
||||
{
|
||||
vr.offhandposition[0] = pOffTracking->HeadPose.Pose.Position.x;
|
||||
vr.offhandposition[1] = pOffTracking->HeadPose.Pose.Position.y;
|
||||
vr.offhandposition[2] = pOffTracking->HeadPose.Pose.Position.z;
|
||||
vr.offhandposition[0][0] = pOffTracking->HeadPose.Pose.Position.x;
|
||||
vr.offhandposition[0][1] = pOffTracking->HeadPose.Pose.Position.y;
|
||||
vr.offhandposition[0][2] = pOffTracking->HeadPose.Pose.Position.z;
|
||||
|
||||
vr.offhandoffset[0] = pOffTracking->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.offhandoffset[1] = pOffTracking->HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
|
|
|
@ -79,6 +79,7 @@ qboolean PM_SlideMove( float gravity );
|
|||
void PM_StepSlideMove( float gravity );
|
||||
|
||||
void rotateAboutOrigin(float x, float y, float rotation, vec2_t out);
|
||||
bool BG_UseVRPosition( gentity_t *ent );
|
||||
void BG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles );
|
||||
void BG_CalculateVRSaberPosition( vec3_t origin, vec3_t angles );
|
||||
void BG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles );
|
||||
|
|
|
@ -757,7 +757,7 @@ void BG_CalculateVRPositionInWorld( const vec3_t in_position, vec3_t in_offset,
|
|||
|
||||
void BG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles )
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition, vr->offhandoffset, vr->offhandangles, origin, angles);
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition[0], vr->offhandoffset, vr->offhandangles, origin, angles);
|
||||
}
|
||||
|
||||
void BG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles )
|
||||
|
@ -770,6 +770,11 @@ void BG_CalculateVRSaberPosition( vec3_t origin, vec3_t angles )
|
|||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles_saber, origin, angles);
|
||||
}
|
||||
|
||||
bool BG_UseVRPosition( gentity_t *ent )
|
||||
{
|
||||
return ( ent->client && (!ent->NPC || ent->client->ps.clientNum == 0 || ent->client->ps.clientNum == cg_entities[0].gent->client->ps.viewEntity));
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
BG_PlayerTouchesItem
|
||||
|
|
|
@ -40,7 +40,7 @@ void WP_FireBryarPistol( gentity_t *ent, qboolean alt_fire )
|
|||
int damage = !alt_fire ? weaponData[WP_BRYAR_PISTOL].damage : weaponData[WP_BRYAR_PISTOL].altDamage;
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -119,7 +119,7 @@ void WP_FireBlaster( gentity_t *ent, qboolean alt_fire )
|
|||
{
|
||||
vec3_t dir, angs;
|
||||
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ static void WP_BowcasterMainFire( gentity_t *ent )
|
|||
vec3_t angs, forward, dir, start;
|
||||
gentity_t *missile;
|
||||
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -258,7 +258,7 @@ static void WP_FireConcussion( gentity_t *ent )
|
|||
float vel = CONC_VELOCITY;
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -39,7 +39,7 @@ static void WP_DEMP2_MainFire( gentity_t *ent )
|
|||
int damage = weaponData[WP_DEMP2].damage;
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -60,7 +60,7 @@ static void WP_DisruptorMainFire( gentity_t *ent )
|
|||
}
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
@ -168,7 +168,7 @@ void WP_DisruptorAltFire( gentity_t *ent )
|
|||
qboolean hitDodged = qfalse, fullCharge = qfalse;
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
@ -371,7 +371,7 @@ void WP_FireDisruptor( gentity_t *ent, qboolean alt_fire )
|
|||
}
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -58,7 +58,7 @@ static void WP_FlechetteMainFire( gentity_t *ent )
|
|||
for ( int i = 0; i < FLECHETTE_SHOTS; i++ )
|
||||
{
|
||||
vec3_t angs;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ static void WP_RepeaterAltFire( gentity_t *ent )
|
|||
else
|
||||
{
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
@ -162,7 +162,7 @@ void WP_FireRepeater( gentity_t *ent, qboolean alt_fire )
|
|||
//---------------------------------------------------------
|
||||
{
|
||||
vec3_t dir, angs;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ void WP_FireRocket( gentity_t *ent, qboolean alt_fire )
|
|||
}
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -37,7 +37,7 @@ void WP_FireStunBaton( gentity_t *ent, qboolean alt_fire )
|
|||
G_Sound( ent, G_SoundIndex( "sound/weapons/baton/fire" ));
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -1885,7 +1885,7 @@ static void CG_DrawCrosshair3D(int type) // 0 - force, 1 - weapons
|
|||
return;
|
||||
}
|
||||
|
||||
if ( cg.snap->ps.viewEntity > 0 && cg.snap->ps.viewEntity < ENTITYNUM_WORLD )
|
||||
if ( in_misccamera )
|
||||
{
|
||||
//Not while viewing from another entity (such as a camera)
|
||||
return;
|
||||
|
@ -2851,11 +2851,13 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
CG_Error( "CG_DrawActive: Undefined stereoView" );
|
||||
}
|
||||
|
||||
char modelName[256];
|
||||
Q_strncpyz(modelName, g_entities[cg.snap->ps.viewEntity].NPC_type, sizeof modelName);
|
||||
|
||||
vr->remote_npc = !Q_stricmp( "NPC", g_entities[cg.snap->ps.viewEntity].classname );
|
||||
vr->remote_droid = vr->remote_npc &&
|
||||
( !Q_stricmp( "mouse", g_entities[cg.snap->ps.viewEntity].NPC_type) ||
|
||||
!Q_stricmp( "r2d2", g_entities[cg.snap->ps.viewEntity].NPC_type) ||
|
||||
!Q_stricmp( "r5d2", g_entities[cg.snap->ps.viewEntity].NPC_type));
|
||||
( !Q_stricmp( "gonk", modelName ) || !Q_stricmp( "seeker", modelName ) || !Q_stricmp( "remote", modelName )
|
||||
|| !Q_strncmp( "r2d2", modelName, 4 ) || !Q_strncmp( "r5d2", modelName, 4 ) || !Q_stricmp( "mouse", modelName ) );
|
||||
|
||||
vr->remote_turret = (!Q_stricmp( "misc_panel_turret", g_entities[cg.snap->ps.viewEntity].classname ));
|
||||
in_misccamera = ( !Q_stricmp( "misc_camera", g_entities[cg.snap->ps.viewEntity].classname ))
|
||||
|
@ -2885,7 +2887,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
!vr->remote_droid)
|
||||
{
|
||||
VectorCopy(vr->hmdorientation, cg.refdef.viewangles);
|
||||
cg.refdef.viewangles[YAW] = cg.refdefViewAngles[YAW]; // Need to do this better.. results in laggy YAW, which is unpleasant
|
||||
cg.refdef.viewangles[YAW] = cg.refdefViewAngles[YAW];
|
||||
AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
|
||||
}
|
||||
|
||||
|
@ -2894,7 +2896,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
{
|
||||
cg.refdef.viewangles[ROLL] = vr->clientviewangles[ROLL];
|
||||
cg.refdef.viewangles[PITCH] = vr->weaponangles[PITCH];
|
||||
cg.refdef.viewangles[YAW] = (vr->clientviewangles[YAW] - vr->hmdorientation[YAW])
|
||||
cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW]
|
||||
+ vr->weaponangles[YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
|
||||
AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
|
||||
}
|
||||
|
|
|
@ -2787,7 +2787,7 @@ void CG_DrawItemSelector( void )
|
|||
if (vr->item_selector == 2)
|
||||
{
|
||||
cg.itemSelectorType = 3;
|
||||
VectorCopy(vr->offhandposition, cg.itemSelectorOrigin);
|
||||
VectorCopy(vr->offhandposition[0], cg.itemSelectorOrigin);
|
||||
VectorCopy(vr->offhandoffset, cg.itemSelectorOffset);
|
||||
}
|
||||
else {
|
||||
|
@ -2812,7 +2812,7 @@ void CG_DrawItemSelector( void )
|
|||
if (cg.itemSelectorType == 3)
|
||||
{
|
||||
BG_CalculateVROffHandPosition(controllerOrigin, controllerAngles);
|
||||
VectorSubtract(vr->offhandposition, cg.itemSelectorOrigin, controllerOffset);
|
||||
VectorSubtract(vr->offhandposition[0], cg.itemSelectorOrigin, controllerOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -79,6 +79,7 @@ qboolean PM_SlideMove( float gravity );
|
|||
void PM_StepSlideMove( float gravity );
|
||||
|
||||
void rotateAboutOrigin(float x, float y, float rotation, vec2_t out);
|
||||
bool BG_UseVRPosition( gentity_t *ent );
|
||||
void BG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles );
|
||||
void BG_CalculateVRSaberPosition( vec3_t origin, vec3_t angles );
|
||||
void BG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles );
|
||||
|
|
|
@ -655,7 +655,7 @@ void rotateAboutOrigin(float x, float y, float rotation, vec2_t out)
|
|||
|
||||
float getHMDYawForCalc()
|
||||
{
|
||||
if (!vr->third_person) {
|
||||
if (!vr->third_person && vr->cgzoommode != 2 && vr->cgzoommode != 4 ) {
|
||||
return vr->hmdorientation[YAW];
|
||||
}
|
||||
return 0.0f;
|
||||
|
@ -698,7 +698,7 @@ void BG_CalculateVRPositionInWorld( const vec3_t in_position, vec3_t in_offset,
|
|||
|
||||
void BG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles )
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition, vr->offhandoffset, vr->offhandangles, origin, angles);
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition[0], vr->offhandoffset, vr->offhandangles, origin, angles);
|
||||
}
|
||||
|
||||
void BG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles )
|
||||
|
@ -711,6 +711,11 @@ void BG_CalculateVRSaberPosition( vec3_t origin, vec3_t angles )
|
|||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles_saber, origin, angles);
|
||||
}
|
||||
|
||||
bool BG_UseVRPosition( gentity_t *ent )
|
||||
{
|
||||
return ( ent->client && (!ent->NPC || ent->client->ps.clientNum == cg_entities[0].gent->client->ps.viewEntity));
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
BG_PlayerTouchesItem
|
||||
|
|
|
@ -29,6 +29,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "Q3_Interface.h"
|
||||
#include "wp_saber.h"
|
||||
#include "g_icarus.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include <float.h>
|
||||
|
@ -216,6 +217,8 @@ void G_SetViewEntity( gentity_t *self, gentity_t *viewEntity )
|
|||
{
|
||||
//vec3_t clear = {0,0,0};
|
||||
CG_SetClientViewAngles( viewEntity->client->ps.viewangles, qtrue );
|
||||
vr->snapTurn = 0;
|
||||
|
||||
//SetClientViewAngle( self, viewEntity->client->ps.viewangles );
|
||||
//SetClientViewAngle( viewEntity, clear );
|
||||
/*
|
||||
|
|
|
@ -110,7 +110,7 @@ void WP_FireBlaster( gentity_t *ent, qboolean alt_fire )
|
|||
{
|
||||
vec3_t dir, angs, start;
|
||||
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent) )
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ static void WP_BowcasterMainFire( gentity_t *ent )
|
|||
vec3_t angs, forward, dir, start;
|
||||
gentity_t *missile;
|
||||
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
@ -144,7 +144,7 @@ static void WP_BowcasterAltFire( gentity_t *ent )
|
|||
vec3_t start, forward, angs;
|
||||
int damage = weaponData[WP_BOWCASTER].altDamage;
|
||||
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -41,7 +41,7 @@ void WP_FireBryarPistol( gentity_t *ent, qboolean alt_fire )
|
|||
int damage = !alt_fire ? weaponData[ent->s.weapon].damage : weaponData[ent->s.weapon].altDamage;
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -40,7 +40,7 @@ static void WP_DEMP2_MainFire( gentity_t *ent )
|
|||
vec3_t start, angs, forward;
|
||||
int damage = weaponData[WP_DEMP2].damage;
|
||||
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
@ -211,7 +211,7 @@ static void WP_DEMP2_AltFire( gentity_t *ent )
|
|||
vec3_t start, angs, forward;
|
||||
trace_t tr;
|
||||
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -83,7 +83,7 @@ static void WP_DisruptorMainFire( gentity_t *ent )
|
|||
}
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
@ -189,7 +189,7 @@ void WP_DisruptorAltFire( gentity_t *ent )
|
|||
qboolean hitDodged = qfalse, fullCharge = qfalse;
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
@ -380,7 +380,7 @@ void WP_FireDisruptor( gentity_t *ent, qboolean alt_fire )
|
|||
}
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
|
||||
AngleVectors(wpMuzzle, forward, NULL, NULL);
|
||||
|
|
|
@ -43,7 +43,7 @@ static void WP_FlechetteMainFire( gentity_t *ent )
|
|||
|
||||
|
||||
vec3_t forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -87,7 +87,7 @@ static void WP_RepeaterAltFire( gentity_t *ent )
|
|||
gentity_t *missile = NULL;
|
||||
|
||||
vec3_t forward, start, angs;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
@ -160,7 +160,7 @@ void WP_FireRepeater( gentity_t *ent, qboolean alt_fire )
|
|||
vec3_t dir, angs;
|
||||
|
||||
vec3_t forward, start;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ void WP_FireRocket( gentity_t *ent, qboolean alt_fire )
|
|||
}
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -8197,7 +8197,7 @@ static void WP_ForcePowerRun( gentity_t *self, forcePowers_t forcePower, usercmd
|
|||
self->client->ps.forceGripEntityInitialDist == ENTITYNUM_NONE)
|
||||
{
|
||||
vec3_t diff;
|
||||
VectorSubtract(vr->offhandposition, vr->hmdposition, diff);
|
||||
VectorSubtract(vr->offhandposition[0], vr->hmdposition, diff);
|
||||
self->client->ps.forceGripEntityInitialDist = VectorLength(diff);
|
||||
}
|
||||
|
||||
|
@ -8216,7 +8216,7 @@ static void WP_ForcePowerRun( gentity_t *self, forcePowers_t forcePower, usercmd
|
|||
{//carry
|
||||
if (isFirstPersonPlayer) {
|
||||
vec3_t diff;
|
||||
VectorSubtract(vr->offhandposition, vr->hmdposition, diff);
|
||||
VectorSubtract(vr->offhandposition[0], vr->hmdposition, diff);
|
||||
float length = VectorLength(diff);
|
||||
float movedLength = (length - self->client->ps.forceGripEntityInitialDist) * cg_worldScale.value;
|
||||
if (fabs(movedLength) > 1.0f) {
|
||||
|
|
|
@ -39,7 +39,7 @@ void WP_FireStunBaton( gentity_t *ent, qboolean alt_fire )
|
|||
G_Sound( ent, G_SoundIndex( "sound/weapons/baton/fire" ));
|
||||
|
||||
vec3_t angs, forward;
|
||||
if ( ent->client && !ent->NPC)
|
||||
if ( BG_UseVRPosition(ent))
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
|
||||
AngleVectors(angs, forward, NULL, NULL);
|
||||
|
|
|
@ -283,7 +283,7 @@ gentity_t *WP_FireThermalDetonator( gentity_t *ent, qboolean alt_fire )
|
|||
bolt = G_Spawn();
|
||||
|
||||
bool realThrow = false;
|
||||
if ( ent->client && !ent->NPC && ent->client->ps.clientNum == 0)
|
||||
if ( BG_UseVRPosition(ent) )
|
||||
{
|
||||
vec3_t angs;
|
||||
BG_CalculateVRWeaponPosition(start, angs);
|
||||
|
|
Loading…
Reference in a new issue