Fix up some uncaught issues with the S-Monitor split

- Cancel-music is fixed
- Offroad gradienting is fixed
- Introduced the "slot-unhog" system (decaying power lets you pick up items again)
- Renamed some more internal variables
This commit is contained in:
yamamama 2026-02-16 17:00:55 -05:00
parent 542648e948
commit fb6066dea9
9 changed files with 38 additions and 24 deletions

View file

@ -20,4 +20,4 @@ _(LANDMINE)
_(BUBBLESHIELD)
_(FLAMESHIELD)
_(EGGBRICK)
_(S_MONITOR)
_(SMONITOR)

View file

@ -1263,7 +1263,7 @@ void K_BotItemUsage(botdata_t *bd, const player_t *player)
case KITEM_GROW:
case KITEM_SHRINK:
case KITEM_SUPERRING:
case KITEM_S_MONITOR:
case KITEM_SMONITOR:
K_BotItemGenericTap(bd);
break;
case KITEM_ROCKETSNEAKER:

View file

@ -1314,6 +1314,7 @@ static void K_drawKartItem(void)
UINT8 *colormap = NULL;
boolean flipamount = false; // Used for 3P/4P splitscreen to flip item amount stuff
boolean isalt = false;
boolean fade = false;
// RadioRacers
boolean shouldDrawOnPlayer = false;
@ -1329,6 +1330,18 @@ static void K_drawKartItem(void)
}
else
{
// S-Monitor nonsense necessitates we do this ahead of time
boolean candrawitemstatus = true;
if (stplyr->itemamount <= 0 && stplyr->itemusecooldown <= 0)
candrawitemstatus = false;
if (stplyr->itemtype == 0 && stplyr->itemusecooldown <= 0)
candrawitemstatus = false;
if (stplyr->itemtype >= numkartitems && stplyr->itemtype != MAXKARTITEMS)
candrawitemstatus = false;
// I'm doing this a little weird and drawing mostly in reverse order
// The only actual reason is to make sneakers line up this way in the code below
// This shouldn't have any actual baring over how it functions
@ -1387,7 +1400,7 @@ static void K_drawKartItem(void)
else
localpatch = kp_nodraw;
}
else if (stplyr->smonitortimer)
else if (stplyr->smonitortimer && (!candrawitemstatus))
{
if (stplyr->smonitortimer < SMONITORTIME)
itembar = FixedDiv(stplyr->smonitortimer, max(1, stplyr->maxsmonitortime));
@ -1397,11 +1410,15 @@ static void K_drawKartItem(void)
if (leveltime & 1)
{
localpatch = K_GetCachedItemPatch(KITEM_S_MONITOR, tiny, 0);
isalt = true;
localpatch = K_GetCachedItemPatch(KITEM_SMONITOR, tiny, 0);
}
else
localpatch = kp_nodraw;
if (!K_SMonitorSlotHogging(stplyr))
{
fade = true;
}
}
else if (K_GetShieldFromPlayer(stplyr) == KSHIELD_BUBBLE)
{
@ -1432,13 +1449,7 @@ static void K_drawKartItem(void)
}
else
{
if (stplyr->itemamount <= 0 && stplyr->itemusecooldown <= 0)
return;
if (stplyr->itemtype == 0 && stplyr->itemusecooldown <= 0)
return;
if (stplyr->itemtype >= numkartitems && stplyr->itemtype != MAXKARTITEMS)
if (!candrawitemstatus)
return;
if (stplyr->itemtype > 0 && stplyr->itemamount > 0)
@ -1502,7 +1513,7 @@ static void K_drawKartItem(void)
}
INT32 hudtrans = V_GetHudTrans();
INT32 transflag = V_HUDTRANS;
INT32 transflag = (fade) ? V_HUDTRANSHALF : V_HUDTRANS;
INT32 transmul = FRACUNIT - (hudtrans * FRACUNIT / 10);
if (hudtrans > 9)
@ -1534,7 +1545,7 @@ static void K_drawKartItem(void)
// Nice-to-have: some way for custom items to have this feature? Not sure yet.
if (stplyr->itemtype == KITEM_FLAMESHIELD || stplyr->eggmanexplode > 1 || (rocketsmonitorbar)) {
roulettetrans = (INT32)((float)(roulettetrans) * 0.57143f);
roulettetrans = (INT32)((float)(roulettetrans) * (0.57143f * ((fade) ? 0.5f : 1.0f)));
}
if (stplyr->exiting)
@ -1546,10 +1557,11 @@ static void K_drawKartItem(void)
}
else
{
transflag = V_HUDTRANS;
transflag = (fade) ? V_HUDTRANSHALF : V_HUDTRANS;
}
}
fx = info.x;
fy = info.y;
fflags = info.flags;
@ -3519,7 +3531,7 @@ static void K_drawKartPlayerCheck(void)
{
pnum += 2;
}
else if (checkplayer->itemtype == KITEM_S_MONITOR || checkplayer->smonitortimer)
else if (checkplayer->itemtype == KITEM_SMONITOR || checkplayer->smonitortimer)
{
// FIXME: Separate "CHECK" icon(?)
pnum += 2;

View file

@ -358,7 +358,7 @@ static boolean K_DontDoubleMyItems(kartitemtype_e type, UINT8 amount)
|| type == KITEM_INVINCIBILITY || type == KITEM_GROW
|| type == KITEM_BUBBLESHIELD || type == KITEM_FLAMESHIELD
|| type == KITEM_ROCKETSNEAKER || type == KITEM_SHRINK
|| type == KITEM_HYUDORO || type == KITEM_S_MONITOR
|| type == KITEM_HYUDORO || type == KITEM_SMONITOR
|| (type == KITEM_BANANA && amount >= 4)
|| (type == KITEM_ORBINAUT && amount >= 3)
|| (type == KITEM_SNEAKER && amount >= 3)
@ -2072,7 +2072,7 @@ void K_PlayerItemThink(player_t *player, boolean onground)
K_BotResetItemConfirm(player, false);
}
break;
case KITEM_S_MONITOR:
case KITEM_SMONITOR:
if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO)
{
K_DoSMonitor(player, SMONITORTIME);

View file

@ -1016,7 +1016,7 @@ static fixed_t K_OffroadGradient(player_t* player, fixed_t offroad)
// S-Monitor: At 50% or lower power, offroad creeps up on you.
fixed_t smonitoroffroad = min(FRACUNIT, K_SMonitorGradient(player->smonitortimer));
fixed_t subtrahend = FixedMul(smonitoroffroad, invinoffroad);
fixed_t subtrahend = (smonitoroffroad + invinoffroad);
fixed_t fac = CLAMP(FRACUNIT - subtrahend, 0, FRACUNIT);
@ -10838,9 +10838,9 @@ INT32 K_GetShieldFromItem(INT32 item)
}
}
static boolean K_SMonitorSlotHogging(player_t *player)
boolean K_SMonitorSlotHogging(player_t *player)
{
return ((player->smonitortimer) != 0);
return (K_SMonitorGradient(player->smonitortimer) >= FRACUNIT);
}
//

