world.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. // world.h
  16. typedef struct
  17. {
  18. vec3_t normal;
  19. float dist;
  20. } plane_t;
  21. typedef struct
  22. {
  23. qboolean allsolid; // if true, plane is not valid
  24. qboolean startsolid; // if true, the initial point was in a solid area
  25. qboolean inopen, inwater;
  26. float fraction; // time completed, 1.0 = didn't hit anything
  27. vec3_t endpos; // final position
  28. plane_t plane; // surface normal at impact
  29. edict_t *ent; // entity the surface is on
  30. } trace_t;
  31. #define MOVE_NORMAL 0
  32. #define MOVE_NOMONSTERS 1
  33. #define MOVE_MISSILE 2
  34. void SV_ClearWorld (void);
  35. // called after the world model has been loaded, before linking any entities
  36. void SV_UnlinkEdict (edict_t *ent);
  37. // call before removing an entity, and before trying to move one,
  38. // so it doesn't clip against itself
  39. // flags ent->v.modified
  40. void SV_LinkEdict (edict_t *ent, qboolean touch_triggers);
  41. // Needs to be called any time an entity changes origin, mins, maxs, or solid
  42. // flags ent->v.modified
  43. // sets ent->v.absmin and ent->v.absmax
  44. // if touchtriggers, calls prog functions for the intersected triggers
  45. int SV_PointContents (vec3_t p);
  46. int SV_TruePointContents (vec3_t p);
  47. // returns the CONTENTS_* value from the world at the given point.
  48. // does not check any entities at all
  49. // the non-true version remaps the water current contents to content_water
  50. edict_t *SV_TestEntityPosition (edict_t *ent);
  51. trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict);
  52. // mins and maxs are reletive
  53. // if the entire move stays in a solid volume, trace.allsolid will be set
  54. // if the starting point is in a solid, it will be allowed to move out
  55. // to an open area
  56. // nomonsters is used for line of sight or edge testing, where mosnters
  57. // shouldn't be considered solid objects
  58. // passedict is explicitly excluded from clipping checks (normally NULL)