mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
Create V_DrawRightAlignedSmallThinStringAtFixed() for new "small-thin-fixed-right" option in v.drawString()
You guys have no idea how long this took to code.
This commit is contained in:
parent
c858d9fd4d
commit
4cbcb68795
3 changed files with 31 additions and 0 deletions
|
@ -123,6 +123,7 @@ enum align {
|
|||
align_smallright,
|
||||
align_smallthin,
|
||||
align_smallthinfixed,
|
||||
align_smallthinfixedright,
|
||||
align_thin,
|
||||
align_thinfixed,
|
||||
align_thinfixedcenter,
|
||||
|
@ -145,6 +146,7 @@ static const char *const align_opt[] = {
|
|||
"small-right",
|
||||
"small-thin",
|
||||
"small-thin-fixed",
|
||||
"small-thin-fixed-right",
|
||||
"thin",
|
||||
"thin-fixed",
|
||||
"thin-fixed-center",
|
||||
|
@ -784,6 +786,9 @@ static int libd_drawString(lua_State *L)
|
|||
case align_smallthinfixed:
|
||||
V_DrawSmallThinStringAtFixed(x, y, flags, str);
|
||||
break;
|
||||
case align_smallthinfixedright:
|
||||
V_DrawRightAlignedSmallThinStringAtFixed(x, y, flags, str);
|
||||
break;
|
||||
// tny_font
|
||||
case align_thin:
|
||||
V_DrawThinString(x, y, flags, str);
|
||||
|
|
|
@ -2435,6 +2435,13 @@ void V_DrawSmallThinString(INT32 x, INT32 y, INT32 option, const char *string)
|
|||
V_DrawSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string);
|
||||
}
|
||||
|
||||
/*void V_DrawRightAlignedSmallThinString(INT32 x, INT32 y, INT32 option, const char *string)
|
||||
{
|
||||
x <<= FRACBITS;
|
||||
y <<= FRACBITS;
|
||||
V_DrawRightAlignedSmallThinStringAtFixed((fixed_t)x, (fixed_t)y, option, string);
|
||||
}*/
|
||||
|
||||
// Draws a string at a fixed_t location.
|
||||
void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
|
@ -2878,6 +2885,12 @@ void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char
|
|||
}
|
||||
}
|
||||
|
||||
void V_DrawRightAlignedSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
|
||||
{
|
||||
x -= V_SmallThinStringWidth(string, option)/2;
|
||||
V_DrawSmallThinStringAtFixed(x, y, option, string);
|
||||
}
|
||||
|
||||
// Draws a tallnum. Replaces two functions in y_inter and st_stuff
|
||||
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num)
|
||||
{
|
||||
|
@ -3435,6 +3448,15 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
|
|||
return w;
|
||||
}
|
||||
|
||||
//
|
||||
// Find string width from tny_font chars, 0.5x scale
|
||||
//
|
||||
INT32 V_SmallThinStringWidth(const char *string, INT32 option)
|
||||
{
|
||||
INT32 w = V_ThinStringWidth(string, option)<<FRACBITS;
|
||||
return w/2 + FRACUNIT; // +FRACUNIT because otherwise it's offset wrong.
|
||||
}
|
||||
|
||||
boolean *heatshifter = NULL;
|
||||
INT32 lastheight = 0;
|
||||
INT32 heatindex[2] = { 0, 0 };
|
||||
|
|
|
@ -231,7 +231,9 @@ void V_DrawThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *str
|
|||
void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
|
||||
// draw a string using the tny_font at fixed_t coordinates, 0.5x scale
|
||||
void V_DrawSmallThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
void V_DrawRightAlignedSmallThinStringAtFixed(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
// Draw tall nums, used for menu, HUD, intermission
|
||||
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);
|
||||
|
@ -257,6 +259,8 @@ INT32 V_StringWidth(const char *string, INT32 option);
|
|||
INT32 V_SmallStringWidth(const char *string, INT32 option);
|
||||
// Find string width from tny_font chars
|
||||
INT32 V_ThinStringWidth(const char *string, INT32 option);
|
||||
// Find string width from tny_font chars, 0.5x scale
|
||||
INT32 V_SmallThinStringWidth(const char *string, INT32 option);
|
||||
|
||||
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
|
||||
|
||||
|
|
Loading…
Reference in a new issue