Merge branch 'develop' into sezz_target_highlighter

This commit is contained in:
Sezz 2023-09-07 00:07:58 +10:00
commit f0e4dc3b4b
7 changed files with 193 additions and 167 deletions

View file

@ -16,6 +16,10 @@ Flow.SetTitleScreenImagePath("Screens\\main.jpg")
Flow.SetTotalSecretCount(5) Flow.SetTotalSecretCount(5)
-- Enable/Disable bilinear filtering.
Flow.EnablePointFilter(false)
-- Disable/enable flycheat globally -- Disable/enable flycheat globally
Flow.EnableFlyCheat(true) Flow.EnableFlyCheat(true)

View file

@ -1,191 +1,68 @@
--[[
NOTE: It's possible to expand string entry tables with extra language variations
corresponding to languages in the table at the end of this file.
--]]
local strings = local strings =
{ {
actions_accelerate = { "Accelerate" }, --[[
actions_reverse = { "Reverse" }, Level name strings
actions_speed = { "Speed" }, --]]
actions_slow = { "Slow" }, lara_home = { "Lara's Home" },
actions_brake = { "Brake/Dismount" }, test_level = { "Test Level" },
actions_fire = { "Fire" }, title = { "Title" },
actions_action = { "Action" },
actions_sprint = { "Sprint" }, --[[
actions_draw = { "Draw" }, Inventory item strings
actions_crouch = { "Crouch" }, --]]
actions_inventory = { "Inventory" },
actions_jump = { "Jump" },
actions_look = { "Look" },
actions_backward = { "Backward" },
actions_forward = { "Forward" },
actions_left = { "Left" },
actions_right = { "Right" },
actions_roll = { "Roll" },
actions_step_left = { "Step Left" },
actions_step_right = { "Step Right" },
actions_pause = { "Pause" },
actions_walk = { "Walk" },
actions_save = { "Save" },
actions_load = { "Load" },
actions_select = { "Select" },
actions_deselect = { "Deselect" },
actions_large_medipack = { "Large Medipack" },
actions_flare = { "Flare" },
actions_next_weapon = { "Next Weapon" },
actions_previous_weapon = { "Previous Weapon" },
actions_small_medipack = { "Small Medipack" },
actions_weapon_1 = { "Weapon 1" },
actions_weapon_2 = { "Weapon 2" },
actions_weapon_3 = { "Weapon 3" },
actions_weapon_4 = { "Weapon 4" },
actions_weapon_5 = { "Weapon 5" },
actions_weapon_6 = { "Weapon 6" },
actions_weapon_7 = { "Weapon 7" },
actions_weapon_8 = { "Weapon 8" },
actions_weapon_9 = { "Weapon 9" },
actions_weapon_10 = { "Weapon 10" },
window_title = { "TombEngine" },
all = { "All" },
apply = { "Apply" },
automatic_targeting = { "Automatic Targeting" },
back = { "Back" },
binoculars = { "Binoculars" }, binoculars = { "Binoculars" },
close = { "Close" },
cancel = { "Cancel" },
caustics = { "Underwater Caustics" },
choose_ammo = { "Choose Ammo" },
choose_weapon = { "Choose Weapon" },
combine = { "Combine" },
combine_with = { "Combine With" },
controls = { "Controls" },
reset_to_defaults = { "Reset to Defaults" },
crossbow = { "Crossbow" }, crossbow = { "Crossbow" },
crossbow_normal_ammo = { "Crossbow Normal Ammo" },
crossbow_poison_ammo = { "Crossbow Poison Ammo" },
crossbow_explosive_ammo = { "Crossbow Explosive Ammo" }, crossbow_explosive_ammo = { "Crossbow Explosive Ammo" },
crossbow_lasersight = { "Crossbow + Lasersight" }, crossbow_lasersight = { "Crossbow + Lasersight" },
crossbow_normal_ammo = { "Crossbow Normal Ammo" },
crossbow_poison_ammo = { "Crossbow Poison Ammo" },
crowbar = { "Crowbar" }, crowbar = { "Crowbar" },
diary = { "Diary" }, diary = { "Diary" },
disabled = { "Disabled" },
display = { "Display Settings" },
display_adapter = { "Display Adapter" },
distance_travelled = { "Distance Travelled" },
enable_sound = { "Enable Sounds" },
enabled = { "Enabled" },
equip = { "Equip" },
examine = { "Examine" },
exit_game = { "Exit Game" },
exit_to_title = { "Exit to Title" },
flares = { "Flares" }, flares = { "Flares" },
general_actions = { "General Actions"},
grenade_launcher = { "Grenade Launcher" }, grenade_launcher = { "Grenade Launcher" },
grenade_launcher_flash_ammo = { "Grenade Launcher Flash Ammo" },
grenade_launcher_normal_ammo = { "Grenade Launcher Normal Ammo" }, grenade_launcher_normal_ammo = { "Grenade Launcher Normal Ammo" },
grenade_launcher_super_ammo = { "Grenade Launcher Super Ammo" }, grenade_launcher_super_ammo = { "Grenade Launcher Super Ammo" },
grenade_launcher_flash_ammo = { "Grenade Launcher Flash Ammo" },
harpoon_gun = { "Harpoon Gun" }, harpoon_gun = { "Harpoon Gun" },
harpoon_gun_ammo = { "Harpoon Gun Ammo" }, harpoon_gun_ammo = { "Harpoon Gun Ammo" },
headset = { "Headset" }, headset = { "Headset" },
hk = { "HK" }, hk = { "HK" },
hk_ammo = { "HK Ammo" }, hk_ammo = { "HK Ammo" },
hk_burst_mode = { "Burst Mode" }, hk_burst_mode = { "Burst Mode" },
hk_rapid_mode = { "Rapid Mode" },
hk_lasersight = { "HK + Lasersight" }, hk_lasersight = { "HK + Lasersight" },
hk_rapid_mode = { "Rapid Mode" },
hk_sniper_mode = { "Sniper Mode" }, hk_sniper_mode = { "Sniper Mode" },
lara_home = { "Lara's Home" },
large_medipack = { "Large Medipack" }, large_medipack = { "Large Medipack" },
lasersight = { "Lasersight" }, lasersight = { "Lasersight" },
menu_actions = { "Menu Actions" }, mechanical_scarab = { "Mechanical Scarab With Winding Key" },
music_volume = { "Music Volume" }, mechanical_scarab_1 = { "Mechanical Scarab (No Winding Key)" },
new_game = { "New Game" }, mechanical_scarab_2 = { "Mechanical Scarab Winding Key" },
none = { "None" },
ok = { "OK" },
options = { "Options" },
other_settings = { "Sound and Gameplay" },
output_settings = { "Output Settings" },
passport = { "Passport" }, passport = { "Passport" },
pistol_ammo = { "Pistol Ammo" }, pistol_ammo = { "Pistol Ammo" },
pistols = { "Pistols" }, pistols = { "Pistols" },
player = { "Player" },
render_options = { "Render Options" },
reverb = { "Reverb" },
revolver = { "Revolver" }, revolver = { "Revolver" },
revolver_ammo = { "Revolver Ammo" }, revolver_ammo = { "Revolver Ammo" },
revolver_lasersight = { "Revolver + Lasersight" }, revolver_lasersight = { "Revolver + Lasersight" },
rocket_launcher_ammo = { "Rocket Launcher Ammo" },
rocket_launcher = { "Rocket Launcher" }, rocket_launcher = { "Rocket Launcher" },
rumble = { "Rumble" }, rocket_launcher_ammo = { "Rocket Launcher Ammo" },
subtitles = { "Subtitles" },
save_game = { "Save Game" },
savegame_timestamp = { "%02d Days %02d:%02d:%02d" },
screen_resolution = { "Screen Resolution" },
level_secrets_found = { "Secrets Found in Level" },
total_secrets_found = { "Secrets Found Total" },
select_level = { "Select Level" },
separate = { "Separate" },
sfx_volume = { "SFX Volume" },
shadows = { "Shadows" },
shotgun = { "Shotgun" }, shotgun = { "Shotgun" },
shotgun_normal_ammo = { "Shotgun Normal Ammo" }, shotgun_normal_ammo = { "Shotgun Normal Ammo" },
shotgun_wideshot_ammo = { "Shotgun Wideshot Ammo" }, shotgun_wideshot_ammo = { "Shotgun Wideshot Ammo" },
small_medipack = { "Small Medipack" },
sound = { "Sound" },
silencer = { "Silencer" }, silencer = { "Silencer" },
view = { "View" }, small_medipack = { "Small Medipack" },
thumbstick_camera = { "Thumbstick Camera" },
time_taken = { "Time Taken" },
statistics = { "Statistics" },
target_highlighter = { "Target Highlighter" },
torch = { "Torch" }, torch = { "Torch" },
empty = { "Empty" },
use = { "Use" },
ammo_used = { "Ammo Used" },
used_medipacks = { "Medipacks Used" },
uzi_ammo = { "Uzi Ammo" }, uzi_ammo = { "Uzi Ammo" },
uzis = { "Uzis" }, uzis = { "Uzis" },
volumetric_fog = { "Volumetric Fog" },
antialiasing = { "Antialiasing" },
low = { "Low" },
medium = { "Medium" },
high = { "High" },
waiting_for_input = { "Waiting For Input" },
windowed = { "Windowed" },
load_game = { "Load Game" },
quick_actions = { "Quick Actions" },
vehicle_actions = { "Vehicle Actions" },
test_level = { "Test Level" },
torch2 = { "Torch 2" },
waterskin_small_empty = { "Small Waterskin (Empty)" },
waterskin_small_1l = { "Small Waterskin (1L)" },
waterskin_small_2l = { "Small Waterskin (2L)" },
waterskin_small_3l = { "Small Waterskin (3L)" },
waterskin_large_empty = { "Large Waterskin (Empty)" },
waterskin_large_1l = { "Large Waterskin (1L)" }, waterskin_large_1l = { "Large Waterskin (1L)" },
waterskin_large_2l = { "Large Waterskin (2L)" }, waterskin_large_2l = { "Large Waterskin (2L)" },
waterskin_large_3l = { "Large Waterskin (3L)" }, waterskin_large_3l = { "Large Waterskin (3L)" },
waterskin_large_4l = { "Large Waterskin (4L)" }, waterskin_large_4l = { "Large Waterskin (4L)" },
waterskin_large_5l = { "Large Waterskin (5L)" }, waterskin_large_5l = { "Large Waterskin (5L)" },
window_title = { "TombEngine" }, waterskin_large_empty = { "Large Waterskin (Empty)" },
mechanical_scarab = { "Mechanical Scarab With Winding Key" }, waterskin_small_1l = { "Small Waterskin (1L)" },
mechanical_scarab_1 = { "Mechanical Scarab (No Winding Key)" }, waterskin_small_2l = { "Small Waterskin (2L)" },
mechanical_scarab_2 = { "Mechanical Scarab Winding Key" }, waterskin_small_3l = { "Small Waterskin (3L)" },
title = { "Title" } waterskin_small_empty = { "Small Waterskin (Empty)" },
} }
TEN.Flow.SetStrings(strings) TEN.Flow.SetStrings(strings)
local languages =
{
"English",
"Italian",
"German",
"French",
"Dutch",
"Spanish",
"Japanese",
"Russian"
}
TEN.Flow.SetLanguageNames(languages)

