• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CM_TransformedBoxTrace函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CM_TransformedBoxTrace函数的典型用法代码示例。如果您正苦于以下问题:C++ CM_TransformedBoxTrace函数的具体用法?C++ CM_TransformedBoxTrace怎么用?C++ CM_TransformedBoxTrace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CM_TransformedBoxTrace函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SV_ClipMoveToEntities

/*
 * ==================== SV_ClipMoveToEntities
 *
 * ====================
 */
void
SV_ClipMoveToEntities(moveclip_t * clip)
{
	int		i, num;
	edict_t        *touchlist[MAX_EDICTS], *touch;
	trace_t		trace;
	int		headnode;
	float          *angles;

	num = SV_AreaEdicts(clip->boxmins, clip->boxmaxs, touchlist
	    ,MAX_EDICTS, AREA_SOLID);

	/* be careful, it is possible to have an entity in this */
	/* list removed before we get to it (killtriggered) */
	for (i = 0; i < num; i++) {
		touch = touchlist[i];
		if (touch->solid == SOLID_NOT)
			continue;
		if (touch == clip->passedict)
			continue;
		if (clip->trace.allsolid)
			return;
		if (clip->passedict) {
			if (touch->owner == clip->passedict)
				continue;	/* don't clip against own
						 * missiles */
			if (clip->passedict->owner == touch)
				continue;	/* don't clip against owner */
		}
		if (!(clip->contentmask & CONTENTS_DEADMONSTER)
		    && (touch->svflags & SVF_DEADMONSTER))
			continue;

		/* might intersect, so do an exact clip */
		headnode = SV_HullForEntity(touch);
		angles = touch->s.angles;
		if (touch->solid != SOLID_BSP)
			angles = vec3_origin;	/* boxes don't rotate */

		if (touch->svflags & SVF_MONSTER)
			trace = CM_TransformedBoxTrace(clip->start, clip->end,
			    clip->mins2, clip->maxs2, headnode, clip->contentmask,
			    touch->s.origin, angles);
		else
			trace = CM_TransformedBoxTrace(clip->start, clip->end,
			    clip->mins, clip->maxs, headnode, clip->contentmask,
			    touch->s.origin, angles);

		if (trace.allsolid || trace.startsolid ||
		    trace.fraction < clip->trace.fraction) {
			trace.ent = touch;
			if (clip->trace.startsolid) {
				clip->trace = trace;
				clip->trace.startsolid = true;
			} else
				clip->trace = trace;
		} else if (trace.startsolid)
			clip->trace.startsolid = true;
	}
}
开发者ID:ZwS,项目名称:qudos,代码行数:65,代码来源:sv_world.c


示例2: SV_ClipToEntity

/*
====================
SV_ClipToEntity

====================
*/
void SV_ClipToEntity( trace_t *trace, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int entityNum, int contentmask, int capsule ) {
	sharedEntity_t	*touch;
	clipHandle_t	clipHandle;
	float			*origin, *angles;

	touch = SV_GentityNum( entityNum );

	Com_Memset(trace, 0, sizeof(trace_t));

	// if it doesn't have any brushes of a type we
	// are looking for, ignore it
	if ( ! ( contentmask & touch->r.contents ) ) {
		trace->fraction = 1.0;
		return;
	}

	// might intersect, so do an exact clip
	clipHandle = SV_ClipHandleForEntity (touch);

	origin = touch->r.currentOrigin;
	angles = touch->r.currentAngles;

	if ( !touch->r.bmodel ) {
		angles = vec3_origin;	// boxes don't rotate
	}

	CM_TransformedBoxTrace ( trace, (float *)start, (float *)end,
		(float *)mins, (float *)maxs, clipHandle,  contentmask,
		origin, angles, capsule);

	if ( trace->fraction < 1 ) {
		trace->entityNum = touch->s.number;
	}
}
开发者ID:Lrns123,项目名称:jkaq3,代码行数:40,代码来源:sv_world.c


示例3: TV_Module_CM_TransformedBoxTrace

static inline void TV_Module_CM_TransformedBoxTrace( relay_t *relay, trace_t *tr, vec3_t start, vec3_t end,
													vec3_t mins, vec3_t maxs, struct cmodel_s *cmodel, int brushmask, vec3_t origin, vec3_t angles )
{
	if( !relay )
	{
		Com_Printf( "Error: TV_Module_CM_TransformedBoxTrace: Relay not set\n" );
		return;
	}

	CM_TransformedBoxTrace( relay->cms, tr, start, end, mins, maxs, cmodel, brushmask, origin, angles );
}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:11,代码来源:tv_relay_module.c


示例4: CM_HeadnodeForBoxHull

