2010-07-03 13:41:20 +00:00
|
|
|
#ifndef GAME_MWWORLD_WORLD_H
|
|
|
|
#define GAME_MWWORLD_WORLD_H
|
2010-07-02 07:38:22 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include <boost/filesystem.hpp>
|
|
|
|
|
2010-07-03 13:41:20 +00:00
|
|
|
#include <components/esm_store/cell_store.hpp>
|
2010-07-02 07:38:22 +00:00
|
|
|
|
2010-07-03 13:41:20 +00:00
|
|
|
#include "../mwrender/mwscene.hpp"
|
2011-08-08 19:11:30 +00:00
|
|
|
#include "../mwrender/rendering_manager.hpp"
|
2010-07-03 13:04:00 +00:00
|
|
|
|
2010-07-02 14:18:25 +00:00
|
|
|
#include "refdata.hpp"
|
2010-07-03 15:46:55 +00:00
|
|
|
#include "ptr.hpp"
|
2010-07-18 14:48:01 +00:00
|
|
|
#include "globals.hpp"
|
2011-07-31 15:07:11 +00:00
|
|
|
#include "scene.hpp"
|
2011-08-01 13:55:36 +00:00
|
|
|
#include "physicssystem.hpp"
|
2010-07-02 11:48:48 +00:00
|
|
|
|
2011-02-26 15:37:47 +00:00
|
|
|
#include <openengine/bullet/physic.hpp>
|
2011-02-19 16:59:40 +00:00
|
|
|
|
2011-02-01 09:11:41 +00:00
|
|
|
namespace Ogre
|
|
|
|
{
|
|
|
|
class Vector3;
|
|
|
|
}
|
|
|
|
|
2010-07-22 10:29:23 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
struct Position;
|
|
|
|
}
|
|
|
|
|
2011-05-05 17:32:42 +00:00
|
|
|
namespace Files
|
|
|
|
{
|
|
|
|
class Collections;
|
|
|
|
}
|
|
|
|
|
2010-07-02 07:38:22 +00:00
|
|
|
namespace Render
|
|
|
|
{
|
|
|
|
class OgreRenderer;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
class SkyManager;
|
|
|
|
class CellRender;
|
|
|
|
}
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-03 13:41:20 +00:00
|
|
|
namespace MWWorld
|
2010-07-02 07:38:22 +00:00
|
|
|
{
|
2010-07-27 12:05:05 +00:00
|
|
|
class Environment;
|
2011-01-04 14:58:22 +00:00
|
|
|
class Player;
|
2010-07-27 12:05:05 +00:00
|
|
|
|
2010-07-02 07:38:22 +00:00
|
|
|
/// \brief The game world and its visual representation
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-02 07:38:22 +00:00
|
|
|
class World
|
|
|
|
{
|
2011-01-04 14:58:22 +00:00
|
|
|
|
2010-07-02 14:18:25 +00:00
|
|
|
public:
|
2010-08-21 09:43:07 +00:00
|
|
|
typedef std::list<std::pair<std::string, Ptr> > ScriptList;
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2011-03-16 08:09:45 +00:00
|
|
|
enum RenderMode
|
|
|
|
{
|
|
|
|
Render_CollisionDebug
|
|
|
|
};
|
|
|
|
|
2010-07-02 14:18:25 +00:00
|
|
|
private:
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-02 07:38:22 +00:00
|
|
|
MWRender::MWScene mScene;
|
2011-07-31 15:07:11 +00:00
|
|
|
MWWorld::Scene *mWorldScene;
|
2011-01-04 14:58:22 +00:00
|
|
|
MWWorld::Player *mPlayer;
|
2010-07-02 07:38:22 +00:00
|
|
|
ESM::ESMReader mEsm;
|
|
|
|
ESMS::ESMStore mStore;
|
2010-07-02 14:18:25 +00:00
|
|
|
ScriptList mLocalScripts;
|
2010-07-18 14:48:01 +00:00
|
|
|
MWWorld::Globals *mGlobalVariables;
|
2011-08-01 13:55:36 +00:00
|
|
|
MWWorld::PhysicsSystem *mPhysics;
|
2010-07-18 17:48:02 +00:00
|
|
|
bool mSky;
|
2010-07-27 12:05:05 +00:00
|
|
|
Environment& mEnvironment;
|
2011-08-08 19:11:30 +00:00
|
|
|
MWRender::RenderingManager *mRenderingManager;
|
2011-07-22 13:56:54 +00:00
|
|
|
int mNextDynamicRecord;
|
2011-09-04 07:48:50 +00:00
|
|
|
|
2011-08-01 12:34:50 +00:00
|
|
|
std::map<std::string, Ptr::CellStore> mInteriors;
|
|
|
|
std::map<std::pair<int, int>, Ptr::CellStore> mExteriors;
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2011-04-01 21:35:56 +00:00
|
|
|
OEngine::Physic::PhysicEngine* mPhysEngine;
|
2011-02-19 16:59:40 +00:00
|
|
|
|
2010-07-02 07:38:22 +00:00
|
|
|
// not implemented
|
|
|
|
World (const World&);
|
|
|
|
World& operator= (const World&);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-10 11:19:04 +00:00
|
|
|
Ptr getPtr (const std::string& name, Ptr::CellStore& cellStore);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
|
|
|
Ptr getPtrViaHandle (const std::string& handle, Ptr::CellStore& cellStore);
|
|
|
|
|
2010-07-10 11:19:04 +00:00
|
|
|
MWRender::CellRender *searchRender (Ptr::CellStore *store);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-22 09:48:27 +00:00
|
|
|
int getDaysPerMonth (int month) const;
|
2011-09-04 07:48:50 +00:00
|
|
|
|
2011-08-02 17:46:21 +00:00
|
|
|
void moveObjectImp (Ptr ptr, float x, float y, float z);
|
2011-09-04 07:48:50 +00:00
|
|
|
|
2010-07-02 07:38:22 +00:00
|
|
|
public:
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2011-05-05 17:32:42 +00:00
|
|
|
World (OEngine::Render::OgreRenderer& renderer, OEngine::Physic::PhysicEngine* physEng,
|
|
|
|
const Files::Collections& fileCollections,
|
2011-02-10 09:38:45 +00:00
|
|
|
const std::string& master, const boost::filesystem::path& resDir, bool newGame,
|
Added new command line option: "encoding"
Added new command line option: "encoding" which allow to
change font encoding used in game messages.
Currently there are three evailable encodings:
win1250 - Central and Eastern European (languages
that use Latin script, such as Polish,
Czech, Slovak, Hungarian, Slovene, Bosnian,
Croatian, Serbian (Latin script),
Romanian and Albanian)
win1251 - languages that use the Cyrillic alphabet
such as Russian, Bulgarian, Serbian Cyrillic
and others
win1252 - Western European (Latin) - default
Signed-off-by: Lukasz Gromanowski <lgromanowski@gmail.com>
2011-07-17 20:16:50 +00:00
|
|
|
Environment& environment, const std::string& encoding);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-02 07:38:22 +00:00
|
|
|
~World();
|
2011-09-04 07:48:50 +00:00
|
|
|
|
2011-08-01 12:34:50 +00:00
|
|
|
Ptr::CellStore *getExterior (int x, int y);
|
2011-09-04 07:48:50 +00:00
|
|
|
|
2011-08-01 12:34:50 +00:00
|
|
|
Ptr::CellStore *getInterior (std::string name);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2011-08-01 02:17:50 +00:00
|
|
|
void removeScripts (Ptr::CellStore *cell);
|
|
|
|
|
2011-07-31 15:07:11 +00:00
|
|
|
void insertInteriorScripts (ESMS::CellStore<RefData>& cell);
|
|
|
|
|
|
|
|
void adjustSky();
|
|
|
|
|
2011-01-04 14:58:22 +00:00
|
|
|
MWWorld::Player& getPlayer();
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2011-04-21 08:49:45 +00:00
|
|
|
const ESMS::ESMStore& getStore() const;
|
2011-09-04 07:48:50 +00:00
|
|
|
|
2011-07-31 15:07:11 +00:00
|
|
|
ESM::ESMReader& getEsmReader();
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-02 14:18:25 +00:00
|
|
|
const ScriptList& getLocalScripts() const;
|
|
|
|
///< Names and local variable state of all local scripts in active cells.
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-03 10:12:13 +00:00
|
|
|
bool hasCellChanged() const;
|
|
|
|
///< Has the player moved to a different cell, since the last frame?
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-18 14:48:01 +00:00
|
|
|
Globals::Data& getGlobalVariable (const std::string& name);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2011-04-21 09:00:00 +00:00
|
|
|
Globals::Data getGlobalVariable (const std::string& name) const;
|
|
|
|
|
2010-07-21 13:01:35 +00:00
|
|
|
char getGlobalVariableType (const std::string& name) const;
|
|
|
|
///< Return ' ', if there is no global variable with this name.
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-10 11:19:04 +00:00
|
|
|
Ptr getPtr (const std::string& name, bool activeOnly);
|
2010-07-05 10:09:04 +00:00
|
|
|
///< Return a pointer to a liveCellRef with the given name.
|
|
|
|
/// \param activeOnly do non search inactive cells.
|
2010-07-09 14:07:03 +00:00
|
|
|
|
2010-08-03 18:01:52 +00:00
|
|
|
Ptr getPtrViaHandle (const std::string& handle);
|
|
|
|
///< Return a pointer to a liveCellRef with the given Ogre handle.
|
|
|
|
|
2010-07-10 11:19:04 +00:00
|
|
|
void enable (Ptr reference);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-10 11:19:04 +00:00
|
|
|
void disable (Ptr reference);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-18 16:29:16 +00:00
|
|
|
void advanceTime (double hours);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-18 16:29:16 +00:00
|
|
|
void setHour (double hour);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-22 09:48:27 +00:00
|
|
|
void setMonth (int month);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-18 16:29:16 +00:00
|
|
|
void setDay (int day);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2011-04-26 19:38:21 +00:00
|
|
|
bool toggleSky();
|
|
|
|
///< \return Resulting mode
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-18 17:48:02 +00:00
|
|
|
int getMasserPhase() const;
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-18 17:48:02 +00:00
|
|
|
int getSecundaPhase() const;
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-18 17:48:02 +00:00
|
|
|
void setMoonColour (bool red);
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2010-07-21 12:10:52 +00:00
|
|
|
float getTimeScaleFactor() const;
|
2010-08-03 18:01:52 +00:00
|
|
|
|
2011-02-10 09:38:45 +00:00
|
|
|
void changeToInteriorCell (const std::string& cellName, const ESM::Position& position);
|
|
|
|
///< Move to interior cell.
|
2010-08-20 11:33:03 +00:00
|
|
|
|
|
|
|
void changeToExteriorCell (const ESM::Position& position);
|
2011-02-10 09:38:45 +00:00
|
|
|
///< Move to exterior cell.
|
2010-08-20 11:33:03 +00:00
|
|
|
|
2010-09-11 09:55:28 +00:00
|
|
|
const ESM::Cell *getExterior (const std::string& cellName) const;
|
|
|
|
///< Return a cell matching the given name or a 0-pointer, if there is no such cell.
|
|
|
|
|
2010-07-22 10:29:23 +00:00
|
|
|
void markCellAsUnchanged();
|
2010-08-05 11:29:49 +00:00
|
|
|
|
|
|
|
std::string getFacedHandle();
|
|
|
|
///< Return handle of the object the player is looking at
|
2010-08-07 18:25:17 +00:00
|
|
|
|
|
|
|
void deleteObject (Ptr ptr);
|
2010-08-21 10:31:04 +00:00
|
|
|
|
|
|
|
void moveObject (Ptr ptr, float x, float y, float z);
|
2010-08-22 19:30:48 +00:00
|
|
|
|
2010-09-11 10:21:55 +00:00
|
|
|
void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false) const;
|
2010-08-22 19:30:48 +00:00
|
|
|
///< Convert cell numbers to position.
|
|
|
|
|
|
|
|
void positionToIndex (float x, float y, int &cellX, int &cellY) const;
|
|
|
|
///< Convert position to cell numbers
|
2011-01-29 16:39:34 +00:00
|
|
|
|
2011-02-01 09:11:41 +00:00
|
|
|
void doPhysics (const std::vector<std::pair<std::string, Ogre::Vector3> >& actors,
|
|
|
|
float duration);
|
2011-01-29 16:39:34 +00:00
|
|
|
///< Run physics simulation and modify \a world accordingly.
|
2011-03-13 21:33:55 +00:00
|
|
|
|
2011-04-26 19:38:21 +00:00
|
|
|
bool toggleCollisionMode();
|
2011-03-13 21:33:55 +00:00
|
|
|
///< Toggle collision mode for player. If disabled player object should ignore
|
|
|
|
/// collisions and gravity.
|
2011-04-26 19:38:21 +00:00
|
|
|
///< \return Resulting mode
|
2011-03-16 08:09:45 +00:00
|
|
|
|
2011-04-26 19:38:21 +00:00
|
|
|
bool toggleRenderMode (RenderMode mode);
|
2011-03-16 08:09:45 +00:00
|
|
|
///< Toggle a render mode.
|
2011-04-26 19:38:21 +00:00
|
|
|
///< \return Resulting mode
|
2011-07-22 13:56:54 +00:00
|
|
|
|
|
|
|
std::pair<std::string, const ESM::Potion *> createRecord (const ESM::Potion& record);
|
|
|
|
///< Create a new recrod (of type potion) in the ESM store.
|
|
|
|
/// \return ID, pointer to created record
|
|
|
|
|
|
|
|
std::pair<std::string, const ESM::Class *> createRecord (const ESM::Class& record);
|
|
|
|
///< Create a new recrod (of type class) in the ESM store.
|
|
|
|
/// \return ID, pointer to created record
|
2010-07-02 07:38:22 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|