Crouching sprites for players with >1 sprite type

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Enjay
 
 
Posts: 27158
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Crouching sprites for players with >1 sprite type

Post by Enjay »

The basic crouch sprite definition merely specifies the name of the sprites to be used in place of the normal ones when the player is crouched.

eg, the default

Player.CrouchSprite "PLYC"

replaces every PLAY sprite with a matching equivalent PLYC sprite whenever the player is crouched.

As far as I can tell, there is no way to tell the game to use different crouch sprites based on which ones are used in the normal player. Specifically, I have a complicated player definition that needs more than the standard number of Doom sub-sprites (ie more than A-Z+[\]) and the way to do this would be to use different sprite names for different parts of the player definition. Ideally, something like

Player.CrouchSprite "crouchname", "normalname"

would solve this problem but I don't think it exists.

eg

Player.CrouchSprite "PLYC", "PLAY"
Player.CrouchSprite "PLC1", "PLY1"
Player.CrouchSprite "PLC2", "PLY2"

So I'm wondering is there a different way to achieve what I want?
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Crouching sprites for players with >1 sprite type

Post by Nash »

I remember having a similar problem waaay back when crouching was first introduced and Graf simply said that the system that's in right now is all we'll ever get.

Psst... Enjay... maybe it's time for you to write a looooong rant PM to Graf again. ;) ;) ;)
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Crouching sprites for players with >1 sprite type

Post by NeuralStunner »

Hmm, well I was curious so I looked into ACS functions and found [wiki]GetActorViewHeight[/wiki]:
Wiki wrote: For a player, this corresponds to the Player.ViewHeight property, modified by crouching if needs be.
So here's an odd (hacky) idea: Could you define no CrouchSprite, and instead supply a second set of sprites, which are the sprites you want for crouching but stretched 2x vertically? Then using a global script called from Decorate, check every tic (!) whether the player's ViewHeight is lower than it should be. If so, give them an Inventory-based flag to chck for. This would be a pain for complex player definitions, especially for the animated states to run "uninterrupted". And there might be the occasional visible jump from the squished standing sprite to the correct crouch sprite. It would also be computationally intensive...

Personally, I think your sprite-for-sprite approach would be a good one. I know I would certainly use it... That would cut away the limits of class spriting, as one could supply frames for different weapons, or have a single character that can change class and appearance.
Nash wrote:I remember having a similar problem waaay back when crouching was first introduced and Graf simply said that the system that's in right now is all we'll ever get.
Wistful sigh.
Locked

Return to “Editing (Archive)”