From 5377b128a9b56bfd8a5bc320ca26111b36a2f4e9 Mon Sep 17 00:00:00 2001 From: pogokeen Date: Thu, 1 Aug 2019 00:08:00 +0000 Subject: [PATCH] Fix rendering skyboxes to a tile by altering renderSetTarget() & renderRestoreTarget() to set & reset xdim & ydim so that G_ShowView() can render while a render target is set, and additionally modifying G_SetupCamTile() to call EVENT_DISPLAYROOMSCAMERATILE after calling renderSetTarget() git-svn-id: https://svn.eduke32.com/eduke32@7852 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/engine.cpp | 10 +++++++--- source/duke3d/src/gameexec.cpp | 7 ------- source/duke3d/src/sector.cpp | 3 ++- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 036621b70..9e67b6318 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -11948,7 +11948,7 @@ void renderSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz) //DRAWROOMS TO TILE BACKUP&SET CODE tilesiz[tilenume].x = xsiz; tilesiz[tilenume].y = ysiz; - bakxsiz[setviewcnt] = xsiz; bakysiz[setviewcnt] = ysiz; + bakxsiz[setviewcnt] = xdim; bakysiz[setviewcnt] = ydim; bakframeplace[setviewcnt] = frameplace; frameplace = waloff[tilenume]; bakwindowxy1[setviewcnt] = windowxy1; bakwindowxy2[setviewcnt] = windowxy2; @@ -11970,6 +11970,8 @@ void renderSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz) setviewcnt++; offscreenrendering = 1; + xdim = ysiz; + ydim = xsiz; videoSetViewableArea(0,0,ysiz-1,xsiz-1); renderSetAspect(65536,65536); @@ -11994,14 +11996,16 @@ void renderRestoreTarget(void) } #endif + xdim = bakxsiz[setviewcnt]; + ydim = bakysiz[setviewcnt]; videoSetViewableArea(bakwindowxy1[setviewcnt].x,bakwindowxy1[setviewcnt].y, bakwindowxy2[setviewcnt].x,bakwindowxy2[setviewcnt].y); copybufbyte(&bakumost[windowxy1.x],&startumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startumost[0])); copybufbyte(&bakdmost[windowxy1.x],&startdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startdmost[0])); frameplace = bakframeplace[setviewcnt]; - calc_ylookup(bytesperline, - (setviewcnt == 0) ? bakxsiz[0] : max(bakxsiz[setviewcnt - 1], bakxsiz[setviewcnt])); + calc_ylookup((setviewcnt == 0) ? bytesperline : bakxsiz[setviewcnt], + bakysiz[setviewcnt]); modechange=1; } diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index e1150dd8f..960d6de47 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1175,13 +1175,6 @@ LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int sect, i if (g_screenCapture) return; - //POGOTODO: check if this has anything to do with cameras not rendering the skybox properly - if (offscreenrendering) - { - videoClearViewableArea(0); - return; - } - int x1 = min(ix1, ix2); int x2 = max(ix1, ix2); int y1 = min(iy1, iy2); diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index bb97a8365..91bee4e46 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -377,7 +377,6 @@ int SetAnimation(int sectNum, int32_t *animPtr, int goalVal, int animVel) static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) { int const playerNum = screenpeek; - int const noDraw = VM_OnEventWithReturn(EVENT_DISPLAYROOMSCAMERATILE, spriteNum, playerNum, 0); vec3_t const camera = G_GetCameraPosition(spriteNum, smoothRatio); int const saveMirror = display_mirror; @@ -385,6 +384,8 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) //if (waloff[wn] == 0) loadtile(wn); renderSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x); + int const noDraw = VM_OnEventWithReturn(EVENT_DISPLAYROOMSCAMERATILE, spriteNum, playerNum, 0); + if (noDraw == 1) return; #ifdef DEBUGGINGAIDS