mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-29 00:07:58 +03:00
Lua set level secrets (#862)
* Set Secrets for level * Set NumberOfSecrets to TotalNumberOfSecrets * Secrets for Level Display * Get LevelSecrets with BitSet Count * Change Short to Int
This commit is contained in:
parent
53ce6192b9
commit
84a21c776b
8 changed files with 38 additions and 9 deletions
|
@ -93,7 +93,8 @@ local strings =
|
|||
save_game = { "Save Game" },
|
||||
savegame_timestamp = { "%02d Days %02d:%02d:%02d" },
|
||||
screen_resolution = { "Screen Resolution" },
|
||||
secrets_found = { "Secrets Found" },
|
||||
level_secrets_found = { "Secrets Found in Level" },
|
||||
total_secrets_found = { "Secrets Found Total" },
|
||||
select_level = { "Select Level" },
|
||||
separate = { "Separate" },
|
||||
sfx_volume = { "SFX Volume" },
|
||||
|
|
|
@ -475,12 +475,22 @@ namespace TEN::Renderer
|
|||
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_USED_MEDIPACKS), PRINTSTRING_COLOR_WHITE, SF());
|
||||
GetNextLinePosition(&y);
|
||||
|
||||
// Secrets found
|
||||
if (g_GameFlow->NumberOfSecrets > 0)
|
||||
// Secrets found in Level
|
||||
if (g_GameFlow->GetLevel(CurrentLevel)->GetSecrets() > 0)
|
||||
{
|
||||
sprintf(buffer, "%d / %d", Statistics.Game.Secrets, g_GameFlow->NumberOfSecrets);
|
||||
std::bitset<32> LevelSecretBitSet(Statistics.Level.Secrets);
|
||||
sprintf(buffer, "%d / %d", LevelSecretBitSet.count(), g_GameFlow->GetLevel(CurrentLevel)->GetSecrets());
|
||||
AddString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
||||
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_SECRETS_FOUND), PRINTSTRING_COLOR_WHITE, SF());
|
||||
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_LEVEL_SECRETS_FOUND), PRINTSTRING_COLOR_WHITE, SF());
|
||||
GetNextLinePosition(&y);
|
||||
}
|
||||
|
||||
// Secrets found total
|
||||
if (g_GameFlow->TotalNumberOfSecrets > 0)
|
||||
{
|
||||
sprintf(buffer, "%d / %d", Statistics.Game.Secrets, g_GameFlow->TotalNumberOfSecrets);
|
||||
AddString(MenuRightSideEntry, y, buffer, PRINTSTRING_COLOR_WHITE, SF());
|
||||
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_TOTAL_SECRETS_FOUND), PRINTSTRING_COLOR_WHITE, SF());
|
||||
}
|
||||
|
||||
DrawAllStrings();
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
int SelectedLevelForNewGame{ 0 };
|
||||
int SelectedSaveGame{ 0 };
|
||||
bool EnableLoadSave{ true };
|
||||
int NumberOfSecrets{ 0 };
|
||||
int TotalNumberOfSecrets{ 0 };
|
||||
std::string TitleScreenImagePath{};
|
||||
TITLE_TYPE TitleType{ TITLE_TYPE::FLYBY };
|
||||
|
||||
|
|
|
@ -43,4 +43,5 @@ public:
|
|||
virtual short GetFogMinDistance() const = 0;
|
||||
virtual short GetFogMaxDistance() const = 0;
|
||||
virtual short GetFarView() const = 0;
|
||||
virtual int GetSecrets() const = 0;
|
||||
};
|
||||
|
|
|
@ -127,7 +127,8 @@
|
|||
#define STRING_DISTANCE_TRAVELLED "distance_travelled"
|
||||
#define STRING_USED_MEDIPACKS "used_medipacks"
|
||||
#define STRING_AMMO_USED "ammo_used"
|
||||
#define STRING_SECRETS_FOUND "secrets_found"
|
||||
#define STRING_TOTAL_SECRETS_FOUND "total_secrets_found"
|
||||
#define STRING_LEVEL_SECRETS_FOUND "level_secrets_found"
|
||||
#define STRING_WATERSKIN_SMALL_EMPTY "waterskin_small_empty"
|
||||
#define STRING_WATERSKIN_SMALL_1L "waterskin_small_1l"
|
||||
#define STRING_WATERSKIN_SMALL_2L "waterskin_small_2l"
|
||||
|
|
|
@ -229,7 +229,7 @@ void FlowHandler::SetTitleScreenImagePath(std::string const& path)
|
|||
|
||||
void FlowHandler::SetTotalSecretCount(int secretsNumber)
|
||||
{
|
||||
NumberOfSecrets = secretsNumber;
|
||||
TotalNumberOfSecrets = secretsNumber;
|
||||
}
|
||||
|
||||
void FlowHandler::LoadFlowScript()
|
||||
|
|
|
@ -118,7 +118,11 @@ e.g. `myLevel.laraType = LaraType.Divesuit`
|
|||
|
||||
/// (table of @{Flow.InventoryItem}s) table of inventory object overrides
|
||||
//@mem objects
|
||||
"objects", &Level::InventoryObjects
|
||||
"objects", &Level::InventoryObjects,
|
||||
|
||||
/// (short) Set Secrets for Level
|
||||
//@mem secrets
|
||||
"secrets", sol::property(&Level::SetSecrets)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -256,3 +260,12 @@ short Level::GetFarView() const
|
|||
return float(LevelFarView);
|
||||
}
|
||||
|
||||
void Level::SetSecrets(int secrets)
|
||||
{
|
||||
LevelSecrets = secrets;
|
||||
}
|
||||
|
||||
int Level::GetSecrets() const
|
||||
{
|
||||
return LevelSecrets;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ struct Level : public ScriptInterfaceLevel
|
|||
int LevelFarView{ 0 };
|
||||
bool UnlimitedAir{ false };
|
||||
std::vector<InventoryItem> InventoryObjects;
|
||||
int LevelSecrets{ 0 };
|
||||
|
||||
RGBAColor8Byte GetFogColor() const override;
|
||||
bool GetFogEnabled() const override;
|
||||
|
@ -55,4 +56,6 @@ struct Level : public ScriptInterfaceLevel
|
|||
short GetFogMinDistance() const override;
|
||||
short GetFogMaxDistance() const override;
|
||||
short GetFarView() const override;
|
||||
void SetSecrets(short secrets);
|
||||
int GetSecrets() const override;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue