1.1 --- a/plugins/include/sdktools_trace.inc Fri Apr 11 08:04:11 2008 +0000
1.2 +++ b/plugins/include/sdktools_trace.inc Fri Apr 11 17:16:36 2008 +0000
1.3 @@ -1,272 +1,272 @@
1.4 -/**
1.5 - * vim: set ts=4 :
1.6 - * =============================================================================
1.7 - * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
1.8 - * =============================================================================
1.9 - *
1.10 - * This file is part of the SourceMod/SourcePawn SDK.
1.11 - *
1.12 - * This program is free software; you can redistribute it and/or modify it under
1.13 - * the terms of the GNU General Public License, version 3.0, as published by the
1.14 - * Free Software Foundation.
1.15 - *
1.16 - * This program is distributed in the hope that it will be useful, but WITHOUT
1.17 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.18 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.19 - * details.
1.20 - *
1.21 - * You should have received a copy of the GNU General Public License along with
1.22 - * this program. If not, see <http://www.gnu.org/licenses/>.
1.23 - *
1.24 - * As a special exception, AlliedModders LLC gives you permission to link the
1.25 - * code of this program (as well as its derivative works) to "Half-Life 2," the
1.26 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.27 - * by the Valve Corporation. You must obey the GNU General Public License in
1.28 - * all respects for all other code used. Additionally, AlliedModders LLC grants
1.29 - * this exception to all derivative works. AlliedModders LLC defines further
1.30 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.31 - * or <http://www.sourcemod.net/license.php>.
1.32 - *
1.33 - * Version: $Id$
1.34 - */
1.35 -
1.36 -#if defined _sdktools_trace_included
1.37 - #endinput
1.38 -#endif
1.39 -#define _sdktools_trace_included
1.40 -
1.41 -#define CONTENTS_EMPTY 0 /**< No contents. */
1.42 -#define CONTENTS_SOLID 0x1 /**< an eye is never valid in a solid . */
1.43 -#define CONTENTS_WINDOW 0x2 /**< translucent, but not watery (glass). */
1.44 -#define CONTENTS_AUX 0x4
1.45 -#define CONTENTS_GRATE 0x8 /**< alpha-tested "grate" textures. Bullets/sight pass through, but solids don't. */
1.46 -#define CONTENTS_SLIME 0x10
1.47 -#define CONTENTS_WATER 0x20
1.48 -#define CONTENTS_MIST 0x40
1.49 -#define CONTENTS_OPAQUE 0x80 /**< things that cannot be seen through (may be non-solid though). */
1.50 -#define LAST_VISIBLE_CONTENTS 0x80
1.51 -#define ALL_VISIBLE_CONTENTS (LAST_VISIBLE_CONTENTS | (LAST_VISIBLE_CONTENTS-1))
1.52 -#define CONTENTS_TESTFOGVOLUME 0x100
1.53 -#define CONTENTS_UNUSED5 0x200
1.54 -#define CONTENTS_UNUSED6 0x4000
1.55 -#define CONTENTS_TEAM1 0x800 /**< per team contents used to differentiate collisions. */
1.56 -#define CONTENTS_TEAM2 0x1000 /**< between players and objects on different teams. */
1.57 -#define CONTENTS_IGNORE_NODRAW_OPAQUE 0x2000 /**< ignore CONTENTS_OPAQUE on surfaces that have SURF_NODRAW. */
1.58 -#define CONTENTS_MOVEABLE 0x4000 /**< hits entities which are MOVETYPE_PUSH (doors, plats, etc) */
1.59 -#define CONTENTS_AREAPORTAL 0x8000 /**< remaining contents are non-visible, and don't eat brushes. */
1.60 -#define CONTENTS_PLAYERCLIP 0x10000
1.61 -#define CONTENTS_MONSTERCLIP 0x20000
1.62 -
1.63 -/**
1.64 - * @section currents can be added to any other contents, and may be mixed
1.65 - */
1.66 -#define CONTENTS_CURRENT_0 0x40000
1.67 -#define CONTENTS_CURRENT_90 0x80000
1.68 -#define CONTENTS_CURRENT_180 0x100000
1.69 -#define CONTENTS_CURRENT_270 0x200000
1.70 -#define CONTENTS_CURRENT_UP 0x400000
1.71 -#define CONTENTS_CURRENT_DOWN 0x800000
1.72 -
1.73 -/**
1.74 - * @endsection
1.75 - */
1.76 -
1.77 -#define CONTENTS_ORIGIN 0x1000000 /**< removed before bsping an entity. */
1.78 -#define CONTENTS_MONSTER 0x2000000 /**< should never be on a brush, only in game. */
1.79 -#define CONTENTS_DEBRIS 0x4000000
1.80 -#define CONTENTS_DETAIL 0x8000000 /**< brushes to be added after vis leafs. */
1.81 -#define CONTENTS_TRANSLUCENT 0x10000000 /**< auto set if any surface has trans. */
1.82 -#define CONTENTS_LADDER 0x20000000
1.83 -#define CONTENTS_HITBOX 0x40000000 /**< use accurate hitboxes on trace. */
1.84 -
1.85 -/**
1.86 - * @section Trace masks.
1.87 - */
1.88 -#define MASK_ALL (0xFFFFFFFF)
1.89 -#define MASK_SOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE) /**< everything that is normally solid */
1.90 -#define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE) /**< everything that blocks player movement */
1.91 -#define MASK_NPCSOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE) /**< blocks npc movement */
1.92 -#define MASK_WATER (CONTENTS_WATER|CONTENTS_MOVEABLE|CONTENTS_SLIME) /**< water physics in these contents */
1.93 -#define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_OPAQUE) /**< everything that blocks line of sight for AI, lighting, etc */
1.94 -#define MASK_OPAQUE_AND_NPCS (MASK_OPAQUE|CONTENTS_MONSTER) /**< everything that blocks line of sight for AI, lighting, etc, but with monsters added. */
1.95 -#define MASK_VISIBLE (MASK_OPAQUE|CONTENTS_IGNORE_NODRAW_OPAQUE) /**< everything that blocks line of sight for players */
1.96 -#define MASK_VISIBLE_AND_NPCS (MASK_OPAQUE_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE) /**< everything that blocks line of sight for players, but with monsters added. */
1.97 -#define MASK_SHOT (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX) /**< bullets see these as solid */
1.98 -#define MASK_SHOT_HULL (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_GRATE) /**< non-raycasted weapons see this as solid (includes grates) */
1.99 -#define MASK_SHOT_PORTAL (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW) /**< hits solids (not grates) and passes through everything else */
1.100 -#define MASK_SOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_GRATE) /**< everything normally solid, except monsters (world+brush only) */
1.101 -#define MASK_PLAYERSOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_PLAYERCLIP|CONTENTS_GRATE) /**< everything normally solid for player movement, except monsters (world+brush only) */
1.102 -#define MASK_NPCSOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE) /**< everything normally solid for npc movement, except monsters (world+brush only) */
1.103 -#define MASK_NPCWORLDSTATIC (CONTENTS_SOLID|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE) /**< just the world, used for route rebuilding */
1.104 -#define MASK_SPLITAREAPORTAL (CONTENTS_WATER|CONTENTS_SLIME) /**< These are things that can split areaportals */
1.105 -
1.106 -/**
1.107 - * @endsection
1.108 - */
1.109 -
1.110 -enum RayType
1.111 -{
1.112 - RayType_EndPoint, /**< The trace ray will go from the start position to the end position. */
1.113 - RayType_Infinite /**< The trace ray will go from the start position to infinity using a direction vector. */
1.114 -};
1.115 -
1.116 -funcenum TraceEntityFilter
1.117 -{
1.118 - /**
1.119 - * Called on entity filtering.
1.120 - *
1.121 - * @param entity Entity index.
1.122 - * @param contentsMask Contents Mask.
1.123 - * @return True to allow the current entity to be hit, otherwise false.
1.124 - */
1.125 - bool:public(entity, contentsMask),
1.126 -
1.127 - /**
1.128 - * Called on entity filtering.
1.129 - *
1.130 - * @param entity Entity index.
1.131 - * @param contentsMask Contents Mask.
1.132 - * @param data Data value, if used.
1.133 - * @return True to allow the current entity to be hit, otherwise false.
1.134 - */
1.135 - bool:public(entity, contentsMask, any:data),
1.136 -};
1.137 -
1.138 -/**
1.139 - * Get the contents mask and the entity index at the given position.
1.140 - *
1.141 - * @param pos World position to test.
1.142 - * @param entindex Entity index found at the given position (by reference).
1.143 - * @return Contents mask.
1.144 - */
1.145 -native TR_GetPointContents(const Float:pos[3], &entindex=-1);
1.146 -
1.147 -/**
1.148 - * Get the point contents testing only the given entity index.
1.149 - *
1.150 - * @param entindex Entity index to test.
1.151 - * @param pos World position.
1.152 - * @return Contents mask.
1.153 - */
1.154 -native TR_GetPointContentsEnt(entindex, const Float:pos[3]);
1.155 -
1.156 -/**
1.157 - * Starts up a new trace ray using a global trace result.
1.158 - *
1.159 - * @param pos Starting position of the ray.
1.160 - * @param vec Depending on RayType, it will be used as the ending point, or the direction angle.
1.161 - * @param flags Trace flags.
1.162 - * @param rtype Method to calculate the ray direction.
1.163 - * @noreturn
1.164 - */
1.165 -native TR_TraceRay(const Float:pos[3], const Float:vec[3], flags, RayType:rtype);
1.166 -
1.167 -/**
1.168 - * Starts up a new trace ray using a global trace result and a customized trace ray filter.
1.169 - *
1.170 - * Calling TR_TraceRayFilter or TR_TraceRayFilterEx from inside a filter function is
1.171 - * currently not allowed and may not work.
1.172 - *
1.173 - * @param pos Starting position of the ray.
1.174 - * @param vec Depending on RayType, it will be used as the ending point, or the direction angle.
1.175 - * @param flags Trace flags.
1.176 - * @param rtype Method to calculate the ray direction.
1.177 - * @param filter Function to use as a filter.
1.178 - * @param data Arbitrary data value to pass through to the filter function.
1.179 - * @noreturn
1.180 - */
1.181 -native TR_TraceRayFilter(const Float:pos[3],
1.182 - const Float:vec[3],
1.183 - flags,
1.184 - RayType:rtype,
1.185 - TraceEntityFilter:filter,
1.186 - any:data=0);
1.187 -
1.188 -/**
1.189 - * Starts up a new trace ray using a new trace result.
1.190 - *
1.191 - * @param pos Starting position of the ray.
1.192 - * @param vec Depending on RayType, it will be used as the ending point, or the direction angle.
1.193 - * @param flags Trace flags.
1.194 - * @param rtype Method to calculate the ray direction.
1.195 - * @return Ray trace handle, which must be closed via CloseHandle().
1.196 - */
1.197 -native Handle:TR_TraceRayEx(const Float:pos[3], const Float:vec[3], flags, RayType:rtype);
1.198 -
1.199 -/**
1.200 - * Starts up a new trace ray using a new trace result and a customized trace ray filter.
1.201 - *
1.202 - * Calling TR_TraceRayFilter or TR_TraceRayFilterEx from inside a filter function is
1.203 - * currently not allowed and may not work.
1.204 - *
1.205 - * @param pos Starting position of the ray.
1.206 - * @param vec Depending on RayType, it will be used as the ending point, or the direction angle.
1.207 - * @param flags Trace flags.
1.208 - * @param rtype Method to calculate the ray direction.
1.209 - * @param filter Function to use as a filter.
1.210 - * @param data Arbitrary data value to pass through to the filter function.
1.211 - * @return Ray trace handle, which must be closed via CloseHandle().
1.212 - */
1.213 -native Handle:TR_TraceRayFilterEx(const Float:pos[3],
1.214 - const Float:vec[3],
1.215 - flags,
1.216 - RayType:rtype,
1.217 - TraceEntityFilter:filter,
1.218 - any:data=0);
1.219 -
1.220 -/**
1.221 - * Returns the time fraction from a trace result (1.0 means no collision).
1.222 - *
1.223 - * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.224 - * @return Time fraction value of the trace.
1.225 - * @error Invalid Handle.
1.226 - */
1.227 -native Float:TR_GetFraction(Handle:hndl=INVALID_HANDLE);
1.228 -
1.229 -/**
1.230 - * Returns the collision position of a trace result.
1.231 - *
1.232 - * @param pos Vector buffer to store data in.
1.233 - * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.234 - * @noreturn
1.235 - * @error Invalid Handle.
1.236 - */
1.237 -native TR_GetEndPosition(Float:pos[3], Handle:hndl=INVALID_HANDLE);
1.238 -
1.239 -/**
1.240 - * Returns the entity index that collided with the trace.
1.241 - *
1.242 - * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.243 - * @return Entity index or -1 for no collision.
1.244 - * @error Invalid Handle.
1.245 - */
1.246 -native TR_GetEntityIndex(Handle:hndl=INVALID_HANDLE);
1.247 -
1.248 -/**
1.249 - * Returns if there was any kind of collision along the trace ray.
1.250 - *
1.251 - * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.252 - * @return True if any collision found, otherwise false.
1.253 - * @error Invalid Handle.
1.254 - */
1.255 -native bool:TR_DidHit(Handle:hndl=INVALID_HANDLE);
1.256 -
1.257 -/**
1.258 - * Returns in which body hit group the trace collided if any.
1.259 - *
1.260 - * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.261 - * @return Body hit group.
1.262 - * @error Invalid Handle.
1.263 - */
1.264 -native TR_GetHitGroup(Handle:hndl=INVALID_HANDLE);
1.265 -
1.266 -/**
1.267 - * Find the normal vector to the collison plane of a trace.
1.268 - *
1.269 - * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.270 - * @param normal Vector buffer to store the vector normal to the collision plane
1.271 - * @noreturn
1.272 - * @error Invalid Handle
1.273 - */
1.274 -native TR_GetPlaneNormal(Handle:hndl, Float:normal[3]);
1.275 -
1.276 +/**
1.277 + * vim: set ts=4 :
1.278 + * =============================================================================
1.279 + * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
1.280 + * =============================================================================
1.281 + *
1.282 + * This file is part of the SourceMod/SourcePawn SDK.
1.283 + *
1.284 + * This program is free software; you can redistribute it and/or modify it under
1.285 + * the terms of the GNU General Public License, version 3.0, as published by the
1.286 + * Free Software Foundation.
1.287 + *
1.288 + * This program is distributed in the hope that it will be useful, but WITHOUT
1.289 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.290 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.291 + * details.
1.292 + *
1.293 + * You should have received a copy of the GNU General Public License along with
1.294 + * this program. If not, see <http://www.gnu.org/licenses/>.
1.295 + *
1.296 + * As a special exception, AlliedModders LLC gives you permission to link the
1.297 + * code of this program (as well as its derivative works) to "Half-Life 2," the
1.298 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.299 + * by the Valve Corporation. You must obey the GNU General Public License in
1.300 + * all respects for all other code used. Additionally, AlliedModders LLC grants
1.301 + * this exception to all derivative works. AlliedModders LLC defines further
1.302 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.303 + * or <http://www.sourcemod.net/license.php>.
1.304 + *
1.305 + * Version: $Id$
1.306 + */
1.307 +
1.308 +#if defined _sdktools_trace_included
1.309 + #endinput
1.310 +#endif
1.311 +#define _sdktools_trace_included
1.312 +
1.313 +#define CONTENTS_EMPTY 0 /**< No contents. */
1.314 +#define CONTENTS_SOLID 0x1 /**< an eye is never valid in a solid . */
1.315 +#define CONTENTS_WINDOW 0x2 /**< translucent, but not watery (glass). */
1.316 +#define CONTENTS_AUX 0x4
1.317 +#define CONTENTS_GRATE 0x8 /**< alpha-tested "grate" textures. Bullets/sight pass through, but solids don't. */
1.318 +#define CONTENTS_SLIME 0x10
1.319 +#define CONTENTS_WATER 0x20
1.320 +#define CONTENTS_MIST 0x40
1.321 +#define CONTENTS_OPAQUE 0x80 /**< things that cannot be seen through (may be non-solid though). */
1.322 +#define LAST_VISIBLE_CONTENTS 0x80
1.323 +#define ALL_VISIBLE_CONTENTS (LAST_VISIBLE_CONTENTS | (LAST_VISIBLE_CONTENTS-1))
1.324 +#define CONTENTS_TESTFOGVOLUME 0x100
1.325 +#define CONTENTS_UNUSED5 0x200
1.326 +#define CONTENTS_UNUSED6 0x4000
1.327 +#define CONTENTS_TEAM1 0x800 /**< per team contents used to differentiate collisions. */
1.328 +#define CONTENTS_TEAM2 0x1000 /**< between players and objects on different teams. */
1.329 +#define CONTENTS_IGNORE_NODRAW_OPAQUE 0x2000 /**< ignore CONTENTS_OPAQUE on surfaces that have SURF_NODRAW. */
1.330 +#define CONTENTS_MOVEABLE 0x4000 /**< hits entities which are MOVETYPE_PUSH (doors, plats, etc) */
1.331 +#define CONTENTS_AREAPORTAL 0x8000 /**< remaining contents are non-visible, and don't eat brushes. */
1.332 +#define CONTENTS_PLAYERCLIP 0x10000
1.333 +#define CONTENTS_MONSTERCLIP 0x20000
1.334 +
1.335 +/**
1.336 + * @section currents can be added to any other contents, and may be mixed
1.337 + */
1.338 +#define CONTENTS_CURRENT_0 0x40000
1.339 +#define CONTENTS_CURRENT_90 0x80000
1.340 +#define CONTENTS_CURRENT_180 0x100000
1.341 +#define CONTENTS_CURRENT_270 0x200000
1.342 +#define CONTENTS_CURRENT_UP 0x400000
1.343 +#define CONTENTS_CURRENT_DOWN 0x800000
1.344 +
1.345 +/**
1.346 + * @endsection
1.347 + */
1.348 +
1.349 +#define CONTENTS_ORIGIN 0x1000000 /**< removed before bsping an entity. */
1.350 +#define CONTENTS_MONSTER 0x2000000 /**< should never be on a brush, only in game. */
1.351 +#define CONTENTS_DEBRIS 0x4000000
1.352 +#define CONTENTS_DETAIL 0x8000000 /**< brushes to be added after vis leafs. */
1.353 +#define CONTENTS_TRANSLUCENT 0x10000000 /**< auto set if any surface has trans. */
1.354 +#define CONTENTS_LADDER 0x20000000
1.355 +#define CONTENTS_HITBOX 0x40000000 /**< use accurate hitboxes on trace. */
1.356 +
1.357 +/**
1.358 + * @section Trace masks.
1.359 + */
1.360 +#define MASK_ALL (0xFFFFFFFF)
1.361 +#define MASK_SOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE) /**< everything that is normally solid */
1.362 +#define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE) /**< everything that blocks player movement */
1.363 +#define MASK_NPCSOLID (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER|CONTENTS_GRATE) /**< blocks npc movement */
1.364 +#define MASK_WATER (CONTENTS_WATER|CONTENTS_MOVEABLE|CONTENTS_SLIME) /**< water physics in these contents */
1.365 +#define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_OPAQUE) /**< everything that blocks line of sight for AI, lighting, etc */
1.366 +#define MASK_OPAQUE_AND_NPCS (MASK_OPAQUE|CONTENTS_MONSTER) /**< everything that blocks line of sight for AI, lighting, etc, but with monsters added. */
1.367 +#define MASK_VISIBLE (MASK_OPAQUE|CONTENTS_IGNORE_NODRAW_OPAQUE) /**< everything that blocks line of sight for players */
1.368 +#define MASK_VISIBLE_AND_NPCS (MASK_OPAQUE_AND_NPCS|CONTENTS_IGNORE_NODRAW_OPAQUE) /**< everything that blocks line of sight for players, but with monsters added. */
1.369 +#define MASK_SHOT (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_HITBOX) /**< bullets see these as solid */
1.370 +#define MASK_SHOT_HULL (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_GRATE) /**< non-raycasted weapons see this as solid (includes grates) */
1.371 +#define MASK_SHOT_PORTAL (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW) /**< hits solids (not grates) and passes through everything else */
1.372 +#define MASK_SOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_GRATE) /**< everything normally solid, except monsters (world+brush only) */
1.373 +#define MASK_PLAYERSOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_PLAYERCLIP|CONTENTS_GRATE) /**< everything normally solid for player movement, except monsters (world+brush only) */
1.374 +#define MASK_NPCSOLID_BRUSHONLY (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE) /**< everything normally solid for npc movement, except monsters (world+brush only) */
1.375 +#define MASK_NPCWORLDSTATIC (CONTENTS_SOLID|CONTENTS_WINDOW|CONTENTS_MONSTERCLIP|CONTENTS_GRATE) /**< just the world, used for route rebuilding */
1.376 +#define MASK_SPLITAREAPORTAL (CONTENTS_WATER|CONTENTS_SLIME) /**< These are things that can split areaportals */
1.377 +
1.378 +/**
1.379 + * @endsection
1.380 + */
1.381 +
1.382 +enum RayType
1.383 +{
1.384 + RayType_EndPoint, /**< The trace ray will go from the start position to the end position. */
1.385 + RayType_Infinite /**< The trace ray will go from the start position to infinity using a direction vector. */
1.386 +};
1.387 +
1.388 +funcenum TraceEntityFilter
1.389 +{
1.390 + /**
1.391 + * Called on entity filtering.
1.392 + *
1.393 + * @param entity Entity index.
1.394 + * @param contentsMask Contents Mask.
1.395 + * @return True to allow the current entity to be hit, otherwise false.
1.396 + */
1.397 + bool:public(entity, contentsMask),
1.398 +
1.399 + /**
1.400 + * Called on entity filtering.
1.401 + *
1.402 + * @param entity Entity index.
1.403 + * @param contentsMask Contents Mask.
1.404 + * @param data Data value, if used.
1.405 + * @return True to allow the current entity to be hit, otherwise false.
1.406 + */
1.407 + bool:public(entity, contentsMask, any:data),
1.408 +};
1.409 +
1.410 +/**
1.411 + * Get the contents mask and the entity index at the given position.
1.412 + *
1.413 + * @param pos World position to test.
1.414 + * @param entindex Entity index found at the given position (by reference).
1.415 + * @return Contents mask.
1.416 + */
1.417 +native TR_GetPointContents(const Float:pos[3], &entindex=-1);
1.418 +
1.419 +/**
1.420 + * Get the point contents testing only the given entity index.
1.421 + *
1.422 + * @param entindex Entity index to test.
1.423 + * @param pos World position.
1.424 + * @return Contents mask.
1.425 + */
1.426 +native TR_GetPointContentsEnt(entindex, const Float:pos[3]);
1.427 +
1.428 +/**
1.429 + * Starts up a new trace ray using a global trace result.
1.430 + *
1.431 + * @param pos Starting position of the ray.
1.432 + * @param vec Depending on RayType, it will be used as the ending point, or the direction angle.
1.433 + * @param flags Trace flags.
1.434 + * @param rtype Method to calculate the ray direction.
1.435 + * @noreturn
1.436 + */
1.437 +native TR_TraceRay(const Float:pos[3], const Float:vec[3], flags, RayType:rtype);
1.438 +
1.439 +/**
1.440 + * Starts up a new trace ray using a global trace result and a customized trace ray filter.
1.441 + *
1.442 + * Calling TR_TraceRayFilter or TR_TraceRayFilterEx from inside a filter function is
1.443 + * currently not allowed and may not work.
1.444 + *
1.445 + * @param pos Starting position of the ray.
1.446 + * @param vec Depending on RayType, it will be used as the ending point, or the direction angle.
1.447 + * @param flags Trace flags.
1.448 + * @param rtype Method to calculate the ray direction.
1.449 + * @param filter Function to use as a filter.
1.450 + * @param data Arbitrary data value to pass through to the filter function.
1.451 + * @noreturn
1.452 + */
1.453 +native TR_TraceRayFilter(const Float:pos[3],
1.454 + const Float:vec[3],
1.455 + flags,
1.456 + RayType:rtype,
1.457 + TraceEntityFilter:filter,
1.458 + any:data=0);
1.459 +
1.460 +/**
1.461 + * Starts up a new trace ray using a new trace result.
1.462 + *
1.463 + * @param pos Starting position of the ray.
1.464 + * @param vec Depending on RayType, it will be used as the ending point, or the direction angle.
1.465 + * @param flags Trace flags.
1.466 + * @param rtype Method to calculate the ray direction.
1.467 + * @return Ray trace handle, which must be closed via CloseHandle().
1.468 + */
1.469 +native Handle:TR_TraceRayEx(const Float:pos[3], const Float:vec[3], flags, RayType:rtype);
1.470 +
1.471 +/**
1.472 + * Starts up a new trace ray using a new trace result and a customized trace ray filter.
1.473 + *
1.474 + * Calling TR_TraceRayFilter or TR_TraceRayFilterEx from inside a filter function is
1.475 + * currently not allowed and may not work.
1.476 + *
1.477 + * @param pos Starting position of the ray.
1.478 + * @param vec Depending on RayType, it will be used as the ending point, or the direction angle.
1.479 + * @param flags Trace flags.
1.480 + * @param rtype Method to calculate the ray direction.
1.481 + * @param filter Function to use as a filter.
1.482 + * @param data Arbitrary data value to pass through to the filter function.
1.483 + * @return Ray trace handle, which must be closed via CloseHandle().
1.484 + */
1.485 +native Handle:TR_TraceRayFilterEx(const Float:pos[3],
1.486 + const Float:vec[3],
1.487 + flags,
1.488 + RayType:rtype,
1.489 + TraceEntityFilter:filter,
1.490 + any:data=0);
1.491 +
1.492 +/**
1.493 + * Returns the time fraction from a trace result (1.0 means no collision).
1.494 + *
1.495 + * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.496 + * @return Time fraction value of the trace.
1.497 + * @error Invalid Handle.
1.498 + */
1.499 +native Float:TR_GetFraction(Handle:hndl=INVALID_HANDLE);
1.500 +
1.501 +/**
1.502 + * Returns the collision position of a trace result.
1.503 + *
1.504 + * @param pos Vector buffer to store data in.
1.505 + * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.506 + * @noreturn
1.507 + * @error Invalid Handle.
1.508 + */
1.509 +native TR_GetEndPosition(Float:pos[3], Handle:hndl=INVALID_HANDLE);
1.510 +
1.511 +/**
1.512 + * Returns the entity index that collided with the trace.
1.513 + *
1.514 + * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.515 + * @return Entity index or -1 for no collision.
1.516 + * @error Invalid Handle.
1.517 + */
1.518 +native TR_GetEntityIndex(Handle:hndl=INVALID_HANDLE);
1.519 +
1.520 +/**
1.521 + * Returns if there was any kind of collision along the trace ray.
1.522 + *
1.523 + * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.524 + * @return True if any collision found, otherwise false.
1.525 + * @error Invalid Handle.
1.526 + */
1.527 +native bool:TR_DidHit(Handle:hndl=INVALID_HANDLE);
1.528 +
1.529 +/**
1.530 + * Returns in which body hit group the trace collided if any.
1.531 + *
1.532 + * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.533 + * @return Body hit group.
1.534 + * @error Invalid Handle.
1.535 + */
1.536 +native TR_GetHitGroup(Handle:hndl=INVALID_HANDLE);
1.537 +
1.538 +/**
1.539 + * Find the normal vector to the collison plane of a trace.
1.540 + *
1.541 + * @param hndl A trace Handle, or INVALID_HANDLE to use a global trace result.
1.542 + * @param normal Vector buffer to store the vector normal to the collision plane
1.543 + * @noreturn
1.544 + * @error Invalid Handle
1.545 + */
1.546 +native TR_GetPlaneNormal(Handle:hndl, Float:normal[3]);
1.547 +