Dehardcode overall secrets count

This commit is contained in:
Lwmte 2022-11-03 07:43:04 +02:00
parent 44ddc68d95
commit 0859d0ea11
7 changed files with 27 additions and 3 deletions

View file

@ -5,6 +5,7 @@ Version 1.0.3
* Add FlipMap and PlayFlyBy script commands and node functions.
* Add OCB 1 for rollingball to make it silent.
* Add FlyCheat option to gameflow script for disabling dozy mode.
* Add SetNumberOfSecrets option to gameflow script to set overall amount of secrets.
* Adjust sprint jump timing.
* Increase amount of maximum secrets per level from 8 to 32.
* Improve game and inventory input handling.

View file

@ -11,6 +11,11 @@ Flow.SetIntroImagePath("Screens\\main.jpg")
Flow.SetTitleScreenImagePath("Screens\\main.jpg")
-- Set overall amount of secrets in game.
-- If set to 0, secrets won't be displayed in statistics.
Flow.SetNumberOfSecrets(5)
-- Disable/enable flycheat globally
Flow.EnableFlyCheat(true)

View file

@ -476,9 +476,12 @@ namespace TEN::Renderer
GetNextLinePosition(&y);
// Secrets found
sprintf(buffer, "%d / 36", Statistics.Game.Secrets);
AddString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SECRETS_FOUND), PRINTSTRING_COLOR_WHITE, SF());
if (g_GameFlow->NumberOfSecrets > 0)
{
sprintf(buffer, "%d / %d", Statistics.Game.Secrets, g_GameFlow->NumberOfSecrets);
AddString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SECRETS_FOUND), PRINTSTRING_COLOR_WHITE, SF());
}
DrawAllStrings();
}

View file

@ -16,6 +16,7 @@ public:
int SelectedLevelForNewGame{ 0 };
int SelectedSaveGame{ 0 };
bool EnableLoadSave{ true };
int NumberOfSecrets{ 0 };
std::string TitleScreenImagePath{};
TITLE_TYPE TitleType{ TITLE_TYPE::FLYBY };

View file

@ -102,6 +102,7 @@ static constexpr char ScriptReserved_GetLevel[] = "GetLevel";
static constexpr char ScriptReserved_GetCurrentLevel[] = "GetCurrentLevel";
static constexpr char ScriptReserved_SetIntroImagePath[] = "SetIntroImagePath";
static constexpr char ScriptReserved_SetTitleScreenImagePath[] = "SetTitleScreenImagePath";
static constexpr char ScriptReserved_SetNumberOfSecrets[] = "SetNumberOfSecrets";
static constexpr char ScriptReserved_SetFarView[] = "SetFarView";
static constexpr char ScriptReserved_SetSettings[] = "SetSettings";
static constexpr char ScriptReserved_SetAnimations[] = "SetAnimations";

View file

@ -106,6 +106,13 @@ __(not yet implemented)__
*/
table_flow.set_function(ScriptReserved_SetTitleScreenImagePath, &FlowHandler::SetTitleScreenImagePath, this);
/*** Total number of secrets in game.
Must be an integer value (0 means no secrets).
@function SetNumberOfSecrets
@tparam int total number of secrets
*/
table_flow.set_function(ScriptReserved_SetNumberOfSecrets, &FlowHandler::SetNumberOfSecrets, this);
/*** Set FlyCheatEnabled
Must be true or false
@function SetFlyCheatEnabled
@ -213,6 +220,11 @@ void FlowHandler::SetTitleScreenImagePath(std::string const& path)
TitleScreenImagePath = path;
}
void FlowHandler::SetNumberOfSecrets(int secretsNumber)
{
NumberOfSecrets = secretsNumber;
}
void FlowHandler::LoadFlowScript()
{
m_handler.ExecuteScript("Scripts/Gameflow.lua");

View file

@ -55,6 +55,7 @@ public:
void AddSecret(int levelSecretIndex);
void SetIntroImagePath(std::string const& path);
void SetTitleScreenImagePath(std::string const& path);
void SetNumberOfSecrets(int secretsNumber);
bool IsFlyCheatEnabled() const;
void EnableFlyCheat(bool flyCheat);
bool CanPlayAnyLevel() const;