Add a held down toggle hotkey option for AutoTalk
This commit is contained in:
parent
7d651c828d
commit
f0c5b3b6cc
@ -1,4 +1,4 @@
|
|||||||
#include "pch-il2cpp.h"
|
#include "pch-il2cpp.h"
|
||||||
#include "DialogSkip.h"
|
#include "DialogSkip.h"
|
||||||
|
|
||||||
#include <helpers.h>
|
#include <helpers.h>
|
||||||
@ -12,6 +12,7 @@ namespace cheat::feature
|
|||||||
|
|
||||||
DialogSkip::DialogSkip() : Feature(),
|
DialogSkip::DialogSkip() : Feature(),
|
||||||
NF(f_Enabled, "Auto talk", "AutoTalk", false),
|
NF(f_Enabled, "Auto talk", "AutoTalk", false),
|
||||||
|
NF(f_ToggleHotkey, "Toggle Hotkey", "AutoTalk", Hotkey()),
|
||||||
NF(f_AutoSelectDialog, "Auto select dialog", "AutoTalk", true),
|
NF(f_AutoSelectDialog, "Auto select dialog", "AutoTalk", true),
|
||||||
NF(f_ExcludeImportant, "Exclude Katheryne/Tubby/Wagner", "AutoTalk", true),
|
NF(f_ExcludeImportant, "Exclude Katheryne/Tubby/Wagner", "AutoTalk", true),
|
||||||
NF(f_FastDialog, "Fast dialog", "AutoTalk", false),
|
NF(f_FastDialog, "Fast dialog", "AutoTalk", false),
|
||||||
@ -32,6 +33,10 @@ namespace cheat::feature
|
|||||||
void DialogSkip::DrawMain()
|
void DialogSkip::DrawMain()
|
||||||
{
|
{
|
||||||
ConfigWidget("Enabled", f_Enabled, "Automatically continue the dialog.");
|
ConfigWidget("Enabled", f_Enabled, "Automatically continue the dialog.");
|
||||||
|
if (f_Enabled)
|
||||||
|
{
|
||||||
|
ConfigWidget("Toggle Hotkey", f_ToggleHotkey, true, "Change behavior to a held down toggle if bound to a key.\nLeave as 'None' for default behavior (always on).");
|
||||||
|
}
|
||||||
ConfigWidget("Auto-select Dialog", f_AutoSelectDialog, "Automatically select dialog choices.");
|
ConfigWidget("Auto-select Dialog", f_AutoSelectDialog, "Automatically select dialog choices.");
|
||||||
if (f_AutoSelectDialog)
|
if (f_AutoSelectDialog)
|
||||||
{
|
{
|
||||||
@ -71,13 +76,23 @@ namespace cheat::feature
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ResetGamespeed()
|
||||||
|
{
|
||||||
|
float gameSpeed = app::Time_get_timeScale(nullptr);
|
||||||
|
if (gameSpeed > 1.0f)
|
||||||
|
app::Time_set_timeScale(1.0f, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
// Raised when dialog view updating
|
// Raised when dialog view updating
|
||||||
// We call free click, if auto talk enabled, that means we just emulate user click
|
// We call free click, if auto talk enabled, that means we just emulate user click
|
||||||
// When appear dialog choose we create notify with dialog select first item.
|
// When appear dialog choose we create notify with dialog select first item.
|
||||||
void DialogSkip::OnCutScenePageUpdate(app::InLevelCutScenePageContext* context)
|
void DialogSkip::OnCutScenePageUpdate(app::InLevelCutScenePageContext* context)
|
||||||
{
|
{
|
||||||
if (!f_Enabled)
|
if (!f_Enabled || !f_ToggleHotkey.value().IsPressed())
|
||||||
|
{
|
||||||
|
ResetGamespeed();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto talkDialog = context->fields._talkDialog;
|
auto talkDialog = context->fields._talkDialog;
|
||||||
if (talkDialog == nullptr)
|
if (talkDialog == nullptr)
|
||||||
@ -139,9 +154,7 @@ namespace cheat::feature
|
|||||||
// Should be a better way to store the pre-dialog speed using Time_get_timeScale.
|
// Should be a better way to store the pre-dialog speed using Time_get_timeScale.
|
||||||
static void InLevelCutScenePageContext_ClearView_Hook(app::InLevelCutScenePageContext* __this, MethodInfo* method)
|
static void InLevelCutScenePageContext_ClearView_Hook(app::InLevelCutScenePageContext* __this, MethodInfo* method)
|
||||||
{
|
{
|
||||||
float gameSpeed = app::Time_get_timeScale(nullptr);
|
ResetGamespeed();
|
||||||
if (gameSpeed > 1.0f)
|
|
||||||
app::Time_set_timeScale(1.0f, nullptr);
|
|
||||||
CALL_ORIGIN(InLevelCutScenePageContext_ClearView_Hook, __this, method);
|
CALL_ORIGIN(InLevelCutScenePageContext_ClearView_Hook, __this, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ namespace cheat::feature
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
config::Field<config::Toggle<Hotkey>> f_Enabled;
|
||||||
|
config::Field<Hotkey> f_ToggleHotkey;
|
||||||
config::Field<config::Toggle<Hotkey>> f_AutoSelectDialog;
|
config::Field<config::Toggle<Hotkey>> f_AutoSelectDialog;
|
||||||
config::Field<config::Toggle<Hotkey>> f_ExcludeImportant;
|
config::Field<config::Toggle<Hotkey>> f_ExcludeImportant;
|
||||||
config::Field<config::Toggle<Hotkey>> f_FastDialog;
|
config::Field<config::Toggle<Hotkey>> f_FastDialog;
|
||||||
|
Loading…
Reference in New Issue
Block a user