diff --git a/source/src/main.cpp b/source/src/main.cpp index 46e41601..0e0d7f29 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -834,7 +834,9 @@ int main(int argc, char **argv) initlog("console"); persistidents = false; - if(!execfile("config/font.cfg")) fatal("cannot find font definitions"); + if(!execfile("config/font.cfg")) fatal("cannot find default font definitions"); + if(!execfile("config/mono.cfg")) fatal("cannot find default font definitions"); + if(!setfont("mono")) fatal("no mono font specified"); if(!setfont("default")) fatal("no default font specified"); loadingscreen(); diff --git a/source/src/menus.cpp b/source/src/menus.cpp index 35bbba00..a6d04e62 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -768,6 +768,7 @@ void *addmenu(const char *name, const char *title, bool allowinput, void (__cdec menu.refreshfunc = refreshfunc; menu.keyfunc = keyfunc; menu.initaction = NULL; + menu.usefont = NULL; menu.dirlist = NULL; menu.forwardkeys = forwardkeys; lastmenu = &menu; @@ -810,6 +811,16 @@ void menuheader(void *menu, char *header, char *footer) m.footer = footer && footer[0] ? footer : NULL; } +void menufont(void *menu, const char *usefont) +{ + gmenu &m = *(gmenu *)menu; + if(usefont==NULL) + { + DELETEA(m.usefont); + m.usefont = NULL; + } else m.usefont = newstring(usefont); +} + void menuinit(char *initaction) { if(!lastmenu) return; @@ -1155,6 +1166,7 @@ void gmenu::init() void gmenu::render() { + if(usefont) setfont(usefont); const char *t = title; if(!t) { @@ -1219,6 +1231,7 @@ void gmenu::render() else if(items.inrange(menusel) && items[menusel]->getdesc()) draw_text(items[menusel]->getdesc(), x, y); } + if(usefont) setfont("default"); } void gmenu::renderbg(int x1, int y1, int x2, int y2, bool border) @@ -1293,5 +1306,27 @@ void reorderscorecolumns() } } - - +void setscorefont(); +VARFP(scorefont, 0, 0, 1, setscorefont()); +void setscorefont() +{ + extern void *scoremenu, *teammenu, *ctfmenu; + switch(scorefont) + { + case 1: + { + menufont(scoremenu, "mono"); + menufont(teammenu, "mono"); + menufont(ctfmenu, "mono"); + break; + } + case 0: + default: + { + menufont(scoremenu, NULL); // "default" + menufont(teammenu, NULL); // "default" + menufont(ctfmenu, NULL); // "default" + break; + } + } +} diff --git a/source/src/protos.h b/source/src/protos.h index 64485974..26b6abb6 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -121,18 +121,20 @@ struct gmenu void (__cdecl *refreshfunc)(void *, bool); bool (__cdecl *keyfunc)(void *, int, bool, int); char *initaction; + char *usefont; const char *mdl; int anim, rotspeed, scale; mdirlist *dirlist; - gmenu() : name(0), title(0), header(0), footer(0), initaction(0), mdl(0), dirlist(0) {} + gmenu() : name(0), title(0), header(0), footer(0), initaction(0), usefont(0), mdl(0), dirlist(0) {} virtual ~gmenu() { DELETEA(name); DELETEA(mdl); DELETEP(dirlist); DELETEA(initaction); + DELETEA(usefont); items.deletecontents(); }