Multiple fixes

- Fixed some crashes
- weapons (for the first level of outcast) should be aligned
- ducking works, player height now correct
some button changes:

A - Jump
B - Alt Fire
X - Use current Force (no use in outcast atm)
Y - Select next Force Power
Right Thumbstick Button - "Use"
Left Thumbstick Button - Duck - good for side rolls etc
Right Grip - Slow time to 10% (testing this for the weapon/force selector, also quite fun)
Left Grip - two handed weapons (no advantage to this at the moment)

You should find that weapons are now properly motion controlled
This commit is contained in:
Simon 2022-10-01 00:02:49 +01:00
parent 385017812e
commit 9620011ed5
24 changed files with 258 additions and 176 deletions

View file

@ -160,11 +160,18 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
float controllerYawHeading = 0.0f;
//Turn on weapon stabilisation?
bool stabilised = qfalse;
if (!vr.pistol && // Don't stabilise pistols
(pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) && (distance < STABILISATION_DISTANCE))
bool offhandGripPushed = (pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger);
if ( (offhandGripPushed != (pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger)) &&
offhandGripPushed && (distance < STABILISATION_DISTANCE))
#ifndef DEBUG
{
stabilised = qtrue;
}
#else
{
Cvar_Set("vr_control_scheme", "99");
}
#endif
vr.weapon_stabilised = stabilised;
@ -397,14 +404,25 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
if (dominantGripPushTime == 0) {
dominantGripPushTime = GetTimeInMilliSeconds();
}
Cvar_Set("timescale", "0.1");
}
else
{
dominantGripPushTime = 0;
Cvar_Set("timescale", "1.0");
}
}
}
#define JOYX_SAMPLE_COUNT 4
static float joyx[JOYX_SAMPLE_COUNT] = {0};
for (int j = JOYX_SAMPLE_COUNT-1; j > 0; --j)
joyx[j] = joyx[j-1];
joyx[0] = pPrimaryJoystick->x;
float sum = 0.0f;
for (int j = 0; j < JOYX_SAMPLE_COUNT; ++j)
sum += joyx[j];
float primaryJoystickX = sum / 4.0f;
//Right-hand specific stuff
@ -430,6 +448,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
positional_movementSideways,
positional_movementForward);
//Jump (A Button)
if ((primaryButtonsNew & primaryButton1) != (primaryButtonsOld & primaryButton1))
{
@ -460,7 +479,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
//Duck - off hand joystick
if ((secondaryButtonsNew & secondaryThumb) !=
(secondaryButtonsNew & secondaryThumb)) {
(secondaryButtonsOld & secondaryThumb)) {
sendButtonAction("+movedown", (secondaryButtonsNew & secondaryThumb));
}
@ -474,7 +493,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
//Weapon Chooser
static bool itemSwitched = false;
if (between(-0.2f, pPrimaryJoystick->x, 0.2f) &&
if (between(-0.2f, primaryJoystickX, 0.2f) &&
(between(0.8f, pPrimaryJoystick->y, 1.0f) ||
between(-1.0f, pPrimaryJoystick->y, -0.8f)))
{
@ -552,7 +571,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
static int syncCount = 0;
static int increaseSnap = true;
if (!vr.mountedgun && !vr.scopeengaged) {
if (pPrimaryJoystick->x > 0.7f) {
if (primaryJoystickX > 0.7f) {
if (increaseSnap) {
float turnAngle = vr_turn_mode->integer ? (vr_turn_angle->value / 9.0f) : vr_turn_angle->value;
vr.snapTurn -= turnAngle;
@ -565,12 +584,12 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
vr.snapTurn += 360.f;
}
}
} else if (pPrimaryJoystick->x < 0.3f) {
} else if (primaryJoystickX < 0.3f) {
increaseSnap = true;
}
static int decreaseSnap = true;
if (pPrimaryJoystick->x < -0.7f) {
if (primaryJoystickX < -0.7f) {
if (decreaseSnap) {
float turnAngle = vr_turn_mode->integer ? (vr_turn_angle->value / 9.0f) : vr_turn_angle->value;
@ -585,12 +604,12 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
vr.snapTurn -= 360.f;
}
}
} else if (pPrimaryJoystick->x > -0.3f) {
} else if (primaryJoystickX > -0.3f) {
decreaseSnap = true;
}
}
else {
if (fabs(pPrimaryJoystick->x) > 0.5f) {
if (fabs(primaryJoystickX) > 0.5f) {
increaseSnap = false;
}
else

View file

@ -149,6 +149,19 @@ void HandleInput_WeaponAlign( ovrInputStateTrackedRemote *pDominantTrackedRemote
}
}
bool offhandGripPushed = (pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger);
if ( (offhandGripPushed != (pOffTrackedRemoteOld->Buttons & ovrButton_GripTrigger)) &&
offhandGripPushed)
#ifndef DEBUG
{
}
#else
{
Cvar_Set("vr_control_scheme", "0");
}
#endif
//Next Weapon with A
if (((pDominantTrackedRemoteNew->Buttons & domButton1) !=
(pDominantTrackedRemoteOld->Buttons & domButton1)) &&
@ -169,14 +182,25 @@ void HandleInput_WeaponAlign( ovrInputStateTrackedRemote *pDominantTrackedRemote
char* item_names[7] = {"scale", "right", "up", "forward", "pitch", "yaw", "roll"};
float item_inc[7] = {0.002, 0.02, 0.02, 0.02, 0.1, 0.1, 0.1};
#define JOYX_SAMPLE_COUNT 4
static float joyx[JOYX_SAMPLE_COUNT] = {0};
for (int j = JOYX_SAMPLE_COUNT-1; j > 0; --j)
joyx[j] = joyx[j-1];
joyx[0] = pDominantTrackedRemoteNew->Joystick.x;
float sum = 0.0f;
for (int j = 0; j < JOYX_SAMPLE_COUNT; ++j)
sum += joyx[j];
float primaryJoystickX = sum / 4.0f;
//Weapon/Inventory Chooser
static bool itemSwitched = false;
if (between(-0.2f, pDominantTrackedRemoteNew->Joystick.y, 0.2f) &&
(between(0.8f, pDominantTrackedRemoteNew->Joystick.x, 1.0f) ||
between(-1.0f, pDominantTrackedRemoteNew->Joystick.x, -0.8f)))
(between(0.8f, primaryJoystickX, 1.0f) ||
between(-1.0f, primaryJoystickX, -0.8f)))
{
if (!itemSwitched) {
if (between(0.8f, pDominantTrackedRemoteNew->Joystick.x, 1.0f))
if (between(0.8f, primaryJoystickX, 1.0f))
{
item_index++;
if (item_index == 7)
@ -211,7 +235,7 @@ void HandleInput_WeaponAlign( ovrInputStateTrackedRemote *pDominantTrackedRemote
}
if (between(-0.2f, pDominantTrackedRemoteNew->Joystick.x, 0.2f))
if (between(-0.2f, primaryJoystickX, 0.2f))
{
if (pDominantTrackedRemoteNew->Joystick.y > 0.6f) {
*(items[item_index]) += item_inc[item_index];

View file

@ -4288,7 +4288,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
if (!in_camera || vr->immersive_cinematics) {
//Vertical Positional Movement
cg.refdef.vieworg[2] -= (float)g_entities[cg.snap->ps.viewEntity].client->ps.viewheight;
cg.refdef.vieworg[2] -= 48;
cg.refdef.vieworg[2] += (vr->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
}

View file

@ -1108,7 +1108,7 @@ static void CG_OffsetFirstPersonView( qboolean firstPersonSaber ) {
angles[PITCH] = perc*-15;
}
// add angles based on weapon kick
/* // add angles based on weapon kick
int kickTime = (cg.time - cg.kick_time);
if ( kickTime < 800 )
{//kicks are always 1 second long. Deal with it.
@ -1123,7 +1123,7 @@ static void CG_OffsetFirstPersonView( qboolean firstPersonSaber ) {
kickPerc = kickTime/600.0f;
}
VectorMA( angles, kickPerc, cg.kick_angles, angles );
}
}*/
// add angles based on damage kick
if ( cg.damageTime ) {

View file

@ -1194,16 +1194,26 @@ void CG_AddViewWeapon( playerState_t *ps )
trace_t trace;
VectorMA(origin, 256, forward, endForward);
CG_TestLine(origin, endForward, FRAMETIME, 0xFF0000, 0.5 );
static vec3_t WHITE ={1.0f,1.0f,1.0f};
FX_AddLine( -1, origin, endForward, 0.1f, 4.0f, 0.0f,
1.0f, 0.0f, 0.0f,
WHITE, WHITE, 0.0f,
120, cgi_R_RegisterShader( "gfx/effects/redLine" ),
0, FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
VectorMA(origin, 20, right, endRight);
CG_TestLine(origin, endRight, FRAMETIME, 0x00FF00, 0.5 );
FX_AddLine( -1, origin, endRight, 0.1f, 4.0f, 0.0f,
1.0f, 0.0f, 0.0f,
WHITE, WHITE, 0.0f,
120, cgi_R_RegisterShader( "gfx/effects/blueLine" ),
0, FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
VectorMA(origin, 20, up, endUp);
CG_TestLine(origin, endUp, FRAMETIME, 0x0000FF, 0.5 );
CG_CenterPrint(vr->test_name, 240);
FX_AddLine( -1, origin, endUp, 0.1f, 4.0f, 0.0f,
1.0f, 0.0f, 0.0f,
WHITE, WHITE, 0.0f,
120, cgi_R_RegisterShader( "gfx/misc/whiteline2" ),
0, FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
}
// set up gun position

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] -= (float)g_entities[cg.snap->ps.viewEntity].client->ps.viewheight;
origin[2] -= 48;
origin[2] += in_position[1] * cg_worldScale.value;
VectorCopy(in_orientation, angles);

View file

@ -165,7 +165,7 @@ const float pm_swimScale = 0.50f;
float pm_ladderScale = 0.7f;
const float pm_vehicleaccelerate = 36.0f;
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;

View file

@ -39,10 +39,11 @@ void WP_FireBryarPistol( gentity_t *ent, qboolean alt_fire )
vec3_t start;
int damage = !alt_fire ? weaponData[WP_BRYAR_PISTOL].damage : weaponData[WP_BRYAR_PISTOL].altDamage;
vec3_t angs;
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
vectoangles(forwardVec, angs);
@ -68,13 +69,13 @@ void WP_FireBryarPistol( gentity_t *ent, qboolean alt_fire )
angs[YAW] += ( Q_flrand(-1.0f, 1.0f) * ((5-ent->NPC->currentAim)*0.25f) );
}
AngleVectors( angs, forwardVec, NULL, NULL );
AngleVectors( angs, forward, NULL, NULL );
}
}
WP_MissileTargetHint(ent, start, forwardVec);
WP_MissileTargetHint(ent, start, forward);
gentity_t *missile = CreateMissile( start, forwardVec, BRYAR_PISTOL_VEL, 10000, ent, alt_fire );
gentity_t *missile = CreateMissile( start, forward, BRYAR_PISTOL_VEL, 10000, ent, alt_fire );
missile->classname = "bryar_proj";
if ( ent->s.weapon == WP_BLASTER_PISTOL

View file

@ -37,9 +37,18 @@ static void WP_BowcasterMainFire( gentity_t *ent )
{
int damage = weaponData[WP_BOWCASTER].damage, count;
float vel;
vec3_t angs, dir, start;
vec3_t angs, forward, dir, start;
gentity_t *missile;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(forwardVec, forward);
}
VectorCopy( muzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
@ -89,14 +98,7 @@ static void WP_BowcasterMainFire( gentity_t *ent )
// create a range of different velocities
vel = BOWCASTER_VELOCITY * ( Q_flrand(-1.0f, 1.0f) * BOWCASTER_VEL_RANGE + 1.0f );
vec3_t angs;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
}
else {
vectoangles(forwardVec, angs);
}
vectoangles( forward, angs );
if ( !(ent->client->ps.forcePowersActive&(1<<FP_SEE))
|| ent->client->ps.forcePowerLevel[FP_SEE] < FORCE_LEVEL_2 )

View file

@ -59,16 +59,6 @@ static void WP_DisruptorMainFire( gentity_t *ent )
}
}
VectorCopy( muzzle, start );
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 )
// {
// // in overcharge mode, so doing double damage
// damage *= 2;
// }
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
@ -79,6 +69,15 @@ static void WP_DisruptorMainFire( gentity_t *ent )
VectorCopy(forwardVec, forward);
}
VectorCopy( muzzle, start );
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 )
// {
// // in overcharge mode, so doing double damage
// damage *= 2;
// }
WP_MissileTargetHint(ent, start, forward);
VectorMA( start, shotRange, forward, end );
@ -130,11 +129,11 @@ static void WP_DisruptorMainFire( gentity_t *ent )
int hitLoc = G_GetHitLocFromTrace( &tr, MOD_DISRUPTOR );
if ( traceEnt && traceEnt->client && traceEnt->client->NPC_class == CLASS_GALAKMECH )
{//hehe
G_Damage( traceEnt, ent, ent, forwardVec, tr.endpos, 3, DAMAGE_DEATH_KNOCKBACK, MOD_DISRUPTOR, hitLoc );
G_Damage( traceEnt, ent, ent, forward, tr.endpos, 3, DAMAGE_DEATH_KNOCKBACK, MOD_DISRUPTOR, hitLoc );
}
else
{
G_Damage( traceEnt, ent, ent, forwardVec, tr.endpos, damage, DAMAGE_DEATH_KNOCKBACK, MOD_DISRUPTOR, hitLoc );
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_DEATH_KNOCKBACK, MOD_DISRUPTOR, hitLoc );
}
}
else
@ -148,10 +147,10 @@ static void WP_DisruptorMainFire( gentity_t *ent )
for ( dist = 0; dist < shotDist; dist += 64 )
{
//FIXME: on a really long shot, this could make a LOT of alerts in one frame...
VectorMA( start, dist, forwardVec, spot );
VectorMA( start, dist, forward, spot );
AddSightEvent( ent, spot, 256, AEL_DISCOVERED, 50 );
}
VectorMA( start, shotDist-4, forwardVec, spot );
VectorMA( start, shotDist-4, forward, spot );
AddSightEvent( ent, spot, 256, AEL_DISCOVERED, 50 );
}
@ -168,6 +167,16 @@ void WP_DisruptorAltFire( gentity_t *ent )
float dist, shotDist, shotRange = 8192;
qboolean hitDodged = qfalse, fullCharge = qfalse;
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(forwardVec, forward);
}
VectorCopy( muzzle, muzzle2 ); // making a backup copy
// The trace start will originate at the eye so we can ensure that it hits the crosshair.
@ -192,8 +201,7 @@ void WP_DisruptorAltFire( gentity_t *ent )
}
else
{
VectorCopy( ent->client->renderInfo.eyePoint, start );
AngleVectors( ent->client->renderInfo.eyeAngles, forwardVec, NULL, NULL );
VectorCopy( muzzle, start );
// don't let NPC's do charging
int count = ( level.time - ent->client->ps.weaponChargeTime - 50 ) / DISRUPTOR_CHARGE_UNIT;
@ -232,7 +240,7 @@ void WP_DisruptorAltFire( gentity_t *ent )
for ( int i = 0; i < traces; i++ )
{
VectorMA( start, shotRange, forwardVec, end );
VectorMA( start, shotRange, forward, end );
//NOTE: if you want to be able to hit guys in emplaced guns, use "G2_COLLIDE, 10" instead of "G2_RETURNONHIT, 0"
//alternately, if you end up hitting an emplaced_gun that has a sitter, just redo this one trace with the "G2_COLLIDE, 10" to see if we it the sitter
@ -297,10 +305,10 @@ void WP_DisruptorAltFire( gentity_t *ent )
int hitLoc = G_GetHitLocFromTrace( &tr, MOD_DISRUPTOR );
if ( traceEnt && traceEnt->client && traceEnt->client->NPC_class == CLASS_GALAKMECH )
{//hehe
G_Damage( traceEnt, ent, ent, forwardVec, tr.endpos, 10, DAMAGE_NO_KNOCKBACK|DAMAGE_NO_HIT_LOC, fullCharge ? MOD_SNIPER : MOD_DISRUPTOR, hitLoc );
G_Damage( traceEnt, ent, ent, forward, tr.endpos, 10, DAMAGE_NO_KNOCKBACK|DAMAGE_NO_HIT_LOC, fullCharge ? MOD_SNIPER : MOD_DISRUPTOR, hitLoc );
break;
}
G_Damage( traceEnt, ent, ent, forwardVec, tr.endpos, damage, DAMAGE_NO_KNOCKBACK|DAMAGE_NO_HIT_LOC, fullCharge ? MOD_SNIPER : MOD_DISRUPTOR, hitLoc );
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK|DAMAGE_NO_HIT_LOC, fullCharge ? MOD_SNIPER : MOD_DISRUPTOR, hitLoc );
if ( traceEnt->s.eType == ET_MOVER )
{//stop the traces on any mover
break;
@ -345,7 +353,7 @@ void WP_DisruptorAltFire( gentity_t *ent )
AddSightEvent( ent, spot, 256, AEL_DISCOVERED, 50 );
}
//FIXME: spawn a temp ent that continuously spawns sight alerts here? And 1 sound alert to draw their attention?
VectorMA( start, shotDist-4, forwardVec, spot );
VectorMA( start, shotDist-4, forward, spot );
AddSightEvent( ent, spot, 256, AEL_DISCOVERED, 50 );
}
@ -362,5 +370,15 @@ void WP_FireDisruptor( gentity_t *ent, qboolean alt_fire )
WP_DisruptorMainFire( ent );
}
G_PlayEffect( G_EffectIndex( "disruptor/line_cap" ), muzzle, forwardVec );
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(forwardVec, forward);
}
G_PlayEffect( G_EffectIndex( "disruptor/line_cap" ), muzzle, forward );
}

