Exemple #1
0
void LMT_Init (localModel_t* localModel)
{
	if (localModel->target[0] != '\0') {
		localModel->parent = LM_GetByID(localModel->target);
		if (!localModel->parent)
			Com_Error(ERR_DROP, "Could not find local model entity with the id: '%s'.", localModel->target);
	}

	/* no longer needed */
	localModel->think = nullptr;
}
Exemple #2
0
static void SP_misc_model (const localEntityParse_t *entData)
{
	localModel_t *lm;
	int renderFlags = 0;

	if (entData->model[0] == '\0') {
		Com_Printf("misc_model without \"model\" specified\n");
		return;
	}

	if (entData->spawnflags & (1 << MISC_MODEL_GLOW))
		renderFlags |= RF_PULSE;

	/* add it */
	lm = LM_AddModel(entData->model, entData->origin, entData->angles, entData->entnum, (entData->spawnflags & 0xFF), renderFlags, entData->scale);
	if (lm) {
		if (LM_GetByID(entData->targetname) != NULL)
			Com_Error(ERR_DROP, "Ambiguous targetname '%s'", entData->targetname);
		Q_strncpyz(lm->id, entData->targetname, sizeof(lm->id));
		Q_strncpyz(lm->target, entData->target, sizeof(lm->target));
		Q_strncpyz(lm->tagname, entData->tagname, sizeof(lm->tagname));

		if (lm->animname[0] != '\0' && lm->tagname[0] != '\0') {
			Com_Printf("Warning: Model has animation set, but also a tag - use the tag and skip the animation\n");
			lm->animname[0] = '\0';
		}

		if (lm->tagname[0] != '\0' && lm->target[0] == '\0') {
			Com_Error(ERR_DROP, "Warning: Model has tag set, but no target given");
		}

		lm->think = LMT_Init;
		lm->skin = entData->skin;
		lm->frame = entData->frame;
		if (!lm->frame)
			Q_strncpyz(lm->animname, entData->anim, sizeof(lm->animname));
		else
			Com_Printf("Warning: Model has frame and anim parameters - using frame (no animation)\n");
	}
}