WIP: Bail

This commit is contained in:
AJ Martinez 2025-05-02 12:02:56 -04:00 committed by Ashnal
parent 6177ca0dcc
commit aa44b140e2
9 changed files with 85 additions and 3 deletions

View file

@ -1081,6 +1081,8 @@ struct player_t
UINT16 progressivethrust; // When getting beat up in GTR_BUMPERS, speed up the longer you've been out of control. UINT16 progressivethrust; // When getting beat up in GTR_BUMPERS, speed up the longer you've been out of control.
UINT8 ringvisualwarning; // Check with > 1, not >= 1! Set when put in debt, counts down and holds at 1 when still in debt. UINT8 ringvisualwarning; // Check with > 1, not >= 1! Set when put in debt, counts down and holds at 1 when still in debt.
UINT32 baildrop;
boolean analoginput; // Has an input been recorded that requires analog usage? For input display. boolean analoginput; // Has an input been recorded that requires analog usage? For input display.
boolean markedfordeath; boolean markedfordeath;

View file

@ -34,6 +34,9 @@ void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage)
return; return;
} }
if (mo->player && mo->player->overshield)
tics = min(tics, 3);
mo->hitlag += tics; mo->hitlag += tics;
mo->hitlag = min(mo->hitlag, MAXHITLAGTICS); mo->hitlag = min(mo->hitlag, MAXHITLAGTICS);

View file

@ -9998,6 +9998,16 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->cangrabitems && player->cangrabitems <= EARLY_ITEM_FLICKER) if (player->cangrabitems && player->cangrabitems <= EARLY_ITEM_FLICKER)
player->cangrabitems++; player->cangrabitems++;
if (player->baildrop)
{
if ((player->baildrop % BAIL_DROPFREQUENCY) == 0)
{
P_FlingBurst(player, K_MomentumAngle(player->mo), MT_FLINGRING, 60*TICRATE, FRACUNIT, player->baildrop/BAIL_DROPFREQUENCY);
S_StartSound(player->mo, sfx_gshad);
}
player->baildrop--;
}
if (!player->invincibilitytimer) if (!player->invincibilitytimer)
player->invincibilityextensions = 0; player->invincibilityextensions = 0;
@ -10147,7 +10157,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->nextringaward >= ringrate) if (player->nextringaward >= ringrate)
{ {
if (player->instaWhipCharge) if (player->instaWhipCharge || player->baildrop)
{ {
// Store award rings to do diabolical horseshit with later. // Store award rings to do diabolical horseshit with later.
player->nextringaward = ringrate; player->nextringaward = ringrate;
@ -13887,6 +13897,60 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
} }
if ((player->cmd.buttons & BT_VOTE) && !(player->oldcmd.buttons & BT_VOTE)
&& ((player->itemtype && player->itemamount) || (player->rings > 0) || player->superring > 0 || player->pickuprings > 0 || player->itemRoulette.active))
{
UINT32 totalrings = player->rings + player->superring + player->pickuprings;
totalrings = max(totalrings, 0);
UINT32 bailboost = FixedInt(FixedMul(totalrings*FRACUNIT, BAIL_BOOST));
UINT32 baildrop = FixedInt(FixedMul(totalrings*FRACUNIT, BAIL_DROP));
if (player->itemRoulette.active)
{
player->itemRoulette.active = false;
}
K_PopPlayerShield(player);
if (player->itemamount)
{
K_DropPaperItem(player, player->itemtype, player->itemamount);
player->itemtype = player->itemamount = 0;
}
player->rings = min(player->rings, 0);
player->superring = 0;
player->pickuprings = 0;
player->ringboxaward = 0;
player->ringboxdelay = 0;
player->superringdisplay = 0;
player->superringalert = 0;
player->superringpeak = 0;
player->counterdash += TICRATE/8;
player->ringboost += bailboost * (3+K_GetKartRingPower(player, true));
player->baildrop = baildrop * BAIL_DROPFREQUENCY + 1;
K_AddHitLag(player->mo, TICRATE/4, false);
mobj_t *broly = Obj_SpawnBrolyKi(player->mo, player->mo->hitlag);
broly->extravalue2 = 16*mapobjectscale;
INT32 fls = K_GetEffectiveFollowerSkin(player);
if (player->follower && fls >= 0 && fls < numfollowers)
{
const follower_t *fl = &followers[fls];
S_StartSound(NULL, fl->hornsound);
}
if (player->amps > 0)
K_DefensiveOverdrive(player);
S_StartSound(player->mo, sfx_gshdd);
}
if (player && player->mo && K_PlayerCanUseItem(player)) if (player && player->mo && K_PlayerCanUseItem(player))
{ {
// First, the really specific, finicky items that function without the item being directly in your item slot. // First, the really specific, finicky items that function without the item being directly in your item slot.

View file

@ -44,6 +44,10 @@ Make sure this matches the actual number of states
#define INSTAWHIP_TETHERBLOCK (TICRATE*4) #define INSTAWHIP_TETHERBLOCK (TICRATE*4)
#define PUNISHWINDOW (7*TICRATE/10) #define PUNISHWINDOW (7*TICRATE/10)
#define BAIL_DROP (FRACUNIT/2)
#define BAIL_BOOST (FRACUNIT/4)
#define BAIL_DROPFREQUENCY (3)
#define MAXCOMBOTHRUST (mapobjectscale*20) #define MAXCOMBOTHRUST (mapobjectscale*20)
#define MAXCOMBOFLOAT (mapobjectscale*10) #define MAXCOMBOFLOAT (mapobjectscale*10)
#define MINCOMBOTHRUST (mapobjectscale*2) #define MINCOMBOTHRUST (mapobjectscale*2)

View file

@ -284,6 +284,8 @@ static int player_get(lua_State *L)
lua_pushboolean(L, plr->progressivethrust); lua_pushboolean(L, plr->progressivethrust);
else if (fastcmp(field,"ringvisualwarning")) else if (fastcmp(field,"ringvisualwarning"))
lua_pushboolean(L, plr->ringvisualwarning); lua_pushboolean(L, plr->ringvisualwarning);
else if (fastcmp(field,"baildrop"))
lua_pushboolean(L, plr->baildrop);
else if (fastcmp(field,"dotrickfx")) else if (fastcmp(field,"dotrickfx"))
lua_pushboolean(L, plr->dotrickfx); lua_pushboolean(L, plr->dotrickfx);
else if (fastcmp(field,"stingfx")) else if (fastcmp(field,"stingfx"))
@ -910,6 +912,8 @@ static int player_set(lua_State *L)
plr->progressivethrust = luaL_checkboolean(L, 3); plr->progressivethrust = luaL_checkboolean(L, 3);
else if (fastcmp(field,"ringvisualwarning")) else if (fastcmp(field,"ringvisualwarning"))
plr->ringvisualwarning = luaL_checkboolean(L, 3); plr->ringvisualwarning = luaL_checkboolean(L, 3);
else if (fastcmp(field,"baildrop"))
plr->baildrop = luaL_checkinteger(L, 3);
else if (fastcmp(field,"analoginput")) else if (fastcmp(field,"analoginput"))
plr->analoginput = luaL_checkboolean(L, 3); plr->analoginput = luaL_checkboolean(L, 3);
else if (fastcmp(field,"transfer")) else if (fastcmp(field,"transfer"))

View file

@ -3503,7 +3503,7 @@ void A_AttractChase(mobj_t *actor)
if (actor->extravalue1 && actor->type != MT_EMERALD) // SRB2Kart if (actor->extravalue1 && actor->type != MT_EMERALD) // SRB2Kart
{ {
if (!actor->target || P_MobjWasRemoved(actor->target) || !actor->target->player) if (!actor->target || P_MobjWasRemoved(actor->target) || !actor->target->player || actor->target->player->baildrop)
{ {
P_RemoveMobj(actor); P_RemoveMobj(actor);
return; return;

View file

@ -3612,7 +3612,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
#define RING_LAYER_SIDE_SIZE (3) #define RING_LAYER_SIDE_SIZE (3)
#define RING_LAYER_SIZE (RING_LAYER_SIDE_SIZE * 2) #define RING_LAYER_SIZE (RING_LAYER_SIDE_SIZE * 2)
static void P_FlingBurst void P_FlingBurst
( player_t *player, ( player_t *player,
angle_t fa, angle_t fa,
mobjtype_t objType, mobjtype_t objType,

View file

@ -549,6 +549,7 @@ void P_RampConstant(const BasicFF_t *FFInfo, INT32 Start, INT32 End);
void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source); 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); boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype);
void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype); 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_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c 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); void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck);

View file

@ -667,6 +667,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
WRITEUINT16(save->p, players[i].progressivethrust); WRITEUINT16(save->p, players[i].progressivethrust);
WRITEUINT8(save->p, players[i].ringvisualwarning); WRITEUINT8(save->p, players[i].ringvisualwarning);
WRITEUINT32(save->p, players[i].baildrop);
WRITEUINT8(save->p, players[i].analoginput); WRITEUINT8(save->p, players[i].analoginput);
WRITEUINT8(save->p, players[i].markedfordeath); WRITEUINT8(save->p, players[i].markedfordeath);
@ -1322,6 +1324,8 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
players[i].progressivethrust = READUINT16(save->p); players[i].progressivethrust = READUINT16(save->p);
players[i].ringvisualwarning = READUINT8(save->p); players[i].ringvisualwarning = READUINT8(save->p);
players[i].baildrop = READUINT32(save->p);
players[i].analoginput = READUINT8(save->p); players[i].analoginput = READUINT8(save->p);
players[i].markedfordeath = READUINT8(save->p); players[i].markedfordeath = READUINT8(save->p);