132
Scripts/SystemStrings.lua Normal file
View file

@ -0,0 +1,132 @@
--[[
NOTE: It's possible to expand string entry tables with extra language variations
corresponding to languages in the table at the end of this file.
--]]
local strings =
{
actions_accelerate = { "Accelerate" },
actions_action = { "Action" },
actions_backward = { "Backward" },
actions_brake = { "Brake/Dismount" },
actions_crouch = { "Crouch" },
actions_deselect = { "Deselect" },
actions_draw = { "Draw" },
actions_fire = { "Fire" },
actions_flare = { "Flare" },
actions_forward = { "Forward" },
actions_inventory = { "Inventory" },
actions_jump = { "Jump" },
actions_large_medipack = { "Large Medipack" },
actions_left = { "Left" },
actions_load = { "Load" },
actions_look = { "Look" },
actions_next_weapon = { "Next Weapon" },
actions_pause = { "Pause" },
actions_previous_weapon = { "Previous Weapon" },
actions_reverse = { "Reverse" },
actions_right = { "Right" },
actions_roll = { "Roll" },
actions_save = { "Save" },
actions_select = { "Select" },
actions_slow = { "Slow" },
actions_small_medipack = { "Small Medipack" },
actions_speed = { "Speed" },
actions_sprint = { "Sprint" },
actions_step_left = { "Step Left" },
actions_step_right = { "Step Right" },
actions_walk = { "Walk" },
actions_weapon_1 = { "Weapon 1" },
actions_weapon_10 = { "Weapon 10" },
actions_weapon_2 = { "Weapon 2" },
actions_weapon_3 = { "Weapon 3" },
actions_weapon_4 = { "Weapon 4" },
actions_weapon_5 = { "Weapon 5" },
actions_weapon_6 = { "Weapon 6" },
actions_weapon_7 = { "Weapon 7" },
actions_weapon_8 = { "Weapon 8" },
actions_weapon_9 = { "Weapon 9" },
all = { "All" },
ammo_used = { "Ammo Used" },
antialiasing = { "Antialiasing" },
apply = { "Apply" },
auto_target = { "Automatic Targeting" },
back = { "Back" },
cancel = { "Cancel" },
caustics = { "Underwater Caustics" },
choose_ammo = { "Choose Ammo" },
choose_weapon = { "Choose Weapon" },
close = { "Close" },
combine = { "Combine" },
combine_with = { "Combine With" },
controls = { "Controls" },
disabled = { "Disabled" },
display = { "Display Settings" },
display_adapter = { "Display Adapter" },
distance_travelled = { "Distance Travelled" },
empty = { "Empty" },
enable_sound = { "Enable Sounds" },
enabled = { "Enabled" },
equip = { "Equip" },
examine = { "Examine" },
exit_game = { "Exit Game" },
exit_to_title = { "Exit to Title" },
general_actions = { "General Actions"},
high = { "High" },
level_secrets_found = { "Secrets Found in Level" },
load_game = { "Load Game" },
low = { "Low" },
medium = { "Medium" },
menu_actions = { "Menu Actions" },
music_volume = { "Music Volume" },
new_game = { "New Game" },
none = { "None" },
ok = { "OK" },
options = { "Options" },
other_settings = { "Sound and Gameplay" },
output_settings = { "Output Settings" },
player = { "Player" },
quick_actions = { "Quick Actions" },
render_options = { "Render Options" },
reset_to_defaults = { "Reset to Defaults" },
reverb = { "Reverb" },
rumble = { "Rumble" },
save_game = { "Save Game" },
savegame_timestamp = { "%02d Days %02d:%02d:%02d" },
screen_resolution = { "Screen Resolution" },
select_level = { "Select Level" },
separate = { "Separate" },
sfx_volume = { "SFX Volume" },
shadows = { "Shadows" },
sound = { "Sound" },
statistics = { "Statistics" },
subtitles = { "Subtitles" },
target_highlighter = { "Target Highlighter" },
thumbstick_camera = { "Thumbstick Camera" },
time_taken = { "Time Taken" },
total_secrets_found = { "Secrets Found Total" },
use = { "Use" },
used_medipacks = { "Medipacks Used" },
vehicle_actions = { "Vehicle Actions" },
view = { "View" },
volumetric_fog = { "Volumetric Fog" },
waiting_for_input = { "Waiting For Input" },
window_title = { "TombEngine" },
windowed = { "Windowed" },
}
TEN.Flow.SetStrings(strings)
local languages =
{
"English",
"Italian",
"German",
"French",
"Dutch",
"Spanish",
"Japanese",
"Russian"
}
TEN.Flow.SetLanguageNames(languages)

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "framework.h" #include "framework.h"
#include <filesystem>
#include "Scripting/Internal/LuaHandler.h" #include "Scripting/Internal/LuaHandler.h"
LuaHandler::LuaHandler(sol::state* lua) : m_lua{ lua } LuaHandler::LuaHandler(sol::state* lua) : m_lua{ lua }
@ -16,8 +18,11 @@ void LuaHandler::ResetGlobals()
m_lua->set(sol::metatable_key, mt); m_lua->set(sol::metatable_key, mt);
} }
void LuaHandler::ExecuteScript(const std::string& luaFilename) void LuaHandler::ExecuteScript(const std::string& luaFilename, bool isOptional)
{ {
if (isOptional && !std::filesystem::is_regular_file(luaFilename))
return;
auto result = m_lua->safe_script_file(luaFilename, sol::script_pass_on_error); auto result = m_lua->safe_script_file(luaFilename, sol::script_pass_on_error);
if (!result.valid()) if (!result.valid())
{ {

View file

@ -15,7 +15,7 @@ public:
LuaHandler& operator=(const LuaHandler&) = delete; LuaHandler& operator=(const LuaHandler&) = delete;
~LuaHandler() = default; ~LuaHandler() = default;
void ExecuteScript(const std::string& luaFilename); void ExecuteScript(const std::string& luaFilename, bool isOptional = false);
void ExecuteString(const std::string& command); void ExecuteString(const std::string& command);
void ResetGlobals(); void ResetGlobals();

View file

@ -215,8 +215,8 @@ Specify which translations in the strings table correspond to which languages.
FlowHandler::~FlowHandler() FlowHandler::~FlowHandler()
{ {
for (auto& lev : Levels) for (auto& level : Levels)
delete lev; delete level;
} }
std::string FlowHandler::GetGameDir() std::string FlowHandler::GetGameDir()
@ -229,14 +229,22 @@ void FlowHandler::SetGameDir(const std::string& assetDir)
m_gameDir = assetDir; m_gameDir = assetDir;
} }
void FlowHandler::SetLanguageNames(sol::as_table_t<std::vector<std::string>> && src) void FlowHandler::SetLanguageNames(sol::as_table_t<std::vector<std::string>>&& src)
{ {
m_languageNames = std::move(src); m_languageNames = std::move(src);
} }
void FlowHandler::SetStrings(sol::nested<std::unordered_map<std::string, std::vector<std::string>>>&& src) void FlowHandler::SetStrings(sol::nested<std::unordered_map<std::string, std::vector<std::string>>>&& src)
{ {
m_translationsMap = std::move(src); if (m_translationsMap.empty())
{
m_translationsMap = std::move(src);
}
else
{
for (auto& stringPair : src.value())
m_translationsMap.insert_or_assign(stringPair.first, stringPair.second);
}
} }
void FlowHandler::SetSettings(Settings const & src) void FlowHandler::SetSettings(Settings const & src)
@ -272,8 +280,9 @@ void FlowHandler::SetTotalSecretCount(int secretsNumber)
void FlowHandler::LoadFlowScript() void FlowHandler::LoadFlowScript()
{ {
m_handler.ExecuteScript(m_gameDir + "Scripts/Gameflow.lua"); m_handler.ExecuteScript(m_gameDir + "Scripts/Gameflow.lua");
m_handler.ExecuteScript(m_gameDir + "Scripts/Strings.lua"); m_handler.ExecuteScript(m_gameDir + "Scripts/SystemStrings.lua");
m_handler.ExecuteScript(m_gameDir + "Scripts/Settings.lua"); m_handler.ExecuteScript(m_gameDir + "Scripts/Strings.lua", true);
m_handler.ExecuteScript(m_gameDir + "Scripts/Settings.lua", true);
SetScriptErrorMode(GetSettings()->ErrorMode); SetScriptErrorMode(GetSettings()->ErrorMode);

View file

@ -1,5 +1,4 @@
#pragma once #pragma once
#include <string_view> #include <string_view>
#include "Scripting/Internal/LanguageScript.h" #include "Scripting/Internal/LanguageScript.h"
@ -15,26 +14,26 @@
class FlowHandler : public ScriptInterfaceFlowHandler class FlowHandler : public ScriptInterfaceFlowHandler
{ {
private: private:
Settings m_settings; Settings m_settings;
std::unordered_map < std::string, std::vector<std::string > > m_translationsMap; std::unordered_map<std::string, std::vector<std::string>> m_translationsMap;
std::vector<std::string> m_languageNames; std::vector<std::string> m_languageNames;
std::map<short, short> m_itemsMap; std::map<short, short> m_itemsMap;
std::string m_gameDir; std::string m_gameDir;
LuaHandler m_handler; LuaHandler m_handler;
public: public:
int FogInDistance{ 0 }; int FogInDistance{ 0 };
int FogOutDistance{ 0 }; int FogOutDistance{ 0 };
bool LevelSelect{ true }; bool LevelSelect{ true };
bool FlyCheat{ true }; bool FlyCheat{ true };
bool PointFilter{ false }; bool PointFilter{ false };
bool MassPickup{ true }; bool MassPickup{ true };
bool LaraInTitle{ false }; bool LaraInTitle{ false };
bool DebugMode{ false }; bool DebugMode{ false };
// New animation flag table // New animation flag table
Animations Anims{}; Animations Anims{};