From cc2ac85dd5c13f42fca9dcc5a4df8e1f5aedd33e Mon Sep 17 00:00:00 2001 From: aurhat Date: Sun, 13 Dec 2015 13:43:18 +0100 Subject: [PATCH] Improve order of displaying on HUD Now command console over hudmessages, hudmessages over flag icons/scores and player's stats. Also fixed length of the line in command console. --- source/src/console.cpp | 2 +- source/src/renderhud.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/src/console.cpp b/source/src/console.cpp index ceffd068..e073f0ec 100644 --- a/source/src/console.cpp +++ b/source/src/console.cpp @@ -137,7 +137,7 @@ int rendercommand(int x, int y, int w) int width, height; text_bounds(s, width, height, w); y -= height - FONTH; - draw_text(s, x, y, 0xFF, 0xFF, 0xFF, 0xFF, cmdline.pos>=0 ? cmdline.pos + strlen(useprompt) + 1 : (int)strlen(s), w); + if (x >= 0) draw_text(s, x, y, 0xFF, 0xFF, 0xFF, 0xFF, cmdline.pos>=0 ? cmdline.pos + strlen(useprompt) + 1 : (int)strlen(s), w); return height; } diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index 1e84e4a4..015b29b4 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -816,7 +816,7 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat char *infostr = editinfo(); int commandh = 1570 + FONTH; - if(command) commandh -= rendercommand(20, 1570, VIRTW); + if(command) commandh -= rendercommand(-1, 1570, VIRTW - FONTH); // dryrun to get height else if(infostr) draw_text(infostr, 20, 1570); else if(targetplayer && showtargetname) draw_text(colorname(targetplayer), 20, 1570); glLoadIdentity(); @@ -1014,7 +1014,6 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat } } - if(!hidehudmsgs) hudmsgs.render(); if(p->state == CS_ALIVE || (p->state == CS_DEAD && p->spectatemode == SM_DEATHCAM)) { glLoadIdentity(); @@ -1068,6 +1067,12 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat } } + if(!hidehudmsgs) hudmsgs.render(); + + glLoadIdentity(); + glOrtho(0, VIRTW, VIRTH, 0, -1, 1); + if(command) commandh -= rendercommand(20, 1570, VIRTW - FONTH); + glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); glEnable(GL_DEPTH_TEST);