Remove hitlag.

This commit is contained in:
NepDisk 2024-07-29 03:24:40 -04:00
parent ec7cfc56fb
commit 8f3b2db7d3
25 changed files with 29 additions and 482 deletions

View file

@ -5611,7 +5611,6 @@ const char *const MOBJFLAG_LIST[] = {
"DONTENCOREMAP",
"PICKUPFROMBELOW",
"NOSQUISH",
"NOHITLAGFORME",
NULL
};
@ -5664,7 +5663,6 @@ const char *const MOBJEFLAG_LIST[] = {
"APPLYPMOMZ", // Platform movement
"TRACERANGLE", // Compute and trigger on mobj angle relative to tracer
"JUSTBOUNCEDWALL",
"DAMAGEHITLAG",
"SLOPELAUNCHED",
NULL
};
@ -6674,7 +6672,6 @@ struct int_const_s const INT_CONST[] = {
{"TC_RAINBOW",TC_RAINBOW},
{"TC_BLINK",TC_BLINK},
{"TC_DASHMODE",TC_DASHMODE},
{"TC_HITLAG",TC_HITLAG},
// marathonmode flags
{"MA_INIT",MA_INIT},

View file

@ -1509,8 +1509,6 @@ void G_PreviewRewind(tic_t previewtime)
players[i].mo->sprite2 = info->playerinfo[i].mobj.sprite2;
players[i].mo->frame = info->playerinfo[i].mobj.frame;
players[i].mo->hitlag = info->playerinfo[i].mobj.hitlag;
players[i].realtime = info->playerinfo[i].player.realtime;
// Genuinely CANNOT be fucked. I can redo lua and I can redo netsaves but I draw the line at this abysmal hack.
/*for (j = 0; j < NUMKARTSTUFF; j++)

View file

@ -44,7 +44,7 @@
#include "hw_md2.h"
// SRB2Kart
#include "../k_kart.h" // HITLAGJITTERS
#include "../k_kart.h"
#include "../r_fps.h"
#ifdef NEWCLIP
@ -3676,21 +3676,6 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale)
R_InterpolateMobjState(thing, FRACUNIT, &interp);
}
// hitlag vibrating (todo: interp somehow?)
if (thing->hitlag > 0 && (thing->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = thing->hitlag * HITLAGJITTERS;
if (leveltime & 1)
{
mul = -mul;
}
interp.x += FixedMul(thing->momx, mul);
interp.y += FixedMul(thing->momy, mul);
interp.z += FixedMul(thing->momz, mul);
}
// sprite offset
interp.x += thing->sprxoff;
interp.y += thing->spryoff;
@ -5131,21 +5116,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
dispoffset = thing->dispoffset;
// hitlag vibrating (todo: interp somehow?)
if (thing->hitlag > 0 && (thing->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = thing->hitlag * HITLAGJITTERS;
if (leveltime & 1)
{
mul = -mul;
}
interp.x += FixedMul(thing->momx, mul);
interp.y += FixedMul(thing->momy, mul);
interp.z += FixedMul(thing->momz, mul);
}
// sprite offset
interp.x += thing->sprxoff;
interp.y += thing->spryoff;
@ -5500,10 +5470,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
vis->mobj = thing;
//Hurdler: 25/04/2000: now support colormap in hardware mode
if (R_ThingIsFlashing(vis->mobj))
{
vis->colormap = R_GetTranslationColormap(TC_HITLAG, 0, GTC_CACHE);
}
/*
else if ((vis->mobj->flags & (MF_ENEMY|MF_BOSS)) && (vis->mobj->flags2 & MF2_FRET) && !(vis->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash"
{
@ -5515,7 +5481,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
vis->colormap = R_GetTranslationColormap(TC_BOSS, 0, GTC_CACHE);
}
*/
else if (thing->color)
if (thing->color)
{
// New colormap stuff for skins Tails 06-07-2002
if (thing->colorized)

View file

@ -46,7 +46,7 @@
// SRB2Kart
#include "../k_color.h"
#include "../k_kart.h" // HITLAGJITTERS
#include "../k_kart.h"
#include "../r_fps.h"
#ifdef HAVE_PNG
@ -822,12 +822,7 @@ static void HWR_CreateBlendedTexture(patch_t *gpatch, patch_t *blendgpatch, GLMi
while (size--)
{
if (skinnum == TC_HITLAG)
{
cur->s.red = cur->s.green = cur->s.blue = K_HitlagColorValue(*image);
cur->s.alpha = image->s.alpha;
}
else if (skinnum == TC_BOSS)
if (skinnum == TC_BOSS)
{
// Turn everything below a certain threshold white
if ((image->s.red == image->s.green) && (image->s.green == image->s.blue) && image->s.blue < 127)
@ -1381,21 +1376,6 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
}
// hitlag vibrating
if (spr->mobj->hitlag > 0 && (spr->mobj->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = spr->mobj->hitlag * HITLAGJITTERS;
if (leveltime & 1)
{
mul = -mul;
}
interp.x += FixedMul(spr->mobj->momx, mul);
interp.y += FixedMul(spr->mobj->momy, mul);
interp.z += FixedMul(spr->mobj->momz, mul);
}
// sprite offset
interp.x += spr->mobj->sprxoff;
interp.y += spr->mobj->spryoff;
@ -1506,10 +1486,6 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
{
INT32 skinnum = TC_DEFAULT;
if (R_ThingIsFlashing(spr->mobj))
{
skinnum = TC_HITLAG;
}
/*
else if ((spr->mobj->flags & (MF_ENEMY|MF_BOSS)) && (spr->mobj->flags2 & MF2_FRET) && !(spr->mobj->flags & MF_GRENADEBOUNCE) && (leveltime & 1)) // Bosses "flash"
{
@ -1521,7 +1497,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
skinnum = TC_BOSS;
}
*/
else if ((skincolornum_t)spr->mobj->color != SKINCOLOR_NONE)
if ((skincolornum_t)spr->mobj->color != SKINCOLOR_NONE)
{
if (spr->mobj->colorized)
skinnum = TC_RAINBOW;

View file

@ -8754,7 +8754,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
4, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_SCENERY|MF_NOCLIPHEIGHT|MF_NOHITLAGFORME, // flags
MF_NOBLOCKMAP|MF_SCENERY|MF_NOCLIPHEIGHT, // flags
S_NULL // raisestate
},
@ -8781,7 +8781,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
4, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIPHEIGHT|MF_PAPERCOLLISION|MF_NOHITLAGFORME, // flags
MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIPHEIGHT|MF_PAPERCOLLISION, // flags
S_NULL // raisestate
},
@ -8808,7 +8808,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
4, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPTHING|MF_NOHITLAGFORME, // flags
MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPTHING, // flags
S_NULL // raisestate
},

View file

@ -85,10 +85,6 @@ void K_BossInfoTicker(void)
if (bossinfo.weakspots[i].spot == NULL)
continue;
// Damaged quickly? Make it disappear immediately (making sure to match the flashing).
if ((bossinfo.weakspots[i].spot->hitlag > 0) && (bossinfo.weakspots[i].time > TICRATE/2))
bossinfo.weakspots[i].time = (TICRATE/2) & ~(bossinfo.weakspots[i].time & 1);
// Handle counter.
if (!bossinfo.weakspots[i].time)
continue;

View file

@ -41,9 +41,6 @@ boolean K_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2)
boolean damageitem = false;
boolean sprung = 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;
@ -57,9 +54,6 @@ boolean K_OrbinautJawzCollide(mobj_t *t1, mobj_t *t2)
if (t2->player)
{
if ((t2->player->flashing > 0 && t2->hitlag == 0)
&& !(t1->type == MT_ORBINAUT || t1->type == MT_JAWZ || t1->type == MT_JAWZ_DUD))
return true;
if (t2->player->hyudorotimer)
return true; // no interaction
@ -138,9 +132,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;
@ -156,8 +147,6 @@ boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2)
if (t2->player)
{
if (t2->player->flashing > 0 && t2->hitlag == 0)
return true;
// Banana snipe!
if (t1->type == MT_BANANA && t1->health > 1)
@ -223,9 +212,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)
{
@ -407,9 +393,6 @@ void 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;
@ -418,7 +401,7 @@ boolean K_MineCollide(mobj_t *t1, mobj_t *t2)
if (t2->player)
{
if (t2->player->flashing > 0 && t2->hitlag == 0)
if (t2->player->flashing > 0)
return true;
// Bomb punting
@ -460,9 +443,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;
@ -534,7 +514,7 @@ 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 || !draggeddroptarget)) || (t2->threshold > 0 && t1->hitlag > 0))
if ((t1->threshold > 0 && (!draggeddroptarget)) || (t2->threshold > 0))
return true;
if (((t1->target == t2) || (t1->target == t2->target)) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0)))
@ -593,13 +573,8 @@ boolean K_DropTargetCollide(mobj_t *t1, mobj_t *t2)
t1->momx = (t1->momx + t2->momx)/2;
t1->momy = (t1->momy + t2->momy)/2;
t1->momz = (t1->momz + t2->momz)/2;
K_AddHitLag(t1->target, 6, false);
}
K_AddHitLag(t1, 6, true);
K_AddHitLag(t2, 6, false);
{
mobj_t *ghost = P_SpawnGhostMobj(t1);
UINT8 i;
@ -793,15 +768,12 @@ 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;
if (t2->player)
{
if (t2->player->flashing > 0 && t2->hitlag == 0)
if (t2->player->flashing > 0)
return true;
S_StartSound(NULL, sfx_bsnipe); // let all players hear it.
@ -953,15 +925,5 @@ boolean K_PvPTouchDamage(mobj_t *t1, mobj_t *t2)
P_PlayerRingBurst(t1->player, 1);
}
// No damage hitlag for stinging.
if (stungT1 == true && stungT2 == false)
{
t2->eflags &= ~MFE_DAMAGEHITLAG;
}
else if (stungT2 == true && stungT1 == false)
{
t1->eflags &= ~MFE_DAMAGEHITLAG;
}
return (stungT1 || stungT2);
}

