- Duke: Interpolate fist_incs when drawing onscreen (hitting the nuke detonator at the end of each level).

This commit is contained in:
Mitchell Richters 2022-06-06 00:12:51 +10:00 committed by Christoph Oelckers
parent 55408e6e3c
commit ab95a8b890
6 changed files with 10 additions and 8 deletions

View file

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

View file

@ -86,15 +86,15 @@ void displayloogie(player_struct* p)
//
//---------------------------------------------------------------------------
int animatefist(int gs, player_struct* p, double look_anghalf, double looking_arc, double plravel, int fistpal)
int animatefist(int gs, player_struct* p, double look_anghalf, double looking_arc, double plravel, int fistpal, double const smoothratio)
{
int fisti = min(p->fist_incs, short(32));
const double fisti = min(interpolatedvaluef(p->ofist_incs, p->fist_incs, smoothratio), 32.);
if (fisti <= 0) return 0;
hud_drawsprite(
(-fisti + 222 + plravel),
(looking_arc + 194 + bsinf((6 + fisti) << 7, -9)),
clamp(65536. - bcosf(fisti << 6, 2), 40920., 90612.), 0, FIST, gs, fistpal, 2);
(looking_arc + 194 + bsinf((6 + fisti) * 128., -9)),
clamp(65536. - bcosf(fisti * 64., 2), 40920., 90612.), 0, FIST, gs, fistpal, 2);
return 1;
}
@ -257,7 +257,7 @@ void displayweapon_d(int snum, double smoothratio)
auto adjusted_arc = looking_arc - hard_landing;
bool playerVars = p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->spr.pal != 1 && p->GetActor()->spr.extra <= 0);
bool playerAnims = animatefist(shade, p, look_anghalf, looking_arc, plravel, pal) || animateknuckles(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal) ||
bool playerAnims = animatefist(shade, p, look_anghalf, looking_arc, plravel, pal, smoothratio) || animateknuckles(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal) ||
animatetip(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal) || animateaccess(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel);
if(playerVars || playerAnims)

View file

@ -644,6 +644,7 @@ int endoflevel(int snum)
auto p = &ps[snum];
// the fist puching the end-of-level thing...
p->ofist_incs = p->fist_incs;
p->fist_incs++;
if (p->fist_incs == 28)
{

View file

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

View file

@ -170,6 +170,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
("one_parallax_sectnum", w.one_parallax_sectnum)
("over_shoulder_on", w.over_shoulder_on)
("random_club_frame", w.random_club_frame)
("ofist_incs", w.ofist_incs)
("fist_incs", w.fist_incs)
("dummyplayersprite", w.dummyplayersprite)
("extra_extra8", w.extra_extra8)

View file

@ -248,7 +248,7 @@ struct player_struct
short jumping_counter, airleft, knee_incs, access_incs;
short ftq;
short got_access, weapon_ang, firstaid_amount;
short over_shoulder_on, fist_incs;
short over_shoulder_on, ofist_incs, fist_incs;
short cheat_phase;
short extra_extra8, quick_kick, last_quick_kick;
short heat_amount, timebeforeexit, customexitsound;