set snapshot.fplayer_speedmod when checkpointing a bot so players don't get stuck

This commit is contained in:
rtldg 2022-01-19 09:15:51 +00:00
parent 7a11acf2e6
commit 117d2d277c

View File

@ -1497,14 +1497,15 @@ void SaveCheckpointCache(int target, cp_cache_t cpcache, bool actually_a_checkpo
snapshot.fServerTime = GetEngineTime();
snapshot.iSHSWCombination = -1;
snapshot.iTimerTrack = Shavit_GetReplayBotTrack(target);
snapshot.fTimescale = Shavit_GetStyleSettingFloat(snapshot.bsStyle, "timescale");
snapshot.fTimescale = 1.0;
snapshot.fplayer_speedmod = 1.0;
float ticks = (Shavit_GetReplayBotCurrentFrame(target) - Shavit_GetReplayCachePreFrames(target)) * snapshot.fTimescale;
float ticks = float(Shavit_GetReplayBotCurrentFrame(target) - Shavit_GetReplayCachePreFrames(target));
float fraction = FloatFraction(ticks);
snapshot.iFullTicks = RoundFloat(ticks-fraction);
snapshot.iFractionalTicks = RoundFloat(fraction * 10000.0);
cpcache.fSpeed = snapshot.fTimescale * Shavit_GetStyleSettingFloat(snapshot.bsStyle, "speed");
cpcache.fSpeed = Shavit_GetStyleSettingFloat(snapshot.bsStyle, "timescale") * Shavit_GetStyleSettingFloat(snapshot.bsStyle, "speed");
ScaleVector(cpcache.fVelocity, 1 / cpcache.fSpeed);
cpcache.fGravity = Shavit_GetStyleSettingFloat(target, "gravity");
}