world.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. typedef struct areanode_s
  35. {
  36. int axis; // -1 = leaf node
  37. float dist;
  38. struct areanode_s *children[2];
  39. link_t trigger_edicts;
  40. link_t solid_edicts;
  41. } areanode_t;
  42. #define AREA_DEPTH 4
  43. #define AREA_NODES 32
  44. extern areanode_t sv_areanodes[AREA_NODES];
  45. void SV_ClearWorld (void);
  46. // called after the world model has been loaded, before linking any entities
  47. void SV_UnlinkEdict (edict_t *ent);
  48. // call before removing an entity, and before trying to move one,
  49. // so it doesn't clip against itself
  50. // flags ent->v.modified
  51. void SV_LinkEdict (edict_t *ent, qboolean touch_triggers);
  52. // Needs to be called any time an entity changes origin, mins, maxs, or solid
  53. // flags ent->v.modified
  54. // sets ent->v.absmin and ent->v.absmax
  55. // if touchtriggers, calls prog functions for the intersected triggers
  56. int SV_PointContents (vec3_t p);
  57. // returns the CONTENTS_* value from the world at the given point.
  58. // does not check any entities at all
  59. edict_t *SV_TestEntityPosition (edict_t *ent);
  60. trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict);
  61. // mins and maxs are reletive
  62. // if the entire move stays in a solid volume, trace.allsolid will be set
  63. // if the starting point is in a solid, it will be allowed to move out
  64. // to an open area
  65. // nomonsters is used for line of sight or edge testing, where mosnters
  66. // shouldn't be considered solid objects
  67. // passedict is explicitly excluded from clipping checks (normally NULL)
  68. edict_t *SV_TestPlayerPosition (edict_t *ent, vec3_t origin);