- 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

View file

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