#5 - Basic HUD changes

This commit is contained in:
JadenArc authored and hayayayay committed 2022-11-16 16:25:03 +08:00
1 parent ff71816c62
commit e6a019a741
5 files changed
+445 -158

No files matched your search

+5 -1
View File
@@ -81,6 +81,8 @@ patch_t *pingnum[10];
patch_t *pinggfx[5]; // small ping graphic
patch_t *pingmeasure[2]; // ping measurement graphic
patch_t *ranknum[10];
patch_t *framecounter;
patch_t *frameslash; // framerate stuff. Used in screen.c
@@ -281,6 +283,8 @@ void HU_LoadGraphics(void)
nightsnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
sprintf(buffer, "PINGN%d", i);
pingnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
sprintf(buffer, "OPPRNK0%d", i);
ranknum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
}
// minus for negative tallnums
@@ -2553,7 +2557,7 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags)
gfxnum = Ping_gfx_num(lag);
if (measureid == 1)
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+10, flags, pingmeasure[measureid]);
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
if (servermaxping && lag > servermaxping && hu_tick < 4)
+1
View File
@@ -82,6 +82,7 @@ extern patch_t *hu_font[HU_FONTSIZE], *kart_font[KART_FONTSIZE], *tny_font[HU_FO
extern patch_t *tallnum[10];
extern patch_t *pingnum[10];
extern patch_t *pinggfx[5];
extern patch_t *ranknum[10];
extern patch_t *nightsnum[10];
extern patch_t *framecounter;
extern patch_t *frameslash;
+144 -157
View File
@@ -6590,6 +6590,9 @@ static patch_t *kp_lapanim_hand[3];
static patch_t *kp_yougotem;
static patch_t *skp_smallsticker;
static patch_t *skp_speedpatches[5];
void K_LoadKartHUDGraphics(void)
{
INT32 i, j;
@@ -6836,6 +6839,14 @@ void K_LoadKartHUDGraphics(void)
}
kp_yougotem = (patch_t *) W_CachePatchName("YOUGOTEM", PU_HUDGFX);
// Snowy patches
skp_smallsticker = W_CachePatchName("SP_SMSTC", PU_HUDGFX);
skp_speedpatches[0] = W_CachePatchName("K_TRNULL", PU_HUDGFX); // lolxd
skp_speedpatches[1] = W_CachePatchName("SP_MKMH", PU_HUDGFX);
skp_speedpatches[2] = W_CachePatchName("SP_MMPH", PU_HUDGFX);
skp_speedpatches[3] = W_CachePatchName("SP_MFRAC", PU_HUDGFX);
skp_speedpatches[4] = W_CachePatchName("SP_MPERC", PU_HUDGFX);
}
// For the item toggle menu
@@ -7094,67 +7105,67 @@ static void K_drawKartItem(void)
if (stplyr->kartstuff[k_itemroulette])
{
if (stplyr->skincolor)
localcolor = stplyr->skincolor;
/*if (stplyr->skincolor)
localcolor = stplyr->skincolor;*/
switch((stplyr->kartstuff[k_itemroulette] % (14*3)) / 3)
{
// Each case is handled in threes, to give three frames of in-game time to see the item on the roulette
case 0: // Sneaker
localpatch = kp_sneaker[offset];
//localcolor = SKINCOLOR_RASPBERRY;
localcolor = SKINCOLOR_RASPBERRY;
break;
case 1: // Banana
localpatch = kp_banana[offset];
//localcolor = SKINCOLOR_YELLOW;
localcolor = SKINCOLOR_YELLOW;
break;
case 2: // Orbinaut
localpatch = kp_orbinaut[3+offset];
//localcolor = SKINCOLOR_STEEL;
localcolor = SKINCOLOR_STEEL;
break;
case 3: // Mine
localpatch = kp_mine[offset];
//localcolor = SKINCOLOR_JET;
localcolor = SKINCOLOR_JET;
break;
case 4: // Grow
localpatch = kp_grow[offset];
//localcolor = SKINCOLOR_TEAL;
localcolor = SKINCOLOR_TEAL;
break;
case 5: // Hyudoro
localpatch = kp_hyudoro[offset];
//localcolor = SKINCOLOR_STEEL;
localcolor = SKINCOLOR_STEEL;
break;
case 6: // Rocket Sneaker
localpatch = kp_rocketsneaker[offset];
//localcolor = SKINCOLOR_TANGERINE;
localcolor = SKINCOLOR_TANGERINE;
break;
case 7: // Jawz
localpatch = kp_jawz[offset];
//localcolor = SKINCOLOR_JAWZ;
localcolor = SKINCOLOR_JAWZ;
break;
case 8: // Self-Propelled Bomb
localpatch = kp_selfpropelledbomb[offset];
//localcolor = SKINCOLOR_JET;
localcolor = SKINCOLOR_JET;
break;
case 9: // Shrink
localpatch = kp_shrink[offset];
//localcolor = SKINCOLOR_ORANGE;
localcolor = SKINCOLOR_ORANGE;
break;
case 10: // Invincibility
localpatch = localinv;
//localcolor = SKINCOLOR_GREY;
localcolor = SKINCOLOR_GREY;
break;
case 11: // Eggman Monitor
localpatch = kp_eggman[offset];
//localcolor = SKINCOLOR_ROSE;
localcolor = SKINCOLOR_ROSE;
break;
case 12: // Ballhog
localpatch = kp_ballhog[offset];
//localcolor = SKINCOLOR_LILAC;
localcolor = SKINCOLOR_LILAC;
break;
case 13: // Thunder Shield
localpatch = kp_thundershield[offset];
//localcolor = SKINCOLOR_CYAN;
localcolor = SKINCOLOR_CYAN;
break;
/*case 14: // Pogo Spring
localpatch = kp_pogospring[offset];
@@ -7541,13 +7552,14 @@ static void K_DrawKartPositionNum(INT32 num)
// POSI_X = BASEVIDWIDTH - 51; // 269
// POSI_Y = BASEVIDHEIGHT- 64; // 136
boolean win = (stplyr->exiting && num == 1);
//INT32 X = POSI_X;
INT32 W = SHORT(kp_positionnum[0][0]->width);
fixed_t scale = FRACUNIT;
fixed_t scale = FRACUNIT / 2;
patch_t *localpatch = kp_positionnum[0][0];
//INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTORIGHT);
INT32 W = SHORT(kp_positionnum[0][0]->width);
INT32 fx = 0, fy = 0, fflags = 0;
INT32 xoffs = (cv_showinput.value) ? -48 : 0;
boolean win = (stplyr->exiting && num == 1);
boolean flipdraw = false; // flip the order we draw it in for MORE splitscreen bs. fun.
boolean flipvdraw = false; // used only for 2p splitscreen so overtaking doesn't make 1P's position fly off the screen.
boolean overtake = false;
@@ -7557,15 +7569,13 @@ static void K_DrawKartPositionNum(INT32 num)
scale *= 2;
overtake = true; // this is used for splitscreen stuff in conjunction with flipdraw.
}
if (splitscreen)
scale /= 2;
W = FixedMul(W<<FRACBITS, scale)>>FRACBITS;
// pain and suffering defined below
if (!splitscreen)
{
fx = POSI_X;
fx = POSI_X + xoffs;
fy = BASEVIDHEIGHT - 8;
fflags = V_SNAPTOBOTTOM|V_SNAPTORIGHT;
}
@@ -7919,12 +7929,11 @@ static void K_drawKartLaps(void)
{
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
INT32 fx = 0, fy = 0, fflags = 0; // stuff for 3p / 4p splitscreen.
boolean flipstring = false; // used for 3p or 4p
INT32 stringw = 0; // used with the above
const UINT8 *colormap = (stplyr->exiting) ? R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE) : NULL;
if (splitscreen > 1)
{
// pain and suffering defined below
if (splitscreen < 2) // don't change shit for THIS splitscreen.
{
@@ -7942,33 +7951,18 @@ static void K_drawKartLaps(void)
}
else // else, that means we're P2 or P4.
{
fx = LAPS2_X;
fx = LAPS2_X - 17;
fy = LAPS2_Y;
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
flipstring = true; // make the string right aligned and other shit
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom.
}
}
V_DrawScaledPatch(fx, fy + 1, V_HUDTRANS|fflags, skp_smallsticker); // Some sticker.
V_DrawScaledPatch(fx + 3, fy, V_HUDTRANS|fflags, kp_splitlapflag); // Lap flag.
if (stplyr->exiting) // draw stuff as god intended.
{
V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, kp_splitlapflag);
V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, "FIN");
}
else // take flipstring into account here since we may have more laps than just 10
if (flipstring)
{
stringw = V_StringWidth(va("%d/%d", stplyr->laps+1, cv_numlaps.value), 0);
V_DrawScaledPatch(BASEVIDWIDTH-stringw-16, fy, V_HUDTRANS|fflags, kp_splitlapflag);
V_DrawRightAlignedString(BASEVIDWIDTH-3, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value));
}
else // draw stuff NORMALLY.
{
V_DrawScaledPatch(fx, fy, V_HUDTRANS|fflags, kp_splitlapflag);
V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->laps+1, cv_numlaps.value));
}
V_DrawRankNum(fx + 28, fy + 1, V_HUDTRANS|fflags, min(stplyr->laps + 1, cv_numlaps.value), 2, colormap); // Current lap.
V_DrawMappedPatch(fx + 31, fy + 1, V_HUDTRANS|fflags, frameslash, colormap); // Umm...
V_DrawRankNum(fx + 48, fy + 1, V_HUDTRANS|fflags, cv_numlaps.value, 2, colormap); // Total Laps.
}
else
{
@@ -7983,35 +7977,38 @@ static void K_drawKartLaps(void)
static void K_drawKartSpeedometer(void)
{
fixed_t convSpeed;
if (cv_kartspeedometer.value == 0)
return;
fixed_t convSpeed = 0;
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
if (cv_kartspeedometer.value == 1) // Kilometers
switch (cv_kartspeedometer.value)
{
convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapobjectscale)/FRACUNIT; // 2.172409058
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d km/h", convSpeed));
}
else if (cv_kartspeedometer.value == 2) // Miles
{
convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapobjectscale)/FRACUNIT; // 1.349868774
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d mph", convSpeed));
}
else if (cv_kartspeedometer.value == 3) // Fracunits
{
convSpeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT;
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%3d fu/t", convSpeed));
}
else if (cv_kartspeedometer.value == 4) // Percent
{
// so code breaks if someone attempts to join from spectator since it sets
// their mo to NULL
// so can we just check if their mo is NULL????
if (stplyr->mo)
{
convSpeed = (FixedDiv(stplyr->speed, FixedMul(K_GetKartSpeed(stplyr, false), ORIG_FRICTION))*100)>>FRACBITS;
V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%4d P", convSpeed));
}
case 1: // Kilometers
convSpeed = FixedDiv(FixedMul(stplyr->speed, 142371), mapobjectscale) / FRACUNIT; // 2.172409058
break;
case 2: // Miles
convSpeed = FixedDiv(FixedMul(stplyr->speed, 88465), mapobjectscale) / FRACUNIT; // 1.349868774
break;
case 3: // Fracunits
convSpeed = FixedDiv(stplyr->speed, mapobjectscale) / FRACUNIT;
break;
case 4: // Percent
if (stplyr->mo)
convSpeed = (FixedDiv(stplyr->speed, FixedMul(K_GetKartSpeed(stplyr, false), ORIG_FRICTION)) * 100) >> FRACBITS;
break;
default:
break;
}
V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_smallsticker);
V_DrawRankNum(SPDM_X + 26, SPDM_Y + 4, V_HUDTRANS|splitflags, convSpeed, 3, NULL);
V_DrawScaledPatch(SPDM_X + 31, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_speedpatches[cv_kartspeedometer.value]);
}
static void K_drawKartBumpersOrKarma(void)
@@ -8019,14 +8016,15 @@ static void K_drawKartBumpersOrKarma(void)
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE);
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
INT32 fx = 0, fy = 0, fflags = 0;
boolean flipstring = false; // same as laps, used for splitscreen
INT32 stringw = 0; // used with the above
boolean dowehavekarma = (stplyr->kartstuff[k_bumper] <= 0);
patch_t *kartma_patch = (dowehavekarma) ? kp_splitkarmabomb : kp_rankbumper;
INT32 kartma_amount = (dowehavekarma) ? 2 : cv_kartbumpers.value;
if (splitscreen > 1)
{
// we will reuse lap coords here since it's essentially the same shit.
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
{
fx = LAPS_X;
@@ -8035,32 +8033,17 @@ static void K_drawKartBumpersOrKarma(void)
}
else // else, that means we're P2 or P4.
{
fx = LAPS2_X;
fx = LAPS2_X - 17;
fy = LAPS2_Y;
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom
flipstring = true;
fflags = V_SNAPTORIGHT|((stplyr == &players[displayplayers[3]]) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the botto flipstring = true;
}
if (stplyr->kartstuff[k_bumper] <= 0)
{
V_DrawMappedPatch(fx, fy-1, V_HUDTRANS|fflags, kp_splitkarmabomb, colormap);
V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/2", stplyr->kartstuff[k_comebackpoints]));
}
else // the above doesn't need to account for weird stuff since the max amount of karma necessary is always 2 ^^^^
{
if (flipstring) // for p2 and p4, assume we can have more than 10 bumpers. It's retarded but who knows.
{
stringw = V_StringWidth(va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value), 0);
V_DrawMappedPatch(BASEVIDWIDTH-stringw-16, fy-1, V_HUDTRANS|fflags, kp_rankbumper, colormap);
V_DrawRightAlignedString(BASEVIDWIDTH-3, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
}
else // draw bumpers normally.
{
V_DrawMappedPatch(fx, fy-1, V_HUDTRANS|fflags, kp_rankbumper, colormap);
V_DrawString(fx+13, fy+1, V_HUDTRANS|fflags, va("%d/%d", stplyr->kartstuff[k_bumper], cv_kartbumpers.value));
}
}
V_DrawScaledPatch(fx, fy + 1, V_HUDTRANS|fflags, skp_smallsticker);
V_DrawMappedPatch(fx + 3, fy - 1, V_HUDTRANS|fflags, kartma_patch, colormap);
V_DrawRankNum(fx + 28, fy + 1, V_HUDTRANS|fflags, stplyr->kartstuff[k_bumper], 2, NULL);
V_DrawMappedPatch(fx + 31, fy + 1, V_HUDTRANS|fflags, frameslash, NULL);
V_DrawRankNum(fx + 48, fy + 1, V_HUDTRANS|fflags, kartma_amount, 2, NULL);
}
else
{
@@ -8112,7 +8095,9 @@ static void K_drawKartWanted(void)
{
UINT8 i, numwanted = 0;
UINT8 *colormap = NULL;
INT32 basex = 0, basey = 0;
INT32 xoffs = (cv_showinput.value) ? -17 : 0;
if (stplyr != &players[displayplayers[0]])
return;
@@ -8130,7 +8115,7 @@ static void K_drawKartWanted(void)
// set X/Y coords depending on splitscreen.
if (splitscreen < 3) // 1P and 2P use the same code.
{
basex = WANT_X;
basex = WANT_X + xoffs;
basey = WANT_Y;
if (splitscreen == 2)
{
@@ -8300,13 +8285,6 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
amxpos = amnumxpos + ((x + AutomapPic->width/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->width/2))<<FRACBITS);
amypos = amnumypos + ((y + AutomapPic->height/2 - (( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin]->height/2))<<FRACBITS);
// do we want this? it feels unnecessary. easier to just modify the amnumxpos?
/*if (encoremode)
{
flags |= V_FLIP;
amxpos = -amnumxpos + ((x + AutomapPic->width/2 + (facemmapprefix[skin]->width/2))<<FRACBITS);
}*/
if (!mo->color) // 'default' color
V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT);
else
@@ -8316,12 +8294,19 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags, pat
colormap = R_GetTranslationColormap(TC_RAINBOW, mo->color, GTC_CACHE);
else
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap);
V_DrawFixedPatch(amxpos + (2 * FRACUNIT), amypos + (2 * FRACUNIT), FRACUNIT / 2, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], colormap);
if (cv_showminimapnames.value && !(modeattacking || gamestate == GS_TIMEATTACK))
{
const char *player_name = va("%c%s", V_GetSkincolorChar(mo->color), player_names[mo->player - players]);
V_DrawCenteredSmallStringAtFixed(amxpos + (4 * FRACUNIT), amypos - (3 * FRACUNIT), V_ALLOWLOWERCASE|flags, player_name);
}
if (mo->player
&& ((G_RaceGametype() && mo->player->kartstuff[k_position] == spbplace)
|| (G_BattleGametype() && K_IsPlayerWanted(mo->player))))
{
V_DrawFixedPatch(amxpos - (4<<FRACBITS), amypos - (4<<FRACBITS), FRACUNIT, flags, kp_wantedreticle, NULL);
V_DrawFixedPatch(amxpos, amypos, FRACUNIT / 2, flags, kp_wantedreticle, NULL);
}
}
}
@@ -8783,14 +8768,38 @@ static void K_drawKartFirstPerson(void)
{ pnum[0] = pn; turn[0] = tn; drift[0] = dr; }
}
#define BUTTW 8
#define BUTTH 11
#define drawButton(xoffs, butt, symb) \
if (cmd->buttons & butt) \
{ \
offs = 2; \
col = accent1; \
} \
else \
{ \
offs = 0; \
col = accent2; \
V_DrawFill(x + xoffs, y+BUTTH, BUTTW-1, 2, splitflags|31); \
} \
V_DrawFill(x + xoffs, y + offs, BUTTW-1, BUTTH, col); \
V_DrawFixedPatch((x + ((symb == 'I') ? 2 : 1) + xoffs) << FRACBITS, ((y + offs) + 1) << FRACBITS, FRACUNIT, splitflags, tny_font[symb - HU_FONTSTART], NULL)
// doesn't need to ever support 4p
static void K_drawInput(void)
{
if (!cv_showinput.value)
return;
INT32 x = BASEVIDWIDTH - 32;
INT32 y = BASEVIDHEIGHT - 24;
INT32 target = 0, splitflags = (V_SNAPTOBOTTOM|V_SNAPTORIGHT), offs, col;
static INT32 pn = 0;
INT32 target = 0, splitflags = (V_SNAPTOBOTTOM|V_SNAPTORIGHT);
INT32 x = BASEVIDWIDTH - 32, y = BASEVIDHEIGHT-24, offs, col;
const INT32 accent1 = splitflags|colortranslations[stplyr->skincolor][5];
const INT32 accent2 = splitflags|colortranslations[stplyr->skincolor][9];
ticcmd_t *cmd = &stplyr->cmd;
if (timeinmap <= 105)
@@ -8805,33 +8814,10 @@ static void K_drawInput(void)
x += offs;
}
#define BUTTW 8
#define BUTTH 11
#define drawbutt(xoffs, butt, symb)\
if (stplyr->cmd.buttons & butt)\
{\
offs = 2;\
col = accent1;\
}\
else\
{\
offs = 0;\
col = accent2;\
V_DrawFill(x+(xoffs), y+BUTTH, BUTTW-1, 2, splitflags|31);\
}\
V_DrawFill(x+(xoffs), y+offs, BUTTW-1, BUTTH, col);\
V_DrawFixedPatch((x+1+(xoffs))<<FRACBITS, (y+offs+1)<<FRACBITS, FRACUNIT, splitflags, tny_font[symb-HU_FONTSTART], NULL)
drawbutt(-2*BUTTW, BT_ACCELERATE, 'A');
drawbutt( -BUTTW, BT_BRAKE, 'B');
drawbutt( 0, BT_DRIFT, 'D');
drawbutt( BUTTW, BT_ATTACK, 'I');
#undef drawbutt
#undef BUTTW
#undef BUTTH
drawButton(-2*BUTTW, BT_ACCELERATE, 'A');
drawButton( -BUTTW, BT_BRAKE, 'B');
drawButton( 0, BT_DRIFT, 'D');
drawButton( BUTTW, BT_ATTACK, 'I');
y -= 1;
@@ -8846,6 +8832,9 @@ static void K_drawInput(void)
target = -target;
}
if (encoremode)
target = -target;
if (pn != target)
{
if (abs(pn - target) == 1)
@@ -8866,16 +8855,15 @@ static void K_drawInput(void)
if (target > 4)
target = 4;
if (!stplyr->skincolor)
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, splitflags, kp_inputwheel[target], NULL);
else
{
UINT8 *colormap;
colormap = R_GetTranslationColormap(0, stplyr->skincolor, GTC_CACHE);
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, splitflags, kp_inputwheel[target], colormap);
}
UINT8 *colormap = (stplyr->skincolor) ? R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, GTC_CACHE) : NULL;
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, splitflags, kp_inputwheel[target], colormap);
}
#undef drawButton
#undef BUTTW
#undef BUTTH
static void K_drawChallengerScreen(void)
{
// This is an insanely complicated animation.
@@ -8955,15 +8943,12 @@ static void K_drawLapStartAnim(void)
void K_drawKartFreePlay(UINT32 flashtime)
{
// no splitscreen support because it's not FREE PLAY if you have more than one player in-game
if (! cv_showfreeplay.value)
return;
if ((flashtime % TICRATE) < TICRATE/2)
if ((flashtime % 60) < 30)
return;
V_DrawKartString((BASEVIDWIDTH - (LAPS_X+1)) - (12*9), // mirror the laps thingy
LAPS_Y+3, V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS, "FREE PLAY");
V_DrawCenteredString(160, 182, V_SNAPTOBOTTOM|V_ALLOWLOWERCASE|V_YELLOWMAP, "Free Play");
}
static void K_drawDistributionDebugger(void)
@@ -9170,6 +9155,10 @@ void K_drawKartHUD(void)
if (!stplyr->spectator && !demo.freecam) // Bottom of the screen elements, don't need in spectate mode
{
if (!(splitscreen || demo.title))
if (LUA_HudEnabled(hud_position))
K_drawInput();
if (demo.title) // Draw title logo instead in demo.titles
{
INT32 x = BASEVIDWIDTH - 32, y = 128, offs;
@@ -9210,9 +9199,7 @@ void K_drawKartHUD(void)
K_drawKartSpeedometer();
}
if (isfreeplay)
;
else if (!modeattacking)
if (!(modeattacking || isfreeplay))
{
// Draw the numerical position
#ifdef HAVE_BLUA
+285
View File
@@ -1766,6 +1766,12 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
}
}
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_SmallStringWidth(string, option)/2;
V_DrawSmallString(x, y, option, string);
}
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string)
{
x -= V_SmallStringWidth(string, option);
@@ -1979,6 +1985,102 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
}
}
// Jaden: awesome!
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
{
fixed_t cx = x, cy = y;
INT32 w, c, dupx, dupy, scrwidth, center = 0, left = 0;
const char *ch = string;
INT32 charflags = 0;
const UINT8 *colormap = NULL;
INT32 spacewidth = 2, charwidth = 0;
INT32 lowercase = (option & V_ALLOWLOWERCASE);
option &= ~V_FLIP; // which is also shared with V_ALLOWLOWERCASE...
if (option & V_NOSCALESTART)
{
dupx = vid.dupx;
dupy = vid.dupy;
scrwidth = vid.width;
}
else
{
dupx = dupy = 1;
scrwidth = vid.width/vid.dupx;
left = (scrwidth - BASEVIDWIDTH)/2;
scrwidth -= left;
}
if (option & V_NOSCALEPATCH)
scrwidth *= vid.dupx;
charflags = (option & V_CHARCOLORMASK);
switch (option & V_SPACINGMASK)
{
case V_MONOSPACE:
spacewidth = 4;
/* FALLTHRU */
case V_OLDSPACING:
charwidth = 4;
break;
case V_6WIDTHSPACE:
spacewidth = 3;
default:
break;
}
for (;;ch++)
{
if (!*ch)
break;
if (*ch & 0x80) //color parsing -x 2.16.09
{
// manually set flags override color codes
if (!(option & V_CHARCOLORMASK))
charflags = ((*ch & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK;
continue;
}
if (*ch == '\n')
{
cx = x;
if (option & V_RETURN8)
cy += (4*dupy)<<FRACBITS;
else
cy += (6*dupy)<<FRACBITS;
continue;
}
c = *ch;
if (!lowercase)
c = toupper(c);
c -= HU_FONTSTART;
// character does not exist or is a space
if (c < 0 || c >= HU_FONTSIZE || !hu_font[c])
{
cx += (spacewidth * dupx)<<FRACBITS;
continue;
}
if (charwidth)
{
w = charwidth * dupx;
center = w/2 - hu_font[c]->width*(dupx/4);
}
else
w = hu_font[c]->width * dupx / 2;
if ((cx>>FRACBITS) > scrwidth)
break;
if ((cx>>FRACBITS)+left + w < 0) //left boundary check
{
cx += w<<FRACBITS;
continue;
}
colormap = V_GetStringColormap(charflags);
V_DrawFixedPatch(cx + (center<<FRACBITS), cy, FRACUNIT/2, option, hu_font[c], colormap);
cx += w<<FRACBITS;
}
}
void V_DrawCenteredSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
{
x -= (V_SmallStringWidth(string, option) / 2)<<FRACBITS;
V_DrawSmallStringAtFixed(x, y, option, string);
}
// Draws a tallnum. Replaces two functions in y_inter and st_stuff
void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num)
{
@@ -2049,6 +2151,28 @@ INT32 V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *color
return x;
}
// Jaden: Draw a number using the position numbers.
//
void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const UINT8 *colormap)
{
INT32 w = SHORT(ranknum[0]->width) - 1;
if (flags & V_NOSCALESTART)
w *= vid.dupx;
if (num < 0)
num = -num;
// draw the number
do
{
x -= (w - 1);
V_DrawFixedPatch(x << FRACBITS, y << FRACBITS, FRACUNIT, flags, ranknum[num % 10], colormap);
num /= 10;
} while (--digits);
}
// Write a string using the credit font
// NOTE: the text is centered for screens larger than the base width
//
@@ -2343,6 +2467,167 @@ INT32 V_ThinStringWidth(const char *string, INT32 option)
return w;
}
char V_GetSkincolorChar(INT32 color)
{
char cstart = 0x80;
switch (color)
{
case SKINCOLOR_WHITE:
case SKINCOLOR_SILVER:
case SKINCOLOR_SLATE:
cstart = 0x80; // White
break;
case SKINCOLOR_GREY:
case SKINCOLOR_NICKEL:
case SKINCOLOR_BLACK:
case SKINCOLOR_SKUNK:
case SKINCOLOR_JET:
cstart = 0x86; // V_GRAYMAP
break;
case SKINCOLOR_SEPIA:
case SKINCOLOR_BEIGE:
case SKINCOLOR_WALNUT:
case SKINCOLOR_BROWN:
case SKINCOLOR_LEATHER:
case SKINCOLOR_RUST:
case SKINCOLOR_WRISTWATCH:
cstart = 0x8e; // V_BROWNMAP
break;
case SKINCOLOR_FAIRY:
case SKINCOLOR_SALMON:
case SKINCOLOR_PINK:
case SKINCOLOR_ROSE:
case SKINCOLOR_BRICK:
case SKINCOLOR_LEMONADE:
case SKINCOLOR_BUBBLEGUM:
case SKINCOLOR_LILAC:
cstart = 0x8d; // V_PINKMAP
break;
case SKINCOLOR_CINNAMON:
case SKINCOLOR_RUBY:
case SKINCOLOR_RASPBERRY:
case SKINCOLOR_CHERRY:
case SKINCOLOR_RED:
case SKINCOLOR_CRIMSON:
case SKINCOLOR_MAROON:
case SKINCOLOR_FLAME:
case SKINCOLOR_SCARLET:
case SKINCOLOR_KETCHUP:
cstart = 0x85; // V_REDMAP
break;
case SKINCOLOR_DAWN:
case SKINCOLOR_SUNSET:
case SKINCOLOR_CREAMSICLE:
case SKINCOLOR_ORANGE:
case SKINCOLOR_PUMPKIN:
case SKINCOLOR_ROSEWOOD:
case SKINCOLOR_BURGUNDY:
case SKINCOLOR_TANGERINE:
cstart = 0x87; // V_ORANGEMAP
break;
case SKINCOLOR_PEACH:
case SKINCOLOR_CARAMEL:
case SKINCOLOR_CREAM:
cstart = 0x8f; // V_PEACHMAP
break;
case SKINCOLOR_GOLD:
case SKINCOLOR_ROYAL:
case SKINCOLOR_BRONZE:
case SKINCOLOR_COPPER:
case SKINCOLOR_THUNDER:
cstart = 0x8a; // V_GOLDMAP
break;
case SKINCOLOR_POPCORN:
case SKINCOLOR_QUARRY:
case SKINCOLOR_YELLOW:
case SKINCOLOR_MUSTARD:
case SKINCOLOR_CROCODILE:
case SKINCOLOR_OLIVE:
cstart = 0x82; // V_YELLOWMAP
break;
case SKINCOLOR_ARTICHOKE:
case SKINCOLOR_VOMIT:
case SKINCOLOR_GARDEN:
case SKINCOLOR_TEA:
case SKINCOLOR_PISTACHIO:
cstart = 0x8b; // V_TEAMAP
break;
case SKINCOLOR_LIME:
case SKINCOLOR_HANDHELD:
case SKINCOLOR_MOSS:
case SKINCOLOR_CAMOUFLAGE:
case SKINCOLOR_ROBOHOOD:
case SKINCOLOR_MINT:
case SKINCOLOR_GREEN:
case SKINCOLOR_PINETREE:
case SKINCOLOR_EMERALD:
case SKINCOLOR_SWAMP:
case SKINCOLOR_DREAM:
case SKINCOLOR_PLAGUE:
case SKINCOLOR_ALGAE:
cstart = 0x83; // V_GREENMAP
break;
case SKINCOLOR_CARIBBEAN:
case SKINCOLOR_AZURE:
case SKINCOLOR_AQUA:
case SKINCOLOR_TEAL:
case SKINCOLOR_CYAN:
case SKINCOLOR_JAWZ:
case SKINCOLOR_CERULEAN:
case SKINCOLOR_NAVY:
case SKINCOLOR_SAPPHIRE:
cstart = 0x88; // V_SKYMAP
break;
case SKINCOLOR_PIGEON:
case SKINCOLOR_PLATINUM:
case SKINCOLOR_STEEL:
cstart = 0x8c; // V_STEELMAP
break;
case SKINCOLOR_PERIWINKLE:
case SKINCOLOR_BLUE:
case SKINCOLOR_BLUEBERRY:
case SKINCOLOR_NOVA:
cstart = 0x84; // V_BLUEMAP
break;
case SKINCOLOR_ULTRAVIOLET:
case SKINCOLOR_PURPLE:
case SKINCOLOR_FUCHSIA:
cstart = 0x81; // V_PURPLEMAP
break;
case SKINCOLOR_PASTEL:
case SKINCOLOR_MOONSLAM:
case SKINCOLOR_DUSK:
case SKINCOLOR_TOXIC:
case SKINCOLOR_MAUVE:
case SKINCOLOR_LAVENDER:
case SKINCOLOR_BYZANTIUM:
case SKINCOLOR_POMEGRANATE:
cstart = 0x89; // V_LAVENDERMAP
break;
default:
break;
}
return cstart;
}
boolean *heatshifter = NULL;
INT32 lastheight = 0;
INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
+10
View File
@@ -190,6 +190,7 @@ void V_DrawRightAlignedString(INT32 x, INT32 y, INT32 option, const char *string
// draw a string using the hu_font, 0.5x scale
void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawCenteredSmallString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawRightAlignedSmallString(INT32 x, INT32 y, INT32 option, const char *string);
// draw a string using the tny_font
@@ -197,8 +198,12 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawCenteredThinString(INT32 x, INT32 y, INT32 option, const char *string);
void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *string);
// draw a string using fixed positions
void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
void V_DrawSmallStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string);
void V_DrawCenteredSmallStringAtFixed(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);
@@ -207,6 +212,9 @@ void V_DrawPaddedTallNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits)
// This is a separate function because IMO lua should have access to it as well.
INT32 V_DrawPingNum(INT32 x, INT32 y, INT32 flags, INT32 num, const UINT8 *colormap);
// Jaden: Draw position numbers. Used by the speedometer and 3/4-player splitscreen bumper/laps display.
void V_DrawRankNum(INT32 x, INT32 y, INT32 flags, INT32 num, INT32 digits, const UINT8 *colormap);
// Find string width from lt_font chars
INT32 V_LevelNameWidth(const char *string);
INT32 V_LevelNameHeight(const char *string);
@@ -221,6 +229,8 @@ INT32 V_SmallStringWidth(const char *string, INT32 option);
// Find string width from tny_font chars
INT32 V_ThinStringWidth(const char *string, INT32 option);
char V_GetSkincolorChar(INT32 color);
void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param);
void V_DrawPatchFill(patch_t *pat);