Merge remote-tracking branch 'scrawl/master'

loadfix
Marc Zinnschlag 10 years ago
commit 003675318d

@ -79,8 +79,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
{
try
{
float frametime = std::min(evt.timeSinceLastFrame, 0.2f);
float frametime = evt.timeSinceLastFrame;
mEnvironment.setFrameDuration (frametime);
// update input
@ -478,9 +477,15 @@ void OMW::Engine::go()
}
// Start the main rendering loop
Ogre::Timer timer;
while (!MWBase::Environment::get().getStateManager()->hasQuitRequest())
Ogre::Root::getSingleton().renderOneFrame();
{
float dt = timer.getMilliseconds()/1000.f;
dt = std::min(dt, 0.2f);
timer.reset();
Ogre::Root::getSingleton().renderOneFrame(dt);
}
// Save user settings
settings.saveUser(settingspath);

@ -162,6 +162,9 @@ namespace MWGui
void RaceDialog::close()
{
mPreviewImage->setImageTexture("");
const std::string textureName = "CharacterHeadPreview";
MyGUI::RenderManager::getInstance().destroyTexture(MyGUI::RenderManager::getInstance().getTexture(textureName));
mPreview.reset(NULL);
}

@ -190,14 +190,12 @@ namespace MWInput
int action = channel->getNumber();
if (action == A_Use)
{
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).setAttackingOrSpell(currentValue);
}
if (action == A_Jump)
if (mControlSwitch["playercontrols"])
{
mAttemptJump = (currentValue == 1.0 && previousValue == 0.0);
if (action == A_Use)
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).setAttackingOrSpell(currentValue);
else if (action == A_Jump)
mAttemptJump = (currentValue == 1.0 && previousValue == 0.0);
}
if (currentValue == 1)
@ -603,7 +601,7 @@ namespace MWInput
MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX), int(mMouseY), mMouseWheel);
}
if (mMouseLookEnabled)
if (mMouseLookEnabled && !mControlsDisabled)
{
resetIdleTime();
@ -622,7 +620,7 @@ namespace MWInput
mPlayer->pitch(y);
}
if (arg.zrel && mControlSwitch["playerviewswitch"]) //Check to make sure you are allowed to zoomout and there is a change
if (arg.zrel && mControlSwitch["playerviewswitch"] && mControlSwitch["playercontrols"]) //Check to make sure you are allowed to zoomout and there is a change
{
MWBase::Environment::get().getWorld()->changeVanityModeScale(arg.zrel);
MWBase::Environment::get().getWorld()->setCameraDistance(arg.zrel, true, true);
@ -680,7 +678,7 @@ namespace MWInput
if (MWBase::Environment::get().getWindowManager()->isGuiMode()) return;
// Not allowed before the magic window is accessible
if (!mControlSwitch["playermagic"])
if (!mControlSwitch["playermagic"] || !mControlSwitch["playercontrols"])
return;
// Not allowed if no spell selected
@ -701,7 +699,7 @@ namespace MWInput
if (MWBase::Environment::get().getWindowManager()->isGuiMode()) return;
// Not allowed before the inventory window is accessible
if (!mControlSwitch["playerfighting"])
if (!mControlSwitch["playerfighting"] || !mControlSwitch["playercontrols"])
return;
MWMechanics::DrawState_ state = mPlayer->getDrawState();
@ -713,6 +711,9 @@ namespace MWInput
void InputManager::rest()
{
if (!mControlSwitch["playercontrols"])
return;
if (!MWBase::Environment::get().getWindowManager()->getRestEnabled () || MWBase::Environment::get().getWindowManager()->isGuiMode ())
return;
@ -734,6 +735,9 @@ namespace MWInput
void InputManager::toggleInventory()
{
if (!mControlSwitch["playercontrols"])
return;
if (MyGUI::InputManager::getInstance ().isModalAny())
return;
@ -770,6 +774,8 @@ namespace MWInput
void InputManager::toggleJournal()
{
if (!mControlSwitch["playercontrols"])
return;
if (MyGUI::InputManager::getInstance ().isModalAny())
return;
@ -787,6 +793,8 @@ namespace MWInput
void InputManager::quickKey (int index)
{
if (!mControlSwitch["playercontrols"])
return;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
if (player.getClass().getNpcStats(player).isWerewolf())
{

@ -396,11 +396,7 @@ namespace MWMechanics
{
CreatureStats& creatureStats = ptr.getClass().getCreatureStats (ptr);
int strength = creatureStats.getAttribute(ESM::Attribute::Strength).getModified();
int intelligence = creatureStats.getAttribute(ESM::Attribute::Intelligence).getModified();
int willpower = creatureStats.getAttribute(ESM::Attribute::Willpower).getModified();
int agility = creatureStats.getAttribute(ESM::Attribute::Agility).getModified();
int endurance = creatureStats.getAttribute(ESM::Attribute::Endurance).getModified();
float base = 1.f;
if (ptr.getCellRef().getRefId() == "player")
@ -415,11 +411,6 @@ namespace MWMechanics
float diff = (static_cast<int>(magickaFactor*intelligence)) - magicka.getBase();
magicka.modify(diff);
creatureStats.setMagicka(magicka);
DynamicStat<float> fatigue = creatureStats.getFatigue();
diff = (strength+willpower+agility+endurance) - fatigue.getBase();
fatigue.modify(diff);
creatureStats.setFatigue(fatigue);
}
void Actors::restoreDynamicStats (const MWWorld::Ptr& ptr, bool sleep)

@ -1645,6 +1645,8 @@ void CharacterController::playGroup(const std::string &groupname, int mode, int
}
else if(mode == 0)
{
if (!mAnimQueue.empty())
mAnimation->stopLooping(mAnimQueue.front().first);
mAnimQueue.resize(1);
mAnimQueue.push_back(std::make_pair(groupname, count-1));
}

@ -20,7 +20,7 @@ namespace MWMechanics
mAttacked (false),
mAttackingOrSpell(false),
mIsWerewolf(false),
mFallHeight(0), mRecalcDynamicStats(false), mKnockdown(false), mKnockdownOneFrame(false),
mFallHeight(0), mRecalcMagicka(false), mKnockdown(false), mKnockdownOneFrame(false),
mKnockdownOverOneFrame(false), mHitRecovery(false), mBlock(false),
mMovementFlags(0), mDrawState (DrawState_Nothing), mAttackStrength(0.f),
mLastRestock(0,0), mGoldPool(0), mActorId(-1),
@ -147,10 +147,22 @@ namespace MWMechanics
if (value != currentValue)
{
if (index != ESM::Attribute::Luck
&& index != ESM::Attribute::Personality
&& index != ESM::Attribute::Speed)
mRecalcDynamicStats = true;
if (index == ESM::Attribute::Intelligence)
mRecalcMagicka = true;
else if (index == ESM::Attribute::Strength ||
index == ESM::Attribute::Willpower ||
index == ESM::Attribute::Agility ||
index == ESM::Attribute::Endurance)
{
int strength = getAttribute(ESM::Attribute::Strength).getModified();
int willpower = getAttribute(ESM::Attribute::Willpower).getModified();
int agility = getAttribute(ESM::Attribute::Agility).getModified();
int endurance = getAttribute(ESM::Attribute::Endurance).getModified();
DynamicStat<float> fatigue = getFatigue();
float diff = (strength+willpower+agility+endurance) - fatigue.getBase();
fatigue.modify(diff);
setFatigue(fatigue);
}
}
if(!mIsWerewolf)
@ -200,7 +212,7 @@ namespace MWMechanics
{
if (effects.get(ESM::MagicEffect::FortifyMaximumMagicka).getModifier()
!= mMagicEffects.get(ESM::MagicEffect::FortifyMaximumMagicka).getModifier())
mRecalcDynamicStats = true;
mRecalcMagicka = true;
mMagicEffects.setModifiers(effects);
}
@ -361,9 +373,9 @@ namespace MWMechanics
bool CreatureStats::needToRecalcDynamicStats()
{
if (mRecalcDynamicStats)
if (mRecalcMagicka)
{
mRecalcDynamicStats = false;
mRecalcMagicka = false;
return true;
}
return false;
@ -371,7 +383,7 @@ namespace MWMechanics
void CreatureStats::setNeedRecalcDynamicStats(bool val)
{
mRecalcDynamicStats = val;
mRecalcMagicka = val;
}
void CreatureStats::setKnockedDown(bool value)
@ -498,7 +510,7 @@ namespace MWMechanics
state.mAttackStrength = mAttackStrength;
state.mFallHeight = mFallHeight; // TODO: vertical velocity (move from PhysicActor to CreatureStats?)
state.mLastHitObject = mLastHitObject;
state.mRecalcDynamicStats = mRecalcDynamicStats;
state.mRecalcDynamicStats = mRecalcMagicka;
state.mDrawState = mDrawState;
state.mLevel = mLevel;
state.mActorId = mActorId;
@ -546,7 +558,7 @@ namespace MWMechanics
mAttackStrength = state.mAttackStrength;
mFallHeight = state.mFallHeight;
mLastHitObject = state.mLastHitObject;
mRecalcDynamicStats = state.mRecalcDynamicStats;
mRecalcMagicka = state.mRecalcDynamicStats;
mDrawState = DrawState_(state.mDrawState);
mLevel = state.mLevel;
mActorId = state.mActorId;

@ -53,8 +53,7 @@ namespace MWMechanics
std::string mLastHitObject; // The last object to hit this actor
// Do we need to recalculate stats derived from attributes or other factors?
bool mRecalcDynamicStats;
bool mRecalcMagicka;
// For merchants: the last time items were restocked and gold pool refilled.
MWWorld::TimeStamp mLastRestock;

@ -842,6 +842,17 @@ void Animation::changeGroups(const std::string &groupname, int groups)
return;
}
}
void Animation::stopLooping(const std::string& groupname)
{
AnimStateMap::iterator stateiter = mStates.find(groupname);
if(stateiter != mStates.end())
{
stateiter->second.mLoopCount = 0;
return;
}
}
void Animation::play(const std::string &groupname, int priority, int groups, bool autodisable, float speedmult, const std::string &start, const std::string &stop, float startpoint, size_t loops)
{
if(!mSkelBase || mAnimSources.empty())

@ -260,6 +260,10 @@ public:
float speedmult, const std::string &start, const std::string &stop,
float startpoint, size_t loops);
/** If the given animation group is currently playing, set its remaining loop count to '0'.
*/
void stopLooping(const std::string& groupName);
/** Adjust the speed multiplier of an already playing animation.
*/
void adjustSpeedMult (const std::string& groupname, float speedmult);

@ -55,6 +55,7 @@ void WeaponAnimation::attachArrow(MWWorld::Ptr actor)
return;
std::string model = ammo->getClass().getModel(*ammo);
assert(weapon->mSkelBase && "Need a skeleton to attach the arrow to");
mAmmunition = NifOgre::Loader::createObjects(weapon->mSkelBase, "ArrowBone", weapon->mSkelBase->getParentSceneNode(), model);
configureAddedObject(mAmmunition, *ammo, MWWorld::InventoryStore::Slot_Ammunition);
}

@ -55,7 +55,7 @@ namespace MWScript
throw std::runtime_error ("animation mode out of range");
}
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, 1);
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, std::numeric_limits<int>::max());
}
};

