forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
commit
7cc1ebc05b
97 changed files with 643 additions and 546 deletions
|
@ -104,6 +104,7 @@ namespace MWBase
|
|||
virtual void clear() = 0;
|
||||
|
||||
virtual int countSavedGameRecords() const = 0;
|
||||
virtual int countSavedGameCells() const = 0;
|
||||
|
||||
virtual void write (ESM::ESMWriter& writer, Loading::Listener& listener) const = 0;
|
||||
|
||||
|
|
|
@ -31,20 +31,18 @@ namespace MWClass
|
|||
return ptr.get<ESM::Activator>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Activator::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Activator::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Actors& actors = renderingInterface.getActors();
|
||||
actors.insertActivator(ptr);
|
||||
actors.insertActivator(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Activator::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Activator::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
physics.addObject(ptr, model);
|
||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -26,19 +26,17 @@ namespace MWClass
|
|||
return ptr.get<ESM::Apparatus>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Apparatus::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Apparatus::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Apparatus::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -18,10 +18,10 @@ namespace MWClass
|
|||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -31,19 +31,17 @@ namespace MWClass
|
|||
return ptr.get<ESM::Armor>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Armor::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Armor::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Armor::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -17,10 +17,10 @@ namespace MWClass
|
|||
|
||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -28,19 +28,17 @@ namespace MWClass
|
|||
return ptr.get<ESM::Book>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Book::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Book::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Book::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -28,19 +28,17 @@ namespace MWClass
|
|||
return ptr.get<ESM::Clothing>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Clothing::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Clothing::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Clothing::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -85,20 +85,18 @@ namespace MWClass
|
|||
store.restock(list, ptr, ptr.getCellRef().getOwner(), ptr.getCellRef().getFaction(), ptr.getCellRef().getFactionRank());
|
||||
}
|
||||
|
||||
void Container::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Container::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Actors& actors = renderingInterface.getActors();
|
||||
actors.insertActivator(ptr);
|
||||
actors.insertActivator(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Container::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Container::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
physics.addObject(ptr, model);
|
||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -160,20 +160,19 @@ namespace MWClass
|
|||
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
|
||||
}
|
||||
|
||||
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||
|
||||
MWRender::Actors& actors = renderingInterface.getActors();
|
||||
actors.insertCreature(ptr, ref->mBase->mFlags & ESM::Creature::Weapon);
|
||||
actors.insertCreature(ptr, model, ref->mBase->mFlags & ESM::Creature::Weapon);
|
||||
}
|
||||
|
||||
void Creature::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Creature::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
{
|
||||
physics.addActor(ptr);
|
||||
physics.addActor(ptr, model);
|
||||
if (getCreatureStats(ptr).isDead())
|
||||
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
||||
}
|
||||
|
|
|
@ -44,10 +44,10 @@ namespace MWClass
|
|||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return ID of \a ptr
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const;
|
||||
|
||||
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
||||
///< Adjust position to stand on ground. Must be called post model load
|
||||
|
|
|
@ -49,20 +49,18 @@ namespace MWClass
|
|||
return ptr.get<ESM::Door>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Door::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Door::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Actors& actors = renderingInterface.getActors();
|
||||
actors.insertActivator(ptr);
|
||||
actors.insertActivator(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Door::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Door::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
physics.addObject(ptr, model);
|
||||
|
||||
// Resume the door's opening/closing animation if it wasn't finished
|
||||
if (ptr.getRefData().getCustomData())
|
||||
|
|
|
@ -19,10 +19,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -32,19 +32,17 @@ namespace MWClass
|
|||
return ref->mBase->mId;
|
||||
}
|
||||
|
||||
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Ingredient::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Ingredient::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Ingredient::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return ID of \a ptr
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -54,26 +54,24 @@ namespace MWClass
|
|||
return ptr.get<ESM::Light>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Light::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Light::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
// Insert even if model is empty, so that the light is added
|
||||
MWRender::Actors& actors = renderingInterface.getActors();
|
||||
actors.insertActivator(ptr, !(ref->mBase->mData.mFlags & ESM::Light::OffDefault));
|
||||
actors.insertActivator(ptr, model, !(ref->mBase->mData.mFlags & ESM::Light::OffDefault));
|
||||
}
|
||||
|
||||
void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Light::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
assert (ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,ref->mBase->mData.mFlags & ESM::Light::Carry);
|
||||
physics.addObject(ptr, model, ref->mBase->mData.mFlags & ESM::Light::Carry);
|
||||
|
||||
if (!ref->mBase->mSound.empty() && !(ref->mBase->mData.mFlags & ESM::Light::OffDefault))
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
|
||||
|
|
|
@ -17,10 +17,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -27,19 +27,17 @@ namespace MWClass
|
|||
return ptr.get<ESM::Lockpick>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Lockpick::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -43,19 +43,17 @@ namespace MWClass
|
|||
return ptr.get<ESM::Miscellaneous>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Miscellaneous::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -428,14 +428,14 @@ namespace MWClass
|
|||
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
|
||||
}
|
||||
|
||||
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
renderingInterface.getActors().insertNPC(ptr);
|
||||
}
|
||||
|
||||
void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Npc::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
physics.addActor(ptr);
|
||||
physics.addActor(ptr, model);
|
||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||
if (getCreatureStats(ptr).isDead())
|
||||
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
||||
|
|
|
@ -50,10 +50,10 @@ namespace MWClass
|
|||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return ID of \a ptr
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const;
|
||||
|
||||
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
||||
///< Adjust position to stand on ground. Must be called post model load
|
||||
|
|
|
@ -30,19 +30,17 @@ namespace MWClass
|
|||
return ptr.get<ESM::Potion>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Potion::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Potion::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Potion::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -27,19 +27,17 @@ namespace MWClass
|
|||
return ptr.get<ESM::Probe>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Probe::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Probe::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Probe::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -26,19 +26,17 @@ namespace MWClass
|
|||
return ptr.get<ESM::Repair>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Repair::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Repair::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Repair::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -17,22 +17,20 @@ namespace MWClass
|
|||
return ptr.get<ESM::Static>()->mBase->mId;
|
||||
}
|
||||
|
||||
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Static> *ref =
|
||||
ptr.get<ESM::Static>();
|
||||
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model, !ref->mBase->mPersistent);
|
||||
}
|
||||
}
|
||||
|
||||
void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Static::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
physics.addObject(ptr, model);
|
||||
}
|
||||
|
||||
std::string Static::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||
/// Return ID of \a ptr
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -30,19 +30,17 @@ namespace MWClass
|
|||
return ref->mBase->mId;
|
||||
}
|
||||
|
||||
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
renderingInterface.getObjects().insertModel(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Weapon::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Weapon::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr,true);
|
||||
physics.addObject(ptr, model, true);
|
||||
}
|
||||
|
||||
std::string Weapon::getModel(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return ID of \a ptr
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) 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);
|
||||
|
|
|
@ -645,7 +645,6 @@ namespace MWDialogue
|
|||
writer.startRecord (ESM::REC_DIAS);
|
||||
state.save (writer);
|
||||
writer.endRecord (ESM::REC_DIAS);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
|
||||
void DialogueManager::readRecord (ESM::ESMReader& reader, int32_t type)
|
||||
|
|
|
@ -187,7 +187,6 @@ namespace MWDialogue
|
|||
writer.startRecord (ESM::REC_QUES);
|
||||
state.save (writer);
|
||||
writer.endRecord (ESM::REC_QUES);
|
||||
progress.increaseProgress();
|
||||
|
||||
for (Topic::TEntryIter iter (quest.begin()); iter!=quest.end(); ++iter)
|
||||
{
|
||||
|
@ -198,7 +197,6 @@ namespace MWDialogue
|
|||
writer.startRecord (ESM::REC_JOUR);
|
||||
entry.save (writer);
|
||||
writer.endRecord (ESM::REC_JOUR);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,7 +208,6 @@ namespace MWDialogue
|
|||
writer.startRecord (ESM::REC_JOUR);
|
||||
entry.save (writer);
|
||||
writer.endRecord (ESM::REC_JOUR);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
|
||||
for (TTopicIter iter (mTopics.begin()); iter!=mTopics.end(); ++iter)
|
||||
|
@ -226,7 +223,6 @@ namespace MWDialogue
|
|||
writer.startRecord (ESM::REC_JOUR);
|
||||
entry.save (writer);
|
||||
writer.endRecord (ESM::REC_JOUR);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
|
||||
Style* createHotStyle (Style* baseStyle, Colour normalColour, Colour hoverColour, Colour activeColour, InteractiveId id, bool unique)
|
||||
{
|
||||
StyleImpl* BaseStyle = dynamic_cast <StyleImpl*> (baseStyle);
|
||||
StyleImpl* BaseStyle = static_cast <StyleImpl*> (baseStyle);
|
||||
|
||||
if (!unique)
|
||||
for (Styles::iterator i = mBook->mStyles.begin (); i != mBook->mStyles.end (); ++i)
|
||||
|
@ -268,7 +268,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
{
|
||||
Range range = mBook->addContent (text);
|
||||
|
||||
writeImpl (dynamic_cast <StyleImpl*> (style), range.first, range.second);
|
||||
writeImpl (static_cast <StyleImpl*> (style), range.first, range.second);
|
||||
}
|
||||
|
||||
intptr_t addContent (Utf8Span text, bool select)
|
||||
|
@ -295,7 +295,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
Utf8Point begin_ = &mCurrentContent->front () + begin;
|
||||
Utf8Point end_ = &mCurrentContent->front () + end ;
|
||||
|
||||
writeImpl (dynamic_cast <StyleImpl*> (style), begin_, end_);
|
||||
writeImpl (static_cast <StyleImpl*> (style), begin_, end_);
|
||||
}
|
||||
|
||||
void lineBreak (float margin)
|
||||
|
|
|
@ -903,7 +903,6 @@ namespace MWGui
|
|||
writer.startRecord(ESM::REC_GMAP);
|
||||
map.save(writer);
|
||||
writer.endRecord(ESM::REC_GMAP);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
|
||||
void MapWindow::readRecord(ESM::ESMReader &reader, int32_t type)
|
||||
|
|
|
@ -36,6 +36,18 @@ namespace
|
|||
return gmst.find(ESM::MagicEffect::effectIdToString (id1))->getString()
|
||||
< gmst.find(ESM::MagicEffect::effectIdToString (id2))->getString();
|
||||
}
|
||||
|
||||
void init(ESM::ENAMstruct& effect)
|
||||
{
|
||||
effect.mArea = 0;
|
||||
effect.mDuration = 0;
|
||||
effect.mEffectID = -1;
|
||||
effect.mMagnMax = 0;
|
||||
effect.mMagnMin = 0;
|
||||
effect.mRange = 0;
|
||||
effect.mSkill = -1;
|
||||
effect.mAttribute = -1;
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
|
@ -47,6 +59,9 @@ namespace MWGui
|
|||
, mMagicEffect(NULL)
|
||||
, mConstantEffect(false)
|
||||
{
|
||||
init(mEffect);
|
||||
init(mOldEffect);
|
||||
|
||||
getWidget(mCancelButton, "CancelButton");
|
||||
getWidget(mOkButton, "OkButton");
|
||||
getWidget(mDeleteButton, "DeleteButton");
|
||||
|
|
|
@ -1604,14 +1604,12 @@ namespace MWGui
|
|||
mMap->write(writer, progress);
|
||||
|
||||
mQuickKeysMenu->write(writer);
|
||||
progress.increaseProgress();
|
||||
|
||||
if (!mSelectedSpell.empty())
|
||||
{
|
||||
writer.startRecord(ESM::REC_ASPL);
|
||||
writer.writeHNString("ID__", mSelectedSpell);
|
||||
writer.endRecord(ESM::REC_ASPL);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
|
||||
for (std::vector<CustomMarker>::const_iterator it = mCustomMarkers.begin(); it != mCustomMarkers.end(); ++it)
|
||||
|
@ -1619,7 +1617,6 @@ namespace MWGui
|
|||
writer.startRecord(ESM::REC_MARK);
|
||||
(*it).save(writer);
|
||||
writer.endRecord(ESM::REC_MARK);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -302,22 +302,8 @@ namespace MWInput
|
|||
}
|
||||
}
|
||||
|
||||
void InputManager::update(float dt, bool disableControls, bool disableEvents)
|
||||
void InputManager::updateCursorMode()
|
||||
{
|
||||
mControlsDisabled = disableControls;
|
||||
|
||||
mInputManager->setMouseVisible(MWBase::Environment::get().getWindowManager()->getCursorVisible());
|
||||
|
||||
mInputManager->capture(disableEvents);
|
||||
// inject some fake mouse movement to force updating MyGUI's widget states
|
||||
MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX), int(mMouseY), mMouseWheel);
|
||||
|
||||
if (mControlsDisabled)
|
||||
return;
|
||||
|
||||
// update values of channels (as a result of pressed keys)
|
||||
mInputBinder->update(dt);
|
||||
|
||||
bool grab = !MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu)
|
||||
&& MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console;
|
||||
|
||||
|
@ -337,6 +323,28 @@ namespace MWInput
|
|||
{
|
||||
mInputManager->warpMouse(mMouseX, mMouseY);
|
||||
}
|
||||
}
|
||||
|
||||
void InputManager::update(float dt, bool disableControls, bool disableEvents)
|
||||
{
|
||||
mControlsDisabled = disableControls;
|
||||
|
||||
mInputManager->setMouseVisible(MWBase::Environment::get().getWindowManager()->getCursorVisible());
|
||||
|
||||
mInputManager->capture(disableEvents);
|
||||
// inject some fake mouse movement to force updating MyGUI's widget states
|
||||
MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX), int(mMouseY), mMouseWheel);
|
||||
|
||||
if (mControlsDisabled)
|
||||
{
|
||||
updateCursorMode();
|
||||
return;
|
||||
}
|
||||
|
||||
// update values of channels (as a result of pressed keys)
|
||||
mInputBinder->update(dt);
|
||||
|
||||
updateCursorMode();
|
||||
|
||||
// Disable movement in Gui mode
|
||||
if (!(MWBase::Environment::get().getWindowManager()->isGuiMode()
|
||||
|
|
|
@ -176,6 +176,8 @@ namespace MWInput
|
|||
|
||||
void setPlayerControlsEnabled(bool enabled);
|
||||
|
||||
void updateCursorMode();
|
||||
|
||||
private:
|
||||
void toggleMainMenu();
|
||||
void toggleSpell();
|
||||
|
|
|
@ -131,7 +131,7 @@ void adjustCommandedActor (const MWWorld::Ptr& actor)
|
|||
for (it = stats.getAiSequence().begin(); it != stats.getAiSequence().end(); ++it)
|
||||
{
|
||||
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow &&
|
||||
dynamic_cast<MWMechanics::AiFollow*>(*it)->isCommanded())
|
||||
static_cast<MWMechanics::AiFollow*>(*it)->isCommanded())
|
||||
{
|
||||
hasCommandPackage = true;
|
||||
break;
|
||||
|
@ -355,7 +355,7 @@ namespace MWMechanics
|
|||
{
|
||||
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
|
||||
{
|
||||
MWWorld::Ptr followTarget = dynamic_cast<MWMechanics::AiFollow*>(*it)->getTarget();
|
||||
MWWorld::Ptr followTarget = static_cast<MWMechanics::AiFollow*>(*it)->getTarget();
|
||||
if (followTarget.isEmpty())
|
||||
continue;
|
||||
|
||||
|
@ -1389,7 +1389,7 @@ namespace MWMechanics
|
|||
{
|
||||
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
|
||||
{
|
||||
MWWorld::Ptr followTarget = dynamic_cast<MWMechanics::AiFollow*>(*it)->getTarget();
|
||||
MWWorld::Ptr followTarget = static_cast<MWMechanics::AiFollow*>(*it)->getTarget();
|
||||
if (followTarget.isEmpty())
|
||||
continue;
|
||||
if (followTarget == actor)
|
||||
|
@ -1419,11 +1419,11 @@ namespace MWMechanics
|
|||
{
|
||||
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
|
||||
{
|
||||
MWWorld::Ptr followTarget = dynamic_cast<MWMechanics::AiFollow*>(*it)->getTarget();
|
||||
MWWorld::Ptr followTarget = static_cast<MWMechanics::AiFollow*>(*it)->getTarget();
|
||||
if (followTarget.isEmpty())
|
||||
continue;
|
||||
if (followTarget == actor)
|
||||
list.push_back(dynamic_cast<MWMechanics::AiFollow*>(*it)->getFollowIndex());
|
||||
list.push_back(static_cast<MWMechanics::AiFollow*>(*it)->getFollowIndex());
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
@ -1460,8 +1460,6 @@ namespace MWMechanics
|
|||
writer.writeHNT ("COUN", it->second);
|
||||
}
|
||||
writer.endRecord(ESM::REC_DCOU);
|
||||
|
||||
listener.increaseProgress(1);
|
||||
}
|
||||
|
||||
void Actors::readRecord (ESM::ESMReader& reader, int32_t type)
|
||||
|
|
|
@ -342,49 +342,49 @@ void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence)
|
|||
case ESM::AiSequence::Ai_Wander:
|
||||
{
|
||||
MWMechanics::AiWander* wander = new AiWander(
|
||||
dynamic_cast<ESM::AiSequence::AiWander*>(it->mPackage));
|
||||
static_cast<ESM::AiSequence::AiWander*>(it->mPackage));
|
||||
mPackages.push_back(wander);
|
||||
break;
|
||||
}
|
||||
case ESM::AiSequence::Ai_Travel:
|
||||
{
|
||||
MWMechanics::AiTravel* travel = new AiTravel(
|
||||
dynamic_cast<ESM::AiSequence::AiTravel*>(it->mPackage));
|
||||
static_cast<ESM::AiSequence::AiTravel*>(it->mPackage));
|
||||
mPackages.push_back(travel);
|
||||
break;
|
||||
}
|
||||
case ESM::AiSequence::Ai_Escort:
|
||||
{
|
||||
MWMechanics::AiEscort* escort = new AiEscort(
|
||||
dynamic_cast<ESM::AiSequence::AiEscort*>(it->mPackage));
|
||||
static_cast<ESM::AiSequence::AiEscort*>(it->mPackage));
|
||||
mPackages.push_back(escort);
|
||||
break;
|
||||
}
|
||||
case ESM::AiSequence::Ai_Follow:
|
||||
{
|
||||
MWMechanics::AiFollow* follow = new AiFollow(
|
||||
dynamic_cast<ESM::AiSequence::AiFollow*>(it->mPackage));
|
||||
static_cast<ESM::AiSequence::AiFollow*>(it->mPackage));
|
||||
mPackages.push_back(follow);
|
||||
break;
|
||||
}
|
||||
case ESM::AiSequence::Ai_Activate:
|
||||
{
|
||||
MWMechanics::AiActivate* activate = new AiActivate(
|
||||
dynamic_cast<ESM::AiSequence::AiActivate*>(it->mPackage));
|
||||
static_cast<ESM::AiSequence::AiActivate*>(it->mPackage));
|
||||
mPackages.push_back(activate);
|
||||
break;
|
||||
}
|
||||
case ESM::AiSequence::Ai_Combat:
|
||||
{
|
||||
MWMechanics::AiCombat* combat = new AiCombat(
|
||||
dynamic_cast<ESM::AiSequence::AiCombat*>(it->mPackage));
|
||||
static_cast<ESM::AiSequence::AiCombat*>(it->mPackage));
|
||||
mPackages.push_back(combat);
|
||||
break;
|
||||
}
|
||||
case ESM::AiSequence::Ai_Pursue:
|
||||
{
|
||||
MWMechanics::AiPursue* pursue = new AiPursue(
|
||||
dynamic_cast<ESM::AiSequence::AiPursue*>(it->mPackage));
|
||||
static_cast<ESM::AiSequence::AiPursue*>(it->mPackage));
|
||||
mPackages.push_back(pursue);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
@ -301,28 +302,32 @@ namespace MWMechanics
|
|||
playIdle(actor, playedIdle);
|
||||
chooseAction = false;
|
||||
idleNow = true;
|
||||
|
||||
// Play idle voiced dialogue entries randomly
|
||||
int hello = cStats.getAiSetting(CreatureStats::AI_Hello).getModified();
|
||||
if (hello > 0)
|
||||
{
|
||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
// Don't bother if the player is out of hearing range
|
||||
static float fVoiceIdleOdds = MWBase::Environment::get().getWorld()->getStore()
|
||||
.get<ESM::GameSetting>().find("fVoiceIdleOdds")->getFloat();
|
||||
|
||||
// Only say Idle voices when player is in LOS
|
||||
// A bit counterintuitive, likely vanilla did this to reduce the appearance of
|
||||
// voices going through walls?
|
||||
if (roll < fVoiceIdleOdds && Ogre::Vector3(player.getRefData().getPosition().pos).squaredDistance(Ogre::Vector3(pos.pos)) < 1500*1500
|
||||
&& MWBase::Environment::get().getWorld()->getLOS(player, actor))
|
||||
MWBase::Environment::get().getDialogueManager()->say(actor, "idle");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Play idle voiced dialogue entries randomly
|
||||
int hello = cStats.getAiSetting(CreatureStats::AI_Hello).getModified();
|
||||
if (hello > 0 && !MWBase::Environment::get().getWorld()->isSwimming(actor)
|
||||
&& actor.getRefData().getPosition().pos[2] < 3000 &&
|
||||
MWBase::Environment::get().getSoundManager()->sayDone(actor))
|
||||
{
|
||||
float roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 10000; // [0, 9999]
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
// Don't bother if the player is out of hearing range
|
||||
static float fVoiceIdleOdds = MWBase::Environment::get().getWorld()->getStore()
|
||||
.get<ESM::GameSetting>().find("fVoiceIdleOdds")->getFloat();
|
||||
|
||||
float x = fVoiceIdleOdds * MWBase::Environment::get().getFrameDuration();
|
||||
|
||||
// Only say Idle voices when player is in LOS
|
||||
// A bit counterintuitive, likely vanilla did this to reduce the appearance of
|
||||
// voices going through walls?
|
||||
if (roll < x && Ogre::Vector3(player.getRefData().getPosition().pos).squaredDistance(Ogre::Vector3(pos.pos)) < 1500*1500
|
||||
&& MWBase::Environment::get().getWorld()->getLOS(player, actor))
|
||||
MWBase::Environment::get().getDialogueManager()->say(actor, "idle");
|
||||
}
|
||||
|
||||
float& lastReaction = storage.mReaction;
|
||||
lastReaction += duration;
|
||||
if(lastReaction < REACTION_INTERVAL)
|
||||
|
@ -477,10 +482,8 @@ namespace MWMechanics
|
|||
|
||||
if (greetingState == MWMechanics::AiWander::Greet_Done)
|
||||
{
|
||||
static float fGreetDistanceReset = MWBase::Environment::get().getWorld()->getStore()
|
||||
.get<ESM::GameSetting>().find("fGreetDistanceReset")->getFloat();
|
||||
|
||||
if (playerDistSqr >= fGreetDistanceReset*fGreetDistanceReset)
|
||||
float resetDist = 2*helloDistance;
|
||||
if (playerDistSqr >= resetDist*resetDist)
|
||||
greetingState = Greet_None;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1496,12 +1496,12 @@ void CharacterController::update(float duration)
|
|||
forcestateupdate = (mJumpState != JumpState_InAir);
|
||||
mJumpState = JumpState_InAir;
|
||||
|
||||
// This is a guess. All that seems to be known is that "While the player is in the
|
||||
// air, fJumpMoveBase and fJumpMoveMult governs air control". What does fJumpMoveMult do?
|
||||
static const float fJumpMoveBase = gmst.find("fJumpMoveBase")->getFloat();
|
||||
|
||||
vec.x *= fJumpMoveBase;
|
||||
vec.y *= fJumpMoveBase;
|
||||
static const float fJumpMoveMult = gmst.find("fJumpMoveMult")->getFloat();
|
||||
float factor = fJumpMoveBase + fJumpMoveMult * mPtr.getClass().getSkill(mPtr, ESM::Skill::Acrobatics)/100.f;
|
||||
factor = std::min(1.f, factor);
|
||||
vec.x *= factor;
|
||||
vec.y *= factor;
|
||||
vec.z = 0.0f;
|
||||
}
|
||||
else if(vec.z > 0.0f && mJumpState == JumpState_None)
|
||||
|
|
|
@ -171,28 +171,30 @@ namespace MWMechanics
|
|||
for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
|
||||
{
|
||||
float baseCost = (store.get<ESM::MagicEffect>().find(it->mEffectID))->mData.mBaseCost;
|
||||
// To reflect vanilla behavior
|
||||
int magMin = (it->mMagnMin == 0) ? 1 : it->mMagnMin;
|
||||
int magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax;
|
||||
int area = (it->mArea == 0) ? 1 : it->mArea;
|
||||
|
||||
float magnitudeCost = 0;
|
||||
float magnitudeCost = (magMin + magMax) * baseCost * 0.05;
|
||||
if (mCastStyle == ESM::Enchantment::ConstantEffect)
|
||||
{
|
||||
magnitudeCost = (magMin + magMax) * baseCost * 2.5;
|
||||
magnitudeCost *= store.get<ESM::GameSetting>().find("fEnchantmentConstantDurationMult")->getFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
magnitudeCost = (magMin + magMax) * it->mDuration * baseCost * 0.025;
|
||||
if(it->mRange == ESM::RT_Target)
|
||||
magnitudeCost *= 1.5;
|
||||
magnitudeCost *= it->mDuration;
|
||||
}
|
||||
|
||||
float areaCost = area * 0.025 * baseCost;
|
||||
if (it->mRange == ESM::RT_Target)
|
||||
areaCost *= 1.5;
|
||||
float areaCost = area * 0.05 * baseCost;
|
||||
|
||||
enchantmentCost += (magnitudeCost + areaCost) * effectsLeftCnt;
|
||||
const float fEffectCostMult = store.get<ESM::GameSetting>().find("fEffectCostMult")->getFloat();
|
||||
|
||||
float cost = (magnitudeCost + areaCost) * fEffectCostMult;
|
||||
if (it->mRange == ESM::RT_Target)
|
||||
cost *= 1.5;
|
||||
|
||||
enchantmentCost += cost * effectsLeftCnt;
|
||||
enchantmentCost = std::max(1.f, enchantmentCost);
|
||||
--effectsLeftCnt;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
|
||||
#include <components/esm/loadacti.hpp>
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
#include "renderconst.hpp"
|
||||
|
||||
namespace MWRender
|
||||
|
@ -18,11 +14,9 @@ ActivatorAnimation::~ActivatorAnimation()
|
|||
{
|
||||
}
|
||||
|
||||
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr)
|
||||
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr, const std::string& model)
|
||||
: Animation(ptr, ptr.getRefData().getBaseNode())
|
||||
{
|
||||
const std::string& model = mPtr.getClass().getModel(mPtr);
|
||||
|
||||
if(!model.empty())
|
||||
{
|
||||
setObjectRoot(model, false);
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace MWRender
|
|||
class ActivatorAnimation : public Animation
|
||||
{
|
||||
public:
|
||||
ActivatorAnimation(const MWWorld::Ptr& ptr);
|
||||
ActivatorAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
||||
virtual ~ActivatorAnimation();
|
||||
|
||||
void addLight(const ESM::Light *light);
|
||||
|
|
|
@ -71,22 +71,22 @@ void Actors::insertNPC(const MWWorld::Ptr& ptr)
|
|||
mAllActors[ptr] = anim;
|
||||
mRendering->addWaterRippleEmitter (ptr);
|
||||
}
|
||||
void Actors::insertCreature (const MWWorld::Ptr& ptr, bool weaponsShields)
|
||||
void Actors::insertCreature (const MWWorld::Ptr& ptr, const std::string &model, bool weaponsShields)
|
||||
{
|
||||
insertBegin(ptr);
|
||||
Animation* anim = NULL;
|
||||
if (weaponsShields)
|
||||
anim = new CreatureWeaponAnimation(ptr);
|
||||
anim = new CreatureWeaponAnimation(ptr, model);
|
||||
else
|
||||
anim = new CreatureAnimation(ptr);
|
||||
anim = new CreatureAnimation(ptr, model);
|
||||
delete mAllActors[ptr];
|
||||
mAllActors[ptr] = anim;
|
||||
mRendering->addWaterRippleEmitter (ptr);
|
||||
}
|
||||
void Actors::insertActivator (const MWWorld::Ptr& ptr, bool addLight)
|
||||
void Actors::insertActivator (const MWWorld::Ptr& ptr, const std::string &model, bool addLight)
|
||||
{
|
||||
insertBegin(ptr);
|
||||
ActivatorAnimation* anim = new ActivatorAnimation(ptr);
|
||||
ActivatorAnimation* anim = new ActivatorAnimation(ptr, model);
|
||||
|
||||
if(ptr.getTypeName() == typeid(ESM::Light).name())
|
||||
{
|
||||
|
|
|
@ -40,8 +40,8 @@ namespace MWRender
|
|||
void setRootNode(Ogre::SceneNode* root);
|
||||
|
||||
void insertNPC(const MWWorld::Ptr& ptr);
|
||||
void insertCreature (const MWWorld::Ptr& ptr, bool weaponsShields);
|
||||
void insertActivator (const MWWorld::Ptr& ptr, bool addLight=false);
|
||||
void insertCreature (const MWWorld::Ptr& ptr, const std::string& model, bool weaponsShields);
|
||||
void insertActivator (const MWWorld::Ptr& ptr, const std::string& model, bool addLight=false);
|
||||
bool deleteObject (const MWWorld::Ptr& ptr);
|
||||
///< \return found?
|
||||
|
||||
|
|
|
@ -86,6 +86,12 @@ Animation::~Animation()
|
|||
mAnimSources.clear();
|
||||
}
|
||||
|
||||
std::string Animation::getObjectRootName() const
|
||||
{
|
||||
if (mSkelBase)
|
||||
return mSkelBase->getMesh()->getName();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
void Animation::setObjectRoot(const std::string &model, bool baseonly)
|
||||
{
|
||||
|
@ -97,22 +103,8 @@ void Animation::setObjectRoot(const std::string &model, bool baseonly)
|
|||
if(model.empty())
|
||||
return;
|
||||
|
||||
std::string mdlname = Misc::StringUtils::lowerCase(model);
|
||||
std::string::size_type p = mdlname.rfind('\\');
|
||||
if(p == std::string::npos)
|
||||
p = mdlname.rfind('/');
|
||||
if(p != std::string::npos)
|
||||
mdlname.insert(mdlname.begin()+p+1, 'x');
|
||||
else
|
||||
mdlname.insert(mdlname.begin(), 'x');
|
||||
if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(mdlname))
|
||||
{
|
||||
mdlname = model;
|
||||
Misc::StringUtils::toLower(mdlname);
|
||||
}
|
||||
|
||||
mObjectRoot = (!baseonly ? NifOgre::Loader::createObjects(mInsert, mdlname) :
|
||||
NifOgre::Loader::createObjectBase(mInsert, mdlname));
|
||||
mObjectRoot = (!baseonly ? NifOgre::Loader::createObjects(mInsert, model) :
|
||||
NifOgre::Loader::createObjectBase(mInsert, model));
|
||||
|
||||
if(mObjectRoot->mSkelBase)
|
||||
{
|
||||
|
@ -255,14 +247,8 @@ void Animation::addAnimSource(const std::string &model)
|
|||
if(!mSkelBase)
|
||||
return;
|
||||
|
||||
std::string kfname = Misc::StringUtils::lowerCase(model);
|
||||
std::string::size_type p = kfname.rfind('\\');
|
||||
if(p == std::string::npos)
|
||||
p = kfname.rfind('/');
|
||||
if(p != std::string::npos)
|
||||
kfname.insert(kfname.begin()+p+1, 'x');
|
||||
else
|
||||
kfname.insert(kfname.begin(), 'x');
|
||||
std::string kfname = model;
|
||||
Misc::StringUtils::toLower(kfname);
|
||||
|
||||
if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0)
|
||||
kfname.replace(kfname.size()-4, 4, ".kf");
|
||||
|
@ -417,7 +403,7 @@ void Animation::addExtraLight(Ogre::SceneManager *sceneMgr, NifOgre::ObjectScene
|
|||
}
|
||||
|
||||
|
||||
Ogre::Node *Animation::getNode(const std::string &name)
|
||||
Ogre::Node* Animation::getNode(const std::string &name)
|
||||
{
|
||||
if(mSkelBase)
|
||||
{
|
||||
|
@ -428,6 +414,16 @@ Ogre::Node *Animation::getNode(const std::string &name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Ogre::Node* Animation::getNode(int handle)
|
||||
{
|
||||
if (mSkelBase)
|
||||
{
|
||||
Ogre::SkeletonInstance *skel = mSkelBase->getSkeleton();
|
||||
return skel->getBone(handle);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NifOgre::TextKeyMap::const_iterator Animation::findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname)
|
||||
{
|
||||
NifOgre::TextKeyMap::const_iterator iter(keys.begin());
|
||||
|
|
|
@ -206,6 +206,9 @@ public:
|
|||
Ogre::uint8 transqueue, Ogre::Real dist=0.0f,
|
||||
bool enchantedGlow=false, Ogre::Vector3* glowColor=NULL);
|
||||
|
||||
/// Returns the name of the .nif file that makes up this animation's base skeleton.
|
||||
/// If there is no skeleton, returns "".
|
||||
std::string getObjectRootName() const;
|
||||
|
||||
Animation(const MWWorld::Ptr &ptr, Ogre::SceneNode *node);
|
||||
virtual ~Animation();
|
||||
|
@ -334,6 +337,7 @@ public:
|
|||
Ogre::AxisAlignedBox getWorldBounds();
|
||||
|
||||
Ogre::Node *getNode(const std::string &name);
|
||||
Ogre::Node *getNode(int handle);
|
||||
|
||||
// Attaches the given object to a bone on this object's base skeleton. If the bone doesn't
|
||||
// exist, the object isn't attached and NULL is returned. The returned TagPoint is only
|
||||
|
|
|
@ -16,39 +16,37 @@ namespace MWRender
|
|||
{
|
||||
|
||||
|
||||
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr)
|
||||
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr, const std::string& model)
|
||||
: Animation(ptr, ptr.getRefData().getBaseNode())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
||||
|
||||
std::string model = ptr.getClass().getModel(ptr);
|
||||
if(!model.empty())
|
||||
{
|
||||
setObjectRoot(model, false);
|
||||
setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
|
||||
|
||||
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
||||
addAnimSource("meshes\\base_anim.nif");
|
||||
addAnimSource("meshes\\xbase_anim.nif");
|
||||
addAnimSource(model);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr)
|
||||
CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const std::string& model)
|
||||
: Animation(ptr, ptr.getRefData().getBaseNode())
|
||||
, mShowWeapons(false)
|
||||
, mShowCarriedLeft(false)
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
||||
|
||||
std::string model = ptr.getClass().getModel(ptr);
|
||||
if(!model.empty())
|
||||
{
|
||||
setObjectRoot(model, false);
|
||||
setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
|
||||
|
||||
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
||||
addAnimSource("meshes\\base_anim.nif");
|
||||
addAnimSource("meshes\\xbase_anim.nif");
|
||||
addAnimSource(model);
|
||||
|
||||
mPtr.getClass().getInventoryStore(mPtr).setListener(this, mPtr);
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace MWRender
|
|||
class CreatureAnimation : public Animation
|
||||
{
|
||||
public:
|
||||
CreatureAnimation(const MWWorld::Ptr& ptr);
|
||||
CreatureAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
||||
virtual ~CreatureAnimation() {}
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace MWRender
|
|||
class CreatureWeaponAnimation : public Animation, public WeaponAnimation, public MWWorld::InventoryStoreListener
|
||||
{
|
||||
public:
|
||||
CreatureWeaponAnimation(const MWWorld::Ptr& ptr);
|
||||
CreatureWeaponAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
||||
virtual ~CreatureWeaponAnimation() {}
|
||||
|
||||
virtual void equipmentChanged() { updateParts(); }
|
||||
|
|
|
@ -157,7 +157,6 @@ namespace MWRender
|
|||
data[texelY * mWidth * 3 + texelX * 3+2] = b;
|
||||
}
|
||||
}
|
||||
loadingListener->increaseProgress(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +245,7 @@ namespace MWRender
|
|||
|
||||
void GlobalMap::loadResource(Ogre::Resource *resource)
|
||||
{
|
||||
Ogre::Texture* tex = dynamic_cast<Ogre::Texture*>(resource);
|
||||
Ogre::Texture* tex = static_cast<Ogre::Texture*>(resource);
|
||||
Ogre::ConstImagePtrList list;
|
||||
list.push_back(&mOverlayImage);
|
||||
tex->_loadImages(list);
|
||||
|
|
|
@ -200,7 +200,7 @@ void LocalMap::requestMap(MWWorld::CellStore* cell,
|
|||
|
||||
// Get the cell's NorthMarker rotation. This is used to rotate the entire map.
|
||||
const Vector2& north = MWBase::Environment::get().getWorld()->getNorthVector(cell);
|
||||
Radian angle = Ogre::Math::ATan2 (north.x, north.y) + Ogre::Degree(2);
|
||||
Radian angle = Ogre::Math::ATan2 (north.x, north.y);
|
||||
mAngle = angle.valueRadians();
|
||||
|
||||
// Rotate the cell and merge the rotated corners to the bounding box
|
||||
|
@ -494,7 +494,7 @@ void LocalMap::loadResource(Ogre::Resource* resource)
|
|||
|
||||
std::vector<uint32>& buffer = mBuffers[resourceName];
|
||||
|
||||
Ogre::Texture* tex = dynamic_cast<Ogre::Texture*>(resource);
|
||||
Ogre::Texture* tex = static_cast<Ogre::Texture*>(resource);
|
||||
tex->createInternalResources();
|
||||
memcpy(tex->getBuffer()->lock(HardwareBuffer::HBL_DISCARD), &buffer[0], sFogOfWarResolution*sFogOfWarResolution*4);
|
||||
tex->getBuffer()->unlock();
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include <extern/shiny/Main/Factory.hpp>
|
||||
|
||||
#include <components/misc/resourcehelpers.hpp>
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
@ -282,6 +284,7 @@ void NpcAnimation::updateNpcBase()
|
|||
(!isWerewolf ? !isBeast ? "meshes\\base_anim.1st.nif"
|
||||
: "meshes\\base_animkna.1st.nif"
|
||||
: "meshes\\wolf\\skin.1st.nif");
|
||||
smodel = Misc::ResourceHelpers::correctActorModelPath(smodel);
|
||||
setObjectRoot(smodel, true);
|
||||
|
||||
if(mViewMode != VM_FirstPerson)
|
||||
|
@ -290,11 +293,11 @@ void NpcAnimation::updateNpcBase()
|
|||
if(!isWerewolf)
|
||||
{
|
||||
if(Misc::StringUtils::lowerCase(mNpc->mRace).find("argonian") != std::string::npos)
|
||||
addAnimSource("meshes\\argonian_swimkna.nif");
|
||||
addAnimSource("meshes\\xargonian_swimkna.nif");
|
||||
else if(!mNpc->isMale() && !isBeast)
|
||||
addAnimSource("meshes\\base_anim_female.nif");
|
||||
addAnimSource("meshes\\xbase_anim_female.nif");
|
||||
if(mNpc->mModel.length() > 0)
|
||||
addAnimSource("meshes\\"+mNpc->mModel);
|
||||
addAnimSource("meshes\\x"+mNpc->mModel);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -306,11 +309,11 @@ void NpcAnimation::updateNpcBase()
|
|||
/* A bit counter-intuitive, but unlike third-person anims, it seems
|
||||
* beast races get both base_anim.1st.nif and base_animkna.1st.nif.
|
||||
*/
|
||||
addAnimSource("meshes\\base_anim.1st.nif");
|
||||
addAnimSource("meshes\\xbase_anim.1st.nif");
|
||||
if(isBeast)
|
||||
addAnimSource("meshes\\base_animkna.1st.nif");
|
||||
addAnimSource("meshes\\xbase_animkna.1st.nif");
|
||||
if(!mNpc->isMale() && !isBeast)
|
||||
addAnimSource("meshes\\base_anim_female.1st.nif");
|
||||
addAnimSource("meshes\\xbase_anim_female.1st.nif");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -256,10 +256,10 @@ void RenderingManager::cellAdded (MWWorld::CellStore *store)
|
|||
mDebugging->cellAdded(store);
|
||||
}
|
||||
|
||||
void RenderingManager::addObject (const MWWorld::Ptr& ptr){
|
||||
void RenderingManager::addObject (const MWWorld::Ptr& ptr, const std::string& model){
|
||||
const MWWorld::Class& class_ =
|
||||
ptr.getClass();
|
||||
class_.insertObjectRendering(ptr, *this);
|
||||
class_.insertObjectRendering(ptr, model, *this);
|
||||
}
|
||||
|
||||
void RenderingManager::removeObject (const MWWorld::Ptr& ptr)
|
||||
|
|
|
@ -111,7 +111,7 @@ public:
|
|||
/// Write current fog of war for this cell to the CellStore
|
||||
void writeFog (MWWorld::CellStore* store);
|
||||
|
||||
void addObject (const MWWorld::Ptr& ptr);
|
||||
void addObject (const MWWorld::Ptr& ptr, const std::string& model);
|
||||
void removeObject (const MWWorld::Ptr& ptr);
|
||||
|
||||
void moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position);
|
||||
|
|
|
@ -142,7 +142,6 @@ namespace MWScript
|
|||
writer.startRecord (ESM::REC_GSCR);
|
||||
script.save (writer);
|
||||
writer.endRecord (ESM::REC_GSCR);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1042,6 +1042,7 @@ namespace MWScript
|
|||
std::vector<std::string> contentFiles = MWBase::Environment::get().getWorld()->getContentFiles();
|
||||
|
||||
msg << contentFiles.at (ptr.getCellRef().getRefNum().mContentFile) << std::endl;
|
||||
msg << "RefNum: " << ptr.getCellRef().getRefNum().mIndex << std::endl;
|
||||
}
|
||||
|
||||
msg << "RefID: " << ptr.getCellRef().getRefId() << std::endl;
|
||||
|
|
|
@ -221,7 +221,8 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
|||
writer.save (stream);
|
||||
|
||||
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||
listener.setProgressRange(recordCount);
|
||||
// Using only Cells for progress information, since they typically have the largest records by far
|
||||
listener.setProgressRange(MWBase::Environment::get().getWorld()->countSavedGameCells());
|
||||
listener.setLabel("#{sNotifyMessage4}");
|
||||
|
||||
Loading::ScopedLoad load(&listener);
|
||||
|
@ -229,7 +230,6 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
|||
writer.startRecord (ESM::REC_SAVE);
|
||||
slot->mProfile.save (writer);
|
||||
writer.endRecord (ESM::REC_SAVE);
|
||||
listener.increaseProgress();
|
||||
|
||||
MWBase::Environment::get().getJournal()->write (writer, listener);
|
||||
MWBase::Environment::get().getDialogueManager()->write (writer, listener);
|
||||
|
@ -337,11 +337,15 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
|
||||
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||
|
||||
listener.setProgressRange(reader.getRecordCount());
|
||||
listener.setProgressRange(100);
|
||||
listener.setLabel("#{sLoadingMessage14}");
|
||||
|
||||
Loading::ScopedLoad load(&listener);
|
||||
|
||||
bool firstPersonCam = false;
|
||||
|
||||
size_t total = reader.getFileSize();
|
||||
int currentPercent = 0;
|
||||
while (reader.hasMoreRecs())
|
||||
{
|
||||
ESM::NAME n = reader.getRecName();
|
||||
|
@ -394,9 +398,11 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
case ESM::REC_ENAB:
|
||||
case ESM::REC_LEVC:
|
||||
case ESM::REC_LEVI:
|
||||
case ESM::REC_CAM_:
|
||||
MWBase::Environment::get().getWorld()->readRecord(reader, n.val, contentFileMap);
|
||||
break;
|
||||
|
||||
MWBase::Environment::get().getWorld()->readRecord (reader, n.val, contentFileMap);
|
||||
case ESM::REC_CAM_:
|
||||
reader.getHNT(firstPersonCam, "FIRS");
|
||||
break;
|
||||
|
||||
case ESM::REC_GSCR:
|
||||
|
@ -423,7 +429,12 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
std::cerr << "Ignoring unknown record: " << n.name << std::endl;
|
||||
reader.skipRecord();
|
||||
}
|
||||
listener.increaseProgress();
|
||||
int progressPercent = static_cast<int>(float(reader.getFileOffset())/total*100);
|
||||
if (progressPercent > currentPercent)
|
||||
{
|
||||
listener.increaseProgress(progressPercent-currentPercent);
|
||||
currentPercent = progressPercent;
|
||||
}
|
||||
}
|
||||
|
||||
mCharacterManager.setCurrentCharacter(character);
|
||||
|
@ -439,6 +450,9 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
MWBase::Environment::get().getWindowManager()->updatePlayer();
|
||||
MWBase::Environment::get().getMechanicsManager()->playerLoaded();
|
||||
|
||||
if (firstPersonCam != MWBase::Environment::get().getWorld()->isFirstPerson())
|
||||
MWBase::Environment::get().getWorld()->togglePOV();
|
||||
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||
|
||||
ESM::CellId cellId = ptr.getCell()->getCell()->getCellId();
|
||||
|
@ -446,7 +460,7 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
// Use detectWorldSpaceChange=false, otherwise some of the data we just loaded would be cleared again
|
||||
MWBase::Environment::get().getWorld()->changeToCell (cellId, ptr.getRefData().getPosition(), false);
|
||||
|
||||
// Vanilla MW will restart startup scripts when a save game is loaded. This is unintuive,
|
||||
// Vanilla MW will restart startup scripts when a save game is loaded. This is unintuitive,
|
||||
// but some mods may be using it as a reload detector.
|
||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
|
||||
|
||||
|
@ -472,8 +486,11 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
void MWState::StateManager::quickLoad()
|
||||
{
|
||||
if (Character* mCurrentCharacter = getCurrentCharacter (false))
|
||||
if (const MWState::Slot* slot = &*mCurrentCharacter->begin()) //Get newest save
|
||||
loadGame (mCurrentCharacter, slot->mPath.string());
|
||||
{
|
||||
if (mCurrentCharacter->begin() == mCurrentCharacter->end())
|
||||
return;
|
||||
loadGame (mCurrentCharacter, mCurrentCharacter->begin()->mPath.string()); //Get newest save
|
||||
}
|
||||
}
|
||||
|
||||
void MWState::StateManager::deleteGame(const MWState::Character *character, const MWState::Slot *slot)
|
||||
|
@ -534,8 +551,8 @@ bool MWState::StateManager::verifyProfile(const ESM::SavedGame& profile) const
|
|||
if (std::find(selectedContentFiles.begin(), selectedContentFiles.end(), *it)
|
||||
== selectedContentFiles.end())
|
||||
{
|
||||
std::cerr << "Savegame dependency " << *it << " is missing." << std::endl;
|
||||
notFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (notFound)
|
||||
|
|
|
@ -37,7 +37,11 @@ namespace MWWorld
|
|||
getFollowers(actor, followers);
|
||||
for(std::set<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
|
||||
{
|
||||
teleport(*it);
|
||||
MWWorld::Ptr follower = *it;
|
||||
if (Ogre::Vector3(follower.getRefData().getPosition().pos).squaredDistance(
|
||||
Ogre::Vector3( actor.getRefData().getPosition().pos))
|
||||
<= 800*800)
|
||||
teleport(*it);
|
||||
}
|
||||
|
||||
teleport(actor);
|
||||
|
|
|
@ -287,7 +287,7 @@ void MWWorld::Cells::write (ESM::ESMWriter& writer, Loading::Listener& progress)
|
|||
if (iter->second.hasState())
|
||||
{
|
||||
writeCell (writer, iter->second);
|
||||
progress.increaseProgress(); // Assumes that each cell writes one record
|
||||
progress.increaseProgress();
|
||||
}
|
||||
|
||||
for (std::map<std::string, CellStore>::iterator iter (mInteriors.begin());
|
||||
|
@ -295,7 +295,7 @@ void MWWorld::Cells::write (ESM::ESMWriter& writer, Loading::Listener& progress)
|
|||
if (iter->second.hasState())
|
||||
{
|
||||
writeCell (writer, iter->second);
|
||||
progress.increaseProgress(); // Assumes that each cell writes one record
|
||||
progress.increaseProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,12 @@ namespace MWWorld
|
|||
throw std::runtime_error ("class does not support ID retrieval");
|
||||
}
|
||||
|
||||
void Class::insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Class::insertObjectRendering (const Ptr& ptr, const std::string& mesh, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Class::insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
void Class::insertObject(const Ptr& ptr, const std::string& mesh, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -81,8 +81,8 @@ namespace MWWorld
|
|||
///< Return ID of \a ptr or throw an exception, if class does not support ID retrieval
|
||||
/// (default implementation: throw an exception)
|
||||
|
||||
virtual void insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
virtual void insertObjectRendering (const Ptr& ptr, const std::string& mesh, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObject(const Ptr& ptr, const std::string& mesh, MWWorld::PhysicsSystem& physics) const;
|
||||
///< Add reference into a cell for rendering (default implementation: don't render anything).
|
||||
|
||||
virtual std::string getName (const Ptr& ptr) const = 0;
|
||||
|
|
|
@ -161,7 +161,6 @@ void ESMStore::setUp()
|
|||
writer.writeT(mDynamicCount);
|
||||
writer.endRecord("COUN");
|
||||
writer.endRecord(ESM::REC_DYNA);
|
||||
progress.increaseProgress();
|
||||
|
||||
mPotions.write (writer, progress);
|
||||
mArmors.write (writer, progress);
|
||||
|
|
|
@ -85,7 +85,6 @@ namespace MWWorld
|
|||
writer.writeHNString ("NAME", iter->first);
|
||||
iter->second.write (writer, ESM::Variant::Format_Global);
|
||||
writer.endRecord (ESM::REC_GLOB);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include <openengine/bullet/BulletShapeLoader.h>
|
||||
|
||||
#include <components/nifbullet/bulletnifloader.hpp>
|
||||
#include <components/nifogre/skeleton.hpp>
|
||||
#include <components/misc/resourcehelpers.hpp>
|
||||
|
||||
#include <components/esm/loadgmst.hpp>
|
||||
|
||||
|
@ -51,25 +53,22 @@ void animateCollisionShapes (std::map<OEngine::Physic::RigidBody*, OEngine::Phys
|
|||
throw std::runtime_error("can't find Ptr");
|
||||
|
||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr);
|
||||
if (!animation) // Shouldn't happen either, since keyframe-controlled objects are not batched in StaticGeometry
|
||||
throw std::runtime_error("can't find Animation for " + ptr.getCellRef().getRefId());
|
||||
if (!animation)
|
||||
continue;
|
||||
|
||||
OEngine::Physic::AnimatedShapeInstance& instance = it->second;
|
||||
|
||||
std::map<std::string, int>& shapes = instance.mAnimatedShapes;
|
||||
for (std::map<std::string, int>::iterator shapeIt = shapes.begin();
|
||||
std::map<int, int>& shapes = instance.mAnimatedShapes;
|
||||
for (std::map<int, int>::iterator shapeIt = shapes.begin();
|
||||
shapeIt != shapes.end(); ++shapeIt)
|
||||
{
|
||||
|
||||
Ogre::Node* bone;
|
||||
if (shapeIt->first.empty())
|
||||
// HACK: see NifSkeletonLoader::buildBones
|
||||
bone = animation->getNode(" ");
|
||||
else
|
||||
bone = animation->getNode(shapeIt->first);
|
||||
const std::string& mesh = animation->getObjectRootName();
|
||||
int boneHandle = NifOgre::NIFSkeletonLoader::lookupOgreBoneHandle(mesh, shapeIt->first);
|
||||
Ogre::Node* bone = animation->getNode(boneHandle);
|
||||
|
||||
if (bone == NULL)
|
||||
throw std::runtime_error("can't find bone");
|
||||
continue;
|
||||
|
||||
btCompoundShape* compound = dynamic_cast<btCompoundShape*>(instance.mCompound);
|
||||
|
||||
|
@ -290,7 +289,7 @@ namespace MWWorld
|
|||
|
||||
// Reset per-frame data
|
||||
physicActor->setWalkingOnWater(false);
|
||||
/* Anything to collide with? */
|
||||
// Anything to collide with?
|
||||
if(!physicActor->getCollisionMode())
|
||||
{
|
||||
return position + (Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z) *
|
||||
|
@ -318,12 +317,11 @@ namespace MWWorld
|
|||
*/
|
||||
|
||||
OEngine::Physic::ActorTracer tracer;
|
||||
Ogre::Vector3 inertia(0.0f);
|
||||
Ogre::Vector3 inertia = physicActor->getInertialForce();
|
||||
Ogre::Vector3 velocity;
|
||||
|
||||
if(position.z < waterlevel || isFlying) // under water by 3/4 or can fly
|
||||
if(position.z < waterlevel || isFlying)
|
||||
{
|
||||
// TODO: Shouldn't water have higher drag in calculating velocity?
|
||||
velocity = (Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z)*
|
||||
Ogre::Quaternion(Ogre::Radian(refpos.rot[0]), Ogre::Vector3::NEGATIVE_UNIT_X)) * movement;
|
||||
}
|
||||
|
@ -331,25 +329,12 @@ namespace MWWorld
|
|||
{
|
||||
velocity = Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z) * movement;
|
||||
|
||||
// not in water nor can fly, so need to deal with gravity
|
||||
if(!physicActor->getOnGround()) // if current OnGround status is false, must be falling or jumping
|
||||
if (velocity.z > 0.f)
|
||||
inertia = velocity;
|
||||
if(!physicActor->getOnGround())
|
||||
{
|
||||
// If falling or jumping up, add part of the incoming velocity with the current inertia,
|
||||
// but don't allow increasing inertia beyond actor's speed (except on the initial jump impulse)
|
||||
float actorSpeed = ptr.getClass().getSpeed(ptr);
|
||||
float cap = std::max(actorSpeed, Ogre::Vector2(physicActor->getInertialForce().x, physicActor->getInertialForce().y).length());
|
||||
Ogre::Vector3 newVelocity = velocity + physicActor->getInertialForce();
|
||||
if (Ogre::Vector2(newVelocity.x, newVelocity.y).squaredLength() > cap*cap)
|
||||
{
|
||||
velocity = newVelocity;
|
||||
float speedXY = Ogre::Vector2(velocity.x, velocity.y).length();
|
||||
velocity.x *= cap / speedXY;
|
||||
velocity.y *= cap / speedXY;
|
||||
}
|
||||
else
|
||||
velocity = newVelocity;
|
||||
velocity = velocity + physicActor->getInertialForce();
|
||||
}
|
||||
inertia = velocity; // NOTE: velocity is for z axis only in this code block
|
||||
}
|
||||
ptr.getClass().getMovementSettings(ptr).mPosition[2] = 0;
|
||||
|
||||
|
@ -372,7 +357,6 @@ namespace MWWorld
|
|||
float remainingTime = time;
|
||||
for(int iterations = 0; iterations < sMaxIterations && remainingTime > 0.01f; ++iterations)
|
||||
{
|
||||
// NOTE: velocity is either z axis only or x & z axis
|
||||
Ogre::Vector3 nextpos = newPosition + velocity * remainingTime;
|
||||
|
||||
// If not able to fly, don't allow to swim up into the air
|
||||
|
@ -483,7 +467,7 @@ namespace MWWorld
|
|||
// so that we do not stay suspended in air indefinitely.
|
||||
if (tracer.mFraction < 1.0f && tracer.mHitObject->getBroadphaseHandle()->m_collisionFilterGroup == OEngine::Physic::CollisionType_Actor)
|
||||
{
|
||||
if (Ogre::Vector3(inertia.x, inertia.y, 0).squaredLength() < 100.f*100.f)
|
||||
if (Ogre::Vector3(velocity.x, velocity.y, 0).squaredLength() < 100.f*100.f)
|
||||
{
|
||||
btVector3 aabbMin, aabbMax;
|
||||
tracer.mHitObject->getCollisionShape()->getAabb(tracer.mHitObject->getWorldTransform(), aabbMin, aabbMax);
|
||||
|
@ -509,7 +493,7 @@ namespace MWWorld
|
|||
}
|
||||
physicActor->setOnGround(isOnGround);
|
||||
|
||||
newPosition.z -= halfExtents.z; // remove what was added at the beggining
|
||||
newPosition.z -= halfExtents.z; // remove what was added at the beginning
|
||||
return newPosition;
|
||||
}
|
||||
};
|
||||
|
@ -689,9 +673,8 @@ namespace MWWorld
|
|||
mEngine->removeHeightField(x, y);
|
||||
}
|
||||
|
||||
void PhysicsSystem::addObject (const Ptr& ptr, bool placeable)
|
||||
void PhysicsSystem::addObject (const Ptr& ptr, const std::string& mesh, bool placeable)
|
||||
{
|
||||
std::string mesh = ptr.getClass().getModel(ptr);
|
||||
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||
handleToMesh[node->getName()] = mesh;
|
||||
mEngine->createAndAdjustRigidBody(
|
||||
|
@ -700,9 +683,8 @@ namespace MWWorld
|
|||
mesh, node->getName(), ptr.getCellRef().getScale(), node->getPosition(), node->getOrientation(), 0, 0, true, placeable);
|
||||
}
|
||||
|
||||
void PhysicsSystem::addActor (const Ptr& ptr)
|
||||
void PhysicsSystem::addActor (const Ptr& ptr, const std::string& mesh)
|
||||
{
|
||||
std::string mesh = ptr.getClass().getModel(ptr);
|
||||
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||
//TODO:optimize this. Searching the std::map isn't very efficient i think.
|
||||
mEngine->addCharacter(node->getName(), mesh, node->getPosition(), node->getScale().x, node->getOrientation());
|
||||
|
@ -773,13 +755,16 @@ namespace MWWorld
|
|||
const std::string &handle = node->getName();
|
||||
if(handleToMesh.find(handle) != handleToMesh.end())
|
||||
{
|
||||
std::string model = ptr.getClass().getModel(ptr);
|
||||
model = Misc::ResourceHelpers::correctActorModelPath(model); // FIXME: scaling shouldn't require model
|
||||
|
||||
bool placeable = false;
|
||||
if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle,true))
|
||||
placeable = body->mPlaceable;
|
||||
else if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle,false))
|
||||
placeable = body->mPlaceable;
|
||||
removeObject(handle);
|
||||
addObject(ptr, placeable);
|
||||
addObject(ptr, model, placeable);
|
||||
}
|
||||
|
||||
if (OEngine::Physic::PhysicActor* act = mEngine->getCharacter(handle))
|
||||
|
@ -820,6 +805,7 @@ namespace MWWorld
|
|||
bool PhysicsSystem::getObjectAABB(const MWWorld::Ptr &ptr, Ogre::Vector3 &min, Ogre::Vector3 &max)
|
||||
{
|
||||
std::string model = ptr.getClass().getModel(ptr);
|
||||
model = Misc::ResourceHelpers::correctActorModelPath(model);
|
||||
if (model.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -38,9 +38,9 @@ namespace MWWorld
|
|||
void setWaterHeight(float height);
|
||||
void disableWater();
|
||||
|
||||
void addObject (const MWWorld::Ptr& ptr, bool placeable=false);
|
||||
void addObject (const MWWorld::Ptr& ptr, const std::string& mesh, bool placeable=false);
|
||||
|
||||
void addActor (const MWWorld::Ptr& ptr);
|
||||
void addActor (const MWWorld::Ptr& ptr, const std::string& mesh);
|
||||
|
||||
void addHeightField (float* heights,
|
||||
int x, int y, float yoffset,
|
||||
|
|
|
@ -225,8 +225,6 @@ namespace MWWorld
|
|||
writer.startRecord (ESM::REC_PLAY);
|
||||
player.save (writer);
|
||||
writer.endRecord (ESM::REC_PLAY);
|
||||
|
||||
progress.increaseProgress();
|
||||
}
|
||||
|
||||
bool Player::readRecord (ESM::ESMReader& reader, int32_t type)
|
||||
|
|
|
@ -318,8 +318,6 @@ namespace MWWorld
|
|||
state.save(writer);
|
||||
|
||||
writer.endRecord(ESM::REC_PROJ);
|
||||
|
||||
progress.increaseProgress();
|
||||
}
|
||||
|
||||
for (std::vector<MagicBoltState>::const_iterator it = mMagicBolts.begin(); it != mMagicBolts.end(); ++it)
|
||||
|
@ -342,8 +340,6 @@ namespace MWWorld
|
|||
state.save(writer);
|
||||
|
||||
writer.endRecord(ESM::REC_MPRJ);
|
||||
|
||||
progress.increaseProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <OgreSceneNode.h>
|
||||
|
||||
#include <components/nif/niffile.hpp>
|
||||
#include <components/misc/resourcehelpers.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -79,8 +80,9 @@ namespace
|
|||
{
|
||||
try
|
||||
{
|
||||
mRendering.addObject (ptr);
|
||||
ptr.getClass().insertObject (ptr, mPhysics);
|
||||
const std::string& model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
||||
mRendering.addObject(ptr, model);
|
||||
ptr.getClass().insertObject (ptr, model, mPhysics);
|
||||
|
||||
updateObjectLocalRotation(ptr, mPhysics, mRendering);
|
||||
if (ptr.getRefData().getBaseNode())
|
||||
|
@ -486,8 +488,7 @@ namespace MWWorld
|
|||
// Sky system
|
||||
MWBase::Environment::get().getWorld()->adjustSky();
|
||||
|
||||
mCellChanged = true;
|
||||
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
||||
mCellChanged = true; MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
||||
|
||||
|
@ -529,8 +530,9 @@ namespace MWWorld
|
|||
|
||||
void Scene::addObjectToScene (const Ptr& ptr)
|
||||
{
|
||||
mRendering.addObject(ptr);
|
||||
ptr.getClass().insertObject(ptr, *mPhysics);
|
||||
const std::string& model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
||||
mRendering.addObject(ptr, model);
|
||||
ptr.getClass().insertObject (ptr, model, *mPhysics);
|
||||
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0, 0, 0, true);
|
||||
MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().getScale());
|
||||
}
|
||||
|
|
|
@ -325,7 +325,6 @@ namespace MWWorld
|
|||
writer.writeHNString ("NAME", iter->second.mId);
|
||||
iter->second.save (writer);
|
||||
writer.endRecord (T::sRecordId);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -760,7 +760,6 @@ void WeatherManager::write(ESM::ESMWriter& writer, Loading::Listener& progress)
|
|||
writer.startRecord(ESM::REC_WTHR);
|
||||
state.save(writer);
|
||||
writer.endRecord(ESM::REC_WTHR);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
|
||||
bool WeatherManager::readRecord(ESM::ESMReader& reader, int32_t type)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <components/files/collections.hpp>
|
||||
#include <components/compiler/locals.hpp>
|
||||
#include <components/esm/cellid.hpp>
|
||||
#include <components/misc/resourcehelpers.hpp>
|
||||
|
||||
#include <boost/math/special_functions/sign.hpp>
|
||||
|
||||
|
@ -309,6 +310,11 @@ namespace MWWorld
|
|||
+1; // camera
|
||||
}
|
||||
|
||||
int World::countSavedGameCells() const
|
||||
{
|
||||
return mCells.countSavedGameRecords();
|
||||
}
|
||||
|
||||
void World::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||
{
|
||||
// Active cells could have a dirty fog of war, sync it to the CellStore first
|
||||
|
@ -320,7 +326,6 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
MWMechanics::CreatureStats::writeActorIdCounter(writer);
|
||||
progress.increaseProgress();
|
||||
|
||||
mStore.write (writer, progress); // dynamic Store must be written (and read) before Cells, so that
|
||||
// references to custom made records will be recognized
|
||||
|
@ -334,12 +339,10 @@ namespace MWWorld
|
|||
writer.writeHNT("TELE", mTeleportEnabled);
|
||||
writer.writeHNT("LEVT", mLevitationEnabled);
|
||||
writer.endRecord(ESM::REC_ENAB);
|
||||
progress.increaseProgress();
|
||||
|
||||
writer.startRecord(ESM::REC_CAM_);
|
||||
writer.writeHNT("FIRS", isFirstPerson());
|
||||
writer.endRecord(ESM::REC_CAM_);
|
||||
progress.increaseProgress();
|
||||
}
|
||||
|
||||
void World::readRecord (ESM::ESMReader& reader, int32_t type,
|
||||
|
@ -354,12 +357,6 @@ namespace MWWorld
|
|||
reader.getHNT(mTeleportEnabled, "TELE");
|
||||
reader.getHNT(mLevitationEnabled, "LEVT");
|
||||
return;
|
||||
case ESM::REC_CAM_:
|
||||
bool firstperson;
|
||||
reader.getHNT(firstperson, "FIRS");
|
||||
if (firstperson != isFirstPerson())
|
||||
togglePOV();
|
||||
break;
|
||||
default:
|
||||
if (!mStore.readRecord (reader, type) &&
|
||||
!mGlobalVariables.readRecord (reader, type) &&
|
||||
|
@ -2096,7 +2093,9 @@ namespace MWWorld
|
|||
// so we should make sure not to use a "stale" controller for that.
|
||||
MWBase::Environment::get().getMechanicsManager()->add(mPlayer->getPlayer());
|
||||
|
||||
mPhysics->addActor(mPlayer->getPlayer());
|
||||
std::string model = getPlayerPtr().getClass().getModel(getPlayerPtr());
|
||||
model = Misc::ResourceHelpers::correctActorModelPath(model);
|
||||
mPhysics->addActor(mPlayer->getPlayer(), model);
|
||||
}
|
||||
|
||||
int World::canRest ()
|
||||
|
|
|
@ -166,6 +166,7 @@ namespace MWWorld
|
|||
virtual void clear();
|
||||
|
||||
virtual int countSavedGameRecords() const;
|
||||
virtual int countSavedGameCells() const;
|
||||
|
||||
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace ESMTerrain
|
|||
/// Fill vertex buffers for a terrain chunk.
|
||||
/// @note May be called from background threads. Make sure to only call thread-safe functions from here!
|
||||
/// @note returned colors need to be in render-system specific format! Use RenderSystem::convertColourValue.
|
||||
/// @note Vertices should be written in row-major order (a row is defined as parallel to the x-axis).
|
||||
/// The specified positions should be in local space, i.e. relative to the center of the terrain chunk.
|
||||
/// @param lodLevel LOD level, 0 = most detailed
|
||||
/// @param size size of the terrain chunk in cell units
|
||||
/// @param center center of the chunk in cell units
|
||||
|
|
|
@ -121,3 +121,20 @@ std::string Misc::ResourceHelpers::correctBookartPath(const std::string &resPath
|
|||
|
||||
return image;
|
||||
}
|
||||
|
||||
std::string Misc::ResourceHelpers::correctActorModelPath(const std::string &resPath)
|
||||
{
|
||||
std::string mdlname = resPath;
|
||||
std::string::size_type p = mdlname.rfind('\\');
|
||||
if(p == std::string::npos)
|
||||
p = mdlname.rfind('/');
|
||||
if(p != std::string::npos)
|
||||
mdlname.insert(mdlname.begin()+p+1, 'x');
|
||||
else
|
||||
mdlname.insert(mdlname.begin(), 'x');
|
||||
if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(mdlname))
|
||||
{
|
||||
return resPath;
|
||||
}
|
||||
return mdlname;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace Misc
|
|||
std::string correctIconPath(const std::string &resPath);
|
||||
std::string correctBookartPath(const std::string &resPath);
|
||||
std::string correctBookartPath(const std::string &resPath, int width, int height);
|
||||
/// Uses "xfoo.nif" instead of "foo.nif" if available
|
||||
std::string correctActorModelPath(const std::string &resPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,57 @@ http://www.gnu.org/licenses/ .
|
|||
|
||||
typedef unsigned char ubyte;
|
||||
|
||||
// Extract a list of keyframe-controlled nodes from a .kf file
|
||||
// FIXME: this is a similar copy of OgreNifLoader::loadKf
|
||||
void extractControlledNodes(Nif::NIFFilePtr kfFile, std::set<std::string>& controlled)
|
||||
{
|
||||
if(kfFile->numRoots() < 1)
|
||||
{
|
||||
kfFile->warn("Found no root nodes in "+kfFile->getFilename()+".");
|
||||
return;
|
||||
}
|
||||
|
||||
const Nif::Record *r = kfFile->getRoot(0);
|
||||
assert(r != NULL);
|
||||
|
||||
if(r->recType != Nif::RC_NiSequenceStreamHelper)
|
||||
{
|
||||
kfFile->warn("First root was not a NiSequenceStreamHelper, but a "+
|
||||
r->recName+".");
|
||||
return;
|
||||
}
|
||||
const Nif::NiSequenceStreamHelper *seq = static_cast<const Nif::NiSequenceStreamHelper*>(r);
|
||||
|
||||
Nif::ExtraPtr extra = seq->extra;
|
||||
if(extra.empty() || extra->recType != Nif::RC_NiTextKeyExtraData)
|
||||
{
|
||||
kfFile->warn("First extra data was not a NiTextKeyExtraData, but a "+
|
||||
(extra.empty() ? std::string("nil") : extra->recName)+".");
|
||||
return;
|
||||
}
|
||||
|
||||
extra = extra->extra;
|
||||
Nif::ControllerPtr ctrl = seq->controller;
|
||||
for(;!extra.empty() && !ctrl.empty();(extra=extra->extra),(ctrl=ctrl->next))
|
||||
{
|
||||
if(extra->recType != Nif::RC_NiStringExtraData || ctrl->recType != Nif::RC_NiKeyframeController)
|
||||
{
|
||||
kfFile->warn("Unexpected extra data "+extra->recName+" with controller "+ctrl->recName);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(ctrl->flags & Nif::NiNode::ControllerFlag_Active))
|
||||
continue;
|
||||
|
||||
const Nif::NiStringExtraData *strdata = static_cast<const Nif::NiStringExtraData*>(extra.getPtr());
|
||||
const Nif::NiKeyframeController *key = static_cast<const Nif::NiKeyframeController*>(ctrl.getPtr());
|
||||
|
||||
if(key->data.empty())
|
||||
continue;
|
||||
controlled.insert(strdata->string);
|
||||
}
|
||||
}
|
||||
|
||||
namespace NifBullet
|
||||
{
|
||||
|
||||
|
@ -72,10 +123,6 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||
mCompoundShape = NULL;
|
||||
mStaticMesh = NULL;
|
||||
|
||||
// Load the NIF. TODO: Wrap this in a try-catch block once we're out
|
||||
// of the early stages of development. Right now we WANT to catch
|
||||
// every error as early and intrusively as possible, as it's most
|
||||
// likely a sign of incomplete code rather than faulty input.
|
||||
Nif::NIFFilePtr pnif (Nif::Cache::getInstance().load(mResourceName.substr(0, mResourceName.length()-7)));
|
||||
Nif::NIFFile & nif = *pnif.get ();
|
||||
if (nif.numRoots() < 1)
|
||||
|
@ -84,6 +131,19 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||
return;
|
||||
}
|
||||
|
||||
// Have to load controlled nodes from the .kf
|
||||
// FIXME: the .kf has to be loaded both for rendering and physics, ideally it should be opened once and then reused
|
||||
mControlledNodes.clear();
|
||||
std::string kfname = mResourceName.substr(0, mResourceName.length()-7);
|
||||
Misc::StringUtils::toLower(kfname);
|
||||
if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0)
|
||||
kfname.replace(kfname.size()-4, 4, ".kf");
|
||||
if (Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(kfname))
|
||||
{
|
||||
Nif::NIFFilePtr kf (Nif::Cache::getInstance().load(kfname));
|
||||
extractControlledNodes(kf, mControlledNodes);
|
||||
}
|
||||
|
||||
Nif::Record *r = nif.getRoot(0);
|
||||
assert(r != NULL);
|
||||
|
||||
|
@ -95,7 +155,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||
return;
|
||||
}
|
||||
|
||||
mShape->mHasCollisionNode = hasRootCollisionNode(node);
|
||||
mShape->mAutogenerated = hasAutoGeneratedCollision(node);
|
||||
|
||||
//do a first pass
|
||||
handleNode(node,0,false,false,false);
|
||||
|
@ -152,12 +212,9 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||
mShape->mRaycastingShape = new TriangleMeshShape(mStaticMesh,true);
|
||||
}
|
||||
|
||||
bool ManualBulletShapeLoader::hasRootCollisionNode(Nif::Node const * node)
|
||||
bool ManualBulletShapeLoader::hasAutoGeneratedCollision(Nif::Node const * rootNode)
|
||||
{
|
||||
if(node->recType == Nif::RC_RootCollisionNode)
|
||||
return true;
|
||||
|
||||
const Nif::NiNode *ninode = dynamic_cast<const Nif::NiNode*>(node);
|
||||
const Nif::NiNode *ninode = dynamic_cast<const Nif::NiNode*>(rootNode);
|
||||
if(ninode)
|
||||
{
|
||||
const Nif::NodeList &list = ninode->children;
|
||||
|
@ -165,13 +222,12 @@ bool ManualBulletShapeLoader::hasRootCollisionNode(Nif::Node const * node)
|
|||
{
|
||||
if(!list[i].empty())
|
||||
{
|
||||
if(hasRootCollisionNode(list[i].getPtr()))
|
||||
return true;
|
||||
if(list[i].getPtr()->recType == Nif::RC_RootCollisionNode)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
||||
|
@ -186,6 +242,9 @@ void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
|||
&& (node->controller->flags & Nif::NiNode::ControllerFlag_Active))
|
||||
isAnimated = true;
|
||||
|
||||
if (mControlledNodes.find(node->name) != mControlledNodes.end())
|
||||
isAnimated = true;
|
||||
|
||||
if (!raycasting)
|
||||
isCollisionNode = isCollisionNode || (node->recType == Nif::RC_RootCollisionNode);
|
||||
else
|
||||
|
@ -230,8 +289,8 @@ void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
|||
}
|
||||
}
|
||||
|
||||
if ( (isCollisionNode || (!mShape->mHasCollisionNode && !raycasting))
|
||||
&& (!isMarker || (mShape->mHasCollisionNode && !raycasting)))
|
||||
if ( (isCollisionNode || (mShape->mAutogenerated && !raycasting))
|
||||
&& (!isMarker || (!mShape->mAutogenerated && !raycasting)))
|
||||
{
|
||||
// NOTE: a trishape with hasBounds=true, but no BBoxCollision flag should NOT go through handleNiTriShape!
|
||||
// It must be ignored completely.
|
||||
|
@ -322,9 +381,9 @@ void ManualBulletShapeLoader::handleNiTriShape(const Nif::NiTriShape *shape, int
|
|||
btTransform trans(btQuaternion(q.x, q.y, q.z, q.w), btVector3(v.x, v.y, v.z));
|
||||
|
||||
if (raycasting)
|
||||
mShape->mAnimatedRaycastingShapes.insert(std::make_pair(shape->name, mCompoundShape->getNumChildShapes()));
|
||||
mShape->mAnimatedRaycastingShapes.insert(std::make_pair(shape->recIndex, mCompoundShape->getNumChildShapes()));
|
||||
else
|
||||
mShape->mAnimatedShapes.insert(std::make_pair(shape->name, mCompoundShape->getNumChildShapes()));
|
||||
mShape->mAnimatedShapes.insert(std::make_pair(shape->recIndex, mCompoundShape->getNumChildShapes()));
|
||||
|
||||
mCompoundShape->addChildShape(trans, childShape);
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ private:
|
|||
/**
|
||||
*Helper function
|
||||
*/
|
||||
bool hasRootCollisionNode(const Nif::Node *node);
|
||||
bool hasAutoGeneratedCollision(const Nif::Node *rootNode);
|
||||
|
||||
/**
|
||||
*convert a NiTriShape to a bullet trishape.
|
||||
|
@ -128,6 +128,8 @@ private:
|
|||
btTriangleMesh* mStaticMesh;
|
||||
|
||||
btBoxShape *mBoundingBox;
|
||||
|
||||
std::set<std::string> mControlledNodes;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ NIFMeshLoader::NIFMeshLoader(const std::string &name, const std::string &group,
|
|||
|
||||
void NIFMeshLoader::loadResource(Ogre::Resource *resource)
|
||||
{
|
||||
Ogre::Mesh *mesh = dynamic_cast<Ogre::Mesh*>(resource);
|
||||
Ogre::Mesh *mesh = static_cast<Ogre::Mesh*>(resource);
|
||||
OgreAssert(mesh, "Attempting to load a mesh into a non-mesh resource!");
|
||||
|
||||
Nif::NIFFilePtr nif = Nif::Cache::getInstance().load(mName);
|
||||
|
@ -395,7 +395,7 @@ void NIFMeshLoader::loadResource(Ogre::Resource *resource)
|
|||
}
|
||||
|
||||
const Nif::Record *record = nif->getRecord(mShapeIndex);
|
||||
createSubMesh(mesh, dynamic_cast<const Nif::NiTriShape*>(record));
|
||||
createSubMesh(mesh, static_cast<const Nif::NiTriShape*>(record));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -799,7 +799,7 @@ class NIFObjectLoader
|
|||
{
|
||||
if (ctrls->recType == Nif::RC_NiAlphaController)
|
||||
{
|
||||
const Nif::NiAlphaController *alphaCtrl = dynamic_cast<const Nif::NiAlphaController*>(ctrls.getPtr());
|
||||
const Nif::NiAlphaController *alphaCtrl = static_cast<const Nif::NiAlphaController*>(ctrls.getPtr());
|
||||
Ogre::ControllerValueRealPtr dstval(OGRE_NEW AlphaController::Value(movable, alphaCtrl->data.getPtr(), &scene->mMaterialControllerMgr));
|
||||
AlphaController::Function* function = OGRE_NEW AlphaController::Function(alphaCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
||||
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
||||
|
@ -808,7 +808,7 @@ class NIFObjectLoader
|
|||
}
|
||||
else if (ctrls->recType == Nif::RC_NiMaterialColorController)
|
||||
{
|
||||
const Nif::NiMaterialColorController *matCtrl = dynamic_cast<const Nif::NiMaterialColorController*>(ctrls.getPtr());
|
||||
const Nif::NiMaterialColorController *matCtrl = static_cast<const Nif::NiMaterialColorController*>(ctrls.getPtr());
|
||||
Ogre::ControllerValueRealPtr dstval(OGRE_NEW MaterialColorController::Value(movable, matCtrl->data.getPtr(), &scene->mMaterialControllerMgr));
|
||||
MaterialColorController::Function* function = OGRE_NEW MaterialColorController::Function(matCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
||||
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
||||
|
@ -826,7 +826,7 @@ class NIFObjectLoader
|
|||
{
|
||||
if (ctrls->recType == Nif::RC_NiFlipController)
|
||||
{
|
||||
const Nif::NiFlipController *flipCtrl = dynamic_cast<const Nif::NiFlipController*>(ctrls.getPtr());
|
||||
const Nif::NiFlipController *flipCtrl = static_cast<const Nif::NiFlipController*>(ctrls.getPtr());
|
||||
|
||||
|
||||
Ogre::ControllerValueRealPtr dstval(OGRE_NEW FlipController::Value(
|
||||
|
|
|
@ -4,6 +4,162 @@
|
|||
|
||||
#include "defs.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
template <typename IndexType>
|
||||
Ogre::HardwareIndexBufferSharedPtr createIndexBuffer(unsigned int flags, unsigned int verts, Ogre::HardwareIndexBuffer::IndexType type)
|
||||
{
|
||||
// LOD level n means every 2^n-th vertex is kept
|
||||
size_t lodLevel = (flags >> (4*4));
|
||||
|
||||
size_t lodDeltas[4];
|
||||
for (int i=0; i<4; ++i)
|
||||
lodDeltas[i] = (flags >> (4*i)) & (0xf);
|
||||
|
||||
bool anyDeltas = (lodDeltas[Terrain::North] || lodDeltas[Terrain::South] || lodDeltas[Terrain::West] || lodDeltas[Terrain::East]);
|
||||
|
||||
size_t increment = 1 << lodLevel;
|
||||
assert(increment < verts);
|
||||
std::vector<IndexType> indices;
|
||||
indices.reserve((verts-1)*(verts-1)*2*3 / increment);
|
||||
|
||||
size_t rowStart = 0, colStart = 0, rowEnd = verts-1, colEnd = verts-1;
|
||||
// If any edge needs stitching we'll skip all edges at this point,
|
||||
// mainly because stitching one edge would have an effect on corners and on the adjacent edges
|
||||
if (anyDeltas)
|
||||
{
|
||||
colStart += increment;
|
||||
colEnd -= increment;
|
||||
rowEnd -= increment;
|
||||
rowStart += increment;
|
||||
}
|
||||
for (size_t row = rowStart; row < rowEnd; row += increment)
|
||||
{
|
||||
for (size_t col = colStart; col < colEnd; col += increment)
|
||||
{
|
||||
indices.push_back(verts*col+row);
|
||||
indices.push_back(verts*(col+increment)+row+increment);
|
||||
indices.push_back(verts*col+row+increment);
|
||||
|
||||
indices.push_back(verts*col+row);
|
||||
indices.push_back(verts*(col+increment)+row);
|
||||
indices.push_back(verts*(col+increment)+row+increment);
|
||||
}
|
||||
}
|
||||
|
||||
size_t innerStep = increment;
|
||||
if (anyDeltas)
|
||||
{
|
||||
// Now configure LOD transitions at the edges - this is pretty tedious,
|
||||
// and some very long and boring code, but it works great
|
||||
|
||||
// South
|
||||
size_t row = 0;
|
||||
size_t outerStep = 1 << (lodDeltas[Terrain::South] + lodLevel);
|
||||
for (size_t col = 0; col < verts-1; col += outerStep)
|
||||
{
|
||||
indices.push_back(verts*col+row);
|
||||
indices.push_back(verts*(col+outerStep)+row);
|
||||
// Make sure not to touch the right edge
|
||||
if (col+outerStep == verts-1)
|
||||
indices.push_back(verts*(col+outerStep-innerStep)+row+innerStep);
|
||||
else
|
||||
indices.push_back(verts*(col+outerStep)+row+innerStep);
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the left or right edges
|
||||
if (col+i == 0 || col+i == verts-1-innerStep)
|
||||
continue;
|
||||
indices.push_back(verts*(col)+row);
|
||||
indices.push_back(verts*(col+i+innerStep)+row+innerStep);
|
||||
indices.push_back(verts*(col+i)+row+innerStep);
|
||||
}
|
||||
}
|
||||
|
||||
// North
|
||||
row = verts-1;
|
||||
outerStep = size_t(1) << (lodDeltas[Terrain::North] + lodLevel);
|
||||
for (size_t col = 0; col < verts-1; col += outerStep)
|
||||
{
|
||||
indices.push_back(verts*(col+outerStep)+row);
|
||||
indices.push_back(verts*col+row);
|
||||
// Make sure not to touch the left edge
|
||||
if (col == 0)
|
||||
indices.push_back(verts*(col+innerStep)+row-innerStep);
|
||||
else
|
||||
indices.push_back(verts*col+row-innerStep);
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the left or right edges
|
||||
if (col+i == 0 || col+i == verts-1-innerStep)
|
||||
continue;
|
||||
indices.push_back(verts*(col+i)+row-innerStep);
|
||||
indices.push_back(verts*(col+i+innerStep)+row-innerStep);
|
||||
indices.push_back(verts*(col+outerStep)+row);
|
||||
}
|
||||
}
|
||||
|
||||
// West
|
||||
size_t col = 0;
|
||||
outerStep = size_t(1) << (lodDeltas[Terrain::West] + lodLevel);
|
||||
for (size_t row = 0; row < verts-1; row += outerStep)
|
||||
{
|
||||
indices.push_back(verts*col+row+outerStep);
|
||||
indices.push_back(verts*col+row);
|
||||
// Make sure not to touch the top edge
|
||||
if (row+outerStep == verts-1)
|
||||
indices.push_back(verts*(col+innerStep)+row+outerStep-innerStep);
|
||||
else
|
||||
indices.push_back(verts*(col+innerStep)+row+outerStep);
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the top or bottom edges
|
||||
if (row+i == 0 || row+i == verts-1-innerStep)
|
||||
continue;
|
||||
indices.push_back(verts*col+row);
|
||||
indices.push_back(verts*(col+innerStep)+row+i);
|
||||
indices.push_back(verts*(col+innerStep)+row+i+innerStep);
|
||||
}
|
||||
}
|
||||
|
||||
// East
|
||||
col = verts-1;
|
||||
outerStep = size_t(1) << (lodDeltas[Terrain::East] + lodLevel);
|
||||
for (size_t row = 0; row < verts-1; row += outerStep)
|
||||
{
|
||||
indices.push_back(verts*col+row);
|
||||
indices.push_back(verts*col+row+outerStep);
|
||||
// Make sure not to touch the bottom edge
|
||||
if (row == 0)
|
||||
indices.push_back(verts*(col-innerStep)+row+innerStep);
|
||||
else
|
||||
indices.push_back(verts*(col-innerStep)+row);
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the top or bottom edges
|
||||
if (row+i == 0 || row+i == verts-1-innerStep)
|
||||
continue;
|
||||
indices.push_back(verts*col+row+outerStep);
|
||||
indices.push_back(verts*(col-innerStep)+row+i+innerStep);
|
||||
indices.push_back(verts*(col-innerStep)+row+i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ogre::HardwareBufferManager* mgr = Ogre::HardwareBufferManager::getSingletonPtr();
|
||||
Ogre::HardwareIndexBufferSharedPtr buffer = mgr->createIndexBuffer(type,
|
||||
indices.size(), Ogre::HardwareBuffer::HBU_STATIC);
|
||||
buffer->writeData(0, buffer->getSizeInBytes(), &indices[0], true);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Terrain
|
||||
{
|
||||
|
||||
|
@ -39,7 +195,7 @@ namespace Terrain
|
|||
return buffer;
|
||||
}
|
||||
|
||||
Ogre::HardwareIndexBufferSharedPtr BufferCache::getIndexBuffer(int flags)
|
||||
Ogre::HardwareIndexBufferSharedPtr BufferCache::getIndexBuffer(unsigned int flags)
|
||||
{
|
||||
unsigned int verts = mNumVerts;
|
||||
|
||||
|
@ -48,151 +204,12 @@ namespace Terrain
|
|||
return mIndexBufferMap[flags];
|
||||
}
|
||||
|
||||
// LOD level n means every 2^n-th vertex is kept
|
||||
size_t lodLevel = (flags >> (4*4));
|
||||
Ogre::HardwareIndexBufferSharedPtr buffer;
|
||||
if (verts*verts > (0xffffu))
|
||||
buffer = createIndexBuffer<unsigned int>(flags, verts, Ogre::HardwareIndexBuffer::IT_32BIT);
|
||||
else
|
||||
buffer = createIndexBuffer<unsigned short>(flags, verts, Ogre::HardwareIndexBuffer::IT_16BIT);
|
||||
|
||||
size_t lodDeltas[4];
|
||||
for (int i=0; i<4; ++i)
|
||||
lodDeltas[i] = (flags >> (4*i)) & (0xf);
|
||||
|
||||
bool anyDeltas = (lodDeltas[North] || lodDeltas[South] || lodDeltas[West] || lodDeltas[East]);
|
||||
|
||||
size_t increment = 1 << lodLevel;
|
||||
assert(increment < verts);
|
||||
std::vector<short> indices;
|
||||
indices.reserve((verts-1)*(verts-1)*2*3 / increment);
|
||||
|
||||
size_t rowStart = 0, colStart = 0, rowEnd = verts-1, colEnd = verts-1;
|
||||
// If any edge needs stitching we'll skip all edges at this point,
|
||||
// mainly because stitching one edge would have an effect on corners and on the adjacent edges
|
||||
if (anyDeltas)
|
||||
{
|
||||
colStart += increment;
|
||||
colEnd -= increment;
|
||||
rowEnd -= increment;
|
||||
rowStart += increment;
|
||||
}
|
||||
for (size_t row = rowStart; row < rowEnd; row += increment)
|
||||
{
|
||||
for (size_t col = colStart; col < colEnd; col += increment)
|
||||
{
|
||||
indices.push_back(verts*col+row);
|
||||
indices.push_back(verts*(col+increment)+row+increment);
|
||||
indices.push_back(verts*col+row+increment);
|
||||
|
||||
indices.push_back(verts*col+row);
|
||||
indices.push_back(verts*(col+increment)+row);
|
||||
indices.push_back(verts*(col+increment)+row+increment);
|
||||
}
|
||||
}
|
||||
|
||||
size_t innerStep = increment;
|
||||
if (anyDeltas)
|
||||
{
|
||||
// Now configure LOD transitions at the edges - this is pretty tedious,
|
||||
// and some very long and boring code, but it works great
|
||||
|
||||
// South
|
||||
size_t row = 0;
|
||||
size_t outerStep = 1 << (lodDeltas[South] + lodLevel);
|
||||
for (size_t col = 0; col < verts-1; col += outerStep)
|
||||
{
|
||||
indices.push_back(verts*col+row);
|
||||
indices.push_back(verts*(col+outerStep)+row);
|
||||
// Make sure not to touch the right edge
|
||||
if (col+outerStep == verts-1)
|
||||
indices.push_back(verts*(col+outerStep-innerStep)+row+innerStep);
|
||||
else
|
||||
indices.push_back(verts*(col+outerStep)+row+innerStep);
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the left or right edges
|
||||
if (col+i == 0 || col+i == verts-1-innerStep)
|
||||
continue;
|
||||
indices.push_back(verts*(col)+row);
|
||||
indices.push_back(verts*(col+i+innerStep)+row+innerStep);
|
||||
indices.push_back(verts*(col+i)+row+innerStep);
|
||||
}
|
||||
}
|
||||
|
||||
// North
|
||||
row = verts-1;
|
||||
outerStep = size_t(1) << (lodDeltas[North] + lodLevel);
|
||||
for (size_t col = 0; col < verts-1; col += outerStep)
|
||||
{
|
||||
indices.push_back(verts*(col+outerStep)+row);
|
||||
indices.push_back(verts*col+row);
|
||||
// Make sure not to touch the left edge
|
||||
if (col == 0)
|
||||
indices.push_back(verts*(col+innerStep)+row-innerStep);
|
||||
else
|
||||
indices.push_back(verts*col+row-innerStep);
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the left or right edges
|
||||
if (col+i == 0 || col+i == verts-1-innerStep)
|
||||
continue;
|
||||
indices.push_back(verts*(col+i)+row-innerStep);
|
||||
indices.push_back(verts*(col+i+innerStep)+row-innerStep);
|
||||
indices.push_back(verts*(col+outerStep)+row);
|
||||
}
|
||||
}
|
||||
|
||||
// West
|
||||
size_t col = 0;
|
||||
outerStep = size_t(1) << (lodDeltas[West] + lodLevel);
|
||||
for (size_t row = 0; row < verts-1; row += outerStep)
|
||||
{
|
||||
indices.push_back(verts*col+row+outerStep);
|
||||
indices.push_back(verts*col+row);
|
||||
// Make sure not to touch the top edge
|
||||
if (row+outerStep == verts-1)
|
||||
indices.push_back(verts*(col+innerStep)+row+outerStep-innerStep);
|
||||
else
|
||||
indices.push_back(verts*(col+innerStep)+row+outerStep);
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the top or bottom edges
|
||||
if (row+i == 0 || row+i == verts-1-innerStep)
|
||||
continue;
|
||||
indices.push_back(verts*col+row);
|
||||
indices.push_back(verts*(col+innerStep)+row+i);
|
||||
indices.push_back(verts*(col+innerStep)+row+i+innerStep);
|
||||
}
|
||||
}
|
||||
|
||||
// East
|
||||
col = verts-1;
|
||||
outerStep = size_t(1) << (lodDeltas[East] + lodLevel);
|
||||
for (size_t row = 0; row < verts-1; row += outerStep)
|
||||
{
|
||||
indices.push_back(verts*col+row);
|
||||
indices.push_back(verts*col+row+outerStep);
|
||||
// Make sure not to touch the bottom edge
|
||||
if (row == 0)
|
||||
indices.push_back(verts*(col-innerStep)+row+innerStep);
|
||||
else
|
||||
indices.push_back(verts*(col-innerStep)+row);
|
||||
|
||||
for (size_t i = 0; i < outerStep; i += innerStep)
|
||||
{
|
||||
// Make sure not to touch the top or bottom edges
|
||||
if (row+i == 0 || row+i == verts-1-innerStep)
|
||||
continue;
|
||||
indices.push_back(verts*col+row+outerStep);
|
||||
indices.push_back(verts*(col-innerStep)+row+i+innerStep);
|
||||
indices.push_back(verts*(col-innerStep)+row+i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ogre::HardwareBufferManager* mgr = Ogre::HardwareBufferManager::getSingletonPtr();
|
||||
Ogre::HardwareIndexBufferSharedPtr buffer = mgr->createIndexBuffer(Ogre::HardwareIndexBuffer::IT_16BIT,
|
||||
indices.size(), Ogre::HardwareBuffer::HBU_STATIC);
|
||||
buffer->writeData(0, buffer->getSizeInBytes(), &indices[0], true);
|
||||
mIndexBufferMap[flags] = buffer;
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Terrain
|
|||
|
||||
/// @param flags first 4*4 bits are LOD deltas on each edge, respectively (4 bits each)
|
||||
/// next 4 bits are LOD level of the index buffer (LOD 0 = don't omit any vertices)
|
||||
Ogre::HardwareIndexBufferSharedPtr getIndexBuffer (int flags);
|
||||
Ogre::HardwareIndexBufferSharedPtr getIndexBuffer (unsigned int flags);
|
||||
|
||||
Ogre::HardwareVertexBufferSharedPtr getUVBuffer ();
|
||||
|
||||
|
|
|
@ -415,7 +415,7 @@ void QuadTreeNode::updateIndexBuffers()
|
|||
// Fetch a suitable index buffer (which may be shared)
|
||||
size_t ourLod = getActualLodLevel();
|
||||
|
||||
int flags = 0;
|
||||
unsigned int flags = 0;
|
||||
|
||||
for (int i=0; i<4; ++i)
|
||||
{
|
||||
|
@ -436,7 +436,7 @@ void QuadTreeNode::updateIndexBuffers()
|
|||
if (lod > 0)
|
||||
{
|
||||
assert (lod - ourLod < (1 << 4));
|
||||
flags |= int(lod - ourLod) << (4*i);
|
||||
flags |= static_cast<unsigned int>(lod - ourLod) << (4*i);
|
||||
}
|
||||
}
|
||||
flags |= 0 /*((int)mAdditionalLod)*/ << (4*4);
|
||||
|
|
|
@ -30,6 +30,8 @@ namespace Terrain
|
|||
/// Fill vertex buffers for a terrain chunk.
|
||||
/// @note May be called from background threads. Make sure to only call thread-safe functions from here!
|
||||
/// @note returned colors need to be in render-system specific format! Use RenderSystem::convertColourValue.
|
||||
/// @note Vertices should be written in row-major order (a row is defined as parallel to the x-axis).
|
||||
/// The specified positions should be in local space, i.e. relative to the center of the terrain chunk.
|
||||
/// @param lodLevel LOD level, 0 = most detailed
|
||||
/// @param size size of the terrain chunk in cell units
|
||||
/// @param center center of the chunk in cell units
|
||||
|
|
|
@ -12,9 +12,12 @@
|
|||
|
||||
|
||||
<!-- Range -->
|
||||
<Widget type="TextBox" skin="NormalText" position="8 36 400 24">
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText" position="8 36 400 24">
|
||||
<Property key="Caption" value="#{sRange}"/>
|
||||
<Property key="TextAlign" value="Left HCenter"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sRangeDes}"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedButton" skin="MW_Button" position="130 36 0 24" name="RangeButton">
|
||||
<Property key="Caption" value="#{sRangeTouch}"/>
|
||||
|
@ -22,9 +25,12 @@
|
|||
|
||||
<!-- Magnitude -->
|
||||
<Widget type="Widget" position="8 80 400 70" name="MagnitudeBox">
|
||||
<Widget type="TextBox" skin="NormalText" position="0 0 400 24">
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText" position="0 0 400 24">
|
||||
<Property key="Caption" value="#{sMagnitude}"/>
|
||||
<Property key="TextAlign" value="Left HCenter"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sMagnitudeDes}"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="122 0 210 20" name="MagnitudeMinValue">
|
||||
|
@ -49,9 +55,12 @@
|
|||
|
||||
<!-- Duration -->
|
||||
<Widget type="Widget" position="8 153 400 40" name="DurationBox">
|
||||
<Widget type="TextBox" skin="NormalText" position="0 20 400 24">
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText" position="0 20 400 24">
|
||||
<Property key="Caption" value="#{sDuration}"/>
|
||||
<Property key="TextAlign" value="Left Top"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sDurationDes}"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="122 0 210 20" name="DurationValue">
|
||||
|
@ -66,9 +75,12 @@
|
|||
|
||||
<!-- Area -->
|
||||
<Widget type="Widget" position="8 197 400 40" name="AreaBox">
|
||||
<Widget type="TextBox" skin="NormalText" position="0 20 400 24" name="AreaText">
|
||||
<Widget type="AutoSizedTextBox" skin="NormalText" position="0 20 400 24" name="AreaText">
|
||||
<Property key="Caption" value="#{sArea}"/>
|
||||
<Property key="TextAlign" value="Left Top"/>
|
||||
<UserString key="ToolTipType" value="Layout"/>
|
||||
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||
<UserString key="Caption_Text" value="#{sAreaDes}"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="122 0 210 20" name="AreaValue">
|
||||
|
|
|
@ -19,7 +19,7 @@ Ogre::Resource(creator, name, handle, group, isManual, loader)
|
|||
*/
|
||||
mCollisionShape = NULL;
|
||||
mRaycastingShape = NULL;
|
||||
mHasCollisionNode = false;
|
||||
mAutogenerated = true;
|
||||
mCollide = true;
|
||||
createParamDictionary("BulletShape");
|
||||
}
|
||||
|
|
|
@ -33,17 +33,16 @@ public:
|
|||
// Stores animated collision shapes. If any collision nodes in the NIF are animated, then mCollisionShape
|
||||
// will be a btCompoundShape (which consists of one or more child shapes).
|
||||
// In this map, for each animated collision shape,
|
||||
// we store the bone name mapped to the child index of the shape in the btCompoundShape.
|
||||
std::map<std::string, int> mAnimatedShapes;
|
||||
// we store the node's record index mapped to the child index of the shape in the btCompoundShape.
|
||||
std::map<int, int> mAnimatedShapes;
|
||||
|
||||
std::map<std::string, int> mAnimatedRaycastingShapes;
|
||||
std::map<int, int> mAnimatedRaycastingShapes;
|
||||
|
||||
btCollisionShape* mCollisionShape;
|
||||
btCollisionShape* mRaycastingShape;
|
||||
|
||||
// Whether or not a NiRootCollisionNode was present in the .nif. If there is none, the collision behaviour
|
||||
// depends on object type, so we need to expose this variable.
|
||||
bool mHasCollisionNode;
|
||||
// Does this .nif have an autogenerated collision mesh?
|
||||
bool mAutogenerated;
|
||||
|
||||
Ogre::Vector3 mBoxTranslation;
|
||||
Ogre::Quaternion mBoxRotation;
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
#include "physic.hpp"
|
||||
|
||||
#include <btBulletDynamicsCommon.h>
|
||||
#include <btBulletCollisionCommon.h>
|
||||
#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
|
||||
#include <components/nifbullet/bulletnifloader.hpp>
|
||||
#include "OgreRoot.h"
|
||||
#include "BtOgrePG.h"
|
||||
#include "BtOgreGP.h"
|
||||
#include "BtOgreExtras.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include <OgreSceneManager.h>
|
||||
|
||||
#include <components/nifbullet/bulletnifloader.hpp>
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include "BtOgrePG.h"
|
||||
#include "BtOgreGP.h"
|
||||
#include "BtOgreExtras.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -35,7 +40,7 @@ btCollisionShape *duplicateCollisionShape(btCollisionShape *shape)
|
|||
|
||||
if(btBvhTriangleMeshShape *trishape = dynamic_cast<btBvhTriangleMeshShape*>(shape))
|
||||
{
|
||||
btTriangleMesh* oldMesh = dynamic_cast<btTriangleMesh*>(trishape->getMeshInterface());
|
||||
btTriangleMesh* oldMesh = static_cast<btTriangleMesh*>(trishape->getMeshInterface());
|
||||
btTriangleMesh* newMesh = new btTriangleMesh(*oldMesh);
|
||||
NifBullet::TriangleMeshShape *newShape = new NifBullet::TriangleMeshShape(newMesh, true);
|
||||
|
||||
|
@ -456,7 +461,7 @@ namespace Physic
|
|||
BulletShapeManager::getSingletonPtr()->load(outputstring,"General");
|
||||
BulletShapePtr shape = BulletShapeManager::getSingleton().getByName(outputstring,"General");
|
||||
|
||||
if (placeable && !raycasting && shape->mCollisionShape && !shape->mHasCollisionNode)
|
||||
if (placeable && !raycasting && shape->mCollisionShape && shape->mAutogenerated)
|
||||
return NULL;
|
||||
|
||||
if (!shape->mCollisionShape && !raycasting)
|
||||
|
|
|
@ -182,8 +182,8 @@ namespace Physic
|
|||
{
|
||||
btCollisionShape* mCompound;
|
||||
|
||||
// Maps bone name to child index in the compound shape
|
||||
std::map<std::string, int> mAnimatedShapes;
|
||||
// Maps node record index to child index in the compound shape
|
||||
std::map<int, int> mAnimatedShapes;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue