mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'fix-stacked-hitlag' into 'misc-battle-fixes-chapter-69'
Let wombo combo work again; fix Bubble-Invincibility deadlock; fix Mine spinout hitbox lifetime See merge request KartKrew/Kart!1033
This commit is contained in:
commit
bee420ff8d
11 changed files with 124 additions and 75 deletions
|
|
@ -490,7 +490,7 @@ struct player_t
|
|||
UINT16 spinouttimer; // Spin-out from a banana peel or oil slick (was "pw_bananacam")
|
||||
UINT8 spinouttype; // Determines the mode of spinout/wipeout, see kartspinoutflags_t
|
||||
UINT8 instashield; // Instashield no-damage animation timer
|
||||
INT32 invulnhitlag; // Numbers of tics of hitlag added this tic for "potential" damage -- not real damage
|
||||
INT32 nullHitlag; // Numbers of tics of hitlag that will ultimately be ignored by subtracting from hitlag
|
||||
UINT8 wipeoutslow; // Timer before you slowdown when getting wiped out
|
||||
UINT8 justbumped; // Prevent players from endlessly bumping into each other
|
||||
UINT8 tumbleBounces;
|
||||
|
|
@ -641,8 +641,10 @@ struct player_t
|
|||
|
||||
INT16 lastsidehit, lastlinehit;
|
||||
|
||||
// These track how many things tried to damage you, not
|
||||
// whether you actually took damage.
|
||||
// TimesHit tracks how many times something tried to
|
||||
// damage you or how many times you tried to damage
|
||||
// something else. It does not track whether damage was
|
||||
// actually dealt.
|
||||
UINT8 timeshit; // times hit this tic
|
||||
UINT8 timeshitprev; // times hit before
|
||||
// That's TIMES HIT, not TIME SHIT, you doofus! -- in memoriam
|
||||
|
|
|
|||
|
|
@ -5730,7 +5730,7 @@ const char *const MOBJFLAG2_LIST[] = {
|
|||
"JUSTATTACKED", // can be pushed by other moving mobjs
|
||||
"FIRING", // turret fire
|
||||
"SUPERFIRE", // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it.
|
||||
"\x01", // free: 1<<20 (name un-matchable)
|
||||
"ALREADYHIT", // This object was already damaged THIS tic, resets even during hitlag
|
||||
"STRONGBOX", // Flag used for "strong" random monitors.
|
||||
"OBJECTFLIP", // Flag for objects that always have flipped gravity.
|
||||
"SKULLFLY", // Special handling: skull in flight.
|
||||
|
|
|
|||
|
|
@ -23907,7 +23907,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
16, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID|MF_NOCLIP|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags
|
||||
MF_SOLID|MF_NOCLIP|MF_NOCLIPTHING|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -43,9 +43,6 @@ boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2)
|
|||
{
|
||||
boolean damageitem = false;
|
||||
|
||||
if ((t1->threshold > 0 && t2->hitlag > 0) || (t2->threshold > 0 && t1->hitlag > 0))
|
||||
return true;
|
||||
|
||||
if (((t1->target == t2) || (!(t2->flags & (MF_ENEMY|MF_BOSS)) && (t1->target == t2->target))) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0)))
|
||||
return true;
|
||||
|
||||
|
|
@ -133,9 +130,6 @@ boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2)
|
|||
|
||||
boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2)
|
||||
{
|
||||
if ((t1->threshold > 0 && t2->hitlag > 0) || (t2->threshold > 0 && t1->hitlag > 0))
|
||||
return true;
|
||||
|
||||
// Push fakes out of other item boxes
|
||||
if (t2->type == MT_RANDOMITEM || t2->type == MT_EGGMANITEM)
|
||||
{
|
||||
|
|
@ -313,6 +307,10 @@ tic_t K_MineExplodeAttack(mobj_t *actor, fixed_t size, boolean spin)
|
|||
// Set this flag to ensure that the inital action won't be triggered twice.
|
||||
actor->flags2 |= MF2_DEBRIS;
|
||||
|
||||
// Set this flag to ensure the hitbox timer doesn't get extended with every player hit
|
||||
actor->flags |= MF_NOHITLAGFORME;
|
||||
actor->hitlag = 0; // same deal
|
||||
|
||||
if (!spin)
|
||||
{
|
||||
if (minehitlag == 0)
|
||||
|
|
@ -330,9 +328,6 @@ tic_t K_MineExplodeAttack(mobj_t *actor, fixed_t size, boolean spin)
|
|||
|
||||
boolean K_MineCollide(mobj_t *t1, mobj_t *t2)
|
||||
{
|
||||
if ((t1->threshold > 0 && t2->hitlag > 0) || (t2->threshold > 0 && t1->hitlag > 0))
|
||||
return true;
|
||||
|
||||
if (((t1->target == t2) || (!(t2->flags & (MF_ENEMY|MF_BOSS)) && (t1->target == t2->target))) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0)))
|
||||
return true;
|
||||
|
||||
|
|
@ -384,9 +379,6 @@ boolean K_MineCollide(mobj_t *t1, mobj_t *t2)
|
|||
|
||||
boolean K_LandMineCollide(mobj_t *t1, mobj_t *t2)
|
||||
{
|
||||
if ((t1->threshold > 0 && t2->hitlag > 0) || (t2->threshold > 0 && t1->hitlag > 0))
|
||||
return true;
|
||||
|
||||
if (((t1->target == t2) || (!(t2->flags & (MF_ENEMY|MF_BOSS)) && (t1->target == t2->target))) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0)))
|
||||
return true;
|
||||
|
||||
|
|
@ -465,9 +457,6 @@ boolean K_DropTargetCollide(mobj_t *t1, mobj_t *t2)
|
|||
{
|
||||
mobj_t *draggeddroptarget = (t1->type == MT_DROPTARGET_SHIELD) ? t1->target : NULL;
|
||||
|
||||
if ((t1->threshold > 0 && t2->hitlag > 0) || (t2->threshold > 0 && t1->hitlag > 0))
|
||||
return true;
|
||||
|
||||
if (((t1->target == t2) || (t1->target == t2->target)) && ((t1->threshold > 0 && t2->type == MT_PLAYER) || (t2->type != MT_PLAYER && t2->threshold > 0)))
|
||||
return true;
|
||||
|
||||
|
|
@ -678,6 +667,17 @@ void K_LightningShieldAttack(mobj_t *actor, fixed_t size)
|
|||
|
||||
boolean K_BubbleShieldCollide(mobj_t *t1, mobj_t *t2)
|
||||
{
|
||||
if (t1->type == MT_PLAYER)
|
||||
{
|
||||
// Bubble Shield already has a hitbox, and it gets
|
||||
// teleported every tic so the Bubble itself will
|
||||
// always make contact with other objects.
|
||||
//
|
||||
// Therefore, we don't need a second, smaller hitbox
|
||||
// on the player. It'll just cause unwanted hitlag.
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t2->type == MT_PLAYER)
|
||||
{
|
||||
// Counter desyncs
|
||||
|
|
@ -697,8 +697,13 @@ boolean K_BubbleShieldCollide(mobj_t *t1, mobj_t *t2)
|
|||
}
|
||||
|
||||
// Player Damage
|
||||
P_DamageMobj(t2, ((t1->type == MT_BUBBLESHIELD) ? t1->target : t1), t1, 1, DMG_NORMAL|DMG_WOMBO);
|
||||
S_StartSound(t1, sfx_s3k44);
|
||||
P_DamageMobj(t2, t1->target, t1, 1, DMG_NORMAL|DMG_WOMBO);
|
||||
|
||||
if (t2->player->timeshit > t2->player->timeshitprev)
|
||||
{
|
||||
// Don't play from t1 else it gets cut out... for some reason.
|
||||
S_StartSound(t2, sfx_s3k44);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -728,9 +733,6 @@ boolean K_BubbleShieldCollide(mobj_t *t1, mobj_t *t2)
|
|||
|
||||
boolean K_KitchenSinkCollide(mobj_t *t1, mobj_t *t2)
|
||||
{
|
||||
if ((t1->threshold > 0 && t2->hitlag > 0) || (t2->threshold > 0 && t1->hitlag > 0))
|
||||
return true;
|
||||
|
||||
if (((t1->target == t2) || (!(t2->flags & (MF_ENEMY|MF_BOSS)) && (t1->target == t2->target))) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0)))
|
||||
return true;
|
||||
|
||||
|
|
|
|||
22
src/k_kart.c
22
src/k_kart.c
|
|
@ -8290,30 +8290,14 @@ void K_KartPlayerAfterThink(player_t *player)
|
|||
K_LookForRings(player->mo);
|
||||
}
|
||||
|
||||
if (player->invulnhitlag > 0)
|
||||
{
|
||||
// Hitlag from what would normally be damage but the
|
||||
// player was invulnerable.
|
||||
//
|
||||
// If we're constantly getting hit the same number of
|
||||
// times, we're probably standing on a damage floor.
|
||||
//
|
||||
// Checking if we're hit more than before ensures
|
||||
// that:
|
||||
//
|
||||
// 1) repeating damage doesn't count
|
||||
// 2) new damage sources still count
|
||||
|
||||
if (player->timeshit <= player->timeshitprev)
|
||||
if (player->nullHitlag > 0)
|
||||
{
|
||||
if (!P_MobjWasRemoved(player->mo))
|
||||
{
|
||||
player->mo->hitlag -= player->invulnhitlag;
|
||||
player->mo->eflags &= ~(MFE_DAMAGEHITLAG);
|
||||
}
|
||||
player->mo->hitlag -= player->nullHitlag;
|
||||
}
|
||||
|
||||
player->invulnhitlag = 0;
|
||||
player->nullHitlag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,8 +232,8 @@ static int player_get(lua_State *L)
|
|||
lua_pushinteger(L, plr->spinouttimer);
|
||||
else if (fastcmp(field,"instashield"))
|
||||
lua_pushinteger(L, plr->instashield);
|
||||
else if (fastcmp(field,"invulnhitlag"))
|
||||
lua_pushinteger(L, plr->invulnhitlag);
|
||||
else if (fastcmp(field,"nullHitlag"))
|
||||
lua_pushinteger(L, plr->nullHitlag);
|
||||
else if (fastcmp(field,"wipeoutslow"))
|
||||
lua_pushinteger(L, plr->wipeoutslow);
|
||||
else if (fastcmp(field,"justbumped"))
|
||||
|
|
@ -614,8 +614,8 @@ static int player_set(lua_State *L)
|
|||
plr->spinouttimer = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"instashield"))
|
||||
plr->instashield = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"invulnhitlag"))
|
||||
plr->invulnhitlag = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"nullHitlag"))
|
||||
plr->nullHitlag = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"wipeoutslow"))
|
||||
plr->wipeoutslow = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"justbumped"))
|
||||
|
|
|
|||
|
|
@ -167,12 +167,6 @@ boolean Obj_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2)
|
|||
boolean tumbleitem = false;
|
||||
boolean sprung = false;
|
||||
|
||||
if ((orbinaut_selfdelay(t1) > 0 && t2->hitlag > 0)
|
||||
|| (orbinaut_selfdelay(t2) > 0 && t1->hitlag > 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t1->health <= 0 || t2->health <= 0)
|
||||
{
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -2003,6 +2003,43 @@ static boolean P_KillPlayer(player_t *player, mobj_t *inflictor, mobj_t *source,
|
|||
return true;
|
||||
}
|
||||
|
||||
static void AddTimesHit(player_t *player)
|
||||
{
|
||||
const INT32 oldtimeshit = player->timeshit;
|
||||
|
||||
player->timeshit++;
|
||||
|
||||
// overflow prevention
|
||||
if (player->timeshit < oldtimeshit)
|
||||
{
|
||||
player->timeshit = oldtimeshit;
|
||||
}
|
||||
}
|
||||
|
||||
static void AddNullHitlag(player_t *player, tic_t oldHitlag)
|
||||
{
|
||||
if (player == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Hitlag from what would normally be damage but the
|
||||
// player was invulnerable.
|
||||
//
|
||||
// If we're constantly getting hit the same number of
|
||||
// times, we're probably standing on a damage floor.
|
||||
//
|
||||
// Checking if we're hit more than before ensures that:
|
||||
//
|
||||
// 1) repeating damage doesn't count
|
||||
// 2) new damage sources still count
|
||||
|
||||
if (player->timeshit <= player->timeshitprev)
|
||||
{
|
||||
player->nullHitlag += (player->mo->hitlag - oldHitlag);
|
||||
}
|
||||
}
|
||||
|
||||
/** Damages an object, which may or may not be a player.
|
||||
* For melee attacks, source and inflictor are the same.
|
||||
*
|
||||
|
|
@ -2023,6 +2060,7 @@ static boolean P_KillPlayer(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)
|
||||
{
|
||||
player_t *player;
|
||||
player_t *playerInflictor;
|
||||
boolean force = false;
|
||||
|
||||
INT32 laglength = 6;
|
||||
|
|
@ -2080,9 +2118,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
if (!(target->flags & MF_SHOOTABLE))
|
||||
return false; // shouldn't happen...
|
||||
}
|
||||
|
||||
if (!(damagetype & DMG_DEATHMASK) && (target->eflags & MFE_PAUSED))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->flags2 & MF2_SKULLFLY)
|
||||
|
|
@ -2101,20 +2136,16 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
}
|
||||
|
||||
player = target->player;
|
||||
playerInflictor = inflictor ? inflictor->player : NULL;
|
||||
|
||||
if (playerInflictor)
|
||||
{
|
||||
AddTimesHit(playerInflictor);
|
||||
}
|
||||
|
||||
if (player) // Player is the target
|
||||
{
|
||||
{
|
||||
const INT32 oldtimeshit = player->timeshit;
|
||||
|
||||
player->timeshit++;
|
||||
|
||||
// overflow prevention
|
||||
if (player->timeshit < oldtimeshit)
|
||||
{
|
||||
player->timeshit = oldtimeshit;
|
||||
}
|
||||
}
|
||||
AddTimesHit(player);
|
||||
|
||||
if (player->pflags & PF_GODMODE)
|
||||
return false;
|
||||
|
|
@ -2179,12 +2210,32 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
|
||||
if (invincible && type != DMG_STUMBLE)
|
||||
{
|
||||
const INT32 oldhitlag = target->hitlag;
|
||||
const INT32 oldHitlag = target->hitlag;
|
||||
const INT32 oldHitlagInflictor = inflictor ? inflictor->hitlag : 0;
|
||||
|
||||
// Damage during hitlag should be a no-op
|
||||
// for invincibility states because there
|
||||
// are no flashing tics. If the damage is
|
||||
// from a constant source, a deadlock
|
||||
// would occur.
|
||||
|
||||
if (target->eflags & MFE_PAUSED)
|
||||
{
|
||||
player->timeshit--; // doesn't count
|
||||
|
||||
if (playerInflictor)
|
||||
{
|
||||
playerInflictor->timeshit--;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
laglength = max(laglength / 2, 1);
|
||||
K_SetHitLagForObjects(target, inflictor, laglength, false);
|
||||
|
||||
player->invulnhitlag += (target->hitlag - oldhitlag);
|
||||
AddNullHitlag(player, oldHitlag);
|
||||
AddNullHitlag(playerInflictor, oldHitlagInflictor);
|
||||
|
||||
if (player->timeshit > player->timeshitprev)
|
||||
{
|
||||
|
|
@ -2214,6 +2265,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
allowcombo = false;
|
||||
}
|
||||
|
||||
if (allowcombo == false && (target->eflags & MFE_PAUSED))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// DMG_EXPLODE excluded from flashtic checks to prevent dodging eggbox/SPB with weak spinout
|
||||
if ((target->hitlag == 0 || allowcombo == false) && player->flashing > 0 && type != DMG_EXPLODE && type != DMG_STUMBLE)
|
||||
{
|
||||
|
|
@ -2221,6 +2277,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
K_DoInstashield(player);
|
||||
return false;
|
||||
}
|
||||
else if (target->flags2 & MF2_ALREADYHIT) // do not deal extra damage in the same tic
|
||||
{
|
||||
K_SetHitLagForObjects(target, inflictor, laglength, true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2401,6 +2462,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
|
||||
K_SetHitLagForObjects(target, inflictor, laglength, true);
|
||||
|
||||
target->flags2 |= MF2_ALREADYHIT;
|
||||
|
||||
if (target->health <= 0)
|
||||
{
|
||||
P_KillMobj(target, inflictor, source, damagetype);
|
||||
|
|
|
|||
|
|
@ -8246,7 +8246,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||
desty = mobj->target->y;
|
||||
}
|
||||
|
||||
mobj->flags &= ~(MF_NOCLIPTHING);
|
||||
P_MoveOrigin(mobj, destx, desty, mobj->target->z);
|
||||
mobj->flags |= MF_NOCLIPTHING;
|
||||
break;
|
||||
}
|
||||
case MT_FLAMESHIELD:
|
||||
|
|
@ -9842,8 +9844,10 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
if ((mobj->flags & MF_BOSS) && mobj->spawnpoint && (bossdisabled & (1<<mobj->spawnpoint->args[0])))
|
||||
return;
|
||||
|
||||
mobj->flags2 &= ~(MF2_ALREADYHIT);
|
||||
|
||||
// Don't run any thinker code while in hitlag
|
||||
if (mobj->hitlag > 0)
|
||||
if ((mobj->player ? mobj->hitlag - mobj->player->nullHitlag : mobj->hitlag) > 0)
|
||||
{
|
||||
mobj->eflags |= MFE_PAUSED;
|
||||
mobj->hitlag--;
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ typedef enum
|
|||
MF2_JUSTATTACKED = 1<<16, // can be pushed by other moving mobjs
|
||||
MF2_FIRING = 1<<17, // turret fire
|
||||
MF2_SUPERFIRE = 1<<18, // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it.
|
||||
// free: 1<<19
|
||||
MF2_ALREADYHIT = 1<<19, // This object was already damaged THIS tic, resets even during hitlag
|
||||
MF2_STRONGBOX = 1<<20, // Flag used for "strong" random monitors.
|
||||
MF2_OBJECTFLIP = 1<<21, // Flag for objects that always have flipped gravity.
|
||||
MF2_SKULLFLY = 1<<22, // Special handling: skull in flight.
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
WRITEUINT16(save->p, players[i].spinouttimer);
|
||||
WRITEUINT8(save->p, players[i].spinouttype);
|
||||
WRITEUINT8(save->p, players[i].instashield);
|
||||
WRITEINT32(save->p, players[i].invulnhitlag);
|
||||
WRITEINT32(save->p, players[i].nullHitlag);
|
||||
WRITEUINT8(save->p, players[i].wipeoutslow);
|
||||
WRITEUINT8(save->p, players[i].justbumped);
|
||||
WRITEUINT8(save->p, players[i].tumbleBounces);
|
||||
|
|
@ -651,7 +651,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
|||
players[i].spinouttimer = READUINT16(save->p);
|
||||
players[i].spinouttype = READUINT8(save->p);
|
||||
players[i].instashield = READUINT8(save->p);
|
||||
players[i].invulnhitlag = READINT32(save->p);
|
||||
players[i].nullHitlag = READINT32(save->p);
|
||||
players[i].wipeoutslow = READUINT8(save->p);
|
||||
players[i].justbumped = READUINT8(save->p);
|
||||
players[i].tumbleBounces = READUINT8(save->p);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue