diff --git a/Configurator/HouseRulesWindow.xaml b/Configurator/HouseRulesWindow.xaml
index 98b84ac5a..4f15fe9e5 100644
--- a/Configurator/HouseRulesWindow.xaml
+++ b/Configurator/HouseRulesWindow.xaml
@@ -14,6 +14,10 @@
+
+
+
+
diff --git a/Configurator/IniViewModel.cs b/Configurator/IniViewModel.cs
index 72a50f2f2..d528cbd62 100644
--- a/Configurator/IniViewModel.cs
+++ b/Configurator/IniViewModel.cs
@@ -31,6 +31,10 @@ public class IniViewModel : DependencyObject
"HpOnLevelUp", typeof (HpOnLevelUpType), typeof (IniViewModel),
new PropertyMetadata(default(HpOnLevelUpType)));
+ public static readonly DependencyProperty FogOfWarProperty = DependencyProperty.Register(
+ "FogOfWar", typeof(FogOfWarType), typeof(IniViewModel),
+ new PropertyMetadata(default(FogOfWarType)));
+
public static readonly DependencyProperty PointBuyPointsProperty = DependencyProperty.Register(
"PointBuyPoints", typeof (int), typeof (IniViewModel), new PropertyMetadata(default(int)));
@@ -51,6 +55,8 @@ public class IniViewModel : DependencyObject
public IEnumerable HpOnLevelUpTypes => Enum.GetValues(typeof (HpOnLevelUpType))
.Cast();
+ public IEnumerable FogOfWarTypes => Enum.GetValues(typeof(FogOfWarType))
+ .Cast();
public IniViewModel()
{
@@ -111,6 +117,12 @@ public HpOnLevelUpType HpOnLevelUp
set { SetValue(HpOnLevelUpProperty, value); }
}
+ public FogOfWarType FogOfWar
+ {
+ get { return (FogOfWarType)GetValue(FogOfWarProperty); }
+ set { SetValue(FogOfWarProperty, value); }
+ }
+
public int PointBuyPoints
{
get { return (int) GetValue(PointBuyPointsProperty); }
@@ -171,6 +183,7 @@ public void LoadFromIni(IniData iniData)
InstallationPath = tpData["toeeDir"];
DisableAutomaticUpdates = tpData["autoUpdate"] != "true";
+
if (tpData["hpOnLevelup"] != null)
{
switch (tpData["hpOnLevelup"].ToLowerInvariant())
@@ -187,6 +200,25 @@ public void LoadFromIni(IniData iniData)
}
}
+ if (tpData["fogOfWar"] != null)
+ {
+ switch (tpData["fogOfWar"].ToLowerInvariant())
+ {
+ case "always":
+ FogOfWar = FogOfWarType.Always;
+ break;
+ case "normal":
+ FogOfWar = FogOfWarType.Normal;
+ break;
+ case "unfogged":
+ FogOfWar = FogOfWarType.Unfogged;
+ break;
+ default:
+ FogOfWar = FogOfWarType.Normal;
+ break;
+ }
+ }
+
int points;
if (int.TryParse(tpData["pointBuyPoints"], out points))
{
@@ -259,6 +291,18 @@ public void SaveToIni(IniData iniData)
tpData["hpOnLevelup"] = "normal";
break;
}
+ switch (FogOfWar)
+ {
+ case FogOfWarType.Unfogged:
+ tpData["fogOfWar"] = "unfogged";
+ break;
+ case FogOfWarType.Always:
+ tpData["fogOfWar"] = "always";
+ break;
+ default:
+ tpData["fogOfWar"] = "normal";
+ break;
+ }
tpData["pointBuyPoints"] = PointBuyPoints.ToString();
tpData["renderWidth"] = RenderWidth.ToString();
tpData["renderHeight"] = RenderHeight.ToString();
@@ -280,4 +324,11 @@ public enum HpOnLevelUpType
Max,
Average
}
+
+ public enum FogOfWarType
+ {
+ Normal,
+ Unfogged,
+ Always // ensures maps are fogged even despite UNFOGGED flag in the module defs
+ }
}
\ No newline at end of file
diff --git a/TemplePlus/config/config.cpp b/TemplePlus/config/config.cpp
index 36d1cdae0..4ff7892f0 100644
--- a/TemplePlus/config/config.cpp
+++ b/TemplePlus/config/config.cpp
@@ -162,7 +162,8 @@ static ConfigSetting configSettings[] = {
CONF_INT(msaaQuality),
CONF_BOOL(showNpcStats),
CONF_BOOL(newClasses),
- CONF_BOOL(tolerantNpcs)
+ CONF_BOOL(tolerantNpcs),
+ CONF_STRING(fogOfWar)
};
void TemplePlusConfig::Load() {
diff --git a/TemplePlus/config/config.h b/TemplePlus/config/config.h
index 47390842a..7bdfe490a 100644
--- a/TemplePlus/config/config.h
+++ b/TemplePlus/config/config.h
@@ -32,7 +32,6 @@ struct TemplePlusConfig
bool showDialogLineNos = false; // Previously: -dialognumber
uint32_t scrollDistance = 10; // Not really sure what this is used for. Previously: -scrolldist
std::string defaultModule = "ToEE"; // Previousl: -mod:
- bool disableFogOfWar = false; // Previously: -nofog
bool skipIntro = true;
bool skipLegal = true;
bool engineEnhancements = true;
@@ -80,6 +79,8 @@ struct TemplePlusConfig
bool slowerLevelling = false;
bool newClasses = false; // Prestige classes and such
bool tolerantNpcs = false; // NPCs tolerate monster party members
+ std::string fogOfWar = "Normal";
+ bool disableFogOfWar = false; // Previously: -nofog
std::unordered_map vanillaSettings;
void AddVanillaSetting(const std::string &name,
diff --git a/TemplePlus/gamesystems/mapsystem.cpp b/TemplePlus/gamesystems/mapsystem.cpp
index 6c1fab5a8..d3552b1ec 100644
--- a/TemplePlus/gamesystems/mapsystem.cpp
+++ b/TemplePlus/gamesystems/mapsystem.cpp
@@ -95,6 +95,17 @@ void MapSystem::LoadModule() {
auto mapList = MesFile::ParseFile("Rules\\MapList.mes");
std::vector> parts;
+
+ bool alwaysFog = false;
+ bool alwaysUnfog = false;
+ if (!_stricmp(tolower(config.fogOfWar).c_str(), "always")) {
+ alwaysFog = true;
+ }
+ else if (!_stricmp(tolower(config.fogOfWar).c_str(), "unfogged")) {
+ alwaysUnfog = true;;
+ }
+
+
for (auto &line : mapList) {
MapListEntry entry;
@@ -106,6 +117,10 @@ void MapSystem::LoadModule() {
entry.startPosX = atoi(parts[1].data());
entry.startPosY = atoi(parts[2].data());
entry.flags = 0;
+ if (alwaysUnfog)
+ entry.flags |= 4;
+
+
// The rest are key value pairs
for (size_t i = 3; i < parts.size(); ++i) {
@@ -135,7 +150,8 @@ void MapSystem::LoadModule() {
} else if (!strncmp(value.data(), "OUTDOOR", value.size())) {
entry.flags |= 2;
} else if (!strncmp(value.data(), "UNFOGGED", value.size())) {
- entry.flags |= 4;
+ if (!alwaysFog)
+ entry.flags |= 4;
} else if (!strncmp(value.data(), "BEDREST", value.size())) {
entry.flags |= 8;
}
diff --git a/TemplePlus/gamesystems/mapsystem_hooks.cpp b/TemplePlus/gamesystems/mapsystem_hooks.cpp
index 34a66792a..b34bfca7f 100644
--- a/TemplePlus/gamesystems/mapsystem_hooks.cpp
+++ b/TemplePlus/gamesystems/mapsystem_hooks.cpp
@@ -5,6 +5,7 @@
#include "gamesystems.h"
#include "mapsystem.h"
#include "map/sector.h"
+#include
enum esd_load_result : uint32_t {
PARTIALLY_EXPLORED = 0,
@@ -146,6 +147,7 @@ static class MapSystemHooks : public TempleFix {
// replaceFunction(0x10072050, map_save);
// replaceFunction(0x10072370, _map_open);
replaceFunction(0x10072a90, map_open_in_game);
+
}
} hooks;
@@ -365,8 +367,7 @@ void MapSystemHooks::map_mark_visited_map(objHndl obj)
gameSystems->GetMap().MarkVisitedMap(obj);
}
-BOOL MapSystemHooks::map_has_fog_of_war(int mapId)
-{
+BOOL MapSystemHooks::map_has_fog_of_war(int mapId){
return gameSystems->GetMap().IsUnfogged(mapId) ? FALSE : TRUE;
}
diff --git a/TemplePlus/temple_main.cpp b/TemplePlus/temple_main.cpp
index 4ea47c8e3..e5b132f17 100644
--- a/TemplePlus/temple_main.cpp
+++ b/TemplePlus/temple_main.cpp
@@ -250,7 +250,8 @@ void applyGameConfig() {
scrollDistance = config.scrollDistance;
// Removes the initialized flag from the fog subsystem
- if (config.disableFogOfWar) {
+ //if (config.disableFogOfWar) {
+ if (!_stricmp( tolower(config.fogOfWar).c_str(), "unfogged")){
mapFoggingInited = mapFoggingInited & ~1;
}