loadfix
scrawl 10 years ago
commit 273a80e2c0

@ -19,7 +19,6 @@ after_script:
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./openmw_test_suite; fi
notifications: notifications:
recipients: recipients:
- lgromanowski+travis.ci@gmail.com
- corrmage+travis-ci@gmail.com - corrmage+travis-ci@gmail.com
email: email:
on_success: change on_success: change

@ -13,7 +13,7 @@ message(STATUS "Configuring OpenMW...")
set(OPENMW_VERSION_MAJOR 0) set(OPENMW_VERSION_MAJOR 0)
set(OPENMW_VERSION_MINOR 33) set(OPENMW_VERSION_MINOR 33)
set(OPENMW_VERSION_RELEASE 0) set(OPENMW_VERSION_RELEASE 1)
set(OPENMW_VERSION_COMMITHASH "") set(OPENMW_VERSION_COMMITHASH "")
set(OPENMW_VERSION_TAGHASH "") set(OPENMW_VERSION_TAGHASH "")

@ -255,7 +255,7 @@ namespace CSVRender
std::pair<std::string, Ogre::Vector3> result = terrainUnderCursor(event->x(), event->y()); std::pair<std::string, Ogre::Vector3> result = terrainUnderCursor(event->x(), event->y());
if(result.first != "") if(result.first != "")
{ {
// FIXME: terrain editing // FIXME: terrain editing goes here
} }
break; break;
} }
@ -267,6 +267,8 @@ namespace CSVRender
void MouseState::mouseDoubleClickEvent (QMouseEvent *event) void MouseState::mouseDoubleClickEvent (QMouseEvent *event)
{ {
event->ignore(); event->ignore();
//mPhysics->toggleDebugRendering(mSceneManager);
//mParent->flagAsModified();
} }
bool MouseState::wheelEvent (QWheelEvent *event) bool MouseState::wheelEvent (QWheelEvent *event)

@ -2,6 +2,8 @@
#include <iostream> #include <iostream>
#include <openengine/bullet/BulletShapeLoader.h>
#include "../render/worldspacewidget.hpp" #include "../render/worldspacewidget.hpp"
#include "physicssystem.hpp" #include "physicssystem.hpp"
@ -54,6 +56,12 @@ namespace CSVWorld
{ {
mSceneWidgets.erase(it); mSceneWidgets.erase(it);
} }
// cleanup global resources used by OEngine
if(mPhysics.empty())
{
delete OEngine::Physic::BulletShapeManager::getSingletonPtr();
}
} }
// called from CSVRender::WorldspaceWidget() to get widgets' association with Document& // called from CSVRender::WorldspaceWidget() to get widgets' association with Document&
@ -74,6 +82,9 @@ namespace CSVWorld
throw std::runtime_error("No physics system found for the given document."); throw std::runtime_error("No physics system found for the given document.");
} }
// deprecated by removeDocument() and may be deleted in future code updates
// however there may be some value in removing the deleted scene widgets from the
// list so that the list does not grow forever
void PhysicsManager::removeSceneWidget(CSVRender::WorldspaceWidget *widget) void PhysicsManager::removeSceneWidget(CSVRender::WorldspaceWidget *widget)
{ {
CSVRender::SceneWidget *sceneWidget = static_cast<CSVRender::SceneWidget *>(widget); CSVRender::SceneWidget *sceneWidget = static_cast<CSVRender::SceneWidget *>(widget);

@ -22,10 +22,7 @@ namespace CSVWorld
PhysicsSystem::~PhysicsSystem() PhysicsSystem::~PhysicsSystem()
{ {
// FIXME: OEngine does not behave well when multiple instances are created delete mEngine;
// and deleted, sometimes resulting in crashes. Skip the deletion until the physics
// code is moved out of OEngine.
//delete mEngine;
} }
// looks up the scene manager based on the scene node name (inefficient) // looks up the scene manager based on the scene node name (inefficient)
@ -278,6 +275,8 @@ namespace CSVWorld
void PhysicsSystem::addSceneManager(Ogre::SceneManager *sceneMgr, CSVRender::SceneWidget *sceneWidget) void PhysicsSystem::addSceneManager(Ogre::SceneManager *sceneMgr, CSVRender::SceneWidget *sceneWidget)
{ {
mSceneWidgets[sceneMgr] = sceneWidget; mSceneWidgets[sceneMgr] = sceneWidget;
mEngine->createDebugDraw(sceneMgr);
} }
std::map<Ogre::SceneManager*, CSVRender::SceneWidget *> PhysicsSystem::sceneWidgets() std::map<Ogre::SceneManager*, CSVRender::SceneWidget *> PhysicsSystem::sceneWidgets()
@ -287,6 +286,8 @@ namespace CSVWorld
void PhysicsSystem::removeSceneManager(Ogre::SceneManager *sceneMgr) void PhysicsSystem::removeSceneManager(Ogre::SceneManager *sceneMgr)
{ {
mEngine->removeDebugDraw(sceneMgr);
mSceneWidgets.erase(sceneMgr); mSceneWidgets.erase(sceneMgr);
} }
@ -310,8 +311,6 @@ namespace CSVWorld
if(!sceneMgr) if(!sceneMgr)
return; return;
mEngine->setSceneManager(sceneMgr);
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance(); CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
if(!(userSettings.setting("debug/mouse-picking", QString("false")) == "true" ? true : false)) if(!(userSettings.setting("debug/mouse-picking", QString("false")) == "true" ? true : false))
{ {
@ -319,7 +318,7 @@ namespace CSVWorld
return; return;
} }
mEngine->toggleDebugRendering(); mEngine->toggleDebugRendering(sceneMgr);
mEngine->stepSimulation(0.0167); // DebugDrawer::step() not directly accessible mEngine->stepDebug(sceneMgr);
} }
} }

