Added modelscale & modelscale_vec. Tested and working:
void SP_misc_model_ghoul( gentity_t *ent )
{
#if 1
ent->s.modelindex = G_ModelIndex( ent->model );
gi.G2API_InitGhoul2Model(ent->ghoul2, ent->model, ent->s.modelindex, NULL_HANDLE, NULL_HANDLE, 0, 0);
ent->s.radius = 50;
//DT EDIT: enable origin & angles to be set via radiant
G_SetOrigin( ent, ent->s.origin );
G_SetAngles( ent, ent->s.angles );
//DT EDIT: enable modelscale & modelscale_vec to be set via radiant
qboolean bHasScale = G_SpawnVector("modelscale_vec", "0 0 0", ent->s.modelScale);
if (!bHasScale)
{
float temp;
G_SpawnFloat( "modelscale", "0", &temp);
if (temp != 0.0f)
{
ent->s.modelScale[ 0 ] = ent->s.modelScale[ 1 ] = ent->s.modelScale[ 2 ] = temp;
bHasScale = qtrue;
}
}
if (bHasScale)
{
//scale the x axis of the bbox up.
ent->maxs[0] *= ent->s.modelScale[0];//*scaleFactor;
ent->mins[0] *= ent->s.modelScale[0];//*scaleFactor;
//scale the y axis of the bbox up.
ent->maxs[1] *= ent->s.modelScale[1];//*scaleFactor;
ent->mins[1] *= ent->s.modelScale[1];//*scaleFactor;
//scale the z axis of the bbox up and adjust origin accordingly
ent->maxs[2] *= ent->s.modelScale[2];
float oldMins2 = ent->mins[2];
ent->mins[2] *= ent->s.modelScale[2];
ent->s.origin[2] += (oldMins2-ent->mins[2]);
}
//DT EDIT: fixed to enable GLM model loading
gi.linkentity (ent);
#else
blah blah.............
So misc_model_ghoul can be used for static ghoul2 models. If you want animated ghoul2 models, use NPC_spawner and a spawnscript to play an animation.