-Fixed steam and brass eject locations due to model changes
This commit is contained in:
Simon 2020-08-14 21:30:23 +01:00
parent 323543a3dc
commit b3d7586f76
2 changed files with 55 additions and 56 deletions

View file

@ -2826,6 +2826,48 @@ qboolean CG_MonsterUsingWeapon( centity_t *cent, int aiChar, int weaponNum ) {
/*
======================
CG_CalcMuzzlePoint
======================
*/
static qboolean CG_CalcMuzzlePoint( int entityNum, int dist, vec3_t muzzle ) {
vec3_t forward, right, up;
centity_t *cent;
int anim;
cent = &cg_entities[entityNum];
if ( entityNum == cg.snap->ps.clientNum ) {
vec3_t angles;
CG_CalculateVRWeaponPosition(cent->currentState.weapon, muzzle, angles);
AngleVectors( angles, forward, NULL, NULL );
VectorMA( muzzle, dist, forward, muzzle );
return qtrue;
}
//----(SA) removed check. is this still necessary? (this way works for ai's firing mg42) should I check for mg42?
// if ( !cent->currentValid ) {
// return qfalse;
// }
//----(SA) end
VectorCopy( cent->currentState.pos.trBase, muzzle );
AngleVectors( cent->currentState.apos.trBase, forward, right, up );
anim = cent->currentState.legsAnim & ~ANIM_TOGGLEBIT;
// RF, this is all broken by scripting system
// if ( anim == LEGS_WALKCR || anim == LEGS_IDLECR || anim == LEGS_IDLE_ALT ) {
// muzzle[2] += CROUCH_VIEWHEIGHT;
// } else {
muzzle[2] += DEFAULT_VIEWHEIGHT;
// }
VectorMA( muzzle, 14, forward, muzzle );
return qtrue;
}
/*
=============
@ -3042,6 +3084,9 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
// has fired and the fire seq has switched over
if ( weaponNum == WP_AKIMBO && akimboFire ) {
CG_PositionRotatedEntityOnTag( &brass, &gun, "tag_brass2" );
} else if ( weaponNum == WP_STEN) {
//Correct bad tag on STEN model
CG_CalcMuzzlePoint(cent->currentState.clientNum, 6, brass.origin);
} else {
CG_PositionRotatedEntityOnTag( &brass, &gun, "tag_brass" );
}
@ -3177,17 +3222,14 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
angles[ROLL] = crandom() * 10;
AnglesToAxis( angles, flash.axis );
if (weaponNum != WP_TESLA) {
if (weaponNum != WP_TESLA && weaponNum != WP_STEN) {
CG_PositionRotatedEntityOnTag(&flash, &gun, "tag_flash");
}
else
{
//For the Tesla, set the origin of the flash to be a short distance forward of the controller
vec3_t origin, angles;
CG_CalculateVRWeaponPosition( 0, flash.origin, angles );
vec3_t forward, right, up;
AngleVectors(angles, forward, right, up);
VectorMA( flash.origin, 10, forward, flash.origin );
//For the Tesla/ Sten, set the origin of the flash to be a distance forward of the controller
//Corrects the confused tag in the altered models
CG_CalcMuzzlePoint(cent->currentState.clientNum, weaponNum == WP_TESLA ? 11 : 24, flash.origin);
}
// store this position for other cgame elements to access
@ -6581,49 +6623,6 @@ void CG_Tracer( vec3_t source, vec3_t dest, int sparks ) {
}
/*
======================
CG_CalcMuzzlePoint
======================
*/
static qboolean CG_CalcMuzzlePoint( int entityNum, vec3_t muzzle ) {
vec3_t forward, right, up;
centity_t *cent;
int anim;
cent = &cg_entities[entityNum];
if ( entityNum == cg.snap->ps.clientNum ) {
vec3_t angles;
CG_CalculateVRWeaponPosition(cent->currentState.weapon, muzzle, angles);
AngleVectors( angles, forward, NULL, NULL );
VectorMA( muzzle, 14, forward, muzzle );
return qtrue;
}
//----(SA) removed check. is this still necessary? (this way works for ai's firing mg42) should I check for mg42?
// if ( !cent->currentValid ) {
// return qfalse;
// }
//----(SA) end
VectorCopy( cent->currentState.pos.trBase, muzzle );
AngleVectors( cent->currentState.apos.trBase, forward, right, up );
anim = cent->currentState.legsAnim & ~ANIM_TOGGLEBIT;
// RF, this is all broken by scripting system
// if ( anim == LEGS_WALKCR || anim == LEGS_IDLECR || anim == LEGS_IDLE_ALT ) {
// muzzle[2] += CROUCH_VIEWHEIGHT;
// } else {
muzzle[2] += DEFAULT_VIEWHEIGHT;
// }
VectorMA( muzzle, 14, forward, muzzle );
return qtrue;
}
/*
======================
CG_Bullet
@ -6644,7 +6643,7 @@ void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh,
// if the shooter is currently valid, calc a source point and possibly
// do trail effects
if ( sourceEntityNum >= 0 && cg_tracerChance.value > 0 ) {
if ( CG_CalcMuzzlePoint( sourceEntityNum, start ) ) {
if ( CG_CalcMuzzlePoint( sourceEntityNum, 14, start ) ) {
sourceContentType = trap_CM_PointContents( start, 0 );
destContentType = trap_CM_PointContents( end, 0 );
@ -6736,7 +6735,7 @@ void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh,
// if we haven't dropped a blood spat in a while, check if this is a good scenario
if ( lastBloodSpat > cg.time || lastBloodSpat < cg.time - 500 ) {
if ( CG_CalcMuzzlePoint( sourceEntityNum, start ) ) {
if ( CG_CalcMuzzlePoint( sourceEntityNum, 14, start ) ) {
VectorSubtract( end, start, dir );
VectorNormalize( dir );
VectorMA( end, 128, dir, trend );
@ -6783,7 +6782,7 @@ void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh,
// CG_SpawnTracer( sourceEntityNum, start, end );
// }
if ( CG_CalcMuzzlePoint( sourceEntityNum, start )
if ( CG_CalcMuzzlePoint( sourceEntityNum, 14, start )
|| cg.snap->ps.persistant[PERS_HWEAPON_USE] ) {
vec3_t start2;
VectorSubtract( end, start, dir );

View file

@ -36,7 +36,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 "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_4 "0.43,-8.75,12.50,-2.31,-0.00,-1.80,5.00"
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"
@ -48,6 +48,6 @@ 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_14 "0.52,-12.87,13.29,-22.09,11.30,26.60,-3.40"
seta vr_weapon_adjustment_18 "0.49,-8.06,13.12,-5.63,-6.00,1.40,-3.20"
seta vr_weapon_adjustment_19 "0.50,-9.12,13.72,-20.60,-2.80,-4.60,0.00"
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"
seta vr_weapon_adjustment_22 "0.64,-12.59,12.94,-20.44,11.30,26.60,-3.40"