mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 18:38:26 +00:00
Added the ability to save CPs from the replay bot. (#525)
This isn't perfect due to limitations, but it motsly works well! * Surf-HSW styles won't save their WASD settings. * Stamina will not be valid for scroll styles. * Strafes/sync won't be saved from the bot.
This commit is contained in:
parent
34a4f9e4bb
commit
2ac410926a
@ -1461,12 +1461,9 @@ public Action Command_Save(int client, int args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else if((bSaved = SaveCheckpoint(client, (CP_MAX - 1))))
|
||||||
{
|
{
|
||||||
if((bSaved = SaveCheckpoint(client, (CP_MAX - 1))))
|
gI_CheckpointsCache[client][iCurrentCheckpoint] = CP_MAX;
|
||||||
{
|
|
||||||
gI_CheckpointsCache[client][iCurrentCheckpoint] = CP_MAX;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bSaved)
|
if(bSaved)
|
||||||
@ -1676,7 +1673,7 @@ bool SaveCheckpoint(int client, int index)
|
|||||||
int iObserverMode = GetEntProp(client, Prop_Send, "m_iObserverMode");
|
int iObserverMode = GetEntProp(client, Prop_Send, "m_iObserverMode");
|
||||||
int iObserverTarget = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
|
int iObserverTarget = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
|
||||||
|
|
||||||
if(IsClientObserver(client) && !IsFakeClient(iObserverTarget) && IsValidClient(iObserverTarget) && iObserverMode >= 3 && iObserverMode <= 5)
|
if(IsClientObserver(client) && IsValidClient(iObserverTarget) && iObserverMode >= 3 && iObserverMode <= 5)
|
||||||
{
|
{
|
||||||
target = iObserverTarget;
|
target = iObserverTarget;
|
||||||
}
|
}
|
||||||
@ -1710,9 +1707,32 @@ bool SaveCheckpoint(int client, int index)
|
|||||||
cpcache[iCPFlags] = GetEntityFlags(target);
|
cpcache[iCPFlags] = GetEntityFlags(target);
|
||||||
|
|
||||||
any snapshot[TIMERSNAPSHOT_SIZE];
|
any snapshot[TIMERSNAPSHOT_SIZE];
|
||||||
Shavit_SaveSnapshot(target, snapshot);
|
|
||||||
CopyArray(snapshot, cpcache[aCPSnapshot], TIMERSNAPSHOT_SIZE);
|
|
||||||
|
|
||||||
|
if(IsFakeClient(target))
|
||||||
|
{
|
||||||
|
// unfortunately replay bots don't have a snapshot, so we can generate a fake one
|
||||||
|
int style = Shavit_GetReplayBotStyle(target);
|
||||||
|
int track = Shavit_GetReplayBotTrack(target);
|
||||||
|
|
||||||
|
snapshot[bTimerEnabled] = true;
|
||||||
|
snapshot[fCurrentTime] = Shavit_GetReplayTime(style, track);
|
||||||
|
snapshot[bClientPaused] = false;
|
||||||
|
snapshot[bsStyle] = style;
|
||||||
|
snapshot[iJumps] = 0;
|
||||||
|
snapshot[iStrafes] = 0;
|
||||||
|
snapshot[iTotalMeasures] = 0;
|
||||||
|
snapshot[iGoodGains] = 0;
|
||||||
|
snapshot[fServerTime] = GetEngineTime();
|
||||||
|
snapshot[iSHSWCombination] = -1;
|
||||||
|
snapshot[iTimerTrack] = track;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Shavit_SaveSnapshot(target, snapshot);
|
||||||
|
}
|
||||||
|
|
||||||
|
CopyArray(snapshot, cpcache[aCPSnapshot], TIMERSNAPSHOT_SIZE);
|
||||||
SetCheckpoint(client, index, cpcache);
|
SetCheckpoint(client, index, cpcache);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user