Almost too many changes to mention!

lots of saber stuff
view angle stuff
height is now correct
6DoF is working
weapon aiming working in a lot of cases
This commit is contained in:
Simon 2022-10-03 22:19:00 +01:00
parent 2c29c10b42
commit 99bf86ae8f
30 changed files with 237 additions and 166 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.jk2quest"
android:versionCode="6"
android:versionCode="7"
android:versionName="0.0.6" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->

View file

@ -1420,7 +1420,7 @@ void * AppThreadFunction(void * parm ) {
{
if (SS_MULTIPLIER == 0.0f)
{
SS_MULTIPLIER = 1.2f;
SS_MULTIPLIER = 1.0f;
}
}
else if (vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_DEVICE_TYPE) == VRAPI_DEVICE_TYPE_OCULUSQUEST2)
@ -1428,7 +1428,7 @@ void * AppThreadFunction(void * parm ) {
if (SS_MULTIPLIER == 0.0f)
{
//GB Override as refresh is now 72 by default as we decided a higher res is better as 90hz has stutters
SS_MULTIPLIER = 1.1f;
SS_MULTIPLIER = 1.25f;
}
else if (SS_MULTIPLIER > 1.5f)
{

View file

@ -7,22 +7,24 @@ Authors : Simon Brown
*************************************************************************************/
#include "../../../../../../VrApi/Include/VrApi.h"
#include "../../../../../../VrApi/Include/VrApi_Helpers.h"
#include "../../../../../../VrApi/Include/VrApi_SystemUtils.h"
#include "../../../../../../VrApi/Include/VrApi_Input.h"
#include "../../../../../../VrApi/Include/VrApi_Types.h"
#include <VrApi.h>
#include <VrApi_Helpers.h>
#include <VrApi_SystemUtils.h>
#include <VrApi_Input.h>
#include <VrApi_Types.h>
#include <android/keycodes.h>
#include "VrInput.h"
#include "VrCvars.h"
#include "../OpenJK/code/qcommon/q_shared.h"
#include "qcommon/q_shared.h"
#include <qcommon/qcommon.h>
#include <client/client.h>
#include "android/sys_local.h"
#define WP_AKIMBO 20
#define WP_SABER 1
void SV_Trace( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask, int capsule );
@ -51,14 +53,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
//Need this for the touch screen
ovrTracking * pWeapon = pDominantTracking;
ovrTracking * pOff = pOffTracking;
if (vr.weaponid == WP_AKIMBO &&
!vr.right_handed &&
!JKVR_useScreenLayer())
{
//Revert to same weapon controls as right-handed if using akimbo
pWeapon = pOffTracking;
pOff = pDominantTracking;
}
//All this to allow stick and button switching!
ovrVector2f *pPrimaryJoystick;
@ -466,7 +460,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
static bool firing = false;
{
//Fire Primary
//Fire Primary - Doesn't trigger the saber
if (!vr.velocitytriggered && // Don't fire velocity triggered weapons
(pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
@ -543,11 +537,12 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
}
}
//Open the datapad
if (!canUseQuickSave) {
if (((secondaryButtonsNew & secondaryButton2) !=
(secondaryButtonsOld & secondaryButton2)) &&
(secondaryButtonsNew & secondaryButton2)) {
sendButtonActionSimple("forcenext");
Sys_QueEvent( 0, SE_KEY, A_TAB, true, 0, NULL );
}
}
@ -560,11 +555,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
ovrButton_Trigger, A_SHIFT);
}
//Open the datapad
handleTrackedControllerButton(pOffTrackedRemoteNew,
pOffTrackedRemoteOld,
ovrButton_Y, A_TAB);
//Resync Yaw on mounted gun transition
static int usingMountedGun = false;
if (vr.mountedgun != usingMountedGun)

View file

@ -4267,8 +4267,8 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
cg.refdef.worldscale = cg_worldScale.value;
if (!in_camera) {
VectorCopy(vr->hmdorientation, cg.refdef.viewangles);
cg.refdef.viewangles[YAW] =
SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]) + vr->hmdorientation[YAW] + vr->snapTurn;
cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW] +
SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
}
@ -4288,7 +4288,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
if (!in_camera || vr->immersive_cinematics) {
//Vertical Positional Movement
cg.refdef.vieworg[2] -= 48;
cg.refdef.vieworg[2] -= DEFAULT_PLAYER_HEIGHT;
cg.refdef.vieworg[2] += (vr->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
}

View file

@ -100,6 +100,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#define WAVE_AMPLITUDE 1
#define WAVE_FREQUENCY 0.4
#define DEFAULT_PLAYER_HEIGHT 58
//=================================================
// player entities need to track more information

View file

@ -127,7 +127,7 @@ temporary marks will not be stored or randomly oriented, but immediately
passed to the renderer.
=================
*/
#define MAX_MARK_FRAGMENTS 256
#define MAX_MARK_FRAGMENTS 512
#define MAX_MARK_POINTS 768
void CG_ImpactMark( qhandle_t markShader, const vec3_t origin, const vec3_t dir, float orientation, float red,

View file

@ -5841,7 +5841,7 @@ static void CG_DoSaber( vec3_t origin, vec3_t dir, float length, float lengthMax
cgi_R_AddRefEntityToScene( &saber );
}
#define MAX_MARK_FRAGMENTS 256
#define MAX_MARK_FRAGMENTS 512
#define MAX_MARK_POINTS 768
extern markPoly_t *CG_AllocMark();

View file

@ -71,8 +71,6 @@ qboolean in_mlooking;
extern cvar_t *in_joystick;
#ifdef __ANDROID__
void JKVR_GetMove(float *forward, float *side, float *pos_forward, float *pos_side, float *up,
float *yaw, float *pitch, float *roll);
@ -90,8 +88,6 @@ typedef struct {
vr_move new_move;
vr_move old_move;
#endif
static void IN_UseGivenForce(void)
{
const char *c = Cmd_Argv(1);
@ -380,38 +376,8 @@ Moves the local angle positions
================
*/
void CL_AdjustAngles( void ) {
/* float speed;
if ( in_speed.active ) {
speed = 0.001 * cls.frametime * cl_anglespeedkey->value;
} else {
speed = 0.001 * cls.frametime;
}
if ( !in_strafe.active ) {
if ( cl_mYawOverride )
{
cl.viewangles[YAW] -= cl_mYawOverride*5.0f*speed*cl_yawspeed->value*CL_KeyState (&in_right);
cl.viewangles[YAW] += cl_mYawOverride*5.0f*speed*cl_yawspeed->value*CL_KeyState (&in_left);
}
else
{
cl.viewangles[YAW] -= speed*cl_yawspeed->value*CL_KeyState (&in_right);
cl.viewangles[YAW] += speed*cl_yawspeed->value*CL_KeyState (&in_left);
}
}
if ( cl_mPitchOverride )
{
cl.viewangles[PITCH] -= cl_mPitchOverride*5.0f*speed*cl_pitchspeed->value * CL_KeyState (&in_lookup);
cl.viewangles[PITCH] += cl_mPitchOverride*5.0f*speed*cl_pitchspeed->value * CL_KeyState (&in_lookdown);
}
else
{
cl.viewangles[PITCH] -= speed*cl_pitchspeed->value * CL_KeyState (&in_lookup);
cl.viewangles[PITCH] += speed*cl_pitchspeed->value * CL_KeyState (&in_lookdown);
}
*/
//Make sure Pitch is correct
IN_CenterView();
cl.viewangles[YAW] -= old_move.yaw;
cl.viewangles[YAW] += new_move.yaw;
@ -423,7 +389,6 @@ void CL_AdjustAngles( void ) {
cl.viewangles[YAW] += 360.0f;
cl.viewangles[PITCH] = new_move.pitch;
cl.viewangles[ROLL] = new_move.roll;
VectorCopy(cl.viewangles, vr.clientviewangles);
@ -732,13 +697,9 @@ usercmd_t CL_CreateCmd( void ) {
VectorCopy( cl.viewangles, oldAngles );
#ifdef __ANDROID__
JKVR_GetMove(&new_move.forward, &new_move.side, &new_move.pos_forward, &new_move.pos_side,
&new_move.up, &new_move.yaw, &new_move.pitch, &new_move.roll);
#endif
// keyboard angle adjustment
CL_AdjustAngles ();

View file

@ -832,6 +832,16 @@ void CL_Frame ( int msec,float fractionMsec ) {
SCR_DebugGraph ( cls.realFrametime * 0.25, 0 );
}
JKVR_FrameSetup();
JKVR_processMessageQueue();
//Get controller state here
JKVR_getHMDOrientation();
JKVR_getTrackedRemotesOrientation();
JKVR_processHaptics();
// see if we need to update any userinfo
CL_CheckUserinfo();

View file

@ -499,16 +499,6 @@ void SCR_UpdateScreen( void ) {
// that case.
if ( cls.uiStarted )
{
JKVR_FrameSetup();
JKVR_processMessageQueue();
//Get controller state here
JKVR_getHMDOrientation();
JKVR_getTrackedRemotesOrientation();
JKVR_processHaptics();
//Draw twice for Quest
SCR_DrawScreenField( STEREO_LEFT );

View file

@ -739,7 +739,7 @@ static void BG_CalculateVRPositionInWorld( vec3_t in_position, vec3_t in_offset
VectorCopy(in_offset, offset);
offset[1] = 0; // up/down is index 1 in this case
BG_ConvertFromVR(offset, cg.refdef.vieworg, origin);
origin[2] -= 48;
origin[2] -= DEFAULT_PLAYER_HEIGHT;
origin[2] += in_position[1] * cg_worldScale.value;
VectorCopy(in_orientation, angles);

View file

@ -659,7 +659,7 @@ void G_InitCvars( void ) {
g_subtitles = gi.cvar( "g_subtitles", "0", CVAR_ARCHIVE );
com_buildScript = gi.cvar ("com_buildscript", "0", 0);
g_saberAutoBlocking = gi.cvar( "g_saberAutoBlocking", "1", CVAR_CHEAT );//must press +block button to do any blocking
g_saberAutoBlocking = gi.cvar( "g_saberAutoBlocking", "0", CVAR_CHEAT );//must press +block button to do any blocking
g_saberRealisticCombat = gi.cvar( "g_saberMoreRealistic", "1", CVAR_ARCHIVE );//makes collision more precise, increases damage
debug_subdivision = gi.cvar( "debug_subdivision", "0", CVAR_ARCHIVE );//debug for dismemberment
g_dismemberProbabilities = gi.cvar ( "g_dismemberProbabilities", "1", CVAR_ARCHIVE );//0 = ignore probabilities, 1 = use probabilities

View file

@ -2486,8 +2486,8 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
cg.refdef.worldscale = cg_worldScale.value;
if (!in_camera) {
VectorCopy(vr->hmdorientation, cg.refdef.viewangles);
cg.refdef.viewangles[YAW] =
SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]) + vr->hmdorientation[YAW] + vr->snapTurn;
cg.refdef.viewangles[YAW] = vr->clientviewangles[YAW] +
SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]);
AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
}
@ -2507,7 +2507,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
if (!in_camera || vr->immersive_cinematics) {
//Vertical Positional Movement
cg.refdef.vieworg[2] -= 48;
cg.refdef.vieworg[2] -= DEFAULT_PLAYER_HEIGHT;
cg.refdef.vieworg[2] += (vr->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
}

View file

@ -95,6 +95,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#define CS_COMBAT 1
#define CS_EXTRA 2
#define CS_JEDI 3
#define DEFAULT_PLAYER_HEIGHT 58
//=================================================
// player entities need to track more information

View file

@ -125,7 +125,7 @@ temporary marks will not be stored or randomly oriented, but immediately
passed to the renderer.
=================
*/
#define MAX_MARK_FRAGMENTS 256
#define MAX_MARK_FRAGMENTS 512
#define MAX_MARK_POINTS 768
void CG_ImpactMark( qhandle_t markShader, const vec3_t origin, const vec3_t dir,

View file

@ -35,6 +35,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#define LOOK_SWING_SCALE 0.5
//How fast the saber needs to be physically swung in order to trigger sounds and trails
#define SABER_ACTIVATE_VELOCITY 1.0f
#include "animtable.h"
@ -50,7 +53,6 @@ qboolean CG_RegisterClientModelname( clientInfo_t *ci, const char *headModelName
const char *legsModelName, const char *legsSkinName );
void CG_PlayerAnimSounds( int animFileIndex, qboolean torso, int oldFrame, int frame, int entNum );
extern void G_SoundOnEnt( gentity_t *ent, soundChannel_t channel, const char *soundPath );
extern void BG_G2SetBoneAngles( centity_t *cent, gentity_t *gent, int boneIndex, const vec3_t angles, const int flags,
const Eorientations up, const Eorientations left, const Eorientations forward, qhandle_t *modelList );
extern void FX_BorgDeathSparkParticles( vec3_t origin, vec3_t angles, vec3_t vel, vec3_t user );
@ -263,6 +265,12 @@ static void CG_RegisterCustomSounds(clientInfo_t *ci, int iSoundEntryBase,
}
//SB: Never render any player model if 1st person and using the saber
bool CG_getPlayer1stPersonSaber(const centity_t *cent) {
return (!cent->gent->NPC && !cg.renderingThirdPerson &&
cent->gent->client->ps.weapon == WP_SABER);
}
/*
================
@ -3396,6 +3404,7 @@ Adds a piece with modifications or duplications for powerups
*/
void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cent )
{
refEntity_t hiltEnt;
if ( !cent )
{
cgi_R_AddRefEntityToScene( ent );
@ -3417,44 +3426,52 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
}
}
bool player1stPersonSaber = CG_getPlayer1stPersonSaber(cent);
// if ( gent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > 0 )
// {
// centity_t *cent = &cg_entities[gent->s.number];
// cgi_S_AddLoopingSound( 0, cent->lerpOrigin, vec3_origin, cgs.media.overchargeLoopSound );
// }
if (player1stPersonSaber) {
ent->renderfx = RF_THIRD_PERSON;
}
// If certain states are active, we don't want to add in the regular body
if ( !gent->client->ps.powerups[PW_CLOAKED] &&
!gent->client->ps.powerups[PW_UNCLOAKING] &&
!gent->client->ps.powerups[PW_DISRUPTION] )
{
//SB: Never render any player model if 1st person
if (cent->gent->NPC || cg.renderingThirdPerson ||
cent->gent->client->ps.weapon != WP_SABER) {
cgi_R_AddRefEntityToScene(ent);
}
else if (!cg.renderingThirdPerson && cent->gent->client->ps.weapon == WP_SABER)
{
cgi_R_AddRefEntityToScene(ent);
}
if (player1stPersonSaber && !cent->currentState.saberInFlight)
{
//#ifdef JK2_MODE
refEntity_t hiltEnt;
memset( &hiltEnt, 0, sizeof(refEntity_t) );
hiltEnt.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON;
hiltEnt.hModel = cgi_R_RegisterModel( "models/weapons2/saber/saber_w.md3" );
vec3_t angles;
BG_CalculateVRSaberPosition(hiltEnt.origin, hiltEnt.angles);
vec3_t axis[3];
AnglesToAxis(hiltEnt.angles, axis);
VectorSubtract(vec3_origin, axis[2], hiltEnt.axis[0]);
VectorCopy(axis[1], hiltEnt.axis[1]);
VectorCopy(axis[0], hiltEnt.axis[2]);
cgi_R_AddRefEntityToScene(&hiltEnt);
if (vr->swingvelocity > 1.2f)
{
G_SoundOnEnt( cent->gent, CHAN_WEAPON, va( "sound/weapons/saber/saberhup%d.wav", Q_irand( 1, 9 ) ) );
}
memset( &hiltEnt, 0, sizeof(refEntity_t) );
hiltEnt.renderfx = RF_DEPTHHACK;
hiltEnt.hModel = cgi_R_RegisterModel( "models/weapons2/saber/saber_w.md3" );
vec3_t angles;
BG_CalculateVRSaberPosition(hiltEnt.origin, hiltEnt.angles);
VectorCopy(hiltEnt.origin, hiltEnt.oldorigin);
vec3_t axis[3];
AnglesToAxis(hiltEnt.angles, axis);
VectorSubtract(vec3_origin, axis[2], hiltEnt.axis[0]);
VectorCopy(axis[1], hiltEnt.axis[1]);
VectorCopy(axis[0], hiltEnt.axis[2]);
cgi_R_AddRefEntityToScene(&hiltEnt);
static int playingSaberSwingSound = 0;
if (vr->swingvelocity > SABER_ACTIVATE_VELOCITY && (cg.time - playingSaberSwingSound) > 750)
{
cgi_S_StartSound ( hiltEnt.origin, cent->gent->s.number, CHAN_AUTO, cgi_S_RegisterSound( va( "sound/weapons/saber/saberhup%d.wav", Q_irand( 0, 2 ) * 3 + 1 ) ) );
playingSaberSwingSound = cg.time;
}
//Try setting ent to be the hilt entity, then any subsequent effects below are applied to that instead
ent = &hiltEnt;
//#else
//#endif
}
}
// Disruptor Gun Alt-fire
@ -4466,7 +4483,7 @@ Ghoul2 Insert Start
// work the matrix axis stuff into the original axis and origins used.
gi.G2API_GiveMeVectorFromMatrix(boltMatrix, ORIGIN, org_);
gi.G2API_GiveMeVectorFromMatrix(boltMatrix, NEGATIVE_X, axis_[0]);//was NEGATIVE_Y, but the md3->glm exporter screws up this tag somethin' awful
if (!cg.renderingThirdPerson && !cent->gent->client->ps.saberInFlight)
if (!cent->gent->client->ps.saberInFlight && CG_getPlayer1stPersonSaber(cent))
{
vec3_t angles;
BG_CalculateVRSaberPosition(org_, angles);
@ -4657,7 +4674,7 @@ Ghoul2 Insert End
saberTrail_t *saberTrail = &client->saberTrail;
#define SABER_TRAIL_TIME 40.0f
#define SABER_TRAIL_TIME 60.0f
// if we happen to be timescaled or running in a high framerate situation, we don't want to flood
// the system with very small trail slices...but perhaps doing it by distance would yield better results?
@ -4670,7 +4687,9 @@ Ghoul2 Insert End
}
if ( cg.time > saberTrail->lastTime + 2 && saberTrail->inAction ) // 2ms
{
if ( saberTrail->inAction && cg.time < saberTrail->lastTime + 300 ) // if we have a stale segment, don't draw until we have a fresh one
//Swinging the saber quick enough to trigger a sound should also invoke trails
if ( (saberTrail->inAction || (vr->swingvelocity > SABER_ACTIVATE_VELOCITY)) &&
cg.time < saberTrail->lastTime + 300 ) // if we have a stale segment, don't draw until we have a fresh one
{
vec3_t rgb1={255,255,255};
@ -4815,7 +4834,8 @@ CG_Player
===============
*/
extern qboolean G_ControlledByPlayer( gentity_t *self );
void CG_Player( centity_t *cent ) {
void CG_Player(centity_t *cent ) {
clientInfo_t *ci;
qboolean shadow, staticScale = qfalse;
float shadowPlane;
@ -4859,6 +4879,9 @@ void CG_Player( centity_t *cent ) {
return;
}
//Before we go any further, default this to false, it can be updated later
vr->velocitytriggered = false;
if ( cent->currentState.vehicleModel != 0 )
{//Using an alternate (md3 for now) model
refEntity_t ent;
@ -5136,7 +5159,7 @@ extern vmCvar_t cg_thirdPersonAlpha;
}
if ( !cg.renderingThirdPerson
&& ( cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE )
&& ( /*cg.snap->ps.weapon == WP_SABER || */cg.snap->ps.weapon == WP_MELEE )
&& !cent->gent->s.number )
{// Yeah um, this needs to not do this quite this way
ent.customSkin = cgi_R_RegisterSkin( "models/players/kyle/model_fpls2.skin" ); //precached in g_client.cpp
@ -5188,6 +5211,7 @@ extern vmCvar_t cg_thirdPersonAlpha;
vec3_t angles;
BG_CalculateVRSaberPosition(cent->gent->client->renderInfo.muzzlePoint, angles);
AngleVectors( angles, cent->gent->client->renderInfo.muzzleDir, NULL, NULL );
vr->velocitytriggered = true;
}
}
}
@ -5309,7 +5333,7 @@ extern vmCvar_t cg_thirdPersonAlpha;
//FIXME: use an actual surfaceIndex?
if ( !gi.G2API_GetSurfaceRenderStatus( &cent->gent->ghoul2[cent->gent->playerModel], "r_hand" ) )//surf is still on
{
CG_AddSaberBlade( cent, cent, NULL, ent.renderfx, cent->gent->weaponModel, ent.origin, tempAngles);
CG_AddSaberBlade( cent, cent, NULL, CG_getPlayer1stPersonSaber(cent) ? 0 : ent.renderfx, cent->gent->weaponModel, ent.origin, tempAngles);
}//else, the limb will draw the blade itself
}//in-flight saber draws it's own blade
}
@ -5900,7 +5924,7 @@ Ghoul2 Insert End
{
if ( !cent->currentState.saberInFlight )
{//holding the saber in-hand
CG_AddSaberBlade( cent, cent, &gun, renderfx, 0, NULL, NULL );
CG_AddSaberBlade(cent, cent, &gun, CG_getPlayer1stPersonSaber(cent) ? 0 : renderfx, 0, NULL, NULL );
calcedMp = qtrue;
}
}

View file

@ -1660,7 +1660,7 @@ static qboolean CG_CalcViewValues( void ) {
}
}
if ( (cg.renderingThirdPerson||cg.snap->ps.weapon == WP_SABER||cg.snap->ps.weapon == WP_MELEE)
if ( (cg.renderingThirdPerson) //||cg.snap->ps.weapon == WP_SABER||cg.snap->ps.weapon == WP_MELEE)
&& !cg.zoomMode
&& !viewEntIsCam )
{

View file

@ -680,7 +680,7 @@ static void BG_CalculateVRPositionInWorld( vec3_t in_position, vec3_t in_offset
VectorCopy(in_offset, offset);
offset[1] = 0; // up/down is index 1 in this case
BG_ConvertFromVR(offset, cg.refdef.vieworg, origin);
origin[2] -= 48;
origin[2] -= DEFAULT_PLAYER_HEIGHT;
origin[2] += in_position[1] * cg_worldScale.value;
VectorCopy(in_orientation, angles);

View file

@ -110,7 +110,7 @@ const float pm_duckScale = 0.50f;
const float pm_swimScale = 0.50f;
float pm_ladderScale = 0.7f;
const float pm_accelerate = 12.0f;
const float pm_accelerate = 1200.0f;
const float pm_airaccelerate = 4.0f;
const float pm_wateraccelerate = 4.0f;
const float pm_flyaccelerate = 8.0f;
@ -5825,7 +5825,8 @@ void PM_SetSaberMove(short newMove)
{
if ( PM_SaberInAttack( newMove ) || PM_SaberInSpecialAttack( anim ) )
{//playing an attack
if ( pm->ps->saberMove != newMove )
if ( pm->ps->saberMove != newMove &&
cg.renderingThirdPerson) // don't want these sounds being triggered in 1st person
{//wasn't playing that attack before
if ( PM_SaberInSpecialAttack( anim ) )
{

View file

@ -583,7 +583,7 @@ void G_InitCvars( void ) {
g_subtitles = gi.cvar( "g_subtitles", "0", CVAR_ARCHIVE );
com_buildScript = gi.cvar ("com_buildscript", "0", 0);
g_saberAutoBlocking = gi.cvar( "g_saberAutoBlocking", "1", CVAR_ARCHIVE|CVAR_CHEAT );//must press +block button to do any blocking
g_saberAutoBlocking = gi.cvar( "g_saberAutoBlocking", "0", CVAR_ARCHIVE|CVAR_CHEAT );//must press +block button to do any blocking
g_saberRealisticCombat = gi.cvar( "g_saberRealisticCombat", "1", CVAR_ARCHIVE );//makes collision more precise, increases damage
g_saberMoveSpeed = gi.cvar( "g_saberMoveSpeed", "1", CVAR_ARCHIVE|CVAR_CHEAT );//how fast you run while attacking with a saber
g_saberAnimSpeed = gi.cvar( "g_saberAnimSpeed", "1", CVAR_ARCHIVE|CVAR_CHEAT );//how fast saber animations run

View file

@ -107,13 +107,14 @@ static void WP_FireBlasterMissile( gentity_t *ent, vec3_t start, vec3_t dir, qbo
void WP_FireBlaster( gentity_t *ent, qboolean alt_fire )
//---------------------------------------------------------
{
vec3_t dir, angs;
vec3_t dir, angs, start;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
BG_CalculateVRWeaponPosition(start, angs);
}
else {
VectorCopy(wpMuzzle, start);
vectoangles(wpFwd, angs);
}
@ -145,5 +146,5 @@ void WP_FireBlaster( gentity_t *ent, qboolean alt_fire )
AngleVectors( angs, dir, NULL, NULL );
// FIXME: if temp_org does not have clear trace to inside the bbox, don't shoot!
WP_FireBlasterMissile( ent, wpMuzzle, dir, alt_fire );
WP_FireBlasterMissile( ent, start, dir, alt_fire );
}

View file

@ -141,13 +141,22 @@ static void WP_BowcasterMainFire( gentity_t *ent )
static void WP_BowcasterAltFire( gentity_t *ent )
//---------------------------------------------------------
{
vec3_t start;
vec3_t start, forward, angs;
int damage = weaponData[WP_BOWCASTER].altDamage;
VectorCopy( wpMuzzle, start );
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(start, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy( wpMuzzle, start );
VectorCopy(wpFwd, forward);
}
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
gentity_t *missile = CreateMissile( start, wpFwd, BOWCASTER_VELOCITY, 10000, ent, qtrue );
gentity_t *missile = CreateMissile( start, forward, BOWCASTER_VELOCITY, 10000, ent, qtrue );
missile->classname = "bowcaster_alt_proj";
missile->s.weapon = WP_BOWCASTER;

View file

@ -27,6 +27,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h"
#include "w_local.h"
#include "g_functions.h"
#include "bg_local.h"
//-------------------
// DEMP2
@ -36,13 +37,22 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
static void WP_DEMP2_MainFire( gentity_t *ent )
//---------------------------------------------------------
{
vec3_t start;
vec3_t start, angs, forward;
int damage = weaponData[WP_DEMP2].damage;
VectorCopy( wpMuzzle, start );
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(start, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy( wpMuzzle, start );
VectorCopy(wpFwd, forward);
}
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
gentity_t *missile = CreateMissile( start, wpFwd, DEMP2_VELOCITY, 10000, ent );
gentity_t *missile = CreateMissile( start, forward, DEMP2_VELOCITY, 10000, ent );
missile->classname = "demp2_proj";
missile->s.weapon = WP_DEMP2;
@ -198,10 +208,19 @@ static void WP_DEMP2_AltFire( gentity_t *ent )
{
int damage = weaponData[WP_DEMP2].altDamage;
int count;
vec3_t start;
vec3_t start, angs, forward;
trace_t tr;
VectorCopy( wpMuzzle, start );
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(start, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy( wpMuzzle, start );
VectorCopy(wpFwd, forward);
}
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
count = ( level.time - ent->client->ps.weaponChargeTime ) / DEMP2_CHARGE_UNIT;
@ -219,7 +238,7 @@ static void WP_DEMP2_AltFire( gentity_t *ent )
// the shot can travel a whopping 4096 units in 1 second. Note that the shot will auto-detonate at 4096 units...we'll see if this looks cool or not
gentity_t *missile = CreateMissile( start, wpFwd, DEMP2_ALT_RANGE, 1000, ent, qtrue );
gentity_t *missile = CreateMissile( start, forward, DEMP2_ALT_RANGE, 1000, ent, qtrue );
// letting it know what the charge size is.
missile->count = count;

View file

@ -82,7 +82,17 @@ static void WP_DisruptorMainFire( gentity_t *ent )
}
}
VectorCopy( wpMuzzle, start );
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(start, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy( wpMuzzle, start );
VectorCopy(wpFwd, forward);
}
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );
// if ( ent->client && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > 0 && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > cg.time )
@ -92,16 +102,6 @@ static void WP_DisruptorMainFire( gentity_t *ent )
// }
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(wpFwd, forward);
}
VectorMA( start, shotRange, forward, end );
int ignore = ent->s.number;

View file

@ -27,6 +27,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h"
#include "w_local.h"
#include "g_functions.h"
#include "bg_local.h"
//-----------------------
// Golan Arms Flechette
@ -40,7 +41,18 @@ static void WP_FlechetteMainFire( gentity_t *ent )
gentity_t *missile;
float damage = weaponData[WP_FLECHETTE].damage, vel = FLECHETTE_VEL;
VectorCopy( wpMuzzle, start );
vec3_t forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(start, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy( wpMuzzle, start );
VectorCopy(wpFwd, forward);
}
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
// If we aren't the player, we will cut the velocity and damage of the shots
@ -58,7 +70,7 @@ static void WP_FlechetteMainFire( gentity_t *ent )
for ( int i = 0; i < FLECHETTE_SHOTS; i++ )
{
vectoangles( wpFwd, angs );
vectoangles( forward, angs );
if ( i == 0 && ent->s.number == 0 )
{
@ -255,8 +267,14 @@ static void WP_FlechetteAltFire( gentity_t *self )
{
vec3_t dir, fwd, start, angs;
vectoangles( wpFwd, angs );
VectorCopy( wpMuzzle, start );
if ( self->client && !self->NPC)
{
BG_CalculateVRWeaponPosition(start, angs);
}
else {
vectoangles( wpFwd, angs );
VectorCopy( wpMuzzle, start );
}
WP_TraceSetStart( self, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall

View file

@ -27,19 +27,18 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h"
#include "w_local.h"
#include "g_functions.h"
#include "bg_local.h"
//-------------------
// Heavy Repeater
//-------------------
//---------------------------------------------------------
static void WP_RepeaterMainFire( gentity_t *ent, vec3_t dir )
static void WP_RepeaterMainFire( gentity_t *ent, vec3_t dir, vec3_t start )
//---------------------------------------------------------
{
vec3_t start;
int damage = weaponData[WP_REPEATER].damage;
VectorCopy( wpMuzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
gentity_t *missile = CreateMissile( start, dir, REPEATER_VELOCITY, 10000, ent );
@ -84,11 +83,20 @@ static void WP_RepeaterMainFire( gentity_t *ent, vec3_t dir )
static void WP_RepeaterAltFire( gentity_t *ent )
//---------------------------------------------------------
{
vec3_t start;
int damage = weaponData[WP_REPEATER].altDamage;
gentity_t *missile = NULL;
VectorCopy( wpMuzzle, start );
vec3_t forward, start, angs;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(start, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy( wpFwd, forward );
VectorCopy( wpMuzzle, start );
}
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
if ( ent->client && ent->client->NPC_class == CLASS_GALAKMECH )
@ -97,7 +105,7 @@ static void WP_RepeaterAltFire( gentity_t *ent )
}
else
{
missile = CreateMissile( start, wpFwd, REPEATER_ALT_VELOCITY, 10000, ent, qtrue );
missile = CreateMissile( start, forward, REPEATER_ALT_VELOCITY, 10000, ent, qtrue );
}
missile->classname = "repeater_alt_proj";
@ -151,7 +159,15 @@ void WP_FireRepeater( gentity_t *ent, qboolean alt_fire )
{
vec3_t dir, angs;
vectoangles( wpFwd, angs );
vec3_t forward, start;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(start, angs);
}
else {
vectoangles( wpFwd, angs );
VectorCopy( wpMuzzle, start );
}
if ( alt_fire )
{
@ -179,6 +195,6 @@ void WP_FireRepeater( gentity_t *ent, qboolean alt_fire )
AngleVectors( angs, dir, NULL, NULL );
// FIXME: if temp_org does not have clear trace to inside the bbox, don't shoot!
WP_RepeaterMainFire( ent, dir );
WP_RepeaterMainFire( ent, dir, start );
}
}

View file

@ -27,6 +27,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h"
#include "w_local.h"
#include "g_functions.h"
#include "bg_local.h"
//-----------------------
// Rocket Launcher
@ -151,10 +152,20 @@ void WP_FireRocket( gentity_t *ent, qboolean alt_fire )
vel *= 0.5f;
}
VectorCopy( wpMuzzle, start );
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(start, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy( wpMuzzle, start );
VectorCopy(wpFwd, forward);
}
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
gentity_t *missile = CreateMissile( start, wpFwd, vel, 10000, ent, alt_fire );
gentity_t *missile = CreateMissile( start, forward, vel, 10000, ent, alt_fire );
missile->classname = "rocket_proj";
missile->s.weapon = WP_ROCKET_LAUNCHER;

View file

@ -266,7 +266,7 @@ void G_CreateG2AttachedWeaponModel( gentity_t *ent, const char *psWeaponModel )
{
if (!psWeaponModel)
{
assert (psWeaponModel);
// assert (psWeaponModel);
return;
}
if ( ent && ent->client && ent->client->NPC_class == CLASS_GALAKMECH )
@ -3973,7 +3973,14 @@ void WP_RunSaber( gentity_t *self, gentity_t *saber )
//figure out where saber should be
vec3_t forward, saberHome, saberDest, fwdangles = {0};
VectorCopy( self->client->ps.viewangles, fwdangles );
if (self->client->ps.clientNum == 0)
{
BG_CalculateVRWeaponPosition(saberHome, fwdangles);
}
else {
VectorCopy(self->client->ps.viewangles, fwdangles);
}
if ( self->s.number )
{
fwdangles[0] -= 8;

View file

@ -27,6 +27,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h"
#include "w_local.h"
#include "g_functions.h"
#include "bg_local.h"
//---------------------
// Thermal Detonator
@ -273,8 +274,17 @@ gentity_t *WP_FireThermalDetonator( gentity_t *ent, qboolean alt_fire )
vec3_t dir, start;
float damageScale = 1.0f;
VectorCopy( wpFwd, dir );
VectorCopy( wpMuzzle, start );
if ( ent->client && !ent->NPC)
{
vec3_t angs;
BG_CalculateVRWeaponPosition(start, angs);
AngleVectors(angs, dir, NULL, NULL);
}
else {
VectorCopy( wpFwd, dir );
VectorCopy( wpMuzzle, start );
}
bolt = G_Spawn();

View file

@ -7,7 +7,7 @@ seta vr_weapon_adjustment_1 "0.55,-4.89,8.12,-12.36,-28.60,10.80,-199.50"
seta vr_weapon_adjustment_2 "1.308,-3.976,5.245,-6.544,0.000,0.000,0.000"
seta vr_weapon_adjustment_3 "1.308,-3.976,6.177,-9.694,0.000,0.000,0.000"
seta vr_weapon_adjustment_4 "0.44,-8.75,12.50,-2.31,-0.00,-1.80,5.00"
seta vr_weapon_adjustment_5 "0.53,-8.59,9.51,-17.38,0.40,1.50,-0.60"
seta vr_weapon_adjustment_5 "1.500,-2.747,5.707,-7.827,1.800,0.000,0.000"
seta vr_weapon_adjustment_6 "0.57,-10.07,14.09,-21.36,28.00,30.50,-0.60"
seta vr_weapon_adjustment_7 "1.22,-5.65,6.81,-3.40,0.00,0.20,0.70"
seta vr_weapon_adjustment_8 "0.67,-9.31,12.49,-7.42,0.50,0.20,0.70"