column titles highlight on mouse hover in menu_servers2, fix to menu options, fixed infinite loop issue with Draw_FunStringLen
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2128 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
d2c2021680
commit
0269b18460
3 changed files with 51 additions and 19 deletions
|
@ -327,10 +327,10 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
|
|||
else
|
||||
Draw_Character (x, y, 129);
|
||||
#endif
|
||||
if (on)
|
||||
Draw_String (x, y, "on");
|
||||
if (!menu->cursoritem && menu->selecteditem == option)
|
||||
Draw_Alt_String (x, y, on ? "on" : "off");
|
||||
else
|
||||
Draw_String (x, y, "off");
|
||||
Draw_String (x, y, on ? "on" : "off");
|
||||
}
|
||||
break;
|
||||
case mt_edit:
|
||||
|
|
|
@ -899,23 +899,51 @@ typedef struct {
|
|||
menupicture_t *mappic;
|
||||
} serverlist_t;
|
||||
|
||||
void SL_DrawColumnTitle (int *x, int y, int xlen, int mx, char *str, qboolean recolor, qbyte clr, qboolean *filldraw)
|
||||
{
|
||||
int xmin;
|
||||
|
||||
if (x == NULL)
|
||||
xmin = 0;
|
||||
else
|
||||
xmin = (*x - xlen);
|
||||
|
||||
if (recolor)
|
||||
str = va("^&%c-%s", clr, str);
|
||||
if (mx > xmin && !(*filldraw))
|
||||
{
|
||||
*filldraw = true;
|
||||
Draw_FillRGB(xmin*8, y, xlen*8, 8, (sin(realtime*4.4)*0.25)+0.5, (sin(realtime*4.4)*0.25)+0.5, 0.08);
|
||||
}
|
||||
Draw_FunStringLen(xmin*8, y, str, xlen);
|
||||
|
||||
if (x != NULL)
|
||||
*x -= xlen + 1;
|
||||
}
|
||||
|
||||
void SL_TitlesDraw (int x, int y, menucustom_t *ths, menu_t *menu)
|
||||
{
|
||||
char *smark;
|
||||
int sf = Master_GetSortField();
|
||||
extern int mousecursor_x, mousecursor_y;
|
||||
int mx = mousecursor_x/8;
|
||||
qboolean filldraw = false;
|
||||
qbyte clr;
|
||||
|
||||
if (Master_GetSortDescending())
|
||||
smark = "^6%s";
|
||||
clr = 'D';
|
||||
else
|
||||
smark = "^5%s";
|
||||
clr = 'B';
|
||||
x = ths->common.width/8;
|
||||
if (sb_showtimelimit.value) {Draw_FunStringLen((x-3)*8, y, va((sf==SLKEY_TIMELIMIT)?smark:"%s", "tl"), 3); x-=4;}
|
||||
if (sb_showfraglimit.value) {Draw_FunStringLen((x-3)*8, y, va((sf==SLKEY_FRAGLIMIT)?smark:"%s", "fl"), 3); x-=4;}
|
||||
if (sb_showplayers.value) {Draw_FunStringLen((x-5)*8, y, va((sf==SLKEY_NUMPLAYERS)?smark:"%s", "plyrs"), 5); x-=6;}
|
||||
if (sb_showmap.value) {Draw_FunStringLen((x-8)*8, y, va((sf==SLKEY_MAP)?smark:"%s", "map"), 8); x-=9;}
|
||||
if (sb_showgamedir.value) {Draw_FunStringLen((x-8)*8, y, va((sf==SLKEY_GAMEDIR)?smark:"%s", "gamedir"), 8); x-=9;}
|
||||
if (sb_showping.value) {Draw_FunStringLen((x-3)*8, y, va((sf==SLKEY_PING)?smark:"%s", "png"), 3); x-=4;}
|
||||
if (sb_showaddress.value) {Draw_FunStringLen((x-21)*8, y, va((sf==SLKEY_ADDRESS)?smark:"%s", "address"), 21); x-=22;}
|
||||
Draw_FunStringLen(0, y, va((sf==SLKEY_NAME)?smark:"%s", "hostname^7 "), x);
|
||||
if (mx > x || mousecursor_y < y || mousecursor_y >= y+8)
|
||||
filldraw = true;
|
||||
if (sb_showtimelimit.value) {SL_DrawColumnTitle(&x, y, 3, mx, "tl", (sf==SLKEY_TIMELIMIT), clr, &filldraw);}
|
||||
if (sb_showfraglimit.value) {SL_DrawColumnTitle(&x, y, 3, mx, "fl", (sf==SLKEY_FRAGLIMIT), clr, &filldraw);}
|
||||
if (sb_showplayers.value) {SL_DrawColumnTitle(&x, y, 5, mx, "plyrs", (sf==SLKEY_NUMPLAYERS), clr, &filldraw);}
|
||||
if (sb_showmap.value) {SL_DrawColumnTitle(&x, y, 8, mx, "map", (sf==SLKEY_MAP), clr, &filldraw);}
|
||||
if (sb_showgamedir.value) {SL_DrawColumnTitle(&x, y, 8, mx, "gamedir", (sf==SLKEY_GAMEDIR), clr, &filldraw);}
|
||||
if (sb_showping.value) {SL_DrawColumnTitle(&x, y, 3, mx, "png", (sf==SLKEY_PING), clr, &filldraw);}
|
||||
if (sb_showaddress.value) {SL_DrawColumnTitle(&x, y, 21, mx, "address", (sf==SLKEY_ADDRESS), clr, &filldraw);}
|
||||
SL_DrawColumnTitle(NULL, y, x, mx, "hostname^7 ", (sf==SLKEY_NAME), clr, &filldraw);
|
||||
}
|
||||
|
||||
qboolean SL_TitlesKey (menucustom_t *ths, menu_t *menu, int key)
|
||||
|
|
|
@ -129,21 +129,20 @@ void Draw_FunString(int x, int y, unsigned char *str)
|
|||
{
|
||||
if (isextendedcode(str[1]) && isextendedcode(str[2]))
|
||||
{
|
||||
str++;// '&'
|
||||
str++;// foreground char
|
||||
if (*str == '-') // default for FG
|
||||
ext = (COLOR_WHITE << CON_FGSHIFT) | (ext&~CON_FGMASK);
|
||||
else if (*str >= 'A')
|
||||
ext = ((*str - ('A' - 10)) << CON_FGSHIFT) | (ext&~CON_FGMASK);
|
||||
else
|
||||
ext = ((*str - '0') << CON_FGSHIFT) | (ext&~CON_FGMASK);
|
||||
str++; // foreground char
|
||||
str++; // background char
|
||||
if (*str == '-') // default (clear) for BG
|
||||
ext &= ~CON_BGMASK & ~CON_NONCLEARBG;
|
||||
else if (*str >= 'A')
|
||||
ext = ((*str - ('A' - 10)) << CON_BGSHIFT) | (ext&~CON_BGMASK) | CON_NONCLEARBG;
|
||||
else
|
||||
ext = ((*str - '0') << CON_BGSHIFT) | (ext&~CON_BGMASK) | CON_NONCLEARBG;
|
||||
str++; // background char
|
||||
continue;
|
||||
}
|
||||
// else invalid code
|
||||
|
@ -226,7 +225,7 @@ void Draw_FunStringLen(int x, int y, unsigned char *str, int len)
|
|||
}
|
||||
else if (*str == '&') // extended code
|
||||
{
|
||||
if (isextendedcode(*str+1) && isextendedcode(*str+2))
|
||||
if (isextendedcode(str[1]) && isextendedcode(str[2]))
|
||||
{
|
||||
str++; // foreground char
|
||||
if (*str == '-') // default for FG
|
||||
|
@ -242,9 +241,14 @@ void Draw_FunStringLen(int x, int y, unsigned char *str, int len)
|
|||
ext = ((*str - ('A' - 10)) << CON_BGSHIFT) | (ext&~CON_BGMASK) | CON_NONCLEARBG;
|
||||
else
|
||||
ext = ((*str - '0') << CON_BGSHIFT) | (ext&~CON_BGMASK) | CON_NONCLEARBG;
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
str--; // else invalid code
|
||||
// else invalid code
|
||||
Draw_ColouredCharacter(x, y, '^' | ext);
|
||||
Draw_ColouredCharacter(x, y, '&' | ext);
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
else if (*str == 'a')
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue