[Duplicate] Expose crouched player squashing to ZScript

Moderator: GZDoom Developers

Expose crouched player squashing to ZScript

Postby Matt » Sat Aug 05, 2017 12:59 am

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 allExpand view
// 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.*= 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 Wed Aug 09, 2017 12:39 am, edited 2 times in total.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Expose crouched player squashing to ZScript

Postby NeuralStunner » Mon Aug 07, 2017 2:51 pm

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
NeuralStunner
Cuddly but Packin'
 
 
 
Joined: 21 Jul 2009
Location: Indiana, USA
Discord: NeuralStunner#1293
Operating System: Windows Vista/7 64-bit

Re: Expose crouched player squashing to ZScript

Postby Graf Zahl » Mon Aug 07, 2017 4:53 pm

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
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Expose crouched player squashing to ZScript

Postby Matt » Mon Aug 07, 2017 9:39 pm

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
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Expose crouched player squashing to ZScript

Postby Matt » Thu Jun 21, 2018 11:31 am

Overriding crouchsprite dynamically seems to work now so I think this suggestion should be closed.
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 2 guests