From a086fe730af105238dae1c1b5e8730e33cf9af26 Mon Sep 17 00:00:00 2001 From: Wincent Date: Tue, 10 Sep 2024 14:33:58 +0000 Subject: [PATCH] Added clean-up param --- dGame/dCinema/Recorder.cpp | 10 ++++++++++ dGame/dCinema/Recorder.h | 2 ++ dGame/dCinema/Scene.cpp | 14 ++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/dGame/dCinema/Recorder.cpp b/dGame/dCinema/Recorder.cpp index 56eef721..033d803d 100644 --- a/dGame/dCinema/Recorder.cpp +++ b/dGame/dCinema/Recorder.cpp @@ -217,6 +217,10 @@ void Recorder::ActingDispatch(Entity* actor, const std::vector& records if (concludeRecord) { if (variables != nullptr) { variables->Conclude(); + + if (concludeRecord->cleanUp) { + variables->CleanUp(); + } } } @@ -1044,11 +1048,17 @@ void Cinema::Recording::ConcludeRecord::Serialize(tinyxml2::XMLDocument& documen element->SetAttribute("t", m_Delay); + element->SetAttribute("cleanUp", true); + parent->InsertEndChild(element); } void Cinema::Recording::ConcludeRecord::Deserialize(tinyxml2::XMLElement* element) { m_Delay = element->DoubleAttribute("t"); + + if (element->Attribute("cleanUp")) { + cleanUp = element->BoolAttribute("clean-up"); + } } Cinema::Recording::VisibilityRecord::VisibilityRecord(bool visible) { diff --git a/dGame/dCinema/Recorder.h b/dGame/dCinema/Recorder.h index 3453d88d..48abca73 100644 --- a/dGame/dCinema/Recorder.h +++ b/dGame/dCinema/Recorder.h @@ -287,6 +287,8 @@ public: class ConcludeRecord : public Record { public: + bool cleanUp = false; + ConcludeRecord() = default; void Act(Entity* actor) override; diff --git a/dGame/dCinema/Scene.cpp b/dGame/dCinema/Scene.cpp index 542d4517..473c6dce 100644 --- a/dGame/dCinema/Scene.cpp +++ b/dGame/dCinema/Scene.cpp @@ -272,14 +272,16 @@ void Cinema::Scene::CheckTicket(Entity* player) { } } - if (!IsPlayerInShowingDistance(player)) { - m_HasBeenOutside.emplace(player->GetObjectID()); + if (m_ShowingDistance != 0.0f) { + if (!IsPlayerInShowingDistance(player)) { + m_HasBeenOutside.emplace(player->GetObjectID()); - return; - } + return; + } - if (m_HasBeenOutside.find(player->GetObjectID()) == m_HasBeenOutside.end()) { - return; + if (m_HasBeenOutside.find(player->GetObjectID()) == m_HasBeenOutside.end()) { + return; + } } m_Audience.emplace(player->GetObjectID());