bool CEngineTrace::ClipRayToBBox( const Ray_t &ray, unsigned int fMask, ICollideable *pEntity, trace_t *pTrace )
{
	if ( pEntity->GetSolid() != SOLID_BBOX )
		return false;

	int nHeadNode = CM_HeadnodeForBoxHull( pEntity->WorldAlignMins(), pEntity->WorldAlignMaxs() );

	// bboxes don't rotate
	CM_TransformedBoxTrace( ray, nHeadNode, fMask, pEntity->GetCollisionOrigin(), vec3_angle, *pTrace );
	return true;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:11,代码来源:enginetrace.cpp


示例5: EnumElement

	IterationRetval_t EnumElement( IHandleEntity *pHandleEntity )
	{
		// Static props should never be in the trigger list 
		Assert( !StaticPropMgr()->IsStaticProp( pHandleEntity ) );

		IServerNetworkable *pNetworkable = static_cast<IServerNetworkable*>( pHandleEntity );
		Assert( pNetworkable );

		// Convert the IHandleEntity to an edict_t*...
		// Context is the thing we're testing everything against		
		edict_t* pTouch = pNetworkable->GetEdict();

		// Can't bump against itself
		if ( pTouch == m_pEnt )
			return ITERATION_CONTINUE;

		IServerEntity *serverEntity = pTouch->GetIServerEntity();
		if ( !serverEntity )
			return ITERATION_CONTINUE;

		// Hmmm.. everything in this list should be a trigger....
		ICollideable *pCollideable = serverEntity->GetCollideable();
		Assert(pCollideable->GetSolidFlags() & FSOLID_TRIGGER );
		if ( (pCollideable->GetSolidFlags() & FSOLID_TRIGGER) == 0 )
			return ITERATION_CONTINUE;

		model_t* pModel = sv.GetModel( pCollideable->GetCollisionModelIndex() );
		if ( pModel && pModel->type == mod_brush )
		{
			int headnode = SV_HullForEntity( pTouch );

			int contents;
			if (!m_Ray.m_IsSwept)
			{
				contents = CM_TransformedBoxContents( m_Ray.m_Start, m_mins, m_maxs,
					headnode, serverEntity->GetAbsOrigin(), serverEntity->GetAbsAngles() );
			}
			else
			{
				trace_t trace;
				CM_TransformedBoxTrace( m_Ray, headnode, MASK_ALL, serverEntity->GetAbsOrigin(), 
					serverEntity->GetAbsAngles(), trace );
				contents = trace.contents;
			}

			if ( !(contents & MASK_SOLID) )
				return ITERATION_CONTINUE;
		}

		m_TouchedEntities.AddToTail( pTouch );

		return ITERATION_CONTINUE;
	}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:53,代码来源:world.cpp


示例6: SV_EntityContact

/*
==================
SV_GameAreaEntities
==================
*/
bool SV_EntityContact(vec3_t mins, vec3_t maxs, const sharedEntity_t * gEnt, traceType_t type) {
	const float		*origin, *angles;
	clipHandle_t	ch;
	trace_t			trace;

	// check for exact collision
	origin = gEnt->r.currentOrigin;
	angles = gEnt->r.currentAngles;

	ch = SV_ClipHandleForEntity( gEnt );
	CM_TransformedBoxTrace(&trace, vec3_origin, vec3_origin, mins, maxs, ch, -1, origin, angles, type);

	return trace.startsolid;
}
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:19,代码来源:sv_game.cpp


示例7: CM_InlineModelNumber

//-----------------------------------------------------------------------------
// Perform bsp trace
//-----------------------------------------------------------------------------
bool CEngineTrace::ClipRayToBSP( const Ray_t &ray, unsigned int fMask, ICollideable *pEntity, trace_t *pTrace )
{
	const model_t *pModel = pEntity->GetCollisionModel();
	if ( pModel && pModel->type == mod_brush )
	{
		int nModelIndex = pEntity->GetCollisionModelIndex();
		cmodel_t *pCModel = CM_InlineModelNumber( nModelIndex - 1 );
		int nHeadNode = pCModel->headnode;

		CM_TransformedBoxTrace( ray, nHeadNode, fMask, pEntity->GetCollisionOrigin(), pEntity->GetCollisionAngles(), *pTrace );
		return true;
	}
	return false;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:17,代码来源:enginetrace.cpp


示例8: SV_ClipMoveToEntities

/*
====================
SV_ClipMoveToEntities

====================
*/
static void SV_ClipMoveToEntities(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end,
                                  edict_t *passedict, int contentmask, trace_t *tr)
{
    vec3_t      boxmins, boxmaxs;
    int         i, num;
    edict_t     *touchlist[MAX_EDICTS], *touch;
    trace_t     trace;

    // create the bounding box of the entire move
    for (i = 0; i < 3; i++) {
        if (end[i] > start[i]) {
            boxmins[i] = start[i] + mins[i] - 1;
            boxmaxs[i] = end[i] + maxs[i] + 1;
        } else {
            boxmins[i] = end[i] + mins[i] - 1;
            boxmaxs[i] = start[i] + maxs[i] + 1;
        }
    }

    num = SV_AreaEdicts(boxmins, boxmaxs, touchlist, MAX_EDICTS, AREA_SOLID);

    // be careful, it is possible to have an entity in this
    // list removed before we get to it (killtriggered)
    for (i = 0; i < num; i++) {
        touch = touchlist[i];
        if (touch->solid == SOLID_NOT)
            continue;
        if (touch == passedict)
            continue;
        if (tr->allsolid)
            return;
        if (passedict) {
            if (touch->owner == passedict)
                continue;    // don't clip against own missiles
            if (passedict->owner == touch)
                continue;    // don't clip against owner
        }

        if (!(contentmask & CONTENTS_DEADMONSTER)
            && (touch->svflags & SVF_DEADMONSTER))
            continue;

        // might intersect, so do an exact clip
        CM_TransformedBoxTrace(&trace, start, end, mins, maxs,
                               SV_HullForEntity(touch), contentmask,
                               touch->s.origin, touch->s.angles);

        CM_ClipEntity(tr, &trace, touch);
    }
}
开发者ID:Jenco420,项目名称:q2pro,代码行数:56,代码来源:world.c


示例9: R_Trace

/**
 * @brief Moves the given mins/maxs volume through the world from start to end.
 * @param[in] start Start vector to start the trace from
 * @param[in] end End vector to stop the trace at
 * @param[in] size Bounding box size used for tracing
 * @param[in] contentmask Searched content the trace should watch for
 */
void R_Trace (const vec3_t start, const vec3_t end, float size, int contentmask)
{
	vec3_t mins, maxs;
	float frac;
	trace_t tr;
	int i;

	r_locals.tracenum++;

	if (r_locals.tracenum > 0xffff)  /* avoid overflows */
		r_locals.tracenum = 0;

	VectorSet(mins, -size, -size, -size);
	VectorSet(maxs, size, size, size);

	refdef.trace = CM_CompleteBoxTrace(refdef.mapTiles, start, end, mins, maxs, TRACING_ALL_VISIBLE_LEVELS, contentmask, 0);
	refdef.traceEntity = NULL;

	frac = refdef.trace.fraction;

	/* check bsp models */
	for (i = 0; i < refdef.numEntities; i++) {
		entity_t *ent = R_GetEntity(i);
		const model_t *m = ent->model;

		if (!m || m->type != mod_bsp_submodel)
			continue;

		tr = CM_TransformedBoxTrace(&(refdef.mapTiles->mapTiles[m->bsp.maptile]), start, end, mins, maxs, m->bsp.firstnode,
				contentmask, 0, ent->origin, ent->angles);

		if (tr.fraction < frac) {
			refdef.trace = tr;
			refdef.traceEntity = ent;

			frac = tr.fraction;
		}
	}

	assert(refdef.trace.mapTile >= 0);
	assert(refdef.trace.mapTile < r_numMapTiles);
}
开发者ID:ptitSeb,项目名称:UFO--AI-OpenPandora,代码行数:49,代码来源:r_lightmap.c


示例10: SV_ClipToEntity

/*
 * SV_ClipToEntity
 *
 */
void
SV_ClipToEntity(Trace *trace, const Vec3 start, const Vec3 mins,
		const Vec3 maxs, const Vec3 end, int entityNum,
		int contentmask,
		int capsule)
{
	Sharedent	*touch;
	Cliphandle	clipHandle;
	float *origin, *angles;

	touch = SV_GentityNum(entityNum);

	Q_Memset(trace, 0, sizeof(Trace));

	/* if it doesn't have any brushes of a type we
	 * are looking for, ignore it */
	if(!(contentmask & touch->r.contents)){
		trace->fraction = 1.0;
		return;
	}

	/* might intersect, so do an exact clip */
	clipHandle = SV_ClipHandleForEntity (touch);

	origin	= touch->r.currentOrigin;
	angles	= touch->r.currentAngles;

	if(!touch->r.bmodel)
		angles = vec3_origin;	/* boxes don't rotate */

	CM_TransformedBoxTrace (trace, (float*)start, (float*)end,
		(float*)mins, (float*)maxs, clipHandle,  contentmask,
		origin, angles, capsule);

	if(trace->fraction < 1)
		trace->entityNum = touch->s.number;
}
开发者ID:icanhas,项目名称:yantar,代码行数:41,代码来源:world.c


示例11: SV_ClipMoveToEntities

/*
=======================================================================================================================================
SV_ClipMoveToEntities
=======================================================================================================================================
*/
void SV_ClipMoveToEntities(moveclip_t *clip) {
	int i, num;
	int touchlist[MAX_GENTITIES];
	sharedEntity_t *touch;
	int passOwnerNum;
	trace_t trace;
	clipHandle_t clipHandle;
	float *origin, *angles;

	num = SV_AreaEntities(clip->boxmins, clip->boxmaxs, touchlist, MAX_GENTITIES);

	if (clip->passEntityNum != ENTITYNUM_NONE) {
		passOwnerNum = (SV_GentityNum(clip->passEntityNum))->r.ownerNum;

		if (passOwnerNum == ENTITYNUM_NONE) {
			passOwnerNum = -1;
		}
	} else {
		passOwnerNum = -1;
	}

	for (i = 0; i < num; i++) {
		if (clip->trace.allsolid) {
			return;
		}

		touch = SV_GentityNum(touchlist[i]);
		// see if we should ignore this entity
		if (clip->passEntityNum != ENTITYNUM_NONE) {
			if (touchlist[i] == clip->passEntityNum) {
				continue; // don't clip against the pass entity
			}

			if (touch->r.ownerNum == clip->passEntityNum) {
				continue; // don't clip against own missiles
			}

			if (touch->r.ownerNum == passOwnerNum) {
				continue; // don't clip against other missiles from our owner
			}
		}
		// if it doesn't have any brushes of a type we are looking for, ignore it
		if (!(clip->contentmask & touch->r.contents)) {
			continue;
		}
		// might intersect, so do an exact clip
		clipHandle = SV_ClipHandleForEntity(touch);
		// non-worldspawn entities must not use world as clip model!
		if (clipHandle == 0) {
			continue;
		}
		// if clipping against BBOX, set to correct contents
		if (clipHandle == BOX_MODEL_HANDLE) {
			CM_SetTempBoxModelContents(touch->r.contents);
		}

		origin = touch->r.currentOrigin;
		angles = touch->r.currentAngles;

		if (!touch->r.bmodel) {
			angles = vec3_origin; // boxes don't rotate
		}

		CM_TransformedBoxTrace(&trace, clip->start, clip->end, clip->mins, clip->maxs, clipHandle, clip->contentmask, origin, angles, clip->capsule);

		if (trace.allsolid) {
			clip->trace.allsolid = qtrue;
			trace.entityNum = touch->s.number;
		} else if (trace.startsolid) {
			clip->trace.startsolid = qtrue;
			trace.entityNum = touch->s.number;
		}

		if (trace.fraction < clip->trace.fraction) {
			// make sure we keep a startsolid from a previous trace
			qboolean oldStart = clip->trace.startsolid;

			trace.entityNum = touch->s.number;
			clip->trace = trace;
			clip->trace.startsolid |= oldStart;
		}
		// reset contents to default
		if (clipHandle == BOX_MODEL_HANDLE) {
			CM_SetTempBoxModelContents(CONTENTS_BODY);
		}
	}
}
开发者ID:ioid3-games,项目名称:ioid3-wet,代码行数:92,代码来源:sv_world.c


示例12: SV_ClipMoveToEntities

/*
====================
SV_ClipMoveToEntities

====================
*/
void SV_ClipMoveToEntities( moveclip_t *clip ) {
	int			i, num;
	int			touchlist[MAX_GENTITIES];
	sharedEntity_t *touch;
	int			passOwnerNum;
	trace_t		trace, oldTrace;
	clipHandle_t	clipHandle;
	float		*origin, *angles;
	int			thisOwnerShared = 1;

	num = SV_AreaEntities( clip->boxmins, clip->boxmaxs, touchlist, MAX_GENTITIES);

	if ( clip->passEntityNum != ENTITYNUM_NONE ) {
		passOwnerNum = ( SV_GentityNum( clip->passEntityNum ) )->r.ownerNum;
		if ( passOwnerNum == ENTITYNUM_NONE ) {
			passOwnerNum = -1;
		}
	} else {
		passOwnerNum = -1;
	}

	if ( SV_GentityNum(clip->passEntityNum)->r.svFlags & SVF_OWNERNOTSHARED )
	{
		thisOwnerShared = 0;
	}

	for ( i=0 ; i<num ; i++ ) {
		if ( clip->trace.allsolid ) {
			return;
		}
		touch = SV_GentityNum( touchlist[i] );

		// see if we should ignore this entity
		if ( clip->passEntityNum != ENTITYNUM_NONE ) {
			if ( touchlist[i] == clip->passEntityNum ) {
				continue;	// don't clip against the pass entity
			}
			if ( touch->r.ownerNum == clip->passEntityNum) {
				if (touch->r.svFlags & SVF_OWNERNOTSHARED)
				{
					if ( clip->contentmask != (MASK_SHOT | CONTENTS_LIGHTSABER) &&
						clip->contentmask != (MASK_SHOT))
					{ //it's not a laser hitting the other "missile", don't care then
						continue;
					}
				}
				else
				{
					continue;	// don't clip against own missiles
				}
			}
			if ( touch->r.ownerNum == passOwnerNum &&
				!(touch->r.svFlags & SVF_OWNERNOTSHARED) &&
				!thisOwnerShared ) {
				continue;	// don't clip against other missiles from our owner
			}
		}

		// if it doesn't have any brushes of a type we
		// are looking for, ignore it
		if ( ! ( clip->contentmask & touch->r.contents ) ) {
			continue;
		}

		if ((clip->contentmask == (MASK_SHOT|CONTENTS_LIGHTSABER) || clip->contentmask == MASK_SHOT) && (touch->r.contents > 0 && (touch->r.contents & CONTENTS_NOSHOT)))
		{
			continue;
		}

		// might intersect, so do an exact clip
		clipHandle = SV_ClipHandleForEntity (touch);

		origin = touch->r.currentOrigin;
		angles = touch->r.currentAngles;


		if ( !touch->r.bmodel ) {
			angles = vec3_origin;	// boxes don't rotate
		}

		CM_TransformedBoxTrace ( &trace, (float *)clip->start, (float *)clip->end,
			(float *)clip->mins, (float *)clip->maxs, clipHandle,  clip->contentmask,
			origin, angles, clip->capsule);

/*
Ghoul2 Insert Start
*/

		// keep these older variables around for a bit, incase we need to replace them in the Ghoul2 Collision check
		oldTrace = clip->trace;
/*
Ghoul2 Insert End
*/

//.........这里部分代码省略.........
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:101,代码来源:sv_world.cpp


示例13: SV_ClipMoveToEntity

__cdecl void SV_ClipMoveToEntity(moveclip_t *clip, svEntity_t *entity, trace_t *trace){

	gentity_t	*touch;
	int		touchNum;
	float		*origin, *angles;
	vec3_t		mins, maxs;
	float		oldfraction;
	clipHandle_t	clipHandle;

	touchNum = entity - sv.svEntities;

	touch = SV_GentityNum( touchNum );

	if( !(clip->contentmask & touch->r.contents))
		return;

	if ( clip->passEntityNum != ENTITYNUM_NONE ) {

		if( touchNum == clip->passEntityNum )
			return;

		if(touch->r.ownerNum){
		
			if( touch->r.ownerNum - 1 == clip->passEntityNum )
			    return;


			if( touch->r.ownerNum - 1 == clip->passOwnerNum )
			    return;
		
		}
		if(!G_ShouldEntitiesClip(clip, touchNum, touch))
			return;
	}

	VectorAdd(touch->r.absmin, clip->mins, mins);
	VectorAdd(touch->r.absmax, clip->maxs, maxs);

	if(CM_TraceBox(clip->extents.start, mins, maxs, trace->fraction))
		return;
	
	clipHandle = SV_ClipHandleForEntity(touch);

	origin = touch->r.currentOrigin;
	angles = touch->r.currentAngles;

	if ( !touch->r.bmodel ) {
		angles = vec3_origin;   // boxes don't rotate
	}

	oldfraction = trace->fraction;

	CM_TransformedBoxTrace( trace, clip->extents.start, clip->extents.end,
				clip->mins, clip->maxs, clipHandle, clip->contentmask, origin, angles );


	if ( trace->fraction < oldfraction ) {
		trace->var_02 = qtrue;
		trace->entityNum = touch->s.number;
	}

}
开发者ID:Call-of-Duty-Scripts,项目名称:CoD4x1.8_Server_Pub,代码行数:62,代码来源:sv_world.c


示例14: SV_ClipMoveToEntities

static void SV_ClipMoveToEntities(trace_t &trace, const CVec3 &start, const CVec3 &end, const CBox &bounds, edict_t *passedict, int contentmask)
{
	guard(SV_ClipMoveToEntities);

	if (trace.allsolid) return;

	int		i;

	CVec3 amins, amaxs;
	for (i = 0; i < 3; i++)
	{
		if (start[i] < end[i])
		{
			amins[i] = bounds.mins[i] + start[i];
			amaxs[i] = bounds.maxs[i] + end[i];
		}
		else
		{
			amins[i] = bounds.mins[i] + end[i];
			amaxs[i] = bounds.maxs[i] + start[i];
		}
	}
	edict_t	*list[MAX_EDICTS];
	int num = SV_AreaEdicts(amins, amaxs, ARRAY_ARG(list), AREA_SOLID);
	if (!num) return;

	float b1 = dot(bounds.mins, bounds.mins);
	float b2 = dot(bounds.maxs, bounds.maxs);
	float t = max(b1, b2);
	float traceWidth = SQRTFAST(t);
	CVec3 traceDir;
	VectorSubtract(end, start, traceDir);
	float traceLen = traceDir.Normalize() + traceWidth;

	for (i = 0; i < num; i++)
	{
		edict_t *edict = list[i];
		entityHull_t &ent = ents[NUM_FOR_EDICT(edict)];
//		if (!ent->linked) continue;

		if (edict->solid == SOLID_NOT || edict == passedict) continue;
		if (passedict)
		{
		 	if (edict->owner == passedict)
				continue;	// don't clip against own missiles
			if (passedict->owner == edict)
				continue;	// don't clip against owner
		}
		if (!(contentmask & CONTENTS_DEADMONSTER) && (edict->svflags & SVF_DEADMONSTER))
			continue;

		CVec3 eCenter;
		VectorSubtract(ent.center, start, eCenter);
		// check position of point projection on line
		float entPos = dot(eCenter, traceDir);
		if (entPos < -traceWidth - ent.radius || entPos > traceLen + ent.radius)
			continue;		// too near / too far

		// check distance between point and line
		CVec3 tmp;
		VectorMA(eCenter, -entPos, traceDir, tmp);
		float dist2 = dot(tmp, tmp);
		float dist0 = ent.radius + traceWidth;
		if (dist2 >= dist0 * dist0) continue;

		trace_t	tr;
		if (ent.model)
			CM_TransformedBoxTrace(tr, start, end, bounds, ent.model->headnode, contentmask, edict->s.origin, ent.axis);
		else
			CM_TransformedBoxTrace(tr, start, end, bounds, CM_HeadnodeForBox(ent.bounds), contentmask, edict->s.origin, nullVec3);
		if (CM_CombineTrace(trace, tr))
			trace.ent = edict;
		if (trace.allsolid) return;
	}

	unguard;
}
开发者ID:RkShaRkz,项目名称:Quake2,代码行数:77,代码来源:sv_world.cpp


示例15: SV_ClipMoveToEntities

static void SV_ClipMoveToEntities( moveclip_t *clip ) {
	int			i, num;
	int			touchlist[MAX_GENTITIES];
	sharedEntity_t *touch;
	int			passOwnerNum;
	trace_t		trace;
	clipHandle_t	clipHandle;
	vector3		*origin, *angles;

	num = SV_AreaEntities( &clip->boxmins, &clip->boxmaxs, touchlist, MAX_GENTITIES);

	if ( clip->passEntityNum != ENTITYNUM_NONE ) {
		passOwnerNum = ( SV_GentityNum( clip->passEntityNum ) )->r.ownerNum;
		if ( passOwnerNum == ENTITYNUM_NONE ) {
			passOwnerNum = -1;
		}
	} else {
		passOwnerNum = -1;
	}

	for ( i=0 ; i<num ; i++ ) {
		if ( clip->trace.allsolid ) {
			return;
		}
		touch = SV_GentityNum( touchlist[i] );

		// see if we should ignore this entity
		if ( clip->passEntityNum != ENTITYNUM_NONE ) {
			if ( touchlist[i] == clip->passEntityNum ) {
				continue;	// don't clip against the pass entity
			}
			//QTZTODO: Missiles colliding with eachother from https://github.com/dmead/jkaq3/commit/1d1e1fefb04fab8ceb42537702d946c1a75f4812
			if ( touch->r.ownerNum == clip->passEntityNum // don't clip against own missiles
				|| touch->r.ownerNum == passOwnerNum ) // don't clip against other missiles from our owner
				continue;
		}

		// if it doesn't have any brushes of a type we
		// are looking for, ignore it
		if ( ! ( clip->contentmask & touch->r.contents ) ) {
			continue;
		}

		// might intersect, so do an exact clip
		clipHandle = SV_ClipHandleForEntity (touch);

		origin = &touch->r.currentOrigin;
		angles = &touch->r.currentAngles;


		if ( !touch->r.bmodel ) {
			angles = &vec3_origin;	// boxes don't rotate
		}

		CM_TransformedBoxTrace( &trace, (vector3 *)clip->start, &clip->end, (vector3 *)clip->mins, (vector3 *)clip->maxs, clipHandle, clip->contentmask, origin, angles, clip->capsule );

		if ( trace.allsolid ) {
			clip->trace.allsolid = qtrue;
			trace.entityNum = touch->s.number;
		} else if ( trace.startsolid ) {
			clip->trace.startsolid = qtrue;
			trace.entityNum = touch->s.number;
		}

		if ( trace.fraction < clip->trace.fraction ) {
			qboolean	oldStart;

			// make sure we keep a startsolid from a previous trace
			oldStart = clip->trace.startsolid;

			trace.entityNum = touch->s.number;
			clip->trace = trace;
			clip->trace.startsolid |= oldStart;
		}
	}
}
开发者ID:Razish,项目名称:QtZ,代码行数:76,代码来源:sv_world.c


示例16: SV_ClipMoveToEntities

static void SV_ClipMoveToEntities( moveclip_t *clip ) {
	static int	touchlist[MAX_GENTITIES];
	int			i, num;
	sharedEntity_t *touch;
	int			passOwnerNum;
	trace_t		trace, oldTrace= {0};
	clipHandle_t	clipHandle;
	float		*origin, *angles;
	int			thisOwnerShared = 1;

	num = SV_AreaEntities( clip->boxmins, clip->boxmaxs, touchlist, MAX_GENTITIES);

	if ( clip->passEntityNum != ENTITYNUM_NONE ) {
		passOwnerNum = ( SV_GentityNum( clip->passEntityNum ) )->r.ownerNum;
		if ( passOwnerNum == ENTITYNUM_NONE ) {
			passOwnerNum = -1;
		}
	} else {
		passOwnerNum = -1;
	}

	if ( SV_GentityNum(clip->passEntityNum)->r.svFlags & SVF_OWNERNOTSHARED )
	{
		thisOwnerShared = 0;
	}

	for ( i=0 ; i<num ; i++ ) {
		if ( clip->trace.allsolid ) {
			return;
		}
		touch = SV_GentityNum( touchlist[i] );

		// see if we should ignore this entity
		if ( clip->passEntityNum != ENTITYNUM_NONE ) {
			if ( touchlist[i] == clip->passEntityNum ) {
				continue;	// don't clip against the pass entity
			}
			if ( touch->r.ownerNum == clip->passEntityNum) {
				if (touch->r.svFlags & SVF_OWNERNOTSHARED)
				{
					if ( clip->contentmask != (MASK_SHOT | CONTENTS_LIGHTSABER) &&
						clip->contentmask != (MASK_SHOT))
					{ //it's not a laser hitting the other "missile", don't care then
						continue;
					}
				}
				else
				{
					continue;	// don't clip against own missiles
				}
			}
			if ( touch->r.ownerNum == passOwnerNum &&
				!(touch->r.svFlags & SVF_OWNERNOTSHARED) &&
				thisOwnerShared ) {
				continue;	// don't clip against other missiles from our owner
			}

			if (touch->s.eType == ET_MISSILE &&
				!(touch->r.svFlags & SVF_OWNERNOTSHARED) &&
				touch->r.ownerNum == passOwnerNum)
			{ //blah, hack
				continue;
			}
		}

		// if it doesn't have any brushes of a type we
		// are looking for, ignore it
		if ( ! ( clip->contentmask & touch->r.contents ) ) {
			continue;
		}

		if ((clip->contentmask == (MASK_SHOT|CONTENTS_LIGHTSABER) || clip->contentmask == MASK_SHOT) && (touch->r.contents > 0 && (touch->r.contents & CONTENTS_NOSHOT)))
		{
			continue;
		}

		// might intersect, so do an exact clip
		clipHandle = SV_ClipHandleForEntity (touch);

		origin = touch->r.currentOrigin;
		angles = touch->r.currentAngles;


		if ( !touch->r.bmodel ) {
			angles = vec3_origin;	// boxes don't rotate
		}

		CM_TransformedBoxTrace ( &trace, (float *)clip->start, (float *)clip->end,
			(float *)clip->mins, (float *)clip->maxs, clipHandle,  clip->contentmask,
			origin, angles, clip->capsule);


		if (clip->traceFlags & G2TRFLAG_DOGHOULTRACE)
		{ // keep these older variables around for a bit, incase we need to replace them in the Ghoul2 Collision check
			oldTrace = clip->trace;
		}

		if ( trace.allsolid ) {
			clip->trace.allsolid = qtrue;
			trace.entityNum = touch->s.number;
//.........这里部分代码省略.........
开发者ID:mh94,项目名称:OpenJK,代码行数:101,代码来源:sv_world.cpp


示例17: CL_CgameSystemCalls


//.........这里部分代码省略.........
        case CG_UPDATESCREEN:
            // this is used during lengthy level loading, so pump message loop
            //		Com_EventLoop();	// FIXME: if a server restarts here, BAD THINGS HAPPEN!
            // We can't call Com_EventLoop here, a restart will crash and this _does_ happen
            // if there is a map change while we are downloading at pk3.
            // ZOID
            SCR_UpdateScreen();
            return 0;
        case CG_CM_LOADMAP:
            CL_CM_LoadMap( (const char*)VMA(1) );
            return 0;
        case CG_CM_NUMINLINEMODELS:
            return CM_NumInlineModels();
        case CG_CM_INLINEMODEL:
            return CM_InlineModel( args[1] );
        case CG_CM_TEMPBOXMODEL:
            return CM_TempBoxModel( (const float*)VMA(1), (const float*)VMA(2), false );
        case CG_CM_TEMPCAPSULEMODEL:
            return CM_TempBoxModel( (const float*)VMA(1), (const float*)VMA(2), true );
        case CG_CM_POINTCONTENTS:
            return CM_PointContents( (const float*)VMA(1), args[2] );
        case CG_CM_TRANSFORMEDPOINTCONTENTS:
            return CM_TransformedPointContents( (const float*)VMA(1), (clipHandle_t)args[2],
                                                (const float*)VMA(3), (const float*)VMA(4) );
        case CG_CM_BOXTRACE:
            CM_BoxTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3),
                         (float*)VMA(4), (float*)VMA(5), (clipHandle_t)args[6], args[7], TT_AABB );
            return 0;
        case CG_CM_CAPSULETRACE:
            CM_BoxTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3),
                         (float*)VMA(4), (float*)VMA(5), (clipHandle_t)args[6], args[7], TT_CAPSULE );
            return 0;
        case CG_CM_TRANSFORMEDBOXTRACE:
            CM_TransformedBoxTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3),
                                    (float*)VMA(4), (float*)VMA(5), (clipHandle_t)args[6], args[7],
                                    (const float*)VMA(8), (const float*)VMA(9), TT_AABB );
            return 0;
        case CG_CM_TRANSFORMEDCAPSULETRACE:
            CM_TransformedBoxTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3),
                                    (float*)VMA(4), (float*)VMA(5), (clipHandle_t)args[6], args[7],
                                    (const float*)VMA(8), (const float*)VMA(9), TT_CAPSULE );
            return 0;
        case CG_CM_BISPHERETRACE:
            CM_BiSphereTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3), VMF(4), VMF(5), (clipHandle_t)args[6], args[7] );
            return 0;
        case CG_CM_TRANSFORMEDBISPHERETRACE:
            CM_TransformedBiSphereTrace( (trace_t*)VMA(1), (const float*)VMA(2), (const float*)VMA(3),
                                         VMF(4), VMF(5), (clipHandle_t)args[6], args[7], (const float*)VMA(8) );
            return 0;
        case CG_CM_MARKFRAGMENTS:
            {
            float (&arg2)[3][3] = *reinterpret_cast<float (*)[3][3]>(VMA(2));
            return re.MarkFragments( args[1], arg2, (const float*)VMA(3), args[4], (float*)VMA(5), args[6], (markFragment_t*)VMA(7) );
            }
        case CG_S_STARTSOUND:
            S_StartSound( (float*)VMA(1), args[2], args[3], (sfxHandle_t)args[4] );
            return 0;
        case CG_S_STARTLOCALSOUND:
            S_StartLocalSound( (sfxHandle_t)args[1], args[2] );
            return 0;
        case CG_S_CLEARLOOPINGSOUNDS:
            S_ClearLoopingSounds( (bool)args[1] );
            return 0;
        case CG_S_ADDLOOPINGSOUND:
            S_AddLoopingSound( args[1], (const float*)VMA(2), (const float*)VMA(3), (sfxHandle_t)args[4] );
            return 0;
