Skip to content

Commit

Permalink
gameflow: add unobtainable secrets property (LostArtefacts#1380)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkawayy authored May 31, 2024
1 parent 3f4b452 commit 3886f56
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions GAMEFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
</td>
</tr>
<tr valign="top">
<td>
<code>unobtainable_secrets</code>
</td>
<td>Integer</td>
<td>No</td>
<td colspan="2">
A count of secrets that will be excluded from secret statistics. Useful for level demos.
</td>
</tr>
<tr valign="top">
<td>
<code>water_color</code>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/game/gameflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/game/gameflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ typedef struct GAMEFLOW_LEVEL {
struct {
uint32_t pickups;
uint32_t kills;
uint32_t secrets;
} unobtainable;
struct {
int length;
Expand Down
1 change: 1 addition & 0 deletions src/game/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tools/config/TR1X_ConfigTool/Resources/Lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 3886f56

Please sign in to comment.