From f87d592ce645c77ba540b0fffee32c5897a499ac Mon Sep 17 00:00:00 2001
From: Lwmte <3331699+Lwmte@users.noreply.github.com>
Date: Sun, 9 Mar 2025 19:14:39 +0100
Subject: [PATCH] Added Flow.GetTotalSecretCount()
---
CHANGELOG.md | 1 +
Documentation/doc/1 modules/Flow.html | 41 +++++++++++++++----
.../Scripting/Internal/ReservedScriptNames.h | 1 +
.../Internal/TEN/Flow/FlowHandler.cpp | 17 ++++++--
.../Scripting/Internal/TEN/Flow/FlowHandler.h | 1 +
5 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 49b577777..259eb2fd3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -39,6 +39,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Added diary module.
* Added custom bar module.
* Added Flow.Horizon class with and use two layers of horizons in a Flow.Level class.
+* Added Flow.GetTotalSecretCount() function to get total amount of secrets in the game.
* Added View.GetFlyByPosition() and View.GetFlyByRotation() functions to get flyby sequence parameters at a specified time point.
* Added Effects.EmitAirBubble() function to spawn air bubbles.
* Added Effects.EmitStreamer() function to emit streamers.
diff --git a/Documentation/doc/1 modules/Flow.html b/Documentation/doc/1 modules/Flow.html
index 87f02974d..4d7ffc676 100644
--- a/Documentation/doc/1 modules/Flow.html
+++ b/Documentation/doc/1 modules/Flow.html
@@ -227,8 +227,12 @@ scripts too.
Adds one secret to current level secret count and also plays secret music track. |
- SetTotalSecretCount(total) |
- Total number of secrets in game. |
+ GetTotalSecretCount() |
+ Get total number of secrets in the game. |
+
+
+ SetTotalSecretCount(count) |
+ Set total number of secrets in the game. |
FlipMap(flipmap) |
@@ -876,20 +880,41 @@ The index argument corresponds to the secret's unique ID, the same that would go
-
- SetTotalSecretCount(total)
+
+ GetTotalSecretCount()
- Total number of secrets in game.
+ Get total number of secrets in the game.
+
+
+
+
+ Returns:
+
+
+ int
+ Total number of secrets in the game.
+
+
+
+
+
+
+
+
+ SetTotalSecretCount(count)
+
+
+ Set total number of secrets in the game.
Must be an integer value (0 means no secrets).
Parameters:
- - total
+
- count
int
- number of secrets
+ Total number of secrets in the game.
@@ -911,7 +936,7 @@ Must be an integer value (0 means no secrets).
- flipmap
int
- (ID of flipmap group to actuvate / deactivate)
+ ID of flipmap group to actuvate / deactivate.
diff --git a/TombEngine/Scripting/Internal/ReservedScriptNames.h b/TombEngine/Scripting/Internal/ReservedScriptNames.h
index 641244bd9..ab9c556b8 100644
--- a/TombEngine/Scripting/Internal/ReservedScriptNames.h
+++ b/TombEngine/Scripting/Internal/ReservedScriptNames.h
@@ -237,6 +237,7 @@ static constexpr char ScriptReserved_DeleteSaveGame[] = "DeleteSaveGame";
static constexpr char ScriptReserved_DoesSaveGameExist[] = "DoesSaveGameExist";
static constexpr char ScriptReserved_GetSecretCount[] = "GetSecretCount";
static constexpr char ScriptReserved_SetSecretCount[] = "SetSecretCount";
+static constexpr char ScriptReserved_GetTotalSecretCount[] = "GetTotalSecretCount";
static constexpr char ScriptReserved_SetTotalSecretCount[] = "SetTotalSecretCount";
static constexpr char ScriptReserved_AddSecret[] = "AddSecret";
static constexpr char ScriptReserved_EnableFlyCheat[] = "EnableFlyCheat";
diff --git a/TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.cpp b/TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.cpp
index f5d304a4b..705143056 100644
--- a/TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.cpp
+++ b/TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.cpp
@@ -240,16 +240,22 @@ The index argument corresponds to the secret's unique ID, the same that would go
*/
tableFlow.set_function(ScriptReserved_AddSecret, &FlowHandler::AddSecret, this);
-/*** Total number of secrets in game.
+/*** Get total number of secrets in the game.
+@function GetTotalSecretCount
+@treturn int Total number of secrets in the game.
+*/
+ tableFlow.set_function(ScriptReserved_GetTotalSecretCount, &FlowHandler::GetTotalSecretCount, this);
+
+/*** Set total number of secrets in the game.
Must be an integer value (0 means no secrets).
@function SetTotalSecretCount
-@tparam int total number of secrets
+@tparam int count Total number of secrets in the game.
*/
tableFlow.set_function(ScriptReserved_SetTotalSecretCount, &FlowHandler::SetTotalSecretCount, this);
/*** Do FlipMap with specific group ID.
@function FlipMap
-@tparam int flipmap (ID of flipmap group to actuvate / deactivate)
+@tparam int flipmap ID of flipmap group to actuvate / deactivate.
*/
tableFlow.set_function(ScriptReserved_FlipMap, &FlowHandler::FlipMap, this);
@@ -406,6 +412,11 @@ void FlowHandler::SetTitleScreenImagePath(const std::string& path)
TitleScreenImagePath = path;
}
+int FlowHandler::GetTotalSecretCount()
+{
+ return TotalNumberOfSecrets;
+}
+
void FlowHandler::SetTotalSecretCount(int secretsNumber)
{
TotalNumberOfSecrets = secretsNumber;
diff --git a/TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.h b/TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.h
index 9dafce539..976397ca9 100644
--- a/TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.h
+++ b/TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.h
@@ -70,6 +70,7 @@ public:
void AddSecret(int levelSecretIndex);
void SetIntroImagePath(const std::string& path);
void SetTitleScreenImagePath(const std::string& path);
+ int GetTotalSecretCount();
void SetTotalSecretCount(int secretsNumber);
bool IsFlyCheatEnabled() const;
void EnableFlyCheat(bool enable);