Add PSPF_PLAYERTRANSLATED flag (makes a PSprite layer translated to the user's color)

This commit is contained in:
Cacodemon345 2019-09-01 14:04:53 +06:00 committed by Christoph Oelckers
parent 55e482d0fc
commit 7fd27bc925
6 changed files with 7 additions and 3 deletions

View file

@ -140,6 +140,7 @@ DEFINE_FIELD_BIT(DPSprite, Flags, bPowDouble, PSPF_POWDOUBLE)
DEFINE_FIELD_BIT(DPSprite, Flags, bCVarFast, PSPF_CVARFAST)
DEFINE_FIELD_BIT(DPSprite, Flags, bFlip, PSPF_FLIP)
DEFINE_FIELD_BIT(DPSprite, Flags, bMirror, PSPF_MIRROR)
DEFINE_FIELD_BIT(DPSprite, Flags, bPlayerTranslated, PSPF_PLAYERTRANSLATED)
//------------------------------------------------------------------------
//

View file

@ -68,6 +68,7 @@ enum PSPFlags
PSPF_FORCEALPHA = 1 << 7,
PSPF_FORCESTYLE = 1 << 8,
PSPF_MIRROR = 1 << 9,
PSPF_PLAYERTRANSLATED = 1 << 10
};
class DPSprite : public DObject

View file

@ -211,7 +211,7 @@ void FModelRenderer::RenderHUDModel(DPSprite *psp, float ofsX, float ofsY)
float orientation = smf->xscale * smf->yscale * smf->zscale;
BeginDrawHUDModel(playermo, objectToWorldMatrix, orientation < 0);
RenderFrameModels(playermo->Level, smf, psp->GetState(), psp->GetTics(), playermo->player->ReadyWeapon->GetClass(), 0);
RenderFrameModels(playermo->Level, smf, psp->GetState(), psp->GetTics(), playermo->player->ReadyWeapon->GetClass(), psp->Flags & PSPF_PLAYERTRANSLATED ? psp->Owner->mo->Translation : 0);
EndDrawHUDModel(playermo);
}

View file

@ -95,7 +95,7 @@ void HWDrawInfo::DrawPSprite(HUDSprite *huds, FRenderState &state)
{
float thresh = (huds->tex->tex->GetTranslucency() || huds->OverrideShader != -1) ? 0.f : gl_mask_sprite_threshold;
state.AlphaFunc(Alpha_GEqual, thresh);
state.SetMaterial(huds->tex, CLAMP_XY_NOMIP, 0, huds->OverrideShader);
state.SetMaterial(huds->tex, CLAMP_XY_NOMIP, (huds->weapon->Flags & PSPF_PLAYERTRANSLATED) ? huds->owner->Translation : 0, huds->OverrideShader);
state.Draw(DT_TriangleStrip, huds->mx, 4);
}

View file

@ -2543,7 +2543,8 @@ class PSprite : Object native play
native bool bCVarFast;
native bool bFlip;
native bool bMirror;
native bool bPlayerTranslated;
native void SetState(State newstate, bool pending = false);
//------------------------------------------------------------------------

View file

@ -748,6 +748,7 @@ enum EPSpriteFlags
PSPF_FORCEALPHA = 1 << 7,
PSPF_FORCESTYLE = 1 << 8,
PSPF_MIRROR = 1 << 9,
PSPF_PLAYERTRANSLATED = 1 << 10
};
// Default psprite layers