forked from mirror/openmw-tes3mp
Class::getModel implementation
This commit is contained in:
parent
87050e48c8
commit
6a3a728a56
39 changed files with 312 additions and 237 deletions
|
@ -19,32 +19,33 @@ namespace MWClass
|
|||
{
|
||||
void Activator::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Activator::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Activator::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Activator::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -28,6 +28,8 @@ namespace MWClass
|
|||
///< Return name of the script attached to ptr
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -22,34 +22,35 @@
|
|||
|
||||
namespace MWClass
|
||||
{
|
||||
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Apparatus::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Apparatus::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Apparatus::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -48,6 +48,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -27,31 +27,33 @@ namespace MWClass
|
|||
{
|
||||
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Armor::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Armor::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Armor::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -66,6 +66,7 @@ namespace MWClass
|
|||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,32 +23,33 @@ namespace MWClass
|
|||
{
|
||||
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Book::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Book::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Book::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -50,6 +50,8 @@ namespace MWClass
|
|||
|
||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -25,32 +25,33 @@ namespace MWClass
|
|||
{
|
||||
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Clothing::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Clothing::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Clothing::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -59,6 +59,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -54,32 +54,33 @@ namespace MWClass
|
|||
|
||||
void Container::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Container::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Container::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
|
||||
|
|
|
@ -51,6 +51,8 @@ namespace MWClass
|
|||
///< Unlock object
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -86,17 +86,25 @@ namespace MWClass
|
|||
}
|
||||
|
||||
void Creature::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()){
|
||||
physics.insertActorPhysics(ptr, model);
|
||||
}
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor (ptr);
|
||||
}
|
||||
|
||||
std::string Creature::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
assert (ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertActorPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor (ptr);
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Creature::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -54,6 +54,8 @@ namespace MWClass
|
|||
/// effects). Throws an exception, if the object can't hold other objects.
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -25,30 +25,33 @@ namespace MWClass
|
|||
{
|
||||
void Door::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Door::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Door::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Door::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace MWClass
|
|||
///< Return name of the script attached to ptr
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,30 +23,33 @@ namespace MWClass
|
|||
{
|
||||
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Ingredient::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Ingredient::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Ingredient::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace MWClass
|
|||
|
||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of inventory icon.
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
|
@ -50,20 +50,31 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if(!model.empty()){
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
if (!ref->base->sound.empty())
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, ref->base->sound, 1.0, 1.0, MWSound::Play_Loop);
|
||||
if (!ref->base->sound.empty()) {
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->base->sound, 1.0, 1.0, MWSound::Play_Loop);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Light::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
assert (ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Light::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -25,35 +25,35 @@ namespace MWClass
|
|||
{
|
||||
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
std::string Lockpick::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -27,32 +27,33 @@ namespace MWClass
|
|||
{
|
||||
void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Miscellaneous::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Miscellaneous::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace MWClass
|
|||
|
||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of inventory icon.
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -125,25 +125,29 @@ namespace MWClass
|
|||
|
||||
void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
physics.insertActorPhysics(ptr, getModel(ptr));
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor(ptr);
|
||||
}
|
||||
|
||||
std::string Npc::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
std::string headID = ref->base->head;
|
||||
std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
|
||||
bool beast = bodyRaceID == "b_n_khajiit_m_" || bodyRaceID == "b_n_khajiit_f_" || bodyRaceID == "b_n_argonian_m_" || bodyRaceID == "b_n_argonian_f_";
|
||||
int end = headID.find_last_of("head_") - 4;
|
||||
std::string bodyRaceID = headID.substr(0, end);
|
||||
|
||||
std::string smodel = "meshes\\base_anim.nif";
|
||||
if(beast)
|
||||
smodel = "meshes\\base_animkna.nif";
|
||||
physics.insertActorPhysics(ptr, smodel);
|
||||
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor (ptr);
|
||||
std::string model = "meshes\\base_anim.nif";
|
||||
if (bodyRaceID == "b_n_khajiit_m_" ||
|
||||
bodyRaceID == "b_n_khajiit_f_" ||
|
||||
bodyRaceID == "b_n_argonian_m_" ||
|
||||
bodyRaceID == "b_n_argonian_f_")
|
||||
{
|
||||
model = "meshes\\base_animkna.nif";
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
std::string Npc::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -88,6 +88,8 @@ namespace MWClass
|
|||
virtual void adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const;
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -25,32 +25,33 @@ namespace MWClass
|
|||
{
|
||||
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Potion::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Potion::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Potion::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -47,6 +47,8 @@ namespace MWClass
|
|||
|
||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of inventory icon.
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -25,35 +25,35 @@ namespace MWClass
|
|||
{
|
||||
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Probe::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Probe::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
std::string Probe::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,32 +23,33 @@ namespace MWClass
|
|||
{
|
||||
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Repair::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Repair::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Repair::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace MWClass
|
|||
|
||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of inventory icon.
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -13,31 +13,33 @@ namespace MWClass
|
|||
{
|
||||
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Static> *ref =
|
||||
ptr.get<ESM::Static>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), true);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Static::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Static> *ref =
|
||||
ptr.get<ESM::Static>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Static::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -19,6 +19,8 @@ namespace MWClass
|
|||
/// can return an empty string.
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -25,32 +25,33 @@ namespace MWClass
|
|||
{
|
||||
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Weapon::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Weapon::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Weapon::getName (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -66,6 +66,7 @@ namespace MWClass
|
|||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace MWWorld
|
|||
{
|
||||
}
|
||||
|
||||
std::string Class::getModel() const
|
||||
std::string Class::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ namespace MWWorld
|
|||
|
||||
virtual void adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const;
|
||||
|
||||
virtual std::string getModel() const;
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -367,12 +367,11 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
float PhysicsSystem::getObjectHeight(const MWWorld::Ptr &ptr) {
|
||||
std::string model = MWWorld::Class::get(ptr).getModel();
|
||||
std::string model = MWWorld::Class::get(ptr).getModel(ptr);
|
||||
if (model.empty()) {
|
||||
return 0.0;
|
||||
}
|
||||
float scale = ptr.getRefData().getBaseNode()->getScale().x;
|
||||
return mEngine->getObjectHeight(model, scale);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue