Patch from Nuke.YKT to fix TROR rendering in mirrors in Polymost

Includes "Fix screen tilt regression on mirror rendering"

git-svn-id: https://svn.eduke32.com/eduke32@7493 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-04-07 20:56:38 +00:00 committed by Christoph Oelckers
parent eb5a90b1ef
commit 2081eff083
4 changed files with 14 additions and 5 deletions

View file

@ -1451,7 +1451,7 @@ int16_t searchsector, searchwall, searchstat; //search output
// When aiming at a 2-sided wall, 1 if aiming at the bottom part, 0 else // When aiming at a 2-sided wall, 1 if aiming at the bottom part, 0 else
int16_t searchbottomwall, searchisbottom; int16_t searchbottomwall, searchisbottom;
char inpreparemirror = 0; char inpreparemirror = 0, mirrorrender = 0;
static int32_t mirrorsx1, mirrorsy1, mirrorsx2, mirrorsy2; static int32_t mirrorsx1, mirrorsy1, mirrorsx2, mirrorsy2;
static int32_t setviewcnt = 0; // interface layers use this now static int32_t setviewcnt = 0; // interface layers use this now
@ -11614,6 +11614,7 @@ void squarerotatetile(int16_t tilenume)
void renderPrepareMirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall, void renderPrepareMirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall,
int32_t *tposx, int32_t *tposy, fix16_t *tang) int32_t *tposx, int32_t *tposy, fix16_t *tang)
{ {
mirrorrender = 1;
const int32_t x = wall[dawall].x, dx = wall[wall[dawall].point2].x-x; const int32_t x = wall[dawall].x, dx = wall[wall[dawall].point2].x-x;
const int32_t y = wall[dawall].y, dy = wall[wall[dawall].point2].y-y; const int32_t y = wall[dawall].y, dy = wall[wall[dawall].point2].y-y;
@ -11636,6 +11637,7 @@ void renderPrepareMirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall
// //
void renderCompleteMirror(void) void renderCompleteMirror(void)
{ {
mirrorrender = 0;
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (videoGetRenderMode() != REND_CLASSIC) if (videoGetRenderMode() != REND_CLASSIC)
return; return;

View file

@ -236,7 +236,7 @@ extern int32_t searchx, searchy;
extern int16_t searchsector, searchwall, searchstat; extern int16_t searchsector, searchwall, searchstat;
extern int16_t searchbottomwall, searchisbottom; extern int16_t searchbottomwall, searchisbottom;
extern char inpreparemirror; extern char inpreparemirror, mirrorrender;
extern char picsiz[MAXTILES]; extern char picsiz[MAXTILES];
extern int16_t sectorborder[256]; extern int16_t sectorborder[256];

View file

@ -5336,7 +5336,7 @@ void polymost_drawrooms()
gctang = (gctang > 0.f) ? 1.f : -1.f; gctang = (gctang > 0.f) ? 1.f : -1.f;
} }
if (inpreparemirror) if (mirrorrender)
gstang = -gstang; gstang = -gstang;
//Generate viewport trapezoid (for handling screen up/down) //Generate viewport trapezoid (for handling screen up/down)
@ -5355,6 +5355,11 @@ void polymost_drawrooms()
v = { o2.x, o2.y * gchang + o2.z * gshang, o2.z * gchang - o2.y * gshang }; v = { o2.x, o2.y * gchang + o2.z * gshang, o2.z * gchang - o2.y * gshang };
} }
#if !SOFTROTMAT
if (mirrorrender)
gstang = -gstang;
#endif
//Clip to SCISDIST plane //Clip to SCISDIST plane
int n = 0; int n = 0;
@ -5429,9 +5434,11 @@ void polymost_drawrooms()
grhalfxdown10x = grhalfxdown10; grhalfxdown10x = grhalfxdown10;
if (mirrorrender)
grhalfxdown10x = -grhalfxdown10;
if (inpreparemirror) if (inpreparemirror)
{ {
grhalfxdown10x = -grhalfxdown10;
inpreparemirror = 0; inpreparemirror = 0;
// see engine.c: INPREPAREMIRROR_NO_BUNCHES // see engine.c: INPREPAREMIRROR_NO_BUNCHES

View file

@ -626,7 +626,7 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t q16horiz
int32_t j = g_visibility; int32_t j = g_visibility;
g_visibility = (j>>1) + (j>>2); g_visibility = (j>>1) + (j>>2);
if (videoGetRenderMode() == REND_CLASSIC) if (videoGetRenderMode() != REND_POLYMER)
{ {
int32_t didmirror; int32_t didmirror;