mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'vote-level-names' into 'master'
Vote level names See merge request KartKrew/Kart!1873
This commit is contained in:
commit
bc80233f1f
6 changed files with 104 additions and 32 deletions
|
|
@ -267,13 +267,15 @@ void HU_Init(void)
|
|||
PR ("STCFN");
|
||||
REG;
|
||||
|
||||
|
||||
PR ("MNUFN");
|
||||
REG;
|
||||
|
||||
PR ("TNYFN");
|
||||
REG;
|
||||
|
||||
PR ("MDFN");
|
||||
REG;
|
||||
|
||||
PR ("FILEF");
|
||||
REG;
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ enum
|
|||
X (HU),
|
||||
X (MENU),
|
||||
X (TINY),
|
||||
X (MED),
|
||||
X (FILE),
|
||||
|
||||
X (LT),
|
||||
|
|
|
|||
119
src/k_vote.c
119
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++)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public:
|
|||
kTimer,
|
||||
kThinTimer,
|
||||
kMenu,
|
||||
kMedium,
|
||||
};
|
||||
|
||||
enum class Align
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue