UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
g_spawn.h File Reference

Brings new objects into the world. More...

#include "g_local.h"

Go to the source code of this file.

Macros

#define G_ValidMessage(ent)   ((ent)->message && ((ent)->message[0] == '_' || strstr((ent)->message, "*msgid:") != nullptr))
 

Functions

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...
 
EdictG_Spawn (const char *classname=nullptr)
 Either finds a free edict, or allocates a new one. 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)
 
EdictG_SpawnFloor (const pos3_t pos)
 Spawns a new entity at the floor. More...
 
EdictG_SpawnParticle (const vec3_t origin, int spawnflags, const char *particle)
 

Detailed Description

Brings new objects into the world.

Definition in file g_spawn.h.

Macro Definition Documentation

#define G_ValidMessage (   ent)    ((ent)->message && ((ent)->message[0] == '_' || strstr((ent)->message, "*msgid:") != nullptr))

Definition at line 33 of file g_spawn.h.

Referenced by G_MissionThink(), Message_Use(), and SP_misc_message().

Function Documentation

Edict* G_Spawn ( const char *  classname)

Either finds a free edict, or allocates a new one.

Note
Try to avoid reusing an entity that was recently freed, because it can cause the player to think the entity morphed into something else instead of being removed and recreated, which can cause interpolated angles and bad trails.
See also
G_FreeEdict

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_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().

Edict* G_SpawnFloor ( const pos3_t  pos)

Spawns a new entity at the floor.

Note
This is e.g. used to place dropped weapons/items 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().

Edict* G_SpawnParticle ( const vec3_t  origin,
int  spawnflags,
const char *  particle 
)

This is only for particles that are spawned during a match - not for map particles.

Returns
A particle edict

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.

Parameters
[in]vecThe position in the world that is the center of the smoke field
[in]particleThe id of the particle (see ptl_*.ufo script files in base/ufos)
[in]roundsThe number of rounds the particle will last
Todo:
Does '2 rounds' mean: created in player's turn, last through the aliens turn, vanish before the 2nd player's turn ??
Parameters
[in]damageThe amount of damage this field will cause when touched by an actor.
[in]radiusThe 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().