From f4edaa26622ff4d5120f4510c8c32be99687303d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 11 Jan 2017 01:23:08 +0100 Subject: [PATCH 1/4] - fixed the railgun's spiral duration was set incorrectly. --- src/p_effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From d1ce098d59645283231ca2304dbc857708117f08 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 11 Jan 2017 10:46:26 +0100 Subject: [PATCH 2/4] - fixed a crash with GL nodes not having partner segs where both sides have a sidedef. This can happen for some render hacks. --- src/p_glnodes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From 72101473d05bd888843a069eedcf79cfb1c044ab Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 11 Jan 2017 10:47:45 +0100 Subject: [PATCH 3/4] - fixed: The texture for legacy dynamic light handling was always allocated, even if not needed, and it was never freed. --- src/gl/renderer/gl_renderer.cpp | 3 ++- src/win32/i_main.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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/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); From 7f3e18a6ccf2d85cfe963c6dc3050a28cc89b45b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 11 Jan 2017 11:37:27 +0100 Subject: [PATCH 4/4] - fixed a few memory leaks. --- src/gl/data/gl_data.cpp | 2 +- src/gl/data/gl_setup.cpp | 14 -------------- src/gl/textures/gl_texture.cpp | 20 ++++++++++++-------- src/r_defs.h | 6 ++++++ 4 files changed, 19 insertions(+), 23 deletions(-) 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/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/r_defs.h b/src/r_defs.h index 86eb7c8c6..f2c089900 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -157,6 +157,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;