示例#1
0
static cell AMX_NATIVE_CALL csdm_trace_hull(AMX *amx,cell *params)
{
	TraceResult tr;
	Vector vPos;
	cell *vCell;

	vCell = MF_GetAmxAddr(amx, params[1]);

	vPos.x = amx_ctof(vCell[0]);
	vPos.y = amx_ctof(vCell[1]);
	vPos.z = amx_ctof(vCell[2]);

	TRACE_HULL(vPos,vPos, 0, params[2], NULL, &tr);

	if (tr.fStartSolid)
		return 1;

	if (tr.fAllSolid)
		return 1;

	if (!tr.fInOpen)
		return 1;

	return 0;
}
示例#2
0
traceresult_t PlayerTestLine(const Vector &vecStart, const Vector &vecEnd, bool igmon,
                             bool isDuckPlayer, CEntity *pentIgnore)
{
   // local variables are made static for speedup reason
   static TraceResult tr; // Valve's TraceResult struct
   static traceresult_t trace;  // our own traceresult_t struct

   // Use Valve's tracehull function to perform the actual operation...
   TRACE_HULL(vecStart, vecEnd, (igmon ? 1 : 0), isDuckPlayer ? head_hull : human_hull,
              (pentIgnore ? pentIgnore->edict() : NULL), &tr);

   // convert Valve's TraceResult to our own traceresult_t
   trace.allsolid = tr.fAllSolid != 0;
   trace.endpos = tr.vecEndPos;
   trace.ent = CEntity::Instance(tr.pHit);
   trace.fraction = tr.flFraction;
   trace.hitgroup = tr.iHitgroup;
   trace.inopen = tr.fInOpen != 0;
   trace.inwater = tr.fInWater != 0;
   trace.plane.dist = tr.flPlaneDist;
   trace.plane.normal = tr.vecPlaneNormal;
   trace.startsolid = tr.fStartSolid != 0;

   return trace; // okay, result converted, return it. Tracehull done.
}
示例#3
0
文件: engine.cpp 项目: 9iky6/amxmodx
//(mahnsawce)
static cell AMX_NATIVE_CALL trace_hull(AMX *amx,cell *params)
{
	int iResult=0;
	TraceResult tr;
	Vector vPos;
	cell *vCell;

	vCell = MF_GetAmxAddr(amx, params[1]);

	vPos.x = amx_ctof(vCell[0]);
	vPos.y = amx_ctof(vCell[1]);
	vPos.z = amx_ctof(vCell[2]);

	TRACE_HULL(vPos,vPos, params[4], params[2], params[3] > 0 ? INDEXENT2(params[3]) : 0 , &tr);

	if (tr.fStartSolid) {
		iResult += 1;
	}
	if (tr.fAllSolid) {
		iResult += 2;
	}
	if (!tr.fInOpen) {
		iResult += 4;
	}
	return iResult;
}
示例#4
0
void UTIL_TraceHull( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr )
{
	TRACE_HULL( vecStart, vecEnd, ( igmon == ignore_monsters ? TRF_IGNORE_MONSTERS : TRF_NONE ), hullNumber, pentIgnore, ptr );
}