mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-02-18 10:02:50 +00:00
No more default 800 gravity on items - NiceAss
This commit is contained in:
parent
ba6770c1bc
commit
8b181630b7
7 changed files with 182 additions and 70 deletions
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.18 2002/01/14 01:19:23 niceass
|
||||||
|
// No more default 800 gravity on items - NiceAss
|
||||||
|
//
|
||||||
// Revision 1.17 2002/01/11 19:48:29 jbravo
|
// Revision 1.17 2002/01/11 19:48:29 jbravo
|
||||||
// Formatted the source in non DOS format.
|
// Formatted the source in non DOS format.
|
||||||
//
|
//
|
||||||
|
@ -594,7 +597,7 @@ static void CG_Missile( centity_t *cent ) {
|
||||||
if ( weapon->missileSound ) {
|
if ( weapon->missileSound ) {
|
||||||
vec3_t velocity;
|
vec3_t velocity;
|
||||||
|
|
||||||
BG_EvaluateTrajectoryDelta( ¢->currentState.pos, cg.time, velocity );
|
CG_EvaluateTrajectoryDelta( ¢->currentState.pos, cg.time, velocity );
|
||||||
|
|
||||||
trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, velocity, weapon->missileSound );
|
trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, velocity, weapon->missileSound );
|
||||||
}
|
}
|
||||||
|
@ -638,7 +641,7 @@ static void CG_Missile( centity_t *cent ) {
|
||||||
if ( s1->weapon == WP_KNIFE ) {
|
if ( s1->weapon == WP_KNIFE ) {
|
||||||
vec3_t knifeVelocity;
|
vec3_t knifeVelocity;
|
||||||
|
|
||||||
BG_EvaluateTrajectoryDelta(&s1->pos, cg.time, knifeVelocity);
|
CG_EvaluateTrajectoryDelta(&s1->pos, cg.time, knifeVelocity);
|
||||||
vectoangles(knifeVelocity, cent->lerpAngles);
|
vectoangles(knifeVelocity, cent->lerpAngles);
|
||||||
cent->lerpAngles[0] += cg.time; // was / 6
|
cent->lerpAngles[0] += cg.time; // was / 6
|
||||||
|
|
||||||
|
@ -841,11 +844,11 @@ void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BG_EvaluateTrajectory( ¢->currentState.pos, fromTime, oldOrigin );
|
CG_EvaluateTrajectory( ¢->currentState.pos, fromTime, oldOrigin );
|
||||||
BG_EvaluateTrajectory( ¢->currentState.apos, fromTime, oldAngles );
|
CG_EvaluateTrajectory( ¢->currentState.apos, fromTime, oldAngles );
|
||||||
|
|
||||||
BG_EvaluateTrajectory( ¢->currentState.pos, toTime, origin );
|
CG_EvaluateTrajectory( ¢->currentState.pos, toTime, origin );
|
||||||
BG_EvaluateTrajectory( ¢->currentState.apos, toTime, angles );
|
CG_EvaluateTrajectory( ¢->currentState.apos, toTime, angles );
|
||||||
|
|
||||||
VectorSubtract( origin, oldOrigin, deltaOrigin );
|
VectorSubtract( origin, oldOrigin, deltaOrigin );
|
||||||
VectorSubtract( angles, oldAngles, deltaAngles );
|
VectorSubtract( angles, oldAngles, deltaAngles );
|
||||||
|
@ -875,15 +878,15 @@ static void CG_InterpolateEntityPosition( centity_t *cent ) {
|
||||||
|
|
||||||
// this will linearize a sine or parabolic curve, but it is important
|
// this will linearize a sine or parabolic curve, but it is important
|
||||||
// to not extrapolate player positions if more recent data is available
|
// to not extrapolate player positions if more recent data is available
|
||||||
BG_EvaluateTrajectory( ¢->currentState.pos, cg.snap->serverTime, current );
|
CG_EvaluateTrajectory( ¢->currentState.pos, cg.snap->serverTime, current );
|
||||||
BG_EvaluateTrajectory( ¢->nextState.pos, cg.nextSnap->serverTime, next );
|
CG_EvaluateTrajectory( ¢->nextState.pos, cg.nextSnap->serverTime, next );
|
||||||
|
|
||||||
cent->lerpOrigin[0] = current[0] + f * ( next[0] - current[0] );
|
cent->lerpOrigin[0] = current[0] + f * ( next[0] - current[0] );
|
||||||
cent->lerpOrigin[1] = current[1] + f * ( next[1] - current[1] );
|
cent->lerpOrigin[1] = current[1] + f * ( next[1] - current[1] );
|
||||||
cent->lerpOrigin[2] = current[2] + f * ( next[2] - current[2] );
|
cent->lerpOrigin[2] = current[2] + f * ( next[2] - current[2] );
|
||||||
|
|
||||||
BG_EvaluateTrajectory( ¢->currentState.apos, cg.snap->serverTime, current );
|
CG_EvaluateTrajectory( ¢->currentState.apos, cg.snap->serverTime, current );
|
||||||
BG_EvaluateTrajectory( ¢->nextState.apos, cg.nextSnap->serverTime, next );
|
CG_EvaluateTrajectory( ¢->nextState.apos, cg.nextSnap->serverTime, next );
|
||||||
|
|
||||||
cent->lerpAngles[0] = LerpAngle( current[0], next[0], f );
|
cent->lerpAngles[0] = LerpAngle( current[0], next[0], f );
|
||||||
cent->lerpAngles[1] = LerpAngle( current[1], next[1], f );
|
cent->lerpAngles[1] = LerpAngle( current[1], next[1], f );
|
||||||
|
@ -922,8 +925,8 @@ static void CG_CalcEntityLerpPositions( centity_t *cent ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// just use the current frame and evaluate as best we can
|
// just use the current frame and evaluate as best we can
|
||||||
BG_EvaluateTrajectory( ¢->currentState.pos, cg.time, cent->lerpOrigin );
|
CG_EvaluateTrajectory( ¢->currentState.pos, cg.time, cent->lerpOrigin );
|
||||||
BG_EvaluateTrajectory( ¢->currentState.apos, cg.time, cent->lerpAngles );
|
CG_EvaluateTrajectory( ¢->currentState.apos, cg.time, cent->lerpAngles );
|
||||||
|
|
||||||
// adjust for riding a mover if it wasn't rolled into the predicted
|
// adjust for riding a mover if it wasn't rolled into the predicted
|
||||||
// player state
|
// player state
|
||||||
|
@ -1281,37 +1284,3 @@ static void CG_Dlight( centity_t *cent ) {
|
||||||
//CG_Printf("cgame: (%f %f %f) %f\n", r, g, b, i );
|
//CG_Printf("cgame: (%f %f %f) %f\n", r, g, b, i );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
CG_CalcViewAngle
|
|
||||||
Added by NiceAss.
|
|
||||||
|
|
||||||
Start not known. End known.
|
|
||||||
Used for calculating a player's viewing angle.
|
|
||||||
Currently used for spark directions (reflected off a plane).
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void CG_CalcViewDir(const int sourceEntityNum, const vec3_t end, vec3_t viewDir) {
|
|
||||||
vec3_t delta, start;
|
|
||||||
|
|
||||||
CG_CalcMuzzlePoint(sourceEntityNum, start);
|
|
||||||
VectorSubtract(end, start, delta);
|
|
||||||
VectorNormalize2(delta, viewDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
CG_CalcViewAngle2
|
|
||||||
Added by NiceAss.
|
|
||||||
|
|
||||||
Start known. End known.
|
|
||||||
Used for calculating a player's viewing angle.
|
|
||||||
Currently used for spark directions (reflected off a plane).
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void CG_CalcViewDir2(const vec3_t start, const vec3_t end, vec3_t viewDir) {
|
|
||||||
vec3_t delta;
|
|
||||||
VectorSubtract(end, start, delta);
|
|
||||||
VectorNormalize2(delta, viewDir);
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.34 2002/01/14 01:19:23 niceass
|
||||||
|
// No more default 800 gravity on items - NiceAss
|
||||||
|
//
|
||||||
// Revision 1.33 2002/01/11 20:20:57 jbravo
|
// Revision 1.33 2002/01/11 20:20:57 jbravo
|
||||||
// Adding TP to main branch
|
// Adding TP to main branch
|
||||||
//
|
//
|
||||||
|
@ -2489,7 +2492,7 @@ void CG_CheckEvents( centity_t *cent ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate the position at exactly the frame time
|
// calculate the position at exactly the frame time
|
||||||
BG_EvaluateTrajectory( ¢->currentState.pos, cg.snap->serverTime, cent->lerpOrigin );
|
CG_EvaluateTrajectory( ¢->currentState.pos, cg.snap->serverTime, cent->lerpOrigin );
|
||||||
CG_SetEntitySoundPosition( cent );
|
CG_SetEntitySoundPosition( cent );
|
||||||
|
|
||||||
CG_EntityEvent( cent, cent->lerpOrigin );
|
CG_EntityEvent( cent, cent->lerpOrigin );
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.40 2002/01/14 01:19:23 niceass
|
||||||
|
// No more default 800 gravity on items - NiceAss
|
||||||
|
//
|
||||||
// Revision 1.39 2002/01/11 20:20:57 jbravo
|
// Revision 1.39 2002/01/11 20:20:57 jbravo
|
||||||
// Adding TP to main branch
|
// Adding TP to main branch
|
||||||
//
|
//
|
||||||
|
@ -1555,7 +1558,8 @@ void CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec
|
||||||
//int skipNumber, int mask );
|
//int skipNumber, int mask );
|
||||||
void CG_PredictPlayerState( void );
|
void CG_PredictPlayerState( void );
|
||||||
void CG_LoadDeferredPlayers( void );
|
void CG_LoadDeferredPlayers( void );
|
||||||
|
void CG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result );
|
||||||
|
void CG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cg_events.c
|
// cg_events.c
|
||||||
|
@ -1581,7 +1585,6 @@ void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *pare
|
||||||
//Blaze: for weapon animations
|
//Blaze: for weapon animations
|
||||||
void CG_PositionWeaponOnTag( refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName );
|
void CG_PositionWeaponOnTag( refEntity_t *entity, const refEntity_t *parent, qhandle_t parentModel, char *tagName );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// cg_weapons.c
|
// cg_weapons.c
|
||||||
//
|
//
|
||||||
|
@ -1617,6 +1620,8 @@ void CG_DrawWeaponSelect( void );
|
||||||
|
|
||||||
void CG_OutOfAmmoChange( void ); // should this be in pmove?
|
void CG_OutOfAmmoChange( void ); // should this be in pmove?
|
||||||
void CG_CheckLaser (); //Elder: check laser to see if it's our own
|
void CG_CheckLaser (); //Elder: check laser to see if it's our own
|
||||||
|
void CG_CalcViewDir2(const vec3_t start, const vec3_t end, vec3_t viewDir);
|
||||||
|
void CG_CalcViewDir(const int sourceEntityNum, const vec3_t end, vec3_t viewDir);
|
||||||
|
|
||||||
//
|
//
|
||||||
// cg_marks.c
|
// cg_marks.c
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.7 2002/01/14 01:19:23 niceass
|
||||||
|
// No more default 800 gravity on items - NiceAss
|
||||||
|
//
|
||||||
// Revision 1.6 2002/01/11 19:48:29 jbravo
|
// Revision 1.6 2002/01/11 19:48:29 jbravo
|
||||||
// Formatted the source in non DOS format.
|
// Formatted the source in non DOS format.
|
||||||
//
|
//
|
||||||
|
@ -125,7 +128,7 @@ void CG_BloodTrail( localEntity_t *le ) {
|
||||||
t2 = step * ( cg.time / step );
|
t2 = step * ( cg.time / step );
|
||||||
|
|
||||||
for ( ; t <= t2; t += step ) {
|
for ( ; t <= t2; t += step ) {
|
||||||
BG_EvaluateTrajectory( &le->pos, t, newOrigin );
|
CG_EvaluateTrajectory( &le->pos, t, newOrigin );
|
||||||
|
|
||||||
blood = CG_SmokePuff( newOrigin, vec3_origin,
|
blood = CG_SmokePuff( newOrigin, vec3_origin,
|
||||||
20, // radius
|
20, // radius
|
||||||
|
@ -213,7 +216,7 @@ void CG_ReflectVelocity( localEntity_t *le, trace_t *trace ) {
|
||||||
|
|
||||||
// reflect the velocity on the trace plane
|
// reflect the velocity on the trace plane
|
||||||
hitTime = cg.time - cg.frametime + cg.frametime * trace->fraction;
|
hitTime = cg.time - cg.frametime + cg.frametime * trace->fraction;
|
||||||
BG_EvaluateTrajectoryDelta( &le->pos, hitTime, velocity );
|
CG_EvaluateTrajectoryDelta( &le->pos, hitTime, velocity );
|
||||||
dot = DotProduct( velocity, trace->plane.normal );
|
dot = DotProduct( velocity, trace->plane.normal );
|
||||||
VectorMA( velocity, -2*dot, trace->plane.normal, le->pos.trDelta );
|
VectorMA( velocity, -2*dot, trace->plane.normal, le->pos.trDelta );
|
||||||
|
|
||||||
|
@ -266,7 +269,7 @@ void CG_AddFragment( localEntity_t *le ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate new position
|
// calculate new position
|
||||||
BG_EvaluateTrajectory( &le->pos, cg.time, newOrigin );
|
CG_EvaluateTrajectory( &le->pos, cg.time, newOrigin );
|
||||||
|
|
||||||
// trace a line from previous position to new position
|
// trace a line from previous position to new position
|
||||||
CG_Trace( &trace, le->refEntity.origin, NULL, NULL, newOrigin, -1, CONTENTS_SOLID );
|
CG_Trace( &trace, le->refEntity.origin, NULL, NULL, newOrigin, -1, CONTENTS_SOLID );
|
||||||
|
@ -277,7 +280,7 @@ void CG_AddFragment( localEntity_t *le ) {
|
||||||
if ( le->leFlags & LEF_TUMBLE ) {
|
if ( le->leFlags & LEF_TUMBLE ) {
|
||||||
vec3_t angles;
|
vec3_t angles;
|
||||||
|
|
||||||
BG_EvaluateTrajectory( &le->angles, cg.time, angles );
|
CG_EvaluateTrajectory( &le->angles, cg.time, angles );
|
||||||
AnglesToAxis( angles, le->refEntity.axis );
|
AnglesToAxis( angles, le->refEntity.axis );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +373,7 @@ static void CG_AddMoveScaleFade( localEntity_t *le ) {
|
||||||
re->radius = le->radius * ( 1.0 - c ) + 8;
|
re->radius = le->radius * ( 1.0 - c ) + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
BG_EvaluateTrajectory( &le->pos, cg.time, re->origin );
|
CG_EvaluateTrajectory( &le->pos, cg.time, re->origin );
|
||||||
|
|
||||||
// if the view would be "inside" the sprite, kill the sprite
|
// if the view would be "inside" the sprite, kill the sprite
|
||||||
// so it doesn't add too much overdraw
|
// so it doesn't add too much overdraw
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.15 2002/01/14 01:19:23 niceass
|
||||||
|
// No more default 800 gravity on items - NiceAss
|
||||||
|
//
|
||||||
// Revision 1.14 2002/01/11 19:48:29 jbravo
|
// Revision 1.14 2002/01/11 19:48:29 jbravo
|
||||||
// Formatted the source in non DOS format.
|
// Formatted the source in non DOS format.
|
||||||
//
|
//
|
||||||
|
@ -2824,8 +2827,8 @@ void CG_ResetPlayerEntity( centity_t *cent ) {
|
||||||
CG_ClearLerpFrame( &cgs.clientinfo[ cent->currentState.clientNum ], ¢->pe.legs, cent->currentState.legsAnim );
|
CG_ClearLerpFrame( &cgs.clientinfo[ cent->currentState.clientNum ], ¢->pe.legs, cent->currentState.legsAnim );
|
||||||
CG_ClearLerpFrame( &cgs.clientinfo[ cent->currentState.clientNum ], ¢->pe.torso, cent->currentState.torsoAnim );
|
CG_ClearLerpFrame( &cgs.clientinfo[ cent->currentState.clientNum ], ¢->pe.torso, cent->currentState.torsoAnim );
|
||||||
|
|
||||||
BG_EvaluateTrajectory( ¢->currentState.pos, cg.time, cent->lerpOrigin );
|
CG_EvaluateTrajectory( ¢->currentState.pos, cg.time, cent->lerpOrigin );
|
||||||
BG_EvaluateTrajectory( ¢->currentState.apos, cg.time, cent->lerpAngles );
|
CG_EvaluateTrajectory( ¢->currentState.apos, cg.time, cent->lerpAngles );
|
||||||
|
|
||||||
VectorCopy( cent->lerpOrigin, cent->rawOrigin );
|
VectorCopy( cent->lerpOrigin, cent->rawOrigin );
|
||||||
VectorCopy( cent->lerpAngles, cent->rawAngles );
|
VectorCopy( cent->lerpAngles, cent->rawAngles );
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.13 2002/01/14 01:19:23 niceass
|
||||||
|
// No more default 800 gravity on items - NiceAss
|
||||||
|
//
|
||||||
// Revision 1.12 2002/01/11 20:20:57 jbravo
|
// Revision 1.12 2002/01/11 20:20:57 jbravo
|
||||||
// Adding TP to main branch
|
// Adding TP to main branch
|
||||||
//
|
//
|
||||||
|
@ -102,7 +105,7 @@ static void CG_ClipMoveToEntities ( const vec3_t start, const vec3_t mins, const
|
||||||
// special value for bmodel
|
// special value for bmodel
|
||||||
cmodel = trap_CM_InlineModel( ent->modelindex );
|
cmodel = trap_CM_InlineModel( ent->modelindex );
|
||||||
VectorCopy( cent->lerpAngles, angles );
|
VectorCopy( cent->lerpAngles, angles );
|
||||||
BG_EvaluateTrajectory( ¢->currentState.pos, cg.physicsTime, origin );
|
CG_EvaluateTrajectory( ¢->currentState.pos, cg.physicsTime, origin );
|
||||||
} else {
|
} else {
|
||||||
// encoded bbox
|
// encoded bbox
|
||||||
x = (ent->solid & 255);
|
x = (ent->solid & 255);
|
||||||
|
@ -662,4 +665,90 @@ void CG_PredictPlayerState( void ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
================
|
||||||
|
CG_EvaluateTrajectory
|
||||||
|
|
||||||
|
================
|
||||||
|
*/
|
||||||
|
void CG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result ) {
|
||||||
|
float deltaTime;
|
||||||
|
float phase;
|
||||||
|
|
||||||
|
switch( tr->trType ) {
|
||||||
|
case TR_STATIONARY:
|
||||||
|
case TR_INTERPOLATE:
|
||||||
|
VectorCopy( tr->trBase, result );
|
||||||
|
break;
|
||||||
|
case TR_LINEAR:
|
||||||
|
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
|
||||||
|
VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
|
||||||
|
break;
|
||||||
|
case TR_SINE:
|
||||||
|
deltaTime = ( atTime - tr->trTime ) / (float) tr->trDuration;
|
||||||
|
phase = sin( deltaTime * M_PI * 2 );
|
||||||
|
VectorMA( tr->trBase, phase, tr->trDelta, result );
|
||||||
|
break;
|
||||||
|
case TR_LINEAR_STOP:
|
||||||
|
if ( atTime > tr->trTime + tr->trDuration ) {
|
||||||
|
atTime = tr->trTime + tr->trDuration;
|
||||||
|
}
|
||||||
|
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
|
||||||
|
if ( deltaTime < 0 ) {
|
||||||
|
deltaTime = 0;
|
||||||
|
}
|
||||||
|
VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
|
||||||
|
break;
|
||||||
|
case TR_GRAVITY:
|
||||||
|
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
|
||||||
|
VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
|
||||||
|
result[2] -= 0.5 * cg.predictedPlayerState.gravity * deltaTime * deltaTime; // FIXME: local gravity...
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Com_Error( ERR_DROP, "CG_EvaluateTrajectory: unknown trType: %i", tr->trTime );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
================
|
||||||
|
CG_EvaluateTrajectoryDelta
|
||||||
|
|
||||||
|
For determining velocity at a given time
|
||||||
|
================
|
||||||
|
*/
|
||||||
|
void CG_EvaluateTrajectoryDelta( const trajectory_t *tr, int atTime, vec3_t result ) {
|
||||||
|
float deltaTime;
|
||||||
|
float phase;
|
||||||
|
|
||||||
|
switch( tr->trType ) {
|
||||||
|
case TR_STATIONARY:
|
||||||
|
case TR_INTERPOLATE:
|
||||||
|
VectorClear( result );
|
||||||
|
break;
|
||||||
|
case TR_LINEAR:
|
||||||
|
VectorCopy( tr->trDelta, result );
|
||||||
|
break;
|
||||||
|
case TR_SINE:
|
||||||
|
deltaTime = ( atTime - tr->trTime ) / (float) tr->trDuration;
|
||||||
|
phase = cos( deltaTime * M_PI * 2 ); // derivative of sin = cos
|
||||||
|
phase *= 0.5;
|
||||||
|
VectorScale( tr->trDelta, phase, result );
|
||||||
|
break;
|
||||||
|
case TR_LINEAR_STOP:
|
||||||
|
if ( atTime > tr->trTime + tr->trDuration ) {
|
||||||
|
VectorClear( result );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
VectorCopy( tr->trDelta, result );
|
||||||
|
break;
|
||||||
|
case TR_GRAVITY:
|
||||||
|
deltaTime = ( atTime - tr->trTime ) * 0.001; // milliseconds to seconds
|
||||||
|
VectorCopy( tr->trDelta, result );
|
||||||
|
result[2] -= cg.predictedPlayerState.gravity * deltaTime; // FIXME: local gravity...
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Com_Error( ERR_DROP, "CG_EvaluateTrajectoryDelta: unknown trType: %i", tr->trTime );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.47 2002/01/14 01:19:23 niceass
|
||||||
|
// No more default 800 gravity on items - NiceAss
|
||||||
|
//
|
||||||
// Revision 1.46 2002/01/12 15:18:20 jbravo
|
// Revision 1.46 2002/01/12 15:18:20 jbravo
|
||||||
// Added a fix from Niceass. (cg_drawgun affecting other player models)
|
// Added a fix from Niceass. (cg_drawgun affecting other player models)
|
||||||
//
|
//
|
||||||
|
@ -493,7 +496,7 @@ static void CG_RocketTrail( centity_t *ent, const weaponInfo_t *wi ) {
|
||||||
startTime = ent->trailTime;
|
startTime = ent->trailTime;
|
||||||
t = step * ( (startTime + step) / step );
|
t = step * ( (startTime + step) / step );
|
||||||
|
|
||||||
BG_EvaluateTrajectory( &es->pos, cg.time, origin );
|
CG_EvaluateTrajectory( &es->pos, cg.time, origin );
|
||||||
contents = CG_PointContents( origin, -1 );
|
contents = CG_PointContents( origin, -1 );
|
||||||
|
|
||||||
// if object (e.g. grenade) is stationary, don't toss up smoke
|
// if object (e.g. grenade) is stationary, don't toss up smoke
|
||||||
|
@ -502,7 +505,7 @@ static void CG_RocketTrail( centity_t *ent, const weaponInfo_t *wi ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BG_EvaluateTrajectory( &es->pos, ent->trailTime, lastPos );
|
CG_EvaluateTrajectory( &es->pos, ent->trailTime, lastPos );
|
||||||
lastContents = CG_PointContents( lastPos, -1 );
|
lastContents = CG_PointContents( lastPos, -1 );
|
||||||
|
|
||||||
ent->trailTime = cg.time;
|
ent->trailTime = cg.time;
|
||||||
|
@ -515,7 +518,7 @@ static void CG_RocketTrail( centity_t *ent, const weaponInfo_t *wi ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ; t <= ent->trailTime ; t += step ) {
|
for ( ; t <= ent->trailTime ; t += step ) {
|
||||||
BG_EvaluateTrajectory( &es->pos, t, lastPos );
|
CG_EvaluateTrajectory( &es->pos, t, lastPos );
|
||||||
|
|
||||||
smoke = CG_SmokePuff( lastPos, up,
|
smoke = CG_SmokePuff( lastPos, up,
|
||||||
wi->trailRadius,
|
wi->trailRadius,
|
||||||
|
@ -561,7 +564,7 @@ static void CG_NailTrail( centity_t *ent, const weaponInfo_t *wi ) {
|
||||||
startTime = ent->trailTime;
|
startTime = ent->trailTime;
|
||||||
t = step * ( (startTime + step) / step );
|
t = step * ( (startTime + step) / step );
|
||||||
|
|
||||||
BG_EvaluateTrajectory( &es->pos, cg.time, origin );
|
CG_EvaluateTrajectory( &es->pos, cg.time, origin );
|
||||||
contents = CG_PointContents( origin, -1 );
|
contents = CG_PointContents( origin, -1 );
|
||||||
|
|
||||||
// if object (e.g. grenade) is stationary, don't toss up smoke
|
// if object (e.g. grenade) is stationary, don't toss up smoke
|
||||||
|
@ -570,7 +573,7 @@ static void CG_NailTrail( centity_t *ent, const weaponInfo_t *wi ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BG_EvaluateTrajectory( &es->pos, ent->trailTime, lastPos );
|
CG_EvaluateTrajectory( &es->pos, ent->trailTime, lastPos );
|
||||||
lastContents = CG_PointContents( lastPos, -1 );
|
lastContents = CG_PointContents( lastPos, -1 );
|
||||||
|
|
||||||
ent->trailTime = cg.time;
|
ent->trailTime = cg.time;
|
||||||
|
@ -583,7 +586,7 @@ static void CG_NailTrail( centity_t *ent, const weaponInfo_t *wi ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ; t <= ent->trailTime ; t += step ) {
|
for ( ; t <= ent->trailTime ; t += step ) {
|
||||||
BG_EvaluateTrajectory( &es->pos, t, lastPos );
|
CG_EvaluateTrajectory( &es->pos, t, lastPos );
|
||||||
|
|
||||||
smoke = CG_SmokePuff( lastPos, up,
|
smoke = CG_SmokePuff( lastPos, up,
|
||||||
wi->trailRadius,
|
wi->trailRadius,
|
||||||
|
@ -626,7 +629,7 @@ static void CG_PlasmaTrail( centity_t *cent, const weaponInfo_t *wi ) {
|
||||||
startTime = cent->trailTime;
|
startTime = cent->trailTime;
|
||||||
t = step * ( (startTime + step) / step );
|
t = step * ( (startTime + step) / step );
|
||||||
|
|
||||||
BG_EvaluateTrajectory( &es->pos, cg.time, origin );
|
CG_EvaluateTrajectory( &es->pos, cg.time, origin );
|
||||||
|
|
||||||
le = CG_AllocLocalEntity();
|
le = CG_AllocLocalEntity();
|
||||||
re = &le->refEntity;
|
re = &le->refEntity;
|
||||||
|
@ -708,7 +711,7 @@ void CG_GrappleTrail( centity_t *ent, const weaponInfo_t *wi ) {
|
||||||
|
|
||||||
es = &ent->currentState;
|
es = &ent->currentState;
|
||||||
|
|
||||||
BG_EvaluateTrajectory( &es->pos, cg.time, origin );
|
CG_EvaluateTrajectory( &es->pos, cg.time, origin );
|
||||||
ent->trailTime = cg.time;
|
ent->trailTime = cg.time;
|
||||||
|
|
||||||
memset( &beam, 0, sizeof( beam ) );
|
memset( &beam, 0, sizeof( beam ) );
|
||||||
|
@ -1234,6 +1237,7 @@ NiceAss; I've torn this function up with testing... ignore it =P
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
static void CG_LightningBolt( centity_t *cent, vec3_t origin ) {
|
static void CG_LightningBolt( centity_t *cent, vec3_t origin ) {
|
||||||
|
/*
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
refEntity_t beam;
|
refEntity_t beam;
|
||||||
vec3_t forward;
|
vec3_t forward;
|
||||||
|
@ -1250,7 +1254,7 @@ static void CG_LightningBolt( centity_t *cent, vec3_t origin ) {
|
||||||
//CG_Printf("%d \n", cg.predictedPlayerState.clientNum);
|
//CG_Printf("%d \n", cg.predictedPlayerState.clientNum);
|
||||||
|
|
||||||
// find muzzle point for this frame
|
// find muzzle point for this frame
|
||||||
//BG_EvaluateTrajectory( ¢->currentState.apos, cg.time, cent->lerpAngles );
|
//CG_EvaluateTrajectory( ¢->currentState.apos, cg.time, cent->lerpAngles );
|
||||||
AngleVectors( cent->lerpAngles, forward, NULL, NULL );
|
AngleVectors( cent->lerpAngles, forward, NULL, NULL );
|
||||||
|
|
||||||
// project forward by the lightning range
|
// project forward by the lightning range
|
||||||
|
@ -1275,6 +1279,7 @@ static void CG_LightningBolt( centity_t *cent, vec3_t origin ) {
|
||||||
if ( trace.fraction < 1.0 ) {
|
if ( trace.fraction < 1.0 ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1692,15 +1697,15 @@ Add the weapon, and flash for the player's view
|
||||||
void CG_AddViewWeapon( playerState_t *ps ) {
|
void CG_AddViewWeapon( playerState_t *ps ) {
|
||||||
refEntity_t hand;
|
refEntity_t hand;
|
||||||
centity_t *cent;
|
centity_t *cent;
|
||||||
clientInfo_t *ci;
|
//clientInfo_t *ci;
|
||||||
float fovOffset;
|
float fovOffset;
|
||||||
vec3_t angles;
|
vec3_t angles;
|
||||||
weaponInfo_t *weapon;
|
weaponInfo_t *weapon;
|
||||||
// remove this:
|
// remove this:
|
||||||
vec3_t origin;
|
//vec3_t origin;
|
||||||
|
|
||||||
//Blaze: Reaction vars for gun positions
|
//Blaze: Reaction vars for gun positions
|
||||||
float rxn_gunx, rxn_guny, rxn_gunz;
|
//float rxn_gunx, rxn_guny, rxn_gunz;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3903,7 +3908,7 @@ static void CG_LocalLaser ()
|
||||||
VectorCopy(re->origin, re->oldorigin);
|
VectorCopy(re->origin, re->oldorigin);
|
||||||
VectorCopy(tr.endpos, re->origin);
|
VectorCopy(tr.endpos, re->origin);
|
||||||
//VectorCopy(tr.endpos, cg.laserEnt->pos.trBase);
|
//VectorCopy(tr.endpos, cg.laserEnt->pos.trBase);
|
||||||
//BG_EvaluateTrajectory(&cg.laserEnt->pos, cg.time, re->origin);
|
//CG_EvaluateTrajectory(&cg.laserEnt->pos, cg.time, re->origin);
|
||||||
|
|
||||||
//Boost the endTime
|
//Boost the endTime
|
||||||
cg.laserEnt->endTime += 10000;
|
cg.laserEnt->endTime += 10000;
|
||||||
|
@ -3997,3 +4002,38 @@ void CG_ReloadWeapon (centity_t *cent, int reloadStage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
CG_CalcViewAngle
|
||||||
|
Added by NiceAss.
|
||||||
|
|
||||||
|
Start not known. End known.
|
||||||
|
Used for calculating a player's viewing angle.
|
||||||
|
Currently used for spark directions (reflected off a plane).
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
void CG_CalcViewDir(const int sourceEntityNum, const vec3_t end, vec3_t viewDir) {
|
||||||
|
vec3_t delta, start;
|
||||||
|
|
||||||
|
CG_CalcMuzzlePoint(sourceEntityNum, start);
|
||||||
|
VectorSubtract(end, start, delta);
|
||||||
|
VectorNormalize2(delta, viewDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
CG_CalcViewAngle2
|
||||||
|
Added by NiceAss.
|
||||||
|
|
||||||
|
Start known. End known.
|
||||||
|
Used for calculating a player's viewing angle.
|
||||||
|
Currently used for spark directions (reflected off a plane).
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
void CG_CalcViewDir2(const vec3_t start, const vec3_t end, vec3_t viewDir) {
|
||||||
|
vec3_t delta;
|
||||||
|
VectorSubtract(end, start, delta);
|
||||||
|
VectorNormalize2(delta, viewDir);
|
||||||
|
}
|
Loading…
Reference in a new issue