From d96e11f4c43070d41557e2021832c3fb3308fb9d Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sat, 11 Oct 2008 23:47:27 +0000 Subject: [PATCH] don't let the timer get pushed down by other messages git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2974 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 3 ++- source/src/protos.h | 5 ++++- source/src/renderhud.cpp | 12 +++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index a89f83c0..b4bbe102 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -296,7 +296,8 @@ bool showhudtimer(int maxsecs, int startmillis, const char *msg, bool flash) s_strcat(str, sec); } } - hudeditf(HUDMSG_TIMER, nextticks < maxticks ? (flash ? str : str+2) : msg); + if(nextticks < maxticks) hudeditf(HUDMSG_TIMER|HUDMSG_OVERWRITE, flash ? str : str+2); + else hudeditf(HUDMSG_TIMER, msg); return true; } diff --git a/source/src/protos.h b/source/src/protos.h index 2a7908ca..c861518f 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -475,7 +475,10 @@ extern void pruneundos(int maxremain = 0); enum { HUDMSG_INFO = 0, - HUDMSG_TIMER + HUDMSG_TIMER, + + HUDMSG_TYPE = 0xFF, + HUDMSG_OVERWRITE = 1<<8 }; extern void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater); extern void loadingscreen(const char *fmt = NULL, ...); diff --git a/source/src/renderhud.cpp b/source/src/renderhud.cpp index 2701fad8..d7b5853c 100644 --- a/source/src/renderhud.cpp +++ b/source/src/renderhud.cpp @@ -273,14 +273,20 @@ struct hudmessages : consolebuffer void addline(const char *sf) { - consolebuffer::addline(sf, totalmillis); + if(conlines.length() && conlines[0].type&HUDMSG_OVERWRITE) + { + conlines[0].millis = totalmillis; + conlines[0].type = HUDMSG_INFO; + s_strcpy(conlines[0].line, sf); + } + else consolebuffer::addline(sf, totalmillis); } void editline(int type, const char *sf) { - if(!conlines.length()) return; - if(conlines.length() && conlines[0].type==type) + if(conlines.length() && ((conlines[0].type&HUDMSG_TYPE)==(type&HUDMSG_TYPE) || conlines[0].type&HUDMSG_OVERWRITE)) { conlines[0].millis = totalmillis; + conlines[0].type = type; s_strcpy(conlines[0].line, sf); } else consolebuffer::addline(sf, totalmillis).type = type;