[ZScript] Universal mirrored deaths
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
-
-
- Posts: 1446
- Joined: Fri Dec 29, 2017 4:15 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Manjaro Linux
- Location: Siberia (UTC+7)
[ZScript] Universal mirrored deaths
Download
Source code
Features
- 50% chance of death animation being mirrored horizontally.
- raising animations are flipped too.
- works with any game and mod (hopefully).
- blacklist to exclude specific monsters from mirroring.
- bonus feature: alternating mirroring (controlled by df_alternate CVar).
Can be included in mods, or used as an addon by itself.
This mod is a part of m8f's toolbox.
Last edited by m8f on Tue Sep 22, 2020 11:06 am, edited 1 time in total.
-
- Posts: 160
- Joined: Fri Nov 15, 2019 4:28 am
- Graphics Processor: Intel with Vulkan/Metal Support
- Location: Australia
Re: [ZScript] Universal mirrored deaths
I love non-intrusive mini mods like this that add variety.
-
- Posts: 160
- Joined: Fri Nov 15, 2019 4:28 am
- Graphics Processor: Intel with Vulkan/Metal Support
- Location: Australia
Re: [ZScript] Universal mirrored deaths
Hi m8f,
I added this into my Universal Entropy mod. Two questions;
Why did you need to blacklist chaingunguy and cyberdemon from being flipped? In my testing flipped bodies for these look just fine.
Why not go further and flip the sprites on Spawn, to create left/right handed variants? As far as I can tell, the projectiles do not originate from the arms anyway. For example, Cyberdemon's rockets seem to fly off his belly.
I added this into my Universal Entropy mod. Two questions;
Why did you need to blacklist chaingunguy and cyberdemon from being flipped? In my testing flipped bodies for these look just fine.
Why not go further and flip the sprites on Spawn, to create left/right handed variants? As far as I can tell, the projectiles do not originate from the arms anyway. For example, Cyberdemon's rockets seem to fly off his belly.
-
-
- Posts: 1446
- Joined: Fri Dec 29, 2017 4:15 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Manjaro Linux
- Location: Siberia (UTC+7)
Re: [ZScript] Universal mirrored deaths
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.
About flipping monsters from the start - I simply didn't think about that.
-
- Posts: 160
- Joined: Fri Nov 15, 2019 4:28 am
- Graphics Processor: Intel with Vulkan/Metal Support
- Location: Australia
Re: [ZScript] Universal mirrored deaths
I replaced all the code in death-flip with this: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.
Code: Select all
// Flip
let flip = random(0, 1);
if (flip == 1)
{
a.A_SetScale(-a.Scale.X, a.Scale.Y);
}
Last edited by bLUEbYTE on Fri Oct 09, 2020 4:29 pm, edited 1 time in total.
-
- Posts: 199
- Joined: Fri May 11, 2018 2:39 pm
- Location: Canada
Re: [ZScript] Universal mirrored deaths
The issue would be if the monster's behaviour is related to its sprite. Consider a Cyberdemon that has been modified to shoot a rocket from its arm instead of its chest. If you mirror it on spawn, then when it fires, its animation will not match its behaviour anymore. If you could mirror EVERYTHING about the actor, including the behaviours, then this would be good, but I'm not sure that's actually possible in a generic way.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.
-
- Posts: 160
- Joined: Fri Nov 15, 2019 4:28 am
- Graphics Processor: Intel with Vulkan/Metal Support
- Location: Australia
Re: [ZScript] Universal mirrored deaths
Well, forget what I said above regarding my super simple 3-line flip code working fine... It doesn't. Although admittedly it looks pretty funny, it causes the monsters to moonwalk .
So I'm back to using m8f's full code in my mod. Lesson learned.
So I'm back to using m8f's full code in my mod. Lesson learned.
-
- Posts: 32
- Joined: Sun Oct 04, 2020 4:00 am
Re: [ZScript] Universal mirrored deaths
Any reason why it doesn't run well with the zombiemans in Brutal Doom? The deathpic is always default. I think its the same with the pinkies. Any way to fix it?
-
-
- Posts: 1446
- Joined: Fri Dec 29, 2017 4:15 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Manjaro Linux
- Location: Siberia (UTC+7)
Re: [ZScript] Universal mirrored deaths
I noticed that the death animation starts mirrored, and then flips back to default when a zombieman falls on the ground. It's because in Brutal Doom, at this moment dead bodies become invisible and spawn a new actor, for exampleProbably this is to make dead bodies shootable. It's a code design choice of Brutal Doom, I cannot fix it in my mod.
If you want Brutal Doom with mirrored shootable corpses, I can recommend BDLite with Universal Gibs.
Code: Select all
TNT1 A 0 A_SpawnItem("DeadZombieman1")
If you want Brutal Doom with mirrored shootable corpses, I can recommend BDLite with Universal Gibs.
-
- Posts: 64
- Joined: Fri Sep 04, 2020 8:08 pm
Re: [ZScript] Universal mirrored deaths
Out of curiosity was there a reason you chose to use scale.x over the XFLIP flag?
By using the flag method I was able to get the same result while completely eliminating the need for the inventory hack items. I used this script for df_EventHandler and was able to delete df_Unflipper and df_MirroredFlag by doing so:
By using the flag method I was able to get the same result while completely eliminating the need for the inventory hack items. I used this script for df_EventHandler and was able to delete df_Unflipper and df_MirroredFlag by doing so:
Code: Select all
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;
}
-
-
- Posts: 1446
- Joined: Fri Dec 29, 2017 4:15 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Manjaro Linux
- Location: Siberia (UTC+7)
Re: [ZScript] Universal mirrored deaths
There is no much difference between using of scale.x and XFLIP flag. With XFLIP, I'd had to use df_MirroredFlag and df_Unflipper too. The point is, with df_MirroredFlag and df_Unflipper I can save my own mirrored state for the actor. If some mod utilizes scale.x (or XFLIP) and I unconditionally override it, it may result in visual inconsistencies.