From 3886f56bdcdbb6e13d798f8ba888b7633aad8322 Mon Sep 17 00:00:00 2001 From: walkawayy <81546780+walkawayy@users.noreply.github.com> Date: Fri, 31 May 2024 18:53:22 -0400 Subject: [PATCH] gameflow: add unobtainable secrets property (#1380) Resolves #1379. --- CHANGELOG.md | 1 + GAMEFLOW.md | 10 ++++++++++ README.md | 2 +- src/game/gameflow.c | 3 +++ src/game/gameflow.h | 1 + src/game/stats.c | 1 + tools/config/TR1X_ConfigTool/Resources/Lang/en.json | 2 +- 7 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73d282479..57d5e9b19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - `/hp` - `/hp [num]` - `/heal` +- added unobtainable secrets stat support in the gameflow (#1379) - fixed config tool and installer missing icons (#1358, regression from 4.0) - fixed looking forward too far causing an upside down camera frame (#1338) - fixed the enemy bear behavior in demo mode (#1370, regression since 2.16) diff --git a/GAMEFLOW.md b/GAMEFLOW.md index 6dbb89ad8..590f86a2c 100644 --- a/GAMEFLOW.md +++ b/GAMEFLOW.md @@ -538,6 +538,16 @@ Following are each of the properties available within a level. A count of items that will be excluded from pickup statistics. +
unobtainable_secrets
+ water_color
diff --git a/README.md b/README.md
index 1c1a37f67..b493d99b3 100644
--- a/README.md
+++ b/README.md
@@ -358,7 +358,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det
- added optional final statistics screen
- added optional deaths counter
- added optional total pickups and kills per level
-- added unobtainable pickups and kills stats support in the gameflow
+- added unobtainable pickups, kills, and secrets stats support in the gameflow
#### Visuals
- added optional shotgun flash sprites
diff --git a/src/game/gameflow.c b/src/game/gameflow.c
index 0d44a857b..38ed4a9a8 100644
--- a/src/game/gameflow.c
+++ b/src/game/gameflow.c
@@ -672,6 +672,9 @@ static bool GameFlow_LoadScriptLevels(struct json_object_s *obj)
cur->unobtainable.kills =
json_object_get_int(jlvl_obj, "unobtainable_kills", 0);
+ cur->unobtainable.secrets =
+ json_object_get_int(jlvl_obj, "unobtainable_secrets", 0);
+
struct json_object_s *jlbl_strings_obj =
json_object_get_object(jlvl_obj, "strings");
if (!jlbl_strings_obj) {
diff --git a/src/game/gameflow.h b/src/game/gameflow.h
index a7f835049..acc0cb502 100644
--- a/src/game/gameflow.h
+++ b/src/game/gameflow.h
@@ -48,6 +48,7 @@ typedef struct GAMEFLOW_LEVEL {
struct {
uint32_t pickups;
uint32_t kills;
+ uint32_t secrets;
} unobtainable;
struct {
int length;
diff --git a/src/game/stats.c b/src/game/stats.c
index 73a0c8f79..bb8ba41f6 100644
--- a/src/game/stats.c
+++ b/src/game/stats.c
@@ -258,6 +258,7 @@ void Stats_CalculateStats(void)
m_LevelPickups -= g_GameFlow.levels[g_CurrentLevel].unobtainable.pickups;
m_LevelKillables -= g_GameFlow.levels[g_CurrentLevel].unobtainable.kills;
+ m_LevelSecrets -= g_GameFlow.levels[g_CurrentLevel].unobtainable.secrets;
}
int32_t Stats_GetPickups(void)
diff --git a/tools/config/TR1X_ConfigTool/Resources/Lang/en.json b/tools/config/TR1X_ConfigTool/Resources/Lang/en.json
index ca56d9604..a6e25231d 100644
--- a/tools/config/TR1X_ConfigTool/Resources/Lang/en.json
+++ b/tools/config/TR1X_ConfigTool/Resources/Lang/en.json
@@ -239,7 +239,7 @@
},
"enable_detailed_stats": {
"Title": "Show total kills and pickups",
- "Description": "Enables showing the maximum pickup count and kill count on each level. This includes unobtainable items."
+ "Description": "Enables showing the maximum pickup count and kill count on each level."
},
"enable_cine": {
"Title": "Enable cutscenes",