Jump to content

misc_model_ghoul


Tempust85

Recommended Posts

I've tried using centity renderfx rf_lighting_origin but it changed nothing. I'll try refent. I'm guessing the origin issue is why the misc static & ghoul aren't displaying stencil shadows in certain areas in a map when the player + NPCs do.

Simply setting the flag doesn't do anything, you must actually supply the lightning origin information in the struct as well. :)

Tempust85 likes this
Link to comment

Will the player be able to interact with a misc_model_ghoul (MMG)? I mean... suppose you use this to spawn (can you spawn an MMG?) a dead corpse (to replace the dead NPC at the moment its corpse disappears...)

 

Then passing NPC's see static corpse and go into alert mode? Or player could walk up to static corpse and be prompted to "Pick up corpse" so you have to hide the body-- which would trigger a new anim to play on MMg corpse being carried etc.

Link to comment
  • 1 year later...

Necro time!

 

New features:

 

- render radius

- rootbone

LOOP - Loop the animation. Default - play once.

"model" - arbitrary .glm file to load
"modelscale" - "x" uniform scale
"modelscale_vec" - "x y z" scale model in each axis
"renderRadius" - default "120" model render radius
"rootbone" - default "model_root" animation root bone
"startframe" - default "0". animation start frame
"endframe" - default "0". animation end frame
"skin" default "models/players/kyle/model_default.skin" - skin file to load. must include path.

- The frames between the "startframe" & "endframe" will play.
- Use "renderRadius" for models larger than a player if you notice them disappearing when moving the camera.
- Use "rootbone" if wanting to change the root bone that the animation will play from. 

Now whenever I have 3x Kyles animating in a very small basic test map, my FPS dips from 60 to 49 unless I look away. Something I've missed or done wrong perhaps...... @@Xycaleth @@ensiform @@eezstreet

 

Would I need to precache it?

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);

	//DT EDIT: misc_model_ghoul edits - START
	//ent->s.radius = 50;

	if (ent->playerModel >= 0)
	{
		ent->rootBone = gi.G2API_GetBoneIndex(&ent->ghoul2[ent->playerModel], "model_root", qtrue);
	}

	G_SpawnInt("renderRadius", "120", &ent->s.radius);
	//DT EDIT: misc_model_ghoul edits - END

	G_SetOrigin( ent, ent->s.origin );
	G_SetAngles( ent, ent->s.angles );

	qboolean bHasScale = G_SpawnVector( "modelscale_vec", "1 1 1", 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];
		ent->mins[0] *= ent->s.modelScale[0];

		//scale the y axis of the bbox up.
		ent->maxs[1] *= ent->s.modelScale[1];
		ent->mins[1] *= ent->s.modelScale[1];

		//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: misc_model_ghoul edits - START
	G_SpawnInt("startframe", "0", &ent->startFrame);
	G_SpawnInt("endframe", "0", &ent->endFrame);

	char	*root_boneName;//[MAX_QPATH];
	G_SpawnString("rootbone", "model_root", &root_boneName);
	gi.G2API_SetBoneAnim(&ent->ghoul2[0], root_boneName, ent->startFrame, ent->endFrame, BONE_ANIM_OVERRIDE_LOOP, 1.0f + Q_flrand(-1.0f, 1.0f) * 0.1f, 0, -1, -1);

	ent->endFrame = 0; // don't allow it to do anything with the animation function in G_main

	char	*skinName;//[MAX_QPATH];
	int skin = gi.RE_RegisterSkin(skinName);

	G_SpawnString("skin", "models/players/kyle/model_default.skin", &skinName);

	gi.G2API_SetSkin(&ent->ghoul2[ent->playerModel], G_SkinIndex(skinName), skin);

	//DT EDIT: misc_model_ghoul edits - END

	gi.linkentity (ent);
#else
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...