mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- re-factor interpolation backups into discrete functions for calling from multiple places.
Fixes #66.
This commit is contained in:
parent
5ed624a48d
commit
2260c2353d
6 changed files with 71 additions and 33 deletions
|
@ -244,4 +244,8 @@ void dointerpolations(int smoothratio);
|
||||||
int* animateptr(int i);
|
int* animateptr(int i);
|
||||||
void updateviewport(void);
|
void updateviewport(void);
|
||||||
|
|
||||||
|
void backuppos(player_struct* p, bool clipping = true);
|
||||||
|
void backuplook(player_struct* p);
|
||||||
|
void backupview(player_struct* p);
|
||||||
|
|
||||||
END_DUKE_NS
|
END_DUKE_NS
|
||||||
|
|
|
@ -178,6 +178,13 @@ inline int calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk)
|
||||||
return CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC);
|
return CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void backupplayer(player_struct* p)
|
||||||
|
{
|
||||||
|
backuppos(p);
|
||||||
|
backuplook(p);
|
||||||
|
backupview(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// These should be the only places converting between level numbers and volume/map pairs
|
// These should be the only places converting between level numbers and volume/map pairs
|
||||||
constexpr inline int levelnum(int vol, int map)
|
constexpr inline int levelnum(int vol, int map)
|
||||||
|
|
|
@ -652,11 +652,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
|
||||||
// p->bobcounter += 32;
|
// p->bobcounter += 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->oposx = p->posx;
|
backupplayer(p);
|
||||||
p->oposy = p->posy;
|
|
||||||
p->oposz = p->posz;
|
|
||||||
p->oq16ang = p->q16ang;
|
|
||||||
p->opyoff = p->pyoff;
|
|
||||||
|
|
||||||
p->sethoriz(100);
|
p->sethoriz(100);
|
||||||
p->q16horizoff = 0;
|
p->q16horizoff = 0;
|
||||||
|
@ -854,6 +850,56 @@ void applylook(int snum, double factor)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void backuppos(player_struct* p, bool clipping)
|
||||||
|
{
|
||||||
|
if (clipping)
|
||||||
|
{
|
||||||
|
p->oposx = p->posx;
|
||||||
|
p->oposy = p->posy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->posx = p->oposx;
|
||||||
|
p->posy = p->oposy;
|
||||||
|
}
|
||||||
|
|
||||||
|
p->oposz = p->posz;
|
||||||
|
p->bobposx = p->posx;
|
||||||
|
p->bobposy = p->posy;
|
||||||
|
p->opyoff = p->pyoff;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void backuplook(player_struct* p)
|
||||||
|
{
|
||||||
|
p->oq16ang = p->q16ang;
|
||||||
|
p->oq16look_ang = p->q16look_ang;
|
||||||
|
p->oq16rotscrnang = p->q16rotscrnang;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void backupview(player_struct* p)
|
||||||
|
{
|
||||||
|
p->oq16horiz = p->q16horiz;
|
||||||
|
p->oq16horizoff = p->q16horizoff;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void checklook(int snum, int sb_snum)
|
void checklook(int snum, int sb_snum)
|
||||||
{
|
{
|
||||||
auto p = &ps[snum];
|
auto p = &ps[snum];
|
||||||
|
@ -879,9 +925,7 @@ void checklook(int snum, int sb_snum)
|
||||||
p->lookRight = true;
|
p->lookRight = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p->oq16ang = p->q16ang;
|
backuplook(p);
|
||||||
p->oq16look_ang = p->q16look_ang;
|
|
||||||
p->oq16rotscrnang = p->q16rotscrnang;
|
|
||||||
|
|
||||||
if (cl_syncinput)
|
if (cl_syncinput)
|
||||||
applylook(snum, 1);
|
applylook(snum, 1);
|
||||||
|
|
|
@ -2634,8 +2634,7 @@ void processinput_d(int snum)
|
||||||
|
|
||||||
if (cl_syncinput)
|
if (cl_syncinput)
|
||||||
{
|
{
|
||||||
p->oq16horiz = p->q16horiz;
|
backupview(p);
|
||||||
p->oq16horizoff = p->q16horizoff;
|
|
||||||
calcviewpitch(p, 1);
|
calcviewpitch(p, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2749,21 +2748,13 @@ void processinput_d(int snum)
|
||||||
|
|
||||||
if (ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS))
|
if (ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS))
|
||||||
{
|
{
|
||||||
p->posx = p->oposx;
|
backuppos(p, false);
|
||||||
p->posy = p->oposy;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->oposx = p->posx;
|
backuppos(p);
|
||||||
p->oposy = p->posy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p->bobposx = p->posx;
|
|
||||||
p->bobposy = p->posy;
|
|
||||||
|
|
||||||
p->oposz = p->posz;
|
|
||||||
p->opyoff = p->pyoff;
|
|
||||||
|
|
||||||
// Shrinking code
|
// Shrinking code
|
||||||
|
|
||||||
i = 40;
|
i = 40;
|
||||||
|
|
|
@ -3643,21 +3643,13 @@ void processinput_r(int snum)
|
||||||
|
|
||||||
if (ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS))
|
if (ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS))
|
||||||
{
|
{
|
||||||
p->posx = p->oposx;
|
backuppos(p, false);
|
||||||
p->posy = p->oposy;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->oposx = p->posx;
|
backuppos(p);
|
||||||
p->oposy = p->posy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p->bobposx = p->posx;
|
|
||||||
p->bobposy = p->posy;
|
|
||||||
|
|
||||||
p->oposz = p->posz;
|
|
||||||
p->opyoff = p->pyoff;
|
|
||||||
|
|
||||||
// Shrinking code
|
// Shrinking code
|
||||||
|
|
||||||
i = 40;
|
i = 40;
|
||||||
|
|
|
@ -111,7 +111,7 @@ void resetplayerstats(int snum)
|
||||||
p->footprintshade = 0;
|
p->footprintshade = 0;
|
||||||
p->jumping_toggle = 0;
|
p->jumping_toggle = 0;
|
||||||
p->sethoriz(140); //!!
|
p->sethoriz(140); //!!
|
||||||
//p->oq16horiz = p->q16horiz;
|
p->oq16horiz = p->q16horiz;
|
||||||
p->sethorizoff(0);
|
p->sethorizoff(0);
|
||||||
p->bobcounter = 0;
|
p->bobcounter = 0;
|
||||||
p->on_ground = 0;
|
p->on_ground = 0;
|
||||||
|
@ -140,8 +140,8 @@ void resetplayerstats(int snum)
|
||||||
|
|
||||||
p->setlookang(512 - ((currentLevel->levelNumber & 1) << 10));
|
p->setlookang(512 - ((currentLevel->levelNumber & 1) << 10));
|
||||||
|
|
||||||
p->q16rotscrnang = 0;
|
p->setrotscrnang(0);
|
||||||
//p->orotscrnang = 1; // JBF 20031220
|
p->oq16rotscrnang = p->q16rotscrnang;
|
||||||
p->newowner =-1;
|
p->newowner =-1;
|
||||||
p->jumping_counter = 0;
|
p->jumping_counter = 0;
|
||||||
p->hard_landing = 0;
|
p->hard_landing = 0;
|
||||||
|
|
Loading…
Reference in a new issue