- Duke: Interpolate loogcnt when drawing onscreen.

This commit is contained in:
Mitchell Richters 2022-06-06 11:24:38 +10:00
parent 3948ec7a35
commit a29bce9eda
7 changed files with 30 additions and 17 deletions

View file

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

View file

@ -61,20 +61,18 @@ inline static void hud_drawpal(double x, double y, int tilenum, int shade, int o
//
//---------------------------------------------------------------------------
static void displayloogie(player_struct* p)
static void displayloogie(player_struct* p, double const smoothratio)
{
double a, y;
int z;
double x;
if (p->loogcnt == 0) return;
y = (p->loogcnt << 2);
const double loogi = interpolatedvaluef(p->oloogcnt, p->loogcnt, smoothratio);
const double y = loogi * 4.;
for (int i = 0; i < p->numloogs; i++)
{
a = fabs(bsinf((p->loogcnt + i) << 5, -5));
z = 4096 + ((p->loogcnt + i) << 9);
x = -getavel(p->GetPlayerNum()) + bsinf((p->loogcnt + i) << 6, -10);
const double a = fabs(bsinf((loogi + i) * 32., -5));
const double z = 4096. + ((loogi + i) * 512.);
const double x = -getavel(p->GetPlayerNum()) + bsinf((loogi + i) * 64., -10);
hud_drawsprite((p->loogie[i].X + x), (200 + p->loogie[i].Y - y), z - (i << 8), 256 - a, LOOGIE, 0, 0, 2);
}
@ -1226,7 +1224,7 @@ void displayweapon_d(int snum, double smoothratio)
}
}
displayloogie(p);
displayloogie(p, smoothratio);
}

View file

@ -796,6 +796,7 @@ void player_struct::backupweapon()
oknee_incs = knee_incs;
oaccess_incs = access_incs;
ofist_incs = fist_incs;
oloogcnt = loogcnt;
}
//---------------------------------------------------------------------------

View file

@ -2802,8 +2802,15 @@ void processinput_d(int snum)
p->last_extra = pact->spr.extra;
if (p->loogcnt > 0) p->loogcnt--;
else p->loogcnt = 0;
if (p->loogcnt > 0)
{
p->oloogcnt = p->loogcnt;
p->loogcnt--;
}
else
{
p->oloogcnt = p->loogcnt = 0;
}
if (p->fist_incs)
{

View file

@ -3520,8 +3520,15 @@ void processinput_r(int snum)
p->last_extra = pact->spr.extra;
if (p->loogcnt > 0) p->loogcnt--;
else p->loogcnt = 0;
if (p->loogcnt > 0)
{
p->oloogcnt = p->loogcnt;
p->loogcnt--;
}
else
{
p->oloogcnt = p->loogcnt = 0;
}
if (p->fist_incs)
{

View file

@ -99,7 +99,7 @@ void resetplayerstats(int snum)
p->pycount = 0;
p->pyoff = 0;
p->opyoff = 0;
p->loogcnt = 0;
p->oloogcnt = p->loogcnt = 0;
p->psectlotag = 0;
p->weapon_sway = 0;
// p->select_dir = 0;

View file

@ -224,7 +224,7 @@ struct player_struct
short psectlotag;
// From here on it is unaltered from JFDuke with the exception of a few fields that are no longer needed and were removed.
int numloogs, loogcnt;
int numloogs, oloogcnt, loogcnt;
int invdisptime;
int pyoff, opyoff;
int last_pissed_time, truefz, truecz;