mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-26 14:33:46 -04:00
hard-code startchar to HU_FONTSTART for all widgets
This commit is contained in:
parent
7ab38ec4a6
commit
34bc2ef837
29
src/hu_lib.c
29
src/hu_lib.c
@ -94,13 +94,12 @@ void HUlib_clearTextLine(hu_textline_t* t)
|
|||||||
// Returns nothing
|
// Returns nothing
|
||||||
//
|
//
|
||||||
|
|
||||||
void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t ***f, int sc,
|
void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t ***f,
|
||||||
char *cr, void (*builder)(void)) //jff 2/16/98 add color range parameter
|
char *cr, void (*builder)(void)) //jff 2/16/98 add color range parameter
|
||||||
{
|
{
|
||||||
t->x = x;
|
t->x = x;
|
||||||
t->y = y;
|
t->y = y;
|
||||||
t->f = f;
|
t->f = f;
|
||||||
t->sc = sc;
|
|
||||||
t->cr = cr;
|
t->cr = cr;
|
||||||
t->builder = builder;
|
t->builder = builder;
|
||||||
HUlib_clearTextLine(t);
|
HUlib_clearTextLine(t);
|
||||||
@ -153,8 +152,8 @@ void HUlib_addStringToTextLine(hu_textline_t *l, char *s)
|
|||||||
}
|
}
|
||||||
else if (c == '\t')
|
else if (c == '\t')
|
||||||
w = (w + TABWIDTH) & ~TABWIDTH;
|
w = (w + TABWIDTH) & ~TABWIDTH;
|
||||||
else if (c != ' ' && c >= l->sc && c <= HU_FONTEND + 6)
|
else if (c != ' ' && c >= HU_FONTSTART && c <= HU_FONTEND + 6)
|
||||||
w += SHORT(f[c - l->sc]->width);
|
w += SHORT(f[c - HU_FONTSTART]->width);
|
||||||
else
|
else
|
||||||
w += 4;
|
w += 4;
|
||||||
|
|
||||||
@ -274,13 +273,13 @@ static void HUlib_drawTextLineAligned(hu_textline_t *l, boolean drawcursor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (c != ' ' && c >= l->sc && c <= HU_FONTEND + 6)
|
if (c != ' ' && c >= HU_FONTSTART && c <= HU_FONTEND + 6)
|
||||||
{
|
{
|
||||||
int w = SHORT(f[c - l->sc]->width);
|
int w = SHORT(f[c - HU_FONTSTART]->width);
|
||||||
if (x+w > SCREENWIDTH)
|
if (x+w > SCREENWIDTH)
|
||||||
break;
|
break;
|
||||||
// killough 1/18/98 -- support multiple lines:
|
// killough 1/18/98 -- support multiple lines:
|
||||||
V_DrawPatchTranslated(x, y, FG, f[c - l->sc], l->cr);
|
V_DrawPatchTranslated(x, y, FG, f[c - HU_FONTSTART], l->cr);
|
||||||
x += w;
|
x += w;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -292,8 +291,8 @@ static void HUlib_drawTextLineAligned(hu_textline_t *l, boolean drawcursor)
|
|||||||
|
|
||||||
// draw the cursor if requested
|
// draw the cursor if requested
|
||||||
// killough 1/18/98 -- support multiple lines
|
// killough 1/18/98 -- support multiple lines
|
||||||
if (drawcursor && x + SHORT(f['_' - l->sc]->width) <= SCREENWIDTH)
|
if (drawcursor && x + SHORT(f['_' - HU_FONTSTART]->width) <= SCREENWIDTH)
|
||||||
V_DrawPatchTranslated(x, y, FG, f['_' - l->sc], l->cr);
|
V_DrawPatchTranslated(x, y, FG, f['_' - HU_FONTSTART], l->cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUlib_drawTextLine(hu_textline_t *l, align_t align, boolean drawcursor)
|
void HUlib_drawTextLine(hu_textline_t *l, align_t align, boolean drawcursor)
|
||||||
@ -360,7 +359,7 @@ void HUlib_eraseTextLine(hu_textline_t* l)
|
|||||||
//jff 2/16/98 add color range parameter
|
//jff 2/16/98 add color range parameter
|
||||||
|
|
||||||
void HUlib_initSText(hu_stext_t *s, int x, int y, int h, patch_t ***font,
|
void HUlib_initSText(hu_stext_t *s, int x, int y, int h, patch_t ***font,
|
||||||
int startchar, char *cr, boolean *on)
|
char *cr, boolean *on)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -370,7 +369,7 @@ void HUlib_initSText(hu_stext_t *s, int x, int y, int h, patch_t ***font,
|
|||||||
s->cl = 0;
|
s->cl = 0;
|
||||||
for (i=0;i<h;i++)
|
for (i=0;i<h;i++)
|
||||||
HUlib_initTextLine(s->l+i, x, y - i*(SHORT((*font[0])->height)+1),
|
HUlib_initTextLine(s->l+i, x, y - i*(SHORT((*font[0])->height)+1),
|
||||||
font, startchar, cr, NULL);
|
font, cr, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -474,7 +473,7 @@ void HUlib_eraseSText(hu_stext_t* s)
|
|||||||
//
|
//
|
||||||
|
|
||||||
void HUlib_initMText(hu_mtext_t *m, int x, int y, patch_t ***font,
|
void HUlib_initMText(hu_mtext_t *m, int x, int y, patch_t ***font,
|
||||||
int startchar, char *cr, boolean *on)
|
char *cr, boolean *on)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -488,7 +487,7 @@ void HUlib_initMText(hu_mtext_t *m, int x, int y, patch_t ***font,
|
|||||||
|
|
||||||
y += HU_REFRESHSPACING * hud_msg_lines;
|
y += HU_REFRESHSPACING * hud_msg_lines;
|
||||||
for (i=0; i<hud_msg_lines; i++, y -= HU_REFRESHSPACING)
|
for (i=0; i<hud_msg_lines; i++, y -= HU_REFRESHSPACING)
|
||||||
HUlib_initTextLine(&m->l[i], x, y, font, startchar, cr, NULL);
|
HUlib_initTextLine(&m->l[i], x, y, font, cr, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -604,12 +603,12 @@ void HUlib_eraseMText(hu_mtext_t *m)
|
|||||||
//jff 2/16/98 add color range parameter
|
//jff 2/16/98 add color range parameter
|
||||||
|
|
||||||
void HUlib_initIText(hu_itext_t *it, int x, int y, patch_t ***font,
|
void HUlib_initIText(hu_itext_t *it, int x, int y, patch_t ***font,
|
||||||
int startchar, char *cr, boolean *on)
|
char *cr, boolean *on)
|
||||||
{
|
{
|
||||||
it->lm = 0; // default left margin is start of text
|
it->lm = 0; // default left margin is start of text
|
||||||
it->on = on;
|
it->on = on;
|
||||||
it->laston = true;
|
it->laston = true;
|
||||||
HUlib_initTextLine(&it->l, x, y, font, startchar, cr, NULL);
|
HUlib_initTextLine(&it->l, x, y, font, cr, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following deletion routines adhere to the left margin restriction
|
// The following deletion routines adhere to the left margin restriction
|
||||||
|
@ -52,7 +52,6 @@ typedef struct
|
|||||||
int y;
|
int y;
|
||||||
|
|
||||||
patch_t ***f; // font
|
patch_t ***f; // font
|
||||||
int sc; // start character
|
|
||||||
char *cr; //jff 2/16/52 output color range
|
char *cr; //jff 2/16/52 output color range
|
||||||
|
|
||||||
// killough 1/23/98: Support multiple lines:
|
// killough 1/23/98: Support multiple lines:
|
||||||
@ -158,7 +157,6 @@ void HUlib_initTextLine
|
|||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
patch_t ***f,
|
patch_t ***f,
|
||||||
int sc,
|
|
||||||
char *cr, //jff 2/16/98 add color range parameter
|
char *cr, //jff 2/16/98 add color range parameter
|
||||||
void (*builder)(void)
|
void (*builder)(void)
|
||||||
);
|
);
|
||||||
@ -186,7 +184,6 @@ void HUlib_initSText
|
|||||||
int y,
|
int y,
|
||||||
int h,
|
int h,
|
||||||
patch_t ***font,
|
patch_t ***font,
|
||||||
int startchar,
|
|
||||||
char *cr, //jff 2/16/98 add color range parameter
|
char *cr, //jff 2/16/98 add color range parameter
|
||||||
boolean* on );
|
boolean* on );
|
||||||
|
|
||||||
@ -209,7 +206,6 @@ void HUlib_initMText
|
|||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
patch_t ***font,
|
patch_t ***font,
|
||||||
int startchar,
|
|
||||||
char *cr,
|
char *cr,
|
||||||
boolean *on
|
boolean *on
|
||||||
);
|
);
|
||||||
@ -234,7 +230,6 @@ void HUlib_initIText
|
|||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
patch_t ***font,
|
patch_t ***font,
|
||||||
int startchar,
|
|
||||||
char *cr, //jff 2/16/98 add color range parameter
|
char *cr, //jff 2/16/98 add color range parameter
|
||||||
boolean* on );
|
boolean* on );
|
||||||
|
|
||||||
|
@ -569,15 +569,15 @@ void HU_Start(void)
|
|||||||
// create the message widget
|
// create the message widget
|
||||||
// messages to player in upper-left of screen
|
// messages to player in upper-left of screen
|
||||||
HUlib_initSText(&w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, &hu_font,
|
HUlib_initSText(&w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, &hu_font,
|
||||||
HU_FONTSTART, colrngs[hudcolor_mesg], &message_on);
|
colrngs[hudcolor_mesg], &message_on);
|
||||||
|
|
||||||
// create the secret message widget
|
// create the secret message widget
|
||||||
HUlib_initSText(&w_secret, 0, 100 - 2*SHORT(hu_font[0]->height), HU_MSGHEIGHT, &hu_font,
|
HUlib_initSText(&w_secret, 0, 100 - 2*SHORT(hu_font[0]->height), HU_MSGHEIGHT, &hu_font,
|
||||||
HU_FONTSTART, colrngs[CR_GOLD], &secret_on);
|
colrngs[CR_GOLD], &secret_on);
|
||||||
|
|
||||||
//jff 2/26/98 add the text refresh widget initialization
|
//jff 2/26/98 add the text refresh widget initialization
|
||||||
HUlib_initMText(&w_rtext, HU_MSGX, HU_MSGY, &hu_font,
|
HUlib_initMText(&w_rtext, HU_MSGX, HU_MSGY, &hu_font,
|
||||||
HU_FONTSTART, colrngs[hudcolor_mesg], &message_list_on); // killough 11/98
|
colrngs[hudcolor_mesg], &message_list_on); // killough 11/98
|
||||||
|
|
||||||
// create the hud text refresh widget
|
// create the hud text refresh widget
|
||||||
// scrolling display of last hud_msg_lines messages received
|
// scrolling display of last hud_msg_lines messages received
|
||||||
@ -588,44 +588,44 @@ void HU_Start(void)
|
|||||||
|
|
||||||
// create the chat widget
|
// create the chat widget
|
||||||
HUlib_initIText(&w_chat, HU_INPUTX, HU_INPUTY, &hu_font,
|
HUlib_initIText(&w_chat, HU_INPUTX, HU_INPUTY, &hu_font,
|
||||||
HU_FONTSTART, colrngs[hudcolor_chat], &chat_on);
|
colrngs[hudcolor_chat], &chat_on);
|
||||||
|
|
||||||
// create the inputbuffer widgets, one per player
|
// create the inputbuffer widgets, one per player
|
||||||
for (i = 0; i < MAXPLAYERS; i++)
|
for (i = 0; i < MAXPLAYERS; i++)
|
||||||
{
|
{
|
||||||
HUlib_initIText(&w_inputbuffer[i], 0, 0, 0,
|
HUlib_initIText(&w_inputbuffer[i], 0, 0, 0,
|
||||||
0, colrngs[hudcolor_chat], &always_off);
|
colrngs[hudcolor_chat], &always_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
//jff 2/16/98 added some HUD widgets
|
//jff 2/16/98 added some HUD widgets
|
||||||
// create the map title widget - map title display in lower left of automap
|
// create the map title widget - map title display in lower left of automap
|
||||||
HUlib_initTextLine(&w_title, HU_TITLEX, HU_TITLEY, &hu_font,
|
HUlib_initTextLine(&w_title, HU_TITLEX, HU_TITLEY, &hu_font,
|
||||||
HU_FONTSTART, colrngs[hudcolor_titl], NULL); // [FG] built only once below
|
colrngs[hudcolor_titl], NULL); // [FG] built only once below
|
||||||
|
|
||||||
// create the hud health widget
|
// create the hud health widget
|
||||||
HUlib_initTextLine(&w_health, 0, 0, &hu_font2, HU_FONTSTART, colrngs[CR_GREEN], HU_widget_build_health);
|
HUlib_initTextLine(&w_health, 0, 0, &hu_font2, colrngs[CR_GREEN], HU_widget_build_health);
|
||||||
|
|
||||||
// create the hud armor widget
|
// create the hud armor widget
|
||||||
HUlib_initTextLine(&w_armor, 0, 0, &hu_font2, HU_FONTSTART, colrngs[CR_GREEN], HU_widget_build_armor);
|
HUlib_initTextLine(&w_armor, 0, 0, &hu_font2, colrngs[CR_GREEN], HU_widget_build_armor);
|
||||||
|
|
||||||
// create the hud ammo widget
|
// create the hud ammo widget
|
||||||
HUlib_initTextLine(&w_ammo, 0, 0, &hu_font2, HU_FONTSTART, colrngs[CR_GOLD], HU_widget_build_ammo);
|
HUlib_initTextLine(&w_ammo, 0, 0, &hu_font2, colrngs[CR_GOLD], HU_widget_build_ammo);
|
||||||
|
|
||||||
// create the hud weapons widget
|
// create the hud weapons widget
|
||||||
HUlib_initTextLine(&w_weapon, 0, 0, &hu_font2, HU_FONTSTART, colrngs[CR_GRAY], HU_widget_build_weapon);
|
HUlib_initTextLine(&w_weapon, 0, 0, &hu_font2, colrngs[CR_GRAY], HU_widget_build_weapon);
|
||||||
|
|
||||||
// create the hud keys widget
|
// create the hud keys widget
|
||||||
HUlib_initTextLine(&w_keys, 0, 0, &hu_font2, HU_FONTSTART, colrngs[CR_GRAY], deathmatch ? HU_widget_build_frag : HU_widget_build_keys);
|
HUlib_initTextLine(&w_keys, 0, 0, &hu_font2, colrngs[CR_GRAY], deathmatch ? HU_widget_build_frag : HU_widget_build_keys);
|
||||||
|
|
||||||
// create the hud monster/secret widget
|
// create the hud monster/secret widget
|
||||||
HUlib_initTextLine(&w_monsec, 0, 0, &hu_font2, HU_FONTSTART, colrngs[CR_GRAY], HU_widget_build_monsec);
|
HUlib_initTextLine(&w_monsec, 0, 0, &hu_font2, colrngs[CR_GRAY], HU_widget_build_monsec);
|
||||||
|
|
||||||
HUlib_initTextLine(&w_sttime, 0, 0, &hu_font2, HU_FONTSTART, colrngs[CR_GRAY], HU_widget_build_sttime);
|
HUlib_initTextLine(&w_sttime, 0, 0, &hu_font2, colrngs[CR_GRAY], HU_widget_build_sttime);
|
||||||
|
|
||||||
// create the automaps coordinate widget
|
// create the automaps coordinate widget
|
||||||
HUlib_initTextLine(&w_coord, 0, 0, &hu_font2, HU_FONTSTART, colrngs[hudcolor_xyco], HU_widget_build_coord);
|
HUlib_initTextLine(&w_coord, 0, 0, &hu_font2, colrngs[hudcolor_xyco], HU_widget_build_coord);
|
||||||
|
|
||||||
HUlib_initTextLine(&w_fps, 0, 0, &hu_font2, HU_FONTSTART, colrngs[hudcolor_xyco], HU_widget_build_fps);
|
HUlib_initTextLine(&w_fps, 0, 0, &hu_font2, colrngs[hudcolor_xyco], HU_widget_build_fps);
|
||||||
|
|
||||||
// initialize the automap's level title widget
|
// initialize the automap's level title widget
|
||||||
HU_widget_build_title();
|
HU_widget_build_title();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user