From bc06d13d309c40dda73f1fe524472169ff38c237 Mon Sep 17 00:00:00 2001 From: Jason Hooks Date: Sun, 13 Nov 2011 23:17:56 -0500 Subject: [PATCH] Removing backups --- apps/openmw/mwworld/backup/scene.cpp | 275 --------------------------- apps/openmw/mwworld/backup/scene.hpp | 106 ----------- 2 files changed, 381 deletions(-) delete mode 100644 apps/openmw/mwworld/backup/scene.cpp delete mode 100644 apps/openmw/mwworld/backup/scene.hpp diff --git a/apps/openmw/mwworld/backup/scene.cpp b/apps/openmw/mwworld/backup/scene.cpp deleted file mode 100644 index 93b4a80f4..000000000 --- a/apps/openmw/mwworld/backup/scene.cpp +++ /dev/null @@ -1,275 +0,0 @@ -#include "scene.hpp" -#include "world.hpp" - -#include "../mwrender/interior.hpp" -#include "../mwrender/exterior.hpp" - -#include "../mwmechanics/mechanicsmanager.hpp" - -#include "../mwsound/soundmanager.hpp" - -#include "ptr.hpp" -#include "environment.hpp" -#include "player.hpp" -#include "class.hpp" - -#include "cellfunctors.hpp" - -namespace { - -template -void insertCellRefList (T& cellRefList, ESMS::CellStore &cell) -{ - if (!cellRefList.list.empty()) - { - //const MWWorld::Class& class_ = MWWorld::Class::get (MWWorld::Ptr (&*cellRefList.list.begin(), &cell)); - - for (typename T::List::iterator it = cellRefList.list.begin(); - it != cellRefList.list.end(); it++) - { - if (it->mData.getCount() || it->mData.isEnabled()) - { - MWWorld::Ptr ptr (&*it, &cell); - /* TODO: call - * RenderingManager.insertObject - * class_.insertObjectPhysic - * class_.insertObjectMechanics - */ - } - } - } -} - -} - - -namespace MWWorld -{ - - void Scene::unloadCell (CellRenderCollection::iterator iter) - { - ListHandles functor; - iter->first->forEach(functor); - - { // silence annoying g++ warning - for (std::vector::const_iterator iter (functor.mHandles.begin()); - iter!=functor.mHandles.end(); ++iter) - mPhysics->removeObject (*iter); - } - - mWorld->getLocalScripts().clearCell (iter->first); - - mEnvironment.mMechanicsManager->dropActors (iter->first); - mEnvironment.mSoundManager->stopSound (iter->first); - delete iter->second; - mActiveCells.erase (iter); - } - - void Scene::loadCell (Ptr::CellStore *cell, MWRender::CellRender *render) - { - // register local scripts - mWorld->getLocalScripts().addCell (cell); - - // This connects the cell data with the rendering scene. - std::pair result = - mActiveCells.insert (std::make_pair (cell, render)); - - if (result.second) - { - // Load the cell and insert it into the renderer - result.first->second->show(); - } - } - - void Scene::playerCellChange (Ptr::CellStore *cell, const ESM::Position& position, - bool adjustPlayerPos) - { - if (adjustPlayerPos) - mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]); - - mWorld->getPlayer().setCell (cell); - // TODO orientation - mEnvironment.mMechanicsManager->addActor (mWorld->getPlayer().getPlayer()); - mEnvironment.mMechanicsManager->watchActor (mWorld->getPlayer().getPlayer()); - } - - void Scene::changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos) - { - // remove active - mEnvironment.mMechanicsManager->removeActor (mWorld->getPlayer().getPlayer()); - - CellRenderCollection::iterator active = mActiveCells.begin(); - - while (active!=mActiveCells.end()) - { - if (!(active->first->cell->data.flags & ESM::Cell::Interior)) - { - if (std::abs (X-active->first->cell->data.gridX)<=1 && - std::abs (Y-active->first->cell->data.gridY)<=1) - { - // keep cells within the new 3x3 grid - ++active; - continue; - } - } - - unloadCell (active++); - } - - // Load cells - for (int x=X-1; x<=X+1; ++x) - for (int y=Y-1; y<=Y+1; ++y) - { - CellRenderCollection::iterator iter = mActiveCells.begin(); - - while (iter!=mActiveCells.end()) - { - assert (!(iter->first->cell->data.flags & ESM::Cell::Interior)); - - if (x==iter->first->cell->data.gridX && - y==iter->first->cell->data.gridY) - break; - - ++iter; - } - - if (iter==mActiveCells.end()) - { - Ptr::CellStore *cell = mWorld->getExterior(x, y); - - loadCell (cell, new MWRender::ExteriorCellRender (*cell, mEnvironment, mRendering.getOgreRenderer(), mMwRoot, mPhysics)); - } - } - - // find current cell - CellRenderCollection::iterator iter = mActiveCells.begin(); - - while (iter!=mActiveCells.end()) - { - assert (!(iter->first->cell->data.flags & ESM::Cell::Interior)); - - if (X==iter->first->cell->data.gridX && - Y==iter->first->cell->data.gridY) - break; - - ++iter; - } - - assert (iter!=mActiveCells.end()); - - mCurrentCell = iter->first; - - // adjust player - playerCellChange (mWorld->getExterior(X, Y), position, adjustPlayerPos); - - // Sky system - mWorld->adjustSky(); - - mCellChanged = true; - } - - //We need the ogre renderer and a scene node. - Scene::Scene (Environment& environment, World *world, MWRender::RenderingManager& rendering, Ogre::SceneNode *mwRoot, PhysicsSystem *physics) - : mRendering(rendering), mCurrentCell (0), - mCellChanged (false), mEnvironment (environment), mWorld(world), mPhysics(physics) - { - mMwRoot = mwRoot; - } - - Scene::~Scene() - { - for (CellRenderCollection::iterator iter (mActiveCells.begin()); - iter!=mActiveCells.end(); ++iter) - delete iter->second; - } - - bool Scene::hasCellChanged() const - { - return mCellChanged; - } - - const Scene::CellRenderCollection& Scene::getActiveCells() const - { - return mActiveCells; - } - - void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position) - { - // remove active - CellRenderCollection::iterator active = mActiveCells.begin(); - - while (active!=mActiveCells.end()) - { - unloadCell (active++); - } - - // Load cell. - std::cout << "cellName:" << cellName << std::endl; - Ptr::CellStore *cell = mWorld->getInterior(cellName); - - loadCell (cell, new MWRender::InteriorCellRender (*cell, mEnvironment, mRendering.getOgreRenderer(), mMwRoot, mPhysics)); - - // adjust player - mCurrentCell = cell; - playerCellChange (cell, position); - - // Sky system - mWorld->adjustSky(); - - mCellChanged = true; - //currentRegion->name = ""; - } - - void Scene::changeToExteriorCell (const ESM::Position& position) - { - int x = 0; - int y = 0; - - mWorld->positionToIndex (position.pos[0], position.pos[1], x, y); - - changeCell (x, y, position, true); - } - - Ptr::CellStore* Scene::getCurrentCell () - { - return mCurrentCell; - } - - void Scene::markCellAsUnchanged() - { - mCellChanged = false; - } - -/*#include -#include -#include - -#include "../mwworld/class.hpp" -#include "../mwworld/ptr.hpp"*/ - -void Scene::insertCell(ESMS::CellStore &cell) -{ - // Loop through all references in the cell - insertCellRefList (cell.activators, cell); - insertCellRefList (cell.potions, cell); - insertCellRefList (cell.appas, cell); - insertCellRefList (cell.armors, cell); - insertCellRefList (cell.books, cell); - insertCellRefList (cell.clothes, cell); - insertCellRefList (cell.containers, cell); - insertCellRefList (cell.creatures, cell); - insertCellRefList (cell.doors, cell); - insertCellRefList (cell.ingreds, cell); - insertCellRefList (cell.creatureLists, cell); - insertCellRefList (cell.itemLists, cell); - insertCellRefList (cell.lights, cell); - insertCellRefList (cell.lockpicks, cell); - insertCellRefList (cell.miscItems, cell); - insertCellRefList (cell.npcs, cell); - insertCellRefList (cell.probes, cell); - insertCellRefList (cell.repairs, cell); - insertCellRefList (cell.statics, cell); - insertCellRefList (cell.weapons, cell); -} - -} diff --git a/apps/openmw/mwworld/backup/scene.hpp b/apps/openmw/mwworld/backup/scene.hpp deleted file mode 100644 index e170f0153..000000000 --- a/apps/openmw/mwworld/backup/scene.hpp +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef GAME_MWWORLD_SCENE_H -#define GAME_MWWORLD_SCENE_H - -#include -#include - -#include - -#include - -#include "physicssystem.hpp" - -#include "refdata.hpp" -#include "ptr.hpp" -#include "globals.hpp" -#include "../mwrender/renderingmanager.hpp" -#include - -namespace Ogre -{ - class Vector3; -} - -namespace ESM -{ - struct Position; -} - -namespace Files -{ - class Collections; -} - -namespace Render -{ - class OgreRenderer; -} - -namespace MWRender -{ - class SkyManager; - class CellRender; -} - -namespace MWWorld -{ - class Environment; - class Player; - - class Scene - { - - public: - - typedef std::map CellRenderCollection; - - private: - - //OEngine::Render::OgreRenderer& mRenderer; - Ogre::SceneNode *mMwRoot; - Ptr::CellStore *mCurrentCell; // the cell, the player is in - CellRenderCollection mActiveCells; - bool mCellChanged; - Environment& mEnvironment; - World *mWorld; - PhysicsSystem *mPhysics; - MWRender::RenderingManager& mRendering; - - void playerCellChange (Ptr::CellStore *cell, const ESM::Position& position, - bool adjustPlayerPos = true); - public: - - Scene (Environment& environment, World *world, MWRender::RenderingManager& rendering, Ogre::SceneNode *mwRoot, PhysicsSystem *physics); - - ~Scene(); - - void unloadCell (CellRenderCollection::iterator iter); - - void loadCell (Ptr::CellStore *cell, MWRender::CellRender *render); - - void changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos); - ///< Move from exterior to interior or from interior cell to a different - /// interior cell. - - Ptr::CellStore* getCurrentCell (); - - const CellRenderCollection& getActiveCells () const; - - bool hasCellChanged() const; - ///< Has the player moved to a different cell, since the last frame? - - void changeToInteriorCell (const std::string& cellName, const ESM::Position& position); - ///< Move to interior cell. - - void changeToExteriorCell (const ESM::Position& position); - ///< Move to exterior cell. - - void markCellAsUnchanged(); - -// std::string getFacedHandle(); - - void insertCell(ESMS::CellStore &cell); - }; -} - -#endif