开发者ID:wtfbbqhax,项目名称:tremulous,代码行数:67,代码来源:cl_cgame.cpp


示例18: SV_ClipMoveToEntities

/*
 * SV_ClipMoveToEntities
 *
 */
static void
SV_ClipMoveToEntities(moveclip_t *clip)
{
	int	i, num;
	int	touchlist[MAX_GENTITIES];
	Sharedent *touch;
	int	passOwnerNum;
	Trace trace;
	Cliphandle clipHandle;
	float	*origin, *angles;

	num = SV_AreaEntities(clip->boxmins, clip->boxmaxs, touchlist,
		MAX_GENTITIES);

	if(clip->passEntityNum != ENTITYNUM_NONE){
		passOwnerNum = (SV_GentityNum(clip->passEntityNum))->r.ownerNum;
		if(passOwnerNum == ENTITYNUM_NONE)
			passOwnerNum = -1;
	}else
		passOwnerNum = -1;

	for(i=0; i<num; i++){
		if(clip->trace.allsolid)
			return;
		touch = SV_GentityNum(touchlist[i]);

		/* see if we should ignore this entity */
		if(clip->passEntityNum != ENTITYNUM_NONE){
			if(touchlist[i] == clip->passEntityNum)
				continue;	/* don't clip against the pass entity */
			if(touch->r.ownerNum == clip->passEntityNum)
				continue;	/* don't clip against own missiles */
			if(touch->r.ownerNum == passOwnerNum)
				continue;	/* don't clip against other missiles from our owner */
		}

		/* if it doesn't have any brushes of a type we
		 * are looking for, ignore it */
		if(!(clip->contentmask & touch->r.contents))
			continue;

		/* might intersect, so do an exact clip */
		clipHandle = SV_ClipHandleForEntity (touch);

		origin	= touch->r.currentOrigin;
		angles	= touch->r.currentAngles;


		if(!touch->r.bmodel)
			angles = vec3_origin;	/* boxes don't rotate */

		CM_TransformedBoxTrace (&trace, (float*)clip->start,
			(float*)clip->end,
			(float*)clip->mins, (float*)clip->maxs, clipHandle,
			clip->contentmask,
			origin, angles,
			clip->capsule);

		if(trace.allsolid){
			clip->trace.allsolid = qtrue;
			trace.entityNum = touch->s.number;
		}else if(trace.startsolid){
			clip->trace.startsolid = qtrue;
			trace.entityNum = touch->s.number;
		}

		if(trace.fraction < clip->trace.fraction){
			qbool oldStart;

			/* make sure we keep a startsolid from a previous trace */
			oldStart = clip->trace.startsolid;

			trace.entityNum = touch->s.number;
			clip->trace = trace;
			clip->trace.startsolid |= oldStart;
		}
	}
}
开发者ID:icanhas,项目名称:yantar,代码行数:82,代码来源:world.c


