New function PimpModel to decorate models with cool client-side effects previously hard coded for certain models only.
Previously, only very specific hard coded models were allowed to cast light around (namely projectiles) or have a nice colored glow (like mana or torches). There were also all kinds of cool client effects (mainly trails for projectiles) triggerable through mdl flags only.
Now it's possible to add such effects to any model without having to give it a special hard coded name or fiddle with its flags in QME (whose latest version anyway doesn't give access to them anymore). Just a line of code in HexenC and that's it. 🙂
Supported features:
RGBA color used for glow and/or dynamically cast light
Offset vector to neatly position the glow origin from the model origin (notably useful for torches)
Glow radius
Light style (normal, pulsating, flickering, etc.) used for glow and/or dynamically cast light
Dynamically cast light radius
To test the game engine edit, here is the tailored new misc_modelpimp entity :
/*QUAKED misc_modelpimp by Inky (11/2021)
An entity able to pimp the properties of a model (like rotation, glow, dynamic light, etc.)
flags ignore the hard coded flags in the mdl file and use those instead
Caution : the value set in flags is ignored if the "Showcase flags" mode is active because of a targetname set
if so the flags value is handled by code automatically and each call to .use
applies a different flag value for flags testing purpose
*/
string FlagFriendlyNames[25] =
{
"_Rocket smoke trail",
"_Grenade smoke trail",
"_Gib long blood trail",
"_Rotate",
"_Scrag double green trail",
"_Zombie gib short blood trail",
"_Hellknight orange split trail",
"_Vore purple trail",
"_Fireball",
"_Ice trail",
"_Mipmap",
"_Ink spit",
"_Transparent sprite",
"_Vertical spray",
"_Holey (fence) texture",
"_Translucent",
"_Always facing player",
"_Bottom & top trail",
"_Slow staff move",
"_Blue/white magic drip",
"_Bone shards drip",
"_Scarab dust",
"_Acid ball",
"_Blood rain",
"_Far mipmap"
};
float modelpimp_showcase()
{
//Advance the flags for the next call
if(self.flags == 16777216)
{
self.walkframe = 0;
self.flags = 1; //We've come full circle, back to the beginning
}
else
{
self.walkframe = self.walkframe + 1;
if(self.flags == 0) self.flags = 1; else self.flags = self.flags * 2; //Next value
}
entity player = find (world, classname, "player");
centerprint(player,FlagFriendlyNames[self.walkframe]);
return pimpmodel(self, self.glow_color);
}
void modelpimp_think ()
{
pimpmodel(self, self.glow_color);
//Do it again later (a small delay is mandatory when (re)loading a map; trying to pimp the model right away would come too early and fail)
self.nextthink = time + self.wait;
}
void() misc_modelpimp =
{
precache_model(self.model);
setmodel(self, self.model);
self.effects(+)EF_NODRAW;
if(!self.wait) self.wait = 0.5;
if(self.targetname)
{
self.use = modelpimp_showcase;
self.walkframe = -1;
self.flags = 0;
}
self.think = modelpimp_think;
self.nextthink = time + self.wait;
}
Unrelated to what's above but also included in this PR:
PR_ExecuteProgram now taking an additional string parameter (the guilty function's name) to make error messages more helpful
SV_Physics_None made more robust against corner case notably caused by new liquid trains
SV_PushMove now supporting liquid trains (like raising water or lava) by not pushing things up but flooding them instead
New function PimpModel to decorate models with cool client-side effects previously hard coded for certain models only.
Previously, only very specific hard coded models were allowed to cast light around (namely projectiles) or have a nice colored glow (like mana or torches). There were also all kinds of cool client effects (mainly trails for projectiles) triggerable through mdl flags only. Now it's possible to add such effects to any model without having to give it a special hard coded name or fiddle with its flags in QME (whose latest version anyway doesn't give access to them anymore). Just a line of code in HexenC and that's it. 🙂
Supported features:
To test the game engine edit, here is the tailored new misc_modelpimp entity :
An its code :
Unrelated to what's above but also included in this PR: