1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00
OpenMW/apps/openmw/engine.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

279 lines
6.9 KiB
C++
Raw Normal View History

#ifndef ENGINE_H
#define ENGINE_H
#include <filesystem>
2010-07-03 12:12:13 +02:00
#include <components/compiler/extensions.hpp>
#include <components/esm/refid.hpp>
#include <components/files/collections.hpp>
#include <components/settings/settings.hpp>
#include <components/translation/translation.hpp>
#include <osgViewer/Viewer>
2017-11-09 18:26:27 +01:00
#include <osgViewer/ViewerEventHandlers>
#include "mwbase/environment.hpp"
namespace Resource
{
class ResourceSystem;
}
2017-02-14 03:37:45 +01:00
namespace SceneUtil
{
class WorkQueue;
class AsyncScreenCaptureOperation;
class UnrefQueue;
2017-02-14 03:37:45 +01:00
}
namespace VFS
{
class Manager;
}
2010-07-02 17:21:27 +02:00
namespace Compiler
{
class Context;
}
2020-12-18 23:21:10 +01:00
namespace MWLua
{
class LuaManager;
2022-10-06 01:56:47 +02:00
class Worker;
2020-12-18 23:21:10 +01:00
}
namespace Stereo
{
class Manager;
}
namespace Files
{
struct ConfigurationManager;
}
2015-06-03 17:25:18 +02:00
namespace osgViewer
{
class ScreenCaptureHandler;
}
namespace SceneUtil
{
class SelectDepthFormatOperation;
namespace Color
{
class SelectColorFormatOperation;
}
}
namespace MWState
{
class StateManager;
}
namespace MWGui
{
class WindowManager;
}
namespace MWInput
{
class InputManager;
}
namespace MWSound
{
class SoundManager;
}
namespace MWWorld
{
class World;
}
namespace MWScript
{
class ScriptManager;
}
namespace MWMechanics
{
class MechanicsManager;
}
namespace MWDialogue
{
class DialogueManager;
}
namespace MWDialogue
{
class Journal;
}
2022-10-02 22:38:37 +02:00
namespace l10n
{
class Manager;
}
struct SDL_Window;
2010-07-03 15:41:20 +02:00
namespace OMW
{
/// \brief Main engine class, that brings together all the components of OpenMW
2015-04-25 15:19:17 +02:00
class Engine
{
SDL_Window* mWindow;
std::unique_ptr<VFS::Manager> mVFS;
std::unique_ptr<Resource::ResourceSystem> mResourceSystem;
2017-02-14 03:37:45 +01:00
osg::ref_ptr<SceneUtil::WorkQueue> mWorkQueue;
std::unique_ptr<SceneUtil::UnrefQueue> mUnrefQueue;
std::unique_ptr<MWWorld::World> mWorld;
std::unique_ptr<MWSound::SoundManager> mSoundManager;
std::unique_ptr<MWScript::ScriptManager> mScriptManager;
std::unique_ptr<MWGui::WindowManager> mWindowManager;
std::unique_ptr<MWMechanics::MechanicsManager> mMechanicsManager;
std::unique_ptr<MWDialogue::DialogueManager> mDialogueManager;
std::unique_ptr<MWDialogue::Journal> mJournal;
std::unique_ptr<MWInput::InputManager> mInputManager;
std::unique_ptr<MWState::StateManager> mStateManager;
std::unique_ptr<MWLua::LuaManager> mLuaManager;
2022-10-06 01:56:47 +02:00
std::unique_ptr<MWLua::Worker> mLuaWorker;
2022-10-02 22:38:37 +02:00
std::unique_ptr<l10n::Manager> mL10nManager;
MWBase::Environment mEnvironment;
2012-12-23 23:23:24 +04:00
ToUTF8::FromType mEncoding;
std::unique_ptr<ToUTF8::Utf8Encoder> mEncoder;
Files::PathContainer mDataDirs;
std::vector<std::string> mArchives;
std::filesystem::path mResDir;
2015-04-24 23:30:30 +02:00
osg::ref_ptr<osgViewer::Viewer> mViewer;
2015-06-03 17:25:18 +02:00
osg::ref_ptr<osgViewer::ScreenCaptureHandler> mScreenCaptureHandler;
osg::ref_ptr<SceneUtil::AsyncScreenCaptureOperation> mScreenCaptureOperation;
osg::ref_ptr<SceneUtil::SelectDepthFormatOperation> mSelectDepthFormatOperation;
osg::ref_ptr<SceneUtil::Color::SelectColorFormatOperation> mSelectColorFormatOperation;
2023-01-19 17:31:45 +01:00
std::string mCellName;
std::vector<std::string> mContentFiles;
2020-01-12 11:42:47 +04:00
std::vector<std::string> mGroundcoverFiles;
2022-09-22 21:26:05 +03:00
std::unique_ptr<Stereo::Manager> mStereoManager;
2022-09-22 21:26:05 +03:00
2013-11-16 11:33:20 +01:00
bool mSkipMenu;
2010-08-18 11:16:15 +02:00
bool mUseSound;
2010-10-06 14:52:53 +02:00
bool mCompileAll;
bool mCompileAllDialogue;
2014-02-02 14:09:59 +01:00
int mWarningsMode;
std::string mFocusName;
bool mScriptConsoleMode;
std::filesystem::path mStartupScript;
int mActivationDistanceOverride;
std::filesystem::path mSaveGameFile;
// Grab mouse?
bool mGrab;
2022-09-22 21:26:05 +03:00
unsigned int mRandomSeed;
2022-09-22 21:26:05 +03:00
2010-07-03 12:12:13 +02:00
Compiler::Extensions mExtensions;
std::unique_ptr<Compiler::Context> mScriptContext;
2022-09-22 21:26:05 +03:00
Files::Collections mFileCollections;
2011-05-05 19:56:16 +02:00
bool mFSStrict;
Translation::Storage mTranslationDataStorage;
std::vector<ESM::RefId> mScriptBlacklist;
2014-07-21 09:34:10 +02:00
bool mScriptBlacklistUse;
2014-09-01 11:55:12 +02:00
bool mNewGame;
2022-09-22 21:26:05 +03:00
// not implemented
Engine(const Engine&);
Engine& operator=(const Engine&);
2022-09-22 21:26:05 +03:00
void executeLocalScripts();
2022-09-22 21:26:05 +03:00
bool frame(float dt);
2022-09-22 21:26:05 +03:00
/// Prepare engine for game play
void prepareEngine();
2022-09-22 21:26:05 +03:00
void createWindow();
2015-05-13 15:03:21 +02:00
void setWindowIcon();
2022-09-22 21:26:05 +03:00
public:
Engine(Files::ConfigurationManager& configurationManager);
virtual ~Engine();
2022-09-22 21:26:05 +03:00
2011-05-05 19:56:16 +02: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);
2022-09-22 21:26:05 +03:00
/// Set data dirs
void setDataDirs(const Files::PathContainer& dataDirs);
2022-09-22 21:26:05 +03:00
/// Add BSA archive
void addArchive(const std::string& archive);
2022-09-22 21:26:05 +03:00
/// Set resource dir
void setResourceDir(const std::filesystem::path& parResDir);
2022-09-22 21:26:05 +03:00
/// Set start cell name
void setCell(const std::string& cellName);
2022-09-22 21:26:05 +03:00
/**
* @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 11:42:47 +04:00
void addGroundcoverFile(const std::string& file);
2022-09-22 21:26:05 +03:00
/// Disable or enable all sounds
void setSoundUsage(bool soundUsage);
2022-09-22 21:26:05 +03:00
2014-09-01 11:55:12 +02: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);
2022-09-22 21:26:05 +03:00
void setGrabMouse(bool grab) { mGrab = grab; }
2022-09-22 21:26:05 +03:00
/// Initialise and enter main loop.
void go();
2010-10-06 14:52:53 +02: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 23:23:24 +04:00
void setEncoding(const ToUTF8::FromType& encoding);
/// Enable console-only script functionality
void setScriptConsoleMode(bool enabled);
2012-07-30 12:37:46 +02:00
/// Set path for a script that is run on startup in the console.
void setStartupScript(const std::filesystem::path& path);
2012-07-30 12:37:46 +02:00
/// Override the game setting specified activation distance.
void setActivationDistanceOverride(int distance);
2014-02-02 14:09:59 +01:00
void setWarningsMode(int mode);
void setScriptBlacklist(const std::vector<ESM::RefId>& list);
2014-07-21 09:34:10 +02:00
void setScriptBlacklistUse(bool use);
/// Set the save game file to load after initialising the engine.
void setSaveGameFile(const std::filesystem::path& savegame);
void setRandomSeed(unsigned int seed);
private:
Files::ConfigurationManager& mCfgMgr;
2022-06-06 22:40:38 +02:00
int mGlMaxTextureImageUnits;
};
}
#endif /* ENGINE_H */