- address C++20 deprecation warnings with enums in floating point arithmetic.

This commit is contained in:
Christoph Oelckers 2021-11-02 23:31:09 +01:00
parent 59850fa768
commit 389f760d45
10 changed files with 13 additions and 18 deletions

View file

@ -207,7 +207,7 @@ static int32_t engineLoadTables(void)
int32_t i;
for (i=0; i<=512; i++)
sintable[i] = int(sin(i * BAngRadian) * SINTABLEUNIT);
sintable[i] = int(sin(i * BAngRadian) * +SINTABLEUNIT);
for (i=513; i<1024; i++)
sintable[i] = sintable[1024-i];
for (i=1024; i<2048; i++)

View file

@ -12,10 +12,7 @@ struct HWSkyPortal;
struct HWDrawInfo;
// 57 world units roughly represent one sky texel for the glTranslate call.
enum
{
skyoffsetfactor = 57
};
const int skyoffsetfactor = 57;
struct FSkyVertex
{

View file

@ -572,7 +572,7 @@ void FMultipatchTextureBuilder::ParsePatch(FScanner &sc, BuildInfo &info, TexPar
else if (sc.Compare("alpha"))
{
sc.MustGetFloat();
part.Alpha = clamp<blend_t>(int(sc.Float * BLENDUNIT), 0, BLENDUNIT);
part.Alpha = clamp<blend_t>(int(sc.Float * +BLENDUNIT), 0, BLENDUNIT);
// bComplex is not set because it is only needed when the style is not OP_COPY.
}
else if (sc.Compare("style"))

View file

@ -131,13 +131,13 @@ public:
binangle(const binangle &other) = default;
// This class intentionally makes no allowances for implicit type conversions because those would render it ineffective.
constexpr short asbuild() const { return value >> BAMBITS; }
constexpr double asbuildf() const { return value * (1. / BAMUNIT); }
constexpr double asbuildf() const { return value * (1. / +BAMUNIT); }
constexpr fixed_t asq16() const { return value >> 5; }
constexpr uint32_t asbam() const { return value; }
constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); }
constexpr double asdeg() const { return AngleToFloat(value); }
constexpr short signedbuild() const { return tosigned() >> BAMBITS; }
constexpr double signedbuildf() const { return tosigned() * (1. / BAMUNIT); }
constexpr double signedbuildf() const { return tosigned() * (1. / +BAMUNIT); }
constexpr fixed_t signedq16() const { return tosigned() >> 5; }
constexpr int32_t signedbam() const { return tosigned(); }
constexpr double signedrad() const { return tosigned() * (pi::pi() / 0x80000000u); }

View file

@ -65,7 +65,7 @@ CVAR(Bool, con_centernotify, false, CVAR_ARCHIVE)
CVAR(Bool, con_pulsetext, false, CVAR_ARCHIVE)
CVAR(Bool, con_notify_advanced, false, CVAR_ARCHIVE)
enum { NOTIFYFADETIME = 6 };
const int NOTIFYFADETIME = 6;
CUSTOM_CVAR(Int, con_notifylines, 4, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
{

View file

@ -209,10 +209,7 @@ void S_PauseSound(bool notmusic, bool notsfx);
void S_ResumeSound(bool notsfx);
void S_SetSoundPaused(int state);
enum
{
MaxSmoothRatio = FRACUNIT
};
const int MaxSmoothRatio = FRACUNIT;
FString G_GetDemoPath();

View file

@ -386,8 +386,8 @@ FNodeBuilder::FVertexMap::FVertexMap (FNodeBuilder &builder,
{
MinX = minx;
MinY = miny;
BlocksWide = int(((double(maxx) - minx + 1) + (BLOCK_SIZE - 1)) / BLOCK_SIZE);
BlocksTall = int(((double(maxy) - miny + 1) + (BLOCK_SIZE - 1)) / BLOCK_SIZE);
BlocksWide = int(((double(maxx) - minx + 1) + (BLOCK_SIZE - 1)) / +BLOCK_SIZE);
BlocksTall = int(((double(maxy) - miny + 1) + (BLOCK_SIZE - 1)) / +BLOCK_SIZE);
MaxX = MinX + fixed64_t(BlocksWide) * BLOCK_SIZE - 1;
MaxY = MinY + fixed64_t(BlocksTall) * BLOCK_SIZE - 1;
VertexGrid = new TArray<int>[BlocksWide * BlocksTall];

View file

@ -71,7 +71,7 @@ void displaymasks_r(int snum, int p, double smoothratio)
{
//int pin = 0;
// to get the proper clock value with regards to interpolation we have add a smoothratio based offset to the value.
double interpclock = PlayClock + (TICSPERFRAME/65536.) * smoothratio;
double interpclock = PlayClock + (+TICSPERFRAME/65536.) * smoothratio;
int pin = RS_STRETCH;
hud_drawsprite((320 - (tileWidth(SCUBAMASK) >> 1) - 15), (200 - (tileHeight(SCUBAMASK) >> 1) + bsinf(interpclock, -10)), 49152, 0, SCUBAMASK, 0, p, 2 + 16 + pin);
hud_drawsprite((320 - tileWidth(SCUBAMASK + 4)), (200 - tileHeight(SCUBAMASK + 4)), 65536, 0, SCUBAMASK + 4, 0, p, 2 + 16 + pin);

View file

@ -655,7 +655,7 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool
if (kbdLeft || kbdRight || p->moto_drink || hidInput->mouseturnx || hidInput->dyaw)
{
double const velScale = 6. / 19.;
auto const baseVel = !p->NotOnWater ? VEHICLETURN : VEHICLETURN * velScale;
auto const baseVel = !p->NotOnWater ? VEHICLETURN : +VEHICLETURN * velScale;
if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
{

View file

@ -113,10 +113,11 @@ float S_ConvertPitch(int lpitch)
enum
{
MAXLEVLDIST = 19000, // The higher the number, the further away you can hear sound
DECAY_CONST = 4000
};
const int MAXLEVLDIST = 19000; // The higher the number, the further away you can hear sound
short SoundDist(int x, int y, int z, int basedist)
{
double tx, ty, tz;