Change A_OverlayTranslation to accept a named translation instead. (#1215)
For more advanced use cases, the Translation member of PSprite can be written to directly.
This commit is contained in:
parent
7bea14e6b2
commit
cfbf115c4b
2 changed files with 17 additions and 3 deletions
|
|
@ -754,7 +754,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayTranslation)
|
|||
{
|
||||
PARAM_ACTION_PROLOGUE(AActor);
|
||||
PARAM_INT(layer);
|
||||
PARAM_UINT(trans);
|
||||
PARAM_NAME(trname);
|
||||
|
||||
if (!ACTION_CALL_FROM_PSPRITE())
|
||||
return 0;
|
||||
|
|
@ -762,7 +762,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayTranslation)
|
|||
DPSprite* pspr = self->player->FindPSprite(((layer != 0) ? layer : stateinfo->mPSPIndex));
|
||||
if (pspr != nullptr)
|
||||
{
|
||||
pspr->Translation = trans;
|
||||
// There is no constant for the empty name...
|
||||
if (trname.GetChars()[0] == 0)
|
||||
{
|
||||
// an empty string resets to the default
|
||||
// (unlike AActor::SetTranslation, there is no Default block for PSprites, so just set the translation to 0)
|
||||
pspr->Translation = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tnum = R_FindCustomTranslation(trname);
|
||||
if (tnum >= 0)
|
||||
{
|
||||
pspr->Translation = tnum;
|
||||
}
|
||||
// silently ignore if the name does not exist, this would create some insane message spam otherwise.
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue