A Duke Corpse Flag
Moderator: GZDoom Developers
A Duke Corpse Flag
What about a flag called +DUKEMIRRORED or something that about half of the time will mirror the actor's death sprites? It would be simpler than adding more frames to sprites along with making more frame room for them.
Re: A Duke Corpse Flag
If this doesn't get added, you may find this useful:
You don't need to actually provide mirrored sprites. You can use the engine to do the mirroring for you if you name the sprites appropriately.
e.g. If you make sprites named
SPRTA0E0
SPRTB0F0
SPRTC0G0
SPRTD0H0
and have the following state sequences in your DECORATE:
StateNameWhatever1:
SPRT ABC 3
SPRT D -1
Stop
StateNameWhatever2:
SPRT EFG 3
SPRT H -1
Stop
The two sequences will use the same graphics but StateNameWhatever2 will mirror them.
You don't need to actually provide mirrored sprites. You can use the engine to do the mirroring for you if you name the sprites appropriately.
e.g. If you make sprites named
SPRTA0E0
SPRTB0F0
SPRTC0G0
SPRTD0H0
and have the following state sequences in your DECORATE:
StateNameWhatever1:
SPRT ABC 3
SPRT D -1
Stop
StateNameWhatever2:
SPRT EFG 3
SPRT H -1
Stop
The two sequences will use the same graphics but StateNameWhatever2 will mirror them.
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Re: A Duke Corpse Flag
A_SetScale(-scalex,scaley) should mirror it. Maybe use that with a Jump to randomize it.
Re: A Duke Corpse Flag
Just make sure you revert it during the Raise state (if applicable) otherwise things start to look weird.Ed the Bat wrote:A_SetScale(-scalex,scaley) should mirror it. Maybe use that with a Jump to randomize it.

basically, do something like this
Code: Select all
actor FlipImp : DoomImp replaces DoomImp
{
states
{
Death:
TROO I 0 A_Jump(128,"Flippity")
goto Super::Death
Flippity:
TROO I 0 A_SetScale(-1.0,1.0)
goto Super::Death
Raise:
TROO I 0 A_SetScale(1.0,1.0)
goto Super::Raise
}
}
- wildweasel
- Posts: 21706
- Joined: Tue Jul 15, 2003 7:33 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): A lot of them
- Graphics Processor: Not Listed
- Contact:
Re: A Duke Corpse Flag
And yet, the only thing I see here is the missed opportunity that someone should have named their example actor "Flimp." =P
-
-
- Posts: 3204
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: A Duke Corpse Flag
Simpler version:
If only negative scales worked?
Code: Select all
Death:
"####" "#" 0 A_SetScale(random(0,1)*2-1, 1)
goto Super::Death
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Re: A Duke Corpse Flag
They do. That's how I randomly flip actor's sprites.Blzut3 wrote:If only negative scales worked?
-
-
- Posts: 3204
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: A Duke Corpse Flag
Interesting. I'm getting invisible actors when I set the scale negative. Didn't think too much about it since the wiki claims only positive values are legal for the xscale property.
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Re: A Duke Corpse Flag
I... don't know what to tell ya. Calling A_SetScale(-xscale,yscale) produces a horizontally-flipped duplicate of what my actor would normally look like.Blzut3 wrote:Interesting. I'm getting invisible actors when I set the scale negative. Didn't think too much about it since the wiki claims only positive values are legal for the xscale property.
EDIT: I figured it out! This negative scale trick only works in GL mode. Software doesn't allow it.
-
- Posts: 5043
- Joined: Sun Nov 14, 2010 12:59 am
Re: A Duke Corpse Flag
I'm interested to know if this trick is actually "legally"supported by the OpenGL renderer and is not some kind of an undefined behavior.
Re: A Duke Corpse Flag
Wow this works!
Never thought of negative scaling. Impressive!

Never thought of negative scaling. Impressive!
- TheMightyHeracross
- Posts: 2100
- Joined: Sun Aug 18, 2013 9:41 am
- Location: Philadelphia, PA
Re: A Duke Corpse Flag
You shouldn't use that method, because it only works in GL, and screws regular ZDoom users over. Use the original way suggested by Enjay.
Re: A Duke Corpse Flag
Best to ask Randi if negative scale is officially supported or not and the fact that it only works in OpenGL is a bug or not. Could be a legit feature that somehow managed to not work due to an oversight in the software renderer (it's happened before - if I remember correctly - with regards to texture mirroring; they were reported by MaxEd IIRC)
Re: A Duke Corpse Flag
FWiW, the reason I wasn't using negative scaling and was using the sprite naming instead was mainly because I was already applying random scale factors to my own enemies in their spawn state to randomise the size of the enemies slightly.
However, I hope that -ve scaling is allowed because I've been using that on special effects like smoke clouds and so on.
As far as I know the sprite naming version should work even in vanilla (although I'm not sure how you'd get it to randomly pick a death state). If you look at the sprite naming for the hell knight, arachnotron and spiderdemon they basically do this for some of their frames.
However, I hope that -ve scaling is allowed because I've been using that on special effects like smoke clouds and so on.
As far as I know the sprite naming version should work even in vanilla (although I'm not sure how you'd get it to randomly pick a death state). If you look at the sprite naming for the hell knight, arachnotron and spiderdemon they basically do this for some of their frames.
Re: A Duke Corpse Flag
I have used sprite mirroring the original way but with some actors having a lot of sprites I was looking for another method.
By not having enough room I mean like the archvile's sprites where he goes all the way to a-z and then to slashes with the fifth letter.
Isn't the sprite letter limit from a-z and "[\]"?
Seems the only way to add mirrored deaths for actors with a lot of sprites is to duplicate and rename them for full compatibility if i'm not mistaken.
By not having enough room I mean like the archvile's sprites where he goes all the way to a-z and then to slashes with the fifth letter.
Code: Select all
VILE Y 0
VILE Z 0
VILE [ 0
VILE \ 0
VILE ] 0
Seems the only way to add mirrored deaths for actors with a lot of sprites is to duplicate and rename them for full compatibility if i'm not mistaken.
Also i edited the code a bit to keep up with the actor's unique scales for my mod. Should help if you need it.Enjay wrote:FWiW, the reason I wasn't using negative scaling and was using the sprite naming instead was mainly because I was already applying random scale factors to my own enemies in their spawn state to randomise the size of the enemies slightly.
Code: Select all
A_SetScale((random(0,1)*2-1)*ScaleX, ScaleY)