game/server/server_weapon.c
/*	Runs a trace to see if a projectile can be casted.
*/
Runs a trace to see if a projectile can be casted.
Runs a trace to see if a projectile can be casted .
bool Weapon_CheckTrace(ServerEntity_t *eOwner)
{
	int i, iTraceContents;
	MathVector3f_t mvTarget, mvSource;
	trace_t tCheck;
	Math_VectorCopy(eOwner->v.origin, mvSource);
	mvSource[2] += eOwner->v.view_ofs[2];
	for (i = 0; i < 3; i++)
		mvTarget[i] = mvSource[i] * 128.0f;
	tCheck = Engine.Server_Move(mvSource, mvTraceMins, mvTraceMaxs, mvTarget, MOVE_NOMONSTERS, eOwner);
	if (!tCheck.bOpen)
		return false;
	if ((tCheck.ent != Server.eWorld) && (tCheck.ent != eOwner))
		if (Math_IsIntersecting(mvTraceMins, mvTraceMaxs, tCheck.ent->v.mins, tCheck.ent->v.maxs))
			return false;
	iTraceContents = Engine.Server_PointContents(tCheck.endpos);
	if ((iTraceContents == BSP_CONTENTS_SKY) || (iTraceContents == BSP_CONTENTS_SOLID))
		return false;
	return true;
}
bool Weapon_CheckTrace ( ServerEntity_t * eOwner ) { int i , iTraceContents ; MathVector3f_t mvTarget , mvSource ; trace_t tCheck ; Math_VectorCopy ( eOwner -> v . origin , mvSource ) ; mvSource [ 2 ] += eOwner -> v . view_ofs [ 2 ] ; for ( i = 0 ; i < 3 ; i ++ ) mvTarget [ i ] = mvSource [ i ] * 128.0f ; tCheck = Engine . Server_Move ( mvSource , mvTraceMins , mvTraceMaxs , mvTarget , MOVE_NOMONSTERS , eOwner ) ; if ( ! tCheck . bOpen ) return false ; if ( ( tCheck . ent != Server . eWorld ) && ( tCheck . ent != eOwner ) ) if ( Math_IsIntersecting ( mvTraceMins , mvTraceMaxs , tCheck . ent -> v . mins , tCheck . ent -> v . maxs ) ) return false ; iTraceContents = Engine . Server_PointContents ( tCheck . endpos ) ; if ( ( iTraceContents == BSP_CONTENTS_SKY ) || ( iTraceContents == BSP_CONTENTS_SOLID ) ) return false ; return true ; }
Runs a trace to see if a projectile can be casted.
Runs a trace to see if a projectile can be casted .
// Copy over the players origin. // Update the origin to the correct view offset. // Apply the distance to the target for the trace. // Check that there's enough space for projectile. // Check to see if there's a target, and it's not the world! // Are we intersecting with it? // Ensure that we're not inside the sky or within a solid.