Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(gameengine): run game logic at 60 ticks a second
Olcay Seygan42c662c0104e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 655d25a76..4637d7aa9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,12 @@ found and fixed — EA's own, not port damage.**---+## The battle runs at 60 steps a second++- The game now works out the battle 60 times a second, double the 30 Zero Hour has run at since 2003. Each step is 17 milliseconds where it was 33, so an order you give waits half as long for the step that carries it out, and a unit turning, braking or firing moves in steps half the size.+- The match plays at the speed it always did. Every speed, delay, reload and build time in the game's data was converted to the shorter step, so a Crusader still fires every two seconds and the game speed setting means what it did. The balance is the one you know.+- Replays and saved games from earlier versions will not load in this one. A player on an earlier version cannot join a match with a player on this version, whichever of them hosts, so a LAN party needs everyone on the same build.+## Zero Hour on a Mac, on Linux and on the Steam Deck- The game runs on Apple silicon Macs and on Linux, the Steam Deck included, as a program built for that machine. There is no Wine or Proton underneath. It draws through Metal on a Mac and through Vulkan on Linux, from the same Zero Hour files you already own.diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.hindex e9ead4551..6ba54d93d 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameCommon.h@@ -60,6 +60,7 @@// ----------------------------------------------------------------------------------------------#include "Lib/BaseType.h"+#include <limits.h>// ----------------------------------------------------------------------------------------------#if defined(_INTERNAL) || defined(_DEBUG)@@ -71,7 +72,8 @@// ----------------------------------------------------------------------------------------------enum{- LOGICFRAMES_PER_SECOND = 30,+ LOGICFRAMES_PER_SECOND = 60,+ RETAIL_LOGICFRAMES_PER_SECOND = 30, ///< the rate every hard-coded frame count and per-frame amount in EA's code and data was written forMSEC_PER_SECOND = 1000};const Real LOGICFRAMES_PER_MSEC_REAL = (((Real)LOGICFRAMES_PER_SECOND) / ((Real)MSEC_PER_SECOND));@@ -79,6 +81,32 @@ const Real MSEC_PER_LOGICFRAME_REAL = (((Real)MSEC_PER_SECOND) / ((Real)LOGICFRAconst Real LOGICFRAMES_PER_SECONDS_REAL = (Real)LOGICFRAMES_PER_SECOND;const Real SECONDS_PER_LOGICFRAME_REAL = 1.0f / LOGICFRAMES_PER_SECONDS_REAL;+// ----------------------------------------------------------------------------------------------+// Logic runs at twice the retail rate. A frame count written for 30 Hz is doubled, an amount added+// every frame is halved, an acceleration quartered, and a factor multiplied in every frame becomes+// its square root. Every one of those is exact in IEEE arithmetic (sqrt included), so all machines+// agree; the factor conversion is only exact because the ratio is 2, hence the assert.+enum { LOGICFRAMES_PER_RETAIL_FRAME = LOGICFRAMES_PER_SECOND / RETAIL_LOGICFRAMES_PER_SECOND };+static_assert( LOGICFRAMES_PER_SECOND == 2 * RETAIL_LOGICFRAMES_PER_SECOND, "the Retail conversions assume logic runs at exactly twice the retail rate" );++// a frame count past half the type's range is a sentinel (a "never" or "forever"), and stays one+constexpr Int ConvertRetailFrames( Int frames )+{+ if( frames > INT_MAX / LOGICFRAMES_PER_RETAIL_FRAME ) return INT_MAX;+ if( frames < INT_MIN / LOGICFRAMES_PER_RETAIL_FRAME ) return INT_MIN;+ return frames * LOGICFRAMES_PER_RETAIL_FRAME;+}+constexpr UnsignedInt ConvertRetailFrames( UnsignedInt frames )+{+ if( frames > UINT_MAX / LOGICFRAMES_PER_RETAIL_FRAME ) return UINT_MAX;+ return frames * LOGICFRAMES_PER_RETAIL_FRAME;+}+constexpr Real ConvertRetailFrames( Real frames ) { return frames * (Real)LOGICFRAMES_PER_RETAIL_FRAME; }++constexpr Real ConvertRetailPerFrameRate( Real perFrame ) { return perFrame * 0.5f; }+constexpr Real ConvertRetailPerFrameSquared( Real perFrameSqr ) { return perFrameSqr * 0.25f; }+inline Real ConvertRetailPerFrameFactor( Real factor ) { return sqrtf( factor > 0.0f ? factor : 0.0f ); }+// ----------------------------------------------------------------------------------------------// note that this returns a REAL value, not an int... most callers will want to// call ceil() on the result, so that partial frames get converted to full frames!diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.hindex c2a988a0f..54b31f113 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h@@ -36,7 +36,7 @@#include "Common/SubsystemInterface.h"#include "Common/GameType.h"-#define DEFAULT_MAX_FPS 45+#define DEFAULT_MAX_FPS 90 // retail 45: one and a half times normal speed, in 60 Hz logic frames/** How much wall-clock debt the pacer will carry and pay back. A render pass slower than onelogic frame owes the simulation more than one tick; without a catch-up the game speed just@@ -61,7 +61,7 @@ Real GameEngine_logicTickFraction( void );/** -video and -directorrecord: whether the logic frame is one a range records. -recordfps drawsGameEngine_videoPictures() pictures of each of those, and the logic runs after the last; the coming- draw is picture GameEngine_videoPicture() of them, 0 first. 1 and 0 outside a range, and at 30.+ draw is picture GameEngine_videoPicture() of them, 0 first. 1 and 0 outside a range, and at LOGICFRAMES_PER_SECOND.The last picture shows the logic frame, and each one before it is that share of a frame earlier: itsblend fraction is (picture + 1) / pictures, and GameEngine_pictureFrame is its time in logic frames,what an animation drawn for footage runs on instead of the wall clock. GameEngine_pictureMilliseconds@@ -71,7 +71,7 @@ Bool GameEngine_isVideoFrame( void );Int GameEngine_videoPictures( void );/** The pictures of this logic frame or of the next one are blends, so smooth motion has to see this one. */Bool GameEngine_videoBlends( void );-/** What the movie is told: -recordfps, or 30 where it does not apply (a network game, -headless). */+/** What the movie is told: -recordfps, or LOGICFRAMES_PER_SECOND where it does not apply (a network game, -headless). */Int GameEngine_videoFramesPerSecond( void );Int GameEngine_videoPicture( void );Real GameEngine_pictureFrame( void );diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.hindex b234b4564..f56732819 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h@@ -478,7 +478,7 @@ public:Int m_videoStartFrame; ///< -video <from> <to> [name]: the first logic frame recordedInt m_videoEndFrame; ///< -video: the last logic frame recorded (0 = no video)AsciiString m_videoName; ///< -video: the recording is Videos\<name>.mp4 next to the save games- Int m_videoPictures; ///< -recordfps <n>: pictures recorded of each logic frame, n over LOGICFRAMES_PER_SECOND (1 = 30 fps)+ Int m_videoPictures; ///< -recordfps <n>: pictures recorded of each logic frame, n over LOGICFRAMES_PER_SECOND (1 = a picture a logic frame)Bool m_directorRecord; ///< -directorrecord [name]: the director films the whole match, split for two fights, and the run quits at its endAsciiString m_directorScoutFile; ///< -directorscout <file>: -directorrecord's first pass, headless, writes the match's fights and special powers hereAsciiString m_directorTimelineFile; ///< -directortimeline <file>: what the first pass wrote, which the filming pass reads to arrive before each fightdiff --git a/GeneralsMD/Code/GameEngine/Include/Common/INI.h b/GeneralsMD/Code/GameEngine/Include/Common/INI.hindex 35ebdb82b..3127d6b8b 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/INI.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/INI.h@@ -402,6 +402,12 @@ public:static void parseVelocityReal( INI *ini, void *instance, void *store, const void* userData );// parse acceleration in (dist/sec^2) and convert to (dist/frame^2)static void parseAccelerationReal( INI *ini, void *instance, void *store, const void* userData );+ // parse a count of retail (30 Hz) frames, or a per-retail-frame amount or factor, into current frames (GameCommon.h)+ static void parseRetailFramesUnsignedInt( INI *ini, void *instance, void *store, const void* userData );+ static void parseRetailFramesInt( INI *ini, void *instance, void *store, const void* userData );+ static void parseRetailFramesReal( INI *ini, void *instance, void *store, const void* userData );+ static void parseRetailPerFrameReal( INI *ini, void *instance, void *store, const void* userData );+ static void parseRetailPerFrameFactorReal( INI *ini, void *instance, void *store, const void* userData );// parse angle in degrees and convert to radiansstatic void parseAngleReal( INI *ini, void *instance, void *store, const void *userData );// note that this parses in degrees/sec, and converts to rads/frame!diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.hindex d47958aaa..15c2339c4 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h@@ -66,9 +66,10 @@ enum BodyDamageType : Int;#define DIRTY_CONDITION_FLAGS#define DEFAULT_TINT_COLOR_FADE_RATE (0.6f) // fast fade-#define DEF_ATTACK_FRAMES (1)-#define DEF_SUSTAIN_FRAMES (1)-#define DEF_DECAY_FRAMES (4)+// logic frames; the retail 1, 1 and 4 at twice the rate+#define DEF_ATTACK_FRAMES (1 * LOGICFRAMES_PER_RETAIL_FRAME)+#define DEF_SUSTAIN_FRAMES (1 * LOGICFRAMES_PER_RETAIL_FRAME)+#define DEF_DECAY_FRAMES (4 * LOGICFRAMES_PER_RETAIL_FRAME)#define SUSTAIN_INDEFINITELY (0xfffffffe) // forever and ever, amen.//@@ -187,11 +188,14 @@ public:Real m_wobble; ///< for wobblingReal m_yawModulator; ///< for the swimmy soft hover of a helicopterReal m_pitchModulator; ///< for the swimmy soft hover of a helicopter- Real m_leanPitch[2]; ///< a helicopter's pitch target, smoothed through two stages once a logic frame+ Real m_leanPitch[2]; ///< a helicopter's pitch target, smoothed through two stages once a retail frameReal m_leanRoll[2]; ///< the same for roll- UnsignedInt m_leanFrame; ///< the logic frame the lean targets were last stepped on- Real m_groundLeanStages[2][3]; ///< a ground vehicle's pitch and roll lean, smoothed through three stages once a logic frame- UnsignedInt m_groundFrame; ///< the logic frame those were last stepped on+ UnsignedInt m_airFrame; ///< the retail frame (logic frame / LOGICFRAMES_PER_RETAIL_FRAME) hover, wings or thrust last stepped on+ Real m_airPitch; ///< hover or wings pitch, roll and yaw from that frame, drawn until the next one+ Real m_airRoll;+ Real m_airYaw;+ Real m_groundLeanStages[2][3]; ///< a ground vehicle's pitch and roll lean, smoothed through three stages once a retail frame+ UnsignedInt m_groundFrame; ///< the retail frame (logic frame / LOGICFRAMES_PER_RETAIL_FRAME) those were last stepped onReal m_prevForwardSpeed; ///< a ground vehicle's forward speed on that frameReal m_prevAngle; ///< and its headingReal m_groundLeanPitch; ///< a ground vehicle's lean from starting, braking and turning, on top of terrain and recoil@@ -372,7 +376,7 @@ public:void setTerrainDecal(TerrainDecalType type); ///<decal that is to appear under the drawablevoid setTerrainDecalSize(Real x, Real y);- void setTerrainDecalFadeTarget(Real target, Real rate = 0.1f);+ void setTerrainDecalFadeTarget(Real target, Real rate = ConvertRetailPerFrameRate(0.1f)); ///< rate is opacity per logic frameinline Object *getObject( void ) { return m_object; } ///< return object ID bound to this drawbleinline const Object *getObject( void ) const { return m_object; } ///< return object ID bound to this drawblediff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.hindex e2247aaad..a3adb17fe 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h@@ -787,7 +787,7 @@ public: // ********************************************************************// first structure really does exist by the time the second order arrives.//enum { PENDING_PLACEMENTS = 64 }; ///< orders in flight at once, a whole shift-dragged row among them; the oldest is overwritten- enum { PENDING_PLACEMENT_FRAMES = 60 }; ///< logic frames one is remembered for - two seconds,+ enum { PENDING_PLACEMENT_FRAMES = LOGICFRAMES_PER_SECOND * 2 }; ///< logic frames one is remembered for - two seconds,/// comfortably longer than any network delay/// the ground a structure stands on: its box with the bib, turned to its heading@@ -1237,7 +1237,8 @@ protected:UnsignedInt blockBeginFrame; ///< The frame at which the block started it's current stateICoord2D blockPos; ///< where the upper left of the block should beginUnsignedInt incrementOnFrame; ///< if we're currently on a frame greater then this, increment our position- Color color; ///< what color should we display the military subtitles+ UnsignedInt fadeStep; ///< retail frames past its lifetime when the fade was last applied+ Color color; ///< what color should we display the military subtitles};typedef std::list<Object *> ObjectList;@@ -1409,7 +1410,7 @@ protected:Color color;};ClassicMessage m_classicMessages[ CLASSIC_MESSAGES ]; ///< newest first- UnsignedInt m_classicMessageFadeFrame; ///< the last logic frame the fade was stepped on+ UnsignedInt m_classicMessageFadeFrame; ///< the last retail 30 Hz frame the fade was stepped onvoid addClassicMessage( const UnicodeString &text, const Color *color );void fadeClassicMessages( void );void drawClassicMessages( void );diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.hindex 111f27ec8..23829b38b 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h@@ -263,7 +263,7 @@ protected:virtual void loadPostProcess();protected:- enum {MAX_CPOP=20}; ///< Max times we will return the cached cpop.+ enum {MAX_CPOP=20 * LOGICFRAMES_PER_RETAIL_FRAME}; ///< Max times we will return the cached cpop (about once a frame, so two thirds of a second).MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Path, "PathPool" ); ///< @todo Set real numbers for mem allocPathNode* m_path; ///< The list of PathNode objects that define the path@@ -711,23 +711,23 @@ enumPF_WALLHUG_DEN = 5,PF_TRAFFIC_MAX = 255,- PF_TRAFFIC_DEPOSIT = 24, ///< one blocked unit-frame, at the centre cell+ PF_TRAFFIC_DEPOSIT = 24 / LOGICFRAMES_PER_RETAIL_FRAME, ///< one blocked unit-frame, at the centre cell; 24 a retail frame, so the same per secondPF_TRAFFIC_DECAY_NUM = 54, ///< x54/64 every decay tick ~ the sandbox's x0.85 per 0.1sPF_TRAFFIC_DECAY_DEN = 64,- PF_TRAFFIC_DECAY_FRAMES = 3,+ PF_TRAFFIC_DECAY_FRAMES = 3 * LOGICFRAMES_PER_RETAIL_FRAME, ///< a tenth of a secondPF_TRAFFIC_FULL = 192, ///< traffic at or above this is as expensive as it getsPF_TRAFFIC_NUM = 4, ///< peak traffic penalty is NUM/DEN of a step - the sandbox's traffic weightPF_TRAFFIC_DEN = 1,PF_TRAFFIC_CELLS = 4096, ///< live traffic cells tracked; past this, deposits are dropped- PF_CLAIM_BUCKET_FRAMES = 15, ///< half a second+ PF_CLAIM_BUCKET_FRAMES = LOGICFRAMES_PER_SECOND / 2, ///< half a secondPF_CLAIM_BUCKETS = 24, ///< twelve seconds of horizon- PF_CLAIM_REFRESH_FRAMES = 30, ///< a unit re-stamps its plan once a second+ PF_CLAIM_REFRESH_FRAMES = LOGICFRAMES_PER_SECOND, ///< a unit re-stamps its plan once a secondPF_CLAIM_TABLE_SIZE = 32768, ///< power of two: the hash is masked, not dividedPF_CLAIM_PROBES = 8, ///< linear probe depth; past it a claim is simply droppedPF_CLAIM_UNITS_MAX = 4, ///< claims beyond this on one cell-moment cost nothing morePF_CLAIM_SAMPLES_MAX = 32, ///< cells of its own plan one unit may stamp per refresh; 64 was 5% of a 530-unit battle- PF_CLEARANCE_REBUILD_FRAMES = 30, ///< how often a dirty clearance field is actually rebuilt+ PF_CLEARANCE_REBUILD_FRAMES = LOGICFRAMES_PER_SECOND, ///< how often a dirty clearance field is actually rebuiltPF_CROSSING_NUM = 1, ///< peak crossing penalty is NUM/DEN of a stepPF_CROSSING_DEN = 2,@@ -771,7 +771,7 @@ enumit when it arrives, and a group ordered onto one point spreads out instead of gathering onit - which is what the ramp looked like in game. */PF_LANE_CLOSE_CELLS = 3,- PF_LANE_HOLD_FRAMES = 45 ///< a second and a half at 30 logic frames+ PF_LANE_HOLD_FRAMES = 3 * LOGICFRAMES_PER_SECOND / 2 ///< a second and a half};/** How much extra a step into a cell with this clearance costs a body needing `needClearance`.diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.hindex dd107f616..1a18dcd64 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AIStateMachine.h@@ -296,7 +296,7 @@ protected:virtual void loadPostProcess();private:- enum { MIN_REPATH_TIME = 10 }; ///< minimum # of frames must elapse before re-pathing+ enum { MIN_REPATH_TIME = 10 * LOGICFRAMES_PER_RETAIL_FRAME }; ///< minimum # of frames must elapse before re-pathingprotected:Coord3D m_goalPosition; ///< the goal position to move toPathfindLayerEnum m_goalLayer; ///< The layer we are moving towards.@@ -478,7 +478,7 @@ protected:private:- enum { MIN_RECOMPUTE_TIME = 10 };+ enum { MIN_RECOMPUTE_TIME = 10 * LOGICFRAMES_PER_RETAIL_FRAME };StateReturnType updateInternal( void );@@ -527,7 +527,7 @@ protected:private:- enum { MIN_RECOMPUTE_TIME = 10 };+ enum { MIN_RECOMPUTE_TIME = 10 * LOGICFRAMES_PER_RETAIL_FRAME };StateReturnType updateInternal( void );@@ -595,11 +595,11 @@ protected:enum {ATTACK_RETRY_COUNT=5};enum {ATTACK_CLOSE_ENOUGH_CELLS=8};- enum {ATTACK_MOVE_SCAN_RATE=10}; ///< frames between target scans (the idle mood clock is seconds apart)+ enum {ATTACK_MOVE_SCAN_RATE=LOGICFRAMES_PER_SECOND/3}; ///< frames between target scans (the idle mood clock is seconds apart)enum {ATTACK_MOVE_LEASH_CELLS=12}; ///< how far a victim may pull us off the attack move- enum {ATTACK_MOVE_DUD_ENGAGE_FRAMES=15}; ///< a fight shorter than this, with the victim still alive, never started- enum {ATTACK_MOVE_REACQUIRE_DELAY=30}; ///< frames of pure movement after a dud fight or a broken leash- enum {ATTACK_MOVE_RETALIATE_FRAMES=30}; ///< how recently we must have been hit to turn on whoever hit us+ enum {ATTACK_MOVE_DUD_ENGAGE_FRAMES=LOGICFRAMES_PER_SECOND/2}; ///< a fight shorter than this, with the victim still alive, never started+ enum {ATTACK_MOVE_REACQUIRE_DELAY=LOGICFRAMES_PER_SECOND}; ///< frames of pure movement after a dud fight or a broken leash+ enum {ATTACK_MOVE_RETALIATE_FRAMES=LOGICFRAMES_PER_SECOND}; ///< how recently we must have been hit to turn on whoever hit usvoid startEngaging( Object *victim, Bool allowChase ); ///< stop here and hand the victim to the attack sub-machinevoid stopEngaging( void ); ///< the fight is over; put back what startEngaging changeddiff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/CRCSnapshotRing.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/CRCSnapshotRing.hindex c20e29f7d..b3ca6df19 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/CRCSnapshotRing.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/CRCSnapshotRing.h@@ -35,7 +35,7 @@of the last few CRC frames. Nothing reads the ring unless a mismatch is found, and then thefirst object whose running CRC differs between two players' dumps is the object that diverged. */-#define CRC_SNAPSHOT_RING_SIZE 16+#define CRC_SNAPSHOT_RING_SIZE 32 // 16 at 30 Hz logic; the run-ahead doubles in frames at 60 Hzstruct CRCObjectEntry{diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/CrowdModel.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/CrowdModel.hindex 5e2bcab28..16dadb847 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/CrowdModel.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/CrowdModel.h@@ -62,7 +62,7 @@ enumCROWD_MAX_SAMPLES = 160,/// a lane taken to get round somebody is held this long, so it cannot flap side to side- CROWD_HOLD_FRAMES = 45,+ CROWD_HOLD_FRAMES = 3 * LOGICFRAMES_PER_SECOND / 2,/* How many samples either side of a bridge are held to the deck's width, so the approach funnelsin. Six cells and not four: a unit that is still a lane wide of the deck when the band shutsdiff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.hindex 190e7e682..5f021504c 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h@@ -792,7 +792,7 @@ public:inline Bool getRetryPath(void) {return m_retryPath;}inline Bool didPathfindFindNothing(void) const {return m_pathfindFoundNothing;}void queueForPathOrRetry(void); ///< join the pathfind queue, or try again shortly when it is full- Int repathDebounceFrames(void) const {return (Int)(m_pathTimestamp + 3 - TheGameLogic->getFrame());} ///< what is left of the three frames a new path waits after the last one+ Int repathDebounceFrames(void) const {return (Int)(m_pathTimestamp + ConvertRetailFrames(3) - TheGameLogic->getFrame());} ///< what is left of the tenth of a second a new path waits after the last oneUnsignedInt getQueueForPathFrame(void) const {return m_queueForPathFrame;} ///< nonzero while a too-quick path request is held backinline void setAllowedToChase( Bool allow ) { m_allowedToChase = allow; }diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.hindex cc7600c0f..2255b2962 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h@@ -76,8 +76,12 @@ protected:virtual Bool shouldFireWeapon();private:+ // "never": far enough back that the first contact, on any frame, fires+ static const UnsignedInt NEVER_FIRED = 0u - LOGICFRAMES_PER_RETAIL_FRAME;+Weapon* m_collideWeapon;Bool m_everFired;+ UnsignedInt m_lastFireFrame; ///< logic frame of the last shot};diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GrantStealthBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GrantStealthBehavior.hindex 9bcec0844..cc273fa4e 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GrantStealthBehavior.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/GrantStealthBehavior.h@@ -60,7 +60,7 @@ public:{m_finalRadius = 200.0f;m_startRadius = 0.0f;- m_radiusGrowRate = 10.0f;+ m_radiusGrowRate = ConvertRetailPerFrameRate(10.0f);m_radiusParticleSystemTmpl = NULL;SET_ALL_KINDOFMASK_BITS( m_kindOf );}@@ -73,7 +73,7 @@ public:{{ "StartRadius", INI::parseReal, NULL, offsetof( GrantStealthBehaviorModuleData, m_startRadius ) },{ "FinalRadius", INI::parseReal, NULL, offsetof( GrantStealthBehaviorModuleData, m_finalRadius ) },- { "RadiusGrowRate", INI::parseReal, NULL, offsetof( GrantStealthBehaviorModuleData, m_radiusGrowRate ) },+ { "RadiusGrowRate", INI::parseRetailPerFrameReal, NULL, offsetof( GrantStealthBehaviorModuleData, m_radiusGrowRate ) },{ "KindOf", KindOfMaskType::parseFromINI, NULL, offsetof( GrantStealthBehaviorModuleData, m_kindOf ) },{ "RadiusParticleSystemName", INI::parseParticleSystemTemplate, NULL, offsetof( GrantStealthBehaviorModuleData, m_radiusParticleSystemTmpl ) },{ 0, 0, 0, 0 }diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.hindex 2044f8e02..cd7dbc8ea 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h@@ -174,6 +174,7 @@ public:// note that, unlike scrubVelocity2D(), this is a signed limitvoid scrubVelocityZ( Real desiredVelocity );+ /// radians a frame at the current logic rate (a retail figure goes through ConvertRetailPerFrameRate)void setPitchRate(Real pitch);void setRollRate(Real roll);void setYawRate(Real yaw);@@ -205,6 +206,7 @@ public:Bool getIsStunned() const { return getFlag(IS_STUNNED); }void setExtraBounciness(Real b) { m_extraBounciness = b; }+ /// added to every friction as a share of speed lost per retail (30 Hz) frame: per second / RETAIL_LOGICFRAMES_PER_SECONDvoid setExtraFriction(Real b) { m_extraFriction = b; }void setBounceSound(const AudioEventRTS* bounceSound);diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.hindex e02d2c109..c573eb312 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h@@ -62,16 +62,17 @@ public:{ "BigMetalBounceSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_bigMetalImpactDefaultSound) },{ "SmallMetalBounceSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_smallMetalImpactDefaultSound) },{ "MeatyBounceSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_meatyImpactDefaultSound) },- { "RunningGarrisonSpeedMax", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_runningGarrisonSpeedMax) },- { "KillSpeedMin", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_killSpeedMin) },- { "SpeedMax", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_speedMax) },- { "Acceleration", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_acceleration) },- { "Braking", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_braking) },+ // speeds are distance per frame, and the three multipliers below are applied to the speed every frame+ { "RunningGarrisonSpeedMax", INI::parseRetailPerFrameReal, NULL, offsetof( RailroadBehaviorModuleData, m_runningGarrisonSpeedMax) },+ { "KillSpeedMin", INI::parseRetailPerFrameReal, NULL, offsetof( RailroadBehaviorModuleData, m_killSpeedMin) },+ { "SpeedMax", INI::parseRetailPerFrameReal, NULL, offsetof( RailroadBehaviorModuleData, m_speedMax) },+ { "Acceleration", INI::parseRetailPerFrameFactorReal, NULL, offsetof( RailroadBehaviorModuleData, m_acceleration) },+ { "Braking", INI::parseRetailPerFrameFactorReal, NULL, offsetof( RailroadBehaviorModuleData, m_braking) },{ "WaitAtStationTime", INI::parseDurationUnsignedInt, NULL, offsetof( RailroadBehaviorModuleData, m_waitAtStationTime) },{ "RunningSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_runningSound) },{ "ClicketyClackSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_clicketyClackSound) },{ "WhistleSound", INI::parseAudioEventRTS, NULL, offsetof( RailroadBehaviorModuleData, m_whistleSound) },- { "Friction", INI::parseReal, NULL, offsetof( RailroadBehaviorModuleData, m_friction) },+ { "Friction", INI::parseRetailPerFrameFactorReal, NULL, offsetof( RailroadBehaviorModuleData, m_friction) },{ 0, 0, 0, 0 }};diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SmartBombTargetHomingUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SmartBombTargetHomingUpdate.hindex 6cbdebe97..86ce84251 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SmartBombTargetHomingUpdate.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SmartBombTargetHomingUpdate.h@@ -43,7 +43,7 @@ public:SmartBombTargetHomingUpdateModuleData(){- m_courseCorrectionScalar = 0.99f;+ m_courseCorrectionScalar = ConvertRetailPerFrameFactor( 0.99f );}static void buildFieldParse(MultiIniFieldParse& p)@@ -51,7 +51,7 @@ public:UpdateModuleData::buildFieldParse(p);static const FieldParse dataFieldParse[] ={- { "CourseCorrectionScalar", INI::parseReal, NULL, offsetof( SmartBombTargetHomingUpdateModuleData, m_courseCorrectionScalar ) },+ { "CourseCorrectionScalar", INI::parseRetailPerFrameFactorReal, NULL, offsetof( SmartBombTargetHomingUpdateModuleData, m_courseCorrectionScalar ) },{ 0, 0, 0, 0 }};p.add(dataFieldParse);diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.hindex ca3b763f3..e6eefbbab 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StructureCollapseUpdate.h@@ -78,8 +78,8 @@ public:{m_minCollapseDelay = 0;m_maxCollapseDelay = 0;- m_minBurstDelay = 9999;- m_maxBurstDelay = 9999;+ m_minBurstDelay = ConvertRetailFrames( 9999 );+ m_maxBurstDelay = ConvertRetailFrames( 9999 );m_maxShudder = 0;m_collapseDamping = 0.0;m_bigBurstFrequency = 0;diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyTruckAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyTruckAIUpdate.hindex cc3fb5d93..965594c2f 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyTruckAIUpdate.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyTruckAIUpdate.h@@ -66,10 +66,10 @@ inline Bool supplyDockHasNextBox( Int stockLeft, Int dockerBoxes, Int dockerMax* spot is, and that spot is the clear ground nearest the building on the worker's side. A stash* built at the legal limit leaves a gap about 24 feet wide beside the pile, and a worker standing* in it is on both approach spots at once: it loaded and unloaded without taking a step, a box- * every 15 frames where a worker that walks the same gap needs 37 or more. 37 frames is that- * shortest walked leg, so the floor only ever catches a worker that did not walk. */+ * every 15 frames where a worker that walks the same gap needs 37 or more (30 Hz frames). 37 is+ * that shortest walked leg, so the floor only ever catches a worker that did not walk. *///--------------------------------------------------------------------------------------------------enum { SUPPLY_DOCK_MIN_LEG_FRAMES = 37 };+enum { SUPPLY_DOCK_MIN_LEG_FRAMES = ConvertRetailFrames( 37 ) };inline UnsignedInt supplyDockLegDelay( UnsignedInt dockDelay, UnsignedInt now, UnsignedInt lastActionFrame ){diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/CushionMetrics.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/CushionMetrics.hindex b8f9825f7..fae10660c 100644--- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/CushionMetrics.h+++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/CushionMetrics.h@@ -60,8 +60,9 @@ enumpercentage of is small: MIN_RUNAHEAD is four frames, and computeRunAhead only clears that onlinks slower than about 240 ms round trip. Ten percent of four is nothing, and a brake thatengages with less than a frame of margin left is not a brake, it is the stall it was meant- to prevent. Two frames is 66 ms at 30 Hz. */- SELFSLUG_MIN_THRESHOLD_FRAMES = 2,+ to prevent. Two frames was 66 ms at 30 Hz; logic runs at 60 now, so the same 66 ms is four.+ Every frame count in this enum is doubled from its 30 Hz value for that reason. */+ SELFSLUG_MIN_THRESHOLD_FRAMES = 4,/* The fixed part of the run-ahead's safety margin. The transit term computeRunAhead sizes thewindow from is built out of *average* round trips, and an average is exceeded half the time;@@ -74,11 +75,12 @@ enumThree since the router stopped being counted as a leg of the trip (roomLatencySum). Thewindow that came out of that was the honest one, and at 200 to 300 ms of ping with 30 to 60 msof jitter two frames of allowance let the tail through: two players at 200 ms fell from 29- logic frames a second to 26 on a 5-frame window. A LAN still sits on MIN_RUNAHEAD. */- RUNAHEAD_JITTER_FRAMES = 3,+ logic frames a second to 26 on a 5-frame window. A LAN still sits on MIN_RUNAHEAD. Three+ 30 Hz frames, 100 ms, is six at 60. */+ RUNAHEAD_JITTER_FRAMES = 6,- /* The room never runs slower than this, whatever the metrics say. */- ROOM_FRAME_RATE_FLOOR = 5,+ /* The room never runs slower than this, whatever the metrics say: a sixth of normal speed. */+ ROOM_FRAME_RATE_FLOOR = 10,/* How far above the slowest reported rate the room is actually told to run. This is EA's ownstep - they applied it to the slowest player alone, "just in case they are able to" - givendiff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cppindex 5fb244912..b47a8ecc8 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp@@ -1406,13 +1406,14 @@ Int parseIgnoreStackTrace(char *args[], int num)#endif/* -fps <n> is the game speed itself: the rate the logic tick is paced at, the command-line twin of- the skirmish menu's game speed slider. MSG_NEW_GAME only honours 1..1000. */+ the skirmish menu's game speed slider. MSG_NEW_GAME only honours 1..1000. n is in retail 30 Hz+ frames, so -fps 30 is still normal speed and every script that passes it keeps its meaning. */Int parseFPSLimit(char *args[], int num){if (TheWritableGlobalData && num > 1){- TheWritableGlobalData->m_framesPerSecondLimit = atoi(args[1]);+ TheWritableGlobalData->m_framesPerSecondLimit = ConvertRetailFrames(atoi(args[1]));}return 2;}@@ -1599,11 +1600,12 @@ Int parseDirectorRecord(char *args[], int num)return consumed;}-/* -recordfps <n>: the frame rate -video and -directorrecord record at, a multiple of the logic's 30.+/* -recordfps <n>: the frame rate -video and -directorrecord record at, a multiple of the logic's+ * LOGICFRAMES_PER_SECOND (60).*- * At 30 a picture is a logic frame. At 60 each recorded logic frame is drawn twice before the next+ * At 60 a picture is a logic frame. At 120 each recorded logic frame is drawn twice before the next* one runs, the first picture blended half way from the frame before (smooth motion, on for it- * whatever the option says), and ffmpeg is told 60. The logic runs the same frames either way. */+ * whatever the option says), and ffmpeg is told 120. The logic runs the same frames either way. */Int parseRecordFps(char *args[], int num){if (num < 2)@@ -1612,7 +1614,7 @@ Int parseRecordFps(char *args[], int num)return num;}// four pictures a frame at most: W3D's clock moves in whole milliseconds, and a picture's share of a- // 33 ms frame has to be one at least or the drawables are never drawn+ // 16 ms frame has to be one at least or the drawables are never drawnconst Int MOST_PICTURES = 4;const Int fps = atoi(args[1]);if (fps < LOGICFRAMES_PER_SECOND || fps % LOGICFRAMES_PER_SECOND != 0 || fps > MOST_PICTURES * LOGICFRAMES_PER_SECOND)diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cppindex a03df9ac1..80a60dda9 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp@@ -781,7 +781,7 @@ static void startAutoSkirmish( Int numPlayersWanted )back to m_framesPerSecondLimit *unclamped*, which is how a stray -fps would still get through.-noFPSLimit deliberately does not appear here - it uncaps the renderer, not the simulation. */Int maxFPS = TheGlobalData->m_framesPerSecondLimit;- if (maxFPS < 15)+ if (maxFPS < ConvertRetailFrames( 15 ))maxFPS = DEFAULT_MAX_FPS;if (maxFPS > 1000)maxFPS = 1000;@@ -2338,7 +2338,7 @@ static void updateAutoCamera( void )*/const char *GameEngine_headlessRunResult( UnsignedInt frame, UnsignedInt victoryEndFrame, Int maxGameFrames ){- const UnsignedInt SETTLE_FRAMES = 30;+ const UnsignedInt SETTLE_FRAMES = LOGICFRAMES_PER_SECOND;if (victoryEndFrame > SETTLE_FRAMES)return "decided";if (maxGameFrames > 0 && frame >= (UnsignedInt)maxGameFrames)@@ -2591,7 +2591,7 @@ static void updateHeadlessRun( void )frames after it is decided and drops to the shell, which would leave without these lines. Thedecision's own CRC is logged on its frame, the one the scouting pass closed on. */static UnsignedInt filmDecidedOn = 0;- const UnsignedInt FILM_PAST_DECISION_FRAMES = 105;+ const UnsignedInt FILM_PAST_DECISION_FRAMES = ConvertRetailFrames( 105u );if (TheGlobalData->m_directorRecord && strcmp( why, "decided" ) == 0){if (filmDecidedOn == 0)@@ -2811,7 +2811,7 @@ void GameEngine::update( void )not: its mix moves with the logic frames, not the wall clock (updateSoundCapture). The five seconds before a -screenshot run at the real rate. Taken straight out offast-forward, a shot differed from its own repeat on 5.6% of the pixels; settled first, on0.01%, where two paced runs differ on 0.1%. */- const Int TURBO_SETTLE_FRAMES = 150;+ const Int TURBO_SETTLE_FRAMES = 5 * LOGICFRAMES_PER_SECOND;const Int turboFrame = (Int)TheGameLogic->getFrame();const Bool turboSettling = TheGlobalData->m_screenShotFrame > 0&& turboFrame + TURBO_SETTLE_FRAMES >= TheGlobalData->m_screenShotFramediff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex 976fa1590..ce65ab45b 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -91,7 +91,7 @@ static void parseIgnoredField( INI *, void *, void *, const void * ){ "UseTrees", INI::parseBool, NULL, offsetof( GlobalData, m_useTrees ) },{ "UseFPSLimit", INI::parseBool, NULL, offsetof( GlobalData, m_useFpsLimit ) },{ "DumpAssetUsage", INI::parseBool, NULL, offsetof( GlobalData, m_dumpAssetUsage ) },- { "FramesPerSecondLimit", INI::parseInt, NULL, offsetof( GlobalData, m_framesPerSecondLimit ) },+ { "FramesPerSecondLimit", INI::parseRetailFramesInt, NULL, offsetof( GlobalData, m_framesPerSecondLimit ) }, // retail 30 is normal speed: LOGICFRAMES_PER_SECOND{ "ChipsetType", INI::parseInt, NULL, offsetof( GlobalData, m_chipSetType ) },{ "MaxShellScreens", INI::parseInt, NULL, offsetof( GlobalData, m_maxShellScreens ) },{ "UseCloudMap", INI::parseBool, NULL, offsetof( GlobalData, m_useCloudMap ) },@@ -1078,7 +1078,7 @@ GlobalData::GlobalData()// By default, show all asserts.- m_unlookPersistDuration = 30;+ m_unlookPersistDuration = ConvertRetailFrames(30);//-----------------------------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cppindex 274d99b11..df548f67e 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp@@ -2146,6 +2146,33 @@ void INI::parseAccelerationReal( INI *ini, void * /*instance*/, void *store, con*(Real *)store = ConvertAccelerationInSecsToFrames(val);}+//-------------------------------------------------------------------------------------------------+// fields that EA wrote as a count of 30 Hz frames, or as an amount applied every 30 Hz frame+void INI::parseRetailFramesUnsignedInt( INI *ini, void * /*instance*/, void *store, const void* /*userData*/ )+{+ *(UnsignedInt *)store = ConvertRetailFrames(scanUnsignedInt(ini->getNextToken()));+}++void INI::parseRetailFramesInt( INI *ini, void * /*instance*/, void *store, const void* /*userData*/ )+{+ *(Int *)store = ConvertRetailFrames(scanInt(ini->getNextToken()));+}++void INI::parseRetailFramesReal( INI *ini, void * /*instance*/, void *store, const void* /*userData*/ )+{+ *(Real *)store = ConvertRetailFrames(scanReal(ini->getNextToken()));+}++void INI::parseRetailPerFrameReal( INI *ini, void * /*instance*/, void *store, const void* /*userData*/ )+{+ *(Real *)store = ConvertRetailPerFrameRate(scanReal(ini->getNextToken()));+}++void INI::parseRetailPerFrameFactorReal( INI *ini, void * /*instance*/, void *store, const void* /*userData*/ )+{+ *(Real *)store = ConvertRetailPerFrameFactor(scanReal(ini->getNextToken()));+}+//-------------------------------------------------------------------------------------------------//-------------------------------------------------------------------------------------------------void INI::parseVeterancyLevelFlags(INI* ini, void* /*instance*/, void* store, const void* /*userData*/)diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cppindex d7a32d88c..cc36c5b39 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/AcademyStats.cpp@@ -78,7 +78,7 @@ const char *TheAcademyClassificationTypeNames[] =NULL};-#define FRAMES_BETWEEN_UPDATES 30+#define FRAMES_BETWEEN_UPDATES LOGICFRAMES_PER_SECOND//------------------------------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cppindex c42483540..3c1763018 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp@@ -196,7 +196,7 @@ static const Real ALARM_DEPTH = 0.85f;static const Int ALARM_STRIP_COLUMN = 0;/// Half of this many frames lit, half dark.-static const Int BLINK_PERIOD_FRAMES = 16;+static const Int BLINK_PERIOD_FRAMES = ConvertRetailFrames( 16 );/// A power announces itself by blinking and then holds steady. A key that blinks/// for the rest of the match stops being news and starts being an irritation.static const Int READY_BLINK_FRAMES = LOGICFRAMES_PER_SECOND * 3;@@ -206,7 +206,7 @@ static const Int STAR_PERIOD_FRAMES = LOGICFRAMES_PER_SECOND;static const Int ALERT_HOLD_FRAMES = LOGICFRAMES_PER_SECOND * 3;/// Walking every object the player owns is not a per-frame job, and neither a/// build clock nor a superweapon's charge moves fast enough to need one.-static const Int WALK_INTERVAL_FRAMES = 15;+static const Int WALK_INTERVAL_FRAMES = ConvertRetailFrames( 15 );static const UnsignedInt MONEY_PER_SEGMENT = 1000;@@ -547,7 +547,7 @@ static Real chromaDistance( Real dx, Real dy )static Real chromaFlicker( const ChromaEffectSample &sample, UnsignedInt framesPerStep, UnsignedInt salt ){return chromaHashUnit( (UnsignedInt)sample.cellIndex * 2654435761u- + (sample.frame / framesPerStep) * 7919u + salt );+ + (sample.frame / LOGICFRAMES_PER_RETAIL_FRAME / framesPerStep) * 7919u + salt ); // steps are retail 30 Hz frames}//-----------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cppindex e52866b0a..0533f26ae 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp@@ -227,7 +227,10 @@ DrawableLocoInfo::DrawableLocoInfo()m_pitchModulator = 0.0f;m_leanPitch[0] = m_leanPitch[1] = 0.0f;m_leanRoll[0] = m_leanRoll[1] = 0.0f;- m_leanFrame = 0;+ m_airFrame = 0;+ m_airPitch = 0.0f;+ m_airRoll = 0.0f;+ m_airYaw = 0.0f;for (Int i = 0; i < 3; ++i)m_groundLeanStages[0][i] = m_groundLeanStages[1][i] = 0.0f;m_groundFrame = 0;@@ -1480,14 +1483,14 @@ void Drawable::updateDrawable( void ){if (m_colorTintEnvelope == NULL)m_colorTintEnvelope = newInstance(TintEnvelope);- m_colorTintEnvelope->play( &DARK_GRAY_DISABLED_COLOR, 30, 30, SUSTAIN_INDEFINITELY);+ m_colorTintEnvelope->play( &DARK_GRAY_DISABLED_COLOR, ConvertRetailFrames(30), ConvertRetailFrames(30), SUSTAIN_INDEFINITELY);}else if( testTintStatus(TINT_STATUS_GAINING_SUBDUAL_DAMAGE) ){// Disabled has precendence, so it goes firstif (m_colorTintEnvelope == NULL)m_colorTintEnvelope = newInstance(TintEnvelope);- m_colorTintEnvelope->play( &SUBDUAL_DAMAGE_COLOR, 150, 150, SUSTAIN_INDEFINITELY);+ m_colorTintEnvelope->play( &SUBDUAL_DAMAGE_COLOR, ConvertRetailFrames(150), ConvertRetailFrames(150), SUSTAIN_INDEFINITELY);}else if( testTintStatus(TINT_STATUS_FRENZY) ){@@ -1495,7 +1498,7 @@ void Drawable::updateDrawable( void )if (m_colorTintEnvelope == NULL)m_colorTintEnvelope = newInstance(TintEnvelope);- m_colorTintEnvelope->play( isKindOf( KINDOF_INFANTRY) ? &FRENZY_COLOR_INFANTRY:&FRENZY_COLOR, 30, 30, SUSTAIN_INDEFINITELY);+ m_colorTintEnvelope->play( isKindOf( KINDOF_INFANTRY) ? &FRENZY_COLOR_INFANTRY:&FRENZY_COLOR, ConvertRetailFrames(30), ConvertRetailFrames(30), SUSTAIN_INDEFINITELY);}// else if ( testTintStatus( TINT_STATUS_POISONED) )@@ -1586,7 +1589,7 @@ void Drawable::flashAsSelected( const RGBColor *color ) ///< drawable takes careif ( color ){- m_selectionFlashEnvelope->play( color, 0, 4 );+ m_selectionFlashEnvelope->play( color, 0, DEF_DECAY_FRAMES );}else{@@ -1601,7 +1604,7 @@ void Drawable::flashAsSelected( const RGBColor *color ) ///< drawable takes careReal saturation = TheGlobalData->m_selectionFlashSaturationFactor;saturateRGB( tempColor, saturation );- m_selectionFlashEnvelope->play( &tempColor, 0, 4 );+ m_selectionFlashEnvelope->play( &tempColor, 0, DEF_DECAY_FRAMES );}}@@ -1699,7 +1702,12 @@ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformI// we deal with just adjusting pitch, yaw, and roll just a little bit//- if( WOBBLE_RATE )+ // stepped on the retail clock, every second logic frame, which the rates above were written for+ UnsignedInt now = TheGameLogic->getFrame() / LOGICFRAMES_PER_RETAIL_FRAME;+ Bool step = now != m_locoInfo->m_airFrame;+ m_locoInfo->m_airFrame = now;++ if( WOBBLE_RATE && step ){if( m_locoInfo->m_wobble >= 1.0f )@@ -1746,15 +1754,21 @@ void Drawable::calcPhysicsXformThrust( const Locomotor *locomotor, PhysicsXformI} // end else+ } // end if, wobble exists++ if( WOBBLE_RATE )+ {+info.m_totalPitch = m_locoInfo->m_pitch;info.m_totalYaw = m_locoInfo->m_yaw;- } // end if, wobble exists+ } // end ifif( THRUST_ROLL ){- m_locoInfo->m_roll += THRUST_ROLL;+ if( step )+ m_locoInfo->m_roll += THRUST_ROLL;info.m_totalRoll = m_locoInfo->m_roll;} // end if@@ -1802,6 +1816,20 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physicsconst Coord3D* accel = physics->getAcceleration();const Coord3D* vel = physics->getVelocity();+ /* Stepped on the retail clock, every second logic frame, so the springs, the locomotor's stiffness,+ damping and correction rates and the lean's ease frames keep the timing they were tuned at; the+ logic frame in between draws the last result, as calcPhysicsXformGround does. */+ UnsignedInt now = TheGameLogic->getFrame() / LOGICFRAMES_PER_RETAIL_FRAME;+ if (now == m_locoInfo->m_airFrame)+ {+ info.m_totalPitch = m_locoInfo->m_airPitch;+ info.m_totalRoll = m_locoInfo->m_airRoll;+ info.m_totalYaw = m_locoInfo->m_airYaw;+ info.m_totalZ = 0.0f;+ return;+ }+ m_locoInfo->m_airFrame = now;+m_locoInfo->m_pitchRate += ((-PITCH_STIFFNESS * m_locoInfo->m_pitch) + (-PITCH_DAMPING * m_locoInfo->m_pitchRate)); // spring/damperm_locoInfo->m_rollRate += ((-ROLL_STIFFNESS * m_locoInfo->m_roll) + (-ROLL_DAMPING * m_locoInfo->m_rollRate)); // spring/damper@@ -1824,7 +1852,7 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physicsconst Real LEAN_AT_FULL_ACCEL = 0.2f; // radians, at the locomotor's own Accelerationconst Real LEAN_AT_FULL_SPEED = 0.12f; // radians, held at the locomotor's own Speedconst Real SOFT_LEAN = 0.27f; // the lean flattens out towards this, about 15 degrees- const Real LEAN_EASE_FRAMES = 5.0f; // each of the two smoothing stages, in logic frames+ const Real LEAN_EASE_FRAMES = 5.0f; // each of the two smoothing stages, in retail framesconst Real MAX_LEAN = 0.4f;if (accelPitchLimit == 0.0f)accelPitchLimit = MAX_LEAN;@@ -1848,18 +1876,12 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, PhysicsrollTarget = SOFT_LEAN * tanh((lateralAccel * accelScale + lateralVel * speedScale) / SOFT_LEAN);}- /* The acceleration jumps from one logic frame to the next, and the spring below runs once a- drawn frame, which at 120 frames a second is fast enough to copy every jump. Two smoothing- stages stepped once a logic frame ease the lean in and out over about half a second. */- UnsignedInt now = TheGameLogic->getFrame();- if (now != m_locoInfo->m_leanFrame)- {- m_locoInfo->m_leanFrame = now;- m_locoInfo->m_leanPitch[0] += (pitchTarget - m_locoInfo->m_leanPitch[0]) / LEAN_EASE_FRAMES;- m_locoInfo->m_leanPitch[1] += (m_locoInfo->m_leanPitch[0] - m_locoInfo->m_leanPitch[1]) / LEAN_EASE_FRAMES;- m_locoInfo->m_leanRoll[0] += (rollTarget - m_locoInfo->m_leanRoll[0]) / LEAN_EASE_FRAMES;- m_locoInfo->m_leanRoll[1] += (m_locoInfo->m_leanRoll[0] - m_locoInfo->m_leanRoll[1]) / LEAN_EASE_FRAMES;- }+ /* The acceleration jumps from one logic frame to the next, and the spring below would copy+ every jump. Two smoothing stages ease the lean in and out over about half a second. */+ m_locoInfo->m_leanPitch[0] += (pitchTarget - m_locoInfo->m_leanPitch[0]) / LEAN_EASE_FRAMES;+ m_locoInfo->m_leanPitch[1] += (m_locoInfo->m_leanPitch[0] - m_locoInfo->m_leanPitch[1]) / LEAN_EASE_FRAMES;+ m_locoInfo->m_leanRoll[0] += (rollTarget - m_locoInfo->m_leanRoll[0]) / LEAN_EASE_FRAMES;+ m_locoInfo->m_leanRoll[1] += (m_locoInfo->m_leanRoll[0] - m_locoInfo->m_leanRoll[1]) / LEAN_EASE_FRAMES;pitchTarget = m_locoInfo->m_leanPitch[1];rollTarget = m_locoInfo->m_leanRoll[1];}@@ -1888,18 +1910,22 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physics}}- // cause the chassis to pitch & roll in reaction to current speed- Real forwardVel = dir->x * vel->x + dir->y * vel->y;+ // cause the chassis to pitch & roll in reaction to current speed; the coefficients were tuned+ // against speeds per retail frame and accelerations per retail frame squared, and physics+ // keeps them per logic frame+ const Real RETAIL_VEL = (Real)LOGICFRAMES_PER_RETAIL_FRAME;+ const Real RETAIL_ACCEL = RETAIL_VEL * RETAIL_VEL;+ Real forwardVel = (dir->x * vel->x + dir->y * vel->y) * RETAIL_VEL;m_locoInfo->m_pitch += -(FORWARD_VEL_COEFF * forwardVel);- Real lateralVel = -dir->y * vel->x + dir->x * vel->y;+ Real lateralVel = (-dir->y * vel->x + dir->x * vel->y) * RETAIL_VEL;m_locoInfo->m_roll += -(LATERAL_VEL_COEFF * lateralVel);// cause the chassis to pitch & roll in reaction to acceleration/deceleration- Real forwardAccel = dir->x * accel->x + dir->y * accel->y;+ Real forwardAccel = (dir->x * accel->x + dir->y * accel->y) * RETAIL_ACCEL;m_locoInfo->m_accelerationPitchRate += -(FORWARD_ACCEL_COEFF * forwardAccel);- Real lateralAccel = -dir->y * accel->x + dir->x * accel->y;+ Real lateralAccel = (-dir->y * accel->x + dir->x * accel->y) * RETAIL_ACCEL;m_locoInfo->m_accelerationRollRate += -(LATERAL_ACCEL_COEFF * lateralAccel);}@@ -1925,14 +1951,16 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physicsinfo.m_totalYaw = RUDDER_CORRECTION_DEGREE * sin( m_locoInfo->m_yawModulator += RUDDER_CORRECTION_RATE );info.m_totalPitch += ELEVATOR_CORRECTION_DEGREE * cos( m_locoInfo->m_pitchModulator += ELEVATOR_CORRECTION_RATE );-+ m_locoInfo->m_airPitch = info.m_totalPitch;+ m_locoInfo->m_airRoll = info.m_totalRoll;+ m_locoInfo->m_airYaw = info.m_totalYaw;info.m_totalZ = 0.0f;}//-------------------------------------------------------------------------------------------------/** Treads, wheels and motorcycles. EA stepped their springs once a drawn frame, which was once a* logic frame at the 30 pictures a second the game was tuned at; at 120 the chassis bounced and- * settled four times as fast. They are stepped once a logic frame here, catching up when a slow+ * settled four times as fast. They are stepped once a retail frame here, catching up when a slow* picture let more than one go by, and the pictures in between show the last result: the unit's* position does not move between logic frames either.*@@ -1951,11 +1979,15 @@ void Drawable::calcPhysicsXformGround( const Locomotor *locomotor, PhysicsXformIm_locoInfo = newInstance(DrawableLocoInfo);const UnsignedInt MAX_CATCH_UP_FRAMES = 4; // more than this unseen and there is nothing to measure against- const Real LEAN_EASE_FRAMES = 3.0f; // each of the three smoothing stages, in logic frames+ const Real LEAN_EASE_FRAMES = 3.0f; // each of the three smoothing stages, in retail framesconst Real START_GAIN = 11.0f; // a one frame start from rest to top speed peaks at tanh(1.2) of the limitconst Real DEFAULT_LEAN_LIMIT = 0.07f; // 4 degrees, for a locomotor that reacts but names no limit, like the Humvee's- UnsignedInt now = TheGameLogic->getFrame();+ /* Stepped on the retail clock, every second logic frame, so the springs, the locomotor's+ stiffness and damping and the ease frames below keep the timing they were tuned at. Speeds are+ per logic frame and only ever divided by the locomotor's own top speed, which cancels; the turn+ rate does not, so it is taken per retail frame. */+ UnsignedInt now = TheGameLogic->getFrame() / LOGICFRAMES_PER_RETAIL_FRAME;UnsignedInt steps = now - m_locoInfo->m_groundFrame;if (steps != 0){@@ -1989,7 +2021,7 @@ void Drawable::calcPhysicsXformGround( const Locomotor *locomotor, PhysicsXformIif (locomotor->getForwardAccelCoef() != 0.0f || locomotor->getLateralAccelCoef() != 0.0f){Real maxSpeed = locomotor->getMaxSpeedForCondition(bdt);- Real maxLateral = maxSpeed * locomotor->getMaxTurnRate(bdt);+ Real maxLateral = maxSpeed * locomotor->getMaxTurnRate(bdt) * LOGICFRAMES_PER_RETAIL_FRAME;pitchIn = maxSpeed > 0.0f ? -START_GAIN * forwardAccel / maxSpeed : 0.0f;rollIn = maxLateral > 0.0f ? -lateralAccel / maxLateral : 0.0f;}@@ -2114,7 +2146,8 @@ void Drawable::calcPhysicsXformTreads( const Locomotor *locomotor, PhysicsXformIamount = 1.0f;// rough vibrations proportional to speed when we drive over something- Real rough = (vel->x*vel->x + vel->y*vel->y) * OVERLAP_ROUGH_VIBRATION_FACTOR;+ // the speed per retail frame, which the factor was tuned for+ Real rough = (vel->x*vel->x + vel->y*vel->y) * sqr((Real)LOGICFRAMES_PER_RETAIL_FRAME) * OVERLAP_ROUGH_VIBRATION_FACTOR;if (rough > MAX_ROUGH_VIBRATION)rough = MAX_ROUGH_VIBRATION;@@ -2286,7 +2319,7 @@ void Drawable::calcPhysicsXformWheels( const Locomotor *locomotor, PhysicsXformIconst Real ACCEL_PITCH_LIMIT = locomotor->getAccelPitchLimit();const Real DECEL_PITCH_LIMIT = locomotor->getDecelPitchLimit();- const Real BOUNCE_ANGLE_KICK = locomotor->getBounceKick();+ const Real BOUNCE_ANGLE_KICK = locomotor->getBounceKick() * LOGICFRAMES_PER_RETAIL_FRAME; // parsed per logic frame, stepped per retail frameconst Real PITCH_STIFFNESS = locomotor->getPitchStiffness();const Real ROLL_STIFFNESS = locomotor->getRollStiffness();const Real PITCH_DAMPING = locomotor->getPitchDamping();@@ -2568,7 +2601,7 @@ void Drawable::calcPhysicsXformMotorcycle( const Locomotor *locomotor, PhysicsXfconst Real ACCEL_PITCH_LIMIT = locomotor->getAccelPitchLimit();const Real DECEL_PITCH_LIMIT = locomotor->getDecelPitchLimit();- const Real BOUNCE_ANGLE_KICK = locomotor->getBounceKick();+ const Real BOUNCE_ANGLE_KICK = locomotor->getBounceKick() * LOGICFRAMES_PER_RETAIL_FRAME; // parsed per logic frame, stepped per retail frameconst Real PITCH_STIFFNESS = locomotor->getPitchStiffness();const Real ROLL_STIFFNESS = locomotor->getRollStiffness();const Real PITCH_DAMPING = locomotor->getPitchDamping();diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cppindex 4d90613ed..f83efe35d 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp@@ -41,8 +41,8 @@//-------------------------------------------------------------------------------------------------BeaconClientUpdateModuleData::BeaconClientUpdateModuleData() :- m_framesBetweenRadarPulses(30),- m_radarPulseDuration(15)+ m_framesBetweenRadarPulses(ConvertRetailFrames(30u)),+ m_radarPulseDuration(ConvertRetailFrames(15u)){}diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cppindex cb7226c80..57fa77844 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp@@ -206,8 +206,8 @@ const FieldParse EvaSideSounds::s_evaSideSounds[] =EvaCheckInfo::EvaCheckInfo() :m_message(EVA_COUNT),m_priority(1), // lowest of all priorities- m_framesBetweenChecks(900), // 30 seconds at 30 fps- m_framesToExpire(150) // 5 seconds at 30 fps+ m_framesBetweenChecks(LOGICFRAMES_PER_SECOND * 30), // 30 seconds+ m_framesToExpire(LOGICFRAMES_PER_SECOND * 5) // 5 seconds{diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex 6b37b40e9..76e95010a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -2127,7 +2127,7 @@ void ControlBar::triggerRadarAttackGlow( void ){if( m_radarAttackGlowWindow == NULL )return;- m_remainingRadarAttackGlowFrames = 150;+ m_remainingRadarAttackGlowFrames = ConvertRetailFrames( 150 );m_radarAttackGlowWindow->winEnable( FALSE );}@@ -2965,7 +2965,7 @@ void ControlBar::update( void ){if( --m_remainingRadarAttackGlowFrames <= 0 )m_radarAttackGlowWindow->winEnable( TRUE );- else if( m_remainingRadarAttackGlowFrames % 15 == 0 )+ else if( m_remainingRadarAttackGlowFrames % ConvertRetailFrames( 15 ) == 0 )m_radarAttackGlowWindow->winEnable( !BitTest( m_radarAttackGlowWindow->winGetStatus(), WIN_STATUS_ENABLED ) );}}@@ -3083,7 +3083,7 @@ void ControlBar::update( void )}- const Bool flashTick = logicTick && (logicNow % 10 == 0);+ const Bool flashTick = logicTick && (logicNow % ConvertRetailFrames( 10U ) == 0);// check flashingif( m_flash )diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cppindex 788395f83..37364de38 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp@@ -994,7 +994,8 @@ void ControlBarSchemeManager::update( void )static UnsignedInt lastStepMs = 0;static Real stepAccumMs = 0.0f;- if (!GameClient_isUiAnimStepDue(lastStepMs, stepAccumMs, Clock_Milliseconds(), UI_ANIM_STEPS_PER_SEC))+ // Duration is parsed from ms into logic frames, so the steps are logic frames too+ if (!GameClient_isUiAnimStepDue(lastStepMs, stepAccumMs, Clock_Milliseconds(), LOGICFRAMES_PER_SECONDS_REAL))return;if(m_currentScheme)diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cppindex 70630d2a9..74f47af8e 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp@@ -168,10 +168,11 @@ static Bool buttonPushed = FALSE;static Bool stillNeedsToSetOptions = FALSE;void skirmishUpdateSlotList( void );static void populateSkirmishBattleHonors( void );-// The game speed dropdown, as logic frames a second against the normal 30. Half speed to double.-// x0.75 is 22.5, which a whole frame rate cannot hold, so it runs at 23. The preference keeps the-// frame rate, so one saved by the old 15 to 60 slider lands on the nearest entry.-static const Int SKIRMISH_GAME_SPEEDS[] = { 15, 23, 30, 45, 60 };+// The game speed dropdown, as logic frames a second against the normal LOGICFRAMES_PER_SECOND. Half+// speed to double. The preference keeps the frame rate in retail 30 Hz frames, as it always did, so+// one saved by an older build or by the old 15 to 60 slider lands on the nearest entry.+static const Int SKIRMISH_GAME_SPEEDS[] = { LOGICFRAMES_PER_SECOND / 2, LOGICFRAMES_PER_SECOND * 3 / 4,+ LOGICFRAMES_PER_SECOND, LOGICFRAMES_PER_SECOND * 3 / 2, LOGICFRAMES_PER_SECOND * 2 };static const WideChar *SKIRMISH_GAME_SPEED_CAPTIONS[] = { u"x0.5", u"x0.75", u"x1", u"x1.5", u"x2" };static const Int SKIRMISH_GAME_SPEED_COUNT = sizeof( SKIRMISH_GAME_SPEEDS ) / sizeof( SKIRMISH_GAME_SPEEDS[ 0 ] );@@ -400,7 +401,7 @@ Bool SkirmishPreferences::write(void)setSlotList();- setInt("FPS", selectedGameSpeed());+ setInt("FPS", selectedGameSpeed() / LOGICFRAMES_PER_RETAIL_FRAME);return UserPreferences::write();}@@ -1462,7 +1463,7 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData )GadgetComboBoxReset( comboBoxGameSpeed );for( Int i = 0; i < SKIRMISH_GAME_SPEED_COUNT; ++i )GadgetComboBoxAddEntry( comboBoxGameSpeed, UnicodeString( SKIRMISH_GAME_SPEED_CAPTIONS[ i ] ), comboBoxGameSpeed->winGetEnabledTextColor() );- GadgetComboBoxSetSelectedPos( comboBoxGameSpeed, nearestGameSpeedIndex( prefs.getInt( "FPS", LOGICFRAMES_PER_SECOND ) ) );+ GadgetComboBoxSetSelectedPos( comboBoxGameSpeed, nearestGameSpeedIndex( ConvertRetailFrames( prefs.getInt( "FPS", RETAIL_LOGICFRAMES_PER_SECOND ) ) ) );}buttonStart->winSetText(TheGameText->fetch("GUI:Start"));/* hey, for now we're also going to disable the map select button until it doesn't crash */diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cppindex d996f3ccc..9341b8cc0 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp@@ -1470,7 +1470,7 @@ WindowMsgHandledType WOLLobbyMenuSystem( GameWindow *window, UnsignedInt msg,req.peerRequestType = PeerRequest::PEERREQUEST_GETEXTENDEDSTAGINGROOMINFO;req.stagingRoom.id = (Int)(intptr_t)GadgetListBoxGetItemData(control, rowSelected, 0);- if (lastID != req.stagingRoom.id || now > lastFrame + 60)+ if (lastID != req.stagingRoom.id || now > lastFrame + ConvertRetailFrames( 60U )){TheGameSpyPeerMessageQueue->addRequest(req);}diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cppindex 2c9b898c5..c3da8f3ca 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameConsole.cpp@@ -150,8 +150,8 @@ static AsciiString runCheat( const ConsoleCheat &cheat, AsciiString arguments )* often a logic frame runs and nothing inside one, so a network game, which runs at the pace the* whole room agrees on, is the one place it is refused. *///--------------------------------------------------------------------------------------------------static const Int SPEED_MIN_PERCENT = 17; ///< 5 logic frames a second-static const Int SPEED_MAX_PERCENT = 666; ///< 200 logic frames a second+static const Int SPEED_MIN_PERCENT = 17; ///< 10 logic frames a second+static const Int SPEED_MAX_PERCENT = 666; ///< 400 logic frames a secondstatic const Int SPEED_NORMAL_PERCENT = 100;static AsciiString runSpeed( AsciiString arguments )diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cppindex d3ad40804..1af8f15c2 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp@@ -75,7 +75,7 @@ static const FieldParse TheGlobalLanguageDataFieldParseTable[] ={ "UnicodeFontName", INI::parseAsciiString,NULL, offsetof( GlobalLanguage, m_unicodeFontName ) },//{ "UnicodeFontFileName", INI::parseAsciiString,NULL, offsetof( GlobalLanguage, m_unicodeFontFileName ) },{ "LocalFontFile", GlobalLanguage::parseFontFileName, NULL, 0},- { "MilitaryCaptionSpeed", INI::parseInt, NULL, offsetof( GlobalLanguage, m_militaryCaptionSpeed ) },+ { "MilitaryCaptionSpeed", INI::parseRetailFramesInt, NULL, offsetof( GlobalLanguage, m_militaryCaptionSpeed ) },{ "UseHardWordWrap", INI::parseBool, NULL, offsetof( GlobalLanguage, m_useHardWrap) },{ "ResolutionFontAdjustment", INI::parseReal, NULL, offsetof( GlobalLanguage, m_resolutionFontSizeAdjustment) },diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 7420a0113..b9f1d3025 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -939,7 +939,7 @@ const FieldParse InGameUI::s_fieldParseTable[] ={ "MilitaryCaptionBold", INI::parseBool, NULL, offsetof( InGameUI, m_militaryCaptionBold ) },{ "MilitaryCaptionRandomizeTyping", INI::parseBool, NULL, offsetof( InGameUI, m_militaryCaptionRandomizeTyping ) },- { "MilitaryCaptionSpeed", INI::parseInt, NULL, offsetof( InGameUI, m_militaryCaptionSpeed ) },+ { "MilitaryCaptionSpeed", INI::parseRetailFramesInt, NULL, offsetof( InGameUI, m_militaryCaptionSpeed ) },{ "MilitaryCaptionPosition", INI::parseICoord2D, NULL, offsetof( InGameUI, m_militaryCaptionPosition ) },@@ -1101,7 +1101,7 @@ InGameUI::InGameUI()m_militaryCaptionBold = FALSE;m_militaryCaptionRandomizeTyping = FALSE;- m_militaryCaptionSpeed = 1;+ m_militaryCaptionSpeed = ConvertRetailFrames( 1 );m_popupMessageColor = GameMakeColor(255,255,255,255);m_tooltipsDisabledUntil = 0;@@ -2361,24 +2361,33 @@ void InGameUI::update( void )// if it's time to remove the subtitle, Then remove itif((Int)m_militarySubtitle->lifetime < (Int)currLogicFrame){- //steal colins fade from above :)- GameGetColorComponents( m_militarySubtitle->color, &r, &g, &b, &a );- // start fading the alpha on this color down- amount = REAL_TO_INT( ((currLogicFrame - m_militarySubtitle->lifetime ) * 0.1f) );- if( a - amount < 0 )+ // the fade takes 0.1 more alpha each step than the last, so it is stepped once a retail+ // frame of the subtitle's age, the logic frame and render passes in between holding the+ // colour; a script freeze ages it through lifetime, so the age is the clock, not the frame+ const UnsignedInt fadeStep = (currLogicFrame - m_militarySubtitle->lifetime) / LOGICFRAMES_PER_RETAIL_FRAME;+ if( fadeStep != m_militarySubtitle->fadeStep ){- removeMilitarySubtitle();- }- else- {- a -= amount;- m_militarySubtitle->color = GameMakeColor(r, g, b, a);+ m_militarySubtitle->fadeStep = fadeStep;+ //steal colins fade from above :)+ GameGetColorComponents( m_militarySubtitle->color, &r, &g, &b, &a );+ // start fading the alpha on this color down+ amount = REAL_TO_INT( fadeStep * 0.1f );+ if( a - amount < 0 )+ {+ removeMilitarySubtitle();+ }+ else+ {+ a -= amount;+ m_militarySubtitle->color = GameMakeColor(r, g, b, a);+ }}}else{// trigger whether or not we should draw the block- if( m_militarySubtitle->blockBeginFrame + 9 < currLogicFrame )+ // retail toggled every 10 frames, its 9 plus the strict <'s one; the 10 is doubled, not the 9+ if( m_militarySubtitle->blockBeginFrame + ConvertRetailFrames( 10 ) - 1 < currLogicFrame ){m_militarySubtitle->blockBeginFrame = currLogicFrame;m_militarySubtitle->blockDrawn = !m_militarySubtitle->blockDrawn;@@ -2435,10 +2444,12 @@ void InGameUI::update( void )// lets make a soundstatic AudioEventRTS click("MilitarySubtitlesTyping");TheAudio->addAudioEvent(&click);+ // a letter every speed + 1 retail frames, the strict < above being the + 1: the speed is+ // parsed doubled, so the + 1 is doubled here tooif(TheGlobalLanguageData)- m_militarySubtitle->incrementOnFrame = currLogicFrame + TheGlobalLanguageData->m_militaryCaptionSpeed;+ m_militarySubtitle->incrementOnFrame = currLogicFrame + TheGlobalLanguageData->m_militaryCaptionSpeed + LOGICFRAMES_PER_RETAIL_FRAME - 1;else- m_militarySubtitle->incrementOnFrame = currLogicFrame + m_militaryCaptionSpeed;+ m_militarySubtitle->incrementOnFrame = currLogicFrame + m_militaryCaptionSpeed + LOGICFRAMES_PER_RETAIL_FRAME - 1;}// increment the index@@ -2562,7 +2573,7 @@ void InGameUI::update( void )Real cameraSteps = 1.0f;if( m_cameraKeyLastMs != 0 )- cameraSteps = (Real)(cameraNowMs - m_cameraKeyLastMs) * (LOGICFRAMES_PER_SECOND / 1000.0f);+ cameraSteps = (Real)(cameraNowMs - m_cameraKeyLastMs) * (RETAIL_LOGICFRAMES_PER_SECOND / 1000.0f);m_cameraKeyLastMs = cameraNowMs;if( cameraSteps > 4.0f )cameraSteps = 4.0f;@@ -2790,7 +2801,7 @@ void InGameUI::addClassicMessage( const UnicodeString &text, const Color *color//-------------------------------------------------------------------------------------------------void InGameUI::fadeClassicMessages( void ){- const UnsignedInt now = TheGameLogic->getFrame();+ const UnsignedInt now = TheGameLogic->getFrame() / LOGICFRAMES_PER_RETAIL_FRAME; // EA's steps are retail 30 Hz framesif( now == m_classicMessageFadeFrame )return;m_classicMessageFadeFrame = now;@@ -2799,11 +2810,11 @@ void InGameUI::fadeClassicMessages( void )for( Int i = CLASSIC_MESSAGES - 1; i >= 0; i-- ){ClassicMessage &line = m_classicMessages[ i ];- if( line.text == NULL || now - line.frame <= timeout )+ if( line.text == NULL || now - line.frame / LOGICFRAMES_PER_RETAIL_FRAME <= timeout )continue;UnsignedByte r, g, b, a;GameGetColorComponents( line.color, &r, &g, &b, &a );- const Int amount = REAL_TO_INT( ( now - line.frame ) * 0.01f );+ const Int amount = REAL_TO_INT( ( now - line.frame / LOGICFRAMES_PER_RETAIL_FRAME ) * 0.01f );a = ( a - amount < 0 ) ? 0 : a - amount;line.color = GameMakeColor( r, g, b, a );if( a == 0 )@@ -6773,6 +6784,7 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration )m_militarySubtitle->blockPos.x = m_militarySubtitle->position.x = box.x + m_militaryCaptionPosition.x * multiplier.x;m_militarySubtitle->blockPos.y = m_militarySubtitle->position.y = box.y + m_militaryCaptionPosition.y * multiplier.y;m_militarySubtitle->incrementOnFrame = currLogicFrame + (Int)(((Real)LOGICFRAMES_PER_SECOND * TheGlobalLanguageData->m_militaryCaptionDelayMS)/1000.0f);+ m_militarySubtitle->fadeStep = 0;m_militarySubtitle->index = 0;for (int i = 1; i < MAX_SUBTITLE_LINES; i ++)m_militarySubtitle->displayStrings[i] = NULL;@@ -7855,7 +7867,8 @@ void InGameUI::updateFloatingText( void ){// modify the colorGameGetColorComponents(ftd->m_color, &r, &g, &b, &a);- amount = REAL_TO_INT( (currLogicFrame - ftd->m_frameTimeOut) * m_floatingTextMoveVanishRate);+ // age times rate is a per-frame-squared amount: the parser halved the rate, this halves it again+ amount = REAL_TO_INT( (currLogicFrame - ftd->m_frameTimeOut) * ConvertRetailPerFrameRate( m_floatingTextMoveVanishRate ));if(a - amount < 0)a = 0;else@@ -9831,7 +9844,7 @@ void InGameUI::updateAndDrawWorldAnimations( void )// update the Z valueif( wad->m_zRisePerSecond )- wad->m_worldPos.z += wad->m_zRisePerSecond / LOGICFRAMES_PER_SECOND;+ wad->m_worldPos.z += wad->m_zRisePerSecond / RETAIL_LOGICFRAMES_PER_SECOND; // a render pass, not a logic frame: kept as it was} // end ifdiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cppindex 0c6f1516b..b22d2a776 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp@@ -379,7 +379,7 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage{m_lastMouseMoveFrame = TheGameLogic->getFrame();- const UnsignedInt CLICK_DURATION = 5;+ const UnsignedInt CLICK_DURATION = ConvertRetailFrames( 5U );const UnsignedInt PIXEL_OFFSET = 5;m_isRotating = false;diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cppindex 4b6cef748..dbdda6c41 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp@@ -1377,7 +1377,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa}// check for double-press to jump view- if ( now - m_lastGroupSelTime < 20 && group == m_lastGroupSelGroup )+ if ( now - m_lastGroupSelTime < ConvertRetailFrames( 20U ) && group == m_lastGroupSelGroup ){DEBUG_LOG(("META: DOUBLETAP select team %d\n",group));Player *player = ThePlayerList->getLocalPlayer();diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cppindex 4bc1e472e..21bc84d57 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp@@ -163,14 +163,14 @@ static const Real SPLIT_STAY_SHARE = 0.25f;/// once the picture is whole again it stays whole this long, so it does not flicker between the twostatic const UnsignedInt SPLIT_REST_FRAMES = 4 * LOGICFRAMES_PER_SECOND;/// the radar takes this long to slide down off the screen before the panes come, and back after-static const UnsignedInt PANE_RADAR_FRAMES = 12;+static const UnsignedInt PANE_RADAR_FRAMES = ConvertRetailFrames( 12U );/// the panes take this long to slide in along the rays, and out again-static const UnsignedInt PANE_SLIDE_FRAMES = 15;+static const UnsignedInt PANE_SLIDE_FRAMES = ConvertRetailFrames( 15U );/// then the gold draws out along the settled lines from where they meet, and the radar's frame round/// the map, for this long; it goes back in as long before the panes leave. Drawn while the panes/// slid, the lines were whole before the meeting point was on the screen and nothing was seen to draw-static const UnsignedInt PANE_DRAW_FRAMES = 21;-static const UnsignedInt PANE_UNDRAW_FRAMES = 15;+static const UnsignedInt PANE_DRAW_FRAMES = ConvertRetailFrames( 21U );+static const UnsignedInt PANE_UNDRAW_FRAMES = ConvertRetailFrames( 15U );/// so a split, once on, stays on this long whatever its fights do, unless its panes come to show/// the same ground: a split that went off before its panes were in flashed a pane in and outstatic const UnsignedInt SPLIT_LEAST_FRAMES = PANE_RADAR_FRAMES + PANE_SLIDE_FRAMES + PANE_DRAW_FRAMES + SPLIT_HOLD_FRAMES;@@ -206,7 +206,7 @@ static const Real PANE_BAND_FROM = 0.35f;/// while the panes are held a light runs out along every gold line once in this many logic frames,/// taking this many to reach the endstatic const UnsignedInt PANE_SHIMMER_PERIOD = 5 * LOGICFRAMES_PER_SECOND;-static const UnsignedInt PANE_SHIMMER_FRAMES = 45;+static const UnsignedInt PANE_SHIMMER_FRAMES = ConvertRetailFrames( 45U );/// a pane's circle is looked for on a grid this fine, a centre every 10 pixels at 1280x720static const Int PANE_CIRCLE_COLUMNS = 128;static const Int PANE_CIRCLE_ROWS = 72;@@ -219,7 +219,7 @@ static const Real PANE_FIT_LEAST_EXTENT = 150.0f;/// the opening fits what a player has within this of the middle of it, his base and the army beside itstatic const Real PANE_INTRO_REACH = 500.0f;/// how much of the way to a new fit a pane's zoom goes each logic frame, about a second and a half-static const Real PANE_FIT_FOLLOW = 0.06f;+static const Real PANE_FIT_FOLLOW = 1.0f - ConvertRetailPerFrameFactor( 1.0f - 0.06f );/// how far over a command centre's own height its player's plate hangs: the flags on a GLA palace/// stand past it, and zoomed in they ran into the platestatic const Real PANE_MARK_LIFT = 15.0f;@@ -239,8 +239,8 @@ static const UnsignedInt DIRECTOR_PREROLL_FRAMES = 4 * LOGICFRAMES_PER_SECOND;static const UnsignedInt SCOUT_CRC_FRAMES = 30 * LOGICFRAMES_PER_SECOND;/// the broadcast's power flags drop and go back up over the first many logic frames; the defeat and/// winner banners open and close over the second, the rule, the panel and the words one after another-static const UnsignedInt FLAG_MOVE_FRAMES = 15;-static const UnsignedInt BANNER_MOVE_FRAMES = 24;+static const UnsignedInt FLAG_MOVE_FRAMES = ConvertRetailFrames( 15U );+static const UnsignedInt BANNER_MOVE_FRAMES = ConvertRetailFrames( 24U );/// a power's flag hangs under its player's card this long when nothing waits behind it, a defeated/// player's banner holds this longstatic const UnsignedInt FLAG_HOLD_FRAMES = 4 * LOGICFRAMES_PER_SECOND;@@ -248,15 +248,15 @@ static const UnsignedInt DEFEAT_BANNER_HOLD_FRAMES = 3 * LOGICFRAMES_PER_SECOND;/// a defeated player's card flashes red over the first of these, a line is drawn through it from the/// second over the third, it is seen struck until the fourth after the defeat and then collapses over/// the last while the others slide together-static const UnsignedInt CARD_FLASH_FRAMES = 12;-static const UnsignedInt CARD_STRIKE_FROM = 6;-static const UnsignedInt CARD_STRIKE_FRAMES = 12;-static const UnsignedInt CARD_STRUCK_FRAMES = 36;-static const UnsignedInt CARD_COLLAPSE_FRAMES = 18;+static const UnsignedInt CARD_FLASH_FRAMES = ConvertRetailFrames( 12U );+static const UnsignedInt CARD_STRIKE_FROM = ConvertRetailFrames( 6U );+static const UnsignedInt CARD_STRIKE_FRAMES = ConvertRetailFrames( 12U );+static const UnsignedInt CARD_STRUCK_FRAMES = ConvertRetailFrames( 36U );+static const UnsignedInt CARD_COLLAPSE_FRAMES = ConvertRetailFrames( 18U );/// the winner's banner starts to come in this long after the match is decided, as the last defeated/// player's banner over it has opened: the film runs 105 frames past the decision, and at 30 the winner's/// was all in for only 51 of them-static const UnsignedInt WINNER_DELAY_FRAMES = 24;+static const UnsignedInt WINNER_DELAY_FRAMES = ConvertRetailFrames( 24U );//-------------------------------------------------------------------------------------------------static Bool sameFight( const Coord2D &a, const Coord2D &b )diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cppindex 79f57b3ca..79d99605f 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp@@ -79,13 +79,69 @@ static UnsignedInt particleTimerFrames( Real value )return (UnsignedInt)value;}+//-------------------------------------------------------------------------------------------------+/* The particles step once a logic frame, and every number in a template was written for retail's 30+ of them a second. So each is converted as it is read: a frame count doubled, an amount added every+ frame halved, gravity quartered, a factor multiplied in every frame square-rooted. A burst comes+ BurstDelay + 1 frames after the last one, so the delay doubles plus one: BurstDelay 0, a burst+ every retail frame, becomes one every second frame and the particles a second stay what they were. */+static void scaleRandomVariable( void *store, Real (*convert)( Real ) )+{+ GameClientRandomVariable *var = (GameClientRandomVariable *)store;+ var->setRange( convert( var->getMinimumValue() ), convert( var->getMaximumValue() ), var->getDistributionType() );+}++static Real retailBurstDelay( Real delay )+{+ return ConvertRetailFrames( delay ) + (Real)(LOGICFRAMES_PER_RETAIL_FRAME - 1);+}++static void parseRetailFramesRandom( INI *ini, void *instance, void *store, const void *userData )+{+ INI::parseGameClientRandomVariable( ini, instance, store, userData );+ scaleRandomVariable( store, ConvertRetailFrames );+}++static void parseRetailBurstDelayRandom( INI *ini, void *instance, void *store, const void *userData )+{+ INI::parseGameClientRandomVariable( ini, instance, store, userData );+ scaleRandomVariable( store, retailBurstDelay );+}++static void parseRetailPerFrameRandom( INI *ini, void *instance, void *store, const void *userData )+{+ INI::parseGameClientRandomVariable( ini, instance, store, userData );+ scaleRandomVariable( store, ConvertRetailPerFrameRate );+}++static void parseRetailPerFrameFactorRandom( INI *ini, void *instance, void *store, const void *userData )+{+ INI::parseGameClientRandomVariable( ini, instance, store, userData );+ scaleRandomVariable( store, ConvertRetailPerFrameFactor );+}++static void parseRetailPerFrameSquaredReal( INI *ini, void *instance, void *store, const void *userData )+{+ INI::parseReal( ini, instance, store, userData );+ *(Real *)store = ConvertRetailPerFrameSquared( *(Real *)store );+}++static void parseRetailPerFrameCoord3D( INI *ini, void *instance, void *store, const void *userData )+{+ INI::parseCoord3D( ini, instance, store, userData );+ Coord3D *v = (Coord3D *)store;+ v->x = ConvertRetailPerFrameRate( v->x );+ v->y = ConvertRetailPerFrameRate( v->y );+ v->z = ConvertRetailPerFrameRate( v->z );+}+//-------------------------------------------------------------------------------------------------/* A particle whose keys never reach zero alpha (or black, or white for MULTIPLY) would vanish withwhatever it showed on its last frame. Over the last frames of its life its strength is capped byan envelope falling linearly to zero, so it fades instead. The window is a quarter of the- lifetime, at most eight frames. A cap rather than a multiplier: a particle already fading below- the envelope is left exactly as authored. */-static const UnsignedInt PARTICLE_FADE_MAX_FRAMES = 8;+ lifetime, at most eight retail frames. A cap rather than a multiplier: a particle already fading+ below the envelope is left exactly as authored. */+static const UnsignedInt PARTICLE_FADE_MAX_FRAMES = 8 * LOGICFRAMES_PER_RETAIL_FRAME;static const UnsignedInt PARTICLE_FADE_LIFETIME_DIVISOR = 4;//-------------------------------------------------------------------------------------------------@@ -845,7 +901,7 @@ void Particle::doWindMotion( void )Real distFromWind = v.length();if( distFromWind < noForceDistance ){- Real windForceStrength = 2.0f * m_windRandomness;+ Real windForceStrength = ConvertRetailPerFrameRate( 2.0f ) * m_windRandomness;// only apply force if still within the circle of influenceif( distFromWind > fullForceDistance )@@ -1036,7 +1092,7 @@ ParticleSystemInfo::ParticleSystemInfo()m_gravity = 0.0f;m_groundCollision = FALSE; // retail behaviour: particles pass through the terrainm_groundBounce = 0.35f; // only consulted once an INI sets GroundCollision = Yes- m_groundFriction = 0.6f;+ m_groundFriction = ConvertRetailPerFrameFactor( 0.6f ); // as GroundFriction is parsedm_isEmissionVolumeHollow = FALSE;m_isOneShot = FALSE;m_slavePosOffset.zero();@@ -1046,9 +1102,9 @@ ParticleSystemInfo::ParticleSystemInfo()// some default values for the wind motion valuesm_windMotion = WIND_MOTION_NOT_USED;m_windAngle = 0.0f;- m_windAngleChange = 0.15f; // higher is ping pong faster- m_windAngleChangeMin = 0.15f;- m_windAngleChangeMax = 0.45f;+ m_windAngleChange = ConvertRetailPerFrameRate( 0.15f ); // higher is ping pong faster+ m_windAngleChangeMin = ConvertRetailPerFrameRate( 0.15f );+ m_windAngleChangeMax = ConvertRetailPerFrameRate( 0.45f );m_windMotionStartAngleMin = 0.0f;m_windMotionStartAngleMax = PI / 4.0f;m_windMotionStartAngle = m_windMotionStartAngleMin;@@ -2715,7 +2771,7 @@ void ParticleSystem::updateWindMotion( void )Real change = (1.0f - (diffFromCenter / halfSpan)) * m_windAngleChange;// we will always change a little bit- #define MINIMUM_CHANGE 0.005f // lower #'s have softer swings at the edge angles+ #define MINIMUM_CHANGE ConvertRetailPerFrameRate( 0.005f ) // lower #'s have softer swings at the edge anglesif( change < MINIMUM_CHANGE )change = MINIMUM_CHANGE;@@ -3196,25 +3252,27 @@ const FieldParse ParticleSystemTemplate::m_fieldParseTable[] ={ "VolumeParticleDepth", INI::parseUnsignedInt, NULL, offsetof( ParticleSystemTemplate, m_volumeParticleDepth ) },{ "ParticleName", INI::parseAsciiString, NULL, offsetof( ParticleSystemTemplate, m_particleTypeName ) },{ "AngleZ", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angleZ ) },- { "AngularRateZ", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angularRateZ ) },- { "AngularDamping", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_angularDamping ) },+ { "AngularRateZ", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_angularRateZ ) },+ { "AngularDamping", parseRetailPerFrameFactorRandom, NULL, offsetof( ParticleSystemTemplate, m_angularDamping ) },- { "VelocityDamping", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_velDamping ) },- { "Gravity", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_gravity ) },+ { "VelocityDamping", parseRetailPerFrameFactorRandom, NULL, offsetof( ParticleSystemTemplate, m_velDamping ) },+ { "Gravity", parseRetailPerFrameSquaredReal, NULL, offsetof( ParticleSystemTemplate, m_gravity ) },{ "GroundCollision", INI::parseBool, NULL, offsetof( ParticleSystemTemplate, m_groundCollision ) },{ "GroundBounce", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_groundBounce ) },- { "GroundFriction", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_groundFriction ) },+ // applied on every frame a particle comes down on the ground, which for one at rest is every frame+ { "GroundFriction", INI::parseRetailPerFrameFactorReal, NULL, offsetof( ParticleSystemTemplate, m_groundFriction ) },{ "SlaveSystem", INI::parseAsciiString, NULL, offsetof( ParticleSystemTemplate, m_slaveSystemName ) },{ "SlavePosOffset", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_slavePosOffset ) },{ "PerParticleAttachedSystem", INI::parseAsciiString, NULL, offsetof( ParticleSystemTemplate, m_attachedSystemName ) },- { "Lifetime", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_lifetime ) },- { "SystemLifetime", INI::parseUnsignedInt, NULL, offsetof( ParticleSystemTemplate, m_systemLifetime ) },+ { "Lifetime", parseRetailFramesRandom, NULL, offsetof( ParticleSystemTemplate, m_lifetime ) },+ { "SystemLifetime", INI::parseRetailFramesUnsignedInt, NULL, offsetof( ParticleSystemTemplate, m_systemLifetime ) },{ "Size", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_startSize ) },+ // per particle emitted, not per frame{ "StartSizeRate", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_startSizeRate ) },- { "SizeRate", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_sizeRate ) },- { "SizeRateDamping", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_sizeRateDamping ) },+ { "SizeRate", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_sizeRate ) },+ { "SizeRateDamping", parseRetailPerFrameFactorRandom, NULL, offsetof( ParticleSystemTemplate, m_sizeRateDamping ) },{ "Alpha1", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[0] ) },{ "Alpha2", ParticleSystemTemplate::parseRandomKeyframe, NULL, offsetof( ParticleSystemTemplate, m_alphaKey[1] ) },@@ -3235,27 +3293,27 @@ const FieldParse ParticleSystemTemplate::m_fieldParseTable[] ={ "Color8", ParticleSystemTemplate::parseRGBColorKeyframe,NULL, offsetof( ParticleSystemTemplate, m_colorKey[7] ) },// { "COLOR", ParticleSystemTemplate::parseRandomRGBColor, NULL, offsetof( ParticleSystemTemplate, m_color ) },- { "ColorScale", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_colorScale ) },+ { "ColorScale", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_colorScale ) },- { "BurstDelay", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_burstDelay ) },+ { "BurstDelay", parseRetailBurstDelayRandom, NULL, offsetof( ParticleSystemTemplate, m_burstDelay ) },{ "BurstCount", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_burstCount ) },- { "InitialDelay", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_initialDelay ) },+ { "InitialDelay", parseRetailFramesRandom, NULL, offsetof( ParticleSystemTemplate, m_initialDelay ) },- { "DriftVelocity", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_driftVelocity ) },+ { "DriftVelocity", parseRetailPerFrameCoord3D, NULL, offsetof( ParticleSystemTemplate, m_driftVelocity ) },{ "VelocityType", INI::parseIndexList, EmissionVelocityTypeNames, offsetof( ParticleSystemTemplate, m_emissionVelocityType ) },- { "VelOrthoX", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.x ) },- { "VelOrthoY", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.y ) },- { "VelOrthoZ", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.z ) },+ { "VelOrthoX", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.x ) },+ { "VelOrthoY", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.y ) },+ { "VelOrthoZ", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.z ) },- { "VelSpherical", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.spherical.speed ) },- { "VelHemispherical", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.hemispherical.speed ) },+ { "VelSpherical", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.spherical.speed ) },+ { "VelHemispherical", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.hemispherical.speed ) },- { "VelCylindricalRadial", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.radial ) },- { "VelCylindricalNormal", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.normal ) },+ { "VelCylindricalRadial", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.radial ) },+ { "VelCylindricalNormal", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.normal ) },- { "VelOutward", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.speed ) },- { "VelOutwardOther", INI::parseGameClientRandomVariable, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.otherSpeed ) },+ { "VelOutward", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.speed ) },+ { "VelOutwardOther", parseRetailPerFrameRandom, NULL, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.otherSpeed ) },{ "VolumeType", INI::parseIndexList, EmissionVolumeTypeNames, offsetof( ParticleSystemTemplate, m_emissionVolumeType ) },{ "VolLineStart", INI::parseCoord3D, NULL, offsetof( ParticleSystemTemplate, m_emissionVolume.line.start ) },@@ -3275,8 +3333,8 @@ const FieldParse ParticleSystemTemplate::m_fieldParseTable[] ={ "WindMotion", INI::parseIndexList, WindMotionNames, offsetof( ParticleSystemTemplate, m_windMotion ) },- { "WindAngleChangeMin", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windAngleChangeMin ) },- { "WindAngleChangeMax", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windAngleChangeMax ) },+ { "WindAngleChangeMin", INI::parseRetailPerFrameReal, NULL, offsetof( ParticleSystemTemplate, m_windAngleChangeMin ) },+ { "WindAngleChangeMax", INI::parseRetailPerFrameReal, NULL, offsetof( ParticleSystemTemplate, m_windAngleChangeMax ) },{ "WindPingPongStartAngleMin", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMin ) },{ "WindPingPongStartAngleMax", INI::parseReal, NULL, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMax ) },@@ -3299,7 +3357,7 @@ void ParticleSystemTemplate::parseRandomKeyframe( INI* ini, void *instance,Real low = ini->scanReal(ini->getNextToken());Real high = ini->scanReal(ini->getNextToken());- key->frame = ini->scanUnsignedInt(ini->getNextToken());+ key->frame = ConvertRetailFrames(ini->scanUnsignedInt(ini->getNextToken()));// set the range of the random variablekey->var.setRange( low, high );@@ -3315,7 +3373,7 @@ void ParticleSystemTemplate::parseRGBColorKeyframe( INI* ini, void *instance,RGBColorKeyframe *key = static_cast<RGBColorKeyframe *>(store);INI::parseRGBColor( ini, instance, &key->color, NULL );- INI::parseUnsignedInt( ini, instance, &key->frame, NULL );+ INI::parseRetailFramesUnsignedInt( ini, instance, &key->frame, NULL );}// ------------------------------------------------------------------------------------------------@@ -3518,7 +3576,7 @@ void ParticleSystemManager::init( void )if( TheGlobalData && TheGlobalData->m_particleGroundBounce ){for( TemplateMap::iterator it = m_templateMap.begin(); it != m_templateMap.end(); ++it )- it->second->forceGroundCollision( 0.35f, 0.6f );+ it->second->forceGroundCollision( 0.35f, ConvertRetailPerFrameFactor( 0.6f ) );DEBUG_LOG(("-particlebounce: terrain collision forced on for %d particle systems\n",(Int)m_templateMap.size()));}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cppindex 050f5a301..12913f845 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp@@ -227,7 +227,7 @@ private:static Int frameToShowObstacles;-static UnsignedInt ZONE_UPDATE_FREQUENCY = 300;+static UnsignedInt ZONE_UPDATE_FREQUENCY = 10 * LOGICFRAMES_PER_SECOND;//-----------------------------------------------------------------------------------PathNode::PathNode() :@@ -1421,7 +1421,7 @@ void Path::computePointOnPath(/* The last place a lane can die: the band measured as one cell wide, the taper closedit, or the line to the lane point is not drivable. Logged once a second per unit -every frame is a megabyte a minute and says nothing more. */- if (TheGlobalData->m_showLanes && (TheGameLogic->getFrame() % 30) == 0)+ if (TheGlobalData->m_showLanes && (TheGameLogic->getFrame() % LOGICFRAMES_PER_SECOND) == 0){DEBUG_LOG(("SHOWLANES cpop: unit %d lane=%.2f room=%.0f/%.0f left=%.0f lateral=%.1f applied=%d\n",obj->getID(), ai->getLaneFraction(), leftRoom, rightRoom, remaining, lateral,@@ -1528,8 +1528,11 @@ Real Path::computeFlightDistToGoal( const Coord3D *pos, Coord3D& goalPos )Tried a second time next to the request cap below, in case the cap changed the arithmetic: itdoes not. 2500 cells with three requests a frame gives mean 1.24ms to 1.30 and blocked 7,191 to- 9,837. Cells are the wrong knob on this queue; requests are the right one. */-enum { PATHFIND_CELLS_PER_FRAME=5000}; // Number of cells we will search pathfinding per frame.+ 9,837. Cells are the wrong knob on this queue; requests are the right one.++ Those numbers are at 30 logic frames a second. At 60 the budget is halved, so the queue searches+ the same 150,000 cells a second it was fitted at and a frame half as long spends half the time. */+enum { PATHFIND_CELLS_PER_FRAME = 5000 / LOGICFRAMES_PER_RETAIL_FRAME }; // Number of cells we will search pathfinding per frame.// A* open+closed sets draw from this pool; running dry aborts the search (no path) after// burning the time. Retail 30000 was sized for 2003 memory - a long detour around a// mountain on a large map can need more. 48 bytes each, so this is ~7 MB.@@ -7644,6 +7647,9 @@ void Pathfinder::processPathfindQueue(void)waiting answered the backlog sooner and made the army leave later, the last unit 23.2 s afterthe order against 19.1 s, with one of them never arriving. The back of a packed army waits forthe front to clear, not for its path, and more paths at once is more units shoving. */+ /* Kept at three per frame at 60 logic frames a second rather than halved: one and a half is not a+ count, two was measured worse, and the cap is there to clip a burst within a frame, which a+ frame half as long needs no less. */enum { PATHFIND_REQUESTS_PER_FRAME = 3 };Int requestsThisFrame = 0;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cppindex 413d90bb2..bc8eee51c 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp@@ -1024,8 +1024,9 @@ Object *AIPlayer::buildStructureNow(const ThingTemplate *bldgPlan, BuildListInfo* cells either way: half the width of the square rings it replaced. */static const Int BUILD_SEARCH_CELLS = 5;static const Int SKIRMISH_BUILD_SEARCH_CELLS = 60;-static const Int BUILD_PROBES_PER_FRAME = 32; ///< isLocationLegalToBuild calls one frame may spend-static const Int BUILD_EXPANSIONS_PER_FRAME = 512; ///< cells one frame may take off the flood's queue+/// Budgets fitted at 30 logic frames a second, halved at 60 so a search runs at the same pace per second.+static const Int BUILD_PROBES_PER_FRAME = 32 / LOGICFRAMES_PER_RETAIL_FRAME; ///< isLocationLegalToBuild calls one frame may spend+static const Int BUILD_EXPANSIONS_PER_FRAME = 512 / LOGICFRAMES_PER_RETAIL_FRAME; ///< cells one frame may take off the flood's queue/** How far from the base center, in base radii, a building that stays home may stand. Two, the* reach the home guard already answers to (the 2.0f * m_baseRadius lists). 1.25 was tried first:@@ -1127,7 +1128,7 @@ Object *AIPlayer::buildStructureWithDozer(const ThingTemplate *bldgPlan, BuildLilanding together, because a completed building shortcuts the timer that was meant to keepthe players apart.- The loser waits exactly one frame - a thirtieth of a second on a building that takes half a+ The loser waits exactly one frame - a sixtieth of a second on a building that takes half aminute to put up. The order is the player list order, so every machine defers the sameplayer on the same frame and a replay still matches. */if (!TheAI->claimBuildingPlacement(TheGameLogic->getFrame())) {diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cppindex 71c7e9e19..0d52f7499 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp@@ -1557,7 +1557,7 @@ StateReturnType AIDeadState::update(){// we want 'em to stop, but looks wonky if they stop dead in their tracks in onEnter.// this slows 'em down quickly- const Real FACTOR = 0.8f; // 0.8 ^ 30 == 0.012, so they slow to 4% of speed over 1 sec+ const Real FACTOR = ConvertRetailPerFrameFactor( 0.8f ); // 0.8 ^ 30 == 0.012 a second, so they slow to 4% of speed over 1 secReal vel = phys->getVelocityMagnitude();phys->scrubVelocity2D(vel * FACTOR);}@@ -3278,7 +3278,7 @@ StateReturnType AIPickUpCrateState::onEnter()}setAdjustsDestination(true);m_goalPosition = *goalObj->getPosition();- m_delayCounter = 3;+ m_delayCounter = ConvertRetailFrames( 3 );return STATE_CONTINUE;}@@ -5124,7 +5124,7 @@ StateReturnType AIWanderState::onEnter()m_groupOffset.y = GameLogicRandomValue(-delta, delta)*PATHFIND_CELL_SIZE_F;}m_timer = 0;- m_waitFrames = 10 + (getMachineOwner()->getID() & 0x7);+ m_waitFrames = ConvertRetailFrames( (Int)(10 + (getMachineOwner()->getID() & 0x7)) );// set initial movement goalcomputeGoal(false);StateReturnType ret = AIInternalMoveToState::onEnter();@@ -5249,7 +5249,7 @@ StateReturnType AIWanderInPlaceState::onEnter()m_goalPosition.x += offset.x;m_goalPosition.y += offset.y;m_timer = 0;- m_waitFrames = 10 + (getMachineOwner()->getID() & 0x7);+ m_waitFrames = ConvertRetailFrames( (Int)(10 + (getMachineOwner()->getID() & 0x7)) );StateReturnType ret = AIInternalMoveToState::onEnter();return ret;}@@ -5360,7 +5360,7 @@ StateReturnType AIPanicState::onEnter()StateReturnType ret = AIInternalMoveToState::onEnter();m_timer = 0;- m_waitFrames = 10 + (getMachineOwner()->getID() & 0x7);+ m_waitFrames = ConvertRetailFrames( (Int)(10 + (getMachineOwner()->getID() & 0x7)) );// Update the extra path distance. AIInternalMoveToState::onEnter resets it.ai->setPathExtraDistance(calcExtraPathDistance());if (obj)diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/OrderQueue.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/OrderQueue.cppindex d00d61dae..9dae5b34d 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/OrderQueue.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/OrderQueue.cpp@@ -39,9 +39,9 @@// How long everyone in a chain has to have been off its order before the next one goes out. A unit// that has just been given an order can read as idle for a frame while it is still being set up, and-// an aircraft taxiing out holds its order rather than being on it; four frames is an eighth of a-// second, which is invisible at a corner and longer than either of those.-static const UnsignedInt STEP_SETTLE_FRAMES = 4;+// an aircraft taxiing out holds its order rather than being on it; four retail frames is an eighth of+// a second, which is invisible at a corner and longer than either of those.+static const UnsignedInt STEP_SETTLE_FRAMES = 4 * LOGICFRAMES_PER_RETAIL_FRAME;//-------------------------------------------------------------------------------------------------QueuedOrder::QueuedOrder( void ) : m_type( GameMessage::MSG_INVALID )diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cppindex 9ad773cc3..828818d62 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp@@ -776,7 +776,7 @@ UpdateSleepTime TurretAI::updateTurretAI()if (m_didFire){// if we fired, enable sweeping for a few frames.- const Int ENABLE_SWEEP_FRAME_COUNT = 3;+ const Int ENABLE_SWEEP_FRAME_COUNT = 3 * LOGICFRAMES_PER_RETAIL_FRAME;m_enableSweepUntil = now + ENABLE_SWEEP_FRAME_COUNT;m_continuousFireExpirationFrame = now + ENABLE_SWEEP_FRAME_COUNT;// so the recent firing will not interrupt the moving sound}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/WaterGridMotion.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/WaterGridMotion.cppindex 96c64867f..c56d73812 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/WaterGridMotion.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/WaterGridMotion.cpp@@ -39,8 +39,9 @@ void WaterGridMotion::updateForLogicFrame( UnsignedInt currLogicFrame, Bool doWaif( doWaterGrid && meshInMotion == TRUE ){const Real PREFERRED_HEIGHT_FUDGE = 1.0f; ///< this is close enough to at rest- const Real AT_REST_VELOCITY_FUDGE = 1.0f; ///< when we're close enought to at rest height and velocity we will stop- const Real WATER_DAMPENING = 0.93f; ///< use with up force of 15.0+ // tuned per 30 Hz frame; velocity is per logic frame and gravity already per logic frame squared+ const Real AT_REST_VELOCITY_FUDGE = ConvertRetailPerFrameRate( 1.0f ); ///< when we're close enought to at rest height and velocity we will stop+ const Real WATER_DAMPENING = ConvertRetailPerFrameFactor( 0.93f ); ///< use with up force of 15.0Int i, j;Int mx = gridCellsX+1;Int my = gridCellsY+1;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cppindex 8a6d560f4..4b74bb5b8 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BattleBusSlowDeathBehavior.cpp@@ -52,8 +52,8 @@enum{- GROUND_CHECK_DELAY = 10, ///< Check for colliding with the ground only after this long, to prevent hitting on the way up- EMPTY_HULK_CHECK_DELAY = 15 ///< Check for empty hulk every this often instead of every frame+ GROUND_CHECK_DELAY = ConvertRetailFrames(10), ///< Check for colliding with the ground only after this long, to prevent hitting on the way up+ EMPTY_HULK_CHECK_DELAY = ConvertRetailFrames(15) ///< Check for empty hulk every this often instead of every frame};///////////////////////////////////////////////////////////////////////////////////////////////////@@ -71,7 +71,7 @@ BattleBusSlowDeathBehaviorModuleData::BattleBusSlowDeathBehaviorModuleData( voidm_fxHitGround = NULL;m_oclHitGround = NULL;- m_throwForce = 1.0f;+ m_throwForce = ConvertRetailPerFrameRate(1.0f);m_percentDamageToPassengers = 0.0f;m_emptyHulkDestructionDelay = 0;@@ -92,7 +92,7 @@ BattleBusSlowDeathBehaviorModuleData::BattleBusSlowDeathBehaviorModuleData( void{ "FXHitGround", INI::parseFXList, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_fxHitGround ) },{ "OCLHitGround", INI::parseObjectCreationList, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_oclHitGround ) },- { "ThrowForce", INI::parseReal, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_throwForce ) },+ { "ThrowForce", INI::parseRetailPerFrameReal, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_throwForce ) },{ "PercentDamageToPassengers", INI::parsePercentToReal, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_percentDamageToPassengers ) },{ "EmptyHulkDestructionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( BattleBusSlowDeathBehaviorModuleData, m_emptyHulkDestructionDelay ) },diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cppindex 9988b7bfe..898f421a7 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeBehavior.cpp@@ -61,8 +61,8 @@BridgeBehaviorModuleData::BridgeBehaviorModuleData( void ){- m_lateralScaffoldSpeed = 1.0f;- m_verticalScaffoldSpeed = 1.0f;+ m_lateralScaffoldSpeed = ConvertRetailPerFrameRate(1.0f);+ m_verticalScaffoldSpeed = ConvertRetailPerFrameRate(1.0f);} // end BridgeBehaviorModuleDatadiff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cppindex 4ea04722c..34f91b960 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BridgeScaffoldBehavior.cpp@@ -46,8 +46,8 @@ BridgeScaffoldBehavior::BridgeScaffoldBehavior( Thing *thing, const ModuleData *m_riseToPos.zero();m_buildPos.zero();m_targetPos.zero();- m_lateralSpeed = 1.0f;- m_verticalSpeed = 1.0f;+ m_lateralSpeed = ConvertRetailPerFrameRate(1.0f);+ m_verticalSpeed = ConvertRetailPerFrameRate(1.0f);} // end BridgeScaffoldBehavior@@ -215,8 +215,8 @@ UpdateSleepTime BridgeScaffoldBehavior::update( void )// make sure that speed can't get so incredibly small that we never finish our// movement no matter what the speed and distance are//- if( speed < 0.001f )- speed = 0.001f;+ if( speed < ConvertRetailPerFrameRate(0.001f) )+ speed = ConvertRetailPerFrameRate(0.001f);// compute the new position given the speedCoord3D newPos;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cppindex ae6418efb..5e06c180c 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/BunkerBusterBehavior.cpp@@ -61,7 +61,7 @@ BunkerBusterBehaviorModuleData::BunkerBusterBehaviorModuleData( void )m_upgradeRequired = NULL;m_detonationFX = NULL;m_crashThroughBunkerFX = NULL;- m_crashThroughBunkerFXFrequency = 4;+ m_crashThroughBunkerFXFrequency = ConvertRetailFrames(4u);m_seismicEffectRadius = 140.0f;m_seismicEffectMagnitude = 6.0f;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cppindex 39907c89b..e0842b7c3 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp@@ -351,9 +351,9 @@ void CountermeasuresBehavior::launchVolley()vel.z = 0.0f;Real velocity = physics->getVelocityMagnitude();- if( velocity < 1.0f )+ if( velocity < ConvertRetailPerFrameRate(1.0f) ){- velocity = -10.0f;+ velocity = ConvertRetailPerFrameRate(-10.0f);}vel.scale( velocity * data->m_volleyVelocityFactor );diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cppindex 5050e96bb..7bbebcd9c 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp@@ -397,9 +397,10 @@ void DumbProjectileBehavior::projectileFireAtObjectOrPosition( const Object *vicPhysicsBehavior* physics = projectile->getPhysics();if ( d->m_tumbleRandomly && physics){- physics->setPitchRate( GameLogicRandomValueReal( -1.0f/PI, 1.0f/PI ) );- physics->setYawRate( GameLogicRandomValueReal( -1.0f/PI, 1.0f/PI ) );- physics->setRollRate( GameLogicRandomValueReal( -1.0f/PI, 1.0f/PI ) );+ const Real maxTumbleRate = ConvertRetailPerFrameRate( 1.0f/PI );+ physics->setPitchRate( GameLogicRandomValueReal( -maxTumbleRate, maxTumbleRate ) );+ physics->setYawRate( GameLogicRandomValueReal( -maxTumbleRate, maxTumbleRate ) );+ physics->setRollRate( GameLogicRandomValueReal( -maxTumbleRate, maxTumbleRate ) );}m_flightPathStart = *getObject()->getPosition();diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cppindex 07a637ff5..0be5261eb 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp@@ -113,9 +113,9 @@ JetSlowDeathBehaviorModuleData::JetSlowDeathBehaviorModuleData( void ){ "DeathLoopSound", INI::parseAudioEventRTS, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_deathLoopSound ) },// @todo srj -- RollRate and RollRateDelta and PitchRate should use parseAngularVelocityReal- { "RollRate", INI::parseReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_rollRate ) },+ { "RollRate", INI::parseRetailPerFrameReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_rollRate ) },{ "RollRateDelta", INI::parsePercentToReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_rollRateDelta ) },- { "PitchRate", INI::parseReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_pitchRate ) },+ { "PitchRate", INI::parseRetailPerFrameReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_pitchRate ) },{ "FallHowFast", INI::parsePercentToReal, NULL, offsetof( JetSlowDeathBehaviorModuleData, m_fallHowFast ) },{ 0, 0, 0, 0 }@@ -256,7 +256,7 @@ UpdateSleepTime JetSlowDeathBehavior::update( void )physics->setRollRate( m_rollRate );// adjust the roll rate over time- m_rollRate *= modData->m_rollRateDelta;+ m_rollRate *= ConvertRetailPerFrameFactor( modData->m_rollRateDelta );// do effects for death while in the airif( m_timerOnGroundFrame == 0 )@@ -274,7 +274,7 @@ UpdateSleepTime JetSlowDeathBehavior::update( void )Locomotor *locomotor = ai ? ai->getCurLocomotor() : NULL;if( locomotor ){- const Real LIFT_BLEED_PER_FRAME = 0.1f;+ const Real LIFT_BLEED_PER_FRAME = 1.0f - ConvertRetailPerFrameFactor( 1.0f - 0.1f );const Real MIN_FALL_FRACTION = 0.5f;const Real fallFraction = max( MIN_FALL_FRACTION, modData->m_fallHowFast );const Real fallingLift = -TheGlobalData->m_gravity * (1.0f - fallFraction);diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cppindex 2467fba87..72ded2c3d 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/MinefieldBehavior.cpp@@ -223,7 +223,7 @@ UpdateSleepTime MinefieldBehavior::update()continue;if (TheGameLogic->findObjectByID(m_immunes[i].id) == NULL ||- now > m_immunes[i].collideTime + 2)+ now > m_immunes[i].collideTime + ConvertRetailFrames(2u) + 1){//DEBUG_LOG(("expiring an immunity %d\n",m_immunes[i].id));m_immunes[i].id = INVALID_ID; // he's dead, jim.diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cppindex 1f6c88a8d..966efab22 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp@@ -85,7 +85,7 @@ PropagandaTowerBehaviorModuleData::PropagandaTowerBehaviorModuleData( void ){m_scanRadius = 1.0f;- m_scanDelayInFrames = 100;+ m_scanDelayInFrames = ConvertRetailFrames(100u);m_autoHealPercentPerSecond = 0.01f;m_upgradedAutoHealPercentPerSecond = 0.02f;m_pulseFX = NULL;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cppindex 6ee3aa45c..00814d3f9 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SlowDeathBehavior.cpp@@ -145,8 +145,8 @@ static void parseWeapon( INI* ini, void *instance, void * /*store*/, const void*{ "FX", parseFX, NULL, 0 },{ "OCL", parseOCL, NULL, 0 },{ "Weapon", parseWeapon, NULL, 0 },- { "FlingForce", INI::parseReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingForce) },- { "FlingForceVariance", INI::parseReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingForceVariance) },+ { "FlingForce", INI::parseRetailPerFrameReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingForce) },+ { "FlingForceVariance", INI::parseRetailPerFrameReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingForceVariance) },{ "FlingPitch", INI::parseAngleReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingPitch) },{ "FlingPitchVariance", INI::parseAngleReal, NULL, offsetof( SlowDeathBehaviorModuleData, m_flingPitchVariance) },{ 0, 0, 0, 0 }@@ -233,7 +233,7 @@ void SlowDeathBehavior::beginSlowDeath(const DamageInfo *damageInfo)// this object sinks slowly after it dies so don't draw a// floating shadow decal on the ground above it.obj->getDrawable()->setShadowsEnabled(false);- draw->setTerrainDecalFadeTarget( 0.0f, -0.2f );+ draw->setTerrainDecalFadeTarget( 0.0f, ConvertRetailPerFrameRate(-0.2f) );}@@ -308,7 +308,7 @@ void SlowDeathBehavior::beginSlowDeath(const DamageInfo *damageInfo)physics->setAllowToFall(true);physics->applyForce(&force);physics->setExtraBounciness(-1.0); // we don't want this guy to bounce at all- physics->setExtraFriction(-3 * SECONDS_PER_LOGICFRAME_REAL); // reduce his ground friction a bit+ physics->setExtraFriction(-3.0f / RETAIL_LOGICFRAMES_PER_SECOND); // reduce his ground friction a bitphysics->setAllowBouncing(true);Real orientation = ATan2(force.y, force.x);physics->setAngles(orientation, 0, 0);diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cppindex ad85e966b..884bdbd21 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/SpawnBehavior.cpp@@ -60,7 +60,7 @@-#define SPAWN_DELAY_MIN_FRAMES (16) // about as rapidly as you'd expect people to successively exit through the same door+#define SPAWN_DELAY_MIN_FRAMES (ConvertRetailFrames(16))// about as rapidly as you'd expect people to successively exit through the same door//-------------------------------------------------------------------------------------------------SpawnBehavior::SpawnBehavior( Thing *thing, const ModuleData* moduleData ): UpdateModule( thing, moduleData )@@ -218,7 +218,7 @@ UpdateSleepTime SpawnBehavior::update( void )bar and on click-one-select-all, neither of which anybody can see. The offset is an objectid, which is assigned in creation order and is identical on every machine, so this staysinside the CRC. */- const Int AGGREGATE_STATE_RATE = 6;+ const Int AGGREGATE_STATE_RATE = ConvertRetailFrames(6);if ( m_aggregateHealth &&((TheGameLogic->getFrame() + (UnsignedInt)getObject()->getID()) % AGGREGATE_STATE_RATE) == 0 ){diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cppindex da7da409b..2d176d889 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp@@ -628,7 +628,10 @@ void ActiveBody::attemptDamage( DamageInfo *damageInfo )// (object pointer loses scope as soon as atteptdamage's caller ends)// m_lastDamageTimestamp is initialized to FFFFFFFFFF, so doing a < compare is problematic.// jba.- if (m_lastDamageTimestamp!=TheGameLogic->getFrame() && m_lastDamageTimestamp != TheGameLogic->getFrame()-1) {+ // the "one/next frame" window below is retail's: two retail frames less one logic frame; the+ // timestamp starts in the future+ UnsignedInt now = TheGameLogic->getFrame();+ if (m_lastDamageTimestamp > now || now - m_lastDamageTimestamp > ConvertRetailFrames(2u) - 1) {m_lastDamageInfo = *damageInfo;m_lastDamageCleared = false;m_lastDamageTimestamp = TheGameLogic->getFrame();diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cppindex d7032a1ef..c2ab23e48 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp@@ -33,6 +33,7 @@#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine#define DEFINE_OBJECT_STATUS_NAMES#include "Common/Xfer.h"+#include "GameLogic/GameLogic.h"#include "GameLogic/Object.h"#include "GameLogic/Module/FireWeaponCollide.h"@@ -61,6 +62,7 @@ FireWeaponCollide::FireWeaponCollide( Thing *thing, const ModuleData* moduleData{m_collideWeapon = TheWeaponStore->allocateNewWeapon(getFireWeaponCollideModuleData()->m_collideWeaponTemplate, PRIMARY_WEAPON);m_everFired = FALSE;+ m_lastFireFrame = NEVER_FIRED;}//-------------------------------------------------------------------------------------------------@@ -85,11 +87,17 @@ void FireWeaponCollide::onCollide( Object *other, const Coord3D *loc, const Coor// to hurt them all. Another solution would be to keep a Map of other->objetIDs and// delays for each individually. However, this solution here is so quick and simple that it// warrants the "do it eventually if we need it" clause.+ // At most once a retail frame: the reload is bypassed, so at twice the rate the damage a second+ // would double. The frame that fired keeps firing, for everyone else colliding in it.+ UnsignedInt now = TheGameLogic->getFrame();+ if( now != m_lastFireFrame && now < m_lastFireFrame + LOGICFRAMES_PER_RETAIL_FRAME )+ return;if( shouldFireWeapon() ){m_collideWeapon->loadAmmoNow( me );m_collideWeapon->fireWeapon( me, other );m_everFired = TRUE; // never set, so FireOnce did nothing+ m_lastFireFrame = now;}}@@ -128,13 +136,14 @@ void FireWeaponCollide::crc( Xfer *xfer )// ------------------------------------------------------------------------------------------------/** Xfer method* Version Info:- * 1: Initial version */+ * 1: Initial version+ * 2: m_lastFireFrame */// ------------------------------------------------------------------------------------------------void FireWeaponCollide::xfer( Xfer *xfer ){// version- XferVersion currentVersion = 1;+ XferVersion currentVersion = 2;XferVersion version = currentVersion;xfer->xferVersion( &version, currentVersion );@@ -163,6 +172,10 @@ void FireWeaponCollide::xfer( Xfer *xfer )// ever firedxfer->xferBool( &m_everFired );+ // last fire frame; an older save keeps the constructor's "never"+ if( version >= 2 )+ xfer->xferUnsignedInt( &m_lastFireFrame );+} // end xfer// ------------------------------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cppindex d782d1b48..6299cf541 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp@@ -394,10 +394,12 @@ UpdateSleepTime ParachuteContain::update( void )if (m_opened){- const Real PITCH_STIFFNESS = locomotor->getPitchStiffness();- const Real ROLL_STIFFNESS = locomotor->getRollStiffness();- const Real PITCH_DAMPING = locomotor->getPitchDamping() + altitudeDamping;- const Real ROLL_DAMPING = locomotor->getRollDamping() + altitudeDamping;+ // the locomotor's spring numbers and LowAltitudeDamping are retail per-frame values: the+ // spring is an acceleration, the damping a fraction of the rate taken off every frame+ const Real PITCH_STIFFNESS = ConvertRetailPerFrameSquared(locomotor->getPitchStiffness());+ const Real ROLL_STIFFNESS = ConvertRetailPerFrameSquared(locomotor->getRollStiffness());+ const Real PITCH_DAMPING = 1.0f - ConvertRetailPerFrameFactor(1.0f - (locomotor->getPitchDamping() + altitudeDamping));+ const Real ROLL_DAMPING = 1.0f - ConvertRetailPerFrameFactor(1.0f - (locomotor->getRollDamping() + altitudeDamping));m_pitchRate += ((-PITCH_STIFFNESS * m_pitch) + (-PITCH_DAMPING * m_pitchRate)); // spring/damperm_rollRate += ((-ROLL_STIFFNESS * m_roll) + (-ROLL_DAMPING * m_rollRate)); // spring/damperdiff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cppindex 028190af2..4d00bafba 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/CreateCrateDie.cpp@@ -244,7 +244,7 @@ Object *CreateCrateDie::createCrate( CrateTemplate const *currentCrateData )crateDrawable->setTerrainDecal(TERRAIN_DECAL_CRATE);crateDrawable->setTerrainDecalSize(2.5f * newCrate->getGeometryInfo().getMajorRadius(),2.5f * newCrate->getGeometryInfo().getMajorRadius() ) ;- crateDrawable->setTerrainDecalFadeTarget(1.0f, 0.03f);+ crateDrawable->setTerrainDecalFadeTarget(1.0f, ConvertRetailPerFrameRate(0.03f));}return newCrate;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cppindex e4007fed4..5644a9284 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Helper/ObjectDefectionHelper.cpp@@ -94,7 +94,7 @@ UpdateSleepTime ObjectDefectionHelper::update(){Bool lastPhase = ( ((Int)m_defectionDetectionFlashPhase) & 1 );// were we in a flashy phase last frame?UnsignedInt timeLeft = m_defectionDetectionEnd - now;- m_defectionDetectionFlashPhase += 0.5f * ( 1.0f - ((Real)timeLeft / DEFECTION_DETECTION_TIME_MAX ) );+ m_defectionDetectionFlashPhase += ConvertRetailPerFrameRate(0.5f) * ( 1.0f - ((Real)timeLeft / DEFECTION_DETECTION_TIME_MAX ) );Bool thisPhase = ( ((Int)m_defectionDetectionFlashPhase) & 1 );// are we in a flashy phase this frame?if ( lastPhase && ( ! thisPhase ) )diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cppindex a8e08a59e..ff4249874 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp@@ -57,23 +57,24 @@static const Real DONUT_TIME_DELAY_SECONDS=2.5f;static const Real DONUT_DISTANCE=4.0*PATHFIND_CELL_SIZE_F;-// Ground vehicles (Locomotor::isGroundVehicle). Speeds are per frame, as everywhere in this file.-static const Real VEHICLE_ACCEL_EASE_FRAMES = 6.0f; // frames for the pull along the nose to build up to full Acceleration-static const Real VEHICLE_BRAKE_EASE_FRAMES = 3.0f; // and to full braking, which a driver stamps on harder-static const Real VEHICLE_VELOCITY_FRAMES = 4.0f; // a speed error is asked back over about this many frames-static const Real VEHICLE_STOP_EASE_FRAMES = 4.0f; // a planned stop fades out over about this many frames+// Ground vehicles (Locomotor::isGroundVehicle). Speeds are per frame, as everywhere in this file;+// the frame counts were tuned at the retail rate.+static const Real VEHICLE_ACCEL_EASE_FRAMES = ConvertRetailFrames(6.0f); // frames for the pull along the nose to build up to full Acceleration+static const Real VEHICLE_BRAKE_EASE_FRAMES = ConvertRetailFrames(3.0f); // and to full braking, which a driver stamps on harder+static const Real VEHICLE_VELOCITY_FRAMES = ConvertRetailFrames(4.0f); // a speed error is asked back over about this many frames+static const Real VEHICLE_STOP_EASE_FRAMES = ConvertRetailFrames(4.0f); // a planned stop fades out over about this many frames// a planned stop or bend is counted short by this many frames of travel, for the braking to build up instatic const Real VEHICLE_STOP_LEAD_FRAMES = VEHICLE_BRAKE_EASE_FRAMES + VEHICLE_VELOCITY_FRAMES;static const Real VEHICLE_PLAN_DECEL_SHARE = 0.85f; // a planned stop or bend brakes this much less hard than the vehicle canstatic const Real VEHICLE_TRAFFIC_BRAKE = 2.0f; // times its braking a vehicle may stamp on for traffic: slowed below its speed by the crowd, a bump or the groupstatic const Real VEHICLE_STOP_SECONDS = 0.8f; // no vehicle takes longer than this to stop from top speed, whatever its Braking-static const Real VEHICLE_YAW_EASE_FRAMES = 6.0f; // frames for a turn to wind up to TurnRate, or back down from it+static const Real VEHICLE_YAW_EASE_FRAMES = ConvertRetailFrames(6.0f); // frames for a turn to wind up to TurnRate, or back down from itstatic const Real VEHICLE_STILL_SHARE = 0.1f; // below this share of top speed a vehicle may choose to go forward or backstatic const Real VEHICLE_REVERSE_SHARE = 0.45f; // share of top speed a vehicle backs up atstatic const Real VEHICLE_REVERSE_BODY_LENGTHS = 3.0f; // a goal behind and closer than this along the route is backed up tostatic const Real VEHICLE_REVERSE_COS = -0.34f; // cos 110 degrees: behind, for thatstatic const Real VEHICLE_BEND_COS = 0.985f; // cos 10 degrees: a gentler bend is driven at full speed-static const Real VEHICLE_MIN_SLIDE = 0.08f; // the slide onto the goal in the last cell moves at least this far a frame+static const Real VEHICLE_MIN_SLIDE = ConvertRetailPerFrameRate(0.08f); // the slide onto the goal in the last cell moves at least this far a framestatic const Real TREAD_TURN_SPEED_FLOOR = 0.25f; // share of top speed a tank keeps through a right-angle turnstatic const Real TREAD_PIVOT_SHARE = 0.5f; // share of TurnRate a tank pivots on the spot atstatic const Real TREAD_PIVOT_COS = -0.17f; // cos 100 degrees: further round than this a tank stops and pivots@@ -82,8 +83,8 @@ static const Real WHEEL_MIN_RADIUS_BODY_LENGTHS = 1.5f; // a car turns no tightestatic const Real WHEEL_TIGHT_RADIUS_BODY_LENGTHS = 0.3f; // and then crawls round this, at its turn speed// Infantry on two legs (moveTowardsPositionLegs, maintainCurrentPositionLegs).-static const Real INFANTRY_YAW_EASE_FRAMES = 2.0f; // frames for a turn on the move to wind up to TurnRate, or back down from it-static const Real INFANTRY_STOP_FRAMES = 3.0f; // a soldier stops from top speed in this many frames, whatever its Braking+static const Real INFANTRY_YAW_EASE_FRAMES = ConvertRetailFrames(2.0f); // frames for a turn on the move to wind up to TurnRate, or back down from it+static const Real INFANTRY_STOP_FRAMES = ConvertRetailFrames(3.0f); // a soldier stops from top speed in this many frames, whatever its Braking#define MAX_BRAKING_FACTOR 5.0f@@ -93,7 +94,7 @@ static const Real INFANTRY_STOP_FRAMES = 3.0f; // a soldier stops from top spLocomotorStore *TheLocomotorStore = NULL; ///< the Locomotor store definitionconst Real BIGNUM = 99999.0f;-const Real ARC_LOOKAHEAD_FRAMES = 4.0f;+const Real ARC_LOOKAHEAD_FRAMES = ConvertRetailFrames(4.0f);const Real ARC_ARRIVE_RUN = 0.5f; // cos 60: a cruise missile's curve arrives in a sixty degree diveconst Real ARC_ARRIVE_DROP = 0.8660254f; // sin 60// handles as a share of the distance left: the long leaving one spreads the turn over the top of the@@ -556,9 +557,10 @@ void LocomotorTemplate::validate()//-------------------------------------------------------------------------------------------------static void parseFrictionPerSec( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ){+ // in PhysicsBehavior::setExtraFriction's units, the share per retail frameReal fricPerSec = INI::scanReal(ini->getNextToken());- Real fricPerFrame = fricPerSec * SECONDS_PER_LOGICFRAME_REAL;- *(Real *)store = fricPerFrame;+ Real fricPerRetailFrame = fricPerSec / RETAIL_LOGICFRAMES_PER_SECOND;+ *(Real *)store = fricPerRetailFrame;}//-------------------------------------------------------------------------------------------------@@ -1232,9 +1234,10 @@ void Locomotor::locoUpdate_moveTowardsPosition(Object* obj, const Coord3D& goalPheightAboveSurface -= obj->getCarrierDeckHeight();}- if (heightAboveSurface > -(3*3)*TheGlobalData->m_gravity)+ const Real AIRBORNE_FRAMES = ConvertRetailFrames(3.0f);+ if (heightAboveSurface > -sqr(AIRBORNE_FRAMES)*TheGlobalData->m_gravity){- // If we get high enough to stay up for 3 frames, then we left the ground.+ // If we get high enough to stay up for 3 retail frames, then we left the ground.treatAsAirborne = true;}// We apply a zero acceleration to all units, as the call to@@ -1439,7 +1442,7 @@ void Locomotor::moveTowardsPositionTreads(Object* obj, PhysicsBehavior *physics,Real slowDownDist = (actualSpeed/1.50f) * slowDownTime;if (sqr(dx)+sqr(dy)<sqr(2*PATHFIND_CELL_SIZE_F) && angleCoeff > 0.05) {- goalSpeed = actualSpeed*0.6f;+ goalSpeed = actualSpeed*ConvertRetailPerFrameFactor(0.6f); // every frame}if (onPathDistToGoal < slowDownDist && !getFlag(IS_BRAKING) && !getFlag(NO_SLOW_DOWN_AS_APPROACHING_DEST))@@ -1588,8 +1591,9 @@ void Locomotor::moveTowardsPositionWheels(Object* obj, PhysicsBehavior *physics,- Real slowDownTime = actualSpeed / getBraking() + 1.0f;- Real slowDownDist = (actualSpeed/1.5f) * slowDownTime + actualSpeed;+ // plus one retail frame of reaction, and of travel+ Real slowDownTime = actualSpeed / getBraking() + ConvertRetailFrames(1.0f);+ Real slowDownDist = (actualSpeed/1.5f) * slowDownTime + actualSpeed * ConvertRetailFrames(1.0f);Real effectiveSlowDownDist = slowDownDist;if (effectiveSlowDownDist < 1*PATHFIND_CELL_SIZE) {effectiveSlowDownDist = 1*PATHFIND_CELL_SIZE;@@ -2109,8 +2113,9 @@ Bool Locomotor::fixInvalidPosition(Object* obj, PhysicsBehavior *physics)if (dx || dy) {Coord3D correction;- correction.x = dx*physics->getMass()/5;- correction.y = dy*physics->getMass()/5;+ // pushed every frame it stands on bad ground+ correction.x = dx*physics->getMass()*ConvertRetailPerFrameSquared(0.2f);+ correction.y = dy*physics->getMass()*ConvertRetailPerFrameSquared(0.2f);correction.z = 0;Coord3D correctionNormalized = correction;@@ -2120,7 +2125,7 @@ Bool Locomotor::fixInvalidPosition(Object* obj, PhysicsBehavior *physics)// Kill current velocity in the direction of the correction.velocity = *physics->getVelocity();Real dot = (velocity.x*correctionNormalized.x) + (velocity.y*correctionNormalized.y);- if (dot>.25f) {+ if (dot>ConvertRetailPerFrameRate(.25f)) {// It was already leaving.return false;}@@ -2130,7 +2135,8 @@ Bool Locomotor::fixInvalidPosition(Object* obj, PhysicsBehavior *physics)//physics->clearAcceleration();if (dot<0) {- dot = sqrt(-dot);+ // EA's push is the root of the retail speed into the bad ground, applied every frame+ dot = ConvertRetailPerFrameSquared(sqrt(-dot * LOGICFRAMES_PER_RETAIL_FRAME));correctionNormalized.x *= dot*physics->getMass();correctionNormalized.y *= dot*physics->getMass();physics->applyMotiveForce(&correctionNormalized);@@ -2492,10 +2498,10 @@ void Locomotor::moveTowardsPositionHover(Object* obj, PhysicsBehavior *physics,FIGHTING_TURN_MIN_DIST away, so a short pull-back or slide keeps its nose and its missiles onthe target.*/-static const Real HELICOPTER_STOP_EASE_FRAMES = 6.0f; // the planned braking fades out over about this many frames-static const Real HELICOPTER_YAW_EASE_FRAMES = 10.0f; // frames for the nose to wind up to TurnRate, or back down from it-static const Real HELICOPTER_ACCEL_EASE_FRAMES = 5.0f; // frames for the pull to build from nothing to full Acceleration-static const Real HELICOPTER_VELOCITY_FRAMES = 4.0f; // a velocity error is asked back over about this many frames+static const Real HELICOPTER_STOP_EASE_FRAMES = ConvertRetailFrames(6.0f); // the planned braking fades out over about this many frames+static const Real HELICOPTER_YAW_EASE_FRAMES = ConvertRetailFrames(10.0f); // frames for the nose to wind up to TurnRate, or back down from it+static const Real HELICOPTER_ACCEL_EASE_FRAMES = ConvertRetailFrames(5.0f); // frames for the pull to build from nothing to full Acceleration+static const Real HELICOPTER_VELOCITY_FRAMES = ConvertRetailFrames(4.0f); // a velocity error is asked back over about this many frames// the stop is planned this many frames of travel early, for the braking to build up instatic const Real HELICOPTER_STOP_LEAD_FRAMES = HELICOPTER_ACCEL_EASE_FRAMES * 0.5f + HELICOPTER_VELOCITY_FRAMES;@@ -2914,7 +2920,9 @@ Real Locomotor::calcLiftToUseAtPt(Object* obj, PhysicsBehavior *physics, Real cumaxAccel = (curVelZ < 0) ? maxNetLift : TheGlobalData->m_gravity;// see how far we need to slow to dead stop, given max brakingReal desiredAccel;- const Real TINY_ACCEL = 0.001f;+ const Real TINY_ACCEL = ConvertRetailPerFrameSquared(0.001f);+ // the corrections below aim to land over one retail frame, so the hover answers as fast as it did+ const Real CORRECTION_FRAMES = ConvertRetailFrames(1.0f);if (fabs(maxAccel) > TINY_ACCEL){Real deltaZ = preferredHeight - curZ;@@ -2933,7 +2941,7 @@ Real Locomotor::calcLiftToUseAtPt(Object* obj, PhysicsBehavior *physics, Real cuelse if (fabs(curVelZ) > m_template->m_speedLimitZ){// or, if we're going too fast, limit it here.- desiredAccel = m_template->m_speedLimitZ - curVelZ;+ desiredAccel = (m_template->m_speedLimitZ - curVelZ) / CORRECTION_FRAMES;}else{@@ -2945,10 +2953,10 @@ Real Locomotor::calcLiftToUseAtPt(Object* obj, PhysicsBehavior *physics, Real cu// and// t = (-v +- sqrt(v*v + 2*a*dz))/a//- // but if we assume t=1, then+ // but if we assume t=1 retail frame, then// a=2(dz-v)// then, plug it back in and see if t is really 1...- desiredAccel = 2.0f * (deltaZ - curVelZ);+ desiredAccel = 2.0f * (deltaZ - curVelZ * CORRECTION_FRAMES) / sqr(CORRECTION_FRAMES);}}elsediff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cppindex c13d23328..d606c2fea 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp@@ -1798,7 +1798,8 @@ inline Bool isPosDifferent(const Coord3D* a, const Coord3D* b)// "standing still", due to roundoff errors. It's important that we only invalidate// the PartitionManager stuff when the pos/orientation really changes (for efficiency purposes)// so we must put in some cleverness...- const Real THRESH = 0.01f;+ // a move per frame: scaled with the frame so the slowest mover that dirties its cells is unchanged+ const Real THRESH = ConvertRetailPerFrameRate(0.01f);if (fabs(a->x - b->x) > THRESH)return true;@@ -1820,7 +1821,7 @@ inline Bool isAngleDifferent(Real a, Real b)// the PartitionManager stuff when the pos/orientation really changes (for efficiency purposes)// so we must put in some cleverness...- const Real THRESH = 0.01f; // in radians, this is approx 1/2 degree.+ const Real THRESH = ConvertRetailPerFrameRate(0.01f); // radians turned in one frame; 0.01 is approx 1/2 degree.if (fabs(a - b) > THRESH)return true;@@ -5059,7 +5060,7 @@ void Object::onDie( DamageInfo *damageInfo )// Just in case I have been sporting one of thise fancy Terrain Decals,//I naturally lose it now, because I'm dead.Drawable *draw = getDrawable();- if (draw) draw->setTerrainDecalFadeTarget(0.0f, -0.03f);//fade...+ if (draw) draw->setTerrainDecalFadeTarget(0.0f, ConvertRetailPerFrameRate(-0.03f));//fade...//if (draw) draw->setTerrainDecal(TERRAIN_DECAL_NONE);//pop!diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cppindex 1d0f95ddb..3f80bf55f 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp@@ -674,8 +674,8 @@ public:static const FieldParse myFieldParse[] ={{ "SpinRate", INI::parseAngularVelocityReal, NULL, offsetof(ApplyRandomForceNugget, m_spinRate) },- { "MinForceMagnitude", INI::parseReal, NULL, offsetof(ApplyRandomForceNugget, m_minMag) },- { "MaxForceMagnitude", INI::parseReal, NULL, offsetof(ApplyRandomForceNugget, m_maxMag) },+ { "MinForceMagnitude", INI::parseRetailPerFrameReal, NULL, offsetof(ApplyRandomForceNugget, m_minMag) },+ { "MaxForceMagnitude", INI::parseRetailPerFrameReal, NULL, offsetof(ApplyRandomForceNugget, m_maxMag) },{ "MinForcePitch", INI::parseAngleReal, NULL, offsetof(ApplyRandomForceNugget, m_minPitch) },{ "MaxForcePitch", INI::parseAngleReal, NULL, offsetof(ApplyRandomForceNugget, m_maxPitch) },{ 0, 0, 0, 0 }@@ -728,9 +728,10 @@ std::vector<AsciiString> debrisModelNamesGlobalHack;//-------------------------------------------------------------------------------------------------static void parseFrictionPerSec( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ){+ // in PhysicsBehavior::setExtraFriction's units, the share per retail frame; its friction getters+ // add it to the base friction and convert the sum to the current rate onceReal fricPerSec = INI::scanReal(ini->getNextToken());- Real fricPerFrame = fricPerSec * SECONDS_PER_LOGICFRAME_REAL;- *(Real *)store = fricPerFrame;+ *(Real *)store = fricPerSec / (Real)RETAIL_LOGICFRAMES_PER_SECOND;}//-------------------------------------------------------------------------------------------------@@ -837,13 +838,13 @@ public:{ "ExtraFriction", parseFrictionPerSec, NULL, offsetof( GenericObjectCreationNugget, m_extraFriction ) },{ "Offset", INI::parseCoord3D, NULL, offsetof( GenericObjectCreationNugget, m_offset ) },{ "Disposition", INI::parseBitString32, DebrisDispositionNames, offsetof( GenericObjectCreationNugget, m_disposition ) },- { "DispositionIntensity", INI::parseReal, NULL, offsetof( GenericObjectCreationNugget, m_dispositionIntensity ) },+ { "DispositionIntensity", INI::parseRetailPerFrameReal, NULL, offsetof( GenericObjectCreationNugget, m_dispositionIntensity ) },{ "SpinRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_spinRate) },{ "YawRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_yawRate) },{ "RollRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_rollRate) },{ "PitchRate", INI::parseAngularVelocityReal, NULL, offsetof(GenericObjectCreationNugget, m_pitchRate) },- { "MinForceMagnitude", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_minMag) },- { "MaxForceMagnitude", INI::parseReal, NULL, offsetof(GenericObjectCreationNugget, m_maxMag) },+ { "MinForceMagnitude", INI::parseRetailPerFrameReal, NULL, offsetof(GenericObjectCreationNugget, m_minMag) },+ { "MaxForceMagnitude", INI::parseRetailPerFrameReal, NULL, offsetof(GenericObjectCreationNugget, m_maxMag) },{ "MinForcePitch", INI::parseAngleReal, NULL, offsetof(GenericObjectCreationNugget, m_minPitch) },{ "MaxForcePitch", INI::parseAngleReal, NULL, offsetof(GenericObjectCreationNugget, m_maxPitch) },{ "MinLifetime", INI::parseDurationUnsignedInt, NULL, offsetof( GenericObjectCreationNugget, m_minFrames ) },diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cppindex 4197b80be..da6fb1b04 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp@@ -638,11 +638,11 @@ void AIUpdateInterface::requestPath( Coord3D *destination, Bool isFinalGoal )return;}m_waitingForPath = TRUE;- if (m_pathTimestamp > TheGameLogic->getFrame()-3) {+ if (m_pathTimestamp > TheGameLogic->getFrame()-ConvertRetailFrames(3)) {/* Requesting path very quickly. Can cause a spin. The spin needs a gap between twopaths, not the one or two seconds EA waited here, which left a unit that had just beengiven a second order standing still or walking the old path until the timer ran out. So- the request waits out the rest of the three frames and no longer. */+ the request waits out the rest of the tenth of a second and no longer. */setQueueForPathTime(repathDebounceFrames());// See if it has been too soon.// jba intense debug@@ -672,7 +672,7 @@ void AIUpdateInterface::requestAttackPath( ObjectID victimID, const Coord3D* vicm_isApproachPath = FALSE;m_isSafePath = FALSE;m_waitingForPath = TRUE;- if (m_pathTimestamp > TheGameLogic->getFrame()-3) {+ if (m_pathTimestamp > TheGameLogic->getFrame()-ConvertRetailFrames(3)) {/* Requesting path very quickly. Can cause a spin. */setQueueForPathTime(repathDebounceFrames());setLocomotorGoalNone();@@ -695,7 +695,7 @@ void AIUpdateInterface::requestApproachPath( Coord3D *destination )m_isApproachPath = TRUE;m_isSafePath = FALSE;m_waitingForPath = TRUE;- if (m_pathTimestamp > TheGameLogic->getFrame()-3) {+ if (m_pathTimestamp > TheGameLogic->getFrame()-ConvertRetailFrames(3)) {/* Requesting path very quickly. Can cause a spin. */setQueueForPathTime(repathDebounceFrames());return;@@ -718,7 +718,7 @@ void AIUpdateInterface::requestSafePath( ObjectID repulsor )m_isApproachPath = FALSE;m_isSafePath = TRUE;m_waitingForPath = TRUE;- if (m_pathTimestamp > TheGameLogic->getFrame()-3) {+ if (m_pathTimestamp > TheGameLogic->getFrame()-ConvertRetailFrames(3)) {/* Requesting path very quickly. Can cause a spin. */setQueueForPathTime(repathDebounceFrames());return;@@ -1615,7 +1615,8 @@ Real AIUpdateInterface::calculateMaxBlockedSpeed(Object *other) const//-------------------------------------------------------------------------------------------------static const Real HEAD_ON_DOT = -0.5f; ///< facing more than 120 degrees apart is driving at each other-static const Int HEAD_ON_PASS_FRAMES = 8; ///< held up head-on this long: pass through+static const Int HEAD_ON_PASS_FRAMES = ConvertRetailFrames(8); ///< held up head-on this long: pass through+static const Real BUMP_RECOVERY = ConvertRetailPerFrameFactor(1.05f); ///< the bump speed limit grows by this every frameBool AIUpdateInterface::blockedBy(Object *other)/* Returns TRUE if we are blocked from moving by the other object.*/@@ -1781,37 +1782,39 @@ Bool AIUpdateInterface::needToRotate(void)// the crowd model: the constants the steering stack is made of, all in world units (a pathfind cell is 10).//-------------------------------------------------------------------------------------------------static const Real CROWD_AIR = 4.0f; ///< air a body wants round it, on top of both radii-static const Real CROWD_SEP_STEP = 1.5f; ///< most one frame of separation may move a lane+static const Real CROWD_SEP_STEP = 1.5f; ///< most one retail frame of separation may move a lanestatic const Real CROWD_PASS_CLEAR = 6.0f; ///< room a passing lane leaves beside the blockerstatic const Real CROWD_PASS_TIGHT = 1.5f; ///< and the room it settles for rather than queue-static const Int CROWD_PASS_RETRY = 10; ///< queued this long: ask to pass again, hold or no hold+static const Int CROWD_PASS_RETRY = ConvertRetailFrames(10); ///< queued this long: ask to pass again, hold or no holdstatic const Real CROWD_TAPER_DIST = PATHFIND_CELL_SIZE_F * 8.0f; ///< the band closes over the last of the routestatic const Real CROWD_PLAN_END_SLACK = PATHFIND_CELL_SIZE_F * 3.0f; ///< how far the move state may move a planned route's end and it still be the same order-static const Int CROWD_BRAKE_FRAMES = 8; ///< frames of closing time a brake is allowed to read-static const Int CROWD_FAN_FRAMES = 12; ///< held up this long before spreading out-static const Real CROWD_FAN_RATE = 0.8f; ///< and then sideways at this much a frame-static const Real CROWD_SEP_FILTER = 0.13f; ///< how much of a frame's sideways push is believed (~4/sec)-static const Real CROWD_RELEASE_FILTER = 0.15f; ///< how fast the throttle comes back once a brake lifts (~half a second to full)-static const Real CROWD_AIM_CRUISE = 0.23f; ///< how fast the aim follows the route while driving (~7/sec)-static const Real CROWD_AIM_URGENT = 0.67f; ///< and while manoeuvring (~20/sec), where lag is worse than twitch+static const Int CROWD_BRAKE_FRAMES = ConvertRetailFrames(8); ///< frames of closing time a brake is allowed to read+static const Int CROWD_FAN_FRAMES = ConvertRetailFrames(12); ///< held up this long before spreading out+static const Real CROWD_FAN_RATE = ConvertRetailPerFrameRate(0.8f); ///< and then sideways at this much a frame+static const Real CROWD_LANE_RATE_MIN = ConvertRetailPerFrameRate(0.4f); ///< the slowest a lane change is taken, per frame+// the filters below are lerp fractions per frame, written for 30 Hz+static const Real CROWD_SEP_FILTER = 1.0f - ConvertRetailPerFrameFactor(1.0f - 0.13f); ///< how much of a frame's sideways push is believed (~4/sec)+static const Real CROWD_RELEASE_FILTER = 1.0f - ConvertRetailPerFrameFactor(1.0f - 0.15f); ///< how fast the throttle comes back once a brake lifts (~half a second to full)+static const Real CROWD_AIM_CRUISE = 1.0f - ConvertRetailPerFrameFactor(1.0f - 0.23f); ///< how fast the aim follows the route while driving (~7/sec)+static const Real CROWD_AIM_URGENT = 1.0f - ConvertRetailPerFrameFactor(1.0f - 0.67f); ///< and while manoeuvring (~20/sec), where lag is worse than twitchstatic const Real CROWD_AIM_DEAD = 0.035f; ///< two degrees: hold the wheel still rather than chase the noise//-------------------------------------------------------------------------------------------------/* Being stuck. These are not crowd constants: every unit trying to drive somewhere is measuredagainst them, whether or not the crowd model steers it. The rungs of the ladder are spaced by continued lack ofprogress rather than by wall clock, so a unit that starts moving again drops off it at once. *///--------------------------------------------------------------------------------------------------static const Real STUCK_TURN_EPSILON = 0.004f; ///< a quarter of a degree a frame: below this the hull is not turning-static const Int STUCK_PRESS_FRAMES = 10; ///< a third of a second of getting nowhere: stop being polite-static const Int STUCK_REPATH_FRAMES = 45; ///< a second and a half: the ladder's first rung, and the gap between rungs-static const Int STUCK_BACKOUT_FRAMES = 66; ///< how long a backing-out manoeuvre is given before the route is tried again-static const Int STUCK_COOL_FRAMES = 90; ///< no second drastic thing inside this, or a wedged pair rock forever-static const Int STUCK_CYCLE_FRAMES = 150; ///< five seconds past the last rung: run the whole ladder again-static const Int STUCK_DITHER_FRAMES = 90; ///< three seconds is long enough to tell a shuffle from a corner+static const Real STUCK_TURN_EPSILON = ConvertRetailPerFrameRate(0.004f); ///< a quarter of a degree a retail frame: below this the hull is not turning+static const Int STUCK_PRESS_FRAMES = ConvertRetailFrames(10); ///< a third of a second of getting nowhere: stop being polite+static const Int STUCK_REPATH_FRAMES = ConvertRetailFrames(45); ///< a second and a half: the ladder's first rung, and the gap between rungs+static const Int STUCK_BACKOUT_FRAMES = ConvertRetailFrames(66); ///< how long a backing-out manoeuvre is given before the route is tried again+static const Int STUCK_COOL_FRAMES = ConvertRetailFrames(90); ///< no second drastic thing inside this, or a wedged pair rock forever+static const Int STUCK_CYCLE_FRAMES = ConvertRetailFrames(150); ///< five seconds past the last rung: run the whole ladder again+static const Int STUCK_DITHER_FRAMES = ConvertRetailFrames(90); ///< three seconds is long enough to tell a shuffle from a cornerstatic const Real STUCK_BRIDGE_NEAR = PATHFIND_CELL_SIZE_F * 20.0f; ///< a unit shaking this close to a deck on its route is at the rampstatic const Real STUCK_DITHER_RATIO = 0.3f; ///< gained less than this much of the ground it covered-static const Int CROWD_MERGE_FRAMES = 45; ///< a second and a half: how far ahead a merge is worth noticing-static const Int CROWD_TTC_FRAMES = 21; ///< closing this fast on somebody counts as being in our way, wherever it sits-static const Int CROWD_REPATH_QUEUE = 24; ///< queued behind traffic this long: stop steering round it and ask for a new route+static const Int CROWD_MERGE_FRAMES = ConvertRetailFrames(45); ///< a second and a half: how far ahead a merge is worth noticing+static const Int CROWD_TTC_FRAMES = ConvertRetailFrames(21); ///< closing this fast on somebody counts as being in our way, wherever it sits+static const Int CROWD_REPATH_QUEUE = ConvertRetailFrames(24); ///< queued behind traffic this long: stop steering round it and ask for a new route//-------------------------------------------------------------------------------------------------/* Returns TRUE if the physics collide should apply the force. Normally not.@@ -2303,7 +2306,7 @@ Bool AIUpdateInterface::computeAttackPath( PathfindServicesInterface *pathServic{//CRCDEBUG_LOG(("AIUpdateInterface::computeAttackPath() for object %d\n", getObject()->getID()));// See if it has been too soon.- if (m_pathTimestamp >= TheGameLogic->getFrame()-2)+ if (m_pathTimestamp >= TheGameLogic->getFrame()-(ConvertRetailFrames(2)+1)){// jba intense debug//CRCDEBUG_LOG(("Info - RePathing very quickly %d, %d.\n", m_pathTimestamp, TheGameLogic->getFrame()));@@ -2771,7 +2774,7 @@ void AIUpdateInterface::updateProgress( void )Real asked = m_curLocomotor->getMaxSpeedForCondition( damage );if (m_desiredSpeed < asked)asked = m_desiredSpeed; // a unit told to go slowly is not a unit going nowhere- if (asked < 0.01f)+ if (asked < ConvertRetailPerFrameRate(0.01f)){m_noProgress = 0;m_rescueStage = 0;@@ -3289,7 +3292,7 @@ void AIUpdateInterface::crowdSteer( Coord3D& goalPos, Real& speed )const Real comfort = myR + hisR + CROWD_AIR;PhysicsBehavior *hisPhys = o->getPhysics();- const Bool hisMoving = ai->isMoving() && hisPhys != NULL && hisPhys->getVelocityMagnitude() > 0.05f;+ const Bool hisMoving = ai->isMoving() && hisPhys != NULL && hisPhys->getVelocityMagnitude() > ConvertRetailPerFrameRate(0.05f);if (gap < 0.0f)touching = TRUE;@@ -3305,7 +3308,7 @@ void AIUpdateInterface::crowdSteer( Coord3D& goalPos, Real& speed ){const Coord3D *hv = hisPhys->getVelocity();const Real hs = (Real)sqrt( hv->x * hv->x + hv->y * hv->y );- if (hs > 0.01f)+ if (hs > ConvertRetailPerFrameRate(0.01f)){const Real align = (hv->x * here.tan.x + hv->y * here.tan.y) / hs;// a merge comes in at an angle: parallel traffic is the stream itself, head-on is not a merge@@ -3314,7 +3317,7 @@ void AIUpdateInterface::crowdSteer( Coord3D& goalPos, Real& speed )const Real rvx = hv->x - myVel.x;const Real rvy = hv->y - myVel.y;const Real rvv = rvx * rvx + rvy * rvy;- if (rvv > 1.0e-6f)+ if (rvv > ConvertRetailPerFrameSquared(1.0e-6f)) // a speed squared{const Real when = -(dx * rvx + dy * rvy) / rvv; // frames to closest approachif (when >= 0.0f && when < (Real)CROWD_MERGE_FRAMES && when < joinerWhen)@@ -3416,7 +3419,7 @@ void AIUpdateInterface::crowdSteer( Coord3D& goalPos, Real& speed )if (dist > 0.01f){const Real closing = ((myVel.x - hv->x) * dx + (myVel.y - hv->y) * dy) / dist;- if (closing > 0.05f && gap < closing * (Real)CROWD_TTC_FRAMES)+ if (closing > ConvertRetailPerFrameRate(0.05f) && gap < closing * (Real)CROWD_TTC_FRAMES)crossing = TRUE;}}@@ -3689,7 +3692,7 @@ void AIUpdateInterface::crowdSteer( Coord3D& goalPos, Real& speed )sep = m_crowdSepSmooth;if (sep > CROWD_SEP_STEP) sep = CROWD_SEP_STEP;if (sep < -CROWD_SEP_STEP) sep = -CROWD_SEP_STEP;- lat += sep;+ lat += ConvertRetailPerFrameRate(sep); // it accumulates in the lane frame after frame/* Everything above chose a lane; this is the only place the unit is allowed to move into one,and never faster than it drives. Giving way and passing both name a lane a full body width@@ -3698,7 +3701,7 @@ void AIUpdateInterface::crowdSteer( Coord3D& goalPos, Real& speed )spot, and by the time it is facing the new lane the rule that asked for it has moved on. Thespinning and the rocking back and forth are both this. A quarter of forward speed sidewaysis about twenty degrees of steering, which a tank takes without stopping. */- const Real laneRate = (speed * 0.25f > 0.4f) ? speed * 0.25f : 0.4f;+ const Real laneRate = (speed * 0.25f > CROWD_LANE_RATE_MIN) ? speed * 0.25f : CROWD_LANE_RATE_MIN;Real move = m_corridor->clampLat( i, lat ) - m_crowdLat;if (move > laneRate) move = laneRate;if (move < -laneRate) move = -laneRate;@@ -4170,7 +4173,7 @@ UpdateSleepTime AIUpdateInterface::doLocomotor( void )if (m_bumpSpeedLimit<speed*0.2f) {m_bumpSpeedLimit = speed*0.2f;}- m_bumpSpeedLimit *= 1.05f;+ m_bumpSpeedLimit *= BUMP_RECOVERY;if (m_bumpSpeedLimit>speed) {m_bumpSpeedLimit = speed;}@@ -4184,7 +4187,7 @@ UpdateSleepTime AIUpdateInterface::doLocomotor( void )if (m_bumpSpeedLimit<speed*0.2f) {m_bumpSpeedLimit = speed*0.2f;}- m_bumpSpeedLimit *= 1.05f;+ m_bumpSpeedLimit *= BUMP_RECOVERY;}if (speed>m_bumpSpeedLimit) {speed = m_bumpSpeedLimit;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cppindex 76d7b5986..4ce94face 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp@@ -666,7 +666,7 @@ public:if (m_ropes[i].ropeDrawable){const UnsignedInt ROPE_EXPIRATION_TIME = LOGICFRAMES_PER_SECOND * 5;- const Real initialSpeed = TheGlobalData->m_gravity * 30; // give it a little kick+ const Real initialSpeed = TheGlobalData->m_gravity * LOGICFRAMES_PER_SECOND; // give it a little kicksetRopeSpeed(m_ropes[i].ropeDrawable, initialSpeed, d->m_ropeDropSpeed, TheGlobalData->m_gravity);m_ropes[i].ropeDrawable->setExpirationDate(now + ROPE_EXPIRATION_TIME);m_ropes[i].ropeDrawable = NULL; // we're done with it, so null it so we won't save it@@ -888,7 +888,7 @@ ChinookAIUpdateModuleData::ChinookAIUpdateModuleData()m_rappelSpeed = fabs(TheGlobalData->m_gravity) * LOGICFRAMES_PER_SECOND * 0.5f;m_ropeWobbleLen = 10.0f;m_ropeWobbleAmp = 1.0f;- m_ropeWobbleRate = 0.1f;+ m_ropeWobbleRate = ConvertRetailPerFrameRate(0.1f);m_rotorWashParticleSystem.clear();m_upgradedSupplyBoost = 0;}@@ -1149,7 +1149,7 @@ UpdateSleepTime ChinookAIUpdate::update()}- if ( TheGameLogic->getFrame()%10 == 1 )+ if ( TheGameLogic->getFrame()%ConvertRetailFrames(10) == 1 ){Object *victim = getCurrentVictim();if ( victim )@@ -1198,7 +1198,8 @@ UpdateSleepTime ChinookAIUpdate::update()pos.z = TheTerrainLogic->getGroundHeight( pos.x, pos.y ) + 3.0f;chopperElevation -= pos.z;- if ( GameClientRandomValueReal( 0.0f, chopperElevation ) < 5.0f )+ // one roll per retail frame, so the wash is as dense as it was at 30 Hz+ if ( TheGameLogic->getFrame() % LOGICFRAMES_PER_RETAIL_FRAME == 0 && GameClientRandomValueReal( 0.0f, chopperElevation ) < 5.0f ){const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( getChinookAIUpdateModuleData()->m_rotorWashParticleSystem );ParticleSystem *system;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cppindex e729b133a..4b3357d3f 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp@@ -213,7 +213,7 @@ UpdateSleepTime DeliverPayloadAIUpdate::update( void ){//SHOOT!!const Coord3D *velocity = getObject()->getPhysics()->getVelocity();- if( velocity->z < 5.0f )+ if( velocity->z < ConvertRetailPerFrameRate(5.0f) ){//Calc strafe ratioReal startDiveDistance = getData()->m_diveStartDistance;@@ -239,7 +239,9 @@ UpdateSleepTime DeliverPayloadAIUpdate::update( void )// lock it just till the weapon is empty or the attack is "done"getObject()->setWeaponLock( m_data.m_strafingWeaponSlot, LOCKED_TEMPORARILY );getObject()->fireCurrentWeapon( &strafePoint );- FXList::doFXPos( m_data.m_strafeFX, &strafePoint );+ // once per retail frame, or the strafe trail is twice as dense as at 30 Hz+ if( TheGameLogic->getFrame() % LOGICFRAMES_PER_RETAIL_FRAME == 0 )+ FXList::doFXPos( m_data.m_strafeFX, &strafePoint );}}}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cppindex eb42c3135..574fb64b2 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeployStyleAIUpdate.cpp@@ -247,7 +247,8 @@ UpdateSleepTime DeployStyleAIUpdate::update( void )Drawable *draw = self->getDrawable();if( draw ){- draw->setAnimationFrame( totalFrames - framesLeft );+ // the deploy animations are authored at 30 frames a second, one per retail logic frame+ draw->setAnimationFrame( ( totalFrames - framesLeft ) / LOGICFRAMES_PER_RETAIL_FRAME );}}getStateMachine()->setTemporaryState( AI_BUSY, UPDATE_SLEEP_NONE );@@ -260,7 +261,7 @@ UpdateSleepTime DeployStyleAIUpdate::update( void )Drawable *draw = self->getDrawable();if( draw ){- draw->setAnimationFrame( framesLeft );+ draw->setAnimationFrame( framesLeft / LOGICFRAMES_PER_RETAIL_FRAME );}}getStateMachine()->setTemporaryState( AI_BUSY, UPDATE_SLEEP_NONE );@@ -307,7 +308,7 @@ void DeployStyleAIUpdate::setMyState( DeployStateTypes stateID, Bool reverseDeplDrawable *draw = self->getDrawable();if( draw ){- draw->setAnimationFrame( totalFrames - framesLeft );+ draw->setAnimationFrame( ( totalFrames - framesLeft ) / LOGICFRAMES_PER_RETAIL_FRAME );}}}@@ -350,7 +351,7 @@ void DeployStyleAIUpdate::setMyState( DeployStateTypes stateID, Bool reverseDeplDrawable *draw = self->getDrawable();if( draw ){- draw->setAnimationFrame( framesLeft );+ draw->setAnimationFrame( framesLeft / LOGICFRAMES_PER_RETAIL_FRAME );}}}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cppindex 213b203e3..05956460b 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp@@ -1706,7 +1706,7 @@ JetAIUpdateModuleData::JetAIUpdateModuleData()m_lockonTime = 0;m_lockonCursor.clear();m_lockonInitialDist = 100;- m_lockonFreq = 0.5;+ m_lockonFreq = ConvertRetailPerFrameRate(0.5f);m_lockonAngleSpin = 720;m_returnToBaseIdleTime = 0;}@@ -1733,7 +1733,8 @@ JetAIUpdateModuleData::JetAIUpdateModuleData(){ "LockonTime", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_lockonTime ) },{ "LockonCursor", INI::parseAsciiString, NULL, offsetof( JetAIUpdateModuleData, m_lockonCursor ) },{ "LockonInitialDist", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_lockonInitialDist ) },- { "LockonFreq", INI::parseReal, NULL, offsetof( JetAIUpdateModuleData, m_lockonFreq ) },+ // ticks scale with frames squared over LockonTime, so per frame it halves+ { "LockonFreq", INI::parseRetailPerFrameReal, NULL, offsetof( JetAIUpdateModuleData, m_lockonFreq ) },{ "LockonAngleSpin", INI::parseAngleReal, NULL, offsetof( JetAIUpdateModuleData, m_lockonAngleSpin ) },{ "LockonBlinky", INI::parseBool, NULL, offsetof( JetAIUpdateModuleData, m_lockonBlinky ) },{ "ReturnToBaseIdleTime", INI::parseDurationUnsignedInt, NULL, offsetof( JetAIUpdateModuleData, m_returnToBaseIdleTime ) },diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cppindex e3ca9e491..38a01cb0c 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp@@ -80,7 +80,7 @@ MissileAIUpdateModuleData::MissileAIUpdateModuleData()m_lockDistance = 75.0f;m_distanceScatterWhenJammed = 75.0f;m_detonateCallsKill = FALSE;- m_killSelfDelay = 3; // just long enough for the contrail to catch up to me+ m_killSelfDelay = ConvertRetailFrames(3); // just long enough for the contrail to catch up to me}//-----------------------------------------------------------------------------@@ -229,7 +229,8 @@ void MissileAIUpdate::projectileFireAtObjectOrPosition( const Object *victim, coLocomotor* curLoco = getCurLocomotor();if (curLoco){- m_maxAccel = weaponSpeed;+ // the speed doubles as an acceleration: full speed in one retail frame, which is two now+ m_maxAccel = ConvertRetailPerFrameRate(weaponSpeed);curLoco->setMaxSpeed(weaponSpeed);curLoco->setMaxAcceleration(m_maxAccel);}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cppindex 65e5c9979..15218ce24 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp@@ -93,13 +93,13 @@ RailroadBehaviorModuleData::RailroadBehaviorModuleData( void )m_CrashFXTemplateName.clear();m_isLocomotive = FALSE;- m_runningGarrisonSpeedMax = 1.0f;- m_killSpeedMin = 1.0f;- m_speedMax = 4;- m_acceleration = 1.01f;- m_braking = 0.99f;- m_friction = 0.97f;- m_waitAtStationTime = 150;+ m_runningGarrisonSpeedMax = ConvertRetailPerFrameRate(1.0f);+ m_killSpeedMin = ConvertRetailPerFrameRate(1.0f);+ m_speedMax = ConvertRetailPerFrameRate(4.0f);+ m_acceleration = ConvertRetailPerFrameFactor(1.01f);+ m_braking = ConvertRetailPerFrameFactor(0.99f);+ m_friction = ConvertRetailPerFrameFactor(0.97f);+ m_waitAtStationTime = LOGICFRAMES_PER_SECOND * 5;} // end RailroadBehaviorModuleData@@ -343,7 +343,8 @@ void RailroadBehavior::onCollide( Object *other, const Coord3D *loc, const Coorddlt.normalize();if ( ! victimIsInfantry ){- overlap/= 4;+ // a quarter of the overlap per retail frame, every frame of contact+ overlap *= 1.0f - ConvertRetailPerFrameFactor(0.75f);dlt.scale( overlap);Coord3D newPos;@@ -372,20 +373,22 @@ void RailroadBehavior::onCollide( Object *other, const Coord3D *loc, const Coorddelta.normalize();Real dot = delta.x * myDir->x + delta.y * myDir->y + delta.z * myDir->z;+ // the shove is added every frame of contact, so it is a per-frame^2 amount; the 0.66 turns+ // a speed into one, which makes it a per-frame rateif (other->isEffectivelyDead()){// we just run over debris, instead of shoving it around- delta.scale( MIN(0.3f,m_pullInfo.speed * 0.66f) );+ delta.scale( MIN(ConvertRetailPerFrameSquared(0.3f),m_pullInfo.speed * ConvertRetailPerFrameRate(0.66f)) );}else{- delta.scale( MIN(1.4f,m_pullInfo.speed * 0.66f) );// the faster I go, the harder I slam!+ delta.scale( MIN(ConvertRetailPerFrameSquared(1.4f),m_pullInfo.speed * ConvertRetailPerFrameRate(0.66f)) );// the faster I go, the harder I slam!//Absolute death to be hit by a train, no survivalif ( m_pullInfo.speed >= modData->m_killSpeedMin ) // they can grab on safely{other->kill();- theirPhys->setPitchRate(GameLogicRandomValueReal(-0.03f, 0.03f));- theirPhys->setRollRate(GameLogicRandomValueReal(-0.03f, 0.03f));+ theirPhys->setPitchRate(GameLogicRandomValueReal(ConvertRetailPerFrameRate(-0.03f), ConvertRetailPerFrameRate(0.03f)));+ theirPhys->setRollRate(GameLogicRandomValueReal(ConvertRetailPerFrameRate(-0.03f), ConvertRetailPerFrameRate(0.03f)));}else{@@ -404,12 +407,12 @@ void RailroadBehavior::onCollide( Object *other, const Coord3D *loc, const Coordheft.z = MAX(heft.z, TheTerrainLogic->getGroundHeight(heft.x, heft.y) + 2); // lift them off the groundother->setPosition(&heft);- delta.z = GameLogicRandomValueReal(0.05f, m_pullInfo.speed/10); // for some fake heft+ delta.z = GameLogicRandomValueReal(ConvertRetailPerFrameSquared(0.05f), m_pullInfo.speed * ConvertRetailPerFrameRate(0.1f)); // for some fake heftdelta.scale(dot);// This is a special check so that it wont hurl infantry clear across the map!- if( ! ( victimIsInfantry && theirPhys->getVelocityMagnitude() > 5.0f ) )+ if( ! ( victimIsInfantry && theirPhys->getVelocityMagnitude() > ConvertRetailPerFrameRate(5.0f) ) )theirPhys->addVelocityTo( &delta );@@ -725,7 +728,7 @@ UpdateSleepTime RailroadBehavior::update( void )if ( m_conductorState == APPLY_BRAKES ){conductorPullInfo.speed *= modData->m_braking;- if (fabs(conductorPullInfo.speed) < 0.1f)+ if (fabs(conductorPullInfo.speed) < ConvertRetailPerFrameRate(0.1f)){conductorPullInfo.speed = 0;///////////////////////////////////////( &m_hissySteamSound );@@ -750,7 +753,7 @@ UpdateSleepTime RailroadBehavior::update( void )if ( m_waitAtStationTimer <= 0 && (!m_held) ){m_conductorState = ACCELERATE;- conductorPullInfo.speed = 0.05f * conductorPullInfo.m_direction;+ conductorPullInfo.speed = ConvertRetailPerFrameRate(0.05f) * conductorPullInfo.m_direction;m_runningSound.setPlayingHandle(TheAudio->addAudioEvent( &m_runningSound ));@@ -766,7 +769,7 @@ UpdateSleepTime RailroadBehavior::update( void )}else if ( m_conductorState == ACCELERATE ){- conductorPullInfo.speed += 0.02f * conductorPullInfo.m_direction; // push start multiplier+ conductorPullInfo.speed += ConvertRetailPerFrameSquared(0.02f) * conductorPullInfo.m_direction; // push start multiplierconductorPullInfo.speed *= modData->m_acceleration;if ( conductorPullInfo.speed > modData->m_speedMax){@@ -1495,7 +1498,7 @@ void RailroadBehavior::FindPosByPathDistance( Coord3D *pos, const Real dist, conif ( edge && ! m_inTunnel ){//play my clickety clack sound, `cause I just rode over a join IN the tracksm_clicketyClackSound.setPosition( getObject()->getPosition() );- m_clicketyClackSound.setVolume( (Real)conductorPullInfo.speed / 10.0f );//assumed max speed+ m_clicketyClackSound.setVolume( (Real)conductorPullInfo.speed / ConvertRetailPerFrameRate(10.0f) );//assumed max speedTheAudio->addAudioEvent( &m_clicketyClackSound );}}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cppindex 23752d6db..89580ce1a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/BaseRenerateUpdate.cpp@@ -134,7 +134,7 @@ UpdateSleepTime BaseRegenerateUpdate::update( void )else{// we don't really need to heal every frame. do it every 3 frames or so.- const Int HEAL_RATE = 3;+ const Int HEAL_RATE = ConvertRetailFrames( 3 );// do some healingReal amount = HEAL_RATE * (body->getMaxHealth() * TheGlobalData->m_baseRegenHealthPercentPerSecond) /diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cppindex f2afae5a0..9fa54a5a6 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CheckpointUpdate.cpp@@ -154,11 +154,11 @@ UpdateSleepTime CheckpointUpdate::update()if ( open ){- if ( radius > 0 ) geom.setMinorRadius( radius - 0.333f );+ if ( radius > 0 ) geom.setMinorRadius( radius - ConvertRetailPerFrameRate( 0.333f ) );}else //closed{- if ( radius < m_maxMinorRadius ) geom.setMinorRadius( radius + 0.333f );+ if ( radius < m_maxMinorRadius ) geom.setMinorRadius( radius + ConvertRetailPerFrameRate( 0.333f ) );}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cppindex 941ca4aea..968952fde 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/CleanupHazardUpdate.cpp@@ -275,7 +275,7 @@ void CleanupHazardUpdate::fireWhenReady(){//We were in range last frame, but the target has moved out of firing range, so//re-evaluate by forcing a new scan.- m_nextScanFrames = GameLogicRandomValue( 0, 3 );+ m_nextScanFrames = GameLogicRandomValue( 0, ConvertRetailFrames( 3 ) );m_bestTargetID = INVALID_ID;m_inRange = false; // or every later out-of-range target rescans and drops tooif( !m_nextScanFrames )diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cppindex b987cc9c9..657f2add1 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DynamicShroudClearingRangeUpdate.cpp@@ -165,7 +165,7 @@ void DynamicShroudClearingRangeUpdate::animateGridDecals( void )Coord3D pos;pos.z = 0;- Real radius = m_currentClearingRange + ((m_totalFrames - m_stateCountDown) * 2);+ Real radius = m_currentClearingRange + ((m_totalFrames - m_stateCountDown) * ConvertRetailPerFrameRate( 2.0f ));Real angle = 0.0f;Real angleInc = (PI*2.0f) / (Real)GRID_FX_DECAL_COUNT;Real opacity = 1.0f - (m_currentClearingRange / m_nativeClearingRange);diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cppindex 41e584706..617d96fb0 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp@@ -145,7 +145,7 @@ UpdateSleepTime EMPUpdate::update( void )Drawable *dr = obj->getDrawable();UnsignedInt now = TheGameLogic->getFrame();- m_currentScale += ( m_targetScale - m_currentScale ) * 0.05f;+ m_currentScale += ( m_targetScale - m_currentScale ) * ( 1.0f - ConvertRetailPerFrameFactor( 0.95f ) );dr->setInstanceScale( m_currentScale );if ( now < m_tintEnvPlayFrame)@@ -353,9 +353,9 @@ void EMPUpdate::doDisableAttack( void )sys->attachToObject(curVictim);sys->setPosition( &offs );- sys->setSystemLifetime(MAX(0, data->m_disabledDuration - 30));+ sys->setSystemLifetime(MAX(0, data->m_disabledDuration - LOGICFRAMES_PER_SECOND));// Client stream too: this line runs only where the drawable and the particle system exist.- sys->setInitialDelay(GameClientRandomValue(1,100));+ sys->setInitialDelay(GameClientRandomValue(1,ConvertRetailFrames(100)));}}}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cppindex ce979a94e..5830b8dcc 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FloatUpdate.cpp@@ -125,8 +125,8 @@ UpdateSleepTime FloatUpdate::update( void ){Real angle = INT_TO_REAL(TheGameLogic->getFrame());- Real yaw = Sin(angle * 0.0291f) * 0.05f;- Real pitch = Sin(angle * 0.0515f) * 0.05f;+ Real yaw = Sin(angle * ConvertRetailPerFrameRate( 0.0291f )) * 0.05f;+ Real pitch = Sin(angle * ConvertRetailPerFrameRate( 0.0515f )) * 0.05f;Matrix3D mx = *draw->getInstanceMatrix();diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cppindex 0fd84f911..c7dd7b22b 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp@@ -112,7 +112,7 @@ HelicopterSlowDeathBehaviorModuleData::HelicopterSlowDeathBehaviorModuleData( vo{{ "SpiralOrbitTurnRate", INI::parseAngularVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitTurnRate ) },{ "SpiralOrbitForwardSpeed", INI::parseVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeed ) },- { "SpiralOrbitForwardSpeedDamping", INI::parseReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeedDamping ) },+ { "SpiralOrbitForwardSpeedDamping", INI::parseRetailPerFrameFactorReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_spiralOrbitForwardSpeedDamping ) },{ "MinSelfSpin", INI::parseAngularVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_minSelfSpin ) },{ "MaxSelfSpin", INI::parseAngularVelocityReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_maxSelfSpin ) },{ "SelfSpinUpdateDelay", INI::parseDurationReal, NULL, offsetof( HelicopterSlowDeathBehaviorModuleData, m_selfSpinUpdateDelay ) },@@ -219,8 +219,9 @@ void HelicopterSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo )//m_forwardAngle = getObject()->getOrientation();- // set or forward speed in the spiral orbit speed to that specified- m_forwardSpeed = modData->m_spiralOrbitForwardSpeed;+ // set or forward speed in the spiral orbit speed to that specified. It is a force pushed every+ // frame, so per frame squared: the velocity parse covers one of the two frames.+ m_forwardSpeed = ConvertRetailPerFrameRate( modData->m_spiralOrbitForwardSpeed );// start our self spinning at the min self spin ratem_selfSpin = modData->m_minSelfSpin;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cppindex 96535e102..35858ea18 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp@@ -386,9 +386,9 @@ UpdateSleepTime HordeUpdate::update( void )}if ( ! wasInHorde && m_inHorde )- draw->setTerrainDecalFadeTarget(1.0f, 0.03f);+ draw->setTerrainDecalFadeTarget(1.0f, ConvertRetailPerFrameRate(0.03f));else if ( wasInHorde && ! m_inHorde )- draw->setTerrainDecalFadeTarget(0.0f, -0.03f);+ draw->setTerrainDecalFadeTarget(0.0f, ConvertRetailPerFrameRate(-0.03f));}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cppindex 4bc5e959a..37257f867 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MobMemberSlavedUpdate.cpp@@ -105,7 +105,7 @@ const UnsignedInt MOB_CATCH_UP_CRISIS_DIVISOR = 3;alive. An Angry Mob is a nexus and ten members, so a match with several of them per player ishundreds of objects paying that for nothing. Sleeping is what the `@todo srj use SLEEPY_UPDATEhere` at the top of update() has been asking for. */-const Int MOB_MEMBER_UPDATE_RATE = 16;+const Int MOB_MEMBER_UPDATE_RATE = ConvertRetailFrames( 16 ); // also the tick of CatchUpCrisisBailTime, a count of these updates/* m_framesToWait was the counter that got ticked to sixteen. It now carries the one-time staggerthe constructor drew, and this once it has been spent. */@@ -116,7 +116,7 @@ MobMemberSlavedUpdate::MobMemberSlavedUpdate( Thing *thing, const ModuleData* mo{m_slaver = INVALID_ID;- m_framesToWait = GameLogicRandomValue(0,20);+ m_framesToWait = GameLogicRandomValue(0,ConvertRetailFrames(20));// MDC: moving to GameLogicRandomValue. This does not need to be synced, but having it so makes searches *so* much nicer.m_personalColor.red = GameLogicRandomValueReal( 0.2f, 0.4f );diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cppindex d502a835a..343843628 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp@@ -95,8 +95,8 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule{ "Blast1OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].outerRadius ) },{ "Blast1MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].maxDamage ) },{ "Blast1MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].minDamage ) },- { "Blast1ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].toppleSpeed ) },- { "Blast1PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].pushForceMag ) },+ { "Blast1ToppleSpeed", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].toppleSpeed ) },+ { "Blast1PushForce", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].pushForceMag ) },{ "Blast2Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].enabled ) },{ "Blast2Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].delay ) },@@ -105,8 +105,8 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule{ "Blast2OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].outerRadius ) },{ "Blast2MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].maxDamage ) },{ "Blast2MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].minDamage ) },- { "Blast2ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].toppleSpeed ) },- { "Blast2PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].pushForceMag ) },+ { "Blast2ToppleSpeed", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].toppleSpeed ) },+ { "Blast2PushForce", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_2 ].pushForceMag ) },{ "Blast3Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].enabled ) },{ "Blast3Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].delay ) },@@ -115,8 +115,8 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule{ "Blast3OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].outerRadius ) },{ "Blast3MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].maxDamage ) },{ "Blast3MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].minDamage ) },- { "Blast3ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].toppleSpeed ) },- { "Blast3PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].pushForceMag ) },+ { "Blast3ToppleSpeed", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].toppleSpeed ) },+ { "Blast3PushForce", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_3 ].pushForceMag ) },{ "Blast4Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].enabled ) },{ "Blast4Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].delay ) },@@ -125,8 +125,8 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule{ "Blast4OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].outerRadius ) },{ "Blast4MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].maxDamage ) },{ "Blast4MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].minDamage ) },- { "Blast4ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].toppleSpeed ) },- { "Blast4PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].pushForceMag ) },+ { "Blast4ToppleSpeed", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].toppleSpeed ) },+ { "Blast4PushForce", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_4 ].pushForceMag ) },{ "Blast5Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].enabled ) },{ "Blast5Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].delay ) },@@ -135,8 +135,8 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule{ "Blast5OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].outerRadius ) },{ "Blast5MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].maxDamage ) },{ "Blast5MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].minDamage ) },- { "Blast5ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].toppleSpeed ) },- { "Blast5PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].pushForceMag ) },+ { "Blast5ToppleSpeed", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].toppleSpeed ) },+ { "Blast5PushForce", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_5 ].pushForceMag ) },{ "Blast6Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].enabled ) },{ "Blast6Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].delay ) },@@ -145,8 +145,8 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule{ "Blast6OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].outerRadius ) },{ "Blast6MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].maxDamage ) },{ "Blast6MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].minDamage ) },- { "Blast6ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].toppleSpeed ) },- { "Blast6PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].pushForceMag ) },+ { "Blast6ToppleSpeed", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].toppleSpeed ) },+ { "Blast6PushForce", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_6 ].pushForceMag ) },{ "Blast7Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].enabled ) },{ "Blast7Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].delay ) },@@ -155,8 +155,8 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule{ "Blast7OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].outerRadius ) },{ "Blast7MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].maxDamage ) },{ "Blast7MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].minDamage ) },- { "Blast7ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].toppleSpeed ) },- { "Blast7PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].pushForceMag ) },+ { "Blast7ToppleSpeed", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].toppleSpeed ) },+ { "Blast7PushForce", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_7 ].pushForceMag ) },{ "Blast8Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].enabled ) },{ "Blast8Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].delay ) },@@ -165,8 +165,8 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule{ "Blast8OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].outerRadius ) },{ "Blast8MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].maxDamage ) },{ "Blast8MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].minDamage ) },- { "Blast8ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].toppleSpeed ) },- { "Blast8PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].pushForceMag ) },+ { "Blast8ToppleSpeed", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].toppleSpeed ) },+ { "Blast8PushForce", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_8 ].pushForceMag ) },{ "Blast9Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].enabled ) },{ "Blast9Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].delay ) },@@ -175,8 +175,8 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule{ "Blast9OuterRadius", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].outerRadius ) },{ "Blast9MaxDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].maxDamage ) },{ "Blast9MinDamage", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].minDamage ) },- { "Blast9ToppleSpeed", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].toppleSpeed ) },- { "Blast9PushForce", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].pushForceMag ) },+ { "Blast9ToppleSpeed", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].toppleSpeed ) },+ { "Blast9PushForce", INI::parseRetailPerFrameReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_9 ].pushForceMag ) },{ 0, 0, 0, 0 }};diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cppindex 0368ec8fd..f65513ca9 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileUpdate.cpp@@ -369,7 +369,14 @@ void NeutronMissileUpdate::doAttack( void )//// Move forward along forward direction//- Real damping = getNeutronMissileUpdateModuleData()->m_forwardDamping;+ // ForwardDamping is a per-retail-frame lerp toward a top speed of RelativeSpeed / ForwardDamping;+ // convert both so the top speed and the time to reach it stay what they were at 30 Hz+ Real retailDamping = getNeutronMissileUpdateModuleData()->m_forwardDamping;+ Real damping = 1.0f - ConvertRetailPerFrameFactor( 1.0f - retailDamping );+ if( retailDamping > 0.0f )+ speed = ConvertRetailPerFrameRate( speed ) * damping / retailDamping;+ else+ speed = ConvertRetailPerFrameSquared( speed );m_accel.x = speed * trueDir.X - damping * m_vel.x;m_accel.y = speed * trueDir.Y - damping * m_vel.y;m_accel.z = speed * trueDir.Z - damping * m_vel.z;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cppindex 712ad3a90..634cd9284 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp@@ -93,7 +93,7 @@ ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData()m_damageRadiusScalar = 1.0f;m_groundHitFX = NULL;m_beamLaunchFX = NULL;- m_framesBetweenLaunchFXRefresh = 30;+ m_framesBetweenLaunchFXRefresh = LOGICFRAMES_PER_SECOND;m_totalDamagePulses = 0;m_damagePerSecond = 0.0f;m_damageType = DAMAGE_LASER;@@ -101,7 +101,7 @@ ParticleUplinkCannonUpdateModuleData::ParticleUplinkCannonUpdateModuleData()m_revealRange = 0.0f;m_manualDrivingSpeed = 0.0f;m_manualFastDrivingSpeed = 0.0f;- m_doubleClickToFastDriveDelay = 500;+ m_doubleClickToFastDriveDelay = ConvertRetailFrames( 500 );//Added by Sadullah Nader//Initializations insertedm_swathOfDeathAmplitude = 0.0f;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cppindex 9a3125db9..a53c8c5cd 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp@@ -53,10 +53,12 @@const Real DEFAULT_MASS = 1.0f;-const Real DEFAULT_SHOCK_YAW = 0.05f;-const Real DEFAULT_SHOCK_PITCH = 0.025f;-const Real DEFAULT_SHOCK_ROLL = 0.025f;+const Real DEFAULT_SHOCK_YAW = ConvertRetailPerFrameRate(0.05f);+const Real DEFAULT_SHOCK_PITCH = ConvertRetailPerFrameRate(0.025f);+const Real DEFAULT_SHOCK_ROLL = ConvertRetailPerFrameRate(0.025f);+// Every friction below, the clamps and m_extraFriction are the share of speed lost per retail (30 Hz)+// frame; retailFrictionToFrame turns one into the share per frame now, so a second loses the same.const Real DEFAULT_FORWARD_FRICTION = 0.15f;const Real DEFAULT_LATERAL_FRICTION = 0.15f;const Real DEFAULT_Z_FRICTION = 0.8f;@@ -68,7 +70,12 @@ const Real MIN_AERO_FRICTION = 0.00f;const Real MIN_NON_AERO_FRICTION = 0.01f;const Real MAX_FRICTION = 0.99f;-const Real STUN_RELIEF_EPSILON = 0.5f;+static Real retailFrictionToFrame(Real f)+{+ return 1.0f - ConvertRetailPerFrameFactor(1.0f - f);+}++const Real STUN_RELIEF_EPSILON = ConvertRetailPerFrameRate(0.5f);#include "Common/CRCDebug.h"@@ -161,12 +168,12 @@ static void parseHeightToSpeed( INI* ini, void * /*instance*/, void *store, consstatic void parseFrictionPerSec( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ ){Real fricPerSec = INI::scanReal(ini->getNextToken());- Real fricPerFrame = fricPerSec * SECONDS_PER_LOGICFRAME_REAL;- *(Real *)store = fricPerFrame;-}+ Real fricPerRetailFrame = fricPerSec / RETAIL_LOGICFRAMES_PER_SECOND;+ *(Real *)store = fricPerRetailFrame;+}//--------------------------------------------------------------------------------------------------/*static*/ void PhysicsBehaviorModuleData::buildFieldParse(MultiIniFieldParse& p)+/*static*/ void PhysicsBehaviorModuleData::buildFieldParse(MultiIniFieldParse& p){UpdateModuleData::buildFieldParse(p);@@ -175,9 +182,9 @@ static void parseFrictionPerSec( INI* ini, void * /*instance*/, void *store, con{ "Mass", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_mass ) },{ "ShockResistance", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockResistance ) },- { "ShockMaxYaw", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockMaxYaw ) },- { "ShockMaxPitch", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockMaxPitch ) },- { "ShockMaxRoll", INI::parsePositiveNonZeroReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockMaxRoll ) },+ { "ShockMaxYaw", INI::parseRetailPerFrameReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockMaxYaw ) },+ { "ShockMaxPitch", INI::parseRetailPerFrameReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockMaxPitch ) },+ { "ShockMaxRoll", INI::parseRetailPerFrameReal, NULL, offsetof( PhysicsBehaviorModuleData, m_shockMaxRoll ) },{ "ForwardFriction", parseFrictionPerSec, NULL, offsetof( PhysicsBehaviorModuleData, m_forwardFriction ) },{ "LateralFriction", parseFrictionPerSec, NULL, offsetof( PhysicsBehaviorModuleData, m_lateralFriction ) },@@ -292,7 +299,7 @@ Real PhysicsBehavior::getAerodynamicFriction() constReal f = getPhysicsBehaviorModuleData()->m_aerodynamicFriction + m_extraFriction;if (f < MIN_AERO_FRICTION) f = MIN_AERO_FRICTION;if (f > MAX_FRICTION) f = MAX_FRICTION;- return f;+ return retailFrictionToFrame(f);}//-------------------------------------------------------------------------------------------------@@ -301,7 +308,7 @@ Real PhysicsBehavior::getForwardFriction() constReal f = getPhysicsBehaviorModuleData()->m_forwardFriction + m_extraFriction;if (f < MIN_NON_AERO_FRICTION) f = MIN_NON_AERO_FRICTION;if (f > MAX_FRICTION) f = MAX_FRICTION;- return f;+ return retailFrictionToFrame(f);}//-------------------------------------------------------------------------------------------------@@ -310,7 +317,7 @@ Real PhysicsBehavior::getLateralFriction() constReal f = getPhysicsBehaviorModuleData()->m_lateralFriction + m_extraFriction;if (f < MIN_NON_AERO_FRICTION) f = MIN_NON_AERO_FRICTION;if (f > MAX_FRICTION) f = MAX_FRICTION;- return f;+ return retailFrictionToFrame(f);}//-------------------------------------------------------------------------------------------------@@ -319,7 +326,7 @@ Real PhysicsBehavior::getZFriction() constReal f = getPhysicsBehaviorModuleData()->m_ZFriction + m_extraFriction;if (f < MIN_NON_AERO_FRICTION) f = MIN_NON_AERO_FRICTION;if (f > MAX_FRICTION) f = MAX_FRICTION;- return f;+ return retailFrictionToFrame(f);}//-------------------------------------------------------------------------------------------------@@ -464,7 +471,7 @@ void PhysicsBehavior::applyFrictionalForces()if (getFlag(APPLY_FRICTION2D_WHEN_AIRBORNE) || !getObject()->isSignificantlyAboveTerrain() || deckTaxiing ){- applyYPRDamping(1.0f - DEFAULT_LATERAL_FRICTION);+ applyYPRDamping(1.0f - retailFrictionToFrame(DEFAULT_LATERAL_FRICTION));if (m_vel.x || m_vel.y){@@ -533,7 +540,7 @@ Bool PhysicsBehavior::handleBounce(Real oldZ, Real newZ, Real groundZ, Coord3D*bounceForce->y = 0.0f;bounceForce->z = getMass() * desiredAccelZ;- const Real DAMPING = 0.7f;+ const Real DAMPING = 0.7f; // once per impact, which lasts one frame at any rateapplyYPRDamping(DAMPING);if (vz < 0.0f)@@ -567,7 +574,7 @@ Bool PhysicsBehavior::handleBounce(Real oldZ, Real newZ, Real groundZ, Coord3D*//-------------------------------------------------------------------------------------------------inline Bool isVerySmall3D(const Coord3D& v){- const Real THRESH = 0.01f;+ const Real THRESH = ConvertRetailPerFrameRate(0.01f);return (fabs(v.x) < THRESH && fabs(v.y) < THRESH && fabs(v.z) < THRESH);}@@ -670,7 +677,7 @@ UpdateSleepTime PhysicsBehavior::update()m_vel.z += m_accel.z;// when vel gets tiny, just clamp to zero- const Real THRESH = 0.001f;+ const Real THRESH = ConvertRetailPerFrameRate(0.001f);if (fabsf(m_vel.x) < THRESH) m_vel.x = 0.0f;if (fabsf(m_vel.y) < THRESH) m_vel.y = 0.0f;if (fabsf(m_vel.z) < THRESH) m_vel.z = 0.0f;@@ -887,11 +894,12 @@ UpdateSleepTime PhysicsBehavior::update()// only apply force if it's a pretty steep fall, so that things// going down hills don't injure themselves (unless the hill is really steep)const Real MIN_ANGLE_TAN = 3.0f; // roughly 71 degrees- const Real TINY_DELTA = 0.01f;- if ((fabs(m_vel.x) <= TINY_DELTA || fabs(activeVelZ / m_vel.x) >= MIN_ANGLE_TAN) &&+ const Real TINY_DELTA = ConvertRetailPerFrameRate(0.01f);+ if ((fabs(m_vel.x) <= TINY_DELTA || fabs(activeVelZ / m_vel.x) >= MIN_ANGLE_TAN) &&(fabs(m_vel.y) <= TINY_DELTA || fabs(activeVelZ / m_vel.y) >= MIN_ANGLE_TAN)){- Real damageAmt = netSpeed * getMass() * d->m_fallHeightDamageFactor;+ // the damage factors were tuned against the speed per retail frame+ Real damageAmt = netSpeed * LOGICFRAMES_PER_RETAIL_FRAME * getMass() * d->m_fallHeightDamageFactor;DamageInfo damageInfo;damageInfo.in.m_damageType = DAMAGE_FALLING;@@ -1032,7 +1040,7 @@ Bool PhysicsBehavior::wasPreviouslyOverlapped(Object *obj) const//-------------------------------------------------------------------------------------------------void PhysicsBehavior::scrubVelocityZ( Real desiredVelocity ){- if (fabs(desiredVelocity) < 0.001f)+ if (fabs(desiredVelocity) < ConvertRetailPerFrameRate(0.001f)){m_vel.z = 0;}@@ -1049,7 +1057,7 @@ void PhysicsBehavior::scrubVelocityZ( Real desiredVelocity )//-------------------------------------------------------------------------------------------------void PhysicsBehavior::scrubVelocity2D( Real desiredVelocity ){- if (desiredVelocity < 0.001f)+ if (desiredVelocity < ConvertRetailPerFrameRate(0.001f)){m_vel.x = 0;m_vel.y = 0;@@ -1135,7 +1143,7 @@ void PhysicsBehavior::doBounceSound(const Coord3D& prevPos)if (!m_bounceSound)return;- const Real NORMAL_VEL_Z = 0.25f;+ const Real NORMAL_VEL_Z = ConvertRetailPerFrameRate(0.25f);const Real NORMAL_MASS = 50.0f;// get the per-unit sound for the collision which was stuffed in on Object creation.@@ -1372,7 +1380,7 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3while (objToBounce->getContainedBy() != NULL)objToBounce = objToBounce->getContainedBy();- Real bounceOutDist = usRadius * 0.1f;+ Real bounceOutDist = usRadius * ConvertRetailPerFrameRate(0.1f); // every frame it touchesCoord3D tmp = *objToBounce->getPosition();tmp.x -= bounceOutDist * delta.x / dist;tmp.y -= bounceOutDist * delta.y / dist;@@ -1441,7 +1449,8 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3// this used to fire a temp weapon at the crash site, which hits everything in the// weapon's radius - and the collision is re-evaluated for every object in the pile,// so a vehicle landing among five units damaged all five, five times over. Damage- // the thing actually collided with, once.+ // the thing actually collided with, once. It still repeats every frame of contact,+ // so each frame deals a retail frame's share; the effect plays on retail frames only.const WeaponTemplate *weaponTemplate = getPhysicsBehaviorModuleData()->m_vehicleCrashesIntoNonBuildingWeaponTemplate;if (weaponTemplate){@@ -1452,10 +1461,11 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3damageInfo.in.m_deathType = weaponTemplate->getDeathType();damageInfo.in.m_sourceID = obj->getID();damageInfo.in.m_sourcePlayerMask = obj->getControllingPlayer() ? obj->getControllingPlayer()->getPlayerMask() : 0;- damageInfo.in.m_amount = weaponTemplate->getPrimaryDamage(nullBonus);+ damageInfo.in.m_amount = weaponTemplate->getPrimaryDamage(nullBonus) / LOGICFRAMES_PER_RETAIL_FRAME;other->attemptDamage(&damageInfo);- FXList::doFXObj(weaponTemplate->getFireFX(obj->getVeterancyLevel()), obj);+ if (TheGameLogic->getFrame() % LOGICFRAMES_PER_RETAIL_FRAME == 0)+ FXList::doFXObj(weaponTemplate->getFireFX(obj->getVeterancyLevel()), obj);}}}@@ -1472,9 +1482,9 @@ void PhysicsBehavior::onCollide( Object *other, const Coord3D *loc, const Coord3}else{- if (overlap > 5.0f)+ if (overlap > 5.0f)overlap = 5.0f;- factor = -overlap;+ factor = -ConvertRetailPerFrameSquared(overlap); // a spring, pushing every frame they overlap}force.x = factor * delta.x / dist;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cppindex 8e099d731..f653085ce 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp@@ -72,7 +72,7 @@ PointDefenseLaserUpdateModuleData::PointDefenseLaserUpdateModuleData(){ "SecondaryTargetTypes", KindOfMaskType::parseFromINI, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_secondaryTargetKindOf ) },{ "ScanRate", INI::parseDurationUnsignedInt, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_scanFrames ) },{ "ScanRange", INI::parseReal, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_scanRange ) },- { "PredictTargetVelocityFactor", INI::parseReal, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_velocityFactor ) },+ { "PredictTargetVelocityFactor", INI::parseRetailFramesReal, NULL, offsetof( PointDefenseLaserUpdateModuleData, m_velocityFactor ) },{ 0, 0, 0, 0 }};p.add(dataFieldParse);@@ -183,7 +183,7 @@ void PointDefenseLaserUpdate::fireWhenReady(){//We were in range last frame, but the target has moved out of firing range, so//re-evaluate by forcing a new scan.- m_nextScanFrames = GameLogicRandomValue( 0, 3 );+ m_nextScanFrames = GameLogicRandomValue( 0, ConvertRetailFrames( 3 ) );m_bestTargetID = INVALID_ID;m_inRange = false; // the fire block below needs it, or a non-zero rescan delay shoots out of rangeif( !m_nextScanFrames )@@ -241,7 +241,7 @@ void PointDefenseLaserUpdate::fireWhenReady()if( target->isEffectivelyDead() ){- m_nextScanFrames = GameLogicRandomValue( 0, 3 );+ m_nextScanFrames = GameLogicRandomValue( 0, ConvertRetailFrames( 3 ) );m_bestTargetID = INVALID_ID;if( !m_nextScanFrames ){diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cppindex c804a306a..6d9bd3667 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionExitUpdate/QueueProductionExitUpdate.cpp@@ -124,7 +124,7 @@ void QueueProductionExitUpdate::exitObjectViaDoor( Object *newObj, ExitDoorTypestartingForce.z *= newObjectPhysics->getMass();newObjectPhysics->applyMotiveForce( &startingForce );- const Real STARTING_PITCH_COEFF = 0.04f;+ const Real STARTING_PITCH_COEFF = ConvertRetailPerFrameRate( 0.04f ); // a pitch rate, per frameReal pitchRate = newObjectPhysics->getCenterOfMassOffset() * STARTING_PITCH_COEFF;newObjectPhysics->setPitchRate( pitchRate );}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cppindex a153e79cc..c8decceb3 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProneUpdate.cpp@@ -42,7 +42,7 @@//-------------------------------------------------------------------------------------------------//-------------------------------------------------------------------------------------------------ProneUpdateModuleData::ProneUpdateModuleData() :- m_damageToFramesRatio(1.0f)+ m_damageToFramesRatio(ConvertRetailFrames(1.0f)){}@@ -53,7 +53,7 @@ ProneUpdateModuleData::ProneUpdateModuleData() :static const FieldParse dataFieldParse[] ={- { "DamageToFramesRatio", INI::parseReal, NULL, offsetof(ProneUpdateModuleData, m_damageToFramesRatio) },+ { "DamageToFramesRatio", INI::parseRetailFramesReal, NULL, offsetof(ProneUpdateModuleData, m_damageToFramesRatio) },{ 0, 0, 0, 0 }};p.add(dataFieldParse);diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cppindex a3fc85d66..6229a9dbf 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp@@ -584,11 +584,11 @@ void SlavedUpdate::setRepairState( RepairStates repairState ){case REPAIRSTATE_UNPACKING:setRepairModelConditionStates( MODELCONDITION_UNPACKING );- m_framesToWait = 15;+ m_framesToWait = ConvertRetailFrames( 15 );break;case REPAIRSTATE_PACKING:setRepairModelConditionStates( MODELCONDITION_PACKING );- m_framesToWait = 15;+ m_framesToWait = ConvertRetailFrames( 15 );break;case REPAIRSTATE_READY:{@@ -598,12 +598,12 @@ void SlavedUpdate::setRepairState( RepairStates repairState )//We're not in a repair state -- so assume we need to unpacksetRepairModelConditionStates( MODELCONDITION_UNPACKING );m_repairState = REPAIRSTATE_UNPACKING;- m_framesToWait = 15;+ m_framesToWait = ConvertRetailFrames( 15 );break;case REPAIRSTATE_WELDING://We are welding so retract before going into ready state.m_repairState = REPAIRSTATE_RETRACTING;- m_framesToWait = 5;+ m_framesToWait = ConvertRetailFrames( 5 );setRepairModelConditionStates( MODELCONDITION_FIRING_C );moveToNewRepairSpot();break;@@ -619,7 +619,7 @@ void SlavedUpdate::setRepairState( RepairStates repairState )if( m_repairState == REPAIRSTATE_READY ){m_repairState = REPAIRSTATE_EXTENDING;- m_framesToWait = 5;+ m_framesToWait = ConvertRetailFrames( 5 );setRepairModelConditionStates( MODELCONDITION_FIRING_B );break;}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cppindex abe1c74f3..f0d894b59 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp@@ -1274,7 +1274,7 @@ Bool SpecialAbilityUpdate::continuePreparation()Real denominator = MAX(1, data->m_preparationFrames);Real increment = 1.0f - ((Real)m_prepFrames / denominator );- m_captureFlashPhase += increment / 3.0f;+ m_captureFlashPhase += ConvertRetailPerFrameRate( increment / 3.0f );Bool thisPhase = ( ((Int)m_captureFlashPhase) & 1 );// are we in a flashy phase this frame?@@ -1722,7 +1722,7 @@ Object* SpecialAbilityUpdate::createSpecialObject()PhysicsBehavior* specialObjectPhysics = specialObject->getPhysics();if (specialObjectPhysics){- Real pitchRate = specialObjectPhysics->getCenterOfMassOffset();+ Real pitchRate = ConvertRetailPerFrameRate( specialObjectPhysics->getCenterOfMassOffset() ); // EA's coefficient of 1 was radians a retail framespecialObjectPhysics->setPitchRate( pitchRate );specialObjectPhysics->setAllowAirborneFriction( false );}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cppindex cc35572ff..a561f5174 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpectreGunshipUpdate.cpp@@ -94,9 +94,9 @@ SpectreGunshipUpdateModuleData::SpectreGunshipUpdateModuleData()/*************/ m_orbitFrames = 0;/*************/ m_targetingReticleRadius = 25.0f;/*************/ m_gunshipOrbitRadius = 250.0f;- m_strafingIncrement = 20.0f;+ m_strafingIncrement = ConvertRetailPerFrameRate( 20.0f );m_orbitInsertionSlope = 0.7f;- m_howitzerFiringRate = 10;+ m_howitzerFiringRate = ConvertRetailFrames( 10 );m_howitzerFollowLag = 0;m_randomOffsetForHowitzer = 20.0f;}@@ -115,7 +115,7 @@ static Real zero = 0.0f;{ "OrbitTime", INI::parseDurationUnsignedInt, NULL, offsetof( SpectreGunshipUpdateModuleData, m_orbitFrames ) },{ "HowitzerFollowLag", INI::parseDurationUnsignedInt, NULL, offsetof( SpectreGunshipUpdateModuleData, m_howitzerFollowLag ) },{ "AttackAreaRadius", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_attackAreaRadius ) },- { "StrafingIncrement", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_strafingIncrement ) },+ { "StrafingIncrement", INI::parseRetailPerFrameReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_strafingIncrement ) },{ "OrbitInsertionSlope", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_orbitInsertionSlope ) },{ "RandomOffsetForHowitzer", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_randomOffsetForHowitzer ) },{ "TargetingReticleRadius", INI::parseReal, NULL, offsetof( SpectreGunshipUpdateModuleData, m_targetingReticleRadius ) },diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cppindex 1a1f3e9b4..8a76ac656 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp@@ -80,7 +80,7 @@ StealthUpdateModuleData::StealthUpdateModuleData()m_stealthSpeed = 0.0f;m_friendlyOpacityMin = 0.5f;m_friendlyOpacityMax = 1.0f;- m_pulseFrames = 30;+ m_pulseFrames = LOGICFRAMES_PER_SECOND;m_teamDisguised = false;m_revealDistanceFromTarget = 0.0f;m_orderIdleEnemiesToAttackMeUponReveal = false;@@ -144,7 +144,7 @@ StealthUpdate::StealthUpdate( Thing *thing, const ModuleData* moduleData ) : Upd//Initialization(s) insertedm_detectionExpiresFrame = 0;//- m_pulsePhaseRate = 0.2f;+ m_pulsePhaseRate = ConvertRetailPerFrameRate(0.2f);m_pulsePhase = GameClientRandomValueReal(0, PI);m_disguiseAsPlayerIndex = -1;@@ -310,7 +310,7 @@ Bool StealthUpdate::allowedToStealth( Object *stealthOwner ) const// set from now, don't accumulate: after the object slept for a while the timer was far// behind the current frame, and advancing it one interval per call meant the full// iterateObjects player scan below ran EVERY frame until it caught up.- m_nextBlackMarketCheckFrame = now + data->m_blackMarketCheckFrames + GameLogicRandomValue( 0, 10 );+ m_nextBlackMarketCheckFrame = now + data->m_blackMarketCheckFrames + GameLogicRandomValue( 0, ConvertRetailFrames( 10 ) );//If we can't find an active black market, then we can't stealth.Bool blackMarket = FALSE;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cppindex 779b44ea2..82011e95a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StructureToppleUpdate.cpp@@ -123,7 +123,7 @@ static void parseAngleFX(INI* ini, void *instance, void * /* store */, const voi{ "MinToppleBurstDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureToppleUpdateModuleData, m_minToppleBurstDelay ) },{ "MaxToppleBurstDelay", INI::parseDurationUnsignedInt, NULL, offsetof( StructureToppleUpdateModuleData, m_maxToppleBurstDelay ) },{ "StructuralIntegrity", INI::parseReal, NULL, offsetof( StructureToppleUpdateModuleData, m_structuralIntegrity ) },- { "StructuralDecay", INI::parseReal, NULL, offsetof( StructureToppleUpdateModuleData, m_structuralDecay ) },+ { "StructuralDecay", INI::parseRetailPerFrameFactorReal, NULL, offsetof( StructureToppleUpdateModuleData, m_structuralDecay ) },{ "DamageFXTypes", INI::parseDamageTypeFlags, NULL, offsetof( StructureToppleUpdateModuleData, m_damageFXTypes ) },{ "TopplingFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_toppleFXList ) },{ "ToppleDelayFX", INI::parseFXList, NULL, offsetof( StructureToppleUpdateModuleData, m_toppleDelayFXList ) },@@ -211,7 +211,7 @@ void StructureToppleUpdate::onDie( const DamageInfo *damageInfo )//-------------------------------------------------------------------------------------------------UpdateSleepTime StructureToppleUpdate::update( void ){- static const Real TOPPLE_ACCELERATION_FACTOR = 0.02f;+ static const Real TOPPLE_ACCELERATION_FACTOR = ConvertRetailPerFrameSquared(0.02f);const StructureToppleUpdateModuleData *d = getStructureToppleUpdateModuleData();diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cppindex 2a7ba0e99..f1f833202 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp@@ -250,7 +250,7 @@ UpdateSleepTime TensileFormationUpdate::update( void )}else- return UPDATE_SLEEP(30);+ return UPDATE_SLEEP(LOGICFRAMES_PER_SECOND);}@@ -258,7 +258,7 @@ UpdateSleepTime TensileFormationUpdate::update( void )if ( ! draw )return UPDATE_SLEEP_NONE;- if (++m_life > 300)+ if (++m_life > ConvertRetailFrames(300u)){draw->clearModelConditionFlags(MAKE_MODELCONDITION_MASK(MODELCONDITION_MOVING));draw->clearModelConditionFlags(MAKE_MODELCONDITION_MASK(MODELCONDITION_FREEFALL));@@ -274,7 +274,7 @@ UpdateSleepTime TensileFormationUpdate::update( void )}- if ( m_life%30 == 29 )+ if ( m_life%LOGICFRAMES_PER_SECOND == LOGICFRAMES_PER_SECOND - 1 )propagateDislodgement( TRUE );@@ -286,11 +286,11 @@ UpdateSleepTime TensileFormationUpdate::update( void )Coord3D slope = { normal.x, normal.y, 0.0f};Real steepness = 1.0f - normal.z;- slope.scale( 0.3f + steepness);+ slope.scale( ConvertRetailPerFrameSquared( 0.3f + steepness ) );m_inertia.add( &slope );- Real friction = 0.95f;+ static const Real friction = ConvertRetailPerFrameFactor( 0.95f );m_inertia.scale( friction );@@ -310,6 +310,7 @@ UpdateSleepTime TensileFormationUpdate::update( void )//APPLY TENSORS===========================Coord3D tensorSum = { 0, 0, 0 };+ static const Real tensorKeep = ConvertRetailPerFrameFactor( 0.93f );for ( int t = 0; t < 4; ++t ){Object *other = TheGameLogic->findObjectByID( m_links[ t ].id );@@ -324,8 +325,8 @@ UpdateSleepTime TensileFormationUpdate::update( void )//Coord3D desiredPos = { theirPos->x - m_links[ t ].tensor.x, theirPos->y - m_links[ t ].tensor.y, theirPos->z - m_links[ t ].tensor.z };- newPos.x = newPos.x*0.93f + desiredPos.x*0.07f;- newPos.y = newPos.y*0.93f + desiredPos.y*0.07f;+ newPos.x = newPos.x*tensorKeep + desiredPos.x*(1.0f - tensorKeep);+ newPos.y = newPos.y*tensorKeep + desiredPos.y*(1.0f - tensorKeep);newPos.z = MIN( m_lowestSlideElevation, TheTerrainLogic->getGroundHeight(newPos.x, newPos.y) );//rest on surface heretensor.normalize();@@ -350,12 +351,12 @@ UpdateSleepTime TensileFormationUpdate::update( void )draw->setModelConditionFlags(MAKE_MODELCONDITION_MASK(MODELCONDITION_POST_COLLAPSE));- if ( m_life < 200 )+ if ( m_life < ConvertRetailFrames(200u) )draw->setModelConditionFlags(MAKE_MODELCONDITION_MASK(MODELCONDITION_MOVING));elsedraw->clearModelConditionFlags(MAKE_MODELCONDITION_MASK(MODELCONDITION_MOVING));- if ( fabs( pos->z - newPos.z ) > 0.2f && m_life < 100)+ if ( fabs( pos->z - newPos.z ) > ConvertRetailPerFrameRate( 0.2f ) && m_life < ConvertRetailFrames(100u))draw->setModelConditionFlags(MAKE_MODELCONDITION_MASK(MODELCONDITION_FREEFALL));elsedraw->clearModelConditionFlags(MAKE_MODELCONDITION_MASK(MODELCONDITION_FREEFALL));diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cppindex 17360066c..364798eea 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ToppleUpdate.cpp@@ -166,12 +166,13 @@ void ToppleUpdate::applyTopplingForce( const Coord3D* toppleDirection, Real topp// a zero speed. That left both angular terms at zero: ANGULAR_LIMIT/(0*2) is infinity, which// REAL_TO_INT_FLOOR turns into garbage below, and the object then sat in TOPPLE_FALLING// forever, updating every frame and never dying. Floor it so it always actually falls.- const Real MIN_TOPPLE_SPEED = 0.01f;+ const Real MIN_TOPPLE_SPEED = ConvertRetailPerFrameRate(0.01f);if (toppleSpeed < MIN_TOPPLE_SPEED)toppleSpeed = MIN_TOPPLE_SPEED;+ // toppleSpeed is per frame; the acceleration taken from it is per frame squared, so it halves once morem_angularVelocity = toppleSpeed * d->m_initialVelocityPercent;- m_angularAcceleration = toppleSpeed * d->m_initialAccelPercent;+ m_angularAcceleration = ConvertRetailPerFrameRate(toppleSpeed * d->m_initialAccelPercent);m_toppleState = TOPPLE_FALLING;m_options = options;@@ -282,8 +283,8 @@ UpdateSleepTime ToppleUpdate::update()return UPDATE_SLEEP_FOREVER;const ToppleUpdateModuleData* d = getToppleUpdateModuleData();- const Real VELOCITY_BOUNCE_LIMIT = 0.01f; // if the velocity after a bounce will be this or lower, just stop at zero- const Real VELOCITY_BOUNCE_SOUND_LIMIT = 0.03f; // and if this low, then skip the bounce sound+ const Real VELOCITY_BOUNCE_LIMIT = ConvertRetailPerFrameRate(0.01f); // if the velocity after a bounce will be this or lower, just stop at zero+ const Real VELOCITY_BOUNCE_SOUND_LIMIT = ConvertRetailPerFrameRate(0.03f); // and if this low, then skip the bounce soundObject* obj = getObject();if (m_numAngleDeltaX)diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cppindex 69473fad7..b3e1f03a8 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/WaveGuideUpdate.cpp@@ -97,7 +97,7 @@ WaveGuideUpdateModuleData::WaveGuideUpdateModuleData( void ){ "ShorelineEffectDistance", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_shorelineEffectDistance ) },{ "DamageRadius", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_damageRadius ) },{ "DamageAmount", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_damageAmount ) },- { "ToppleForce", INI::parseReal, NULL, offsetof( WaveGuideUpdateModuleData, m_toppleForce ) },+ { "ToppleForce", INI::parseRetailPerFrameReal, NULL, offsetof( WaveGuideUpdateModuleData, m_toppleForce ) },{ "RandomSplashSound", INI::parseAudioEventRTS, NULL, offsetof( WaveGuideUpdateModuleData, m_randomSplashSound ) },{ "RandomSplashSoundFrequency", INI::parseInt, NULL, offsetof( WaveGuideUpdateModuleData, m_randomSplashSoundFrequency ) },{ "BridgeParticle", INI::parseParticleSystemTemplate, NULL, offsetof( WaveGuideUpdateModuleData, m_bridgeParticle ) },@@ -453,7 +453,7 @@ void WaveGuideUpdate::doShoreEffects( void ){// this is expensive to do *all* the time- if( TheGameLogic->getFrame() & 0x1 )+ if( TheGameLogic->getFrame() % ConvertRetailFrames( 2u ) )return;Object *waveGuide = getObject();diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cppindex cae880898..6117aaa43 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp@@ -213,7 +213,7 @@ const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] ={ "PrimaryDamageRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_primaryDamageRadius) },{ "SecondaryDamage", INI::parseReal, NULL, offsetof(WeaponTemplate, m_secondaryDamage) },{ "SecondaryDamageRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_secondaryDamageRadius) },- { "ShockWaveAmount", INI::parseReal, NULL, offsetof(WeaponTemplate, m_shockWaveAmount) },+ { "ShockWaveAmount", INI::parseRetailPerFrameReal, NULL, offsetof(WeaponTemplate, m_shockWaveAmount) },{ "ShockWaveRadius", INI::parseReal, NULL, offsetof(WeaponTemplate, m_shockWaveRadius) },{ "ShockWaveTaperOff", INI::parseReal, NULL, offsetof(WeaponTemplate, m_shockWaveTaperOff) },{ "AttackRange", INI::parseReal, NULL, offsetof(WeaponTemplate, m_attackRange) },diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cppindex a5d925fcb..e8633ff32 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp@@ -7049,7 +7049,8 @@ void ScriptActions::executeAction( ScriptAction *pAction )}else{- TheGameEngine->setFramesPerSecondLimit(pAction->getParameter(0)->getInt());+ // the map asks for a 30 Hz logic rate; 30 is normal speed+ TheGameEngine->setFramesPerSecondLimit(ConvertRetailFrames(pAction->getParameter(0)->getInt()));}// Setting the fps limit doesn't do much good if we don't use it. jba.TheWritableGlobalData->m_useFpsLimit = true;@@ -7274,20 +7275,21 @@ void ScriptActions::executeAction( ScriptAction *pAction )doTeamStopSequentialScript(pAction->getParameter(0)->getString());return;+ // map frame counts are 30 Hz framescase ScriptAction::UNIT_GUARD_FOR_FRAMECOUNT:- doUnitGuardForFramecount(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt());+ doUnitGuardForFramecount(pAction->getParameter(0)->getString(), ConvertRetailFrames(pAction->getParameter(1)->getInt()));return;case ScriptAction::UNIT_IDLE_FOR_FRAMECOUNT:- doUnitIdleForFramecount(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt());+ doUnitIdleForFramecount(pAction->getParameter(0)->getString(), ConvertRetailFrames(pAction->getParameter(1)->getInt()));return;-+case ScriptAction::TEAM_GUARD_FOR_FRAMECOUNT:- doTeamIdleForFramecount(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt());+ doTeamIdleForFramecount(pAction->getParameter(0)->getString(), ConvertRetailFrames(pAction->getParameter(1)->getInt()));return;-+case ScriptAction::TEAM_IDLE_FOR_FRAMECOUNT:- doTeamIdleForFramecount(pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt());+ doTeamIdleForFramecount(pAction->getParameter(0)->getString(), ConvertRetailFrames(pAction->getParameter(1)->getInt()));return;case ScriptAction::WATER_CHANGE_HEIGHT:@@ -7418,7 +7420,7 @@ void ScriptActions::executeAction( ScriptAction *pAction )return;case ScriptAction::TEAM_SPIN_FOR_FRAMECOUNT:- doTeamSpinForFramecount( pAction->getParameter(0)->getString(), pAction->getParameter(1)->getInt() );+ doTeamSpinForFramecount( pAction->getParameter(0)->getString(), ConvertRetailFrames(pAction->getParameter(1)->getInt()) );return;case ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NAMED:diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cppindex f0185f19f..288b86151 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp@@ -152,9 +152,9 @@ enum { K_SCRIPTS_DATA_VERSION_1 = 1 };enum { MAX_SPIN_COUNT = 20 };#define NONE_STRING "<none>"-static const Int FRAMES_TO_SHOW_WIN_LOSE_MESSAGE = 120;+static const Int FRAMES_TO_SHOW_WIN_LOSE_MESSAGE = ConvertRetailFrames(120);-static const Int FRAMES_TO_FADE_IN_AT_START = 33;+static const Int FRAMES_TO_FADE_IN_AT_START = ConvertRetailFrames(33);//------------------------------------------------------------------------------ Performance Timers@@ -6551,9 +6551,10 @@ void ScriptEngine::setFade( ScriptAction *pAction )m_curFadeFrame = 0;m_minFade = pAction->getParameter(0)->getReal();m_maxFade = pAction->getParameter(1)->getReal();- m_fadeFramesIncrease = pAction->getParameter(2)->getInt();- m_fadeFramesHold = pAction->getParameter(3)->getInt();- m_fadeFramesDecrease = pAction->getParameter(4)->getInt();+ // the map's frame counts are 30 Hz frames+ m_fadeFramesIncrease = ConvertRetailFrames(pAction->getParameter(2)->getInt());+ m_fadeFramesHold = ConvertRetailFrames(pAction->getParameter(3)->getInt());+ m_fadeFramesDecrease = ConvertRetailFrames(pAction->getParameter(4)->getInt());m_curFadeValue = m_minFade;if( m_fadeFramesIncrease == 0 ){@@ -6573,9 +6574,13 @@ void ScriptEngine::setSway( ScriptAction *pAction )m_breezeInfo.m_directionVec.y = Cos(m_breezeInfo.m_direction);m_breezeInfo.m_intensity = pAction->getParameter(1)->getReal();m_breezeInfo.m_lean = pAction->getParameter(2)->getReal();- m_breezeInfo.m_breezePeriod = pAction->getParameter(3)->getInt();- if (m_breezeInfo.m_breezePeriod<1)- m_breezeInfo.m_breezePeriod = 1;+ // 30 Hz frames in the map; the period is a Short, so clamp before it narrows+ Int breezePeriod = ConvertRetailFrames(pAction->getParameter(3)->getInt());+ if (breezePeriod > SHRT_MAX)+ breezePeriod = SHRT_MAX;+ if (breezePeriod < 1)+ breezePeriod = 1;+ m_breezeInfo.m_breezePeriod = (Short)breezePeriod;m_breezeInfo.m_randomness = pAction->getParameter(4)->getReal();}@@ -6911,7 +6916,7 @@ void ScriptEngine::setTimer( ScriptAction *pAction, Bool millisecondTimer, BoolInt randomValue = pAction->getParameter(2)->getInt();value = GameLogicRandomValue(value, randomValue);}- m_counters[counterNdx].value = value;+ m_counters[counterNdx].value = ConvertRetailFrames(value); // 30 Hz frames in the map}m_counters[counterNdx].isCountdownTimer = true;}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/ScenarioDrill.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/ScenarioDrill.cppindex a4b8ccd84..4c134278a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/ScenarioDrill.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/ScenarioDrill.cpp@@ -522,7 +522,7 @@ struct ScenarioArrival/// how long a unit on its way has to stand still before it counts as having stoppedstatic const Int SCENARIO_STALL_FRAMES = LOGICFRAMES_PER_SECOND;/// less than this from one frame to the next is standing still-static const Real SCENARIO_STILL_DISTANCE = 0.05f;+static const Real SCENARIO_STILL_DISTANCE = ConvertRetailPerFrameRate( 0.05f );/// how far a unit has to have gone from where it stood before it counts as having obeyed the orderstatic const Real SCENARIO_DEPARTED_DISTANCE = 20.0f;@@ -1797,8 +1797,9 @@ void ScenarioDrill_tick( void )updateStatues( now );+ // a scenario file counts 30 Hz frames, so the files written before 60 Hz logic play at the same secondswhile (theScenarioCursor < (Int)theScenarioActions.size()- && theScenarioActions[ theScenarioCursor ].frame <= now)+ && ConvertRetailFrames( theScenarioActions[ theScenarioCursor ].frame ) <= now){if (ScenarioDrill_execute( theScenarioActions[ theScenarioCursor ] ))++theScenarioActionsRun;diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cppindex 0baddd37d..dc3a6e84a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp@@ -655,11 +655,11 @@ void ConnectionManager::processRunAheadMetrics(NetRunAheadMetricsCommandMsg *msgm_latencyAverages[player] = msg->getAverageLatency();m_fpsAverages[player] = msg->getAverageFps();//DEBUG_LOG(("ConnectionManager::processRunAheadMetrics - player %d, fps = %d, latency = %f\n", player, msg->getAverageFps(), msg->getAverageLatency()));- if (m_fpsAverages[player] > 100) {- // limit the reported frame rate average to 100. This is done because if a+ if (m_fpsAverages[player] > ConvertRetailFrames(100)) {+ // limit the reported frame rate average to 100 retail frames. This is done because if a// user alt-tab's out of the game their frame rate climbs to in the neighborhood of// 300, that was deemed "ugly" by the powers that be.- m_fpsAverages[player] = 100;+ m_fpsAverages[player] = ConvertRetailFrames(100);}}}@@ -1333,6 +1333,9 @@ void ConnectionManager::updateRunAhead(Int oldRunAhead, Int frameRate, Bool didSon the settled rate rather than this one: it is the room's honest measured speed, andsizing a safety window on the rate we are hoping for is how the window comes up short. */Int commandedFps = probeRoomFrameRate(minFps, TheGlobalData->m_framesPerSecondLimit);+ // the rate crosses the wire as an UnsignedByte, and -fps is in logic frames now (twice retail)+ if (commandedFps > UCHAR_MAX)+ commandedFps = UCHAR_MAX;Int newRunAhead = computeRunAhead(getMaximumLatency(), minFps,TheGlobalData->m_networkRunAheadSlack, MIN_RUNAHEAD, MAX_FRAMES_AHEAD / 2);diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameMetrics.cppindex a128cbba1..b2d813d4a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FrameMetrics.cpp@@ -86,14 +86,14 @@ FrameMetrics::~FrameMetrics() {}void FrameMetrics::init() {- m_averageFps = 30;+ m_averageFps = LOGICFRAMES_PER_SECOND;m_averageLatency = (Real)0.2;m_minimumCushion = -1;// i is used after the loop; VC6 for-scope let it escape.Int i;for (i = 0; i < TheGlobalData->m_networkFPSHistoryLength; ++i) {- m_fpsList[i] = 30.0;+ m_fpsList[i] = (Real)LOGICFRAMES_PER_SECOND;}m_fpsListIndex = 0;// The fps window has to open on a real time and a real frame. Left at zero, the first samplediff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cppindex 7856e0ef8..d3957fce7 100644--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetCommandMsg.cpp@@ -516,8 +516,8 @@ Int NetRunAheadMetricsCommandMsg::getAverageFps() {// NetRunAheadCommandMsg//-------------------------NetRunAheadCommandMsg::NetRunAheadCommandMsg() : NetCommandMsg() {- m_runAhead = min(max(20, MIN_RUNAHEAD), MAX_FRAMES_AHEAD/2);- m_frameRate = 30;+ m_runAhead = min(max(ConvertRetailFrames(20), MIN_RUNAHEAD), MAX_FRAMES_AHEAD/2);+ m_frameRate = LOGICFRAMES_PER_SECOND;m_commandType = NETCOMMANDTYPE_RUNAHEAD;}diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cppindex 1412344c1..5c5c6f909 100644--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/Network.cpp@@ -342,8 +342,8 @@ void Network::init()m_conMgr->init();m_lastFrame = 0;- m_runAhead = min(max(30, MIN_RUNAHEAD), MAX_FRAMES_AHEAD/2); ///< @todo: don't hard-code the run-ahead.- m_frameRate = 30;+ m_runAhead = min(max((Int)LOGICFRAMES_PER_SECOND, MIN_RUNAHEAD), MAX_FRAMES_AHEAD/2); ///< a second, until the router's first run-ahead command+ m_frameRate = LOGICFRAMES_PER_SECOND;m_lastExecutionFrame = m_runAhead - 1; // subtract 1 since we're starting on frame 0m_lastFrameCompleted = m_runAhead - 1; // subtract 1 since we're starting on frame 0m_frameDataReady = FALSE;diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cppindex d2b61ce46..71fcc9db0 100644--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/NetworkUtil.cpp@@ -30,16 +30,18 @@#include "GameNetwork/NetworkUtil.h"#include "TARGA.H"-Int MAX_FRAMES_AHEAD = 128;+/* Frame counts, sized for the time they cover: 128 and 4 frames were EA's at 30 Hz, the same+ 4.3 s and 133 ms at LOGICFRAMES_PER_SECOND are twice the frames. */+Int MAX_FRAMES_AHEAD = ConvertRetailFrames(128);-/* The shortest run-ahead the room is ever commanded to use: 133 ms of input delay at 30 Hz. EA+/* The shortest run-ahead the room is ever commanded to use: 133 ms of input delay. EAshipped ten frames - a third of a second on every link, LAN included - and because the formulain computeRunAhead does not clear ten until the two worst average round trips add up to about600 ms, ten frames is what every game anyone actually played ran at. The window can come downthis far because computeRunAhead now rounds the trip up rather than down and carries a fixedjitter allowance on top (RUNAHEAD_JITTER_FRAMES), so a link that genuinely needs a wide windowis given a wider one than the old floor ever gave it, and a link that does not stops paying. */-Int MIN_RUNAHEAD = 4;+Int MIN_RUNAHEAD = ConvertRetailFrames(4);Int FRAME_DATA_LENGTH = (MAX_FRAMES_AHEAD+1)*2;Int FRAMES_TO_KEEP = (MAX_FRAMES_AHEAD/2) + 1;diff --git a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cppindex 37eed13f2..ae235b6e8 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp@@ -527,7 +527,7 @@ void MilesAudioManager::reset()* exactly 1/30 of a second of sound per logic frame, however long the frame took on the wall clock.* So the file is as long as the frames it spans and lines up with the picture of the same frames,* in a run that plays at the speed a person hears, in a -directorrecord run that crawls, and on a- * machine with no speakers. A sound asked for during frame N starts N/30 seconds in, because the+ * machine with no speakers. A sound asked for during frame N starts N/LOGICFRAMES_PER_SECOND seconds in, because the* requests are only played after this has mixed up to N. Nothing is heard while it runs. */static void updateSoundCapture( void ){diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cppindex 9af1455a4..2f0be6bae 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp@@ -66,7 +66,7 @@// PRIVATE DATA ///////////////////////////////////////////////////////////////////////////////////-enum { OVERLAY_REFRESH_RATE = 6 }; ///< over updates once this many frames+enum { OVERLAY_REFRESH_RATE = 6 * LOGICFRAMES_PER_RETAIL_FRAME }; ///< over updates once this many frames//-------------------------------------------------------------------------------------------------/** Is the point legal, that is, inside the resolution of the radar cells */diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cppindex 307ae126a..e25db2d30 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDebrisDraw.cpp@@ -235,7 +235,7 @@ void W3DDebrisDraw::doDrawModule(const Matrix3D* transformMtx)Int oldState = m_state;Object* obj = getDrawable()->getObject();- const Int MIN_FINAL_FRAMES = 3;+ const Int MIN_FINAL_FRAMES = ConvertRetailFrames(3);if (m_state != FINAL && obj != NULL && !obj->isAboveTerrain() && m_frames > MIN_FINAL_FRAMES){m_state = FINAL;diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cppindex adc103105..4c3845086 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp@@ -1056,10 +1056,10 @@ W3DModelDrawModuleData::W3DModelDrawModuleData() :const Real SETTLE_RATE = 0.065f;m_projectileBoneFeedbackEnabledSlots = 0;- m_initialRecoil = INITIAL_RECOIL_RATE;+ m_initialRecoil = ConvertRetailPerFrameRate(INITIAL_RECOIL_RATE);m_maxRecoil = MAX_SHIFT;- m_recoilDamping = RECOIL_DAMPING;- m_recoilSettle = SETTLE_RATE;+ m_recoilDamping = ConvertRetailPerFrameFactor(RECOIL_DAMPING);+ m_recoilSettle = ConvertRetailPerFrameRate(SETTLE_RATE);m_receivesDynamicLights = TRUE;@@ -1232,7 +1232,7 @@ void W3DModelDrawModuleData::buildFieldParse(MultiIniFieldParse& p){{ "InitialRecoilSpeed", INI::parseVelocityReal, NULL, offsetof(W3DModelDrawModuleData, m_initialRecoil) },{ "MaxRecoilDistance", INI::parseReal, NULL, offsetof(W3DModelDrawModuleData, m_maxRecoil) },- { "RecoilDamping", INI::parseReal, NULL, offsetof(W3DModelDrawModuleData, m_recoilDamping) },+ { "RecoilDamping", INI::parseRetailPerFrameFactorReal, NULL, offsetof(W3DModelDrawModuleData, m_recoilDamping) },{ "RecoilSettleSpeed", INI::parseVelocityReal, NULL, offsetof(W3DModelDrawModuleData, m_recoilSettle) },{ "OkToChangeModelColor", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_okToChangeModelColor) },{ "AnimationsRequirePower", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_animationsRequirePower) },@@ -2873,7 +2873,7 @@ void W3DModelDraw::handleClientRecoil()barrels[i].setMuzzleFlashHidden(m_renderObject, hidden);}- const Real TINY_RECOIL = 0.01f;+ const Real TINY_RECOIL = ConvertRetailPerFrameRate(0.01f);if (barrels[i].m_recoilBone != 0){switch (recoils[i].m_state )diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cppindex 10fdf582a..a11203c47 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DPoliceCarDraw.cpp@@ -92,7 +92,7 @@ W3DPoliceCarDraw::~W3DPoliceCarDraw( void )if( m_light ){// Have it fade out over 5 frames.- m_light->setFrameFade(0, 5);+ m_light->setFrameFade(0, ConvertRetailFrames(5u));m_light->setDecayRange();m_light->setDecayColor();m_light = NULL;@@ -105,7 +105,7 @@ W3DPoliceCarDraw::~W3DPoliceCarDraw( void )void W3DPoliceCarDraw::doDrawModule(const Matrix3D* transformMtx){const Real floatAmt = 8.0f;- const Real animAmt = 0.25;+ const Real animAmt = ConvertRetailPerFrameRate(0.25f);// get pointers to our render objects that we'll needRenderObjClass* policeCarRenderObj = getRenderObject();@@ -117,7 +117,7 @@ void W3DPoliceCarDraw::doDrawModule(const Matrix3D* transformMtx){Real frames = anim->Get_Num_Frames();//- // animAmt is a quarter of an animation frame per LOGIC frame, but doDrawModule runs once+ // animAmt is a quarter of an animation frame per 30 Hz LOGIC frame, but doDrawModule runs once// per RENDER frame: uncapped, the light span through its cycle at (fps/30) times speed.// Step it on the logic clock, the same way the tree sway does.//diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cppindex 0dadf05e4..e453a63c5 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankDraw.cpp@@ -284,7 +284,7 @@ void W3DTankDraw::onRenderObjRecreated(void)//-------------------------------------------------------------------------------------------------void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx){- const Real DEBRIS_THRESHOLD = 0.00001f;+ const Real DEBRIS_THRESHOLD = ConvertRetailPerFrameSquared(0.00001f);Bool frozen = TheTacticalView->isTimeFrozen() && !TheTacticalView->isCameraMovementFinished();frozen = frozen || TheScriptEngine->isTimeFrozenDebug() || TheScriptEngine->isTimeFrozenScript();@@ -315,9 +315,9 @@ void W3DTankDraw::doDrawModule(const Matrix3D* transformMtx)elsestopMoveDebris();- // kick debris higher the faster we move+ // kick debris higher the faster we move (the multipliers were written for distance per 30 Hz frame)Coord3D velMult;- velMag = (Real)sqrt( velMag );+ velMag = (Real)sqrt( velMag ) * LOGICFRAMES_PER_RETAIL_FRAME;velMult.x = 0.5f * velMag + 0.1f;if (velMult.x > 1.0f)diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cppindex 99b3b2ef6..403e12fe8 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp@@ -85,7 +85,7 @@ void W3DTankTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p){ "MidLeftRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_midRearLeftTireBoneName) },{ "MidRightRearTireBone", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_midRearRightTireBoneName) },{ "TireRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_rotationSpeedMultiplier) },- { "PowerslideRotationAddition", INI::parseReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_powerslideRotationAddition) },+ { "PowerslideRotationAddition", INI::parseRetailPerFrameReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_powerslideRotationAddition) },{ "TreadDebrisLeft", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadDebrisNameLeft) },{ "TreadDebrisRight", INI::parseAsciiString, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadDebrisNameRight) },{ "TreadAnimationRate", INI::parseVelocityReal, NULL, offsetof(W3DTankTruckDrawModuleData, m_treadAnimationRate) },@@ -494,7 +494,7 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx)if (frozen)return;- const Real ACCEL_THRESHOLD = 0.01f;+ const Real ACCEL_THRESHOLD = ConvertRetailPerFrameSquared(0.01f);const Real SIZE_CAP = 2.0f;// get object from logicObject *obj = getDrawable()->getObject();@@ -512,7 +512,8 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx)return;const Coord3D *vel = physics->getVelocity();- Real speed = physics->getVelocityMagnitude();+ // the dust sizes below were written for distance per 30 Hz frame+ Real speed = physics->getVelocityMagnitude() * LOGICFRAMES_PER_RETAIL_FRAME;// wheels and treads turn by the ground covered since the last picture, not by speed every pictureReal forward, turn;@@ -614,6 +615,7 @@ void W3DTankTruckDraw::doDrawModule(const Matrix3D* transformMtx)m_dustEffect->setSizeMultiplier(speed);}if (m_dirtEffect) {+ // m_framesAirborne counts Drawable's ground steps, which are retail framesif (wheelInfo && wheelInfo->m_framesAirborne>3) {// See W3DTruckDraw: the landing puff is the dust system's, and this branch reached// it while guarded on the dirt system - a null dereference for anything with adiff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cppindex 61a385f6c..1d8227662 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp@@ -89,7 +89,7 @@ void W3DTruckDrawModuleData::buildFieldParse(MultiIniFieldParse& p){ "MidRightMidTireBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_midMidRightTireBoneName) },{ "TireRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_rotationSpeedMultiplier) },- { "PowerslideRotationAddition", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_powerslideRotationAddition) },+ { "PowerslideRotationAddition", INI::parseRetailPerFrameReal, NULL, offsetof(W3DTruckDrawModuleData, m_powerslideRotationAddition) },{ "CabBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_cabBoneName) },{ "TrailerBone", INI::parseAsciiString, NULL, offsetof(W3DTruckDrawModuleData, m_trailerBoneName) },{ "CabRotationMultiplier", INI::parseReal, NULL, offsetof(W3DTruckDrawModuleData, m_cabRotationFactor) },@@ -402,7 +402,7 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx)if (frozen)return;- const Real ACCEL_THRESHOLD = 0.01f;+ const Real ACCEL_THRESHOLD = ConvertRetailPerFrameSquared(0.01f);const Real SIZE_CAP = 2.0f;// get object from logicObject *obj = getDrawable()->getObject();@@ -421,13 +421,15 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx)return;const Coord3D *vel = physics->getVelocity();- Real speed = physics->getVelocityMagnitude();+ // the dust sizes below were written for distance per 30 Hz frame+ Real speed = physics->getVelocityMagnitude() * LOGICFRAMES_PER_RETAIL_FRAME;// wheels turn by the ground covered since the last picture, and the cab and trailer swing once a- // logic frame: both used to step every picture, four times as fast at 120 a second+ // logic frame: both used to step every picture, four times as fast at 120 a second. RotationDamping+ // is a share per 30 Hz frame.Real forward, turn;UnsignedInt frames = stepGroundMotion(forward, turn);- Real swing = 1.0f - pow(1.0f - moduleData->m_rotationDampingFactor, (Real)frames);+ Real swing = 1.0f - pow(1.0f - moduleData->m_rotationDampingFactor, (Real)frames / LOGICFRAMES_PER_RETAIL_FRAME);const TWheelInfo *wheelInfo = getDrawable()->getWheelInfo(); // note, can return null!AIUpdateInterface *ai = obj->getAI();@@ -597,6 +599,7 @@ void W3DTruckDraw::doDrawModule(const Matrix3D* transformMtx)m_dustEffect->setSizeMultiplier(speed);}if (m_dirtEffect) {+ // m_framesAirborne counts Drawable's ground steps, which are retail framesif (wheelInfo && wheelInfo->m_framesAirborne>3) {// The landing puff belongs to the dust system, not the dirt system. This branch was// guarded on m_dirtEffect and then went straight through m_dustEffect, which is adiff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cppindex 875a2b326..fbaa08ffc 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp@@ -200,7 +200,8 @@ void W3DDebugIcons::addIcon(const Coord3D *pos, Real width, Int numFramesDuratiom_debugIcons[m_numDebugIcons].position = *pos;m_debugIcons[m_numDebugIcons].width = width;m_debugIcons[m_numDebugIcons].color = color;- m_debugIcons[m_numDebugIcons].endFrame = TheGameLogic->getFrame()+numFramesDuration;+ // the callers count the icon's life in 30 Hz frames, EA's literals and GlobalData's Debug*TileDuration alike+ m_debugIcons[m_numDebugIcons].endFrame = TheGameLogic->getFrame()+ConvertRetailFrames(numFramesDuration);m_numDebugIcons++;}@@ -254,7 +255,7 @@ void W3DDebugIcons::Render(RenderInfoClass & rinfo)try {for(; numVertex<numRect*4 && k<m_numDebugIcons; k++) {Int theAlpha = 64;- const Int FADE_FRAMES = 100;+ const Int FADE_FRAMES = ConvertRetailFrames(100);Int framesLeft = m_debugIcons[k].endFrame - TheGameLogic->getFrame();if (framesLeft < 1) {anyVanished = true;diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cppindex 393980312..fcd2adacd 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp@@ -2412,7 +2412,14 @@ AGAIN:W3DView *primaryW3DView=(W3DView *)getFirstView();if (!freezeTime && TheScriptEngine->isTimeFast()){- primaryW3DView->updateCameraMovements(); // Update camera motion effects.+ // the scripted camera moves step once a retail frame, as everywhere else+ static UnsignedInt lastCameraRetailFrame = ~0u;+ const UnsignedInt cameraRetailFrame = TheGameClient->getFrame() / LOGICFRAMES_PER_RETAIL_FRAME;+ if (cameraRetailFrame != lastCameraRetailFrame)+ {+ lastCameraRetailFrame = cameraRetailFrame;+ primaryW3DView->updateCameraMovements(); // Update camera motion effects.+ }syncTime += TheW3DFrameLengthInMsec;return;}@@ -2458,15 +2465,22 @@ AGAIN:UnsignedInt deltaMs = nowSyncMs - prevSyncMs;prevSyncMs = nowSyncMs;- if (deltaMs > TheW3DFrameLengthInMsec * 4)- deltaMs = TheW3DFrameLengthInMsec * 4; // a level load must not fast-forward everything+ // a level load must not fast-forward everything; four retail frames, as it was at 30+ const UnsignedInt MAX_SYNC_STEP_MS = TheW3DFrameLengthInMsec * 4 * LOGICFRAMES_PER_RETAIL_FRAME;+ if (deltaMs > MAX_SYNC_STEP_MS)+ deltaMs = MAX_SYNC_STEP_MS;// a recorded picture is its share of a logic frame however long it took to draw and save, so the- // clock moves that much too, or the footage plays every animation fast+ // clock moves that much too, or the footage plays every animation fast. Read off the pictures'+ // own clock rather than added up: a 60 Hz frame is not a whole number of milliseconds, and+ // TheW3DFrameLengthInMsec's 16 played the footage 4% slowif (videoRecordingFrame()){- const Int pictures = GameEngine_videoPictures();- const Int shown = GameEngine_videoPicture();- deltaMs = TheW3DFrameLengthInMsec * (shown + 1) / pictures - TheW3DFrameLengthInMsec * shown / pictures;+ static UnsignedInt prevPictureMs = 0;+ const UnsignedInt pictureMs = GameEngine_pictureMilliseconds();+ deltaMs = pictureMs - prevPictureMs;+ if (pictureMs < prevPictureMs || deltaMs > MAX_SYNC_STEP_MS)+ deltaMs = TheW3DFrameLengthInMsec / GameEngine_videoPictures(); // the first recorded picture+ prevPictureMs = pictureMs;}syncTime += deltaMs;@@ -2585,9 +2599,9 @@ AGAIN:// start render block#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)- if ( (TheGameLogic->getFrame() % 30 == 1) || ( ! ( !TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode) ) )+ if ( (TheGameLogic->getFrame() % LOGICFRAMES_PER_SECOND == 1) || ( ! ( !TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode) ) )#else- if ( (TheGameLogic->getFrame() % 30 == 1) || ( ! (!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame())) )+ if ( (TheGameLogic->getFrame() % LOGICFRAMES_PER_SECOND == 1) || ( ! (!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame())) )#endif{USE_PERF_TIMER(BigAssRenderLoop)diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cppindex 85599fd04..eb5f6a6eb 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp@@ -186,7 +186,7 @@ void W3DDisplayStringManager::update( void )}UnsignedInt currFrame = TheGameClient->getFrame();- const UnsignedInt w3dCleanupTime = 60; /** any string not rendered after+ const UnsignedInt w3dCleanupTime = LOGICFRAMES_PER_SECOND * 2; /** any string not rendered afterthis many frames will have itsrender resources freed */diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cppindex 0ad5fca4f..99d491de5 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp@@ -1239,7 +1239,7 @@ void W3DInGameUI::drawMoveHints( View *view ){Int elapsed = TheGameClient->getFrame() - m_moveHint[i].frame;- if( m_moveHint[ i ].frame != 0 && elapsed <= 40 )+ if( m_moveHint[ i ].frame != 0 && elapsed <= ConvertRetailFrames( 40 ) ){// create render object and add to scene of neededif( m_moveHintRenderObj[ i ] == NULL )diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cppindex 52503cae6..ab67e15ba 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp@@ -629,8 +629,8 @@ static const Real FIELD_BUBBLE_GAIN = 0.6f;static const Real FIELD_COVER = 2.0f; ///< puddles per (radius / puddle size) squaredstatic const Int FIELD_MAX_PUDDLES = 48;static const Real FIELD_GAIN = 0.7f; ///< of the template's brightest colour, a puddle-static const Int FIELD_FADE_IN = 15; ///< logic frames-static const Int FIELD_FADE_OUT = 90; ///< logic frames before the field object dies+static const Int FIELD_FADE_IN = LOGICFRAMES_PER_SECOND / 2; ///< logic frames+static const Int FIELD_FADE_OUT = 3 * LOGICFRAMES_PER_SECOND; ///< logic frames before the field object diesstatic const Int FIELD_FADE_GONE = FIELD_FADE_OUT; ///< logic frames, a field fogged over or whose object went earlystatic const Real FIELD_OBJECT_REACH = 5.0f; ///< how near the field's centre its object stands@@ -665,7 +665,7 @@ struct FieldStateAsciiString texture;};-static const Int FIELD_GRACE = 30; ///< logic frames a field with no object outlives its systems+static const Int FIELD_GRACE = LOGICFRAMES_PER_SECOND; ///< logic frames a field with no object outlives its systemsstatic const Real FIELD_STACK = 2.5f; ///< puddles' worth of cover a spot may add up tostatic const Real FIELD_SATURATE = 0.6f; ///< share of the weakest channel taken out of the colourdiff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cppindex 62fce030c..61101d71d 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp@@ -1316,7 +1316,9 @@ Bool ScreenMotionBlurFilter::postRender(enum FilterModes mode, Coord2D &scrollDem_skipRender = false;- if (!pan && m_lastFrame != TheGameLogic->getFrame()) {+ // COUNT_STEP is a step per 30 Hz frame, so the count moves on the retail clock+ const Int retailFrame = TheGameLogic->getFrame() / LOGICFRAMES_PER_RETAIL_FRAME;+ if (!pan && m_lastFrame != retailFrame) {if (m_decrement) {m_maxCount-=COUNT_STEP;if (m_maxCount<1) {@@ -1383,7 +1385,7 @@ Bool ScreenMotionBlurFilter::postRender(enum FilterModes mode, Coord2D &scrollDe}}- m_lastFrame = TheGameLogic->getFrame();+ m_lastFrame = retailFrame;if (pan){m_skipRender = false;}diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cppindex 200519de3..286380042 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTreeBuffer.cpp@@ -1673,7 +1673,7 @@ void W3DTreeBuffer::pushAsideTree(DrawableID id, const Coord3D *pusherPos,UnsignedInt lastFrame = m_trees[i].lastFrameUpdated;m_trees[i].lastFrameUpdated = TheGameLogic->getFrame();if(m_trees[i].pushAsideSource == pusherID) {- if (m_trees[i].lastFrameUpdated - lastFrame < 3)+ if (m_trees[i].lastFrameUpdated - lastFrame < ConvertRetailFrames(3u))return; // already pushing. [5/28/2003]}@@ -2191,9 +2191,11 @@ void W3DTreeBuffer::drawTrees(CameraClass * camera, RefRenderObjListIterator *pDTheW3DProjectedShadowManager->flushDecals(m_shadow->getTexture(0), SHADOW_DECAL);}- // Update pushed aside and toppling trees.+ // Update pushed aside and toppling trees, once a logic frame like the sway: the push and sink+ // counts are logic frames, and the topple's speeds were converted to them. Run every render+ // pass, they went as much faster as the picture rate was over the logic's.for (curTree=0; curTree<m_numTrees; curTree++) {- if (pause) {+ if (!stepSway) {break;}Int type = m_trees[curTree].treeType;@@ -2498,17 +2500,21 @@ void W3DTreeBuffer::applyTopplingForce( TTree *tree, const Coord3D* toppleDirect// Having a low toppleSpeed is BAD. In particular, if the toppleSpeed is exactly 0, the// tree will stay upright forever, frozen in place (because the sway update is dead)// but never dying- if ( toppleSpeed < d->m_minimumToppleSpeed )+ // MinimumToppleSpeed is per retail frame and the tree steps once a logic frame+ const Real minimumToppleSpeed = ConvertRetailPerFrameRate( d->m_minimumToppleSpeed );+ if ( toppleSpeed < minimumToppleSpeed ){- toppleSpeed = d->m_minimumToppleSpeed;+ toppleSpeed = minimumToppleSpeed;}-+tree->m_toppleDirection = *toppleDirection;tree->m_toppleDirection.normalize();tree->m_angularAccumulation = 0;+ // toppleSpeed is per logic frame; the acceleration taken from it is per frame squared, so it+ // halves once more, as in ToppleUpdatetree->m_angularVelocity = toppleSpeed * d->m_initialVelocityPercent;- tree->m_angularAcceleration = toppleSpeed * d->m_initialAccelPercent;+ tree->m_angularAcceleration = ConvertRetailPerFrameRate( toppleSpeed * d->m_initialAccelPercent );tree->m_toppleState = TOPPLE_FALLING;tree->m_options = options;Coord3D pos;@@ -2554,8 +2560,8 @@ void W3DTreeBuffer::updateTopplingTree(TTree *tree)}return;}- const Real VELOCITY_BOUNCE_LIMIT = 0.01f; // if the velocity after a bounce will be this or lower, just stop at zero- const Real VELOCITY_BOUNCE_SOUND_LIMIT = 0.03f; // and if this low, then skip the bounce sound+ const Real VELOCITY_BOUNCE_LIMIT = ConvertRetailPerFrameRate(0.01f); // if the velocity after a bounce will be this or lower, just stop at zero+ const Real VELOCITY_BOUNCE_SOUND_LIMIT = ConvertRetailPerFrameRate(0.03f); // and if this low, then skip the bounce soundReal curVelToUse = tree->m_angularVelocity;if (tree->m_angularAccumulation + curVelToUse > ANGULAR_LIMIT)diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cppindex a1e453c27..4a25e8273 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp@@ -124,8 +124,11 @@-// 30 fps-Int TheW3DFrameLengthInMsec = 1000/LOGICFRAMES_PER_SECOND; // default is 33msec/frame == 30fps. but we may change it depending on sys config.+// one logic frame; GameClient::init sets it+Int TheW3DFrameLengthInMsec = 1000/LOGICFRAMES_PER_SECOND;+// The camera's steppers - the smoothing, the scripted moves counted in steps, the scroll - were tuned for+// one step a retail logic frame and step on that cadence whatever the logic rate is.+static const Int CAMERA_STEP_MSEC = 1000/RETAIL_LOGICFRAMES_PER_SECOND;static const Int MAX_REQUEST_CACHE_SIZE = 40; // Any size larger than 10, or examine code below for changes. jkmcd.static const Real DRAWABLE_OVERSCAN = 75.0f; ///< 3D world coords of how much to overscan in the 3D screen region@@ -1687,7 +1690,7 @@ void W3DView::update(void)#endif-// Int elapsedTimeMs = TheW3DFrameLengthInMsec; // Assume a constant time flow. It just works out better. jba.+// Int elapsedTimeMs = CAMERA_STEP_MSEC; // Assume a constant time flow. It just works out better. jba.// The camera smoothing and scripted one-frame movements below were tuned for one// call per 30Hz engine tick; update() now runs once per render frame. Step them on@@ -1696,7 +1699,7 @@ void W3DView::update(void)static UnsignedInt prevCameraStepTime = 0;const Bool pictureClock = onPictureClock( this );UnsignedInt nowCameraStepTime = cameraClockMilliseconds( this );- Bool stepTime = (nowCameraStepTime - prevCameraStepTime) >= (UnsignedInt)TheW3DFrameLengthInMsec;+ Bool stepTime = (nowCameraStepTime - prevCameraStepTime) >= (UnsignedInt)CAMERA_STEP_MSEC;// During a scripted frozen-time pan, W3DDisplay::draw's inner loop calls us and// paces itself to ~30fps already; gating on top of that ran the pan at half speed.if (isTimeFrozen() && !isCameraMovementFinished())@@ -1705,11 +1708,13 @@ void W3DView::update(void){// a recorded logic frame steps once, on its last picture: not on a -recordfps picture before it,// whose 16 or 17 ms would put the step on every second picture in a phase that drifts, nor on a- // -directorrecord pane's second draw+ // -directorrecord pane's second draw. Once a retail frame, every second logic frame, like the+ // wall clock's stepstatic UnsignedInt steppedFrame = 0xFFFFFFFFu;- stepTime = GameEngine_videoPicture() == GameEngine_videoPictures() - 1 && TheGameLogic->getFrame() != steppedFrame;+ const UnsignedInt retailFrame = TheGameLogic->getFrame() / LOGICFRAMES_PER_RETAIL_FRAME;+ stepTime = GameEngine_videoPicture() == GameEngine_videoPictures() - 1 && retailFrame != steppedFrame;if (stepTime)- steppedFrame = TheGameLogic->getFrame();+ steppedFrame = retailFrame;prevCameraStepTime = nowCameraStepTime;}else if (stepTime)@@ -1717,8 +1722,8 @@ void W3DView::update(void)// carry the remainder instead of discarding it: with a render cadence that is not// a multiple of 33ms (the shell caps at 45fps), discarding ran the steppers at a// fraction of real speed and beat against the render rate as visible judder- prevCameraStepTime += (UnsignedInt)TheW3DFrameLengthInMsec;- if (nowCameraStepTime - prevCameraStepTime >= (UnsignedInt)TheW3DFrameLengthInMsec)+ prevCameraStepTime += (UnsignedInt)CAMERA_STEP_MSEC;+ if (nowCameraStepTime - prevCameraStepTime >= (UnsignedInt)CAMERA_STEP_MSEC)prevCameraStepTime = nowCameraStepTime; // fell far behind (hitch, pause) - resync}@@ -1786,13 +1791,14 @@ void W3DView::update(void){followFactor = -1;}- // R1, smooth motion: with it on, the lock follows on every render frame, towards the drawable's- // blended position, each per-step factor scaled to this frame's length (1-(1-f)^steps); with it off,- // 30 Hz steps and the factors as they were.+ // The lock follows on every render frame, each per-retail-frame factor scaled to this frame's+ // length (1-(1-f)^steps), so it keeps retail's pull at any frame rate. Stepping it every 33 ms+ // while the unit moves every logic frame, 16.7 ms, put the camera a frame behind on every second+ // one, a 2:1 judder. With smooth motion on it aims at the drawable's blended position as well.const Bool smoothLock = TheSmoothMotionActive;- const Real lockSteps = smoothLock ? (Real)waypointElapsedMs / (Real)TheW3DFrameLengthInMsec : 1.0f;- auto perStep = [smoothLock, lockSteps](Real f) -> Real { return smoothLock ? 1.0f - powf(1.0f - f, lockSteps) : f; };- if ((smoothLock ? lockSteps > 0.0f : (stepTime != 0)) && cameraLock != INVALID_ID)+ const Real lockSteps = (Real)waypointElapsedMs / (Real)CAMERA_STEP_MSEC;+ auto perStep = [lockSteps](Real f) -> Real { return 1.0f - powf(1.0f - f, lockSteps); };+ if (lockSteps > 0.0f && cameraLock != INVALID_ID){m_doingMoveCameraOnWaypointPath = false;m_CameraArrivedAtWaypointOnPathFlag = false;@@ -2058,7 +2064,7 @@ void W3DView::update(void)// time this frame actually took, so the zoom is smooth and its speed stays the same.//static UnsignedInt prevZoomStepTime = 0;- Real zoomSteps = (Real)(nowCameraStepTime - prevZoomStepTime) / (Real)TheW3DFrameLengthInMsec;+ Real zoomSteps = (Real)(nowCameraStepTime - prevZoomStepTime) / (Real)CAMERA_STEP_MSEC;prevZoomStepTime = nowCameraStepTime;// first frame ever, or a hitch: take one plain step. A recorded picture's second draw, a// -directorrecord pane, is no time at all and takes none@@ -2068,7 +2074,7 @@ void W3DView::update(void)// The director asks for a slower settle: at CameraAdjustSpeed's third of a second every ridge// the five height samples crossed during a glide stepped the picture in and out.if (m_heightSettleSeconds > 0.0f)- cameraAdjustSpeed = 1.0f - expf(-zoomSteps * TheW3DFrameLengthInMsec / (1000.0f * m_heightSettleSeconds));+ cameraAdjustSpeed = 1.0f - expf(-zoomSteps * CAMERA_STEP_MSEC / (1000.0f * m_heightSettleSeconds));if (TheTerrainLogic && TheGlobalData && TheInGameUI && m_okToAdjustHeight && !TheGameLogic->isGamePaused()){Real desiredHeight = (m_terrainHeightUnderCamera + m_heightAboveGround);@@ -2716,7 +2722,7 @@ void W3DView::scrollBy( Coord2D *delta ){// Sample every render tick, including zero movement. Measuring only nonzero scrolls// includes all the idle time in the first move and produces a jump on every restart.- const Real scrollDtFactor = m_scrollClock.sample(Clock_Milliseconds(), TheW3DFrameLengthInMsec);+ const Real scrollDtFactor = m_scrollClock.sample(Clock_Milliseconds(), CAMERA_STEP_MSEC);if (delta)m_scrollAmount = *delta;@@ -3427,7 +3433,7 @@ void W3DView::rotateCamera(Real rotations, Int milliseconds, Real easeIn, Real em_rcInfo.trackObject = FALSE;if (milliseconds<1) milliseconds = 1;- m_rcInfo.numFrames = milliseconds/TheW3DFrameLengthInMsec;+ m_rcInfo.numFrames = milliseconds/CAMERA_STEP_MSEC;if (m_rcInfo.numFrames < 1) {m_rcInfo.numFrames = 1;}@@ -3450,13 +3456,13 @@ void W3DView::rotateCameraTowardObject(ObjectID id, Int milliseconds, Int holdMi{m_rcInfo.trackObject = TRUE;if (holdMilliseconds<1) holdMilliseconds = 0;- m_rcInfo.numHoldFrames = holdMilliseconds/TheW3DFrameLengthInMsec;+ m_rcInfo.numHoldFrames = holdMilliseconds/CAMERA_STEP_MSEC;if (m_rcInfo.numHoldFrames < 1) {m_rcInfo.numHoldFrames = 0;}if (milliseconds<1) milliseconds = 1;- m_rcInfo.numFrames = milliseconds/TheW3DFrameLengthInMsec;+ m_rcInfo.numFrames = milliseconds/CAMERA_STEP_MSEC;if (m_rcInfo.numFrames < 1) {m_rcInfo.numFrames = 1;}@@ -3480,7 +3486,7 @@ void W3DView::rotateCameraTowardPosition(const Coord3D *pLoc, Int milliseconds,m_rcInfo.trackObject = FALSE;if (milliseconds<1) milliseconds = 1;- m_rcInfo.numFrames = milliseconds/TheW3DFrameLengthInMsec;+ m_rcInfo.numFrames = milliseconds/CAMERA_STEP_MSEC;if (m_rcInfo.numFrames < 1) {m_rcInfo.numFrames = 1;}@@ -3521,7 +3527,7 @@ void W3DView::rotateCameraTowardPosition(const Coord3D *pLoc, Int milliseconds,void W3DView::zoomCamera( Real finalZoom, Int milliseconds, Real easeIn, Real easeOut ){if (milliseconds<1) milliseconds = 1;- m_zcInfo.numFrames = milliseconds/TheW3DFrameLengthInMsec;+ m_zcInfo.numFrames = milliseconds/CAMERA_STEP_MSEC;if (m_zcInfo.numFrames < 1) {m_zcInfo.numFrames = 1;}@@ -3537,7 +3543,7 @@ void W3DView::zoomCamera( Real finalZoom, Int milliseconds, Real easeIn, Real eavoid W3DView::pitchCamera( Real finalPitch, Int milliseconds, Real easeIn, Real easeOut ){if (milliseconds<1) milliseconds = 1;- m_pcInfo.numFrames = milliseconds/TheW3DFrameLengthInMsec;+ m_pcInfo.numFrames = milliseconds/CAMERA_STEP_MSEC;if (m_pcInfo.numFrames < 1) {m_pcInfo.numFrames = 1;}@@ -3560,7 +3566,7 @@ void W3DView::cameraModFinalZoom( Real finalZoom, Real easeIn, Real easeOut )Real maxHeight = (terrainHeightMax + m_maxHeightAboveGround);Real maxZoom = maxHeight / m_cameraOffset.z;- Real time = (m_rcInfo.numFrames + m_rcInfo.numHoldFrames - m_rcInfo.curFrame)*TheW3DFrameLengthInMsec;+ Real time = (m_rcInfo.numFrames + m_rcInfo.numHoldFrames - m_rcInfo.curFrame)*CAMERA_STEP_MSEC;zoomCamera( finalZoom*maxZoom, time, time*easeIn, time*easeOut );}if (m_doingMoveCameraOnWaypointPath)@@ -3767,7 +3773,7 @@ void W3DView::cameraModRollingAverage(Int framesToAverage)// ------------------------------------------------------------------------------------------------void W3DView::cameraModFinalPitch(Real finalPitch, Real easeIn, Real easeOut) {if (m_doingRotateCamera) {- Real time = (m_rcInfo.numFrames + m_rcInfo.numHoldFrames - m_rcInfo.curFrame)*TheW3DFrameLengthInMsec;+ Real time = (m_rcInfo.numFrames + m_rcInfo.numHoldFrames - m_rcInfo.curFrame)*CAMERA_STEP_MSEC;pitchCamera( finalPitch, time, time*easeIn, time*easeOut );}if (m_doingMoveCameraOnWaypointPath) {@@ -3845,7 +3851,7 @@ void W3DView::moveCameraAlongWaypointPath(Waypoint *pWay, Int milliseconds, Intm_mcwpInfo.numWaypoints = 1;if (milliseconds<1) milliseconds = 1;m_mcwpInfo.totalTimeMilliseconds = milliseconds;- m_mcwpInfo.shutter = shutter/TheW3DFrameLengthInMsec;+ m_mcwpInfo.shutter = shutter/CAMERA_STEP_MSEC;if (m_mcwpInfo.shutter<1) m_mcwpInfo.shutter = 1;m_mcwpInfo.ease.setEaseTimes(easeIn/milliseconds, easeOut/milliseconds);@@ -4319,7 +4325,7 @@ void W3DView::addScreenDistortion( const Coord3D *epicenter, const ScreenDistortconst Real dx = other.m_epicenter.x - epicenter->x;const Real dy = other.m_epicenter.y - epicenter->y;const Real sameSpot = 0.25f * other.m_info.m_radius;- if (now - other.m_startFrame <= 1 && dx * dx + dy * dy < sameSpot * sameSpot)+ if (now - other.m_startFrame <= LOGICFRAMES_PER_RETAIL_FRAME && dx * dx + dy * dy < sameSpot * sameSpot)return;}diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cppindex ba8591dc0..8b2f3f825 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp@@ -2719,7 +2719,10 @@ void WaterRenderObjClass::addVelocity( Real worldX, Real worldY,// set the velocity of this point based on the distance from the center of the// "core" point for this call//- meshPoint->velocity = meshPoint->velocity + zVelocity;+ // The one caller, WaveGuideUpdate, pushes every logic frame, so the push is an+ // acceleration: per frame squared, a quarter of the 30 Hz amount. WaterVelocity's+ // parse (per second to per frame) took one half, this is the other.+ meshPoint->velocity = meshPoint->velocity + ConvertRetailPerFrameRate( zVelocity );// this point is now "in motion"BitSet( meshPoint->status, WaterRenderObjClass::IN_MOTION );diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/MSS.h b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/MSS.hindex 03b9e65ce..70996b9aa 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/MSS.h+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/MSS.h@@ -270,7 +270,7 @@ S32 AILCALL AIL_ex_start_capture(const char *pathname);void AILCALL AIL_ex_stop_capture(void);/* The logic clock's mix, for -wav. AIL_ex_offline_mix, called before AIL_startup, opens no audio- device: the mix moves only when AIL_ex_mix_to_frame asks it to, logicFrame * rate / 30 frames from+ device: the mix moves only when AIL_ex_mix_to_frame asks it to, logicFrame * rate / 60 frames fromthe start, so a capture holds exactly the sound of the logic frames it spans however fast or slowthe run went. Nothing is heard meanwhile. AIL_ex_capture_length reports what the last finishedcapture wrote, in frames at its rate; the XAudio2 backend does not count and says zero. */diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miniaudio/miles_miniaudio.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miniaudio/miles_miniaudio.cppindex 1499bb7e5..0e9a2b952 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miniaudio/miles_miniaudio.cpp+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miniaudio/miles_miniaudio.cpp@@ -1317,12 +1317,13 @@ void AILCALL AIL_ex_offline_mix(void)g_engine.offline = true;}-// The logic runs 30 frames a second of game time (LOGICFRAMES_PER_SECOND), whatever the wall clock-// does. Each target is computed from the absolute frame, so the remainders of a rate 30 does not-// divide never add up: frames a to b always mix (b - a) * rate / 30, give or take one sample.+// The logic runs 60 frames a second of game time (LOGICFRAMES_PER_SECOND in the game's GameCommon.h,+// which this library cannot see: keep the two equal), whatever the wall clock does. Each target is+// computed from the absolute frame, so the remainders of a rate 60 does not divide never add up:+// frames a to b always mix (b - a) * rate / 60, give or take one sample.void AILCALL AIL_ex_mix_to_frame(S32 logicFrame){- const long long LOGIC_FRAMES_PER_SECOND = 30;+ const long long LOGIC_FRAMES_PER_SECOND = 60;if (!g_engine.offline || !g_engine.deviceReady) {return;}diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex f72e8cfd3..640ab5756 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -1640,8 +1640,8 @@ extern Bool Signal_isThrottled( UnsignedInt now, UnsignedInt lastSignalFrame );TEST(a_signal_waits_a_second_after_the_last_one){CHECK( Signal_isThrottled( 1000, 1000 ) );- CHECK( Signal_isThrottled( 1029, 1000 ) );- CHECK( !Signal_isThrottled( 1030, 1000 ) );+ CHECK( Signal_isThrottled( 1000 + LOGICFRAMES_PER_SECOND - 1, 1000 ) );+ CHECK( !Signal_isThrottled( 1000 + LOGICFRAMES_PER_SECOND, 1000 ) );/* a frame left over from a longer earlier match does not silence the new one */CHECK( !Signal_isThrottled( 40, 50000 ) );@@ -2072,14 +2072,14 @@ extern Bool AIAttackMove_engageWasADud( Bool victimStillAlive, Int ammoAtEngage,TEST(attack_move_charges_the_reacquire_delay_only_for_a_fight_that_never_happened){- const Int DUD = 15; /* ATTACK_MOVE_DUD_ENGAGE_FRAMES, protected on the state */+ const Int DUD = LOGICFRAMES_PER_SECOND / 2; /* ATTACK_MOVE_DUD_ENGAGE_FRAMES, protected on the state *//* stood next to it for a moment, fired nothing, it is still alive: a dud. */CHECK( AIAttackMove_engageWasADud( true, 8, 8, 1000, 1000, DUD ) );- CHECK( AIAttackMove_engageWasADud( true, 8, 8, 1000, 1014, DUD ) );+ CHECK( AIAttackMove_engageWasADud( true, 8, 8, 1000, 1000 + DUD - 1, DUD ) );/* the same non-fight, but long enough that it was a real attempt, not a bounce. */- CHECK( !AIAttackMove_engageWasADud( true, 8, 8, 1000, 1015, DUD ) );+ CHECK( !AIAttackMove_engageWasADud( true, 8, 8, 1000, 1000 + DUD, DUD ) );CHECK( !AIAttackMove_engageWasADud( true, 8, 8, 1000, 9999, DUD ) );/* it died. whatever we did worked, so go straight back to scanning. */@@ -2097,7 +2097,7 @@ TEST(attack_move_charges_the_reacquire_delay_only_for_a_fight_that_never_happenethe answer there is the conservative "dud", not whatever was in the block. */CHECK( AIAttackMove_engageWasADud( true, 0, 0, 1000, 1000, DUD ) );CHECK( AIAttackMove_engageWasADud( true, 0, 12, 1000, 1000, DUD ) );- CHECK( !AIAttackMove_engageWasADud( true, 0, 12, 1000, 1015, DUD ) );+ CHECK( !AIAttackMove_engageWasADud( true, 0, 12, 1000, 1000 + DUD, DUD ) );/* a unit with no ammunition at all on either side of a fight it could not start. */CHECK( AIAttackMove_engageWasADud( true, 0, 0, 0, 0, DUD ) );@@ -2115,15 +2115,15 @@ extern Bool AIAttackMove_shouldRetaliate( UnsignedInt lastDamageFrame, UnsignedITEST(attack_move_turns_on_whoever_is_shooting_it){- const Int WINDOW = 30; /* ATTACK_MOVE_RETALIATE_FRAMES, protected on the state */+ const Int WINDOW = LOGICFRAMES_PER_SECOND; /* ATTACK_MOVE_RETALIATE_FRAMES, protected on the state *//* hit this second, can shoot back, busy with somebody else: turn on the shooter. */CHECK( AIAttackMove_shouldRetaliate( 1000, 1000, WINDOW, false, true ) );- CHECK( AIAttackMove_shouldRetaliate( 1000, 1029, WINDOW, false, true ) );- CHECK( AIAttackMove_shouldRetaliate( 1000, 1030, WINDOW, false, true ) );+ CHECK( AIAttackMove_shouldRetaliate( 1000, 1000 + WINDOW - 1, WINDOW, false, true ) );+ CHECK( AIAttackMove_shouldRetaliate( 1000, 1000 + WINDOW, WINDOW, false, true ) );/* an old grudge is not a fight. */- CHECK( !AIAttackMove_shouldRetaliate( 1000, 1031, WINDOW, false, true ) );+ CHECK( !AIAttackMove_shouldRetaliate( 1000, 1000 + WINDOW + 1, WINDOW, false, true ) );CHECK( !AIAttackMove_shouldRetaliate( 1000, 9999, WINDOW, false, true ) );/* already fighting them, or cannot touch them: leave the current target alone,@@ -4040,9 +4040,9 @@ TEST(controlbar_seconds_round_up_and_never_reach_zero_early)TEST(controlbar_seconds_are_real_seconds_at_the_current_game_speed){/* The number on a build button is a promise about how long you will be waiting, and the logic- rate is a knob in this fork (the game speed keys move it between 5 and 200). The same 600- frames of work is 20 seconds at the nominal rate and 10 at double speed. */- const Real frames = 600.0f;+ rate is a knob in this fork (the game speed keys move it between 5 and 200). The same+ work is 20 seconds at the nominal rate and 10 at double speed. */+ const Real frames = 20.0f * LOGICFRAMES_PER_SECOND;CHECK_EQ( ControlBar_secondsFromFramesAt( frames, LOGICFRAMES_PER_SECOND ), 20 );CHECK_EQ( ControlBar_secondsFromFramesAt( frames, LOGICFRAMES_PER_SECOND * 2 ), 10 );CHECK_EQ( ControlBar_secondsFromFramesAt( frames, LOGICFRAMES_PER_SECOND / 2 ), 40 );@@ -5152,44 +5152,44 @@ TEST(selfslug_does_not_fire_on_a_cushion_nobody_has_measured)TEST(selfslug_fires_once_the_margin_eats_into_the_slack){- // run-ahead 20, slack 10% -> the threshold is 2 frames of margin- CHECK( shouldSelfSlug( 0, 20, 10 ) );- CHECK( shouldSelfSlug( 1, 20, 10 ) );- CHECK( !shouldSelfSlug( 2, 20, 10 ) );- CHECK( !shouldSelfSlug( 19, 20, 10 ) );+ // run-ahead 40, slack 10% -> the threshold is 4 frames of margin+ CHECK( shouldSelfSlug( 0, 40, 10 ) );+ CHECK( shouldSelfSlug( 3, 40, 10 ) );+ CHECK( !shouldSelfSlug( 4, 40, 10 ) );+ CHECK( !shouldSelfSlug( 39, 40, 10 ) );// a bigger run-ahead is given proportionally more margin before it worries- CHECK( shouldSelfSlug( 5, 60, 10 ) );- CHECK( !shouldSelfSlug( 6, 60, 10 ) );+ CHECK( shouldSelfSlug( 11, 120, 10 ) );+ CHECK( !shouldSelfSlug( 12, 120, 10 ) );// a run-ahead too small for the slack to round to a whole frame still gets the brake: see// selfslug_threshold_has_a_floor_the_shipped_run_ahead_cannot_undercutCHECK( shouldSelfSlug( 0, 9, 10 ) );- CHECK( shouldSelfSlug( 1, 9, 10 ) );- CHECK( !shouldSelfSlug( 2, 9, 10 ) );+ CHECK( shouldSelfSlug( SELFSLUG_MIN_THRESHOLD_FRAMES - 1, 9, 10 ) );+ CHECK( !shouldSelfSlug( SELFSLUG_MIN_THRESHOLD_FRAMES, 9, 10 ) );}TEST(selfslug_threshold_has_a_floor_the_shipped_run_ahead_cannot_undercut){- /* The run-ahead a real room plays on is a handful of frames - MIN_RUNAHEAD is four, and+ /* The run-ahead a real room plays on is a handful of frames - MIN_RUNAHEAD is eight, andcomputeRunAhead only clears that above about 240 ms round trip - so NetworkRunAheadSlack's10 % of it is worth well under a frame. A brake that waits until less than one frame of- margin is left has already lost: at 30 Hz that is under 33 ms of warning for a hitch that+ margin is left has already lost: at 60 Hz that is under 17 ms of warning for a hitch thattakes longer than that to signal, let alone correct. Hence the floor. */CHECK_EQ( selfSlugThreshold( 10, 10 ), SELFSLUG_MIN_THRESHOLD_FRAMES );// the floor holds wherever the arithmetic would land under it, including at zero slackCHECK_EQ( selfSlugThreshold( 10, 0 ), SELFSLUG_MIN_THRESHOLD_FRAMES );CHECK_EQ( selfSlugThreshold( 1, 10 ), SELFSLUG_MIN_THRESHOLD_FRAMES );- CHECK_EQ( selfSlugThreshold( 19, 10 ), SELFSLUG_MIN_THRESHOLD_FRAMES );+ CHECK_EQ( selfSlugThreshold( 39, 10 ), SELFSLUG_MIN_THRESHOLD_FRAMES );// and gets out of the way as soon as the configured slack is worth more than it- CHECK_EQ( selfSlugThreshold( 30, 10 ), 3 );- CHECK_EQ( selfSlugThreshold( 64, 10 ), 6 );+ CHECK_EQ( selfSlugThreshold( 60, 10 ), 6 );+ CHECK_EQ( selfSlugThreshold( 128, 10 ), 12 );CHECK_EQ( selfSlugThreshold( 20, 50 ), 10 );// the floor is what shouldSelfSlug actually uses - no second copy of the arithmetic- for( Int runAhead = 1; runAhead <= 64; ++runAhead )+ for( Int runAhead = 1; runAhead <= 128; ++runAhead ){Int threshold = selfSlugThreshold( runAhead, 10 );CHECK( threshold >= SELFSLUG_MIN_THRESHOLD_FRAMES );@@ -5217,7 +5217,7 @@ TEST(the_run_ahead_covers_the_trip_it_is_sized_for)for( Int ms = 0; ms <= 800; ms += 5 ){Real latency = (Real)ms / 1000.0f;- for( Int fps = 5; fps <= 30; fps += 5 )+ for( Int fps = 5; fps <= LOGICFRAMES_PER_SECOND; fps += 5 ){Int runAhead = computeRunAhead( latency, fps, 10, MIN_RUNAHEAD, MAX_FRAMES_AHEAD / 2 );@@ -5272,18 +5272,19 @@ TEST(a_stalled_frame_is_not_filed_as_round_trip_time)CHECK_NEAR( sanitizeLatencySample( -3.0f, MAX_PLAUSIBLE_LATENCY_SECONDS ), 0.0f, 0.0001f );/* and the point of all of it: what the run-ahead does with the clamped numbers. Two players at- the ceiling still cost far less than the 64 frames the raw samples bought. */+ the ceiling still cost far less than the 2.1 s the raw samples bought. */Real clamped = sanitizeLatencySample( 7.636834f, MAX_PLAUSIBLE_LATENCY_SECONDS )+ sanitizeLatencySample( 1.785224f, MAX_PLAUSIBLE_LATENCY_SECONDS );- Int runAhead = computeRunAhead( clamped, 30, 10, MIN_RUNAHEAD, MAX_FRAMES_AHEAD / 2 );- CHECK( runAhead < 64 );- CHECK( runAhead <= 29 ); // 0.97 s at 30 Hz, and only with both players at the ceiling- CHECK( runAhead <= (Int)(MAX_PLAUSIBLE_LATENCY_SECONDS * 30.0f * 1.2f) + RUNAHEAD_JITTER_FRAMES );+ const Int fps = LOGICFRAMES_PER_SECOND;+ Int runAhead = computeRunAhead( clamped, fps, 10, MIN_RUNAHEAD, MAX_FRAMES_AHEAD / 2 );+ CHECK( runAhead < ConvertRetailFrames( 64 ) );+ CHECK( runAhead <= 58 ); // 0.97 s at 60 Hz, and only with both players at the ceiling+ CHECK( runAhead <= (Int)(MAX_PLAUSIBLE_LATENCY_SECONDS * (Real)fps * 1.2f) + RUNAHEAD_JITTER_FRAMES );/* a LAN is untouched by any of this */CHECK_EQ( computeRunAhead( sanitizeLatencySample( 0.051f, MAX_PLAUSIBLE_LATENCY_SECONDS ) * 2.0f,- 30, 10, MIN_RUNAHEAD, MAX_FRAMES_AHEAD / 2 ),- computeRunAhead( 0.102f, 30, 10, MIN_RUNAHEAD, MAX_FRAMES_AHEAD / 2 ) );+ fps, 10, MIN_RUNAHEAD, MAX_FRAMES_AHEAD / 2 ),+ computeRunAhead( 0.102f, fps, 10, MIN_RUNAHEAD, MAX_FRAMES_AHEAD / 2 ) );}/* The other half of that match: nothing ever asked for the lost frame. FrameData escalates to@@ -5330,11 +5331,11 @@ TEST(the_run_ahead_carries_a_margin_the_percentage_alone_cannot_give)for( Int ms = 0; ms <= 800; ms += 5 ){Real latency = (Real)ms / 1000.0f;- Int runAhead = computeRunAhead( latency, 30, 10, MIN_RUNAHEAD, MAX_FRAMES_AHEAD / 2 );+ Int runAhead = computeRunAhead( latency, LOGICFRAMES_PER_SECOND, 10, MIN_RUNAHEAD, MAX_FRAMES_AHEAD / 2 );// at least RUNAHEAD_JITTER_FRAMES of room beyond the trip itself, at every latency- Real slackSeconds = ( (Real)runAhead / 30.0f ) - ( latency / 2.0f );- CHECK( slackSeconds >= ( (Real)RUNAHEAD_JITTER_FRAMES / 30.0f ) - 0.0005f );+ Real slackSeconds = ( (Real)runAhead / LOGICFRAMES_PER_SECONDS_REAL ) - ( latency / 2.0f );+ CHECK( slackSeconds >= ( (Real)RUNAHEAD_JITTER_FRAMES / LOGICFRAMES_PER_SECONDS_REAL ) - 0.0005f );}}@@ -5343,21 +5344,22 @@ TEST(the_run_ahead_is_shorter_than_the_shipped_floor_on_the_links_that_do_not_ne/* What the change is for. A LAN game and a good broadband game used to be given the same thirdof a second of input delay as a transatlantic one, because the floor was ten frames and theformula never beat it. */- const Int shippedFloor = 10; // EA's MIN_RUNAHEAD, 333 ms of input delay at 30 Hz+ const Int shippedFloor = ConvertRetailFrames( 10 ); // EA's MIN_RUNAHEAD, 333 ms of input delay+ const Int fps = LOGICFRAMES_PER_SECOND;- CHECK( computeRunAhead( 0.000f, 30, 10, MIN_RUNAHEAD, 64 ) < shippedFloor ); // LAN- CHECK( computeRunAhead( 0.040f, 30, 10, MIN_RUNAHEAD, 64 ) < shippedFloor ); // 40 ms- CHECK( computeRunAhead( 0.100f, 30, 10, MIN_RUNAHEAD, 64 ) < shippedFloor ); // 100 ms- CHECK( computeRunAhead( 0.160f, 30, 10, MIN_RUNAHEAD, 64 ) < shippedFloor ); // 160 ms+ CHECK( computeRunAhead( 0.000f, fps, 10, MIN_RUNAHEAD, 64 ) < shippedFloor ); // LAN+ CHECK( computeRunAhead( 0.040f, fps, 10, MIN_RUNAHEAD, 64 ) < shippedFloor ); // 40 ms+ CHECK( computeRunAhead( 0.100f, fps, 10, MIN_RUNAHEAD, 64 ) < shippedFloor ); // 100 ms+ CHECK( computeRunAhead( 0.160f, fps, 10, MIN_RUNAHEAD, 64 ) < shippedFloor ); // 160 ms// and the shortest of them is the floor itself, not something under it- CHECK_EQ( computeRunAhead( 0.000f, 30, 10, MIN_RUNAHEAD, 64 ), MIN_RUNAHEAD );+ CHECK_EQ( computeRunAhead( 0.000f, fps, 10, MIN_RUNAHEAD, 64 ), MIN_RUNAHEAD );/* And what it is not: the links that were relying on the floor get more window than the floorgave them, not less. 600 ms summed round trip is where EA's formula finally reached ten. */- CHECK( computeRunAhead( 0.300f, 30, 10, MIN_RUNAHEAD, 64 ) >= 7 );- CHECK( computeRunAhead( 0.600f, 30, 10, MIN_RUNAHEAD, 64 ) > shippedFloor );- CHECK( computeRunAhead( 1.000f, 30, 10, MIN_RUNAHEAD, 64 ) > 16 );+ CHECK( computeRunAhead( 0.300f, fps, 10, MIN_RUNAHEAD, 64 ) >= ConvertRetailFrames( 7 ) );+ CHECK( computeRunAhead( 0.600f, fps, 10, MIN_RUNAHEAD, 64 ) > shippedFloor );+ CHECK( computeRunAhead( 1.000f, fps, 10, MIN_RUNAHEAD, 64 ) > ConvertRetailFrames( 16 ) );}TEST(the_run_ahead_stays_inside_the_bounds_the_network_buffers_are_built_for)@@ -5518,10 +5520,10 @@ TEST(room_frame_rate_still_pins_to_a_genuinely_slow_player_without_oscillating)TEST(resend_window_is_measured_from_the_start_of_the_match_not_four_billion){/* ConnectionManager::sendSingleFrameToPlayer refuses to resend a frame older than- FRAMES_TO_KEEP, which is (MAX_FRAMES_AHEAD / 2) + 1 = 65 - about two seconds at 30 Hz, and+ FRAMES_TO_KEEP, which is (MAX_FRAMES_AHEAD / 2) + 1 = 129 - about two seconds at 60 Hz, andexactly the window a stalled player can be behind by, since nobody advances while the roomis waiting for them. */- const Int KEEP = 65;+ const Int KEEP = FRAMES_TO_KEEP;// the frame we are on, and everything inside the window, is resendableCHECK( !frameIsTooOldToResend( 1000, 1000, KEEP ) );@@ -7376,27 +7378,27 @@ TEST(a_strike_or_cargo_plane_wears_a_health_bar)}/** Only a slow gun wears the amber reload bar: over three seconds a shot, a clip's reload spread- over the shots in it. Frames, at 30 a second. */+ over the shots in it. Frames written at the retail 30 a second, converted to the logic rate. */TEST(only_a_slow_firing_weapon_wears_a_reload_bar){- CHECK( Drawable_weaponWearsReloadBar( 0, 300, 0, FALSE ) == TRUE ); // Nuke Cannon, 10 s- CHECK( Drawable_weaponWearsReloadBar( 0, 120, 0, FALSE ) == TRUE ); // Inferno Cannon, 4 s- CHECK( Drawable_weaponWearsReloadBar( 1, 0, 300, FALSE ) == TRUE ); // SCUD, one missile and a 10 s reload- CHECK( Drawable_weaponWearsReloadBar( 2, 6, 450, FALSE ) == TRUE ); // Scorpion's two missiles, 15 s reload- CHECK( Drawable_weaponWearsReloadBar( 0, 60, 0, FALSE ) == FALSE ); // a tank gun, 2 s- CHECK( Drawable_weaponWearsReloadBar( 0, 90, 0, FALSE ) == FALSE ); // exactly three seconds is not over three- CHECK( Drawable_weaponWearsReloadBar( 6, 6, 180, FALSE ) == FALSE ); // Rocket Buggy, six rockets, 6 s reload- CHECK( Drawable_weaponWearsReloadBar( 2, 7, 120, FALSE ) == FALSE ); // Paladin's point defence laser- CHECK( Drawable_weaponWearsReloadBar( 20, 6, 900, FALSE ) == FALSE ); // Comanche rocket pods+ CHECK( Drawable_weaponWearsReloadBar( 0, ConvertRetailFrames( 300 ), 0, FALSE ) == TRUE ); // Nuke Cannon, 10 s+ CHECK( Drawable_weaponWearsReloadBar( 0, ConvertRetailFrames( 120 ), 0, FALSE ) == TRUE ); // Inferno Cannon, 4 s+ CHECK( Drawable_weaponWearsReloadBar( 1, 0, ConvertRetailFrames( 300 ), FALSE ) == TRUE ); // SCUD, one missile and a 10 s reload+ CHECK( Drawable_weaponWearsReloadBar( 2, ConvertRetailFrames( 6 ), ConvertRetailFrames( 450 ), FALSE ) == TRUE ); // Scorpion's two missiles, 15 s reload+ CHECK( Drawable_weaponWearsReloadBar( 0, ConvertRetailFrames( 60 ), 0, FALSE ) == FALSE ); // a tank gun, 2 s+ CHECK( Drawable_weaponWearsReloadBar( 0, ConvertRetailFrames( 90 ), 0, FALSE ) == FALSE ); // exactly three seconds is not over three+ CHECK( Drawable_weaponWearsReloadBar( 6, ConvertRetailFrames( 6 ), ConvertRetailFrames( 180 ), FALSE ) == FALSE ); // Rocket Buggy, six rockets, 6 s reload+ CHECK( Drawable_weaponWearsReloadBar( 2, ConvertRetailFrames( 7 ), ConvertRetailFrames( 120 ), FALSE ) == FALSE ); // Paladin's point defence laser+ CHECK( Drawable_weaponWearsReloadBar( 20, ConvertRetailFrames( 6 ), ConvertRetailFrames( 900 ), FALSE ) == FALSE ); // Comanche rocket pods}/** The Dozer's mine-clearing scoop is one shot and a 4 s reload, slow enough for the bar on thenumbers alone, and the Dozer wore it after every mine. A DISARM weapon is not a gun. */TEST(a_mine_clearing_weapon_wears_no_reload_bar){- CHECK( Drawable_weaponWearsReloadBar( 1, 0, 120, FALSE ) == TRUE ); // the same numbers on a gun- CHECK( Drawable_weaponWearsReloadBar( 1, 0, 120, TRUE ) == FALSE ); // DozerMineDisarmingWeapon- CHECK( Drawable_weaponWearsReloadBar( 0, 30, 0, TRUE ) == FALSE ); // WorkerMineDisarmingWeapon+ CHECK( Drawable_weaponWearsReloadBar( 1, 0, ConvertRetailFrames( 120 ), FALSE ) == TRUE ); // the same numbers on a gun+ CHECK( Drawable_weaponWearsReloadBar( 1, 0, ConvertRetailFrames( 120 ), TRUE ) == FALSE ); // DozerMineDisarmingWeapon+ CHECK( Drawable_weaponWearsReloadBar( 0, ConvertRetailFrames( 30 ), 0, TRUE ) == FALSE ); // WorkerMineDisarmingWeapon}/** A launcher that shares its reload is told when it can fire next and keeps an old start frame;@@ -10333,8 +10335,8 @@ TEST(headless_run_ends_on_a_decision_or_on_the_frame_limit)// player owning nothing, which reads as eliminated, and VictoryConditions stores that as an end// frame inside the settle window - an unattended run must not take it for a result.CHECK( GameEngine_headlessRunResult( 40, 1, 0 ) == NULL );- CHECK( GameEngine_headlessRunResult( 40, 30, 0 ) == NULL );- CHECK_STR( GameEngine_headlessRunResult( 40, 31, 0 ), "decided" );+ CHECK( GameEngine_headlessRunResult( 40, LOGICFRAMES_PER_SECOND, 0 ) == NULL );+ CHECK_STR( GameEngine_headlessRunResult( 40, LOGICFRAMES_PER_SECOND + 1, 0 ), "decided" );// -maxframes is the floor under a stalemate, and the comparison is >= so a limit that was// already passed still ends the run rather than never matching@@ -11183,14 +11185,16 @@ TEST(the_ai_buys_ambulances_by_army_and_calls_in_the_hurt_nearby)CHECK( !AIAmbulance_mayBuyMore( 3, AISKILL_MEDIUM ) );CHECK( !AIAmbulance_mayBuyMore( 0, AISKILL_EASY ) );- CHECK( AIAmbulance_callsPatient( 0.3f, 100.0f, 60 ) );- CHECK( AIAmbulance_callsPatient( 0.49f, 900.0f, 60 ) );+ // two seconds since the last hit is quiet enough+ const UnsignedInt quiet = 2 * LOGICFRAMES_PER_SECOND;+ CHECK( AIAmbulance_callsPatient( 0.3f, 100.0f, quiet ) );+ CHECK( AIAmbulance_callsPatient( 0.49f, 900.0f, quiet ) );// half health or more stays in the fight- CHECK( !AIAmbulance_callsPatient( 0.5f, 100.0f, 60 ) );+ CHECK( !AIAmbulance_callsPatient( 0.5f, 100.0f, quiet ) );// too far off to walk over- CHECK( !AIAmbulance_callsPatient( 0.1f, 901.0f, 60 ) );+ CHECK( !AIAmbulance_callsPatient( 0.1f, 901.0f, quiet ) );// still being shot: it would die on the way- CHECK( !AIAmbulance_callsPatient( 0.3f, 100.0f, 59 ) );+ CHECK( !AIAmbulance_callsPatient( 0.3f, 100.0f, quiet - 1 ) );}/** AIPlayer.cpp: an Ambulance pulls back when shot at or inside a known gun's reach, and a lost one is@@ -11206,12 +11210,13 @@ TEST(the_ai_ambulance_pulls_back_when_hit_and_is_not_rebought_at_once)CHECK( !AIAmbulance_pullsBack( 1000, 0, FALSE ) );CHECK( !AIAmbulance_pullsBack( 1000, 500, FALSE ) );+ // Hard waits a minute and a half, Medium twice as long+ const UnsignedInt second = LOGICFRAMES_PER_SECOND;CHECK( !AIAmbulance_rebuyWaits( 1000, 0, AISKILL_BRUTAL ) );CHECK( AIAmbulance_rebuyWaits( 1000, 900, AISKILL_BRUTAL ) );- CHECK( !AIAmbulance_rebuyWaits( 10000, 900, AISKILL_BRUTAL ) );- // Medium waits twice as long- CHECK( AIAmbulance_rebuyWaits( 6000, 900, AISKILL_MEDIUM ) );- CHECK( !AIAmbulance_rebuyWaits( 6500, 900, AISKILL_MEDIUM ) );+ CHECK( !AIAmbulance_rebuyWaits( 900 + 90 * second, 900, AISKILL_BRUTAL ) );+ CHECK( AIAmbulance_rebuyWaits( 900 + 170 * second, 900, AISKILL_MEDIUM ) );+ CHECK( !AIAmbulance_rebuyWaits( 900 + 180 * second, 900, AISKILL_MEDIUM ) );}diff --git a/GeneralsMD/Code/Tests/test_observer_camera.inc b/GeneralsMD/Code/Tests/test_observer_camera.incindex 9994b9af8..2faa08c42 100644--- a/GeneralsMD/Code/Tests/test_observer_camera.inc+++ b/GeneralsMD/Code/Tests/test_observer_camera.inc@@ -457,7 +457,7 @@ TEST(a_match_of_two_splits_after_its_opening_only_for_a_big_moment)CHECK( !ObserverCamera_holdSideSplit( FALSE, FALSE, TRUE, 2, farApart, needed, rested - 1 ) );CHECK( !ObserverCamera_holdSideSplit( FALSE, FALSE, TRUE, 2, 900.0f, needed, rested ) );// once on it stays the panes' slide and 15 s whatever the fights do, no 8 s flicker- const UnsignedInt least = 12 + 15 + 21 + 15 * second;+ const UnsignedInt least = ConvertRetailFrames( 12U + 15U + 21U ) + 15 * second; // radar, slide and draw in 30 Hz frames, then the holdCHECK( ObserverCamera_holdSideSplit( TRUE, FALSE, FALSE, 0, 0.0f, needed, 8 * second ) );CHECK( ObserverCamera_holdSideSplit( TRUE, FALSE, FALSE, 0, 0.0f, needed, least - 1 ) );CHECK( !ObserverCamera_holdSideSplit( TRUE, FALSE, FALSE, 0, 0.0f, needed, least ) );@@ -520,7 +520,7 @@ TEST(a_split_once_on_stays_until_its_panes_are_in_and_held_six_seconds)const Real needed = 660.0f;// in through the radar's slide, the panes' and the lines' draw, and held six seconds, whatever the// second fight does: one that went off on the next scan slid a pane in and straight back out- const UnsignedInt least = 12 + 15 + 21 + 6 * LOGICFRAMES_PER_SECOND;+ const UnsignedInt least = ConvertRetailFrames( 12U + 15U + 21U ) + 6 * LOGICFRAMES_PER_SECOND; // the three in 30 Hz framesCHECK( ObserverCamera_holdSplit( TRUE, 6.0f, 0.0f, 2000.0f, needed, 15 ) );CHECK( ObserverCamera_holdSplit( TRUE, 6.0f, 0.0f, 2000.0f, needed, least - 1 ) );CHECK( !ObserverCamera_holdSplit( TRUE, 6.0f, 0.0f, 2000.0f, needed, least ) );@@ -1022,7 +1022,7 @@ TEST(the_director_skips_only_a_fight_the_scout_saw_fizzle){std::vector< DirectorMoment > timeline;timeline.push_back( scoutedFight( 500, 560, 2000.0f, 2000.0f, 2.0f ) );- timeline.push_back( scoutedFight( 500, 900, 5000.0f, 5000.0f, 8.0f ) );+ timeline.push_back( scoutedFight( 500, 500 + 8 * LOGICFRAMES_PER_SECOND, 5000.0f, 5000.0f, 8.0f ) );Coord2D place;place.x = 2050.0f;place.y = 2000.0f;@@ -1034,7 +1034,7 @@ TEST(the_director_skips_only_a_fight_the_scout_saw_fizzle)place.x = place.y = 8000.0f;CHECK( !ObserverCamera_fizzles( timeline, place, 520 ) );// a fight worth filming in the same place beats the fizzle beside it- timeline.push_back( scoutedFight( 500, 900, 2100.0f, 2000.0f, 8.0f ) );+ timeline.push_back( scoutedFight( 500, 500 + 8 * LOGICFRAMES_PER_SECOND, 2100.0f, 2000.0f, 8.0f ) );place.x = 2050.0f;place.y = 2000.0f;CHECK( !ObserverCamera_fizzles( timeline, place, 520 ) );@@ -1061,25 +1061,27 @@ TEST(the_recording_splits_before_a_known_second_fight_far_from_the_first)TEST(a_split_is_planned_only_beside_a_fight_that_outlasts_its_least_hold){std::vector< DirectorMoment > timeline;- timeline.push_back( scoutedFight( 1000, 1300, 1000.0f, 1000.0f, 8.0f ) );+ // ten seconds, past the eight a fight has to last to be worth filming+ const UnsignedInt end = 1000 + 10 * LOGICFRAMES_PER_SECOND;+ timeline.push_back( scoutedFight( 1000, end, 1000.0f, 1000.0f, 8.0f ) );timeline[ 0 ].target.x = 1400.0f;- timeline.push_back( scoutedFight( 1000, 1300, 3000.0f, 3000.0f, 2.0f ) );+ timeline.push_back( scoutedFight( 1000, end, 3000.0f, 3000.0f, 2.0f ) );Coord2D place;place.x = 1050.0f;place.y = 1000.0f;- CHECK( ObserverCamera_fightLasts( timeline, place, 1100, 1300, NULL ) );- CHECK( !ObserverCamera_fightLasts( timeline, place, 1100, 1301, NULL ) );+ CHECK( ObserverCamera_fightLasts( timeline, place, 1100, end, NULL ) );+ CHECK( !ObserverCamera_fightLasts( timeline, place, 1100, end + 1, NULL ) );// near where it ended up as well as where it beganplace.x = 1600.0f;- CHECK( ObserverCamera_fightLasts( timeline, place, 1100, 1300, NULL ) );+ CHECK( ObserverCamera_fightLasts( timeline, place, 1100, end, NULL ) );// but not for a second pane while the first shows where it began: that is the first pane's fightCoord2D first;first.x = first.y = 1000.0f;- CHECK( !ObserverCamera_fightLasts( timeline, place, 1100, 1300, &first ) );+ CHECK( !ObserverCamera_fightLasts( timeline, place, 1100, end, &first ) );first.x = first.y = 3000.0f;- CHECK( ObserverCamera_fightLasts( timeline, place, 1100, 1300, &first ) );+ CHECK( ObserverCamera_fightLasts( timeline, place, 1100, end, &first ) );// one about to begin counts; a fizzle never does- CHECK( ObserverCamera_fightLasts( timeline, place, 1000 - 4 * LOGICFRAMES_PER_SECOND, 1300, NULL ) );+ CHECK( ObserverCamera_fightLasts( timeline, place, 1000 - 4 * LOGICFRAMES_PER_SECOND, end, NULL ) );place.x = place.y = 3000.0f;CHECK( !ObserverCamera_fightLasts( timeline, place, 1100, 1200, NULL ) );}@@ -1277,12 +1279,14 @@ TEST(the_pane_lines_grow_out_then_their_band_fades_in_and_a_light_runs_along_theCHECK( now >= last );last = now;}- // the light runs out over 45 frames once every five seconds, and is off in between+ // the light runs out over 45 frames at 30 Hz once every five seconds, and is off in between+ const Real K = (Real)LOGICFRAMES_PER_RETAIL_FRAME;+ const Real period = (Real)( 5 * LOGICFRAMES_PER_SECOND );CHECK_NEAR( ObserverCamera_shimmerAt( 0 ), 0.0f, 0.0001f );- CHECK( ObserverCamera_shimmerAt( 22 ) > 0.3f && ObserverCamera_shimmerAt( 22 ) < 0.7f );- CHECK( ObserverCamera_shimmerAt( 45 ) < 0.0f );- CHECK( ObserverCamera_shimmerAt( 149 ) < 0.0f );- CHECK_NEAR( ObserverCamera_shimmerAt( 150 ), 0.0f, 0.0001f );+ CHECK( ObserverCamera_shimmerAt( 22 * K ) > 0.3f && ObserverCamera_shimmerAt( 22 * K ) < 0.7f );+ CHECK( ObserverCamera_shimmerAt( 45 * K ) < 0.0f );+ CHECK( ObserverCamera_shimmerAt( period - 1 ) < 0.0f );+ CHECK_NEAR( ObserverCamera_shimmerAt( period ), 0.0f, 0.0001f );// the band is five golds wideCHECK_EQ( ObserverCamera_paneBandWidth( 720 ), 30 );}@@ -1372,26 +1376,28 @@ TEST(the_last_defeat_banner_of_a_decided_match_stays_up)TEST(a_defeated_card_flashes_is_struck_and_closes_one_card_at_a_time){+ // the card's times are 30 Hz frame counts: flash 12, strike from 6 over 12, struck 36, collapse 18+ const UnsignedInt K = LOGICFRAMES_PER_RETAIL_FRAME;Real flash = 0.0f, struck = 0.0f, collapse = 0.0f;const UnsignedInt first = ObserverCamera_collapseFrom( 100, 0 );- CHECK_EQ( first, 136u );+ CHECK_EQ( first, 100 + 36 * K );ObserverCamera_cardExit( 100, 100, first, &flash, &struck, &collapse );CHECK_NEAR( flash, 0.0f, 0.0001f );- ObserverCamera_cardExit( 104, 100, first, &flash, &struck, &collapse );+ ObserverCamera_cardExit( 100 + 4 * K, 100, first, &flash, &struck, &collapse );CHECK_NEAR( flash, 1.0f, 0.0001f );CHECK_NEAR( struck, 0.0f, 0.0001f );- ObserverCamera_cardExit( 112, 100, first, &flash, &struck, &collapse );+ ObserverCamera_cardExit( 100 + 12 * K, 100, first, &flash, &struck, &collapse );CHECK_NEAR( flash, 0.0f, 0.0001f );CHECK( struck > 0.0f && struck < 1.0f );- ObserverCamera_cardExit( 136, 100, first, &flash, &struck, &collapse );+ ObserverCamera_cardExit( 100 + 36 * K, 100, first, &flash, &struck, &collapse );CHECK_NEAR( struck, 1.0f, 0.0001f );CHECK_NEAR( collapse, 0.0f, 0.0001f );- ObserverCamera_cardExit( 145, 100, first, &flash, &struck, &collapse );+ ObserverCamera_cardExit( 100 + 45 * K, 100, first, &flash, &struck, &collapse );CHECK_NEAR( collapse, 0.5f, 0.0001f );- ObserverCamera_cardExit( 154, 100, first, &flash, &struck, &collapse );+ ObserverCamera_cardExit( 100 + 54 * K, 100, first, &flash, &struck, &collapse );CHECK_NEAR( collapse, 1.0f, 0.0001f );// a second player beaten on the same frame closes once the first card has gone, a later one on its ownconst UnsignedInt second = ObserverCamera_collapseFrom( 100, first );- CHECK_EQ( second, 154u );- CHECK_EQ( ObserverCamera_collapseFrom( 400, second ), 436u );+ CHECK_EQ( second, 100 + 54 * K );+ CHECK_EQ( ObserverCamera_collapseFrom( 400, second ), 400 + 36 * K );}diff --git a/GeneralsMD/Code/Tests/test_water_grid.cpp b/GeneralsMD/Code/Tests/test_water_grid.cppindex a4115b111..387da8b80 100644--- a/GeneralsMD/Code/Tests/test_water_grid.cpp+++ b/GeneralsMD/Code/Tests/test_water_grid.cpp@@ -33,6 +33,14 @@* is the engine's loop, which needs the W3D device to run (read in the source, T1); the* client passes' own reads of the grid, which now see it a step earlier in a pass, and draw nothing* the simulation reads.+ *+ * Since logic runs at 60 frames a second the step is no longer the original's bits: its gravity is+ * per 60 Hz frame squared, its damping the square root of EA's and its at-rest velocity half of it,+ * so the original's 30 Hz line can no longer be the golden. The catch-up tests hold every schedule+ * to the moved code's own one-pass-per-frame line, computed in the same run, which is the claim T1c+ * makes. EA_LOOP_GOLDEN pins that line against a change to the step, and is that line as a run of+ * this binary prints it ("moved, passes of 1: ..."): regenerate it from a run whenever the step's+ * constants or the frame rate change on purpose.*/#include "test_harness.h"@@ -51,8 +59,10 @@namespace {-// EA's loop, run by the original code: water_grid_oracle's "original passes of 1" line.-const char *const EA_LOOP_GOLDEN = "frames 240 all 96559c89 last a7eea444 moving 183";+// The moved code at 60 Hz under one pass per logic frame, as test_water_grid prints it. The 30 Hz+// original's line (water_grid_oracle, "original passes of 1") was "frames 240 all 96559c89 last a7eea444+// moving 183". This is the "moved, passes of 1" line taken from a run of the 60 Hz step.+const char *const EA_LOOP_GOLDEN = "frames 240 all 5c9f1917 last ac3c3fa9 moving 240";void boot(){@@ -91,21 +101,29 @@ unsigned nextFirstFrame()return 1 + 1000 * run++; // the step's last-frame gate is a static: no run starts where one ended}+// The moved code under EA's loop, one pass per logic frame: what every other schedule has to print.+std::string eaLoopLine( void )+{+ MovedEngine engine;+ return water_grid::run( engine, std::vector<int>( 1, 1 ), nextFirstFrame() );+}+} // namespaceTEST(water_grid_scenario_uses_the_engines_gravity){+ // the scenario's gravity is the oracle's, per 30 Hz frame squared; the engine's is per 60 Hz frame+ // squared, a quarter of it, and exactly so: halving 1/30 only moves the exponentboot();const Real engine = ConvertAccelerationInSecsToFrames( -64.0f );- const float scenario = water_grid::shippedGravity();- CHECK( memcmp( &engine, &scenario, sizeof( engine ) ) == 0 ); // the oracle used the scenario's+ const float scenario = ConvertRetailPerFrameSquared( water_grid::shippedGravity() );+ CHECK( memcmp( &engine, &scenario, sizeof( engine ) ) == 0 );}TEST(water_grid_steps_as_eas_loop_did_under_eas_loop){boot();- MovedEngine engine;- const std::string line = water_grid::run( engine, std::vector<int>( 1, 1 ), nextFirstFrame() );+ const std::string line = eaLoopLine();printf( " moved, passes of 1: %s\n", line.c_str() );CHECK_STR( line.c_str(), EA_LOOP_GOLDEN );}@@ -113,13 +131,14 @@ TEST(water_grid_steps_as_eas_loop_did_under_eas_loop)TEST(water_grid_k_logic_frames_in_one_pass_equal_k_single_passes){boot();+ const std::string eaLoop = eaLoopLine();const std::vector<std::vector<int> > schedules = water_grid::schedules();for (size_t s = 0; s < schedules.size(); ++s){MovedEngine engine;const std::string line = water_grid::run( engine, schedules[s], nextFirstFrame() );printf( " moved, passes of %s: %s\n", water_grid::describe( schedules[s] ).c_str(), line.c_str() );- CHECK_STR( line.c_str(), EA_LOOP_GOLDEN );+ CHECK_STR( line.c_str(), eaLoop.c_str() );}}@@ -128,17 +147,18 @@ TEST(water_grid_a_second_call_for_the_same_frame_does_not_step_again)/* A frozen or held logic frame calls GameLogic::update again without advancing the frame; thegate, EA's own, keeps it to one step, as one client pass per unchanged frame did. */boot();+ const std::string eaLoop = eaLoopLine();MovedEngine engine( 3 );const std::string line = water_grid::run( engine, std::vector<int>( 1, 2 ), nextFirstFrame() );- CHECK_STR( line.c_str(), EA_LOOP_GOLDEN );+ CHECK_STR( line.c_str(), eaLoop.c_str() );}TEST(water_grid_unstepped_is_not_the_golden){- // So the golden means something: with no step at all the result is different...+ // So the reference means something: with no step at all the result is differentboot();+ const std::string eaLoop = eaLoopLine();struct Unstepped : MovedEngine { void logicFrameTop( UnsignedInt ) {} } still;const std::string line = water_grid::run( still, std::vector<int>( 1, 1 ), nextFirstFrame() );- CHECK( line != EA_LOOP_GOLDEN );- // ...and the golden's grid was in motion on 183 of the 240 frames: pushed, then settled.+ CHECK( line != eaLoop );}diff --git a/GeneralsMD/Code/Tests/water_grid_scenario.h b/GeneralsMD/Code/Tests/water_grid_scenario.hindex 3d600ad88..354732985 100644--- a/GeneralsMD/Code/Tests/water_grid_scenario.h+++ b/GeneralsMD/Code/Tests/water_grid_scenario.h@@ -33,8 +33,9 @@* push, the frame counter moves on. It returns one line: the hash of every point's bits after every* frame, the last frame's own hash, and how many of the frames ended with the mesh in motion.*- * The gravity is the shipped one: GameData.ini's Gravity = -64.0, converted per logic frame as- * INI::parseAccelerationReal does (test_water_grid checks that against the engine's own conversion).+ * The gravity is the shipped one: GameData.ini's Gravity = -64.0, converted per 30 Hz frame, the rate+ * the original ran at. The engine's INI::parseAccelerationReal now converts per 60 Hz frame, a quarter+ * of this, which test_water_grid checks.*/#ifndef WATER_GRID_SCENARIO_H#define WATER_GRID_SCENARIO_Hdiff --git a/GeneralsMD/Code/Tools/asan-check.sh b/GeneralsMD/Code/Tools/asan-check.shindex d7497381d..f61e6379f 100755--- a/GeneralsMD/Code/Tools/asan-check.sh+++ b/GeneralsMD/Code/Tools/asan-check.sh@@ -17,10 +17,10 @@## asan-check.sh: the whole game under AddressSanitizer, in a ZH_SANITIZE=address build# (docs/porting/sanitizers.md). Two runs, and each must exit 0 with no ASan report:-# mobstress headless, the mobstress scenario on Alpine Assault, seed 1, --mob-frames (default 12000): the+# mobstress headless, the mobstress scenario on Alpine Assault, seed 1, --mob-frames (default 24000): the# simulation, the allocator and its locks, the job threads# skirmish -offscreen and -noaudio at 1920x1080, the seed-1234 generated skirmish, --skirmish-frames-# (default 1800): the same plus the GPU device (Metal on macOS, Vulkan on Linux) and the+# (default 3600): the same plus the GPU device (Metal on macOS, Vulkan on Linux) and the# system frameworks under it# Each run ends with the game's reset after the match, where the use-after-free ZH_SANITIZE first found was.#@@ -43,8 +43,8 @@ set -uGENERALS=""DATA="${ZH_DATA_DIR:-}"-MOB_FRAMES=12000-SKIRMISH_FRAMES=1800+MOB_FRAMES=24000 # logic frames, 60 a second+SKIRMISH_FRAMES=3600KEEP=0while [ $# -gt 0 ]; docase "$1" indiff --git a/GeneralsMD/Code/Tools/cheat_check.py b/GeneralsMD/Code/Tools/cheat_check.pyindex 6ab23a4ad..001684998 100644--- a/GeneralsMD/Code/Tools/cheat_check.py+++ b/GeneralsMD/Code/Tools/cheat_check.py@@ -27,8 +27,8 @@ MAP = r"Maps\Alpine Assault\Alpine Assault.map"PORT = 8787LOAD_TIMEOUT_SECONDS = 180CONNECT_ATTEMPTS = 120-MATCH_SETTLE_FRAME = 60-LOGIC_FRAMES_PER_SECOND = 30+LOGIC_FRAMES_PER_SECOND = 60+MATCH_SETTLE_FRAME = 2 * LOGIC_FRAMES_PER_SECONDCHEAT_BITS = {"power": 1 << 5,diff --git a/GeneralsMD/Code/Tools/linux-packages-check.sh b/GeneralsMD/Code/Tools/linux-packages-check.shindex 57fb3e09a..6140ef089 100755--- a/GeneralsMD/Code/Tools/linux-packages-check.sh+++ b/GeneralsMD/Code/Tools/linux-packages-check.sh@@ -139,7 +139,7 @@ RUNNER-e APPIMAGE_EXTRACT_AND_RUN=1 -e TMPDIR="$T/tmp" -e LIBGL_ALWAYS_SOFTWARE=1 -w "$T" "$name" sh -c \"Xvfb :77 -screen 0 1024x768x24 -nolisten tcp > '$T/xvfb.log' 2>&1 & sleep 2; DISPLAY=:77 timeout 900 '$run' -root '$FARM' \-quickstart -noshellmap -multiInstance -noaudio -xres 800 -yres 600 -randommap 0 2 -autoskirmish 2 -aidiff brutal \- -seed 0 -observer -maxframes 90 -screenshot 80 > '$T/draw.out' 2> '$T/draw.err'; echo \$? > '$T/draw.status'"+ -seed 0 -observer -maxframes 180 -screenshot 160 > '$T/draw.out' 2> '$T/draw.err'; echo \$? > '$T/draw.status'"shot="$(find "$T/draw-user" -name 'sshot*.bmp' | head -1)"local colours=0[ -n "$shot" ] && colours="$(od -An -v -tu1 -j 54 "$shot" | tr -s ' ' '\n' | sort -u | wc -l)"diff --git a/GeneralsMD/Code/Tools/lod-first-run-check.sh b/GeneralsMD/Code/Tools/lod-first-run-check.shindex f9f3fdc15..312c66b49 100755--- a/GeneralsMD/Code/Tools/lod-first-run-check.sh+++ b/GeneralsMD/Code/Tools/lod-first-run-check.sh@@ -112,7 +112,7 @@ run() { # run <name> <user data folder> <switches...>: a fresh farm each time (tfarm "$WORK/root"mkdir -p "$user"( cd "$WORK/root" && ZH_USER_DATA_DIR="$user" "$GENERALS" -headless -root "$WORK/root" -overlay "$WORK/overlay" \- -quickstart -noshellmap -multiInstance -noFPSLimit -maxframes 30 -logPrefix "$TAG$name" \+ -quickstart -noshellmap -multiInstance -noFPSLimit -maxframes 60 -logPrefix "$TAG$name" \-randommap 0 2 128 -autoskirmish 2 -aidiff brutal -seed 0 -observer "$@" \> "$WORK/$name.out" 2> "$WORK/$name.err" )RUN_STATUS=$?diff --git a/GeneralsMD/Code/Tools/net-check.sh b/GeneralsMD/Code/Tools/net-check.shindex 65a8465f8..4e58847c3 100755--- a/GeneralsMD/Code/Tools/net-check.sh+++ b/GeneralsMD/Code/Tools/net-check.sh@@ -65,7 +65,7 @@# as the app ships it, the user data in the work folder, the install hashed before and after# (Tools/install-guard.sh), exit 99 if it changed or could not be checked.#-# Usage: net-check.sh --generals <path> [--peer1 <path>] [--data <dir>] [--seed 3] [--frames 3000]+# Usage: net-check.sh --generals <path> [--peer1 <path>] [--data <dir>] [--seed 3] [--frames 6000]# [--netai 2] [--map "Maps\Golden Oasis\Golden Oasis.map"] [--control] [--corrupt-at <frame>] [--legacy-replay]# [--overshoot-control] [--keep]# --peer1 the executable for the second copy (default: --generals); an x86_64 build runs under@@ -115,7 +115,7 @@ GENERALS=""PEER1=""DATA="${ZH_DATA_DIR:-}"SEED=3-FRAMES=3000+FRAMES=6000 # logic frames, 60 a second: 100 s of game timeNETAI=2MAP='Maps\Golden Oasis\Golden Oasis.map'CONTROL=0@@ -127,7 +127,7 @@ PEER=""HOSTS_ARG=""REPLAY_OUT=""PLAY=""-LIVE_TIMEOUT="${NET_CHECK_LIVE_TIMEOUT:-900}" # seconds for the match; 3000 frames took 105 s+LIVE_TIMEOUT="${NET_CHECK_LIVE_TIMEOUT:-900}" # seconds for the match; 3000 frames at 30 a second took 105 swhile [ $# -gt 0 ]; docase "$1" in--generals) GENERALS="$2"; shift 2;;diff --git a/GeneralsMD/Code/Tools/net_check.py b/GeneralsMD/Code/Tools/net_check.pyindex b2f9265b5..ce8b261e8 100644--- a/GeneralsMD/Code/Tools/net_check.py+++ b/GeneralsMD/Code/Tools/net_check.py@@ -6,7 +6,7 @@ travels through the network, so these become orders both machines execute on a sWorld commands (spawn, move) run on one machine only, which is what --prove uses to force adesync and show the check is looking.- python net_check.py # two copies, 3000 frames+ python net_check.py # two copies, 6000 frames (100 s)python net_check.py --copies 3 --teams 2python net_check.py --each "-latAvg 120 -latNoise 60 -packetloss 5"python net_check.py --slot-args 1 "-drawdelay 100" # one slow renderer@@ -35,7 +35,8 @@ MATCH_START_TIMEOUT_SECONDS = 180.0PRESS_INTERVAL_SECONDS = 0.5PRESSES = ("KEY_A CTRL", "KEY_X", "KEY_S", "KEY_X")MISMATCH_LINE = "CRC Mismatch"-PROVE_FRAME = 300+LOGIC_FPS = 60 # LOGICFRAMES_PER_SECOND: frame numbers here and in the logs count these+PROVE_FRAME = 10 * LOGIC_FPSPROVE_SPAWN = "spawn 0 AmericaVehicleHumvee 2 %s"QUIT_GRACE_SECONDS = 10.0@@ -46,12 +47,13 @@ def parse_arguments() -> argparse.Namespace:parser.add_argument("--teams", type=int, default=0, help="-teams for the slot list; 0 is free for all")parser.add_argument("--map", default="Maps\\Golden Oasis\\Golden Oasis.map")parser.add_argument("--seed", type=int, default=3)- parser.add_argument("--frames", type=int, default=3000, help="stop once every copy has passed this frame")+ parser.add_argument("--frames", type=int, default=100 * LOGIC_FPS,+ help="stop once every copy has passed this logic frame (%d a second)" % LOGIC_FPS)parser.add_argument("--each", default="", help="extra switches for every copy")parser.add_argument("--slot-args", nargs=2, action="append", default=[], metavar=("SLOT", "SWITCHES"),help="extra switches for one copy, repeatable")parser.add_argument("--tag", default="net", help="log prefix; copy n logs to Run/<tag><n>_DebugLogFile.txt")- parser.add_argument("--prove", action="store_true", help="spawn on copy 0 alone at frame 300")+ parser.add_argument("--prove", action="store_true", help="spawn on copy 0 alone at frame %d" % PROVE_FRAME)parser.add_argument("--prove-at", default="2192 3537", help="map position for --prove")parser.add_argument("--keys", default=",".join(PRESSES),help="the presses, comma separated, each as the control socket's key command takes it")diff --git a/GeneralsMD/Code/Tools/overlay-crc-check.sh b/GeneralsMD/Code/Tools/overlay-crc-check.shindex c1775042c..046f57cdc 100755--- a/GeneralsMD/Code/Tools/overlay-crc-check.sh+++ b/GeneralsMD/Code/Tools/overlay-crc-check.sh@@ -46,14 +46,14 @@# The install is listed (sizes, times, BLAKE2) before this script writes anything and again at the end,# and must be unchanged (Tools/install-guard.sh).#-# Usage: overlay-crc-check.sh --generals <path> [--data <dir>] [--maxframes 600] [--keep]+# Usage: overlay-crc-check.sh --generals <path> [--data <dir>] [--maxframes 1200] [--keep]# Exit status: 0 when W and P agree and the control differs; 1 otherwise; 77 without game data.set -uGENERALS=""DATA="${ZH_DATA_DIR:-}"-MAXFRAMES=600+MAXFRAMES=1200 # logic frames, 60 a secondKEEP=0while [ $# -gt 0 ]; docase "$1" indiff --git a/GeneralsMD/Code/Tools/record-dx11-shaders.ps1 b/GeneralsMD/Code/Tools/record-dx11-shaders.ps1index 0c71b0093..ea463845d 100644--- a/GeneralsMD/Code/Tools/record-dx11-shaders.ps1+++ b/GeneralsMD/Code/Tools/record-dx11-shaders.ps1@@ -56,7 +56,8 @@ param([int[]] $Seeds = @(0, 1, 2),# named skirmish maps played the same way, for the lighting the random maps do not have (night, snow)[string[]] $Maps = @(),- [int] $Frames = 2400,+ # logic frames, 60 a second+ [int] $Frames = 4800,[int] $TimeoutMinutes = 30,# leave the shipped file in the farm: a check that a run with it compiles nothing it holds[switch] $KeepShipped,diff --git a/GeneralsMD/Code/Tools/replay-check.sh b/GeneralsMD/Code/Tools/replay-check.shindex fbfaaf782..9439ea62e 100755--- a/GeneralsMD/Code/Tools/replay-check.sh+++ b/GeneralsMD/Code/Tools/replay-check.sh@@ -40,7 +40,7 @@# the executable, as on Windows, each under its own -logPrefix, and are removed once read.## Usage: replay-check.sh --generals <path> | --app <.app> | --package <folder> [--data <dir>] [--seeds "0 1"] [--players 2]-# [--aidiff brutal] [--maxframes 12000] [--cells <n>] [--extra "<args>"]+# [--aidiff brutal] [--maxframes 24000] [--cells <n>] [--extra "<args>"]# [--control] [--extended] [--keep] [--log-lines <regex>]# --data a folder holding zerohour/ (with the base game in zerohour/ZH_Generals, as the# install has it); default $ZH_DATA_DIR@@ -55,7 +55,7 @@# seed (SD= in its header) has its last digit changed, so the playback plays a# different world from the same commands, and every seed must be reported DIVERGED# --extended the wider backstop, not in ctest: seeds 2 to 5, each at 2 and at 4 players (eight-# matches), at --maxframes (default 12000). --seeds and --players are ignored+# matches), at --maxframes (default 24000). --seeds and --players are ignored# --keep leave the temporary folder and the logs, and say where# --log-lines <re> print each live run's log lines matching the extended regex, as " log: <line>",# before the log is removed (Tests/run_locomotor_check.sh reads port defect 33's check)@@ -99,7 +99,7 @@ DATA="${ZH_DATA_DIR:-}"SEEDS="0 1"PLAYERS=2AIDIFF=brutal-MAXFRAMES=12000+MAXFRAMES=24000 # logic frames, 60 a second: 6 min 40 s of game timeCELLS=""EXTRA=""CONTROL=0diff --git a/GeneralsMD/Code/Tools/root-readonly-check.sh b/GeneralsMD/Code/Tools/root-readonly-check.shindex 974961f42..35bf6c4f7 100755--- a/GeneralsMD/Code/Tools/root-readonly-check.sh+++ b/GeneralsMD/Code/Tools/root-readonly-check.sh@@ -32,14 +32,14 @@## RULE 9 still holds while this runs: the root is a farm, never the install.#-# Usage: root-readonly-check.sh --generals <path> [--data <dir>] [--maxframes 600] [--keep]+# Usage: root-readonly-check.sh --generals <path> [--data <dir>] [--maxframes 1200] [--keep]# Exit status: 0 on a pass; 1 otherwise; 77 without game data.set -uGENERALS=""DATA="${ZH_DATA_DIR:-}"-MAXFRAMES=600+MAXFRAMES=1200 # logic frames, 60 a secondKEEP=0while [ $# -gt 0 ]; docase "$1" indiff --git a/Tools/Balance/duel.py b/Tools/Balance/duel.pyindex db3528ec2..f9724a989 100644--- a/Tools/Balance/duel.py+++ b/Tools/Balance/duel.py@@ -17,7 +17,7 @@ import sysimport siegeBUDGET = 4800-MAX_FRAMES = 3000+MAX_FRAMES = 3000 * siege.LOGIC_FPS // siege.SCENARIO_FPS # logic frames; the rest are scenario framesTALLY_FRAME = 2950SPAWN_FRAME = 30ATTACK_FRAME = 60diff --git a/Tools/Balance/siege.py b/Tools/Balance/siege.pyindex 124e22d99..0001d6f90 100644--- a/Tools/Balance/siege.py+++ b/Tools/Balance/siege.py@@ -25,7 +25,11 @@ SCENARIO_DIR = RUN_DIR / "Scenarios"OUT_DIR = RUN_DIR / "Balance"PARALLEL_RUNS = 5TIMEOUT_SECONDS = 600-MAX_FRAMES = 3600+# A scenario file counts 30 Hz frames (ScenarioDrill_tick converts them) and its tally lines print+# them back, but -maxframes counts the logic's own frames, 60 a second+SCENARIO_FPS = 30+LOGIC_FPS = 60+MAX_FRAMES = 3600 * LOGIC_FPS // SCENARIO_FPSTALLY_FRAME = 3550SPAWN_FRAME = 30ENTER_FRAME = 40diff --git a/Tools/Balance/unitmatrix.py b/Tools/Balance/unitmatrix.pyindex b5d897168..270a17e38 100644--- a/Tools/Balance/unitmatrix.py+++ b/Tools/Balance/unitmatrix.py@@ -42,7 +42,7 @@ sys.path.insert(0, str(GENERALS / "Code" / "Tools"))import bigfile # noqa: E402import gametext # noqa: E402-LOGIC_FPS = 30+LOGIC_FPS = 60 # LOGICFRAMES_PER_SECONDSORTIE_MSEC = 20000SORTIE_FRAMES = SORTIE_MSEC * LOGIC_FPS / 1000.0 # AI_SORTIE_FRAMESOVERKILL_TOLERANCE = 0.0001@@ -719,7 +719,7 @@ def selfcheck():assert kill_frames(150.0, clip._replace(opening=15.0)) == 135.0assert kill_frames(10.0, gun) == 60.0assert kill_frames(480.0, Shots(0.0, 30.0, 0, 0.0, 0.0)) == CANNOT_KILL- assert msec_to_frames(2000) == 60 and msec_to_frames(100) == 3 and msec_to_frames(1) == 1+ assert msec_to_frames(2000) == 120 and msec_to_frames(100) == 6 and msec_to_frames(1) == 1assert real("75.0.") == 75.0 and real("-2e1x") == -20.0 and percent("50%") == 0.5assert is_fork_owned("Data/INI/BalanceReforged.ini") and is_fork_owned("Window/Menus/MainMenu.wnd")assert not is_fork_owned("Data/INI/Object/Reforged.ini") and not is_fork_owned("Data/INI/Weapon.ini")diff --git a/Tools/Chroma/effect-preview.ps1 b/Tools/Chroma/effect-preview.ps1index 58a0b4a5c..2ba54da73 100644--- a/Tools/Chroma/effect-preview.ps1+++ b/Tools/Chroma/effect-preview.ps1@@ -1,8 +1,9 @@# Plays the superweapon effects on the hardware so they can be judged without# waiting for a real launch, and tuned without waiting for a build. The maths is-# compiled C# that mirrors ChromaKeyboard.cpp's chromaEffectColor, stepped on the-# same thirty-a-second frame count the game uses, so what this shows is what the-# game shows. The first version was plain PowerShell and managed about eight+# compiled C# that mirrors ChromaKeyboard.cpp's chromaEffectColor, stepped thirty+# times a second. The game's logic runs at sixty, but chromaFlicker steps its noise+# on retail 30 Hz frames (LOGICFRAMES_PER_RETAIL_FRAME), so what this shows is what+# the game shows. The first version was plain PowerShell and managed about eight# frames a second, which made every effect look like it stuttered.## The constants below are a second copy of the ones in ChromaKeyboard.cpp anddiff --git a/ai-batch.ps1 b/ai-batch.ps1index 6265257d7..db176c34a 100644--- a/ai-batch.ps1+++ b/ai-batch.ps1@@ -39,8 +39,9 @@ param(# 4v4. Free-for-all spreads the fighting over the whole map; teams put every unit on one of two# fronts, which is the load a player actually complains about[int] $Teams = 0,- # a match that has not been decided by here is a result in itself: the AI cannot finish- [int] $MaxFrames = 30000,+ # a match that has not been decided by here is a result in itself: the AI cannot finish.+ # Logic frames, 60 a second: 60000 is 16.7 minutes of game time+ [int] $MaxFrames = 60000,# names this batch's logs, so two batches can be compared afterwards[string] $Tag = "ai",# map sizes to spread the batch over, in playable cells a side. Ignored when -Map is given.@@ -80,6 +81,8 @@ param()$ErrorActionPreference = "Stop"+# LOGICFRAMES_PER_SECOND: every frame number the log writes counts these+$LogicFps = 60$env:ZH_UNATTENDED = "1" # every game this starts is unattended: no box may wait on a person (EarlyCommandLine.h)# PowerShell variable names are case-insensitive, so this must not be called $exe: it would be the@@ -308,7 +311,7 @@ Write-Host ("decided {0}/{1} frame-limited {2} failed {3}" -fif ($decided.Count -gt 0) {Write-Host ("average length {0:n0} frames ({1:n1} min of game time)" -f($decided | Measure-Object Frames -Average).Average,- (($decided | Measure-Object Frames -Average).Average / 30 / 60))+ (($decided | Measure-Object Frames -Average).Average / $LogicFps / 60))}# The player list carries the civilian and neutral sides before the playable ones, so the indices@@ -413,7 +416,7 @@ if ($pfRows.Count -gt 0) {$worstWedge = ($pfRows | ForEach-Object { $_.Pf.WedgeWorst } | Measure-Object -Maximum).MaximumWrite-Host ("wedged unit-frames per 1000 logic frames: {0:n1} | worst single wedge {1} frames ({2:n1}s) | escapes {3} repaths {4} dithers {5} per match" -f(1000.0 * $totWedge / $totFrames),- $worstWedge, ($worstWedge / 30.0),+ $worstWedge, ($worstWedge / $LogicFps),(& $avg { param($p) $p.Escapes }),(& $avg { param($p) $p.Repaths }),(& $avg { param($p) $p.Dithers }))diff --git a/dx11-check.ps1 b/dx11-check.ps1index c1b97c44b..466a04c05 100644--- a/dx11-check.ps1+++ b/dx11-check.ps1@@ -60,15 +60,16 @@ $shots = "$env:USERPROFILE\Documents\Command and Conquer Generals Zero Hour Data$tmp = Join-Path $env:TEMP "dx11check"if (-not (Test-Path $tmp)) { $null = New-Item -ItemType Directory $tmp }+# f is a logic frame at 60 a second$cases = @(- @{map='Flash Effect'; x='1200'; y='945'; f=400},- @{map='Flash Effect'; x='1816'; y='1861'; f=1200},- @{map='Flash Effect'; x='1378'; y='1384'; f=2400},- @{map='ForgottenForestZH'; x='1620'; y='1470'; f=600},- @{map='ForgottenForestZH'; x='1543'; y='1636'; f=1800},- @{map='Golden Oasis'; x='2643'; y='3580'; f=900},- @{map='Alpine Assault'; x='760'; y='920'; f=700},- @{map='Killing Fields'; x='1024'; y='1024'; f=1500}+ @{map='Flash Effect'; x='1200'; y='945'; f=800},+ @{map='Flash Effect'; x='1816'; y='1861'; f=2400},+ @{map='Flash Effect'; x='1378'; y='1384'; f=4800},+ @{map='ForgottenForestZH'; x='1620'; y='1470'; f=1200},+ @{map='ForgottenForestZH'; x='1543'; y='1636'; f=3600},+ @{map='Golden Oasis'; x='2643'; y='3580'; f=1800},+ @{map='Alpine Assault'; x='760'; y='920'; f=1400},+ @{map='Killing Fields'; x='1024'; y='1024'; f=3000})# -msaa 0 for tree-check.ps1's reason: a multisampled back buffer cannot be read back, the capture@@ -81,7 +82,7 @@ function Shoot($c, $tag, $switches) {Get-ChildItem "$shots\sshot*.bmp" -ErrorAction SilentlyContinue | Remove-Item -Force$arguments = @('-win','-xres','1280','-yres','720','-quickstart','-noshellmap','-multiInstance','-msaa','0','-dx11post','off','-map',"`"Maps\$($c.map)\$($c.map).map`"",'-autoskirmish','4','-aidiff','easy',- '-seed','5','-maxframes',($c.f+80),'-screenshot',$c.f,'-camera',$c.x,$c.y,+ '-seed','5','-maxframes',($c.f+160),'-screenshot',$c.f,'-camera',$c.x,$c.y,'-logPrefix',"dx11chk_$tag`_",'-turbo') + $switches + $Extra$process = Start-Process (Join-Path $run $Exe) -ArgumentList $arguments -WorkingDirectory $run -PassThrutry {diff --git a/replay-check.ps1 b/replay-check.ps1index 660cfbdb0..bafffaee2 100644--- a/replay-check.ps1+++ b/replay-check.ps1@@ -21,7 +21,7 @@.EXAMPLE.\replay-check.ps1- .\replay-check.ps1 -Seeds 0,1,2,3 -MaxFrames 6000+ .\replay-check.ps1 -Seeds 0,1,2,3 -MaxFrames 12000Four seeds instead of two, shorter matches. Each seed costs two runs.#>param(@@ -31,9 +31,10 @@ param([int] $Players = 2,# easy | medium | brutal[string] $Difficulty = "brutal",- # how long each match runs. Long enough to build and fight; a divergence in movement code needs- # units on the move, and the first thousand frames are two workers walking to a supply dock- [int] $MaxFrames = 12000,+ # how long each match runs, in logic frames at 60 a second (24000 is 6 min 40 s of game time).+ # Long enough to build and fight; a divergence in movement code needs units on the move, and the+ # first two thousand frames are two workers walking to a supply dock+ [int] $MaxFrames = 24000,# playable cells a side of the generated map; 0 lets the generator size it for the player count.# 128 used to be the default, below even the generator's small size for two players: seed 1 put# the two starts 124 units apart, neither AI could build, and the match stayed idlediff --git a/shadow-check.ps1 b/shadow-check.ps1index 2bab38f0f..96303fb94 100644--- a/shadow-check.ps1+++ b/shadow-check.ps1@@ -16,22 +16,23 @@ $out = Join-Path $env:TEMP "shadowcheck"if (-not (Test-Path $out)) { $null = New-Item -ItemType Directory $out }# The same views tree-check uses, for the same reason: they are the ones with something in them.+# f is a logic frame at 60 a second.$cases = @(- @{map='Flash Effect'; x='1200'; y='945'; f=400},- @{map='Flash Effect'; x='1816'; y='1861'; f=1200},- @{map='Flash Effect'; x='1378'; y='1384'; f=2400},- @{map='ForgottenForestZH'; x='1620'; y='1470'; f=600},- @{map='ForgottenForestZH'; x='1543'; y='1636'; f=1800},- @{map='Golden Oasis'; x='2643'; y='3580'; f=900},- @{map='Alpine Assault'; x='760'; y='920'; f=700},- @{map='Killing Fields'; x='1024'; y='1024'; f=1500}+ @{map='Flash Effect'; x='1200'; y='945'; f=800},+ @{map='Flash Effect'; x='1816'; y='1861'; f=2400},+ @{map='Flash Effect'; x='1378'; y='1384'; f=4800},+ @{map='ForgottenForestZH'; x='1620'; y='1470'; f=1200},+ @{map='ForgottenForestZH'; x='1543'; y='1636'; f=3600},+ @{map='Golden Oasis'; x='2643'; y='3580'; f=1800},+ @{map='Alpine Assault'; x='760'; y='920'; f=1400},+ @{map='Killing Fields'; x='1024'; y='1024'; f=3000})function Shoot($case, $tag, $extra) {Get-ChildItem "$shots\sshot*.bmp" -ErrorAction SilentlyContinue | Remove-Item -Force$arguments = @('-win','-xres','1280','-yres','720','-quickstart','-noshellmap','-multiInstance','-msaa','0','-dx11post','off','-map',"`"Maps\$($case.map)\$($case.map).map`"",- '-autoskirmish','4','-aidiff','easy','-seed','5','-maxframes',($case.f+80),+ '-autoskirmish','4','-aidiff','easy','-seed','5','-maxframes',($case.f+160),'-screenshot',$case.f,'-camera',$case.x,$case.y,'-logPrefix',"shd_$tag`_",'-turbo')if ($extra) { $arguments += $extra }$process = Start-Process (Join-Path $run "generals.exe") -ArgumentList $arguments `diff --git a/tree-check.ps1 b/tree-check.ps1index c7c8b0f0a..9286f05a3 100644--- a/tree-check.ps1+++ b/tree-check.ps1@@ -19,8 +19,14 @@# view's measured noise plus about 0.75 of a point, rounded up: a real drawing change still trips it,# the run-to-run shimmer does not. Re-measure and move them if the reference machine changes.#+# Frames in $cases are logic frames at 60 a second. A reference build from before the logic went+# to 60 ticks a second counts 30, so pass -BaseFps 30 with one and its shots are taken at the same+# game time, which is the same picture.+## Exit code is the number of views over the limit.-param([double]$Limit = 0, [string[]]$Extra = @(), [string[]]$NewEnv = @(), [string]$Base = 'generals_base.exe', [string]$Candidate = 'generals.exe')+param([double]$Limit = 0, [string[]]$Extra = @(), [string[]]$NewEnv = @(), [string]$Base = 'generals_base.exe', [string]$Candidate = 'generals.exe',+ [int]$BaseFps = 60)+$LogicFps = 60 # LOGICFRAMES_PER_SECOND of the candidate build$env:ZH_UNATTENDED = "1" # every game this starts is unattended: no box may wait on a person (EarlyCommandLine.h)Add-Type -AssemblyName System.Drawing@@ -42,14 +48,14 @@ if (Select-String -Path $baseExe -Pattern '-turbo' -SimpleMatch -Quiet) { $paceelse { "$Base predates -turbo: both builds run paced, about 90 seconds a view" }$cases = @(- @{map='Flash Effect'; x='1200'; y='945'; f=400; lim=1.6}, # noise 0.77- @{map='Flash Effect'; x='1816'; y='1861'; f=1200; lim=2.3}, # noise 1.54- @{map='Flash Effect'; x='1378'; y='1384'; f=2400; lim=2.0}, # noise 1.21- @{map='ForgottenForestZH'; x='1620'; y='1470'; f=600; lim=1.2}, # noise 0.37- @{map='ForgottenForestZH'; x='1543'; y='1636'; f=1800; lim=1.1}, # noise 0.35- @{map='Golden Oasis'; x='2643'; y='3580'; f=900; lim=2.4}, # noise 1.64- @{map='Alpine Assault'; x='760'; y='920'; f=700; lim=2.7}, # noise 1.93- @{map='Killing Fields'; x='1024'; y='1024'; f=1500; lim=1.7} # noise 0.94+ @{map='Flash Effect'; x='1200'; y='945'; f=800; lim=1.6}, # noise 0.77+ @{map='Flash Effect'; x='1816'; y='1861'; f=2400; lim=2.3}, # noise 1.54+ @{map='Flash Effect'; x='1378'; y='1384'; f=4800; lim=2.0}, # noise 1.21+ @{map='ForgottenForestZH'; x='1620'; y='1470'; f=1200; lim=1.2}, # noise 0.37+ @{map='ForgottenForestZH'; x='1543'; y='1636'; f=3600; lim=1.1}, # noise 0.35+ @{map='Golden Oasis'; x='2643'; y='3580'; f=1800; lim=2.4}, # noise 1.64+ @{map='Alpine Assault'; x='760'; y='920'; f=1400; lim=2.7}, # noise 1.93+ @{map='Killing Fields'; x='1024'; y='1024'; f=3000; lim=1.7} # noise 0.94)# -msaa 0 is not a preference, it is what makes the picture a picture of the game. The screenshot@@ -60,18 +66,22 @@ $cases = @(## The shot folder is emptied before every launch for the neighbouring reason: this takes the newest# .bmp in it afterwards, and a run that writes none - the reference build needs more than the wait-# below to reach frame 2400 - would otherwise hand back the previous case's picture and compare two+# below to reach frame 4800 - would otherwise hand back the previous case's picture and compare two# different frames. Empty, that is a stated failure instead of a number.## -dx11post off for the same kind of reason: the post chain runs by default since v1.0.0, and a# reference build from before that draws without it, so the bloom would be the difference counted.function Shoot($exe, $c, $tag) {+ # the case's frame at this build's logic rate, and 160 frames (2.7 s) past it to quit on+ $fps = if ($exe -eq $Base) { $BaseFps } else { $LogicFps }+ $at = [int]($c.f * $fps / $LogicFps)+ $end = $at + [int](160 * $fps / $LogicFps)Get-ChildItem "$shots\sshot*.bmp" -ErrorAction SilentlyContinue | Remove-Item -Force# -showHudOverlay is for a reference exe from before 8b859d61, whose corner readout was off in Release# without it; this build draws the info strip by ShowNetBox alone and skips the switch as unknown.$args = @('-win','-xres','1280','-yres','720','-quickstart','-noshellmap','-multiInstance','-showHudOverlay','-msaa','0','-dx11post','off','-map',"`"Maps\$($c.map)\$($c.map).map`"",'-autoskirmish','4','-aidiff','easy','-seed','5',- '-maxframes',($c.f+80),'-screenshot',$c.f,'-camera',$c.x,$c.y,'-logPrefix',"chk_$tag`_") + $pace + $Extra+ '-maxframes',$end,'-screenshot',$at,'-camera',$c.x,$c.y,'-logPrefix',"chk_$tag`_") + $pace + $Extra$environment = if ($exe -eq $Candidate) { $NewEnv } else { @() }try {foreach ($e in $environment) { $n, $v = $e -split '=', 2; Set-Item "env:$n" $v }