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() {
sNumEnabledPasses = 1 - static_cast<int>(sValidPasses[maxTevPasses - 1]);
CGX::SetNumTevStages(sNumEnabledPasses);
u8 tmp = static_cast<u8>((sValidPasses[maxTevPasses - 1] != 0));
tmp++;
sNumEnabledPasses = tmp;
CGX::SetNumTevStages(tmp);
}
void ResetStates() {

View File

@ -51,6 +51,11 @@ CScriptSpecialFunction::CScriptSpecialFunction(TUniqueId uid, std::string_view n
if (xe8_function == ESpecialFunction::HUDTarget) {
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); }
@ -923,7 +928,7 @@ void CScriptSpecialFunction::ThinkSaveStation(float, CStateManager& mgr) {
}
void CScriptSpecialFunction::ThinkRainSimulator(float, CStateManager& mgr) {
if ((static_cast< float >(mgr.GetInputFrameIdx() % 3600)) / 3600.f < 0.5f) {
if ((static_cast<float>(mgr.GetInputFrameIdx() % 3600)) / 3600.f < 0.5f) {
SendScriptMsgs(EScriptObjectState::MaxReached, mgr, EScriptObjectMessage::None);
} else {
SendScriptMsgs(EScriptObjectState::Zero, mgr, EScriptObjectMessage::None);
@ -986,7 +991,7 @@ void CScriptSpecialFunction::ThinkPlayerInArea(float dt, CStateManager& mgr) {
}
bool CScriptSpecialFunction::ShouldSkipCinematic(CStateManager& stateMgr) const {
if (com_developer->toBoolean()) {
if (m_canSkipCutscenes) {
return true;
}
return g_GameState->SystemOptions().GetCinematicState(stateMgr.GetWorld()->IGetWorldAssetId(), GetEditorId());

View File

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