- Duke: Interpolate knee_incs when drawing onscreen (stomping on shrunken enemies).

This commit is contained in:
Mitchell Richters 2022-06-06 09:19:55 +10:00
parent ab95a8b890
commit d6549d6335
6 changed files with 11 additions and 8 deletions

View file

@ -576,7 +576,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case PLAYER_KNEE_INCS:
if (bSet) ps[iPlayer].knee_incs = lValue;
if (bSet) ps[iPlayer].oknee_incs = ps[iPlayer].knee_incs = lValue;
else SetGameVarID(lVar2, ps[iPlayer].knee_incs, sActor, sPlayer);
break;

View file

@ -105,15 +105,16 @@ int animatefist(int gs, player_struct* p, double look_anghalf, double looking_ar
//
//---------------------------------------------------------------------------
int animateknee(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal)
int animateknee(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal, double const smoothratio)
{
if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->spr.extra <= 0) return 0;
static const int8_t knee_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8 };
const double kneei = interpolatedvaluef(knee_y[p->oknee_incs], knee_y[p->knee_incs], smoothratio);
looking_arc += knee_y[p->knee_incs];
looking_arc += kneei;
hud_drawpal(105 + plravel - look_anghalf + (knee_y[p->knee_incs] >> 2), looking_arc + 280 - horiz16th, KNEE, gs, 4, pal);
hud_drawpal(105 + plravel - look_anghalf + (kneei * 0.25), looking_arc + 280 - horiz16th, KNEE, gs, 4, pal);
return 1;
}
@ -263,7 +264,7 @@ void displayweapon_d(int snum, double smoothratio)
if(playerVars || playerAnims)
return;
animateknee(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal);
animateknee(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal, smoothratio);
if (isWW2GI())
{

View file

@ -374,12 +374,13 @@ void dokneeattack(int snum, const std::initializer_list<int> & respawnlist)
if (p->knee_incs > 0)
{
p->oknee_incs = p->knee_incs;
p->knee_incs++;
p->horizon.addadjustment(buildhoriz(-48));
p->sync.actions |= SB_CENTERVIEW;
if (p->knee_incs > 15)
{
p->knee_incs = 0;
p->oknee_incs = p->knee_incs = 0;
p->holster_weapon = 0;
if (p->weapon_pos < 0)
p->weapon_pos = -p->weapon_pos;

View file

@ -168,7 +168,7 @@ void resetplayerstats(int snum)
p->knuckle_incs = 1;
p->ofist_incs = p->fist_incs = 0;
p->knee_incs = 0;
p->oknee_incs = p->knee_incs = 0;
p->stairs = 0;
p->noise.X = 0;
p->noise.Y = 0;

View file

@ -155,6 +155,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
("hbomb_hold_delay", w.hbomb_hold_delay)
("jumping_counter", w.jumping_counter)
("airleft", w.airleft)
("oknee_incs", w.oknee_incs)
("knee_incs", w.knee_incs)
("access_incs", w.access_incs)
("ftq", w.ftq)

View file

@ -245,7 +245,7 @@ struct player_struct
short curr_weapon, last_weapon, tipincs, wantweaponfire;
short holoduke_amount, hurt_delay, hbomb_hold_delay;
short jumping_counter, airleft, knee_incs, access_incs;
short jumping_counter, airleft, oknee_incs, knee_incs, access_incs;
short ftq;
short got_access, weapon_ang, firstaid_amount;
short over_shoulder_on, ofist_incs, fist_incs;