1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 12:32:36 +00:00
OpenMW/apps/openmw/mwworld/worldimp.hpp

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

679 lines
27 KiB
C++
Raw Normal View History

#ifndef GAME_MWWORLD_WORLDIMP_H
#define GAME_MWWORLD_WORLDIMP_H
#include <osg/Timer>
#include <osg/ref_ptr>
#include <components/esm3/readerscache.hpp>
#include <components/misc/rng.hpp>
2016-01-06 12:46:06 +01:00
#include <components/settings/settings.hpp>
#include "../mwbase/world.hpp"
#include "contentloader.hpp"
2012-10-01 19:17:04 +04:00
#include "esmstore.hpp"
#include "globals.hpp"
#include "groundcoverstore.hpp"
#include "localscripts.hpp"
#include "ptr.hpp"
#include "scene.hpp"
#include "timestamp.hpp"
2022-12-06 00:11:19 +01:00
#include "worldmodel.hpp"
namespace osg
{
class Group;
class Stats;
}
namespace osgViewer
{
class Viewer;
}
namespace Resource
{
class ResourceSystem;
}
2017-02-14 03:37:45 +01:00
namespace SceneUtil
{
class WorkQueue;
class UnrefQueue;
2017-02-14 03:37:45 +01:00
}
2010-07-22 12:29:23 +02:00
namespace ESM
{
struct Position;
2023-02-15 23:19:51 +01:00
class RefId;
2010-07-22 12:29:23 +02:00
}
namespace Files
{
class Collections;
}
namespace MWRender
{
class SkyManager;
class Animation;
class Camera;
2022-05-13 18:58:00 -07:00
class PostProcessor;
}
2015-07-09 19:22:04 +02:00
namespace ToUTF8
{
class Utf8Encoder;
}
2018-08-25 23:51:54 +03:00
namespace MWPhysics
{
class Object;
}
2010-07-03 15:41:20 +02:00
namespace MWWorld
{
class DateTimeManager;
class WeatherManager;
class Player;
class ProjectileManager;
/// \brief The game world and its visual representation
class World final : public MWBase::World
{
private:
2015-05-12 17:40:42 +02:00
Resource::ResourceSystem* mResourceSystem;
ESM::ReadersCache mReaders;
2012-10-01 19:17:04 +04:00
MWWorld::ESMStore mStore;
GroundcoverStore mGroundcoverStore;
LocalScripts mLocalScripts;
MWWorld::Globals mGlobalVariables;
Misc::Rng::Generator mPrng;
2022-12-15 20:56:17 +01:00
WorldModel mWorldModel;
std::vector<int> mESMVersions; // the versions of esm files
2023-01-19 17:31:45 +01:00
std::string mCurrentWorldSpace;
2014-05-17 05:21:17 +02:00
std::unique_ptr<MWWorld::Player> mPlayer;
std::unique_ptr<MWPhysics::PhysicsSystem> mPhysics;
std::unique_ptr<DetourNavigator::Navigator> mNavigator;
std::unique_ptr<MWRender::RenderingManager> mRendering;
std::unique_ptr<MWWorld::Scene> mWorldScene;
std::unique_ptr<MWWorld::WeatherManager> mWeatherManager;
std::unique_ptr<MWWorld::DateTimeManager> mTimeManager;
std::unique_ptr<ProjectileManager> mProjectileManager;
bool mSky;
2013-08-29 20:25:36 -04:00
bool mGodMode;
2015-02-10 20:25:57 +01:00
bool mScriptsEnabled;
Process movement queue in one or several background threads Before movement calculation, the main thread prepare a vector of ActorFrameData, which contains all data necessary to perform the simulation, and feed it to the solver. At the same time it fetches the result from the previous background simulation, which in turn is used by the game mechanics. Other functions of the physics system (weapon hit for instance) interrupt the background simulation, with some exceptions described below. The number of threads is controlled by the numeric setting [Physics] async num threads In case 'async num threads' > 1 and Bullet doesn't support multiple threads, 1 async thread will be used. 0 means synchronous solver. Additional settings (will be silently switched off if async num threads = 0) [Physics] defer aabb update Update AABBs of actors and objects in the background thread(s). It is not an especially costly operation, but it needs exclusive access to the collision world, which blocks other operations. Since AABB needs to be updated for collision detection, one can queue them to defer update before start of the movement solver. Extensive tests on as much as one installation (mine) show no drawback having that switched on. [Physics] lineofsight keep inactive cache Control for how long (how many frames) the line of sight (LOS) request will be kept updated. When a request for LOS is made for the first time, the background threads are stopped to service it. From now on, the LOS will be refreshed preemptively as part of the background routine until it is not required for lineofsight keep inactive cache frames. This mean that subsequent request will not interrupt the background computation.
2020-10-15 06:11:44 +02:00
bool mDiscardMovements;
std::vector<std::string> mContentFiles;
2013-08-29 20:25:36 -04:00
std::filesystem::path mUserDataPath;
int mActivationDistanceOverride;
2023-01-19 17:31:45 +01:00
std::string mStartCell;
float mSwimHeightScale;
float mDistanceToFacedObject;
bool mTeleportEnabled;
bool mLevitationEnabled;
bool mGoToJail;
int mDaysInPrison;
bool mPlayerTraveling;
bool mPlayerInJail;
float mSpellPreloadTimer;
2019-08-25 15:20:14 +02:00
std::map<MWWorld::Ptr, MWWorld::DoorState> mDoorStates;
///< only holds doors that are currently moving. 1 = opening, 2 = closing
2013-04-28 14:59:15 +02:00
uint32_t mRandomSeed{};
// not implemented
World(const World&) = delete;
World& operator=(const World&) = delete;
void updateWeather(float duration, bool paused = false);
2011-09-04 09:48:50 +02:00
2023-07-17 17:06:28 +02:00
void initObjectInCell(const Ptr& ptr, CellStore& cell, bool adjustPos);
Ptr moveObjectToCell(const Ptr& ptr, CellStore* cell, ESM::Position pos, bool adjustPos);
Ptr copyObjectToCell(const ConstPtr& ptr, CellStore* cell, ESM::Position pos, int count, bool adjustPos);
void updateSoundListener();
void preloadSpells();
MWWorld::Ptr getFacedObject(float maxDistance, bool ignorePlayer = true);
void PCDropped(const Ptr& item);
2019-08-25 15:20:14 +02:00
bool rotateDoor(const Ptr door, DoorState state, float duration);
void processDoors(float duration);
2013-04-29 11:00:15 +02:00
///< Run physics simulation and modify \a world accordingly.
void doPhysics(float duration, osg::Timer_t frameStart, unsigned int frameNumber, osg::Stats& stats);
///< Run physics simulation and modify \a world accordingly.
2018-08-25 23:51:54 +03:00
void updateNavigator();
void updateNavigatorObject(
const MWPhysics::Object& object, const DetourNavigator::UpdateGuard* navigatorUpdateGuard = nullptr);
2018-08-25 23:51:54 +03:00
void ensureNeededRecords();
void fillGlobalVariables();
void updateSkyDate();
void loadContentFiles(const Files::Collections& fileCollections, const std::vector<std::string>& content,
ToUTF8::Utf8Encoder* encoder, Loading::Listener* listener);
2022-06-03 18:59:08 +02:00
void loadGroundcoverFiles(const Files::Collections& fileCollections,
const std::vector<std::string>& groundcoverFiles, ToUTF8::Utf8Encoder* encoder,
Loading::Listener* listener);
float feetToGameUnits(float feet);
float getActivationDistancePlusTelekinesis();
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
MWWorld::ConstPtr getClosestMarker(const MWWorld::ConstPtr& ptr, const ESM::RefId& id);
MWWorld::ConstPtr getClosestMarkerFromExteriorPosition(const osg::Vec3f& worldPos, const ESM::RefId& id);
public:
2022-12-15 20:56:17 +01:00
WorldModel& getWorldModel() { return mWorldModel; }
Scene& getWorldScene() { return *mWorldScene; }
// FIXME
void addContainerScripts(const Ptr& reference, CellStore* cell) override;
void removeContainerScripts(const Ptr& reference) override;
World(Resource::ResourceSystem* resourceSystem, int activationDistanceOverride, const std::string& startCell,
const std::filesystem::path& userDataPath);
void loadData(const Files::Collections& fileCollections, const std::vector<std::string>& contentFiles,
const std::vector<std::string>& groundcoverFiles, ToUTF8::Utf8Encoder* encoder,
Loading::Listener* listener);
// Must be called after `loadData`.
void init(osgViewer::Viewer* viewer, osg::ref_ptr<osg::Group> rootNode, SceneUtil::WorkQueue* workQueue,
SceneUtil::UnrefQueue& unrefQueue);
virtual ~World();
void setRandomSeed(uint32_t seed) override;
void startNewGame(bool bypass) override;
///< \param bypass Bypass regular game start.
2013-05-15 17:54:18 +02:00
void clear() override;
int countSavedGameRecords() const override;
int countSavedGameCells() const override;
2013-12-07 13:17:28 +01:00
void write(ESM::ESMWriter& writer, Loading::Listener& progress) const override;
2013-12-07 13:17:28 +01:00
void readRecord(ESM::ESMReader& reader, uint32_t type) override;
2013-12-07 13:17:28 +01:00
// switch to POV before showing player's death animation
void useDeathCamera() override;
void setWaterHeight(const float height) override;
2012-03-29 15:49:24 +02:00
2021-08-15 19:50:28 +02:00
void rotateWorldObject(const MWWorld::Ptr& ptr, const osg::Quat& rotate) override;
bool toggleWater() override;
bool toggleWorld() override;
2018-06-13 01:48:31 +02:00
bool toggleBorders() override;
void adjustSky();
Player& getPlayer() override;
MWWorld::Ptr getPlayerPtr() override;
MWWorld::ConstPtr getPlayerConstPtr() const override;
MWWorld::ESMStore& getStore() override { return mStore; }
2011-09-04 09:48:50 +02:00
const std::vector<int>& getESMVersions() const override;
LocalScripts& getLocalScripts() override;
bool isCellExterior() const override;
bool isCellQuasiExterior() const override;
2023-05-09 22:08:17 +02:00
ESM::RefId getCurrentWorldspace() const;
void getDoorMarkers(MWWorld::CellStore& cell, std::vector<DoorMarker>& out) override;
2012-08-28 17:30:34 +02:00
///< get a list of teleport door markers for a given cell, to be displayed on the local map
void setGlobalInt(GlobalVariableName name, int value) override;
///< Set value independently from real type.
void setGlobalFloat(GlobalVariableName name, float value) override;
///< Set value independently from real type.
int getGlobalInt(GlobalVariableName name) const override;
///< Get value independently from real type.
float getGlobalFloat(GlobalVariableName name) const override;
///< Get value independently from real type.
2011-04-21 11:00:00 +02:00
char getGlobalVariableType(GlobalVariableName name) const override;
///< Return ' ', if there is no global variable with this name.
2013-03-06 19:57:00 +01:00
std::string_view getCellName(const MWWorld::CellStore* cell = nullptr) const override;
///< Return name of the cell.
///
/// \note If cell==0, the cell the player is currently in will be used instead to
/// generate a name.
std::string_view getCellName(const MWWorld::Cell& cell) const override;
std::string_view getCellName(const ESM::Cell* cell) const override;
2013-03-06 19:57:00 +01:00
void removeRefScript(MWWorld::RefData* ref) override;
//< Remove the script attached to ref from mLocalScripts
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
Ptr getPtr(const ESM::RefId& name, bool activeOnly) override;
///< Return a pointer to a liveCellRef with the given name.
/// \param activeOnly do non search inactive cells.
2010-07-09 16:07:03 +02:00
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
Ptr searchPtr(const ESM::RefId& name, bool activeOnly, bool searchInContainers = false) override;
///< Return a pointer to a liveCellRef with the given name.
2020-09-15 21:13:18 +02:00
/// \param activeOnly do not search inactive cells.
Ptr searchPtrViaActorId(int actorId) override;
2014-04-29 15:27:49 +02:00
///< Search is limited to the active cells.
MWWorld::Ptr findContainer(const MWWorld::ConstPtr& ptr) override;
///< Return a pointer to a liveCellRef which contains \a ptr.
/// \note Search is limited to the active cells.
void adjustPosition(const Ptr& ptr, bool force) override;
///< Adjust position after load to be on ground. Must be called after model load.
/// @param force do this even if the ptr is flying
2018-10-24 01:40:57 +03:00
void fixPosition() override;
///< Attempt to fix position so that the player is not stuck inside the geometry.
void enable(const Ptr& ptr) override;
void disable(const Ptr& ptr) override;
void advanceTime(double hours, bool incremental = false) override;
///< Advance in-game time.
TimeStamp getTimeStamp() const override;
///< Return current in-game time and number of day since new game start.
bool toggleSky() override;
///< \return Resulting mode
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
void changeWeather(const ESM::RefId& region, const unsigned int id) override;
int getCurrentWeather() const override;
2022-05-13 18:58:00 -07:00
int getNextWeather() const override;
float getWeatherTransition() const override;
unsigned int getNightDayMode() const override;
int getMasserPhase() const override;
int getSecundaPhase() const override;
void setMoonColour(bool red) override;
void modRegion(const ESM::RefId& regionid, const std::vector<uint8_t>& chances) override;
2023-01-19 17:31:45 +01:00
void changeToInteriorCell(const std::string_view cellName, const ESM::Position& position, bool adjustPlayerPos,
bool changeEvent = true) override;
2011-02-10 10:38:45 +01:00
///< Move to interior cell.
///< @param changeEvent If false, do not trigger cell change flag or detect worldspace changes
void changeToCell(const ESM::RefId& cellId, const ESM::Position& position, bool adjustPlayerPos,
bool changeEvent = true) override;
///< @param changeEvent If false, do not trigger cell change flag or detect worldspace changes
MWWorld::Ptr getFacedObject() override;
///< Return pointer to the object the player is looking at, if it is within activation range
2010-08-07 20:25:17 +02:00
float getDistanceToFacedObject() override;
/// @note No-op for items in containers. Use ContainerStore::removeItem instead.
void deleteObject(const Ptr& ptr) override;
void undeleteObject(const Ptr& ptr) override;
MWWorld::Ptr moveObject(
const Ptr& ptr, const osg::Vec3f& position, bool movePhysics = true, bool moveToActive = false) override;
///< @return an updated Ptr in case the Ptr's cell changes
MWWorld::Ptr moveObject(const Ptr& ptr, CellStore* newCell, const osg::Vec3f& position, bool movePhysics = true,
bool keepActive = false) override;
///< @return an updated Ptr
MWWorld::Ptr moveObjectBy(const Ptr& ptr, const osg::Vec3f& vec, bool moveToActive) override;
///< @return an updated Ptr
void scaleObject(const Ptr& ptr, float scale, bool force = false) override;
/// World rotates object, uses radians
/// @note Rotations via this method use a different rotation order than the initial rotations in the CS. This
/// could be considered a bug, but is needed for MW compatibility.
2012-08-11 13:23:54 +04:00
/// \param adjust indicates rotation should be set or adjusted
void rotateObject(const Ptr& ptr, const osg::Vec3f& rot,
MWBase::RotationFlags flags = MWBase::RotationFlag_inverseOrder) override;
2021-08-15 19:50:28 +02:00
MWWorld::Ptr placeObject(
const MWWorld::ConstPtr& ptr, MWWorld::CellStore* cell, const ESM::Position& pos) override;
2016-02-29 17:16:33 +01:00
///< Place an object. Makes a copy of the Ptr.
MWWorld::Ptr safePlaceObject(const MWWorld::ConstPtr& ptr, const MWWorld::ConstPtr& referenceObject,
MWWorld::CellStore* referenceCell, int direction, float distance) override;
2016-02-29 17:16:33 +01:00
///< Place an object in a safe place next to \a referenceObject. \a direction and \a distance specify the wanted
///< placement
/// relative to \a referenceObject (but the object may be placed somewhere else if the wanted location is
/// obstructed).
2012-09-17 13:36:48 +02:00
float getMaxActivationDistance() const override;
void queueMovement(const Ptr& ptr, const osg::Vec3f& velocity, float duration, bool jump = false) override;
///< Queues movement for \a ptr (in local space), to be applied in the next call to
/// doPhysics.
/// \param duration The duration this speed shall be held, starting at current simulation time
/// \param jump Whether the movement shall be run over time, or immediately added as inertia instead
void updateAnimatedCollisionShape(const Ptr& ptr) override;
2020-08-03 22:44:16 +02:00
const MWPhysics::RayCastingInterface* getRayCasting() const override;
2022-03-18 00:27:16 +01:00
bool castRenderingRay(MWPhysics::RayCastingResult& res, const osg::Vec3f& from, const osg::Vec3f& to,
bool ignorePlayer, bool ignoreActors) override;
void setActorCollisionMode(const Ptr& ptr, bool internal, bool external) override;
bool isActorCollisionEnabled(const Ptr& ptr) override;
bool toggleCollisionMode() override;
///< Toggle collision mode for player. If disabled player object should ignore
/// collisions and gravity.
///< \return Resulting mode
bool toggleRenderMode(MWRender::RenderMode mode) override;
///< Toggle a render mode.
///< \return Resulting mode
void update(float duration, bool paused);
void updatePhysics(
float duration, bool paused, osg::Timer_t frameStart, unsigned int frameNumber, osg::Stats& stats);
2012-02-19 15:39:12 -05:00
void updateWindowManager();
MWWorld::Ptr placeObject(
const MWWorld::Ptr& object, float cursorX, float cursorY, int amount, bool copy = true) override;
///< copy and place an object into the gameworld at the specified cursor position
/// @param object
/// @param cursor X (relative 0-1)
/// @param cursor Y (relative 0-1)
/// @param number of objects to place
MWWorld::Ptr dropObjectOnGround(
const MWWorld::Ptr& actor, const MWWorld::Ptr& object, int amount, bool copy = true) override;
///< copy and place an object into the gameworld at the given actor's position
/// @param actor giving the dropped object position
/// @param object
/// @param number of objects to place
bool canPlaceObject(float cursorX, float cursorY) override;
///< @return true if it is possible to place on object at specified cursor location
2012-05-23 01:32:36 +02:00
void processChangedSettings(const Settings::CategorySettingVector& settings) override;
bool isFlying(const MWWorld::Ptr& ptr) const override;
bool isSlowFalling(const MWWorld::Ptr& ptr) const override;
/// Is the head of the creature underwater?
bool isSubmerged(const MWWorld::ConstPtr& object) const override;
bool isSwimming(const MWWorld::ConstPtr& object) const override;
bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f& pos) const override;
bool isUnderwater(const MWWorld::ConstPtr& object, const float heightRatio) const override;
bool isWading(const MWWorld::ConstPtr& object) const override;
bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr& target) const override;
bool isOnGround(const MWWorld::Ptr& ptr) const override;
osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const override;
void togglePOV(bool force = false) override;
2012-08-14 14:37:48 +04:00
bool isFirstPerson() const override;
2020-08-04 06:04:59 +00:00
bool isPreviewModeEnabled() const override;
bool toggleVanityMode(bool enable) override;
2012-08-14 14:37:48 +04:00
2021-06-14 19:58:04 +02:00
MWRender::Camera* getCamera() override;
bool vanityRotateCamera(const float* rot) override;
2020-06-27 00:58:33 +02:00
void applyDeferredPreviewRotationToPlayer(float dt) override;
void disableDeferredPreviewRotation() override;
void saveLoaded() override;
void setupPlayer() override;
void renderPlayer() override;
2012-12-23 23:23:24 +04:00
/// open or close a non-teleport door (depending on current state)
void activateDoor(const MWWorld::Ptr& door) override;
/// update movement state of a non-teleport door as specified
/// @param state see MWClass::setDoorState
/// @note throws an exception when invoked on a teleport door
2019-08-25 15:20:14 +02:00
void activateDoor(const MWWorld::Ptr& door, MWWorld::DoorState state) override;
2013-04-28 14:59:15 +02:00
2018-09-04 12:37:43 +04:00
void getActorsStandingOn(const MWWorld::ConstPtr& object,
std::vector<MWWorld::Ptr>& actors) override; ///< get a list of actors standing on \a object
bool getPlayerStandingOn(
const MWWorld::ConstPtr& object) override; ///< @return true if the player is standing on \a object
bool getActorStandingOn(
const MWWorld::ConstPtr& object) override; ///< @return true if any actor is standing on \a object
bool getPlayerCollidingWith(
const MWWorld::ConstPtr& object) override; ///< @return true if the player is colliding with \a object
bool getActorCollidingWith(
const MWWorld::ConstPtr& object) override; ///< @return true if any actor is colliding with \a object
void hurtStandingActors(const MWWorld::ConstPtr& object, float dmgPerSecond) override;
///< Apply a health difference to any actors standing on \a object.
/// To hurt actors, healthPerSecond should be a positive value. For a negative value, actors will be healed.
2017-10-19 16:34:11 +01:00
void hurtCollidingActors(const MWWorld::ConstPtr& object, float dmgPerSecond) override;
///< Apply a health difference to any actors colliding with \a object.
/// To hurt actors, healthPerSecond should be a positive value. For a negative value, actors will be healed.
2017-10-19 16:34:11 +01:00
float getWindSpeed() override;
2017-10-19 16:34:11 +01:00
void getContainersOwnedBy(const MWWorld::ConstPtr& npc, std::vector<MWWorld::Ptr>& out) override;
2013-05-11 18:38:27 +02:00
///< get all containers in active cells owned by this Npc
2017-10-19 16:34:11 +01:00
void getItemsOwnedBy(const MWWorld::ConstPtr& npc, std::vector<MWWorld::Ptr>& out) override;
2013-05-27 02:18:36 +02:00
///< get all items in active cells owned by this Npc
2013-05-11 18:38:27 +02:00
2017-10-19 16:34:11 +01:00
bool getLOS(const MWWorld::ConstPtr& actor, const MWWorld::ConstPtr& targetActor) override;
///< get Line of Sight (morrowind stupid implementation)
2017-10-19 16:34:11 +01:00
float getDistToNearestRayHit(
const osg::Vec3f& from, const osg::Vec3f& dir, float maxDist, bool includeWater = false) override;
2014-04-20 20:35:07 +04:00
2017-10-19 16:34:11 +01:00
void enableActorCollision(const MWWorld::Ptr& actor, bool enable) override;
2013-06-27 14:11:20 -07:00
2018-09-23 06:25:20 +03:00
RestPermitted canRest() const override;
///< check if the player is allowed to rest
void rest(double hours) override;
2022-05-06 19:56:10 +02:00
void rechargeItems(double duration, bool activeOnly);
2012-09-25 02:35:50 +02:00
/// \todo Probably shouldn't be here
2017-10-19 16:34:11 +01:00
MWRender::Animation* getAnimation(const MWWorld::Ptr& ptr) override;
const MWRender::Animation* getAnimation(const MWWorld::ConstPtr& ptr) const override;
void reattachPlayerCamera() override;
2012-09-25 02:35:50 +02:00
/// \todo this does not belong here
2017-10-19 16:34:11 +01:00
void screenshot(osg::Image* image, int w, int h) override;
bool screenshot360(osg::Image* image) override;
/// Find center of exterior cell above land surface
/// \return false if exterior with given name not exists, true otherwise
ESM::RefId findExteriorPosition(std::string_view nameId, ESM::Position& pos) override;
/// Find position in interior cell near door entrance
/// \return false if interior with given name not exists, true otherwise
ESM::RefId findInteriorPosition(std::string_view name, ESM::Position& pos) override;
/// Enables or disables use of teleport spell effects (recall, intervention, etc).
2017-10-19 16:34:11 +01:00
void enableTeleporting(bool enable) override;
/// Returns true if teleport spell effects are allowed.
2017-10-19 16:34:11 +01:00
bool isTeleportingEnabled() const override;
/// Enables or disables use of levitation spell effect.
2017-10-19 16:34:11 +01:00
void enableLevitation(bool enable) override;
/// Returns true if levitation spell effect is allowed.
2017-10-19 16:34:11 +01:00
bool isLevitationEnabled() const override;
2020-12-22 06:19:18 +03:00
bool getGodModeState() const override;
2017-10-19 16:34:11 +01:00
bool toggleGodMode() override;
2017-10-19 16:34:11 +01:00
bool toggleScripts() override;
bool getScriptsEnabled() const override;
2015-02-10 20:25:57 +01:00
/**
* @brief startSpellCast attempt to start casting a spell. Might fail immediately if conditions are not met.
* @param actor
* @return Success or the failure condition.
*/
MWWorld::SpellCastState startSpellCast(const MWWorld::Ptr& actor) override;
/**
* @brief Cast the actual spell, should be called mid-animation
* @param actor
*/
void castSpell(const MWWorld::Ptr& actor, bool manualSpell = false) override;
2013-10-25 22:16:52 +02:00
void launchMagicBolt(const ESM::RefId& spellId, const MWWorld::Ptr& caster, const osg::Vec3f& fallbackDirection,
ESM::RefNum item) override;
void launchProjectile(MWWorld::Ptr& actor, MWWorld::Ptr& projectile, const osg::Vec3f& worldPos,
const osg::Quat& orient, MWWorld::Ptr& bow, float speed, float attackStrength) override;
void updateProjectilesCasters() override;
2013-12-08 23:36:37 +01:00
void applyLoopingParticles(const MWWorld::Ptr& ptr) const override;
2017-10-19 16:34:11 +01:00
const std::vector<std::string>& getContentFiles() const override;
void breakInvisibility(const MWWorld::Ptr& actor) override;
// Allow NPCs to use torches?
bool useTorches() const override;
float getSunVisibility() const override;
float getSunPercentage() const override;
2017-10-19 16:34:11 +01:00
bool findInteriorPositionInWorldSpace(const MWWorld::CellStore* cell, osg::Vec3f& result) override;
/// Teleports \a ptr to the closest reference of \a id (e.g. DivineMarker, PrisonMarker, TempleMarker)
/// @note id must be lower case
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
void teleportToClosestMarker(const MWWorld::Ptr& ptr, const ESM::RefId& id) override;
/// List all references (filtered by \a type) detected by \a ptr. The range
/// is determined by the current magnitude of the "Detect X" magic effect belonging to \a type.
/// @note This also works for references in containers.
2017-10-19 16:34:11 +01:00
void listDetectedReferences(
const MWWorld::Ptr& ptr, std::vector<MWWorld::Ptr>& out, DetectionType type) override;
/// Update the value of some globals according to the world state, which may be used by dialogue entries.
/// This should be called when initiating a dialogue.
2017-10-19 16:34:11 +01:00
void updateDialogueGlobals() override;
2014-01-11 03:29:41 +01:00
/// Moves all stolen items from \a ptr to the closest evidence chest.
2017-10-19 16:34:11 +01:00
void confiscateStolenItems(const MWWorld::Ptr& ptr) override;
2014-01-11 06:47:58 +01:00
2017-10-19 16:34:11 +01:00
void goToJail() override;
/// Spawn a random creature from a levelled list next to the player
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
void spawnRandomCreature(const ESM::RefId& creatureList) override;
2014-01-17 10:52:44 +01:00
/// Spawn a blood effect for \a ptr at \a worldPosition
2017-10-19 16:34:11 +01:00
void spawnBloodEffect(const MWWorld::Ptr& ptr, const osg::Vec3f& worldPosition) override;
2018-07-15 12:44:25 +04:00
void spawnEffect(const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos,
float scale = 1.f, bool isMagicVFX = true) override;
/// @see MWWorld::WeatherManager::isInStorm
2017-10-19 16:34:11 +01:00
bool isInStorm() const override;
/// @see MWWorld::WeatherManager::getStormDirection
2017-10-19 16:34:11 +01:00
osg::Vec3f getStormDirection() const override;
/// Resets all actors in the current active cells to their original location within that cell.
2017-10-19 16:34:11 +01:00
void resetActors() override;
2014-10-05 22:24:11 +02:00
2017-10-19 16:34:11 +01:00
bool isWalkingOnWater(const MWWorld::ConstPtr& actor) const override;
/// Return a vector aiming the actor's weapon towards a target.
/// @note The length of the vector is the distance between actor and target.
2021-04-07 12:07:03 +04:00
osg::Vec3f aimToTarget(
const MWWorld::ConstPtr& actor, const MWWorld::ConstPtr& target, bool isRangedCombat) override;
2017-10-19 16:34:11 +01:00
bool isPlayerInJail() const override;
2016-11-16 20:15:25 +01:00
void setPlayerTraveling(bool traveling) override;
bool isPlayerTraveling() const override;
2016-11-16 20:15:25 +01:00
/// Return terrain height at \a worldPos position.
float getTerrainHeightAt(const osg::Vec3f& worldPos, ESM::RefId worldspace) const override;
2016-11-16 20:15:25 +01:00
/// Return physical or rendering half extents of the given actor.
2017-10-19 16:34:11 +01:00
osg::Vec3f getHalfExtents(const MWWorld::ConstPtr& actor, bool rendering = false) const override;
/// Export scene graph to a file and return the filename.
/// \param ptr object to export scene graph for (if empty, export entire scene graph)
std::filesystem::path exportSceneGraph(const MWWorld::Ptr& ptr) override;
/// Preload VFX associated with this effect list
2017-10-19 16:34:11 +01:00
void preloadEffects(const ESM::EffectList* effectList) override;
2018-03-14 01:49:08 +03:00
DetourNavigator::Navigator* getNavigator() const override;
void updateActorPath(const MWWorld::ConstPtr& actor, const std::deque<osg::Vec3f>& path,
const DetourNavigator::AgentBounds& agentBounds, const osg::Vec3f& start,
const osg::Vec3f& end) const override;
void removeActorPath(const MWWorld::ConstPtr& actor) const override;
void setNavMeshNumberToRender(const std::size_t value) override;
DetourNavigator::AgentBounds getPathfindingAgentBounds(const MWWorld::ConstPtr& actor) const override;
bool hasCollisionWithDoor(
const MWWorld::ConstPtr& door, const osg::Vec3f& position, const osg::Vec3f& destination) const override;
bool isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius,
2022-08-01 00:28:14 +02:00
std::span<const MWWorld::ConstPtr> ignore, std::vector<MWWorld::Ptr>* occupyingActors) const override;
void reportStats(unsigned int frameNumber, osg::Stats& stats) const override;
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID Slowly going through all the changes to make, still hundreds of errors a lot of functions/structures use std::string or stringview to designate an ID. So it takes time Continues slowly replacing ids. There are technically more and more compilation errors I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type Continue moving forward, changes to the stores slowly moving along Starting to see the fruit of those changes. still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type. More replacements. Things are starting to get easier I can see more and more often the issue is that the function is awaiting a RefId, but is given a string there is less need to go down functions and to fix a long list of them. Still moving forward, and for the first time error count is going down! Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably Cells are back to using string for the name, haven't fixed everything yet. Many other changes Under the bar of 400 compilation errors. more good progress <100 compile errors! More progress Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string some more progress on other fronts Mostly game settings clean one error opened a lot of other errors. Down to 18, but more will prbably appear only link errors left?? Fixed link errors OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
std::vector<MWWorld::Ptr> getAll(const ESM::RefId& id) override;
Misc::Rng::Generator& getPrng() override;
2022-04-03 20:42:19 +02:00
MWRender::RenderingManager* getRenderingManager() override { return mRendering.get(); }
2022-05-13 18:58:00 -07:00
MWRender::PostProcessor* getPostProcessor() override;
DateTimeManager* getTimeManager() override { return mTimeManager.get(); }
void setActorActive(const MWWorld::Ptr& ptr, bool value) override;
};
}
#endif