Skip to content

Commit

Permalink
apply weaponscale relative to baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
XaserAcheron committed Nov 15, 2021
1 parent 0b93aef commit 441b700
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/rendering/hwrenderer/scene/hw_weapon.cpp
Expand Up @@ -411,6 +411,7 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
float tx;
float scale;
float scalex;
float ftextureadj;
float ftexturemid;

// decide which patch to use
Expand Down Expand Up @@ -445,7 +446,8 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
x2 += viewwindowx;

// killough 12/98: fix psprite positioning problem
ftexturemid = 100.f - sy - r.top - psp->GetYAdjust(screenblocks >= 11);
ftextureadj = (120.0f / psp->baseScale.Y) - 100.0f; // [XA] scale relative to weapon baseline
ftexturemid = 100.f - sy - r.top - psp->GetYAdjust(screenblocks >= 11) - ftextureadj;

// [XA] note: Doom's native 1.2x aspect ratio was originally
// handled here by multiplying SCREENWIDTH by 200 instead of
Expand Down
3 changes: 2 additions & 1 deletion src/rendering/swrenderer/things/r_playersprite.cpp
Expand Up @@ -293,7 +293,8 @@ namespace swrenderer
vis.renderflags = owner->renderflags;

FSoftwareTexture* stex = GetSoftwareTexture(tex);
vis.texturemid = (BASEYCENTER - sy) * stex->GetScale().Y + stex->GetTopOffset(0);
double textureadj = (120.0f / pspr->baseScale.Y) - BASEYCENTER; // [XA] scale relative to weapon baseline
vis.texturemid = (BASEYCENTER - sy - textureadj) * stex->GetScale().Y + stex->GetTopOffset(0);

// Force it to use software rendering when drawing to a canvas texture.
bool renderToCanvas = viewport->RenderingToCanvas;
Expand Down

0 comments on commit 441b700

Please sign in to comment.