From 5a6935f14acb631e16fc642e8154c5bb68cc72ce Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 1 Jul 2023 13:39:01 +0400 Subject: [PATCH] try delaying starting tas playback --- BunnymodXT/modules/HwDLL.cpp | 6 +++++- BunnymodXT/modules/HwDLL.hpp | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/BunnymodXT/modules/HwDLL.cpp b/BunnymodXT/modules/HwDLL.cpp index ab9e778a..d55b064b 100644 --- a/BunnymodXT/modules/HwDLL.cpp +++ b/BunnymodXT/modules/HwDLL.cpp @@ -4938,7 +4938,7 @@ extern "C" DLLEXPORT void bxt_tas_load_script_from_string(const char *script) return; } - hw.StartTASPlayback(); + hw.startRunningInputOnNextCbufExecute = true; } void HwDLL::SetTASEditorMode(TASEditorMode mode) @@ -6297,6 +6297,10 @@ HOOK_DEF_0(HwDLL, void, __cdecl, Cbuf_Execute) if (*state != 5 && *state != 4) executing = false; + if (startRunningInputOnNextCbufExecute) { + StartTASPlayback(); + } + insideCbuf_Execute = true; ORIG_Cbuf_Execute(); // executing might change inside if we had some kind of load command in the buffer. diff --git a/BunnymodXT/modules/HwDLL.hpp b/BunnymodXT/modules/HwDLL.hpp index 1bc055c7..eb06edf8 100644 --- a/BunnymodXT/modules/HwDLL.hpp +++ b/BunnymodXT/modules/HwDLL.hpp @@ -624,6 +624,7 @@ class HwDLL : public IHookableNameFilterOrdered std::vector TargetYawOverrides; float sensitivityToRestore = 0; public: + bool startRunningInputOnNextCbufExecute = false; bool ButtonsPresent; HLTAS::StrafeButtons Buttons; HLStrafe::CurrentState StrafeState;