Merge branch 'vote-level-names' into 'master'

Vote level names

See merge request KartKrew/Kart!1873
This commit is contained in:
Oni 2024-01-28 23:29:44 +00:00
commit bc80233f1f
6 changed files with 104 additions and 32 deletions

View file

@ -267,13 +267,15 @@ void HU_Init(void)
PR ("STCFN"); PR ("STCFN");
REG; REG;
PR ("MNUFN"); PR ("MNUFN");
REG; REG;
PR ("TNYFN"); PR ("TNYFN");
REG; REG;
PR ("MDFN");
REG;
PR ("FILEF"); PR ("FILEF");
REG; REG;

View file

@ -69,6 +69,7 @@ enum
X (HU), X (HU),
X (MENU), X (MENU),
X (TINY), X (TINY),
X (MED),
X (FILE), X (FILE),
X (LT), X (LT),

View file

@ -190,7 +190,8 @@ typedef struct
// Voting level drawing // Voting level drawing
typedef struct typedef struct
{ {
char str[62]; char str[128];
size_t str_len;
boolean encore; boolean encore;
fixed_t hop; fixed_t hop;
} y_vote_draw_level; } y_vote_draw_level;
@ -789,7 +790,10 @@ static void Y_DrawVoteSelector(const fixed_t y, const fixed_t time, const UINT8
static void Y_DrawVoteSelection(fixed_t offset) static void Y_DrawVoteSelection(fixed_t offset)
{ {
static fixed_t selectorTimer = 0; static fixed_t animTimer = 0;
animTimer += renderdeltatics;
const size_t charAnim = animTimer / FRACUNIT / 4;
fixed_t x = SELECTION_X; fixed_t x = SELECTION_X;
fixed_t y = SELECTION_Y + FixedMul(offset, (SELECTION_HEIGHT + SELECTOR_HEIGHT) * 2); fixed_t y = SELECTION_Y + FixedMul(offset, (SELECTION_HEIGHT + SELECTOR_HEIGHT) * 2);
@ -832,6 +836,51 @@ static void Y_DrawVoteSelection(fixed_t offset)
renderdeltatics renderdeltatics
); );
if (vote_draw.levels[i].hop > FRACUNIT >> 2)
{
const fixed_t height = (SELECTION_WIDTH * BASEVIDHEIGHT) / BASEVIDWIDTH;
const fixed_t tx = x - (SELECTION_WIDTH >> 1);
const fixed_t ty = y + (height >> 1);
INT32 fx, fy, fw, fh;
INT32 dupx, dupy;
dupx = vid.dupx;
dupy = vid.dupy;
// only use one dup, to avoid stretching (har har)
dupx = dupy = (dupx < dupy ? dupx : dupy);
fx = FixedMul(tx, dupx << FRACBITS) >> FRACBITS;
fy = FixedMul(ty, dupy << FRACBITS) >> FRACBITS;
fw = FixedMul(SELECTION_WIDTH - 1, dupx << FRACBITS) >> FRACBITS; // Why does only this need -1 to match up? IDFK
fh = FixedMul(SELECTION_HOP, dupy << FRACBITS) >> FRACBITS;
V_AdjustXYWithSnap(&fx, &fy, 0, dupx, dupy);
V_DrawFill(
fx - dupx, fy - fh + dupy,
fw + (dupx << 1), fh,
31|V_NOSCALESTART
);
size_t ci;
for (ci = 0; ci < 12; ci++)
{
const size_t c = (ci + charAnim) % vote_draw.levels[i].str_len;
V_DrawCharacterScaled(
(fx + (6 * dupx * ci)) << FRACBITS,
(fy - fh + dupy) << FRACBITS,
FRACUNIT,
V_ORANGEMAP | V_FORCEUPPERCASE | V_NOSCALESTART,
MED_FONT,
vote_draw.levels[i].str[c],
NULL
);
}
}
Y_DrawVoteThumbnail( Y_DrawVoteThumbnail(
x, y - vote_draw.levels[i].hop, x, y - vote_draw.levels[i].hop,
SELECTION_WIDTH, 0, SELECTION_WIDTH, 0,
@ -855,7 +904,6 @@ static void Y_DrawVoteSelection(fixed_t offset)
// //
// Draw splitscreen selectors // Draw splitscreen selectors
// //
selectorTimer += renderdeltatics;
//if (splitscreen > 0) //if (splitscreen > 0)
{ {
@ -868,10 +916,10 @@ static void Y_DrawVoteSelection(fixed_t offset)
continue; continue;
} }
Y_DrawVoteSelector(y, selectorTimer, i); Y_DrawVoteSelector(y, animTimer, i);
} }
Y_DrawVoteSelector(y, selectorTimer, priority); Y_DrawVoteSelector(y, animTimer, priority);
} }
} }
} }
@ -1616,38 +1664,47 @@ static void Y_InitVoteDrawing(void)
for (i = 0; i < VOTE_NUM_LEVELS; i++) for (i = 0; i < VOTE_NUM_LEVELS; i++)
{ {
const mapheader_t *header = mapheaderinfo[g_voteLevels[i][0]];
// set up the encore // set up the encore
vote_draw.levels[i].encore = (g_voteLevels[i][1] & VOTE_MOD_ENCORE); vote_draw.levels[i].encore = (g_voteLevels[i][1] & VOTE_MOD_ENCORE);
// set up the levelstring // set up the level title string
if (mapheaderinfo[g_voteLevels[i][0]]->levelflags & LF_NOZONE || !mapheaderinfo[g_voteLevels[i][0]]->zonttl[0]) memset(vote_draw.levels[i].str, 0, sizeof(vote_draw.levels[i].str));
vote_draw.levels[i].str_len = 0;
vote_draw.levels[i].str_len += snprintf(
vote_draw.levels[i].str + vote_draw.levels[i].str_len,
sizeof(vote_draw.levels[i].str) - vote_draw.levels[i].str_len,
"%s",
header->lvlttl
);
if (header->zonttl[0])
{ {
if (mapheaderinfo[g_voteLevels[i][0]]->actnum > 0) vote_draw.levels[i].str_len += snprintf(
snprintf(vote_draw.levels[i].str, vote_draw.levels[i].str + vote_draw.levels[i].str_len,
sizeof vote_draw.levels[i].str, sizeof(vote_draw.levels[i].str) - vote_draw.levels[i].str_len,
"%s %d", " %s",
mapheaderinfo[g_voteLevels[i][0]]->lvlttl, mapheaderinfo[g_voteLevels[i][0]]->actnum); header->zonttl
else );
snprintf(vote_draw.levels[i].str,
sizeof vote_draw.levels[i].str,
"%s",
mapheaderinfo[g_voteLevels[i][0]]->lvlttl);
}
else
{
if (mapheaderinfo[g_voteLevels[i][0]]->actnum > 0)
snprintf(vote_draw.levels[i].str,
sizeof vote_draw.levels[i].str,
"%s %s %d",
mapheaderinfo[g_voteLevels[i][0]]->lvlttl, mapheaderinfo[g_voteLevels[i][0]]->zonttl, mapheaderinfo[g_voteLevels[i][0]]->actnum);
else
snprintf(vote_draw.levels[i].str,
sizeof vote_draw.levels[i].str,
"%s %s",
mapheaderinfo[g_voteLevels[i][0]]->lvlttl, mapheaderinfo[g_voteLevels[i][0]]->zonttl);
} }
vote_draw.levels[i].str[sizeof vote_draw.levels[i].str - 1] = '\0'; if (header->actnum > 0)
{
vote_draw.levels[i].str_len += snprintf(
vote_draw.levels[i].str + vote_draw.levels[i].str_len,
sizeof(vote_draw.levels[i].str) - vote_draw.levels[i].str_len,
" %d",
header->actnum
);
}
vote_draw.levels[i].str_len += snprintf(
vote_draw.levels[i].str + vote_draw.levels[i].str_len,
sizeof(vote_draw.levels[i].str) - vote_draw.levels[i].str_len,
" "
);
} }
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)

