diff --git a/modules/engine/engine.cpp b/modules/engine/engine.cpp index f996f8ef..59fc8ddd 100644 --- a/modules/engine/engine.cpp +++ b/modules/engine/engine.cpp @@ -574,16 +574,27 @@ static cell AMX_NATIVE_CALL trace_hull(AMX *amx,cell *params) { int iResult=0; TraceResult tr; - Vector vPos; + Vector vStart; + Vector vEnd; 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]); + vStart.x = amx_ctof(vCell[0]); + vStart.y = amx_ctof(vCell[1]); + vStart.z = amx_ctof(vCell[2]); - TRACE_HULL(vPos,vPos, params[4], params[2], params[3] > 0 ? INDEXENT2(params[3]) : 0 , &tr); + if (params[0] / sizeof(cell) >= 5 && (vCell = MF_GetAmxVectorNull(amx, params[5]))) + { + + vEnd.x = amx_ctof(vCell[0]); + vEnd.y = amx_ctof(vCell[1]); + vEnd.z = amx_ctof(vCell[2]); + } + else + vEnd = vStart; + + TRACE_HULL(vStart, vEnd, params[4], params[2], params[3] > 0 ? INDEXENT2(params[3]) : 0, &tr); if (tr.fStartSolid) { iResult += 1; diff --git a/plugins/include/engine.inc b/plugins/include/engine.inc index 4b811429..cbe11a5b 100755 --- a/plugins/include/engine.inc +++ b/plugins/include/engine.inc @@ -999,7 +999,7 @@ native trace_line(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float: native trace_normal(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]); /** - * Fires a trace hull on a specified origin. + * Fires a trace hull on a specified origin or between two origins. * * @note This native writes to the global trace handle. Additional trace results * can be retrieved using traceresult(). @@ -1008,15 +1008,16 @@ native trace_normal(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Floa * @note For a list of valid ignore types see the *IGNORE_* constants in * hlsdk_const.inc * - * @param origin Trace startin and end point + * @param origin Trace start point (and end point if not specified) * @param hull Hull type * @param ignoredent Entity index that trace will ignore * @param ignoremonsters Entity ignore type + * @param end Trace end point, pass NULL_VECTOR to use start point * * @return Custom bitflag sum of relevant trace results * StartSolid (1), AllSolid (2) and InOpen (4) */ -native trace_hull(const Float:origin[3], hull, ignoredent = 0, ignoremonsters = 0); +native trace_hull(const Float:origin[3], hull, ignoredent = 0, ignoremonsters = 0, const Float:end[3] = NULL_VECTOR); /** * Attempts to describe an obstacle by firing trace lines in a specified