From 0783533932c7523d7386b9c9d963a25321f7338b Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sat, 19 Jan 2019 01:37:31 +0100 Subject: [PATCH] Menu: Proper entity shutdown bobs --- Source/Menu-FN/entry.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Source/Menu-FN/entry.cpp b/Source/Menu-FN/entry.cpp index ca111b09..22e7920c 100644 --- a/Source/Menu-FN/entry.cpp +++ b/Source/Menu-FN/entry.cpp @@ -6,6 +6,8 @@ * ****/ +var int g_initialized = FALSE; + void m_init(void) { vector g_btnsize; @@ -17,7 +19,7 @@ void m_init(void) font_label_p = loadfont( "label_p", "gfx/shell/arialbd.ttf", "16", -1 ); localcmd("plug_load ffmpeg\n"); - + /* TODO: Shove these into defaults.cfg instead of forcing them */ localcmd("con_textsize -12\n"); localcmd("scr_conalpha 1\n"); @@ -36,22 +38,21 @@ void m_init(void) Colors_Init(); games_init(); main_init(); + g_initialized = TRUE; } void m_shutdown(void) { + g_initialized = FALSE; /*int i = 0; for (i = 0; i < g_bmp.length; i++) { freepic(g_bmp[i]); - } - - entity e; - i = 1; - while ((e = edict_num(i)) != __NULL__) { - remove(e); - i++; }*/ + entity e; + while((e=nextent(__NULL__))) + remove(e); + memfree(g_sprays); memfree(g_models); memfree(g_maps); @@ -66,6 +67,10 @@ void m_draw(vector screensize) if (!g_active) { return; } + + if (g_initialized == FALSE) { + return; + } if ((screensize[0] != g_vidsize[0]) || (screensize[1] != g_vidsize[1])) { g_vidsize[0] = screensize[0];