Expose crouched player squashing to ZScript

Moderator: GZDoom Developers

Post Reply
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Expose crouched player squashing to ZScript

Post by Matt »

Right now there's no way to get around this crouchsprite check except to re-write all crouching from scratch.

Meanwhile, setting crouchsprite on the fly will not be honoured by this check and you end up with the squashed PLAY* sprite instead of whatever you had specified.


EDIT: For reference, here is the code as it is now:

Code: Select all

// Set the crouch sprite?
if (player->crouchfactor < 0.75)
{
    if (spritenum == actor->SpawnState->sprite || spritenum == player->mo->crouchsprite) 
    {
        crouchspriteno = player->mo->crouchsprite;
    }
    else if (!(actor->flags4 & MF4_NOSKIN) &&
            (spritenum == Skins[player->userinfo.GetSkin()].sprite ||
             spritenum == Skins[player->userinfo.GetSkin()].crouchsprite))
    {
        crouchspriteno = Skins[player->userinfo.GetSkin()].crouchsprite;
    }
    else
    { // no sprite -> squash the existing one
        crouchspriteno = -1;
    }

    if (crouchspriteno > 0) 
    {
        spritenum = crouchspriteno;
    }
    else if (player->playerstate != PST_DEAD && player->crouchfactor < 0.75)
    {
        scale.Y *= 0.5;
    }
}
The problem is that, instead of simply checking for whether there is a crouchsprite available, it checks for... I'm sorry but I can't even wrap my head around what the reasoning is for the way it's set up now. I'd really like to change this to something that makes more sense for what I'm trying to do, but presumably there's a legit compatibility reason for the current setup. (morphing, perhaps?)
Last edited by Matt on Tue Aug 08, 2017 11:39 pm, edited 2 times in total.
User avatar
NeuralStunner
 
 
Posts: 12325
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Expose crouched player squashing to ZScript

Post by NeuralStunner »

The squashing always annoyed the crud out of me: Having one sprite range for crouching is pointlessly restrictive as soon as you're doing anything Not Doom. Better if we can excise the squashing entirely and have as full a range of animations as we like.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Expose crouched player squashing to ZScript

Post by Graf Zahl »

The minor problem here is that the crouched player needs to run the same states as the uncrouched player. It cannot just duplicate all sequences with a different sprite and not cause some hiccups in the player movement code.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Expose crouched player squashing to ZScript

Post by Matt »

At this point all I want to do is to be able to swap out PLAY and PLYC for other sprite sets depending on the player's settings, without having to morph into another playerclass (with all the troubles and gross hack workarounds that implies).
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Expose crouched player squashing to ZScript

Post by Matt »

Overriding crouchsprite dynamically seems to work now so I think this suggestion should be closed.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”