@ -369,7 +369,7 @@ namespace MWMechanics
void Actors::updateNpc (const MWWorld::Ptr& ptr, float duration) void Actors::updateNpc (const MWWorld::Ptr& ptr, float duration)
{ {
updateDrowning(ptr, duration); updateDrowning(ptr, duration);
calculateNpcStatModifiers(ptr); calculateNpcStatModifiers(ptr, duration);
updateEquippedLight(ptr, duration); updateEquippedLight(ptr, duration);
} }
@ -499,6 +499,9 @@ namespace MWMechanics
effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).getMagnitude() - effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::AbsorbAttribute, i)).getMagnitude()); effects.get(EffectKey(ESM::MagicEffect::AbsorbAttribute, i)).getMagnitude());
stat.damage(effects.get(EffectKey(ESM::MagicEffect::DamageAttribute, i)).getMagnitude() * duration * 1.5);
stat.restore(effects.get(EffectKey(ESM::MagicEffect::RestoreAttribute, i)).getMagnitude() * duration * 1.5);
creatureStats.setAttribute(i, stat); creatureStats.setAttribute(i, stat);
} }
@ -855,7 +858,7 @@ namespace MWMechanics
} }
} }
void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr) void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr, float duration)
{ {
NpcStats &npcStats = ptr.getClass().getNpcStats(ptr); NpcStats &npcStats = ptr.getClass().getNpcStats(ptr);
const MagicEffects &effects = npcStats.getMagicEffects(); const MagicEffects &effects = npcStats.getMagicEffects();
@ -867,6 +870,9 @@ namespace MWMechanics
skill.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifySkill, i)).getMagnitude() - skill.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifySkill, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::DrainSkill, i)).getMagnitude() - effects.get(EffectKey(ESM::MagicEffect::DrainSkill, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::AbsorbSkill, i)).getMagnitude()); effects.get(EffectKey(ESM::MagicEffect::AbsorbSkill, i)).getMagnitude());
skill.damage(effects.get(EffectKey(ESM::MagicEffect::DamageSkill, i)).getMagnitude() * duration * 1.5);
skill.restore(effects.get(EffectKey(ESM::MagicEffect::RestoreSkill, i)).getMagnitude() * duration * 1.5);
} }
} }
@ -1534,6 +1540,6 @@ namespace MWMechanics
adjustMagicEffects(ptr); adjustMagicEffects(ptr);
calculateCreatureStatModifiers(ptr, 0.f); calculateCreatureStatModifiers(ptr, 0.f);
if (ptr.getClass().isNpc()) if (ptr.getClass().isNpc())
calculateNpcStatModifiers(ptr); calculateNpcStatModifiers(ptr, 0.f);
} }
} }

@ -34,7 +34,7 @@ namespace MWMechanics
void calculateDynamicStats (const MWWorld::Ptr& ptr); void calculateDynamicStats (const MWWorld::Ptr& ptr);
void calculateCreatureStatModifiers (const MWWorld::Ptr& ptr, float duration); void calculateCreatureStatModifiers (const MWWorld::Ptr& ptr, float duration);
void calculateNpcStatModifiers (const MWWorld::Ptr& ptr); void calculateNpcStatModifiers (const MWWorld::Ptr& ptr, float duration);
void calculateRestoration (const MWWorld::Ptr& ptr, float duration); void calculateRestoration (const MWWorld::Ptr& ptr, float duration);

