mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-20 01:21:15 +00:00
Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
commit
7cc1ebc05b
@ -104,6 +104,7 @@ namespace MWBase
|
|||||||
virtual void clear() = 0;
|
virtual void clear() = 0;
|
||||||
|
|
||||||
virtual int countSavedGameRecords() const = 0;
|
virtual int countSavedGameRecords() const = 0;
|
||||||
|
virtual int countSavedGameCells() const = 0;
|
||||||
|
|
||||||
virtual void write (ESM::ESMWriter& writer, Loading::Listener& listener) 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;
|
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()) {
|
if (!model.empty()) {
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr);
|
physics.addObject(ptr, model);
|
||||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -26,19 +26,17 @@ namespace MWClass
|
|||||||
return ptr.get<ESM::Apparatus>()->mBase->mId;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Apparatus::getModel(const MWWorld::Ptr &ptr) const
|
std::string Apparatus::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -18,10 +18,10 @@ namespace MWClass
|
|||||||
|
|
||||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -31,19 +31,17 @@ namespace MWClass
|
|||||||
return ptr.get<ESM::Armor>()->mBase->mId;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Armor::getModel(const MWWorld::Ptr &ptr) const
|
std::string Armor::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -17,10 +17,10 @@ namespace MWClass
|
|||||||
|
|
||||||
virtual float getWeight (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -28,19 +28,17 @@ namespace MWClass
|
|||||||
return ptr.get<ESM::Book>()->mBase->mId;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Book::getModel(const MWWorld::Ptr &ptr) const
|
std::string Book::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -28,19 +28,17 @@ namespace MWClass
|
|||||||
return ptr.get<ESM::Clothing>()->mBase->mId;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Clothing::getModel(const MWWorld::Ptr &ptr) const
|
std::string Clothing::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -85,20 +85,18 @@ namespace MWClass
|
|||||||
store.restock(list, ptr, ptr.getCellRef().getOwner(), ptr.getCellRef().getFaction(), ptr.getCellRef().getFactionRank());
|
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()) {
|
if (!model.empty()) {
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr);
|
physics.addObject(ptr, model);
|
||||||
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -160,20 +160,19 @@ namespace MWClass
|
|||||||
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
|
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>();
|
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||||
|
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
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())
|
if(!model.empty())
|
||||||
{
|
{
|
||||||
physics.addActor(ptr);
|
physics.addActor(ptr, model);
|
||||||
if (getCreatureStats(ptr).isDead())
|
if (getCreatureStats(ptr).isDead())
|
||||||
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,10 @@ namespace MWClass
|
|||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return ID of \a ptr
|
///< 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
|
///< 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;
|
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
||||||
///< Adjust position to stand on ground. Must be called post model load
|
///< 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;
|
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()) {
|
if (!model.empty()) {
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr);
|
physics.addObject(ptr, model);
|
||||||
|
|
||||||
// Resume the door's opening/closing animation if it wasn't finished
|
// Resume the door's opening/closing animation if it wasn't finished
|
||||||
if (ptr.getRefData().getCustomData())
|
if (ptr.getRefData().getCustomData())
|
||||||
|
@ -19,10 +19,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -32,19 +32,17 @@ namespace MWClass
|
|||||||
return ref->mBase->mId;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Ingredient::getModel(const MWWorld::Ptr &ptr) const
|
std::string Ingredient::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return ID of \a ptr
|
///< 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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -54,26 +54,24 @@ namespace MWClass
|
|||||||
return ptr.get<ESM::Light>()->mBase->mId;
|
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 =
|
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
// Insert even if model is empty, so that the light is added
|
// Insert even if model is empty, so that the light is added
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
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 =
|
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
assert (ref->mBase != NULL);
|
assert (ref->mBase != NULL);
|
||||||
|
|
||||||
const std::string &model = ref->mBase->mModel;
|
|
||||||
|
|
||||||
if(!model.empty())
|
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))
|
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,
|
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
|
||||||
|
@ -17,10 +17,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -27,19 +27,17 @@ namespace MWClass
|
|||||||
return ptr.get<ESM::Lockpick>()->mBase->mId;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const
|
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -43,19 +43,17 @@ namespace MWClass
|
|||||||
return ptr.get<ESM::Miscellaneous>()->mBase->mId;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Miscellaneous::getModel(const MWWorld::Ptr &ptr) const
|
std::string Miscellaneous::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -428,14 +428,14 @@ namespace MWClass
|
|||||||
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
|
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);
|
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);
|
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||||
if (getCreatureStats(ptr).isDead())
|
if (getCreatureStats(ptr).isDead())
|
||||||
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
MWBase::Environment::get().getWorld()->enableActorCollision(ptr, false);
|
||||||
|
@ -50,10 +50,10 @@ namespace MWClass
|
|||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return ID of \a ptr
|
///< 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
|
///< 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;
|
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
||||||
///< Adjust position to stand on ground. Must be called post model load
|
///< 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;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Potion::getModel(const MWWorld::Ptr &ptr) const
|
std::string Potion::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -27,19 +27,17 @@ namespace MWClass
|
|||||||
return ptr.get<ESM::Probe>()->mBase->mId;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Probe::getModel(const MWWorld::Ptr &ptr) const
|
std::string Probe::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -26,19 +26,17 @@ namespace MWClass
|
|||||||
return ptr.get<ESM::Repair>()->mBase->mId;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Repair::getModel(const MWWorld::Ptr &ptr) const
|
std::string Repair::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -17,22 +17,20 @@ namespace MWClass
|
|||||||
return ptr.get<ESM::Static>()->mBase->mId;
|
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 =
|
MWWorld::LiveCellRef<ESM::Static> *ref =
|
||||||
ptr.get<ESM::Static>();
|
ptr.get<ESM::Static>();
|
||||||
|
|
||||||
const std::string model = getModel(ptr);
|
|
||||||
if (!model.empty()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model, !ref->mBase->mPersistent);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr);
|
physics.addObject(ptr, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Static::getModel(const MWWorld::Ptr &ptr) const
|
std::string Static::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||||||
/// Return ID of \a ptr
|
/// Return ID of \a ptr
|
||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -30,19 +30,17 @@ namespace MWClass
|
|||||||
return ref->mBase->mId;
|
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()) {
|
if (!model.empty()) {
|
||||||
renderingInterface.getObjects().insertModel(ptr, model);
|
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())
|
if(!model.empty())
|
||||||
physics.addObject(ptr,true);
|
physics.addObject(ptr, model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Weapon::getModel(const MWWorld::Ptr &ptr) const
|
std::string Weapon::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
@ -15,10 +15,10 @@ namespace MWClass
|
|||||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
///< Return ID of \a ptr
|
///< 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
|
///< 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;
|
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
||||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
|
@ -645,7 +645,6 @@ namespace MWDialogue
|
|||||||
writer.startRecord (ESM::REC_DIAS);
|
writer.startRecord (ESM::REC_DIAS);
|
||||||
state.save (writer);
|
state.save (writer);
|
||||||
writer.endRecord (ESM::REC_DIAS);
|
writer.endRecord (ESM::REC_DIAS);
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::readRecord (ESM::ESMReader& reader, int32_t type)
|
void DialogueManager::readRecord (ESM::ESMReader& reader, int32_t type)
|
||||||
|
@ -187,7 +187,6 @@ namespace MWDialogue
|
|||||||
writer.startRecord (ESM::REC_QUES);
|
writer.startRecord (ESM::REC_QUES);
|
||||||
state.save (writer);
|
state.save (writer);
|
||||||
writer.endRecord (ESM::REC_QUES);
|
writer.endRecord (ESM::REC_QUES);
|
||||||
progress.increaseProgress();
|
|
||||||
|
|
||||||
for (Topic::TEntryIter iter (quest.begin()); iter!=quest.end(); ++iter)
|
for (Topic::TEntryIter iter (quest.begin()); iter!=quest.end(); ++iter)
|
||||||
{
|
{
|
||||||
@ -198,7 +197,6 @@ namespace MWDialogue
|
|||||||
writer.startRecord (ESM::REC_JOUR);
|
writer.startRecord (ESM::REC_JOUR);
|
||||||
entry.save (writer);
|
entry.save (writer);
|
||||||
writer.endRecord (ESM::REC_JOUR);
|
writer.endRecord (ESM::REC_JOUR);
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +208,6 @@ namespace MWDialogue
|
|||||||
writer.startRecord (ESM::REC_JOUR);
|
writer.startRecord (ESM::REC_JOUR);
|
||||||
entry.save (writer);
|
entry.save (writer);
|
||||||
writer.endRecord (ESM::REC_JOUR);
|
writer.endRecord (ESM::REC_JOUR);
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TTopicIter iter (mTopics.begin()); iter!=mTopics.end(); ++iter)
|
for (TTopicIter iter (mTopics.begin()); iter!=mTopics.end(); ++iter)
|
||||||
@ -226,7 +223,6 @@ namespace MWDialogue
|
|||||||
writer.startRecord (ESM::REC_JOUR);
|
writer.startRecord (ESM::REC_JOUR);
|
||||||
entry.save (writer);
|
entry.save (writer);
|
||||||
writer.endRecord (ESM::REC_JOUR);
|
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)
|
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)
|
if (!unique)
|
||||||
for (Styles::iterator i = mBook->mStyles.begin (); i != mBook->mStyles.end (); ++i)
|
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);
|
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)
|
intptr_t addContent (Utf8Span text, bool select)
|
||||||
@ -295,7 +295,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||||||
Utf8Point begin_ = &mCurrentContent->front () + begin;
|
Utf8Point begin_ = &mCurrentContent->front () + begin;
|
||||||
Utf8Point end_ = &mCurrentContent->front () + end ;
|
Utf8Point end_ = &mCurrentContent->front () + end ;
|
||||||
|
|
||||||
writeImpl (dynamic_cast <StyleImpl*> (style), begin_, end_);
|
writeImpl (static_cast <StyleImpl*> (style), begin_, end_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lineBreak (float margin)
|
void lineBreak (float margin)
|
||||||
|
@ -903,7 +903,6 @@ namespace MWGui
|
|||||||
writer.startRecord(ESM::REC_GMAP);
|
writer.startRecord(ESM::REC_GMAP);
|
||||||
map.save(writer);
|
map.save(writer);
|
||||||
writer.endRecord(ESM::REC_GMAP);
|
writer.endRecord(ESM::REC_GMAP);
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::readRecord(ESM::ESMReader &reader, int32_t type)
|
void MapWindow::readRecord(ESM::ESMReader &reader, int32_t type)
|
||||||
|
@ -36,6 +36,18 @@ namespace
|
|||||||
return gmst.find(ESM::MagicEffect::effectIdToString (id1))->getString()
|
return gmst.find(ESM::MagicEffect::effectIdToString (id1))->getString()
|
||||||
< gmst.find(ESM::MagicEffect::effectIdToString (id2))->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
|
namespace MWGui
|
||||||
@ -47,6 +59,9 @@ namespace MWGui
|
|||||||
, mMagicEffect(NULL)
|
, mMagicEffect(NULL)
|
||||||
, mConstantEffect(false)
|
, mConstantEffect(false)
|
||||||
{
|
{
|
||||||
|
init(mEffect);
|
||||||
|
init(mOldEffect);
|
||||||
|
|
||||||
getWidget(mCancelButton, "CancelButton");
|
getWidget(mCancelButton, "CancelButton");
|
||||||
getWidget(mOkButton, "OkButton");
|
getWidget(mOkButton, "OkButton");
|
||||||
getWidget(mDeleteButton, "DeleteButton");
|
getWidget(mDeleteButton, "DeleteButton");
|
||||||
|
@ -1604,14 +1604,12 @@ namespace MWGui
|
|||||||
mMap->write(writer, progress);
|
mMap->write(writer, progress);
|
||||||
|
|
||||||
mQuickKeysMenu->write(writer);
|
mQuickKeysMenu->write(writer);
|
||||||
progress.increaseProgress();
|
|
||||||
|
|
||||||
if (!mSelectedSpell.empty())
|
if (!mSelectedSpell.empty())
|
||||||
{
|
{
|
||||||
writer.startRecord(ESM::REC_ASPL);
|
writer.startRecord(ESM::REC_ASPL);
|
||||||
writer.writeHNString("ID__", mSelectedSpell);
|
writer.writeHNString("ID__", mSelectedSpell);
|
||||||
writer.endRecord(ESM::REC_ASPL);
|
writer.endRecord(ESM::REC_ASPL);
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<CustomMarker>::const_iterator it = mCustomMarkers.begin(); it != mCustomMarkers.end(); ++it)
|
for (std::vector<CustomMarker>::const_iterator it = mCustomMarkers.begin(); it != mCustomMarkers.end(); ++it)
|
||||||
@ -1619,7 +1617,6 @@ namespace MWGui
|
|||||||
writer.startRecord(ESM::REC_MARK);
|
writer.startRecord(ESM::REC_MARK);
|
||||||
(*it).save(writer);
|
(*it).save(writer);
|
||||||
writer.endRecord(ESM::REC_MARK);
|
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)
|
bool grab = !MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu)
|
||||||
&& MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console;
|
&& MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console;
|
||||||
|
|
||||||
@ -337,6 +323,28 @@ namespace MWInput
|
|||||||
{
|
{
|
||||||
mInputManager->warpMouse(mMouseX, mMouseY);
|
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
|
// Disable movement in Gui mode
|
||||||
if (!(MWBase::Environment::get().getWindowManager()->isGuiMode()
|
if (!(MWBase::Environment::get().getWindowManager()->isGuiMode()
|
||||||
|
@ -176,6 +176,8 @@ namespace MWInput
|
|||||||
|
|
||||||
void setPlayerControlsEnabled(bool enabled);
|
void setPlayerControlsEnabled(bool enabled);
|
||||||
|
|
||||||
|
void updateCursorMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void toggleMainMenu();
|
void toggleMainMenu();
|
||||||
void toggleSpell();
|
void toggleSpell();
|
||||||
|
@ -131,7 +131,7 @@ void adjustCommandedActor (const MWWorld::Ptr& actor)
|
|||||||
for (it = stats.getAiSequence().begin(); it != stats.getAiSequence().end(); ++it)
|
for (it = stats.getAiSequence().begin(); it != stats.getAiSequence().end(); ++it)
|
||||||
{
|
{
|
||||||
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow &&
|
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow &&
|
||||||
dynamic_cast<MWMechanics::AiFollow*>(*it)->isCommanded())
|
static_cast<MWMechanics::AiFollow*>(*it)->isCommanded())
|
||||||
{
|
{
|
||||||
hasCommandPackage = true;
|
hasCommandPackage = true;
|
||||||
break;
|
break;
|
||||||
@ -355,7 +355,7 @@ namespace MWMechanics
|
|||||||
{
|
{
|
||||||
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
|
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())
|
if (followTarget.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -1389,7 +1389,7 @@ namespace MWMechanics
|
|||||||
{
|
{
|
||||||
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
|
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())
|
if (followTarget.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
if (followTarget == actor)
|
if (followTarget == actor)
|
||||||
@ -1419,11 +1419,11 @@ namespace MWMechanics
|
|||||||
{
|
{
|
||||||
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
|
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())
|
if (followTarget.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
if (followTarget == actor)
|
if (followTarget == actor)
|
||||||
list.push_back(dynamic_cast<MWMechanics::AiFollow*>(*it)->getFollowIndex());
|
list.push_back(static_cast<MWMechanics::AiFollow*>(*it)->getFollowIndex());
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1460,8 +1460,6 @@ namespace MWMechanics
|
|||||||
writer.writeHNT ("COUN", it->second);
|
writer.writeHNT ("COUN", it->second);
|
||||||
}
|
}
|
||||||
writer.endRecord(ESM::REC_DCOU);
|
writer.endRecord(ESM::REC_DCOU);
|
||||||
|
|
||||||
listener.increaseProgress(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actors::readRecord (ESM::ESMReader& reader, int32_t type)
|
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:
|
case ESM::AiSequence::Ai_Wander:
|
||||||
{
|
{
|
||||||
MWMechanics::AiWander* wander = new AiWander(
|
MWMechanics::AiWander* wander = new AiWander(
|
||||||
dynamic_cast<ESM::AiSequence::AiWander*>(it->mPackage));
|
static_cast<ESM::AiSequence::AiWander*>(it->mPackage));
|
||||||
mPackages.push_back(wander);
|
mPackages.push_back(wander);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESM::AiSequence::Ai_Travel:
|
case ESM::AiSequence::Ai_Travel:
|
||||||
{
|
{
|
||||||
MWMechanics::AiTravel* travel = new AiTravel(
|
MWMechanics::AiTravel* travel = new AiTravel(
|
||||||
dynamic_cast<ESM::AiSequence::AiTravel*>(it->mPackage));
|
static_cast<ESM::AiSequence::AiTravel*>(it->mPackage));
|
||||||
mPackages.push_back(travel);
|
mPackages.push_back(travel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESM::AiSequence::Ai_Escort:
|
case ESM::AiSequence::Ai_Escort:
|
||||||
{
|
{
|
||||||
MWMechanics::AiEscort* escort = new AiEscort(
|
MWMechanics::AiEscort* escort = new AiEscort(
|
||||||
dynamic_cast<ESM::AiSequence::AiEscort*>(it->mPackage));
|
static_cast<ESM::AiSequence::AiEscort*>(it->mPackage));
|
||||||
mPackages.push_back(escort);
|
mPackages.push_back(escort);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESM::AiSequence::Ai_Follow:
|
case ESM::AiSequence::Ai_Follow:
|
||||||
{
|
{
|
||||||
MWMechanics::AiFollow* follow = new AiFollow(
|
MWMechanics::AiFollow* follow = new AiFollow(
|
||||||
dynamic_cast<ESM::AiSequence::AiFollow*>(it->mPackage));
|
static_cast<ESM::AiSequence::AiFollow*>(it->mPackage));
|
||||||
mPackages.push_back(follow);
|
mPackages.push_back(follow);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESM::AiSequence::Ai_Activate:
|
case ESM::AiSequence::Ai_Activate:
|
||||||
{
|
{
|
||||||
MWMechanics::AiActivate* activate = new AiActivate(
|
MWMechanics::AiActivate* activate = new AiActivate(
|
||||||
dynamic_cast<ESM::AiSequence::AiActivate*>(it->mPackage));
|
static_cast<ESM::AiSequence::AiActivate*>(it->mPackage));
|
||||||
mPackages.push_back(activate);
|
mPackages.push_back(activate);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESM::AiSequence::Ai_Combat:
|
case ESM::AiSequence::Ai_Combat:
|
||||||
{
|
{
|
||||||
MWMechanics::AiCombat* combat = new AiCombat(
|
MWMechanics::AiCombat* combat = new AiCombat(
|
||||||
dynamic_cast<ESM::AiSequence::AiCombat*>(it->mPackage));
|
static_cast<ESM::AiSequence::AiCombat*>(it->mPackage));
|
||||||
mPackages.push_back(combat);
|
mPackages.push_back(combat);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESM::AiSequence::Ai_Pursue:
|
case ESM::AiSequence::Ai_Pursue:
|
||||||
{
|
{
|
||||||
MWMechanics::AiPursue* pursue = new AiPursue(
|
MWMechanics::AiPursue* pursue = new AiPursue(
|
||||||
dynamic_cast<ESM::AiSequence::AiPursue*>(it->mPackage));
|
static_cast<ESM::AiSequence::AiPursue*>(it->mPackage));
|
||||||
mPackages.push_back(pursue);
|
mPackages.push_back(pursue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
#include "../mwbase/dialoguemanager.hpp"
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
@ -301,28 +302,32 @@ namespace MWMechanics
|
|||||||
playIdle(actor, playedIdle);
|
playIdle(actor, playedIdle);
|
||||||
chooseAction = false;
|
chooseAction = false;
|
||||||
idleNow = true;
|
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;
|
float& lastReaction = storage.mReaction;
|
||||||
lastReaction += duration;
|
lastReaction += duration;
|
||||||
if(lastReaction < REACTION_INTERVAL)
|
if(lastReaction < REACTION_INTERVAL)
|
||||||
@ -477,10 +482,8 @@ namespace MWMechanics
|
|||||||
|
|
||||||
if (greetingState == MWMechanics::AiWander::Greet_Done)
|
if (greetingState == MWMechanics::AiWander::Greet_Done)
|
||||||
{
|
{
|
||||||
static float fGreetDistanceReset = MWBase::Environment::get().getWorld()->getStore()
|
float resetDist = 2*helloDistance;
|
||||||
.get<ESM::GameSetting>().find("fGreetDistanceReset")->getFloat();
|
if (playerDistSqr >= resetDist*resetDist)
|
||||||
|
|
||||||
if (playerDistSqr >= fGreetDistanceReset*fGreetDistanceReset)
|
|
||||||
greetingState = Greet_None;
|
greetingState = Greet_None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1496,12 +1496,12 @@ void CharacterController::update(float duration)
|
|||||||
forcestateupdate = (mJumpState != JumpState_InAir);
|
forcestateupdate = (mJumpState != JumpState_InAir);
|
||||||
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();
|
static const float fJumpMoveBase = gmst.find("fJumpMoveBase")->getFloat();
|
||||||
|
static const float fJumpMoveMult = gmst.find("fJumpMoveMult")->getFloat();
|
||||||
vec.x *= fJumpMoveBase;
|
float factor = fJumpMoveBase + fJumpMoveMult * mPtr.getClass().getSkill(mPtr, ESM::Skill::Acrobatics)/100.f;
|
||||||
vec.y *= fJumpMoveBase;
|
factor = std::min(1.f, factor);
|
||||||
|
vec.x *= factor;
|
||||||
|
vec.y *= factor;
|
||||||
vec.z = 0.0f;
|
vec.z = 0.0f;
|
||||||
}
|
}
|
||||||
else if(vec.z > 0.0f && mJumpState == JumpState_None)
|
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)
|
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;
|
float baseCost = (store.get<ESM::MagicEffect>().find(it->mEffectID))->mData.mBaseCost;
|
||||||
// To reflect vanilla behavior
|
|
||||||
int magMin = (it->mMagnMin == 0) ? 1 : it->mMagnMin;
|
int magMin = (it->mMagnMin == 0) ? 1 : it->mMagnMin;
|
||||||
int magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax;
|
int magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax;
|
||||||
int area = (it->mArea == 0) ? 1 : it->mArea;
|
int area = (it->mArea == 0) ? 1 : it->mArea;
|
||||||
|
|
||||||
float magnitudeCost = 0;
|
float magnitudeCost = (magMin + magMax) * baseCost * 0.05;
|
||||||
if (mCastStyle == ESM::Enchantment::ConstantEffect)
|
if (mCastStyle == ESM::Enchantment::ConstantEffect)
|
||||||
{
|
{
|
||||||
magnitudeCost = (magMin + magMax) * baseCost * 2.5;
|
magnitudeCost *= store.get<ESM::GameSetting>().find("fEnchantmentConstantDurationMult")->getFloat();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
magnitudeCost = (magMin + magMax) * it->mDuration * baseCost * 0.025;
|
magnitudeCost *= it->mDuration;
|
||||||
if(it->mRange == ESM::RT_Target)
|
|
||||||
magnitudeCost *= 1.5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float areaCost = area * 0.025 * baseCost;
|
float areaCost = area * 0.05 * baseCost;
|
||||||
if (it->mRange == ESM::RT_Target)
|
|
||||||
areaCost *= 1.5;
|
|
||||||
|
|
||||||
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;
|
--effectsLeftCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,10 +5,6 @@
|
|||||||
|
|
||||||
#include <components/esm/loadacti.hpp>
|
#include <components/esm/loadacti.hpp>
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
|
||||||
|
|
||||||
#include "renderconst.hpp"
|
#include "renderconst.hpp"
|
||||||
|
|
||||||
namespace MWRender
|
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())
|
: Animation(ptr, ptr.getRefData().getBaseNode())
|
||||||
{
|
{
|
||||||
const std::string& model = mPtr.getClass().getModel(mPtr);
|
|
||||||
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
{
|
{
|
||||||
setObjectRoot(model, false);
|
setObjectRoot(model, false);
|
||||||
|
@ -13,7 +13,7 @@ namespace MWRender
|
|||||||
class ActivatorAnimation : public Animation
|
class ActivatorAnimation : public Animation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ActivatorAnimation(const MWWorld::Ptr& ptr);
|
ActivatorAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
||||||
virtual ~ActivatorAnimation();
|
virtual ~ActivatorAnimation();
|
||||||
|
|
||||||
void addLight(const ESM::Light *light);
|
void addLight(const ESM::Light *light);
|
||||||
|
@ -71,22 +71,22 @@ void Actors::insertNPC(const MWWorld::Ptr& ptr)
|
|||||||
mAllActors[ptr] = anim;
|
mAllActors[ptr] = anim;
|
||||||
mRendering->addWaterRippleEmitter (ptr);
|
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);
|
insertBegin(ptr);
|
||||||
Animation* anim = NULL;
|
Animation* anim = NULL;
|
||||||
if (weaponsShields)
|
if (weaponsShields)
|
||||||
anim = new CreatureWeaponAnimation(ptr);
|
anim = new CreatureWeaponAnimation(ptr, model);
|
||||||
else
|
else
|
||||||
anim = new CreatureAnimation(ptr);
|
anim = new CreatureAnimation(ptr, model);
|
||||||
delete mAllActors[ptr];
|
delete mAllActors[ptr];
|
||||||
mAllActors[ptr] = anim;
|
mAllActors[ptr] = anim;
|
||||||
mRendering->addWaterRippleEmitter (ptr);
|
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);
|
insertBegin(ptr);
|
||||||
ActivatorAnimation* anim = new ActivatorAnimation(ptr);
|
ActivatorAnimation* anim = new ActivatorAnimation(ptr, model);
|
||||||
|
|
||||||
if(ptr.getTypeName() == typeid(ESM::Light).name())
|
if(ptr.getTypeName() == typeid(ESM::Light).name())
|
||||||
{
|
{
|
||||||
|
@ -40,8 +40,8 @@ namespace MWRender
|
|||||||
void setRootNode(Ogre::SceneNode* root);
|
void setRootNode(Ogre::SceneNode* root);
|
||||||
|
|
||||||
void insertNPC(const MWWorld::Ptr& ptr);
|
void insertNPC(const MWWorld::Ptr& ptr);
|
||||||
void insertCreature (const MWWorld::Ptr& ptr, bool weaponsShields);
|
void insertCreature (const MWWorld::Ptr& ptr, const std::string& model, bool weaponsShields);
|
||||||
void insertActivator (const MWWorld::Ptr& ptr, bool addLight=false);
|
void insertActivator (const MWWorld::Ptr& ptr, const std::string& model, bool addLight=false);
|
||||||
bool deleteObject (const MWWorld::Ptr& ptr);
|
bool deleteObject (const MWWorld::Ptr& ptr);
|
||||||
///< \return found?
|
///< \return found?
|
||||||
|
|
||||||
|
@ -86,6 +86,12 @@ Animation::~Animation()
|
|||||||
mAnimSources.clear();
|
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)
|
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())
|
if(model.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string mdlname = Misc::StringUtils::lowerCase(model);
|
mObjectRoot = (!baseonly ? NifOgre::Loader::createObjects(mInsert, model) :
|
||||||
std::string::size_type p = mdlname.rfind('\\');
|
NifOgre::Loader::createObjectBase(mInsert, model));
|
||||||
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));
|
|
||||||
|
|
||||||
if(mObjectRoot->mSkelBase)
|
if(mObjectRoot->mSkelBase)
|
||||||
{
|
{
|
||||||
@ -255,14 +247,8 @@ void Animation::addAnimSource(const std::string &model)
|
|||||||
if(!mSkelBase)
|
if(!mSkelBase)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string kfname = Misc::StringUtils::lowerCase(model);
|
std::string kfname = model;
|
||||||
std::string::size_type p = kfname.rfind('\\');
|
Misc::StringUtils::toLower(kfname);
|
||||||
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');
|
|
||||||
|
|
||||||
if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0)
|
if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0)
|
||||||
kfname.replace(kfname.size()-4, 4, ".kf");
|
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)
|
if(mSkelBase)
|
||||||
{
|
{
|
||||||
@ -428,6 +414,16 @@ Ogre::Node *Animation::getNode(const std::string &name)
|
|||||||
return NULL;
|
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 Animation::findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname)
|
||||||
{
|
{
|
||||||
NifOgre::TextKeyMap::const_iterator iter(keys.begin());
|
NifOgre::TextKeyMap::const_iterator iter(keys.begin());
|
||||||
|
@ -206,6 +206,9 @@ public:
|
|||||||
Ogre::uint8 transqueue, Ogre::Real dist=0.0f,
|
Ogre::uint8 transqueue, Ogre::Real dist=0.0f,
|
||||||
bool enchantedGlow=false, Ogre::Vector3* glowColor=NULL);
|
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);
|
Animation(const MWWorld::Ptr &ptr, Ogre::SceneNode *node);
|
||||||
virtual ~Animation();
|
virtual ~Animation();
|
||||||
@ -334,6 +337,7 @@ public:
|
|||||||
Ogre::AxisAlignedBox getWorldBounds();
|
Ogre::AxisAlignedBox getWorldBounds();
|
||||||
|
|
||||||
Ogre::Node *getNode(const std::string &name);
|
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
|
// 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
|
// 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())
|
: Animation(ptr, ptr.getRefData().getBaseNode())
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
||||||
|
|
||||||
std::string model = ptr.getClass().getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
{
|
{
|
||||||
setObjectRoot(model, false);
|
setObjectRoot(model, false);
|
||||||
setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
|
setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
|
||||||
|
|
||||||
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
||||||
addAnimSource("meshes\\base_anim.nif");
|
addAnimSource("meshes\\xbase_anim.nif");
|
||||||
addAnimSource(model);
|
addAnimSource(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr)
|
CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const std::string& model)
|
||||||
: Animation(ptr, ptr.getRefData().getBaseNode())
|
: Animation(ptr, ptr.getRefData().getBaseNode())
|
||||||
, mShowWeapons(false)
|
, mShowWeapons(false)
|
||||||
, mShowCarriedLeft(false)
|
, mShowCarriedLeft(false)
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
||||||
|
|
||||||
std::string model = ptr.getClass().getModel(ptr);
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
{
|
{
|
||||||
setObjectRoot(model, false);
|
setObjectRoot(model, false);
|
||||||
setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
|
setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
|
||||||
|
|
||||||
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
if((ref->mBase->mFlags&ESM::Creature::Bipedal))
|
||||||
addAnimSource("meshes\\base_anim.nif");
|
addAnimSource("meshes\\xbase_anim.nif");
|
||||||
addAnimSource(model);
|
addAnimSource(model);
|
||||||
|
|
||||||
mPtr.getClass().getInventoryStore(mPtr).setListener(this, mPtr);
|
mPtr.getClass().getInventoryStore(mPtr).setListener(this, mPtr);
|
||||||
|
@ -15,7 +15,7 @@ namespace MWRender
|
|||||||
class CreatureAnimation : public Animation
|
class CreatureAnimation : public Animation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CreatureAnimation(const MWWorld::Ptr& ptr);
|
CreatureAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
||||||
virtual ~CreatureAnimation() {}
|
virtual ~CreatureAnimation() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ namespace MWRender
|
|||||||
class CreatureWeaponAnimation : public Animation, public WeaponAnimation, public MWWorld::InventoryStoreListener
|
class CreatureWeaponAnimation : public Animation, public WeaponAnimation, public MWWorld::InventoryStoreListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CreatureWeaponAnimation(const MWWorld::Ptr& ptr);
|
CreatureWeaponAnimation(const MWWorld::Ptr& ptr, const std::string &model);
|
||||||
virtual ~CreatureWeaponAnimation() {}
|
virtual ~CreatureWeaponAnimation() {}
|
||||||
|
|
||||||
virtual void equipmentChanged() { updateParts(); }
|
virtual void equipmentChanged() { updateParts(); }
|
||||||
|
@ -157,7 +157,6 @@ namespace MWRender
|
|||||||
data[texelY * mWidth * 3 + texelX * 3+2] = b;
|
data[texelY * mWidth * 3 + texelX * 3+2] = b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadingListener->increaseProgress(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +245,7 @@ namespace MWRender
|
|||||||
|
|
||||||
void GlobalMap::loadResource(Ogre::Resource *resource)
|
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;
|
Ogre::ConstImagePtrList list;
|
||||||
list.push_back(&mOverlayImage);
|
list.push_back(&mOverlayImage);
|
||||||
tex->_loadImages(list);
|
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.
|
// Get the cell's NorthMarker rotation. This is used to rotate the entire map.
|
||||||
const Vector2& north = MWBase::Environment::get().getWorld()->getNorthVector(cell);
|
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();
|
mAngle = angle.valueRadians();
|
||||||
|
|
||||||
// Rotate the cell and merge the rotated corners to the bounding box
|
// 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];
|
std::vector<uint32>& buffer = mBuffers[resourceName];
|
||||||
|
|
||||||
Ogre::Texture* tex = dynamic_cast<Ogre::Texture*>(resource);
|
Ogre::Texture* tex = static_cast<Ogre::Texture*>(resource);
|
||||||
tex->createInternalResources();
|
tex->createInternalResources();
|
||||||
memcpy(tex->getBuffer()->lock(HardwareBuffer::HBL_DISCARD), &buffer[0], sFogOfWarResolution*sFogOfWarResolution*4);
|
memcpy(tex->getBuffer()->lock(HardwareBuffer::HBL_DISCARD), &buffer[0], sFogOfWarResolution*sFogOfWarResolution*4);
|
||||||
tex->getBuffer()->unlock();
|
tex->getBuffer()->unlock();
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
#include <extern/shiny/Main/Factory.hpp>
|
#include <extern/shiny/Main/Factory.hpp>
|
||||||
|
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
@ -282,6 +284,7 @@ void NpcAnimation::updateNpcBase()
|
|||||||
(!isWerewolf ? !isBeast ? "meshes\\base_anim.1st.nif"
|
(!isWerewolf ? !isBeast ? "meshes\\base_anim.1st.nif"
|
||||||
: "meshes\\base_animkna.1st.nif"
|
: "meshes\\base_animkna.1st.nif"
|
||||||
: "meshes\\wolf\\skin.1st.nif");
|
: "meshes\\wolf\\skin.1st.nif");
|
||||||
|
smodel = Misc::ResourceHelpers::correctActorModelPath(smodel);
|
||||||
setObjectRoot(smodel, true);
|
setObjectRoot(smodel, true);
|
||||||
|
|
||||||
if(mViewMode != VM_FirstPerson)
|
if(mViewMode != VM_FirstPerson)
|
||||||
@ -290,11 +293,11 @@ void NpcAnimation::updateNpcBase()
|
|||||||
if(!isWerewolf)
|
if(!isWerewolf)
|
||||||
{
|
{
|
||||||
if(Misc::StringUtils::lowerCase(mNpc->mRace).find("argonian") != std::string::npos)
|
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)
|
else if(!mNpc->isMale() && !isBeast)
|
||||||
addAnimSource("meshes\\base_anim_female.nif");
|
addAnimSource("meshes\\xbase_anim_female.nif");
|
||||||
if(mNpc->mModel.length() > 0)
|
if(mNpc->mModel.length() > 0)
|
||||||
addAnimSource("meshes\\"+mNpc->mModel);
|
addAnimSource("meshes\\x"+mNpc->mModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -306,11 +309,11 @@ void NpcAnimation::updateNpcBase()
|
|||||||
/* A bit counter-intuitive, but unlike third-person anims, it seems
|
/* A bit counter-intuitive, but unlike third-person anims, it seems
|
||||||
* beast races get both base_anim.1st.nif and base_animkna.1st.nif.
|
* 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)
|
if(isBeast)
|
||||||
addAnimSource("meshes\\base_animkna.1st.nif");
|
addAnimSource("meshes\\xbase_animkna.1st.nif");
|
||||||
if(!mNpc->isMale() && !isBeast)
|
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);
|
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_ =
|
const MWWorld::Class& class_ =
|
||||||
ptr.getClass();
|
ptr.getClass();
|
||||||
class_.insertObjectRendering(ptr, *this);
|
class_.insertObjectRendering(ptr, model, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::removeObject (const MWWorld::Ptr& ptr)
|
void RenderingManager::removeObject (const MWWorld::Ptr& ptr)
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
/// Write current fog of war for this cell to the CellStore
|
/// Write current fog of war for this cell to the CellStore
|
||||||
void writeFog (MWWorld::CellStore* store);
|
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 removeObject (const MWWorld::Ptr& ptr);
|
||||||
|
|
||||||
void moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position);
|
void moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position);
|
||||||
|
@ -142,7 +142,6 @@ namespace MWScript
|
|||||||
writer.startRecord (ESM::REC_GSCR);
|
writer.startRecord (ESM::REC_GSCR);
|
||||||
script.save (writer);
|
script.save (writer);
|
||||||
writer.endRecord (ESM::REC_GSCR);
|
writer.endRecord (ESM::REC_GSCR);
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1042,6 +1042,7 @@ namespace MWScript
|
|||||||
std::vector<std::string> contentFiles = MWBase::Environment::get().getWorld()->getContentFiles();
|
std::vector<std::string> contentFiles = MWBase::Environment::get().getWorld()->getContentFiles();
|
||||||
|
|
||||||
msg << contentFiles.at (ptr.getCellRef().getRefNum().mContentFile) << std::endl;
|
msg << contentFiles.at (ptr.getCellRef().getRefNum().mContentFile) << std::endl;
|
||||||
|
msg << "RefNum: " << ptr.getCellRef().getRefNum().mIndex << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg << "RefID: " << ptr.getCellRef().getRefId() << 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);
|
writer.save (stream);
|
||||||
|
|
||||||
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
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}");
|
listener.setLabel("#{sNotifyMessage4}");
|
||||||
|
|
||||||
Loading::ScopedLoad load(&listener);
|
Loading::ScopedLoad load(&listener);
|
||||||
@ -229,7 +230,6 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
|||||||
writer.startRecord (ESM::REC_SAVE);
|
writer.startRecord (ESM::REC_SAVE);
|
||||||
slot->mProfile.save (writer);
|
slot->mProfile.save (writer);
|
||||||
writer.endRecord (ESM::REC_SAVE);
|
writer.endRecord (ESM::REC_SAVE);
|
||||||
listener.increaseProgress();
|
|
||||||
|
|
||||||
MWBase::Environment::get().getJournal()->write (writer, listener);
|
MWBase::Environment::get().getJournal()->write (writer, listener);
|
||||||
MWBase::Environment::get().getDialogueManager()->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();
|
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||||
|
|
||||||
listener.setProgressRange(reader.getRecordCount());
|
listener.setProgressRange(100);
|
||||||
listener.setLabel("#{sLoadingMessage14}");
|
listener.setLabel("#{sLoadingMessage14}");
|
||||||
|
|
||||||
Loading::ScopedLoad load(&listener);
|
Loading::ScopedLoad load(&listener);
|
||||||
|
|
||||||
|
bool firstPersonCam = false;
|
||||||
|
|
||||||
|
size_t total = reader.getFileSize();
|
||||||
|
int currentPercent = 0;
|
||||||
while (reader.hasMoreRecs())
|
while (reader.hasMoreRecs())
|
||||||
{
|
{
|
||||||
ESM::NAME n = reader.getRecName();
|
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_ENAB:
|
||||||
case ESM::REC_LEVC:
|
case ESM::REC_LEVC:
|
||||||
case ESM::REC_LEVI:
|
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;
|
break;
|
||||||
|
|
||||||
case ESM::REC_GSCR:
|
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;
|
std::cerr << "Ignoring unknown record: " << n.name << std::endl;
|
||||||
reader.skipRecord();
|
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);
|
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().getWindowManager()->updatePlayer();
|
||||||
MWBase::Environment::get().getMechanicsManager()->playerLoaded();
|
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();
|
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
|
|
||||||
ESM::CellId cellId = ptr.getCell()->getCell()->getCellId();
|
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
|
// 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);
|
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.
|
// but some mods may be using it as a reload detector.
|
||||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
|
||||||
|
|
||||||
@ -472,8 +486,11 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||||||
void MWState::StateManager::quickLoad()
|
void MWState::StateManager::quickLoad()
|
||||||
{
|
{
|
||||||
if (Character* mCurrentCharacter = getCurrentCharacter (false))
|
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)
|
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)
|
if (std::find(selectedContentFiles.begin(), selectedContentFiles.end(), *it)
|
||||||
== selectedContentFiles.end())
|
== selectedContentFiles.end())
|
||||||
{
|
{
|
||||||
|
std::cerr << "Savegame dependency " << *it << " is missing." << std::endl;
|
||||||
notFound = true;
|
notFound = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (notFound)
|
if (notFound)
|
||||||
|
@ -37,7 +37,11 @@ namespace MWWorld
|
|||||||
getFollowers(actor, followers);
|
getFollowers(actor, followers);
|
||||||
for(std::set<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
|
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);
|
teleport(actor);
|
||||||
|
@ -287,7 +287,7 @@ void MWWorld::Cells::write (ESM::ESMWriter& writer, Loading::Listener& progress)
|
|||||||
if (iter->second.hasState())
|
if (iter->second.hasState())
|
||||||
{
|
{
|
||||||
writeCell (writer, iter->second);
|
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());
|
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())
|
if (iter->second.hasState())
|
||||||
{
|
{
|
||||||
writeCell (writer, iter->second);
|
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");
|
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
|
///< Return ID of \a ptr or throw an exception, if class does not support ID retrieval
|
||||||
/// (default implementation: throw an exception)
|
/// (default implementation: throw an exception)
|
||||||
|
|
||||||
virtual void insertObjectRendering (const Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
virtual void insertObjectRendering (const Ptr& ptr, const std::string& mesh, MWRender::RenderingInterface& renderingInterface) const;
|
||||||
virtual void insertObject(const Ptr& ptr, MWWorld::PhysicsSystem& physics) 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).
|
///< Add reference into a cell for rendering (default implementation: don't render anything).
|
||||||
|
|
||||||
virtual std::string getName (const Ptr& ptr) const = 0;
|
virtual std::string getName (const Ptr& ptr) const = 0;
|
||||||
|
@ -161,7 +161,6 @@ void ESMStore::setUp()
|
|||||||
writer.writeT(mDynamicCount);
|
writer.writeT(mDynamicCount);
|
||||||
writer.endRecord("COUN");
|
writer.endRecord("COUN");
|
||||||
writer.endRecord(ESM::REC_DYNA);
|
writer.endRecord(ESM::REC_DYNA);
|
||||||
progress.increaseProgress();
|
|
||||||
|
|
||||||
mPotions.write (writer, progress);
|
mPotions.write (writer, progress);
|
||||||
mArmors.write (writer, progress);
|
mArmors.write (writer, progress);
|
||||||
|
@ -85,7 +85,6 @@ namespace MWWorld
|
|||||||
writer.writeHNString ("NAME", iter->first);
|
writer.writeHNString ("NAME", iter->first);
|
||||||
iter->second.write (writer, ESM::Variant::Format_Global);
|
iter->second.write (writer, ESM::Variant::Format_Global);
|
||||||
writer.endRecord (ESM::REC_GLOB);
|
writer.endRecord (ESM::REC_GLOB);
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
#include <openengine/bullet/BulletShapeLoader.h>
|
#include <openengine/bullet/BulletShapeLoader.h>
|
||||||
|
|
||||||
#include <components/nifbullet/bulletnifloader.hpp>
|
#include <components/nifbullet/bulletnifloader.hpp>
|
||||||
|
#include <components/nifogre/skeleton.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include <components/esm/loadgmst.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");
|
throw std::runtime_error("can't find Ptr");
|
||||||
|
|
||||||
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(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
|
if (!animation)
|
||||||
throw std::runtime_error("can't find Animation for " + ptr.getCellRef().getRefId());
|
continue;
|
||||||
|
|
||||||
OEngine::Physic::AnimatedShapeInstance& instance = it->second;
|
OEngine::Physic::AnimatedShapeInstance& instance = it->second;
|
||||||
|
|
||||||
std::map<std::string, int>& shapes = instance.mAnimatedShapes;
|
std::map<int, int>& shapes = instance.mAnimatedShapes;
|
||||||
for (std::map<std::string, int>::iterator shapeIt = shapes.begin();
|
for (std::map<int, int>::iterator shapeIt = shapes.begin();
|
||||||
shapeIt != shapes.end(); ++shapeIt)
|
shapeIt != shapes.end(); ++shapeIt)
|
||||||
{
|
{
|
||||||
|
|
||||||
Ogre::Node* bone;
|
const std::string& mesh = animation->getObjectRootName();
|
||||||
if (shapeIt->first.empty())
|
int boneHandle = NifOgre::NIFSkeletonLoader::lookupOgreBoneHandle(mesh, shapeIt->first);
|
||||||
// HACK: see NifSkeletonLoader::buildBones
|
Ogre::Node* bone = animation->getNode(boneHandle);
|
||||||
bone = animation->getNode(" ");
|
|
||||||
else
|
|
||||||
bone = animation->getNode(shapeIt->first);
|
|
||||||
|
|
||||||
if (bone == NULL)
|
if (bone == NULL)
|
||||||
throw std::runtime_error("can't find bone");
|
continue;
|
||||||
|
|
||||||
btCompoundShape* compound = dynamic_cast<btCompoundShape*>(instance.mCompound);
|
btCompoundShape* compound = dynamic_cast<btCompoundShape*>(instance.mCompound);
|
||||||
|
|
||||||
@ -290,7 +289,7 @@ namespace MWWorld
|
|||||||
|
|
||||||
// Reset per-frame data
|
// Reset per-frame data
|
||||||
physicActor->setWalkingOnWater(false);
|
physicActor->setWalkingOnWater(false);
|
||||||
/* Anything to collide with? */
|
// Anything to collide with?
|
||||||
if(!physicActor->getCollisionMode())
|
if(!physicActor->getCollisionMode())
|
||||||
{
|
{
|
||||||
return position + (Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z) *
|
return position + (Ogre::Quaternion(Ogre::Radian(refpos.rot[2]), Ogre::Vector3::NEGATIVE_UNIT_Z) *
|
||||||
@ -318,12 +317,11 @@ namespace MWWorld
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
OEngine::Physic::ActorTracer tracer;
|
OEngine::Physic::ActorTracer tracer;
|
||||||
Ogre::Vector3 inertia(0.0f);
|
Ogre::Vector3 inertia = physicActor->getInertialForce();
|
||||||
Ogre::Vector3 velocity;
|
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)*
|
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;
|
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;
|
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 (velocity.z > 0.f)
|
||||||
if(!physicActor->getOnGround()) // if current OnGround status is false, must be falling or jumping
|
inertia = velocity;
|
||||||
|
if(!physicActor->getOnGround())
|
||||||
{
|
{
|
||||||
// If falling or jumping up, add part of the incoming velocity with the current inertia,
|
velocity = velocity + physicActor->getInertialForce();
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
inertia = velocity; // NOTE: velocity is for z axis only in this code block
|
|
||||||
}
|
}
|
||||||
ptr.getClass().getMovementSettings(ptr).mPosition[2] = 0;
|
ptr.getClass().getMovementSettings(ptr).mPosition[2] = 0;
|
||||||
|
|
||||||
@ -372,7 +357,6 @@ namespace MWWorld
|
|||||||
float remainingTime = time;
|
float remainingTime = time;
|
||||||
for(int iterations = 0; iterations < sMaxIterations && remainingTime > 0.01f; ++iterations)
|
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;
|
Ogre::Vector3 nextpos = newPosition + velocity * remainingTime;
|
||||||
|
|
||||||
// If not able to fly, don't allow to swim up into the air
|
// 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.
|
// 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 (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;
|
btVector3 aabbMin, aabbMax;
|
||||||
tracer.mHitObject->getCollisionShape()->getAabb(tracer.mHitObject->getWorldTransform(), aabbMin, aabbMax);
|
tracer.mHitObject->getCollisionShape()->getAabb(tracer.mHitObject->getWorldTransform(), aabbMin, aabbMax);
|
||||||
@ -509,7 +493,7 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
physicActor->setOnGround(isOnGround);
|
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;
|
return newPosition;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -689,9 +673,8 @@ namespace MWWorld
|
|||||||
mEngine->removeHeightField(x, y);
|
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();
|
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||||
handleToMesh[node->getName()] = mesh;
|
handleToMesh[node->getName()] = mesh;
|
||||||
mEngine->createAndAdjustRigidBody(
|
mEngine->createAndAdjustRigidBody(
|
||||||
@ -700,9 +683,8 @@ namespace MWWorld
|
|||||||
mesh, node->getName(), ptr.getCellRef().getScale(), node->getPosition(), node->getOrientation(), 0, 0, true, placeable);
|
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();
|
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||||
//TODO:optimize this. Searching the std::map isn't very efficient i think.
|
//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());
|
mEngine->addCharacter(node->getName(), mesh, node->getPosition(), node->getScale().x, node->getOrientation());
|
||||||
@ -773,13 +755,16 @@ namespace MWWorld
|
|||||||
const std::string &handle = node->getName();
|
const std::string &handle = node->getName();
|
||||||
if(handleToMesh.find(handle) != handleToMesh.end())
|
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;
|
bool placeable = false;
|
||||||
if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle,true))
|
if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle,true))
|
||||||
placeable = body->mPlaceable;
|
placeable = body->mPlaceable;
|
||||||
else if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle,false))
|
else if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle,false))
|
||||||
placeable = body->mPlaceable;
|
placeable = body->mPlaceable;
|
||||||
removeObject(handle);
|
removeObject(handle);
|
||||||
addObject(ptr, placeable);
|
addObject(ptr, model, placeable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OEngine::Physic::PhysicActor* act = mEngine->getCharacter(handle))
|
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)
|
bool PhysicsSystem::getObjectAABB(const MWWorld::Ptr &ptr, Ogre::Vector3 &min, Ogre::Vector3 &max)
|
||||||
{
|
{
|
||||||
std::string model = ptr.getClass().getModel(ptr);
|
std::string model = ptr.getClass().getModel(ptr);
|
||||||
|
model = Misc::ResourceHelpers::correctActorModelPath(model);
|
||||||
if (model.empty()) {
|
if (model.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,9 @@ namespace MWWorld
|
|||||||
void setWaterHeight(float height);
|
void setWaterHeight(float height);
|
||||||
void disableWater();
|
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,
|
void addHeightField (float* heights,
|
||||||
int x, int y, float yoffset,
|
int x, int y, float yoffset,
|
||||||
|
@ -225,8 +225,6 @@ namespace MWWorld
|
|||||||
writer.startRecord (ESM::REC_PLAY);
|
writer.startRecord (ESM::REC_PLAY);
|
||||||
player.save (writer);
|
player.save (writer);
|
||||||
writer.endRecord (ESM::REC_PLAY);
|
writer.endRecord (ESM::REC_PLAY);
|
||||||
|
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::readRecord (ESM::ESMReader& reader, int32_t type)
|
bool Player::readRecord (ESM::ESMReader& reader, int32_t type)
|
||||||
|
@ -318,8 +318,6 @@ namespace MWWorld
|
|||||||
state.save(writer);
|
state.save(writer);
|
||||||
|
|
||||||
writer.endRecord(ESM::REC_PROJ);
|
writer.endRecord(ESM::REC_PROJ);
|
||||||
|
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<MagicBoltState>::const_iterator it = mMagicBolts.begin(); it != mMagicBolts.end(); ++it)
|
for (std::vector<MagicBoltState>::const_iterator it = mMagicBolts.begin(); it != mMagicBolts.end(); ++it)
|
||||||
@ -342,8 +340,6 @@ namespace MWWorld
|
|||||||
state.save(writer);
|
state.save(writer);
|
||||||
|
|
||||||
writer.endRecord(ESM::REC_MPRJ);
|
writer.endRecord(ESM::REC_MPRJ);
|
||||||
|
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <OgreSceneNode.h>
|
#include <OgreSceneNode.h>
|
||||||
|
|
||||||
#include <components/nif/niffile.hpp>
|
#include <components/nif/niffile.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
@ -79,8 +80,9 @@ namespace
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mRendering.addObject (ptr);
|
const std::string& model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
||||||
ptr.getClass().insertObject (ptr, mPhysics);
|
mRendering.addObject(ptr, model);
|
||||||
|
ptr.getClass().insertObject (ptr, model, mPhysics);
|
||||||
|
|
||||||
updateObjectLocalRotation(ptr, mPhysics, mRendering);
|
updateObjectLocalRotation(ptr, mPhysics, mRendering);
|
||||||
if (ptr.getRefData().getBaseNode())
|
if (ptr.getRefData().getBaseNode())
|
||||||
@ -486,8 +488,7 @@ namespace MWWorld
|
|||||||
// Sky system
|
// Sky system
|
||||||
MWBase::Environment::get().getWorld()->adjustSky();
|
MWBase::Environment::get().getWorld()->adjustSky();
|
||||||
|
|
||||||
mCellChanged = true;
|
mCellChanged = true; MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
||||||
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.5);
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
MWBase::Environment::get().getWindowManager()->changeCell(mCurrentCell);
|
||||||
|
|
||||||
@ -529,8 +530,9 @@ namespace MWWorld
|
|||||||
|
|
||||||
void Scene::addObjectToScene (const Ptr& ptr)
|
void Scene::addObjectToScene (const Ptr& ptr)
|
||||||
{
|
{
|
||||||
mRendering.addObject(ptr);
|
const std::string& model = Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getModel(ptr));
|
||||||
ptr.getClass().insertObject(ptr, *mPhysics);
|
mRendering.addObject(ptr, model);
|
||||||
|
ptr.getClass().insertObject (ptr, model, *mPhysics);
|
||||||
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0, 0, 0, true);
|
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0, 0, 0, true);
|
||||||
MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().getScale());
|
MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().getScale());
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,6 @@ namespace MWWorld
|
|||||||
writer.writeHNString ("NAME", iter->second.mId);
|
writer.writeHNString ("NAME", iter->second.mId);
|
||||||
iter->second.save (writer);
|
iter->second.save (writer);
|
||||||
writer.endRecord (T::sRecordId);
|
writer.endRecord (T::sRecordId);
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,7 +760,6 @@ void WeatherManager::write(ESM::ESMWriter& writer, Loading::Listener& progress)
|
|||||||
writer.startRecord(ESM::REC_WTHR);
|
writer.startRecord(ESM::REC_WTHR);
|
||||||
state.save(writer);
|
state.save(writer);
|
||||||
writer.endRecord(ESM::REC_WTHR);
|
writer.endRecord(ESM::REC_WTHR);
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WeatherManager::readRecord(ESM::ESMReader& reader, int32_t type)
|
bool WeatherManager::readRecord(ESM::ESMReader& reader, int32_t type)
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <components/files/collections.hpp>
|
#include <components/files/collections.hpp>
|
||||||
#include <components/compiler/locals.hpp>
|
#include <components/compiler/locals.hpp>
|
||||||
#include <components/esm/cellid.hpp>
|
#include <components/esm/cellid.hpp>
|
||||||
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
|
||||||
#include <boost/math/special_functions/sign.hpp>
|
#include <boost/math/special_functions/sign.hpp>
|
||||||
|
|
||||||
@ -309,6 +310,11 @@ namespace MWWorld
|
|||||||
+1; // camera
|
+1; // camera
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int World::countSavedGameCells() const
|
||||||
|
{
|
||||||
|
return mCells.countSavedGameRecords();
|
||||||
|
}
|
||||||
|
|
||||||
void World::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
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
|
// 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);
|
MWMechanics::CreatureStats::writeActorIdCounter(writer);
|
||||||
progress.increaseProgress();
|
|
||||||
|
|
||||||
mStore.write (writer, progress); // dynamic Store must be written (and read) before Cells, so that
|
mStore.write (writer, progress); // dynamic Store must be written (and read) before Cells, so that
|
||||||
// references to custom made records will be recognized
|
// references to custom made records will be recognized
|
||||||
@ -334,12 +339,10 @@ namespace MWWorld
|
|||||||
writer.writeHNT("TELE", mTeleportEnabled);
|
writer.writeHNT("TELE", mTeleportEnabled);
|
||||||
writer.writeHNT("LEVT", mLevitationEnabled);
|
writer.writeHNT("LEVT", mLevitationEnabled);
|
||||||
writer.endRecord(ESM::REC_ENAB);
|
writer.endRecord(ESM::REC_ENAB);
|
||||||
progress.increaseProgress();
|
|
||||||
|
|
||||||
writer.startRecord(ESM::REC_CAM_);
|
writer.startRecord(ESM::REC_CAM_);
|
||||||
writer.writeHNT("FIRS", isFirstPerson());
|
writer.writeHNT("FIRS", isFirstPerson());
|
||||||
writer.endRecord(ESM::REC_CAM_);
|
writer.endRecord(ESM::REC_CAM_);
|
||||||
progress.increaseProgress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::readRecord (ESM::ESMReader& reader, int32_t type,
|
void World::readRecord (ESM::ESMReader& reader, int32_t type,
|
||||||
@ -354,12 +357,6 @@ namespace MWWorld
|
|||||||
reader.getHNT(mTeleportEnabled, "TELE");
|
reader.getHNT(mTeleportEnabled, "TELE");
|
||||||
reader.getHNT(mLevitationEnabled, "LEVT");
|
reader.getHNT(mLevitationEnabled, "LEVT");
|
||||||
return;
|
return;
|
||||||
case ESM::REC_CAM_:
|
|
||||||
bool firstperson;
|
|
||||||
reader.getHNT(firstperson, "FIRS");
|
|
||||||
if (firstperson != isFirstPerson())
|
|
||||||
togglePOV();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if (!mStore.readRecord (reader, type) &&
|
if (!mStore.readRecord (reader, type) &&
|
||||||
!mGlobalVariables.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.
|
// so we should make sure not to use a "stale" controller for that.
|
||||||
MWBase::Environment::get().getMechanicsManager()->add(mPlayer->getPlayer());
|
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 ()
|
int World::canRest ()
|
||||||
|
@ -166,6 +166,7 @@ namespace MWWorld
|
|||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
virtual int countSavedGameRecords() const;
|
virtual int countSavedGameRecords() const;
|
||||||
|
virtual int countSavedGameCells() const;
|
||||||
|
|
||||||
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ namespace ESMTerrain
|
|||||||
/// Fill vertex buffers for a terrain chunk.
|
/// 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 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 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 lodLevel LOD level, 0 = most detailed
|
||||||
/// @param size size of the terrain chunk in cell units
|
/// @param size size of the terrain chunk in cell units
|
||||||
/// @param center center of the 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;
|
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 correctIconPath(const std::string &resPath);
|
||||||
std::string correctBookartPath(const std::string &resPath);
|
std::string correctBookartPath(const std::string &resPath);
|
||||||
std::string correctBookartPath(const std::string &resPath, int width, int height);
|
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;
|
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
|
namespace NifBullet
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -72,10 +123,6 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||||||
mCompoundShape = NULL;
|
mCompoundShape = NULL;
|
||||||
mStaticMesh = 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::NIFFilePtr pnif (Nif::Cache::getInstance().load(mResourceName.substr(0, mResourceName.length()-7)));
|
||||||
Nif::NIFFile & nif = *pnif.get ();
|
Nif::NIFFile & nif = *pnif.get ();
|
||||||
if (nif.numRoots() < 1)
|
if (nif.numRoots() < 1)
|
||||||
@ -84,6 +131,19 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||||||
return;
|
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);
|
Nif::Record *r = nif.getRoot(0);
|
||||||
assert(r != NULL);
|
assert(r != NULL);
|
||||||
|
|
||||||
@ -95,7 +155,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mShape->mHasCollisionNode = hasRootCollisionNode(node);
|
mShape->mAutogenerated = hasAutoGeneratedCollision(node);
|
||||||
|
|
||||||
//do a first pass
|
//do a first pass
|
||||||
handleNode(node,0,false,false,false);
|
handleNode(node,0,false,false,false);
|
||||||
@ -152,12 +212,9 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||||||
mShape->mRaycastingShape = new TriangleMeshShape(mStaticMesh,true);
|
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)
|
const Nif::NiNode *ninode = dynamic_cast<const Nif::NiNode*>(rootNode);
|
||||||
return true;
|
|
||||||
|
|
||||||
const Nif::NiNode *ninode = dynamic_cast<const Nif::NiNode*>(node);
|
|
||||||
if(ninode)
|
if(ninode)
|
||||||
{
|
{
|
||||||
const Nif::NodeList &list = ninode->children;
|
const Nif::NodeList &list = ninode->children;
|
||||||
@ -165,13 +222,12 @@ bool ManualBulletShapeLoader::hasRootCollisionNode(Nif::Node const * node)
|
|||||||
{
|
{
|
||||||
if(!list[i].empty())
|
if(!list[i].empty())
|
||||||
{
|
{
|
||||||
if(hasRootCollisionNode(list[i].getPtr()))
|
if(list[i].getPtr()->recType == Nif::RC_RootCollisionNode)
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
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))
|
&& (node->controller->flags & Nif::NiNode::ControllerFlag_Active))
|
||||||
isAnimated = true;
|
isAnimated = true;
|
||||||
|
|
||||||
|
if (mControlledNodes.find(node->name) != mControlledNodes.end())
|
||||||
|
isAnimated = true;
|
||||||
|
|
||||||
if (!raycasting)
|
if (!raycasting)
|
||||||
isCollisionNode = isCollisionNode || (node->recType == Nif::RC_RootCollisionNode);
|
isCollisionNode = isCollisionNode || (node->recType == Nif::RC_RootCollisionNode);
|
||||||
else
|
else
|
||||||
@ -230,8 +289,8 @@ void ManualBulletShapeLoader::handleNode(const Nif::Node *node, int flags,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (isCollisionNode || (!mShape->mHasCollisionNode && !raycasting))
|
if ( (isCollisionNode || (mShape->mAutogenerated && !raycasting))
|
||||||
&& (!isMarker || (mShape->mHasCollisionNode && !raycasting)))
|
&& (!isMarker || (!mShape->mAutogenerated && !raycasting)))
|
||||||
{
|
{
|
||||||
// NOTE: a trishape with hasBounds=true, but no BBoxCollision flag should NOT go through handleNiTriShape!
|
// NOTE: a trishape with hasBounds=true, but no BBoxCollision flag should NOT go through handleNiTriShape!
|
||||||
// It must be ignored completely.
|
// 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));
|
btTransform trans(btQuaternion(q.x, q.y, q.z, q.w), btVector3(v.x, v.y, v.z));
|
||||||
|
|
||||||
if (raycasting)
|
if (raycasting)
|
||||||
mShape->mAnimatedRaycastingShapes.insert(std::make_pair(shape->name, mCompoundShape->getNumChildShapes()));
|
mShape->mAnimatedRaycastingShapes.insert(std::make_pair(shape->recIndex, mCompoundShape->getNumChildShapes()));
|
||||||
else
|
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);
|
mCompoundShape->addChildShape(trans, childShape);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
*Helper function
|
*Helper function
|
||||||
*/
|
*/
|
||||||
bool hasRootCollisionNode(const Nif::Node *node);
|
bool hasAutoGeneratedCollision(const Nif::Node *rootNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*convert a NiTriShape to a bullet trishape.
|
*convert a NiTriShape to a bullet trishape.
|
||||||
@ -128,6 +128,8 @@ private:
|
|||||||
btTriangleMesh* mStaticMesh;
|
btTriangleMesh* mStaticMesh;
|
||||||
|
|
||||||
btBoxShape *mBoundingBox;
|
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)
|
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!");
|
OgreAssert(mesh, "Attempting to load a mesh into a non-mesh resource!");
|
||||||
|
|
||||||
Nif::NIFFilePtr nif = Nif::Cache::getInstance().load(mName);
|
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);
|
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)
|
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));
|
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));
|
AlphaController::Function* function = OGRE_NEW AlphaController::Function(alphaCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
||||||
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
||||||
@ -808,7 +808,7 @@ class NIFObjectLoader
|
|||||||
}
|
}
|
||||||
else if (ctrls->recType == Nif::RC_NiMaterialColorController)
|
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));
|
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));
|
MaterialColorController::Function* function = OGRE_NEW MaterialColorController::Function(matCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
|
||||||
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
|
||||||
@ -826,7 +826,7 @@ class NIFObjectLoader
|
|||||||
{
|
{
|
||||||
if (ctrls->recType == Nif::RC_NiFlipController)
|
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(
|
Ogre::ControllerValueRealPtr dstval(OGRE_NEW FlipController::Value(
|
||||||
|
@ -4,6 +4,162 @@
|
|||||||
|
|
||||||
#include "defs.hpp"
|
#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
|
namespace Terrain
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -39,7 +195,7 @@ namespace Terrain
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ogre::HardwareIndexBufferSharedPtr BufferCache::getIndexBuffer(int flags)
|
Ogre::HardwareIndexBufferSharedPtr BufferCache::getIndexBuffer(unsigned int flags)
|
||||||
{
|
{
|
||||||
unsigned int verts = mNumVerts;
|
unsigned int verts = mNumVerts;
|
||||||
|
|
||||||
@ -48,151 +204,12 @@ namespace Terrain
|
|||||||
return mIndexBufferMap[flags];
|
return mIndexBufferMap[flags];
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOD level n means every 2^n-th vertex is kept
|
Ogre::HardwareIndexBufferSharedPtr buffer;
|
||||||
size_t lodLevel = (flags >> (4*4));
|
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;
|
mIndexBufferMap[flags] = buffer;
|
||||||
return 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)
|
/// @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)
|
/// 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 ();
|
Ogre::HardwareVertexBufferSharedPtr getUVBuffer ();
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ void QuadTreeNode::updateIndexBuffers()
|
|||||||
// Fetch a suitable index buffer (which may be shared)
|
// Fetch a suitable index buffer (which may be shared)
|
||||||
size_t ourLod = getActualLodLevel();
|
size_t ourLod = getActualLodLevel();
|
||||||
|
|
||||||
int flags = 0;
|
unsigned int flags = 0;
|
||||||
|
|
||||||
for (int i=0; i<4; ++i)
|
for (int i=0; i<4; ++i)
|
||||||
{
|
{
|
||||||
@ -436,7 +436,7 @@ void QuadTreeNode::updateIndexBuffers()
|
|||||||
if (lod > 0)
|
if (lod > 0)
|
||||||
{
|
{
|
||||||
assert (lod - ourLod < (1 << 4));
|
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);
|
flags |= 0 /*((int)mAdditionalLod)*/ << (4*4);
|
||||||
|
@ -30,6 +30,8 @@ namespace Terrain
|
|||||||
/// Fill vertex buffers for a terrain chunk.
|
/// 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 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 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 lodLevel LOD level, 0 = most detailed
|
||||||
/// @param size size of the terrain chunk in cell units
|
/// @param size size of the terrain chunk in cell units
|
||||||
/// @param center center of the chunk in cell units
|
/// @param center center of the chunk in cell units
|
||||||
|
@ -12,9 +12,12 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- Range -->
|
<!-- 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="Caption" value="#{sRange}"/>
|
||||||
<Property key="TextAlign" value="Left HCenter"/>
|
<Property key="TextAlign" value="Left HCenter"/>
|
||||||
|
<UserString key="ToolTipType" value="Layout"/>
|
||||||
|
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||||
|
<UserString key="Caption_Text" value="#{sRangeDes}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="AutoSizedButton" skin="MW_Button" position="130 36 0 24" name="RangeButton">
|
<Widget type="AutoSizedButton" skin="MW_Button" position="130 36 0 24" name="RangeButton">
|
||||||
<Property key="Caption" value="#{sRangeTouch}"/>
|
<Property key="Caption" value="#{sRangeTouch}"/>
|
||||||
@ -22,9 +25,12 @@
|
|||||||
|
|
||||||
<!-- Magnitude -->
|
<!-- Magnitude -->
|
||||||
<Widget type="Widget" position="8 80 400 70" name="MagnitudeBox">
|
<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="Caption" value="#{sMagnitude}"/>
|
||||||
<Property key="TextAlign" value="Left HCenter"/>
|
<Property key="TextAlign" value="Left HCenter"/>
|
||||||
|
<UserString key="ToolTipType" value="Layout"/>
|
||||||
|
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||||
|
<UserString key="Caption_Text" value="#{sMagnitudeDes}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="TextBox" skin="SandText" position="122 0 210 20" name="MagnitudeMinValue">
|
<Widget type="TextBox" skin="SandText" position="122 0 210 20" name="MagnitudeMinValue">
|
||||||
@ -49,9 +55,12 @@
|
|||||||
|
|
||||||
<!-- Duration -->
|
<!-- Duration -->
|
||||||
<Widget type="Widget" position="8 153 400 40" name="DurationBox">
|
<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="Caption" value="#{sDuration}"/>
|
||||||
<Property key="TextAlign" value="Left Top"/>
|
<Property key="TextAlign" value="Left Top"/>
|
||||||
|
<UserString key="ToolTipType" value="Layout"/>
|
||||||
|
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||||
|
<UserString key="Caption_Text" value="#{sDurationDes}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="TextBox" skin="SandText" position="122 0 210 20" name="DurationValue">
|
<Widget type="TextBox" skin="SandText" position="122 0 210 20" name="DurationValue">
|
||||||
@ -66,9 +75,12 @@
|
|||||||
|
|
||||||
<!-- Area -->
|
<!-- Area -->
|
||||||
<Widget type="Widget" position="8 197 400 40" name="AreaBox">
|
<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="Caption" value="#{sArea}"/>
|
||||||
<Property key="TextAlign" value="Left Top"/>
|
<Property key="TextAlign" value="Left Top"/>
|
||||||
|
<UserString key="ToolTipType" value="Layout"/>
|
||||||
|
<UserString key="ToolTipLayout" value="TextToolTip"/>
|
||||||
|
<UserString key="Caption_Text" value="#{sAreaDes}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="TextBox" skin="SandText" position="122 0 210 20" name="AreaValue">
|
<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;
|
mCollisionShape = NULL;
|
||||||
mRaycastingShape = NULL;
|
mRaycastingShape = NULL;
|
||||||
mHasCollisionNode = false;
|
mAutogenerated = true;
|
||||||
mCollide = true;
|
mCollide = true;
|
||||||
createParamDictionary("BulletShape");
|
createParamDictionary("BulletShape");
|
||||||
}
|
}
|
||||||
|
@ -33,17 +33,16 @@ public:
|
|||||||
// Stores animated collision shapes. If any collision nodes in the NIF are animated, then mCollisionShape
|
// 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).
|
// will be a btCompoundShape (which consists of one or more child shapes).
|
||||||
// In this map, for each animated collision shape,
|
// In this map, for each animated collision shape,
|
||||||
// we store the bone name mapped to the child index of the shape in the btCompoundShape.
|
// we store the node's record index mapped to the child index of the shape in the btCompoundShape.
|
||||||
std::map<std::string, int> mAnimatedShapes;
|
std::map<int, int> mAnimatedShapes;
|
||||||
|
|
||||||
std::map<std::string, int> mAnimatedRaycastingShapes;
|
std::map<int, int> mAnimatedRaycastingShapes;
|
||||||
|
|
||||||
btCollisionShape* mCollisionShape;
|
btCollisionShape* mCollisionShape;
|
||||||
btCollisionShape* mRaycastingShape;
|
btCollisionShape* mRaycastingShape;
|
||||||
|
|
||||||
// Whether or not a NiRootCollisionNode was present in the .nif. If there is none, the collision behaviour
|
// Does this .nif have an autogenerated collision mesh?
|
||||||
// depends on object type, so we need to expose this variable.
|
bool mAutogenerated;
|
||||||
bool mHasCollisionNode;
|
|
||||||
|
|
||||||
Ogre::Vector3 mBoxTranslation;
|
Ogre::Vector3 mBoxTranslation;
|
||||||
Ogre::Quaternion mBoxRotation;
|
Ogre::Quaternion mBoxRotation;
|
||||||
|
@ -1,16 +1,21 @@
|
|||||||
#include "physic.hpp"
|
#include "physic.hpp"
|
||||||
|
|
||||||
#include <btBulletDynamicsCommon.h>
|
#include <btBulletDynamicsCommon.h>
|
||||||
#include <btBulletCollisionCommon.h>
|
#include <btBulletCollisionCommon.h>
|
||||||
#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.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/lexical_cast.hpp>
|
||||||
#include <boost/format.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
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -35,7 +40,7 @@ btCollisionShape *duplicateCollisionShape(btCollisionShape *shape)
|
|||||||
|
|
||||||
if(btBvhTriangleMeshShape *trishape = dynamic_cast<btBvhTriangleMeshShape*>(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);
|
btTriangleMesh* newMesh = new btTriangleMesh(*oldMesh);
|
||||||
NifBullet::TriangleMeshShape *newShape = new NifBullet::TriangleMeshShape(newMesh, true);
|
NifBullet::TriangleMeshShape *newShape = new NifBullet::TriangleMeshShape(newMesh, true);
|
||||||
|
|
||||||
@ -456,7 +461,7 @@ namespace Physic
|
|||||||
BulletShapeManager::getSingletonPtr()->load(outputstring,"General");
|
BulletShapeManager::getSingletonPtr()->load(outputstring,"General");
|
||||||
BulletShapePtr shape = BulletShapeManager::getSingleton().getByName(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;
|
return NULL;
|
||||||
|
|
||||||
if (!shape->mCollisionShape && !raycasting)
|
if (!shape->mCollisionShape && !raycasting)
|
||||||
|
@ -182,8 +182,8 @@ namespace Physic
|
|||||||
{
|
{
|
||||||
btCollisionShape* mCompound;
|
btCollisionShape* mCompound;
|
||||||
|
|
||||||
// Maps bone name to child index in the compound shape
|
// Maps node record index to child index in the compound shape
|
||||||
std::map<std::string, int> mAnimatedShapes;
|
std::map<int, int> mAnimatedShapes;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user