Jump to content

(SP) Loading of a "modder GLA"


DT85

Recommended Posts

So I've figured out how to load another GLA ontop of the base _humanoid GLA and the cinematic map GLA. Here's the code:

 

NPC_stats.cpp - Game

Find line "if (Q_stricmp(skeletonName, "_humanoid")==0)" and put this in after the cinematic GLA stuff.

			// loading the "modder" animation GLA for new animations, so animators don't need to edit the base _humanoid GLA.
			char  _humanoid_mod1Name[MAX_QPATH];
			Com_sprintf(_humanoid_mod1Name, MAX_QPATH, "_humanoid_mod1");

			const int mod1_animsGLAIndex = gi.G2API_PrecacheGhoul2Model(va("models/players/%s/%s.gla", _humanoid_mod1Name, _humanoid_mod1Name));
			if (mod1_animsGLAIndex)
			{
				assert(mod1_animsGLAIndex == normalGLAIndex + 2);
				if (mod1_animsGLAIndex != normalGLAIndex + 2)
				{
					Com_Error(ERR_DROP, "_humanoid_mod1 GLA was not loaded after the normal GLA.  Cannot continue safely.");
				}
				G_ParseAnimationFile(2, _humanoid_mod1Name, fileIndex);
				G_ParseAnimationEvtFile(2, _humanoid_mod1Name, fileIndex, mod1_animsGLAIndex, false/*flag for model specific*/);
			}

tr_ghoul2.cpp - Renderer

Find line "if (!strcmp(mdxm->animName,"models/players/_humanoid/_humanoid"))" and put this in after the cinematic GLA code.

		// loading the "modder" animation GLA for new animations, so animators don't need to edit the base _humanoid GLA.
		RE_RegisterModel("models/players/_humanoid_mod1/_humanoid_mod1.gla");	

This "modder GLA" takes preference over the base _humanoid & cinematic GLAs in-game, so modders can do easy animation replacements. You can make stance mods or add new animations (would need code edits obviously for new animations) without having to touch the base _humanoid GLA.

Kualan, ent, Archangel35757 and 4 others like this
Link to comment

Long answer: The initial thought was to have an easier way for modders to add new animation in (though it would require code edits for them to be added to the animtable, and to actually do something). But I noticed that the last appended GLA will override the main GLA's (and any other previously appended GLAs) animation, which is great because people like to make stance mods.

 

Short answer: It works to add and/or replace animations.

 

 

Side note: Might be possible to do this per class, not sure.

Link to comment

@@DT85, when you say it overrides previous GLA's... you are saying you could have a "melee.gla" that would override existing melee animations and ADD new melee animations (as long as the new ones are added to the anims.h list)? So it only requires compiling the "delta" animations?

 

@@eezstreet, @@mrwonko -- could we externalize the anims.h animation list so that it is read by the compiled game code from an external txt file? This would allow for easier animation modding, right?

Link to comment

Yes, it would override the existing animation in either the base _humanoid.gla or a previously appended GLA.

 

What would be the point of making anims.h external? Any new animations would still need to be coded in to actually do something, unless of course you mean for ICARUS where you can just play an animation.

Link to comment

@@DT85, @@eezstreet - all animations from any appended custom.gla have to be added in anims.h correct? That means you have to recompile the full game code. It would be nicer, easier if modding of anims.h was externalized so it would not require recompiling the game code. Right?

Right but for most purposes you can just use BOTH_CIN_x animations which can be loaded on a per-map basis and used by ICARUS. There's like 50 of them so unless you need more, you don't really need to touch the game code to add new animations which are usable by ICARUS. Anything else (extra death animations for example) would have to be added through code, and I assume it's not a problem for someone to recompile the game code there.

 

Having something like a modder GLA allows you to have an extra set of overrides per player model.

Link to comment

what I'd like to do with this is break up the main gla into parts like so:

 

- Core (runs, walks, crouch walks, jumps, stands, idles, deaths, legs, swims, face)

- Guns (all gun animations)

- Saber (all saber animations)

- Force (all force animations, including acrobatics)

- Misc (any animations that do not fit in any other category)

Link to comment

@@DT85 - yeah but would that approach allow you to expand any of the individual GLA files and not impact the start/stop frames of the others? I guess it would not impact others, as each GLA would have it's own config file...

 

...add a Melee category for all hand-to-hand combat fighting. Also, I would suggest all acrobatics be in the Core.gla since they can be used for melee, etc.

Link to comment

It would end up the exact same as it is now game-wise, just that it's split up into parts for easier modding. Personally, I'd rather just have every animation loose like Quake 4 does with MD5anim but I'm pretty sure this appending code has some sort of memory limitations and appending 1,000+ GLA's would kill something. :lol:

Link to comment
  • 2 weeks later...

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...