示例19: CL_CgameSystemCalls

intptr_t CL_CgameSystemCalls(intptr_t *args)
{
	switch (args[0])
	{
	case CG_PRINT:
		Com_Printf("%s", (char *)VMA(1));
		return 0;
	case CG_ERROR:
		Com_Error(ERR_DROP, "%s", (char *)VMA(1));
		return 0;
	case CG_MILLISECONDS:
		return Sys_Milliseconds();
	case CG_CVAR_REGISTER:
		Cvar_Register(VMA(1), VMA(2), VMA(3), args[4]);
		return 0;
	case CG_CVAR_UPDATE:
		Cvar_Update(VMA(1));
		return 0;
	case CG_CVAR_SET:
		Cvar_SetSafe(VMA(1), VMA(2));
		return 0;
	case CG_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer(VMA(1), VMA(2), args[3]);
		return 0;
	case CG_CVAR_LATCHEDVARIABLESTRINGBUFFER:
		Cvar_LatchedVariableStringBuffer(VMA(1), VMA(2), args[3]);
		return 0;
	case CG_ARGC:
		return Cmd_Argc();
	case CG_ARGV:
		Cmd_ArgvBuffer(args[1], VMA(2), args[3]);
		return 0;
	case CG_ARGS:
		Cmd_ArgsBuffer(VMA(1), args[2]);
		return 0;
	case CG_FS_FOPENFILE:
		return FS_FOpenFileByMode(VMA(1), VMA(2), args[3]);
	case CG_FS_READ:
		FS_Read(VMA(1), args[2], args[3]);
		return 0;
	case CG_FS_WRITE:
		return FS_Write(VMA(1), args[2], args[3]);
	case CG_FS_FCLOSEFILE:
		FS_FCloseFile(args[1]);
		return 0;
	case CG_FS_GETFILELIST:
		return FS_GetFileList(VMA(1), VMA(2), VMA(3), args[4]);
	case CG_FS_DELETEFILE:
		return FS_Delete(VMA(1));
	case CG_SENDCONSOLECOMMAND:
		Cbuf_AddText(VMA(1));
		return 0;
	case CG_ADDCOMMAND:
		CL_AddCgameCommand(VMA(1));
		return 0;
	case CG_REMOVECOMMAND:
		Cmd_RemoveCommandSafe(VMA(1));
		return 0;
	case CG_SENDCLIENTCOMMAND:
		CL_AddReliableCommand(VMA(1));
		return 0;
	case CG_UPDATESCREEN:
		SCR_UpdateScreen();
		return 0;
	case CG_CM_LOADMAP:
		CL_CM_LoadMap(VMA(1));
		return 0;
	case CG_CM_NUMINLINEMODELS:
		return CM_NumInlineModels();
	case CG_CM_INLINEMODEL:
		return CM_InlineModel(args[1]);
	case CG_CM_TEMPBOXMODEL:
		return CM_TempBoxModel(VMA(1), VMA(2), qfalse);
	case CG_CM_TEMPCAPSULEMODEL:
		return CM_TempBoxModel(VMA(1), VMA(2), qtrue);
	case CG_CM_POINTCONTENTS:
		return CM_PointContents(VMA(1), args[2]);
	case CG_CM_TRANSFORMEDPOINTCONTENTS:
		return CM_TransformedPointContents(VMA(1), args[2], VMA(3), VMA(4));
	case CG_CM_BOXTRACE:
		CM_BoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qfalse);
		return 0;
	case CG_CM_CAPSULETRACE:
		CM_BoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qtrue);
		return 0;
	case CG_CM_TRANSFORMEDBOXTRACE:
		CM_TransformedBoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qfalse);
		return 0;
	case CG_CM_TRANSFORMEDCAPSULETRACE:
		CM_TransformedBoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qtrue);
		return 0;
	case CG_CM_MARKFRAGMENTS:
		return re.MarkFragments(args[1], VMA(2), VMA(3), args[4], VMA(5), args[6], VMA(7));

	case CG_R_PROJECTDECAL:
		re.ProjectDecal(args[1], args[2], VMA(3), VMA(4), VMA(5), args[6], args[7]);
		return 0;
	case CG_R_CLEARDECALS:
		re.ClearDecals();
		return 0;
