Ringbox: HUD, transform time define, ring-box-only, scaling rewards

This commit is contained in:
AJ Martinez 2023-06-26 17:36:41 -07:00
parent 45547607bd
commit 0a6bac0dcc
9 changed files with 81 additions and 20 deletions

View file

@ -433,6 +433,8 @@ consvar_t cv_kartbot = CVAR_INIT ("bots", "0", CV_NETVAR, kartbot_cons_t, NULL);
consvar_t cv_karteliminatelast = CVAR_INIT ("eliminatelast", "Yes", CV_NETVAR|CV_CALL, CV_YesNo, KartEliminateLast_OnChange);
consvar_t cv_thunderdome = CVAR_INIT ("thunderdome", "Off", CV_NETVAR, CV_OnOff, NULL);
consvar_t cv_kartusepwrlv = CVAR_INIT ("usepwrlv", "Yes", CV_NETVAR, CV_YesNo, NULL);
static CV_PossibleValue_t kartdebugitem_cons_t[] =

View file

@ -88,6 +88,7 @@ extern consvar_t cv_kartspeedometer;
extern consvar_t cv_kartvoices;
extern consvar_t cv_kartbot;
extern consvar_t cv_karteliminatelast;
extern consvar_t cv_thunderdome;
extern consvar_t cv_kartusepwrlv;
extern consvar_t cv_votetime;

View file