View file

@ -1057,6 +1057,12 @@ void RB_CalcSpecularAlpha( unsigned char *alphas ) {
alphas += 3;
//What the hell is this doing as a NaN?!?
if (Q_isnan(backEnd.ori.viewOrigin[0]))
{
return;
}
numVertexes = tess.numVertexes;
for (i = 0 ; i < numVertexes ; i++, v += 4, normal += 4, alphas += 4) {
float ilength;

View file

@ -2507,7 +2507,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
if (!in_camera || vr->immersive_cinematics) {
//Vertical Positional Movement
cg.refdef.vieworg[2] -= (float)g_entities[cg.snap->ps.viewEntity].client->ps.viewheight;
cg.refdef.vieworg[2] -= 48;
cg.refdef.vieworg[2] += (vr->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
}

View file

@ -1055,7 +1055,7 @@ static void CG_OffsetFirstPersonView( qboolean firstPersonSaber ) {
}
// add angles based on weapon kick
VectorAdd (angles, cg.kick_angles, angles);
//VectorAdd (angles, cg.kick_angles, angles);
// add angles based on damage kick
if ( cg.damageTime ) {

View file

@ -804,7 +804,9 @@ static float CG_CalculateWeaponPositionAndScale( playerState_t *ps, vec3_t origi
VectorCopy(vr->test_offset, offset);
CG_CenterPrint( vr->test_name, SMALLCHAR_WIDTH );
int w = cgi_R_Font_StrLenPixels(vr->test_name, cgs.media.qhFontSmall, 1.0f);
int x = ( SCREEN_WIDTH - w ) / 2;
cgi_R_Font_DrawString(x, (SCREEN_HEIGHT / 2), vr->test_name, colorTable[CT_ICON_BLUE], cgs.media.qhFontSmall, -1, 1.0f);
} else {
if (ps->weapon != 0)
{
@ -1109,22 +1111,35 @@ void CG_AddViewWeapon( playerState_t *ps )
if (strcmp(cgi_Cvar_Get("vr_control_scheme"), "99") == 0) {
vec3_t origin;
vec3_t endForward, endRight, endUp;
vec3_t angles;
clientInfo_t ci;
BG_CalculateVRWeaponPosition( origin, angles );
vec3_t _angles;
BG_CalculateVRWeaponPosition( origin, _angles );
vec3_t forward, right, up;
AngleVectors(angles, forward, right, up);
AngleVectors(_angles, forward, right, up);
trace_t trace;
VectorMA(origin, 256, forward, endForward);
CG_TestLine(origin, endForward, FRAMETIME, 0xFF0000, 0.5 );
static vec3_t WHITE ={1.0f,1.0f,1.0f};
FX_AddLine( origin, endForward, 0.1f, 4.0f, 0.0f,
1.0f, 0.0f, 0.0f,
WHITE, WHITE, 0.0f,
120, cgi_R_RegisterShader( "gfx/effects/redLine" ),
FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
VectorMA(origin, 20, right, endRight);
CG_TestLine(origin, endRight, FRAMETIME, 0x00FF00, 0.5 );
vec3_t color = { 0, 0, 255 };
FX_AddLine( origin, endRight, 0.1f, 4.0f, 0.0f,
1.0f, 0.0f, 0.0f,
color, color, 0.0f,
120, cgi_R_RegisterShader( "gfx/misc/nav_line" ),
FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
VectorMA(origin, 20, up, endUp);
CG_TestLine(origin, endUp, FRAMETIME, 0x0000FF, 0.5 );
FX_AddLine( origin, endUp, 0.1f, 4.0f, 0.0f,
1.0f, 0.0f, 0.0f,
WHITE, WHITE, 0.0f,
120, cgi_R_RegisterShader( "gfx/misc/whiteline2" ),
FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
CG_CenterPrint(vr->test_name, 240);

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] -= (float)g_entities[cg.snap->ps.viewEntity].client->ps.viewheight;
origin[2] -= 48;
origin[2] += in_position[1] * cg_worldScale.value;
VectorCopy(in_orientation, angles);

View file

@ -556,6 +556,8 @@ void CNavigator::Free( void )
{
delete (*ni);
}
m_nodes.clear();
}
/*

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"
//---------------
// Blaster
@ -108,7 +109,13 @@ void WP_FireBlaster( gentity_t *ent, qboolean alt_fire )
{
vec3_t dir, angs;
vectoangles( wpFwd, angs );
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
}
else {
vectoangles(wpFwd, angs);
}
if ( alt_fire )
{

View file

@ -26,6 +26,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"
//-------------------
// Wookiee Bowcaster
@ -37,9 +38,18 @@ static void WP_BowcasterMainFire( gentity_t *ent )
{
int damage = weaponData[WP_BOWCASTER].damage, count;
float vel;
vec3_t angs, dir, start;
vec3_t angs, forward, dir, start;
gentity_t *missile;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(wpMuzzle, 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
@ -88,7 +98,7 @@ static void WP_BowcasterMainFire( gentity_t *ent )
// create a range of different velocities
vel = BOWCASTER_VELOCITY * ( Q_flrand(-1.0f, 1.0f) * BOWCASTER_VEL_RANGE + 1.0f );
vectoangles( wpFwd, angs );
vectoangles( forward, angs );
// add some slop to the fire direction
angs[PITCH] += Q_flrand(-1.0f, 1.0f) * BOWCASTER_ALT_SPREAD * 0.2f;

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"
//---------------
// Bryar Pistol
@ -39,15 +40,21 @@ void WP_FireBryarPistol( gentity_t *ent, qboolean alt_fire )
vec3_t start;
int damage = !alt_fire ? weaponData[ent->s.weapon].damage : weaponData[ent->s.weapon].altDamage;
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
vectoangles(wpFwd, angs);
}
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->NPC && ent->NPC->currentAim < 5 )
{
vec3_t angs;
vectoangles( wpFwd, angs );
if ( ent->client->NPC_class == CLASS_IMPWORKER )
{//*sigh*, hack to make impworkers less accurate without affecteing imperial officer accuracy
angs[PITCH] += ( Q_flrand(-1.0f, 1.0f) * (BLASTER_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f
@ -59,10 +66,10 @@ void WP_FireBryarPistol( gentity_t *ent, qboolean alt_fire )
angs[YAW] += ( Q_flrand(-1.0f, 1.0f) * ((5-ent->NPC->currentAim)*0.25f) );
}
AngleVectors( angs, wpFwd, NULL, NULL );
AngleVectors( angs, forward, NULL, NULL );
}
gentity_t *missile = CreateMissile( start, wpFwd, BRYAR_PISTOL_VEL, 10000, ent, alt_fire );
gentity_t *missile = CreateMissile( start, forward, BRYAR_PISTOL_VEL, 10000, ent, alt_fire );
missile->classname = "bryar_proj";
missile->s.weapon = WP_BRYAR_PISTOL;

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"
//---------------------
// Tenloss Disruptor
@ -90,7 +91,18 @@ static void WP_DisruptorMainFire( gentity_t *ent )
// damage *= 2;
// }
VectorMA( start, shotRange, wpFwd, end );
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;
int traces = 0;
@ -176,6 +188,16 @@ void WP_DisruptorAltFire( gentity_t *ent )
float dist, shotDist, shotRange = 8192;
qboolean hitDodged = qfalse, fullCharge = qfalse;
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(wpFwd, forward);
}
VectorCopy( wpMuzzle, muzzle2 ); // making a backup copy
// The trace start will originate at the eye so we can ensure that it hits the crosshair.
@ -200,8 +222,7 @@ void WP_DisruptorAltFire( gentity_t *ent )
}
else
{
VectorCopy( ent->client->renderInfo.eyePoint, start );
AngleVectors( ent->client->renderInfo.eyeAngles, wpFwd, NULL, NULL );
VectorCopy( wpMuzzle, start );
// don't let NPC's do charging
int count = ( level.time - ent->client->ps.weaponChargeTime - 50 ) / DISRUPTOR_CHARGE_UNIT;
@ -240,7 +261,7 @@ void WP_DisruptorAltFire( gentity_t *ent )
for ( int i = 0; i < traces; i++ )
{
VectorMA( start, shotRange, wpFwd, end );
VectorMA( start, shotRange, forward, end );
//NOTE: if you want to be able to hit guys in emplaced guns, use "G2_COLLIDE, 10" instead of "G2_RETURNONHIT, 0"
//alternately, if you end up hitting an emplaced_gun that has a sitter, just redo this one trace with the "G2_COLLIDE, 10" to see if we it the sitter
@ -302,10 +323,10 @@ void WP_DisruptorAltFire( gentity_t *ent )
int hitLoc = G_GetHitLocFromTrace( &tr, MOD_DISRUPTOR );
if ( traceEnt && traceEnt->client && traceEnt->client->NPC_class == CLASS_GALAKMECH )
{//hehe
G_Damage( traceEnt, ent, ent, wpFwd, tr.endpos, 10, DAMAGE_NO_KNOCKBACK|DAMAGE_NO_HIT_LOC, fullCharge ? MOD_SNIPER : MOD_DISRUPTOR, hitLoc );
G_Damage( traceEnt, ent, ent, forward, tr.endpos, 10, DAMAGE_NO_KNOCKBACK|DAMAGE_NO_HIT_LOC, fullCharge ? MOD_SNIPER : MOD_DISRUPTOR, hitLoc );
break;
}
G_Damage( traceEnt, ent, ent, wpFwd, tr.endpos, damage, DAMAGE_NO_KNOCKBACK|DAMAGE_NO_HIT_LOC, fullCharge ? MOD_SNIPER : MOD_DISRUPTOR, hitLoc );
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK|DAMAGE_NO_HIT_LOC, fullCharge ? MOD_SNIPER : MOD_DISRUPTOR, hitLoc );
}
else
{
@ -341,7 +362,7 @@ void WP_DisruptorAltFire( gentity_t *ent )
AddSightEvent( ent, spot, 256, AEL_DISCOVERED, 50 );
}
//FIXME: spawn a temp ent that continuously spawns sight alerts here? And 1 sound alert to draw their attention?
VectorMA( start, shotDist-4, wpFwd, spot );
VectorMA( start, shotDist-4, forward, spot );
AddSightEvent( ent, spot, 256, AEL_DISCOVERED, 50 );
}
@ -358,5 +379,15 @@ void WP_FireDisruptor( gentity_t *ent, qboolean alt_fire )
WP_DisruptorMainFire( ent );
}
G_PlayEffect( G_EffectIndex( "disruptor/line_cap" ), wpMuzzle, wpFwd );
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
AngleVectors(wpMuzzle, forward, NULL, NULL);
}
else {
VectorCopy(wpFwd, forward);
}
G_PlayEffect( G_EffectIndex( "disruptor/line_cap" ), wpMuzzle, forward );
}

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"
//---------------------------------------------------------
void WP_FireStunBaton( gentity_t *ent, qboolean alt_fire )
@ -37,10 +38,20 @@ 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)
{
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(wpFwd, forward);
}
VectorCopy( wpMuzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );
VectorMA( start, STUN_BATON_RANGE, wpFwd, end );
VectorMA( start, STUN_BATON_RANGE, forward, end );
VectorSet( maxs, 5, 5, 5 );
VectorScale( maxs, -1, mins );
@ -62,10 +73,10 @@ void WP_FireStunBaton( gentity_t *ent, qboolean alt_fire )
// G_Sound( tr_ent, G_SoundIndex( va("sound/weapons/melee/punch%d", Q_irand(1, 4)) ) );
tr_ent->client->ps.powerups[PW_SHOCKED] = level.time + 1500;
G_Damage( tr_ent, ent, ent, wpFwd, tr.endpos, weaponData[WP_STUN_BATON].damage, DAMAGE_NO_KNOCKBACK, MOD_MELEE );
G_Damage( tr_ent, ent, ent, forward, tr.endpos, weaponData[WP_STUN_BATON].damage, DAMAGE_NO_KNOCKBACK, MOD_MELEE );
}
else if ( tr_ent->svFlags & SVF_GLASS_BRUSH || ( tr_ent->svFlags & SVF_BBRUSH && tr_ent->material == 12 )) // material grate...we are breaking a grate!
{
G_Damage( tr_ent, ent, ent, wpFwd, tr.endpos, 999, DAMAGE_NO_KNOCKBACK, MOD_MELEE ); // smash that puppy
G_Damage( tr_ent, ent, ent, forward, tr.endpos, 999, DAMAGE_NO_KNOCKBACK, MOD_MELEE ); // smash that puppy
}
}

View file

@ -1 +1 @@
ja
jo

View file

@ -1,55 +1,4 @@
///////////////////////////////////////////////////////////////////
// Weapon IDs
//
// WP_NONE,
//
// // Player weapons
// WP_SABER, // player and NPC weapon
// WP_BLASTER_PISTOL, // player and NPC weapon
// WP_BLASTER, // player and NPC weapon
// WP_DISRUPTOR, // player and NPC weapon
// WP_BOWCASTER, // NPC weapon - player can pick this up, but never starts with them
// WP_REPEATER, // NPC weapon - player can pick this up, but never starts with them
// WP_DEMP2, // NPC weapon - player can pick this up, but never starts with them
// WP_FLECHETTE, // NPC weapon - player can pick this up, but never starts with them
// WP_ROCKET_LAUNCHER, // NPC weapon - player can pick this up, but never starts with them
// WP_THERMAL, // player and NPC weapon
// WP_TRIP_MINE, // NPC weapon - player can pick this up, but never starts with them
// WP_DET_PACK, // NPC weapon - player can pick this up, but never starts with them
// WP_CONCUSSION, // NPC weapon - player can pick this up, but never starts with them
//
// //extras
// WP_MELEE, // player and NPC weapon - Any old melee attack
//
// //when in atst
// WP_ATST_MAIN,
// WP_ATST_SIDE,
//
// // These can never be gotten directly by the player
// WP_STUN_BATON, // stupid weapon, should remove
//
// //NPC weapons
// WP_BRYAR_PISTOL, // NPC weapon - player can pick this up, but never starts with them
//
// WP_EMPLACED_GUN,
//
// WP_BOT_LASER, // Probe droid - Laser blast
//
// WP_TURRET, // turret guns
//
// WP_TIE_FIGHTER,
//
// WP_RAPID_FIRE_CONC,
//
// WP_JAWA,
// WP_TUSKEN_RIFLE,
// WP_TUSKEN_STAFF,
// WP_SCEPTER,
// WP_NOGHRI_STICK,
// Weapon offsets - This is the default for the weapon models
// put the weapon id at the end of the cvar name, so the knife is vr_weapon_adjustment_1
// Values are: scale,right,up,forward,pitch,yaw,roll
@ -57,7 +6,7 @@
seta vr_weapon_adjustment_2 "1.0,-3.5,7.4,-12.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_3 "1.0,-3.5,7.4,-10.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_4 "1.0,-3.5,7.4,-6.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_5 "1.5,-3.5,8.5,-10.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_5 "1.500,-2.747,5.707,-7.827,1.800,0.000,0.000"
seta vr_weapon_adjustment_6 "1.0,-3.5,7.0,-8.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_7 "1.0,-5.0,7.5,-10.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_8 "1.0,-5.0,8.0,-10.0,0.0,0.0,0.0"

View file

@ -1,52 +1,22 @@
///////////////////////////////////////////////////////////////////
// Weapon IDs
//
// WP_KNIFE, // 1
//
// // German weapons
// WP_LUGER, // 2
// WP_MP40, // 3
// WP_MAUSER, // 4 sniper rifle
// WP_FG42, // 5 scoped rifle
// WP_GRENADE_LAUNCHER, // 6
// WP_PANZERFAUST, // 7
// WP_VENOM, // 8
// WP_FLAMETHROWER, // 9
// WP_TESLA, // 10
//
// // American equivalents
// WP_COLT, // 11 equivalent american weapon to german luger
// WP_THOMPSON, // 12 equivalent american weapon to german mp40
// WP_GARAND, // 13 equivalent american weapon to german mauser (snooper scope)
// WP_GRENADE_PINEAPPLE, // 14
//
// // more weapons
// WP_STEN, // 18 silenced sten sub-machinegun
// WP_SILENCER, // 19 used to be sp5
// WP_AKIMBO, // 20 dual handguns
// WP_DYNAMITE, // 22
// Weapon offsets - This is the default for the weapon models
// put the weapon id at the end of the cvar name, so the knife is vr_weapon_adjustment_1
// Values are: scale,right,up,forward,pitch,yaw,roll
seta vr_weapon_adjustment_1 "0.55,-4.89,8.12,-12.36,-28.60,10.80,-199.50"
seta vr_weapon_adjustment_2 "0.43,-8.97,13.22,-21.68,-4.80,-4.50,-0.40"
seta vr_weapon_adjustment_3 "0.63,-8.51,8.99,-10.95,-2.50,0.20,2.70"
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_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"
seta vr_weapon_adjustment_9 "0.70,-5.01,6.81,13.25,0.00,0.00,0.00"
seta vr_weapon_adjustment_10 "0.75,-8.45,5.91,-11.39,0.00,0.00,0.00"
seta vr_weapon_adjustment_10 "1.500,-3.600,5.973,-8.640,0.000,0.000,0.000"
seta vr_weapon_adjustment_11 "0.44,-9.55,12.79,-23.06,0.30,-1.40,-0.40"
seta vr_weapon_adjustment_20 "0.44,-13.55,12.79,-26.06,0.30,-1.40,-0.40"
seta vr_weapon_adjustment_12 "0.83,-7.61,10.14,-11.47,-2.60,-0.00,0.80"
seta vr_weapon_adjustment_13 "0.50,-9.48,10.08,0.56,-0.40,-1.80,1.10"
seta vr_weapon_adjustment_13 "1.000,-6.500,9.240,-12.680,15.300,0.000,0.000"
seta vr_weapon_adjustment_14 "0.52,-12.87,13.29,-22.09,11.30,26.60,-3.40"
seta vr_weapon_adjustment_18 "0.510,-8.235,10.706,-3.922,-5.600,0.400,0.000"
seta vr_weapon_adjustment_19 "0.43,-8.97,13.22,-21.68,-4.80,-4.50,-0.40"