implement instant text setting

This commit is contained in:
gymnast86
2026-04-17 01:30:08 -07:00
parent 363788accd
commit 5ba04524eb
7 changed files with 64 additions and 3 deletions
+1
View File
@@ -1334,6 +1334,7 @@ set(DUSK_FILES
include/dusk/endian_gx.hpp
include/dusk/config.hpp
include/dusk/dvd_asset.hpp
include/dusk/scope_guard.hpp
src/dusk/dvd_asset.cpp
src/d/actor/d_a_alink_dusk.cpp
src/dusk/asserts.cpp
+24
View File
@@ -0,0 +1,24 @@
//
// Created by carlw on 4/17/2026.
//
#ifndef DUSK_SCOPE_GUARD_HPP
#define DUSK_SCOPE_GUARD_HPP
#include <functional>
class SimpleScopeGuard {
public:
// Store the function in the constructor
explicit SimpleScopeGuard(const std::function<void()>& func) : m_func(func) {}
// Run the function when the object goes out of scope
~SimpleScopeGuard() {
if (m_func) m_func();
}
private:
std::function<void()> m_func;
};
#endif //DUSK_SCOPE_GUARD_HPP
+1
View File
@@ -61,6 +61,7 @@ struct UserSettings {
ConfigVar<bool> noMissClimbing;
ConfigVar<bool> fastTears;
ConfigVar<bool> instantSaves;
ConfigVar<bool> instantText;
ConfigVar<bool> sunsSong;
// Preferences
+21
View File
@@ -12,6 +12,10 @@
#include "d/d_lib.h"
#include "JSystem/JUtility/JUTFont.h"
#if TARGET_PC
#include "dusk/scope_guard.hpp"
#endif
#if REGION_JPN
#define CHAR_CODE_MALE_ICON 0x8189
#define CHAR_CODE_FEMALE_ICON 0x818A
@@ -1918,6 +1922,11 @@ void jmessage_tSequenceProcessor::do_begin(void const* pEntry, char const* pszTe
pReference->resetReference();
field_0xb5 = 0;
#if TARGET_PC
if (dusk::getSettings().game.instantText && mDoCPd_c::getHoldB(0)) {
field_0xb2 = 1;
}
#endif
}
void jmessage_tSequenceProcessor::do_end() {
@@ -2154,6 +2163,18 @@ void jmessage_tSequenceProcessor::do_character(int iCharacter) {
bool jmessage_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_size) {
jmessage_tReference* pReference = (jmessage_tReference*)getReference();
#if TARGET_PC
// This class runs the lambda function when it goes out of scope. We want to run
// this code after the switch statement and this saves us from having to litter
// the switch statement with IF_DUSK before every return.
auto instantTextRun = SimpleScopeGuard([&]() {
if (dusk::getSettings().game.instantText && mDoCPd_c::getHoldB(0)) {
field_0xb2 = 1;
pReference->setSendTimer(0);
}
});
#endif
switch (i_tag & 0xFF0000) {
case MSGTAG_GROUP(1): {
cXyz pos = pReference->getActorPos();
+10 -3
View File
@@ -28,6 +28,10 @@
#include "m_Do/m_Do_lib.h"
#include "JSystem/JKernel/JKRExpHeap.h"
#if TARGET_PC
#include "dusk/settings.h"
#endif
static void dMsgObject_addFundRaising(s16 param_0);
static void dMsgObject_addTotalPayment(s16 param_0);
@@ -1566,7 +1570,8 @@ u8 dMsgObject_c::isSend() {
if (pRef->getSendFlag() == 5) {
if (getStatusLocal() == 21) {
setButtonStatusLocal();
if (mDoCPd_c::getTrigA(0) != 0 || mDoCPd_c::getTrigB(0) != 0) {
if (IF_DUSK((dusk::getSettings().game.instantText && mDoCPd_c::getHoldB(0)) ||)
mDoCPd_c::getTrigA(0) != 0 || mDoCPd_c::getTrigB(0) != 0) {
return 2;
}
return 0;
@@ -1585,7 +1590,8 @@ u8 dMsgObject_c::isSend() {
}
if (pRef->getSendFlag() == 2) {
setButtonStatusLocal();
if (mDoCPd_c::getTrigA(0) != 0 || mDoCPd_c::getTrigB(0) != 0) {
if (IF_DUSK((dusk::getSettings().game.instantText && mDoCPd_c::getHoldB(0)) ||)
mDoCPd_c::getTrigA(0) != 0 || mDoCPd_c::getTrigB(0) != 0) {
return 2;
}
}
@@ -1598,7 +1604,8 @@ u8 dMsgObject_c::isSend() {
return 2;
}
} else {
if (mDoCPd_c::getTrigA(0) != 0 || mDoCPd_c::getTrigB(0) != 0) {
if (IF_DUSK((dusk::getSettings().game.instantText && mDoCPd_c::getHoldB(0)) ||)
mDoCPd_c::getTrigA(0) != 0 || mDoCPd_c::getTrigB(0) != 0) {
return 2;
}
if (mesgCancelButton) {
+5
View File
@@ -65,6 +65,11 @@ namespace dusk {
ImGui::SetTooltip("Skip the delay when writing to the Memory Card.");
}
config::ImGuiCheckbox("Hold B for Instant Text", getSettings().game.instantText);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Make text scroll immediately by holding B.");
}
config::ImGuiCheckbox("No Climbing Miss Animation", getSettings().game.noMissClimbing);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("Prevents Link from playing a struggle animation\n"
+2
View File
@@ -35,6 +35,7 @@ UserSettings g_userSettings = {
.noMissClimbing {"game.noMissClimbing", false},
.fastTears {"game.fastTears", false},
.instantSaves {"game.instantSaves", false},
.instantText {"game.instantText", false},
.sunsSong {"game.sunsSong", false},
// Preferences
@@ -120,6 +121,7 @@ void registerSettings() {
Register(g_userSettings.game.fastClimbing);
Register(g_userSettings.game.fastTears);
Register(g_userSettings.game.instantSaves);
Register(g_userSettings.game.instantText);
Register(g_userSettings.game.sunsSong);
Register(g_userSettings.game.enableMirrorMode);
Register(g_userSettings.game.invertCameraXAxis);