diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index 07fac1b2e..d386428a2 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -483,7 +483,7 @@ FTextureID gl_GetSpriteFrame(unsigned sprite, int frame, int rot, angle_t ang, b //========================================================================== // -// Recalculate all heights affectting this vertex. +// Recalculate all heights affecting this vertex. // //========================================================================== void gl_RecalcVertexHeights(vertex_t * v) diff --git a/src/gl/data/gl_setup.cpp b/src/gl/data/gl_setup.cpp index 6bdf57d4c..7959b2083 100644 --- a/src/gl/data/gl_setup.cpp +++ b/src/gl/data/gl_setup.cpp @@ -623,20 +623,6 @@ void gl_CleanLevelData() mo=next; } - for(auto &v : level.vertexes) if (v.numsectors > 0) - { - if (v.sectors != nullptr) - { - delete [] v.sectors; - v.sectors = nullptr; - } - if (v.heightlist != nullptr) - { - delete [] v.heightlist; - v.heightlist = nullptr; - } - } - if (level.sides.Size() > 0 && level.sides[0].segs) { delete [] level.sides[0].segs; diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 57d17dfb4..6021411be 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -164,7 +164,7 @@ void FGLRenderer::Initialize(int width, int height) } else mVAOID = 0; - gllight = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/gllight.png"), FTexture::TEX_MiscPatch); + if (gl.legacyMode) gllight = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/gllight.png"), FTexture::TEX_MiscPatch); glpart2 = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart2.png"), FTexture::TEX_MiscPatch); glpart = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart.png"), FTexture::TEX_MiscPatch); mirrortexture = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/mirror.png"), FTexture::TEX_MiscPatch); @@ -196,6 +196,7 @@ FGLRenderer::~FGLRenderer() if (mLights != NULL) delete mLights; if (glpart2) delete glpart2; if (glpart) delete glpart; + if (gllight) delete gllight; if (mirrortexture) delete mirrortexture; if (mFBID != 0) glDeleteFramebuffers(1, &mFBID); if (mVAOID != 0) diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index 8aaa98ae6..2b338513a 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -394,16 +394,20 @@ bool FTexture::FindHoles(const unsigned char * buffer, int w, int h) } if (startdraw==0 && lendraw==h) return false; // nothing saved so don't create a split list - FloatRect * rcs = new FloatRect[gapc]; - - for(x=0;x 0) { - // gaps are stored as texture (u/v) coordinates - rcs[x].width=rcs[x].left=-1.0f; - rcs[x].top=(float)gaps[x][0]/(float)h; - rcs[x].height=(float)gaps[x][1]/(float)h; + FloatRect * rcs = new FloatRect[gapc]; + + for (x = 0; x < gapc; x++) + { + // gaps are stored as texture (u/v) coordinates + rcs[x].width = rcs[x].left = -1.0f; + rcs[x].top = (float)gaps[x][0] / (float)h; + rcs[x].height = (float)gaps[x][1] / (float)h; + } + gl_info.areas = rcs; } - gl_info.areas=rcs; + else gl_info.areas = nullptr; gl_info.areacount=gapc; return true; diff --git a/src/p_effect.cpp b/src/p_effect.cpp index e0679338d..0f784fa06 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -764,7 +764,7 @@ void P_DrawRailTrail(AActor *source, TArray &portalhits, int color1, int spiralduration = (duration == 0) ? 35 : duration; p->alpha = 1.f; - p->ttl = duration; + p->ttl = spiralduration; p->fadestep = FADEFROMTTL(spiralduration); p->size = 3; p->bright = fullbright; diff --git a/src/p_glnodes.cpp b/src/p_glnodes.cpp index 35f9f4502..0860c98b8 100644 --- a/src/p_glnodes.cpp +++ b/src/p_glnodes.cpp @@ -1488,7 +1488,7 @@ void P_SetRenderSector() seg = ss->firstline; for(j=0; jnumlines; j++) { - if(seg->sidedef && (seg->PartnerSeg == nullptr || seg->sidedef->sector!=seg->PartnerSeg->sidedef->sector)) + if(seg->sidedef && (seg->PartnerSeg == nullptr || (seg->PartnerSeg->sidedef != nullptr && seg->sidedef->sector!=seg->PartnerSeg->sidedef->sector))) { ss->render_sector = seg->sidedef->sector; break; diff --git a/src/r_defs.h b/src/r_defs.h index e8af4ea68..ee32e6c8b 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -156,6 +156,12 @@ struct vertex_t heightlist = NULL; } + ~vertex_t() + { + if (sectors != nullptr) delete[] sectors; + if (heightlist != nullptr) delete[] heightlist; + } + bool operator== (const vertex_t &other) { return p == other.p; diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index 14c4791c6..906bf9539 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -1337,7 +1337,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n _CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF); // Use this to break at a specific allocation number. - //_crtBreakAlloc = 53039; + _crtBreakAlloc = 124459; #endif DoMain (hInstance);