- fixed weapon-based Psprite adjustment to always use the weapon this was called from and make non-weapon specific checks only exclude the targeter.

This commit is contained in:
Christoph Oelckers 2016-06-17 14:14:35 +02:00
parent 574f2936d4
commit 018615ca0d
1 changed files with 4 additions and 11 deletions

View File

@ -1292,7 +1292,6 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
FTexture* tex; FTexture* tex;
vissprite_t* vis; vissprite_t* vis;
bool noaccel; bool noaccel;
bool isweapon;
static TArray<vissprite_t> avis; static TArray<vissprite_t> avis;
if (avis.Size() < vispspindex + 1) if (avis.Size() < vispspindex + 1)
@ -1319,8 +1318,6 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
if (tex->UseType == FTexture::TEX_Null) if (tex->UseType == FTexture::TEX_Null)
return; return;
isweapon = pspr->GetCaller()->IsKindOf(RUNTIME_CLASS(AWeapon));
if (pspr->firstTic) if (pspr->firstTic)
{ // Can't interpolate the first tic. { // Can't interpolate the first tic.
pspr->firstTic = false; pspr->firstTic = false;
@ -1371,12 +1368,8 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
viewheight == RenderTarget->GetHeight() || viewheight == RenderTarget->GetHeight() ||
(RenderTarget->GetWidth() > (BASEXCENTER * 2) && !st_scale))) (RenderTarget->GetWidth() > (BASEXCENTER * 2) && !st_scale)))
{ // Adjust PSprite for fullscreen views { // Adjust PSprite for fullscreen views
AWeapon *weapon = nullptr; AWeapon *weapon = dyn_cast<AWeapon>(pspr->GetCaller());
if (camera->player != nullptr) if (weapon != nullptr && weapon->YAdjust != 0)
{
weapon = camera->player->ReadyWeapon;
}
if (isweapon && weapon != nullptr && weapon->YAdjust != 0)
{ {
if (RenderTarget != screen || viewheight == RenderTarget->GetHeight()) if (RenderTarget != screen || viewheight == RenderTarget->GetHeight())
{ {
@ -1388,7 +1381,7 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
} }
} }
} }
if (isweapon) if (pspr->GetID() < PSP_TARGETCENTER)
{ // Move the weapon down for 1280x1024. { // Move the weapon down for 1280x1024.
vis->texturemid -= BaseRatioSizes[WidescreenRatio][2]; vis->texturemid -= BaseRatioSizes[WidescreenRatio][2];
} }
@ -1416,7 +1409,7 @@ void R_DrawPSprite(DPSprite *pspr, AActor *owner, float bobx, float boby, double
noaccel = false; noaccel = false;
FDynamicColormap *colormap_to_use = nullptr; FDynamicColormap *colormap_to_use = nullptr;
if (isweapon) if (pspr->GetID() < PSP_TARGETCENTER)
{ {
vis->Style.Alpha = float(owner->Alpha); vis->Style.Alpha = float(owner->Alpha);
vis->Style.RenderStyle = owner->RenderStyle; vis->Style.RenderStyle = owner->RenderStyle;