OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
worldimp.hpp
Go to the documentation of this file.
1 #ifndef GAME_MWWORLD_WORLDIMP_H
2 #define GAME_MWWORLD_WORLDIMP_H
3 
4 #include <boost/shared_ptr.hpp>
5 
6 #include <osg/ref_ptr>
7 
10 
11 #include "../mwbase/world.hpp"
12 
13 #include "ptr.hpp"
14 #include "scene.hpp"
15 #include "esmstore.hpp"
16 #include "cells.hpp"
17 #include "localscripts.hpp"
18 #include "timestamp.hpp"
19 #include "globals.hpp"
20 #include "contentloader.hpp"
21 
22 namespace osg
23 {
24  class Group;
25 }
26 
27 namespace osgViewer
28 {
29  class Viewer;
30 }
31 
32 namespace Resource
33 {
34  class ResourceSystem;
35 }
36 
37 namespace ESM
38 {
39  struct Position;
40 }
41 
42 namespace Files
43 {
44  class Collections;
45 }
46 
47 namespace MWRender
48 {
49  class SkyManager;
50  class Animation;
51  class Camera;
52 }
53 
54 namespace ToUTF8
55 {
56  class Utf8Encoder;
57 }
58 
59 struct ContentLoader;
60 
61 namespace MWWorld
62 {
63  class WeatherManager;
64  class Player;
65  class ProjectileManager;
66 
68 
69  class World : public MWBase::World
70  {
72 
75 
77 
80  std::vector<ESM::ESMReader> mEsm;
85  bool mSky;
86 
93 
95 
96  std::string mCurrentWorldSpace;
97 
98  boost::shared_ptr<ProjectileManager> mProjectileManager;
99 
100  bool mGodMode;
102  std::vector<std::string> mContentFiles;
103 
104  // not implemented
105  World (const World&);
106  World& operator= (const World&);
107 
109 
110  std::string mStartupScript;
111 
112  std::map<MWWorld::Ptr, int> mDoorStates;
114 
115  std::string mStartCell;
116 
117  void updateWeather(float duration, bool paused = false);
118  int getDaysPerMonth (int month) const;
119 
120  void rotateObjectImp (const Ptr& ptr, const osg::Vec3f& rot, bool adjust);
121 
122  Ptr moveObjectImp (const Ptr& ptr, float x, float y, float z, bool movePhysics=true);
124 
125  Ptr copyObjectToCell(const ConstPtr &ptr, CellStore* cell, ESM::Position pos, int count, bool adjustPos);
126 
127  void updateSoundListener();
128  void updateWindowManager ();
129  void updatePlayer(bool paused);
130 
131  MWWorld::Ptr getFacedObject(float maxDistance, bool ignorePlayer=true);
132 
133  public: // FIXME
134  void removeContainerScripts(const Ptr& reference);
135  private:
136  void addContainerScripts(const Ptr& reference, CellStore* cell);
137  void PCDropped (const Ptr& item);
138 
139  void processDoors(float duration);
141 
142  void doPhysics(float duration);
144 
145  void ensureNeededRecords();
146 
147  void fillGlobalVariables();
148 
155  void loadContentFiles(const Files::Collections& fileCollections,
156  const std::vector<std::string>& content, ContentLoader& contentLoader);
157 
159 
161 
162  bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const;
164 
167  bool mGoToJail;
169 
170  float feetToGameUnits(float feet);
172 
173  MWWorld::ConstPtr getClosestMarker( const MWWorld::Ptr &ptr, const std::string &id );
174  MWWorld::ConstPtr getClosestMarkerFromExteriorPosition( const osg::Vec3f& worldPos, const std::string &id );
175 
176  public:
177 
178  World (
179  osgViewer::Viewer* viewer,
180  osg::ref_ptr<osg::Group> rootNode,
181  Resource::ResourceSystem* resourceSystem,
182  const Files::Collections& fileCollections,
183  const std::vector<std::string>& contentFiles,
184  ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap,
185  int activationDistanceOverride, const std::string& startCell, const std::string& startupScript, const std::string& resourcePath);
186 
187  virtual ~World();
188 
189  virtual void startNewGame (bool bypass);
191 
192  virtual void preloadCommonAssets();
193 
194  virtual void clear();
195 
196  virtual int countSavedGameRecords() const;
197  virtual int countSavedGameCells() const;
198 
199  virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
200 
201  virtual void readRecord (ESM::ESMReader& reader, uint32_t type,
202  const std::map<int, int>& contentFileMap);
203 
204  virtual CellStore *getExterior (int x, int y);
205 
206  virtual CellStore *getInterior (const std::string& name);
207 
208  virtual CellStore *getCell (const ESM::CellId& id);
209 
210  //switch to POV before showing player's death animation
211  virtual void useDeathCamera();
212 
213  virtual void setWaterHeight(const float height);
214 
215  virtual bool toggleWater();
216  virtual bool toggleWorld();
217 
218  virtual void adjustSky();
219 
220  virtual const Fallback::Map *getFallback() const;
221 
222  virtual Player& getPlayer();
223  virtual MWWorld::Ptr getPlayerPtr();
224 
225  virtual const MWWorld::ESMStore& getStore() const;
226 
227  virtual std::vector<ESM::ESMReader>& getEsmReader();
228 
229  virtual LocalScripts& getLocalScripts();
230 
231  virtual bool hasCellChanged() const;
233 
234  virtual bool isCellExterior() const;
235 
236  virtual bool isCellQuasiExterior() const;
237 
238  virtual osg::Vec2f getNorthVector (const CellStore* cell);
240 
241  virtual void getDoorMarkers (MWWorld::CellStore* cell, std::vector<DoorMarker>& out);
243 
244  virtual void setGlobalInt (const std::string& name, int value);
246 
247  virtual void setGlobalFloat (const std::string& name, float value);
249 
250  virtual int getGlobalInt (const std::string& name) const;
252 
253  virtual float getGlobalFloat (const std::string& name) const;
255 
256  virtual char getGlobalVariableType (const std::string& name) const;
258 
259  virtual std::string getCellName (const MWWorld::CellStore *cell = 0) const;
264 
265  virtual void removeRefScript (MWWorld::RefData *ref);
266  //< Remove the script attached to ref from mLocalScripts
267 
268  virtual Ptr getPtr (const std::string& name, bool activeOnly);
271 
272  virtual Ptr searchPtr (const std::string& name, bool activeOnly);
275 
276  virtual Ptr searchPtrViaActorId (int actorId);
278 
279  virtual MWWorld::Ptr findContainer (const MWWorld::ConstPtr& ptr);
282 
283  virtual void adjustPosition (const Ptr& ptr, bool force);
286 
287  virtual void fixPosition (const Ptr& actor);
289 
290  virtual void enable (const Ptr& ptr);
291 
292  virtual void disable (const Ptr& ptr);
293 
294  virtual void advanceTime (double hours, bool incremental = false);
296 
297  virtual void setHour (double hour);
299 
300  virtual void setMonth (int month);
302 
303  virtual void setDay (int day);
305 
306  virtual int getDay() const;
307  virtual int getMonth() const;
308  virtual int getYear() const;
309 
310  virtual std::string getMonthName (int month = -1) const;
312 
313  virtual TimeStamp getTimeStamp() const;
315 
316  virtual bool toggleSky();
318 
319  virtual void changeWeather (const std::string& region, const unsigned int id);
320 
321  virtual int getCurrentWeather() const;
322 
323  virtual int getMasserPhase() const;
324 
325  virtual int getSecundaPhase() const;
326 
327  virtual void setMoonColour (bool red);
328 
329  virtual void modRegion(const std::string &regionid, const std::vector<char> &chances);
330 
331  virtual float getTimeScaleFactor() const;
332 
333  virtual void changeToInteriorCell (const std::string& cellName, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true);
336 
337  virtual void changeToExteriorCell (const ESM::Position& position, bool adjustPlayerPos, bool changeEvent = true);
340 
341  virtual void changeToCell (const ESM::CellId& cellId, const ESM::Position& position, bool adjustPlayerPos, bool changeEvent=true);
343 
344  virtual const ESM::Cell *getExterior (const std::string& cellName) const;
346 
347  virtual void markCellAsUnchanged();
348 
349  virtual MWWorld::Ptr getFacedObject();
351 
352  virtual float getDistanceToFacedObject();
353 
357  virtual std::pair<MWWorld::Ptr,osg::Vec3f> getHitContact(const MWWorld::ConstPtr &ptr, float distance);
358 
360  virtual void deleteObject (const Ptr& ptr);
361 
362  virtual void undeleteObject (const Ptr& ptr);
363 
364  virtual MWWorld::Ptr moveObject (const Ptr& ptr, float x, float y, float z);
366 
367  virtual MWWorld::Ptr moveObject (const Ptr& ptr, CellStore* newCell, float x, float y, float z, bool movePhysics=true);
369 
370  virtual void scaleObject (const Ptr& ptr, float scale);
371 
376  virtual void rotateObject (const Ptr& ptr,float x,float y,float z, bool adjust = false);
377 
380 
381  virtual MWWorld::Ptr safePlaceObject (const MWWorld::ConstPtr& ptr, const MWWorld::ConstPtr& referenceObject, MWWorld::CellStore* referenceCell, int direction, float distance);
384 
385  virtual float getMaxActivationDistance();
386 
387  virtual void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false)
388  const;
390 
391  virtual void positionToIndex (float x, float y, int &cellX, int &cellY) const;
393 
394  virtual void queueMovement(const Ptr &ptr, const osg::Vec3f &velocity);
397 
398  virtual bool castRay (float x1, float y1, float z1, float x2, float y2, float z2);
400 
401  virtual bool toggleCollisionMode();
405 
406  virtual bool toggleRenderMode (MWRender::RenderMode mode);
409 
410  virtual const ESM::Potion *createRecord (const ESM::Potion& record);
413 
414  virtual const ESM::Spell *createRecord (const ESM::Spell& record);
417 
418  virtual const ESM::Class *createRecord (const ESM::Class& record);
421 
422  virtual const ESM::Cell *createRecord (const ESM::Cell& record);
425 
426  virtual const ESM::NPC *createRecord(const ESM::NPC &record);
429 
430  virtual const ESM::Armor *createRecord (const ESM::Armor& record);
433 
434  virtual const ESM::Weapon *createRecord (const ESM::Weapon& record);
437 
438  virtual const ESM::Clothing *createRecord (const ESM::Clothing& record);
441 
442  virtual const ESM::Enchantment *createRecord (const ESM::Enchantment& record);
445 
446  virtual const ESM::Book *createRecord (const ESM::Book& record);
449 
450  virtual const ESM::CreatureLevList *createOverrideRecord (const ESM::CreatureLevList& record);
453 
454  virtual const ESM::ItemLevList *createOverrideRecord (const ESM::ItemLevList& record);
457 
458  virtual void update (float duration, bool paused);
459 
460  virtual MWWorld::Ptr placeObject (const MWWorld::ConstPtr& object, float cursorX, float cursorY, int amount);
466 
467  virtual MWWorld::Ptr dropObjectOnGround (const MWWorld::Ptr& actor, const MWWorld::ConstPtr& object, int amount);
472 
473  virtual bool canPlaceObject(float cursorX, float cursorY);
475 
476  virtual void processChangedSettings(const Settings::CategorySettingVector& settings);
477 
478  virtual bool isFlying(const MWWorld::Ptr &ptr) const;
479  virtual bool isSlowFalling(const MWWorld::Ptr &ptr) const;
481  virtual bool isSubmerged(const MWWorld::ConstPtr &object) const;
482  virtual bool isSwimming(const MWWorld::ConstPtr &object) const;
483  virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const;
484  virtual bool isWading(const MWWorld::ConstPtr &object) const;
485  virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const;
486  virtual bool isOnGround(const MWWorld::Ptr &ptr) const;
487 
488  virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr& actor) const;
489 
490  virtual void togglePOV();
491 
492  virtual bool isFirstPerson() const;
493 
494  virtual void togglePreviewMode(bool enable);
495 
496  virtual bool toggleVanityMode(bool enable);
497 
498  virtual void allowVanityMode(bool allow);
499 
500  virtual void togglePlayerLooking(bool enable);
501 
502  virtual void changeVanityModeScale(float factor);
503 
504  virtual bool vanityRotateCamera(float * rot);
505  virtual void setCameraDistance(float dist, bool adjust = false, bool override = true);
506 
507  virtual void setupPlayer();
508  virtual void renderPlayer();
509 
511  virtual void activateDoor(const MWWorld::Ptr& door);
512 
516  virtual void activateDoor(const MWWorld::Ptr& door, int state);
517 
518  virtual bool getPlayerStandingOn (const MWWorld::ConstPtr& object);
519  virtual bool getActorStandingOn (const MWWorld::ConstPtr& object);
520  virtual bool getPlayerCollidingWith(const MWWorld::ConstPtr& object);
521  virtual bool getActorCollidingWith (const MWWorld::ConstPtr& object);
522  virtual void hurtStandingActors (const MWWorld::ConstPtr& object, float dmgPerSecond);
525  virtual void hurtCollidingActors (const MWWorld::ConstPtr& object, float dmgPerSecond);
528 
529  virtual float getWindSpeed();
530 
531  virtual void getContainersOwnedBy (const MWWorld::ConstPtr& npc, std::vector<MWWorld::Ptr>& out);
533  virtual void getItemsOwnedBy (const MWWorld::ConstPtr& npc, std::vector<MWWorld::Ptr>& out);
535 
536  virtual bool getLOS(const MWWorld::ConstPtr& actor,const MWWorld::ConstPtr& targetActor);
538 
539  virtual float getDistToNearestRayHit(const osg::Vec3f& from, const osg::Vec3f& dir, float maxDist, bool includeWater = false);
540 
541  virtual void enableActorCollision(const MWWorld::Ptr& actor, bool enable);
542 
543  virtual int canRest();
549 
551  virtual MWRender::Animation* getAnimation(const MWWorld::Ptr &ptr);
552  virtual const MWRender::Animation* getAnimation(const MWWorld::ConstPtr &ptr) const;
553  virtual void reattachPlayerCamera();
554 
556  virtual void screenshot (osg::Image* image, int w, int h);
557 
560  virtual bool findExteriorPosition(const std::string &name, ESM::Position &pos);
561 
564  virtual bool findInteriorPosition(const std::string &name, ESM::Position &pos);
565 
567  virtual void enableTeleporting(bool enable);
568 
570  virtual bool isTeleportingEnabled() const;
571 
573  virtual void enableLevitation(bool enable);
574 
576  virtual bool isLevitationEnabled() const;
577 
578  virtual bool getGodModeState();
579 
580  virtual bool toggleGodMode();
581 
582  virtual bool toggleScripts();
583  virtual bool getScriptsEnabled() const;
584 
590  virtual bool startSpellCast (const MWWorld::Ptr& actor);
591 
596  virtual void castSpell (const MWWorld::Ptr& actor);
597 
598  virtual void launchMagicBolt (const std::string& spellId, bool stack, const ESM::EffectList& effects,
599  const MWWorld::Ptr& caster, const std::string& sourceName, const osg::Vec3f& fallbackDirection);
600  virtual void launchProjectile (MWWorld::Ptr actor, MWWorld::ConstPtr projectile,
601  const osg::Vec3f& worldPos, const osg::Quat& orient, MWWorld::Ptr bow, float speed, float attackStrength);
602 
603 
604  virtual const std::vector<std::string>& getContentFiles() const;
605 
606  virtual void breakInvisibility (const MWWorld::Ptr& actor);
607  // Are we in an exterior or pseudo-exterior cell and it's night?
608  virtual bool isDark() const;
609 
610  virtual bool findInteriorPositionInWorldSpace(const MWWorld::CellStore* cell, osg::Vec3f& result);
611 
614  virtual void teleportToClosestMarker (const MWWorld::Ptr& ptr,
615  const std::string& id);
616 
620  virtual void listDetectedReferences (const MWWorld::Ptr& ptr, std::vector<MWWorld::Ptr>& out,
621  DetectionType type);
622 
625  virtual void updateDialogueGlobals();
626 
628  virtual void confiscateStolenItems(const MWWorld::Ptr& ptr);
629 
630  virtual void goToJail ();
631 
633  virtual void spawnRandomCreature(const std::string& creatureList);
634 
636  virtual void spawnBloodEffect (const MWWorld::Ptr& ptr, const osg::Vec3f& worldPosition);
637 
638  virtual void spawnEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPos);
639 
640  virtual void explodeSpell(const osg::Vec3f& origin, const ESM::EffectList& effects, const MWWorld::Ptr& caster, const MWWorld::Ptr& ignore,
641  ESM::RangeType rangeType, const std::string& id, const std::string& sourceName,
642  const bool fromProjectile=false);
643 
644  virtual void activate (const MWWorld::Ptr& object, const MWWorld::Ptr& actor);
645 
647  virtual bool isInStorm() const;
648 
650  virtual osg::Vec3f getStormDirection() const;
651 
653  virtual void resetActors();
654 
655  virtual bool isWalkingOnWater (const MWWorld::ConstPtr& actor) const;
656 
659  virtual osg::Vec3f aimToTarget(const MWWorld::ConstPtr& actor, const MWWorld::ConstPtr& target);
660 
662  virtual float getHitDistance(const MWWorld::ConstPtr& actor, const MWWorld::ConstPtr& target);
663 
664  virtual bool isPlayerInJail() const;
665 
667  virtual float getTerrainHeightAt(const osg::Vec3f& worldPos) const;
668 
670  virtual osg::Vec3f getHalfExtents(const MWWorld::ConstPtr& actor, bool rendering=false) const;
671  };
672 }
673 
674 #endif
virtual bool toggleVanityMode(bool enable)
Definition: worldimp.cpp:2120
virtual void scaleObject(const Ptr &ptr, float scale)
Definition: worldimp.cpp:1245
std::vector< ESM::ESMReader > mEsm
Definition: worldimp.hpp:80
virtual void adjustPosition(const Ptr &ptr, bool force)
Definition: worldimp.cpp:1292
virtual void teleportToClosestMarker(const MWWorld::Ptr &ptr, const std::string &id)
Definition: worldimp.cpp:2896
Cell container.
Definition: cells.hpp:28
virtual bool isCellQuasiExterior() const
Definition: worldimp.cpp:1759
virtual void getContainersOwnedBy(const MWWorld::ConstPtr &npc, std::vector< MWWorld::Ptr > &out)
get all containers in active cells owned by this Npc
Definition: worldimp.cpp:2386
virtual bool toggleWorld()
Definition: worldimp.cpp:1867
float mDistanceToFacedObject
Definition: worldimp.hpp:160
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:24
virtual int getDay() const
Definition: worldimp.cpp:895
virtual float getTerrainHeightAt(const osg::Vec3f &worldPos) const
Return terrain height at worldPos position.
Definition: worldimp.cpp:3136
virtual void setDay(int day)
Set in-game time day.
Definition: worldimp.cpp:842
virtual int getCurrentWeather() const
Definition: worldimp.cpp:1772
virtual void setGlobalInt(const std::string &name, int value)
Set value independently from real type.
Definition: worldimp.cpp:571
virtual void setGlobalFloat(const std::string &name, float value)
Set value independently from real type.
Definition: worldimp.cpp:583
LocalScripts mLocalScripts
Definition: worldimp.hpp:82
MWWorld::Scene * mWorldScene
Definition: worldimp.hpp:78
virtual int getMonth() const
Definition: worldimp.cpp:900
int mActivationDistanceOverride
Definition: worldimp.hpp:108
virtual char getGlobalVariableType(const std::string &name) const
Return ' ', if there is no global variable with this name.
Definition: worldimp.cpp:605
int mDaysInPrison
Definition: worldimp.hpp:168
virtual bool isSubmerged(const MWWorld::ConstPtr &object) const
Is the head of the creature underwater?
Definition: worldimp.cpp:2049
virtual Ptr searchPtr(const std::string &name, bool activeOnly)
Definition: worldimp.cpp:629
virtual void write(ESM::ESMWriter &writer, Loading::Listener &progress) const
Definition: worldimp.cpp:333
virtual std::string getCellName(const MWWorld::CellStore *cell=0) const
Definition: worldimp.cpp:610
Definition: animation.hpp:77
virtual MWWorld::Ptr findContainer(const MWWorld::ConstPtr &ptr)
Definition: worldimp.cpp:709
virtual MWWorld::Ptr placeObject(const MWWorld::ConstPtr &ptr, MWWorld::CellStore *cell, ESM::Position pos)
Place an object. Makes a copy of the Ptr.
Definition: worldimp.cpp:1340
virtual void spawnEffect(const std::string &model, const std::string &textureOverride, const osg::Vec3f &worldPos)
Definition: worldimp.cpp:3198
Definition: renderingmanager.hpp:63
Interface for the World (implemented in MWWorld)
Definition: world.hpp:77
virtual MWWorld::Ptr dropObjectOnGround(const MWWorld::Ptr &actor, const MWWorld::ConstPtr &object, int amount)
Definition: worldimp.cpp:1980
virtual void resetActors()
Resets all actors in the current active cells to their original location within that cell...
Definition: worldimp.cpp:3306
virtual float getDistToNearestRayHit(const osg::Vec3f &from, const osg::Vec3f &dir, float maxDist, bool includeWater=false)
Definition: worldimp.cpp:2432
Fallback::Map mFallback
Definition: worldimp.hpp:73
Definition: esmreader.hpp:21
virtual void enableTeleporting(bool enable)
Enables or disables use of teleport spell effects (recall, intervention, etc).
Definition: worldimp.cpp:2533
virtual void positionToIndex(float x, float y, int &cellX, int &cellY) const
Convert position to cell numbers.
Definition: worldimp.cpp:1411
virtual bool startSpellCast(const MWWorld::Ptr &actor)
startSpellCast attempt to start casting a spell. Might fail immediately if conditions are not met...
Definition: worldimp.cpp:2603
Definition: loadspel.hpp:14
void rotateObjectImp(const Ptr &ptr, const osg::Vec3f &rot, bool adjust)
Definition: worldimp.cpp:1252
void updateSoundListener()
Definition: worldimp.cpp:1686
virtual float getGlobalFloat(const std::string &name) const
Get value independently from real type.
Definition: worldimp.cpp:600
ESM::Variant * mGameHour
Definition: worldimp.hpp:87
void updateWindowManager()
Definition: worldimp.cpp:1708
MWWorld::WeatherManager * mWeatherManager
Definition: worldimp.hpp:76
void doPhysics(float duration)
Run physics simulation and modify world accordingly.
Definition: worldimp.cpp:1424
Definition: loadarmo.hpp:66
virtual CellStore * getCell(const ESM::CellId &id)
Definition: worldimp.cpp:527
virtual void updateDialogueGlobals()
Definition: worldimp.cpp:3042
MWWorld::Player * mPlayer
Definition: worldimp.hpp:79
NPC object representing the player and additional player data.
Definition: player.hpp:30
contains settings imported from the Morrowind INI file.
Definition: fallback.hpp:12
virtual void togglePreviewMode(bool enable)
Definition: worldimp.cpp:2115
Definition: globals.hpp:28
Cells mCells
Definition: worldimp.hpp:94
std::map< MWWorld::Ptr, int > mDoorStates
only holds doors that are currently moving. 1 = opening, 2 = closing
Definition: worldimp.hpp:112
virtual int getMasserPhase() const
Definition: worldimp.cpp:942
virtual void rotateObject(const Ptr &ptr, float x, float y, float z, bool adjust=false)
Definition: worldimp.cpp:1335
virtual MWRender::Animation * getAnimation(const MWWorld::Ptr &ptr)
Definition: worldimp.cpp:2207
virtual MWWorld::Ptr moveObject(const Ptr &ptr, float x, float y, float z)
Definition: worldimp.cpp:1240
virtual bool isFlying(const MWWorld::Ptr &ptr) const
Definition: worldimp.cpp:2013
int getDaysPerMonth(int month) const
Definition: worldimp.cpp:107
Definition: loadinglistener.hpp:8
MWRender::RenderingManager * mRendering
Definition: worldimp.hpp:74
Definition: physicssystem.hpp:51
virtual void deleteObject(const Ptr &ptr)
Definition: worldimp.cpp:1089
virtual void hurtStandingActors(const MWWorld::ConstPtr &object, float dmgPerSecond)
Definition: worldimp.cpp:2279
virtual CellStore * getInterior(const std::string &name)
Definition: worldimp.cpp:522
virtual void startNewGame(bool bypass)
Definition: worldimp.cpp:205
RangeType
Definition: defs.hpp:27
void fillGlobalVariables()
Definition: worldimp.cpp:193
virtual void activate(const MWWorld::Ptr &object, const MWWorld::Ptr &actor)
Definition: worldimp.cpp:3281
virtual void changeToCell(const ESM::CellId &cellId, const ESM::Position &position, bool adjustPlayerPos, bool changeEvent=true)
Definition: worldimp.cpp:995
virtual void enableActorCollision(const MWWorld::Ptr &actor, bool enable)
Definition: worldimp.cpp:2450
virtual void setMonth(int month)
Set in-game time month.
Definition: worldimp.cpp:874
virtual bool findInteriorPosition(const std::string &name, ESM::Position &pos)
Definition: worldimp.cpp:2457
void addContainerScripts(const Ptr &reference, CellStore *cell)
Definition: worldimp.cpp:735
Definition: refdata.hpp:29
ESM::Variant * mYear
Definition: worldimp.hpp:91
virtual void explodeSpell(const osg::Vec3f &origin, const ESM::EffectList &effects, const MWWorld::Ptr &caster, const MWWorld::Ptr &ignore, ESM::RangeType rangeType, const std::string &id, const std::string &sourceName, const bool fromProjectile=false)
Definition: worldimp.cpp:3203
std::set< std::pair< std::string, std::string > > CategorySettingVector
Definition: settings.hpp:11
virtual void hurtCollidingActors(const MWWorld::ConstPtr &object, float dmgPerSecond)
Definition: worldimp.cpp:2309
ESM::Variant * mTimeScale
Definition: worldimp.hpp:92
virtual ~World()
Definition: worldimp.cpp:478
virtual bool toggleWater()
Definition: worldimp.cpp:1862
Resource::ResourceSystem * mResourceSystem
Definition: worldimp.hpp:71
virtual void fixPosition(const Ptr &actor)
Attempt to fix position so that the Ptr is no longer inside collision geometry.
Definition: worldimp.cpp:1323
void loadContentFiles(const Files::Collections &fileCollections, const std::vector< std::string > &content, ContentLoader &contentLoader)
loadContentFiles - Loads content files (esm,esp,omwgame,omwaddon)
Definition: worldimp.cpp:2581
MWPhysics::PhysicsSystem * mPhysics
Definition: worldimp.hpp:84
virtual bool isFirstPerson() const
Definition: worldimp.cpp:2110
Definition: esmwriter.hpp:17
The game world and its visual representation.
Definition: worldimp.hpp:69
Ptr copyObjectToCell(const ConstPtr &ptr, CellStore *cell, ESM::Position pos, int count, bool adjustPos)
Definition: worldimp.cpp:1927
virtual bool toggleSky()
Definition: worldimp.cpp:935
virtual void disable(const Ptr &ptr)
Definition: worldimp.cpp:789
MWWorld::ESMStore mStore
Definition: worldimp.hpp:81
virtual int countSavedGameCells() const
Definition: worldimp.cpp:328
Definition: scene.hpp:47
ESM::Variant * mMonth
Definition: worldimp.hpp:90
ESM::Variant * mDaysPassed
Definition: worldimp.hpp:88
virtual void undeleteObject(const Ptr &ptr)
Definition: worldimp.cpp:1109
Definition: esmstore.hpp:17
virtual void setCameraDistance(float dist, bool adjust=false, bool override=true)
Definition: worldimp.cpp:2145
virtual int getYear() const
Definition: worldimp.cpp:905
virtual void adjustSky()
Definition: worldimp.cpp:128
virtual void activateDoor(const MWWorld::Ptr &door)
open or close a non-teleport door (depending on current state)
Definition: worldimp.cpp:2222
virtual MWWorld::Ptr getPlayerPtr()
Definition: worldimp.cpp:3037
virtual bool getLOS(const MWWorld::ConstPtr &actor, const MWWorld::ConstPtr &targetActor)
get Line of Sight (morrowind stupid implementation)
Definition: worldimp.cpp:2422
virtual bool toggleScripts()
Definition: worldimp.cpp:2570
virtual bool getGodModeState()
Definition: worldimp.cpp:2558
virtual TimeStamp getTimeStamp() const
Return current in-game time stamp.
Definition: worldimp.cpp:930
virtual void queueMovement(const Ptr &ptr, const osg::Vec3f &velocity)
Definition: worldimp.cpp:1419
virtual void launchMagicBolt(const std::string &spellId, bool stack, const ESM::EffectList &effects, const MWWorld::Ptr &caster, const std::string &sourceName, const osg::Vec3f &fallbackDirection)
Definition: worldimp.cpp:2730
virtual void changeToInteriorCell(const std::string &cellName, const ESM::Position &position, bool adjustPlayerPos, bool changeEvent=true)
Definition: worldimp.cpp:962
bool mLevitationEnabled
Definition: worldimp.hpp:166
virtual bool isDark() const
Definition: worldimp.cpp:2752
virtual void goToJail()
Definition: worldimp.cpp:3099
virtual void spawnRandomCreature(const std::string &creatureList)
Spawn a random creature from a levelled list next to the player.
Definition: worldimp.cpp:3149
bool mGodMode
Definition: worldimp.hpp:100
Definition: loadnpc.hpp:23
virtual void useDeathCamera()
Definition: worldimp.cpp:535
float getActivationDistancePlusTelekinesis()
Definition: worldimp.cpp:3025
virtual bool canPlaceObject(float cursorX, float cursorY)
Definition: worldimp.cpp:1909
virtual std::vector< ESM::ESMReader > & getEsmReader()
Definition: worldimp.cpp:556
virtual int getGlobalInt(const std::string &name) const
Get value independently from real type.
Definition: worldimp.cpp:595
virtual void modRegion(const std::string &regionid, const std::vector< char > &chances)
Definition: worldimp.cpp:1782
virtual void getDoorMarkers(MWWorld::CellStore *cell, std::vector< DoorMarker > &out)
get a list of teleport door markers for a given cell, to be displayed on the local map ...
Definition: worldimp.cpp:1850
virtual float getWindSpeed()
Definition: worldimp.cpp:2339
virtual bool findInteriorPositionInWorldSpace(const MWWorld::CellStore *cell, osg::Vec3f &result)
Definition: worldimp.cpp:2767
virtual bool toggleRenderMode(MWRender::RenderMode mode)
Definition: worldimp.cpp:1523
virtual osg::Vec3f getStormDirection() const
Definition: worldimp.cpp:2355
virtual void setMoonColour(bool red)
Definition: worldimp.cpp:952
virtual void indexToPosition(int cellX, int cellY, float &x, float &y, bool centre=false) const
Convert cell numbers to position.
Definition: worldimp.cpp:1397
virtual void breakInvisibility(const MWWorld::Ptr &actor)
Definition: worldimp.cpp:2741
Mutable state of a cell.
Definition: cellstore.hpp:53
virtual osg::Vec2f getNorthVector(const CellStore *cell)
get north vector for given interior cell
Definition: worldimp.cpp:1787
virtual bool getPlayerCollidingWith(const MWWorld::ConstPtr &object)
Definition: worldimp.cpp:2266
virtual void update(float duration, bool paused)
Definition: worldimp.cpp:1610
void ensureNeededRecords()
Definition: worldimp.cpp:390
virtual bool getActorCollidingWith(const MWWorld::ConstPtr &object)
Definition: worldimp.cpp:2272
virtual void castSpell(const MWWorld::Ptr &actor)
Cast the actual spell, should be called mid-animation.
Definition: worldimp.cpp:2646
virtual void setWaterHeight(const float height)
Definition: worldimp.cpp:1856
Pointer to a const LiveCellRef.
Definition: ptr.hpp:90
virtual bool isSwimming(const MWWorld::ConstPtr &object) const
Definition: worldimp.cpp:2054
virtual bool toggleGodMode()
Definition: worldimp.cpp:2563
virtual void processChangedSettings(const Settings::CategorySettingVector &settings)
Definition: worldimp.cpp:2008
virtual void changeWeather(const std::string &region, const unsigned int id)
Definition: worldimp.cpp:1777
Definition: contentloader.hpp:13
virtual bool getActorStandingOn(const MWWorld::ConstPtr &object)
Definition: worldimp.cpp:2259
Definition: loadlevlist.hpp:46
float feetToGameUnits(float feet)
Definition: worldimp.cpp:3018
virtual osg::Matrixf getActorHeadTransform(const MWWorld::ConstPtr &actor) const
Definition: worldimp.cpp:1045
float distance(const ESM::Pathgrid::Point &point, float x, float y, float z)
Definition: pathfinding.cpp:69
virtual void clear()
Definition: worldimp.cpp:284
Definition: loadcell.hpp:64
virtual void preloadCommonAssets()
Definition: worldimp.cpp:3342
std::string mCurrentWorldSpace
Definition: worldimp.hpp:96
virtual float getMaxActivationDistance()
Definition: worldimp.cpp:1011
bool mGoToJail
Definition: worldimp.hpp:167
virtual void removeRefScript(MWWorld::RefData *ref)
Definition: worldimp.cpp:624
In-game time stamp.
Definition: timestamp.hpp:14
virtual std::pair< MWWorld::Ptr, osg::Vec3f > getHitContact(const MWWorld::ConstPtr &ptr, float distance)
Definition: worldimp.cpp:1062
virtual void confiscateStolenItems(const MWWorld::Ptr &ptr)
Moves all stolen items from ptr to the closest evidence chest.
Definition: worldimp.cpp:3069
void updateWeather(float duration, bool paused=false)
Definition: worldimp.cpp:2915
virtual void changeVanityModeScale(float factor)
Definition: worldimp.cpp:2135
virtual bool isCellExterior() const
Definition: worldimp.cpp:1749
virtual void markCellAsUnchanged()
Definition: worldimp.cpp:1006
virtual bool getScriptsEnabled() const
Definition: worldimp.cpp:2576
virtual void togglePOV()
Definition: worldimp.cpp:2105
virtual bool isOnGround(const MWWorld::Ptr &ptr) const
Definition: worldimp.cpp:2100
virtual bool getPlayerStandingOn(const MWWorld::ConstPtr &object)
Definition: worldimp.cpp:2253
Definition: defs.hpp:38
Definition: loadclot.hpp:18
virtual const MWWorld::ESMStore & getStore() const
Definition: worldimp.cpp:551
virtual bool isWalkingOnWater(const MWWorld::ConstPtr &actor) const
Definition: worldimp.cpp:3317
void PCDropped(const Ptr &item)
Definition: worldimp.cpp:1872
virtual void togglePlayerLooking(bool enable)
Definition: worldimp.cpp:2130
MWWorld::Globals mGlobalVariables
Definition: worldimp.hpp:83
virtual void screenshot(osg::Image *image, int w, int h)
Definition: worldimp.cpp:2217
virtual void setupPlayer()
Definition: worldimp.cpp:2150
virtual const ESM::Potion * createRecord(const ESM::Potion &record)
Definition: worldimp.cpp:1534
bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const
helper function for implementing isSwimming(), isSubmerged(), isWading()
Definition: worldimp.cpp:2065
MWWorld::ConstPtr getClosestMarker(const MWWorld::Ptr &ptr, const std::string &id)
Definition: worldimp.cpp:2817
virtual CellStore * getExterior(int x, int y)
Definition: worldimp.cpp:517
bool mScriptsEnabled
Definition: worldimp.hpp:101
virtual int countSavedGameRecords() const
Definition: worldimp.cpp:314
virtual bool castRay(float x1, float y1, float z1, float x2, float y2, float z2)
cast a Ray and return true if there is an object in the ray path.
Definition: worldimp.cpp:1449
virtual Ptr searchPtrViaActorId(int actorId)
Search is limited to the active cells.
Definition: worldimp.cpp:681
virtual const Fallback::Map * getFallback() const
Definition: worldimp.cpp:512
List of active local scripts.
Definition: localscripts.hpp:16
Definition: loadclas.hpp:18
bool mSky
Definition: worldimp.hpp:85
virtual Ptr getPtr(const std::string &name, bool activeOnly)
Definition: worldimp.cpp:673
Definition: variant.hpp:25
virtual osg::Vec3f aimToTarget(const MWWorld::ConstPtr &actor, const MWWorld::ConstPtr &target)
Definition: worldimp.cpp:3325
ESM::Variant * mDay
Definition: worldimp.hpp:89
virtual void advanceTime(double hours, bool incremental=false)
Advance in-game time.
Definition: worldimp.cpp:807
virtual void getItemsOwnedBy(const MWWorld::ConstPtr &npc, std::vector< MWWorld::Ptr > &out)
get all items in active cells owned by this Npc
Definition: worldimp.cpp:2408
virtual MWWorld::Ptr safePlaceObject(const MWWorld::ConstPtr &ptr, const MWWorld::ConstPtr &referenceObject, MWWorld::CellStore *referenceCell, int direction, float distance)
Definition: worldimp.cpp:1345
virtual void spawnBloodEffect(const MWWorld::Ptr &ptr, const osg::Vec3f &worldPosition)
Spawn a blood effect for ptr at worldPosition.
Definition: worldimp.cpp:3168
virtual bool isTeleportingEnabled() const
Returns true if teleport spell effects are allowed.
Definition: worldimp.cpp:2538
World()
Definition: world.hpp:94
float mSwimHeightScale
Definition: worldimp.hpp:158
void processDoors(float duration)
Run physics simulation and modify world accordingly.
Definition: worldimp.cpp:1457
Interface for weather settings.
Definition: weather.hpp:205
virtual void renderPlayer()
Definition: worldimp.cpp:2169
virtual LocalScripts & getLocalScripts()
Definition: worldimp.cpp:561
virtual Player & getPlayer()
Definition: worldimp.cpp:546
World & operator=(const World &)
virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const
Definition: worldimp.cpp:2082
boost::shared_ptr< ProjectileManager > mProjectileManager
Definition: worldimp.hpp:98
virtual bool findExteriorPosition(const std::string &name, ESM::Position &pos)
Definition: worldimp.cpp:2516
virtual void reattachPlayerCamera()
Definition: worldimp.cpp:2553
virtual const ESM::CreatureLevList * createOverrideRecord(const ESM::CreatureLevList &record)
Definition: worldimp.cpp:1554
virtual float getTimeScaleFactor() const
Definition: worldimp.cpp:957
virtual bool isInStorm() const
Definition: worldimp.cpp:2347
Definition: loadlevlist.hpp:66
virtual std::string getMonthName(int month=-1) const
Return name of month (-1: current month)
Definition: worldimp.cpp:910
void removeContainerScripts(const Ptr &reference)
Definition: worldimp.cpp:770
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
virtual void launchProjectile(MWWorld::Ptr actor, MWWorld::ConstPtr projectile, const osg::Vec3f &worldPos, const osg::Quat &orient, MWWorld::Ptr bow, float speed, float attackStrength)
Definition: worldimp.cpp:2724
virtual bool isLevitationEnabled() const
Returns true if levitation spell effect is allowed.
Definition: worldimp.cpp:2548
virtual int getSecundaPhase() const
Definition: worldimp.cpp:947
Definition: collections.hpp:10
Definition: loadench.hpp:18
virtual float getDistanceToFacedObject()
Definition: worldimp.cpp:1040
Definition: loadalch.hpp:18
virtual void changeToExteriorCell(const ESM::Position &position, bool adjustPlayerPos, bool changeEvent=true)
Definition: worldimp.cpp:980
Definition: to_utf8.hpp:25
virtual void enableLevitation(bool enable)
Enables or disables use of levitation spell effect.
Definition: worldimp.cpp:2543
Ptr moveObjectImp(const Ptr &ptr, float x, float y, float z, bool movePhysics=true)
Definition: worldimp.cpp:1226
virtual void enable(const Ptr &ptr)
Definition: worldimp.cpp:755
virtual bool isWading(const MWWorld::ConstPtr &object) const
Definition: worldimp.cpp:2059
virtual bool isPlayerInJail() const
Definition: worldimp.cpp:3128
Definition: cellid.hpp:11
bool mTeleportEnabled
Definition: worldimp.hpp:165
DetectionType
Definition: world.hpp:508
virtual bool isSlowFalling(const MWWorld::Ptr &ptr) const
Definition: worldimp.cpp:2037
std::string mStartupScript
Definition: worldimp.hpp:110
virtual bool hasCellChanged() const
Has the set of active cells changed, since the last frame?
Definition: worldimp.cpp:566
virtual int canRest()
Definition: worldimp.cpp:2186
EffectList, ENAM subrecord.
Definition: effectlist.hpp:33
void updatePlayer(bool paused)
Definition: worldimp.cpp:1629
Definition: loadbook.hpp:15
virtual osg::Vec3f getHalfExtents(const MWWorld::ConstPtr &actor, bool rendering=false) const
Return physical or rendering half extents of the given actor.
Definition: worldimp.cpp:3141
virtual float getHitDistance(const MWWorld::ConstPtr &actor, const MWWorld::ConstPtr &target)
Return the distance between actor's weapon and target's collision box.
Definition: worldimp.cpp:3333
virtual void allowVanityMode(bool allow)
Definition: worldimp.cpp:2125
virtual const std::vector< std::string > & getContentFiles() const
Definition: worldimp.cpp:2736
RenderMode
Definition: rendermode.hpp:7
virtual void listDetectedReferences(const MWWorld::Ptr &ptr, std::vector< MWWorld::Ptr > &out, DetectionType type)
Definition: worldimp.cpp:2992
virtual MWWorld::Ptr getFacedObject()
Return pointer to the object the player is looking at, if it is within activation range...
Definition: worldimp.cpp:1020
virtual void setHour(double hour)
Set in-game time hour.
Definition: worldimp.cpp:827
MWWorld::ConstPtr getClosestMarkerFromExteriorPosition(const osg::Vec3f &worldPos, const std::string &id)
Definition: worldimp.cpp:2873
virtual bool vanityRotateCamera(float *rot)
Definition: worldimp.cpp:2140
Definition: loadweap.hpp:16
const char * name
Definition: crashcatcher.cpp:59
virtual bool toggleCollisionMode()
Definition: worldimp.cpp:1518
std::string mStartCell
Definition: worldimp.hpp:115
std::vector< std::string > mContentFiles
Definition: worldimp.hpp:102
virtual void readRecord(ESM::ESMReader &reader, uint32_t type, const std::map< int, int > &contentFileMap)
Definition: worldimp.cpp:363