mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 06:53:52 +00:00
World::Scene improvements
This commit is contained in:
parent
af59f3c475
commit
380cd5ca35
2 changed files with 8 additions and 106 deletions
|
@ -1,13 +1,6 @@
|
|||
#include "scene.hpp"
|
||||
#include "world.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
#include <components/bsa/bsa_archive.hpp>
|
||||
#include <components/files/collections.hpp>
|
||||
|
||||
#include "../mwrender/sky.hpp"
|
||||
#include "../mwrender/interior.hpp"
|
||||
#include "../mwrender/exterior.hpp"
|
||||
|
||||
|
@ -17,11 +10,8 @@
|
|||
|
||||
#include "ptr.hpp"
|
||||
#include "environment.hpp"
|
||||
#include "class.hpp"
|
||||
#include "player.hpp"
|
||||
|
||||
#include "refdata.hpp"
|
||||
#include "globals.hpp"
|
||||
#include "doingphysics.hpp"
|
||||
#include "cellfunctors.hpp"
|
||||
|
||||
|
@ -42,8 +32,8 @@ namespace MWWorld
|
|||
|
||||
mWorld->removeScripts (iter->first);
|
||||
|
||||
mEnvironment.mMechanicsManager->dropActors (iter->first);
|
||||
mEnvironment.mSoundManager->stopSound (iter->first);
|
||||
mEnvironment.mMechanicsManager->dropActors (iter->first); // FIXME: gehört in world?
|
||||
mEnvironment.mSoundManager->stopSound (iter->first); // FIXME: same
|
||||
delete iter->second;
|
||||
mActiveCells.erase (iter);
|
||||
}
|
||||
|
@ -158,8 +148,8 @@ namespace MWWorld
|
|||
const Files::Collections& fileCollections,
|
||||
const std::string& master, const boost::filesystem::path& resDir,
|
||||
bool newGame, Environment& environment, const std::string& encoding, World *world, MWRender::MWScene& scene)
|
||||
: mSkyManager (0), mScene (scene), mCurrentCell (0), mGlobalVariables (0),
|
||||
mSky (false), mCellChanged (false), mEnvironment (environment), mNextDynamicRecord (0), mWorld(world)
|
||||
: mScene (scene), mCurrentCell (0),
|
||||
mCellChanged (false), mEnvironment (environment), mWorld(world)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -168,13 +158,6 @@ namespace MWWorld
|
|||
for (CellRenderCollection::iterator iter (mActiveCells.begin());
|
||||
iter!=mActiveCells.end(); ++iter)
|
||||
delete iter->second;
|
||||
|
||||
for (CellRenderCollection::iterator iter (mBufferedCells.begin());
|
||||
iter!=mBufferedCells.end(); ++iter)
|
||||
delete iter->second;
|
||||
|
||||
delete mSkyManager;
|
||||
delete mGlobalVariables;
|
||||
}
|
||||
|
||||
bool Scene::hasCellChanged() const
|
||||
|
|
|
@ -47,55 +47,25 @@ namespace MWWorld
|
|||
class Environment;
|
||||
class Player;
|
||||
|
||||
/// \brief The game world and its visual representation
|
||||
|
||||
class Scene
|
||||
{
|
||||
|
||||
public:
|
||||
typedef std::list<std::pair<std::string, Ptr> > ScriptList;
|
||||
|
||||
enum RenderMode
|
||||
{
|
||||
Render_CollisionDebug
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
typedef std::map<Ptr::CellStore *, MWRender::CellRender *> CellRenderCollection;
|
||||
|
||||
MWRender::SkyManager* mSkyManager;
|
||||
MWRender::MWScene mScene;
|
||||
Ptr::CellStore *mCurrentCell; // the cell, the player is in
|
||||
CellRenderCollection mActiveCells;
|
||||
CellRenderCollection mBufferedCells; // loaded, but not active (buffering not implementd yet)
|
||||
ESM::ESMReader mEsm;
|
||||
ESMS::ESMStore mStore;
|
||||
std::map<std::string, Ptr::CellStore> mInteriors;
|
||||
std::map<std::pair<int, int>, Ptr::CellStore> mExteriors;
|
||||
ScriptList mLocalScripts;
|
||||
MWWorld::Globals *mGlobalVariables;
|
||||
bool mSky;
|
||||
bool mCellChanged;
|
||||
Environment& mEnvironment;
|
||||
int mNextDynamicRecord;
|
||||
World *mWorld;
|
||||
|
||||
OEngine::Physic::PhysicEngine* mPhysEngine;
|
||||
|
||||
// not implemented
|
||||
Scene (const Scene&);
|
||||
Scene& operator= (const Scene&);
|
||||
|
||||
Ptr getPtr (const std::string& name, Ptr::CellStore& cellStore);
|
||||
|
||||
Ptr getPtrViaHandle (const std::string& handle, Ptr::CellStore& cellStore);
|
||||
|
||||
MWRender::CellRender *searchRender (Ptr::CellStore *store);
|
||||
|
||||
int getDaysPerMonth (int month) const;
|
||||
|
||||
void removeScripts (Ptr::CellStore *cell);
|
||||
|
||||
void playerCellChange (Ptr::CellStore *cell, const ESM::Position& position,
|
||||
bool adjustPlayerPos = true);
|
||||
|
@ -120,72 +90,21 @@ namespace MWWorld
|
|||
|
||||
CellRenderCollection getActiveCells ();
|
||||
|
||||
void insertInteriorScripts (ESMS::CellStore<RefData>& cell);
|
||||
|
||||
MWWorld::Player& getPlayer();
|
||||
|
||||
const ESMS::ESMStore& getStore() const;
|
||||
|
||||
const ScriptList& getLocalScripts() const;
|
||||
///< Names and local variable state of all local scripts in active cells.
|
||||
|
||||
bool hasCellChanged() const;
|
||||
///< Has the player moved to a different cell, since the last frame?
|
||||
|
||||
Globals::Data& getGlobalVariable (const std::string& name);
|
||||
|
||||
Globals::Data getGlobalVariable (const std::string& name) const;
|
||||
|
||||
char getGlobalVariableType (const std::string& name) const;
|
||||
///< Return ' ', if there is no global variable with this name.
|
||||
|
||||
Ptr getPtr (const std::string& name, bool activeOnly);
|
||||
///< Return a pointer to a liveCellRef with the given name.
|
||||
/// \param activeOnly do non search inactive cells.
|
||||
|
||||
Ptr getPtrViaHandle (const std::string& handle);
|
||||
///< Return a pointer to a liveCellRef with the given Ogre handle.
|
||||
|
||||
void enable (Ptr reference);
|
||||
|
||||
void disable (Ptr reference);
|
||||
|
||||
void changeToInteriorCell (const std::string& cellName, const ESM::Position& position); // FIXME: YEAH!
|
||||
void changeToInteriorCell (const std::string& cellName, const ESM::Position& position);
|
||||
///< Move to interior cell.
|
||||
|
||||
void changeToExteriorCell (const ESM::Position& position); // FIXME: YEAH!
|
||||
void changeToExteriorCell (const ESM::Position& position);
|
||||
///< Move to exterior cell.
|
||||
|
||||
const ESM::Cell *getExterior (const std::string& cellName) const; // FIXME: YEAH!
|
||||
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.
|
||||
|
||||
void markCellAsUnchanged(); // FIXME: YEAH!
|
||||
void markCellAsUnchanged();
|
||||
|
||||
std::string getFacedHandle();
|
||||
///< Return handle of the object the player is looking at
|
||||
|
||||
void deleteObject (Ptr ptr); // FIXME: DONT KNOW
|
||||
|
||||
void moveObject (Ptr ptr, float x, float y, float z); // FIXME: DONT KNOW
|
||||
|
||||
void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false) const;
|
||||
///< Convert cell numbers to position.
|
||||
|
||||
void positionToIndex (float x, float y, int &cellX, int &cellY) const;
|
||||
///< Convert position to cell numbers
|
||||
|
||||
void doPhysics (const std::vector<std::pair<std::string, Ogre::Vector3> >& actors,
|
||||
float duration);
|
||||
///< Run physics simulation and modify \a world accordingly.
|
||||
|
||||
bool toggleCollisionMode();
|
||||
///< Toggle collision mode for player. If disabled player object should ignore
|
||||
/// collisions and gravity.
|
||||
///< \return Resulting mode
|
||||
|
||||
bool toggleRenderMode (RenderMode mode);
|
||||
///< Toggle a render mode.
|
||||
///< \return Resulting mode
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue