コード例 #1
0
ファイル: g_spawn.cpp プロジェクト: danninemx/ufoai
/**
 * @brief Initializes the human/phalanx mission entity
 */
static void SP_misc_mission (Edict* ent)
{
	Edict* other;

	ent->classname = "misc_mission";
	ent->type = ET_MISSION;

	/* maybe this was set to something else for multiplayer */
	if (!ent->team)
		ent->team = TEAM_PHALANX;

	ent->solid = SOLID_BBOX;

	if (ent->HP) {
		ent->flags |= FL_DESTROYABLE;
		ent->destroy = G_MissionDestroy;
	}

	if (!ent->HP && !ent->time && !ent->target) {
		G_FreeEdict(ent);
		gi.DPrintf("misc_mission given with no objective\n");
		return;
	}

	/* think function values */
	ent->think = G_MissionThink;
	ent->nextthink = 1;

	if (ent->radius <= GRID_WIDTH) {
		ent->radius = GRID_WIDTH * 3;
	}
	VectorSet(ent->absmax, ent->radius, ent->radius, PLAYER_STAND);
	VectorSet(ent->absmin, -ent->radius, -ent->radius, PLAYER_MIN);

	if (G_ValidMessage(ent))
		G_MissionAddVictoryMessage(ent->message);

	/* spawn the trigger entity */
	other = G_TriggerSpawn(ent);
	other->touch = G_MissionTouch;
	if (ent->target)
		ent->use = G_MissionUse;
	ent->child = other;

	gi.LinkEdict(ent);
}
コード例 #2
0
/**
 * @brief func_door (0 .5 .8) ?
 * "health" if set, door is destroyable
 * @sa SV_SetModel
 * @sa LM_AddModel
 * @sa G_SendEdictsAndBrushModels
 */
void SP_func_door (edict_t *ent)
{
	edict_t *other;

	ent->classname = "door";
	ent->type = ET_DOOR;
	if (!ent->noise)
		ent->noise = "doors/open_close";

	/* set an inline model */
	gi.SetModel(ent, ent->model);
	ent->solid = SOLID_BSP;
	gi.LinkEdict(ent);
	ent->doorState = STATE_CLOSED;
	ent->dir = YAW;

	if (ent->spawnflags & REVERSE)
		ent->dir |= DOOR_OPEN_REVERSE;

	if (ent->HP)
		ent->flags |= FL_DESTROYABLE;
	ent->flags |= FL_CLIENTACTION;

	/* spawn the trigger entity */
	other = G_TriggerSpawn(ent);
	other->touch = Touch_DoorTrigger;
	other->reset = Reset_DoorTrigger;
	ent->child = other;

	G_ActorSetTU(ent, TU_DOOR_ACTION);
	if (!ent->speed)
		ent->speed = 10;
	ent->use = Door_Use;

	/* the door should start opened */
	if (ent->spawnflags & FL_TRIGGERED)
		G_UseEdict(ent, NULL);

	ent->destroy = Destroy_Breakable;
}
コード例 #3
0
ファイル: g_spawn.cpp プロジェクト: Qazzian/ufoai_suspend
/**
 * @brief Initializes the alien mission entity
 */
static void SP_misc_mission_aliens (edict_t *ent)
{
	edict_t *other;

	ent->classname = "mission";
	ent->type = ET_MISSION;
	ent->team = TEAM_ALIEN;
	ent->solid = SOLID_BBOX;

	/* think function values */
	ent->think = G_MissionThink;
	ent->nextthink = 1;

	VectorSet(ent->absmax, PLAYER_WIDTH * 3, PLAYER_WIDTH * 3, PLAYER_STAND);
	VectorSet(ent->absmin, -(PLAYER_WIDTH * 3), -(PLAYER_WIDTH * 3), PLAYER_MIN);

	/* spawn the trigger entity */
	other = G_TriggerSpawn(ent);
	other->touch = G_MissionTouch;
	ent->child = other;

	gi.LinkEdict(ent);
}