forked from teamnwah/openmw-tes3coop
first settings test (config file has to be created manually)
This commit is contained in:
parent
308df7caa8
commit
6091a0504d
4 changed files with 135 additions and 122 deletions
|
@ -20,6 +20,7 @@
|
|||
#include <components/esm/esm_reader.hpp>
|
||||
#include <components/files/fixedpath.hpp>
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include <components/nifbullet/bullet_nif_loader.hpp>
|
||||
#include <components/nifogre/ogre_nif_loader.hpp>
|
||||
|
@ -313,6 +314,17 @@ void OMW::Engine::go()
|
|||
{
|
||||
boost::filesystem::create_directories(configPath);
|
||||
}
|
||||
|
||||
Settings::Manager settings;
|
||||
|
||||
//settings.loadDefault(defaultsettingspath);
|
||||
|
||||
const std::string settingspath = mCfgMgr.getUserPath().string() + "/settings.cfg";
|
||||
if (boost::filesystem::exists(settingspath))
|
||||
settings.loadUser(settingspath);
|
||||
else
|
||||
settings.copyDefaultToUserSettings();
|
||||
|
||||
mOgre->configure(!boost::filesystem::is_regular_file(mCfgMgr.getOgreConfigPath()),
|
||||
mCfgMgr.getOgreConfigPath().string(),
|
||||
mCfgMgr.getLogPath().string(),
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "ogre_nif_loader.hpp"
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
typedef unsigned char ubyte;
|
||||
|
||||
|
@ -299,6 +300,8 @@ void NIFLoader::createMaterial(const String &name,
|
|||
material->setSelfIllumination(emissive.array[0], emissive.array[1], emissive.array[2]);
|
||||
material->setShininess(glossiness);
|
||||
|
||||
if (Settings::Manager::getBool("shaders", "Objects"))
|
||||
{
|
||||
// Create shader for the material
|
||||
// vertex
|
||||
HighLevelGpuProgramManager& mgr = HighLevelGpuProgramManager::getSingleton();
|
||||
|
@ -349,12 +352,7 @@ void NIFLoader::createMaterial(const String &name,
|
|||
// not work perfectly for objects batched together (they will all use the same
|
||||
// lights). to work around this, we are simply pushing the maximum number
|
||||
// of lights here in order to minimize disappearing lights.
|
||||
float num_lights;
|
||||
if (GpuProgramManager::getSingleton().isSyntaxSupported("fp40") ||
|
||||
GpuProgramManager::getSingleton().isSyntaxSupported("ps_4_0"))
|
||||
num_lights = 8 /* 32 */;
|
||||
else
|
||||
num_lights = 8;
|
||||
int num_lights = Settings::Manager::getInt("num lights", "Objects");
|
||||
|
||||
// fragment
|
||||
HighLevelGpuProgramPtr fragment;
|
||||
|
@ -431,6 +429,7 @@ void NIFLoader::createMaterial(const String &name,
|
|||
else
|
||||
fragment = mgr.getByName("main_fp");
|
||||
material->getTechnique(0)->getPass(0)->setFragmentProgram(fragment->getName());
|
||||
}
|
||||
}
|
||||
|
||||
// Takes a name and adds a unique part to it. This is just used to
|
||||
|
|
|
@ -73,6 +73,7 @@ const bool Manager::getBool (const std::string& setting, const std::string& cate
|
|||
|
||||
void Manager::setString (const std::string& setting, const std::string& category, const std::string& value)
|
||||
{
|
||||
bool found=false;
|
||||
Ogre::ConfigFile::SettingsIterator it = mFile.getSettingsIterator(category);
|
||||
while (it.hasMoreElements())
|
||||
{
|
||||
|
@ -82,10 +83,12 @@ void Manager::setString (const std::string& setting, const std::string& category
|
|||
{
|
||||
mChangedSettings.push_back(std::make_pair(setting, category));
|
||||
(*i).second = value;
|
||||
found = true;
|
||||
}
|
||||
|
||||
it.getNext();
|
||||
}
|
||||
assert(found && "Attempting to change a non-existing setting");
|
||||
}
|
||||
|
||||
void Manager::setInt (const std::string& setting, const std::string& category, const int value)
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace Settings
|
|||
class Manager
|
||||
{
|
||||
public:
|
||||
|
||||
static Ogre::ConfigFile mFile;
|
||||
static Ogre::ConfigFile mDefaultFile;
|
||||
|
||||
|
|
Loading…
Reference in a new issue