All pastes #805873 Raw Edit

Something

public text v1 · immutable
·published 2007-12-04 19:14 UTC
rendered paste body
void PF_precache_model (void)
{
	char	*s;
	int		i;

	if (sv.state != ss_loading)
		PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions");

	s = G_STRING(OFS_PARM0);
	G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
	PR_CheckEmptyString (s);

	for (i=0 ; i<MAX_MODELS ; i++)
	{
		if (!sv.model_precache[i])
		{
			//Con_Printf("%i. Precaching model: %s\n", i, s);
			if (i > 255)
				Con_Printf("WARNING: Model count over 255 but precaching anyways: %s\n", s);
			sv.model_precache[i] = s;
			return;
		}
		if (!strcmp(sv.model_precache[i], s))
			return;
	}
	Con_Printf("No room to precache model: %s\n", s);
	//PR_RunError ("PF_precache_model: overflow");
}