@ -70,11 +70,13 @@ namespace MWMechanics
if (mPermanentSpellEffects.find(lower) != mPermanentSpellEffects.end()) if (mPermanentSpellEffects.find(lower) != mPermanentSpellEffects.end())
{ {
MagicEffects & effects = mPermanentSpellEffects[lower]; MagicEffects & effects = mPermanentSpellEffects[lower];
for (MagicEffects::Collection::const_iterator effectIt = effects.begin(); effectIt != effects.end(); ++effectIt) for (MagicEffects::Collection::const_iterator effectIt = effects.begin(); effectIt != effects.end();)
{ {
const ESM::MagicEffect * magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectIt->first.mId); const ESM::MagicEffect * magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectIt->first.mId);
if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful)
effects.remove(effectIt->first); effects.remove((effectIt++)->first);
else
++effectIt;
} }
} }
mCorprusSpells.erase(corprusIt); mCorprusSpells.erase(corprusIt);

@ -236,20 +236,20 @@ namespace MWMechanics
{ {
int mBase; int mBase;
int mModifier; int mModifier;
int mDamage; float mDamage; // needs to be float to allow continuous damage
public: public:
AttributeValue() : mBase(0), mModifier(0), mDamage(0) {} AttributeValue() : mBase(0), mModifier(0), mDamage(0) {}
int getModified() const { return std::max(0, mBase - mDamage + mModifier); } int getModified() const { return std::max(0, mBase - (int) mDamage + mModifier); }
int getBase() const { return mBase; } int getBase() const { return mBase; }
int getModifier() const { return mModifier; } int getModifier() const { return mModifier; }
void setBase(int base) { mBase = std::max(0, base); } void setBase(int base) { mBase = std::max(0, base); }
void setModifier(int mod) { mModifier = mod; } void setModifier(int mod) { mModifier = mod; }
void damage(int damage) { mDamage += damage; } void damage(float damage) { mDamage += damage; }
void restore(int amount) { mDamage -= std::min(mDamage, amount); } void restore(float amount) { mDamage -= std::min(mDamage, amount); }
int getDamage() const { return mDamage; } int getDamage() const { return mDamage; }
void writeState (ESM::StatState<int>& state) const; void writeState (ESM::StatState<int>& state) const;

@ -125,6 +125,9 @@ namespace MWScript
{ {
MWWorld::Ptr ptr = R()(runtime); MWWorld::Ptr ptr = R()(runtime);
if (!ptr.getRefData().isEnabled())
return;
MWBase::Environment::get().getDialogueManager()->startDialogue (ptr); MWBase::Environment::get().getDialogueManager()->startDialogue (ptr);
} }
}; };

