mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
HUD model tweaks:
- Look up HUD models by referencing the psprite's caller, rather than player's ReadyWeapon. - Allow Strife hands psprite to be a model.
This commit is contained in:
parent
f34258281f
commit
888eab3063
2 changed files with 10 additions and 5 deletions
|
@ -183,7 +183,7 @@ void RenderModel(FModelRenderer *renderer, float x, float y, float z, FSpriteMod
|
|||
void RenderHUDModel(FModelRenderer *renderer, DPSprite *psp, float ofsX, float ofsY)
|
||||
{
|
||||
AActor * playermo = players[consoleplayer].camera;
|
||||
FSpriteModelFrame *smf = FindModelFrame(playermo->player->ReadyWeapon->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
|
||||
FSpriteModelFrame *smf = FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
|
||||
|
||||
// [BB] No model found for this sprite, so we can't render anything.
|
||||
if (smf == nullptr)
|
||||
|
@ -216,7 +216,7 @@ void RenderHUDModel(FModelRenderer *renderer, DPSprite *psp, float ofsX, float o
|
|||
renderer->BeginDrawHUDModel(playermo->RenderStyle, objectToWorldMatrix, orientation < 0);
|
||||
uint32_t trans = psp->GetTranslation() != 0 ? psp->GetTranslation() : 0;
|
||||
if ((psp->Flags & PSPF_PLAYERTRANSLATED)) trans = psp->Owner->mo->Translation;
|
||||
RenderFrameModels(renderer, playermo->Level, smf, psp->GetState(), psp->GetTics(), playermo->player->ReadyWeapon->GetClass(), trans);
|
||||
RenderFrameModels(renderer, playermo->Level, smf, psp->GetState(), psp->GetTics(), psp->Caller->GetClass(), trans);
|
||||
renderer->EndDrawHUDModel(playermo->RenderStyle);
|
||||
}
|
||||
|
||||
|
@ -780,12 +780,17 @@ bool IsHUDModelForPlayerAvailable (player_t * player)
|
|||
if (player == nullptr || player->ReadyWeapon == nullptr)
|
||||
return false;
|
||||
|
||||
DPSprite *psp = player->FindPSprite(PSP_WEAPON);
|
||||
// [MK] allow the Strife burning hands to be a model...
|
||||
DPSprite *psp = player->FindPSprite(PSP_STRIFEHANDS);
|
||||
|
||||
// [MK] ...otherwise, check for the weapon psprite as per usual
|
||||
if (psp == nullptr)
|
||||
psp = player->FindPSprite(PSP_WEAPON);
|
||||
|
||||
if (psp == nullptr)
|
||||
return false;
|
||||
|
||||
FSpriteModelFrame *smf = FindModelFrame(player->ReadyWeapon->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
|
||||
FSpriteModelFrame *smf = FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
|
||||
return ( smf != nullptr );
|
||||
}
|
||||
|
||||
|
|
|
@ -614,7 +614,7 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area)
|
|||
for (DPSprite *psp = player->psprites; psp != nullptr && psp->GetID() < PSP_TARGETCENTER; psp = psp->GetNext())
|
||||
{
|
||||
if (!psp->GetState()) continue;
|
||||
FSpriteModelFrame *smf = playermo->player->ReadyWeapon ? FindModelFrame(playermo->player->ReadyWeapon->GetClass(), psp->GetSprite(), psp->GetFrame(), false) : nullptr;
|
||||
FSpriteModelFrame *smf = FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
|
||||
// This is an 'either-or' proposition. This maybe needs some work to allow overlays with weapon models but as originally implemented this just won't work.
|
||||
if (smf && !hudModelStep) continue;
|
||||
if (!smf && hudModelStep) continue;
|
||||
|
|
Loading…
Reference in a new issue