blinking-text disabled by default (general and in menus)

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6113 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
flowtron
2011-02-28 16:09:51 +00:00
parent da984e5593
commit e6ce8cae06
3 changed files with 19 additions and 4 deletions
+12
View File
@@ -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)
+3 -2
View File
@@ -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();
+4 -2
View File
@@ -3,12 +3,14 @@
#include "cube.h"
int VIRTW;
bool ignoreblinkingbit = false; // for remote-n-temp override of '\fb'
static hashtable<const char *, font> 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]))
{