@ -14,6 +14,7 @@
#include <openengine/bullet/physic.hpp> #include <openengine/bullet/physic.hpp>
#include <openengine/bullet/BtOgreExtras.h> #include <openengine/bullet/BtOgreExtras.h>
#include <openengine/ogre/renderer.hpp> #include <openengine/ogre/renderer.hpp>
#include <openengine/bullet/BulletShapeLoader.h>
#include <components/nifbullet/bulletnifloader.hpp> #include <components/nifbullet/bulletnifloader.hpp>
@ -471,10 +472,9 @@ namespace MWWorld
physicActor->setInertialForce(Ogre::Vector3(0.0f)); physicActor->setInertialForce(Ogre::Vector3(0.0f));
else else
{ {
float diff = time*-627.2f; inertia.z += time * -627.2f;
if (inertia.z < 0) if (inertia.z < 0)
diff *= slowFall; inertia.z *= slowFall;
inertia.z += diff;
physicActor->setInertialForce(inertia); physicActor->setInertialForce(inertia);
} }
physicActor->setOnGround(isOnGround); physicActor->setOnGround(isOnGround);
@ -498,6 +498,7 @@ namespace MWWorld
if (mWaterCollisionObject.get()) if (mWaterCollisionObject.get())
mEngine->mDynamicsWorld->removeCollisionObject(mWaterCollisionObject.get()); mEngine->mDynamicsWorld->removeCollisionObject(mWaterCollisionObject.get());
delete mEngine; delete mEngine;
delete OEngine::Physic::BulletShapeManager::getSingletonPtr();
} }
OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine() OEngine::Physic::PhysicEngine* PhysicsSystem::getEngine()
@ -863,8 +864,8 @@ namespace MWWorld
continue; continue;
physicActor->setCanWaterWalk(waterCollision); physicActor->setCanWaterWalk(waterCollision);
// 100 points of slowfall reduce gravity by 90% (this is just a guess) // Slow fall reduces fall speed by a factor of (effect magnitude / 200)
float slowFall = 1-std::min(std::max(0.f, (effects.get(ESM::MagicEffect::SlowFall).getMagnitude() / 100.f) * 0.9f), 0.9f); float slowFall = 1.f - std::max(0.f, std::min(1.f, effects.get(ESM::MagicEffect::SlowFall).getMagnitude() * 0.005f));
Ogre::Vector3 newpos = MovementSolver::move(iter->first, iter->second, mTimeAccum, Ogre::Vector3 newpos = MovementSolver::move(iter->first, iter->second, mTimeAccum,
world->isFlying(iter->first), world->isFlying(iter->first),

@ -15,7 +15,7 @@ namespace ESM
T mMod; // Note: can either be the modifier, or the modified value. T mMod; // Note: can either be the modifier, or the modified value.
// A bit inconsistent, but we can't fix this without breaking compatibility. // A bit inconsistent, but we can't fix this without breaking compatibility.
T mCurrent; T mCurrent;
T mDamage; float mDamage;
float mProgress; float mProgress;
StatState(); StatState();
@ -36,8 +36,14 @@ namespace ESM
esm.getHNOT (mMod, "STMO"); esm.getHNOT (mMod, "STMO");
mCurrent = 0; mCurrent = 0;
esm.getHNOT (mCurrent, "STCU"); esm.getHNOT (mCurrent, "STCU");
mDamage = 0;
esm.getHNOT (mDamage, "STDA"); // mDamage was changed to a float; ensure backwards compatibility
T oldDamage = 0;
esm.getHNOT(oldDamage, "STDA");
mDamage = oldDamage;
esm.getHNOT (mDamage, "STDF");
mProgress = 0; mProgress = 0;
esm.getHNOT (mProgress, "STPR"); esm.getHNOT (mProgress, "STPR");
} }
@ -54,7 +60,7 @@ namespace ESM
esm.writeHNT ("STCU", mCurrent); esm.writeHNT ("STCU", mCurrent);
if (mDamage) if (mDamage)
esm.writeHNT ("STDA", mDamage); esm.writeHNT ("STDF", mDamage);
if (mProgress) if (mProgress)
esm.writeHNT ("STPR", mProgress); esm.writeHNT ("STPR", mProgress);

@ -46,6 +46,7 @@ Jannik Heller (scrawl)
Jason Hooks (jhooks) Jason Hooks (jhooks)
jeaye jeaye
Jeffrey Haines (Jyby) Jeffrey Haines (Jyby)
Jengerer
Joel Graff (graffy) Joel Graff (graffy)
John Blomberg (fstp) John Blomberg (fstp)
Jordan Ayers Jordan Ayers

@ -1,5 +1,5 @@
data="?global?data"
data="?mw?Data Files" data="?mw?Data Files"
data=${MORROWIND_DATA_FILES}
data-local="?userdata?data" data-local="?userdata?data"
resources=${OPENMW_RESOURCE_FILES} resources=${OPENMW_RESOURCE_FILES}
script-blacklist=Museum script-blacklist=Museum

@ -212,8 +212,10 @@ public:
~DebugDrawer() ~DebugDrawer()
{ {
Ogre::MaterialManager::getSingleton().remove("BtOgre/DebugLines"); if (Ogre::MaterialManager::getSingleton().resourceExists("BtOgre/DebugLines"))
Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup("BtOgre"); Ogre::MaterialManager::getSingleton().remove("BtOgre/DebugLines");
if (Ogre::ResourceGroupManager::getSingleton().resourceGroupExists("BtOgre"))
Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup("BtOgre");
delete mLineDrawer; delete mLineDrawer;
} }

