DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
world.h File Reference
#include "qtypes.h"
#include "collision.h"
+ Include dependency graph for world.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  link_t
 
struct  world_physics_t
 
struct  world_t
 

Macros

#define AREA_GRID   128
 
#define AREA_GRIDNODES   (AREA_GRID * AREA_GRID)
 
#define MOVE_HITMODEL   4
 
#define MOVE_MISSILE   2
 
#define MOVE_NOMONSTERS   1
 
#define MOVE_NORMAL   0
 
#define MOVE_WORLDONLY   3
 

Functions

void World_ClearLink (link_t *l)
 World_ClearLink is used for new headnodes.
 
void World_End (world_t *world)
 
int World_EntitiesInBox (world_t *world, const vec3_t mins, const vec3_t maxs, int maxlist, struct prvm_edict_s **list)
 
void World_Init (void)
 
void World_InsertLinkBefore (link_t *l, link_t *before, int entitynumber)
 
void World_LinkEdict (world_t *world, struct prvm_edict_s *ent, const vec3_t mins, const vec3_t maxs, qbool link_solid_not)
 Needs to be called any time an entity changes origin, mins, maxs.
 
void World_Physics_ApplyCmd (struct prvm_edict_s *ed, struct edict_odefunc_s *f)
 
void World_Physics_Frame (world_t *world, double frametime, double gravity)
 
void World_Physics_RemoveFromEntity (world_t *world, struct prvm_edict_s *ed)
 
void World_Physics_RemoveJointFromEntity (world_t *world, struct prvm_edict_s *ed)
 
void World_PrintAreaStats (world_t *world, const char *worldname)
 
void World_RemoveLink (link_t *l)
 
void World_SetSize (world_t *world, const char *filename, const vec3_t mins, const vec3_t maxs, struct prvm_prog_s *prog)
 called after the world model has been loaded, before linking any entities
 
void World_Shutdown (void)
 
void World_Start (world_t *world)
 
void World_UnlinkAll (world_t *world)
 unlinks all entities (used before reallocation of edicts)
 
void World_UnlinkEdict (struct prvm_edict_s *ent)
 call before removing an entity, and before trying to move one, so it doesn't clip against itself
 

Macro Definition Documentation

◆ AREA_GRID

#define AREA_GRID   128

Definition at line 34 of file world.h.

Referenced by World_EntitiesInBox(), World_LinkEdict_AreaGrid(), and World_SetSize().

◆ AREA_GRIDNODES

#define AREA_GRIDNODES   (AREA_GRID * AREA_GRID)

Definition at line 35 of file world.h.

Referenced by World_SetSize(), and World_UnlinkAll().

◆ MOVE_HITMODEL

◆ MOVE_MISSILE

#define MOVE_MISSILE   2

◆ MOVE_NOMONSTERS

◆ MOVE_NORMAL

◆ MOVE_WORLDONLY

Function Documentation

◆ World_ClearLink()

void World_ClearLink ( link_t * l)

World_ClearLink is used for new headnodes.

Definition at line 79 of file world.c.

80{
81 l->entitynumber = 0;
82 l->list.prev = l->list.next = &l->list;
83}
struct llist_s * prev
Definition com_list.h:32
struct llist_s * next
Definition com_list.h:33

References link_t::entitynumber, link_t::list, llist_t::next, and llist_t::prev.

Referenced by World_SetSize().

◆ World_End()

void World_End ( world_t * world)

Definition at line 69 of file world.c.

70{
71#ifdef USEODE
72 World_Physics_End(world);
73#endif
74}
entity world

References world.

Referenced by CLVM_reset_cmd(), and SVVM_reset_cmd().

◆ World_EntitiesInBox()

int World_EntitiesInBox ( world_t * world,
const vec3_t mins,
const vec3_t maxs,
int maxlist,
struct prvm_edict_s ** list )
Returns
list of entities touching a box

◆ World_Init()

void World_Init ( void )

Definition at line 38 of file world.c.

39{
41#ifdef USEODE
42 World_Physics_Init();
43#endif
44}
void Collision_Init(void)
Definition collision.c:25

References Collision_Init().

Referenced by Host_Init().

◆ World_InsertLinkBefore()

void World_InsertLinkBefore ( link_t * l,
link_t * before,
int entitynumber )

Definition at line 90 of file world.c.

91{
92 l->entitynumber = entitynumber;
93 List_Add_Tail(&l->list, &before->list);
94}
static void List_Add_Tail(llist_t *node, llist_t *head)
Definition com_list.h:249

