A Duke Corpse Flag

Moderator: GZDoom Developers

User avatar
TXTX
Posts: 195
Joined: Thu Sep 12, 2013 5:53 pm
Location: A Hidden Location

A Duke Corpse Flag

Post by TXTX »

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.
User avatar
Enjay
 
 
Posts: 27031
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: A Duke Corpse Flag

Post by Enjay »

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

Post by Ed the Bat »

A_SetScale(-scalex,scaley) should mirror it. Maybe use that with a Jump to randomize it.
User avatar
Ethril
Posts: 2677
Joined: Sun Nov 16, 2008 2:59 am
Location: with you in the dark

Re: A Duke Corpse Flag

Post by Ethril »

Ed the Bat wrote:A_SetScale(-scalex,scaley) should mirror it. Maybe use that with a Jump to randomize it.
Just make sure you revert it during the Raise state (if applicable) otherwise things start to look weird. ;)

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
 }
}
User avatar
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

Post by wildweasel »

And yet, the only thing I see here is the missed opportunity that someone should have named their example actor "Flimp." =P
Blzut3
 
 
Posts: 3204
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: A Duke Corpse Flag

Post by Blzut3 »

Simpler version:

Code: Select all

Death:
  "####" "#" 0 A_SetScale(random(0,1)*2-1, 1)
  goto Super::Death
If only negative scales worked?
User avatar
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

Post by Ed the Bat »

Blzut3 wrote:If only negative scales worked?
They do. That's how I randomly flip actor's sprites.
Blzut3
 
 
Posts: 3204
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: A Duke Corpse Flag

Post by Blzut3 »

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

Post by Ed the Bat »

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.
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.
EDIT: I figured it out! This negative scale trick only works in GL mode. Software doesn't allow it.
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: A Duke Corpse Flag

Post by Blue Shadow »

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.
User avatar
TXTX
Posts: 195
Joined: Thu Sep 12, 2013 5:53 pm
Location: A Hidden Location

Re: A Duke Corpse Flag

Post by TXTX »

Wow this works! :shock:

Never thought of negative scaling. Impressive!
User avatar
TheMightyHeracross
Posts: 2100
Joined: Sun Aug 18, 2013 9:41 am
Location: Philadelphia, PA

Re: A Duke Corpse Flag

Post by TheMightyHeracross »

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.
User avatar
Nash
 
 
Posts: 17496
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: A Duke Corpse Flag

Post by Nash »

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)
User avatar
Enjay
 
 
Posts: 27031
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: A Duke Corpse Flag

Post by Enjay »

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.
User avatar
TXTX
Posts: 195
Joined: Thu Sep 12, 2013 5:53 pm
Location: A Hidden Location

Re: A Duke Corpse Flag

Post by TXTX »

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.

Code: Select all

VILE Y 0
VILE Z 0
VILE [ 0
VILE \ 0
VILE ] 0
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.
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.
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.

Code: Select all

A_SetScale((random(0,1)*2-1)*ScaleX, ScaleY)
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”