mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- create an enum for MaxSmoothRatio and replace multiple hard-coded uses of '65536' constant.
This commit is contained in:
parent
733f3aa490
commit
1cf857e788
7 changed files with 19 additions and 19 deletions
|
@ -1040,7 +1040,6 @@ void S_SetSoundPaused(int state)
|
|||
|
||||
int CalcSmoothRatio(const ClockTicks &totalclk, const ClockTicks &ototalclk, int realgameticspersec)
|
||||
{
|
||||
const int baseValue = 65536;
|
||||
uint64_t currentTime = I_nsTime();
|
||||
|
||||
if ((lastototalclk == ototalclk) && (lastTime != 0))
|
||||
|
@ -1054,7 +1053,7 @@ int CalcSmoothRatio(const ClockTicks &totalclk, const ClockTicks &ototalclk, int
|
|||
}
|
||||
lastTime = currentTime;
|
||||
|
||||
return clamp(baseValue * (elapsedTime / (1'000'000'000. / realgameticspersec)), 0, baseValue);
|
||||
return clamp(MaxSmoothRatio * (elapsedTime / (1'000'000'000. / realgameticspersec)), 0, MaxSmoothRatio);
|
||||
}
|
||||
|
||||
FString G_GetDemoPath()
|
||||
|
|
|
@ -193,6 +193,10 @@ void S_SetSoundPaused(int state);
|
|||
|
||||
void G_FatalEngineError(void);
|
||||
int CalcSmoothRatio(const ClockTicks& totalclk, const ClockTicks& ototalclk, int realgameticspersec);
|
||||
enum
|
||||
{
|
||||
MaxSmoothRatio = FRACUNIT
|
||||
};
|
||||
|
||||
FString G_GetDemoPath();
|
||||
|
||||
|
|
|
@ -168,16 +168,16 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
|
|||
if( t->statnum == 99 ) continue;
|
||||
if( s->statnum != 1 && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && s->owner >= 0 )
|
||||
{
|
||||
t->x -= mulscale16(65536-smoothratio,ps[s->yvel].posx-ps[s->yvel].oposx);
|
||||
t->y -= mulscale16(65536-smoothratio,ps[s->yvel].posy-ps[s->yvel].oposy);
|
||||
t->x -= mulscale16(MaxSmoothRatio-smoothratio,ps[s->yvel].posx-ps[s->yvel].oposx);
|
||||
t->y -= mulscale16(MaxSmoothRatio-smoothratio,ps[s->yvel].posy-ps[s->yvel].oposy);
|
||||
t->z = ps[s->yvel].oposz + mulscale16(smoothratio,ps[s->yvel].posz-ps[s->yvel].oposz);
|
||||
t->z += (40<<8);
|
||||
}
|
||||
else if( ( s->statnum == 0 && s->picnum != CRANEPOLE) || s->statnum == 10 || s->statnum == 6 || s->statnum == 4 || s->statnum == 5 || s->statnum == 1 )
|
||||
{
|
||||
t->x -= mulscale16(65536-smoothratio,s->x-hittype[i].bposx);
|
||||
t->y -= mulscale16(65536-smoothratio,s->y-hittype[i].bposy);
|
||||
t->z -= mulscale16(65536-smoothratio,s->z-hittype[i].bposz);
|
||||
t->x -= mulscale16(MaxSmoothRatio-smoothratio,s->x-hittype[i].bposx);
|
||||
t->y -= mulscale16(MaxSmoothRatio-smoothratio,s->y-hittype[i].bposy);
|
||||
t->z -= mulscale16(MaxSmoothRatio-smoothratio,s->z-hittype[i].bposz);
|
||||
}
|
||||
|
||||
sect = s->sectnum;
|
||||
|
|
|
@ -155,8 +155,8 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
|||
if( t->statnum == 99 ) continue;
|
||||
if( s->statnum != 1 && s->picnum == APLAYER && ps[s->yvel].newowner == -1 && s->owner >= 0 )
|
||||
{
|
||||
t->x -= mulscale16(65536-smoothratio,ps[s->yvel].posx-ps[s->yvel].oposx);
|
||||
t->y -= mulscale16(65536-smoothratio,ps[s->yvel].posy-ps[s->yvel].oposy);
|
||||
t->x -= mulscale16(MaxSmoothRatio-smoothratio,ps[s->yvel].posx-ps[s->yvel].oposx);
|
||||
t->y -= mulscale16(MaxSmoothRatio-smoothratio,ps[s->yvel].posy-ps[s->yvel].oposy);
|
||||
t->z = ps[s->yvel].oposz + mulscale16(smoothratio,ps[s->yvel].posz-ps[s->yvel].oposz);
|
||||
t->z += (40<<8);
|
||||
s->xrepeat = 24;
|
||||
|
@ -164,9 +164,9 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
|||
}
|
||||
else if( ( s->statnum == 0 && s->picnum != CRANEPOLE) || s->statnum == 10 || s->statnum == 6 || s->statnum == 4 || s->statnum == 5 || s->statnum == 1 )
|
||||
{
|
||||
t->x -= mulscale16(65536-smoothratio,s->x-hittype[i].bposx);
|
||||
t->y -= mulscale16(65536-smoothratio,s->y-hittype[i].bposy);
|
||||
t->z -= mulscale16(65536-smoothratio,s->z-hittype[i].bposz);
|
||||
t->x -= mulscale16(MaxSmoothRatio-smoothratio,s->x-hittype[i].bposx);
|
||||
t->y -= mulscale16(MaxSmoothRatio-smoothratio,s->y-hittype[i].bposy);
|
||||
t->z -= mulscale16(MaxSmoothRatio-smoothratio,s->z-hittype[i].bposz);
|
||||
}
|
||||
|
||||
sect = s->sectnum;
|
||||
|
|
|
@ -296,8 +296,6 @@ void displayrest(int smoothratio)
|
|||
|
||||
if (ud.overhead_on > 0)
|
||||
{
|
||||
// smoothratio = min(max(smoothratio,0),65536);
|
||||
smoothratio = calc_smoothratio(totalclock, ototalclock);
|
||||
dointerpolations(smoothratio);
|
||||
|
||||
if (ud.scrollmode == 0)
|
||||
|
|
|
@ -173,7 +173,7 @@ inline int calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk)
|
|||
{
|
||||
if (!playrunning())
|
||||
{
|
||||
return 65536;
|
||||
return MaxSmoothRatio;
|
||||
}
|
||||
return CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC);
|
||||
}
|
||||
|
|
|
@ -489,8 +489,7 @@ void displayrooms(int snum, int smoothratio)
|
|||
newaspect_enable = 1;
|
||||
videoSetCorrectedAspect();
|
||||
|
||||
smoothratio = min(max(smoothratio, 0), 65536);
|
||||
if (!playrunning() || ps[snum].on_crane > -1) smoothratio = 65536;
|
||||
if (!playrunning() || ps[snum].on_crane > -1) smoothratio = MaxSmoothRatio;
|
||||
|
||||
sect = p->cursectnum;
|
||||
if (sect < 0 || sect >= MAXSECTORS) return;
|
||||
|
@ -594,7 +593,7 @@ void displayrooms(int snum, int smoothratio)
|
|||
cposy = p->posy;
|
||||
cposz = p->posz;
|
||||
sect = sprite[p->newowner].sectnum;
|
||||
smoothratio = 65536L;
|
||||
smoothratio = MaxSmoothRatio;
|
||||
}
|
||||
else if (p->over_shoulder_on == 0)
|
||||
{
|
||||
|
@ -660,7 +659,7 @@ void displayrooms(int snum, int smoothratio)
|
|||
|
||||
bool GameInterface::GenerateSavePic()
|
||||
{
|
||||
displayrooms(myconnectindex, 65536);
|
||||
displayrooms(myconnectindex, MaxSmoothRatio);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue