mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 02:18:26 +00:00
make sure StartReplayFromFile uses delay and fix hud time for customframes
This commit is contained in:
parent
6bcb16b361
commit
fc8b78ae43
@ -23,7 +23,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#define _shavit_included
|
#define _shavit_included
|
||||||
|
|
||||||
#define SHAVIT_VERSION "3.0.4"
|
#define SHAVIT_VERSION "3.0.5"
|
||||||
#define STYLE_LIMIT 256
|
#define STYLE_LIMIT 256
|
||||||
#define MAX_ZONES 64
|
#define MAX_ZONES 64
|
||||||
#define MAX_STAGES 51 // 😐 kind of arbitrary but also some space between this and MAX_ZONES
|
#define MAX_STAGES 51 // 😐 kind of arbitrary but also some space between this and MAX_ZONES
|
||||||
@ -2035,7 +2035,7 @@ native bool Shavit_IsReplayEntity(int ent);
|
|||||||
* @param ignorelimit Ignore cvar limit for dynamic bots.
|
* @param ignorelimit Ignore cvar limit for dynamic bots.
|
||||||
* @return Replay entity. 0 is returned if couldn't be created.
|
* @return Replay entity. 0 is returned if couldn't be created.
|
||||||
*/
|
*/
|
||||||
native int Shavit_StartReplay(int style, int track, float delay, int client, int bot, int type, bool ignorelimit = false);
|
native int Shavit_StartReplay(int style, int track, float delay, int client, int bot, int type, bool ignorelimit);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a replay with a given set of frames.
|
* Starts a replay with a given set of frames.
|
||||||
@ -2052,7 +2052,7 @@ native int Shavit_StartReplay(int style, int track, float delay, int client, int
|
|||||||
* @param size sizeof(frame_cache_t). Used to throw errors at you if you don't recompile plugins.
|
* @param size sizeof(frame_cache_t). Used to throw errors at you if you don't recompile plugins.
|
||||||
* @return Replay entity. 0 is returned if couldn't be created.
|
* @return Replay entity. 0 is returned if couldn't be created.
|
||||||
*/
|
*/
|
||||||
native int Shavit_StartReplayFromFrameCache(int style, int track, float delay, int client, int bot, int type, bool ignorelimit = false, any[] cache, int size = sizeof(frame_cache_t));
|
native int Shavit_StartReplayFromFrameCache(int style, int track, float delay, int client, int bot, int type, bool ignorelimit, any[] cache, int size = sizeof(frame_cache_t));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a replay from a replay file.
|
* Starts a replay from a replay file.
|
||||||
@ -2068,7 +2068,7 @@ native int Shavit_StartReplayFromFrameCache(int style, int track, float delay, i
|
|||||||
* @param path File path to replay
|
* @param path File path to replay
|
||||||
* @return Replay entity. 0 is returned if couldn't be created.
|
* @return Replay entity. 0 is returned if couldn't be created.
|
||||||
*/
|
*/
|
||||||
native int Shavit_StartReplayFromFile(int style, int track, float delay, int client, int bot, int type, bool ignorelimit = false, const char[] path);
|
native int Shavit_StartReplayFromFile(int style, int track, float delay, int client, int bot, int type, bool ignorelimit, const char[] path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reloads a specific replay into the replay bot cache.
|
* Reloads a specific replay into the replay bot cache.
|
||||||
|
|||||||
@ -1493,7 +1493,7 @@ void UpdateMainHUD(int client)
|
|||||||
if(iReplayStyle != -1)
|
if(iReplayStyle != -1)
|
||||||
{
|
{
|
||||||
fReplayTime = Shavit_GetReplayTime(target);
|
fReplayTime = Shavit_GetReplayTime(target);
|
||||||
fReplayLength = Shavit_GetReplayLength(iReplayStyle, iReplayTrack);
|
fReplayLength = Shavit_GetReplayCacheLength(target);
|
||||||
|
|
||||||
fSpeedHUD /= Shavit_GetStyleSettingFloat(iReplayStyle, "speed") * Shavit_GetStyleSettingFloat(iReplayStyle, "timescale");
|
fSpeedHUD /= Shavit_GetStyleSettingFloat(iReplayStyle, "speed") * Shavit_GetStyleSettingFloat(iReplayStyle, "timescale");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,6 +110,7 @@ enum struct bot_info_t
|
|||||||
bool bCustomFrames;
|
bool bCustomFrames;
|
||||||
bool bIgnoreLimit;
|
bool bIgnoreLimit;
|
||||||
bool b2x;
|
bool b2x;
|
||||||
|
float fDelay;
|
||||||
frame_cache_t aCache;
|
frame_cache_t aCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -884,6 +885,7 @@ void StartReplay(bot_info_t info, int track, int style, int starter, float delay
|
|||||||
info.iStarterSerial = (starter > 0) ? GetClientSerial(starter) : 0;
|
info.iStarterSerial = (starter > 0) ? GetClientSerial(starter) : 0;
|
||||||
info.iTick = 0;
|
info.iTick = 0;
|
||||||
//info.iLoopingConfig
|
//info.iLoopingConfig
|
||||||
|
info.fDelay = delay;
|
||||||
info.hTimer = CreateTimer((delay / 2.0), Timer_StartReplay, info.iEnt, TIMER_FLAG_NO_MAPCHANGE);
|
info.hTimer = CreateTimer((delay / 2.0), Timer_StartReplay, info.iEnt, TIMER_FLAG_NO_MAPCHANGE);
|
||||||
|
|
||||||
if (!info.bCustomFrames)
|
if (!info.bCustomFrames)
|
||||||
@ -971,6 +973,7 @@ int CreateReplayEntity(int track, int style, float delay, int client, int bot, i
|
|||||||
info.iStarterSerial = (client > 0) ? GetClientSerial(client) : 0;
|
info.iStarterSerial = (client > 0) ? GetClientSerial(client) : 0;
|
||||||
info.bIgnoreLimit = ignorelimit;
|
info.bIgnoreLimit = ignorelimit;
|
||||||
info.iLoopingConfig = loopingConfig;
|
info.iLoopingConfig = loopingConfig;
|
||||||
|
info.fDelay = delay;
|
||||||
SetupIfCustomFrames(info, cache);
|
SetupIfCustomFrames(info, cache);
|
||||||
bot = CreateReplayBot(info);
|
bot = CreateReplayBot(info);
|
||||||
|
|
||||||
@ -1762,7 +1765,7 @@ int CreateReplayBot(bot_info_t info)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartReplay(gA_BotInfo[bot], gA_BotInfo[bot].iTrack, gA_BotInfo[bot].iStyle, GetClientFromSerial(info.iStarterSerial), gCV_ReplayDelay.FloatValue);
|
StartReplay(gA_BotInfo[bot], gA_BotInfo[bot].iTrack, gA_BotInfo[bot].iStyle, GetClientFromSerial(info.iStarterSerial), info.fDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
gA_BotInfo[GetClientFromSerial(info.iStarterSerial)].iEnt = bot;
|
gA_BotInfo[GetClientFromSerial(info.iStarterSerial)].iEnt = bot;
|
||||||
@ -2860,7 +2863,7 @@ Action ReplayOnPlayerRunCmd(bot_info_t info, int &buttons, int &impulse, float v
|
|||||||
if(info.iTick >= (info.aCache.iFrameCount + info.aCache.iPostFrames + info.aCache.iPreFrames))
|
if(info.iTick >= (info.aCache.iFrameCount + info.aCache.iPostFrames + info.aCache.iPreFrames))
|
||||||
{
|
{
|
||||||
info.iStatus = Replay_End;
|
info.iStatus = Replay_End;
|
||||||
info.hTimer = CreateTimer((gCV_ReplayDelay.FloatValue / 2.0), Timer_EndReplay, info.iEnt, TIMER_FLAG_NO_MAPCHANGE);
|
info.hTimer = CreateTimer((info.fDelay / 2.0), Timer_EndReplay, info.iEnt, TIMER_FLAG_NO_MAPCHANGE);
|
||||||
|
|
||||||
return Plugin_Changed;
|
return Plugin_Changed;
|
||||||
}
|
}
|
||||||
@ -3884,6 +3887,7 @@ void ClearBotInfo(bot_info_t info)
|
|||||||
info.bCustomFrames = false;
|
info.bCustomFrames = false;
|
||||||
//info.bIgnoreLimit
|
//info.bIgnoreLimit
|
||||||
info.b2x = false;
|
info.b2x = false;
|
||||||
|
info.fDelay = 0.0;
|
||||||
|
|
||||||
ClearFrameCache(info.aCache);
|
ClearFrameCache(info.aCache);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user