From e31572600181f9355d316d2c33ef0ba7ba2c6816 Mon Sep 17 00:00:00 2001 From: DaFox Date: Mon, 24 Aug 2009 09:19:42 +1200 Subject: [PATCH] Added PointOutsideWorld native to sdktools (bug 3906, r=dvander) --- extensions/sdktools/trnatives.cpp | 15 +++++++++++++++ plugins/include/sdktools_trace.inc | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/extensions/sdktools/trnatives.cpp b/extensions/sdktools/trnatives.cpp index 6503921a..463f2396 100644 --- a/extensions/sdktools/trnatives.cpp +++ b/extensions/sdktools/trnatives.cpp @@ -557,6 +557,20 @@ static cell_t smn_TRGetPointContentsEnt(IPluginContext *pContext, const cell_t * return enginetrace->GetPointContents_Collideable(pEdict->GetCollideable(), pos); } +static cell_t smn_TRPointOutsideWorld(IPluginContext *pContext, const cell_t *params) +{ + cell_t *vec; + Vector pos; + + pContext->LocalToPhysAddr(params[1], &vec); + + pos.x = sp_ctof(vec[0]); + pos.y = sp_ctof(vec[1]); + pos.z = sp_ctof(vec[2]); + + return enginetrace->PointOutsideWorld(pos) +} + sp_nativeinfo_t g_TRNatives[] = { {"TR_TraceRay", smn_TRTraceRay}, @@ -575,5 +589,6 @@ sp_nativeinfo_t g_TRNatives[] = {"TR_TraceHullFilter", smn_TRTraceHullFilter}, {"TR_TraceHullFilterEx", smn_TRTraceHullFilterEx}, {"TR_GetPlaneNormal", smn_TRGetPlaneNormal}, + {"TR_PointOutsideWorld", smn_TRPointOutsideWorld}, {NULL, NULL} }; diff --git a/plugins/include/sdktools_trace.inc b/plugins/include/sdktools_trace.inc index d69b654e..27de9201 100644 --- a/plugins/include/sdktools_trace.inc +++ b/plugins/include/sdktools_trace.inc @@ -365,3 +365,10 @@ native TR_GetHitGroup(Handle:hndl=INVALID_HANDLE); */ native TR_GetPlaneNormal(Handle:hndl, Float:normal[3]); +/** + * Tests a point to see if it's outside any playable area + * + * @param pos Vector buffer to store data in. + * @return True if outside world, otherwise false. + */ +native TR_PointOutsideWorld(Float:pos[3]); \ No newline at end of file