References link_t::entitynumber, link_t::list, and List_Add_Tail().

Referenced by World_LinkEdict_AreaGrid().

◆ World_LinkEdict()

void World_LinkEdict ( world_t * world,
struct prvm_edict_s * ent,
const vec3_t mins,
const vec3_t maxs,
qbool link_solid_not )

Needs to be called any time an entity changes origin, mins, maxs.

◆ World_Physics_ApplyCmd()

void World_Physics_ApplyCmd ( struct prvm_edict_s * ed,
struct edict_odefunc_s * f )

◆ World_Physics_Frame()

void World_Physics_Frame ( world_t * world,
double frametime,
double gravity )

◆ World_Physics_RemoveFromEntity()

void World_Physics_RemoveFromEntity ( world_t * world,
struct prvm_edict_s * ed )

Referenced by CLVM_free_edict(), and SVVM_free_edict().

◆ World_Physics_RemoveJointFromEntity()

void World_Physics_RemoveJointFromEntity ( world_t * world,
struct prvm_edict_s * ed )

Referenced by CLVM_free_edict(), and SVVM_free_edict().

◆ World_PrintAreaStats()

void World_PrintAreaStats ( world_t * world,
const char * worldname )

Definition at line 104 of file world.c.

105{
106 Con_Printf("%s areagrid check stats: %d calls %d nodes (%f per call) %d entities (%f per call)\n", worldname, world->areagrid_stats_calls, world->areagrid_stats_nodechecks, (double) world->areagrid_stats_nodechecks / (double) world->areagrid_stats_calls, world->areagrid_stats_entitychecks, (double) world->areagrid_stats_entitychecks / (double) world->areagrid_stats_calls);
107 world->areagrid_stats_calls = 0;
108 world->areagrid_stats_nodechecks = 0;
109 world->areagrid_stats_entitychecks = 0;
110}
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
Definition console.c:1514

References Con_Printf(), and world.

Referenced by CL_AreaStats_f(), and SV_AreaStats_f().

◆ World_RemoveLink()

void World_RemoveLink ( link_t * l)

Definition at line 85 of file world.c.

86{
87 List_Delete(&l->list);
88}
static void List_Delete(llist_t *node)
Definition com_list.h:274

References link_t::list, and List_Delete().

Referenced by World_UnlinkEdict().

◆ World_SetSize()

void World_SetSize ( world_t * world,
const char * filename,
const vec3_t mins,
const vec3_t maxs,
struct prvm_prog_s * prog )

called after the world model has been loaded, before linking any entities

◆ World_Shutdown()

void World_Shutdown ( void )

Definition at line 49 of file world.c.

50{
51#ifdef USEODE
52 World_Physics_Shutdown();
53#endif
54}

◆ World_Start()

void World_Start ( world_t * world)

Definition at line 59 of file world.c.

60{
61#ifdef USEODE
62 World_Physics_Start(world);
63#endif
64}

References world.

Referenced by CL_SetupWorldModel(), and SV_SpawnServer().

◆ World_UnlinkAll()

void World_UnlinkAll ( world_t * world)

unlinks all entities (used before reallocation of edicts)

Definition at line 159 of file world.c.

160{
161 prvm_prog_t *prog = world->prog;
162 int i;
163 link_t *grid;
164 // unlink all entities one by one
165 grid = &world->areagrid_outside;
166 while (grid->list.next != &grid->list)
167 World_UnlinkEdict(PRVM_EDICT_NUM(List_Entry(grid->list.next, link_t, list)->entitynumber));
168 for (i = 0, grid = world->areagrid;i < AREA_GRIDNODES;i++, grid++)
169 while (grid->list.next != &grid->list)
170 World_UnlinkEdict(PRVM_EDICT_NUM(List_Entry(grid->list.next, link_t, list)->entitynumber));
171}
#define List_Entry(ptr, type, member)
Definition com_list.h:44
#define PRVM_EDICT_NUM(n)
Definition progsvm.h:867
int i
void World_UnlinkEdict(prvm_edict_t *ent)
Definition world.c:178
#define AREA_GRIDNODES
Definition world.h:35

References AREA_GRIDNODES, i, link_t::list, List_Entry, llist_t::next, PRVM_EDICT_NUM, world, and World_UnlinkEdict().

Referenced by CLVM_begin_increase_edicts(), SV_Loadgame_f(), and SVVM_begin_increase_edicts().

◆ World_UnlinkEdict()

void World_UnlinkEdict ( struct prvm_edict_s * ent)

call before removing an entity, and before trying to move one, so it doesn't clip against itself