@ -1256,7 +1256,7 @@ static void K_drawKartItem(void)
for (i = 0; i < 3; i++)
{
const SINT8 indexOfs = i-1;
const size_t index = (stplyr->itemRoulette.index + indexOfs) % stplyr->itemRoulette.itemListLen;
const size_t index = (stplyr->itemRoulette.itemListLen + (stplyr->itemRoulette.index + indexOfs)) % stplyr->itemRoulette.itemListLen;
const SINT8 result = stplyr->itemRoulette.itemList[index];
const SINT8 item = K_ItemResultToType(result);
@ -1584,13 +1584,21 @@ static void K_drawKartSlotMachine(void)
patch_t *localpatch[3] = { kp_nodraw, kp_nodraw, kp_nodraw };
patch_t *localbg = offset ? kp_ringbg[1] : kp_ringbg[0];
// == SHITGARBAGE UNLIMITED 2: RISE OF MY ASS ==
// FIVE LAYERS OF BULLSHIT PER-PIXEL SHOVING BECAUSE THE PATCHES HAVE DIFFERENT OFFSETS
// IF YOU ARE HERE TO ADJUST THE RINGBOX HUD TURN OFF YOUR COMPUTER AND GO TO YOUR LOCAL PARK
INT32 fx = 0, fy = 0, fflags = 0; // final coords for hud and flags...
INT32 boxoffx = 0;
INT32 boxoffy = -6;
INT32 vstretch = 0;
INT32 splitbsx, splitbsy = 0;
UINT16 localcolor[3] = { stplyr->skincolor };
SINT8 colormode[3] = { TC_RAINBOW };
fixed_t rouletteOffset = 0;
fixed_t rouletteSpace = ROULETTE_SPACING;
vector2_t rouletteCrop = {7, 7};
fixed_t rouletteSpace = SLOT_SPACING;
vector2_t rouletteCrop = {10, 10};
INT32 i;
if (stplyr->itemRoulette.itemListLen > 0)
@ -1599,7 +1607,7 @@ static void K_drawKartSlotMachine(void)
for (i = 0; i < 3; i++)
{
const SINT8 indexOfs = i-1;
const size_t index = (stplyr->itemRoulette.index + indexOfs) % stplyr->itemRoulette.itemListLen;
const size_t index = (stplyr->itemRoulette.itemListLen + (stplyr->itemRoulette.index + indexOfs)) % stplyr->itemRoulette.itemListLen;
const SINT8 result = stplyr->itemRoulette.itemList[index];
@ -1609,7 +1617,7 @@ static void K_drawKartSlotMachine(void)
if (stplyr->itemRoulette.active == true)
{
rouletteOffset = K_GetRouletteOffset(&stplyr->itemRoulette, rendertimefrac);
rouletteOffset = K_GetSlotOffset(&stplyr->itemRoulette, rendertimefrac);
}
else
{
@ -1620,23 +1628,27 @@ static void K_drawKartSlotMachine(void)
// pain and suffering defined below
if (offset)
{
boxoffx -= 4;
if (stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]]) // If we are P1 or P3...
{
fx = ITEM_X;
fy = ITEM_Y;
fx = ITEM_X + 10;
fy = ITEM_Y + 10;
fflags = V_SNAPTOLEFT|V_SNAPTOTOP|V_SPLITSCREEN;
}
else // else, that means we're P2 or P4.
{
fx = ITEM2_X;
fy = ITEM2_Y;
fx = ITEM2_X + 7;
fy = ITEM2_Y + 10;
fflags = V_SNAPTORIGHT|V_SNAPTOTOP|V_SPLITSCREEN;
}
rouletteSpace = ROULETTE_SPACING_SPLITSCREEN;
rouletteOffset = FixedMul(rouletteOffset, FixedDiv(ROULETTE_SPACING_SPLITSCREEN, ROULETTE_SPACING));
rouletteSpace = SLOT_SPACING_SPLITSCREEN;
rouletteOffset = FixedMul(rouletteOffset, FixedDiv(SLOT_SPACING_SPLITSCREEN, SLOT_SPACING));
rouletteCrop.x = 16;
rouletteCrop.y = 15;
rouletteCrop.y = 13;
splitbsx = -6;
splitbsy = -6;
boxoffy += 2;
}
else
{
@ -1648,8 +1660,8 @@ static void K_drawKartSlotMachine(void)
V_DrawScaledPatch(fx, fy, V_HUDTRANS|V_SLIDEIN|fflags, localbg);
V_SetClipRect(
(fx + rouletteCrop.x) << FRACBITS, (fy + rouletteCrop.y) << FRACBITS,
rouletteSpace, rouletteSpace,
((fx + rouletteCrop.x + boxoffx + splitbsx) << FRACBITS), ((fy + rouletteCrop.y + boxoffy - vstretch + splitbsy) << FRACBITS),
rouletteSpace, rouletteSpace + (vstretch<<FRACBITS),
V_SLIDEIN|fflags
);
@ -1659,7 +1671,7 @@ static void K_drawKartSlotMachine(void)
for (i = 0; i < 3; i++)
{
V_DrawFixedPatch(
fx<<FRACBITS, (fy<<FRACBITS) + rouletteOffset,
((fx)<<FRACBITS), ((fy)<<FRACBITS) + rouletteOffset,
FRACUNIT, V_HUDTRANS|V_SLIDEIN|fflags,
localpatch[i], (localcolor[i] ? R_GetTranslationColormap(colormode[i], localcolor[i], GTC_CACHE) : NULL)
);

View file

@ -361,6 +361,7 @@ void K_RegisterKartStuff(void)
CV_RegisterVar(&cv_kartvoices);
CV_RegisterVar(&cv_kartbot);
CV_RegisterVar(&cv_karteliminatelast);
CV_RegisterVar(&cv_thunderdome);
CV_RegisterVar(&cv_kartusepwrlv);
CV_RegisterVar(&cv_votetime);
CV_RegisterVar(&cv_botscanvote);
@ -10738,7 +10739,16 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (player->ringboxdelay == 0)
{
// TODO
K_AwardPlayerRings(player, 10 * (player->ringboxaward + 1), true);
UINT32 behind = K_GetItemRouletteDistance(player, player->itemRoulette.playing);
UINT32 behindMulti = behind / 1000;
behindMulti = min(behindMulti, 20);
UINT32 award = 5*player->ringboxaward + 10;
if (player->ringboxaward > 2) // not a BAR
award = 3 * award / 2;
award = award * (behind / 1000 + 10) / 10;
K_AwardPlayerRings(player, award, true);
player->ringboxaward = 0;
}
}

View file

@ -132,6 +132,7 @@ void Obj_RandomItemVisuals(mobj_t *mobj);
boolean Obj_RandomItemSpawnIn(mobj_t *mobj);
fixed_t Obj_RandomItemScale(fixed_t oldScale);
void Obj_RandomItemSpawn(mobj_t *mobj);
#define RINGBOX_TIME (70)
/* Gachabom Rebound */
void Obj_GachaBomReboundThink(mobj_t *mobj);

View file

@ -449,7 +449,7 @@ static UINT32 K_ScaleItemDistance(UINT32 distance, UINT8 numPlayers)
Return:-
The player's finalized item distance.
--------------------------------------------------*/
static UINT32 K_GetItemRouletteDistance(const player_t *player, UINT8 numPlayers)
UINT32 K_GetItemRouletteDistance(const player_t *player, UINT8 numPlayers)
{
UINT32 pdis = 0;
@ -1488,6 +1488,19 @@ fixed_t K_GetRouletteOffset(itemroulette_t *const roulette, fixed_t renderDelta)
return FixedMul(FixedDiv(midTic - curTic, ((roulette->speed + 1) << FRACBITS)), ROULETTE_SPACING);
}
/*--------------------------------------------------
fixed_t K_GetSlotOffset(itemroulette_t *const roulette, fixed_t renderDelta)
See header file for description.
--------------------------------------------------*/
fixed_t K_GetSlotOffset(itemroulette_t *const roulette, fixed_t renderDelta)
{
const fixed_t curTic = (roulette->tics << FRACBITS) - renderDelta;
const fixed_t midTic = roulette->speed * (FRACUNIT >> 1);
return FixedMul(FixedDiv(midTic - curTic, ((roulette->speed + 1) << FRACBITS)), SLOT_SPACING);
}
/*--------------------------------------------------
static void K_KartGetItemResult(player_t *const player, kartitems_t getitem)

View file

@ -23,6 +23,9 @@ extern "C" {
#define ROULETTE_SPACING (36 << FRACBITS)
#define ROULETTE_SPACING_SPLITSCREEN (16 << FRACBITS)
#define SLOT_SPACING (40 << FRACBITS)
#define SLOT_SPACING_SPLITSCREEN (22 << FRACBITS)
/*--------------------------------------------------
boolean K_ItemEnabled(kartitems_t item);
@ -171,6 +174,23 @@ void K_StartEggmanRoulette(player_t *const player);
fixed_t K_GetRouletteOffset(itemroulette_t *const roulette, fixed_t renderDelta);
/*--------------------------------------------------
fixed_t K_GetSlotOffset(itemroulette_t *const roulette, fixed_t renderDelta);
Gets the Y offset, for use in the slot HUD.
A separate function since it is used both by the
HUD itself, as well as when confirming an item.
Input Arguments:-
roulette - The roulette we are drawing for.
renderDelta - Fractional tic delta, when used for HUD.
Return:-
The Y offset when drawing the item.
--------------------------------------------------*/
fixed_t K_GetSlotOffset(itemroulette_t *const roulette, fixed_t renderDelta);
/*--------------------------------------------------
void K_KartItemRoulette(player_t *const player, ticcmd_t *cmd);
@ -188,6 +208,8 @@ fixed_t K_GetRouletteOffset(itemroulette_t *const roulette, fixed_t renderDelta)
void K_KartItemRoulette(player_t *const player, ticcmd_t *cmd);
UINT32 K_GetItemRouletteDistance(const player_t *player, UINT8 numPlayers);
#ifdef __cplusplus
} // extern "C"
#endif

View file

@ -111,10 +111,10 @@ void Obj_RandomItemVisuals(mobj_t *mobj)
// the player's cleared out a good portion of the map.
//
// Then extraval1 starts ticking up and triggers the transformation from Ringbox to Random Item.
if (mobj->fuse == 0 && !(mobj->flags & MF_NOCLIPTHING))
if (mobj->fuse == 0 && !(mobj->flags & MF_NOCLIPTHING) && !cv_thunderdome.value)
{
mobj->extravalue1++;
if (mobj->extravalue1 == TICRATE)
if (mobj->extravalue1 == RINGBOX_TIME)
{
// Sync the position in RINGBOX and RANDOMITEM animations.
statenum_t animDelta = mobj->state - states - S_RINGBOX1;

View file

@ -356,7 +356,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
special->momx = special->momy = special->momz = 0;
P_SetTarget(&special->target, toucher);
// P_KillMobj(special, toucher, toucher, DMG_NORMAL);
if (special->extravalue1 >= TICRATE)
if (special->extravalue1 >= RINGBOX_TIME)
K_StartItemRoulette(player, false);
else
K_StartItemRoulette(player, true);