m8f wrote:Because these monsters are asymmetric, and it will look wrong if the monster weapon flips to the other hand on death animation.
About flipping monsters from the start - I simply didn't think about that.
// Flip
let flip = random(0, 1);
if (flip == 1)
{
a.A_SetScale(-a.Scale.X, a.Scale.Y);
}
bLUEbYTE wrote:All looking good to me, including chaingunner death animations, and they do come back with the correct orientation if revived. I guess the engine doesn't clear the actor's sprite scaling values when it becomes a corpse, rendering all the Inventory stuff unnecessary. But if I'm missing something here, let me know.
TNT1 A 0 A_SpawnItem("DeadZombieman1")
class df_EventHandler : EventHandler
{
// public: // EventHandler /////////////////////////////////////////////////////
override
void OnRegister()
{
blacklist = new("df_StringSet").init();
}
override
void WorldThingDied(WorldEvent event)
{
let thing = event.thing;
if (thing == NULL) { return; }
if (blacklist.contains(thing.GetClassName())) { return; }
bool flipped = df_alternate
? (isPrevFlipped = !isPrevFlipped)
: random(0, 1);
if (flipped)
{
flip(thing);
}
}
override
void WorldThingRevived(WorldEvent event)
{
let thing = event.thing;
if (thing == NULL) { return; }
if (blacklist.contains(thing.GetClassName())) { return; }
thing.bXFLIP = false; //Might as well always clear the flag.
}
// public: /////////////////////////////////////////////////////////////////////
static
void flip(Actor thing)
{
thing.bXFLIP = true;
}
// private: /////////////////////////////////////////////////////////////////////
private df_StringSet blacklist;
private bool isPrevFlipped;
}
Users browsing this forum: No registered users and 2 guests