View file

@ -90,59 +90,6 @@ void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor)
}
}
/*--------------------------------------------------
UINT8 K_HitlagColorValue(RGBA_t color)
See header file for description.
--------------------------------------------------*/
UINT8 K_HitlagColorValue(RGBA_t color)
{
// Outputs a raw brightness value (makes OGL support easier)
INT32 output = K_ColorRelativeLuminance(color.s.red, color.s.green, color.s.blue);
// Invert the color
output = 255 - output;
// Increase the contrast
output = ((output-128) * 2) + 128;
// Make sure to cap it.
if (output > 255)
{
output = 255;
}
else if (output < 0)
{
output = 0;
}
return output;
}
/*--------------------------------------------------
void K_HitlagColormap(UINT8 *dest_colormap)
See header file for description.
--------------------------------------------------*/
void K_HitlagColormap(UINT8 *dest_colormap)
{
RGBA_t color;
UINT8 v, offset;
INT32 i;
// for every colour in the palette, invert, greyscale, and increase the contrast.
for (i = 0; i < NUM_PALETTE_ENTRIES; i++)
{
color = V_GetColor(i);
v = K_HitlagColorValue(color);
// Convert raw brightness value to an offset from the greyscale palette line
offset = (255 - v) / 8;
dest_colormap[i] = offset; // Starts from 0, add it if greyscale moves.
}
}
/*--------------------------------------------------
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color)
@ -153,12 +100,7 @@ void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color)
INT32 i;
INT32 starttranscolor;
if (skinnum == TC_HITLAG)
{
K_HitlagColormap(dest_colormap);
return;
}
else if (skinnum == TC_BOSS
if (skinnum == TC_BOSS
|| skinnum == TC_ALLWHITE
|| skinnum == TC_METALSONIC
|| skinnum == TC_BLINK

View file

@ -66,34 +66,6 @@ UINT16 K_RainbowColor(tic_t time);
void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor);
/*--------------------------------------------------
UINT8 K_HitlagColorValue(RGBA_t color);
Gets the new replacement brightness value for the hitlag effect.
Input Arguments:-
color - Input color we intend to replace.
Return:-
0 to 255 brightness value.
--------------------------------------------------*/
UINT8 K_HitlagColorValue(RGBA_t color);
/*--------------------------------------------------
void K_HitlagColormap(UINT8 *dest_colormap);
Generates a inverted hi-contrast greyscale colormap,
for the hitlag effect.
Input Arguments:-
dest_colormap - Colormap to populate.
Return:-
None
--------------------------------------------------*/
void K_HitlagColormap(UINT8 *dest_colormap);
/*--------------------------------------------------
void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color);

View file

@ -4163,23 +4163,6 @@ static void K_drawKartFirstPerson(void)
fixed_t xoffs = -P_ReturnThrustY(stplyr->mo, ang, (BASEVIDWIDTH<<(FRACBITS-2))/2);
fixed_t yoffs = -P_ReturnThrustX(stplyr->mo, ang, 4*FRACUNIT);
// hitlag vibrating
if (stplyr->mo->hitlag > 0 && (stplyr->mo->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = stplyr->mo->hitlag * HITLAGJITTERS;
if (r_splitscreen && mul > FRACUNIT)
mul = FRACUNIT;
if (leveltime & 1)
{
mul = -mul;
}
xoffs = FixedMul(xoffs, mul);
yoffs = FixedMul(yoffs, mul);
}
if ((yoffs += 4*FRACUNIT) < 0)
yoffs = 0;

View file

@ -3435,75 +3435,6 @@ angle_t K_MomentumAngle(mobj_t *mo)
}
}
void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage)
{
if (mo == NULL || P_MobjWasRemoved(mo) || (mo->flags & MF_NOHITLAGFORME && mo->type != MT_PLAYER))
{
return;
}
mo->hitlag += tics;
mo->hitlag = min(mo->hitlag, MAXHITLAGTICS);
if (mo->player != NULL)
{
// Reset each time. We want to explicitly set this for bananas afterwards,
// so make sure an old value doesn't possibly linger.
mo->player->flipDI = false;
}
if (fromDamage == true)
{
// Dunno if this should flat-out &~ the flag out too.
// Decided it probably just just keep it since it's "adding" hitlag.
mo->eflags |= MFE_DAMAGEHITLAG;
}
}
void K_SetHitLagForObjects(mobj_t *mo1, mobj_t *mo2, INT32 tics, boolean fromDamage)
{
INT32 finalTics = tics;
if (tics <= 0)
{
return;
}
if ((mo1 && !P_MobjWasRemoved(mo1)) == true && (mo2 && !P_MobjWasRemoved(mo2)) == true)
{
const fixed_t speedTicFactor = (mapobjectscale * 8);
const INT32 angleTicFactor = ANGLE_22h;
const fixed_t mo1speed = FixedHypot(FixedHypot(mo1->momx, mo1->momy), mo1->momz);
const fixed_t mo2speed = FixedHypot(FixedHypot(mo2->momx, mo2->momy), mo2->momz);
const fixed_t speedDiff = abs(mo2speed - mo1speed);
const fixed_t scaleDiff = abs(mo2->scale - mo1->scale);
angle_t mo1angle = K_MomentumAngle(mo1);
angle_t mo2angle = K_MomentumAngle(mo2);
INT32 angleDiff = 0;
if (mo1speed > 0 && mo2speed > 0)
{
// If either object is completely not moving, their speed doesn't matter.
angleDiff = AngleDelta(mo1angle, mo2angle);
}
// Add extra "damage" based on what was happening to the objects on impact.
finalTics += (FixedMul(speedDiff, FRACUNIT + scaleDiff) / speedTicFactor) + (angleDiff / angleTicFactor);
// This shouldn't happen anymore, but just in case something funky happens.
if (finalTics < tics)
{
finalTics = tics;
}
}
K_AddHitLag(mo1, finalTics, fromDamage);
K_AddHitLag(mo2, finalTics, false); // mo2 is the inflictor, so don't use the damage property.
}
void K_AwardPlayerRings(player_t *player, INT32 rings, boolean overload)
{
UINT16 superring;
@ -3557,8 +3488,6 @@ void K_DoPowerClash(player_t *t1, player_t *t2) {
t2->instashield = 1;
S_StartSound(t1->mo, sfx_parry);
K_AddHitLag(t1->mo, 6, false);
K_AddHitLag(t2->mo, 6, false);
clash = P_SpawnMobj((t1->mo->x/2) + (t2->mo->x/2), (t1->mo->y/2) + (t2->mo->y/2), (t1->mo->z/2) + (t2->mo->z/2), MT_POWERCLASH);
@ -3759,10 +3688,6 @@ static void K_HandleTumbleBounce(player_t *player)
}
}
// A bit of damage hitlag.
// This gives a window for DI!!
K_AddHitLag(player->mo, 3, true);
if (P_IsDisplayPlayer(player) && player->tumbleHeight >= 40)
P_StartQuake((player->tumbleHeight*3/2)<<FRACBITS, 6); // funny earthquakes for the FEEL
@ -3812,7 +3737,6 @@ void K_ApplyTripWire(player_t *player, tripwirestate_t state)
S_StartSound(player->mo, sfx_kc40);
player->tripwireState = state;
K_AddHitLag(player->mo, 10, false);
if (state == TRIPSTATE_PASSED && player->spinouttimer &&
player->speed > 2 * K_GetKartSpeed(player, false, true))
@ -5279,9 +5203,6 @@ void K_PuntMine(mobj_t *origMine, mobj_t *punter)
if (!origMine || P_MobjWasRemoved(origMine))
return;
if (punter->hitlag > 0)
return;
// This guarantees you hit a mine being dragged
if (origMine->type == MT_SSMINE_SHIELD) // Create a new mine, and clean up the old one
{
@ -5330,7 +5251,7 @@ void K_PuntMine(mobj_t *origMine, mobj_t *punter)
if (!mine || P_MobjWasRemoved(mine))
return;
if (mine->threshold > 0 || mine->hitlag > 0)
if (mine->threshold > 0)
return;
spd = FixedMul(82 * punter->scale, K_GetKartGameSpeedScalar(gamespeed)); // Avg Speed is 41 in Normal
@ -5345,8 +5266,6 @@ void K_PuntMine(mobj_t *origMine, mobj_t *punter)
mine->momy = punter->momy + FixedMul(FINESINE(fa >> ANGLETOFINESHIFT), spd);
P_SetObjectMomZ(mine, z, false);
//K_SetHitLagForObjects(punter, mine, 5);
mine->flags &= ~MF_NOCLIPTHING;
}
@ -5687,7 +5606,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
thrust = FixedMul(thrust, 9*FRACUNIT/8);
}
mo->player->tricktime = 0; // Reset post-hitlag timer
mo->player->tricktime = 0;
// Setup the boost for potential upwards trick, at worse, make it your regular max speed. (boost = curr speed*1.25)
mo->player->trickboostpower = max(FixedDiv(mo->player->speed, K_GetKartSpeed(mo->player, false, false)) - FRACUNIT, 0)*125/100;
//CONS_Printf("Got boost: %d%\n", mo->player->trickboostpower*100 / FRACUNIT);
@ -5926,7 +5845,6 @@ void K_DropHnextList(player_t *player, boolean keepshields)
dropwork->ceilingz = work->ceilingz;
dropwork->health = work->health; // will never be set to 0 as long as above guard exists
dropwork->hitlag = work->hitlag;
// Copy interp data
dropwork->old_angle = work->old_angle;
@ -6002,15 +5920,6 @@ void K_DropHnextList(player_t *player, boolean keepshields)
{
dropwork->threshold = 10;
dropwork->flags &= ~MF_NOCLIPTHING;
if (type == MT_DROPTARGET && dropwork->hitlag)
{
dropwork->momx = work->momx;
dropwork->momy = work->momy;
dropwork->momz = work->momz;
dropwork->reactiontime = work->reactiontime;
P_SetMobjState(dropwork, mobjinfo[type].painstate);
}
}
P_RemoveMobj(work);
@ -9246,7 +9155,7 @@ static void K_KartSpindash(player_t *player)
UINT16 buttons = K_GetKartButtons(player);
boolean spawnWind = (leveltime % 2 == 0);
if (player->mo->hitlag > 0 || P_PlayerInPain(player))
if (P_PlayerInPain(player))
{
player->spindash = 0;
}
@ -9507,7 +9416,7 @@ void K_AdjustPlayerFriction(player_t *player)
//
// K_trickPanelTimingVisual
// Spawns the timing visual for trick panels depending on the given player's momz.
// If the player has tricked and is not in hitlag, this will send the half circles flying out.
// If the player has tricked, this will send the half circles flying out.
// if you tumble, they'll fall off instead.
//
@ -10440,9 +10349,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
// Finalise everything.
if (player->trickpanel != 1) // just changed from 1?
{
player->mo->hitlag = TRICKLAG;
player->mo->eflags &= ~MFE_DAMAGEHITLAG;
K_trickPanelTimingVisual(player, momz);
if (abs(momz) < FRACUNIT*99) // Let's use that as baseline for PERFECT trick.
@ -10658,9 +10564,6 @@ void K_HandleDirectionalInfluence(player_t *player)
return;
}
// DI attempted!!
player->justDI = MAXHITLAGTICS;
cmd = &player->cmd;
inputX = cmd->throwdir;

View file

@ -19,9 +19,6 @@ Make sure this matches the actual number of states
*/
#define KART_NUMINVSPARKLESANIM 12
#define MAXHITLAGTICS 18 //12
#define HITLAGJITTERS (FRACUNIT / 20)
#define GROW_SCALE (2*FRACUNIT)
#define SHRINK_SCALE (FRACUNIT/2)
@ -65,8 +62,6 @@ void K_KartResetPlayerColor(player_t *player);
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
void K_KartPlayerAfterThink(player_t *player);
angle_t K_MomentumAngle(mobj_t *mo);
void K_AddHitLag(mobj_t *mo, INT32 tics, boolean fromDamage);
void K_SetHitLagForObjects(mobj_t *mo1, mobj_t *mo2, INT32 tics, boolean fromDamage);
void K_AwardPlayerRings(player_t *player, INT32 rings, boolean overload);
void K_DoInstashield(player_t *player);
void K_DoPowerClash(player_t *t1, player_t *t2);

