mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Support act numbers up to 99 and draw both digits individually.
This commit is contained in:
parent
feced5ec3c
commit
69c11a8220
5 changed files with 34 additions and 13 deletions
|
@ -1557,7 +1557,7 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
}
|
||||
else if (fastcmp(word, "ACT"))
|
||||
{
|
||||
if (i >= 0 && i < 20) // 0 for no act number, TTL1 through TTL19
|
||||
if (i >= 0 && i <= 99) // 0 for no act number
|
||||
mapheaderinfo[num-1]->actnum = (UINT8)i;
|
||||
else
|
||||
deh_warning("Level header %d: invalid act number %d", num, i);
|
||||
|
|
|
@ -68,7 +68,7 @@ patch_t *nightsnum[10]; // 0-9
|
|||
// Level title and credits fonts
|
||||
patch_t *lt_font[LT_FONTSIZE];
|
||||
patch_t *cred_font[CRED_FONTSIZE];
|
||||
patch_t *ttlnum[20]; // act numbers (0-19)
|
||||
patch_t *ttlnum[10]; // act numbers (0-9)
|
||||
|
||||
// Name tag fonts
|
||||
patch_t *ntb_font[NT_FONTSIZE];
|
||||
|
@ -243,7 +243,7 @@ void HU_LoadGraphics(void)
|
|||
tallinfin = (patch_t *)W_CachePatchName("STTINFIN", PU_HUDGFX);
|
||||
|
||||
// cache act numbers for level titles
|
||||
for (i = 0; i < 20; i++)
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
sprintf(buffer, "TTL%.2d", i);
|
||||
ttlnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
|
|
|
@ -85,7 +85,7 @@ extern patch_t *lt_font[LT_FONTSIZE];
|
|||
extern patch_t *cred_font[CRED_FONTSIZE];
|
||||
extern patch_t *ntb_font[NT_FONTSIZE];
|
||||
extern patch_t *nto_font[NT_FONTSIZE];
|
||||
extern patch_t *ttlnum[20];
|
||||
extern patch_t *ttlnum[10];
|
||||
extern patch_t *emeraldpics[3][8];
|
||||
extern patch_t *rflagico;
|
||||
extern patch_t *bflagico;
|
||||
|
|
|
@ -1325,7 +1325,7 @@ void ST_drawTitleCard(void)
|
|||
{
|
||||
char *lvlttl = mapheaderinfo[gamemap-1]->lvlttl;
|
||||
char *subttl = mapheaderinfo[gamemap-1]->subttl;
|
||||
INT32 actnum = mapheaderinfo[gamemap-1]->actnum;
|
||||
UINT8 actnum = mapheaderinfo[gamemap-1]->actnum;
|
||||
INT32 lvlttlxpos, ttlnumxpos, zonexpos;
|
||||
INT32 subttlxpos = BASEVIDWIDTH/2;
|
||||
INT32 ttlscroll = FixedInt(lt_scroll);
|
||||
|
@ -1382,7 +1382,12 @@ void ST_drawTitleCard(void)
|
|||
if (actnum)
|
||||
{
|
||||
if (!splitscreen)
|
||||
V_DrawMappedPatch(ttlnumxpos + ttlscroll, 104 - ttlscroll, 0, actpat, colormap);
|
||||
{
|
||||
if (actnum > 9)
|
||||
V_DrawMappedPatch(ttlnumxpos + (V_LevelActNumWidth(actnum)/4) + ttlscroll, 104 - ttlscroll, 0, actpat, colormap);
|
||||
else
|
||||
V_DrawMappedPatch(ttlnumxpos + ttlscroll, 104 - ttlscroll, 0, actpat, colormap);
|
||||
}
|
||||
V_DrawLevelActNum(ttlnumxpos + ttlscroll, 104, V_PERPLAYER, actnum);
|
||||
}
|
||||
|
||||
|
|
|
@ -2952,13 +2952,19 @@ void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits)
|
|||
}
|
||||
|
||||
// Draw an act number for a level title
|
||||
// Todo: actually draw two-digit numbers as two act num patches
|
||||
void V_DrawLevelActNum(INT32 x, INT32 y, INT32 flags, INT32 num)
|
||||
void V_DrawLevelActNum(INT32 x, INT32 y, INT32 flags, UINT8 num)
|
||||
{
|
||||
if (num < 0 || num > 19)
|
||||
if (num < 0 || num > 99)
|
||||
return; // not supported
|
||||
|
||||
V_DrawScaledPatch(x, y, flags, ttlnum[num]);
|
||||
while (num > 0)
|
||||
{
|
||||
if (num > 9)
|
||||
V_DrawScaledPatch(x + (V_LevelActNumWidth(num) - V_LevelActNumWidth(num%10)), y, flags, ttlnum[num%10]);
|
||||
else
|
||||
V_DrawScaledPatch(x, y, flags, ttlnum[num]);
|
||||
num = num/10;
|
||||
}
|
||||
}
|
||||
|
||||
// Write a string using the credit font
|
||||
|
@ -3340,12 +3346,22 @@ INT32 V_LevelNameHeight(const char *string)
|
|||
|
||||
// For ST_drawTitleCard
|
||||
// Returns the width of the act num patch
|
||||
INT32 V_LevelActNumWidth(INT32 num)
|
||||
INT32 V_LevelActNumWidth(UINT8 num)
|
||||
{
|
||||
if (num < 0 || num > 19)
|
||||
SHORT result = 0;
|
||||
if (num > 99)
|
||||
return 0; // not a valid number
|
||||
|
||||
return SHORT(ttlnum[num]->width);
|
||||
if (num == 0)
|
||||
return SHORT(ttlnum[num]->width);
|
||||
|
||||
while (num > 0)
|
||||
{
|
||||
result = result + SHORT(ttlnum[num%10]->width);
|
||||
num = num/10;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue