UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sv_world.cpp
Go to the documentation of this file.
1 
6 /*
7 All original material Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 Original file from Quake 2 v3.21: quake2-2.31/server/sv_world.c
10 Copyright (C) 1997-2001 Id Software, Inc.
11 
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License
14 as published by the Free Software Foundation; either version 2
15 of the License, or (at your option) any later version.
16 
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 
21 See the GNU General Public License for more details.
22 
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 
27 */
28 
29 #include "../shared/moveclip.h"
30 #include "server.h"
31 #include "../common/qfiles.h"
32 
33 #define AREA_DEPTH 4
34 
40 static worldSector_t* SV_CreateWorldSector (int depth, const AABB& sBox)
41 {
43  Com_Error(ERR_DROP, "SV_CreateWorldSector: overflow");
44 
47 
48  anode->entities = nullptr;
49 
50  if (depth == AREA_DEPTH) {
51  anode->axis = LEAFNODE; /* end of tree */
52  anode->children[0] = anode->children[1] = nullptr;
53  return anode;
54  }
55 
56  vec3_t size;
57  sBox.getDiagonal(size);
58  if (size[0] > size[1])
59  anode->axis = PLANE_X;
60  else
61  anode->axis = PLANE_Y;
62 
63  anode->dist = 0.5f * (sBox.maxs[anode->axis] + sBox.mins[anode->axis]);
64  AABB sBox1(sBox);
65  AABB sBox2(sBox);
66 
67  sBox1.maxs[anode->axis] = sBox2.mins[anode->axis] = anode->dist;
68 
69  anode->children[0] = SV_CreateWorldSector(depth + 1, sBox2);
70  anode->children[1] = SV_CreateWorldSector(depth + 1, sBox1);
71 
72  return anode;
73 }
74 
81 void SV_ClearWorld (void)
82 {
84 }
85 
86 static inline sv_edict_t* SV_GetServerDataForEdict (const edict_t* ent)
87 {
88  if (!ent || ent->number < 0 || ent->number >= lengthof(sv->edicts))
89  Com_Error(ERR_DROP, "SV_GetServerDataForEdict: bad game ent");
90 
91  return &sv->edicts[ent->number];
92 }
93 
98 {
99  sv_edict_t* sv_ent = SV_GetServerDataForEdict(ent);
100  sv_edict_t* scan;
101  worldSector_t* ws;
102 
103  sv_ent->linked = false;
104 
105  ws = sv_ent->worldSector;
106  if (!ws)
107  return; /* not linked in anywhere */
108 
109  sv_ent->worldSector = nullptr;
110 
111  if (ws->entities == sv_ent) {
112  ws->entities = sv_ent->nextEntityInWorldSector;
113  return;
114  }
115 
116  for (scan = ws->entities; scan; scan = scan->nextEntityInWorldSector) {
117  if (scan->nextEntityInWorldSector == sv_ent) {
119  return;
120  }
121  }
122 
123  Com_Printf("WARNING: SV_UnlinkEntity: not found in worldSector\n");
124 }
125 
132 {
133  worldSector_t* node;
134  sv_edict_t* sv_ent = SV_GetServerDataForEdict(ent);
135 
136  if (sv_ent->worldSector)
137  SV_UnlinkEdict(ent); /* unlink from old position */
138 
139  if (ent == svs.ge->edicts)
140  return; /* don't add the world */
141 
142  if (!ent->inuse)
143  return;
144 
145  /* set the size */
146  ent->entBox.getDiagonal(ent->size);
147 
148  /* increase the linkcount - even for none solids */
149  ent->linkcount++;
150 
151  CalculateMinsMaxs(ent->solid == SOLID_BSP ? ent->angles : vec3_origin, ent->entBox, ent->origin, ent->absBox);
152 
153  /* if not solid we have to set the abs mins/maxs above but don't really link it */
154  if (ent->solid == SOLID_NOT)
155  return;
156 
157  /* find the first node that the ent's box crosses */
158  node = sv->worldSectors;
159  while (1) {
160  /* end of tree */
161  if (node->axis == LEAFNODE)
162  break;
163  if (ent->absBox.mins[node->axis] > node->dist)
164  node = node->children[0];
165  else if (ent->absBox.maxs[node->axis] < node->dist)
166  node = node->children[1];
167  else
168  break; /* crosses the node */
169  }
170 
171  /* link it in */
172  sv_ent->nextEntityInWorldSector = node->entities;
173  node->entities = sv_ent;
174 
175  sv_ent->linked = true;
176  sv_ent->worldSector = node;
177  sv_ent->ent = ent;
178 
179  /* If this ent has a child, link it back in, too */
180  if (ent->child()) {
181  ent->child()->entBox.set(ent->absBox);
182 
183  /* expand the trigger box */
184  ent->child()->entBox.expandXY(UNIT_SIZE / 2);
185  /* link child back into the world */
186  SV_LinkEdict(ent->child());
187  }
188 }
189 
196 static bool SV_BoundingBoxesIntersect (const AABB& aabb, const edict_t* ent)
197 {
198  return aabb.doesIntersect(ent->absBox);
199 }
200 
201 typedef struct {
204  int areaEdictListCount, areaEdictListMaxCount;
205 } areaParms_t;
206 
213 static void SV_AreaEdicts_r (worldSector_t* node, areaParms_t* ap)
214 {
215  sv_edict_t* check, *next;
216 
217  for (check = node->entities; check; check = next) {
218  next = check->nextEntityInWorldSector;
219 
220  /* deactivated */
221  if (check->ent->solid == SOLID_NOT)
222  continue;
223 
224  if (!check->ent->inuse)
225  continue;
226 
227  if (!SV_BoundingBoxesIntersect(ap->areaBox, check->ent))
228  continue; /* not touching */
229 
230  if (ap->areaEdictListCount == ap->areaEdictListMaxCount) {
231  Com_Printf("SV_AreaEdicts_r: MAXCOUNT\n");
232  return;
233  }
234 
235  ap->areaEdictList[ap->areaEdictListCount] = check->ent;
236  ap->areaEdictListCount++;
237  }
238 
239  if (node->axis == LEAFNODE)
240  return; /* terminal node - end of tree */
241 
242  /* recurse down both sides */
243  if (ap->areaBox.maxs[node->axis] > node->dist)
244  SV_AreaEdicts_r(node->children[0], ap);
245  if (ap->areaBox.mins[node->axis] < node->dist)
246  SV_AreaEdicts_r(node->children[1], ap);
247 }
248 
256 static int SV_AreaEdicts (const AABB& abox, edict_t** list, int maxCount)
257 {
258  areaParms_t ap;
259 
260  ap.areaBox.set(abox);
261  ap.areaEdictList = list;
262  ap.areaEdictListCount = 0;
263  ap.areaEdictListMaxCount = maxCount;
264 
266 
267  return ap.areaEdictListCount;
268 }
269 
271 class MoveClipSV : public MoveClip
272 {
273 public:
276 };
277 
278 
290 static int SV_HullForEntity (const edict_t* ent, int* tile, vec3_t rmaShift)
291 {
292  assert(ent->solid != SOLID_NOT);
293  assert(ent->solid != SOLID_TRIGGER);
294 
295  /* decide which clipping hull to use, based on the size */
296  if (ent->solid == SOLID_BSP) { /* explicit hulls in the BSP model */
297  const cBspModel_t* model;
298 
299  assert(ent->modelindex < MAX_MODELS);
300 
301  model = sv->models[ent->modelindex];
302  if (!model)
303  Com_Error(ERR_FATAL, "SOLID_BSP with a non bsp model");
304 
305  *tile = model->tile;
306  VectorCopy(model->shift, rmaShift);
307  assert(model->headnode < MAX_MAP_NODES);
308  return model->headnode;
309  }
310 
311  /* create a temp hull from bounding box sizes */
312  *tile = 0;
313  VectorCopy(vec3_origin, rmaShift);
314  return CM_HeadnodeForBox(sv->mapTiles.mapTiles[*tile], ent->entBox);
315 }
316 
317 
324 {
325  edict_t* touchlist[MAX_EDICTS];
326  const int num = SV_AreaEdicts(clip->clipBox, touchlist, MAX_EDICTS);
327 
328  /* be careful, it is possible to have an entity in this
329  * list removed before we get to it (killtriggered) */
330  for (int i = 0; i < num; i++) {
331  vec3_t rmaShift;
332  edict_t* touch = touchlist[i];
333  int tile = 0;
334 
335  if (touch->solid == SOLID_NOT || touch->solid == SOLID_TRIGGER)
336  continue;
337  if (touch == clip->passedict)
338  continue;
339 
340  if (clip->trace.allsolid)
341  return;
342 
343  if (clip->passedict) {
344  if (touch->isParentship(clip->passedict)) /* check if one of them is the owner of the other */
345  continue; /* don't clip against own missiles or owner */
346  }
347 
348  /* might intersect, so do an exact clip */
349  int headnode = SV_HullForEntity(touch, &tile, rmaShift);
350  if (headnode >= MAX_MAP_NODES)
351  continue;
352 
353  const float* angles;
354  if (touch->solid != SOLID_BSP)
355  angles = vec3_origin; /* boxes don't rotate */
356  else
357  angles = touch->angles;
358 
359  assert(headnode < MAX_MAP_NODES);
360  trace_t trace = CM_HintedTransformedBoxTrace(sv->mapTiles.mapTiles[tile], clip->moveLine, clip->objBox, headnode,
361  clip->contentmask, 0, touch->origin, angles, rmaShift, 1.0);
362 
363 #ifdef PARANOID
364  Com_DPrintf(DEBUG_SERVER, "SV_ClipMoveToEntities: %i %i: (%i %i %i) (%i %i %i) (%i %i %i)\n", touch->number, touch->modelindex,
365  (int)touch->entBox.mins[0], (int)touch->entBox.mins[1], (int)touch->entBox.mins[2],
366  (int)touch->entBox.maxs[0], (int)touch->entBox.maxs[1], (int)touch->entBox.maxs[2],
367  (int)touch->origin[0], (int)touch->origin[1], (int)touch->origin[2]);
368 #endif
369 
370  if (trace.fraction < clip->trace.fraction) {
371  bool oldStart;
372 
373  /* make sure we keep a startsolid from a previous trace */
374  oldStart = clip->trace.startsolid;
375  trace.entNum = touch->number;
376  clip->trace = trace;
377  clip->trace.startsolid |= oldStart;
378  } else if (trace.allsolid) {
379  trace.entNum = touch->number;
380  clip->trace = trace;
381  } else if (trace.startsolid) {
382  trace.entNum = touch->number;
383  clip->trace.startsolid = true;
384  }
385  }
386 }
387 
396 {
397  /* clip to all world levels */
399  if (trace.fraction == 0)
400  return trace.contentFlags; /* blocked by the world */
401  return 0;
402 }
403 
417 trace_t SV_Trace (const Line& traceLine, const AABB& box, const edict_t* passedict, int contentmask)
418 {
419  MoveClipSV clip;
420 
421  OBJZERO(clip);
422 
423  /* clip to world - 0x1FF = all levels */
424  clip.trace = CM_CompleteBoxTrace(&sv->mapTiles, traceLine, box, TRACE_ALL_LEVELS, contentmask, 0);
427  clip.trace.entNum = 0; /* the first edict is the world */
428  if (clip.trace.fraction == 0)
429  return clip.trace; /* blocked by the world */
430 
431  clip.contentmask = contentmask;
432  clip.moveLine.set(traceLine);
433  clip.objBox.set(box);
434  clip.passedict = passedict;
435 
436  /* create the bounding box for the entire path traveled by the shot */
437  clip.calcBounds();
438 
439  /* clip to other solid entities */
440  SV_ClipMoveToEntities(&clip);
441 
442  return clip.trace;
443 }
444 
451 const char* SV_GetFootstepSound (const char* texture)
452 {
453  const terrainType_t* t = Com_GetTerrainType(texture);
454  return t ? t->footstepSound : nullptr;
455 }
456 
462 float SV_GetBounceFraction (const char* texture)
463 {
464  const terrainType_t* t = Com_GetTerrainType(texture);
465  return t ? t->bounceFraction : 1.0f;
466 }
467 
473 static void SV_ModLoadAliasMD2Model (sv_model_t* mod, const byte* buffer)
474 {
475  const dMD2Model_t* md2 = (const dMD2Model_t*)buffer;
476  const int num_frames = LittleLong(md2->num_frames);
477  const int frameSize = LittleLong(md2->framesize);
478  const dMD2Frame_t* frame = (const dMD2Frame_t*) ((const byte*) md2 + LittleLong(md2->ofs_frames) + mod->frame * frameSize);
479  vec3_t scale, mins, maxs;
480 
481  if (mod->frame > num_frames)
482  return;
483 
484  for (int j = 0; j < 3; j++) {
485  scale[j] = LittleFloat(frame->scale[j]);
486  mins[j] = LittleFloat(frame->translate[j]);
487  }
488 
489  VectorMA(mins, 255, scale, maxs);
490  mod->aabb.add(mins);
491  mod->aabb.add(maxs);
492 }
493 
499 static void SV_ModLoadAliasMD3Model (sv_model_t* mod, const byte* buffer)
500 {
501  const dmd3_t* md3 = (const dmd3_t*)buffer;
502  const dmd3frame_t* frame = (const dmd3frame_t*)((const byte*)md3 + LittleLong(md3->ofs_frames));
503  const int num_frames = LittleLong(md3->num_frames);
504  vec3_t mins, maxs;
505 
506  if (mod->frame > num_frames)
507  return;
508 
509  frame += mod->frame;
510  for (int j = 0; j < 3; j++) {
511  mins[j] = LittleFloat(frame->mins[j]);
512  maxs[j] = LittleFloat(frame->maxs[j]);
513  }
514  mod->aabb.add(mins);
515  mod->aabb.add(maxs);
516 }
517 
524 static void SV_ModLoadObjModel (sv_model_t* mod, const byte* buffer, int bufferLength)
525 {
527 }
528 
533 static char const* const mod_extensions[] = {
534  "md2", "md3", "obj", nullptr
535 };
536 
543 bool SV_LoadModelAABB (const char* model, int frame, AABB& aabb)
544 {
545  sv_model_t* mod;
546  byte* buf = nullptr;
547  unsigned int i;
548  int modfilelen = 0;
549 
550  if (model[0] == '\0')
551  Com_Error(ERR_DROP, "SV_LoadModelAABB: nullptr model");
552 
553  /* search the currently loaded models */
554  for (i = 0, mod = sv->svModels; i < sv->numSVModels; i++, mod++)
555  if (mod->frame == frame && Q_streq(mod->name, model)) {
556  aabb.set(mod->aabb);
557  return true;
558  }
559 
560  /* find a free model slot spot */
561  for (i = 0, mod = sv->svModels; i < sv->numSVModels; i++, mod++) {
562  if (!mod->name)
563  break; /* free spot */
564  }
565 
566  if (i == sv->numSVModels) {
567  if (sv->numSVModels == MAX_MOD_KNOWN)
568  Com_Error(ERR_DROP, "sv->numSVModels == MAX_MOD_KNOWN");
569  sv->numSVModels++;
570  }
571 
572  aabb.reset();
573 
574  /* load the file */
575  if (Com_GetExtension(model) == nullptr) {
576  char filename[MAX_QPATH];
577 
578  for (i = 0; mod_extensions[i] != nullptr; i++) {
579  Com_sprintf(filename, sizeof(filename), "%s.%s", model, mod_extensions[i]);
580  modfilelen = FS_LoadFile(filename, &buf);
581  if (buf) {
582  break;
583  }
584  }
585  } else {
586  modfilelen = FS_LoadFile(model, &buf);
587  }
588 
589  if (!buf) {
590  sv->numSVModels--;
591  return false;
592  }
593 
594  OBJZERO(*mod);
595  mod->name = Mem_PoolStrDup(model, com_genericPool, 0);
596  mod->frame = frame;
597  mod->aabb.setNegativeVolume();
598 
599  /* call the appropriate loader */
600  switch (LittleLong(*(unsigned* ) buf)) {
601  case IDALIASHEADER:
602  SV_ModLoadAliasMD2Model(mod, buf);
603  break;
604 
605  case IDMD3HEADER:
606  SV_ModLoadAliasMD3Model(mod, buf);
607  break;
608 
609  default:
610  if (!Q_strcasecmp(mod->name + strlen(mod->name) - 4, ".obj"))
611  SV_ModLoadObjModel(mod, buf, modfilelen);
612  else {
613  FS_FreeFile(buf);
614  return false;
615  }
616  break;
617  }
618 
619  aabb.set(mod->aabb); /* to return the found values */
620 
621  FS_FreeFile(buf);
622  return true;
623 }
sv_model_t svModels[MAX_MOD_KNOWN]
Definition: server.h:128
#define LEAFNODE
Definition: defines.h:44
void CalculateMinsMaxs(const vec3_t angles, const AABB &relBox, const vec3_t origin, AABB &absBox)
Calculates the bounding box in absolute coordinates, also for rotating objects. WARNING: do not use t...
Definition: mathlib.cpp:546
#define VectorCopy(src, dest)
Definition: vector.h:51
edict_t * ent
Definition: server.h:43
AABB clipBox
Definition: moveclip.h:36
#define IDALIASHEADER
Definition: qfiles.h:40
Definition: qfiles.h:227
void setNegativeVolume()
Sets mins and maxs to their starting points before using addPoint.
Definition: aabb.h:98
void set(const Line &other)
Copies the values from the given Line.
Definition: line.h:47
bool isParentship(const SrvEdict *other) const
Definition: srvedict.h:69
int contentmask
Definition: moveclip.h:39
void VectorMA(const vec3_t veca, const float scale, const vec3_t vecb, vec3_t outVector)
Sets vector_out (vc) to vevtor1 (va) + scale * vector2 (vb)
Definition: mathlib.cpp:261
static void SV_ClipMoveToEntities(MoveClipSV *clip)
Definition: sv_world.cpp:323
#define DEBUG_SERVER
Definition: defines.h:60
int frame
Definition: server.h:49
const char * Com_GetExtension(const char *path)
Definition: shared.cpp:282
is a variable sized structure, however all frame_t structures within the same file will have the same...
Definition: qfiles.h:90
float dist
Definition: server.h:59
void SV_ClearWorld(void)
Clear physics interaction links.
Definition: sv_world.cpp:81
bool SV_LoadModelAABB(const char *model, int frame, AABB &aabb)
Load the bounding box for the model on the serverside for pathfinding and clipping.
Definition: sv_world.cpp:543
const terrainType_t * Com_GetTerrainType(const char *textureName)
Searches the terrain definition if given.
Definition: scripts.cpp:3089
static const vec3_t scale
vec3_t origin
Definition: srvedict.h:42
bool inuse
Definition: srvedict.h:36
struct worldSector_s * worldSector
Definition: server.h:40
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
Definition: shared.cpp:494
bool doesIntersect(const AABB &other) const
Checks if the aabb touches or intersects with the given aabb.
Definition: aabb.h:183
#define TRACE_ALL_LEVELS
Definition: tracing.h:52
bool linked
Definition: server.h:42
Definition: aabb.h:42
static int SV_HullForEntity(const edict_t *ent, int *tile, vec3_t rmaShift)
Returns a headnode that can be used for testing or clipping an object of mins/maxs size...
Definition: sv_world.cpp:290
const char * filename
Definition: ioapi.h:41
const vec3_t vec3_origin
Definition: mathlib.cpp:35
void SV_UnlinkEdict(edict_t *ent)
call before removing an entity, and before trying to move one, so it doesn't clip against itself ...
Definition: sv_world.cpp:97
SrvEdict * child()
Definition: srvedict.h:58
edict_t ** areaEdictList
Definition: sv_world.cpp:203
uint32_t num_frames
Definition: qfiles.h:235
int FS_LoadFile(const char *path, byte **buffer)
Filenames are relative to the quake search path.
Definition: files.cpp:384
int linkcount
Definition: srvedict.h:37
void set(const AABB &other)
Copies the values from the given aabb.
Definition: aabb.h:60
float maxs[3]
Definition: qfiles.h:186
void Com_Printf(const char *const fmt,...)
Definition: common.cpp:386
float translate[3]
Definition: qfiles.h:92
struct cBspModel_s * models[MAX_MODELS]
Definition: server.h:111
float SV_GetBounceFraction(const char *texture)
Different terrain types might have different bounce fraction.
Definition: sv_world.cpp:462
sv_edict_t * entities
Definition: server.h:61
#define AREA_DEPTH
Definition: sv_world.cpp:33
vec3_t maxs
Definition: aabb.h:258
#define MASK_ALL
Definition: defines.h:271
The bounding box of a moving object.
Definition: moveclip.h:33
voidpf void * buf
Definition: ioapi.h:42
#define ERR_FATAL
Definition: common.h:210
void getDiagonal(vec3_t diagonal) const
Definition: aabb.h:159
int tile
Definition: typedefs.h:31
float mins[3]
Definition: qfiles.h:185
float fraction
Definition: tracing.h:58
void Com_Error(int code, const char *fmt,...)
Definition: common.cpp:417
vec3_t shift
Definition: typedefs.h:28
vec3_t angles
Definition: srvedict.h:43
trace_t CM_HintedTransformedBoxTrace(MapTile &tile, const Line &traceLine, const AABB &traceBox, const int headnode, const int contentmask, const int brushrejects, const vec3_t origin, const vec3_t angles, const vec3_t rmaShift, const float fraction)
Handles offseting and rotation of the end points for moving and rotating entities.
Definition: cmodel.cpp:84
uint32_t framesize
Definition: qfiles.h:119
AABB objBox
Definition: moveclip.h:37
serverInstanceGame_t * sv
Definition: sv_init.cpp:36
const char * SV_GetFootstepSound(const char *texture)
Query the footstep sound for the given surface texture.
Definition: sv_world.cpp:451
unsigned int numSVModels
Definition: server.h:129
void add(const vec3_t point)
If the point is outside the box, expand the box to accommodate it.
Definition: aabb.cpp:57
#define ERR_DROP
Definition: common.h:211
#define MAX_MOD_KNOWN
Definition: defines.h:160
solid_t solid
Definition: srvedict.h:46
GLsizei size
Definition: r_gl.h:152
#define IDMD3HEADER
Definition: qfiles.h:159
void calcBounds()
Create the bounding box for the entire move.
Definition: moveclip.h:48
#define OBJZERO(obj)
Definition: shared.h:178
struct worldSector_s * children[2]
Definition: server.h:60
int32_t CM_HeadnodeForBox(MapTile &tile, const AABB &box)
To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being c...
Definition: cmodel.cpp:151
AABB absBox
Definition: srvedict.h:49
memPool_t * com_genericPool
Definition: common.cpp:73
char * name
Definition: server.h:50
Main server include file.
Line moveLine
Definition: moveclip.h:38
float scale[3]
Definition: qfiles.h:91
mapData_t mapData
Definition: server.h:124
int areaEdictListCount
Definition: sv_world.cpp:204
uint32_t ofs_frames
Definition: qfiles.h:240
Definition: line.h:31
vec3_t size
Definition: srvedict.h:50
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
Definition: common.cpp:398
#define Q_strcasecmp(a, b)
Definition: shared.h:131
AABB areaBox
Definition: sv_world.cpp:202
uint32_t num_frames
Definition: qfiles.h:126
struct sv_edict_s * nextEntityInWorldSector
Definition: server.h:41
int SV_PointContents(const vec3_t p)
Returns the content flags for a given point.
Definition: sv_world.cpp:395
uint32_t ofs_frames
Definition: qfiles.h:131
void expandXY(const float byVal)
expand the box in four directions, but clip them to the maximum boundaries
Definition: aabb.h:232
static void SV_ModLoadObjModel(sv_model_t *mod, const byte *buffer, int bufferLength)
Loads the mins/maxs for a obj mesh model.
Definition: sv_world.cpp:524
#define UNIT_SIZE
Definition: defines.h:121
AABB entBox
Definition: srvedict.h:48
#define MAX_MODELS
Definition: defines.h:100
int axis
Definition: server.h:58
const edict_t * passedict
Definition: sv_world.cpp:275
mapTiles_t mapTiles
Definition: server.h:126
trace_t SV_Trace(const Line &traceLine, const AABB &box, const edict_t *passedict, int contentmask)
Moves the given mins/maxs volume through the world from start to end.
Definition: sv_world.cpp:417
static worldSector_t * SV_CreateWorldSector(int depth, const AABB &sBox)
Builds a uniformly subdivided tree for the given world size.
Definition: sv_world.cpp:40
the glcmd format: a positive integer starts a tristrip command, followed by that many vertex structur...
Definition: qfiles.h:109
TR_TILE_TYPE mapTiles[MAX_MAPTILES]
Definition: tracing.h:79
int areaEdictListMaxCount
Definition: sv_world.cpp:204
#define MAX_QPATH
Definition: filesys.h:40
QGL_EXTERN GLint i
Definition: r_gl.h:113
int number
Definition: srvedict.h:40
static bool SV_BoundingBoxesIntersect(const AABB &aabb, const edict_t *ent)
Checks whether the bounding box of the given edict will intersect with the given bbox.
Definition: sv_world.cpp:196
static void SV_AreaEdicts_r(worldSector_t *node, areaParms_t *ap)
fills in a table of edict pointers with edicts that have bounding boxes that intersect the given area...
Definition: sv_world.cpp:213
sv_edict_t edicts[MAX_EDICTS]
Definition: server.h:130
AABB aabb
Definition: server.h:48
unsigned int numWorldSectors
Definition: server.h:132
To avoid linearly searching through lists of entities during environment testing, the world is carved...
Definition: server.h:57
bool startsolid
Definition: tracing.h:57
vec_t vec3_t[3]
Definition: ufotypes.h:39
worldSector_t worldSectors[AREA_NODES]
Definition: server.h:131
uint32_t contentFlags
Definition: tracing.h:63
static void SV_ModLoadAliasMD2Model(sv_model_t *mod, const byte *buffer)
Loads the mins/maxs for a md2 mesh model.
Definition: sv_world.cpp:473
int32_t headnode
Definition: typedefs.h:29
vec3_t mins
Definition: aabb.h:257
AABB mapBox
Definition: typedefs.h:351
#define lengthof(x)
Definition: shared.h:105
Different terrain definitions for footsteps and particles.
Definition: scripts.h:216
const char * footstepSound
Definition: scripts.h:218
trace_t trace
Definition: sv_world.cpp:274
#define Q_streq(a, b)
Definition: shared.h:136
#define Mem_PoolStrDup(in, pool, tagNum)
Definition: mem.h:50
static void SV_ModLoadAliasMD3Model(sv_model_t *mod, const byte *buffer)
Loads the mins/maxs for a md3 mesh model.
Definition: sv_world.cpp:499
static const AABB EMPTY
Definition: aabb.h:44
bool allsolid
Definition: tracing.h:56
int modelindex
Definition: srvedict.h:54
static sv_edict_t * SV_GetServerDataForEdict(const edict_t *ent)
Definition: sv_world.cpp:86
static int SV_AreaEdicts(const AABB &abox, edict_t **list, int maxCount)
Definition: sv_world.cpp:256
#define PLANE_Y
Definition: defines.h:192
uint8_t byte
Definition: ufotypes.h:34
static mesh models (none-animated) can have a server side flag set to be clipped for pathfinding ...
Definition: server.h:47
void SV_LinkEdict(edict_t *ent)
Needs to be called any time an entity changes origin, mins, maxs, or solid. Automatically unlinks if ...
Definition: sv_world.cpp:131
serverInstanceStatic_t svs
Definition: sv_init.cpp:35
void reset()
Definition: aabb.h:83
#define PLANE_X
Definition: defines.h:191
trace_t CM_CompleteBoxTrace(mapTiles_t *mapTiles, const Line &trLine, const AABB &box, int levelmask, int brushmask, int brushreject)
Traces all submodels in all tiles. Used by ufo and ufo_ded.
Definition: cmodel.cpp:283
int entNum
Definition: tracing.h:67
edict_t * edicts
Definition: game.h:360
#define LittleFloat(X)
Definition: byte.h:57
Server side moveclip - see cmodel.c.
Definition: sv_world.cpp:271
void FS_FreeFile(void *buffer)
Definition: files.cpp:411
#define LittleLong(X)
Definition: byte.h:37
float bounceFraction
Definition: scripts.h:220
static char const *const mod_extensions[]
all supported model formats
Definition: sv_world.cpp:533
#define MAX_EDICTS
Definition: defines.h:99
game_export_t * ge
Definition: server.h:92
#define MAX_MAP_NODES
Definition: defines.h:140