Brings new objects into the world. More...
#include "g_local.h"
#include "../shared/parse.h"
Go to the source code of this file.
Data Structures | |
struct | spawn_t |
struct | field_t |
Defines | |
#define | MISC_MODEL_SOLID 256 |
Enumerations | |
enum | fieldtype_t { F_INT, F_FLOAT, F_LSTRING, F_VECTOR, F_IGNORE } |
Functions | |
static void | SP_light (edict_t *ent) |
light (0 1 0) (-8 -8 -8) (8 8 8) | |
static void | SP_dummy (edict_t *ent) |
a dummy to get rid of local entities | |
static void | SP_player_start (edict_t *ent) |
info_player_start (1 0 0) (-16 -16 -24) (16 16 32) Starting point for a player. "team" the number of the team for this player starting point "0" is reserved for civilians and critters (use info_civilian_start instead) | |
static void | SP_human_start (edict_t *ent) |
info_human_start (1 0 0) (-16 -16 -24) (16 16 32) Starting point for a single player human. | |
static void | SP_alien_start (edict_t *ent) |
info_alien_start (1 0 0) (-16 -16 -24) (16 16 32) Starting point for a single player alien. | |
static void | SP_civilian_start (edict_t *ent) |
info_civilian_start (0 1 1) (-16 -16 -24) (16 16 32) Starting point for a civilian. | |
static void | SP_worldspawn (edict_t *ent) |
Spawns the world entity. | |
static void | SP_2x2_start (edict_t *ent) |
info_2x2_start (1 1 0) (-32 -32 -24) (32 32 32) Starting point for a 2x2 unit. | |
static void | SP_civilian_target (edict_t *ent) |
info_civilian_start (0 1 1) (-16 -16 -24) (16 16 32) Way point for a civilian. | |
static void | SP_misc_model (edict_t *ent) |
Spawns a misc_model if there is a solid state. | |
static void | SP_misc_item (edict_t *ent) |
Spawns an item to the ground container. | |
static void | SP_misc_mission (edict_t *ent) |
Initializes the human/phalanx mission entity. | |
static void | SP_misc_mission_aliens (edict_t *ent) |
Initializes the alien mission entity. | |
static void | SP_misc_message (edict_t *ent) |
static void | ED_CallSpawn (edict_t *ent) |
Finds the spawn function for the entity and calls it. | |
static char * | ED_NewString (const char *string) |
Allocated memory for the given string in the level context (TAG_LEVEL). | |
static void | ED_ParseField (const char *key, const char *value, edict_t *ent) |
Takes a key/value pair and sets the binary values in an edict. | |
static const char * | ED_ParseEdict (const char *data, edict_t *ent) |
Parses an edict out of the given string, returning the new position. | |
static void | G_FindEdictGroups (void) |
Chain together all entities with a matching team field. All but the first will have the FL_GROUPSLAVE flag set. All but the last will have the groupchain field set to the next one. | |
void | G_SpawnEntities (const char *mapname, qboolean day, const char *entities) |
Creates a server's entity / program execution context by parsing textual entity definitions out of an ent file. | |
static void | G_InitEdict (edict_t *ent) |
edict_t * | G_Spawn (void) |
Either finds a free edict, or allocates a new one. | |
edict_t * | G_SpawnFloor (const pos3_t pos) |
Spawns a new entity at the floor. | |
edict_t * | G_SpawnParticle (const vec3_t origin, int spawnflags, const char *particle) |
static void | G_ActorSpawn (edict_t *ent) |
Spawn a 1x1 unit. | |
static void | G_Actor2x2Spawn (edict_t *ent) |
Spawn a singleplayer 2x2 unit. | |
static void | G_BuildForbiddenListForEntity (edict_t *ent) |
static qboolean | Message_Use (edict_t *self, edict_t *activator) |
Variables | |
static spawn_temp_t | st |
static const spawn_t | spawns [] |
static const field_t | fields [] |
Brings new objects into the world.
Definition in file g_spawn.c.
#define MISC_MODEL_SOLID 256 |
Definition at line 778 of file g_spawn.c.
Referenced by SP_misc_model().
enum fieldtype_t |
static void ED_CallSpawn | ( | edict_t * | ent | ) | [static] |
Finds the spawn function for the entity and calls it.
Definition at line 136 of file g_spawn.c.
References edict_s::classname, edict_s::inuse, spawn_t::name, qfalse, and spawn_t::spawn.
Referenced by G_SpawnEntities().
static char* ED_NewString | ( | const char * | string | ) | [static] |
Allocated memory for the given string in the level context (TAG_LEVEL).
[in] | string | The string to copy |
Definition at line 160 of file g_spawn.c.
References G_TagMalloc, i, and TAG_LEVEL.
Referenced by ED_ParseField().
static const char* ED_ParseEdict | ( | const char * | data, | |
edict_t * | ent | |||
) | [static] |
Parses an edict out of the given string, returning the new position.
[in] | data | The string to parse from |
[in] | ent | should be a properly initialized empty edict. |
Definition at line 230 of file g_spawn.c.
References Com_Parse(), ED_ParseField(), gi, MAX_VAR, Q_strncpyz(), qfalse, and qtrue.
Referenced by G_SpawnEntities().
static void ED_ParseField | ( | const char * | key, | |
const char * | value, | |||
edict_t * | ent | |||
) | [static] |
Takes a key/value pair and sets the binary values in an edict.
Definition at line 187 of file g_spawn.c.
References byte, ED_NewString(), f, F_FLOAT, F_IGNORE, F_INT, F_LSTRING, F_VECTOR, FFL_NOSPAWN, FFL_SPAWNTEMP, field_t::flags, field_t::name, field_t::ofs, Q_strcasecmp, and field_t::type.
Referenced by ED_ParseEdict().
static void G_Actor2x2Spawn | ( | edict_t * | ent | ) | [static] |
Spawn a singleplayer 2x2 unit.
Definition at line 488 of file g_spawn.c.
References ACTOR_SIZE_2x2, edict_s::angle, AngleToDir(), edict_s::classname, CORE_DIRECTIONS, edict_s::dir, ET_ACTOR2x2SPAWN, edict_s::fieldSize, G_EdictCalcOrigin(), gi, level, edict_s::maxs, edict_s::mins, level_locals_t::num_2x2spawnpoints, PATHFINDING_HEIGHT, PLAYER2x2_WIDTH, PLAYER_MIN, PLAYER_STAND, edict_s::pos, game_import_t::routingMap, edict_s::solid, SOLID_BBOX, edict_s::team, edict_s::type, and VectorSet.
Referenced by SP_2x2_start().
static void G_ActorSpawn | ( | edict_t * | ent | ) | [static] |
Spawn a 1x1 unit.
Definition at line 455 of file g_spawn.c.
References ACTOR_SIZE_NORMAL, edict_s::angle, AngleToDir(), edict_s::classname, CORE_DIRECTIONS, edict_s::dir, ET_ACTORSPAWN, edict_s::fieldSize, G_EdictCalcOrigin(), gi, level, edict_s::maxs, edict_s::mins, level_locals_t::num_spawnpoints, PATHFINDING_HEIGHT, PLAYER_MIN, PLAYER_STAND, PLAYER_WIDTH, edict_s::pos, game_import_t::routingMap, edict_s::solid, SOLID_BBOX, edict_s::team, edict_s::type, and VectorSet.
Referenced by SP_alien_start(), SP_civilian_start(), SP_human_start(), and SP_player_start().
static void G_BuildForbiddenListForEntity | ( | edict_t * | ent | ) | [static] |
ent | The edict to fill the forbidden list for |
Definition at line 747 of file g_spawn.c.
References edict_s::absmax, edict_s::absmin, edict_s::forbiddenListPos, edict_s::forbiddenListSize, G_TagMalloc, i, edict_s::origin, TAG_LEVEL, VecToPos, VectorAdd, VectorCenterFromMinsMaxs(), and VectorSet.
Referenced by SP_misc_model().
static void G_FindEdictGroups | ( | void | ) | [static] |
Chain together all entities with a matching team field. All but the first will have the FL_GROUPSLAVE flag set. All but the last will have the groupchain field set to the next one.
Definition at line 278 of file g_spawn.c.
References FL_GROUPSLAVE, edict_s::flags, G_EdictsGetFirst(), G_EdictsGetNextInUse(), edict_s::group, edict_s::groupChain, and edict_s::groupMaster.
Referenced by G_SpawnEntities().
static void G_InitEdict | ( | edict_t * | ent | ) | [inline, static] |
Definition at line 383 of file g_spawn.c.
References ACTOR_SIZE_NORMAL, edict_s::classname, edict_s::fieldSize, G_EdictsGetNumber(), edict_s::inuse, edict_s::number, and qtrue.
Referenced by G_Spawn().
edict_t* G_Spawn | ( | void | ) |
Either finds a free edict, or allocates a new one.
Definition at line 400 of file g_spawn.c.
References G_EdictsGetNewEdict(), G_InitEdict(), and gi.
Referenced by G_SpawnEntities(), G_SpawnFloor(), G_SpawnParticle(), and G_TriggerSpawn().
void G_SpawnEntities | ( | const char * | mapname, | |
qboolean | day, | |||
const char * | entities | |||
) |
Creates a server's entity / program execution context by parsing textual entity definitions out of an ent file.
Definition at line 313 of file g_spawn.c.
References level_locals_t::activeTeam, level_locals_t::actualRound, AI_CreatePlayer(), ai_numactors, ai_waypointList, Com_Parse(), Com_Printf(), level_locals_t::day, ED_CallSpawn(), ED_ParseEdict(), G_EdictCalcOrigin(), G_EdictsGetFirst(), G_EdictsReset(), G_FindEdictGroups(), G_FreeTags, G_ResetClientData(), G_Spawn(), game, inventoryInterface_s::GetUsedSlots, gi, level_locals_t::hurtAliens, game_locals_t::i, cvar_s::integer, level, level_locals_t::mapname, edict_s::mapNum, level_locals_t::num_spawnpoints, edict_s::origin, edict_s::pos, Q_strncpyz(), edict_s::solid, SOLID_BBOX, sv_hurtaliens, sv_maxclients, TAG_LEVEL, TEAM_ALIEN, TEAM_CIVILIAN, TEAM_NO_ACTIVE, and VecToPos.
Referenced by GetGameAPI().
Spawns a new entity at the floor.
Definition at line 415 of file g_spawn.c.
References ACTOR_SIZE_NORMAL, edict_s::classname, ET_ITEM, edict_s::fieldSize, G_EdictCalcOrigin(), G_Spawn(), gi, edict_s::pos, game_import_t::routingMap, edict_s::type, and VectorCopy.
Referenced by G_ActorInvMove(), G_AddItemToFloor(), G_InventoryToFloor(), and G_SpawnItemOnFloor().
This is only for particles that are spawned during a match - not for map particles.
Definition at line 434 of file g_spawn.c.
References edict_s::classname, ET_PARTICLE, G_CheckVis(), G_Spawn(), edict_s::origin, edict_s::particle, edict_s::pos, qtrue, edict_s::spawnflags, edict_s::type, VecToPos, and VectorCopy.
Referenced by Destroy_Breakable(), G_MissionThink(), G_ShootSingle(), and G_SplashDamage().
Definition at line 828 of file g_spawn.c.
References G_ClientPrintf(), G_FreeEdict(), G_IsActor, G_PLAYER_FROM_ENT, PRINT_HUD, and qfalse.
Referenced by SP_misc_message().
static void SP_2x2_start | ( | edict_t * | ent | ) | [static] |
info_2x2_start (1 1 0) (-32 -32 -24) (32 32 32) Starting point for a 2x2 unit.
Definition at line 572 of file g_spawn.c.
References G_Actor2x2Spawn(), G_FreeEdict(), edict_s::HP, cvar_s::integer, MAX_HP, edict_s::maxs, edict_s::mins, PLAYER_MIN, PLAYER_STAND, PLAYER_WIDTH, edict_s::STUN, sv_maxclients, edict_s::team, TEAM_PHALANX, and VectorSet.
static void SP_alien_start | ( | edict_t * | ent | ) | [static] |
info_alien_start (1 0 0) (-16 -16 -24) (16 16 32) Starting point for a single player alien.
Definition at line 598 of file g_spawn.c.
References ai_numactors, f, frand(), G_ActorSpawn(), G_FreeEdict(), edict_s::HP, level_locals_t::hurtAliens, cvar_s::integer, level, MAX_HP, random, edict_s::STUN, sv_maxclients, edict_s::team, and TEAM_ALIEN.
static void SP_civilian_start | ( | edict_t * | ent | ) | [static] |
info_civilian_start (0 1 1) (-16 -16 -24) (16 16 32) Starting point for a civilian.
Definition at line 631 of file g_spawn.c.
References ai_numcivilians, edict_s::count, G_ActorSpawn(), G_FreeEdict(), edict_s::HP, cvar_s::integer, MAX_HP, edict_s::STUN, sv_maxclients, edict_s::team, and TEAM_CIVILIAN.
static void SP_civilian_target | ( | edict_t * | ent | ) | [static] |
info_civilian_start (0 1 1) (-16 -16 -24) (16 16 32) Way point for a civilian.
Definition at line 653 of file g_spawn.c.
References ACTOR_SIZE_NORMAL, edict_s::classname, ET_CIVILIANTARGET, edict_s::fieldSize, G_AddToWayPointList(), G_EdictCalcOrigin(), gi, PATHFINDING_HEIGHT, edict_s::pos, game_import_t::routingMap, edict_s::team, TEAM_CIVILIAN, and edict_s::type.
static void SP_dummy | ( | edict_t * | ent | ) | [static] |
a dummy to get rid of local entities
Definition at line 865 of file g_spawn.c.
References G_FreeEdict().
static void SP_human_start | ( | edict_t * | ent | ) | [static] |
info_human_start (1 0 0) (-16 -16 -24) (16 16 32) Starting point for a single player human.
Definition at line 554 of file g_spawn.c.
References G_ActorSpawn(), G_FreeEdict(), edict_s::HP, cvar_s::integer, MAX_HP, edict_s::STUN, sv_maxclients, edict_s::team, and TEAM_PHALANX.
static void SP_light | ( | edict_t * | ent | ) | [static] |
light (0 1 0) (-8 -8 -8) (8 8 8)
Definition at line 519 of file g_spawn.c.
References G_FreeEdict().
static void SP_misc_item | ( | edict_t * | ent | ) | [static] |
Spawns an item to the ground container.
Definition at line 814 of file g_spawn.c.
References G_AddItemToFloor(), G_FreeEdict(), gi, edict_s::item, and edict_s::pos.
static void SP_misc_message | ( | edict_t * | ent | ) | [static] |
Definition at line 847 of file g_spawn.c.
References edict_s::classname, ET_MESSAGE, G_FreeEdict(), gi, edict_s::message, Message_Use(), edict_s::solid, SOLID_NOT, edict_s::type, and edict_s::use.
static void SP_misc_mission | ( | edict_t * | ent | ) | [static] |
Initializes the human/phalanx mission entity.
Definition at line 674 of file g_spawn.c.
References edict_s::absmax, edict_s::absmin, edict_s::child, edict_s::classname, edict_s::destroy, ET_MISSION, FL_DESTROYABLE, edict_s::flags, G_FreeEdict(), G_MissionDestroy(), G_MissionThink(), G_MissionTouch(), G_MissionUse(), G_TriggerSpawn(), gi, edict_s::HP, edict_s::nextthink, PLAYER_MIN, PLAYER_STAND, PLAYER_WIDTH, edict_s::solid, SOLID_BBOX, edict_s::target, edict_s::team, TEAM_PHALANX, edict_s::think, edict_s::time, edict_s::touch, edict_s::type, edict_s::use, and VectorSet.
static void SP_misc_mission_aliens | ( | edict_t * | ent | ) | [static] |
Initializes the alien mission entity.
Definition at line 718 of file g_spawn.c.
References edict_s::absmax, edict_s::absmin, edict_s::child, edict_s::classname, ET_MISSION, G_MissionThink(), G_MissionTouch(), G_TriggerSpawn(), gi, edict_s::nextthink, PLAYER_MIN, PLAYER_STAND, PLAYER_WIDTH, edict_s::solid, SOLID_BBOX, edict_s::team, TEAM_ALIEN, edict_s::think, edict_s::touch, edict_s::type, and VectorSet.
static void SP_misc_model | ( | edict_t * | ent | ) | [static] |
Spawns a misc_model if there is a solid state.
Definition at line 782 of file g_spawn.c.
References edict_s::absmax, edict_s::absmin, ACTOR_SIZE_NORMAL, edict_s::classname, ET_SOLID, edict_s::fieldSize, edict_s::frame, G_BuildForbiddenListForEntity(), G_FreeEdict(), gi, MISC_MODEL_SOLID, edict_s::model, edict_s::solid, SOLID_BBOX, edict_s::spawnflags, edict_s::type, and VectorCopy.
static void SP_player_start | ( | edict_t * | ent | ) | [static] |
info_player_start (1 0 0) (-16 -16 -24) (16 16 32) Starting point for a player. "team" the number of the team for this player starting point "0" is reserved for civilians and critters (use info_civilian_start instead)
Definition at line 532 of file g_spawn.c.
References G_ActorSpawn(), G_FreeEdict(), edict_s::HP, cvar_s::integer, level, MAX_HP, level_locals_t::num_spawnpoints, edict_s::STUN, sv_maxclients, sv_maxsoldiersperteam, and edict_s::team.
static void SP_worldspawn | ( | edict_t * | ent | ) | [static] |
Spawns the world entity.
Only used for the world. "sounds" music cd track number "maxlevel" max. level to use in the map "maxteams" max team amount for multiplayergames for the current map
Definition at line 880 of file g_spawn.c.
References edict_s::classname, CS_ENABLEMORALE, CS_MAXCLIENTS, CS_MAXSOLDIERSPERPLAYER, CS_MAXSOLDIERSPERTEAM, CS_MAXTEAMS, gi, cvar_s::integer, edict_s::inuse, level, level_locals_t::nextmap, spawn_temp_t::nextmap, Q_strncpyz(), qtrue, spawn_temp_t::randomSpawn, level_locals_t::randomSpawn, edict_s::solid, SOLID_BSP, cvar_s::string, sv_enablemorale, sv_maxclients, sv_maxsoldiersperplayer, sv_maxsoldiersperteam, and sv_maxteams.
{ {"worldspawn", SP_worldspawn}, {"light", SP_light}, {"misc_item", SP_misc_item}, {"misc_sound", SP_dummy}, {"misc_model", SP_misc_model}, {"misc_particle", SP_dummy}, {"misc_mission", SP_misc_mission}, {"misc_mission_aliens", SP_misc_mission_aliens}, {"info_player_start", SP_player_start}, {"info_human_start", SP_human_start}, {"info_alien_start", SP_alien_start}, {"info_civilian_start", SP_civilian_start}, {"info_civilian_target", SP_civilian_target}, {"info_2x2_start", SP_2x2_start}, {"info_null", SP_dummy}, {"func_breakable", SP_func_breakable}, {"func_door", SP_func_door}, {"func_rotating", SP_func_rotating}, {"trigger_hurt", SP_trigger_hurt}, {"trigger_touch", SP_trigger_touch}, {"trigger_rescue", SP_trigger_rescue}, {"misc_message", SP_misc_message}, {NULL, NULL} }
spawn_temp_t st [static] |
Definition at line 33 of file g_spawn.c.
Referenced by _ase_submit_triangles(), _md2_load(), _md3_load(), luaD_precall(), operator<<(), R_DrawSurfaceStage(), R_LoadObjModelVertexArrays(), R_ModLoadArrayData(), and R_SphereGenerate().