Expose crouched player squashing to ZScript

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Expose crouched player squashing to ZScript

Re: Expose crouched player squashing to ZScript

by Matt » Thu Jun 21, 2018 10:31 am

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

Re: Expose crouched player squashing to ZScript

by Matt » Mon Aug 07, 2017 8: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).

Re: Expose crouched player squashing to ZScript

by Graf Zahl » Mon Aug 07, 2017 3: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.

Re: Expose crouched player squashing to ZScript

by NeuralStunner » Mon Aug 07, 2017 1: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.

Expose crouched player squashing to ZScript

by Matt » Fri Aug 04, 2017 11:59 pm

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?)

Top