From bcb78151186febcd7a82ddc3d3b1ab1840c95fc6 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 24 Jun 2018 00:55:23 +0000 Subject: [PATCH] Fix crash in Mapster32 when switching from GL 3d mode to 2d mode. git-svn-id: https://svn.eduke32.com/eduke32@6929 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/engine.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index eeaacbbd5..a36863970 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -9890,7 +9890,7 @@ int32_t videoSetGameMode(char davidoption, int32_t daxdim, int32_t daydim, int32 #ifdef USE_OPENGL if (dabpp > 8) rendmode = glrendmode; // GL renderer - else if (dabpp == 8 && j > 8) rendmode = REND_CLASSIC; + else rendmode = REND_CLASSIC; #endif xdim = daxdim; @@ -12759,19 +12759,21 @@ void videoSet2dMode(int32_t daxdim, int32_t daydim) ydim = yres; #ifdef USE_OPENGL + extern char nogl; + fxdim = (float) xres; fydim = (float) yres; -#endif + if (!nogl) + glsurface_initialize({ xres, yres }); +#endif videoAllocateBuffers(); ydim16 = yres - STATUS2DSIZ2; halfxdim16 = xres >> 1; midydim16 = ydim16 >> 1; // scale(200,yres,480); - videoBeginDrawing(); //{{{ - Bmemset((char *)frameplace, 0, yres*bytesperline); - videoEndDrawing(); //}}} + videoClearScreen(0L); } qsetmode = ((daxdim<<16)|(daydim&0xffff));