diff --git a/src/r_things.cpp b/src/r_things.cpp index 148bf7d61..9bca7cc1a 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -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 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(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;