From 8cd6d1524784258f812909be0ee54c741211981f Mon Sep 17 00:00:00 2001 From: ac-stef Date: Sun, 20 Nov 2016 15:20:16 +0100 Subject: [PATCH] hide hudgun while menu shows a mapmodel ...to avoid overlap --- source/src/menus.cpp | 7 ++++--- source/src/protos.h | 2 +- source/src/rendergl.cpp | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/src/menus.cpp b/source/src/menus.cpp index 575487b2..9f3af6ba 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -1255,11 +1255,11 @@ bool menukey(int code, bool isdown, int unicode, SDLMod mod) } } -void rendermenumdl() +bool rendermenumdl() { - if(!curmenu) return; + if(!curmenu) return false; gmenu &m = *curmenu; - if(!m.mdl) return; + if(!m.mdl) return false; glPushMatrix(); glLoadIdentity(); @@ -1294,6 +1294,7 @@ void rendermenumdl() rendermodel(isplayermodel ? "playermodels" : m.mdl, m.anim|ANIM_DYNALLOC, tex, -1, pos, 0, yaw, pitch, 0, 0, NULL, a, m.scale ? m.scale/25.0f : 1.0f); glPopMatrix(); + return !(isplayermodel || isweapon); } void gmenu::refresh() diff --git a/source/src/protos.h b/source/src/protos.h index 32623044..c83a18ec 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -172,7 +172,7 @@ extern bool needscoresreorder; extern void menuheader(void *menu, char *header = NULL, char *footer = NULL); extern bool menukey(int code, bool isdown, int unicode, SDLMod mod = KMOD_NONE); extern void *addmenu(const char *name, const char *title = NULL, bool allowinput = true, void (__cdecl *refreshfunc)(void *, bool) = NULL, bool (__cdecl *keyfunc)(void *, int, bool, int) = NULL, bool hotkeys = false, bool forwardkeys = false); -extern void rendermenumdl(); +extern bool rendermenumdl(); extern void menuset(void *m, bool save = true); extern void menuselect(void *menu, int sel); extern void showmenu(const char *name, bool top = true); diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index de920273..c0792c15 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -949,12 +949,11 @@ void drawhudgun() { sethudgunperspective(true); - if(hudgun && (specthudgun || !player1->isspectating()) && camera1->type==ENT_PLAYER) + if(!rendermenumdl() && hudgun && (specthudgun || !player1->isspectating()) && camera1->type==ENT_PLAYER) { playerent *p = (playerent *)camera1; if(p->state==CS_ALIVE) p->weaponsel->renderhudmodel(); } - rendermenumdl(); sethudgunperspective(false); }