本文整理汇总了C++中BG_EvaluateTrajectoryDelta函数的典型用法代码示例。如果您正苦于以下问题:C++ BG_EvaluateTrajectoryDelta函数的具体用法?C++ BG_EvaluateTrajectoryDelta怎么用?C++ BG_EvaluateTrajectoryDelta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BG_EvaluateTrajectoryDelta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CG_ReflectVelocity
/*
================
CG_ReflectVelocity
================
*/
void CG_ReflectVelocity( localEntity_t *le, trace_t *trace ) {
vec3_t velocity;
float dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = cg.time - cg.frametime + cg.frametime * trace->fraction;
BG_EvaluateTrajectoryDelta( &le->pos, hitTime, velocity );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -2*dot, trace->plane.normal, le->pos.trDelta );
VectorScale( le->pos.trDelta, le->bounceFactor, le->pos.trDelta );
VectorCopy( trace->endpos, le->pos.trBase );
le->pos.trTime = cg.time;
// check for stop, making sure that even on low FPS systems it doesn't bobble
if ( trace->allsolid ||
( trace->plane.normal[2] > 0 &&
( le->pos.trDelta[2] < 40 || le->pos.trDelta[2] < -cg.frametime * le->pos.trDelta[2] ) ) ) {
le->pos.trType = TR_STATIONARY;
} else {
}
}
示例2: CG_ReflectVelocity
/*
================
CG_ReflectVelocity
================
*/
void CG_ReflectVelocity( localEntity_t *le, trace_t *trace ) {
bvec3_t velocity;
bfixed dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = cg.time - cg.frametime + FIXED_TO_INT(MAKE_GFIXED(cg.frametime) * trace->fraction);
BG_EvaluateTrajectoryDelta( &le->pos, hitTime, velocity );
dot = FIXED_VEC3DOT( velocity, trace->plane.normal );
FIXED_VEC3MA_R( velocity, -BFIXED(2,0)*dot, trace->plane.normal, le->pos.trDelta );
FIXED_VEC3SCALE( le->pos.trDelta, le->bounceFactor, le->pos.trDelta );
VectorCopy( trace->endpos, le->pos.trBase );
le->pos.trTime = cg.time;
// check for stop, making sure that even on low FPS systems it doesn't bobble
if ( trace->allsolid ||
( trace->plane.normal[2] > AFIXED_0 &&
( le->pos.trDelta[2] < BFIXED(40,0) || le->pos.trDelta[2] < -MAKE_BFIXED(cg.frametime) * le->pos.trDelta[2] ) ) ) {
le->pos.trType = TR_STATIONARY;
} else {
}
}
示例3: G_PredictBounceMissile
/*
================
G_PredictBounceMissile
================
*/
void G_PredictBounceMissile( gentity_t *ent, trajectory_t *pos, trace_t *trace, int time ) {
vec3_t velocity, origin;
float dot;
int hitTime;
BG_EvaluateTrajectory( pos, time, origin );
// reflect the velocity on the trace plane
hitTime = time;
BG_EvaluateTrajectoryDelta( pos, hitTime, velocity );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -2 * dot, trace->plane.normal, pos->trDelta );
if ( ent->s.eFlags & EF_BOUNCE_HALF ) {
if ( ent->s.eFlags & EF_BOUNCE ) { // both flags marked, do a third type of bounce
VectorScale( pos->trDelta, 0.35, pos->trDelta );
} else {
VectorScale( pos->trDelta, 0.65, pos->trDelta );
}
// check for stop
if ( trace->plane.normal[2] > 0.2 && VectorLength( pos->trDelta ) < 40 ) {
VectorCopy( trace->endpos, pos->trBase );
return;
}
}
VectorAdd( origin, trace->plane.normal, pos->trBase );
pos->trTime = time;
}
示例4: G_BounceMissile
/*
================
G_BounceMissile
================
*/
void G_BounceMissile( gentity_t *ent, trace_t *trace )
{
vec3_t velocity;
float dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = level.previousTime + ( level.time - level.previousTime ) * trace->fraction;
BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, velocity );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -2 * dot, trace->plane.normal, ent->s.pos.trDelta );
if( ent->s.eFlags & EF_BOUNCE_HALF )
{
VectorScale( ent->s.pos.trDelta, 0.65, ent->s.pos.trDelta );
// check for stop
if( trace->plane.normal[ 2 ] > 0.2 && VectorLength( ent->s.pos.trDelta ) < 40 )
{
G_SetOrigin( ent, trace->endpos );
return;
}
}
VectorAdd( ent->r.currentOrigin, trace->plane.normal, ent->r.currentOrigin );
VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase );
ent->s.pos.trTime = level.time;
}
示例5: G_BounceMissile
/*
================
G_BounceMissile
================
*/
void G_BounceMissile( gentity_t *ent, trace_t *trace ) {
vec3_t velocity;
float dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = level.previousTime + ( level.time - level.previousTime ) * trace->fraction;
BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, velocity );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -2*dot, trace->plane.normal, ent->s.pos.trDelta );
if ( ent->s.eFlags & EF_BOUNCE_HALF ) {
#ifndef SMOKINGUNS
VectorScale( ent->s.pos.trDelta, 0.65, ent->s.pos.trDelta );
#else
VectorScale( ent->s.pos.trDelta, 0.17, ent->s.pos.trDelta );
#endif
// check for stop
if ( trace->plane.normal[2] > 0.2 && VectorLength( ent->s.pos.trDelta ) < 40 ) {
G_SetOrigin( ent, trace->endpos );
#ifdef SMOKINGUNS
if(!Q_stricmp(ent->classname, "grenadeno")){
ent->classname = "grenadeend";
VectorCopy(trace->endpos, ent->s.origin2);
}
#endif
return;
}
}
VectorAdd( ent->r.currentOrigin, trace->plane.normal, ent->r.currentOrigin);
VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase );
ent->s.pos.trTime = level.time;
}
示例6: G_BounceMissile
/*
================
G_BounceMissile
================
*/
void G_BounceMissile( gentity_t *ent, trace_t *trace )
{
vec3_t velocity;
float dot;
int hitTime;
float cor = 1.;
if( !strcmp( ent->classname, "bounceball" ) )
cor = .8;
// reflect the velocity on the trace plane
hitTime = level.previousTime + ( level.time - level.previousTime ) * trace->fraction;
BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, velocity );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -(1+cor) * dot, trace->plane.normal, ent->s.pos.trDelta );
if( ent->s.eFlags & EF_BOUNCE_HALF )
{
if(!strcmp(ent->classname,"grenade") && g_proximityMines.integer) {
VectorScale( ent->s.pos.trDelta, 0.00, ent->s.pos.trDelta );
} else {
VectorScale( ent->s.pos.trDelta, 0.65, ent->s.pos.trDelta );
}
// check for stop
if( trace->plane.normal[ 2 ] > 0.2 && VectorLength( ent->s.pos.trDelta ) < 40 )
{
G_SetOrigin( ent, trace->endpos );
return;
}
}
VectorAdd( ent->r.currentOrigin, trace->plane.normal, ent->r.currentOrigin );
VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase );
ent->s.pos.trTime = level.time;
}
示例7: G_BounceMissile_Q3
void G_BounceMissile_Q3( gentity_t *ent, trace_t *trace ) {
vector3 velocity;
float dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = level.previousTime + (int)(( level.time - level.previousTime ) * trace->fraction);
BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, &velocity );
dot = DotProduct( &velocity, &trace->plane.normal );
VectorMA( &velocity, -2*dot, &trace->plane.normal, &ent->s.pos.trDelta );
if ( ent->flags & FL_BOUNCE_HALF ) {
VectorScale( &ent->s.pos.trDelta, 0.65f, &ent->s.pos.trDelta );
// check for stop
if ( trace->plane.normal.z > 0.2f && VectorLength( &ent->s.pos.trDelta ) < 40 ) {
G_SetOrigin( ent, &trace->endpos );
ent->s.time = level.time / 4;
return;
}
}
VectorAdd( &ent->r.currentOrigin, &trace->plane.normal, &ent->r.currentOrigin);
VectorCopy( &ent->r.currentOrigin, &ent->s.pos.trBase );
ent->s.pos.trTime = level.time;
}
示例8: G_BounceItem
/*
================
G_BounceItem
================
*/
void G_BounceItem( gentity_t *ent, trace_t *trace ) {
vec3_t velocity;
float dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = level.previousTime + ( level.time - level.previousTime ) * trace->fraction;
BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, velocity );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -2*dot, trace->plane.normal, ent->s.pos.trDelta );
// cut the velocity to keep from bouncing forever
VectorScale( ent->s.pos.trDelta, ent->physicsBounce, ent->s.pos.trDelta );
// check for stop
if ( trace->plane.normal[2] > 0 && ent->s.pos.trDelta[2] < 40 ) {
trace->endpos[2] += 1.0; // make sure it is off ground
SnapVector( trace->endpos );
G_SetOrigin( ent, trace->endpos );
ent->s.groundEntityNum = trace->entityNum;
return;
}
VectorAdd( ent->r.currentOrigin, trace->plane.normal, ent->r.currentOrigin);
VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase );
ent->s.pos.trTime = level.time;
}
示例9: G_BounceMissile
/*
================
G_BounceMissile
================
*/
void G_BounceMissile( gentity_t *ent, trace_t *trace ) {
vec3_t velocity;
float dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = level.previousTime + ( level.time - level.previousTime ) * trace->fraction;
BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, velocity );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -2*dot, trace->plane.normal, ent->s.pos.trDelta );
if ( ent->flags & FL_BOUNCE_SHRAPNEL )
{
VectorScale( ent->s.pos.trDelta, 0.25f, ent->s.pos.trDelta );
ent->s.pos.trType = TR_GRAVITY;
// check for stop
if ( trace->plane.normal[2] > 0.7 && ent->s.pos.trDelta[2] < 40 ) //this can happen even on very slightly sloped walls, so changed it from > 0 to > 0.7
{
G_SetOrigin( ent, trace->endpos );
ent->nextthink = level.time + 100;
return;
}
}
else if ( ent->flags & FL_BOUNCE_HALF )
{
VectorScale( ent->s.pos.trDelta, 0.65f, ent->s.pos.trDelta );
// check for stop
if ( trace->plane.normal[2] > 0.2 && VectorLength( ent->s.pos.trDelta ) < 40 )
{
G_SetOrigin( ent, trace->endpos );
return;
}
}
if (ent->s.weapon == WP_THERMAL)
{ //slight hack for hit sound
G_Sound(ent, CHAN_BODY, G_SoundIndex(va("sound/weapons/thermal/bounce%i.wav", Q_irand(1, 2))));
}
else if (ent->s.weapon == WP_SABER)
{
G_Sound(ent, CHAN_BODY, G_SoundIndex(va("sound/weapons/saber/bounce%i.wav", Q_irand(1, 3))));
}
else if (ent->s.weapon == G2_MODEL_PART)
{
//Limb bounce sound?
}
VectorAdd( ent->r.currentOrigin, trace->plane.normal, ent->r.currentOrigin);
VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase );
ent->s.pos.trTime = level.time;
if (ent->bounceCount != -5)
{
ent->bounceCount--;
}
}
示例10: G_BounceMissile
/*
================
G_BounceMissile
================
*/
void G_BounceMissile( gentity_t *ent, trace_t *trace ) {
vec3_t velocity;
float dot;
int hitTime;
// Arnout: removed this for MP as well (was already gone from SP)
/*
// Ridah, if we are a grenade, and we have hit an AI that is waiting to catch us, give them a grenade, and delete ourselves
if ((ent->splashMethodOfDeath == MOD_GRENADE_SPLASH) && (g_entities[trace->entityNum].flags & FL_AI_GRENADE_KICK) &&
(trace->endpos[2] > g_entities[trace->entityNum].r.currentOrigin[2])) {
g_entities[trace->entityNum].grenadeExplodeTime = ent->nextthink;
g_entities[trace->entityNum].flags &= ~FL_AI_GRENADE_KICK;
Add_Ammo( &g_entities[trace->entityNum], WP_GRENADE_LAUNCHER, 1, qfalse ); //----(SA) modified
G_FreeEntity( ent );
return;
}
*/
// reflect the velocity on the trace plane
hitTime = level.previousTime + ( level.time - level.previousTime ) * trace->fraction;
BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, velocity );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -2 * dot, trace->plane.normal, ent->s.pos.trDelta );
// RF, record this for mover pushing
if ( trace->plane.normal[2] > 0.2 /*&& VectorLength( ent->s.pos.trDelta ) < 40*/ ) {
ent->s.groundEntityNum = trace->entityNum;
}
if ( ent->s.eFlags & EF_BOUNCE_HALF ) {
if ( ent->s.eFlags & EF_BOUNCE ) { // both flags marked, do a third type of bounce
VectorScale( ent->s.pos.trDelta, 0.35, ent->s.pos.trDelta );
} else {
VectorScale( ent->s.pos.trDelta, 0.65, ent->s.pos.trDelta );
}
// check for stop
if ( trace->plane.normal[2] > 0.2 && VectorLength( ent->s.pos.trDelta ) < 40 ) {
//----(SA) make the world the owner of the dynamite, so the player can shoot it after it stops moving
if ( ent->s.weapon == WP_DYNAMITE || ent->s.weapon == WP_DYNAMITE2 ) {
ent->r.ownerNum = ENTITYNUM_WORLD;
}
//----(SA) end
G_SetOrigin( ent, trace->endpos );
return;
}
}
SnapVector( ent->s.pos.trDelta );
VectorAdd( ent->r.currentOrigin, trace->plane.normal, ent->r.currentOrigin );
VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase );
SnapVector( ent->s.pos.trBase );
ent->s.pos.trTime = level.time;
}
示例11: G_Bounce
/*
================
G_Bounce
================
*/
static void G_Bounce( gentity_t *ent, trace_t *trace )
{
vec3_t velocity;
float dot;
int hitTime;
float minNormal;
qboolean invert = qfalse;
// reflect the velocity on the trace plane
hitTime = level.previousTime + ( level.time - level.previousTime ) * trace->fraction;
BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, velocity );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -2 * dot, trace->plane.normal, ent->s.pos.trDelta );
if ( ent->s.eType == ET_BUILDABLE )
{
minNormal = BG_Buildable( ent->s.modelindex )->minNormal;
invert = BG_Buildable( ent->s.modelindex )->invertNormal;
}
else
{
minNormal = 0.707f;
}
// cut the velocity to keep from bouncing forever
if ( ( trace->plane.normal[ 2 ] >= minNormal ||
( invert && trace->plane.normal[ 2 ] <= -minNormal ) ) &&
trace->entityNum == ENTITYNUM_WORLD )
{
VectorScale( ent->s.pos.trDelta, ent->physicsBounce, ent->s.pos.trDelta );
}
else
{
VectorScale( ent->s.pos.trDelta, 0.3f, ent->s.pos.trDelta );
}
if ( VectorLength( ent->s.pos.trDelta ) < 10 )
{
VectorMA( trace->endpos, 0.5f, trace->plane.normal, trace->endpos ); // make sure it is off ground
G_SetOrigin( ent, trace->endpos );
ent->s.groundEntityNum = trace->entityNum;
VectorCopy( trace->plane.normal, ent->s.origin2 );
VectorSet( ent->s.pos.trDelta, 0.0f, 0.0f, 0.0f );
return;
}
VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase );
VectorAdd( ent->r.currentOrigin, trace->plane.normal, ent->r.currentOrigin );
ent->s.pos.trTime = level.time;
}
示例12: CG_ReflectVelocity
/*
================
CG_ReflectVelocity
================
*/
void CG_ReflectVelocity( localEntity_t *le, trace_t *trace ) {
vec3_t velocity;
float dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = cg.time - cg.frametime + cg.frametime * trace->fraction;
BG_EvaluateTrajectoryDelta( &le->pos, hitTime, velocity );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -2*dot, trace->plane.normal, le->pos.trDelta );
VectorScale( le->pos.trDelta, le->bounceFactor, le->pos.trDelta );
VectorCopy( trace->endpos, le->pos.trBase );
le->pos.trTime = cg.time;
// check for stop, making sure that even on low FPS systems it doesn't bobble
if (le->leMarkType == LEMT_BLOOD && trace->startsolid)
{
//centity_t *cent;
//cent = &cg_entities[trace->entityNum];
//if (cent && cent->currentState.apos.trType != TR_STATIONARY)
// le->pos.trType = TR_STATIONARY;
}
else if ( trace->allsolid ||
( trace->plane.normal[2] > 0 &&
( le->pos.trDelta[2] < 40 || le->pos.trDelta[2] < -cg.frametime * le->pos.trDelta[2] ) ) ) {
//----(SA) if it's a fragment and it's not resting on the world...
// if(le->leType == LE_DEBRIS && trace->entityNum < (MAX_ENTITIES - 1))
if(le->leType == LE_FRAGMENT && trace->entityNum < (MAX_ENTITIES - 1))
{
le->pos.trType = TR_GRAVITY_PAUSED;
}
else
{
le->pos.trType = TR_STATIONARY;
}
}
else {
}
}
示例13: G_BounceMissile_JA
void G_BounceMissile_JA( gentity_t *ent, trace_t *trace ) {
vector3 velocity;
float dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = level.previousTime + (int)(( level.time - level.previousTime ) * trace->fraction);
BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, &velocity );
dot = DotProduct( &velocity, &trace->plane.normal );
VectorMA( &velocity, -2*dot, &trace->plane.normal, &ent->s.pos.trDelta );
if ( ent->flags & FL_BOUNCE_SHRAPNEL )
{
VectorScale( &ent->s.pos.trDelta, 0.25f, &ent->s.pos.trDelta );
ent->s.pos.trType = TR_GRAVITY;
// check for stop
if ( trace->plane.normal.z > 0.7f && ent->s.pos.trDelta.z < 40 ) //this can happen even on very slightly sloped walls, so changed it from > 0 to > 0.7f
{
G_SetOrigin( ent, &trace->endpos );
ent->nextthink = level.time + 100;
return;
}
}
else if ( ent->flags & FL_BOUNCE_HALF )
{
VectorScale( &ent->s.pos.trDelta, 0.65f, &ent->s.pos.trDelta );
// check for stop
if ( trace->plane.normal.z > 0.2f && VectorLength( &ent->s.pos.trDelta ) < 40 )
{
G_SetOrigin( ent, &trace->endpos );
return;
}
}
VectorAdd( &ent->r.currentOrigin, &trace->plane.normal, &ent->r.currentOrigin);
VectorCopy( &ent->r.currentOrigin, &ent->s.pos.trBase );
ent->s.pos.trTime = level.time;
if (ent->bounceCount != -5)
ent->bounceCount--;
}
示例14: CG_ReflectVelocity
/*
================
CG_ReflectVelocity
================
*/
void CG_ReflectVelocity(localEntity_t * le, trace_t * trace)
{
vec3_t velocity;
float dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = cg.time - cg.frametime + cg.frametime * trace->fraction;
BG_EvaluateTrajectoryDelta(&le->pos, hitTime, velocity);
dot = DotProduct(velocity, trace->plane.normal);
VectorMA(velocity, -2 * dot, trace->plane.normal, le->pos.trDelta);
VectorScale(le->pos.trDelta, le->bounceFactor, le->pos.trDelta);
VectorCopy(trace->endpos, le->pos.trBase);
le->pos.trTime = cg.time;
// check for stop, making sure that even on low FPS systems it doesn't bobble
if(trace->allsolid ||
(trace->plane.normal[2] > 0 && (le->pos.trDelta[2] < 40 || le->pos.trDelta[2] < -cg.frametime * le->pos.trDelta[2])))
{
le->pos.trType = TR_STATIONARY;
}
else
{
if(le->leFlags & LEF_TUMBLE)
{
// collided with a surface so calculate the new rotation axis
CrossProduct(trace->plane.normal, velocity, le->rotAxis);
le->angVel = VectorNormalize(le->rotAxis) / le->radius;
// save current orientation as a rotation from model's base orientation
QuatMultiply0(le->quatRot, le->quatOrient);
// reset the orientation
QuatClear(le->quatOrient);
}
}
}
示例15: G_BounceItem
/*
================
G_BounceItem
================
*/
void G_BounceItem( gentity_t *ent, trace_t *trace ) {
vec3_t velocity;
float dot;
int hitTime;
// reflect the velocity on the trace plane
hitTime = level.previousTime + ( level.time - level.previousTime ) * trace->fraction;
BG_EvaluateTrajectoryDelta( &ent->s.pos, hitTime, velocity, qfalse, ent->s.effect2Time );
dot = DotProduct( velocity, trace->plane.normal );
VectorMA( velocity, -2*dot, trace->plane.normal, ent->s.pos.trDelta );
// cut the velocity to keep from bouncing forever
VectorScale( ent->s.pos.trDelta, ent->physicsBounce, ent->s.pos.trDelta );
// check for stop
if ( trace->plane.normal[2] > 0 && ent->s.pos.trDelta[2] < 40 ) {
if (g_flushItems.integer) {
vectoangles( trace->plane.normal, ent->s.angles );
ent->s.angles[0] += 90;
if (ent->s.angles[0] > 0.0 && ent->s.angles[0] < 50.0) {
// avoid freaky medpacks
G_SetAngle( ent, ent->s.angles);
trace->endpos[2] -= (tan(DEG2RAD(ent->s.angles[0])) * ITEM_RADIUS);
} else {
trace->endpos[2] += 1.0; // make sure it is off ground
}
} else {
trace->endpos[2] += 1.0; // make sure it is off ground
}
SnapVector( trace->endpos );
G_SetOrigin( ent, trace->endpos );
ent->s.groundEntityNum = trace->entityNum;
return;
}
VectorAdd( ent->r.currentOrigin, trace->plane.normal, ent->r.currentOrigin);
VectorCopy( ent->r.currentOrigin, ent->s.pos.trBase );
ent->s.pos.trTime = level.time;
}