- C++20 constant fixes.

Use of enums is deprecated in floating point calculations.
This commit is contained in:
Christoph Oelckers 2023-01-21 10:26:07 +01:00
parent 8ce61255e9
commit 81f6899e72
5 changed files with 17 additions and 14 deletions

View file

@ -36,11 +36,13 @@ enum
kGenDudeTransformStatus = -222, kGenDudeTransformStatus = -222,
kGenDudeUpdTimeRate = 10, kGenDudeUpdTimeRate = 10,
kGenDudeMaxMeleeDist = 2048, kGenDudeMaxMeleeDist = 2048,
kGenDudeMaxMeleeDistf = 128,
kGenDudeMinDispesion = 200, kGenDudeMinDispesion = 200,
kGenDudeMaxDispersion = 3500, kGenDudeMaxDispersion = 3500,
}; };
constexpr double kGenDudeMaxMeleeDistf = 128;
enum { enum {
kGenDudeSeqIdleL = 0, kGenDudeSeqIdleL = 0,
kGenDudeSeqDeathDefault = 1, kGenDudeSeqDeathDefault = 1,

View file

@ -67,14 +67,14 @@ enum
kModernTypeFlag64 = 0x0040, kModernTypeFlag64 = 0x0040,
kMaxRandomizeRetries = 16, kMaxRandomizeRetries = 16,
kPercFull = 100,
kCondRange = 100, kCondRange = 100,
}; };
constexpr int kPercFull = 100;
enum enum
{ {
kPatrolStateSize = 42, kPatrolStateSize = 42,
kPatrolAlarmSeeDistSq = 625*625,
kPatrolAlarmHearDist = 10000, kPatrolAlarmHearDist = 10000,
kMaxPatrolSpotValue = 500, kMaxPatrolSpotValue = 500,
kMinPatrolTurnDelay = 8, kMinPatrolTurnDelay = 8,
@ -83,7 +83,6 @@ enum
kDudeFlagStealth = 0x0001, kDudeFlagStealth = 0x0001,
kDudeFlagCrouch = 0x0002, kDudeFlagCrouch = 0x0002,
kSlopeDist = 0x20,
kEffectGenCallbackBase = 200, kEffectGenCallbackBase = 200,
kTriggerSpriteScreen = 0x0001, kTriggerSpriteScreen = 0x0001,
kTriggerSpriteAim = 0x0002, kTriggerSpriteAim = 0x0002,
@ -92,6 +91,8 @@ enum
kMaxAllowedPowerup = kMaxPowerUps kMaxAllowedPowerup = kMaxPowerUps
}; };
constexpr double kPatrolAlarmSeeDistSq = 625 * 625;
constexpr double kSlopeDist = 0x20;
constexpr double kMaxPatrolVelocity = FixedToFloat(500000); // ~7.63 constexpr double kMaxPatrolVelocity = FixedToFloat(500000); // ~7.63
constexpr double kMaxPatrolCrouchVelocity = (kMaxPatrolVelocity / 2); constexpr double kMaxPatrolCrouchVelocity = (kMaxPatrolVelocity / 2);

View file

@ -4,12 +4,10 @@
// all game constants got collected here. // all game constants got collected here.
enum constexpr int TICRATE = 120;
{ constexpr int REALGAMETICSPERSEC = 30; // The number of game state updates per second:
TICRATE = 120, constexpr int TICSPERFRAME = (TICRATE / REALGAMETICSPERSEC); // (This used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated to 4 by integer division.)
REALGAMETICSPERSEC = 30, // The number of game state updates per second:
TICSPERFRAME = (TICRATE/REALGAMETICSPERSEC) // (This used to be TICRATE/GAMETICSPERSEC, which was 120/26 = 4.615~ truncated to 4 by integer division.)
};
// tile names which are identical for all games. // tile names which are identical for all games.
enum enum

View file

@ -228,7 +228,7 @@ double hitawall(player_struct* p, walltype** hitw)
DDukeActor* aim(DDukeActor* actor, int abase) DDukeActor* aim(DDukeActor* actor, int abase)
{ {
DAngle aang = DAngle90 * (AUTO_AIM_ANGLE / 512.); DAngle aang = DAngle90 * (+AUTO_AIM_ANGLE / 512.);
bool gotshrinker, gotfreezer; bool gotshrinker, gotfreezer;
static const int aimstats[] = { STAT_PLAYER, STAT_DUMMYPLAYER, STAT_ACTOR, STAT_ZOMBIEACTOR }; static const int aimstats[] = { STAT_PLAYER, STAT_DUMMYPLAYER, STAT_ACTOR, STAT_ZOMBIEACTOR };

View file

@ -1521,9 +1521,6 @@ extern int lockspeed;
// Various scattered constants // Various scattered constants
enum enum
{ {
synctics = 3,
ACTORMOVETICS = (synctics << 1),
TICSPERMOVEMENT = synctics,
ACTOR_GRAVITY = 8, ACTOR_GRAVITY = 8,
// subtract value from clipdist on getzrange calls // subtract value from clipdist on getzrange calls
STAT_DAMAGE_LIST_SIZE = 20, STAT_DAMAGE_LIST_SIZE = 20,
@ -1535,6 +1532,11 @@ enum
}; };
constexpr int synctics = 3;
constexpr int ACTORMOVETICS = (synctics << 1);
constexpr int TICSPERMOVEMENT = synctics;
constexpr double GETZRANGE_CLIP_ADJ = 0.5; constexpr double GETZRANGE_CLIP_ADJ = 0.5;