Merge pull request #201 from OpenMW/master

Add OpenMW commits up to 19 Apr 2017
pull/176/merge
David Cernat 8 years ago committed by GitHub
commit edb155869b

@ -13,6 +13,7 @@
#include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwworld/player.hpp"
#include "textinput.hpp"
#include "race.hpp"
@ -230,10 +231,19 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog);
mReviewDialog = 0;
mReviewDialog = new ReviewDialog();
mReviewDialog->setPlayerName(mPlayerName);
mReviewDialog->setRace(mPlayerRaceId);
mReviewDialog->setClass(mPlayerClass);
mReviewDialog->setBirthSign(mPlayerBirthSignId);
MWBase::World *world = MWBase::Environment::get().getWorld();
const ESM::NPC *playerNpc = world->getPlayerPtr().get<ESM::NPC>()->mBase;
const MWWorld::Player player = world->getPlayer();
const ESM::Class *playerClass = world->getStore().get<ESM::Class>().find(playerNpc->mClass);
mReviewDialog->setPlayerName(playerNpc->mName);
mReviewDialog->setRace(playerNpc->mRace);
mReviewDialog->setClass(*playerClass);
mReviewDialog->setBirthSign(player.getBirthSign());
{
MWWorld::Ptr player = MWMechanics::getPlayer();

@ -142,6 +142,18 @@ namespace MWGui
dirtyPreview();
updatePreviewSize();
updateEncumbranceBar();
mItemView->update();
notifyContentChanged();
}
void InventoryWindow::clear()
{
mPtr = MWWorld::Ptr();
mTradeModel = NULL;
mSortModel = NULL;
mItemView->setModel(NULL);
}
void InventoryWindow::setGuiMode(GuiMode mode)
@ -346,13 +358,12 @@ namespace MWGui
void InventoryWindow::open()
{
mPtr = MWMechanics::getPlayer();
updateEncumbranceBar();
mItemView->update();
notifyContentChanged();
if (!mPtr.isEmpty())
{
updateEncumbranceBar();
mItemView->update();
notifyContentChanged();
}
adjustPanes();
}

@ -60,6 +60,8 @@ namespace MWGui
void updatePlayer();
void clear();
void useItem(const MWWorld::Ptr& ptr);
void setGuiMode(GuiMode mode);

@ -146,6 +146,7 @@ namespace MWGui
const ESM::NPC& proto = mPreview->getPrototype();
setRaceId(proto.mRace);
setGender(proto.isMale() ? GM_Male : GM_Female);
recountParts();
for (unsigned int i=0; i<mAvailableHeads.size(); ++i)

@ -1700,6 +1700,8 @@ namespace MWGui
mCompanionWindow->resetReference();
mConsole->resetReference();
mInventoryWindow->clear();
mSelectedSpell.clear();
mCustomMarkers.clear();

