From 9d73e4c635e57c445b7e3a025b4ba017cb8afe5d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 23 May 2017 09:37:38 +0200 Subject: [PATCH] - fixed errors in wallsprite setup for the classic software renderer: * it did not use the correct texture. * it had a math error in the right edge's y-coordinate calculation. --- src/swrenderer/scene/r_opaque_pass.cpp | 2 +- src/swrenderer/things/r_wallsprite.cpp | 5 ++--- src/swrenderer/things/r_wallsprite.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index 3d0e9a08a..9bdbd9aea 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -897,7 +897,7 @@ namespace swrenderer if ((sprite.renderflags & RF_SPRITETYPEMASK) == RF_WALLSPRITE) { - RenderWallSprite::Project(Thread, thing, sprite.pos, sprite.picnum, sprite.spriteScale, sprite.renderflags, thingShade, foggy, thingColormap); + RenderWallSprite::Project(Thread, thing, sprite.pos, sprite.tex, sprite.spriteScale, sprite.renderflags, thingShade, foggy, thingColormap); } else if (sprite.voxel) { diff --git a/src/swrenderer/things/r_wallsprite.cpp b/src/swrenderer/things/r_wallsprite.cpp index 6b1ccdcaa..1555e7124 100644 --- a/src/swrenderer/things/r_wallsprite.cpp +++ b/src/swrenderer/things/r_wallsprite.cpp @@ -71,13 +71,12 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); namespace swrenderer { - void RenderWallSprite::Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade, bool foggy, FDynamicColormap *basecolormap) + void RenderWallSprite::Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTexture *pic, const DVector2 &scale, int renderflags, int spriteshade, bool foggy, FDynamicColormap *basecolormap) { FWallCoords wallc; double x1, x2; DVector2 left, right; double gzb, gzt, tz; - FTexture *pic = TexMan(picnum, true); DAngle ang = thing->Angles.Yaw + 90; double angcos = ang.Cos(); double angsin = ang.Sin(); @@ -93,7 +92,7 @@ namespace swrenderer left.X = pos.X - x1 * angcos - thread->Viewport->viewpoint.Pos.X; left.Y = pos.Y - x1 * angsin - thread->Viewport->viewpoint.Pos.Y; right.X = left.X + x2 * angcos; - right.Y = right.Y + x2 * angsin; + right.Y = left.Y + x2 * angsin; // Is it off-screen? if (wallc.Init(thread, left, right, TOO_CLOSE_Z)) diff --git a/src/swrenderer/things/r_wallsprite.h b/src/swrenderer/things/r_wallsprite.h index 163fe12fb..2c2ca269c 100644 --- a/src/swrenderer/things/r_wallsprite.h +++ b/src/swrenderer/things/r_wallsprite.h @@ -10,7 +10,7 @@ namespace swrenderer class RenderWallSprite : public VisibleSprite { public: - static void Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTextureID picnum, const DVector2 &scale, int renderflags, int spriteshade, bool foggy, FDynamicColormap *basecolormap); + static void Project(RenderThread *thread, AActor *thing, const DVector3 &pos, FTexture *pic, const DVector2 &scale, int renderflags, int spriteshade, bool foggy, FDynamicColormap *basecolormap); protected: bool IsWallSprite() const override { return true; }