View file

@ -3758,19 +3758,6 @@ static int lib_kGetCollideAngle(lua_State *L)
return 1;
}
static int lib_kAddHitLag(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
tic_t tics = (tic_t)luaL_checkinteger(L, 2);
boolean fromdamage = lua_opttrueboolean(L, 3);
NOHUD
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
K_AddHitLag(mo, tics, fromdamage);
return 0;
}
static int lib_kInitBossHealthBar(lua_State *L)
{
const char *enemyname = luaL_checkstring(L, 1);
@ -4084,7 +4071,6 @@ static luaL_Reg lib[] = {
{"K_GetItemPatch",lib_kGetItemPatch},
{"K_GetCollideAngle",lib_kGetCollideAngle},
{"K_AddHitLag",lib_kAddHitLag},
// k_boss
{"K_InitBossHealthBar", lib_kInitBossHealthBar},

View file

@ -99,7 +99,6 @@ enum mobj_e {
mobj_sprxoff,
mobj_spryoff,
mobj_sprzoff,
mobj_hitlag,
mobj_dispoffset
};
@ -180,7 +179,6 @@ static const char *const mobj_opt[] = {
"sprxoff",
"spryoff",
"sprzoff",
"hitlag",
"dispoffset",
NULL};
@ -457,9 +455,6 @@ static int mobj_get(lua_State *L)
case mobj_sprzoff:
lua_pushfixed(L, mo->sprzoff);
break;
case mobj_hitlag:
lua_pushinteger(L, mo->hitlag);
break;
case mobj_dispoffset:
lua_pushinteger(L, mo->dispoffset);
break;
@ -832,9 +827,6 @@ static int mobj_set(lua_State *L)
case mobj_sprzoff:
mo->sprzoff = luaL_checkfixed(L, 3);
break;
case mobj_hitlag:
mo->hitlag = luaL_checkinteger(L, 3);
break;
case mobj_dispoffset:
mo->dispoffset = luaL_checkinteger(L, 3);
break;

View file

@ -302,8 +302,6 @@ hyudoro_patrol_hit_player
if (!player->itemamount)
return false;
K_AddHitLag(toucher, TICRATE/2, true);
hyudoro_mode(hyu) = HYU_RETURN;
hyudoro_itemtype(hyu) = player->itemtype;
hyudoro_itemcount(hyu) = player->itemamount;

View file

@ -13607,12 +13607,6 @@ void A_SPBChase(mobj_t *actor)
actor->lastlook = actor->tracer->player-players; // Save the player num for death scumming...
actor->tracer->player->pflags |= PF_RINGLOCK; // set ring lock
if (actor->tracer->hitlag)
{
// If the player is frozen through no fault of their own, the SPB should be too.
actor->hitlag = actor->tracer->hitlag;
}
if (!P_IsObjectOnGround(actor->tracer))
{
// In the air you have no control; basically don't hit unless you make a near complete stop

View file

@ -394,9 +394,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (special->threshold > 0)
return;
if (toucher->hitlag > 0)
return;
player->emeralds |= special->extravalue1;
K_CheckEmeralds(player);
break;
@ -972,8 +969,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
if (LUAh_MobjDeath(target, inflictor, source, damagetype) || P_MobjWasRemoved(target))
return;
//K_SetHitLagForObjects(target, inflictor, MAXHITLAGTICS, true);
// SRB2kart
// I wish I knew a better way to do this
if (target->target && target->target->player && target->target->player->mo)
@ -1251,8 +1246,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
{
kart->angle = target->angle;
kart->color = target->color;
kart->hitlag = target->hitlag;
kart->eflags |= MFE_DAMAGEHITLAG;
P_SetObjectMomZ(kart, 6*FRACUNIT, false);
kart->extravalue1 = target->player->kartweight;
@ -1754,7 +1747,6 @@ static boolean P_KillPlayer(player_t *player, mobj_t *inflictor, mobj_t *source,
}
K_DropEmeraldsFromPlayer(player, player->emeralds);
K_SetHitLagForObjects(player->mo, inflictor, MAXHITLAGTICS, true);
player->carry = CR_NONE;
@ -1855,7 +1847,7 @@ 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->hitlag > 0 && inflictor == NULL)
if (!(damagetype & DMG_DEATHMASK) && inflictor == NULL)
return false;
}
@ -1949,7 +1941,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
allowcombo = false;
}
if ((target->hitlag == 0 || allowcombo == false) && player->flashing > 0)
if ((allowcombo == false) && player->flashing > 0)
{
// Post-hit invincibility
K_DoInstashield(player);
@ -2088,7 +2080,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
}
player->instashield = 15;
K_SetHitLagForObjects(target, inflictor, laglength, true);
if (inflictor && !P_MobjWasRemoved(inflictor) && inflictor->type == MT_BANANA)
{
@ -2116,16 +2107,12 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (source && source->player && target)
G_GhostAddHit((INT32) (source->player - players), target);
K_SetHitLagForObjects(target, inflictor, laglength, true);
if (target->health <= 0)
{
P_KillMobj(target, inflictor, source, damagetype);
return true;
}
//K_SetHitLagForObjects(target, inflictor, laglength, true);
if (player)
P_ResetPlayer(target->player);
else

View file

@ -446,7 +446,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
{
if (spring->reactiontime == 0)
{
object->player->tricktime = 0; // Reset post-hitlag timer
object->player->tricktime = 0;
// Setup the boost for potential upwards trick, at worse, make it your regular max speed. (boost = curr speed*1.25)
object->player->trickboostpower = max(FixedDiv(object->player->speed, K_GetKartSpeed(object->player, false, false)) - FRACUNIT, 0)*125/100;
//CONS_Printf("Got boost: %d%\n", mo->player->trickboostpower*100 / FRACUNIT);
@ -569,10 +569,6 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
|| (thing->player && thing->player->spectator))
return BMIT_CONTINUE;
// Ignore the collision if BOTH things are in hitlag.
if (thing->hitlag > 0 && tmthing->hitlag > 0)
return BMIT_CONTINUE;
if ((thing->flags & MF_NOCLIPTHING) || !(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE|MF_SPRING)))
return BMIT_CONTINUE;
@ -2509,14 +2505,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
// And Big Large (tm) movements can skip over slopes.
radius = min(radius, 16*mapobjectscale);
#if 0
if (thing->hitlag > 0)
{
// Do not move during hitlag
return false;
}
#endif
do {
if (thing->flags & MF_NOCLIP)
{

View file

@ -5492,8 +5492,6 @@ static void P_MobjSceneryThink(mobj_t *mobj)
}
else
P_AddOverlay(mobj);
if (mobj->target->hitlag) // move to the correct position, update to the correct properties, but DON'T STATE-ANIMATE
return;
break;
case MT_WATERDROP:
P_SceneryCheckWater(mobj);
@ -9342,26 +9340,7 @@ void P_MobjThinker(mobj_t *mobj)
if ((mobj->flags & MF_BOSS) && mobj->spawnpoint && (bossdisabled & (1<<mobj->spawnpoint->extrainfo)))
return;
// Don't run any thinker code while in hitlag
if (mobj->hitlag > 0)
{
mobj->hitlag--;
if (mobj->type == MT_DROPTARGET && mobj->reactiontime > 0 && mobj->hitlag == 2)
{
mobj->spritexscale = FRACUNIT;
mobj->spriteyscale = 5*FRACUNIT;
}
if (mobj->player != NULL && mobj->hitlag == 0 && (mobj->eflags & MFE_DAMAGEHITLAG))
{
K_HandleDirectionalInfluence(mobj->player);
}
return;
}
mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG|MFE_JUSTBOUNCEDWALL|MFE_DAMAGEHITLAG|MFE_SLOPELAUNCHED);
mobj->eflags &= ~(MFE_PUSHED|MFE_SPRUNG|MFE_JUSTBOUNCEDWALL|MFE_SLOPELAUNCHED);
tmfloorthing = tmhitthing = NULL;
@ -10009,8 +9988,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->colorized = false;
mobj->hitlag = 0;
// Set shadowscale here, before spawn hook so that Lua can change it
P_DefaultMobjShadowScale(mobj);

View file

@ -161,8 +161,8 @@ typedef enum
MF_PICKUPFROMBELOW = 1<<29,
// Disable momentum-based squash and stretch.
MF_NOSQUISH = 1<<30,
// Disable hitlag for this object
MF_NOHITLAGFORME = (INT32)(1U<<31),
// Free
// = (INT32)(1U<<31),
// no more free slots, next up I suppose we can get rid of shit like MF_BOXICON?
} mobjflag_t;
@ -251,8 +251,8 @@ typedef enum
MFE_TRACERANGLE = 1<<11,
// SRB2Kart: The mobj just hit & bounced off a wall, this is cleared on next frame
MFE_JUSTBOUNCEDWALL = 1<<12,
// SRB2Kart: In damage hitlag (displays different visual efx)
MFE_DAMAGEHITLAG = 1<<13,
// SRB2Kart: free
// = 1<<13,
// Slope physics sent you airborne
MFE_SLOPELAUNCHED = 1<<14,
// free: to and including 1<<15
@ -406,7 +406,6 @@ typedef struct mobj_s
fixed_t sprxoff, spryoff, sprzoff; // Sprite offsets in real space, does NOT affect position or collision
struct terrain_s *terrain; // Terrain definition of the floor this object last hit. NULL when in the air.
INT32 hitlag; // Sal-style hit lag, straight from Captain Fetch's jowls
INT32 dispoffset;

View file

@ -1603,7 +1603,7 @@ typedef enum
MD2_SPRITEYOFFSET = 1<<21,
MD2_FLOORSPRITESLOPE = 1<<22,
MD2_DISPOFFSET = 1<<23,
MD2_HITLAG = 1<<24,
//free = 1<<24,
MD2_WAYPOINTCAP = 1<<25,
MD2_KITEMCAP = 1<<26,
MD2_ITNEXT = 1<<27,
@ -1841,8 +1841,6 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|| (slope->normal.z != FRACUNIT))
diff2 |= MD2_FLOORSPRITESLOPE;
}
if (mobj->hitlag)
diff2 |= MD2_HITLAG;
if (mobj->dispoffset)
diff2 |= MD2_DISPOFFSET;
if (mobj == waypointcap)
@ -2049,10 +2047,6 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
WRITEFIXED(save_p, slope->normal.y);
WRITEFIXED(save_p, slope->normal.z);
}
if (diff2 & MD2_HITLAG)
{
WRITEINT32(save_p, mobj->hitlag);
}
if (diff2 & MD2_DISPOFFSET)
{
WRITEINT32(save_p, mobj->dispoffset);
@ -3158,10 +3152,6 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker)
P_UpdateSlopeLightOffset(slope);
}
if (diff2 & MD2_HITLAG)
{
mobj->hitlag = READINT32(save_p);
}
if (diff2 & MD2_DISPOFFSET)
{
mobj->dispoffset = READINT32(save_p);

View file

@ -3079,11 +3079,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
mo = player->mo;
if (mo->hitlag > 0 || player->playerstate == PST_DEAD)
if (player->playerstate == PST_DEAD)
{
// Do not move the camera while in hitlag!
// The camera zooming out after you got hit makes it hard to focus on the vibration.
// of course, if you're in chase, don't forget the postimage - otherwise encore will flip back
// Do not move the camera while dead!
if (thiscam->chase)
P_CalcChasePostImg(player, thiscam);
@ -4101,11 +4099,6 @@ void P_PlayerThink(player_t *player)
if (player->awayviewtics && player->awayviewtics != -1)
player->awayviewtics--;
if (player->mo->hitlag > 0)
{
return;
}
// Track airtime
if (P_IsObjectOnGround(player->mo)
&& !P_PlayerInPain(player)) // This isn't airtime, but it's control loss all the same.

View file

@ -147,7 +147,6 @@ UINT32 nflatxshift, nflatyshift, nflatshiftup, nflatmask;
#define RAINBOW_TT_CACHE_INDEX (MAXSKINS + 4)
#define BLINK_TT_CACHE_INDEX (MAXSKINS + 5)
#define DASHMODE_TT_CACHE_INDEX (MAXSKINS + 6)
#define HITLAG_TT_CACHE_INDEX (MAXSKINS + 7)
#define TT_CACHE_SIZE (MAXSKINS + 8)
#define SKIN_RAMP_LENGTH 16
@ -168,7 +167,6 @@ static INT32 SkinToCacheIndex(INT32 skinnum)
case TC_RAINBOW: return RAINBOW_TT_CACHE_INDEX;
case TC_BLINK: return BLINK_TT_CACHE_INDEX;
case TC_DASHMODE: return DASHMODE_TT_CACHE_INDEX;
case TC_HITLAG: return HITLAG_TT_CACHE_INDEX;
default: break;
}
@ -186,7 +184,6 @@ static INT32 CacheIndexToSkin(INT32 ttc)
case RAINBOW_TT_CACHE_INDEX: return TC_RAINBOW;
case BLINK_TT_CACHE_INDEX: return TC_BLINK;
case DASHMODE_TT_CACHE_INDEX: return TC_DASHMODE;
case HITLAG_TT_CACHE_INDEX: return TC_HITLAG;
default: break;
}

