diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 25843c271..89aeae8e6 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -832,6 +832,7 @@ set (PCH_SOURCES common/rendering/gl/system/gl_debug.cpp common/rendering/gl/system/gl_framebuffer.cpp common/rendering/gl_load/gl_interface.cpp + common/rendering/hwrenderer/data/flatvertices.cpp common/rendering/hwrenderer/postprocessing/hw_postprocess.cpp common/rendering/hwrenderer/postprocessing/hw_postprocess_cvars.cpp common/rendering/hwrenderer/utility/hw_shaderpatcher.cpp diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index dc3076ba5..da9b99db8 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -64,6 +64,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "menu/menu.h" #include "gstrings.h" #include "v_2ddrawer.h" +#include "v_video.h" CVARD(Bool, hud_powerupduration, true, CVAR_ARCHIVE|CVAR_FRONTEND_BLOOD, "enable/disable displaying the remaining seconds for power-ups") @@ -3226,6 +3227,7 @@ void viewDrawScreen(void) } else if (v4 && gNetPlayers > 1) { + int tmp = ((int)totalclock / 240) % (gNetPlayers - 1); int i = connecthead; while (1) @@ -3245,6 +3247,7 @@ void viewDrawScreen(void) } renderSetTarget(4079, 128, 128); renderSetAspect(65536, 78643); + screen->BeginScene(); int vd8 = pOther->pSprite->x; int vd4 = pOther->pSprite->y; int vd0 = pOther->zView; @@ -3307,6 +3310,7 @@ void viewDrawScreen(void) memcpy(gotpic + 510, bakMirrorGotpic, 2); viewProcessSprites(vd8, vd4, vd0, v50, gInterpolate); renderDrawMasks(); + screen->FinishScene(); renderRestoreTarget(); } else @@ -3347,6 +3351,7 @@ void viewDrawScreen(void) } nSprite = nextspritestat[nSprite]; } + screen->BeginScene(); g_visibility = (int32_t)(ClipLow(gVisibility - 32 * gView->visibility - unk, 0) * (numplayers > 1 ? 1.f : r_ambientlightrecip)); cA = (cA + interpolateangfix16(fix16_from_int(deliriumTurnO), fix16_from_int(deliriumTurn), gInterpolate)) & 0x7ffffff; int vfc, vf8; @@ -3400,6 +3405,7 @@ void viewDrawScreen(void) sub_557C4(cX, cY, gInterpolate); renderDrawMasks(); gView->pSprite->cstat = bakCstat; + screen->FinishScene(); if (v78 || bDelirium) { diff --git a/source/common/rendering/gl/system/gl_framebuffer.cpp b/source/common/rendering/gl/system/gl_framebuffer.cpp index 873edb0cb..dc6d86a34 100644 --- a/source/common/rendering/gl/system/gl_framebuffer.cpp +++ b/source/common/rendering/gl/system/gl_framebuffer.cpp @@ -45,6 +45,7 @@ #include "gl/system/gl_framebuffer.h" #include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderbuffers.h" +#include "hwrenderer/data/flatvertices.h" /* #include "gl/textures/gl_samplers.h" #include "hwrenderer/utility/hw_clock.h" @@ -105,8 +106,8 @@ OpenGLFrameBuffer::~OpenGLFrameBuffer() { PPResource::ResetAll(); -#ifdef IMPLEMENT_IT if (mVertexData != nullptr) delete mVertexData; +#ifdef IMPLEMENT_IT if (mSkyData != nullptr) delete mSkyData; if (mViewpoints != nullptr) delete mViewpoints; if (mLights != nullptr) delete mLights; @@ -171,8 +172,8 @@ void OpenGLFrameBuffer::InitializeState() SetViewportRects(nullptr); -#ifdef IMPLEMENT_IT mVertexData = new FFlatVertexBuffer(GetWidth(), GetHeight()); +#ifdef IMPLEMENT_IT mSkyData = new FSkyVertexBuffer; mViewpoints = new HWViewpointBuffer; mLights = new FLightBuffer(); @@ -305,6 +306,7 @@ FModelRenderer *OpenGLFrameBuffer::CreateModelRenderer(int mli) { return new FHWModelRenderer(nullptr, gl_RenderState, mli); } +#endif IVertexBuffer *OpenGLFrameBuffer::CreateVertexBuffer() { @@ -315,7 +317,6 @@ IIndexBuffer *OpenGLFrameBuffer::CreateIndexBuffer() { return new GLIndexBuffer; } -#endif IDataBuffer *OpenGLFrameBuffer::CreateDataBuffer(int bindingpoint, bool ssbo, bool needsresize) { diff --git a/source/common/rendering/gl/system/gl_framebuffer.h b/source/common/rendering/gl/system/gl_framebuffer.h index e0670a605..6b4a99db8 100644 --- a/source/common/rendering/gl/system/gl_framebuffer.h +++ b/source/common/rendering/gl/system/gl_framebuffer.h @@ -37,10 +37,8 @@ public: void BeginFrame() override; //void SetViewportRects(IntRect *bounds) override; void BlurScene(float amount) override; -#ifdef IMPLEMENT_IT IVertexBuffer *CreateVertexBuffer() override; IIndexBuffer *CreateIndexBuffer() override; -#endif IDataBuffer *CreateDataBuffer(int bindingpoint, bool ssbo, bool needsresize) override; // Retrieves a buffer containing image data for a screenshot. diff --git a/source/common/rendering/hwrenderer/data/flatvertices.cpp b/source/common/rendering/hwrenderer/data/flatvertices.cpp new file mode 100644 index 000000000..eae6a42e9 --- /dev/null +++ b/source/common/rendering/hwrenderer/data/flatvertices.cpp @@ -0,0 +1,138 @@ +/* +** hw_flatvertices.cpp +** Creates flat vertex data for hardware rendering. +** +**--------------------------------------------------------------------------- +** Copyright 2010-2020 Christoph Oelckers +** All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** 3. The name of the author may not be used to endorse or promote products +** derived from this software without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +**--------------------------------------------------------------------------- +** +*/ + +#include "c_cvars.h" +#include "flatvertices.h" +#include "v_video.h" +#include "cmdlib.h" +#include "hwrenderer/data/buffers.h" + +//========================================================================== +// +// +// +//========================================================================== + +FFlatVertexBuffer::FFlatVertexBuffer(int width, int height) +{ + vbo_shadowdata.Resize(NUM_RESERVED); + + // the first quad is reserved for handling coordinates through uniforms. + vbo_shadowdata[0].Set(0, 0, 0, 0, 0); + vbo_shadowdata[1].Set(1, 0, 0, 0, 0); + vbo_shadowdata[2].Set(2, 0, 0, 0, 0); + vbo_shadowdata[3].Set(3, 0, 0, 0, 0); + + // and the second one for the fullscreen quad used for blend overlays. + vbo_shadowdata[4].Set(0, 0, 0, 0, 0); + vbo_shadowdata[5].Set(0, (float)height, 0, 0, 1); + vbo_shadowdata[6].Set((float)width, 0, 0, 1, 0); + vbo_shadowdata[7].Set((float)width, (float)height, 0, 1, 1); + + // and this is for the postprocessing copy operation + vbo_shadowdata[8].Set(-1.0f, -1.0f, 0, 0.0f, 0.0f); + vbo_shadowdata[9].Set(-1.0f, 1.0f, 0, 0.0f, 1.f); + vbo_shadowdata[10].Set(1.0f, -1.0f, 0, 1.f, 0.0f); + vbo_shadowdata[11].Set(1.0f, 1.0f, 0, 1.f, 1.f); + + // The next two are the stencil caps. + vbo_shadowdata[12].Set(-32767.0f, 32767.0f, -32767.0f, 0, 0); + vbo_shadowdata[13].Set(-32767.0f, 32767.0f, 32767.0f, 0, 0); + vbo_shadowdata[14].Set(32767.0f, 32767.0f, 32767.0f, 0, 0); + vbo_shadowdata[15].Set(32767.0f, 32767.0f, -32767.0f, 0, 0); + + vbo_shadowdata[16].Set(-32767.0f, -32767.0f, -32767.0f, 0, 0); + vbo_shadowdata[17].Set(-32767.0f, -32767.0f, 32767.0f, 0, 0); + vbo_shadowdata[18].Set(32767.0f, -32767.0f, 32767.0f, 0, 0); + vbo_shadowdata[19].Set(32767.0f, -32767.0f, -32767.0f, 0, 0); + + mVertexBuffer = screen->CreateVertexBuffer(); + mIndexBuffer = screen->CreateIndexBuffer(); + + unsigned int bytesize = BUFFER_SIZE * sizeof(FFlatVertex); + mVertexBuffer->SetData(bytesize, nullptr, false); + + static const FVertexBufferAttribute format[] = { + { 0, VATTR_VERTEX, VFmt_Float3, (int)myoffsetof(FFlatVertex, x) }, + { 0, VATTR_TEXCOORD, VFmt_Float2, (int)myoffsetof(FFlatVertex, u) } + }; + mVertexBuffer->SetFormat(1, 2, sizeof(FFlatVertex), format); + + mIndex = mCurIndex = 0; + mNumReserved = NUM_RESERVED; + Copy(0, NUM_RESERVED); +} + +//========================================================================== +// +// +// +//========================================================================== + +FFlatVertexBuffer::~FFlatVertexBuffer() +{ + delete mIndexBuffer; + delete mVertexBuffer; + mIndexBuffer = nullptr; + mVertexBuffer = nullptr; +} + +//========================================================================== +// +// +// +//========================================================================== + +void FFlatVertexBuffer::OutputResized(int width, int height) +{ + vbo_shadowdata[4].Set(0, 0, 0, 0, 0); + vbo_shadowdata[5].Set(0, (float)height, 0, 0, 1); + vbo_shadowdata[6].Set((float)width, 0, 0, 1, 0); + vbo_shadowdata[7].Set((float)width, (float)height, 0, 1, 1); + Copy(4, 4); +} + +//========================================================================== +// +// +// +//========================================================================== + +void FFlatVertexBuffer::Copy(int start, int count) +{ + Map(); + memcpy(GetBuffer(start), &vbo_shadowdata[0], count * sizeof(FFlatVertex)); + Unmap(); +} + diff --git a/source/common/rendering/hwrenderer/data/flatvertices.h b/source/common/rendering/hwrenderer/data/flatvertices.h new file mode 100644 index 000000000..58c383013 --- /dev/null +++ b/source/common/rendering/hwrenderer/data/flatvertices.h @@ -0,0 +1,98 @@ + +#ifndef _HW__VERTEXBUFFER_H +#define _HW__VERTEXBUFFER_H + +#include "tarray.h" +#include "hwrenderer/data/buffers.h" +#include +#include + +class FRenderState; +struct secplane_t; +struct subsector_t; + +struct FFlatVertex +{ + float x, z, y; // world position + float u, v; // texture coordinates + + void Set(float xx, float zz, float yy, float uu, float vv) + { + x = xx; + z = zz; + y = yy; + u = uu; + v = vv; + } +}; + +class FFlatVertexBuffer +{ + TArray vbo_shadowdata; + TArray ibo_data; + + IVertexBuffer *mVertexBuffer; + IIndexBuffer *mIndexBuffer; + + unsigned int mIndex; + std::atomic mCurIndex; + unsigned int mNumReserved; + + + static const unsigned int BUFFER_SIZE = 2000000; + static const unsigned int BUFFER_SIZE_TO_USE = 1999500; + +public: + enum + { + QUAD_INDEX = 0, + FULLSCREEN_INDEX = 4, + PRESENT_INDEX = 8, + STENCILTOP_INDEX = 12, + STENCILBOTTOM_INDEX = 16, + + NUM_RESERVED = 20 + }; + + FFlatVertexBuffer(int width, int height); + ~FFlatVertexBuffer(); + + void OutputResized(int width, int height); + std::pair GetBufferObjects() const + { + return std::make_pair(mVertexBuffer, mIndexBuffer); + } + + void Copy(int start, int count); + + FFlatVertex *GetBuffer(int index) const + { + FFlatVertex *ff = (FFlatVertex*)mVertexBuffer->Memory(); + return &ff[index]; + } + + FFlatVertex *GetBuffer() const + { + return GetBuffer(mCurIndex); + } + + std::pair AllocVertices(unsigned int count); + + void Reset() + { + mCurIndex = mIndex; + } + + void Map() + { + mVertexBuffer->Map(); + } + + void Unmap() + { + mVertexBuffer->Unmap(); + } + +}; + +#endif diff --git a/source/common/rendering/v_framebuffer.cpp b/source/common/rendering/v_framebuffer.cpp index 0782ae49e..854feb9c3 100644 --- a/source/common/rendering/v_framebuffer.cpp +++ b/source/common/rendering/v_framebuffer.cpp @@ -49,8 +49,8 @@ /* #include "hwrenderer/scene/hw_portal.h" #include "hwrenderer/utility/hw_clock.h" -#include "hwrenderer/data/flatvertices.h" */ +#include "hwrenderer/data/flatvertices.h" #include #include @@ -189,7 +189,7 @@ void DFrameBuffer::Update() { SetVirtualSize(clientWidth, clientHeight); V_OutputResized(clientWidth, clientHeight); - //mVertexData->OutputResized(clientWidth, clientHeight); + mVertexData->OutputResized(clientWidth, clientHeight); } } @@ -364,3 +364,21 @@ void DFrameBuffer::FPSLimit() } #endif } + +void DFrameBuffer::BeginScene() +{ + if (videoGetRenderMode() < REND_POLYMOST) return; + assert(BufferLock >= 0); + if (BufferLock++ == 0) + { + mVertexData->Map(); + } +} + +void DFrameBuffer::FinishScene() +{ + if (videoGetRenderMode() < REND_POLYMOST) return; + assert(BufferLock > 0); + if (--BufferLock == 0) + mVertexData->Unmap(); +} diff --git a/source/common/rendering/v_video.h b/source/common/rendering/v_video.h index 5904470c1..292b0b259 100644 --- a/source/common/rendering/v_video.h +++ b/source/common/rendering/v_video.h @@ -178,6 +178,7 @@ class FFont; struct FRemapTable; class player_t; typedef uint32_t angle_t; +struct RenderScene; // @@ -219,6 +220,7 @@ protected: private: int Width = 0; int Height = 0; + int BufferLock = 0; protected: int clipleft = 0, cliptop = 0, clipwidth = -1, clipheight = -1; @@ -233,7 +235,7 @@ public: const char *vendorstring; // We have to account for some issues with particular vendors. //FPortalSceneState *mPortalState; // global portal state. //FSkyVertexBuffer *mSkyData = nullptr; // the sky vertex buffer - //FFlatVertexBuffer *mVertexData = nullptr; // Global vertex data + FFlatVertexBuffer *mVertexData = nullptr; // Global vertex data //HWViewpointBuffer *mViewpoints = nullptr; // Viewpoint render data. //FLightBuffer *mLights = nullptr; // Dynamic lights //IShadowMap mShadowMap; @@ -313,6 +315,9 @@ public: void Begin2D() { isIn2D = true; } void End2D() { isIn2D = false; } + void BeginScene(); + void FinishScene(); + void End2DAndUpdate() { DrawRateStuff(); diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index e6a275ca4..450229c98 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -725,6 +725,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) "other values are reserved.\n"); #endif + screen->BeginScene(); #ifdef LEGACY_ROR G_SE40(smoothRatio); #endif @@ -737,6 +738,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) yax_drawrooms(G_DoSpriteAnimations, pSprite->sectnum, 0, smoothRatio); G_DoSpriteAnimations(pSprite->x, pSprite->y, pSprite->z - ZOFFSET6, fix16_to_int(CAMERA(q16ang)), smoothRatio); renderDrawMasks(); + screen->FinishScene(); } } else @@ -981,6 +983,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) OSD_Printf(OSD_ERROR "ERROR: EVENT_DISPLAYROOMS return value must be 0 or 1, " "other values are reserved.\n"); #endif + screen->BeginScene(); G_HandleMirror(CAMERA(pos.x), CAMERA(pos.y), CAMERA(pos.z), CAMERA(q16ang), CAMERA(q16horiz), smoothRatio); G_ClearGotMirror(); @@ -1010,6 +1013,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) #endif renderDrawMasks(); #endif + screen->FinishScene(); } if (g_screenCapture) diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 1ae2cb404..22273e3d9 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -42,6 +42,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "quotemgr.h" #include "mapinfo.h" #include "version.h" +#include "v_video.h" #include "debugbreak.h" @@ -1214,6 +1215,7 @@ LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int sect, i renderSetAspect(viewingRange, yxAspect); int const smoothratio = calc_smoothratio(totalclock, ototalclock); G_DoInterpolations(smoothratio); + screen->BeginScene(); if (!display_mirror) G_HandleMirror(vec.x, vec.y, vec.z, a, horiz, smoothratio); #ifdef POLYMER @@ -1228,6 +1230,7 @@ LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int sect, i G_DoSpriteAnimations(vec.x, vec.y, vec.z, fix16_to_int(a), smoothratio); display_mirror = 0; renderDrawMasks(); + screen->FinishScene(); G_RestoreInterpolations(); G_UpdateScreenArea(); renderSetAspect(viewingRange, yxAspect); diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index da4559472..376944cce 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "printf.h" #include "secrets.h" +#include "v_video.h" BEGIN_DUKE_NS @@ -399,6 +400,7 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) OSD_Printf(OSD_ERROR "ERROR: EVENT_DISPLAYROOMSCAMERATILE return value must be 0 or 1, " "other values are reserved.\n"); #endif + screen->BeginScene(); yax_preparedrawrooms(); drawrooms(camera.x, camera.y, camera.z, SA(spriteNum), 100 + sprite[spriteNum].shade, SECT(spriteNum)); @@ -408,6 +410,7 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) G_DoSpriteAnimations(camera.x, camera.y, camera.z, SA(spriteNum), smoothRatio); display_mirror = saveMirror; renderDrawMasks(); + screen->FinishScene(); finishTileSetup: renderRestoreTarget(); diff --git a/source/exhumed/src/view.cpp b/source/exhumed/src/view.cpp index 583b73079..df8c9891c 100644 --- a/source/exhumed/src/view.cpp +++ b/source/exhumed/src/view.cpp @@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "engine.h" #include "trigdat.h" #include "runlist.h" +#include "v_video.h" #include BEGIN_PS_NS @@ -530,9 +531,11 @@ void DrawView(int smoothRatio) } } + screen->BeginScene(); renderDrawRoomsQ16(nCamerax, nCameray, viewz, nCameraa, nCamerapan, nSector); analyzesprites(); renderDrawMasks(); + screen->FinishScene(); if (HavePLURemap()) { diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 26c17862e..ccaf44f5e 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -1280,6 +1280,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) CAMERA(q16horiz) = fix16_clamp(CAMERA(q16horiz), F16(HORIZ_MIN), F16(HORIZ_MAX)); + screen->BeginScene(); G_HandleMirror(CAMERA(pos.x), CAMERA(pos.y), CAMERA(pos.z), CAMERA(q16ang), CAMERA(q16horiz), smoothRatio); #ifdef LEGACY_ROR if (!RR) @@ -1409,6 +1410,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) #endif renderDrawMasks(); #endif + screen->FinishScene(); if (g_screenCapture) { diff --git a/source/rr/src/sector.cpp b/source/rr/src/sector.cpp index 1333b1a88..7d39a13fa 100644 --- a/source/rr/src/sector.cpp +++ b/source/rr/src/sector.cpp @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "duke3d.h" #include "secrets.h" +#include "v_video.h" BEGIN_RR_NS @@ -505,6 +506,7 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) int const saveMirror = display_mirror; renderSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x); + screen->BeginScene(); yax_preparedrawrooms(); drawrooms(camera.x, camera.y, camera.z, SA(spriteNum), 100 + sprite[spriteNum].shade, SECT(spriteNum)); @@ -514,6 +516,7 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) G_DoSpriteAnimations(camera.x, camera.y, camera.z, SA(spriteNum), smoothRatio); display_mirror = saveMirror; renderDrawMasks(); + screen->FinishScene(); renderRestoreTarget(); squarerotatetile(tileNum); diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index ce2b38c7b..f3ccadacf 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -58,6 +58,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "menu/menu.h" #include "swcvar.h" #include "v_2ddrawer.h" +#include "v_video.h" BEGIN_SW_NS @@ -2183,6 +2184,7 @@ drawscreen(PLAYERp pp) if (FAF_DebugView) videoClearViewableArea(255L); + screen->BeginScene(); OverlapDraw = TRUE; DrawOverlapRoom(tx, ty, tz, tang, thoriz, tsectnum); OverlapDraw = FALSE; @@ -2203,6 +2205,7 @@ drawscreen(PLAYERp pp) analyzesprites(tx, ty, tz, FALSE); post_analyzesprites(); renderDrawMasks(); + screen->FinishScene(); if (r_usenewaspect) { @@ -2439,29 +2442,9 @@ DrawCompass(PLAYERp pp) } -void ScreenTileLock(void) -{ -} -void ScreenTileUnLock(void) -{ -} - -int -ScreenLoadSaveSetup(PLAYERp pp) -{ - int tx, ty, tz,thoriz,pp_siz; - short tang,tsectnum; - short i; - - // lock and allocate memory - - ScreenTileLock(); - - TileFiles.tileCreate(SAVE_SCREEN_TILE, SAVE_SCREEN_XSIZE, SAVE_SCREEN_YSIZE); - return SAVE_SCREEN_TILE; -} +#if 0 int ScreenSaveSetup(PLAYERp pp) { @@ -2479,6 +2462,7 @@ ScreenSaveSetup(PLAYERp pp) return SAVE_SCREEN_TILE; } +#endif diff --git a/source/sw/src/jsector.cpp b/source/sw/src/jsector.cpp index 420df85bd..58a2a57ce 100644 --- a/source/sw/src/jsector.cpp +++ b/source/sw/src/jsector.cpp @@ -45,6 +45,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "lists.h" #include "pal.h" #include "parent.h" +#include "v_video.h" BEGIN_SW_NS @@ -472,10 +473,12 @@ void drawroomstotile(int daposx, int daposy, int daposz, TileFiles.tileCreate(tilenume, tilesiz[tilenume].x, tilesiz[tilenume].y); renderSetTarget(tilenume, tilesiz[tilenume].x, tilesiz[tilenume].y); + screen->BeginScene(); drawrooms(daposx, daposy, daposz, daang, dahoriz, dacursectnum); analyzesprites(daposx, daposy, daposz, FALSE); renderDrawMasks(); + screen->FinishScene(); renderRestoreTarget(); diff --git a/source/sw/src/save.cpp b/source/sw/src/save.cpp index 22447e94a..33b96a025 100644 --- a/source/sw/src/save.cpp +++ b/source/sw/src/save.cpp @@ -90,15 +90,6 @@ extern SWBOOL sumowasseen; extern SWBOOL zillawasseen; extern short BossSpriteNum[3]; -void ScreenTileLock(void); -void ScreenTileUnLock(void); - -int ScreenSaveSetup(PLAYERp pp); -void ScreenSave(MFILE_WRITE fout); - -int ScreenLoadSaveSetup(PLAYERp pp); -void ScreenLoad(MFILE_READ fin); - #define PANEL_SAVE 1 #define ANIM_SAVE 1 @@ -255,12 +246,6 @@ bool GameInterface::SaveGame(FSaveGameNode *sv) MWRITE(&Level,sizeof(Level),1,fil); MWRITE(&Skill,sizeof(Skill),1,fil); - ScreenSaveSetup(&Player[myconnectindex]); - - ScreenSave(fil); - - ScreenTileUnLock(); - MWRITE(&numplayers,sizeof(numplayers),1,fil); MWRITE(&myconnectindex,sizeof(myconnectindex),1,fil); MWRITE(&connecthead,sizeof(connecthead),1,fil); @@ -794,10 +779,6 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) MREAD(&Level,sizeof(Level),1,fil); MREAD(&Skill,sizeof(Skill),1,fil); - ScreenLoadSaveSetup(Player + myconnectindex); - ScreenLoad(fil); - ScreenTileUnLock(); - MREAD(&numplayers, sizeof(numplayers),1,fil); MREAD(&myconnectindex,sizeof(myconnectindex),1,fil); MREAD(&connecthead,sizeof(connecthead),1,fil); @@ -1287,24 +1268,4 @@ bool GameInterface::LoadGame(FSaveGameNode* sv) return true; } -void -ScreenSave(MFILE_WRITE fout) -{ - // int num; - MWRITE((void *)tileData(SAVE_SCREEN_TILE), SAVE_SCREEN_XSIZE * SAVE_SCREEN_YSIZE, 1, fout); - // ASSERT(num == 1); -} - -void -ScreenLoad(MFILE_READ fin) -{ - int num; - - renderSetTarget(SAVE_SCREEN_TILE, SAVE_SCREEN_YSIZE, SAVE_SCREEN_XSIZE); - - num = MREAD(tileData(SAVE_SCREEN_TILE), SAVE_SCREEN_XSIZE * SAVE_SCREEN_YSIZE, 1, fin); - - renderRestoreTarget(); -} - END_SW_NS