Engine: Add a destination parameter to trace_hull() to make it more useful
This commit is contained in:
parent
add4867d21
commit
3c1022af99
|
@ -574,16 +574,27 @@ static cell AMX_NATIVE_CALL trace_hull(AMX *amx,cell *params)
|
||||||
{
|
{
|
||||||
int iResult=0;
|
int iResult=0;
|
||||||
TraceResult tr;
|
TraceResult tr;
|
||||||
Vector vPos;
|
Vector vStart;
|
||||||
|
Vector vEnd;
|
||||||
cell *vCell;
|
cell *vCell;
|
||||||
|
|
||||||
vCell = MF_GetAmxAddr(amx, params[1]);
|
vCell = MF_GetAmxAddr(amx, params[1]);
|
||||||
|
|
||||||
vPos.x = amx_ctof(vCell[0]);
|
vStart.x = amx_ctof(vCell[0]);
|
||||||
vPos.y = amx_ctof(vCell[1]);
|
vStart.y = amx_ctof(vCell[1]);
|
||||||
vPos.z = amx_ctof(vCell[2]);
|
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) {
|
if (tr.fStartSolid) {
|
||||||
iResult += 1;
|
iResult += 1;
|
||||||
|
|
|
@ -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]);
|
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
|
* @note This native writes to the global trace handle. Additional trace results
|
||||||
* can be retrieved using traceresult().
|
* 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
|
* @note For a list of valid ignore types see the *IGNORE_* constants in
|
||||||
* hlsdk_const.inc
|
* 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 hull Hull type
|
||||||
* @param ignoredent Entity index that trace will ignore
|
* @param ignoredent Entity index that trace will ignore
|
||||||
* @param ignoremonsters Entity ignore type
|
* @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
|
* @return Custom bitflag sum of relevant trace results
|
||||||
* StartSolid (1), AllSolid (2) and InOpen (4)
|
* 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
|
* Attempts to describe an obstacle by firing trace lines in a specified
|
||||||
|
|
Loading…
Reference in New Issue
Block a user