@ -114,7 +114,7 @@ namespace Physic
{ {
mEngine->mDynamicsWorld->removeRigidBody(mBody); mEngine->mDynamicsWorld->removeRigidBody(mBody);
delete mBody; delete mBody;
} }
} }
void PhysicActor::enableCollisionMode(bool collision) void PhysicActor::enableCollisionMode(bool collision)
@ -356,7 +356,8 @@ namespace Physic
delete broadphase; delete broadphase;
delete mShapeLoader; delete mShapeLoader;
delete BulletShapeManager::getSingletonPtr(); // Moved the cleanup to mwworld/physicssystem
//delete BulletShapeManager::getSingletonPtr();
} }
void PhysicEngine::addHeightField(float* heights, void PhysicEngine::addHeightField(float* heights,
@ -863,5 +864,76 @@ namespace Physic
} }
} }
int PhysicEngine::toggleDebugRendering(Ogre::SceneManager *sceneMgr)
{
if(!sceneMgr)
return 0;
std::map<Ogre::SceneManager *, BtOgre::DebugDrawer *>::iterator iter =
mDebugDrawers.find(sceneMgr);
if(iter != mDebugDrawers.end()) // found scene manager
{
if((*iter).second)
{
// set a new drawer each time (maybe with a different scene manager)
mDynamicsWorld->setDebugDrawer(mDebugDrawers[sceneMgr]);
if(!mDebugDrawers[sceneMgr]->getDebugMode())
mDebugDrawers[sceneMgr]->setDebugMode(1 /*mDebugDrawFlags*/);
else
mDebugDrawers[sceneMgr]->setDebugMode(0);
mDynamicsWorld->debugDrawWorld();
return mDebugDrawers[sceneMgr]->getDebugMode();
}
}
return 0;
}
void PhysicEngine::stepDebug(Ogre::SceneManager *sceneMgr)
{
if(!sceneMgr)
return;
std::map<Ogre::SceneManager *, BtOgre::DebugDrawer *>::iterator iter =
mDebugDrawers.find(sceneMgr);
if(iter != mDebugDrawers.end()) // found scene manager
{
if((*iter).second)
(*iter).second->step();
else
return;
}
}
void PhysicEngine::createDebugDraw(Ogre::SceneManager *sceneMgr)
{
if(mDebugDrawers.find(sceneMgr) == mDebugDrawers.end())
{
mDebugSceneNodes[sceneMgr] = sceneMgr->getRootSceneNode()->createChildSceneNode();
mDebugDrawers[sceneMgr] = new BtOgre::DebugDrawer(mDebugSceneNodes[sceneMgr], mDynamicsWorld);
mDebugDrawers[sceneMgr]->setDebugMode(0);
}
}
void PhysicEngine::removeDebugDraw(Ogre::SceneManager *sceneMgr)
{
std::map<Ogre::SceneManager *, BtOgre::DebugDrawer *>::iterator iter =
mDebugDrawers.find(sceneMgr);
if(iter != mDebugDrawers.end())
{
delete (*iter).second;
mDebugDrawers.erase(iter);
}
std::map<Ogre::SceneManager *, Ogre::SceneNode *>::iterator it =
mDebugSceneNodes.find(sceneMgr);
if(it != mDebugSceneNodes.end())
{
std::string sceneNodeName = (*it).second->getName();
if(sceneMgr->hasSceneNode(sceneNodeName))
sceneMgr->destroySceneNode(sceneNodeName);
}
}
} }
} }

@ -348,6 +348,15 @@ namespace Physic
bool isDebugCreated; bool isDebugCreated;
bool mDebugActive; bool mDebugActive;
// for OpenCS with multiple engines per document
std::map<Ogre::SceneManager *, BtOgre::DebugDrawer *> mDebugDrawers;
std::map<Ogre::SceneManager *, Ogre::SceneNode *> mDebugSceneNodes;
int toggleDebugRendering(Ogre::SceneManager *sceneMgr);
void stepDebug(Ogre::SceneManager *sceneMgr);
void createDebugDraw(Ogre::SceneManager *sceneMgr);
void removeDebugDraw(Ogre::SceneManager *sceneMgr);
private: private:
PhysicEngine(const PhysicEngine&); PhysicEngine(const PhysicEngine&);
PhysicEngine& operator=(const PhysicEngine&); PhysicEngine& operator=(const PhysicEngine&);

@ -3,7 +3,7 @@ OpenMW: A reimplementation of The Elder Scrolls III: Morrowind
OpenMW is an attempt at recreating the engine for the popular role-playing game OpenMW is an attempt at recreating the engine for the popular role-playing game
Morrowind by Bethesda Softworks. You need to own and install the original game for OpenMW to work. Morrowind by Bethesda Softworks. You need to own and install the original game for OpenMW to work.
Version: 0.33.0 Version: 0.33.1
License: GPL (see GPL3.txt for more information) License: GPL (see GPL3.txt for more information)
Website: http://www.openmw.org Website: http://www.openmw.org
@ -98,6 +98,10 @@ Allowed options:
CHANGELOG CHANGELOG
0.33.1
Bug #2108: OpenCS fails to build
0.33.0 0.33.0
Bug #371: If console assigned to ` (probably to any symbolic key), "`" symbol will be added to console every time it closed Bug #371: If console assigned to ` (probably to any symbolic key), "`" symbol will be added to console every time it closed

Loading…
Cancel
Save