Rework menu option looping (#1393)

* Remove menu loop

* Update CHANGELOG.md

* Update config

* Implement new menu logic

* Remove mouse smoothing

* Update Input.cpp

* Allow 3 options for menu looping

* Name adjustment

* Rename RegKey

* String key rename

* General refactors

* Change default menu looping mode

* Update configuration.h

---------

Co-authored-by: Sezz <sezzary@outlook.com>
This commit is contained in:
Kewin Kupilas 2024-08-11 09:59:56 +01:00 committed by GitHub
parent 046e0b26ac
commit 0628affb69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 182 additions and 253 deletions

View file

@ -41,7 +41,8 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
- Quicksand - sound effect plays when a moveable is in quicksand. - Quicksand - sound effect plays when a moveable is in quicksand.
- Underwater - sound plays when the camera is submerged. - Underwater - sound plays when the camera is submerged.
* Changed Water sound condition to ShallowWater. * Changed Water sound condition to ShallowWater.
* Added option to enable or disable menu option looping.
* Menu scrolling using held inputs will stop at the last option until a new input is made.
### Lua API changes ### Lua API changes
* Added Inventory.GetUsedItem(), Inventory.SetUsedItem() and Inventory.ClearUsedItem() functions. * Added Inventory.GetUsedItem(), Inventory.SetUsedItem() and Inventory.ClearUsedItem() functions.

View file

@ -80,8 +80,11 @@ local strings =
low = { "Low" }, low = { "Low" },
medium = { "Medium" }, medium = { "Medium" },
menu_actions = { "Menu Actions" }, menu_actions = { "Menu Actions" },
menu_option_looping = { "Menu Option Looping" },
menu_option_looping_all_menus = { "All Menus" },
menu_option_looping_disabled = { "Disabled" },
menu_option_looping_save_load_only = { "Save/Load Only" },
mouse_sensitivity = { "Mouse Sensitivity" }, mouse_sensitivity = { "Mouse Sensitivity" },
mouse_smoothing = { "Mouse Smoothing" },
music_volume = { "Music Volume" }, music_volume = { "Music Volume" },
new_game = { "New Game" }, new_game = { "New Game" },
none = { "None" }, none = { "None" },

View file

@ -173,7 +173,7 @@ namespace TEN::Gui
return ((IsReleased(In::Select) || IsReleased(In::Action)) && CanSelect()); return ((IsReleased(In::Select) || IsReleased(In::Action)) && CanSelect());
} }
} }
bool GuiController::GuiIsDeselected() const bool GuiController::GuiIsDeselected() const
{ {
return ((IsClicked(In::Deselect) || IsClicked(In::Draw)) && CanDeselect()); return ((IsClicked(In::Deselect) || IsClicked(In::Draw)) && CanDeselect());
@ -354,21 +354,7 @@ namespace TEN::Gui
MenuToDisplay == Menu::SelectLevel || MenuToDisplay == Menu::SelectLevel ||
MenuToDisplay == Menu::Options) MenuToDisplay == Menu::Options)
{ {
if (GuiIsPulsed(In::Forward)) SelectedOption = GetLoopedSelectedOption(SelectedOption, OptionCount, g_Configuration.MenuOptionLoopingMode == MenuOptionLoopingMode::AllMenus);
{
SelectedOption = (SelectedOption <= 0) ? OptionCount : (SelectedOption - 1);
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
}
if (GuiIsPulsed(In::Back))
{
if (SelectedOption < OptionCount)
SelectedOption++;
else
SelectedOption -= OptionCount;
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
}
if (GuiIsDeselected() && MenuToDisplay != Menu::Title) if (GuiIsDeselected() && MenuToDisplay != Menu::Title)
{ {
@ -577,25 +563,7 @@ namespace TEN::Gui
} }
} }
if (GuiIsPulsed(In::Forward)) SelectedOption = GetLoopedSelectedOption(SelectedOption, OptionCount, g_Configuration.MenuOptionLoopingMode == MenuOptionLoopingMode::AllMenus);
{
if (SelectedOption <= 0)
SelectedOption += OptionCount;
else
SelectedOption--;
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
}
if (GuiIsPulsed(In::Back))
{
if (SelectedOption < OptionCount)
SelectedOption++;
else
SelectedOption -= OptionCount;
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
}
if (GuiIsSelected()) if (GuiIsSelected())
{ {
@ -612,7 +580,7 @@ namespace TEN::Gui
SaveConfiguration(); SaveConfiguration();
// Reset screen and go back. // Reset screen and go back.
g_Renderer.ChangeScreenResolution(CurrentSettings.Configuration.ScreenWidth, CurrentSettings.Configuration.ScreenHeight, g_Renderer.ChangeScreenResolution(CurrentSettings.Configuration.ScreenWidth, CurrentSettings.Configuration.ScreenHeight,
CurrentSettings.Configuration.EnableWindowedMode); CurrentSettings.Configuration.EnableWindowedMode);
MenuToDisplay = fromPauseMenu ? Menu::Pause : Menu::Options; MenuToDisplay = fromPauseMenu ? Menu::Pause : Menu::Options;
@ -743,25 +711,7 @@ namespace TEN::Gui
} }
else else
{ {
if (GuiIsPulsed(In::Forward)) SelectedOption = GetLoopedSelectedOption(SelectedOption, OptionCount, g_Configuration.MenuOptionLoopingMode == MenuOptionLoopingMode::AllMenus);
{
if (SelectedOption <= 0)
SelectedOption += OptionCount;
else
SelectedOption--;
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
}
if (GuiIsPulsed(In::Back))
{
if (SelectedOption < OptionCount)
SelectedOption++;
else
SelectedOption -= OptionCount;
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
}
// HACK: Menu screen scroll. // HACK: Menu screen scroll.
if (GuiIsPulsed(In::Left) || GuiIsPulsed(In::Right)) if (GuiIsPulsed(In::Left) || GuiIsPulsed(In::Right))
@ -893,8 +843,9 @@ namespace TEN::Gui
TargetHighlighter, TargetHighlighter,
ToggleRumble, ToggleRumble,
ThumbstickCameraControl, ThumbstickCameraControl,
MouseSensitivity, MouseSensitivity,
MouseSmoothing, MenuOptionLooping,
Apply, Apply,
Cancel, Cancel,
@ -929,7 +880,7 @@ namespace TEN::Gui
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always); SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
CurrentSettings.Configuration.EnableAutoMonkeySwingJump = !CurrentSettings.Configuration.EnableAutoMonkeySwingJump; CurrentSettings.Configuration.EnableAutoMonkeySwingJump = !CurrentSettings.Configuration.EnableAutoMonkeySwingJump;
break; break;
case OtherSettingsOption::Subtitles: case OtherSettingsOption::Subtitles:
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always); SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
CurrentSettings.Configuration.EnableSubtitles = !CurrentSettings.Configuration.EnableSubtitles; CurrentSettings.Configuration.EnableSubtitles = !CurrentSettings.Configuration.EnableSubtitles;
@ -944,7 +895,7 @@ namespace TEN::Gui
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always); SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
CurrentSettings.Configuration.EnableTargetHighlighter = !CurrentSettings.Configuration.EnableTargetHighlighter; CurrentSettings.Configuration.EnableTargetHighlighter = !CurrentSettings.Configuration.EnableTargetHighlighter;
break; break;
case OtherSettingsOption::ToggleRumble: case OtherSettingsOption::ToggleRumble:
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always); SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
CurrentSettings.Configuration.EnableRumble = !CurrentSettings.Configuration.EnableRumble; CurrentSettings.Configuration.EnableRumble = !CurrentSettings.Configuration.EnableRumble;
@ -1000,14 +951,23 @@ namespace TEN::Gui
break; break;
case OtherSettingsOption::MouseSmoothing: case OtherSettingsOption::MenuOptionLooping:
if (CurrentSettings.Configuration.MouseSmoothing > MOUSE_SMOOTHING_MIN) SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
{
CurrentSettings.Configuration.MouseSmoothing -= 1;
if (CurrentSettings.Configuration.MouseSmoothing < MOUSE_SMOOTHING_MIN)
CurrentSettings.Configuration.MouseSmoothing = MOUSE_SMOOTHING_MIN;
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always); switch (CurrentSettings.Configuration.MenuOptionLoopingMode)
{
default:
case MenuOptionLoopingMode::AllMenus:
CurrentSettings.Configuration.MenuOptionLoopingMode = MenuOptionLoopingMode::Disabled;
break;
case MenuOptionLoopingMode::SaveLoadOnly:
CurrentSettings.Configuration.MenuOptionLoopingMode = MenuOptionLoopingMode::AllMenus;
break;
case MenuOptionLoopingMode::Disabled:
CurrentSettings.Configuration.MenuOptionLoopingMode = MenuOptionLoopingMode::SaveLoadOnly;
break;
} }
break; break;
@ -1063,14 +1023,23 @@ namespace TEN::Gui
break; break;
case OtherSettingsOption::MouseSmoothing: case OtherSettingsOption::MenuOptionLooping:
if (CurrentSettings.Configuration.MouseSmoothing < MOUSE_SMOOTHING_MAX) SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
switch (CurrentSettings.Configuration.MenuOptionLoopingMode)
{ {
CurrentSettings.Configuration.MouseSmoothing += 1; default:
if (CurrentSettings.Configuration.MouseSmoothing > MOUSE_SMOOTHING_MAX) case MenuOptionLoopingMode::AllMenus:
CurrentSettings.Configuration.MouseSmoothing = MOUSE_SMOOTHING_MAX; CurrentSettings.Configuration.MenuOptionLoopingMode = MenuOptionLoopingMode::SaveLoadOnly;
break;
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always); case MenuOptionLoopingMode::SaveLoadOnly:
CurrentSettings.Configuration.MenuOptionLoopingMode = MenuOptionLoopingMode::Disabled;
break;
case MenuOptionLoopingMode::Disabled:
CurrentSettings.Configuration.MenuOptionLoopingMode = MenuOptionLoopingMode::AllMenus;
break;
} }
break; break;
@ -1083,33 +1052,7 @@ namespace TEN::Gui
} }
} }
if (GuiIsPulsed(In::Forward)) SelectedOption = GetLoopedSelectedOption(SelectedOption, OptionCount, g_Configuration.MenuOptionLoopingMode == MenuOptionLoopingMode::AllMenus);
{
if (SelectedOption <= 0)
{
SelectedOption += OptionCount;
}
else
{
SelectedOption--;
}
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
}
if (GuiIsPulsed(In::Back))
{
if (SelectedOption < OptionCount)
{
SelectedOption++;
}
else
{
SelectedOption -= OptionCount;
}
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
}
if (GuiIsSelected()) if (GuiIsSelected())
{ {
@ -1191,25 +1134,7 @@ namespace TEN::Gui
if (MenuToDisplay == Menu::Pause || if (MenuToDisplay == Menu::Pause ||
MenuToDisplay == Menu::Options) MenuToDisplay == Menu::Options)
{ {
if (GuiIsPulsed(In::Forward)) SelectedOption = GetLoopedSelectedOption(SelectedOption, OptionCount, g_Configuration.MenuOptionLoopingMode == MenuOptionLoopingMode::AllMenus);
{
if (SelectedOption <= 0)
SelectedOption += OptionCount;
else
SelectedOption--;
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
}
if (GuiIsPulsed(In::Back))
{
if (SelectedOption < OptionCount)
SelectedOption++;
else
SelectedOption -= OptionCount;
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
}
} }
if (GuiIsDeselected() || IsClicked(In::Pause)) if (GuiIsDeselected() || IsClicked(In::Pause))
@ -1409,7 +1334,7 @@ namespace TEN::Gui
if (Rings[(int)RingTypes::Ammo].RingActive) if (Rings[(int)RingTypes::Ammo].RingActive)
return; return;
AmmoObjectList[0].Orientation = EulerAngles::Identity; AmmoObjectList[0].Orientation = EulerAngles::Identity;
AmmoObjectList[1].Orientation = EulerAngles::Identity; AmmoObjectList[1].Orientation = EulerAngles::Identity;
AmmoObjectList[2].Orientation = EulerAngles::Identity; AmmoObjectList[2].Orientation = EulerAngles::Identity;
@ -1903,7 +1828,7 @@ namespace TEN::Gui
{ {
Ammo.AmountShotGunAmmo2 = lara->Weapons[(int)LaraWeaponType::Shotgun].Ammo[1].GetCount() / 6; Ammo.AmountShotGunAmmo2 = lara->Weapons[(int)LaraWeaponType::Shotgun].Ammo[1].GetCount() / 6;
} }
Ammo.AmountShotGunAmmo1 = lara->Weapons[(int)LaraWeaponType::Shotgun].Ammo[(int)WeaponAmmoType::Ammo1].HasInfinite() ? -1 : lara->Weapons[(int)LaraWeaponType::Shotgun].Ammo[(int)WeaponAmmoType::Ammo1].GetCount(); Ammo.AmountShotGunAmmo1 = lara->Weapons[(int)LaraWeaponType::Shotgun].Ammo[(int)WeaponAmmoType::Ammo1].HasInfinite() ? -1 : lara->Weapons[(int)LaraWeaponType::Shotgun].Ammo[(int)WeaponAmmoType::Ammo1].GetCount();
Ammo.AmountShotGunAmmo2 = lara->Weapons[(int)LaraWeaponType::Shotgun].Ammo[(int)WeaponAmmoType::Ammo2].HasInfinite() ? -1 : lara->Weapons[(int)LaraWeaponType::Shotgun].Ammo[(int)WeaponAmmoType::Ammo2].GetCount(); Ammo.AmountShotGunAmmo2 = lara->Weapons[(int)LaraWeaponType::Shotgun].Ammo[(int)WeaponAmmoType::Ammo2].HasInfinite() ? -1 : lara->Weapons[(int)LaraWeaponType::Shotgun].Ammo[(int)WeaponAmmoType::Ammo2].GetCount();
Ammo.AmountHKAmmo1 = lara->Weapons[(int)LaraWeaponType::HK].Ammo[(int)WeaponAmmoType::Ammo1].HasInfinite() ? -1 : lara->Weapons[(int)LaraWeaponType::HK].Ammo[(int)WeaponAmmoType::Ammo1].GetCount(); Ammo.AmountHKAmmo1 = lara->Weapons[(int)LaraWeaponType::HK].Ammo[(int)WeaponAmmoType::Ammo1].HasInfinite() ? -1 : lara->Weapons[(int)LaraWeaponType::HK].Ammo[(int)WeaponAmmoType::Ammo1].GetCount();
@ -2108,7 +2033,7 @@ namespace TEN::Gui
{ {
player.Control.HandStatus = HandStatus::WeaponDraw; player.Control.HandStatus = HandStatus::WeaponDraw;
} }
InventoryItemChosen = NO_VALUE; InventoryItemChosen = NO_VALUE;
return; return;
} }
@ -2515,51 +2440,10 @@ namespace TEN::Gui
!invRing.ObjectListMovement && !invRing.ObjectListMovement &&
!ammoRing.ObjectListMovement) !ammoRing.ObjectListMovement)
{ {
CurrentSelectedOption = GetLoopedSelectedOption(CurrentSelectedOption, n - 1, g_Configuration.MenuOptionLoopingMode == MenuOptionLoopingMode::AllMenus);
if (AmmoActive) if (AmmoActive)
{
if (GuiIsPulsed(In::Forward))
{
if (CurrentSelectedOption <= 0)
CurrentSelectedOption = n - 1;
else
CurrentSelectedOption--;
SoundEffect(SFX_TR4_MENU_SELECT, nullptr, SoundEnvironment::Always);
}
if (GuiIsPulsed(In::Back))
{
if (CurrentSelectedOption >= (n - 1))
CurrentSelectedOption = 0;
else
CurrentSelectedOption++;
SoundEffect(SFX_TR4_MENU_SELECT, nullptr, SoundEnvironment::Always);
}
*CurrentAmmoType = CurrentSelectedOption; *CurrentAmmoType = CurrentSelectedOption;
}
else
{
if (GuiIsPulsed(In::Forward))
{
if (CurrentSelectedOption <= 0)
CurrentSelectedOption = n - 1;
else
CurrentSelectedOption--;
SoundEffect(SFX_TR4_MENU_SELECT, nullptr, SoundEnvironment::Always);
}
else if (GuiIsPulsed(In::Back))
{
if (CurrentSelectedOption >= (n - 1))
CurrentSelectedOption = 0;
else
CurrentSelectedOption++;
SoundEffect(SFX_TR4_MENU_SELECT, nullptr, SoundEnvironment::Always);
}
}
if (GuiIsSelected(false)) if (GuiIsSelected(false))
{ {
@ -2719,7 +2603,7 @@ namespace TEN::Gui
{ {
if (!AmmoSelectorFlag) if (!AmmoSelectorFlag)
return; return;
int xPos = (2 * PHD_CENTER_X - OBJLIST_SPACING) / 2; int xPos = (2 * PHD_CENTER_X - OBJLIST_SPACING) / 2;
if (NumAmmoSlots == 2) if (NumAmmoSlots == 2)
xPos -= OBJLIST_SPACING / 2; xPos -= OBJLIST_SPACING / 2;
@ -2767,7 +2651,7 @@ namespace TEN::Gui
// CHECK: AmmoSelectorFadeVal is never true and therefore the string is never printed. // CHECK: AmmoSelectorFadeVal is never true and therefore the string is never printed.
//if (AmmoSelectorFadeVal) //if (AmmoSelectorFadeVal)
g_Renderer.AddString(PHD_CENTER_X, 380, &invTextBuffer[0], PRINTSTRING_COLOR_YELLOW, (int)PrintStringFlags::Center | (int)PrintStringFlags::Outline); g_Renderer.AddString(PHD_CENTER_X, 380, &invTextBuffer[0], PRINTSTRING_COLOR_YELLOW, (int)PrintStringFlags::Center | (int)PrintStringFlags::Outline);
if (n == *CurrentAmmoType) if (n == *CurrentAmmoType)
g_Renderer.DrawObjectIn2DSpace(objectNumber, Vector2(x, y), AmmoObjectList[n].Orientation, scaler); g_Renderer.DrawObjectIn2DSpace(objectNumber, Vector2(x, y), AmmoObjectList[n].Orientation, scaler);
else else
@ -3459,27 +3343,49 @@ namespace TEN::Gui
return SelectedSaveSlot; return SelectedSaveSlot;
} }
LoadResult GuiController::DoLoad() int GuiController::GetLoopedSelectedOption(int selectedOption, int optionCount, bool canLoop)
{ {
if (GuiIsPulsed(In::Back))
{
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
if (SelectedSaveSlot == (SAVEGAME_MAX - 1))
SelectedSaveSlot -= SAVEGAME_MAX - 1;
else
SelectedSaveSlot++;
}
if (GuiIsPulsed(In::Forward)) if (GuiIsPulsed(In::Forward))
{ {
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always); if (selectedOption <= 0)
{
if (SelectedSaveSlot == 0) if (IsClicked(In::Forward) && canLoop)
SelectedSaveSlot += SAVEGAME_MAX - 1; {
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
return optionCount;
}
}
else else
SelectedSaveSlot--; {
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
return (selectedOption - 1);
}
} }
else if (GuiIsPulsed(In::Back))
{
if (selectedOption >= optionCount)
{
if (IsClicked(In::Back) && canLoop)
{
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
return 0;
}
}
else
{
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
return (selectedOption + 1);
}
}
return selectedOption;
}
LoadResult GuiController::DoLoad()
{
bool canLoop = g_Configuration.MenuOptionLoopingMode == MenuOptionLoopingMode::SaveLoadOnly ||
g_Configuration.MenuOptionLoopingMode == MenuOptionLoopingMode::AllMenus;
SelectedSaveSlot = GetLoopedSelectedOption(SelectedSaveSlot, SAVEGAME_MAX - 1, canLoop);
if (GuiIsSelected()) if (GuiIsSelected())
{ {
@ -3501,25 +3407,9 @@ namespace TEN::Gui
bool GuiController::DoSave() bool GuiController::DoSave()
{ {
if (GuiIsPulsed(In::Back)) bool canLoop = g_Configuration.MenuOptionLoopingMode == MenuOptionLoopingMode::SaveLoadOnly ||
{ g_Configuration.MenuOptionLoopingMode == MenuOptionLoopingMode::AllMenus;
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always); SelectedSaveSlot = GetLoopedSelectedOption(SelectedSaveSlot, SAVEGAME_MAX - 1, canLoop);
if (SelectedSaveSlot == (SAVEGAME_MAX - 1))
SelectedSaveSlot -= SAVEGAME_MAX - 1;
else
SelectedSaveSlot++;
}
if (GuiIsPulsed(In::Forward))
{
SoundEffect(SFX_TR4_MENU_CHOOSE, nullptr, SoundEnvironment::Always);
if (SelectedSaveSlot == 0)
SelectedSaveSlot += SAVEGAME_MAX - 1;
else
SelectedSaveSlot--;
}
if (GuiIsSelected()) if (GuiIsSelected())
{ {
@ -3569,7 +3459,7 @@ namespace TEN::Gui
return true; return true;
} }
} }
else else
{ {
// Small one isn't empty and the big one isn't full. // Small one isn't empty and the big one isn't full.
if (lara->Inventory.SmallWaterskin != 1 && bigCapacity) if (lara->Inventory.SmallWaterskin != 1 && bigCapacity)

View file

@ -184,6 +184,7 @@ namespace TEN::Gui
void UseItem(ItemInfo& item, int objectNumber); void UseItem(ItemInfo& item, int objectNumber);
// Getters // Getters
const InventoryRing& GetRing(RingTypes ringType); const InventoryRing& GetRing(RingTypes ringType);
int GetSelectedOption(); int GetSelectedOption();
Menu GetMenuToDisplay(); Menu GetMenuToDisplay();
@ -193,8 +194,10 @@ namespace TEN::Gui
int GetLastInventoryItem(); int GetLastInventoryItem();
SettingsData& GetCurrentSettings(); SettingsData& GetCurrentSettings();
int GetLoadSaveSelection(); int GetLoadSaveSelection();
int GetLoopedSelectedOption(int selectedOption, int optionCount, bool canLoop);
// Setters // Setters
void SetSelectedOption(int menu); void SetSelectedOption(int menu);
void SetMenuToDisplay(Menu menu); void SetMenuToDisplay(Menu menu);
void SetInventoryMode(InventoryMode mode); void SetInventoryMode(InventoryMode mode);

View file

@ -38,7 +38,7 @@ namespace TEN::Renderer
constexpr auto MenuVerticalLineSpacing = 30; constexpr auto MenuVerticalLineSpacing = 30;
constexpr auto MenuVerticalNarrowLineSpacing = 24; constexpr auto MenuVerticalNarrowLineSpacing = 24;
constexpr auto MenuVerticalBlockSpacing = 50; constexpr auto MenuVerticalBlockSpacing = 50;
// Vertical menu positioning templates // Vertical menu positioning templates
constexpr auto MenuVerticalControls = 30; constexpr auto MenuVerticalControls = 30;
constexpr auto MenuVerticalDisplaySettings = 160; constexpr auto MenuVerticalDisplaySettings = 160;
@ -65,10 +65,25 @@ namespace TEN::Renderer
// Helper functions to construct string flags // Helper functions to construct string flags
inline int SF(bool selected = false) { return (int)PrintStringFlags::Outline | (selected ? (int)PrintStringFlags::Blink : 0); } inline int SF(bool selected = false) { return (int)PrintStringFlags::Outline | (selected ? (int)PrintStringFlags::Blink : 0); }
inline int SF_Center(bool selected = false) { return (int)PrintStringFlags::Outline | (int)PrintStringFlags::Center | (selected ? (int)PrintStringFlags::Blink : 0); } inline int SF_Center(bool selected = false) { return (int)PrintStringFlags::Outline | (int)PrintStringFlags::Center | (selected ? (int)PrintStringFlags::Blink : 0); }
// Helper functions to get specific generic strings // Helper functions to get specific generic strings
inline const char* Str_Enabled(bool enabled = false) { return g_GameFlow->GetString(enabled ? STRING_ENABLED : STRING_DISABLED); } inline const std::string Str_Enabled(bool enabled = false) { return g_GameFlow->GetString(enabled ? STRING_ENABLED : STRING_DISABLED); }
inline const char* Str_LoadSave(bool save = false) { return g_GameFlow->GetString(save ? STRING_SAVE_GAME : STRING_LOAD_GAME); } inline const std::string Str_LoadSave(bool save = false) { return g_GameFlow->GetString(save ? STRING_SAVE_GAME : STRING_LOAD_GAME); }
inline const std::string Str_MenuOptionLoopingMode(MenuOptionLoopingMode loopingMode)
{
switch (loopingMode)
{
default:
case MenuOptionLoopingMode::AllMenus:
return g_GameFlow->GetString(STRING_MENU_OPT_LOOP_ALL_MENUS);
case MenuOptionLoopingMode::SaveLoadOnly:
return g_GameFlow->GetString(STRING_MENU_OPT_LOOP_SAVE_LOAD_ONLY);
case MenuOptionLoopingMode::Disabled:
return g_GameFlow->GetString(STRING_MENU_OPT_LOOP_DISABLED);
}
}
// These bars are only used in menus. // These bars are only used in menus.
TEN::Renderer::RendererHudBar* g_MusicVolumeBar = nullptr; TEN::Renderer::RendererHudBar* g_MusicVolumeBar = nullptr;
@ -235,7 +250,7 @@ namespace TEN::Renderer
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_AUTO_MONKEY_SWING_JUMP), PRINTSTRING_COLOR_ORANGE, SF(titleOption == 4)); AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_AUTO_MONKEY_SWING_JUMP), PRINTSTRING_COLOR_ORANGE, SF(titleOption == 4));
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().Configuration.EnableAutoMonkeySwingJump), PRINTSTRING_COLOR_WHITE, SF(titleOption == 4)); AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().Configuration.EnableAutoMonkeySwingJump), PRINTSTRING_COLOR_WHITE, SF(titleOption == 4));
GetNextLinePosition(&y); GetNextLinePosition(&y);
// Auto targeting // Auto targeting
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_AUTO_TARGETING), PRINTSTRING_COLOR_ORANGE, SF(titleOption == 5)); AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_AUTO_TARGETING), PRINTSTRING_COLOR_ORANGE, SF(titleOption == 5));
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().Configuration.EnableAutoTargeting), PRINTSTRING_COLOR_WHITE, SF(titleOption == 5)); AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().Configuration.EnableAutoTargeting), PRINTSTRING_COLOR_WHITE, SF(titleOption == 5));
@ -245,7 +260,7 @@ namespace TEN::Renderer
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_TARGET_HIGHLIGHTER), PRINTSTRING_COLOR_ORANGE, SF(titleOption == 6)); AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_TARGET_HIGHLIGHTER), PRINTSTRING_COLOR_ORANGE, SF(titleOption == 6));
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().Configuration.EnableTargetHighlighter), PRINTSTRING_COLOR_WHITE, SF(titleOption == 6)); AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().Configuration.EnableTargetHighlighter), PRINTSTRING_COLOR_WHITE, SF(titleOption == 6));
GetNextLinePosition(&y); GetNextLinePosition(&y);
// Vibration // Vibration
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_RUMBLE), PRINTSTRING_COLOR_ORANGE, SF(titleOption == 7)); AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_RUMBLE), PRINTSTRING_COLOR_ORANGE, SF(titleOption == 7));
AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().Configuration.EnableRumble), PRINTSTRING_COLOR_WHITE, SF(titleOption == 7)); AddString(MenuRightSideEntry, y, Str_Enabled(g_Gui.GetCurrentSettings().Configuration.EnableRumble), PRINTSTRING_COLOR_WHITE, SF(titleOption == 7));
@ -261,9 +276,9 @@ namespace TEN::Renderer
AddString(MenuRightSideEntry, y, std::to_string(g_Gui.GetCurrentSettings().Configuration.MouseSensitivity).c_str(), PRINTSTRING_COLOR_WHITE, SF(titleOption == 9)); AddString(MenuRightSideEntry, y, std::to_string(g_Gui.GetCurrentSettings().Configuration.MouseSensitivity).c_str(), PRINTSTRING_COLOR_WHITE, SF(titleOption == 9));
GetNextLinePosition(&y); GetNextLinePosition(&y);
// Mouse smoothing // Menu option looping
AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_MOUSE_SMOOTHING), PRINTSTRING_COLOR_ORANGE, SF(titleOption == 10)); AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_MENU_OPT_LOOP), PRINTSTRING_COLOR_ORANGE, SF(titleOption == 10));
AddString(MenuRightSideEntry, y, std::to_string(g_Gui.GetCurrentSettings().Configuration.MouseSmoothing).c_str(), PRINTSTRING_COLOR_WHITE, SF(titleOption == 10)); AddString(MenuRightSideEntry, y, Str_MenuOptionLoopingMode(g_Gui.GetCurrentSettings().Configuration.MenuOptionLoopingMode), PRINTSTRING_COLOR_WHITE, SF(titleOption == 10));
GetNextBlockPosition(&y); GetNextBlockPosition(&y);
// Apply // Apply
@ -605,7 +620,7 @@ namespace TEN::Renderer
char stringBuffer[255]; char stringBuffer[255];
// Title // Title
AddString(MenuCenterEntry, MenuVerticalNarrowLineSpacing, Str_LoadSave(g_Gui.GetInventoryMode() == InventoryMode::Save), AddString(MenuCenterEntry, MenuVerticalNarrowLineSpacing, Str_LoadSave(g_Gui.GetInventoryMode() == InventoryMode::Save),
PRINTSTRING_COLOR_ORANGE, SF_Center()); PRINTSTRING_COLOR_ORANGE, SF_Center());
GetNextBlockPosition(&y); GetNextBlockPosition(&y);
@ -798,7 +813,7 @@ namespace TEN::Renderer
{ {
if (meshBits && !(meshBits & (1 << n))) if (meshBits && !(meshBits & (1 << n)))
continue; continue;
auto* mesh = (*moveableObject).ObjectMeshes[n]; auto* mesh = (*moveableObject).ObjectMeshes[n];
// HACK: Rotate compass needle. // HACK: Rotate compass needle.
@ -823,7 +838,7 @@ namespace TEN::Renderer
_cbItem.UpdateData(_stItem, _context.Get()); _cbItem.UpdateData(_stItem, _context.Get());
BindConstantBufferVS(ConstantBufferRegister::Item, _cbItem.get()); BindConstantBufferVS(ConstantBufferRegister::Item, _cbItem.get());
BindConstantBufferPS(ConstantBufferRegister::Item, _cbItem.get()); BindConstantBufferPS(ConstantBufferRegister::Item, _cbItem.get());
for (const auto& bucket : mesh->Buckets) for (const auto& bucket : mesh->Buckets)
{ {
if (bucket.NumVertices == 0) if (bucket.NumVertices == 0)
@ -835,10 +850,10 @@ namespace TEN::Renderer
BindTexture(TextureRegister::ColorMap, &std::get<0>(_moveablesTextures[bucket.Texture]), SamplerStateRegister::AnisotropicClamp); BindTexture(TextureRegister::ColorMap, &std::get<0>(_moveablesTextures[bucket.Texture]), SamplerStateRegister::AnisotropicClamp);
BindTexture(TextureRegister::NormalMap, &std::get<1>(_moveablesTextures[bucket.Texture]), SamplerStateRegister::AnisotropicClamp); BindTexture(TextureRegister::NormalMap, &std::get<1>(_moveablesTextures[bucket.Texture]), SamplerStateRegister::AnisotropicClamp);
if (bucket.BlendMode != BlendMode::Opaque) if (bucket.BlendMode != BlendMode::Opaque)
Renderer::SetBlendMode(bucket.BlendMode, true); Renderer::SetBlendMode(bucket.BlendMode, true);
SetAlphaTest( SetAlphaTest(
(bucket.BlendMode == BlendMode::AlphaTest) ? AlphaTestMode::GreatherThan : AlphaTestMode::None, (bucket.BlendMode == BlendMode::AlphaTest) ? AlphaTestMode::GreatherThan : AlphaTestMode::None,
ALPHA_TEST_THRESHOLD); ALPHA_TEST_THRESHOLD);
@ -1104,9 +1119,9 @@ namespace TEN::Renderer
{ {
_context->ClearDepthStencilView(_backBuffer.DepthStencilView.Get(), D3D11_CLEAR_STENCIL | D3D11_CLEAR_DEPTH, 1.0f, 0); _context->ClearDepthStencilView(_backBuffer.DepthStencilView.Get(), D3D11_CLEAR_STENCIL | D3D11_CLEAR_DEPTH, 1.0f, 0);
_context->ClearRenderTargetView(_backBuffer.RenderTargetView.Get(), Colors::Black); _context->ClearRenderTargetView(_backBuffer.RenderTargetView.Get(), Colors::Black);
RenderInventoryScene(&_backBuffer, &_dumpScreenRenderTarget, 0.5f); RenderInventoryScene(&_backBuffer, &_dumpScreenRenderTarget, 0.5f);
_swapChain->Present(0, 0); _swapChain->Present(0, 0);
} }
@ -1171,14 +1186,14 @@ namespace TEN::Renderer
PrintDebugMessage(" CheckPortal() calls: %d", _numCheckPortalCalls); PrintDebugMessage(" CheckPortal() calls: %d", _numCheckPortalCalls);
PrintDebugMessage(" GetVisibleRooms() calls: %d", _numGetVisibleRoomsCalls); PrintDebugMessage(" GetVisibleRooms() calls: %d", _numGetVisibleRoomsCalls);
PrintDebugMessage(" Dot products: %d", _numDotProducts); PrintDebugMessage(" Dot products: %d", _numDotProducts);
_spriteBatch->Begin(SpriteSortMode_Deferred, _renderStates->Opaque()); _spriteBatch->Begin(SpriteSortMode_Deferred, _renderStates->Opaque());
rect.left = _screenWidth - thumbWidth; rect.left = _screenWidth - thumbWidth;
rect.top = thumbY; rect.top = thumbY;
rect.right = rect.left+ thumbWidth; rect.right = rect.left+ thumbWidth;
rect.bottom = rect.top+thumbWidth / aspectRatio; rect.bottom = rect.top+thumbWidth / aspectRatio;
_spriteBatch->Draw(_normalsRenderTarget.ShaderResourceView.Get(), rect); _spriteBatch->Draw(_normalsRenderTarget.ShaderResourceView.Get(), rect);
thumbY += thumbWidth / aspectRatio; thumbY += thumbWidth / aspectRatio;
@ -1194,7 +1209,7 @@ namespace TEN::Renderer
_spriteBatch->Draw(_SSAOBlurredRenderTarget.ShaderResourceView.Get(), rect); _spriteBatch->Draw(_SSAOBlurredRenderTarget.ShaderResourceView.Get(), rect);
thumbY += thumbWidth / aspectRatio; thumbY += thumbWidth / aspectRatio;
if (g_Configuration.AntialiasingMode > AntialiasingMode::Low) if (g_Configuration.AntialiasingMode > AntialiasingMode::Low)
{ {
rect.left = _screenWidth - thumbWidth; rect.left = _screenWidth - thumbWidth;
@ -1265,7 +1280,7 @@ namespace TEN::Renderer
if (action.IsReleased()) if (action.IsReleased())
releasedActions.Set((int)action.GetID()); releasedActions.Set((int)action.GetID());
} }
PrintDebugMessage("INPUT STATS"); PrintDebugMessage("INPUT STATS");
PrintDebugMessage(("Clicked actions: " + clickedActions.ToString()).c_str()); PrintDebugMessage(("Clicked actions: " + clickedActions.ToString()).c_str());
PrintDebugMessage(("Held actions: " + heldActions.ToString()).c_str()); PrintDebugMessage(("Held actions: " + heldActions.ToString()).c_str());
@ -1288,12 +1303,12 @@ namespace TEN::Renderer
PrintDebugMessage("Front left ceil: %d", LaraCollision.FrontLeft.Ceiling); PrintDebugMessage("Front left ceil: %d", LaraCollision.FrontLeft.Ceiling);
PrintDebugMessage("Front right ceil: %d", LaraCollision.FrontRight.Ceiling); PrintDebugMessage("Front right ceil: %d", LaraCollision.FrontRight.Ceiling);
break; break;
case RendererDebugPage::PathfindingStats: case RendererDebugPage::PathfindingStats:
PrintDebugMessage("PATHFINDING STATS"); PrintDebugMessage("PATHFINDING STATS");
PrintDebugMessage("BoxNumber: %d", LaraItem->BoxNumber); PrintDebugMessage("BoxNumber: %d", LaraItem->BoxNumber);
break; break;
case RendererDebugPage::WireframeMode: case RendererDebugPage::WireframeMode:
PrintDebugMessage("WIREFRAME MODE"); PrintDebugMessage("WIREFRAME MODE");
break; break;

View file

@ -11,7 +11,7 @@
#define STRING_LOAD_GAME "load_game" #define STRING_LOAD_GAME "load_game"
#define STRING_SAVE_GAME "save_game" #define STRING_SAVE_GAME "save_game"
#define STRING_EXIT_GAME "exit_game" #define STRING_EXIT_GAME "exit_game"
#define STRING_EXIT_TO_TITLE "exit_to_title" #define STRING_EXIT_TO_TITLE "exit_to_title"
#define STRING_OPTIONS "options" #define STRING_OPTIONS "options"
#define STRING_UZIS "uzis" #define STRING_UZIS "uzis"
#define STRING_PISTOLS "pistols" #define STRING_PISTOLS "pistols"
@ -86,8 +86,11 @@
#define STRING_RUMBLE "rumble" #define STRING_RUMBLE "rumble"
#define STRING_THUMBSTICK_CAMERA "thumbstick_camera" #define STRING_THUMBSTICK_CAMERA "thumbstick_camera"
#define STRING_SUBTITLES "subtitles" #define STRING_SUBTITLES "subtitles"
#define STRING_MENU_OPT_LOOP "menu_option_looping"
#define STRING_MENU_OPT_LOOP_ALL_MENUS "menu_option_looping_all_menus"
#define STRING_MENU_OPT_LOOP_DISABLED "menu_option_looping_disabled"
#define STRING_MENU_OPT_LOOP_SAVE_LOAD_ONLY "menu_option_looping_save_load_only"
#define STRING_MOUSE_SENSITIVITY "mouse_sensitivity" #define STRING_MOUSE_SENSITIVITY "mouse_sensitivity"
#define STRING_MOUSE_SMOOTHING "mouse_smoothing"
#define STRING_ACTIONS_FORWARD "actions_forward" #define STRING_ACTIONS_FORWARD "actions_forward"
#define STRING_ACTIONS_BACKWARD "actions_backward" #define STRING_ACTIONS_BACKWARD "actions_backward"
#define STRING_ACTIONS_LEFT "actions_left" #define STRING_ACTIONS_LEFT "actions_left"

View file

@ -463,10 +463,9 @@ namespace TEN::Input
(((rawAxes.x - -DISPLAY_SPACE_RES.x) * 2) / (DISPLAY_SPACE_RES.x - -DISPLAY_SPACE_RES.x)) - 1.0f, (((rawAxes.x - -DISPLAY_SPACE_RES.x) * 2) / (DISPLAY_SPACE_RES.x - -DISPLAY_SPACE_RES.x)) - 1.0f,
(((rawAxes.y - -DISPLAY_SPACE_RES.y) * 2) / (DISPLAY_SPACE_RES.y - -DISPLAY_SPACE_RES.y)) - 1.0f); (((rawAxes.y - -DISPLAY_SPACE_RES.y) * 2) / (DISPLAY_SPACE_RES.y - -DISPLAY_SPACE_RES.y)) - 1.0f);
// Apply sensitivity and smoothing. // Apply sensitivity.
float sensitivity = (g_Configuration.MouseSensitivity * 0.1f) + 0.4f; float sensitivity = (g_Configuration.MouseSensitivity * 0.1f) + 0.4f;
float smoothing = 1.0f - (g_Configuration.MouseSmoothing * 0.1f); normAxes *= sensitivity;
normAxes *= sensitivity * smoothing;
// Set mouse axis values. // Set mouse axis values.
AxisMap[(int)InputAxis::Mouse] = normAxes; AxisMap[(int)InputAxis::Mouse] = normAxes;

View file

@ -257,7 +257,7 @@ bool SaveConfiguration()
// Set Input keys. // Set Input keys.
if (SetDWORDRegKey(inputKey, REGKEY_MOUSE_SENSITIVITY, g_Configuration.MouseSensitivity) != ERROR_SUCCESS || if (SetDWORDRegKey(inputKey, REGKEY_MOUSE_SENSITIVITY, g_Configuration.MouseSensitivity) != ERROR_SUCCESS ||
SetDWORDRegKey(inputKey, REGKEY_MOUSE_SMOOTHING, g_Configuration.MouseSmoothing) != ERROR_SUCCESS) SetDWORDRegKey(inputKey, REGKEY_ENABLE_MENU_OPTION_LOOPING, (int)g_Configuration.MenuOptionLoopingMode) != ERROR_SUCCESS)
{ {
RegCloseKey(rootKey); RegCloseKey(rootKey);
RegCloseKey(graphicsKey); RegCloseKey(graphicsKey);
@ -330,7 +330,7 @@ void InitDefaultConfiguration()
g_Configuration.EnableThumbstickCamera = false; g_Configuration.EnableThumbstickCamera = false;
g_Configuration.MouseSensitivity = GameConfiguration::DEFAULT_MOUSE_SENSITIVITY; g_Configuration.MouseSensitivity = GameConfiguration::DEFAULT_MOUSE_SENSITIVITY;
g_Configuration.MouseSmoothing = GameConfiguration::DEFAULT_MOUSE_SMOOTHING; g_Configuration.MenuOptionLoopingMode = MenuOptionLoopingMode::SaveLoadOnly;
g_Configuration.SupportedScreenResolutions = GetAllSupportedScreenResolutions(); g_Configuration.SupportedScreenResolutions = GetAllSupportedScreenResolutions();
g_Configuration.AdapterName = g_Renderer.GetDefaultAdapterName(); g_Configuration.AdapterName = g_Renderer.GetDefaultAdapterName();
@ -444,14 +444,14 @@ bool LoadConfiguration()
} }
DWORD mouseSensitivity = GameConfiguration::DEFAULT_MOUSE_SENSITIVITY; DWORD mouseSensitivity = GameConfiguration::DEFAULT_MOUSE_SENSITIVITY;
DWORD mouseSmoothing = GameConfiguration::DEFAULT_MOUSE_SMOOTHING; DWORD menuOptionLoopingMode = (DWORD)MenuOptionLoopingMode::SaveLoadOnly;
// Load Input keys. // Load Input keys.
HKEY inputKey = NULL; HKEY inputKey = NULL;
if (RegOpenKeyExA(rootKey, REGKEY_INPUT, 0, KEY_READ, &inputKey) == ERROR_SUCCESS) if (RegOpenKeyExA(rootKey, REGKEY_INPUT, 0, KEY_READ, &inputKey) == ERROR_SUCCESS)
{ {
if (GetDWORDRegKey(inputKey, REGKEY_MOUSE_SENSITIVITY, &mouseSensitivity, GameConfiguration::DEFAULT_MOUSE_SENSITIVITY) != ERROR_SUCCESS || if (GetDWORDRegKey(inputKey, REGKEY_MOUSE_SENSITIVITY, &mouseSensitivity, GameConfiguration::DEFAULT_MOUSE_SENSITIVITY) != ERROR_SUCCESS ||
GetDWORDRegKey(inputKey, REGKEY_MOUSE_SMOOTHING, &mouseSmoothing, GameConfiguration::DEFAULT_MOUSE_SMOOTHING) != ERROR_SUCCESS) GetDWORDRegKey(inputKey, REGKEY_ENABLE_MENU_OPTION_LOOPING, &menuOptionLoopingMode, (DWORD)MenuOptionLoopingMode::SaveLoadOnly) != ERROR_SUCCESS)
{ {
RegCloseKey(rootKey); RegCloseKey(rootKey);
RegCloseKey(graphicsKey); RegCloseKey(graphicsKey);
@ -519,7 +519,7 @@ bool LoadConfiguration()
g_Configuration.EnableThumbstickCamera = enableThumbstickCamera; g_Configuration.EnableThumbstickCamera = enableThumbstickCamera;
g_Configuration.MouseSensitivity = mouseSensitivity; g_Configuration.MouseSensitivity = mouseSensitivity;
g_Configuration.MouseSmoothing = mouseSmoothing; g_Configuration.MenuOptionLoopingMode = (MenuOptionLoopingMode)menuOptionLoopingMode;
// Set legacy variables. // Set legacy variables.
SetVolumeTracks(musicVolume); SetVolumeTracks(musicVolume);
@ -558,10 +558,10 @@ LONG GetDWORDRegKey(HKEY hKey, LPCSTR strValueName, DWORD* nValue, DWORD nDefaul
NULL, NULL,
reinterpret_cast<LPBYTE>(&nResult), reinterpret_cast<LPBYTE>(&nResult),
&dwBufferSize); &dwBufferSize);
if (ERROR_SUCCESS == nError) if (ERROR_SUCCESS == nError)
*nValue = nResult; *nValue = nResult;
return nError; return nError;
} }
@ -570,10 +570,10 @@ LONG GetBoolRegKey(HKEY hKey, LPCSTR strValueName, bool* bValue, bool bDefaultVa
DWORD nDefValue((bDefaultValue) ? 1 : 0); DWORD nDefValue((bDefaultValue) ? 1 : 0);
DWORD nResult(nDefValue); DWORD nResult(nDefValue);
LONG nError = GetDWORDRegKey(hKey, strValueName, &nResult, nDefValue); LONG nError = GetDWORDRegKey(hKey, strValueName, &nResult, nDefValue);
if (ERROR_SUCCESS == nError) if (ERROR_SUCCESS == nError)
*bValue = (nResult != 0); *bValue = (nResult != 0);
return nError; return nError;
} }

View file

@ -7,6 +7,7 @@ using namespace TEN::Input;
using namespace TEN::Math; using namespace TEN::Math;
// Directories // Directories
constexpr auto REGKEY_ROOT = "Software\\TombEngine\\1.1.0"; constexpr auto REGKEY_ROOT = "Software\\TombEngine\\1.1.0";
constexpr auto REGKEY_GRAPHICS = "Graphics"; constexpr auto REGKEY_GRAPHICS = "Graphics";
constexpr auto REGKEY_SOUND = "Sound"; constexpr auto REGKEY_SOUND = "Sound";
@ -14,6 +15,7 @@ constexpr auto REGKEY_GAMEPLAY = "Gameplay";
constexpr auto REGKEY_INPUT = "Input"; constexpr auto REGKEY_INPUT = "Input";
// Graphics keys // Graphics keys
constexpr auto REGKEY_SCREEN_WIDTH = "ScreenWidth"; constexpr auto REGKEY_SCREEN_WIDTH = "ScreenWidth";
constexpr auto REGKEY_SCREEN_HEIGHT = "ScreenHeight"; constexpr auto REGKEY_SCREEN_HEIGHT = "ScreenHeight";
constexpr auto REGKEY_ENABLE_WINDOWED_MODE = "EnableWindowedMode"; constexpr auto REGKEY_ENABLE_WINDOWED_MODE = "EnableWindowedMode";
@ -25,6 +27,7 @@ constexpr auto REGKEY_ANTIALIASING_MODE = "AntialiasingMode";
constexpr auto REGKEY_AMBIENT_OCCLUSION = "AmbientOcclusion"; constexpr auto REGKEY_AMBIENT_OCCLUSION = "AmbientOcclusion";
// Sound keys // Sound keys
constexpr auto REGKEY_SOUND_DEVICE = "SoundDevice"; constexpr auto REGKEY_SOUND_DEVICE = "SoundDevice";
constexpr auto REGKEY_ENABLE_SOUND = "EnableSound"; constexpr auto REGKEY_ENABLE_SOUND = "EnableSound";
constexpr auto REGKEY_ENABLE_REVERB = "EnableReverb"; constexpr auto REGKEY_ENABLE_REVERB = "EnableReverb";
@ -32,6 +35,7 @@ constexpr auto REGKEY_MUSIC_VOLUME = "MusicVolume";
constexpr auto REGKEY_SFX_VOLUME = "SfxVolume"; constexpr auto REGKEY_SFX_VOLUME = "SfxVolume";
// Gameplay keys // Gameplay keys
constexpr auto REGKEY_ENABLE_SUBTITLES = "EnableSubtitles"; constexpr auto REGKEY_ENABLE_SUBTITLES = "EnableSubtitles";
constexpr auto REGKEY_ENABLE_AUTO_MONKEY_JUMP = "EnableAutoMonkeySwingJump"; constexpr auto REGKEY_ENABLE_AUTO_MONKEY_JUMP = "EnableAutoMonkeySwingJump";
constexpr auto REGKEY_ENABLE_AUTO_TARGETING = "EnableAutoTargeting"; constexpr auto REGKEY_ENABLE_AUTO_TARGETING = "EnableAutoTargeting";
@ -40,17 +44,25 @@ constexpr auto REGKEY_ENABLE_RUMBLE = "EnableRumble";
constexpr auto REGKEY_ENABLE_THUMBSTICK_CAMERA = "EnableThumbstickCamera"; constexpr auto REGKEY_ENABLE_THUMBSTICK_CAMERA = "EnableThumbstickCamera";
// Input keys // Input keys
constexpr auto REGKEY_MOUSE_SENSITIVITY = "MouseSensitivity";
constexpr auto REGKEY_MOUSE_SMOOTHING = "MouseSmoothing";
struct GameConfiguration constexpr auto REGKEY_MOUSE_SENSITIVITY = "MouseSensitivity";
constexpr auto REGKEY_ENABLE_MENU_OPTION_LOOPING = "EnableMenuOptionLooping";
enum class MenuOptionLoopingMode
{
AllMenus,
SaveLoadOnly,
Disabled
};
struct GameConfiguration
{ {
static constexpr auto DEFAULT_SHADOW_MAP_SIZE = 1024; static constexpr auto DEFAULT_SHADOW_MAP_SIZE = 1024;
static constexpr auto DEFAULT_SHADOW_BLOBS_MAX = 16; static constexpr auto DEFAULT_SHADOW_BLOBS_MAX = 16;
static constexpr auto DEFAULT_MOUSE_SENSITIVITY = 6; static constexpr auto DEFAULT_MOUSE_SENSITIVITY = 6;
static constexpr auto DEFAULT_MOUSE_SMOOTHING = 1;
// Graphics // Graphics
int ScreenWidth = 0; int ScreenWidth = 0;
int ScreenHeight = 0; int ScreenHeight = 0;
bool EnableWindowedMode = false; bool EnableWindowedMode = false;
@ -62,6 +74,7 @@ struct GameConfiguration
AntialiasingMode AntialiasingMode = AntialiasingMode::None; AntialiasingMode AntialiasingMode = AntialiasingMode::None;
// Sound // Sound
int SoundDevice = 0; int SoundDevice = 0;
bool EnableSound = false; bool EnableSound = false;
bool EnableReverb = false; bool EnableReverb = false;
@ -69,17 +82,19 @@ struct GameConfiguration
int SfxVolume = 0; int SfxVolume = 0;
// Gameplay // Gameplay
bool EnableSubtitles = false;
bool EnableAutoMonkeySwingJump = false; bool EnableSubtitles = false;
bool EnableAutoTargeting = false; bool EnableAutoMonkeySwingJump = false;
bool EnableTargetHighlighter = false; bool EnableAutoTargeting = false;
bool EnableRumble = false; bool EnableTargetHighlighter = false;
bool EnableThumbstickCamera = false; bool EnableRumble = false;
bool EnableThumbstickCamera = false;
// Input // Input
int MouseSensitivity = DEFAULT_MOUSE_SENSITIVITY;
int MouseSmoothing = DEFAULT_MOUSE_SMOOTHING; int MouseSensitivity = DEFAULT_MOUSE_SENSITIVITY;
std::vector<int> Bindings = {}; MenuOptionLoopingMode MenuOptionLoopingMode = MenuOptionLoopingMode::SaveLoadOnly;
std::vector<int> Bindings = {};
std::vector<Vector2i> SupportedScreenResolutions = {}; std::vector<Vector2i> SupportedScreenResolutions = {};
std::string AdapterName = {}; std::string AdapterName = {};