//.........这里部分代码省略.........
开发者ID:Mailaender,项目名称:etlegacy,代码行数:101,代码来源:cl_cgame.c


示例20: CL_CgameSystemCalls

/*
====================
CL_CgameSystemCalls

The cgame module is making a system call
====================
*/
intptr_t CL_CgameSystemCalls( intptr_t *args ) {
	switch( args[0] ) {
	case CG_PRINT:
		Com_Printf( "%s", VMA(1) );
		return 0;
	case CG_FATAL_ERROR:
		Com_Error( ERR_DROP, "%s", VMA(1) );
		return 0;
	case CG_MILLISECONDS:
		return Sys_Milliseconds();
	case CG_CVAR_REGISTER:
		Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] ); 
		return 0;
	case CG_CVAR_UPDATE:
		Cvar_Update( VMA(1) );
		return 0;
	case CG_CVAR_SET:
		Cvar_Set( VMA(1), VMA(2) );
		return 0;
	case CG_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
		return 0;
	case CG_ARGC:
		return Cmd_Argc();
	case CG_ARGV:
		Cmd_ArgvBuffer( args[1], VMA(2), args[3] );
		return 0;
	case CG_ARGVI:
		return atoi( Cmd_Argv( args[1] ) );
	case CG_ARGS:
		Cmd_ArgsBuffer( VMA(1), args[2] );
		return 0;
	case CG_CMD_EXECUTETEXT:
		Cbuf_ExecuteText( args[1], VMA(2) );
		return 0;
	case CG_FS_FOPENFILE:
		return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] );
	case CG_FS_READ:
		FS_Read( VMA(1), args[2], args[3] );
		return 0;
	case CG_FS_WRITE:
		FS_Write( VMA(1), args[2], args[3] );
		return 0;
	case CG_FS_FCLOSEFILE:
		FS_FCloseFile( args[1] );
		return 0;
	case CG_SENDCONSOLECOMMAND:
		Cbuf_AddText( VMA(1) );
		return 0;
	case CG_FORWARDCOMMAND:
		VM_Call( uivm, UI_CONSOLE_COMMAND, cls.realtime );
		return 0;
	case CG_ADDCOMMAND:
		CL_AddCgameCommand( VMA(1) );
		return 0;
	case CG_REMOVECOMMAND:
		Cmd_RemoveCommand( VMA(1) );
		return 0;
	case CG_SENDCLIENTCOMMAND:
		CL_AddReliableCommand( VMA(1) );
		return 0;
	case CG_UPDATESCREEN:
		// this is used during lengthy level loading, so pump message loop
//		Com_EventLoop();	// FIXME: if a server restarts here, BAD THINGS HAPPEN!
// We can't call Com_EventLoop here, a restart will crash and this _does_  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CM_TransformedPointContents函数代码示例发布时间:2022-05-30
下一篇:
C++ CM_TempBoxModel函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap