mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'bail-move-drain' into 'master'
Move bail ring drain to end of hitlag, bail stun reduction based on charge See merge request kart-krew-dev/ring-racers-internal!2711
This commit is contained in:
commit
efd7442c65
4 changed files with 97 additions and 94 deletions
|
|
@ -1092,7 +1092,7 @@ struct player_t
|
|||
|
||||
UINT32 bailcharge;
|
||||
UINT32 baildrop;
|
||||
boolean bailquake;
|
||||
boolean bailhitlag;
|
||||
|
||||
boolean analoginput; // Has an input been recorded that requires analog usage? For input display.
|
||||
|
||||
|
|
|
|||
177
src/k_kart.c
177
src/k_kart.c
|
|
@ -10095,10 +10095,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
if (player->baildrop)
|
||||
{
|
||||
if (player->stunned & 0x8000)
|
||||
player->stunned = 0x8000 | BAILSTUN;
|
||||
else
|
||||
player->stunned = BAILSTUN;
|
||||
// freeze the stunned timer while baildrop is active
|
||||
// while retaining the value that was initially set
|
||||
player->stunned++;
|
||||
|
||||
mobj_t *pmo = player->mo;
|
||||
// particle spawn
|
||||
|
|
@ -10132,10 +10131,92 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
player->ringboost /= 3;
|
||||
}
|
||||
|
||||
if (player->bailquake && !player->mo->hitlag) // quake as soon as we leave hitlag
|
||||
if (player->bailhitlag && !player->mo->hitlag) // do the ring reduction and set boost as soon as we leave hitlag
|
||||
{
|
||||
UINT32 debtrings = 20;
|
||||
if (player->rings < 0)
|
||||
{
|
||||
debtrings += player->rings;
|
||||
player->rings = 0;
|
||||
}
|
||||
|
||||
UINT32 totalrings = player->rings + player->superring + player->pickuprings;
|
||||
if (BAIL_CREDIT_DEBTRINGS)
|
||||
totalrings += debtrings;
|
||||
totalrings = max(totalrings, 0);
|
||||
UINT32 bailboost = FixedInt(FixedMul(totalrings*FRACUNIT, BAIL_BOOST));
|
||||
UINT32 baildrop = FixedInt(FixedMul((totalrings)*FRACUNIT, BAIL_DROP));
|
||||
|
||||
player->rings = -20;
|
||||
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;
|
||||
// CONS_Printf("bailcharge: %d\n", player->bailcharge);
|
||||
// Below: The stun the player gets from bailing is reduced as a pity if you did it out of Burst. Longer charge, shorter stun.
|
||||
player->stunned = BAILSTUN - player->bailcharge*5/4; // note: bailcharge goes up by 2 every tic, not 1, so this is actually - charge duration *2
|
||||
player->bailcharge = 0;
|
||||
|
||||
player->ringboost += bailboost * (3+K_GetKartRingPower(player, true));
|
||||
player->baildrop += baildrop * BAIL_DROPFREQUENCY + 1;
|
||||
|
||||
if (player->amps > 0)
|
||||
K_DefensiveOverdrive(player);
|
||||
|
||||
P_StartQuakeFromMobj(7, 50 * player->mo->scale, 2048 * player->mo->scale, player->mo);
|
||||
player->bailquake = false;
|
||||
player->bailhitlag = false;
|
||||
}
|
||||
|
||||
if ((!P_PlayerInPain(player) && player->bailcharge >= 5) || player->bailcharge >= BAIL_MAXCHARGE)
|
||||
{
|
||||
mobj_t *bail = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_BAIL);
|
||||
P_SetTarget(&bail->target, player->mo);
|
||||
|
||||
if (player->itemRoulette.active)
|
||||
{
|
||||
player->itemRoulette.active = false;
|
||||
}
|
||||
|
||||
K_PopPlayerShield(player);
|
||||
K_DeleteHnextList(player);
|
||||
K_DropItems(player);
|
||||
|
||||
player->itemamount = 0;
|
||||
player->itemtype = 0;
|
||||
|
||||
/*
|
||||
if (player->itemamount)
|
||||
{
|
||||
K_DropPaperItem(player, player->itemtype, player->itemamount);
|
||||
player->itemtype = player->itemamount = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
K_AddHitLag(player->mo, TICRATE/4, false);
|
||||
player->bailhitlag = true; // set for a one time quake effect as soon as hitlag ends
|
||||
|
||||
if (P_PlayerInPain(player))
|
||||
{
|
||||
player->spinouttimer = 0;
|
||||
player->spinouttype = 0;
|
||||
player->tumbleBounces = 0;
|
||||
player->pflags &= ~PF_TUMBLELASTBOUNCE;
|
||||
player->mo->rollangle = 0;
|
||||
P_ResetPitchRoll(player->mo);
|
||||
}
|
||||
|
||||
INT32 fls = K_GetEffectiveFollowerSkin(player);
|
||||
if (player->follower && fls >= 0 && fls < numfollowers)
|
||||
{
|
||||
const follower_t *fl = &followers[fls];
|
||||
S_StartSound(NULL, fl->hornsound);
|
||||
}
|
||||
|
||||
S_StartSound(player->mo, sfx_kc33);
|
||||
}
|
||||
|
||||
// The precise ordering of start-of-level made me want to cut my head off,
|
||||
|
|
@ -14124,11 +14205,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
else if ((player->itemtype && player->itemamount) || player->rings > 0 || player->superring > 0 || player->pickuprings > 0 || player->itemRoulette.active)
|
||||
{
|
||||
// Set up bail charge, provided we have something to bail with (any rings or item resource).
|
||||
boolean grounded = P_IsObjectOnGround(player->mo);
|
||||
// boolean grounded = P_IsObjectOnGround(player->mo);
|
||||
// onground && player->tumbleBounces == 0 ? player->bailcharge += 2 : player->bailcharge++; // charge twice as fast on the ground
|
||||
player->bailcharge += 2;
|
||||
// if ((P_PlayerInPain(player) && player->bailcharge == 1) || (grounded && P_PlayerInPain(player) && player->bailcharge == 2)) // this is brittle ..
|
||||
if (player->bailcharge == 2)
|
||||
if (P_PlayerInPain(player) && player->bailcharge == 2)
|
||||
{
|
||||
mobj_t *bail = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_BAILCHARGE);
|
||||
S_StartSound(bail, sfx_gshb9); // I tried to use info.c, but you can't play sounds on mobjspawn via A_PlaySound
|
||||
|
|
@ -14142,87 +14223,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->bailcharge = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!P_PlayerInPain(player) && player->bailcharge >= 5) || player->bailcharge >= BAIL_MAXCHARGE)
|
||||
else
|
||||
{
|
||||
player->bailcharge = 0;
|
||||
|
||||
mobj_t *bail = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_BAIL);
|
||||
P_SetTarget(&bail->target, player->mo);
|
||||
|
||||
UINT32 debtrings = 20;
|
||||
if (player->rings < 0)
|
||||
{
|
||||
debtrings += player->rings;
|
||||
player->rings = 0;
|
||||
}
|
||||
|
||||
UINT32 totalrings = player->rings + player->superring + player->pickuprings;
|
||||
if (BAIL_CREDIT_DEBTRINGS)
|
||||
totalrings += debtrings;
|
||||
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);
|
||||
K_DeleteHnextList(player);
|
||||
K_DropItems(player);
|
||||
|
||||
player->itemamount = 0;
|
||||
player->itemtype = 0;
|
||||
|
||||
/*
|
||||
if (player->itemamount)
|
||||
{
|
||||
K_DropPaperItem(player, player->itemtype, player->itemamount);
|
||||
player->itemtype = player->itemamount = 0;
|
||||
}
|
||||
*/
|
||||
|
||||
player->rings = -20;
|
||||
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);
|
||||
player->bailquake = true; // set for a one time quake effect as soon as hitlag ends
|
||||
|
||||
if (P_PlayerInPain(player))
|
||||
{
|
||||
player->spinouttimer = 0;
|
||||
player->spinouttype = 0;
|
||||
player->tumbleBounces = 0;
|
||||
player->pflags &= ~PF_TUMBLELASTBOUNCE;
|
||||
player->mo->rollangle = 0;
|
||||
P_ResetPitchRoll(player->mo);
|
||||
}
|
||||
|
||||
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_kc33);
|
||||
}
|
||||
|
||||
if (player && player->mo && K_PlayerCanUseItem(player))
|
||||
|
|
|
|||
|
|
@ -286,8 +286,8 @@ static int player_get(lua_State *L)
|
|||
lua_pushinteger(L, plr->bailcharge);
|
||||
else if (fastcmp(field,"baildrop"))
|
||||
lua_pushinteger(L, plr->baildrop);
|
||||
else if (fastcmp(field,"bailquake"))
|
||||
lua_pushboolean(L, plr->bailquake);
|
||||
else if (fastcmp(field,"bailhitlag"))
|
||||
lua_pushboolean(L, plr->bailhitlag);
|
||||
else if (fastcmp(field,"dotrickfx"))
|
||||
lua_pushboolean(L, plr->dotrickfx);
|
||||
else if (fastcmp(field,"stingfx"))
|
||||
|
|
@ -927,8 +927,8 @@ static int player_set(lua_State *L)
|
|||
plr->bailcharge = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"baildrop"))
|
||||
plr->baildrop = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"bailquake"))
|
||||
plr->bailquake = luaL_checkboolean(L, 3);
|
||||
else if (fastcmp(field,"bailhitlag"))
|
||||
plr->bailhitlag = luaL_checkboolean(L, 3);
|
||||
else if (fastcmp(field,"analoginput"))
|
||||
plr->analoginput = luaL_checkboolean(L, 3);
|
||||
else if (fastcmp(field,"transfer"))
|
||||
|
|
|
|||
|
|
@ -683,7 +683,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
|
||||
WRITEUINT32(save->p, players[i].bailcharge);
|
||||
WRITEUINT32(save->p, players[i].baildrop);
|
||||
WRITEUINT8(save->p, players[i].bailquake);
|
||||
WRITEUINT8(save->p, players[i].bailhitlag);
|
||||
|
||||
WRITEUINT8(save->p, players[i].analoginput);
|
||||
|
||||
|
|
@ -1348,7 +1348,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
|||
|
||||
players[i].bailcharge = READUINT32(save->p);
|
||||
players[i].baildrop = READUINT32(save->p);
|
||||
players[i].bailquake = READUINT8(save->p);
|
||||
players[i].bailhitlag = READUINT8(save->p);
|
||||
|
||||
players[i].analoginput = READUINT8(save->p);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue