Use a dedicated CVar for enabling cutscene skips

This commit is contained in:
Phillip Stephens 2022-12-07 18:02:33 -08:00
parent b1ffc45307
commit ce1f1ac362
3 changed files with 16 additions and 4 deletions

View File

@ -99,8 +99,10 @@ bool SetPassCombiners(ERglTevStage stage, const CTevPass& pass) {
} }
void RecomputePasses() { void RecomputePasses() {
sNumEnabledPasses = 1 - static_cast<int>(sValidPasses[maxTevPasses - 1]); u8 tmp = static_cast<u8>((sValidPasses[maxTevPasses - 1] != 0));
CGX::SetNumTevStages(sNumEnabledPasses); tmp++;
sNumEnabledPasses = tmp;
CGX::SetNumTevStages(tmp);
} }
void ResetStates() { void ResetStates() {

View File

@ -51,6 +51,11 @@ CScriptSpecialFunction::CScriptSpecialFunction(TUniqueId uid, std::string_view n
if (xe8_function == ESpecialFunction::HUDTarget) { if (xe8_function == ESpecialFunction::HUDTarget) {
x1c8_touchBounds = {-1.f, 1.f}; x1c8_touchBounds = {-1.f, 1.f};
} }
// Set this as internal archivable so it can be serialized if the player sets it in the configuration
m_cvRef.emplace(&m_canSkipCutscenes,
CVarManager::instance()->findOrMakeCVar(
"enableCutsceneSkip"sv, "Enable skipping of all cutscenes", false,
CVar::EFlags::Cheat | CVar::EFlags::Game | CVar::EFlags::InternalArchivable));
} }
void CScriptSpecialFunction::Accept(IVisitor& visitor) { visitor.Visit(this); } void CScriptSpecialFunction::Accept(IVisitor& visitor) { visitor.Visit(this); }
@ -986,7 +991,7 @@ void CScriptSpecialFunction::ThinkPlayerInArea(float dt, CStateManager& mgr) {
} }
bool CScriptSpecialFunction::ShouldSkipCinematic(CStateManager& stateMgr) const { bool CScriptSpecialFunction::ShouldSkipCinematic(CStateManager& stateMgr) const {
if (com_developer->toBoolean()) { if (m_canSkipCutscenes) {
return true; return true;
} }
return g_GameState->SystemOptions().GetCinematicState(stateMgr.GetWorld()->IGetWorldAssetId(), GetEditorId()); return g_GameState->SystemOptions().GetCinematicState(stateMgr.GetWorld()->IGetWorldAssetId(), GetEditorId());

View File

@ -8,6 +8,8 @@
#include "Runtime/World/CActor.hpp" #include "Runtime/World/CActor.hpp"
#include "Runtime/World/CDamageInfo.hpp" #include "Runtime/World/CDamageInfo.hpp"
#include "Runtime/ConsoleVariables/CVar.hpp"
#include <zeus/CColor.hpp> #include <zeus/CColor.hpp>
#include <zeus/CTransform.hpp> #include <zeus/CTransform.hpp>
#include <zeus/CVector3f.hpp> #include <zeus/CVector3f.hpp>
@ -111,6 +113,9 @@ private:
bool x1e5_25_playerInArea : 1 = false; bool x1e5_25_playerInArea : 1 = false;
bool x1e5_26_displayBillboard : 1 = false; bool x1e5_26_displayBillboard : 1 = false;
TLockedToken<CTexture> x1e8_; // Used to be optional TLockedToken<CTexture> x1e8_; // Used to be optional
std::optional<CVarValueReference<bool>> m_cvRef;
bool m_canSkipCutscenes = false;
public: public:
DEFINE_ENTITY DEFINE_ENTITY
CScriptSpecialFunction(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, ESpecialFunction, CScriptSpecialFunction(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, ESpecialFunction,