1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 21:49:56 +00:00
openmw-tes3mp/apps/openmw/engine.hpp

212 lines
5.9 KiB
C++
Raw Normal View History

#ifndef ENGINE_H
#define ENGINE_H
2010-07-03 10:12:13 +00:00
#include <components/compiler/extensions.hpp>
#include <components/files/collections.hpp>
#include <components/translation/translation.hpp>
#include <components/settings/settings.hpp>
#include <osgViewer/Viewer>
2017-11-09 17:26:27 +00:00
#include <osgViewer/ViewerEventHandlers>
#include "mwbase/environment.hpp"
#include "mwworld/ptr.hpp"
2010-07-04 08:43:34 +00:00
namespace Resource
{
class ResourceSystem;
}
2017-02-14 02:37:45 +00:00
namespace SceneUtil
{
class WorkQueue;
}
namespace VFS
{
class Manager;
}
2010-07-02 15:21:27 +00:00
namespace Compiler
{
class Context;
}
namespace MWScript
{
class ScriptManager;
}
namespace MWSound
{
class SoundManager;
}
2010-07-03 13:41:20 +00:00
namespace MWWorld
{
class World;
2010-07-03 13:41:20 +00:00
}
namespace MWGui
{
class WindowManager;
}
namespace Files
{
struct ConfigurationManager;
}
2015-06-03 15:25:18 +00:00
namespace osgViewer
{
class ScreenCaptureHandler;
}
struct SDL_Window;
2010-07-03 13:41:20 +00:00
namespace OMW
{
/// \brief Main engine class, that brings together all the components of OpenMW
2015-04-25 13:19:17 +00:00
class Engine
{
SDL_Window* mWindow;
std::unique_ptr<VFS::Manager> mVFS;
std::unique_ptr<Resource::ResourceSystem> mResourceSystem;
2017-02-14 02:37:45 +00:00
osg::ref_ptr<SceneUtil::WorkQueue> mWorkQueue;
MWBase::Environment mEnvironment;
2012-12-23 19:23:24 +00:00
ToUTF8::FromType mEncoding;
ToUTF8::Utf8Encoder* mEncoder;
Files::PathContainer mDataDirs;
std::vector<std::string> mArchives;
boost::filesystem::path mResDir;
2015-04-24 21:30:30 +00:00
osg::ref_ptr<osgViewer::Viewer> mViewer;
2015-06-03 15:25:18 +00:00
osg::ref_ptr<osgViewer::ScreenCaptureHandler> mScreenCaptureHandler;
2017-11-09 17:26:27 +00:00
osgViewer::ScreenCaptureHandler::CaptureOperation *mScreenCaptureOperation;
std::string mCellName;
std::vector<std::string> mContentFiles;
2020-01-12 07:42:47 +00:00
std::vector<std::string> mGroundcoverFiles;
2013-11-16 10:33:20 +00:00
bool mSkipMenu;
2010-08-18 09:16:15 +00:00
bool mUseSound;
2010-10-06 12:52:53 +00:00
bool mCompileAll;
bool mCompileAllDialogue;
2014-02-02 13:09:59 +00:00
int mWarningsMode;
std::string mFocusName;
bool mScriptConsoleMode;
2012-07-30 10:37:46 +00:00
std::string mStartupScript;
int mActivationDistanceOverride;
std::string mSaveGameFile;
// Grab mouse?
bool mGrab;
2014-08-11 18:37:29 +00:00
bool mExportFonts;
unsigned int mRandomSeed;
2014-08-11 18:37:29 +00:00
2010-07-03 10:12:13 +00:00
Compiler::Extensions mExtensions;
2010-07-02 15:21:27 +00:00
Compiler::Context *mScriptContext;
2012-03-05 15:56:14 +00:00
Files::Collections mFileCollections;
2011-05-05 17:56:16 +00:00
bool mFSStrict;
Translation::Storage mTranslationDataStorage;
2014-07-21 07:34:10 +00:00
std::vector<std::string> mScriptBlacklist;
bool mScriptBlacklistUse;
2014-09-01 09:55:12 +00:00
bool mNewGame;
// not implemented
Engine (const Engine&);
Engine& operator= (const Engine&);
void executeLocalScripts();
bool frame (float dt);
/// Load settings from various files, returns the path to the user settings file
std::string loadSettings (Settings::Manager & settings);
/// Prepare engine for game play
void prepareEngine (Settings::Manager & settings);
void createWindow(Settings::Manager& settings);
2015-05-13 13:03:21 +00:00
void setWindowIcon();
public:
Engine(Files::ConfigurationManager& configurationManager);
virtual ~Engine();
2011-05-05 17:56:16 +00:00
/// Enable strict filesystem mode (do not fold case)
///
/// \attention The strict mode must be specified before any path-related settings
/// are given to the engine.
void enableFSStrict(bool fsStrict);
2011-05-05 17:56:16 +00:00
/// Set data dirs
void setDataDirs(const Files::PathContainer& dataDirs);
/// Add BSA archive
void addArchive(const std::string& archive);
/// Set resource dir
void setResourceDir(const boost::filesystem::path& parResDir);
/// Set start cell name
void setCell(const std::string& cellName);
/**
* @brief addContentFile - Adds content file (ie. esm/esp, or omwgame/omwaddon) to the content files container.
* @param file - filename (extension is required)
*/
void addContentFile(const std::string& file);
2020-01-12 07:42:47 +00:00
void addGroundcoverFile(const std::string& file);
/// Disable or enable all sounds
void setSoundUsage(bool soundUsage);
2010-08-18 09:16:15 +00:00
2014-09-01 09:55:12 +00:00
/// Skip main menu and go directly into the game
///
/// \param newGame Start a new game instead off dumping the player into the game
/// (ignored if !skipMenu).
void setSkipMenu (bool skipMenu, bool newGame);
2013-11-16 10:33:20 +00:00
void setGrabMouse(bool grab) { mGrab = grab; }
/// Initialise and enter main loop.
void go();
2010-10-06 12:52:53 +00:00
/// Compile all scripts (excludign dialogue scripts) at startup?
void setCompileAll (bool all);
/// Compile all dialogue scripts at startup?
void setCompileAllDialogue (bool all);
/// Font encoding
2012-12-23 19:23:24 +00:00
void setEncoding(const ToUTF8::FromType& encoding);
/// Enable console-only script functionality
void setScriptConsoleMode (bool enabled);
2012-07-30 10:37:46 +00:00
/// Set path for a script that is run on startup in the console.
void setStartupScript (const std::string& path);
/// Override the game setting specified activation distance.
void setActivationDistanceOverride (int distance);
2014-02-02 13:09:59 +00:00
void setWarningsMode (int mode);
2014-07-21 07:34:10 +00:00
void setScriptBlacklist (const std::vector<std::string>& list);
void setScriptBlacklistUse (bool use);
2014-08-11 18:37:29 +00:00
void enableFontExport(bool exportFonts);
/// Set the save game file to load after initialising the engine.
void setSaveGameFile(const std::string& savegame);
void setRandomSeed(unsigned int seed);
private:
Files::ConfigurationManager& mCfgMgr;
};
}
#endif /* ENGINE_H */