mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-10 06:42:17 +00:00
Start of proper changes for JKA
This commit is contained in:
parent
c8de3b4673
commit
82ace54c07
22 changed files with 177 additions and 130 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -55,3 +55,6 @@ Projects/Android/jni/SupportLibs/liboggvorbis/libs/x86/libvorbis-jni.so
|
|||
Projects/Android/jni/SupportLibs/liboggvorbis/libs/x86/libvorbis.so
|
||||
Projects/Android/libs/arm64-v8a/libopenxr_loader_meta.so
|
||||
Projects/Android/libs/arm64-v8a/libopenxr_loader_pico.so
|
||||
build/intermediates/lint-cache/sdk-registry.xml/sdk-registry.xml
|
||||
build/intermediates/lint-cache/maven.google/master-index.xml
|
||||
build/intermediates/lint-cache/maven.google/com/android/support/group-index.xml
|
||||
|
|
|
@ -151,7 +151,7 @@ void VR_SetHMDOrientation(float pitch, float yaw, float roll)
|
|||
|
||||
if (!vr.remote_turret)
|
||||
{
|
||||
VectorCopy(vr.weaponangles, vr.weaponangles_first);
|
||||
VectorCopy(vr.weaponangles[ANGLES_ADJUSTED], vr.weaponangles_first[ANGLES_ADJUSTED]);
|
||||
}
|
||||
|
||||
// View yaw delta
|
||||
|
@ -209,8 +209,8 @@ void VR_GetMove(float *forward, float *side, float *pos_forward, float *pos_side
|
|||
*side = 0.0f;
|
||||
*pos_side = 0.0f;
|
||||
*yaw = vr.snapTurn + vr.hmdorientation_first[YAW] +
|
||||
vr.weaponangles[YAW] - vr.weaponangles_first[YAW];
|
||||
*pitch = vr.weaponangles[PITCH];
|
||||
vr.weaponangles[ANGLES_ADJUSTED][YAW] - vr.weaponangles_first[ANGLES_ADJUSTED][YAW];
|
||||
*pitch = vr.weaponangles[ANGLES_ADJUSTED][PITCH];
|
||||
*roll = 0.0f;
|
||||
}
|
||||
else if (vr.cgzoommode == 2 || vr.cgzoommode == 4)
|
||||
|
@ -221,7 +221,7 @@ void VR_GetMove(float *forward, float *side, float *pos_forward, float *pos_side
|
|||
*side = 0.0f;
|
||||
*pos_side = 0.0f;
|
||||
*yaw = vr.snapTurn;
|
||||
*pitch = vr.weaponangles[PITCH];
|
||||
*pitch = vr.weaponangles[ANGLES_ADJUSTED][PITCH];
|
||||
*roll = vr.hmdorientation[ROLL];
|
||||
}
|
||||
else if (vr.remote_npc) {
|
||||
|
@ -301,7 +301,7 @@ void VR_Init()
|
|||
vr_haptic_intensity = Cvar_Get ("vr_haptic_intensity", "1.0", CVAR_ARCHIVE);
|
||||
vr_comfort_vignette = Cvar_Get ("vr_comfort_vignette", "0.0", CVAR_ARCHIVE);
|
||||
vr_saber_3rdperson_mode = Cvar_Get ("vr_saber_3rdperson_mode", "1", CVAR_ARCHIVE);
|
||||
vr_gesture_triggered_use = Cvar_Get ("vr_gesture_triggered_use", "0", CVAR_ARCHIVE);
|
||||
vr_gesture_triggered_use = Cvar_Get ("vr_gesture_triggered_use", "2", CVAR_ARCHIVE);
|
||||
vr_use_gesture_boundary = Cvar_Get ("vr_use_gesture_boundary", "0.35", CVAR_ARCHIVE);
|
||||
|
||||
cvar_t *expanded_menu_enabled = Cvar_Get ("expanded_menu_enabled", "0", CVAR_ARCHIVE);
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
#define NUM_WEAPON_SAMPLES 10
|
||||
|
||||
#define ANGLES_DEFAULT 0
|
||||
#define ANGLES_ADJUSTED 1
|
||||
#define ANGLES_SABER 2
|
||||
#define ANGLES_COUNT 3
|
||||
|
||||
typedef struct {
|
||||
bool cin_camera; // cinematic camera taken over
|
||||
|
||||
|
@ -26,6 +31,7 @@ typedef struct {
|
|||
bool player_moving;
|
||||
int move_speed; // 0 (default) = Comfortable (75%) , 1 = Full (100%), 2 = Walk (50%)
|
||||
bool crouched;
|
||||
bool dual_wield; // JKA only - is player dual sabers active
|
||||
int cgzoommode;
|
||||
int cgzoomdir;
|
||||
int saberBlockDebounce; // Amount of time after player is blocked that the saber position is fixed
|
||||
|
@ -46,17 +52,16 @@ typedef struct {
|
|||
vec3_t hmdorientation_snap;
|
||||
vec3_t hmdorientation_first; // only updated when in first person
|
||||
|
||||
vec3_t weaponangles_saber;
|
||||
vec3_t weaponangles;
|
||||
vec3_t weaponangles_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t weaponangles_delta;
|
||||
vec3_t weaponangles_first; // only updated when in first person
|
||||
|
||||
vec3_t clientviewangles; //orientation in the client - we use this in the cgame
|
||||
float snapTurn; // how much turn has been applied to the yaw by joystick
|
||||
float clientview_yaw_last; // Don't use this, it is just for calculating delta!
|
||||
float clientview_yaw_delta;
|
||||
|
||||
vec3_t weaponangles[ANGLES_COUNT];
|
||||
vec3_t weaponangles_last[ANGLES_COUNT]; // Don't use this, it is just for calculating delta!
|
||||
vec3_t weaponangles_delta[ANGLES_COUNT];
|
||||
vec3_t weaponangles_first[ANGLES_COUNT]; // only updated when in first person
|
||||
|
||||
vec3_t weaponposition;
|
||||
vec3_t weaponoffset;
|
||||
float weaponoffset_timestamp;
|
||||
|
@ -72,10 +77,10 @@ typedef struct {
|
|||
bool secondaryVelocityTriggeredAttack;
|
||||
vec3_t secondaryVelocityTriggerLocation;
|
||||
|
||||
vec3_t offhandangles;
|
||||
vec3_t offhandangles_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t offhandangles_delta;
|
||||
vec3_t offhandangles_saber;
|
||||
vec3_t offhandangles[ANGLES_COUNT];
|
||||
vec3_t offhandangles_last[ANGLES_COUNT]; // Don't use this, it is just for calculating delta!
|
||||
vec3_t offhandangles_delta[ANGLES_COUNT];
|
||||
vec3_t offhandangles_saber[ANGLES_COUNT];
|
||||
|
||||
vec3_t offhandposition[5]; // store last 5
|
||||
vec3_t offhandoffset;
|
||||
|
|
|
@ -132,12 +132,12 @@ float clamp(float _min, float _val, float _max)
|
|||
void interactWithTouchScreen(bool reset, ovrInputStateTrackedRemote *newState, ovrInputStateTrackedRemote *oldState) {
|
||||
|
||||
static float centerYaw = 0;
|
||||
if (reset || Q_isnan(centerYaw) || fabs(sinf(DEG2RAD(vr.weaponangles[YAW]-centerYaw))) > 0.9f)
|
||||
if (reset || Q_isnan(centerYaw) || fabs(sinf(DEG2RAD(vr.weaponangles[ANGLES_ADJUSTED][YAW]-centerYaw))) > 0.9f)
|
||||
{
|
||||
centerYaw = vr.weaponangles[YAW];
|
||||
centerYaw = vr.weaponangles[ANGLES_ADJUSTED][YAW];
|
||||
}
|
||||
float cursorX = -sinf(DEG2RAD(vr.weaponangles[YAW]-centerYaw)) + 0.5f;
|
||||
float cursorY = (float)(vr.weaponangles[PITCH] / 90.0) + 0.5f;
|
||||
float cursorX = -sinf(DEG2RAD(vr.weaponangles[ANGLES_ADJUSTED][YAW]-centerYaw)) + 0.5f;
|
||||
float cursorY = (float)(vr.weaponangles[ANGLES_ADJUSTED][PITCH] / 90.0) + 0.5f;
|
||||
|
||||
PortableMouseAbs(cursorX, cursorY);
|
||||
}
|
||||
|
|
|
@ -87,34 +87,31 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
secondaryButton2 = offButton2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Set controller angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
{
|
||||
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
vec3_t rotation = {0};
|
||||
QuatToYawPitchRoll(pWeapon->Pose.orientation, rotation, vr.weaponangles[ANGLES_DEFAULT]);
|
||||
QuatToYawPitchRoll(pOff->Pose.orientation, rotation, vr.offhandangles[ANGLES_DEFAULT]);
|
||||
|
||||
//if we are in saber block debounce, don't update the angles
|
||||
//if we are in saber block debounce, don't update the saber angles
|
||||
if (vr.saberBlockDebounce < cl.serverTime) {
|
||||
rotation[PITCH] = 45;
|
||||
QuatToYawPitchRoll(pWeapon->Pose.orientation, rotation, vr.weaponangles_saber);
|
||||
QuatToYawPitchRoll(pOff->Pose.orientation, rotation, vr.offhandangles_saber);
|
||||
QuatToYawPitchRoll(pWeapon->Pose.orientation, rotation, vr.weaponangles[ANGLES_SABER]);
|
||||
QuatToYawPitchRoll(pOff->Pose.orientation, rotation, vr.offhandangles[ANGLES_SABER]);
|
||||
}
|
||||
|
||||
rotation[PITCH] = vr_weapon_pitchadjust->value;
|
||||
QuatToYawPitchRoll(pWeapon->Pose.orientation, rotation, vr.weaponangles);
|
||||
QuatToYawPitchRoll(pWeapon->Pose.orientation, rotation, vr.weaponangles[ANGLES_ADJUSTED]);
|
||||
QuatToYawPitchRoll(pOff->Pose.orientation, rotation, vr.offhandangles[ANGLES_ADJUSTED]);
|
||||
|
||||
VectorSubtract(vr.weaponangles_last, vr.weaponangles, vr.weaponangles_delta);
|
||||
VectorCopy(vr.weaponangles, vr.weaponangles_last);
|
||||
for (int anglesIndex = 0; anglesIndex <= ANGLES_SABER; ++anglesIndex)
|
||||
{
|
||||
VectorSubtract(vr.weaponangles_last[anglesIndex], vr.weaponangles[anglesIndex], vr.weaponangles_delta[anglesIndex]);
|
||||
VectorCopy(vr.weaponangles[anglesIndex], vr.weaponangles_last[anglesIndex]);
|
||||
|
||||
// ALOGV(" weaponangles_last: %f, %f, %f",
|
||||
// vr.weaponangles_last[0], vr.weaponangles_last[1], vr.weaponangles_last[2]);
|
||||
|
||||
//GB Also set offhand angles just in case we want to use those.
|
||||
vec3_t rotation_off = {0};
|
||||
rotation_off[PITCH] = vr_weapon_pitchadjust->value;
|
||||
QuatToYawPitchRoll(pOff->Pose.orientation, rotation_off, vr.offhandangles);
|
||||
|
||||
VectorSubtract(vr.offhandangles_last, vr.offhandangles, vr.offhandangles_delta);
|
||||
VectorCopy(vr.offhandangles, vr.offhandangles_last);
|
||||
VectorSubtract(vr.offhandangles_last[anglesIndex], vr.offhandangles[anglesIndex], vr.offhandangles_delta[anglesIndex]);
|
||||
VectorCopy(vr.offhandangles[anglesIndex], vr.offhandangles_last[anglesIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
//Menu button
|
||||
|
@ -425,8 +422,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
float zxDist = length(x, z);
|
||||
|
||||
if (zxDist != 0.0f && z != 0.0f) {
|
||||
VectorSet(vr.weaponangles, -RAD2DEG(atanf(y / zxDist)),
|
||||
-RAD2DEG(atan2f(x, -z)), vr.weaponangles[ROLL] /
|
||||
VectorSet(vr.weaponangles[ANGLES_ADJUSTED], -RAD2DEG(atanf(y / zxDist)),
|
||||
-RAD2DEG(atan2f(x, -z)), vr.weaponangles[ANGLES_ADJUSTED][ROLL] /
|
||||
2.0f); //Dampen roll on stabilised weapon
|
||||
}
|
||||
}
|
||||
|
@ -441,8 +438,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
float zxDist = length(x, z);
|
||||
|
||||
if (zxDist != 0.0f && z != 0.0f) {
|
||||
VectorSet(vr.weaponangles, -RAD2DEG(atanf(y / zxDist)),
|
||||
-RAD2DEG(atan2f(x, -z)), vr.weaponangles[ROLL] /
|
||||
VectorSet(vr.weaponangles[ANGLES_ADJUSTED], -RAD2DEG(atanf(y / zxDist)),
|
||||
-RAD2DEG(atan2f(x, -z)), vr.weaponangles[ANGLES_ADJUSTED][ROLL] /
|
||||
2.0f); //Dampen roll on stabilised weapon
|
||||
}
|
||||
}
|
||||
|
@ -461,7 +458,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
0.10)) // 3) Weapon height in relation to HMD must be within <-0.10, 0.10> range
|
||||
{
|
||||
AngleVectors(vr.hmdorientation, hmdForwardXY, NULL, NULL);
|
||||
AngleVectors(vr.weaponangles, weaponForwardXY, NULL, NULL);
|
||||
AngleVectors(vr.weaponangles[ANGLES_ADJUSTED], weaponForwardXY, NULL, NULL);
|
||||
|
||||
float weaponToDownAngle = AngleBetweenVectors(downVector, weaponForwardXY);
|
||||
// 4) Angle between weapon forward vector and a down vector must be within 80-140 degrees
|
||||
|
@ -492,11 +489,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
vr.offhandoffset[1] = pOff->Pose.position.y - vr.hmdposition[1];
|
||||
vr.offhandoffset[2] = pOff->Pose.position.z - vr.hmdposition[2];
|
||||
|
||||
vec3_t rotation = {0};
|
||||
QuatToYawPitchRoll(pOff->Pose.orientation, rotation, vr.offhandangles);
|
||||
|
||||
if (vr_walkdirection->value == 0) {
|
||||
controllerYawHeading = vr.offhandangles[YAW] - vr.hmdorientation[YAW];
|
||||
controllerYawHeading = vr.offhandangles[ANGLES_ADJUSTED][YAW] - vr.hmdorientation[YAW];
|
||||
} else {
|
||||
controllerYawHeading = 0.0f;
|
||||
}
|
||||
|
@ -516,7 +510,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
{
|
||||
//Need to do this again as might not have done it above and cant be bothered to refactor
|
||||
AngleVectors(vr.hmdorientation, hmdForwardXY, NULL, NULL);
|
||||
AngleVectors(vr.offhandangles, offhandForwardXY, NULL, NULL);
|
||||
AngleVectors(vr.offhandangles[ANGLES_ADJUSTED], offhandForwardXY, NULL, NULL);
|
||||
|
||||
offhandToDownAngle = AngleBetweenVectors(downVector, offhandForwardXY);
|
||||
|
||||
|
|
|
@ -39,22 +39,31 @@ void HandleInput_WeaponAlign( ovrInputStateTrackedRemote *pDominantTrackedRemote
|
|||
VectorScale(vr.test_offset, vr.test_scale, vr.test_offset);
|
||||
*/
|
||||
|
||||
//Need this for the touch screen
|
||||
//Set controller angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
{
|
||||
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
vec3_t rotation = {0};
|
||||
rotation[PITCH] = 45;
|
||||
QuatToYawPitchRoll(pDominantTracking->Pose.orientation, rotation, vr.weaponangles_saber);
|
||||
QuatToYawPitchRoll(pOffTracking->Pose.orientation, rotation, vr.offhandangles_saber);
|
||||
QuatToYawPitchRoll(pDominantTracking->Pose.orientation, rotation, vr.weaponangles[ANGLES_DEFAULT]);
|
||||
QuatToYawPitchRoll(pOffTracking->Pose.orientation, rotation, vr.offhandangles[ANGLES_DEFAULT]);
|
||||
|
||||
//if we are in saber block debounce, don't update the saber angles
|
||||
if (vr.saberBlockDebounce < cl.serverTime) {
|
||||
rotation[PITCH] = 45;
|
||||
QuatToYawPitchRoll(pDominantTracking->Pose.orientation, rotation, vr.weaponangles[ANGLES_SABER]);
|
||||
QuatToYawPitchRoll(pOffTracking->Pose.orientation, rotation, vr.offhandangles[ANGLES_SABER]);
|
||||
}
|
||||
|
||||
rotation[PITCH] = vr_weapon_pitchadjust->value;
|
||||
QuatToYawPitchRoll(pDominantTracking->Pose.orientation, rotation, vr.weaponangles);
|
||||
QuatToYawPitchRoll(pDominantTracking->Pose.orientation, rotation, vr.weaponangles[ANGLES_ADJUSTED]);
|
||||
QuatToYawPitchRoll(pOffTracking->Pose.orientation, rotation, vr.offhandangles[ANGLES_ADJUSTED]);
|
||||
|
||||
VectorSubtract(vr.weaponangles_last, vr.weaponangles, vr.weaponangles_delta);
|
||||
VectorCopy(vr.weaponangles, vr.weaponangles_last);
|
||||
|
||||
ALOGV(" weaponangles_last: %f, %f, %f",
|
||||
vr.weaponangles_last[0], vr.weaponangles_last[1], vr.weaponangles_last[2]);
|
||||
for (int anglesIndex = 0; anglesIndex <= ANGLES_SABER; ++anglesIndex)
|
||||
{
|
||||
VectorSubtract(vr.weaponangles_last[anglesIndex], vr.weaponangles[anglesIndex], vr.weaponangles_delta[anglesIndex]);
|
||||
VectorCopy(vr.weaponangles[anglesIndex], vr.weaponangles_last[anglesIndex]);
|
||||
|
||||
VectorSubtract(vr.offhandangles_last[anglesIndex], vr.offhandangles[anglesIndex], vr.offhandangles_delta[anglesIndex]);
|
||||
VectorCopy(vr.offhandangles[anglesIndex], vr.offhandangles_last[anglesIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
//Menu button
|
||||
|
@ -96,9 +105,6 @@ void HandleInput_WeaponAlign( ovrInputStateTrackedRemote *pDominantTrackedRemote
|
|||
vr.offhandoffset[0] = pOffTracking->Pose.position.x - vr.hmdposition[0];
|
||||
vr.offhandoffset[1] = pOffTracking->Pose.position.y - vr.hmdposition[1];
|
||||
vr.offhandoffset[2] = pOffTracking->Pose.position.z - vr.hmdposition[2];
|
||||
|
||||
vec3_t rotation = {0};
|
||||
QuatToYawPitchRoll(pOffTracking->Pose.orientation, rotation, vr.offhandangles);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4521,9 +4521,9 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
if (usingScope)
|
||||
{
|
||||
cg.refdef.viewangles[ROLL] = vr->clientviewangles[ROLL];
|
||||
cg.refdef.viewangles[PITCH] = vr->weaponangles[PITCH];
|
||||
cg.refdef.viewangles[PITCH] = vr->weaponangles[ANGLES_ADJUSTED][PITCH];
|
||||
cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW]
|
||||
+ vr->weaponangles[YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
|
||||
+ vr->weaponangles[ANGLES_ADJUSTED][YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
|
||||
AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
|
||||
}
|
||||
|
||||
|
|
|
@ -347,6 +347,11 @@ typedef struct {
|
|||
|
||||
qboolean renderingThirdPerson; // during deaths, chasecams, etc
|
||||
|
||||
//Probably needs to move elsewhere but...
|
||||
int saberG2Num[2];
|
||||
int saberModelIndex[2];
|
||||
CGhoul2Info_v saber_ghoul2[2];
|
||||
|
||||
// prediction state
|
||||
qboolean hyperspace; // true if prediction has hit a trigger_teleport
|
||||
playerState_t predicted_player_state;
|
||||
|
|
|
@ -8480,9 +8480,11 @@ Ghoul2 Insert End
|
|||
|
||||
}
|
||||
|
||||
if (CG_getPlayer1stPersonSaber(cent) && !cent->currentState.saberInFlight && !vr->item_selector &&
|
||||
if (CG_getPlayer1stPersonSaber(cent) && !vr->item_selector &&
|
||||
cent->gent->client->ps.saberLockEnemy == ENTITYNUM_NONE)
|
||||
{
|
||||
gentity_t *main_saber = &g_entities[cent->gent->client->ps.saberEntityNum];
|
||||
|
||||
int numSabers = 1;
|
||||
if ( cent->gent->client->ps.dualSabers )
|
||||
{
|
||||
|
@ -8490,31 +8492,30 @@ Ghoul2 Insert End
|
|||
}
|
||||
for ( int saberNum = 0; saberNum < numSabers; saberNum++ )
|
||||
{
|
||||
gentity_t *main_saber = &g_entities[cent->gent->client->ps.saberEntityNum];
|
||||
if (saberNum == 0 && cent->currentState.saberInFlight)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
refEntity_t hiltEnt;
|
||||
memset( &hiltEnt, 0, sizeof(refEntity_t) );
|
||||
|
||||
BG_CalculateVRSaberPosition(saberNum, hiltEnt.origin, hiltEnt.angles);
|
||||
|
||||
//Force it to use the ghoul2 model!?
|
||||
if (saberNum == 0)
|
||||
int saberModelIndex = G_ModelIndex( cent->gent->client->ps.saber[saberNum].model );
|
||||
if (saberModelIndex != cg.saberModelIndex[saberNum])
|
||||
{
|
||||
hiltEnt.ghoul2 = &main_saber->ghoul2;
|
||||
}
|
||||
else
|
||||
{
|
||||
static CGhoul2Info_v ghoul2;
|
||||
if (ghoul2.size() == 0)
|
||||
if (cg.saber_ghoul2[saberNum].size() != 0)
|
||||
{
|
||||
int saber2 =
|
||||
G_ModelIndex( cent->gent->client->ps.saber[1].model );
|
||||
gi.G2API_InitGhoul2Model( ghoul2, cent->gent->client->ps.saber[1].model, saber2 , NULL_HANDLE, NULL_HANDLE, 0, 0 );
|
||||
gi.G2API_RemoveGhoul2Model(cg.saber_ghoul2[saberNum], cg.saberG2Num[saberNum]);
|
||||
//cg.saber_ghoul2[saberNum].clear();
|
||||
}
|
||||
hiltEnt.ghoul2 = &ghoul2;
|
||||
cg.saberG2Num[saberNum] = gi.G2API_InitGhoul2Model( cg.saber_ghoul2[saberNum], cent->gent->client->ps.saber[saberNum].model, saberModelIndex , NULL_HANDLE, NULL_HANDLE, 0, 0 );
|
||||
cg.saberModelIndex[saberNum] = saberModelIndex;
|
||||
}
|
||||
hiltEnt.ghoul2 = &cg.saber_ghoul2[saberNum];
|
||||
hiltEnt.hModel = cgs.model_draw[0];
|
||||
VectorCopy( main_saber->modelScale, hiltEnt.modelScale);
|
||||
VectorSet( hiltEnt.modelScale, 0.8f, 0.8f, 0.8f ); // Scale down slightly or they are all just too big
|
||||
hiltEnt.radius = 60;
|
||||
|
||||
vec3_t axis[3];
|
||||
|
@ -8522,39 +8523,9 @@ Ghoul2 Insert End
|
|||
VectorSubtract(vec3_origin, axis[2], hiltEnt.axis[0]);
|
||||
VectorCopy(axis[1], hiltEnt.axis[1]);
|
||||
VectorCopy(axis[0], hiltEnt.axis[2]);
|
||||
//VectorMA(hiltEnt.origin, 1.0f, hiltEnt.axis[2], hiltEnt.origin);
|
||||
VectorCopy(hiltEnt.origin, hiltEnt.oldorigin);
|
||||
|
||||
cgi_R_AddRefEntityToScene(&hiltEnt);
|
||||
/*
|
||||
// if (cent->gent->weaponModel[saberNum] > 0)
|
||||
// {
|
||||
// gi.G2API_RemoveGhoul2Model(cent->gent->ghoul2, cent->gent->weaponModel[saberNum]);
|
||||
// cent->gent->weaponModel[saberNum] = -1;
|
||||
// }
|
||||
//draw it
|
||||
saber->s.eFlags &= ~EF_NODRAW;
|
||||
saber->svFlags |= SVF_BROADCAST;
|
||||
saber->svFlags &= ~SVF_NOCLIENT;
|
||||
BG_CalculateVRSaberPosition(saberNum, saber->currentOrigin, saber->currentAngles);
|
||||
VectorCopy(saber->currentOrigin, saber->s.pos.trBase);
|
||||
|
||||
vec3_t axis[3], _axis[3];
|
||||
AnglesToAxis(saber->currentAngles, axis);
|
||||
VectorSubtract(vec3_origin, axis[2], _axis[0]);
|
||||
VectorCopy(axis[1], _axis[1]);
|
||||
VectorCopy(axis[0], _axis[2]);
|
||||
//vectoangles(_axis[2], saber->currentAngles);
|
||||
|
||||
|
||||
VectorCopy(saber->currentAngles, saber->s.apos.trBase);
|
||||
saber->s.pos.trTime = level.time;
|
||||
saber->s.pos.trType = TR_STATIONARY;
|
||||
saber->s.apos.trTime = level.time;
|
||||
saber->s.apos.trType = TR_STATIONARY;
|
||||
VectorClear(saber->s.pos.trDelta);
|
||||
VectorClear(saber->s.apos.trDelta);
|
||||
gi.linkentity(saber);*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2013,6 +2013,9 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|
|||
cg.time = serverTime;
|
||||
}
|
||||
|
||||
//Reset seed so random numbers are the same for each eye
|
||||
Rand_Init(cg.time);
|
||||
|
||||
cg.stereoView = stereoView;
|
||||
|
||||
// update cvars
|
||||
|
@ -2258,7 +2261,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|
|||
vec3_t end, forward;
|
||||
refEntity_t handEnt;
|
||||
memset( &handEnt, 0, sizeof(refEntity_t) );
|
||||
BG_CalculateVROffHandPosition(handEnt.origin, handEnt.angles);
|
||||
BG_CalculateVRDefaultPosition(1, handEnt.origin, handEnt.angles);
|
||||
|
||||
//Move it back a bit?
|
||||
AngleVectors(handEnt.angles, forward, NULL, NULL);
|
||||
|
@ -2290,7 +2293,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|
|||
|
||||
if (cg.snap->ps.weapon == WP_NONE)
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(handEnt.origin, handEnt.angles);
|
||||
BG_CalculateVRDefaultPosition(0, handEnt.origin, handEnt.angles);
|
||||
|
||||
//Move it back a bit?
|
||||
AngleVectors(handEnt.angles, forward, NULL, NULL);
|
||||
|
|
|
@ -82,6 +82,7 @@ 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( int saberNum, vec3_t origin, vec3_t angles );
|
||||
void BG_CalculateVRDefaultPosition( int hand, vec3_t origin, vec3_t angles );
|
||||
void BG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles );
|
||||
void BG_ConvertFromVR(vec3_t in, vec3_t offset, vec3_t out);
|
||||
void BG_CalculateVRPositionInWorld( const vec3_t in_position, vec3_t in_offset, vec3_t in_orientation, vec3_t origin, vec3_t angles );
|
||||
|
|
|
@ -755,26 +755,44 @@ void BG_CalculateVRPositionInWorld( const vec3_t in_position, vec3_t in_offset,
|
|||
angles[YAW] += (cg.refdefViewAngles[YAW] - getHMDYawForCalc());
|
||||
}
|
||||
|
||||
void BG_CalculateVRDefaultPosition( int hand, vec3_t origin, vec3_t angles )
|
||||
{
|
||||
if (hand == 0)
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles[ANGLES_DEFAULT], origin, angles);
|
||||
}
|
||||
else
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition[0], vr->offhandoffset, vr->offhandangles[ANGLES_DEFAULT], origin, angles);
|
||||
}
|
||||
}
|
||||
|
||||
void BG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles )
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition[0], vr->offhandoffset, vr->offhandangles, origin, angles);
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition[0], vr->offhandoffset, vr->offhandangles[ANGLES_ADJUSTED], origin, angles);
|
||||
}
|
||||
|
||||
void BG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles )
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles, origin, angles);
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles[ANGLES_ADJUSTED], origin, angles);
|
||||
}
|
||||
|
||||
void BG_CalculateVRSaberPosition( int saberNum, vec3_t origin, vec3_t angles )
|
||||
{
|
||||
if (saberNum == 0)
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles_saber, origin, angles);
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles[ANGLES_SABER], origin, angles);
|
||||
}
|
||||
else
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition[0], vr->offhandoffset, vr->offhandangles_saber, origin, angles);
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition[0], vr->offhandoffset, vr->offhandangles[ANGLES_SABER], origin, angles);
|
||||
}
|
||||
|
||||
//Move position down a bit
|
||||
vec3_t axis[3];
|
||||
AnglesToAxis(angles, axis);
|
||||
//The "forward" axis will be adjusted
|
||||
VectorMA(origin, -3.0f, axis[0], origin);
|
||||
}
|
||||
|
||||
bool BG_UseVRPosition( gentity_t *ent )
|
||||
|
|
|
@ -26,6 +26,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "b_local.h"
|
||||
#include "anims.h"
|
||||
#include "../cgame/cg_local.h"
|
||||
#include "bg_local.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
#define ENTDIST_PLAYER 1
|
||||
#define ENTDIST_NPC 2
|
||||
|
@ -258,7 +260,20 @@ 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;
|
||||
if (vr->useGestureActive && gi.cvar("vr_gesture_triggered_use", "2", CVAR_ARCHIVE)->integer == 1) { // defined in VrCvars.h
|
||||
BG_CalculateVROffHandPosition(origin, angles);
|
||||
} else {
|
||||
BG_CalculateVRWeaponPosition(origin, angles);
|
||||
}
|
||||
AngleVectors( angles, forward, NULL, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
AngleVectors( other->client->ps.viewangles, forward, NULL, NULL );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -30,6 +30,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "g_navigator.h"
|
||||
#include "b_local.h"
|
||||
#include "g_nav.h"
|
||||
#include "bg_local.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
#define ACT_ACTIVE qtrue
|
||||
#define ACT_INACTIVE qfalse
|
||||
|
@ -1670,9 +1672,21 @@ qboolean CanUseInfrontOf(gentity_t *ent)
|
|||
|
||||
//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;
|
||||
if (vr->useGestureActive && gi.cvar("vr_gesture_triggered_use", "2", CVAR_ARCHIVE)->integer == 1) { // defined in VrCvars.h
|
||||
BG_CalculateVROffHandPosition(src, angles);
|
||||
} else {
|
||||
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 );
|
||||
//extend to find end of use trace
|
||||
VectorMA( src, USE_DISTANCE, vf, dest );
|
||||
|
||||
|
|
|
@ -999,8 +999,7 @@ Ghoul2 Insert Start
|
|||
//gi.G2API_SetLodBias( &saberent->ghoul2[0], 0 );
|
||||
if ( ent->client->ps.dualSabers )
|
||||
{
|
||||
//int saber2 =
|
||||
G_ModelIndex( ent->client->ps.saber[1].model );
|
||||
int saber2 = G_ModelIndex( ent->client->ps.saber[1].model );
|
||||
//gi.G2API_InitGhoul2Model( saberent->ghoul2, ent->client->ps.saber[1].model, saber2 );
|
||||
// set up a bolt on the end so we can get where the sabre muzzle is - we can assume this is always bolt 0
|
||||
//gi.G2API_AddBolt( &saberent->ghoul2[0], "*flash" );
|
||||
|
|
|
@ -2996,9 +2996,9 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
if (usingScope)
|
||||
{
|
||||
cg.refdef.viewangles[ROLL] = vr->clientviewangles[ROLL];
|
||||
cg.refdef.viewangles[PITCH] = vr->weaponangles[PITCH];
|
||||
cg.refdef.viewangles[PITCH] = vr->weaponangles[ANGLES_ADJUSTED][PITCH];
|
||||
cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW]
|
||||
+ vr->weaponangles[YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
|
||||
+ vr->weaponangles[ANGLES_ADJUSTED][YAW] + SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
|
||||
AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
|
||||
}
|
||||
|
||||
|
|
|
@ -2045,7 +2045,7 @@ wasForceSpeed=isForceSpeed;
|
|||
vec3_t end, forward;
|
||||
refEntity_t handEnt;
|
||||
memset( &handEnt, 0, sizeof(refEntity_t) );
|
||||
BG_CalculateVROffHandPosition(handEnt.origin, handEnt.angles);
|
||||
BG_CalculateVRDefaultPosition(1, handEnt.origin, handEnt.angles);
|
||||
|
||||
//Move it back a bit?
|
||||
AngleVectors(handEnt.angles, forward, NULL, NULL);
|
||||
|
@ -2075,7 +2075,7 @@ wasForceSpeed=isForceSpeed;
|
|||
|
||||
if (cg.snap->ps.weapon == WP_NONE)
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(handEnt.origin, handEnt.angles);
|
||||
BG_CalculateVRDefaultPosition(0, handEnt.origin, handEnt.angles);
|
||||
|
||||
//Move it back a bit?
|
||||
AngleVectors(handEnt.angles, forward, NULL, NULL);
|
||||
|
|
|
@ -82,6 +82,7 @@ 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_CalculateVRDefaultPosition( int hand, vec3_t origin, vec3_t angles );
|
||||
void BG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles );
|
||||
void BG_ConvertFromVR(vec3_t in, vec3_t offset, vec3_t out);
|
||||
void BG_CalculateVRPositionInWorld( const vec3_t in_position, vec3_t in_offset, vec3_t in_orientation, vec3_t origin, vec3_t angles );
|
||||
|
|
|
@ -696,19 +696,31 @@ void BG_CalculateVRPositionInWorld( const vec3_t in_position, vec3_t in_offset,
|
|||
angles[YAW] += (cg.refdefViewAngles[YAW] - getHMDYawForCalc());
|
||||
}
|
||||
|
||||
void BG_CalculateVRDefaultPosition( int hand, vec3_t origin, vec3_t angles )
|
||||
{
|
||||
if (hand == 0)
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles[ANGLES_DEFAULT], origin, angles);
|
||||
}
|
||||
else
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition[0], vr->offhandoffset, vr->offhandangles[ANGLES_DEFAULT], origin, angles);
|
||||
}
|
||||
}
|
||||
|
||||
void BG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles )
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition[0], vr->offhandoffset, vr->offhandangles, origin, angles);
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition[0], vr->offhandoffset, vr->offhandangles[ANGLES_ADJUSTED], origin, angles);
|
||||
}
|
||||
|
||||
void BG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles )
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles, origin, angles);
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles[ANGLES_ADJUSTED], origin, angles);
|
||||
}
|
||||
|
||||
void BG_CalculateVRSaberPosition( vec3_t origin, vec3_t angles )
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles_saber, origin, angles);
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles[ANGLES_SABER], origin, angles);
|
||||
}
|
||||
|
||||
bool BG_UseVRPosition( gentity_t *ent )
|
||||
|
|
|
@ -233,7 +233,7 @@ void Touch_Multi( gentity_t *self, gentity_t *other, trace_t *trace )
|
|||
if (other->client->ps.clientNum == 0)
|
||||
{
|
||||
vec3_t origin, angles;
|
||||
if (vr->useGestureActive && gi.cvar("vr_gesture_triggered_use", "0", CVAR_ARCHIVE)->integer == 1) { // defined in VrCvars.h
|
||||
if (vr->useGestureActive && gi.cvar("vr_gesture_triggered_use", "2", CVAR_ARCHIVE)->integer == 1) { // defined in VrCvars.h
|
||||
BG_CalculateVROffHandPosition(origin, angles);
|
||||
} else {
|
||||
BG_CalculateVRWeaponPosition(origin, angles);
|
||||
|
|
|
@ -1284,7 +1284,7 @@ void TryUse( gentity_t *ent ) {
|
|||
//cg.refdef.vieworg, basically
|
||||
if (ent->client->ps.clientNum == 0) {
|
||||
vec3_t angles;
|
||||
if (vr->useGestureActive && gi.cvar("vr_gesture_triggered_use", "0", CVAR_ARCHIVE)->integer == 1) { // defined in VrCvars.h
|
||||
if (vr->useGestureActive && gi.cvar("vr_gesture_triggered_use", "2", CVAR_ARCHIVE)->integer == 1) { // defined in VrCvars.h
|
||||
BG_CalculateVROffHandPosition(src, angles);
|
||||
} else {
|
||||
BG_CalculateVRWeaponPosition(src, angles);
|
||||
|
|
|
@ -114,7 +114,7 @@ static void WP_BowcasterMainFire( gentity_t *ent )
|
|||
AngleVectors( angs, dir, NULL, NULL );
|
||||
|
||||
vec3_t rotatedDir;
|
||||
VectorRotateAroundAxis(dir, forward, vr->weaponangles[ROLL], rotatedDir);
|
||||
VectorRotateAroundAxis(dir, forward, vr->weaponangles[ANGLES_ADJUSTED][ROLL], rotatedDir);
|
||||
|
||||
missile = CreateMissile( start, rotatedDir, vel, 10000, ent );
|
||||
|
||||
|
|
Loading…
Reference in a new issue