Refactor bubble speed limit, trap duration 3.5sec, 6 inputs per second

This commit is contained in:
Antonio Martinez 2025-07-29 19:08:29 -04:00
parent 3e78ba17ac
commit 8c0f07ad6d

View file

@ -9822,8 +9822,13 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->extravalue1 = 1;
// Mash speed limit
UINT8 MASHPWR = TICRATE/2; // Amount to deduct from timer when mashing
UINT8 MAXMASHFREQUENCY = 6; // Nerf fast mashing: allow optimal decay with X inputs per second
UINT8 ticsbetweenmashing = TICRATE/MAXMASHFREQUENCY;
UINT8 decaypertic = MASHPWR / ticsbetweenmashing;
if (mobj->cusval)
mobj->cusval--;
mobj->cusval = max(0, mobj->cusval - decaypertic);
mobj->cvmem /= 2;
mobj->momz = 0;
@ -9860,7 +9865,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
mobj->tracer->y + P_ReturnThrustY(NULL, mobj->tracer->angle+ANGLE_90, (mobj->cvmem)<<FRACBITS),
mobj->tracer->z - (4*mobj->tracer->scale) + (P_RandomRange(PR_ITEM_BUBBLE, -abs(mobj->cvmem), abs(mobj->cvmem))<<FRACBITS));
if (mobj->movecount > 3*TICRATE)
if (mobj->movecount > 7*TICRATE/2)
{
S_StartSound(mobj->tracer, sfx_s3k77);
mobj->tracer->flags &= ~MF_NOGRAVITY;
@ -9881,17 +9886,11 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
if ((player->cmd.turning > 0 && lastsign < 0)
|| (player->cmd.turning < 0 && lastsign > 0))
{
UINT8 mashpwr = TICRATE/2;
mobj->movecount += (mashpwr) - (mobj->cusval*2);
// CONS_Printf("%d -> ", mobj->movecount);
mobj->movecount += MASHPWR - mobj->cusval;
// CONS_Printf("%d\n", mobj->movecount);
mobj->cvmem = 8*lastsign;
mobj->cusval = mashpwr/2; // Mash speed limit.
// The value of this var, as set here, is the highest useful speed
// (in tics) that you can mash out of bubble trap. As configured
// here, it's 4 inputs per second.
// If you're here to change this, make sure that when cusval = this
// value, the "movecount" line above adds 0. I would have hooked that
// math up before leaving, but integer precision is a drag here and
// you probably have to use even divisors of mashpwr.
mobj->cusval = MASHPWR; // Mash speed limit.
S_StartSound(mobj, sfx_s3k7a);
}