Skip to content

Commit

Permalink
Add option to Fix Bugs In Levels
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoAnsems committed Apr 16, 2021
1 parent 75ae820 commit a2aaa81
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/Engine/ConfigurationSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ ConfigurationSettings::ConfigurationSettings() :
m_alwaysRun("Always Run", "alwaysRun", false),
m_autoFire("Auto Fire", "autoFire", false),
m_manaBar("Mana Bar", "manaBar", false),
m_fixBugsInLevels("Fix Bugs In Levels", "fixBugsInLevels", true),
m_cvarsBool(
{
std::make_pair(CVarIdDepthShading, &m_depthShading),
std::make_pair(CVarIdVSync, &m_vSync),
std::make_pair(CVarIdMouseLook, &m_mouseLook),
std::make_pair(CVarIdAlwaysRun, &m_alwaysRun),
std::make_pair(CVarIdAutoFire, &m_autoFire),
std::make_pair(CVarIdManaBar, &m_manaBar)
std::make_pair(CVarIdManaBar, &m_manaBar),
std::make_pair(CVarIdFixBugsInLevels, &m_fixBugsInLevels)
}),
m_dummyCvarString("Dummy", "Dummy", ""),
m_pathAbyssv113("", "pathabyssv113", ""),
Expand Down Expand Up @@ -443,6 +445,7 @@ void ConfigurationSettings::ResetToClassic()
GetCVarBoolMutable(CVarIdAlwaysRun).SetEnabled(false);
GetCVarBoolMutable(CVarIdAutoFire).SetEnabled(false);
GetCVarBoolMutable(CVarIdManaBar).SetEnabled(false);
GetCVarBoolMutable(CVarIdFixBugsInLevels).SetEnabled(false);
GetCVarEnumMutable(CVarIdAutoMapMode).SetItemIndex(CVarItemIdAutoMapOriginal);
GetCVarEnumMutable(CVarIdShowFpsMode).SetItemIndex(CVarItemIdShowFpsOff);
GetCVarEnumMutable(CVarIdScreenResolution).SetItemIndex(CVarItemIdScreenResolutionOriginal);
Expand Down
2 changes: 2 additions & 0 deletions src/Engine/ConfigurationSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ static const uint8_t CVarIdAspectRatio = 27;
static const uint8_t CVarIdFov = 40;
static const uint8_t CVarIdMouseSensitivity = 41;
static const uint8_t CVarIdTurnSpeed = 42;
static const uint8_t CVarIdFixBugsInLevels = 43;

static const uint8_t CVarItemIdScreenModeWindowed = 0;
static const uint8_t CVarItemIdScreenModeFullscreen = 1;
Expand Down Expand Up @@ -129,6 +130,7 @@ class ConfigurationSettings
ConsoleVariableBool m_alwaysRun;
ConsoleVariableBool m_autoFire;
ConsoleVariableBool m_manaBar;
ConsoleVariableBool m_fixBugsInLevels;

ConsoleVariableEnum m_dummyCvarEnum;
ConsoleVariableEnum m_screenMode;
Expand Down
16 changes: 16 additions & 0 deletions src/Engine/EngineCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,26 @@ void EngineCore::LoadLevel(const uint8_t mapIndex)

m_level = m_game.GetGameMaps()->GetLevelFromStart(mapIndex);

// Fix bugs in levels by manipulating the tiles
if (m_configurationSettings.GetCVarBool(CVarIdFixBugsInLevels).IsEnabled())
{
// Prevent soft lock in The Town of Morbidity
if (m_game.GetId() == 3 && m_level->GetLevelIndex() == 0)
{
// Change yellow key to red key
m_level->SetFloorTile(29, 24, 8);

// Change yellow door to red door
m_level->SetFloorTile(2, 19, 256);
}
}

m_game.SpawnActors(m_level, m_difficultyLevel);
m_level->GetPlayerActor()->SetHealth(health);
m_autoMap.ResetOrigin(*m_level, m_configurationSettings.GetCVarEnum(CVarIdAutoMapMode).GetItemIndex());



m_timeStampOfPlayerCurrentFrame = 0;
m_timeStampOfPlayerPreviousFrame = 0;
m_timeStampOfWorldCurrentFrame = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/Engine/ExtraMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ ExtraMenu::ExtraMenu(
pageGameplay->SetId(pageGameplayOptionsId);

GuiElementList* elementListGameplay = new GuiElementList(playerInput, 8, 10, egaGraph->GetPicture(menuCursorPic), browseMenuSound);
elementListGameplay->AddChild(new GuiElementBoolSelection(playerInput, configurationSettings.GetCVarBoolMutable(CVarIdManaBar), 95, m_renderableText));

elementListGameplay->AddChild(new GuiElementBoolSelection(playerInput, configurationSettings.GetCVarBoolMutable(CVarIdManaBar), 120, m_renderableText));
elementListGameplay->AddChild(new GuiElementBoolSelection(playerInput, configurationSettings.GetCVarBoolMutable(CVarIdFixBugsInLevels), 120, m_renderableText));
pageGameplay->AddChild(elementListGameplay, 60, 30);

GuiElementStaticText* pageLabelGameplay = new GuiElementStaticText(playerInput, "Gameplay Options", EgaBrightYellow, m_renderableText);
Expand Down

0 comments on commit a2aaa81

Please sign in to comment.