@ -818,6 +818,12 @@ namespace MWMechanics
CharacterController* ctrl = it->second->getCharacterController();
NpcStats &stats = ptr.getClass().getNpcStats(ptr);
// When npc stats are just initialized, mTimeToStartDrowning == -1 and we should get value from GMST
static const int fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fHoldBreathTime")->getFloat();
if (stats.getTimeToStartDrowning() == -1.f)
stats.setTimeToStartDrowning(fHoldBreathTime);
MWBase::World *world = MWBase::Environment::get().getWorld();
bool knockedOutUnderwater = (ctrl->isKnockedOut() && world->isUnderwater(ptr.getCell(), osg::Vec3f(ptr.getRefData().getPosition().asVec3())));
if((world->isSubmerged(ptr) || knockedOutUnderwater)

@ -531,8 +531,7 @@ namespace MWMechanics
{
// get the range of the target's weapon
float rangeAttackOfTarget = 0.f;
bool isRangedCombat = false;
MWWorld::Ptr targetWeapon = MWWorld::Ptr();
MWWorld::Ptr targetWeapon = MWWorld::Ptr();
const MWWorld::Class& targetClass = target.getClass();
if (targetClass.hasInventoryStore(target))
@ -547,7 +546,10 @@ namespace MWMechanics
boost::shared_ptr<Action> targetWeaponAction (new ActionWeapon(targetWeapon));
if (targetWeaponAction.get())
{
bool isRangedCombat = false;
rangeAttackOfTarget = targetWeaponAction->getCombatRange(isRangedCombat);
}
// apply sideway movement (kind of dodging) with some probability
// if actor is within range of target's weapon

@ -171,10 +171,10 @@ void MWMechanics::Alchemy::updateEffects()
if (fPotionT1DurMult<=0)
throw std::runtime_error ("invalid gmst: fPotionT1DurMult");
float magnitude = magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude ?
1 : (x / fPotionT1MagMul) / magicEffect->mData.mBaseCost;
float duration = magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration ?
1 : (x / fPotionT1DurMult) / magicEffect->mData.mBaseCost;
float magnitude = (magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude) ?
1.0f : (x / fPotionT1MagMul) / magicEffect->mData.mBaseCost;
float duration = (magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration) ?
1.0f : (x / fPotionT1DurMult) / magicEffect->mData.mBaseCost;
if (!(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude))
applyTools (magicEffect->mData.mFlags, magnitude);

@ -338,12 +338,16 @@ namespace MWMechanics
winMgr->setValue(fbar, stats.getFatigue());
}
if(stats.getTimeToStartDrowning() != mWatchedTimeToStartDrowning)
float timeToDrown = stats.getTimeToStartDrowning();
if(timeToDrown != mWatchedTimeToStartDrowning)
{
const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
static const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
.find("fHoldBreathTime")->getFloat();
mWatchedTimeToStartDrowning = stats.getTimeToStartDrowning();
if(stats.getTimeToStartDrowning() >= fHoldBreathTime)
mWatchedTimeToStartDrowning = timeToDrown;
if(timeToDrown >= fHoldBreathTime || timeToDrown == -1.0) // -1.0 is a special value during initialization
winMgr->setDrowningBarVisibility(false);
else
{

@ -30,7 +30,7 @@ MWMechanics::NpcStats::NpcStats()
, mBounty(0)
, mWerewolfKills (0)
, mLevelProgress(0)
, mTimeToStartDrowning(20.0)
, mTimeToStartDrowning(-1.0) // set breath to special value, it will be replaced during actor update
, mIsWerewolf(false)
{
mSkillIncreases.resize (ESM::Attribute::Length, 0);

@ -230,13 +230,6 @@ namespace MWPhysics
return direction - project(direction, planeNormal);
}
static inline osg::Vec3f reflect(const osg::Vec3& velocity, const osg::Vec3f& normal)
{
return velocity - (normal * (normal * velocity)) * 2;
// ^ dot product
}
public:
static osg::Vec3f traceDown(const MWWorld::Ptr &ptr, const osg::Vec3f& position, Actor* actor, btCollisionWorld* collisionWorld, float maxHeight)
{

@ -211,7 +211,7 @@ namespace MWPhysics
float mTimeAccum;
float mWaterHeight;
float mWaterEnabled;
bool mWaterEnabled;
std::auto_ptr<btCollisionObject> mWaterCollisionObject;
std::auto_ptr<btCollisionShape> mWaterCollisionShape;

@ -1058,11 +1058,9 @@ namespace MWRender
float timepassed = duration * state.mSpeedMult;
while(state.mPlaying)
{
float targetTime;
if (!state.shouldLoop())
{
targetTime = state.getTime() + timepassed;
float targetTime = state.getTime() + timepassed;
if(textkey == textkeys.end() || textkey->first > targetTime)
{
if(mAccumCtrl && state.mTime == mAnimationTimePtr[0]->getTimePtr())

@ -580,13 +580,9 @@ namespace MWWorld
std::cout << "Changing to interior\n";
// unload
int current = 0;
CellStoreCollection::iterator active = mActiveCells.begin();
while (active!=mActiveCells.end())
{
unloadCell (active++);
++current;
}
int refsToLoad = cell->count();
loadingListener->setProgressRange(refsToLoad);

Loading…
Cancel
Save