- change returned value for CalcSmoothRatio() from int to double and pass through to displayrest() for future use with displayweapon().

* `displayrooms()` ultimately should be adjusted as well. For now, just relying on integer truncation as this is just a proof of concept.

# Conflicts:
#	source/core/gamecontrol.cpp
#	source/core/gamecontrol.h
This commit is contained in:
Mitchell Richters 2020-08-02 14:28:07 +10:00 committed by Christoph Oelckers
parent 4301706e00
commit 0c12436092
5 changed files with 8 additions and 9 deletions

View file

@ -1038,10 +1038,9 @@ void S_SetSoundPaused(int state)
}
}
int CalcSmoothRatio(ClockTicks totalclk, ClockTicks ototalclk, int realgameticspersec)
double CalcSmoothRatio(ClockTicks totalclk, ClockTicks ototalclk, int realgameticspersec)
{
double ratio;
int result;
double ratio, result;
if (cl_debugintrpl)
{
@ -1075,11 +1074,11 @@ int CalcSmoothRatio(ClockTicks totalclk, ClockTicks ototalclk, int realgameticsp
ratio = (0.5 + (totalclk - ototalclk)) / (120 / realgameticspersec);
}
result = clamp(xs_CRoundToInt(ratio * MaxSmoothRatio), 0, MaxSmoothRatio);
result = fclamp2(ratio * MaxSmoothRatio, 0., MaxSmoothRatio);
if (cl_debugintrpl)
{
Printf("ratio: %f\nresult: %d\n", ratio, result);
Printf("ratio: %f\nresult: %f\n", ratio, result);
}
return result;

View file

@ -192,7 +192,7 @@ void S_ResumeSound(bool notsfx);
void S_SetSoundPaused(int state);
void G_FatalEngineError(void);
int CalcSmoothRatio(ClockTicks totalclk, ClockTicks ototalclk, int realgameticspersec);
double CalcSmoothRatio(ClockTicks totalclk, ClockTicks ototalclk, int realgameticspersec);
enum
{
MaxSmoothRatio = FRACUNIT

View file

@ -211,7 +211,7 @@ void dobonus(int bonusonly, const CompletionFunc& completion);
void dobonus_d(bool bonusonly, const CompletionFunc& completion);
void dobonus_r(bool bonusonly, const CompletionFunc& completion);
void displayrest(int32_t smoothratio);
void displayrest(double smoothratio);
void drawbackground(void);
void displayrooms(int32_t playerNum, int32_t smoothratio);
void setgamepalette(int palid);

View file

@ -234,7 +234,7 @@ void V_AddBlend (float r, float g, float b, float a, float v_blend[4])
//
//---------------------------------------------------------------------------
void displayrest(int smoothratio)
void displayrest(double smoothratio)
{
int i, j;
unsigned char fader = 0, fadeg = 0, fadeb = 0, fadef = 0, tintr = 0, tintg = 0, tintb = 0, tintf = 0, dotint = 0;

View file

@ -342,7 +342,7 @@ bool GameTicker()
{
ototalclock = totalclock - 1;
}
int const smoothRatio = calc_smoothratio(totalclock, ototalclock);
double const smoothRatio = calc_smoothratio(totalclock, ototalclock);
gameupdatetime.Unclock();