1 /* 2 ** p_trace.h 3 ** 4 **--------------------------------------------------------------------------- 5 ** Copyright 1998-2006 Randy Heit 6 ** All rights reserved. 7 ** 8 ** Redistribution and use in source and binary forms, with or without 9 ** modification, are permitted provided that the following conditions 10 ** are met: 11 ** 12 ** 1. Redistributions of source code must retain the above copyright 13 ** notice, this list of conditions and the following disclaimer. 14 ** 2. Redistributions in binary form must reproduce the above copyright 15 ** notice, this list of conditions and the following disclaimer in the 16 ** documentation and/or other materials provided with the distribution. 17 ** 3. The name of the author may not be used to endorse or promote products 18 ** derived from this software without specific prior written permission. 19 ** 20 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 **--------------------------------------------------------------------------- 31 ** 32 */ 33 34 #ifndef __P_TRACE_H__ 35 #define __P_TRACE_H__ 36 37 #include <stddef.h> 38 #include "actor.h" 39 #include "textures/textures.h" 40 41 struct sector_t; 42 struct line_t; 43 class AActor; 44 struct F3DFloor; 45 46 enum ETraceResult 47 { 48 TRACE_HitNone, 49 TRACE_HitFloor, 50 TRACE_HitCeiling, 51 TRACE_HitWall, 52 TRACE_HitActor 53 }; 54 55 enum 56 { 57 TIER_Middle, 58 TIER_Upper, 59 TIER_Lower, 60 TIER_FFloor, 61 }; 62 63 struct FTraceResults 64 { 65 sector_t *Sector; 66 FTextureID HitTexture; 67 fixed_t X, Y, Z; 68 fixed_t Distance; 69 fixed_t Fraction; 70 71 AActor *Actor; // valid if hit an actor 72 73 line_t *Line; // valid if hit a line 74 BYTE Side; 75 BYTE Tier; 76 ETraceResult HitType; 77 sector_t *CrossedWater; // For Boom-style, Transfer_Heights-based deep water 78 F3DFloor *Crossed3DWater; // For 3D floor-based deep water 79 F3DFloor *ffloor; 80 }; 81 82 enum 83 { 84 TRACE_NoSky = 1, // Hitting the sky returns TRACE_HitNone 85 TRACE_PCross = 2, // Trigger SPAC_PCROSS lines 86 TRACE_Impact = 4, // Trigger SPAC_IMPACT lines 87 }; 88 89 // return values from callback 90 enum ETraceStatus 91 { 92 TRACE_Stop, // stop the trace, returning this hit 93 TRACE_Continue, // continue the trace, returning this hit if there are none further along 94 TRACE_Skip, // continue the trace; do not return this hit 95 TRACE_Abort, // stop the trace, returning no hits 96 }; 97 98 bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector, 99 fixed_t vx, fixed_t vy, fixed_t vz, fixed_t maxDist, 100 ActorFlags ActorMask, DWORD WallMask, AActor *ignore, 101 FTraceResults &res, 102 DWORD traceFlags=0, 103 ETraceStatus (*callback)(FTraceResults &res, void *)=NULL, void *callbackdata=NULL); 104 105 #endif //__P_TRACE_H__ 106