Merge branch 'better-burn' into 'master'

Improve burning rings from payout

See merge request kart-krew-dev/ring-racers-internal!2919
This commit is contained in:
AJ Martinez 2025-10-11 07:32:23 +00:00
commit 58b158ffab
6 changed files with 35 additions and 8 deletions

View file

@ -843,6 +843,7 @@ struct player_t
UINT8 pickuprings; // Number of rings being picked up before added to the counter (prevents rings from being deleted forever over 20)
UINT8 ringdelay; // (0 to 3) - 3 tic delay between every ring usage
UINT16 ringboost; // Ring boost timer
UINT16 momentboost; // Sigh
UINT8 sparkleanim; // (0 to 19) - Angle offset for ring sparkle animation
UINT16 superring; // You were awarded rings, and have this many of them left to spawn on yourself.
UINT16 superringdisplay; // For HUD countup when awarded superring
@ -1129,7 +1130,7 @@ struct player_t
boolean dotrickfx;
boolean stingfx;
UINT8 bumperinflate;
boolean mfdfinish; // Did you cross the finish line while just about to explode?
UINT8 ringboxdelay; // Delay until Ring Box auto-activates

View file

@ -3910,9 +3910,12 @@ static void K_GetKartBoostPower(player_t *player)
fixed_t ringboost_base = FRACUNIT/4;
if (player->overdrive)
ringboost_base += FRACUNIT/4;
if (player->momentboost)
ringboost_base += FRACUNIT/4;
// This one's a little special: we add extra top speed per tic of ringboost stored up, to allow for Ring Box to really rocket away.
// (We compensate when decrementing ringboost to avoid runaway exponential scaling hell.)
fixed_t rb = FixedDiv(player->ringboost * FRACUNIT, max(FRACUNIT, K_RingDurationBoost(player)));
fixed_t rp = ((9 - player->kartspeed) + (9 - player->kartweight)) * ((3*FRACUNIT/20)/16);
ADDBOOST(
ringboost_base + FixedMul(FRACUNIT / 1750, rb) + rp,
@ -10561,6 +10564,16 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
// CONS_Printf("%d - %d\n", player->ringboost, oldringboost - player->ringboost);
}
if (player->momentboost)
{
player->momentboost--;
if (player->ringboost > 3)
player->ringboost -= 3;
}
if (player->ringboost == 0)
player->momentboost = 0;
if (!G_CompatLevel(0x0010) && player->superring == 0 && player->ringboxdelay == 0 && player->ringboost < player->lastringboost)
{
player->lastringboost = player->ringboost;
@ -10815,7 +10828,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if ((player->baildrop % BAIL_DROPFREQUENCY) == 0)
{
P_FlingBurst(player, K_MomentumAngle(pmo), MT_FLINGRING, 10*TICRATE, FRACUNIT, player->baildrop/BAIL_DROPFREQUENCY);
P_FlingBurst(player, K_MomentumAngle(pmo), MT_FLINGRING, 10*TICRATE, FRACUNIT, player->baildrop/BAIL_DROPFREQUENCY, FRACUNIT);
S_StartSound(pmo, sfx_gshad);
}
@ -15109,6 +15122,13 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
{
player->superring--;
dumprate = 2;
if (!G_CompatLevel(0x0011))
player->momentboost += 3;
// angle_t flingangle = player->mo->angle + ((P_RandomByte(PR_ITEM_RINGS) & 1) ? -ANGLE_90 : ANGLE_90);
// P_FlingBurst(player, flingangle, MT_DEBTSPIKE, 0, 3 * FRACUNIT / 2, player->superring, 4*FRACUNIT);
}
else
{

View file

@ -465,6 +465,8 @@ static int player_get(lua_State *L)
lua_pushinteger(L, plr->ringdelay);
else if (fastcmp(field,"ringboost"))
lua_pushinteger(L, plr->ringboost);
else if (fastcmp(field,"momentboost"))
lua_pushinteger(L, plr->momentboost);
else if (fastcmp(field,"sparkleanim"))
lua_pushinteger(L, plr->sparkleanim);
else if (fastcmp(field,"superring"))
@ -1049,7 +1051,7 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"fakeboost"))
plr->fakeBoost = luaL_checkinteger(L, 3);
else if (fastcmp(field,"subsonicleniency"))
plr->subsonicleniency = luaL_checkinteger(L, 3);
plr->subsonicleniency = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwireleniency"))
plr->tripwireLeniency = luaL_checkinteger(L, 3);
else if (fastcmp(field,"tripwireairleniency"))

