mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Merge branch 'leveltitle-tinkering' into 'master'
Leveltitle tinkering See merge request STJr/SRB2Internal!134
This commit is contained in:
commit
299337f578
6 changed files with 39 additions and 17 deletions
|
@ -69,6 +69,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)
|
||||
|
||||
static player_t *plr;
|
||||
boolean chat_on; // entering a chat message?
|
||||
|
@ -237,6 +238,13 @@ void HU_LoadGraphics(void)
|
|||
tallminus = (patch_t *)W_CachePatchName("STTMINUS", PU_HUDGFX);
|
||||
tallinfin = (patch_t *)W_CachePatchName("STTINFIN", PU_HUDGFX);
|
||||
|
||||
// cache act numbers for level titles
|
||||
for (i = 0; i < 20; i++)
|
||||
{
|
||||
sprintf(buffer, "TTL%.2d", i);
|
||||
ttlnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
|
||||
// cache the crosshairs, don't bother to know which one is being used,
|
||||
// just cache all 3, they're so small anyway.
|
||||
for (i = 0; i < HU_CROSSHAIRS; i++)
|
||||
|
|
|
@ -63,6 +63,7 @@ extern patch_t *tallnum[10];
|
|||
extern patch_t *nightsnum[10];
|
||||
extern patch_t *lt_font[LT_FONTSIZE];
|
||||
extern patch_t *cred_font[CRED_FONTSIZE];
|
||||
extern patch_t *ttlnum[20];
|
||||
extern patch_t *emeraldpics[3][8];
|
||||
extern patch_t *rflagico;
|
||||
extern patch_t *bflagico;
|
||||
|
|
|
@ -79,7 +79,6 @@ static patch_t *race1;
|
|||
static patch_t *race2;
|
||||
static patch_t *race3;
|
||||
static patch_t *racego;
|
||||
static patch_t *ttlnum;
|
||||
static patch_t *nightslink;
|
||||
static patch_t *curweapon;
|
||||
static patch_t *normring;
|
||||
|
@ -1120,13 +1119,10 @@ static void ST_drawLevelTitle(void)
|
|||
if (!(timeinmap > 2 && timeinmap-3 < 110))
|
||||
return;
|
||||
|
||||
lvlttlxpos = ((BASEVIDWIDTH/2) - (V_LevelNameWidth(lvlttl)/2));
|
||||
|
||||
if (actnum > 0)
|
||||
{
|
||||
ttlnum = W_CachePatchName(va("TTL%.2d", actnum), PU_CACHE);
|
||||
lvlttlxpos = ((BASEVIDWIDTH/2) - (V_LevelNameWidth(lvlttl)/2)) - SHORT(ttlnum->width);
|
||||
}
|
||||
else
|
||||
lvlttlxpos = ((BASEVIDWIDTH/2) - (V_LevelNameWidth(lvlttl)/2));
|
||||
lvlttlxpos -= V_LevelActNumWidth(actnum);
|
||||
|
||||
ttlnumxpos = lvlttlxpos + V_LevelNameWidth(lvlttl);
|
||||
zonexpos = ttlnumxpos - V_LevelNameWidth(M_GetText("ZONE"));
|
||||
|
@ -1186,7 +1182,7 @@ static void ST_drawLevelTitle(void)
|
|||
#endif
|
||||
|
||||
if (actnum)
|
||||
V_DrawScaledPatch(ttlnumxpos, zoney, V_PERPLAYER, ttlnum);
|
||||
V_DrawLevelActNum(ttlnumxpos, zoney, V_PERPLAYER, actnum);
|
||||
|
||||
V_DrawLevelTitle(lvlttlxpos, lvlttly, V_PERPLAYER, lvlttl);
|
||||
|
||||
|
|
|
@ -2074,6 +2074,16 @@ void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits)
|
|||
} while (--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)
|
||||
{
|
||||
if (num < 0 || num > 19)
|
||||
return; // not supported
|
||||
|
||||
V_DrawScaledPatch(x, y, flags, ttlnum[num]);
|
||||
}
|
||||
|
||||
// Write a string using the credit font
|
||||
// NOTE: the text is centered for screens larger than the base width
|
||||
//
|
||||
|
@ -2254,6 +2264,16 @@ INT32 V_LevelNameHeight(const char *string)
|
|||
return w;
|
||||
}
|
||||
|
||||
// For ST_drawLevelTitle
|
||||
// Returns the width of the act num patch
|
||||
INT32 V_LevelActNumWidth(INT32 num)
|
||||
{
|
||||
if (num < 0 || num > 19)
|
||||
return 0; // not a valid number
|
||||
|
||||
return SHORT(ttlnum[num]->width);
|
||||
}
|
||||
|
||||
//
|
||||
// Find string width from hu_font chars
|
||||
//
|
||||
|
|
|
@ -185,10 +185,12 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t 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);
|
||||
void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits);
|
||||
void V_DrawLevelActNum(INT32 x, INT32 y, INT32 flags, INT32 num);
|
||||
|
||||
// Find string width from lt_font chars
|
||||
INT32 V_LevelNameWidth(const char *string);
|
||||
INT32 V_LevelNameHeight(const char *string);
|
||||
INT32 V_LevelActNumWidth(INT32 num); // act number width
|
||||
|
||||
void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string);
|
||||
INT32 V_CreditStringWidth(const char *string);
|
||||
|
|
|
@ -70,7 +70,7 @@ typedef union
|
|||
UINT32 score, total; // fake score, total
|
||||
UINT32 tics; // time
|
||||
|
||||
patch_t *ttlnum; // act number being displayed
|
||||
INT32 actnum; // act number being displayed
|
||||
patch_t *ptotal; // TOTAL
|
||||
UINT8 gotlife; // Number of extra lives obtained
|
||||
} coop;
|
||||
|
@ -288,8 +288,8 @@ void Y_IntermissionDrawer(void)
|
|||
V_DrawLevelTitle(data.coop.passedx1, 49, 0, data.coop.passed1);
|
||||
V_DrawLevelTitle(data.coop.passedx2, 49+V_LevelNameHeight(data.coop.passed2)+2, 0, data.coop.passed2);
|
||||
|
||||
if (mapheaderinfo[gamemap-1]->actnum)
|
||||
V_DrawScaledPatch(244, 57, 0, data.coop.ttlnum);
|
||||
if (data.coop.actnum)
|
||||
V_DrawLevelActNum(244, 57, 0, data.coop.actnum);
|
||||
|
||||
bonusy = 150;
|
||||
// Total
|
||||
|
@ -1183,11 +1183,7 @@ void Y_StartIntermission(void)
|
|||
data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_STATIC);
|
||||
|
||||
// get act number
|
||||
if (mapheaderinfo[prevmap]->actnum)
|
||||
data.coop.ttlnum = W_CachePatchName(va("TTL%.2d", mapheaderinfo[prevmap]->actnum),
|
||||
PU_STATIC);
|
||||
else
|
||||
data.coop.ttlnum = W_CachePatchName("TTL01", PU_STATIC);
|
||||
data.coop.actnum = mapheaderinfo[gamemap-1]->actnum;
|
||||
|
||||
// get background patches
|
||||
widebgpatch = W_CachePatchName("INTERSCW", PU_STATIC);
|
||||
|
@ -1994,7 +1990,6 @@ static void Y_UnloadData(void)
|
|||
{
|
||||
case int_coop:
|
||||
// unload the coop and single player patches
|
||||
UNLOAD(data.coop.ttlnum);
|
||||
UNLOAD(data.coop.bonuspatches[3]);
|
||||
UNLOAD(data.coop.bonuspatches[2]);
|
||||
UNLOAD(data.coop.bonuspatches[1]);
|
||||
|
|
Loading…
Reference in a new issue