View file

@ -305,6 +305,9 @@ int Draw::font_to_fontno(Font font)
case Font::kMenu: case Font::kMenu:
return MENU_FONT; return MENU_FONT;
case Font::kMedium:
return MED_FONT;
} }
return TINY_FONT; return TINY_FONT;

View file

@ -40,6 +40,7 @@ public:
kTimer, kTimer,
kThinTimer, kThinTimer,
kMenu, kMenu,
kMedium,
}; };
enum class Align enum class Align

View file

@ -2302,6 +2302,10 @@ static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result)
break; break;
} }
break; break;
case MED_FONT:
result->chw = 6;
result->spacew = 6;
break;
case LT_FONT: case LT_FONT:
result->spacew = 12; result->spacew = 12;
break; break;
@ -2348,6 +2352,7 @@ static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result)
case TINY_FONT: case TINY_FONT:
case TINYTIMER_FONT: case TINYTIMER_FONT:
case KART_FONT: case KART_FONT:
case MED_FONT:
result->lfh = 12; result->lfh = 12;
break; break;
case LT_FONT: case LT_FONT:
@ -2403,6 +2408,9 @@ static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result)
else else
result->dim_fn = BunchedCharacterDim; result->dim_fn = BunchedCharacterDim;
break; break;
case MED_FONT:
result->dim_fn = FixedCharacterDim;
break;
case GM_FONT: case GM_FONT:
if (result->chw) if (result->chw)
result->dim_fn = FixedCharacterDim; result->dim_fn = FixedCharacterDim;