@ -964,6 +964,9 @@ namespace MWScript
msg << "Grid: " << cell->getCell()->getGridX() << " " << cell->getCell()->getGridY() << std::endl;
Ogre::Vector3 pos (ptr.getRefData().getPosition().pos);
msg << "Coordinates: " << pos << std::endl;
msg << "Model: " << ptr.getClass().getModel(ptr) << std::endl;
if (!ptr.getClass().getScript(ptr).empty())
msg << "Script: " << ptr.getClass().getScript(ptr) << std::endl;
}
std::string notes = runtime.getStringLiteral (runtime[0].mInteger);

@ -278,7 +278,9 @@ namespace MWScript
MWMechanics::DynamicStat<float> stat (ptr.getClass().getCreatureStats (ptr)
.getDynamic (mIndex));
stat.setCurrent (diff + current, true);
// for fatigue, a negative current value is allowed and means the actor will be knocked down
bool allowDecreaseBelowZero = (mIndex == 2);
stat.setCurrent (diff + current, allowDecreaseBelowZero);
ptr.getClass().getCreatureStats (ptr).setDynamic (mIndex, stat);
}

@ -62,7 +62,7 @@ void Wizard::ComponentSelectionPage::initializePage()
if (field(QLatin1String("installation.new")).toBool() == true)
{
morrowindItem->setFlags(morrowindItem->flags() & !Qt::ItemIsEnabled & Qt::ItemIsUserCheckable);
morrowindItem->setFlags(morrowindItem->flags() & ~Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
morrowindItem->setData(Qt::CheckStateRole, Qt::Checked);
componentsList->addItem(morrowindItem);
@ -77,7 +77,7 @@ void Wizard::ComponentSelectionPage::initializePage()
if (mWizard->mInstallations[path].hasMorrowind) {
morrowindItem->setText(tr("Morrowind\t\t(installed)"));
morrowindItem->setFlags(morrowindItem->flags() & !Qt::ItemIsEnabled & Qt::ItemIsUserCheckable);
morrowindItem->setFlags(morrowindItem->flags() & ~Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
morrowindItem->setData(Qt::CheckStateRole, Qt::Unchecked);
} else {
morrowindItem->setText(tr("Morrowind"));
@ -88,7 +88,7 @@ void Wizard::ComponentSelectionPage::initializePage()
if (mWizard->mInstallations[path].hasTribunal) {
tribunalItem->setText(tr("Tribunal\t\t(installed)"));
tribunalItem->setFlags(tribunalItem->flags() & !Qt::ItemIsEnabled & Qt::ItemIsUserCheckable);
tribunalItem->setFlags(tribunalItem->flags() & ~Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
tribunalItem->setData(Qt::CheckStateRole, Qt::Unchecked);
} else {
tribunalItem->setText(tr("Tribunal"));
@ -99,7 +99,7 @@ void Wizard::ComponentSelectionPage::initializePage()
if (mWizard->mInstallations[path].hasBloodmoon) {
bloodmoonItem->setText(tr("Bloodmoon\t\t(installed)"));
bloodmoonItem->setFlags(bloodmoonItem->flags() & !Qt::ItemIsEnabled & Qt::ItemIsUserCheckable);
bloodmoonItem->setFlags(bloodmoonItem->flags() & ~Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
bloodmoonItem->setData(Qt::CheckStateRole, Qt::Unchecked);
} else {
bloodmoonItem->setText(tr("Bloodmoon"));

@ -133,8 +133,6 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
mResourceName = mShape->getName();
mShape->mCollide = false;
mBoundingBox = NULL;
mShape->mBoxTranslation = Ogre::Vector3(0,0,0);
mShape->mBoxRotation = Ogre::Quaternion::IDENTITY;
mStaticMesh = NULL;
mCompoundShape = NULL;

@ -111,7 +111,7 @@ bool NIFSkeletonLoader::needSkeleton(const Nif::Node *node)
/* We need to be a little aggressive here, since some NIFs have a crap-ton
* of nodes and Ogre only supports 256 bones. We will skip a skeleton if:
* There are no bones used for skinning, there are no keyframe controllers, there
* are no nodes named "AttachLight", and the tree consists of NiNode,
* are no nodes named "AttachLight" or "ArrowBone", and the tree consists of NiNode,
* NiTriShape, and RootCollisionNode types only.
*/
if(node->boneTrafo)
@ -126,7 +126,7 @@ bool NIFSkeletonLoader::needSkeleton(const Nif::Node *node)
} while(!(ctrl=ctrl->next).empty());
}
if (node->name == "AttachLight")
if (node->name == "AttachLight" || node->name == "ArrowBone")
return true;
if(node->recType == Nif::RC_NiNode || node->recType == Nif::RC_RootCollisionNode)

@ -54,6 +54,8 @@ namespace sh
OgrePlatform::~OgrePlatform ()
{
Ogre::MaterialManager::getSingleton().removeListener(this);
delete sSerializer;
}

@ -514,6 +514,7 @@ namespace Physic
assert (mRaycastingObjectMap.find(name) == mRaycastingObjectMap.end());
mRaycastingObjectMap[name] = body;
mDynamicsWorld->addRigidBody(body,CollisionType_Raycasting,CollisionType_Raycasting|CollisionType_Projectile);
body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_DISABLE_VISUALIZE_OBJECT);
}
return body;

Loading…
Cancel
Save