mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 20:45:35 +00:00
Merge branch 'class2'
This commit is contained in:
commit
973ddc54e8
43 changed files with 586 additions and 114 deletions
|
@ -7,8 +7,26 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Activator::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Activator>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Activator::getName (const MWWorld::Ptr& ptr) const
|
std::string Activator::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Apparatus::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Apparatus>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Apparatus::getName (const MWWorld::Ptr& ptr) const
|
std::string Apparatus::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Armor::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Armor>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Armor::getName (const MWWorld::Ptr& ptr) const
|
std::string Armor::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Book::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Book>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Book::getName (const MWWorld::Ptr& ptr) const
|
std::string Book::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Clothing::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Clothing>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Clothing::getName (const MWWorld::Ptr& ptr) const
|
std::string Clothing::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -7,8 +7,26 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Container::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Container>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Container::getName (const MWWorld::Ptr& ptr) const
|
std::string Container::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -7,9 +7,40 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontalk.hpp"
|
#include "../mwworld/actiontalk.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Creature::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Creature>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Creature::enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
environment.mMechanicsManager->addActor (ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Creature::disable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
environment.mMechanicsManager->removeActor (ptr);
|
||||||
|
}
|
||||||
|
|
||||||
std::string Creature::getName (const MWWorld::Ptr& ptr) const
|
std::string Creature::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,16 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
|
virtual void enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
||||||
|
///< Enable reference; only does the non-rendering part
|
||||||
|
|
||||||
|
virtual void disable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
||||||
|
///< Enable reference; only does the non-rendering part
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -13,8 +13,26 @@
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwworld/environment.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Door::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Door>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Door::getName (const MWWorld::Ptr& ptr) const
|
std::string Door::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Ingredient::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Ingredient>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Ingredient::getName (const MWWorld::Ptr& ptr) const
|
std::string Ingredient::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,11 +8,53 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Light::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
|
||||||
|
// Extract the color and convert to floating point
|
||||||
|
const int color = ref->base->data.color;
|
||||||
|
const float r = ((color >> 0) & 0xFF) / 255.0f;
|
||||||
|
const float g = ((color >> 8) & 0xFF) / 255.0f;
|
||||||
|
const float b = ((color >> 16) & 0xFF) / 255.0f;
|
||||||
|
const float radius = float (ref->base->data.radius);
|
||||||
|
cellRender.insertLight (r, g, b, radius);
|
||||||
|
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Light::enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
|
if (!ref->base->sound.empty())
|
||||||
|
{
|
||||||
|
environment.mSoundManager->playSound3D (ptr, ref->base->sound, 1.0, 1.0, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Light::getName (const MWWorld::Ptr& ptr) const
|
std::string Light::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,15 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
|
virtual void enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
||||||
|
///< Enable reference; only does the non-rendering part
|
||||||
|
/// \attention This is not the same as the script instruction with the same name. References
|
||||||
|
/// should only be enabled while in an active cell.
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Lockpick::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Tool>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Lockpick::getName (const MWWorld::Ptr& ptr) const
|
std::string Lockpick::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Misc::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Misc, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Misc>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Misc::getName (const MWWorld::Ptr& ptr) const
|
std::string Misc::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Misc, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Misc, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -7,9 +7,54 @@
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontalk.hpp"
|
#include "../mwworld/actiontalk.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Npc::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::NPC>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
|
||||||
|
std::string headID = ref->base->head;
|
||||||
|
|
||||||
|
//get the part of the bodypart id which describes the race and the gender
|
||||||
|
std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
|
||||||
|
std::string headModel = "meshes\\" +
|
||||||
|
environment.mWorld->getStore().bodyParts.find(headID)->model;
|
||||||
|
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh (headModel);
|
||||||
|
|
||||||
|
//TODO: define consts for each bodypart e.g. chest, foot, wrist... and put the parts in the
|
||||||
|
// right place
|
||||||
|
const ESM::BodyPart *bodyPart =
|
||||||
|
environment.mWorld->getStore().bodyParts.search (bodyRaceID + "chest");
|
||||||
|
|
||||||
|
if (bodyPart)
|
||||||
|
cellRender.insertMesh("meshes\\" + bodyPart->model);
|
||||||
|
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Npc::enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
environment.mMechanicsManager->addActor (ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Npc::disable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
environment.mMechanicsManager->removeActor (ptr);
|
||||||
|
}
|
||||||
|
|
||||||
std::string Npc::getName (const MWWorld::Ptr& ptr) const
|
std::string Npc::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,16 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
|
virtual void enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
||||||
|
///< Enable reference; only does the non-rendering part
|
||||||
|
|
||||||
|
virtual void disable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const;
|
||||||
|
///< Enable reference; only does the non-rendering part
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Potion::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Potion>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Potion::getName (const MWWorld::Ptr& ptr) const
|
std::string Potion::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Probe::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Probe>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Probe::getName (const MWWorld::Ptr& ptr) const
|
std::string Probe::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Repair::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Repair>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Repair::getName (const MWWorld::Ptr& ptr) const
|
std::string Repair::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -3,8 +3,28 @@
|
||||||
|
|
||||||
#include <components/esm/loadstat.hpp>
|
#include <components/esm/loadstat.hpp>
|
||||||
|
|
||||||
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Static::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Static, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Static>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Static::getName (const MWWorld::Ptr& ptr) const
|
std::string Static::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -8,10 +8,28 @@
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
|
|
||||||
|
#include "../mwrender/cellimp.hpp"
|
||||||
|
|
||||||
#include "containerutil.hpp"
|
#include "containerutil.hpp"
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
void Weapon::insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Weapon>();
|
||||||
|
|
||||||
|
assert (ref->base != NULL);
|
||||||
|
const std::string &model = ref->base->model;
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
cellRender.insertBegin (ref->ref);
|
||||||
|
cellRender.insertMesh ("meshes\\" + model);
|
||||||
|
ref->mData.setHandle (cellRender.insertEnd (ref->mData.isEnabled()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Weapon::getName (const MWWorld::Ptr& ptr) const
|
std::string Weapon::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void insertObj (const MWWorld::Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -2,94 +2,55 @@
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
using namespace MWRender;
|
using namespace MWRender;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void insertObj(CellRenderImp& cellRender, T& liveRef, const ESMS::ESMStore& store)
|
void insertCellRefList (CellRenderImp& cellRender, MWWorld::Environment& environment,
|
||||||
|
T& cellRefList, ESMS::CellStore<MWWorld::RefData> &cell)
|
||||||
{
|
{
|
||||||
assert (liveRef.base != NULL);
|
if (!cellRefList.list.empty())
|
||||||
const std::string &model = liveRef.base->model;
|
|
||||||
if(!model.empty())
|
|
||||||
{
|
{
|
||||||
cellRender.insertBegin (liveRef.ref);
|
const MWWorld::Class& class_ =
|
||||||
cellRender.insertMesh ("meshes\\" + model);
|
MWWorld::Class::get (MWWorld::Ptr (&*cellRefList.list.begin(), &cell));
|
||||||
liveRef.mData.setHandle (cellRender.insertEnd (liveRef.mData.isEnabled()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
for (typename T::List::iterator it = cellRefList.list.begin();
|
||||||
void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRef<ESM::Light, MWWorld::RefData>& liveRef, const ESMS::ESMStore& store)
|
|
||||||
{
|
|
||||||
assert (liveRef.base != NULL);
|
|
||||||
const std::string &model = liveRef.base->model;
|
|
||||||
if(!model.empty())
|
|
||||||
{
|
|
||||||
cellRender.insertBegin (liveRef.ref);
|
|
||||||
|
|
||||||
cellRender.insertMesh ("meshes\\" + model);
|
|
||||||
|
|
||||||
// Extract the color and convert to floating point
|
|
||||||
const int color = liveRef.base->data.color;
|
|
||||||
const float r = ((color >> 0) & 0xFF) / 255.0f;
|
|
||||||
const float g = ((color >> 8) & 0xFF) / 255.0f;
|
|
||||||
const float b = ((color >> 16) & 0xFF) / 255.0f;
|
|
||||||
const float radius = float(liveRef.base->data.radius);
|
|
||||||
cellRender.insertLight(r, g, b, radius);
|
|
||||||
|
|
||||||
liveRef.mData.setHandle (cellRender.insertEnd (liveRef.mData.isEnabled()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
void insertObj(CellRenderImp& cellRender, ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>& liveRef, const ESMS::ESMStore& store)
|
|
||||||
{
|
|
||||||
std::string headID = liveRef.base->head;
|
|
||||||
|
|
||||||
//get the part of the bodypart id which describes the race and the gender
|
|
||||||
std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
|
|
||||||
std::string headModel = "meshes\\" + store.bodyParts.find(headID)->model;
|
|
||||||
|
|
||||||
cellRender.insertBegin(liveRef.ref);
|
|
||||||
cellRender.insertMesh(headModel);
|
|
||||||
|
|
||||||
//TODO: define consts for each bodypart e.g. chest, foot, wrist... and put the parts in the right place
|
|
||||||
cellRender.insertMesh("meshes\\" + store.bodyParts.find(bodyRaceID + "chest")->model);
|
|
||||||
|
|
||||||
liveRef.mData.setHandle (cellRender.insertEnd (liveRef.mData.isEnabled()));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void insertCellRefList (CellRenderImp& cellRender, const ESMS::ESMStore& store, T& cellRefList)
|
|
||||||
{
|
|
||||||
for(typename T::List::iterator it = cellRefList.list.begin();
|
|
||||||
it != cellRefList.list.end(); it++)
|
it != cellRefList.list.end(); it++)
|
||||||
{
|
{
|
||||||
if (it->mData.getCount())
|
if (it->mData.getCount())
|
||||||
insertObj (cellRender, *it, store);
|
{
|
||||||
|
MWWorld::Ptr ptr (&*it, &cell);
|
||||||
|
class_.insertObj (ptr, cellRender, environment);
|
||||||
|
class_.enable (ptr, environment);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellRenderImp::insertCell(ESMS::CellStore<MWWorld::RefData> &cell, const ESMS::ESMStore& store)
|
void CellRenderImp::insertCell(ESMS::CellStore<MWWorld::RefData> &cell,
|
||||||
|
MWWorld::Environment& environment)
|
||||||
{
|
{
|
||||||
// Loop through all references in the cell
|
// Loop through all references in the cell
|
||||||
insertCellRefList (*this, store, cell.activators);
|
insertCellRefList (*this, environment, cell.activators, cell);
|
||||||
insertCellRefList (*this, store, cell.potions);
|
insertCellRefList (*this, environment, cell.potions, cell);
|
||||||
insertCellRefList (*this, store, cell.appas);
|
insertCellRefList (*this, environment, cell.appas, cell);
|
||||||
insertCellRefList (*this, store, cell.armors);
|
insertCellRefList (*this, environment, cell.armors, cell);
|
||||||
insertCellRefList (*this, store, cell.books);
|
insertCellRefList (*this, environment, cell.books, cell);
|
||||||
insertCellRefList (*this, store, cell.clothes);
|
insertCellRefList (*this, environment, cell.clothes, cell);
|
||||||
insertCellRefList (*this, store, cell.containers);
|
insertCellRefList (*this, environment, cell.containers, cell);
|
||||||
insertCellRefList (*this, store, cell.creatures);
|
insertCellRefList (*this, environment, cell.creatures, cell);
|
||||||
insertCellRefList (*this, store, cell.doors);
|
insertCellRefList (*this, environment, cell.doors, cell);
|
||||||
insertCellRefList (*this, store, cell.ingreds);
|
insertCellRefList (*this, environment, cell.ingreds, cell);
|
||||||
// insertCellRefList (*this, store, cell.creatureLists);
|
insertCellRefList (*this, environment, cell.creatureLists, cell);
|
||||||
// insertCellRefList (*this, store, cell.itemLists);
|
insertCellRefList (*this, environment, cell.itemLists, cell);
|
||||||
insertCellRefList (*this, store, cell.lights);
|
insertCellRefList (*this, environment, cell.lights, cell);
|
||||||
insertCellRefList (*this, store, cell.lockpicks);
|
insertCellRefList (*this, environment, cell.lockpicks, cell);
|
||||||
insertCellRefList (*this, store, cell.miscItems);
|
insertCellRefList (*this, environment, cell.miscItems, cell);
|
||||||
insertCellRefList (*this, store, cell.npcs);
|
insertCellRefList (*this, environment, cell.npcs, cell);
|
||||||
insertCellRefList (*this, store, cell.probes);
|
insertCellRefList (*this, environment, cell.probes, cell);
|
||||||
insertCellRefList (*this, store, cell.repairs);
|
insertCellRefList (*this, environment, cell.repairs, cell);
|
||||||
insertCellRefList (*this, store, cell.statics);
|
insertCellRefList (*this, environment, cell.statics, cell);
|
||||||
insertCellRefList (*this, store, cell.weapons);
|
insertCellRefList (*this, environment, cell.weapons, cell);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,9 @@ namespace ESM
|
||||||
class CellRef;
|
class CellRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ESMS
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class ESMStore;
|
class Environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
|
@ -40,7 +40,7 @@ namespace MWRender
|
||||||
/// finish inserting a new reference and return a handle to it.
|
/// finish inserting a new reference and return a handle to it.
|
||||||
virtual std::string insertEnd (bool Enable) = 0;
|
virtual std::string insertEnd (bool Enable) = 0;
|
||||||
|
|
||||||
void insertCell(ESMS::CellStore<MWWorld::RefData> &cell, const ESMS::ESMStore& store);
|
void insertCell(ESMS::CellStore<MWWorld::RefData> &cell, MWWorld::Environment& environment);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,19 +174,12 @@ void InteriorCellRender::setAmbientMode()
|
||||||
|
|
||||||
void InteriorCellRender::show()
|
void InteriorCellRender::show()
|
||||||
{
|
{
|
||||||
// If already loaded, just make the cell visible.
|
|
||||||
if(base)
|
|
||||||
{
|
|
||||||
base->setVisible(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
base = scene.getRoot()->createChildSceneNode();
|
base = scene.getRoot()->createChildSceneNode();
|
||||||
|
|
||||||
configureAmbient();
|
configureAmbient();
|
||||||
configureFog();
|
configureFog();
|
||||||
|
|
||||||
insertCell(cell, store);
|
insertCell(cell, mEnvironment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteriorCellRender::hide()
|
void InteriorCellRender::hide()
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "cell.hpp"
|
#include "cell.hpp"
|
||||||
#include "cellimp.hpp"
|
#include "cellimp.hpp"
|
||||||
#include "components/esm_store/cell_store.hpp"
|
|
||||||
|
|
||||||
#include "OgreColourValue.h"
|
#include "OgreColourValue.h"
|
||||||
|
|
||||||
|
@ -12,6 +11,11 @@ namespace Ogre
|
||||||
class SceneNode;
|
class SceneNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
class Environment;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
class MWScene;
|
class MWScene;
|
||||||
|
@ -43,7 +47,7 @@ namespace MWRender
|
||||||
static bool lightOutQuadInLin;
|
static bool lightOutQuadInLin;
|
||||||
|
|
||||||
ESMS::CellStore<MWWorld::RefData> &cell;
|
ESMS::CellStore<MWWorld::RefData> &cell;
|
||||||
const ESMS::ESMStore &store;
|
MWWorld::Environment &mEnvironment;
|
||||||
MWScene &scene;
|
MWScene &scene;
|
||||||
|
|
||||||
/// The scene node that contains all objects belonging to this
|
/// The scene node that contains all objects belonging to this
|
||||||
|
@ -79,8 +83,9 @@ namespace MWRender
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
InteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, const ESMS::ESMStore& _store, MWScene &_scene)
|
InteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||||
: cell(_cell), store(_store), scene(_scene), base(NULL), insert(NULL), ambientMode (0) {}
|
MWScene &_scene)
|
||||||
|
: cell(_cell), mEnvironment (environment), scene(_scene), base(NULL), insert(NULL), ambientMode (0) {}
|
||||||
|
|
||||||
virtual ~InteriorCellRender() { destroy(); }
|
virtual ~InteriorCellRender() { destroy(); }
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,22 @@ namespace MWWorld
|
||||||
|
|
||||||
Class::~Class() {}
|
Class::~Class() {}
|
||||||
|
|
||||||
|
void Class::insertObj (const Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Class::enable (const Ptr& ptr, MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Class::disable (const Ptr& ptr, MWWorld::Environment& environment) const
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
MWMechanics::CreatureStats& Class::getCreatureStats (const Ptr& ptr) const
|
MWMechanics::CreatureStats& Class::getCreatureStats (const Ptr& ptr) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error ("class does not have creature stats");
|
throw std::runtime_error ("class does not have creature stats");
|
||||||
|
|
|
@ -10,6 +10,11 @@
|
||||||
#include "containerstore.hpp"
|
#include "containerstore.hpp"
|
||||||
#include "refdata.hpp"
|
#include "refdata.hpp"
|
||||||
|
|
||||||
|
namespace MWRender
|
||||||
|
{
|
||||||
|
class CellRenderImp;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
struct CreatureStats;
|
struct CreatureStats;
|
||||||
|
@ -18,6 +23,7 @@ namespace MWMechanics
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class Ptr;
|
class Ptr;
|
||||||
|
class Environment;
|
||||||
|
|
||||||
/// \brief Base class for referenceable esm records
|
/// \brief Base class for referenceable esm records
|
||||||
class Class
|
class Class
|
||||||
|
@ -36,6 +42,20 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual ~Class();
|
virtual ~Class();
|
||||||
|
|
||||||
|
virtual void insertObj (const Ptr& ptr, MWRender::CellRenderImp& cellRender,
|
||||||
|
MWWorld::Environment& environment) const;
|
||||||
|
///< Add reference into a cell for rendering (default implementation: don't render anything).
|
||||||
|
|
||||||
|
virtual void enable (const Ptr& ptr, MWWorld::Environment& environment) const;
|
||||||
|
///< Enable reference; only does the non-rendering part (default implementation: ignore)
|
||||||
|
/// \attention This is not the same as the script instruction with the same name. References
|
||||||
|
/// should only be enabled while in an active cell.
|
||||||
|
|
||||||
|
virtual void disable (const Ptr& ptr, MWWorld::Environment& environment) const;
|
||||||
|
///< Enable reference; only does the non-rendering part (default implementation: ignore)
|
||||||
|
/// \attention This is not the same as the script instruction with the same name. References
|
||||||
|
/// should only be enabled while in an active cell.
|
||||||
|
|
||||||
virtual std::string getName (const Ptr& ptr) const = 0;
|
virtual std::string getName (const Ptr& ptr) const = 0;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
|
|
@ -11,8 +11,11 @@
|
||||||
|
|
||||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||||
|
|
||||||
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
#include "ptr.hpp"
|
#include "ptr.hpp"
|
||||||
#include "environment.hpp"
|
#include "environment.hpp"
|
||||||
|
#include "class.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -372,12 +375,8 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
render->enable (reference.getRefData().getHandle());
|
render->enable (reference.getRefData().getHandle());
|
||||||
|
|
||||||
if (mActiveCells.find (reference.getCell())!=mActiveCells.end() &&
|
if (mActiveCells.find (reference.getCell())!=mActiveCells.end())
|
||||||
(reference.getType()==typeid (ESMS::LiveCellRef<ESM::NPC, RefData>) ||
|
Class::get (reference).enable (reference, mEnvironment);
|
||||||
reference.getType()==typeid (ESMS::LiveCellRef<ESM::Creature, RefData>)))
|
|
||||||
{
|
|
||||||
mEnvironment.mMechanicsManager->addActor (reference);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -392,11 +391,10 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
render->disable (reference.getRefData().getHandle());
|
render->disable (reference.getRefData().getHandle());
|
||||||
|
|
||||||
if (mActiveCells.find (reference.getCell())!=mActiveCells.end() &&
|
if (mActiveCells.find (reference.getCell())!=mActiveCells.end())
|
||||||
(reference.getType()==typeid (ESMS::LiveCellRef<ESM::NPC, RefData>) ||
|
|
||||||
reference.getType()==typeid (ESMS::LiveCellRef<ESM::Creature, RefData>)))
|
|
||||||
{
|
{
|
||||||
mEnvironment.mMechanicsManager->removeActor (reference);
|
Class::get (reference).disable (reference, mEnvironment);
|
||||||
|
mEnvironment.mSoundManager->stopSound3D (reference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -535,6 +533,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
mEnvironment.mMechanicsManager->dropActors (active->first);
|
mEnvironment.mMechanicsManager->dropActors (active->first);
|
||||||
active->second->destroy();
|
active->second->destroy();
|
||||||
|
mEnvironment.mSoundManager->stopSound (active->first);
|
||||||
delete active->second;
|
delete active->second;
|
||||||
mActiveCells.erase (active);
|
mActiveCells.erase (active);
|
||||||
}
|
}
|
||||||
|
@ -551,7 +550,7 @@ namespace MWWorld
|
||||||
// This connects the cell data with the rendering scene.
|
// This connects the cell data with the rendering scene.
|
||||||
std::pair<CellRenderCollection::iterator, bool> result =
|
std::pair<CellRenderCollection::iterator, bool> result =
|
||||||
mActiveCells.insert (std::make_pair (cell,
|
mActiveCells.insert (std::make_pair (cell,
|
||||||
new MWRender::InteriorCellRender (*cell, mStore, mScene)));
|
new MWRender::InteriorCellRender (*cell, mEnvironment, mScene)));
|
||||||
|
|
||||||
if (result.second)
|
if (result.second)
|
||||||
{
|
{
|
||||||
|
@ -623,11 +622,10 @@ namespace MWWorld
|
||||||
render->deleteObject (ptr.getRefData().getHandle());
|
render->deleteObject (ptr.getRefData().getHandle());
|
||||||
ptr.getRefData().setHandle ("");
|
ptr.getRefData().setHandle ("");
|
||||||
|
|
||||||
if (mActiveCells.find (ptr.getCell())!=mActiveCells.end() &&
|
if (mActiveCells.find (ptr.getCell())!=mActiveCells.end())
|
||||||
(ptr.getType()==typeid (ESMS::LiveCellRef<ESM::NPC, RefData>) ||
|
|
||||||
ptr.getType()==typeid (ESMS::LiveCellRef<ESM::Creature, RefData>)))
|
|
||||||
{
|
{
|
||||||
mEnvironment.mMechanicsManager->removeActor (ptr);
|
Class::get (ptr).disable (ptr, mEnvironment);
|
||||||
|
mEnvironment.mSoundManager->stopSound3D (ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue