示例#1
0
/**
 * @sa G_Spawn
 */
static inline void G_InitEdict (edict_t * ent)
{
	ent->inuse = true;
	ent->classname = "noclass";
	ent->number = G_EdictsGetNumber(ent);
	ent->fieldSize = ACTOR_SIZE_NORMAL;
}
示例#2
0
Edict* G_EdictDuplicate (const Edict* edict)
{
	Edict* duplicate = G_EdictsGetNewEdict();
	if (duplicate == nullptr)
		return nullptr;
	memcpy(duplicate, edict, sizeof(*edict));
	duplicate->number = G_EdictsGetNumber(duplicate);
	return duplicate;
}
示例#3
0
/**
 * @brief 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.
 * @sa G_FreeEdict
 */
Edict* G_Spawn (const char* classname)
{
	Edict* ent = G_EdictsGetNewEdict();

	if (!ent)
		gi.Error("G_Spawn: no free edicts");

	ent->inuse = true;
	ent->number = G_EdictsGetNumber(ent);
	if (classname)
		ent->classname = classname;
	else
		ent->classname = "noclass";
	ent->fieldSize = ACTOR_SIZE_NORMAL;
	ent->setActive();		/* only used by camera */
	return ent;
}