2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include "collision.h"
28 #define MOVE_NOMONSTERS 1
29 #define MOVE_MISSILE 2
30 #define MOVE_WORLDONLY 3
31 #define MOVE_HITMODEL 4
34 #define AREA_GRIDNODES (AREA_GRID * AREA_GRID)
39 struct link_s *prev, *next;
42 typedef struct world_s
45 char filename[MAX_QPATH];
49 int areagrid_stats_calls;
50 int areagrid_stats_nodechecks;
51 int areagrid_stats_entitychecks;
53 link_t areagrid[AREA_GRIDNODES];
54 link_t areagrid_outside;
56 vec3_t areagrid_scale;
60 int areagrid_marknumber;
66 // cyclic doubly-linked list functions
67 void World_ClearLink(link_t *l);
68 void World_RemoveLink(link_t *l);
69 void World_InsertLinkBefore(link_t *l, link_t *before, int entitynumber);
71 void World_Init(void);
73 /// called after the world model has been loaded, before linking any entities
74 void World_SetSize(world_t *world, const char *filename, const vec3_t mins, const vec3_t maxs);
75 /// unlinks all entities (used before reallocation of edicts)
76 void World_UnlinkAll(world_t *world);
78 void World_PrintAreaStats(world_t *world, const char *worldname);
80 /// call before removing an entity, and before trying to move one,
81 /// so it doesn't clip against itself
82 void World_UnlinkEdict(struct prvm_edict_s *ent);
84 /// Needs to be called any time an entity changes origin, mins, maxs
85 void World_LinkEdict(world_t *world, struct prvm_edict_s *ent, const vec3_t mins, const vec3_t maxs);
87 /// \returns list of entities touching a box
88 int World_EntitiesInBox(world_t *world, const vec3_t mins, const vec3_t maxs, int maxlist, struct prvm_edict_s **list);