diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 96acfd80f..8473f5ce1 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -267,13 +267,15 @@ void HU_Init(void) PR ("STCFN"); REG; - PR ("MNUFN"); REG; PR ("TNYFN"); REG; + PR ("MDFN"); + REG; + PR ("FILEF"); REG; diff --git a/src/hu_stuff.h b/src/hu_stuff.h index d7384f9f8..0a119f63c 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -69,6 +69,7 @@ enum X (HU), X (MENU), X (TINY), + X (MED), X (FILE), X (LT), diff --git a/src/k_vote.c b/src/k_vote.c index 9993e6dd2..da617ceb5 100644 --- a/src/k_vote.c +++ b/src/k_vote.c @@ -190,7 +190,8 @@ typedef struct // Voting level drawing typedef struct { - char str[62]; + char str[128]; + size_t str_len; boolean encore; fixed_t hop; } 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 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 y = SELECTION_Y + FixedMul(offset, (SELECTION_HEIGHT + SELECTOR_HEIGHT) * 2); @@ -832,6 +836,51 @@ static void Y_DrawVoteSelection(fixed_t offset) 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( x, y - vote_draw.levels[i].hop, SELECTION_WIDTH, 0, @@ -855,7 +904,6 @@ static void Y_DrawVoteSelection(fixed_t offset) // // Draw splitscreen selectors // - selectorTimer += renderdeltatics; //if (splitscreen > 0) { @@ -868,10 +916,10 @@ static void Y_DrawVoteSelection(fixed_t offset) 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++) { + const mapheader_t *header = mapheaderinfo[g_voteLevels[i][0]]; + // set up the encore vote_draw.levels[i].encore = (g_voteLevels[i][1] & VOTE_MOD_ENCORE); - // set up the levelstring - if (mapheaderinfo[g_voteLevels[i][0]]->levelflags & LF_NOZONE || !mapheaderinfo[g_voteLevels[i][0]]->zonttl[0]) + // set up the level title string + 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) - snprintf(vote_draw.levels[i].str, - sizeof vote_draw.levels[i].str, - "%s %d", - mapheaderinfo[g_voteLevels[i][0]]->lvlttl, mapheaderinfo[g_voteLevels[i][0]]->actnum); - 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_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->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++) diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 02eb317cc..e611b41a4 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -305,6 +305,9 @@ int Draw::font_to_fontno(Font font) case Font::kMenu: return MENU_FONT; + + case Font::kMedium: + return MED_FONT; } return TINY_FONT; diff --git a/src/v_draw.hpp b/src/v_draw.hpp index b7ec5e1d9..c81a7be45 100644 --- a/src/v_draw.hpp +++ b/src/v_draw.hpp @@ -40,6 +40,7 @@ public: kTimer, kThinTimer, kMenu, + kMedium, }; enum class Align diff --git a/src/v_video.cpp b/src/v_video.cpp index 64fa37169..1db7bd01c 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -2302,6 +2302,10 @@ static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result) break; } break; + case MED_FONT: + result->chw = 6; + result->spacew = 6; + break; case LT_FONT: result->spacew = 12; break; @@ -2348,6 +2352,7 @@ static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result) case TINY_FONT: case TINYTIMER_FONT: case KART_FONT: + case MED_FONT: result->lfh = 12; break; case LT_FONT: @@ -2403,6 +2408,9 @@ static void V_GetFontSpecification(int fontno, INT32 flags, fontspec_t *result) else result->dim_fn = BunchedCharacterDim; break; + case MED_FONT: + result->dim_fn = FixedCharacterDim; + break; case GM_FONT: if (result->chw) result->dim_fn = FixedCharacterDim;