mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Merge remote-tracking branch 'zini/master' into animations
Conflicts: apps/openmw/mwworld/worldimp.cpp
This commit is contained in:
commit
15a2eeebb8
@ -368,7 +368,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
|||||||
mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mMaster, mPlugins,
|
mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mMaster, mPlugins,
|
||||||
mResDir, mCfgMgr.getCachePath(), mNewGame, mEncoder, mFallbackMap,
|
mResDir, mCfgMgr.getCachePath(), mNewGame, mEncoder, mFallbackMap,
|
||||||
mActivationDistanceOverride));
|
mActivationDistanceOverride));
|
||||||
MWBase::Environment::get().getWorld()->setupPlayer(mNewGame);
|
MWBase::Environment::get().getWorld()->setupPlayer();
|
||||||
|
|
||||||
//Load translation data
|
//Load translation data
|
||||||
mTranslationDataStorage.setEncoder(mEncoder);
|
mTranslationDataStorage.setEncoder(mEncoder);
|
||||||
|
@ -323,9 +323,11 @@ namespace MWBase
|
|||||||
virtual void changeVanityModeScale(float factor) = 0;
|
virtual void changeVanityModeScale(float factor) = 0;
|
||||||
virtual bool vanityRotateCamera(float * rot) = 0;
|
virtual bool vanityRotateCamera(float * rot) = 0;
|
||||||
|
|
||||||
virtual void setupPlayer(bool newGame) = 0;
|
virtual void setupPlayer() = 0;
|
||||||
virtual void renderPlayer() = 0;
|
virtual void renderPlayer() = 0;
|
||||||
|
|
||||||
|
virtual bool getOpenOrCloseDoor(const MWWorld::Ptr& door) = 0;
|
||||||
|
///< if activated, should this door be opened or closed?
|
||||||
virtual void activateDoor(const MWWorld::Ptr& door) = 0;
|
virtual void activateDoor(const MWWorld::Ptr& door) = 0;
|
||||||
///< activate (open or close) an non-teleport door
|
///< activate (open or close) an non-teleport door
|
||||||
|
|
||||||
|
@ -375,12 +375,12 @@ namespace MWClass
|
|||||||
return MWWorld::Ptr(&cell.mArmors.insert(*ref), &cell);
|
return MWWorld::Ptr(&cell.mArmors.insert(*ref), &cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
short Armor::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
float Armor::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||||
ptr.get<ESM::Armor>();
|
ptr.get<ESM::Armor>();
|
||||||
|
|
||||||
return ref->mBase->mData.mEnchant;
|
return ref->mBase->mData.mEnchant/10.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Armor::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Armor::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
|
@ -77,7 +77,7 @@ namespace MWClass
|
|||||||
|
|
||||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
virtual float getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||||
};
|
};
|
||||||
|
@ -176,12 +176,12 @@ namespace MWClass
|
|||||||
return MWWorld::Ptr(&cell.mBooks.insert(*ref), &cell);
|
return MWWorld::Ptr(&cell.mBooks.insert(*ref), &cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
short Book::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
float Book::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||||
ptr.get<ESM::Book>();
|
ptr.get<ESM::Book>();
|
||||||
|
|
||||||
return ref->mBase->mData.mEnchant;
|
return ref->mBase->mData.mEnchant/10.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Book::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Book::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
|
@ -58,7 +58,7 @@ namespace MWClass
|
|||||||
|
|
||||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
virtual float getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||||
};
|
};
|
||||||
|
@ -295,12 +295,12 @@ namespace MWClass
|
|||||||
return MWWorld::Ptr(&cell.mClothes.insert(*ref), &cell);
|
return MWWorld::Ptr(&cell.mClothes.insert(*ref), &cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
short Clothing::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
float Clothing::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||||
ptr.get<ESM::Clothing>();
|
ptr.get<ESM::Clothing>();
|
||||||
|
|
||||||
return ref->mBase->mData.mEnchant;
|
return ref->mBase->mData.mEnchant/10.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Clothing::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Clothing::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
|
@ -71,7 +71,7 @@ namespace MWClass
|
|||||||
|
|
||||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
virtual float getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||||
|
|
||||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||||
};
|
};
|
||||||
|
@ -141,7 +141,7 @@ namespace MWClass
|
|||||||
{
|
{
|
||||||
// animated door
|
// animated door
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionDoor(ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionDoor(ptr));
|
||||||
if (ptr.getRefData().getLocalRotation().rot[2] == 0)
|
if (MWBase::Environment::get().getWorld()->getOpenOrCloseDoor(ptr))
|
||||||
action->setSound(openSound);
|
action->setSound(openSound);
|
||||||
else
|
else
|
||||||
action->setSound(closeSound);
|
action->setSound(closeSound);
|
||||||
|
@ -181,4 +181,12 @@ namespace MWClass
|
|||||||
{
|
{
|
||||||
return npcServices & ESM::NPC::Picks;
|
return npcServices & ESM::NPC::Picks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Lockpick::getItemMaxHealth (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
MWWorld::LiveCellRef<ESM::Lockpick> *ref =
|
||||||
|
ptr.get<ESM::Lockpick>();
|
||||||
|
|
||||||
|
return ref->mBase->mData.mUses;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,9 @@ namespace MWClass
|
|||||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||||
|
|
||||||
|
virtual int getItemMaxHealth (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Return item max health or throw an exception, if class does not have item health
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,4 +180,12 @@ namespace MWClass
|
|||||||
{
|
{
|
||||||
return npcServices & ESM::NPC::Probes;
|
return npcServices & ESM::NPC::Probes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Probe::getItemMaxHealth (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||||
|
ptr.get<ESM::Probe>();
|
||||||
|
|
||||||
|
return ref->mBase->mData.mUses;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,9 @@ namespace MWClass
|
|||||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||||
|
|
||||||
|
virtual int getItemMaxHealth (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Return item max health or throw an exception, if class does not have item health
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,12 +428,12 @@ namespace MWClass
|
|||||||
return MWWorld::Ptr(&cell.mWeapons.insert(*ref), &cell);
|
return MWWorld::Ptr(&cell.mWeapons.insert(*ref), &cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
short Weapon::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
float Weapon::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||||
ptr.get<ESM::Weapon>();
|
ptr.get<ESM::Weapon>();
|
||||||
|
|
||||||
return ref->mBase->mData.mEnchant;
|
return ref->mBase->mData.mEnchant/10.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Weapon::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Weapon::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
|
@ -79,7 +79,7 @@ namespace MWClass
|
|||||||
|
|
||||||
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
virtual bool canSell (const MWWorld::Ptr& item, int npcServices) const;
|
||||||
|
|
||||||
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
virtual float getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,8 +57,9 @@ namespace MWGui
|
|||||||
|
|
||||||
void EnchantingDialog::updateLabels()
|
void EnchantingDialog::updateLabels()
|
||||||
{
|
{
|
||||||
mEnchantmentPoints->setCaption(boost::lexical_cast<std::string>(mEnchanting.getEnchantCost())
|
std::stringstream enchantCost;
|
||||||
+ " / " + boost::lexical_cast<std::string>(mEnchanting.getMaxEnchantValue()));
|
enchantCost << std::setprecision(1) << std::fixed << mEnchanting.getEnchantCost();
|
||||||
|
mEnchantmentPoints->setCaption(enchantCost.str() + " / " + boost::lexical_cast<std::string>(mEnchanting.getMaxEnchantValue()));
|
||||||
|
|
||||||
mCharge->setCaption(boost::lexical_cast<std::string>(mEnchanting.getGemCharge()));
|
mCharge->setCaption(boost::lexical_cast<std::string>(mEnchanting.getGemCharge()));
|
||||||
|
|
||||||
|
@ -918,14 +918,16 @@ namespace MWGui
|
|||||||
const ESM::Enchantment* ench = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>()
|
const ESM::Enchantment* ench = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>()
|
||||||
.find(MWWorld::Class::get(item).getEnchantment(item));
|
.find(MWWorld::Class::get(item).getEnchantment(item));
|
||||||
|
|
||||||
int chargePercent = item.getCellRef().mEnchantmentCharge / static_cast<float>(ench->mData.mCharge) * 100;
|
int chargePercent = (item.getCellRef().mEnchantmentCharge == -1) ? 100
|
||||||
|
: (item.getCellRef().mEnchantmentCharge / static_cast<float>(ench->mData.mCharge) * 100);
|
||||||
mHud->setSelectedEnchantItem(item, chargePercent);
|
mHud->setSelectedEnchantItem(item, chargePercent);
|
||||||
mSpellWindow->setTitle(MWWorld::Class::get(item).getName(item));
|
mSpellWindow->setTitle(MWWorld::Class::get(item).getName(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::setSelectedWeapon(const MWWorld::Ptr& item)
|
void WindowManager::setSelectedWeapon(const MWWorld::Ptr& item)
|
||||||
{
|
{
|
||||||
int durabilityPercent = item.getCellRef().mCharge / static_cast<float>(MWWorld::Class::get(item).getItemMaxHealth(item)) * 100;
|
int durabilityPercent = (item.getCellRef().mCharge == -1) ? 100
|
||||||
|
: (item.getCellRef().mCharge / static_cast<float>(MWWorld::Class::get(item).getItemMaxHealth(item)) * 100);
|
||||||
mHud->setSelectedWeapon(item, durabilityPercent);
|
mHud->setSelectedWeapon(item, durabilityPercent);
|
||||||
mInventoryWindow->setTitle(MWWorld::Class::get(item).getName(item));
|
mInventoryWindow->setTitle(MWWorld::Class::get(item).getName(item));
|
||||||
}
|
}
|
||||||
@ -1110,6 +1112,13 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
mLoadingScreen->loadingDone ();
|
mLoadingScreen->loadingDone ();
|
||||||
}
|
}
|
||||||
|
bool WindowManager::getRestEnabled()
|
||||||
|
{
|
||||||
|
//Enable rest dialogue if character creation finished
|
||||||
|
if(mRestAllowed==false && MWBase::Environment::get().getWorld()->getGlobalVariable ("chargenstate").mFloat==-1)
|
||||||
|
mRestAllowed=true;
|
||||||
|
return mRestAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
bool WindowManager::getPlayerSleeping ()
|
bool WindowManager::getPlayerSleeping ()
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ namespace MWGui
|
|||||||
virtual void loadingDone();
|
virtual void loadingDone();
|
||||||
|
|
||||||
virtual void enableRest() { mRestAllowed = true; }
|
virtual void enableRest() { mRestAllowed = true; }
|
||||||
virtual bool getRestEnabled() { return mRestAllowed; }
|
virtual bool getRestEnabled();
|
||||||
|
|
||||||
virtual bool getPlayerSleeping();
|
virtual bool getPlayerSleeping();
|
||||||
virtual void wakeUpPlayer();
|
virtual void wakeUpPlayer();
|
||||||
|
@ -679,7 +679,8 @@ namespace MWInput
|
|||||||
|
|
||||||
void InputManager::quickKey (int index)
|
void InputManager::quickKey (int index)
|
||||||
{
|
{
|
||||||
mWindows.activateQuickKey (index);
|
if (!mWindows.isGuiMode())
|
||||||
|
mWindows.activateQuickKey (index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputManager::showQuickKeysMenu()
|
void InputManager::showQuickKeysMenu()
|
||||||
|
@ -134,7 +134,7 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Enchanting::getEnchantCost() const
|
float Enchanting::getEnchantCost() const
|
||||||
{
|
{
|
||||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||||
float cost = 0;
|
float cost = 0;
|
||||||
@ -193,7 +193,7 @@ namespace MWMechanics
|
|||||||
return soul->mData.mSoul;
|
return soul->mData.mSoul;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Enchanting::getMaxEnchantValue() const
|
float Enchanting::getMaxEnchantValue() const
|
||||||
{
|
{
|
||||||
if (itemEmpty())
|
if (itemEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -35,9 +35,9 @@ namespace MWMechanics
|
|||||||
bool create(); //Return true if created, false if failed.
|
bool create(); //Return true if created, false if failed.
|
||||||
void nextEnchantType(); //Set enchant type to next possible type (for mOldItemPtr object)
|
void nextEnchantType(); //Set enchant type to next possible type (for mOldItemPtr object)
|
||||||
int getEnchantType() const;
|
int getEnchantType() const;
|
||||||
int getEnchantCost() const;
|
float getEnchantCost() const;
|
||||||
int getEnchantPrice() const;
|
int getEnchantPrice() const;
|
||||||
int getMaxEnchantValue() const;
|
float getMaxEnchantValue() const;
|
||||||
int getGemCharge() const;
|
int getGemCharge() const;
|
||||||
float getEnchantChance() const;
|
float getEnchantChance() const;
|
||||||
bool soulEmpty() const; //Return true if empty
|
bool soulEmpty() const; //Return true if empty
|
||||||
|
@ -54,9 +54,10 @@ namespace MWRender
|
|||||||
|
|
||||||
TerrainMaterial::Profile::~Profile()
|
TerrainMaterial::Profile::~Profile()
|
||||||
{
|
{
|
||||||
|
if (mMaterial)
|
||||||
|
sh::Factory::getInstance().destroyMaterialInstance(mMaterial->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ogre::MaterialPtr TerrainMaterial::Profile::generate(const Ogre::Terrain* terrain)
|
Ogre::MaterialPtr TerrainMaterial::Profile::generate(const Ogre::Terrain* terrain)
|
||||||
{
|
{
|
||||||
const Ogre::String& matName = terrain->getMaterialName();
|
const Ogre::String& matName = terrain->getMaterialName();
|
||||||
|
@ -132,7 +132,7 @@ namespace MWWorld
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
short Class::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
float Class::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error ("class does not support enchanting");
|
throw std::runtime_error ("class does not support enchanting");
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ namespace MWWorld
|
|||||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||||
/// (default implementation: return empty string)
|
/// (default implementation: return empty string)
|
||||||
|
|
||||||
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
virtual float getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||||
///< @return the number of enchantment points available for possible enchanting
|
///< @return the number of enchantment points available for possible enchanting
|
||||||
|
|
||||||
virtual void adjustScale(const MWWorld::Ptr& ptr,float& scale) const;
|
virtual void adjustScale(const MWWorld::Ptr& ptr,float& scale) const;
|
||||||
|
@ -162,7 +162,8 @@ namespace MWWorld
|
|||||||
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride)
|
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride)
|
||||||
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||||
mSky (true), mCells (mStore, mEsm),
|
mSky (true), mCells (mStore, mEsm),
|
||||||
mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride),mFallback(fallbackMap)
|
mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride),
|
||||||
|
mFallback(fallbackMap), mNewGame(newGame)
|
||||||
{
|
{
|
||||||
mPhysics = new PhysicsSystem(renderer);
|
mPhysics = new PhysicsSystem(renderer);
|
||||||
mPhysEngine = mPhysics->getEngine();
|
mPhysEngine = mPhysics->getEngine();
|
||||||
@ -213,7 +214,7 @@ namespace MWWorld
|
|||||||
// global variables
|
// global variables
|
||||||
mGlobalVariables = new Globals (mStore);
|
mGlobalVariables = new Globals (mStore);
|
||||||
|
|
||||||
if (newGame)
|
if (mNewGame)
|
||||||
{
|
{
|
||||||
// set new game mark
|
// set new game mark
|
||||||
mGlobalVariables->setInt ("chargenstate", 1);
|
mGlobalVariables->setInt ("chargenstate", 1);
|
||||||
@ -1490,14 +1491,14 @@ namespace MWWorld
|
|||||||
return mRendering->vanityRotateCamera(rot);
|
return mRendering->vanityRotateCamera(rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setupPlayer(bool newGame)
|
void World::setupPlayer()
|
||||||
{
|
{
|
||||||
const ESM::NPC *player = mStore.get<ESM::NPC>().find("player");
|
const ESM::NPC *player = mStore.get<ESM::NPC>().find("player");
|
||||||
mPlayer = new MWWorld::Player(player, *this);
|
mPlayer = new MWWorld::Player(player, *this);
|
||||||
|
|
||||||
Ptr ptr = mPlayer->getPlayer();
|
Ptr ptr = mPlayer->getPlayer();
|
||||||
mRendering->setupPlayer(ptr);
|
mRendering->setupPlayer(ptr);
|
||||||
if(newGame)
|
if (mNewGame)
|
||||||
{
|
{
|
||||||
MWWorld::Class::get(ptr).getContainerStore(ptr).fill(player->mInventory, "", mStore);
|
MWWorld::Class::get(ptr).getContainerStore(ptr).fill(player->mInventory, "", mStore);
|
||||||
MWWorld::Class::get(ptr).getInventoryStore(ptr).autoEquip(ptr);
|
MWWorld::Class::get(ptr).getInventoryStore(ptr).autoEquip(ptr);
|
||||||
@ -1508,6 +1509,8 @@ namespace MWWorld
|
|||||||
{
|
{
|
||||||
mRendering->renderPlayer(mPlayer->getPlayer());
|
mRendering->renderPlayer(mPlayer->getPlayer());
|
||||||
mPhysics->addActor(mPlayer->getPlayer());
|
mPhysics->addActor(mPlayer->getPlayer());
|
||||||
|
if (mNewGame)
|
||||||
|
toggleCollisionMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::setupExternalRendering (MWRender::ExternalRendering& rendering)
|
void World::setupExternalRendering (MWRender::ExternalRendering& rendering)
|
||||||
@ -1566,4 +1569,11 @@ namespace MWWorld
|
|||||||
mDoorStates[door] = 0; // close
|
mDoorStates[door] = 0; // close
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool World::getOpenOrCloseDoor(const Ptr &door)
|
||||||
|
{
|
||||||
|
if (mDoorStates.find(door) != mDoorStates.end())
|
||||||
|
return !mDoorStates[door]; // if currently opening or closing, then do the opposite
|
||||||
|
return door.getRefData().getLocalRotation().rot[2] == 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,8 @@ namespace MWWorld
|
|||||||
float mFaced2Distance;
|
float mFaced2Distance;
|
||||||
int mNumFacing;
|
int mNumFacing;
|
||||||
|
|
||||||
|
bool mNewGame;
|
||||||
|
|
||||||
std::map<MWWorld::Ptr, int> mDoorStates;
|
std::map<MWWorld::Ptr, int> mDoorStates;
|
||||||
///< only holds doors that are currently moving. 0 means closing, 1 opening
|
///< only holds doors that are currently moving. 0 means closing, 1 opening
|
||||||
|
|
||||||
@ -113,6 +115,9 @@ namespace MWWorld
|
|||||||
void addContainerScripts(const Ptr& reference, Ptr::CellStore* cell);
|
void addContainerScripts(const Ptr& reference, Ptr::CellStore* cell);
|
||||||
void PCDropped (const Ptr& item);
|
void PCDropped (const Ptr& item);
|
||||||
|
|
||||||
|
virtual void processDoors(float duration);
|
||||||
|
///< Run physics simulation and modify \a world accordingly.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
World (OEngine::Render::OgreRenderer& renderer,
|
World (OEngine::Render::OgreRenderer& renderer,
|
||||||
@ -272,9 +277,6 @@ namespace MWWorld
|
|||||||
virtual void doPhysics(const PtrMovementList &actors, float duration);
|
virtual void doPhysics(const PtrMovementList &actors, float duration);
|
||||||
///< Run physics simulation and modify \a world accordingly.
|
///< Run physics simulation and modify \a world accordingly.
|
||||||
|
|
||||||
virtual void processDoors(float duration);
|
|
||||||
///< Run physics simulation and modify \a world accordingly.
|
|
||||||
|
|
||||||
virtual bool toggleCollisionMode();
|
virtual bool toggleCollisionMode();
|
||||||
///< Toggle collision mode for player. If disabled player object should ignore
|
///< Toggle collision mode for player. If disabled player object should ignore
|
||||||
/// collisions and gravity.
|
/// collisions and gravity.
|
||||||
@ -371,9 +373,11 @@ namespace MWWorld
|
|||||||
|
|
||||||
virtual bool vanityRotateCamera(float * rot);
|
virtual bool vanityRotateCamera(float * rot);
|
||||||
|
|
||||||
virtual void setupPlayer(bool newGame);
|
virtual void setupPlayer();
|
||||||
virtual void renderPlayer();
|
virtual void renderPlayer();
|
||||||
|
|
||||||
|
virtual bool getOpenOrCloseDoor(const MWWorld::Ptr& door);
|
||||||
|
///< if activated, should this door be opened or closed?
|
||||||
virtual void activateDoor(const MWWorld::Ptr& door);
|
virtual void activateDoor(const MWWorld::Ptr& door);
|
||||||
///< activate (open or close) an non-teleport door
|
///< activate (open or close) an non-teleport door
|
||||||
|
|
||||||
|
@ -313,21 +313,26 @@ public:
|
|||||||
void destroyInstance( Archive* arch) { delete arch; }
|
void destroyInstance( Archive* arch) { delete arch; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DirArchiveFactory : public FileSystemArchiveFactory
|
class DirArchiveFactory : public ArchiveFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const String& getType() const
|
const String& getType() const
|
||||||
{
|
{
|
||||||
static String name = "Dir";
|
static String name = "Dir";
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Archive *createInstance( const String& name )
|
Archive *createInstance( const String& name )
|
||||||
{
|
{
|
||||||
return new DirArchive(name);
|
return new DirArchive(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroyInstance( Archive* arch) { delete arch; }
|
virtual Archive* createInstance(const String& name, bool readOnly)
|
||||||
|
{
|
||||||
|
return new DirArchive(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void destroyInstance( Archive* arch) { delete arch; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ struct Weapon
|
|||||||
short mType;
|
short mType;
|
||||||
short mHealth;
|
short mHealth;
|
||||||
float mSpeed, mReach;
|
float mSpeed, mReach;
|
||||||
short mEnchant; // Enchantment points
|
short mEnchant; // Enchantment points. The real value is mEnchant/10.f
|
||||||
unsigned char mChop[2], mSlash[2], mThrust[2]; // Min and max
|
unsigned char mChop[2], mSlash[2], mThrust[2]; // Min and max
|
||||||
int mFlags;
|
int mFlags;
|
||||||
}; // 32 bytes
|
}; // 32 bytes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user