View file

@ -123,7 +123,6 @@ enum
TC_RAINBOW, // For single colour
TC_BLINK, // For item blinking, according to kart
TC_DASHMODE, // For Metal Sonic's dashmode
TC_HITLAG, // Damage hitlag effect
TC_DEFAULT
};

View file

@ -46,7 +46,7 @@
// SRB2kart
#include "k_color.h"
#include "k_kart.h" // HITLAGJITTERS
#include "k_kart.h"
#include "r_fps.h"
#define MINZ (FRACUNIT*4)
@ -789,13 +789,6 @@ void R_DrawFlippedMaskedColumn(column_t *column, column_t *brightmap)
dc_texturemid = basetexturemid;
}
static boolean hitlag_is_flashing(mobj_t *thing)
{
return
(thing->hitlag > 0) &&
(thing->eflags & (MFE_DAMAGEHITLAG));
}
static boolean baddie_is_flashing(mobj_t *thing)
{
return
@ -807,17 +800,11 @@ static boolean baddie_is_flashing(mobj_t *thing)
boolean R_ThingIsFlashing(mobj_t *thing)
{
return
hitlag_is_flashing(thing) ||
baddie_is_flashing(thing);
}
UINT8 *R_GetSpriteTranslation(vissprite_t *vis)
{
if (!(vis->cut & SC_PRECIP) &&
R_ThingIsFlashing(vis->mobj))
{
return R_GetTranslationColormap(TC_HITLAG, 0, GTC_CACHE);
}
/*
else if (R_SpriteIsFlashing(vis)) // Bosses "flash"
{
@ -829,7 +816,7 @@ UINT8 *R_GetSpriteTranslation(vissprite_t *vis)
return R_GetTranslationColormap(TC_BOSS, 0, GTC_CACHE);
}
*/
else if (vis->mobj->color)
if (vis->mobj->color)
{
// New colormap stuff for skins Tails 06-07-2002
if (!(vis->cut & SC_PRECIP) && vis->mobj->colorized)
@ -1537,21 +1524,6 @@ static void R_ProjectSprite(mobj_t *thing)
this_scale = interp.scale;
// hitlag vibrating (todo: interp somehow?)
if (thing->hitlag > 0 && (thing->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = thing->hitlag * HITLAGJITTERS;
if (leveltime & 1)
{
mul = -mul;
}
interp.x += FixedMul(thing->momx, mul);
interp.y += FixedMul(thing->momy, mul);
interp.z += FixedMul(thing->momz, mul);
}
// sprite offset
interp.x += thing->sprxoff;
interp.y += thing->spryoff;
@ -1877,21 +1849,6 @@ static void R_ProjectSprite(mobj_t *thing)
R_InterpolateMobjState(thing, FRACUNIT, &tracer_interp);
}
// hitlag vibrating (todo: interp somehow?)
if (thing->hitlag > 0 && (thing->eflags & MFE_DAMAGEHITLAG))
{
fixed_t mul = thing->hitlag * (FRACUNIT / 10);
if (leveltime & 1)
{
mul = -mul;
}
tracer_interp.x += FixedMul(thing->momx, mul);
tracer_interp.y += FixedMul(thing->momy, mul);
tracer_interp.z += FixedMul(thing->momz, mul);
}
// sprite offset
tracer_interp.x += thing->sprxoff;
tracer_interp.y += thing->spryoff;