diff --git a/src/swrenderer/r_main.cpp b/src/swrenderer/r_main.cpp index cfb9daf51..a5978b5a8 100644 --- a/src/swrenderer/r_main.cpp +++ b/src/swrenderer/r_main.cpp @@ -102,7 +102,6 @@ static void R_ShutdownRenderer(); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- -extern short *openings; extern int fuzzviewheight; @@ -391,13 +390,7 @@ static void R_ShutdownRenderer() R_DeinitSprites(); R_DeinitPlanes(); Clip3DFloors::Instance()->Cleanup(); - // Free openings - if (openings != NULL) - { - M_Free (openings); - openings = NULL; - } - + R_DeinitOpenings(); R_FreeDrawSegs(); } diff --git a/src/swrenderer/r_memory.cpp b/src/swrenderer/r_memory.cpp index dd5fd83f8..0b3d3c1d4 100644 --- a/src/swrenderer/r_memory.cpp +++ b/src/swrenderer/r_memory.cpp @@ -61,4 +61,13 @@ namespace swrenderer { lastopening = 0; } + + void R_DeinitOpenings() + { + if (openings != nullptr) + { + M_Free(openings); + openings = nullptr; + } + } } diff --git a/src/swrenderer/r_memory.h b/src/swrenderer/r_memory.h index fc0c845e2..5df750480 100644 --- a/src/swrenderer/r_memory.h +++ b/src/swrenderer/r_memory.h @@ -19,4 +19,5 @@ namespace swrenderer ptrdiff_t R_NewOpening(ptrdiff_t len); void R_FreeOpenings(); + void R_DeinitOpenings(); }