UFO: Alien Invasion
|
Brings new objects into the world. More...
#include "g_spawn.h"
#include "g_ai.h"
#include "g_client.h"
#include "g_edicts.h"
#include "g_func.h"
#include "g_inventory.h"
#include "g_mission.h"
#include "g_reaction.h"
#include "g_trigger.h"
#include "g_utils.h"
#include "g_vis.h"
#include "../shared/parse.h"
#include "../shared/keyvaluepair.h"
Go to the source code of this file.
Data Structures | |
struct | spawn_temp_s |
this is only used to hold entity field values that can be set from the editor, but aren't actually present in Edict during gameplay More... | |
struct | spawn_s |
Macros | |
#define | FFL_SPAWNTEMP 1 |
#define | FFL_NOSPAWN 2 |
#define | G_ValidDescription(ent) ((ent)->description && ((ent)->description[0] == '_' || strstr((ent)->description, "*msgid:") != nullptr)) |
#define | MISC_MODEL_SOLID (1 << 8) |
#define | CAMERA_ROTATE (1 << 8) |
Typedefs | |
typedef struct spawn_temp_s | spawn_temp_t |
this is only used to hold entity field values that can be set from the editor, but aren't actually present in Edict during gameplay More... | |
typedef struct spawn_s | spawn_t |
Functions | |
static void | SP_light (Edict *ent) |
light (0 1 0) (-8 -8 -8) (8 8 8) More... | |
static void | SP_dummy (Edict *ent) |
a dummy to get rid of local entities More... | |
static void | SP_player_start (Edict *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) More... | |
static void | SP_human_start (Edict *ent) |
info_human_start (1 0 0) (-16 -16 -24) (16 16 32) Starting point for a single player human. More... | |
static void | SP_alien_start (Edict *ent) |
info_alien_start (1 0 0) (-16 -16 -24) (16 16 32) Starting point for a single player alien. More... | |
static void | SP_civilian_start (Edict *ent) |
info_civilian_start (0 1 1) (-16 -16 -24) (16 16 32) Starting point for a civilian. More... | |
static void | SP_worldspawn (Edict *ent) |
Spawns the world entity. More... | |
static void | SP_2x2_start (Edict *ent) |
info_2x2_start (1 1 0) (-32 -32 -24) (32 32 32) Starting point for a 2x2 unit. More... | |
static void | SP_civilian_target (Edict *ent) |
info_civilian_start (0 1 1) (-16 -16 -24) (16 16 32) Way point for a civilian. More... | |
static void | SP_misc_model (Edict *ent) |
Spawns a misc_model if there is a solid state. More... | |
static void | SP_misc_item (Edict *ent) |
Spawns an item to the ground container. More... | |
static void | SP_misc_mission (Edict *ent) |
Initializes the human/phalanx mission entity. More... | |
static void | SP_misc_message (Edict *ent) |
static void | SP_misc_smoke (Edict *ent) |
static void | SP_misc_fire (Edict *ent) |
static void | SP_misc_camera (Edict *ent) |
static void | SP_misc_smokestun (Edict *ent) |
static void | ED_CallSpawn (Edict *ent) |
Finds the spawn function for the entity and calls it. More... | |
static char * | ED_NewString (const char *string) |
Allocated memory for the given string in the level context (TAG_LEVEL) More... | |
static void | ED_ParseField (const char *key, const char *value, Edict *ent) |
Takes a key/value pair and sets the binary values in an edict. More... | |
static const char * | ED_ParseEdict (const char *data, Edict *ent) |
Parses an edict out of the given string, returning the new position. More... | |
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. More... | |
void | G_SpawnEntities (const char *mapname, bool day, const char *entities) |
Creates a server's entity / program execution context by parsing textual entity definitions out of an ent file. More... | |
Edict * | G_Spawn (const char *classname) |
Either finds a free edict, or allocates a new one. More... | |
static void | Think_SmokeAndFire (Edict *self) |
static void | G_SpawnFieldPart (const entity_type_t fieldtype, const vec3_t vec, const char *particle, int rounds, int damage) |
static void | G_SpawnFieldGroup (const entity_type_t fieldtype, const vec3_t vec, const char *particle, int rounds, int damage, vec_t radius) |
Spawns a field that is available for some rounds. More... | |
void | G_SpawnSmokeField (const vec3_t vec, const char *particle, int rounds, int damage, vec_t radius) |
Spawns a smoke field that is available for some rounds. More... | |
void | G_SpawnFireField (const vec3_t vec, const char *particle, int rounds, int damage, vec_t radius) |
void | G_SpawnStunSmokeField (const vec3_t vec, const char *particle, int rounds, int damage, vec_t radius) |
Edict * | G_SpawnFloor (const pos3_t pos) |
Spawns a new entity at the floor. More... | |
Edict * | G_SpawnParticle (const vec3_t origin, int spawnflags, const char *particle) |
static void | G_ActorSpawn (Edict *ent) |
Spawn point for a 1x1 unit. More... | |
static void | G_Actor2x2Spawn (Edict *ent) |
Spawn a singleplayer 2x2 unit. More... | |
static void | G_BuildForbiddenListForEntity (Edict *ent) |
Create a list of the grid positions the edict occupies and store it with the edict. More... | |
static bool | Message_Use (Edict *self, Edict *activator) |
static void | G_SpawnField (Edict *ent, const char *classname, entity_type_t type, solid_t solid) |
Variables | |
static spawn_temp_t | spawnTemp |
static const spawn_t | spawns [] |
Brings new objects into the world.
Definition in file g_spawn.cpp.
#define CAMERA_ROTATE (1 << 8) |
Definition at line 981 of file g_spawn.cpp.
Referenced by SP_misc_camera().
#define FFL_NOSPAWN 2 |
Definition at line 45 of file g_spawn.cpp.
#define FFL_SPAWNTEMP 1 |
Definition at line 44 of file g_spawn.cpp.
#define G_ValidDescription | ( | ent | ) | ((ent)->description && ((ent)->description[0] == '_' || strstr((ent)->description, "*msgid:") != nullptr)) |
Definition at line 47 of file g_spawn.cpp.
Referenced by SP_misc_mission().
#define MISC_MODEL_SOLID (1 << 8) |
Definition at line 852 of file g_spawn.cpp.
Referenced by SP_misc_model().
typedef struct spawn_temp_s spawn_temp_t |
this is only used to hold entity field values that can be set from the editor, but aren't actually present in Edict during gameplay
Finds the spawn function for the entity and calls it.
Definition at line 119 of file g_spawn.cpp.
References Edict::classname, Edict::inuse, spawn_t::name, and Q_streq.
Referenced by G_SpawnEntities().
|
static |
Allocated memory for the given string in the level context (TAG_LEVEL)
[in] | string | The string to copy |
Definition at line 141 of file g_spawn.cpp.
References G_TagMalloc, i, and TAG_LEVEL.
Referenced by ED_ParseField().
|
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 245 of file g_spawn.cpp.
References Com_Parse(), ED_ParseField(), gi, MAX_VAR, Edict::nativeReset(), OBJZERO, and Q_strncpyz().
Referenced by G_SpawnEntities().
Takes a key/value pair and sets the binary values in an edict.
Definition at line 165 of file g_spawn.cpp.
References Edict::active, Edict::angle, Edict::angles, KeyValuePair::asBool(), KeyValuePair::asFloat(), KeyValuePair::asInt(), KeyValuePair::asVec3(), Edict::classname, Edict::count, Edict::description, Edict::dir, Edict::dmg, ED_NewString(), Edict::fieldSize, Edict::frame, Edict::group, Edict::HP, KeyValuePair::isKey(), Edict::item, Edict::material, Edict::message, Edict::model, Edict::nextmap, spawn_temp_s::noEquipment, Edict::noise, spawn_temp_s::noRandomSpawn, Edict::origin, Edict::particle, Edict::radius, Edict::setTeam(), Edict::sounds, Edict::spawnflags, Edict::speed, Edict::target, Edict::targetname, and Edict::time.
Referenced by ED_ParseEdict().
Spawn a singleplayer 2x2 unit.
Definition at line 609 of file g_spawn.cpp.
References ACTOR_SIZE_2x2, Edict::angle, AngleToDir(), Edict::calcOrigin(), Edict::classname, CORE_DIRECTIONS, Edict::dir, Edict::entBox, ET_ACTOR2x2SPAWN, Edict::fieldSize, AABB::getMaxX(), AABB::getMinX(), Edict::getTeam(), gi, level, level_locals_s::num_2x2spawnpoints, PATHFINDING_HEIGHT, PLAYER2x2_WIDTH, PLAYER_MIN, PLAYER_STAND, Edict::pos, AABB::setMaxs(), AABB::setMins(), Edict::solid, SOLID_BBOX, and Edict::type.
Referenced by SP_2x2_start().
Spawn point for a 1x1 unit.
Definition at line 571 of file g_spawn.cpp.
References ACTOR_SIZE_NORMAL, Edict::angle, AngleToDir(), Edict::calcOrigin(), Edict::classname, CORE_DIRECTIONS, Edict::dir, Edict::entBox, ET_ACTORSPAWN, Edict::fieldSize, AABB::getMaxX(), AABB::getMinX(), Edict::getTeam(), gi, level, level_locals_s::num_spawnpoints, PATHFINDING_HEIGHT, PLAYER_MIN, PLAYER_STAND, PLAYER_WIDTH, Edict::pos, PosToVec, AABB::setMaxs(), AABB::setMins(), Edict::solid, SOLID_BBOX, and Edict::type.
Referenced by SP_alien_start(), SP_civilian_start(), SP_human_start(), and SP_player_start().
Create a list of the grid positions the edict occupies and store it with the edict.
ent | The edict to fill the forbidden list for |
Definition at line 824 of file g_spawn.cpp.
References Edict::absBox, Edict::forbiddenListPos, Edict::forbiddenListSize, G_TagMalloc, AABB::getCenter(), i, AABB::maxs, AABB::mins, TAG_LEVEL, VecToPos, and VectorSet.
Referenced by SP_misc_model().
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 292 of file g_spawn.cpp.
References FL_GROUPSLAVE, Edict::flags, G_EdictsGetFirst(), G_EdictsGetNextInUse(), Edict::group, Edict::groupChain, Edict::groupMaster, and Q_streq.
Referenced by G_SpawnEntities().
Edict* G_Spawn | ( | const char * | classname | ) |
Either finds a free edict, or allocates a new one.
Definition at line 403 of file g_spawn.cpp.
References ACTOR_SIZE_NORMAL, Edict::classname, Edict::fieldSize, G_EdictsGetNewEdict(), G_EdictsGetNumber(), gi, Edict::inuse, Edict::number, and Edict::setActive().
Referenced by G_SpawnEntities(), G_SpawnFieldPart(), G_SpawnFloor(), G_SpawnParticle(), and G_TriggerSpawn().
void G_SpawnEntities | ( | const char * | mapname, |
bool | 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 331 of file g_spawn.cpp.
References level_locals_s::activeTeam, level_locals_s::actualRound, AI_CreatePlayer(), ai_multiplayeraliens, Edict::calcOrigin(), Com_Parse(), Com_Printf(), level_locals_s::day, ED_CallSpawn(), ED_ParseEdict(), G_EdictsInit(), G_FindEdictGroups(), G_FreeTags, G_IsSinglePlayer, G_ReactionFireTargetsInit(), G_ResetClientData(), G_Spawn(), G_TagMalloc, game, InventoryInterface::GetUsedSlots(), gi, level_locals_s::hurtAliens, cvar_s::integer, game_locals_s::invi, level, level_locals_s::mapname, Edict::mapNum, level_locals_s::num_spawnpoints, OBJZERO, Edict::origin, level_locals_s::pathingMap, Edict::pos, Q_strncpyz(), Edict::solid, SOLID_BBOX, sv_hurtaliens, TAG_LEVEL, TEAM_ALIEN, TEAM_CIVILIAN, TEAM_NO_ACTIVE, and VecToPos.
Referenced by GetGameAPI().
|
static |
Definition at line 922 of file g_spawn.cpp.
References level_locals_s::activeTeam, ACTOR_SIZE_NORMAL, level_locals_s::actualRound, Edict::calcOrigin(), Edict::classname, Edict::entBox, Edict::fieldSize, G_SpawnParticle(), gi, GROUND_DELTA, level, Edict::nextthink, Edict::origin, Edict::particle, Edict::particleLink, AABB::setMaxs(), AABB::setMins(), Edict::setTeam(), Edict::solid, Edict::spawnflags, Edict::think, Think_SmokeAndFire(), Edict::time, Edict::type, type, UNIT_HEIGHT, UNIT_SIZE, and VectorCopy.
Referenced by SP_misc_fire(), SP_misc_smoke(), and SP_misc_smokestun().
|
static |
Spawns a field that is available for some rounds.
[in] | fieldtype | The kind of field eg. smoke, fire, ... |
[in] | vec | The position in the world that is the center of the field |
[in] | particle | The id of the particle (see ptl_*.ufo script files in base/ufos) |
[in] | rounds | The number of rounds the particle will last |
[in] | damage | The damage dealt by the field |
[in] | radius | The max distance of a cell from the center to get a particle |
Definition at line 482 of file g_spawn.cpp.
References trace_s::contentFlags, CONTENTS_WATER, trace_s::fraction, G_SpawnFieldPart(), G_Trace(), gi, MASK_SMOKE_AND_FIRE, tr, UNIT_SIZE, VectorDist, and VectorSet.
Referenced by G_SpawnFireField(), G_SpawnSmokeField(), and G_SpawnStunSmokeField().
|
static |
Definition at line 436 of file g_spawn.cpp.
References ACTOR_SIZE_NORMAL, Edict::calcOrigin(), Edict::count, Edict::dmg, ET_FIRE, ET_SMOKE, ET_SMOKESTUN, G_GetEdictFromPos(), G_GetLevelFlagsFromPos(), G_Spawn(), gi, Edict::particle, Edict::pos, SP_misc_fire(), SP_misc_smoke(), SP_misc_smokestun(), Edict::spawnflags, VecToPos, and VectorCopy.
Referenced by G_SpawnFieldGroup().
void G_SpawnFireField | ( | const vec3_t | vec, |
const char * | particle, | ||
int | rounds, | ||
int | damage, | ||
vec_t | radius | ||
) |
Definition at line 521 of file g_spawn.cpp.
References ET_FIRE, and G_SpawnFieldGroup().
Referenced by G_ClientShoot().
Spawns a new entity at the floor.
Definition at line 535 of file g_spawn.cpp.
References ACTOR_SIZE_NORMAL, Edict::calcOrigin(), ET_ITEM, Edict::fieldSize, G_Spawn(), gi, Edict::pos, Edict::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 551 of file g_spawn.cpp.
References ET_PARTICLE, G_CheckVis(), G_Spawn(), Edict::origin, Edict::particle, Edict::pos, Edict::spawnflags, Edict::type, VecToPos, and VectorCopy.
Referenced by Destroy_Breakable(), Destroy_Camera(), G_MissionThink(), G_ShootSingle(), G_SpawnField(), G_SplashDamage(), and Think_NextMapTrigger().
void G_SpawnSmokeField | ( | const vec3_t | vec, |
const char * | particle, | ||
int | rounds, | ||
int | damage, | ||
vec_t | radius | ||
) |
Spawns a smoke field that is available for some rounds.
[in] | vec | The position in the world that is the center of the smoke field |
[in] | particle | The id of the particle (see ptl_*.ufo script files in base/ufos) |
[in] | rounds | The number of rounds the particle will last |
[in] | damage | The amount of damage this field will cause when touched by an actor. |
[in] | radius | The max distance of a cell from the center to get a particle |
Definition at line 516 of file g_spawn.cpp.
References ET_SMOKE, and G_SpawnFieldGroup().
Referenced by G_ClientShoot().
void G_SpawnStunSmokeField | ( | const vec3_t | vec, |
const char * | particle, | ||
int | rounds, | ||
int | damage, | ||
vec_t | radius | ||
) |
Definition at line 526 of file g_spawn.cpp.
References ET_SMOKESTUN, and G_SpawnFieldGroup().
Referenced by G_ClientShoot().
Definition at line 901 of file g_spawn.cpp.
References G_ClientPrintf(), G_FreeEdict(), G_IsActor, G_ValidMessage, Edict::getPlayer(), and PRINT_HUD.
Referenced by SP_misc_message().
info_2x2_start (1 1 0) (-32 -32 -24) (32 32 32) Starting point for a 2x2 unit.
Definition at line 697 of file g_spawn.cpp.
References Edict::entBox, G_Actor2x2Spawn(), G_FreeEdict(), G_IsMultiPlayer, Edict::getTeam(), PLAYER_MIN, PLAYER_STAND, PLAYER_WIDTH, AABB::setMaxs(), AABB::setMins(), Edict::setTeam(), and TEAM_PHALANX.
info_alien_start (1 0 0) (-16 -16 -24) (16 16 32) Starting point for a single player alien.
Definition at line 720 of file g_spawn.cpp.
References ai_multiplayeraliens, G_ActorSpawn(), G_FreeEdict(), G_IsMultiPlayer, cvar_s::integer, Edict::setTeam(), and TEAM_ALIEN.
info_civilian_start (0 1 1) (-16 -16 -24) (16 16 32) Starting point for a civilian.
Definition at line 737 of file g_spawn.cpp.
References ai_numcivilians, Edict::count, G_ActorSpawn(), G_FreeEdict(), G_IsMultiPlayer, cvar_s::integer, Edict::setTeam(), and TEAM_CIVILIAN.
info_civilian_start (0 1 1) (-16 -16 -24) (16 16 32) Way point for a civilian.
Definition at line 756 of file g_spawn.cpp.
References ACTOR_SIZE_NORMAL, Edict::calcOrigin(), Edict::classname, ET_CIVILIANTARGET, Edict::fieldSize, G_AddToWayPointList(), gi, PATHFINDING_HEIGHT, Edict::pos, Edict::setTeam(), TEAM_CIVILIAN, and Edict::type.
a dummy to get rid of local entities
Definition at line 998 of file g_spawn.cpp.
References G_FreeEdict().
info_human_start (1 0 0) (-16 -16 -24) (16 16 32) Starting point for a single player human.
Definition at line 680 of file g_spawn.cpp.
References G_ActorSpawn(), G_FreeEdict(), G_IsMultiPlayer, Edict::setTeam(), and TEAM_PHALANX.
light (0 1 0) (-8 -8 -8) (8 8 8)
Definition at line 647 of file g_spawn.cpp.
References G_FreeEdict().
Definition at line 983 of file g_spawn.cpp.
References Edict::angle, CAMERA_ROTATE, CAMERA_STATIONARY, G_FreeEdict(), G_InitCamera(), G_IsMultiPlayer, and Edict::spawnflags.
Definition at line 952 of file g_spawn.cpp.
References game_import_s::csi, csi_s::damIncendiary, Edict::dmgtype, ET_FIRE, G_SpawnField(), gi, Edict::setTouch(), SOLID_TRIGGER, and Touch_HurtTrigger().
Referenced by G_SpawnFieldPart().
Spawns an item to the ground container.
Definition at line 887 of file g_spawn.cpp.
References G_AddItemToFloor(), G_FreeEdict(), gi, Edict::item, and Edict::pos.
Definition at line 966 of file g_spawn.cpp.
References Edict::classname, ET_MESSAGE, G_FreeEdict(), G_ValidMessage, gi, Edict::message, Message_Use(), Edict::solid, SOLID_NOT, Edict::type, and Edict::use.
Initializes the human/phalanx mission entity.
Definition at line 777 of file g_spawn.cpp.
References Edict::classname, Edict::description, Edict::entBox, ET_MISSION, G_FreeEdict(), G_MissionAddVictoryMessage(), G_MissionReset(), G_MissionThink(), G_MissionTouch(), G_MissionUse(), G_ValidDescription, Edict::getTeam(), gi, Edict::group, Edict::item, Edict::nextthink, PLAYER_MIN, PLAYER_STAND, Edict::radius, Edict::reset, AABB::setMaxs(), AABB::setMins(), Edict::setTeam(), Edict::setTouch(), Edict::solid, SOLID_TRIGGER, Edict::target, TEAM_PHALANX, Edict::think, Edict::time, Edict::type, UNIT_SIZE, and Edict::use.
Spawns a misc_model if there is a solid state.
Definition at line 856 of file g_spawn.cpp.
References ACTOR_SIZE_NORMAL, Edict::classname, Edict::entBox, ET_SOLID, Edict::fieldSize, Edict::frame, G_BuildForbiddenListForEntity(), G_FreeEdict(), gi, MISC_MODEL_SOLID, Edict::model, AABB::set(), Edict::solid, SOLID_BBOX, Edict::spawnflags, and Edict::type.
Definition at line 944 of file g_spawn.cpp.
References game_import_s::csi, csi_s::damStunGas, Edict::dmgtype, ET_SMOKE, G_CheckVis(), G_SpawnField(), gi, Edict::setTouch(), SOLID_TRIGGER, and Touch_HurtTrigger().
Referenced by G_SpawnFieldPart().
Definition at line 959 of file g_spawn.cpp.
References game_import_s::csi, csi_s::damStunGas, Edict::dmgtype, ET_SMOKESTUN, G_SpawnField(), gi, Edict::setTouch(), SOLID_TRIGGER, and Touch_HurtTrigger().
Referenced by G_SpawnFieldPart().
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 660 of file g_spawn.cpp.
References G_ActorSpawn(), G_FreeEdict(), G_IsSinglePlayer, Edict::getTeam(), cvar_s::integer, level, level_locals_s::num_spawnpoints, and sv_maxsoldiersperteam.
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 1013 of file g_spawn.cpp.
References Edict::classname, CS_ENABLEMORALE, CS_MAXCLIENTS, CS_MAXSOLDIERSPERPLAYER, CS_MAXSOLDIERSPERTEAM, CS_MAXTEAMS, G_IsMultiPlayer, gi, cvar_s::integer, Edict::inuse, level, spawn_temp_s::noEquipment, level_locals_s::noEquipment, spawn_temp_s::noRandomSpawn, level_locals_s::noRandomSpawn, Edict::solid, SOLID_BSP, cvar_s::string, sv_enablemorale, sv_maxclients, sv_maxsoldiersperplayer, sv_maxsoldiersperteam, and sv_maxteams.
Definition at line 421 of file g_spawn.cpp.
References level_locals_s::activeTeam, level_locals_s::actualRound, ET_SMOKE, G_CheckVis(), G_EventEdictPerish(), G_FreeEdict(), G_VisToPM(), level, MAX_TEAMS, and level_locals_s::teamOfs.
Referenced by G_SpawnField().
|
static |
Definition at line 84 of file g_spawn.cpp.
|
static |
Definition at line 59 of file g_spawn.cpp.