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?)
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, [url=https://github.com/coelckers/gzdoom/blob/f1a6ef9cc85e51a9f42b85dcbffc1eb495a41132/src/p_user.cpp#L1892]here is the code as it is now[/url]:[code=php]// 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;
}
}[/code]The problem is that, instead of simply checking for [i]whether there is a crouchsprite available[/i], 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?)