mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-06 23:13:20 +00:00
Pick-me-up HUD
This commit is contained in:
parent
a1c99fa890
commit
b62f3c65a8
1 changed files with 66 additions and 120 deletions
186
src/k_hud.cpp
186
src/k_hud.cpp
|
|
@ -1894,31 +1894,19 @@ static void K_drawKartItem(void)
|
|||
}
|
||||
|
||||
// So, like, we've already established that HUD code is unsavable, right?
|
||||
// == SHITGARBAGE UNLIMITED 3: HACKS GONE WILD ==
|
||||
static void K_drawBackupItem(void)
|
||||
{
|
||||
// ITEM_X = BASEVIDWIDTH-50; // 270
|
||||
// ITEM_Y = 24; // 24
|
||||
|
||||
// Why write V_DrawScaledPatch calls over and over when they're all the same?
|
||||
// Set to 'no item' just in case.
|
||||
const UINT8 offset = 1;
|
||||
patch_t *localpatch[3] = { kp_nodraw, kp_nodraw, kp_nodraw };
|
||||
UINT8 localamt[3] = {0, 0, 0};
|
||||
patch_t *localbg = ((offset) ? kp_itembg[2] : kp_itembg[0]);
|
||||
patch_t *localinv = ((offset) ? kp_invincibility[((leveltime % (6*3)) / 3) + 7] : kp_invincibility[(leveltime % (7*3)) / 3]);
|
||||
INT32 fx = 0, fy = 0, fflags = 0; // final coords for hud and flags...
|
||||
const INT32 numberdisplaymin = ((!offset && stplyr->itemtype == KITEM_ORBINAUT) ? 5 : 2);
|
||||
bool tiny = r_splitscreen > 1;
|
||||
patch_t *localpatch[3] = { kp_nodraw, kp_nodraw, kp_nodraw };
|
||||
patch_t *localbg = (kp_itembg[2]);
|
||||
patch_t *localinv = kp_invincibility[((leveltime % (6*3)) / 3) + 7 + tiny];
|
||||
INT32 fx = 0, fy = 0, fflags = 0, tx = 0, ty = 0; // final coords for hud and flags...
|
||||
const INT32 numberdisplaymin = 2;
|
||||
skincolornum_t localcolor[3] = { static_cast<skincolornum_t>(stplyr->skincolor) };
|
||||
SINT8 colormode[3] = { TC_RAINBOW };
|
||||
boolean flipamount = false; // Used for 3P/4P splitscreen to flip item amount stuff
|
||||
|
||||
fixed_t rouletteOffset = 0;
|
||||
fixed_t rouletteSpace = ROULETTE_SPACING;
|
||||
vector2_t rouletteCrop = {7, 7};
|
||||
|
||||
boolean flashOnOne = false;
|
||||
boolean flashOnTwo = false;
|
||||
|
||||
if (stplyr->backupitemamount <= 0)
|
||||
return;
|
||||
|
||||
|
|
@ -1926,22 +1914,22 @@ static void K_drawBackupItem(void)
|
|||
{
|
||||
case KITEM_INVINCIBILITY:
|
||||
localpatch[1] = localinv;
|
||||
localbg = kp_itembg[offset+1];
|
||||
localbg = kp_itembg[2];
|
||||
break;
|
||||
|
||||
case KITEM_ORBINAUT:
|
||||
localpatch[1] = kp_orbinaut[(offset ? 4 : std::min(stplyr->itemamount-1, 3))];
|
||||
localpatch[1] = kp_orbinaut[tiny+4];
|
||||
break;
|
||||
|
||||
case KITEM_SPB:
|
||||
case KITEM_LIGHTNINGSHIELD:
|
||||
case KITEM_BUBBLESHIELD:
|
||||
case KITEM_FLAMESHIELD:
|
||||
localbg = kp_itembg[offset+1];
|
||||
localbg = kp_itembg[2];
|
||||
/*FALLTHRU*/
|
||||
|
||||
default:
|
||||
localpatch[1] = K_GetCachedItemPatch(stplyr->backupitemtype, offset);
|
||||
localpatch[1] = K_GetCachedItemPatch(stplyr->backupitemtype, 1 + tiny);
|
||||
|
||||
if (localpatch[1] == NULL)
|
||||
localpatch[1] = kp_nodraw; // diagnose underflows
|
||||
|
|
@ -1949,32 +1937,18 @@ static void K_drawBackupItem(void)
|
|||
}
|
||||
|
||||
// pain and suffering defined below
|
||||
if (offset)
|
||||
{
|
||||
if (!(R_GetViewNumber() & 1)) // If we are P1 or P3...
|
||||
{
|
||||
fx = 0;
|
||||
fy = 0;
|
||||
fflags = V_SNAPTOLEFT|V_SNAPTOTOP|V_SPLITSCREEN;
|
||||
}
|
||||
else // else, that means we're P2 or P4.
|
||||
{
|
||||
fx = ITEM2_X*2;
|
||||
fy = 0;
|
||||
fflags = V_SNAPTORIGHT|V_SNAPTOTOP|V_SPLITSCREEN;
|
||||
flipamount = true;
|
||||
}
|
||||
|
||||
rouletteSpace = ROULETTE_SPACING_SPLITSCREEN;
|
||||
rouletteOffset = FixedMul(rouletteOffset, FixedDiv(ROULETTE_SPACING_SPLITSCREEN, ROULETTE_SPACING));
|
||||
rouletteCrop.x = 16;
|
||||
rouletteCrop.y = 15;
|
||||
}
|
||||
else
|
||||
if (!(R_GetViewNumber() & 1) || (!tiny)) // If we are P1 or P3...
|
||||
{
|
||||
fx = ITEM_X;
|
||||
fy = ITEM_Y;
|
||||
fflags = V_SNAPTOTOP|V_SNAPTOLEFT|V_SPLITSCREEN;
|
||||
fflags = V_SNAPTOLEFT|V_SNAPTOTOP|V_SPLITSCREEN;
|
||||
}
|
||||
else // else, that means we're P2 or P4.
|
||||
{
|
||||
fx = ITEM2_X;
|
||||
fy = ITEM2_Y;
|
||||
fflags = V_SNAPTORIGHT|V_SNAPTOTOP|V_SPLITSCREEN;
|
||||
flipamount = true;
|
||||
}
|
||||
|
||||
if (r_splitscreen == 1)
|
||||
|
|
@ -1982,87 +1956,59 @@ static void K_drawBackupItem(void)
|
|||
fy -= 5;
|
||||
}
|
||||
|
||||
auto draw_item = [&](fixed_t y, int i)
|
||||
// final fudge - vegeta 2025
|
||||
if (tiny && !(R_GetViewNumber() & 1)) // P1/P3 4P
|
||||
{
|
||||
const UINT8 *colormap = (localcolor[i] ? R_GetTranslationColormap(colormode[i], localcolor[i], GTC_CACHE) : NULL);
|
||||
fx += 26;
|
||||
fy += 5;
|
||||
tx += 10;
|
||||
ty += 10;
|
||||
}
|
||||
else if (tiny && (R_GetViewNumber() & 1)) // P2/P4 4P
|
||||
{
|
||||
fx += -4;
|
||||
fy += 5;
|
||||
tx += -5;
|
||||
ty += 10;
|
||||
}
|
||||
else // 1P/2P
|
||||
{
|
||||
fx += 30;
|
||||
fy += -10;
|
||||
tx += 25;
|
||||
ty += 30;
|
||||
}
|
||||
|
||||
boolean transflag = V_HUDTRANS;
|
||||
|
||||
// I feel like the cardinal sin of all evolving HUDcode is, like, assuming the old offsets do something that makes sense.
|
||||
|
||||
if (stplyr->backupitemamount >= numberdisplaymin && stplyr->itemRoulette.active == false)
|
||||
{
|
||||
/*
|
||||
// Then, the numbers:
|
||||
V_DrawScaledPatch(
|
||||
fx + (flipamount ? 48 : 0), fy,
|
||||
V_HUDTRANS|V_SLIDEIN|fflags|(flipamount ? V_FLIP : 0),
|
||||
kp_itemmulsticker[offset]
|
||||
); // flip this graphic for p2 and p4 in split and shift it.
|
||||
*/
|
||||
|
||||
V_DrawFixedPatch(
|
||||
fx<<FRACBITS, (fy<<FRACBITS) + rouletteOffset + y,
|
||||
FRACUNIT, V_HUDTRANS|V_SLIDEIN|fflags,
|
||||
localpatch[i], colormap
|
||||
fx<<FRACBITS, (fy<<FRACBITS),
|
||||
FRACUNIT, transflag|V_SLIDEIN|fflags,
|
||||
localpatch[1], (localcolor[1] ? R_GetTranslationColormap(colormode[1], localcolor[1], GTC_CACHE) : NULL)
|
||||
);
|
||||
if (localamt[i] > 1)
|
||||
{
|
||||
using srb2::Draw;
|
||||
Draw(
|
||||
fx + rouletteCrop.x + FixedToFloat(rouletteSpace/2),
|
||||
fy + rouletteCrop.y + FixedToFloat(rouletteOffset + y + rouletteSpace) - (r_splitscreen > 1 ? 15 : 33))
|
||||
.font(r_splitscreen > 1 ? Draw::Font::kRollingNum4P : Draw::Font::kRollingNum)
|
||||
.align(Draw::Align::kCenter)
|
||||
.flags(V_HUDTRANS|V_SLIDEIN|fflags)
|
||||
.colormap(colormap)
|
||||
.text("{}", localamt[i]);
|
||||
}
|
||||
};
|
||||
|
||||
draw_item(rouletteSpace, 0);
|
||||
draw_item(-rouletteSpace, 2);
|
||||
|
||||
if (false)
|
||||
{
|
||||
// Draw the item underneath the box.
|
||||
draw_item(0, 1);
|
||||
V_ClearClipRect();
|
||||
V_DrawString(fx+tx, fy+ty, V_HUDTRANS|V_SLIDEIN|fflags, va("x%d", stplyr->backupitemamount));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw the item above the box.
|
||||
V_ClearClipRect();
|
||||
|
||||
boolean transflag = V_HUDTRANS;
|
||||
|
||||
if (cv_reducevfx.value && (flashOnOne || flashOnTwo))
|
||||
{
|
||||
transflag = V_HUDTRANSHALF;
|
||||
}
|
||||
|
||||
if (stplyr->backupitemamount >= numberdisplaymin && stplyr->itemRoulette.active == false)
|
||||
{
|
||||
/*
|
||||
// Then, the numbers:
|
||||
V_DrawScaledPatch(
|
||||
fx + (flipamount ? 48 : 0), fy,
|
||||
V_HUDTRANS|V_SLIDEIN|fflags|(flipamount ? V_FLIP : 0),
|
||||
kp_itemmulsticker[offset]
|
||||
); // flip this graphic for p2 and p4 in split and shift it.
|
||||
*/
|
||||
|
||||
V_DrawFixedPatch(
|
||||
fx<<FRACBITS, (fy<<FRACBITS) + rouletteOffset,
|
||||
FRACUNIT, transflag|V_SLIDEIN|fflags,
|
||||
localpatch[1], (localcolor[1] ? R_GetTranslationColormap(colormode[1], localcolor[1], GTC_CACHE) : NULL)
|
||||
);
|
||||
|
||||
if (offset)
|
||||
{
|
||||
if (flipamount) // reminder that this is for 3/4p's right end of the screen.
|
||||
V_DrawString(fx+2, fy+31, V_HUDTRANS|V_SLIDEIN|fflags, va("x%d", stplyr->backupitemamount));
|
||||
else
|
||||
V_DrawString(fx+24, fy+31, V_HUDTRANS|V_SLIDEIN|fflags, va("x%d", stplyr->backupitemamount));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawScaledPatch(fy+28, fy+41, V_HUDTRANS|V_SLIDEIN|fflags, kp_itemx);
|
||||
V_DrawTimerString(fx+38, fy+36, V_HUDTRANS|V_SLIDEIN|fflags, va("%d", stplyr->backupitemamount));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawFixedPatch(
|
||||
fx<<FRACBITS, (fy<<FRACBITS) + rouletteOffset,
|
||||
FRACUNIT, transflag|V_SLIDEIN|fflags,
|
||||
localpatch[1], (localcolor[1] ? R_GetTranslationColormap(colormode[1], localcolor[1], GTC_CACHE) : NULL)
|
||||
);
|
||||
}
|
||||
V_DrawFixedPatch(
|
||||
fx<<FRACBITS, (fy<<FRACBITS),
|
||||
FRACUNIT, transflag|V_SLIDEIN|fflags,
|
||||
localpatch[1], (localcolor[1] ? R_GetTranslationColormap(colormode[1], localcolor[1], GTC_CACHE) : NULL)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue