mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-27 11:41:16 +00:00
Reorganize v_video.c a little, clean up v_video.h a little.
This commit is contained in:
parent
7929a89394
commit
f1bf065777
2 changed files with 61 additions and 70 deletions
121
src/v_video.c
121
src/v_video.c
|
@ -1979,47 +1979,6 @@ void V_DrawPromptBack(INT32 boxheight, INT32 color)
|
|||
*buf = promptbgmap[*buf];
|
||||
}
|
||||
|
||||
// Gets string colormap, used for 0x80 color codes
|
||||
//
|
||||
UINT8 *V_GetStringColormap(INT32 colorflags)
|
||||
{
|
||||
switch ((colorflags & V_CHARCOLORMASK) >> V_CHARCOLORSHIFT)
|
||||
{
|
||||
case 1: // 0x81, magenta
|
||||
return magentamap;
|
||||
case 2: // 0x82, yellow
|
||||
return yellowmap;
|
||||
case 3: // 0x83, lgreen
|
||||
return lgreenmap;
|
||||
case 4: // 0x84, blue
|
||||
return bluemap;
|
||||
case 5: // 0x85, red
|
||||
return redmap;
|
||||
case 6: // 0x86, gray
|
||||
return graymap;
|
||||
case 7: // 0x87, orange
|
||||
return orangemap;
|
||||
case 8: // 0x88, sky
|
||||
return skymap;
|
||||
case 9: // 0x89, purple
|
||||
return purplemap;
|
||||
case 10: // 0x8A, aqua
|
||||
return aquamap;
|
||||
case 11: // 0x8B, peridot
|
||||
return peridotmap;
|
||||
case 12: // 0x8C, azure
|
||||
return azuremap;
|
||||
case 13: // 0x8D, brown
|
||||
return brownmap;
|
||||
case 14: // 0x8E, rosy
|
||||
return rosymap;
|
||||
case 15: // 0x8F, invert
|
||||
return invertmap;
|
||||
default: // reset
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Writes a single character (draw WHITE if bit 7 set)
|
||||
//
|
||||
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed)
|
||||
|
@ -2068,8 +2027,6 @@ void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UI
|
|||
return;
|
||||
|
||||
V_DrawFixedPatch(x*FRACUNIT, y*FRACUNIT, (vid.width < 640) ? (FRACUNIT) : (FRACUNIT/2), flags, hu_font.chars[c], colormap);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Precompile a wordwrapped string to any given width.
|
||||
|
@ -2141,6 +2098,47 @@ char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
|||
return newstring;
|
||||
}
|
||||
|
||||
// Gets string colormap, used for 0x80 color codes
|
||||
//
|
||||
UINT8 *V_GetStringColormap(INT32 colorflags)
|
||||
{
|
||||
switch ((colorflags & V_CHARCOLORMASK) >> V_CHARCOLORSHIFT)
|
||||
{
|
||||
case 1: // 0x81, magenta
|
||||
return magentamap;
|
||||
case 2: // 0x82, yellow
|
||||
return yellowmap;
|
||||
case 3: // 0x83, lgreen
|
||||
return lgreenmap;
|
||||
case 4: // 0x84, blue
|
||||
return bluemap;
|
||||
case 5: // 0x85, red
|
||||
return redmap;
|
||||
case 6: // 0x86, gray
|
||||
return graymap;
|
||||
case 7: // 0x87, orange
|
||||
return orangemap;
|
||||
case 8: // 0x88, sky
|
||||
return skymap;
|
||||
case 9: // 0x89, purple
|
||||
return purplemap;
|
||||
case 10: // 0x8A, aqua
|
||||
return aquamap;
|
||||
case 11: // 0x8B, peridot
|
||||
return peridotmap;
|
||||
case 12: // 0x8C, azure
|
||||
return azuremap;
|
||||
case 13: // 0x8D, brown
|
||||
return brownmap;
|
||||
case 14: // 0x8E, rosy
|
||||
return rosymap;
|
||||
case 15: // 0x8F, invert
|
||||
return invertmap;
|
||||
default: // reset
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw a string, using a supplied font and scale.
|
||||
// NOTE: The text is centered for screens larger than the base width.
|
||||
void V_DrawFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font)
|
||||
|
@ -2333,6 +2331,23 @@ void V_DrawLevelActNum(INT32 x, INT32 y, INT32 flags, UINT8 num)
|
|||
}
|
||||
}
|
||||
|
||||
// Returns the width of the act num patch(es)
|
||||
INT16 V_LevelActNumWidth(UINT8 num)
|
||||
{
|
||||
INT16 result = 0;
|
||||
|
||||
if (num == 0)
|
||||
result = ttlnum[num]->width;
|
||||
|
||||
while (num > 0 && num <= 99)
|
||||
{
|
||||
result = result + ttlnum[num%10]->width;
|
||||
num = num/10;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Draw a string using the nt_font
|
||||
// Note that the outline is a seperate font set
|
||||
static void V_DrawNameTagLine(INT32 x, INT32 y, INT32 option, fixed_t scale, UINT8 *basecolormap, UINT8 *outlinecolormap, const char *string)
|
||||
|
@ -2533,24 +2548,6 @@ INT32 V_NameTagWidth(const char *string)
|
|||
return w;
|
||||
}
|
||||
|
||||
// For ST_drawTitleCard
|
||||
// Returns the width of the act num patch(es)
|
||||
INT16 V_LevelActNumWidth(UINT8 num)
|
||||
{
|
||||
INT16 result = 0;
|
||||
|
||||
if (num == 0)
|
||||
result = ttlnum[num]->width;
|
||||
|
||||
while (num > 0 && num <= 99)
|
||||
{
|
||||
result = result + ttlnum[num%10]->width;
|
||||
num = num/10;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Find string width from supplied font characters & character width.
|
||||
//
|
||||
INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font)
|
||||
|
@ -2592,7 +2589,7 @@ INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font)
|
|||
|
||||
// Find max string height from supplied font characters
|
||||
//
|
||||
INT32 V_FontStringHeight(const char *string, INT32 option, fontdef_t font)
|
||||
INT32 V_FontStringHeight(const char *string, fontdef_t font)
|
||||
{
|
||||
INT32 c, h = 0;
|
||||
size_t i;
|
||||
|
|
|
@ -201,10 +201,6 @@ void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);
|
|||
// draw a single character, but for the chat
|
||||
void V_DrawChatCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed, UINT8 *colormap);
|
||||
|
||||
UINT8 *V_GetStringColormap(INT32 colorflags);
|
||||
|
||||
void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string);
|
||||
|
||||
// wordwrap a string using the hu_font
|
||||
char *V_WordWrap(INT32 x, INT32 w, INT32 option, const char *string);
|
||||
UINT8 *V_GetStringColormap(INT32 colorflags);
|
||||
|
@ -217,7 +213,6 @@ void V_DrawRightAlignedFontString(INT32 x, INT32 y, INT32 option, fixed_t pscale
|
|||
void V_DrawFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||
void V_DrawCenteredFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||
void V_DrawRightAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t pscale, fixed_t vscale, const char *string, fontdef_t font);
|
||||
// width = "average" character width (divided by 2 for space width), height = distance between two lines. TODO: incorporate these in the supplied font, somehow
|
||||
|
||||
// Defines for old string drawers.
|
||||
// draw a string using the hu_font
|
||||
|
@ -261,7 +256,6 @@ void V_DrawRightAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fix
|
|||
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num);
|
||||
void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits);
|
||||
void V_DrawLevelActNum(INT32 x, INT32 y, INT32 flags, UINT8 num);
|
||||
|
||||
INT16 V_LevelActNumWidth(UINT8 num); // act number width
|
||||
|
||||
// Draw a string using the nt_font
|
||||
|
@ -271,7 +265,7 @@ INT32 V_NameTagWidth(const char *string);
|
|||
|
||||
// Find string width or height from supplied font chars
|
||||
INT32 V_FontStringWidth(const char *string, INT32 option, fontdef_t font);
|
||||
INT32 V_FontStringHeight(const char *string, INT32 option, fontdef_t font);
|
||||
INT32 V_FontStringHeight(const char *string, fontdef_t font);
|
||||
|
||||
// Defines for old string width functions.
|
||||
#define V_StringWidth(str,o) V_FontStringWidth(str,o,hu_font)
|
||||
|
@ -280,7 +274,7 @@ INT32 V_FontStringHeight(const char *string, INT32 option, fontdef_t font);
|
|||
#define V_SmallThinStringWidth(str,o) V_FontStringWidth(str,o,tny_font)/2
|
||||
#define V_CreditStringWidth(str) V_FontStringWidth(str,0,cred_font)
|
||||
#define V_LevelNameWidth(str) V_FontStringWidth(str,V_ALLOWLOWERCASE,lt_font)
|
||||
#define V_LevelNameHeight(str) V_FontStringHeight(str,V_ALLOWLOWERCASE,lt_font)
|
||||
#define V_LevelNameHeight(str) V_FontStringHeight(str,lt_font)
|
||||
|
||||
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
|
||||
|
||||
|
|
Loading…
Reference in a new issue