mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
hopefully fix checkpoint timescale stuff
This commit is contained in:
parent
85609db2e6
commit
5c772b06e3
@ -228,6 +228,7 @@ enum struct timer_snapshot_t
|
||||
float fDistanceOffset[2];
|
||||
float fAvgVelocity;
|
||||
float fMaxVelocity;
|
||||
float fTimescale;
|
||||
}
|
||||
|
||||
enum struct cp_cache_t
|
||||
|
||||
@ -1675,23 +1675,7 @@ public int Native_FinishMap(Handle handler, int numParams)
|
||||
}
|
||||
|
||||
timer_snapshot_t snapshot;
|
||||
snapshot.bTimerEnabled = gA_Timers[client].bEnabled;
|
||||
snapshot.bClientPaused = gA_Timers[client].bPaused;
|
||||
snapshot.iJumps = gA_Timers[client].iJumps;
|
||||
snapshot.bsStyle = gA_Timers[client].iStyle;
|
||||
snapshot.iStrafes = gA_Timers[client].iStrafes;
|
||||
snapshot.iTotalMeasures = gA_Timers[client].iTotalMeasures;
|
||||
snapshot.iGoodGains = gA_Timers[client].iGoodGains;
|
||||
snapshot.fServerTime = GetEngineTime();
|
||||
snapshot.fCurrentTime = gA_Timers[client].fTimer;
|
||||
snapshot.iSHSWCombination = gA_Timers[client].iSHSWCombination;
|
||||
snapshot.iTimerTrack = gA_Timers[client].iTrack;
|
||||
snapshot.iMeasuredJumps = gA_Timers[client].iMeasuredJumps;
|
||||
snapshot.iPerfectJumps = gA_Timers[client].iPerfectJumps;
|
||||
snapshot.fTimeOffset = gA_Timers[client].fTimeOffset;
|
||||
snapshot.fDistanceOffset = gA_Timers[client].fDistanceOffset;
|
||||
snapshot.fAvgVelocity = gA_Timers[client].fAvgVelocity;
|
||||
snapshot.fMaxVelocity = gA_Timers[client].fMaxVelocity;
|
||||
BuildSnapshot(client, snapshot);
|
||||
|
||||
Action result = Plugin_Continue;
|
||||
Call_StartForward(gH_Forwards_FinishPre);
|
||||
@ -2037,23 +2021,7 @@ public int Native_SaveSnapshot(Handle handler, int numParams)
|
||||
int client = GetNativeCell(1);
|
||||
|
||||
timer_snapshot_t snapshot;
|
||||
snapshot.bTimerEnabled = gA_Timers[client].bEnabled;
|
||||
snapshot.bClientPaused = gA_Timers[client].bPaused;
|
||||
snapshot.iJumps = gA_Timers[client].iJumps;
|
||||
snapshot.bsStyle = gA_Timers[client].iStyle;
|
||||
snapshot.iStrafes = gA_Timers[client].iStrafes;
|
||||
snapshot.iTotalMeasures = gA_Timers[client].iTotalMeasures;
|
||||
snapshot.iGoodGains = gA_Timers[client].iGoodGains;
|
||||
snapshot.fServerTime = GetEngineTime();
|
||||
snapshot.fCurrentTime = gA_Timers[client].fTimer;
|
||||
snapshot.iSHSWCombination = gA_Timers[client].iSHSWCombination;
|
||||
snapshot.iTimerTrack = gA_Timers[client].iTrack;
|
||||
snapshot.iMeasuredJumps = gA_Timers[client].iMeasuredJumps;
|
||||
snapshot.iPerfectJumps = gA_Timers[client].iPerfectJumps;
|
||||
snapshot.fTimeOffset = gA_Timers[client].fTimeOffset;
|
||||
snapshot.fDistanceOffset = gA_Timers[client].fDistanceOffset;
|
||||
snapshot.fAvgVelocity = gA_Timers[client].fAvgVelocity;
|
||||
snapshot.fMaxVelocity = gA_Timers[client].fMaxVelocity;
|
||||
BuildSnapshot(client, snapshot);
|
||||
return SetNativeArray(2, snapshot, sizeof(timer_snapshot_t));
|
||||
}
|
||||
|
||||
@ -2064,6 +2032,7 @@ public int Native_LoadSnapshot(Handle handler, int numParams)
|
||||
return ThrowNativeError(200, "timer_snapshot_t does not match latest(got %i expected %i). Please update your includes and recompile your plugins",
|
||||
GetNativeCell(3), sizeof(timer_snapshot_t));
|
||||
}
|
||||
|
||||
int client = GetNativeCell(1);
|
||||
|
||||
timer_snapshot_t snapshot;
|
||||
@ -2102,6 +2071,7 @@ public int Native_LoadSnapshot(Handle handler, int numParams)
|
||||
gA_Timers[client].fDistanceOffset = snapshot.fDistanceOffset;
|
||||
gA_Timers[client].fAvgVelocity = snapshot.fAvgVelocity;
|
||||
gA_Timers[client].fMaxVelocity = snapshot.fMaxVelocity;
|
||||
gA_Timers[client].fTimescale = snapshot.fTimescale;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -3494,21 +3464,7 @@ public MRESReturn DHook_ProcessMovementPost(Handle hParams)
|
||||
gA_Timers[client].iZoneIncrement++;
|
||||
|
||||
timer_snapshot_t snapshot;
|
||||
snapshot.bTimerEnabled = gA_Timers[client].bEnabled;
|
||||
snapshot.bClientPaused = gA_Timers[client].bPaused;
|
||||
snapshot.iJumps = gA_Timers[client].iJumps;
|
||||
snapshot.bsStyle = gA_Timers[client].iStyle;
|
||||
snapshot.iStrafes = gA_Timers[client].iStrafes;
|
||||
snapshot.iTotalMeasures = gA_Timers[client].iTotalMeasures;
|
||||
snapshot.iGoodGains = gA_Timers[client].iGoodGains;
|
||||
snapshot.fServerTime = GetEngineTime();
|
||||
snapshot.fCurrentTime = gA_Timers[client].fTimer;
|
||||
snapshot.iSHSWCombination = gA_Timers[client].iSHSWCombination;
|
||||
snapshot.iTimerTrack = gA_Timers[client].iTrack;
|
||||
snapshot.fTimeOffset = gA_Timers[client].fTimeOffset;
|
||||
snapshot.fDistanceOffset = gA_Timers[client].fDistanceOffset;
|
||||
snapshot.fAvgVelocity = gA_Timers[client].fAvgVelocity;
|
||||
snapshot.fMaxVelocity = gA_Timers[client].fMaxVelocity;
|
||||
BuildSnapshot(client, snapshot);
|
||||
|
||||
Call_StartForward(gH_Forwards_OnTimerIncrement);
|
||||
Call_PushCell(client);
|
||||
@ -3599,6 +3555,28 @@ bool TREnumTrigger(int entity, int client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void BuildSnapshot(int client, timer_snapshot_t snapshot)
|
||||
{
|
||||
snapshot.bTimerEnabled = gA_Timers[client].bEnabled;
|
||||
snapshot.bClientPaused = gA_Timers[client].bPaused;
|
||||
snapshot.iJumps = gA_Timers[client].iJumps;
|
||||
snapshot.bsStyle = gA_Timers[client].iStyle;
|
||||
snapshot.iStrafes = gA_Timers[client].iStrafes;
|
||||
snapshot.iTotalMeasures = gA_Timers[client].iTotalMeasures;
|
||||
snapshot.iGoodGains = gA_Timers[client].iGoodGains;
|
||||
snapshot.fServerTime = GetEngineTime();
|
||||
snapshot.fCurrentTime = gA_Timers[client].fTimer;
|
||||
snapshot.iSHSWCombination = gA_Timers[client].iSHSWCombination;
|
||||
snapshot.iTimerTrack = gA_Timers[client].iTrack;
|
||||
snapshot.iMeasuredJumps = gA_Timers[client].iMeasuredJumps;
|
||||
snapshot.iPerfectJumps = gA_Timers[client].iPerfectJumps;
|
||||
snapshot.fTimeOffset = gA_Timers[client].fTimeOffset;
|
||||
snapshot.fDistanceOffset = gA_Timers[client].fDistanceOffset;
|
||||
snapshot.fAvgVelocity = gA_Timers[client].fAvgVelocity;
|
||||
snapshot.fMaxVelocity = gA_Timers[client].fMaxVelocity;
|
||||
snapshot.fTimescale = gA_Timers[client].fTimescale;
|
||||
}
|
||||
|
||||
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
|
||||
{
|
||||
if(IsFakeClient(client))
|
||||
|
||||
@ -2380,6 +2380,9 @@ void SaveCheckpointCache(int target, cp_cache_t cpcache, bool isPersistentData)
|
||||
snapshot.fServerTime = GetEngineTime();
|
||||
snapshot.iSHSWCombination = -1;
|
||||
snapshot.iTimerTrack = Shavit_GetReplayBotTrack(target);
|
||||
snapshot.fTimescale = Shavit_GetStyleSettingFloat(snapshot.bsStyle, "timescale");
|
||||
cpcache.fSpeed = snapshot.fTimescale;
|
||||
ScaleVector(cpcache.fVelocity, 1 / cpcache.fSpeed);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user