View file

@ -278,6 +278,7 @@ fixed_t K_SMonitorGradient(UINT16 time);
fixed_t K_GetSMonitorSpeed(UINT16 time);
fixed_t K_GetSMonitorAccel(UINT16 time);
fixed_t K_GetSMonitorHandling(UINT16 time);
boolean K_SMonitorSlotHogging(player_t *player);
void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source);
void K_UpdateHnextList(player_t *player, boolean clean);

View file

@ -100,7 +100,7 @@ boolean P_CanPickupItem(player_t *player, UINT8 weapon)
if (player->stealingtimer || player->stolentimer
|| player->rocketsneakertimer
|| player->eggmanexplode
|| player->smonitortimer
|| K_SMonitorSlotHogging(player)
|| (player->growshrinktimer > 0)
|| player->flametimer)
return false;

View file

@ -8501,7 +8501,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
K_UpdateMobjItemOverlay(part, mobj->threshold, mobj->movecount);
if ((mobj->threshold == KITEM_INVINCIBILITY) || (mobj->threshold == KITEM_S_MONITOR))
if ((mobj->threshold == KITEM_INVINCIBILITY) || (mobj->threshold == KITEM_SMONITOR))
mobj->color = K_RainbowColor(leveltime);
}
break;

View file

@ -1812,7 +1812,8 @@ static void P_CheckInvincibilityTimer(player_t *player)
// Resume normal music stuff.
if (player->invincibilitytimer == 1
|| player->powers[pw_invulnerability] == 1
|| (player->smonitorwarning == 1))
|| (player->smonitorwarning == 1)
|| player->smonitortimer == 1)
{
player->smonitorwarning = 2; // Don't attempt to restore music again.