diff --git a/source/src/menus.cpp b/source/src/menus.cpp index 10a7cba1..9c454339 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -790,6 +790,7 @@ void *addmenu(const char *name, const char *title, bool allowinput, void (__cdec menu.keyfunc = keyfunc; menu.initaction = NULL; menu.usefont = NULL; + menu.allowblink = false; menu.dirlist = NULL; menu.forwardkeys = forwardkeys; lastmenu = &menu; @@ -857,6 +858,13 @@ void setmenufont(char *usefont) menufont(lastmenu, usefont); } +void setmenublink(int truth) +{ + if(!lastmenu) return; + gmenu &m = *(gmenu *)lastmenu; + m.allowblink = truth != 0; +} + void menuinit(char *initaction) { if(!lastmenu) return; @@ -992,6 +1000,7 @@ COMMAND(chmenumdl, ARG_6STR); COMMANDN(showmenu, showmenu_, ARG_1STR); COMMAND(closemenu, ARG_1STR); COMMANDN(menufont, setmenufont, ARG_1STR); +COMMANDN(menucanblink, setmenublink, ARG_1INT); COMMAND(menuinit, ARG_1STR); COMMAND(menuinitselection, ARG_1INT); COMMAND(menuselection, ARG_2STR); @@ -1225,7 +1234,9 @@ void gmenu::init() void gmenu::render() { + extern bool ignoreblinkingbit; if(usefont) pushfont(usefont); + if(!allowblink) ignoreblinkingbit = true; const char *t = title; if(!t) { @@ -1327,6 +1338,7 @@ void gmenu::render() } if(usefont) popfont(); // setfont("default"); + ignoreblinkingbit = false; } void gmenu::renderbg(int x1, int y1, int x2, int y2, bool border) diff --git a/source/src/protos.h b/source/src/protos.h index 327fcd87..76dbc175 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -143,13 +143,13 @@ struct gmenu bool (__cdecl *keyfunc)(void *, int, bool, int); char *initaction; char *usefont; - + bool allowblink; const char *mdl; int anim, rotspeed, scale; int footlen; mdirlist *dirlist; - gmenu() : name(0), title(0), header(0), footer(0), initaction(0), usefont(0), mdl(0), footlen(0), dirlist(0) {} + gmenu() : name(0), title(0), header(0), footer(0), initaction(0), usefont(0), allowblink(0), mdl(0), footlen(0), dirlist(0) {} virtual ~gmenu() { DELETEA(name); @@ -521,6 +521,7 @@ struct font #define PIXELTAB (10*curfont->defaultw) extern int VIRTW; // virtual screen size for text & HUD +extern bool ignoreblinkingbit; extern font *curfont; extern void initfont(); diff --git a/source/src/rendertext.cpp b/source/src/rendertext.cpp index 6d32aa73..8ec4398e 100644 --- a/source/src/rendertext.cpp +++ b/source/src/rendertext.cpp @@ -3,12 +3,14 @@ #include "cube.h" int VIRTW; - +bool ignoreblinkingbit = false; // for remote-n-temp override of '\fb' static hashtable fonts; static font *fontdef = NULL; font *curfont = NULL; +VARP(allowblinkingtext, 0, 0, 1); // if you're so inclined + void newfont(char *name, char *tex, char *defaultw, char *defaulth, char *offsetx, char *offsety, char *offsetw, char *offseth) { font *f = fonts.access(name); @@ -317,7 +319,7 @@ static void text_color(char c, char *stack, int size, int &sp, bvec color, int a else { if(c=='r') c = stack[(sp > 0) ? --sp : sp]; // restore color - else if(c == 'b') stack[sp] *= -1; + else if(c == 'b') { if(allowblinkingtext && !ignoreblinkingbit) stack[sp] *= -1; } // blinking text - only if allowed else stack[sp] = c; switch(abs(stack[sp])) {