View file

@ -4523,7 +4523,8 @@ void P_FlingBurst
mobjtype_t objType,
tic_t objFuse,
fixed_t objScale,
INT32 i)
INT32 i,
fixed_t dampen)
{
mobj_t *mo = P_SpawnMobjFromMobj(player->mo, 0, 0, 0, objType);
P_SetTarget(&mo->target, player->mo);
@ -4550,7 +4551,8 @@ void P_FlingBurst
angle_t fp = offset + (((i / 2) % RING_LAYER_SIDE_SIZE) * (offset * 3 >> 1));
const UINT8 layer = i / RING_LAYER_SIZE;
const fixed_t thrust = (13 * mo->scale) + (7 * mo->scale * layer);
fixed_t thrust = (13 * mo->scale) + (7 * mo->scale * layer);
thrust = FixedDiv(thrust, dampen);
mo->momx = (player->mo->momx / 2) + FixedMul(FixedMul(thrust, FINECOSINE(fp >> ANGLETOFINESHIFT)), FINECOSINE(fa >> ANGLETOFINESHIFT));
mo->momy = (player->mo->momy / 2) + FixedMul(FixedMul(thrust, FINECOSINE(fp >> ANGLETOFINESHIFT)), FINESINE(fa >> ANGLETOFINESHIFT));
mo->momz = (player->mo->momz / 2) + (FixedMul(thrust, FINESINE(fp >> ANGLETOFINESHIFT)) * P_MobjFlip(mo));
@ -4595,12 +4597,12 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
for (i = 0; i < num_fling_rings; i++)
{
P_FlingBurst(player, fa, MT_FLINGRING, 60*TICRATE, FRACUNIT, i);
P_FlingBurst(player, fa, MT_FLINGRING, 60*TICRATE, FRACUNIT, i, FRACUNIT);
}
while (i < spill_total)
{
P_FlingBurst(player, fa, MT_DEBTSPIKE, 0, 3 * FRACUNIT / 2, i++);
P_FlingBurst(player, fa, MT_DEBTSPIKE, 0, 3 * FRACUNIT / 2, i++, FRACUNIT);
}
K_DefensiveOverdrive(player);

View file

@ -555,7 +555,7 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source);
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype);
void P_UpdateRemovedOrbital(mobj_t *target, mobj_t *inflictor, mobj_t *source);
void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
void P_FlingBurst(player_t *player, angle_t fa, mobjtype_t objType, tic_t objFuse, fixed_t objScale, INT32 i);
void P_FlingBurst(player_t *player, angle_t fa, mobjtype_t objType, tic_t objFuse, fixed_t objScale, INT32 i, fixed_t dampen);
void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck);

View file

@ -549,6 +549,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT8(save->p, players[i].pickuprings);
WRITEUINT8(save->p, players[i].ringdelay);
WRITEUINT16(save->p, players[i].ringboost);
WRITEUINT16(save->p, players[i].momentboost);
WRITEUINT8(save->p, players[i].sparkleanim);
WRITEUINT16(save->p, players[i].superring);
WRITEUINT16(save->p, players[i].superringdisplay);
@ -1230,6 +1231,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].pickuprings = READUINT8(save->p);
players[i].ringdelay = READUINT8(save->p);
players[i].ringboost = READUINT16(save->p);
players[i].momentboost = READUINT16(save->p);
players[i].sparkleanim = READUINT8(save->p);
players[i].superring = READUINT16(save->p);
players[i].superringdisplay = READUINT16(save->p);