From b1381ddd693995d4920a0e683b313ed46869bf6f Mon Sep 17 00:00:00 2001 From: Sergey Shambir Date: Mon, 25 Feb 2013 04:12:41 +0400 Subject: [PATCH 01/65] Nif loader: workaround for missed textures in BB/BH Works for Better Bodies / Better Heads addons. --- components/nifogre/ogre_nif_loader.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index dfbc93ee90..0ee778df30 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -540,7 +540,7 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String Nif::NiSourceTexture *st = t->textures[0].texture.getPtr(); if (st->external) { - /* Bethesda at some at some point converted all their BSA + /* Bethesda at some point converted all their BSA * textures from tga to dds for increased load speed, but all * texture file name references were kept as .tga. */ @@ -559,6 +559,17 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName)) texName = path + st->filename; } + else if (!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName)) + { + // workaround for Better Heads addon + size_t lastSlash = st->filename.rfind('\\'); + if (lastSlash != std::string::npos && lastSlash + 1 != st->filename.size()) { + texName = path + st->filename.substr(lastSlash + 1); + // workaround for Better Bodies addon + if (!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName)) + texName = st->filename; + } + } } else warn("Found internal texture, ignoring."); } From da575b181e4f6929b97d0255ccc8dec1f8362b6e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 25 Feb 2013 13:04:17 -0800 Subject: [PATCH 02/65] Use the correct GMST for the race menu --- apps/openmw/mwgui/race.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index 699c687ff6..71a4d1b3e4 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -61,7 +61,7 @@ RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager) prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousHair); nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextHair); - setText("RaceT", mWindowManager.getGameSettingString("sRaceMenu4", "Race")); + setText("RaceT", mWindowManager.getGameSettingString("sRaceMenu5", "Race")); getWidget(mRaceList, "RaceList"); mRaceList->setScrollVisible(true); mRaceList->eventListSelectAccept += MyGUI::newDelegate(this, &RaceDialog::onSelectRace); From 429bc23cf6c2bc763213cb6d1052ee398f374391 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 25 Feb 2013 13:08:40 -0800 Subject: [PATCH 03/65] Convert the 0-1 glossiness parameter to 0-255 for shininess --- components/nifogre/ogre_nif_loader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 826d247c6f..fd376045f3 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -683,7 +683,7 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String new sh::Vector4(diffuse.x, diffuse.y, diffuse.z, alpha))); instance->setProperty ("specular", sh::makeProperty ( - new sh::Vector4(specular.x, specular.y, specular.z, glossiness))); + new sh::Vector4(specular.x, specular.y, specular.z, glossiness*255.0f))); instance->setProperty ("emissive", sh::makeProperty ( new sh::Vector3(emissive.x, emissive.y, emissive.z))); From aefd12dfe046f08ab55160ff4248f8576ca8e406 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 25 Feb 2013 15:44:59 -0800 Subject: [PATCH 04/65] Don't create meshes for collision shapes --- components/nifogre/ogre_nif_loader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index fd376045f3..97b297238f 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -1031,6 +1031,10 @@ public: void createMeshes(const Nif::Node *node, MeshInfoList &meshes, int flags=0) { + // Do not create meshes for the collision shape (includes all children) + if(node->recType == Nif::RC_RootCollisionNode) + return; + flags |= node->flags; // Marker objects: just skip the entire node From a576e9e430b0feaf5c27bce36a3c3313b831a11a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 25 Feb 2013 16:40:08 -0800 Subject: [PATCH 05/65] Set the race selection character preview in a valid (idle) pose. --- apps/openmw/mwrender/characterpreview.cpp | 6 ++++++ apps/openmw/mwrender/characterpreview.hpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index 36cac2155d..c32e9d1d68 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -161,6 +161,7 @@ namespace MWRender void RaceSelectionPreview::update(float angle) { + mAnimation->runAnimation(0.0f); mNode->roll(Ogre::Radian(angle), Ogre::SceneNode::TS_LOCAL); mNode->setVisible (true); @@ -175,4 +176,9 @@ namespace MWRender rebuild(); update(0); } + + void RaceSelectionPreview::onSetup () + { + mAnimation->play("idle", "start", "stop", false); + } } diff --git a/apps/openmw/mwrender/characterpreview.hpp b/apps/openmw/mwrender/characterpreview.hpp index d07a03be7d..cf1e250692 100644 --- a/apps/openmw/mwrender/characterpreview.hpp +++ b/apps/openmw/mwrender/characterpreview.hpp @@ -85,6 +85,8 @@ namespace MWRender public: RaceSelectionPreview(); + virtual void onSetup(); + void update(float angle); const ESM::NPC &getPrototype() const { From 955e2713a949e1d65d3c0f1bbf7975048960c8e0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 25 Feb 2013 17:29:32 -0800 Subject: [PATCH 06/65] Fix encumbrance term calculation --- apps/openmw/mwclass/npc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 12b40bfdcf..c8c61e118f 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -382,7 +382,7 @@ namespace MWClass const MWMechanics::MagicEffects &mageffects = npcdata->mCreatureStats.getMagicEffects(); const float encumbranceTerm = fJumpEncumbranceBase->getFloat() + fJumpEncumbranceMultiplier->getFloat() * - (Npc::getEncumbrance(ptr)/Npc::getCapacity(ptr)); + (1.0f - Npc::getEncumbrance(ptr)/Npc::getCapacity(ptr)); float a = npcdata->mNpcStats.getSkill(ESM::Skill::Acrobatics).getModified(); float b = 0.0f; From a5451eb9d92164397a7dd5499976d77bbad436fe Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 26 Feb 2013 08:30:06 +0100 Subject: [PATCH 07/65] Z-up conversion: terrain, objects --- apps/openmw/mwrender/renderingmanager.cpp | 3 +-- apps/openmw/mwrender/terrain.cpp | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 559fc01157..455e84f5ef 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -147,8 +147,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const // Morrowind uses, and it automagically makes everything work as it // should. SceneNode *rt = mRendering.getScene()->getRootSceneNode(); - mMwRoot = rt->createChildSceneNode("mwRoot"); - mMwRoot->pitch(Degree(-90)); + mMwRoot = rt; mObjects.setMwRoot(mMwRoot); mActors.setMwRoot(mMwRoot); diff --git a/apps/openmw/mwrender/terrain.cpp b/apps/openmw/mwrender/terrain.cpp index 2c2e9e6fcf..47ee6f06f9 100644 --- a/apps/openmw/mwrender/terrain.cpp +++ b/apps/openmw/mwrender/terrain.cpp @@ -26,7 +26,7 @@ namespace MWRender //---------------------------------------------------------------------------------------------- TerrainManager::TerrainManager(Ogre::SceneManager* mgr, RenderingManager* rend) : - mTerrainGroup(TerrainGroup(mgr, Terrain::ALIGN_X_Z, mLandSize, mWorldSize)), mRendering(rend) + mTerrainGroup(TerrainGroup(mgr, Terrain::ALIGN_X_Y, mLandSize, mWorldSize)), mRendering(rend) { mTerrainGlobals = OGRE_NEW TerrainGlobalOptions(); @@ -54,8 +54,8 @@ namespace MWRender mTerrainGlobals->setCompositeMapDistance(mWorldSize*2); mTerrainGroup.setOrigin(Vector3(mWorldSize/2, - 0, - -mWorldSize/2)); + mWorldSize/2, + 0)); Terrain::ImportData& importSettings = mTerrainGroup.getDefaultImportSettings(); From 3cb3ec91c065cd7ce4c229476b0e95a12cfe41f2 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 26 Feb 2013 09:12:35 +0100 Subject: [PATCH 08/65] Z-up conversion: camera --- apps/openmw/mwrender/player.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/apps/openmw/mwrender/player.cpp b/apps/openmw/mwrender/player.cpp index 9ab8a7de33..1ac3b072f5 100644 --- a/apps/openmw/mwrender/player.cpp +++ b/apps/openmw/mwrender/player.cpp @@ -113,11 +113,6 @@ namespace MWRender Ogre::Vector3 dir = mCamera->getRealDirection(); Ogre::Vector3 up = mCamera->getRealUp(); - Ogre::Real xch; - xch = pos.y, pos.y = -pos.z, pos.z = xch; - xch = dir.y, dir.y = -dir.z, dir.z = xch; - xch = up.y, up.y = -up.z, up.z = xch; - MWBase::Environment::get().getSoundManager()->setListenerPosDir(pos, dir, up); } @@ -323,10 +318,8 @@ namespace MWRender bool Player::getPosition(Ogre::Vector3 &player, Ogre::Vector3 &camera) { - float xch; mCamera->getParentSceneNode ()->needUpdate(true); camera = mCamera->getRealPosition(); - xch = camera.z, camera.z = camera.y, camera.y = -xch; player = mPlayerNode->getPosition(); return mFirstPersonView && !mVanity.enabled && !mPreviewMode; From 3ef952172d5a05133d94b9f3e6cf65a636eafa26 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 26 Feb 2013 10:38:48 +0100 Subject: [PATCH 09/65] Z-up conversion: water, sky --- apps/openmw/mwrender/renderingmanager.cpp | 7 +++--- apps/openmw/mwrender/sky.cpp | 1 - apps/openmw/mwrender/water.cpp | 14 +++++------ files/materials/objects.shader | 12 ++++----- files/materials/terrain.shader | 16 ++++++------ files/materials/underwater.h | 6 ++--- files/materials/water.shader | 30 ++++++++++++----------- 7 files changed, 43 insertions(+), 43 deletions(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 455e84f5ef..b2d7fbff08 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -365,7 +365,7 @@ void RenderingManager::update (float duration, bool paused) float *fpos = data.getPosition().pos; // only for LocalMap::updatePlayer() - Ogre::Vector3 pos(fpos[0], -fpos[2], -fpos[1]); + Ogre::Vector3 pos(fpos[0], fpos[1], fpos[2]); Ogre::SceneNode *node = data.getBaseNode(); Ogre::Quaternion orient = @@ -381,7 +381,7 @@ void RenderingManager::update (float duration, bool paused) mWater->updateUnderwater( world->isUnderwater( world->getPlayer().getPlayer().getCell(), - Ogre::Vector3(cam.x, -cam.z, cam.y)) + cam) ); mWater->update(duration); } @@ -613,8 +613,7 @@ void RenderingManager::sunDisable() void RenderingManager::setSunDirection(const Ogre::Vector3& direction) { // direction * -1 (because 'direction' is camera to sun vector and not sun to camera), - // then convert from MW to ogre coordinates (swap y,z and make y negative) - if (mSun) mSun->setDirection(Vector3(-direction.x, -direction.z, direction.y)); + if (mSun) mSun->setDirection(Vector3(-direction.x, -direction.y, -direction.z)); mSkyManager->setSunDirection(direction); } diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 767f3c4639..b747b0d9a8 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -236,7 +236,6 @@ SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera) { mSceneMgr = pMwRoot->getCreator(); mRootNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); - mRootNode->pitch(Degree(-90)); // convert MW to ogre coordinates mRootNode->setInheritOrientation(false); } diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index e8f099640b..e8ccbb2b46 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -42,9 +42,9 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel mIsUnderwater = false; - mWaterPlane = Plane(Vector3::UNIT_Y, 0); + mWaterPlane = Plane(Vector3::UNIT_Z, 0); - MeshManager::getSingleton().createPlane("water", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, mWaterPlane, CELL_SIZE*5, CELL_SIZE * 5, 10, 10, true, 1, 3,3, Vector3::UNIT_Z); + MeshManager::getSingleton().createPlane("water", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, mWaterPlane, CELL_SIZE*5, CELL_SIZE * 5, 10, 10, true, 1, 3,3, Vector3::UNIT_Y); mWater = mSceneManager->createEntity("water"); mWater->setVisibilityFlags(RV_Water); @@ -168,12 +168,12 @@ void Water::setHeight(const float height) { mTop = height; - mWaterPlane = Plane(Vector3::UNIT_Y, height); + mWaterPlane = Plane(Vector3::UNIT_Z, height); // small error due to reflection texture size & reflection distortion - mErrorPlane = Plane(Vector3::UNIT_Y, height - 5); + mErrorPlane = Plane(Vector3::UNIT_Z, height - 5); - mWaterNode->setPosition(0, height, 0); + mWaterNode->setPosition(0, 0, height); sh::Factory::getInstance ().setSharedParameter ("waterLevel", sh::makeProperty(new sh::FloatValue(height))); } @@ -199,7 +199,7 @@ Water::updateUnderwater(bool underwater) Vector3 Water::getSceneNodeCoordinates(int gridX, int gridY) { - return Vector3(gridX * CELL_SIZE + (CELL_SIZE / 2), mTop, -gridY * CELL_SIZE - (CELL_SIZE / 2)); + return Vector3(gridX * CELL_SIZE + (CELL_SIZE / 2), gridY * CELL_SIZE + (CELL_SIZE / 2), mTop); } void Water::preRenderTargetUpdate(const RenderTargetEvent& evt) @@ -216,7 +216,7 @@ void Water::preRenderTargetUpdate(const RenderTargetEvent& evt) mReflectionRenderActive = true; Vector3 pos = mCamera->getRealPosition(); - pos.y = mTop*2 - pos.y; + pos.z = mTop*2 - pos.z; mSky->setSkyPosition(pos); mReflectionCamera->enableReflection(mWaterPlane); } diff --git a/files/materials/objects.shader b/files/materials/objects.shader index 25624351c8..6adf7e3fa0 100644 --- a/files/materials/objects.shader +++ b/files/materials/objects.shader @@ -225,9 +225,9 @@ float3 waterEyePos = float3(1,1,1); // NOTE: this calculation would be wrong for non-uniform scaling float4 worldNormal = shMatrixMult(worldMatrix, float4(normal.xyz, 0)); - waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,1,0), waterLevel); + waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,0,1), waterLevel); caustics = getCaustics(causticMap, worldPos, waterEyePos.xyz, worldNormal.xyz, lightDirectionWS0.xyz, waterLevel, waterTimer, windDir_windSpeed); - if (worldPos.y >= waterLevel || waterEnabled != 1.f) + if (worldPos.z >= waterLevel || waterEnabled != 1.f) caustics = float3(1,1,1); #endif @@ -269,7 +269,7 @@ #if UNDERWATER // regular fog only if fragment is above water - if (worldPos.y > waterLevel || waterEnabled != 1.f) + if (worldPos.z > waterLevel || waterEnabled != 1.f) #endif shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, gammaCorrectRead(fogColour), fogValue); #endif @@ -278,7 +278,7 @@ shOutputColour(0).xyz = max(shOutputColour(0).xyz, float3(0,0,0)); #if UNDERWATER - float fogAmount = (cameraPos.y > waterLevel) + float fogAmount = (cameraPos.z > waterLevel) ? shSaturate(length(waterEyePos-worldPos) / VISIBILITY) : shSaturate(length(cameraPos.xyz-worldPos)/ VISIBILITY); @@ -292,14 +292,14 @@ waterGradient = clamp((waterGradient*0.5+0.5),0.2,1.0); float3 watercolour = ( gammaCorrectRead(float3(0.0078, 0.5176, 0.700))+waterSunColour)*waterGradient*2.0; watercolour = shLerp(watercolour*0.3*waterSunFade_sunHeight.x, watercolour, shSaturate(1.0-exp(-waterSunFade_sunHeight.y*SUN_EXT))); - watercolour = (cameraPos.y <= waterLevel) ? watercolour : watercolour*0.3; + watercolour = (cameraPos.z <= waterLevel) ? watercolour : watercolour*0.3; float darkness = VISIBILITY*2.0; darkness = clamp((waterEyePos.y - waterLevel + darkness)/darkness,0.2,1.0); watercolour *= darkness; - float isUnderwater = (worldPos.y < waterLevel) ? 1.0 : 0.0; + float isUnderwater = (worldPos.z < waterLevel) ? 1.0 : 0.0; shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, watercolour, fogAmount * isUnderwater * waterEnabled); #endif diff --git a/files/materials/terrain.shader b/files/materials/terrain.shader index dee7332630..e4f1cf091a 100644 --- a/files/materials/terrain.shader +++ b/files/materials/terrain.shader @@ -88,8 +88,8 @@ float toMorph = -min(0, sign(uv1.y - lodMorph.y)); // morph - // this assumes XZ terrain alignment - worldPos.y += uv1.x * toMorph * lodMorph.x; + // this assumes XY terrain alignment + worldPos.z += uv1.x * toMorph * lodMorph.x; shOutputPosition = shMatrixMult(viewProjMatrix, worldPos); @@ -233,9 +233,9 @@ float3 waterEyePos = float3(1,1,1); // NOTE: this calculation would be wrong for non-uniform scaling float4 worldNormal = shMatrixMult(worldMatrix, float4(normal.xyz, 0)); - waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,1,0), waterLevel); + waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,0,1), waterLevel); caustics = getCaustics(causticMap, worldPos, waterEyePos.xyz, worldNormal.xyz, lightDirectionWS0.xyz, waterLevel, waterTimer, windDir_windSpeed); - if (worldPos.y >= waterLevel) + if (worldPos.z >= waterLevel) caustics = float3(1,1,1); @@ -341,7 +341,7 @@ #if UNDERWATER // regular fog only if fragment is above water - if (worldPos.y > waterLevel) + if (worldPos.z > waterLevel) #endif shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, gammaCorrectRead(fogColour), fogValue); #endif @@ -350,7 +350,7 @@ shOutputColour(0).xyz = max(shOutputColour(0).xyz, float3(0,0,0)); #if UNDERWATER - float fogAmount = (cameraPos.y > waterLevel) + float fogAmount = (cameraPos.z > waterLevel) ? shSaturate(length(waterEyePos-worldPos) / VISIBILITY) : shSaturate(length(cameraPos.xyz-worldPos)/ VISIBILITY); @@ -365,14 +365,14 @@ float3 watercolour = (gammaCorrectRead(float3(0.0078, 0.5176, 0.700))+waterSunColour)*waterGradient*2.0; float3 waterext = gammaCorrectRead(float3(0.6, 0.9, 1.0));//water extinction watercolour = shLerp(watercolour*0.3*waterSunFade_sunHeight.x, watercolour, shSaturate(1.0-exp(-waterSunFade_sunHeight.y*SUN_EXT))); - watercolour = (cameraPos.y <= waterLevel) ? watercolour : watercolour*0.3; + watercolour = (cameraPos.z <= waterLevel) ? watercolour : watercolour*0.3; float darkness = VISIBILITY*2.0; darkness = clamp((waterEyePos.y - waterLevel + darkness)/darkness,0.2,1.0); watercolour *= darkness; - float isUnderwater = (worldPos.y < waterLevel) ? 1.0 : 0.0; + float isUnderwater = (worldPos.z < waterLevel) ? 1.0 : 0.0; shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, watercolour, fogAmount * isUnderwater); #endif diff --git a/files/materials/underwater.h b/files/materials/underwater.h index 18052a98da..3b25404086 100644 --- a/files/materials/underwater.h +++ b/files/materials/underwater.h @@ -79,9 +79,9 @@ float3 perturb(shTexture2D tex, float2 coords, float bend, float2 windDir, float float3 getCaustics (shTexture2D causticMap, float3 worldPos, float3 waterEyePos, float3 worldNormal, float3 lightDirectionWS0, float waterLevel, float waterTimer, float3 windDir_windSpeed) { - float waterDepth = shSaturate((waterEyePos.y - worldPos.y) / 50.0); + float waterDepth = shSaturate((waterEyePos.y - worldPos.z) / 50.0); - float3 causticPos = intercept(worldPos.xyz, lightDirectionWS0.xyz, float3(0,1,0), waterLevel); + float3 causticPos = intercept(worldPos.xyz, lightDirectionWS0.xyz, float3(0,0,1), waterLevel); ///\ todo clean this up float causticdepth = length(causticPos-worldPos.xyz); @@ -91,7 +91,7 @@ float3 getCaustics (shTexture2D causticMap, float3 worldPos, float3 waterEyePos, // NOTE: the original shader calculated a tangent space basis here, // but using only the world normal is cheaper and i couldn't see a visual difference // also, if this effect gets moved to screen-space some day, it's unlikely to have tangent information - float3 causticNorm = worldNormal.xyz * perturb(causticMap, causticPos.xz, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).xzy * 2 - 1; + float3 causticNorm = worldNormal.xyz * perturb(causticMap, causticPos.xz, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).xyz * 2 - 1; //float fresnel = pow(clamp(dot(LV,causticnorm),0.0,1.0),2.0); diff --git a/files/materials/water.shader b/files/materials/water.shader index 6bd277eab6..b7fb60b6b7 100644 --- a/files/materials/water.shader +++ b/files/materials/water.shader @@ -122,7 +122,7 @@ #define REFL_BUMP 0.08 // reflection distortion amount #define REFR_BUMP 0.06 // refraction distortion amount - #define SCATTER_AMOUNT 3.0 // amount of sunlight scattering + #define SCATTER_AMOUNT 1.0 // amount of sunlight scattering #define SCATTER_COLOUR gammaCorrectRead(float3(0.0,1.0,0.95)) // colour of sunlight scattering #define SUN_EXT gammaCorrectRead(float3(0.45, 0.55, 0.68)) //sunlight extinction @@ -219,25 +219,27 @@ float3 normal = (normal0 * BIG_WAVES_X + normal1 * BIG_WAVES_Y + normal2 * MID_WAVES_X + normal3 * MID_WAVES_Y + - normal4 * SMALL_WAVES_X + normal5 * SMALL_WAVES_Y).xzy; + normal4 * SMALL_WAVES_X + normal5 * SMALL_WAVES_Y).xyz; - normal = normalize(float3(normal.x * BUMP, normal.y, normal.z * BUMP)); + normal = normalize(float3(normal.x * BUMP, normal.y * BUMP, normal.z)); + normal = float3(normal.x, normal.y, -normal.z); // normal for sunlight scattering float3 lNormal = (normal0 * BIG_WAVES_X*0.5 + normal1 * BIG_WAVES_Y*0.5 + normal2 * MID_WAVES_X*0.2 + normal3 * MID_WAVES_Y*0.2 + - normal4 * SMALL_WAVES_X*0.1 + normal5 * SMALL_WAVES_Y*0.1).xzy; - lNormal = normalize(float3(lNormal.x * BUMP, lNormal.y, lNormal.z * BUMP)); - + normal4 * SMALL_WAVES_X*0.1 + normal5 * SMALL_WAVES_Y*0.1).xyz; + lNormal = normalize(float3(lNormal.x * BUMP, lNormal.y * BUMP, lNormal.z)); + lNormal = float3(lNormal.x, lNormal.y, -lNormal.z); + float3 lVec = normalize(sunPosition.xyz); float3 vVec = normalize(position.xyz - cameraPos.xyz); - float isUnderwater = (cameraPos.y > 0) ? 0.0 : 1.0; + float isUnderwater = (cameraPos.z > 0) ? 0.0 : 1.0; // sunlight scattering - float3 pNormal = float3(0,1,0); + float3 pNormal = float3(0,0,1); float3 lR = reflect(lVec, lNormal); float3 llR = reflect(lVec, pNormal); @@ -246,13 +248,13 @@ float3 scatterColour = shLerp(float3(SCATTER_COLOUR)*gammaCorrectRead(float3(1.0,0.4,0.0)), SCATTER_COLOUR, shSaturate(1.0-exp(-waterSunFade_sunHeight.y*SUN_EXT))); // fresnel - float ior = (cameraPos.y>0)?(1.333/1.0):(1.0/1.333); //air to water; water to air + float ior = (cameraPos.z>0)?(1.333/1.0):(1.0/1.333); //air to water; water to air float fresnel = fresnel_dielectric(-vVec, normal, ior); fresnel = shSaturate(fresnel); // reflection - float3 reflection = gammaCorrectRead(shSample(reflectionMap, screenCoords+(normal.xz*REFL_BUMP)).rgb); + float3 reflection = gammaCorrectRead(shSample(reflectionMap, screenCoords+(normal.xy*REFL_BUMP)).rgb); // refraction float3 R = reflect(vVec, normal); @@ -260,13 +262,13 @@ // check the depth at the refracted coords, and don't do any normal distortion for the refraction if the object to refract // is actually above the water (objectDepth < waterDepth) // this solves silhouettes around objects above the water - float refractDepth = shSample(depthMap, screenCoords-(shoreFade * normal.xz*REFR_BUMP)).x * far - depthPassthrough; + float refractDepth = shSample(depthMap, screenCoords-(shoreFade * normal.xy*REFR_BUMP)).x * far - depthPassthrough; float doRefraction = (refractDepth < 0) ? 0.f : 1.f; - float3 refraction = gammaCorrectRead(shSample(refractionMap, (screenCoords-(shoreFade * normal.xz*REFR_BUMP * doRefraction))*1.0).rgb); + float3 refraction = gammaCorrectRead(shSample(refractionMap, (screenCoords-(shoreFade * normal.xy*REFR_BUMP * doRefraction))*1.0).rgb); // brighten up the refraction underwater - refraction = (cameraPos.y < 0) ? shSaturate(refraction * 1.5) : refraction; + refraction = (cameraPos.z < 0) ? shSaturate(refraction * 1.5) : refraction; // specular float specular = pow(max(dot(R, lVec), 0.0),SPEC_HARDNESS); @@ -290,7 +292,7 @@ watercolour = shLerp(watercolour*0.3*waterSunFade_sunHeight.x, watercolour, shSaturate(1.0-exp(-waterSunFade_sunHeight.y*SUN_EXT))); float darkness = VISIBILITY*2.0; - darkness = clamp((cameraPos.y+darkness)/darkness,0.2,1.0); + darkness = clamp((cameraPos.z+darkness)/darkness,0.2,1.0); float fog = shSaturate(length(cameraPos.xyz-position.xyz) / VISIBILITY); From 5c0c5854e893b0aaa44ab3e936b0af24f9026cfa Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 26 Feb 2013 12:01:10 +0100 Subject: [PATCH 10/65] Unrelated change: we always want the XAutoRepeat workaround, regardless of using exclusive input or not --- apps/openmw/mwinput/inputmanagerimp.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 4a79f77b85..f7e1c8a845 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -87,10 +87,12 @@ namespace MWInput std::string("false"))); pl.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false"))); - pl.insert(std::make_pair(std::string("XAutoRepeatOn"), - std::string("true"))); #endif } +#if defined OIS_LINUX_PLATFORM + pl.insert(std::make_pair(std::string("XAutoRepeatOn"), + std::string("true"))); +#endif #if defined(__APPLE__) && !defined(__LP64__) // Give the application window focus to receive input events From 2e7bc1a368c730d7fc3e3691037c69476c0b5d0e Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 26 Feb 2013 13:39:10 +0100 Subject: [PATCH 11/65] Z-up conversion: local map, fix tcg --- apps/openmw/mwgui/map_window.cpp | 6 +- apps/openmw/mwrender/localmap.cpp | 80 +++++++++++------------ apps/openmw/mwrender/renderingmanager.cpp | 4 +- apps/openmw/mwrender/sky.cpp | 3 +- apps/openmw/mwworld/worldimp.cpp | 4 +- files/materials/water.shader | 4 +- libs/openengine/bullet/physic.cpp | 1 - 7 files changed, 51 insertions(+), 51 deletions(-) diff --git a/apps/openmw/mwgui/map_window.cpp b/apps/openmw/mwgui/map_window.cpp index 4e2ee517ea..bbb2be648b 100644 --- a/apps/openmw/mwgui/map_window.cpp +++ b/apps/openmw/mwgui/map_window.cpp @@ -88,7 +88,7 @@ void LocalMapBase::applyFogOfWar() + boost::lexical_cast(my); std::string image = mPrefix+"_"+ boost::lexical_cast(mCurX + (mx-1)) + "_" - + boost::lexical_cast(mCurY + (mInterior ? (my-1) : -1*(my-1))); + + boost::lexical_cast(mCurY + (-1*(my-1))); MyGUI::ImageBox* fog = mFogWidgets[my + 3*mx]; fog->setImageTexture(mFogOfWar ? ((MyGUI::RenderManager::getInstance().getTexture(image+"_fog") != 0) ? image+"_fog" @@ -127,7 +127,7 @@ void LocalMapBase::setActiveCell(const int x, const int y, bool interior) { // map std::string image = mPrefix+"_"+ boost::lexical_cast(x + (mx-1)) + "_" - + boost::lexical_cast(y + (interior ? (my-1) : -1*(my-1))); + + boost::lexical_cast(y + (-1*(my-1))); std::string name = "Map_" + boost::lexical_cast(mx) + "_" + boost::lexical_cast(my); @@ -173,7 +173,7 @@ void LocalMapBase::setActiveCell(const int x, const int y, bool interior) } else { - Ogre::Vector2 position (marker.x, -marker.y); + Ogre::Vector2 position (marker.x, marker.y); MWBase::Environment::get().getWorld ()->getInteriorMapPosition (position, nX, nY, cellDx, cellDy); widgetCoord = MyGUI::IntCoord(nX * 512 - 4 + (1+cellDx-x) * 512, nY * 512 - 4 + (1+cellDy-y) * 512, 8, 8); diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index d878cb86ed..b661c0795b 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -28,9 +28,6 @@ LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend, MWRender::RenderingManag mCellCamera = mRendering->getScene()->createCamera("CellCamera"); mCellCamera->setProjectionType(PT_ORTHOGRAPHIC); - // look down -y - const float sqrt0pt5 = 0.707106781; - mCellCamera->setOrientation(Quaternion(sqrt0pt5, -sqrt0pt5, 0, 0)); mCameraNode->attachObject(mCellCamera); } @@ -82,8 +79,8 @@ void LocalMap::saveFogOfWar(MWWorld::Ptr::CellStore* cell) } else { - Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().z); - Vector2 max(mBounds.getMaximum().x, mBounds.getMaximum().z); + Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().y); + Vector2 max(mBounds.getMaximum().x, mBounds.getMaximum().y); Vector2 length = max-min; // divide into segments @@ -107,6 +104,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell) mInterior = false; mCameraRotNode->setOrientation(Quaternion::IDENTITY); + mCellCamera->setOrientation(Quaternion(Ogre::Math::Cos(Ogre::Degree(0)/2.f), 0, 0, -Ogre::Math::Sin(Ogre::Degree(0)/2.f))); int x = cell->mCell->getGridX(); int y = cell->mCell->getGridY(); @@ -115,7 +113,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell) mCameraPosNode->setPosition(Vector3(0,0,0)); - render((x+0.5)*sSize, (-y-0.5)*sSize, -10000, 10000, sSize, sSize, name); + render((x+0.5)*sSize, (y+0.5)*sSize, -10000, 10000, sSize, sSize, name); } void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell, @@ -124,40 +122,44 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell, mInterior = true; mBounds = bounds; - Vector2 z(mBounds.getMaximum().y, mBounds.getMinimum().y); + float zMin = mBounds.getMinimum().z; + float zMax = mBounds.getMaximum().z; const Vector2& north = MWBase::Environment::get().getWorld()->getNorthVector(cell); - Radian angle(std::atan2(-north.x, -north.y)); + Radian angle = Ogre::Math::ATan2 (north.x, north.y); mAngle = angle.valueRadians(); - mCameraRotNode->setOrientation(Quaternion(Math::Cos(angle/2.f), 0, Math::Sin(angle/2.f), 0)); + + mCellCamera->setOrientation(Quaternion::IDENTITY); + mCameraRotNode->setOrientation(Quaternion(Math::Cos(angle/2.f), 0, 0, -Math::Sin(angle/2.f))); // rotate the cell and merge the rotated corners to the bounding box - Vector2 _center(bounds.getCenter().x, bounds.getCenter().z); - Vector3 _c1 = bounds.getCorner(AxisAlignedBox::NEAR_LEFT_BOTTOM); - Vector3 _c2 = bounds.getCorner(AxisAlignedBox::FAR_LEFT_BOTTOM); - Vector3 _c3 = bounds.getCorner(AxisAlignedBox::NEAR_RIGHT_BOTTOM); - Vector3 _c4 = bounds.getCorner(AxisAlignedBox::FAR_RIGHT_BOTTOM); - Vector2 c1(_c1.x, _c1.z); - Vector2 c2(_c2.x, _c2.z); - Vector2 c3(_c3.x, _c3.z); - Vector2 c4(_c4.x, _c4.z); + Vector2 _center(bounds.getCenter().x, bounds.getCenter().y); + Vector3 _c1 = bounds.getCorner(AxisAlignedBox::FAR_LEFT_BOTTOM); + Vector3 _c2 = bounds.getCorner(AxisAlignedBox::FAR_RIGHT_BOTTOM); + Vector3 _c3 = bounds.getCorner(AxisAlignedBox::FAR_LEFT_TOP); + Vector3 _c4 = bounds.getCorner(AxisAlignedBox::FAR_RIGHT_TOP); + + Vector2 c1(_c1.x, _c1.y); + Vector2 c2(_c2.x, _c2.y); + Vector2 c3(_c3.x, _c3.y); + Vector2 c4(_c4.x, _c4.y); c1 = rotatePoint(c1, _center, mAngle); c2 = rotatePoint(c2, _center, mAngle); c3 = rotatePoint(c3, _center, mAngle); c4 = rotatePoint(c4, _center, mAngle); - mBounds.merge(Vector3(c1.x, 0, c1.y)); - mBounds.merge(Vector3(c2.x, 0, c2.y)); - mBounds.merge(Vector3(c3.x, 0, c3.y)); - mBounds.merge(Vector3(c4.x, 0, c4.y)); + mBounds.merge(Vector3(c1.x, c1.y, 0)); + mBounds.merge(Vector3(c2.x, c2.y, 0)); + mBounds.merge(Vector3(c3.x, c3.y, 0)); + mBounds.merge(Vector3(c4.x, c4.y, 0)); - Vector2 center(mBounds.getCenter().x, mBounds.getCenter().z); + Vector2 center(mBounds.getCenter().x, mBounds.getCenter().y); - Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().z); - Vector2 max(mBounds.getMaximum().x, mBounds.getMaximum().z); + Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().y); + Vector2 max(mBounds.getMaximum().x, mBounds.getMaximum().y); Vector2 length = max-min; - mCameraPosNode->setPosition(Vector3(center.x, 0, center.y)); + mCameraPosNode->setPosition(Vector3(center.x, center.y, 0)); // divide into segments const int segsX = std::ceil( length.x / sSize ); @@ -172,7 +174,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell, Vector2 start = min + Vector2(sSize*x,sSize*y); Vector2 newcenter = start + 4096; - render(newcenter.x - center.x, newcenter.y - center.y, z.y, z.x, sSize, sSize, + render(newcenter.x - center.x, newcenter.y - center.y, zMin, zMax, sSize, sSize, cell->mCell->mName + "_" + coordStr(x,y)); } } @@ -193,7 +195,7 @@ void LocalMap::render(const float x, const float y, mRendering->getScene()->setAmbientLight(ColourValue(1,1,1)); mRenderingManager->disableLights(); - mCameraNode->setPosition(Vector3(x, zhigh+100000, y)); + mCameraNode->setPosition(Vector3(x, y, 100000)); //mCellCamera->setFarClipDistance( (zhigh-zlow) * 1.1 ); mCellCamera->setFarClipDistance(0); // infinite @@ -272,15 +274,15 @@ void LocalMap::render(const float x, const float y, void LocalMap::getInteriorMapPosition (Ogre::Vector2 pos, float& nX, float& nY, int& x, int& y) { - pos = rotatePoint(pos, Vector2(mBounds.getCenter().x, mBounds.getCenter().z), mAngle); + pos = rotatePoint(pos, Vector2(mBounds.getCenter().x, mBounds.getCenter().y), mAngle); - Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().z); + Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().y); x = std::ceil((pos.x - min.x)/sSize)-1; y = std::ceil((pos.y - min.y)/sSize)-1; nX = (pos.x - min.x - sSize*x)/sSize; - nY = (pos.y - min.y - sSize*y)/sSize; + nY = 1.0-(pos.y - min.y - sSize*y)/sSize; } bool LocalMap::isPositionExplored (float nX, float nY, int x, int y, bool interior) @@ -311,19 +313,19 @@ void LocalMap::updatePlayer (const Ogre::Vector3& position, const Ogre::Quaterni int x,y; float u,v; - Vector2 pos(position.x, position.z); + Vector2 pos(position.x, position.y); if (mInterior) getInteriorMapPosition(pos, u,v, x,y); - Vector3 playerdirection = mCameraRotNode->convertWorldToLocalOrientation(orientation).zAxis(); + Vector3 playerdirection = mCameraRotNode->convertWorldToLocalOrientation(orientation).yAxis(); - Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().z); + Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().y); if (!mInterior) { x = std::ceil(pos.x / sSize)-1; - y = std::ceil(-pos.y / sSize)-1; + y = std::ceil(pos.y / sSize)-1; mCellX = x; mCellY = y; } @@ -337,7 +339,7 @@ void LocalMap::updatePlayer (const Ogre::Vector3& position, const Ogre::Quaterni if (!mInterior) { u = std::abs((pos.x - (sSize*x))/sSize); - v = 1-std::abs((pos.y + (sSize*y))/sSize); + v = 1.0-std::abs((pos.y - (sSize*y))/sSize); texBaseName = "Cell_"; } else @@ -346,15 +348,13 @@ void LocalMap::updatePlayer (const Ogre::Vector3& position, const Ogre::Quaterni } MWBase::Environment::get().getWindowManager()->setPlayerPos(u, v); - MWBase::Environment::get().getWindowManager()->setPlayerDir(playerdirection.x, -playerdirection.z); + MWBase::Environment::get().getWindowManager()->setPlayerDir(playerdirection.x, playerdirection.y); // explore radius (squared) const float sqrExploreRadius = (mInterior ? 0.01 : 0.09) * sFogOfWarResolution*sFogOfWarResolution; const float exploreRadius = (mInterior ? 0.1 : 0.3) * sFogOfWarResolution; // explore radius from 0 to sFogOfWarResolution const float exploreRadiusUV = exploreRadius / sFogOfWarResolution; // explore radius from 0 to 1 (UV space) - int intExtMult = mInterior ? 1 : -1; // interior and exterior have reversed Y coordinates (interior: top to bottom) - // change the affected fog of war textures (in a 3x3 grid around the player) for (int mx = -1; mx<2; ++mx) { @@ -375,7 +375,7 @@ void LocalMap::updatePlayer (const Ogre::Vector3& position, const Ogre::Quaterni if (!affected) continue; - std::string texName = texBaseName + coordStr(x+mx,y+my*intExtMult); + std::string texName = texBaseName + coordStr(x+mx,y+my*-1); TexturePtr tex = TextureManager::getSingleton().getByName(texName+"_fog"); if (!tex.isNull()) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index b2d7fbff08..fe8c5f57fb 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -368,8 +368,10 @@ void RenderingManager::update (float duration, bool paused) Ogre::Vector3 pos(fpos[0], fpos[1], fpos[2]); Ogre::SceneNode *node = data.getBaseNode(); + //Ogre::Quaternion orient = + //node->convertLocalToWorldOrientation(node->_getDerivedOrientation()); Ogre::Quaternion orient = - node->convertLocalToWorldOrientation(node->_getDerivedOrientation()); +node->_getDerivedOrientation(); mLocalMap->updatePlayer(pos, orient); diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index b747b0d9a8..87790fab5f 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -110,7 +110,7 @@ void BillboardObject::setPosition(const Vector3& pPosition) Vector3 BillboardObject::getPosition() const { Vector3 p = mNode->_getDerivedPosition() - mNode->getParentSceneNode()->_getDerivedPosition(); - return Vector3(p.x, -p.z, p.y); + return p; } void BillboardObject::setVisibilityFlags(int flags) @@ -390,7 +390,6 @@ void SkyManager::update(float duration) // increase the strength of the sun glare effect depending // on how directly the player is looking at the sun Vector3 sun = mSunGlare->getPosition(); - sun = Vector3(sun.x, sun.z, -sun.y); Vector3 cam = mCamera->getRealDirection(); const Degree angle = sun.angleBetween( cam ); float val = 1- (angle.valueDegrees() / 180.f); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index eaee8f5a7b..ce39842b31 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1228,8 +1228,8 @@ namespace MWWorld if (!ref) return Vector2(0, 1); Ogre::SceneNode* node = ref->mData.getBaseNode(); - Vector3 dir = node->_getDerivedOrientation().yAxis(); - Vector2 d = Vector2(dir.x, dir.z); + Vector3 dir = node->_getDerivedOrientation() * Ogre::Vector3(0,1,0); + Vector2 d = Vector2(dir.x, dir.y); return d; } diff --git a/files/materials/water.shader b/files/materials/water.shader index b7fb60b6b7..a58a9c38b9 100644 --- a/files/materials/water.shader +++ b/files/materials/water.shader @@ -122,7 +122,7 @@ #define REFL_BUMP 0.08 // reflection distortion amount #define REFR_BUMP 0.06 // refraction distortion amount - #define SCATTER_AMOUNT 1.0 // amount of sunlight scattering + #define SCATTER_AMOUNT 0.3 // amount of sunlight scattering #define SCATTER_COLOUR gammaCorrectRead(float3(0.0,1.0,0.95)) // colour of sunlight scattering #define SUN_EXT gammaCorrectRead(float3(0.45, 0.55, 0.68)) //sunlight extinction @@ -223,7 +223,7 @@ normal = normalize(float3(normal.x * BUMP, normal.y * BUMP, normal.z)); normal = float3(normal.x, normal.y, -normal.z); - + // normal for sunlight scattering float3 lNormal = (normal0 * BIG_WAVES_X*0.5 + normal1 * BIG_WAVES_Y*0.5 + normal2 * MID_WAVES_X*0.2 + normal3 * MID_WAVES_Y*0.2 + diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index 5d5749d5d8..f993ce68e2 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -193,7 +193,6 @@ namespace Physic if(!isDebugCreated) { Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); - node->pitch(Ogre::Degree(-90)); mDebugDrawer = new BtOgre::DebugDrawer(node, dynamicsWorld); dynamicsWorld->setDebugDrawer(mDebugDrawer); isDebugCreated = true; From 284ba58e1e7372d74c80acd0f3f18d0b728ea901 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 26 Feb 2013 13:52:01 +0100 Subject: [PATCH 12/65] Z-up conversion: global map, shader fix --- apps/openmw/mwgui/map_window.cpp | 2 +- apps/openmw/mwrender/globalmap.cpp | 2 +- files/materials/objects.shader | 2 +- files/materials/terrain.shader | 2 +- files/materials/underwater.h | 11 ++++++----- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwgui/map_window.cpp b/apps/openmw/mwgui/map_window.cpp index bbb2be648b..34f246d8b1 100644 --- a/apps/openmw/mwgui/map_window.cpp +++ b/apps/openmw/mwgui/map_window.cpp @@ -397,7 +397,7 @@ void MapWindow::globalMapUpdatePlayer () Ogre::Vector2 dir (orient.yAxis ().x, -orient.yAxis().z); float worldX, worldY; - mGlobalMapRender->worldPosToImageSpace (pos.x, pos.z, worldX, worldY); + mGlobalMapRender->worldPosToImageSpace (pos.x, pos.y, worldX, worldY); worldX *= mGlobalMapRender->getWidth(); worldY *= mGlobalMapRender->getHeight(); diff --git a/apps/openmw/mwrender/globalmap.cpp b/apps/openmw/mwrender/globalmap.cpp index 072015f9a8..055faaa1f7 100644 --- a/apps/openmw/mwrender/globalmap.cpp +++ b/apps/openmw/mwrender/globalmap.cpp @@ -190,7 +190,7 @@ namespace MWRender { imageX = float(x / 8192.f - mMinX) / (mMaxX - mMinX + 1); - imageY = 1.f-float(-z / 8192.f - mMinY) / (mMaxY - mMinY + 1); + imageY = 1.f-float(z / 8192.f - mMinY) / (mMaxY - mMinY + 1); } void GlobalMap::cellTopLeftCornerToImageSpace(int x, int y, float& imageX, float& imageY) diff --git a/files/materials/objects.shader b/files/materials/objects.shader index 6adf7e3fa0..0f1b3722fa 100644 --- a/files/materials/objects.shader +++ b/files/materials/objects.shader @@ -296,7 +296,7 @@ float darkness = VISIBILITY*2.0; - darkness = clamp((waterEyePos.y - waterLevel + darkness)/darkness,0.2,1.0); + darkness = clamp((waterEyePos.z - waterLevel + darkness)/darkness,0.2,1.0); watercolour *= darkness; float isUnderwater = (worldPos.z < waterLevel) ? 1.0 : 0.0; diff --git a/files/materials/terrain.shader b/files/materials/terrain.shader index e4f1cf091a..d8bc00c187 100644 --- a/files/materials/terrain.shader +++ b/files/materials/terrain.shader @@ -369,7 +369,7 @@ float darkness = VISIBILITY*2.0; - darkness = clamp((waterEyePos.y - waterLevel + darkness)/darkness,0.2,1.0); + darkness = clamp((waterEyePos.z - waterLevel + darkness)/darkness,0.2,1.0); watercolour *= darkness; float isUnderwater = (worldPos.z < waterLevel) ? 1.0 : 0.0; diff --git a/files/materials/underwater.h b/files/materials/underwater.h index 3b25404086..a760202fa2 100644 --- a/files/materials/underwater.h +++ b/files/materials/underwater.h @@ -79,7 +79,7 @@ float3 perturb(shTexture2D tex, float2 coords, float bend, float2 windDir, float float3 getCaustics (shTexture2D causticMap, float3 worldPos, float3 waterEyePos, float3 worldNormal, float3 lightDirectionWS0, float waterLevel, float waterTimer, float3 windDir_windSpeed) { - float waterDepth = shSaturate((waterEyePos.y - worldPos.z) / 50.0); + float waterDepth = shSaturate((waterEyePos.z - worldPos.z) / 50.0); float3 causticPos = intercept(worldPos.xyz, lightDirectionWS0.xyz, float3(0,0,1), waterLevel); @@ -91,20 +91,21 @@ float3 getCaustics (shTexture2D causticMap, float3 worldPos, float3 waterEyePos, // NOTE: the original shader calculated a tangent space basis here, // but using only the world normal is cheaper and i couldn't see a visual difference // also, if this effect gets moved to screen-space some day, it's unlikely to have tangent information - float3 causticNorm = worldNormal.xyz * perturb(causticMap, causticPos.xz, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).xyz * 2 - 1; + float3 causticNorm = worldNormal.xyz * perturb(causticMap, causticPos.xy, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).xyz * 2 - 1; + causticNorm = float3(causticNorm.x, causticNorm.y, -causticNorm.z); //float fresnel = pow(clamp(dot(LV,causticnorm),0.0,1.0),2.0); float NdotL = max(dot(worldNormal.xyz, lightDirectionWS0.xyz),0.0); - float causticR = 1.0-perturb(causticMap, causticPos.xz, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).z; + float causticR = 1.0-perturb(causticMap, causticPos.xy, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).z; /// \todo sunFade // float3 caustics = clamp(pow(float3(causticR)*5.5,float3(5.5*causticdepth)),0.0,1.0)*NdotL*sunFade*causticdepth; float3 caustics = clamp(pow(float3(causticR,causticR,causticR)*5.5,float3(5.5*causticdepth,5.5*causticdepth,5.5*causticdepth)),0.0,1.0)*NdotL*causticdepth; - float causticG = 1.0-perturb(causticMap,causticPos.xz+(1.0-causticdepth)*ABBERATION, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).z; - float causticB = 1.0-perturb(causticMap,causticPos.xz+(1.0-causticdepth)*ABBERATION*2.0, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).z; + float causticG = 1.0-perturb(causticMap,causticPos.xy+(1.0-causticdepth)*ABBERATION, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).z; + float causticB = 1.0-perturb(causticMap,causticPos.xy+(1.0-causticdepth)*ABBERATION*2.0, causticdepth, windDir_windSpeed.xy, windDir_windSpeed.z, waterTimer).z; //caustics = shSaturate(pow(float3(causticR,causticG,causticB)*5.5,float3(5.5*causticdepth)))*NdotL*sunFade*causticdepth; caustics = shSaturate(pow(float3(causticR,causticG,causticB)*5.5,float3(5.5*causticdepth,5.5*causticdepth,5.5*causticdepth)))*NdotL*causticdepth; From 341f9b96e2a589a86977d42b1856d147b4bc6f80 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 26 Feb 2013 13:53:23 +0100 Subject: [PATCH 13/65] Local map: restore zHigh --- apps/openmw/mwrender/localmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index b661c0795b..601ee58e31 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -195,7 +195,7 @@ void LocalMap::render(const float x, const float y, mRendering->getScene()->setAmbientLight(ColourValue(1,1,1)); mRenderingManager->disableLights(); - mCameraNode->setPosition(Vector3(x, y, 100000)); + mCameraNode->setPosition(Vector3(x, y, zhigh+100000)); //mCellCamera->setFarClipDistance( (zhigh-zlow) * 1.1 ); mCellCamera->setFarClipDistance(0); // infinite From cc9b72b9b1f75f138bb38e1b095ed84a2b2f71a6 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 26 Feb 2013 14:01:10 +0100 Subject: [PATCH 14/65] Removing some leftovers of mwRoot node --- apps/openmw/mwrender/actors.cpp | 8 ++++---- apps/openmw/mwrender/actors.hpp | 4 ++-- apps/openmw/mwrender/debugging.cpp | 8 ++++---- apps/openmw/mwrender/debugging.hpp | 4 ++-- apps/openmw/mwrender/objects.cpp | 20 ++++++++++---------- apps/openmw/mwrender/objects.hpp | 4 ++-- apps/openmw/mwrender/renderingmanager.cpp | 19 +++++++------------ apps/openmw/mwrender/renderingmanager.hpp | 5 +---- apps/openmw/mwrender/sky.cpp | 4 ++-- apps/openmw/mwrender/sky.hpp | 2 +- 10 files changed, 35 insertions(+), 43 deletions(-) diff --git a/apps/openmw/mwrender/actors.cpp b/apps/openmw/mwrender/actors.cpp index 78521d0ce6..83c07737ce 100644 --- a/apps/openmw/mwrender/actors.cpp +++ b/apps/openmw/mwrender/actors.cpp @@ -28,8 +28,8 @@ Actors::~Actors() } } -void Actors::setMwRoot(Ogre::SceneNode* root) -{ mMwRoot = root; } +void Actors::setRootNode(Ogre::SceneNode* root) +{ mRootNode = root; } void Actors::insertBegin(const MWWorld::Ptr &ptr) { @@ -40,7 +40,7 @@ void Actors::insertBegin(const MWWorld::Ptr &ptr) else { //Create the scenenode and put it in the map - cellnode = mMwRoot->createChildSceneNode(); + cellnode = mRootNode->createChildSceneNode(); mCellSceneNodes[ptr.getCell()] = cellnode; } @@ -159,7 +159,7 @@ void Actors::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur) node = celliter->second; else { - node = mMwRoot->createChildSceneNode(); + node = mRootNode->createChildSceneNode(); mCellSceneNodes[newCell] = node; } node->addChild(cur.getRefData().getBaseNode()); diff --git a/apps/openmw/mwrender/actors.hpp b/apps/openmw/mwrender/actors.hpp index c89bfbaf5e..75a18ba915 100644 --- a/apps/openmw/mwrender/actors.hpp +++ b/apps/openmw/mwrender/actors.hpp @@ -20,7 +20,7 @@ namespace MWRender typedef std::map PtrAnimationMap; OEngine::Render::OgreRenderer &mRend; - Ogre::SceneNode* mMwRoot; + Ogre::SceneNode* mRootNode; CellSceneNodeMap mCellSceneNodes; PtrAnimationMap mAllActors; @@ -29,7 +29,7 @@ namespace MWRender Actors(OEngine::Render::OgreRenderer& _rend): mRend(_rend) {} ~Actors(); - void setMwRoot(Ogre::SceneNode* root); + void setRootNode(Ogre::SceneNode* root); void insertBegin (const MWWorld::Ptr& ptr); void insertNPC(const MWWorld::Ptr& ptr, MWWorld::InventoryStore& inv); void insertCreature (const MWWorld::Ptr& ptr); diff --git a/apps/openmw/mwrender/debugging.cpp b/apps/openmw/mwrender/debugging.cpp index 2061b74d7f..54f288bff8 100644 --- a/apps/openmw/mwrender/debugging.cpp +++ b/apps/openmw/mwrender/debugging.cpp @@ -150,9 +150,9 @@ ManualObject *Debugging::createPathgridPoints(const ESM::Pathgrid *pathgrid) return result; } -Debugging::Debugging(SceneNode *mwRoot, OEngine::Physic::PhysicEngine *engine) : - mMwRoot(mwRoot), mEngine(engine), - mSceneMgr(mwRoot->getCreator()), +Debugging::Debugging(SceneNode *root, OEngine::Physic::PhysicEngine *engine) : + mRootNode(root), mEngine(engine), + mSceneMgr(root->getCreator()), mPathgridEnabled(false), mInteriorPathgridNode(NULL), mPathGridRoot(NULL), mGridMatsCreated(false) @@ -208,7 +208,7 @@ void Debugging::togglePathgrid() createGridMaterials(); // add path grid meshes to already loaded cells - mPathGridRoot = mMwRoot->createChildSceneNode(); + mPathGridRoot = mRootNode->createChildSceneNode(); for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); ++it) { enableCellPathgrid(*it); diff --git a/apps/openmw/mwrender/debugging.hpp b/apps/openmw/mwrender/debugging.hpp index 07e5f0a3f4..6a4eef58f4 100644 --- a/apps/openmw/mwrender/debugging.hpp +++ b/apps/openmw/mwrender/debugging.hpp @@ -54,7 +54,7 @@ namespace MWRender typedef std::vector CellList; CellList mActiveCells; - Ogre::SceneNode *mMwRoot; + Ogre::SceneNode *mRootNode; Ogre::SceneNode *mPathGridRoot; @@ -78,7 +78,7 @@ namespace MWRender Ogre::ManualObject *createPathgridLines(const ESM::Pathgrid *pathgrid); Ogre::ManualObject *createPathgridPoints(const ESM::Pathgrid *pathgrid); public: - Debugging(Ogre::SceneNode* mwRoot, OEngine::Physic::PhysicEngine *engine); + Debugging(Ogre::SceneNode* root, OEngine::Physic::PhysicEngine *engine); ~Debugging(); bool toggleRenderMode (int mode); diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index 76f38eefc2..add781459e 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -57,14 +57,14 @@ void Objects::clearSceneNode (Ogre::SceneNode *node) } } -void Objects::setMwRoot(Ogre::SceneNode* root) +void Objects::setRootNode(Ogre::SceneNode* root) { - mMwRoot = root; + mRootNode = root; } void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_) { - Ogre::SceneNode* root = mMwRoot; + Ogre::SceneNode* root = mRootNode; Ogre::SceneNode* cellnode; if(mCellSceneNodes.find(ptr.getCell()) == mCellSceneNodes.end()) { @@ -390,9 +390,9 @@ void Objects::enableLights() std::vector::iterator it = mLights.begin(); while (it != mLights.end()) { - if (mMwRoot->getCreator()->hasLight(it->name)) + if (mRootNode->getCreator()->hasLight(it->name)) { - mMwRoot->getCreator()->getLight(it->name)->setVisible(true); + mRootNode->getCreator()->getLight(it->name)->setVisible(true); ++it; } else @@ -405,9 +405,9 @@ void Objects::disableLights() std::vector::iterator it = mLights.begin(); while (it != mLights.end()) { - if (mMwRoot->getCreator()->hasLight(it->name)) + if (mRootNode->getCreator()->hasLight(it->name)) { - mMwRoot->getCreator()->getLight(it->name)->setVisible(false); + mRootNode->getCreator()->getLight(it->name)->setVisible(false); ++it; } else @@ -460,9 +460,9 @@ void Objects::update(const float dt) std::vector::iterator it = mLights.begin(); while (it != mLights.end()) { - if (mMwRoot->getCreator()->hasLight(it->name)) + if (mRootNode->getCreator()->hasLight(it->name)) { - Ogre::Light* light = mMwRoot->getCreator()->getLight(it->name); + Ogre::Light* light = mRootNode->getCreator()->getLight(it->name); float brightness; float cycle_time; @@ -550,7 +550,7 @@ void Objects::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur) MWWorld::CellStore *newCell = cur.getCell(); if(mCellSceneNodes.find(newCell) == mCellSceneNodes.end()) { - node = mMwRoot->createChildSceneNode(); + node = mRootNode->createChildSceneNode(); mCellSceneNodes[newCell] = node; } else { node = mCellSceneNodes[newCell]; diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index 5801014642..73e95a3c53 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -53,7 +53,7 @@ class Objects{ std::map mStaticGeometrySmall; std::map mBounds; std::vector mLights; - Ogre::SceneNode* mMwRoot; + Ogre::SceneNode* mRootNode; bool mIsStatic; static int uniqueID; @@ -90,7 +90,7 @@ public: void removeCell(MWWorld::CellStore* store); void buildStaticGeometry(MWWorld::CellStore &cell); - void setMwRoot(Ogre::SceneNode* root); + void setRootNode(Ogre::SceneNode* root); void rebuildStaticGeometry(); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index fe8c5f57fb..fe3dc776d1 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -141,25 +141,20 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const applyCompositors(); - // Turn the entire scene (represented by the 'root' node) -90 - // degrees around the x axis. This makes Z go upwards, and Y go into - // the screen (when x is to the right.) This is the orientation that - // Morrowind uses, and it automagically makes everything work as it - // should. SceneNode *rt = mRendering.getScene()->getRootSceneNode(); - mMwRoot = rt; + mRootNode = rt; - mObjects.setMwRoot(mMwRoot); - mActors.setMwRoot(mMwRoot); + mObjects.setRootNode(mRootNode); + mActors.setRootNode(mRootNode); - Ogre::SceneNode *playerNode = mMwRoot->createChildSceneNode ("player"); + Ogre::SceneNode *playerNode = mRootNode->createChildSceneNode ("player"); mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode); mShadows = new Shadows(&mRendering); mTerrainManager = new TerrainManager(mRendering.getScene(), this); - mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera()); + mSkyManager = new SkyManager(mRootNode, mRendering.getCamera()); mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode()); @@ -168,7 +163,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const mSun = 0; - mDebugging = new Debugging(mMwRoot, engine); + mDebugging = new Debugging(mRootNode, engine); mLocalMap = new MWRender::LocalMap(&mRendering, this); setMenuTransparency(Settings::Manager::getFloat("menu transparency", "GUI")); @@ -321,7 +316,7 @@ void RenderingManager::update (float duration, bool paused) Ogre::Vector3 orig, dest; mPlayer->setCameraDistance(); if (!mPlayer->getPosition(orig, dest)) { - orig.z += mPlayer->getHeight() * mMwRoot->getScale().z; + orig.z += mPlayer->getHeight() * mRootNode->getScale().z; btVector3 btOrig(orig.x, orig.y, orig.z); btVector3 btDest(dest.x, dest.y, dest.z); diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index bdb5447e32..53c63cfedd 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -228,10 +228,7 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList Ogre::ColourValue mAmbientColor; Ogre::Light* mSun; - /// Root node for all objects added to the scene. This is rotated so - /// that the OGRE coordinate system matches that used internally in - /// Morrowind. - Ogre::SceneNode *mMwRoot; + Ogre::SceneNode *mRootNode; OEngine::Physic::PhysicEngine* mPhysicsEngine; diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 87790fab5f..0620796931 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -203,7 +203,7 @@ unsigned int Moon::getPhaseInt() const return 0; } -SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera) +SkyManager::SkyManager (SceneNode* root, Camera* pCamera) : mHour(0.0f) , mDay(0) , mMonth(0) @@ -234,7 +234,7 @@ SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera) , mCloudAnimationTimer(0.f) , mMoonRed(false) { - mSceneMgr = pMwRoot->getCreator(); + mSceneMgr = root->getCreator(); mRootNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); mRootNode->setInheritOrientation(false); } diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index 52fd7b4aa8..feaba3d969 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -112,7 +112,7 @@ namespace MWRender class SkyManager { public: - SkyManager(Ogre::SceneNode* pMwRoot, Ogre::Camera* pCamera); + SkyManager(Ogre::SceneNode* root, Ogre::Camera* pCamera); ~SkyManager(); void update(float duration); From cd68012498881544eb00b9f902ab3bc9ef1bd1e5 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 26 Feb 2013 14:28:35 +0100 Subject: [PATCH 15/65] Z-up conversion: raycasts --- apps/openmw/mwworld/physicssystem.cpp | 14 ++++++-------- apps/openmw/mwworld/worldimp.cpp | 11 +++++------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index 0c1f580488..65cbc1164e 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -264,9 +264,8 @@ namespace MWWorld Ogre::Vector3 to = ray.getPoint(queryDistance); btVector3 _from, _to; - // OGRE to MW coordinates - _from = btVector3(from.x, -from.z, from.y); - _to = btVector3(to.x, -to.z, to.y); + _from = btVector3(from.x, from.y, from.z); + _to = btVector3(to.x, to.y, to.z); std::vector < std::pair > results; /* auto */ results = mEngine->rayTest2(_from,_to); @@ -287,7 +286,7 @@ namespace MWWorld Ray centerRay = mRender.getCamera()->getCameraToViewportRay( mRender.getViewport()->getWidth()/2, mRender.getViewport()->getHeight()/2); - btVector3 result(centerRay.getPoint(extent).x,-centerRay.getPoint(extent).z,centerRay.getPoint(extent).y); + btVector3 result(centerRay.getPoint(extent).x,centerRay.getPoint(extent).y,centerRay.getPoint(extent).z); return result; } @@ -295,7 +294,7 @@ namespace MWWorld { //get a ray pointing to the center of the viewport Ray centerRay = mRender.getCamera()->getCameraToViewportRay(mouseX, mouseY); - btVector3 result(centerRay.getPoint(extent).x,-centerRay.getPoint(extent).z,centerRay.getPoint(extent).y); + btVector3 result(centerRay.getPoint(extent).x,centerRay.getPoint(extent).y,centerRay.getPoint(extent).z); return result; } @@ -335,9 +334,8 @@ namespace MWWorld Ogre::Vector3 to = ray.getPoint(200); /// \todo make this distance (ray length) configurable btVector3 _from, _to; - // OGRE to MW coordinates - _from = btVector3(from.x, -from.z, from.y); - _to = btVector3(to.x, -to.z, to.y); + _from = btVector3(from.x, from.y, from.z); + _to = btVector3(to.x, to.y, to.z); std::pair result = mEngine->rayTest(_from, _to); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index ce39842b31..24a1f83022 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1024,7 +1024,6 @@ namespace MWWorld // currently its here because we need to access the physics system float* p = mPlayer->getPlayer().getRefData().getPosition().pos; Vector3 sun = mRendering->getSkyManager()->getRealSunPos(); - sun = Vector3(sun.x, -sun.z, sun.y); mRendering->getSkyManager()->setGlare(!mPhysics->castRay(Ogre::Vector3(p[0], p[1], p[2]), sun)); } @@ -1122,7 +1121,7 @@ namespace MWWorld } else p = mPhysics->getRayPoint(results.front().first); - Ogre::Vector3 pos(p.x(), p.z(), -p.y()); + Ogre::Vector3 pos(p.x(), p.y(), p.z()); Ogre::SceneNode* node = mFaced1.getRefData().getBaseNode(); //std::cout << "Num facing 1 : " << mFaced1Name << std::endl; @@ -1150,7 +1149,7 @@ namespace MWWorld } else p = mPhysics->getRayPoint(results.at (1).first); - Ogre::Vector3 pos(p.x(), p.z(), -p.y()); + Ogre::Vector3 pos(p.x(), p.y(), p.z()); Ogre::SceneNode* node1 = mFaced1.getRefData().getBaseNode(); Ogre::SceneNode* node2 = mFaced2.getRefData().getBaseNode(); @@ -1299,7 +1298,7 @@ namespace MWWorld if (isCellExterior()) { int cellX, cellY; - positionToIndex(result.second[0], -result.second[2], cellX, cellY); + positionToIndex(result.second[0], result.second[1], cellX, cellY); cell = mCells.getExterior(cellX, cellY); } else @@ -1307,8 +1306,8 @@ namespace MWWorld ESM::Position pos = getPlayer().getPlayer().getRefData().getPosition(); pos.pos[0] = result.second[0]; - pos.pos[1] = -result.second[2]; - pos.pos[2] = result.second[1]; + pos.pos[1] = result.second[1]; + pos.pos[2] = result.second[2]; Ptr dropped = copyObjectToCell(object, *cell, pos); PCDropped(dropped); From b9912a19e0ed585b041c33ce2861b224dea23369 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 26 Feb 2013 14:31:30 +0100 Subject: [PATCH 16/65] Z-up conversion: fix player arrow direction on global map --- apps/openmw/mwgui/map_window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/map_window.cpp b/apps/openmw/mwgui/map_window.cpp index 34f246d8b1..6f7f0eaabc 100644 --- a/apps/openmw/mwgui/map_window.cpp +++ b/apps/openmw/mwgui/map_window.cpp @@ -394,7 +394,7 @@ void MapWindow::globalMapUpdatePlayer () { Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer().getRefData ().getBaseNode ()->_getDerivedPosition (); Ogre::Quaternion orient = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer().getRefData ().getBaseNode ()->_getDerivedOrientation (); - Ogre::Vector2 dir (orient.yAxis ().x, -orient.yAxis().z); + Ogre::Vector2 dir (orient.yAxis ().x, orient.yAxis().y); float worldX, worldY; mGlobalMapRender->worldPosToImageSpace (pos.x, pos.y, worldX, worldY); From 1a43d86d9e33cb1a8351347d37eaeaedfebca47b Mon Sep 17 00:00:00 2001 From: vorenon Date: Tue, 26 Feb 2013 15:58:32 +0100 Subject: [PATCH 17/65] Close messages boxes with the activation key (Bug #589) --- apps/openmw/mwinput/inputmanagerimp.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index f7e1c8a845..5a6998d9ee 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -179,6 +179,11 @@ namespace MWInput case A_Activate: resetIdleTime(); activate(); + if( MWBase::Environment::get().getWindowManager()->isGuiMode() + && MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_InterMessageBox ) { + // Pressing the activation key when a messagebox is prompting for "ok" will activate the ok button + MWBase::Environment::get().getWindowManager()->enterPressed(); + } break; case A_Journal: toggleJournal (); From b1ca719d61b4df9b5ebcfd58457640febbd7da51 Mon Sep 17 00:00:00 2001 From: vorenon Date: Tue, 26 Feb 2013 16:37:59 +0100 Subject: [PATCH 18/65] Added click sound to OK button for message boxes --- apps/openmw/mwgui/messagebox.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/openmw/mwgui/messagebox.cpp b/apps/openmw/mwgui/messagebox.cpp index 896ab3bb56..0ee042e326 100644 --- a/apps/openmw/mwgui/messagebox.cpp +++ b/apps/openmw/mwgui/messagebox.cpp @@ -1,6 +1,8 @@ #include #include "messagebox.hpp" +#include "../mwbase/environment.hpp" +#include "../mwbase/soundmanager.hpp" using namespace MWGui; @@ -375,6 +377,7 @@ void InteractiveMessageBox::enterPressed() if(Misc::StringUtils::lowerCase((*button)->getCaption()) == ok) { buttonActivated(*button); + MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.f, 1.f); break; } } From fb990b5e69d96865f490f5ea4f747ad64d571a51 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 26 Feb 2013 17:08:34 +0100 Subject: [PATCH 19/65] updated credits file --- credits.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/credits.txt b/credits.txt index 535e922ae1..027dc09860 100644 --- a/credits.txt +++ b/credits.txt @@ -34,6 +34,7 @@ lazydev Leon Saunders (emoose) Lukasz Gromanowski (lgro) Marcin Hulist (Gohan) +Manuel Edelmann (vorenon) Michael Mc Donnell Michael Papageorgiou (werdanith) Nathan Jeffords (blunted2night) From cd99e9d952d9a2b2b3f24425e678a83a1c9dd73c Mon Sep 17 00:00:00 2001 From: pvdk Date: Tue, 26 Feb 2013 17:28:39 +0100 Subject: [PATCH 20/65] Updated credits.txt and corrected license info in readme.txt --- credits.txt | 58 +++++++++++++++++++++++++++++++++++------------------ readme.txt | 2 +- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/credits.txt b/credits.txt index 027dc09860..6f7e72aa1c 100644 --- a/credits.txt +++ b/credits.txt @@ -12,66 +12,74 @@ Marc Zinnschlag (Zini) - Lead Programmer/Project Manager Adam Hogan (aurix) Aleksandar Jovanov +Alexander Nadeau (wareya) Alexander Olofsson (Ace) Artem Kotsynyak (greye) athile BrotherBrick -Chris Robinson +Chris Robinson (KittyCat) Cory F. Cohen (cfcohen) Cris Mihalache (Mirceam) Douglas Diniz (Dgdiniz) +Douglas Mencken (dougmencken) +Edmondo Tommasina (edmondo) Eduard Cot (trombonecot) Eli2 -Emanuel "potatoesmaster" Guével -gugus / gus +Emanuel Guével (potatoesmaster) +gugus/gus Jacob Essex (Yacoby) Jannik Heller (scrawl) Jason Hooks (jhooks) Joel Graff (graffy) +Jordan Milne +Julien Voisin (jvoisin/ap0) Karl-Felix Glatzer (k1ll) Lars Söderberg (Lazaroth) lazydev Leon Saunders (emoose) Lukasz Gromanowski (lgro) Marcin Hulist (Gohan) +Mark Siewert (mark76) Manuel Edelmann (vorenon) Michael Mc Donnell Michael Papageorgiou (werdanith) Nathan Jeffords (blunted2night) Nikolay Kasyanov (corristo) +Nolan Poe (nopoe) +Paul McElroy (Greendogo) Pieter van der Kloet (pvdk) +Radu-Marius Popovici (rpopovici) Roman Melnik (Kromgart) +Sandy Carter (bwrsandman) Sebastian Wick (swick) Sergey Shambir -Sylvain T. (Garvek) +Sylvain Thesnieres (Garvek) Tom Mason (wheybags) + Packagers: Alexander Olofsson (Ace) - Windows BrotherBrick - Ubuntu Linux -Edmondo Tommasina - Gentoo Linux +Edmondo Tommasina (edmondo) - Gentoo Linux +Julian Ospald (hasufell) - Gentoo Linux +Karl-Felix Glatzer (k1ll) - Linux Binaries Kenny Armstrong (artorius) - Fedora Linux Nikolay Kasyanov (corristo) - Mac OS X Sandy Carter (bwrsandman) - Arch Linux -Public Relations: -ElderTroll - Release Manager -sir_herrbatka - News Writer +Public Relations and Translations: +Julien Voisin (jvoisin/ap0) - French News Writer +Artem Kotsynyak (greye) - Russian News Writer +Pithorn - Chinese News Writer +sir_herrbatka - English/Polish News Writer WeirdSexy - Podcaster Website: -juanmnzsk8 - Spanish News Writer -Julien Voisin (jvoisin/ap0) - French News Writer -Kingpix - Italian News Writer Lukasz Gromanowski (lgro) - Website Administrator -Nikolay Kasyanov (corristo) - Russian News Writer -Okulo - Dutch News Writer -penguinroad - Indonesian News Writer Ryan Sardonic (Wry) - Wiki Editor -sir_herrbatka - Forum Admin/Polish News Writer -spyboot - German News Writer +sir_herrbatka - Forum Administrator Formula Research: @@ -87,20 +95,32 @@ Sadler Artwork: Necrod - OpenMW Logo -raevol - Wordpress Theme - +Mickey Lyle (raevol) - Wordpress Theme +Okulo - OpenMW Editor Icons Inactive Contributors: Ardekantur Armin Preiml +Carl Maxwell Diggory Hardy -Jan Borsodi +Dmitry Marakasov (AMDmi3) +ElderTroll +guidoj Jan-Peter Nilsson (peppe) +Jan Borsodi Josua Grawitter +juanmnzsk8 +Kingpix Lordrea +Michal Sciubidlo Nicolay Korslund +pchan3 +penguinroad +psi29a sergoz +spyboot Star-Demon +Thoronador Yuri Krupenin diff --git a/readme.txt b/readme.txt index 3124744c30..228278a919 100644 --- a/readme.txt +++ b/readme.txt @@ -9,7 +9,7 @@ Website: http://www.openmw.org Font Licenses: EBGaramond-Regular.ttf: OFL (see OFL.txt for more information) -VeraMono.ttf: custom (see Bitstream Vera License.txt for more information) +DejaVuLGCSansMono.ttf: custom (see DejaVu Font License.txt for more information) From 21f502e3ddf191d67ff5569ac846a01574dcedc5 Mon Sep 17 00:00:00 2001 From: Nathan Jeffords Date: Tue, 26 Feb 2013 09:36:56 -0800 Subject: [PATCH 21/65] properly handle potentially non 16 bit planar audio formats --- apps/openmw/mwsound/ffmpeg_decoder.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index 54df45ff4c..7e8751c598 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -134,6 +134,18 @@ size_t FFmpeg_Decoder::readAVAudioData(void *data, size_t length) return dec; } +static AVSampleFormat ffmpegNonPlanarSampleFormat (AVSampleFormat format) +{ + switch (format) + { + case AV_SAMPLE_FMT_U8P: return AV_SAMPLE_FMT_U8; + case AV_SAMPLE_FMT_S16P: return AV_SAMPLE_FMT_S16; + case AV_SAMPLE_FMT_S32P: return AV_SAMPLE_FMT_S32; + case AV_SAMPLE_FMT_FLTP: return AV_SAMPLE_FMT_FLT; + case AV_SAMPLE_FMT_DBLP: return AV_SAMPLE_FMT_DBL; + default:return format; + } +} void FFmpeg_Decoder::open(const std::string &fname) { @@ -153,10 +165,6 @@ void FFmpeg_Decoder::open(const std::string &fname) try { - for(size_t j = 0;j < mFormatCtx->nb_streams;j++) - if(mFormatCtx->streams[j]->codec->codec_type == AVMEDIA_TYPE_AUDIO) - mFormatCtx->streams[j]->codec->request_sample_fmt = AV_SAMPLE_FMT_S16; - if(avformat_find_stream_info(mFormatCtx, NULL) < 0) fail("Failed to find stream info in "+fname); @@ -164,7 +172,6 @@ void FFmpeg_Decoder::open(const std::string &fname) { if(mFormatCtx->streams[j]->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - mFormatCtx->streams[j]->codec->request_sample_fmt = AV_SAMPLE_FMT_S16; mStream = &mFormatCtx->streams[j]; break; } @@ -172,6 +179,8 @@ void FFmpeg_Decoder::open(const std::string &fname) if(!mStream) fail("No audio streams in "+fname); + (*mStream)->codec->request_sample_fmt = ffmpegNonPlanarSampleFormat ((*mStream)->codec->sample_fmt); + AVCodec *codec = avcodec_find_decoder((*mStream)->codec->codec_id); if(!codec) { From ceafcc2ebbc4a86e4f5cbc6f188658a10fdc58b4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 26 Feb 2013 10:19:33 -0800 Subject: [PATCH 22/65] Support float samples with ffmpeg Requires the AL_EXT_FLOAT32 extension in OpenAL --- apps/openmw/mwrender/videoplayer.cpp | 2 ++ apps/openmw/mwsound/ffmpeg_decoder.cpp | 2 ++ apps/openmw/mwsound/openal_output.cpp | 45 +++++++++++++++++++++++++ apps/openmw/mwsound/sound_decoder.hpp | 3 +- apps/openmw/mwsound/soundmanagerimp.cpp | 2 ++ 5 files changed, 53 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/videoplayer.cpp b/apps/openmw/mwrender/videoplayer.cpp index b710225042..a0dedb6bc2 100644 --- a/apps/openmw/mwrender/videoplayer.cpp +++ b/apps/openmw/mwrender/videoplayer.cpp @@ -404,6 +404,8 @@ public: *type = MWSound::SampleType_UInt8; else if(mAVStream->codec->sample_fmt == AV_SAMPLE_FMT_S16) *type = MWSound::SampleType_Int16; + else if(mAVStream->codec->sample_fmt == AV_SAMPLE_FMT_FLT) + *type = MWSound::SampleType_Float32; else fail(std::string("Unsupported sample format: ")+ av_get_sample_fmt_name(mAVStream->codec->sample_fmt)); diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index 54df45ff4c..8c857f4ea1 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -224,6 +224,8 @@ void FFmpeg_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType * *type = SampleType_UInt8; else if((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_S16) *type = SampleType_Int16; + else if((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_FLT) + *type = SampleType_Float32; else fail(std::string("Unsupported sample format: ")+ av_get_sample_fmt_name((*mStream)->codec->sample_fmt)); diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index 67008e2bcd..1dc5f9974f 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -88,6 +88,51 @@ static ALenum getALFormat(ChannelConfig chans, SampleType type) } } } + if(alIsExtensionPresent("AL_EXT_FLOAT32")) + { + static const struct { + char name[32]; + ChannelConfig chans; + SampleType type; + } fltfmtlist[] = { + { "AL_FORMAT_MONO_FLOAT32", ChannelConfig_Mono, SampleType_Float32 }, + { "AL_FORMAT_STEREO_FLOAT32", ChannelConfig_Stereo, SampleType_Float32 }, + }; + static const size_t fltfmtlistsize = sizeof(fltfmtlist)/sizeof(fltfmtlist[0]); + + for(size_t i = 0;i < fltfmtlistsize;i++) + { + if(fltfmtlist[i].chans == chans && fltfmtlist[i].type == type) + { + ALenum format = alGetEnumValue(fltfmtlist[i].name); + if(format != 0 && format != -1) + return format; + } + } + if(alIsExtensionPresent("AL_EXT_MCFORMATS")) + { + static const struct { + char name[32]; + ChannelConfig chans; + SampleType type; + } fltmcfmtlist[] = { + { "AL_FORMAT_QUAD32", ChannelConfig_Quad, SampleType_Float32 }, + { "AL_FORMAT_51CHN32", ChannelConfig_5point1, SampleType_Float32 }, + { "AL_FORMAT_71CHN32", ChannelConfig_7point1, SampleType_Float32 }, + }; + static const size_t fltmcfmtlistsize = sizeof(fltmcfmtlist)/sizeof(fltmcfmtlist[0]); + + for(size_t i = 0;i < fltmcfmtlistsize;i++) + { + if(fltmcfmtlist[i].chans == chans && fltmcfmtlist[i].type == type) + { + ALenum format = alGetEnumValue(fltmcfmtlist[i].name); + if(format != 0 && format != -1) + return format; + } + } + } + } fail(std::string("Unsupported sound format (")+getChannelConfigName(chans)+", "+getSampleTypeName(type)+")"); return AL_NONE; diff --git a/apps/openmw/mwsound/sound_decoder.hpp b/apps/openmw/mwsound/sound_decoder.hpp index 29d99e8fa4..151b580360 100644 --- a/apps/openmw/mwsound/sound_decoder.hpp +++ b/apps/openmw/mwsound/sound_decoder.hpp @@ -9,7 +9,8 @@ namespace MWSound { enum SampleType { SampleType_UInt8, - SampleType_Int16 + SampleType_Int16, + SampleType_Float32 }; const char *getSampleTypeName(SampleType type); diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index c502906808..1b07dfe627 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -607,6 +607,7 @@ namespace MWSound { case SampleType_UInt8: return "U8"; case SampleType_Int16: return "S16"; + case SampleType_Float32: return "Float32"; } return "(unknown sample type)"; } @@ -638,6 +639,7 @@ namespace MWSound { case SampleType_UInt8: frames *= 1; break; case SampleType_Int16: frames *= 2; break; + case SampleType_Float32: frames *= 4; break; } return frames; } From 13c33c1613adce9e7bf5b81debfe4922f3412734 Mon Sep 17 00:00:00 2001 From: vorenon Date: Tue, 26 Feb 2013 19:37:47 +0100 Subject: [PATCH 23/65] added missing click sound to main menu --- apps/openmw/mwgui/mainmenu.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/openmw/mwgui/mainmenu.cpp b/apps/openmw/mwgui/mainmenu.cpp index 14309abc5e..5402d35428 100644 --- a/apps/openmw/mwgui/mainmenu.cpp +++ b/apps/openmw/mwgui/mainmenu.cpp @@ -5,6 +5,7 @@ #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" +#include "../mwbase/soundmanager.hpp" namespace MWGui { @@ -65,6 +66,7 @@ namespace MWGui void MainMenu::onButtonClicked(MyGUI::Widget *sender) { + MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.f, 1.f); if (sender == mButtons["return"]) MWBase::Environment::get().getWindowManager ()->removeGuiMode (GM_MainMenu); else if (sender == mButtons["options"]) From 89cba3cf455109e661d7e3db2139a7873628cfa5 Mon Sep 17 00:00:00 2001 From: vorenon Date: Tue, 26 Feb 2013 19:52:51 +0100 Subject: [PATCH 24/65] Replaced ifs/elseifs with switch --- apps/openmw/mwgui/waitdialog.cpp | 65 ++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/apps/openmw/mwgui/waitdialog.cpp b/apps/openmw/mwgui/waitdialog.cpp index 2c74dd2fd6..794a9ab55f 100644 --- a/apps/openmw/mwgui/waitdialog.cpp +++ b/apps/openmw/mwgui/waitdialog.cpp @@ -95,31 +95,46 @@ namespace MWGui // http://www.uesp.net/wiki/Lore:Calendar std::string month; int m = MWBase::Environment::get().getWorld ()->getMonth (); - if (m == 0) - month = "#{sMonthMorningstar}"; - else if (m == 1) - month = "#{sMonthSunsdawn}"; - else if (m == 2) - month = "#{sMonthFirstseed}"; - else if (m == 3) - month = "#{sMonthRainshand}"; - else if (m == 4) - month = "#{sMonthSecondseed}"; - else if (m == 5) - month = "#{sMonthMidyear}"; - else if (m == 6) - month = "#{sMonthSunsheight}"; - else if (m == 7) - month = "#{sMonthLastseed}"; - else if (m == 8) - month = "#{sMonthHeartfire}"; - else if (m == 9) - month = "#{sMonthFrostfall}"; - else if (m == 10) - month = "#{sMonthSunsdusk}"; - else if (m == 11) - month = "#{sMonthEveningstar}"; - + switch (m) { + case 0: + month = "#{sMonthMorningstar}"; + break; + case 1: + month = "#{sMonthSunsdawn}"; + break; + case 2: + month = "#{sMonthFirstseed}"; + break; + case 3: + month = "#{sMonthRainshand}"; + break; + case 4: + month = "#{sMonthSecondseed}"; + break; + case 5: + month = "#{sMonthMidyear}"; + break; + case 6: + month = "#{sMonthSunsheight}"; + break; + case 7: + month = "#{sMonthLastseed}"; + break; + case 8: + month = "#{sMonthHeartfire}"; + break; + case 9: + month = "#{sMonthFrostfall}"; + break; + case 10: + month = "#{sMonthSunsdusk}"; + break; + case 11: + month = "#{sMonthEveningstar}"; + break; + default: + break; + } int hour = MWBase::Environment::get().getWorld ()->getTimeStamp ().getHour (); bool pm = hour >= 12; if (hour >= 13) hour -= 12; From 6b86db6b6fa7ff0a5020a4d95baa0da6ee6e9567 Mon Sep 17 00:00:00 2001 From: pvdk Date: Tue, 26 Feb 2013 20:49:20 +0100 Subject: [PATCH 25/65] Forgot the release manager and added the license terms of EB Garamond --- credits.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/credits.txt b/credits.txt index 6f7e72aa1c..d1e85c6904 100644 --- a/credits.txt +++ b/credits.txt @@ -69,8 +69,9 @@ Sandy Carter (bwrsandman) - Arch Linux Public Relations and Translations: -Julien Voisin (jvoisin/ap0) - French News Writer Artem Kotsynyak (greye) - Russian News Writer +Julien Voisin (jvoisin/ap0) - French News Writer +Mickey Lyle (raevol) - Release Manager Pithorn - Chinese News Writer sir_herrbatka - English/Polish News Writer WeirdSexy - Podcaster @@ -138,7 +139,7 @@ Thanks to Kevin Ryan, for creating the icon used for the Data Files tab of the OpenMW Launcher. Thanks to Georg Duffner, -for the open-source EB Garamond fontface. +for his EB Garamond fontface, see OFL.txt for his license terms. Thanks to Dongle, for his Daedric fontface, see Daedric Font License.txt for his license terms. From 759b2e96bf77a97cc0f2c713c2700ba51024791c Mon Sep 17 00:00:00 2001 From: lazydev Date: Wed, 27 Feb 2013 01:37:40 +0400 Subject: [PATCH 26/65] fix for https://bugs.openmw.org/issues/577 --- components/esm/loadcell.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index 7400fd026c..92cb7d5ce8 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -112,8 +112,8 @@ void Cell::load(ESMReader &esm, MWWorld::ESMStore &store) // instead. if (mData.mFlags & QuasiEx) mRegion = esm.getHNOString("RGNN"); - else - esm.getHNT(mAmbi, "AMBI", 16); + else if (esm.isNextSub("AMBI")) + esm.getHT(mAmbi); } else { @@ -126,7 +126,7 @@ void Cell::load(ESMReader &esm, MWWorld::ESMStore &store) if (esm.isNextSub("NAM0")) { esm.getHT(mNAM0); } - + // preload moved references while (esm.isNextSub("MVRF")) { CellRef ref; @@ -135,7 +135,7 @@ void Cell::load(ESMReader &esm, MWWorld::ESMStore &store) MWWorld::Store &cStore = const_cast&>(store.get()); ESM::Cell *cellAlt = const_cast(cStore.searchOrCreate(cMRef.mTarget[0], cMRef.mTarget[1])); - + // Get regular moved reference data. Adapted from CellStore::loadRefs. Maybe we can optimize the following // implementation when the oher implementation works as well. getNextRef(esm, ref); @@ -143,7 +143,7 @@ void Cell::load(ESMReader &esm, MWWorld::ESMStore &store) std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase), (int(*)(int)) std::tolower); - + // Add data required to make reference appear in the correct cell. // We should not need to test for duplicates, as this part of the code is pre-cell merge. mMovedRefs.push_back(cMRef); @@ -186,7 +186,7 @@ void Cell::save(ESMWriter &esm) if (mMapColor != 0) esm.writeHNT("NAM5", mMapColor); } - + if (mNAM0 != 0) esm.writeHNT("NAM0", mNAM0); } @@ -226,7 +226,7 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) esm.getHNT(ref.mRefnum, "FRMR"); ref.mRefID = esm.getHNString("NAME"); - + // Identify references belonging to a parent file and adapt the ID accordingly. int local = (ref.mRefnum & 0xff000000) >> 24; size_t global = esm.getIndex() + 1; @@ -249,7 +249,7 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) // missing ref.mScale = 1.0; esm.getHNOT(ref.mScale, "XSCL"); - + // TODO: support loading references from saves, there are tons of keys not recognized yet. // The following is just an incomplete list. if (esm.isNextSub("ACTN")) @@ -266,7 +266,7 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) esm.skipHSub(); else if (esm.isNextSub("CRED")) // ??? esm.skipHSub(); - + ref.mOwner = esm.getHNOString("ANAM"); ref.mGlob = esm.getHNOString("BNAM"); ref.mSoul = esm.getHNOString("XSOL"); @@ -305,7 +305,7 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) esm.getHNOT(ref.mFltv, "FLTV"); esm.getHNOT(ref.mPos, "DATA", 24); - + // Number of references in the cell? Maximum once in each cell, // but not always at the beginning, and not always right. In other // words, completely useless. @@ -318,7 +318,7 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref) esm.getHT(ref.mNam0); //esm.getHNOT(NAM0, "NAM0"); } - + if (esm.isNextSub("DELE")) { esm.skipHSub(); ref.mDeleted = 2; // Deleted, will not respawn. @@ -333,7 +333,7 @@ bool Cell::getNextMVRF(ESMReader &esm, MovedCellRef &mref) { esm.getHT(mref.mRefnum); esm.getHNOT(mref.mTarget, "CNDT"); - + // Identify references belonging to a parent file and adapt the ID accordingly. int local = (mref.mRefnum & 0xff000000) >> 24; size_t global = esm.getIndex() + 1; From b4b20622c670bb15b78ede194f4f57a99b9f36b2 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 26 Feb 2013 15:24:20 -0800 Subject: [PATCH 27/65] Properly handle NiAlphaProperty values --- components/nifogre/ogre_nif_loader.cpp | 139 ++++++++++--------------- 1 file changed, 57 insertions(+), 82 deletions(-) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 5b84807a47..5042f666a5 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -492,49 +492,43 @@ bool createSkeleton(const std::string &name, const std::string &group, const Nif NIFSkeletonLoader::LoaderMap NIFSkeletonLoader::sLoaders; -// Conversion of blend / test mode from NIF -> OGRE. -// Not in use yet, so let's comment it out. -/* -static SceneBlendFactor getBlendFactor(int mode) +// Conversion of blend / test mode from NIF +static const char *getBlendFactor(int mode) { - switch(mode) + switch(mode) { - case 0: return SBF_ONE; - case 1: return SBF_ZERO; - case 2: return SBF_SOURCE_COLOUR; - case 3: return SBF_ONE_MINUS_SOURCE_COLOUR; - case 4: return SBF_DEST_COLOUR; - case 5: return SBF_ONE_MINUS_DEST_COLOUR; - case 6: return SBF_SOURCE_ALPHA; - case 7: return SBF_ONE_MINUS_SOURCE_ALPHA; - case 8: return SBF_DEST_ALPHA; - case 9: return SBF_ONE_MINUS_DEST_ALPHA; - // [Comment from Chris Robinson:] Can't handle this mode? :/ - // case 10: return SBF_SOURCE_ALPHA_SATURATE; - default: - return SBF_SOURCE_ALPHA; + case 0: return "one"; + case 1: return "zero"; + case 2: return "src_colour"; + case 3: return "one_minus_src_colour"; + case 4: return "dest_colour"; + case 5: return "one_minus_dest_colour"; + case 6: return "src_alpha"; + case 7: return "one_minus_src_alpha"; + case 8: return "dest_alpha"; + case 9: return "one_minus_dest_alpha"; + case 10: return "src_alpha_saturate"; } + std::cerr<< "Unexpected blend mode: "<data->colors.size() != 0); @@ -640,7 +634,7 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String if (a) { alphaFlags = a->flags; -// alphaTest = a->data.threshold; + alphaTest = a->data.threshold; } // Material @@ -674,6 +668,7 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String boost::hash_combine(h, texName); boost::hash_combine(h, vertexColour); boost::hash_combine(h, alphaFlags); + boost::hash_combine(h, alphaTest); std::map::iterator itr = MaterialMap.find(h); if (itr != MaterialMap.end()) @@ -705,57 +700,37 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String instance->setProperty ("has_vertex_colour", sh::makeProperty(new sh::BooleanValue(true))); // Add transparency if NiAlphaProperty was present - if (alphaFlags != -1) + NifOverrides::TransparencyResult result = NifOverrides::Overrides::getTransparencyOverride(texName); + if (result.first) { - // The 237 alpha flags are by far the most common. Check - // NiAlphaProperty in nif/property.h if you need to decode - // other values. 237 basically means normal transparencly. - if (alphaFlags == 237) - { - NifOverrides::TransparencyResult result = NifOverrides::Overrides::getTransparencyOverride(texName); - if (result.first) - { - instance->setProperty("alpha_rejection", - sh::makeProperty(new sh::StringValue("greater_equal " + boost::lexical_cast(result.second)))); - } - else - { - // Enable transparency - instance->setProperty("scene_blend", sh::makeProperty(new sh::StringValue("alpha_blend"))); - instance->setProperty("depth_write", sh::makeProperty(new sh::StringValue("off"))); - } - } - else - warn("Unhandled alpha setting for texture " + texName); + alphaFlags = (1<<9) | (6<<10); /* alpha_rejection enabled, greater_equal */ + alphaTest = result.second; + } + + if((alphaFlags&1)) + { + std::string blend_mode; + blend_mode += getBlendFactor((alphaFlags>>1)&0xf); + blend_mode += " "; + blend_mode += getBlendFactor((alphaFlags>>5)&0xf); + + instance->setProperty("depth_write", sh::makeProperty(new sh::StringValue("off"))); + instance->setProperty("scene_blend", sh::makeProperty(new sh::StringValue(blend_mode))); } else - instance->getMaterial ()->setShadowCasterMaterial ("openmw_shadowcaster_noalpha"); + instance->getMaterial()->setShadowCasterMaterial("openmw_shadowcaster_noalpha"); - // As of yet UNTESTED code from Chris: - /*pass->setTextureFiltering(Ogre::TFO_ANISOTROPIC); - pass->setDepthFunction(Ogre::CMPF_LESS_EQUAL); - pass->setDepthCheckEnabled(true); - - // Add transparency if NiAlphaProperty was present - if (alphaFlags != -1) + if((alphaFlags>>9)&1) { - std::cout << "Alpha flags set!" << endl; - if ((alphaFlags&1)) - { - pass->setDepthWriteEnabled(false); - pass->setSceneBlending(getBlendFactor((alphaFlags>>1)&0xf), - getBlendFactor((alphaFlags>>5)&0xf)); - } - else - pass->setDepthWriteEnabled(true); - - if ((alphaFlags>>9)&1) - pass->setAlphaRejectSettings(getTestMode((alphaFlags>>10)&0x7), - alphaTest); - - pass->setTransparentSortingEnabled(!((alphaFlags>>13)&1)); + std::string reject; + reject += getTestMode((alphaFlags>>10)&0x7); + reject += " "; + reject += Ogre::StringConverter::toString(alphaTest); + instance->setProperty("alpha_rejection", sh::makeProperty(new sh::StringValue(reject))); } -*/ + + instance->setProperty("transparent_sorting", sh::makeProperty(new sh::StringValue(((alphaFlags>>13)&1) ? + "off" : "on"))); return matname; } From f994b7d227bd2639882f5f8a1b525bff6db77c9f Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Wed, 27 Feb 2013 07:44:35 +0400 Subject: [PATCH 28/65] Prepare .desktop file for more systems This brings condition for .desktop file preparation in sync with condition for its installation. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6929850b51..dbab836907 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,7 +297,7 @@ configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg "${OpenMW_BINARY_DIR}/openmw.cfg.install") -if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if (NOT WIN32 AND NOT APPLE) configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop "${OpenMW_BINARY_DIR}/openmw.desktop") endif() From 0bc4c3556ae9f9c10e9197fb1ce18aab49a824c1 Mon Sep 17 00:00:00 2001 From: Emanuel Guevel Date: Wed, 27 Feb 2013 15:58:01 +0100 Subject: [PATCH 29/65] Fix dialogue gender filter --- apps/openmw/mwdialogue/filter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwdialogue/filter.cpp b/apps/openmw/mwdialogue/filter.cpp index 09bb0ddc4c..6f9d8b42fc 100644 --- a/apps/openmw/mwdialogue/filter.cpp +++ b/apps/openmw/mwdialogue/filter.cpp @@ -289,7 +289,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con case SelectWrapper::Function_PcGender: - return player.get()->mBase->mFlags & ESM::NPC::Female ? 0 : 1; + return player.get()->mBase->isMale() ? 0 : 1; case SelectWrapper::Function_PcClothingModifier: { From be9d49c510ea56aaca83e8c80456a70810ce2bef Mon Sep 17 00:00:00 2001 From: Emanuel Guevel Date: Wed, 27 Feb 2013 16:15:59 +0100 Subject: [PATCH 30/65] Do not hide pinned windows during loadings --- apps/openmw/mwgui/windowmanagerimp.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 1dc11f2c44..e17190b023 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -424,6 +424,12 @@ void WindowManager::updateVisible() MyGUI::PointerManager::getInstance().setVisible(false); break; case GM_Loading: + // Show the pinned windows + mMap->setVisible(mMap->pinned()); + mStatsWindow->setVisible(mStatsWindow->pinned()); + mInventoryWindow->setVisible(mInventoryWindow->pinned()); + mSpellWindow->setVisible(mSpellWindow->pinned()); + MyGUI::PointerManager::getInstance().setVisible(false); break; case GM_Video: From 03ca7f6123e250222bc133f9017f5d8b0aa5e01b Mon Sep 17 00:00:00 2001 From: Sergey Shambir Date: Wed, 27 Feb 2013 23:45:09 +0400 Subject: [PATCH 31/65] NIF: added NiStencilProperty record handling NiStencilProperty appears in Better Clothes plugin. If it not handled, some parts of NPCs bodies will be not rendered. --- components/nif/nif_file.cpp | 1 + components/nif/nif_file.hpp | 1 + components/nif/property.hpp | 57 ++++++++++++++++++++++++++ components/nif/record.hpp | 1 + components/nifogre/ogre_nif_loader.cpp | 2 + 5 files changed, 62 insertions(+) diff --git a/components/nif/nif_file.cpp b/components/nif/nif_file.cpp index 58d1bc9b85..ba3a7513b2 100644 --- a/components/nif/nif_file.cpp +++ b/components/nif/nif_file.cpp @@ -256,6 +256,7 @@ void NIFFile::parse() else if(rec == "NiDitherProperty") { r = new NiDitherProperty; r->recType = RC_NiDitherProperty; } else if(rec == "NiWireframeProperty") { r = new NiWireframeProperty; r->recType = RC_NiWireframeProperty; } else if(rec == "NiSpecularProperty") { r = new NiSpecularProperty; r->recType = RC_NiSpecularProperty; } + else if(rec == "NiStencilProperty") { r = new NiStencilProperty; r->recType = RC_NiStencilProperty; } // Controllers else if(rec == "NiVisController") { r = new NiVisController; r->recType = RC_NiVisController; } diff --git a/components/nif/nif_file.hpp b/components/nif/nif_file.hpp index e8884cd4d4..5e9694f4b4 100644 --- a/components/nif/nif_file.hpp +++ b/components/nif/nif_file.hpp @@ -158,6 +158,7 @@ public: short getShort() { return read_le16(); } unsigned short getUShort() { return read_le16(); } int getInt() { return read_le32(); } + unsigned int getUInt() { return read_le32(); } float getFloat() { return read_le32f(); } Ogre::Vector2 getVector2() { diff --git a/components/nif/property.hpp b/components/nif/property.hpp index b24e49b479..046fb04652 100644 --- a/components/nif/property.hpp +++ b/components/nif/property.hpp @@ -257,9 +257,66 @@ struct S_AlphaProperty } }; +/* + Docs taken from: + http://niftools.sourceforge.net/doc/nif/NiStencilProperty.html + */ +struct S_StencilProperty +{ + // Is stencil test enabled? + unsigned char enabled; + + /* + 0 TEST_NEVER + 1 TEST_LESS + 2 TEST_EQUAL + 3 TEST_LESS_EQUAL + 4 TEST_GREATER + 5 TEST_NOT_EQUAL + 6 TEST_GREATER_EQUAL + 7 TEST_ALWAYS + */ + int compareFunc; + unsigned stencilRef; + unsigned stencilMask; + /* + Stencil test fail action, depth test fail action and depth test pass action: + 0 ACTION_KEEP + 1 ACTION_ZERO + 2 ACTION_REPLACE + 3 ACTION_INCREMENT + 4 ACTION_DECREMENT + 5 ACTION_INVERT + */ + int failAction; + int zFailAction; + int zPassAction; + /* + Face draw mode: + 0 DRAW_CCW_OR_BOTH + 1 DRAW_CCW [default] + 2 DRAW_CW + 3 DRAW_BOTH + */ + int drawMode; + + void read(NIFFile *nif) + { + enabled = nif->getChar(); + compareFunc = nif->getInt(); + stencilRef = nif->getUInt(); + stencilMask = nif->getUInt(); + failAction = nif->getInt(); + zFailAction = nif->getInt(); + zPassAction = nif->getInt(); + drawMode = nif->getInt(); + } +}; + typedef StructPropT NiAlphaProperty; typedef StructPropT NiMaterialProperty; typedef StructPropT NiVertexColorProperty; +typedef StructPropT NiStencilProperty; } // Namespace #endif diff --git a/components/nif/record.hpp b/components/nif/record.hpp index d5f65e83a3..073f4657c0 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -48,6 +48,7 @@ enum RecordType RC_NiDitherProperty, RC_NiWireframeProperty, RC_NiSpecularProperty, + RC_NiStencilProperty, RC_NiVisController, RC_NiGeomMorpherController, RC_NiKeyframeController, diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 5042f666a5..052334f1da 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -586,6 +586,8 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String m = static_cast(pr); else if (pr->recType == Nif::RC_NiAlphaProperty) a = static_cast(pr); + else if (pr->recType == Nif::RC_NiStencilProperty) + /* unused */; else warn("Skipped property type: "+pr->recName); } From bfe80bb8dc0fa780ab065bb2086a4a7fc6663016 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 27 Feb 2013 12:33:36 -0800 Subject: [PATCH 32/65] Avoid duplicating skeletons due to casing issues Manually created resource names are apparently always case sensitive, causing some skeletons to get loaded multiple times. --- apps/openmw/mwrender/animation.cpp | 15 ++------ components/nifogre/ogre_nif_loader.cpp | 51 ++++++++++++++------------ components/nifogre/ogre_nif_loader.hpp | 2 +- 3 files changed, 32 insertions(+), 36 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 394e25b504..cc926e685d 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -53,8 +53,6 @@ void Animation::setAnimationSources(const std::vector &names) if(!mEntityList.mSkelBase) return; - Ogre::SkeletonManager &skelMgr = Ogre::SkeletonManager::getSingleton(); - mCurrentAnim = NULL; mCurrentKeys = NULL; mAnimVelocity = 0.0f; @@ -62,19 +60,14 @@ void Animation::setAnimationSources(const std::vector &names) mNonAccumRoot = NULL; mSkeletonSources.clear(); - std::vector::const_iterator nameiter = names.begin(); + std::vector::const_iterator nameiter; for(nameiter = names.begin();nameiter != names.end();nameiter++) { - Ogre::SkeletonPtr skel = skelMgr.getByName(*nameiter); + Ogre::SkeletonPtr skel = NifOgre::Loader::getSkeleton(*nameiter); if(skel.isNull()) { - NifOgre::Loader::createSkeleton(*nameiter); - skel = skelMgr.getByName(*nameiter); - if(skel.isNull()) - { - std::cerr<< "Failed to get skeleton source "<<*nameiter <touch(); diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 5042f666a5..b3d70bb1fe 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -452,7 +452,8 @@ void loadResource(Ogre::Resource *resource) } } -bool createSkeleton(const std::string &name, const std::string &group, const Nif::Node *node) + +static Ogre::SkeletonPtr createSkeleton(const std::string &name, const std::string &group, 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: @@ -463,7 +464,7 @@ bool createSkeleton(const std::string &name, const std::string &group, const Nif if(!node->boneTrafo) { if(node->recType == Nif::RC_NiTriShape) - return false; + return Ogre::SkeletonPtr(); if(node->controller.empty() && node->name != "AttachLight") { if(node->recType == Nif::RC_NiNode || node->recType == Nif::RC_RootCollisionNode) @@ -474,18 +475,18 @@ bool createSkeleton(const std::string &name, const std::string &group, const Nif { if(!children[i].empty()) { - if(createSkeleton(name, group, children[i].getPtr())) - return true; + Ogre::SkeletonPtr skel = createSkeleton(name, group, children[i].getPtr()); + if(!skel.isNull()) + return skel; } } - return false; + return Ogre::SkeletonPtr(); } } } Ogre::SkeletonManager &skelMgr = Ogre::SkeletonManager::getSingleton(); - skelMgr.create(name, group, true, &sLoaders[name]); - return true; + return skelMgr.create(name, group, true, &sLoaders[name]); } }; @@ -1140,10 +1141,7 @@ MeshInfoList Loader::load(const std::string &name, const std::string &group) bool hasSkel = Ogre::SkeletonManager::getSingleton().resourceExists(name); if(!hasSkel) - { - NIFSkeletonLoader skelldr; - hasSkel = skelldr.createSkeleton(name, group, node); - } + hasSkel = !NIFSkeletonLoader::createSkeleton(name, group, node).isNull(); NIFMeshLoader meshldr(name, group); if(hasSkel) @@ -1253,30 +1251,35 @@ EntityList Loader::createEntities(Ogre::Entity *parent, const std::string &bonen } -bool Loader::createSkeleton(const std::string &name, const std::string &group) +Ogre::SkeletonPtr Loader::getSkeleton(std::string name, const std::string &group) { - Nif::NIFFile::ptr pnif = Nif::NIFFile::create(name); - Nif::NIFFile &nif = *pnif.get(); - if(nif.numRecords() < 1) + Ogre::SkeletonPtr skel; + + Misc::StringUtils::toLower(name); + skel = Ogre::SkeletonManager::getSingleton().getByName(name); + if(!skel.isNull()) + return skel; + + Nif::NIFFile::ptr nif = Nif::NIFFile::create(name); + if(nif->numRecords() < 1) { - nif.warn("Found no NIF records in "+name+"."); - return false; + nif->warn("Found no NIF records in "+name+"."); + return skel; } // The first record is assumed to be the root node - Nif::Record const *r = nif.getRecord(0); + const Nif::Record *r = nif->getRecord(0); assert(r != NULL); - Nif::Node const *node = dynamic_cast(r); + const Nif::Node *node = dynamic_cast(r); if(node == NULL) { - nif.warn("First record in "+name+" was not a node, but a "+ - r->recName+"."); - return false; + nif->warn("First record in "+name+" was not a node, but a "+ + r->recName+"."); + return skel; } - NIFSkeletonLoader skelldr; - return skelldr.createSkeleton(name, group, node); + return NIFSkeletonLoader::createSkeleton(name, group, node); } diff --git a/components/nifogre/ogre_nif_loader.hpp b/components/nifogre/ogre_nif_loader.hpp index 7a7b0c5a1e..eae37dd8a9 100644 --- a/components/nifogre/ogre_nif_loader.hpp +++ b/components/nifogre/ogre_nif_loader.hpp @@ -74,7 +74,7 @@ public: std::string name, const std::string &group="General"); - static bool createSkeleton(const std::string &name, const std::string &group="General"); + static Ogre::SkeletonPtr getSkeleton(std::string name, const std::string &group="General"); }; } From 3ed0bf97a8a94d98e5d274f7a45a2f72e0b0bb63 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 27 Feb 2013 13:16:27 -0800 Subject: [PATCH 33/65] Share the space with the parent entity only when there's real skinned meshes The existence of a base skeleton doesn't mean it shares the same bone structure. If there isn't an actual skinned entity besides the base, simply attach it to the bone like unskinned meshes should be. --- components/nifogre/ogre_nif_loader.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index b3d70bb1fe..4d047ae8bb 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -1204,14 +1204,20 @@ EntityList Loader::createEntities(Ogre::Entity *parent, const std::string &bonen if(meshes.size() == 0) return entitylist; + bool isskinned = false; Ogre::SceneManager *sceneMgr = parentNode->getCreator(); std::string filter = "@shape=tri "+bonename; Misc::StringUtils::toLower(filter); for(size_t i = 0;i < meshes.size();i++) { Ogre::Entity *ent = sceneMgr->createEntity(meshes[i].mMeshName); - if(!entitylist.mSkelBase && ent->hasSkeleton()) - entitylist.mSkelBase = ent; + if(!entitylist.mSkelBase) + { + if(ent->hasSkeleton()) + entitylist.mSkelBase = ent; + } + else if(!isskinned && ent->hasSkeleton()) + isskinned = true; entitylist.mEntities.push_back(ent); } @@ -1219,7 +1225,7 @@ EntityList Loader::createEntities(Ogre::Entity *parent, const std::string &bonen if(bonename.find("Left") != std::string::npos) scale.x *= -1.0f; - if(entitylist.mSkelBase) + if(isskinned) { for(size_t i = 0;i < entitylist.mEntities.size();i++) { From b93eb844010f3002bb1acb15534f82f2a5af55c0 Mon Sep 17 00:00:00 2001 From: lazydev Date: Thu, 28 Feb 2013 02:43:03 +0400 Subject: [PATCH 34/65] fix for https://bugs.openmw.org/issues/573 --- components/esm/esmreader.hpp | 16 ++++++++-------- components/esm/loadappa.cpp | 27 +++++++++++++++++++++------ components/esm/loadappa.hpp | 6 ++++-- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/components/esm/esmreader.hpp b/components/esm/esmreader.hpp index 45d6d9164c..ae876edf8b 100644 --- a/components/esm/esmreader.hpp +++ b/components/esm/esmreader.hpp @@ -37,14 +37,14 @@ public: *************************************************************************/ int getVer() const { return mCtx.header.version; } - float getFVer() { if(mCtx.header.version == VER_12) return 1.2; else return 1.3; } - int getSpecial() { return mSpf; } - int getType() { return mCtx.header.type; } - const std::string getAuthor() { return mCtx.header.author.toString(); } - const std::string getDesc() { return mCtx.header.desc.toString(); } + float getFVer() const { if(mCtx.header.version == VER_12) return 1.2; else return 1.3; } + int getSpecial() const { return mSpf; } + int getType() const { return mCtx.header.type; } + const std::string getAuthor() const { return mCtx.header.author.toString(); } + const std::string getDesc() const { return mCtx.header.desc.toString(); } const SaveData &getSaveData() const { return mSaveData; } - const MasterList &getMasters() { return mMasters; } - const NAME &retSubName() { return mCtx.subName; } + const MasterList &getMasters() const { return mMasters; } + const NAME &retSubName() const { return mCtx.subName; } uint32_t getSubSize() const { return mCtx.leftSub; } /************************************************************************* @@ -85,7 +85,7 @@ public: int mIdx; void setIndex(const int index) {mIdx = index; mCtx.index = index;} const int getIndex() {return mIdx;} - + void setGlobalReaderList(std::vector *list) {mGlobalReaderList = list;} std::vector *getGlobalReaderList() {return mGlobalReaderList;} diff --git a/components/esm/loadappa.cpp b/components/esm/loadappa.cpp index f5e7e10e1a..80922e2cbe 100644 --- a/components/esm/loadappa.cpp +++ b/components/esm/loadappa.cpp @@ -7,13 +7,28 @@ namespace ESM { void Apparatus::load(ESMReader &esm) { - mModel = esm.getHNString("MODL"); - mName = esm.getHNString("FNAM"); - esm.getHNT(mData, "AADT", 16); - mScript = esm.getHNOString("SCRI"); - mIcon = esm.getHNString("ITEX"); + // we will not treat duplicated subrecords as errors here + while (esm.hasMoreSubs()) + { + esm.getSubName(); + NAME subName = esm.retSubName(); + + if (subName == "MODL") + mModel = esm.getHString(); + else if (subName == "FNAM") + mName = esm.getHString(); + else if (subName == "AADT") + esm.getHT(mData); + else if (subName == "SCRI") + mScript = esm.getHString(); + else if (subName == "ITEX") + mIcon = esm.getHString(); + else + esm.fail("wrong subrecord type " + subName.toString() + " for APPA record"); + } } -void Apparatus::save(ESMWriter &esm) + +void Apparatus::save(ESMWriter &esm) const { esm.writeHNCString("MODL", mModel); esm.writeHNCString("FNAM", mName); diff --git a/components/esm/loadappa.hpp b/components/esm/loadappa.hpp index 486a559f89..a1daeb1237 100644 --- a/components/esm/loadappa.hpp +++ b/components/esm/loadappa.hpp @@ -1,6 +1,7 @@ #ifndef OPENMW_ESM_APPA_H #define OPENMW_ESM_APPA_H +#include "esmcommon.hpp" #include namespace ESM @@ -13,8 +14,9 @@ class ESMWriter; * Alchemist apparatus */ -struct Apparatus +class Apparatus { +public: enum AppaType { MortarPestle = 0, @@ -35,7 +37,7 @@ struct Apparatus std::string mId, mModel, mIcon, mScript, mName; void load(ESMReader &esm); - void save(ESMWriter &esm); + void save(ESMWriter &esm) const; }; } #endif From d5aa975675c2bacfe91dd7199143b79fa4ac324d Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Wed, 27 Feb 2013 23:44:20 +0100 Subject: [PATCH 35/65] Fix some issues that seem to have appeared in the CMake configuration. --- CMakeLists.txt | 6 +++--- cmake/OpenMWMacros.cmake | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbab836907..4b092e922d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -378,7 +378,7 @@ if(WIN32) "${OpenMW_SOURCE_DIR}/readme.txt" "${OpenMW_SOURCE_DIR}/GPL3.txt" "${OpenMW_SOURCE_DIR}/OFL.txt" - "${OpenMW_SOURCE_DIR}/Bitstream Vera License.txt" + "${OpenMW_SOURCE_DIR}/DejaVu Font License.txt" "${OpenMW_SOURCE_DIR}/Daedric Font License.txt" "${OpenMW_BINARY_DIR}/launcher.qss" "${OpenMW_BINARY_DIR}/settings-default.cfg" @@ -389,7 +389,7 @@ if(WIN32) INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".") SET(CPACK_GENERATOR "NSIS") - SET(CPACK_PACKAGE_NAME "OpenMW ${OPENMW_VERSION}") + SET(CPACK_PACKAGE_NAME "OpenMW") SET(CPACK_PACKAGE_VENDOR "OpenMW.org") SET(CPACK_PACKAGE_VERSION ${OPENMW_VERSION}) SET(CPACK_PACKAGE_VERSION_MAJOR ${OPENMW_VERSION_MAJOR}) @@ -404,7 +404,7 @@ if(WIN32) SET(CPACK_RESOURCE_FILE_README "${OpenMW_SOURCE_DIR}/readme.txt") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${OpenMW_SOURCE_DIR}/readme.txt") SET(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") - SET(CPACK_NSIS_DISPLAY_NAME "OpenMW") + SET(CPACK_NSIS_DISPLAY_NAME "OpenMW ${OPENMW_VERSION}") SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.openmw.org") SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.openmw.org") SET(CPACK_NSIS_INSTALLED_ICON_NAME "omwlauncher.exe") diff --git a/cmake/OpenMWMacros.cmake b/cmake/OpenMWMacros.cmake index f2382fd8ac..f66dbf2c47 100644 --- a/cmake/OpenMWMacros.cmake +++ b/cmake/OpenMWMacros.cmake @@ -2,7 +2,7 @@ macro (add_openmw_dir dir) set (files) foreach (u ${ARGN}) -file (GLOB ALL ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.[ch]pp") +file (GLOB ALL "${dir}/${u}.[ch]pp") foreach (f ${ALL}) list (APPEND files "${f}") list (APPEND OPENMW_FILES "${f}") @@ -14,7 +14,7 @@ endmacro (add_openmw_dir) macro (add_component_dir dir) set (files) foreach (u ${ARGN}) -file (GLOB ALL ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.[ch]pp") +file (GLOB ALL "${dir}/${u}.[ch]pp") foreach (f ${ALL}) list (APPEND files "${f}") list (APPEND COMPONENT_FILES "${f}") @@ -26,12 +26,12 @@ endmacro (add_component_dir) macro (add_component_qt_dir dir) set (files) foreach (u ${ARGN}) -file (GLOB ALL ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.[ch]pp") +file (GLOB ALL "${dir}/${u}.[ch]pp") foreach (f ${ALL}) list (APPEND files "${f}") list (APPEND COMPONENT_FILES "${f}") endforeach (f) -file (GLOB MOC_H ${CMAKE_CURRENT_SOURCE_DIR} "${dir}/${u}.hpp") +file (GLOB MOC_H "${dir}/${u}.hpp") foreach (fi ${MOC_H}) list (APPEND COMPONENT_MOC_FILES "${fi}") endforeach (fi) From 0e8ff22d6fabe839380acdb2cde3fd11706ebbab Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Thu, 28 Feb 2013 07:20:01 +0400 Subject: [PATCH 36/65] Only install binaries which are enabled to be built --- CMakeLists.txt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbab836907..e8d5f23c75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -657,10 +657,18 @@ if (NOT WIN32 AND NOT DPKG_PROGRAM AND NOT APPLE) # Install binaries INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/openmw" DESTINATION "${BINDIR}" ) - INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/omwlauncher" DESTINATION "${BINDIR}" ) - INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/esmtool" DESTINATION "${BINDIR}" ) - INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/mwiniimport" DESTINATION "${BINDIR}" ) - INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/opencs" DESTINATION "${BINDIR}" ) + IF(BUILD_LAUNCHER) + INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/omwlauncher" DESTINATION "${BINDIR}" ) + ENDIF(BUILD_LAUNCHER) + IF(BUILD_ESMTOOL) + INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/esmtool" DESTINATION "${BINDIR}" ) + ENDIF(BUILD_ESMTOOL) + IF(BUILD_MWINIIMPORTER) + INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/mwiniimport" DESTINATION "${BINDIR}" ) + ENDIF(BUILD_MWINIIMPORTER) + IF(BUILD_OPENCS) + INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/opencs" DESTINATION "${BINDIR}" ) + ENDIF(BUILD_OPENCS) # Install icon and .desktop INSTALL(FILES "${OpenMW_SOURCE_DIR}/apps/launcher/resources/images/openmw.png" DESTINATION "${ICONDIR}") @@ -674,5 +682,7 @@ if (NOT WIN32 AND NOT DPKG_PROGRAM AND NOT APPLE) # Install resources INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "${DATADIR}" ) - INSTALL(FILES "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION "${DATADIR}/resources" ) + IF(BUILD_LAUNCHER) + INSTALL(FILES "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION "${DATADIR}/resources" ) + ENDIF(BUILD_LAUNCHER) endif(NOT WIN32 AND NOT DPKG_PROGRAM AND NOT APPLE) From f75681d89b3d29cf1561f0a261829f8b8ad6d347 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 28 Feb 2013 12:12:51 +0100 Subject: [PATCH 37/65] Ignore ESX header version --- components/esm/esmreader.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/esm/esmreader.cpp b/components/esm/esmreader.cpp index eca0d78548..41a2f738af 100644 --- a/components/esm/esmreader.cpp +++ b/components/esm/esmreader.cpp @@ -77,8 +77,9 @@ void ESMReader::open(Ogre::DataStreamPtr _esm, const std::string &name) // Get the header getHNT(mCtx.header, "HEDR", 300); - if (mCtx.header.version != VER_12 && mCtx.header.version != VER_13) - fail("Unsupported file format version"); + // Some mods abuse the header.version field for the version of the mod instead of the version of the file format, so we can only ignore it. + //if (mCtx.header.version != VER_12 && mCtx.header.version != VER_13) + //fail("Unsupported file format version"); while (isNextSub("MAST")) { From 6683e43efcfefffc069fa172b2e0cdd15bb04891 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 28 Feb 2013 12:35:18 +0100 Subject: [PATCH 38/65] Removed commented code --- components/esm/esmreader.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/esm/esmreader.cpp b/components/esm/esmreader.cpp index 41a2f738af..b4f581d7e8 100644 --- a/components/esm/esmreader.cpp +++ b/components/esm/esmreader.cpp @@ -78,8 +78,6 @@ void ESMReader::open(Ogre::DataStreamPtr _esm, const std::string &name) getHNT(mCtx.header, "HEDR", 300); // Some mods abuse the header.version field for the version of the mod instead of the version of the file format, so we can only ignore it. - //if (mCtx.header.version != VER_12 && mCtx.header.version != VER_13) - //fail("Unsupported file format version"); while (isNextSub("MAST")) { From ffd96c771593bc85205e53c487adebf4bdcaf41e Mon Sep 17 00:00:00 2001 From: vorenon Date: Thu, 28 Feb 2013 13:19:05 +0100 Subject: [PATCH 39/65] Removed "Unloading Cell..." text from loading screen OpenMW unloads the cell so fast, it's hardly noticable. This commit gets rid of the "flicker" every time a cell loads. --- apps/openmw/mwworld/scene.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index fb7653401f..99c1793fe2 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -75,7 +75,7 @@ namespace MWWorld { std::cout << "Unloading cell\n"; ListHandles functor; - + (*iter)->forEach(functor); { // silence annoying g++ warning @@ -217,7 +217,7 @@ namespace MWWorld } } - MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Unloading cells", 0, current, numUnload); + //MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Unloading cells", 0, current, numUnload); unloadCell (active++); ++current; } @@ -360,7 +360,7 @@ namespace MWWorld active = mActiveCells.begin(); while (active!=mActiveCells.end()) { - MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Unloading cells", 0, current, numUnload); + //MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Unloading cells", 0, current, numUnload); unloadCell (active++); ++current; From d4aa33b9a7da71682e9afa0cea01b65f9ce57453 Mon Sep 17 00:00:00 2001 From: vorenon Date: Thu, 28 Feb 2013 15:58:03 +0100 Subject: [PATCH 40/65] Removing the unloading cells part instead of just commenting them. --- apps/openmw/mwworld/scene.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 99c1793fe2..c15baf43ba 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -75,7 +75,7 @@ namespace MWWorld { std::cout << "Unloading cell\n"; ListHandles functor; - + (*iter)->forEach(functor); { // silence annoying g++ warning @@ -217,7 +217,6 @@ namespace MWWorld } } - //MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Unloading cells", 0, current, numUnload); unloadCell (active++); ++current; } @@ -360,7 +359,6 @@ namespace MWWorld active = mActiveCells.begin(); while (active!=mActiveCells.end()) { - //MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Unloading cells", 0, current, numUnload); unloadCell (active++); ++current; From a6fb58bc59598f77c2ccc415b47ce475b7cf073a Mon Sep 17 00:00:00 2001 From: vorenon Date: Thu, 28 Feb 2013 16:31:24 +0100 Subject: [PATCH 41/65] Using "Loading Exterior" and "Loading Interior" instead of "Loading Cell" This commit replaces the default "Loading Cell" text with "Loading Interior" and "Loading Exterior" --- apps/openmw/mwworld/scene.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index c15baf43ba..1e8f6d339b 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -27,13 +27,10 @@ namespace { const MWWorld::Class& class_ = MWWorld::Class::get (MWWorld::Ptr (&*cellRefList.mList.begin(), &cell)); - - size_t numRefs = cellRefList.mList.size(); int current = 0; for (typename T::List::iterator it = cellRefList.mList.begin(); it != cellRefList.mList.end(); it++) { - MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 1, current, numRefs); ++current; if (it->mData.getCount() || it->mData.isEnabled()) @@ -55,10 +52,6 @@ namespace } } } - else - { - MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 1, 0, 1); - } } } @@ -216,7 +209,6 @@ namespace MWWorld continue; } } - unloadCell (active++); ++current; } @@ -265,7 +257,9 @@ namespace MWWorld { CellStore *cell = MWBase::Environment::get().getWorld()->getExterior(x, y); - MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 0, current, numLoad); + //Loading Exterior loading text + MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading Exterior", 0, current, numLoad); + loadCell (cell); ++current; } @@ -359,7 +353,6 @@ namespace MWWorld active = mActiveCells.begin(); while (active!=mActiveCells.end()) { - unloadCell (active++); ++current; } @@ -367,7 +360,9 @@ namespace MWWorld // Load cell. std::cout << "cellName: " << cell->mCell->mName << std::endl; - MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 0, 0, 1); + //Loading Interior loading text + MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading Interior", 0, 0, 1); + loadCell (cell); mCurrentCell = cell; From f66f67eaa12f0fcddbb615648b478c2215c77d96 Mon Sep 17 00:00:00 2001 From: vorenon Date: Thu, 28 Feb 2013 17:54:42 +0100 Subject: [PATCH 42/65] Loading text uses now the corresponding GMSTs --- apps/openmw/mwworld/scene.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 1e8f6d339b..ecf783d6c4 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -169,12 +169,18 @@ namespace MWWorld void Scene::changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos) { Nif::NIFFile::CacheLock cachelock; + const MWWorld::Store &gmst = + MWBase::Environment::get().getWorld()->getStore().get(); mRendering.preCellChange(mCurrentCell); // remove active MWBase::Environment::get().getMechanicsManager()->remove(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); + std::string loadingExteriorText; + + loadingExteriorText = gmst.find ("sLoadingMessage3")->getString(); + CellStoreCollection::iterator active = mActiveCells.begin(); // get the number of cells to unload @@ -258,7 +264,7 @@ namespace MWWorld CellStore *cell = MWBase::Environment::get().getWorld()->getExterior(x, y); //Loading Exterior loading text - MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading Exterior", 0, current, numLoad); + MWBase::Environment::get().getWindowManager ()->setLoadingProgress (loadingExteriorText, 0, current, numLoad); loadCell (cell); ++current; @@ -318,6 +324,13 @@ namespace MWWorld void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position) { + + const MWWorld::Store &gmst = + MWBase::Environment::get().getWorld()->getStore().get(); + + std::string loadingInteriorText; + loadingInteriorText = gmst.find ("sLoadingMessage2")->getString(); + CellStore *cell = MWBase::Environment::get().getWorld()->getInterior(cellName); bool loadcell = (mCurrentCell == NULL); if(!loadcell) @@ -361,7 +374,7 @@ namespace MWWorld std::cout << "cellName: " << cell->mCell->mName << std::endl; //Loading Interior loading text - MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading Interior", 0, 0, 1); + MWBase::Environment::get().getWindowManager ()->setLoadingProgress (loadingInteriorText, 0, 0, 1); loadCell (cell); From bd597f07ab85d667ced3c6ef4afce828db73705e Mon Sep 17 00:00:00 2001 From: vorenon Date: Thu, 28 Feb 2013 19:22:10 +0100 Subject: [PATCH 43/65] Centered the loading text --- files/mygui/openmw_loading_screen.layout | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/mygui/openmw_loading_screen.layout b/files/mygui/openmw_loading_screen.layout index 4b6861151a..1e4bba5ed8 100644 --- a/files/mygui/openmw_loading_screen.layout +++ b/files/mygui/openmw_loading_screen.layout @@ -8,7 +8,8 @@ - + + From c9a701cfa1cf0c4de63717357673c9044b1ae6f3 Mon Sep 17 00:00:00 2001 From: vorenon Date: Thu, 28 Feb 2013 19:25:18 +0100 Subject: [PATCH 44/65] Removed the 3 dots after the load text. --- apps/openmw/mwgui/loadingscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/loadingscreen.cpp b/apps/openmw/mwgui/loadingscreen.cpp index dd5289edb1..e7c7acb533 100644 --- a/apps/openmw/mwgui/loadingscreen.cpp +++ b/apps/openmw/mwgui/loadingscreen.cpp @@ -106,7 +106,7 @@ namespace MWGui float progress = (float(mCurrentCellLoading)+refProgress) / float(mTotalCellsLoading); assert(progress <= 1 && progress >= 0); - mLoadingText->setCaption(stage + "... "); + mLoadingText->setCaption(stage); mProgressBar->setProgressPosition (static_cast(progress * 1000)); static float loadingScreenFps = 30.f; From 06e077c07ca699fb50f1b3d965394291eb1ccdde Mon Sep 17 00:00:00 2001 From: vorenon Date: Thu, 28 Feb 2013 19:36:10 +0100 Subject: [PATCH 45/65] Removing all traces of "Open Morrowind". pvdk said it was ok to remove the header entirely --- components/files/fixedpath.hpp | 22 ---------------------- components/files/linuxpath.cpp | 22 ---------------------- components/files/linuxpath.hpp | 22 ---------------------- components/files/macospath.cpp | 22 ---------------------- components/files/macospath.hpp | 22 ---------------------- components/files/ogreplugin.hpp | 22 ---------------------- components/files/windowspath.hpp | 22 ---------------------- 7 files changed, 154 deletions(-) diff --git a/components/files/fixedpath.hpp b/components/files/fixedpath.hpp index dce4f96c20..a309dc9fb6 100644 --- a/components/files/fixedpath.hpp +++ b/components/files/fixedpath.hpp @@ -1,25 +1,3 @@ -/** - * Open Morrowind - an opensource Elder Scrolls III: Morrowind - * engine implementation. - * - * Copyright (C) 2011 Open Morrowind Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** \file components/files/fixedpath.hpp */ - #ifndef COMPONENTS_FILES_FIXEDPATH_HPP #define COMPONENTS_FILES_FIXEDPATH_HPP diff --git a/components/files/linuxpath.cpp b/components/files/linuxpath.cpp index 0f08b67feb..c974a91d35 100644 --- a/components/files/linuxpath.cpp +++ b/components/files/linuxpath.cpp @@ -1,25 +1,3 @@ -/** - * Open Morrowind - an opensource Elder Scrolls III: Morrowind - * engine implementation. - * - * Copyright (C) 2011 Open Morrowind Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** \file components/files/linuxpath.cpp */ - #include "linuxpath.hpp" #if defined(__linux__) || defined(__FreeBSD__) diff --git a/components/files/linuxpath.hpp b/components/files/linuxpath.hpp index 09acd2be7f..6acf2a2d5f 100644 --- a/components/files/linuxpath.hpp +++ b/components/files/linuxpath.hpp @@ -1,25 +1,3 @@ -/** - * Open Morrowind - an opensource Elder Scrolls III: Morrowind - * engine implementation. - * - * Copyright (C) 2011 Open Morrowind Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** \file components/files/linuxpath.hpp */ - #ifndef COMPONENTS_FILES_LINUXPATH_H #define COMPONENTS_FILES_LINUXPATH_H diff --git a/components/files/macospath.cpp b/components/files/macospath.cpp index 9625612ad4..9edcd6ef2a 100644 --- a/components/files/macospath.cpp +++ b/components/files/macospath.cpp @@ -1,25 +1,3 @@ -/** - * Open Morrowind - an opensource Elder Scrolls III: Morrowind - * engine implementation. - * - * Copyright (C) 2011 Open Morrowind Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** \file components/files/macospath.cpp */ - #include "macospath.hpp" #if defined(macintosh) || defined(Macintosh) || defined(__APPLE__) || defined(__MACH__) diff --git a/components/files/macospath.hpp b/components/files/macospath.hpp index 591c978aa7..576ec16812 100644 --- a/components/files/macospath.hpp +++ b/components/files/macospath.hpp @@ -1,25 +1,3 @@ -/** - * Open Morrowind - an opensource Elder Scrolls III: Morrowind - * engine implementation. - * - * Copyright (C) 2011 Open Morrowind Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** \file components/files/macospath.hpp */ - #ifndef COMPONENTS_FILES_MACOSPATH_H #define COMPONENTS_FILES_MACOSPATH_H diff --git a/components/files/ogreplugin.hpp b/components/files/ogreplugin.hpp index 2d56bfb47a..6fcf613768 100644 --- a/components/files/ogreplugin.hpp +++ b/components/files/ogreplugin.hpp @@ -1,25 +1,3 @@ -/** - * Open Morrowind - an opensource Elder Scrolls III: Morrowind - * engine implementation. - * - * Copyright (C) 2011 Open Morrowind Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** \file components/files/ogreplugin.hpp */ - #ifndef COMPONENTS_FILES_OGREPLUGIN_H #define COMPONENTS_FILES_OGREPLUGIN_H diff --git a/components/files/windowspath.hpp b/components/files/windowspath.hpp index 7fe8bc9559..6044b67c21 100644 --- a/components/files/windowspath.hpp +++ b/components/files/windowspath.hpp @@ -1,25 +1,3 @@ -/** - * Open Morrowind - an opensource Elder Scrolls III: Morrowind - * engine implementation. - * - * Copyright (C) 2011 Open Morrowind Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** \file components/files/windowspath.hpp */ - #ifndef COMPONENTS_FILES_WINDOWSPATH_HPP #define COMPONENTS_FILES_WINDOWSPATH_HPP From 3df34fb5ccbb8ec0f1870b7f9072ff6576a22dd9 Mon Sep 17 00:00:00 2001 From: Michal Sciubidlo Date: Thu, 28 Feb 2013 19:52:32 +0100 Subject: [PATCH 46/65] fix bug 574 --- apps/openmw/mwinput/inputmanagerimp.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 4a79f77b85..2b943c50f5 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -274,13 +274,11 @@ namespace MWInput if (actionIsActive(A_MoveLeft)) { triedToMove = true; - mPlayer.setAutoMove (false); mPlayer.setLeftRight (-1); } else if (actionIsActive(A_MoveRight)) { triedToMove = true; - mPlayer.setAutoMove (false); mPlayer.setLeftRight (1); } else From f77ace088537a7a999decf39485affe7cb8d0080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20S=C3=B6derberg?= Date: Thu, 28 Feb 2013 20:16:46 +0100 Subject: [PATCH 47/65] Removed the "hack" mygui.png and misc fixes for this. --- files/mygui/CMakeLists.txt | 1 - files/mygui/mwgui.png | Bin 13534 -> 0 bytes .../openmw_chargen_class_description.layout | 3 + files/mygui/openmw_chargen_race.layout | 45 +- files/mygui/openmw_dialogue_window.layout | 6 +- files/mygui/openmw_edit.skin.xml | 57 ++- files/mygui/openmw_edit_effect.layout | 8 +- files/mygui/openmw_hud_box.skin.xml | 75 +--- files/mygui/openmw_list.skin.xml | 415 +++++++----------- files/mygui/openmw_loading_screen.layout | 3 +- files/mygui/openmw_map_window_skin.xml | 2 +- files/mygui/openmw_scroll_skin.xml | 6 +- files/mygui/openmw_settings_window.layout | 26 +- 13 files changed, 250 insertions(+), 397 deletions(-) delete mode 100644 files/mygui/mwgui.png diff --git a/files/mygui/CMakeLists.txt b/files/mygui/CMakeLists.txt index e7e5b695e1..beace5b81e 100644 --- a/files/mygui/CMakeLists.txt +++ b/files/mygui/CMakeLists.txt @@ -9,7 +9,6 @@ set(MYGUI_FILES core.skin core.xml EBGaramond-Regular.ttf - mwgui.png Obliviontt.zip openmw_alchemy_window.layout openmw_book.layout diff --git a/files/mygui/mwgui.png b/files/mygui/mwgui.png deleted file mode 100644 index 318f16e41873af708fd31d302bf0726efbdf916c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13534 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 Zfjvhb*ux%p4FUc|9E<#-`SbJN{0~$*&Ncu5 diff --git a/files/mygui/openmw_chargen_class_description.layout b/files/mygui/openmw_chargen_class_description.layout index 11031eb4e6..8823e1e760 100644 --- a/files/mygui/openmw_chargen_class_description.layout +++ b/files/mygui/openmw_chargen_class_description.layout @@ -4,6 +4,9 @@ + + + diff --git a/files/mygui/openmw_chargen_race.layout b/files/mygui/openmw_chargen_race.layout index a9ec9905da..4ef8da0f3f 100644 --- a/files/mygui/openmw_chargen_race.layout +++ b/files/mygui/openmw_chargen_race.layout @@ -8,33 +8,52 @@ - + - + - - + + + + + + + + + - - - + + + + + + + + + - - - + + + + + + + + + - + @@ -42,11 +61,11 @@ - + - + diff --git a/files/mygui/openmw_dialogue_window.layout b/files/mygui/openmw_dialogue_window.layout index 1271a287b6..9a9da72d4c 100644 --- a/files/mygui/openmw_dialogue_window.layout +++ b/files/mygui/openmw_dialogue_window.layout @@ -3,13 +3,15 @@ + + - + - + diff --git a/files/mygui/openmw_edit.skin.xml b/files/mygui/openmw_edit.skin.xml index 02fee4b179..da21385e2a 100644 --- a/files/mygui/openmw_edit.skin.xml +++ b/files/mygui/openmw_edit.skin.xml @@ -1,55 +1,52 @@ + + + + + + - - - - + - - - - - - - - - - - - + + + + + + + + + + + + + - + + + + - - - - - - - - - - - - - + + + diff --git a/files/mygui/openmw_edit_effect.layout b/files/mygui/openmw_edit_effect.layout index 45ecb63edf..cad22c064a 100644 --- a/files/mygui/openmw_edit_effect.layout +++ b/files/mygui/openmw_edit_effect.layout @@ -31,7 +31,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -56,7 +56,7 @@ - + @@ -72,7 +72,7 @@ - + diff --git a/files/mygui/openmw_hud_box.skin.xml b/files/mygui/openmw_hud_box.skin.xml index 464b6343aa..23480e8d35 100644 --- a/files/mygui/openmw_hud_box.skin.xml +++ b/files/mygui/openmw_hud_box.skin.xml @@ -1,80 +1,31 @@ + - - - - - - - - + - - - - - - - + + + - - - - - - - - - - - - - - - - + + - - - - - - - - - + - - - - - - - + - - - - - - - - - - - - - - - + + + + diff --git a/files/mygui/openmw_list.skin.xml b/files/mygui/openmw_list.skin.xml index 64435451ad..6631424ccf 100644 --- a/files/mygui/openmw_list.skin.xml +++ b/files/mygui/openmw_list.skin.xml @@ -1,228 +1,107 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + @@ -234,81 +113,85 @@ - - - - + + + + - - + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + - + - - + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/files/mygui/openmw_loading_screen.layout b/files/mygui/openmw_loading_screen.layout index 1e4bba5ed8..4b6861151a 100644 --- a/files/mygui/openmw_loading_screen.layout +++ b/files/mygui/openmw_loading_screen.layout @@ -8,8 +8,7 @@ - - + diff --git a/files/mygui/openmw_map_window_skin.xml b/files/mygui/openmw_map_window_skin.xml index 0c6050969d..13f18c6d3c 100644 --- a/files/mygui/openmw_map_window_skin.xml +++ b/files/mygui/openmw_map_window_skin.xml @@ -1,7 +1,7 @@ - + diff --git a/files/mygui/openmw_scroll_skin.xml b/files/mygui/openmw_scroll_skin.xml index 70fad3f4b4..1b94f0c291 100644 --- a/files/mygui/openmw_scroll_skin.xml +++ b/files/mygui/openmw_scroll_skin.xml @@ -2,12 +2,12 @@ - + - + - + diff --git a/files/mygui/openmw_settings_window.layout b/files/mygui/openmw_settings_window.layout index 2f9b5a67f1..8d435bfd53 100644 --- a/files/mygui/openmw_settings_window.layout +++ b/files/mygui/openmw_settings_window.layout @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -64,35 +64,35 @@ - + - + - + - + - + @@ -117,7 +117,7 @@ - + @@ -133,7 +133,7 @@ - + @@ -192,7 +192,7 @@ - + @@ -208,7 +208,7 @@ - + @@ -233,7 +233,7 @@ - + @@ -241,7 +241,7 @@ - + From 3efbb5e728b5708ee738279ccbe15ed765efadf9 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 28 Feb 2013 20:27:35 +0100 Subject: [PATCH 48/65] Don't try to render a map in empty cells --- apps/openmw/mwrender/localmap.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index 601ee58e31..1a14b86bfb 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -119,6 +119,10 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell) void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell, AxisAlignedBox bounds) { + // if we're in an empty cell, don't bother rendering anything + if (bounds.isNull ()) + return; + mInterior = true; mBounds = bounds; From 0b629791a82cc2abcaa7b1c2b106a81763c56a57 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 28 Feb 2013 20:40:32 +0100 Subject: [PATCH 49/65] reverting loading bar layout --- files/mygui/openmw_loading_screen.layout | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/mygui/openmw_loading_screen.layout b/files/mygui/openmw_loading_screen.layout index 4b6861151a..1e4bba5ed8 100644 --- a/files/mygui/openmw_loading_screen.layout +++ b/files/mygui/openmw_loading_screen.layout @@ -8,7 +8,8 @@ - + + From b7ab12e7cf4e919cdd664254163bf8c204be2771 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 28 Feb 2013 21:12:13 +0100 Subject: [PATCH 50/65] Workaround to prevent the map drawing on top of the world button --- apps/openmw/mwgui/map_window.cpp | 19 +++++++++++++++++++ apps/openmw/mwgui/map_window.hpp | 3 +++ 2 files changed, 22 insertions(+) diff --git a/apps/openmw/mwgui/map_window.cpp b/apps/openmw/mwgui/map_window.cpp index 6f7f0eaabc..52b108f850 100644 --- a/apps/openmw/mwgui/map_window.cpp +++ b/apps/openmw/mwgui/map_window.cpp @@ -6,6 +6,8 @@ #include #include +#include + #include "../mwbase/windowmanager.hpp" #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" @@ -13,6 +15,8 @@ #include "../mwrender/globalmap.hpp" +#include "widgets.hpp" + using namespace MWGui; LocalMapBase::LocalMapBase() @@ -96,6 +100,7 @@ void LocalMapBase::applyFogOfWar() : ""); } } + notifyMapChanged (); } void LocalMapBase::onMarkerFocused (MyGUI::Widget* w1, MyGUI::Widget* w2) @@ -425,3 +430,17 @@ void MapWindow::notifyPlayerUpdate () { globalMapUpdatePlayer (); } + +void MapWindow::notifyMapChanged () +{ + // workaround to prevent the map from drawing on top of the button + MyGUI::IntCoord oldCoord = mButton->getCoord (); + MyGUI::Gui::getInstance().destroyWidget (mButton); + mButton = mMainWidget->createWidget("MW_Button", + oldCoord, MyGUI::Align::Bottom | MyGUI::Align::Right); + mButton->setProperty ("ExpandDirection", "Left"); + + mButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MapWindow::onWorldButtonClicked); + mButton->setCaptionWithReplacing( mGlobal ? "#{sLocal}" : + "#{sWorld}"); +} diff --git a/apps/openmw/mwgui/map_window.hpp b/apps/openmw/mwgui/map_window.hpp index 4e2dd67567..39770a7a26 100644 --- a/apps/openmw/mwgui/map_window.hpp +++ b/apps/openmw/mwgui/map_window.hpp @@ -50,6 +50,7 @@ namespace MWGui void onMarkerUnfocused(MyGUI::Widget* w1, MyGUI::Widget* w2); virtual void notifyPlayerUpdate() {} + virtual void notifyMapChanged() {} OEngine::GUI::Layout* mLayout; @@ -99,6 +100,8 @@ namespace MWGui virtual void onPinToggled(); virtual void notifyPlayerUpdate(); + virtual void notifyMapChanged(); + }; } #endif From 1168f153611cb7e017c092496f3b31c978cd090e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 28 Feb 2013 12:17:58 -0800 Subject: [PATCH 51/65] Don't disable depth writes when blending is enabled --- apps/openmw/mwrender/activatoranimation.cpp | 3 +-- apps/openmw/mwrender/creatureanimation.cpp | 3 +-- apps/openmw/mwrender/npcanimation.cpp | 2 +- apps/openmw/mwrender/objects.cpp | 3 +-- components/nifogre/ogre_nif_loader.cpp | 2 -- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwrender/activatoranimation.cpp b/apps/openmw/mwrender/activatoranimation.cpp index 7bc89b9179..a3332d4b5c 100644 --- a/apps/openmw/mwrender/activatoranimation.cpp +++ b/apps/openmw/mwrender/activatoranimation.cpp @@ -42,8 +42,7 @@ ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr) while (passIt.hasMoreElements() && !transparent) { Ogre::Pass* pass = passIt.getNext(); - - if (pass->getDepthWriteEnabled() == false) + if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO) transparent = true; } } diff --git a/apps/openmw/mwrender/creatureanimation.cpp b/apps/openmw/mwrender/creatureanimation.cpp index b85c4dbbda..3adb0c4489 100644 --- a/apps/openmw/mwrender/creatureanimation.cpp +++ b/apps/openmw/mwrender/creatureanimation.cpp @@ -43,8 +43,7 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr) while (passIt.hasMoreElements() && !transparent) { Ogre::Pass* pass = passIt.getNext(); - - if (pass->getDepthWriteEnabled() == false) + if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO) transparent = true; } } diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 809e3f6d29..ce15841fc6 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -118,7 +118,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor while (passIt.hasMoreElements()) { Ogre::Pass* pass = passIt.getNext(); - if (pass->getDepthWriteEnabled() == false) + if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO) transparent = true; } } diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index add781459e..9aa65ac995 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -148,8 +148,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool while (passIt.hasMoreElements()) { Ogre::Pass* pass = passIt.getNext(); - - if (pass->getDepthWriteEnabled() == false) + if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO) transparent = true; } } diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index e6779ac1af..4d4a0d9c51 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -716,8 +716,6 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String blend_mode += getBlendFactor((alphaFlags>>1)&0xf); blend_mode += " "; blend_mode += getBlendFactor((alphaFlags>>5)&0xf); - - instance->setProperty("depth_write", sh::makeProperty(new sh::StringValue("off"))); instance->setProperty("scene_blend", sh::makeProperty(new sh::StringValue(blend_mode))); } else From 60f22194507c45f235c13928f3d7ca64e1629536 Mon Sep 17 00:00:00 2001 From: lazydev Date: Fri, 1 Mar 2013 00:46:05 +0400 Subject: [PATCH 52/65] fixed zini's norices --- components/esm/loadappa.cpp | 2 +- components/esm/loadappa.hpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/components/esm/loadappa.cpp b/components/esm/loadappa.cpp index 80922e2cbe..643fefda51 100644 --- a/components/esm/loadappa.cpp +++ b/components/esm/loadappa.cpp @@ -28,7 +28,7 @@ void Apparatus::load(ESMReader &esm) } } -void Apparatus::save(ESMWriter &esm) const +void Apparatus::save(ESMWriter &esm) { esm.writeHNCString("MODL", mModel); esm.writeHNCString("FNAM", mName); diff --git a/components/esm/loadappa.hpp b/components/esm/loadappa.hpp index a1daeb1237..820c44c592 100644 --- a/components/esm/loadappa.hpp +++ b/components/esm/loadappa.hpp @@ -1,7 +1,6 @@ #ifndef OPENMW_ESM_APPA_H #define OPENMW_ESM_APPA_H -#include "esmcommon.hpp" #include namespace ESM @@ -14,7 +13,7 @@ class ESMWriter; * Alchemist apparatus */ -class Apparatus +struct Apparatus { public: enum AppaType @@ -37,7 +36,7 @@ public: std::string mId, mModel, mIcon, mScript, mName; void load(ESMReader &esm); - void save(ESMWriter &esm) const; + void save(ESMWriter &esm); }; } #endif From 230136438b096d017ac490cc65347d73bc2b8854 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 28 Feb 2013 22:17:07 +0100 Subject: [PATCH 53/65] minor cleanup --- components/esm/loadappa.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/components/esm/loadappa.hpp b/components/esm/loadappa.hpp index 820c44c592..486a559f89 100644 --- a/components/esm/loadappa.hpp +++ b/components/esm/loadappa.hpp @@ -15,7 +15,6 @@ class ESMWriter; struct Apparatus { -public: enum AppaType { MortarPestle = 0, From 2786cc67f61e9e4aa6338222491ec96c501c4f5d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 28 Feb 2013 13:38:48 -0800 Subject: [PATCH 54/65] Fix loading empty NiTriShapeData records --- components/nif/data.hpp | 16 +++++++--------- components/nif/nif_file.cpp | 5 ++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/components/nif/data.hpp b/components/nif/data.hpp index 63df23b273..46b58da8f9 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -142,20 +142,18 @@ public: { ShapeData::read(nif); - int tris = nif->getUShort(); - if(tris) - { - // We have three times as many vertices as triangles, so this - // is always equal to tris*3. - int cnt = nif->getInt(); - nif->getShorts(triangles, cnt); - } + /*int tris =*/ nif->getUShort(); + + // We have three times as many vertices as triangles, so this + // is always equal to tris*3. + int cnt = nif->getInt(); + nif->getShorts(triangles, cnt); // Read the match list, which lists the vertices that are equal to // vertices. We don't actually need need this for anything, so // just skip it. int verts = nif->getUShort(); - for(int i=0;igetUShort(); diff --git a/components/nif/nif_file.cpp b/components/nif/nif_file.cpp index ba3a7513b2..6e806e7ecc 100644 --- a/components/nif/nif_file.cpp +++ b/components/nif/nif_file.cpp @@ -220,11 +220,10 @@ void NIFFile::parse() for(size_t i = 0;i < recNum;i++) { - std::string rec = getString(); - //cout << i << ": " << rec.toString() << endl; - Record *r = NULL; + std::string rec = getString(); + /* These are all the record types we know how to read. This can be heavily optimized later if needed. For example, a From eaa6813917498b84eb3ea02adb3d2ab3b26e08ad Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 28 Feb 2013 13:54:53 -0800 Subject: [PATCH 55/65] Workaround for meshes without any vertices --- components/nifogre/ogre_nif_loader.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index e6779ac1af..a86487854f 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -844,9 +844,12 @@ class NIFMeshLoader : Ogre::ManualResourceLoader // Set the bounding box first BoundsFinder bounds; bounds.add(&srcVerts[0][0], srcVerts.size()); - // No idea why this offset is needed. It works fine without it if the - // vertices weren't transformed first, but otherwise it fails later on - // when the object is being inserted into the scene. + if(!bounds.isValid()) + { + float v[3] = { 0.0f, 0.0f, 0.0f }; + bounds.add(&v[0], 1); + } + mesh->_setBounds(Ogre::AxisAlignedBox(bounds.minX()-0.5f, bounds.minY()-0.5f, bounds.minZ()-0.5f, bounds.maxX()+0.5f, bounds.maxY()+0.5f, bounds.maxZ()+0.5f)); mesh->_setBoundingSphereRadius(bounds.getRadius()); From 1d988676febb8b0e6629f6ca9b2eff0bdec6512e Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 28 Feb 2013 22:56:29 +0100 Subject: [PATCH 56/65] Local map: the obtained bounding box wasn't exactly accurate, getWorldBoundingBox seems to solve this. --- apps/openmw/mwrender/localmap.cpp | 5 ++++- apps/openmw/mwrender/objects.cpp | 8 ++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index 1a14b86bfb..918ec4580d 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -134,7 +134,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell, mAngle = angle.valueRadians(); mCellCamera->setOrientation(Quaternion::IDENTITY); - mCameraRotNode->setOrientation(Quaternion(Math::Cos(angle/2.f), 0, 0, -Math::Sin(angle/2.f))); + mCameraRotNode->setOrientation(Quaternion(Math::Cos(mAngle/2.f), 0, 0, -Math::Sin(mAngle/2.f))); // rotate the cell and merge the rotated corners to the bounding box Vector2 _center(bounds.getCenter().x, bounds.getCenter().y); @@ -156,6 +156,9 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell, mBounds.merge(Vector3(c3.x, c3.y, 0)); mBounds.merge(Vector3(c4.x, c4.y, 0)); + // apply a little padding + mBounds.scale ((mBounds.getSize ()+Ogre::Vector3(1000,1000,0)) / mBounds.getSize ()); + Vector2 center(mBounds.getCenter().x, mBounds.getCenter().y); Vector2 min(mBounds.getMinimum().x, mBounds.getMinimum().y); diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index add781459e..e8ee3f95f5 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -113,12 +113,8 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool Ogre::AxisAlignedBox bounds = Ogre::AxisAlignedBox::BOX_NULL; NifOgre::EntityList entities = NifOgre::Loader::createEntities(insert, mesh); for(size_t i = 0;i < entities.mEntities.size();i++) - { - const Ogre::AxisAlignedBox &tmp = entities.mEntities[i]->getBoundingBox(); - bounds.merge(Ogre::AxisAlignedBox(insert->_getDerivedPosition() + tmp.getMinimum(), - insert->_getDerivedPosition() + tmp.getMaximum()) - ); - } + bounds.merge(entities.mEntities[i]->getWorldBoundingBox(true)); + Ogre::Vector3 extents = bounds.getSize(); extents *= insert->getScale(); float size = std::max(std::max(extents.x, extents.y), extents.z); From 2c05a7477cfc37faab23217c87fe7527aa2a9dbf Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 28 Feb 2013 17:16:28 -0800 Subject: [PATCH 57/65] Improve checks for texture resource names that include the "textures\" prefix --- components/nifogre/ogre_nif_loader.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index a86487854f..85fbfea264 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -605,7 +605,12 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String */ static const char path[] = "textures\\"; - texName = path + st->filename; + texName = st->filename; + Misc::StringUtils::toLower(texName); + + if(texName.compare(0, sizeof(path)-1, path) != 0) + texName = path + texName; + Ogre::String::size_type pos = texName.rfind('.'); if(pos != Ogre::String::npos && texName.compare(pos, texName.length() - pos, ".dds") != 0) { @@ -616,18 +621,7 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String // if it turns out that the above wasn't true in all cases (not for vanilla, but maybe mods) // verify, and revert if false (this call succeeds quickly, but fails slowly) if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName)) - texName = path + st->filename; - } - else if (!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName)) - { - // workaround for Better Heads addon - size_t lastSlash = st->filename.rfind('\\'); - if (lastSlash != std::string::npos && lastSlash + 1 != st->filename.size()) { - texName = path + st->filename.substr(lastSlash + 1); - // workaround for Better Bodies addon - if (!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName)) - texName = st->filename; - } + texName = path + Misc::StringUtils::lowerCase(texName); } } else warn("Found internal texture, ignoring."); From d8f2d0195af6b9ac35560057412e0afb1544ec58 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 1 Mar 2013 18:45:52 +0100 Subject: [PATCH 58/65] Got rid of the texture rotation hack by rendering the cursor manually. --- apps/openmw/CMakeLists.txt | 4 +- apps/openmw/engine.cpp | 4 - apps/openmw/mwgui/cursor.cpp | 130 +++++++++++++++++++++++++ apps/openmw/mwgui/cursor.hpp | 62 ++++++++++++ apps/openmw/mwgui/cursorreplace.cpp | 16 --- apps/openmw/mwgui/cursorreplace.hpp | 16 --- apps/openmw/mwgui/windowmanagerimp.cpp | 19 +++- apps/openmw/mwgui/windowmanagerimp.hpp | 2 + files/mygui/openmw_pointer.xml | 11 ++- files/mygui/openmw_resources.xml | 21 ---- libs/openengine/gui/manager.cpp | 2 +- 11 files changed, 219 insertions(+), 68 deletions(-) create mode 100644 apps/openmw/mwgui/cursor.cpp create mode 100644 apps/openmw/mwgui/cursor.hpp delete mode 100644 apps/openmw/mwgui/cursorreplace.cpp delete mode 100644 apps/openmw/mwgui/cursorreplace.hpp diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index b3f4cd57b9..7cfeb84c5e 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -26,11 +26,11 @@ add_openmw_dir (mwinput add_openmw_dir (mwgui text_input widgets race class birth review windowmanagerimp console dialogue dialogue_history window_base stats_window messagebox journalwindow charactercreation - map_window window_pinnable_base cursorreplace tooltips scrollwindow bookwindow list + map_window window_pinnable_base tooltips scrollwindow bookwindow list formatting inventorywindow container hud countdialog tradewindow settingswindow confirmationdialog alchemywindow referenceinterface spellwindow mainmenu quickkeysmenu itemselection spellbuyingwindow loadingscreen levelupdialog waitdialog spellcreationdialog - enchantingdialog trainingwindow travelwindow imagebutton exposedwindow + enchantingdialog trainingwindow travelwindow imagebutton exposedwindow cursor ) add_openmw_dir (mwdialogue diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 6f59349fd5..d14696cdd6 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -18,7 +18,6 @@ #include "mwinput/inputmanagerimp.hpp" #include "mwgui/windowmanagerimp.hpp" -#include "mwgui/cursorreplace.hpp" #include "mwscript/scriptmanagerimp.hpp" #include "mwscript/extensions.hpp" @@ -333,9 +332,6 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) loadBSA(); - // cursor replacer (converts the cursor from the bsa so they can be used by mygui) - MWGui::CursorReplace replacer; - // Create the world mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mMaster, mPlugins, mResDir, mCfgMgr.getCachePath(), mNewGame, mEncoder, mFallbackMap, diff --git a/apps/openmw/mwgui/cursor.cpp b/apps/openmw/mwgui/cursor.cpp new file mode 100644 index 0000000000..852eea29a4 --- /dev/null +++ b/apps/openmw/mwgui/cursor.cpp @@ -0,0 +1,130 @@ +#include "cursor.hpp" + +#include +#include +#include +#include +#include + +#include + + +namespace MWGui +{ + + + ResourceImageSetPointerFix::ResourceImageSetPointerFix() : + mImageSet(nullptr) + { + } + + ResourceImageSetPointerFix::~ResourceImageSetPointerFix() + { + } + + void ResourceImageSetPointerFix::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) + { + Base::deserialization(_node, _version); + + MyGUI::xml::ElementEnumerator info = _node->getElementEnumerator(); + while (info.next("Property")) + { + const std::string& key = info->findAttribute("key"); + const std::string& value = info->findAttribute("value"); + + if (key == "Point") + mPoint = MyGUI::IntPoint::parse(value); + else if (key == "Size") + mSize = MyGUI::IntSize::parse(value); + else if (key == "Rotation") + mRotation = MyGUI::utility::parseInt(value); + else if (key == "Resource") + mImageSet = MyGUI::ResourceManager::getInstance().getByName(value)->castType(); + } + } + + int ResourceImageSetPointerFix::getRotation() + { + return mRotation; + } + + void ResourceImageSetPointerFix::setImage(MyGUI::ImageBox* _image) + { + if (mImageSet != nullptr) + _image->setItemResourceInfo(mImageSet->getIndexInfo(0, 0)); + } + + void ResourceImageSetPointerFix::setPosition(MyGUI::ImageBox* _image, const MyGUI::IntPoint& _point) + { + _image->setCoord(_point.left - mPoint.left, _point.top - mPoint.top, mSize.width, mSize.height); + } + + MyGUI::ResourceImageSetPtr ResourceImageSetPointerFix:: getImageSet() + { + return mImageSet; + } + + MyGUI::IntPoint ResourceImageSetPointerFix::getHotSpot() + { + return mPoint; + } + + MyGUI::IntSize ResourceImageSetPointerFix::getSize() + { + return mSize; + } + + // ---------------------------------------------------------------------------------------- + + Cursor::Cursor() + { + // hide mygui's pointer since we're rendering it ourselves (because mygui's pointer doesn't support rotation) + MyGUI::PointerManager::getInstance().setVisible(false); + + MyGUI::PointerManager::getInstance().eventChangeMousePointer += MyGUI::newDelegate(this, &Cursor::onCursorChange); + + mWidget = MyGUI::Gui::getInstance().createWidget("RotatingSkin",0,0,0,0,MyGUI::Align::Default,"Pointer",""); + + onCursorChange(MyGUI::PointerManager::getInstance().getDefaultPointer()); + } + + Cursor::~Cursor() + { + } + + void Cursor::onCursorChange(const std::string &name) + { + ResourceImageSetPointerFix* imgSetPtr = dynamic_cast( + MyGUI::PointerManager::getInstance().getByName(name)); + assert(imgSetPtr != NULL); + + MyGUI::ResourceImageSet* imgSet = imgSetPtr->getImageSet(); + + std::string texture = imgSet->getIndexInfo(0,0).texture; + + mSize = imgSetPtr->getSize(); + mHotSpot = imgSetPtr->getHotSpot(); + + int rotation = imgSetPtr->getRotation(); + + mWidget->setImageTexture(texture); + MyGUI::ISubWidget* main = mWidget->getSubWidgetMain(); + MyGUI::RotatingSkin* rotatingSubskin = main->castType(); + rotatingSubskin->setCenter(MyGUI::IntPoint(16,16)); + rotatingSubskin->setAngle(Ogre::Degree(rotation).valueRadians()); + } + + void Cursor::update() + { + MyGUI::IntPoint position = MyGUI::InputManager::getInstance().getMousePosition(); + + mWidget->setPosition(position - mHotSpot); + mWidget->setSize(mSize); + } + + void Cursor::setVisible(bool visible) + { + mWidget->setVisible(visible); + } + +} diff --git a/apps/openmw/mwgui/cursor.hpp b/apps/openmw/mwgui/cursor.hpp new file mode 100644 index 0000000000..3a4a05f4ca --- /dev/null +++ b/apps/openmw/mwgui/cursor.hpp @@ -0,0 +1,62 @@ +#ifndef MWGUI_CURSOR_H +#define MWGUI_CURSOR_H + +#include +#include +#include + +namespace MWGui +{ + + /// \brief Allows us to get the members of + /// ResourceImageSetPointer that we need. + /// \example MyGUI::FactoryManager::getInstance().registerFactory("Resource", "ResourceImageSetPointer"); + /// MyGUI::ResourceManager::getInstance().load("core.xml"); + class ResourceImageSetPointerFix : + public MyGUI::IPointer + { + MYGUI_RTTI_DERIVED( ResourceImageSetPointerFix ) + + public: + ResourceImageSetPointerFix(); + virtual ~ResourceImageSetPointerFix(); + + virtual void deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version); + + virtual void setImage(MyGUI::ImageBox* _image); + virtual void setPosition(MyGUI::ImageBox* _image, const MyGUI::IntPoint& _point); + + //and now for the whole point of this class, allow us to get + //the hot spot, the image and the size of the cursor. + virtual MyGUI::ResourceImageSetPtr getImageSet(); + virtual MyGUI::IntPoint getHotSpot(); + virtual MyGUI::IntSize getSize(); + virtual int getRotation(); + + private: + MyGUI::IntPoint mPoint; + MyGUI::IntSize mSize; + MyGUI::ResourceImageSetPtr mImageSet; + int mRotation; // rotation in degrees + }; + + class Cursor + { + public: + Cursor(); + ~Cursor(); + void update (); + + void setVisible (bool visible); + + void onCursorChange (const std::string& name); + + private: + MyGUI::ImageBox* mWidget; + + MyGUI::IntSize mSize; + MyGUI::IntPoint mHotSpot; + }; +} + +#endif diff --git a/apps/openmw/mwgui/cursorreplace.cpp b/apps/openmw/mwgui/cursorreplace.cpp deleted file mode 100644 index 2079538fc2..0000000000 --- a/apps/openmw/mwgui/cursorreplace.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "cursorreplace.hpp" - -#include -#include - -#include -#include - -using namespace MWGui; - -CursorReplace::CursorReplace() -{ - OEngine::Render::ImageRotate::rotate("textures\\tx_cursormove.dds", "mwpointer_vresize.png", 90); - OEngine::Render::ImageRotate::rotate("textures\\tx_cursormove.dds", "mwpointer_dresize1.png", -45); - OEngine::Render::ImageRotate::rotate("textures\\tx_cursormove.dds", "mwpointer_dresize2.png", 45); -} diff --git a/apps/openmw/mwgui/cursorreplace.hpp b/apps/openmw/mwgui/cursorreplace.hpp deleted file mode 100644 index 06fe28e39a..0000000000 --- a/apps/openmw/mwgui/cursorreplace.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef GAME_CURSORREPLACE_H -#define GAME_CURSORREPLACE_H - -#include - -namespace MWGui -{ - /// \brief MyGUI does not support rotating cursors, so we have to do it manually - class CursorReplace - { - public: - CursorReplace(); - }; -} - -#endif diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index e17190b023..1138f62faa 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -53,6 +53,7 @@ #include "trainingwindow.hpp" #include "imagebutton.hpp" #include "exposedwindow.hpp" +#include "cursor.hpp" using namespace MWGui; @@ -130,6 +131,9 @@ WindowManager::WindowManager( MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); + MyGUI::FactoryManager::getInstance().registerFactory("Resource", "ResourceImageSetPointer"); + MyGUI::ResourceManager::getInstance().load("core.xml"); + MyGUI::LanguageManager::getInstance().eventRequestTag = MyGUI::newDelegate(this, &WindowManager::onRetrieveTag); // Get size info from the Gui object @@ -178,6 +182,8 @@ WindowManager::WindowManager( mInputBlocker = mGui->createWidget("",0,0,w,h,MyGUI::Align::Default,"Windows",""); + mCursor = new Cursor(); + // The HUD is always on mHud->setVisible(true); @@ -236,6 +242,7 @@ WindowManager::~WindowManager() delete mTrainingWindow; delete mCountDialog; delete mQuickKeysMenu; + delete mCursor; cleanupGarbage(); @@ -262,6 +269,8 @@ void WindowManager::update() mHud->setFPS(mFPS); mHud->setTriangleCount(mTriangleCount); mHud->setBatchCount(mBatchCount); + + mCursor->update(); } void WindowManager::updateVisible() @@ -293,7 +302,7 @@ void WindowManager::updateVisible() mHud->setVisible(true); // Mouse is visible whenever we're not in game mode - MyGUI::PointerManager::getInstance().setVisible(isGuiMode()); + mCursor->setVisible(isGuiMode()); bool gameMode = !isGuiMode(); @@ -421,7 +430,7 @@ void WindowManager::updateVisible() break; case GM_LoadingWallpaper: mHud->setVisible(false); - MyGUI::PointerManager::getInstance().setVisible(false); + mCursor->setVisible(false); break; case GM_Loading: // Show the pinned windows @@ -430,10 +439,10 @@ void WindowManager::updateVisible() mInventoryWindow->setVisible(mInventoryWindow->pinned()); mSpellWindow->setVisible(mSpellWindow->pinned()); - MyGUI::PointerManager::getInstance().setVisible(false); + mCursor->setVisible(false); break; case GM_Video: - MyGUI::PointerManager::getInstance().setVisible(false); + mCursor->setVisible(false); mHud->setVisible(false); break; default: @@ -755,7 +764,7 @@ void WindowManager::setSpellVisibility(bool visible) void WindowManager::setMouseVisible(bool visible) { - MyGUI::PointerManager::getInstance().setVisible(visible); + mCursor->setVisible(visible); } void WindowManager::setDragDrop(bool dragDrop) diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index f574211372..e2d64a855d 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -72,6 +72,7 @@ namespace MWGui class SpellCreationDialog; class EnchantingDialog; class TrainingWindow; + class Cursor; class WindowManager : public MWBase::WindowManager { @@ -260,6 +261,7 @@ namespace MWGui EnchantingDialog* mEnchantingDialog; TrainingWindow* mTrainingWindow; Translation::Storage& mTranslationDataStorage; + Cursor* mCursor; CharacterCreation* mCharGen; diff --git a/files/mygui/openmw_pointer.xml b/files/mygui/openmw_pointer.xml index 42ee5d4351..cf21037f8e 100644 --- a/files/mygui/openmw_pointer.xml +++ b/files/mygui/openmw_pointer.xml @@ -5,26 +5,31 @@ + + - + + - + + - + + diff --git a/files/mygui/openmw_resources.xml b/files/mygui/openmw_resources.xml index 5a695515d4..e47ff6386d 100644 --- a/files/mygui/openmw_resources.xml +++ b/files/mygui/openmw_resources.xml @@ -17,27 +17,6 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/openengine/gui/manager.cpp b/libs/openengine/gui/manager.cpp index 925891e1b3..e5a164b818 100644 --- a/libs/openengine/gui/manager.cpp +++ b/libs/openengine/gui/manager.cpp @@ -53,7 +53,7 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool // Create GUI mGui = new Gui(); - mGui->initialise("core.xml"); + mGui->initialise(""); } void MyGUIManager::shutdown() From 166d529c5071bd88e59374cfa7ba9078e47eee86 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 1 Mar 2013 13:26:31 -0800 Subject: [PATCH 59/65] Ensure the material is properly built after creating it --- components/nifogre/ogre_nif_loader.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 4d4a0d9c51..c856c4ab33 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -733,6 +733,7 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String instance->setProperty("transparent_sorting", sh::makeProperty(new sh::StringValue(((alphaFlags>>13)&1) ? "off" : "on"))); + sh::Factory::getInstance()._ensureMaterial(matname, "Default"); return matname; } From 238a8feb1819d1b1b430a0fd5211b13b71998e79 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 1 Mar 2013 13:27:25 -0800 Subject: [PATCH 60/65] Fix transparency checks --- apps/openmw/mwrender/activatoranimation.cpp | 9 +++---- apps/openmw/mwrender/creatureanimation.cpp | 9 +++---- apps/openmw/mwrender/npcanimation.cpp | 29 ++++++++++++++++----- apps/openmw/mwrender/objects.cpp | 11 ++++---- 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/apps/openmw/mwrender/activatoranimation.cpp b/apps/openmw/mwrender/activatoranimation.cpp index a3332d4b5c..0dc16ecb6f 100644 --- a/apps/openmw/mwrender/activatoranimation.cpp +++ b/apps/openmw/mwrender/activatoranimation.cpp @@ -31,19 +31,18 @@ ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr) Ogre::Entity *ent = mEntityList.mEntities[i]; bool transparent = false; - for (unsigned int j=0;j < ent->getNumSubEntities() && !transparent; ++j) + for(unsigned int j=0;!transparent && j < ent->getNumSubEntities(); ++j) { Ogre::MaterialPtr mat = ent->getSubEntity(j)->getMaterial(); Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator(); - while (techIt.hasMoreElements() && !transparent) + while(!transparent && techIt.hasMoreElements()) { Ogre::Technique* tech = techIt.getNext(); Ogre::Technique::PassIterator passIt = tech->getPassIterator(); - while (passIt.hasMoreElements() && !transparent) + while(!transparent && passIt.hasMoreElements()) { Ogre::Pass* pass = passIt.getNext(); - if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO) - transparent = true; + transparent = pass->isTransparent(); } } } diff --git a/apps/openmw/mwrender/creatureanimation.cpp b/apps/openmw/mwrender/creatureanimation.cpp index 3adb0c4489..73bb80547d 100644 --- a/apps/openmw/mwrender/creatureanimation.cpp +++ b/apps/openmw/mwrender/creatureanimation.cpp @@ -32,19 +32,18 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr) ent->setVisibilityFlags(RV_Actors); bool transparent = false; - for (unsigned int j=0;j < ent->getNumSubEntities() && !transparent; ++j) + for(unsigned int j=0;!transparent && j < ent->getNumSubEntities(); ++j) { Ogre::MaterialPtr mat = ent->getSubEntity(j)->getMaterial(); Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator(); - while (techIt.hasMoreElements() && !transparent) + while(!transparent && techIt.hasMoreElements()) { Ogre::Technique* tech = techIt.getNext(); Ogre::Technique::PassIterator passIt = tech->getPassIterator(); - while (passIt.hasMoreElements() && !transparent) + while(!transparent && passIt.hasMoreElements()) { Ogre::Pass* pass = passIt.getNext(); - if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO) - transparent = true; + transparent = pass->isTransparent(); } } } diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index ce15841fc6..1f1cd0530b 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -107,19 +107,18 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor base->setVisibilityFlags(mVisibilityFlags); bool transparent = false; - for(unsigned int j=0;j < base->getNumSubEntities();++j) + for(unsigned int j=0;!transparent && j < base->getNumSubEntities();++j) { Ogre::MaterialPtr mat = base->getSubEntity(j)->getMaterial(); Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator(); - while (techIt.hasMoreElements()) + while(!transparent && techIt.hasMoreElements()) { Ogre::Technique* tech = techIt.getNext(); Ogre::Technique::PassIterator passIt = tech->getPassIterator(); - while (passIt.hasMoreElements()) + while(!transparent && passIt.hasMoreElements()) { Ogre::Pass* pass = passIt.getNext(); - if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO) - transparent = true; + transparent = pass->isTransparent(); } } } @@ -322,8 +321,26 @@ NifOgre::EntityList NpcAnimation::insertBoundedPart(const std::string &mesh, int std::vector &parts = entities.mEntities; for(size_t i = 0;i < parts.size();i++) { - parts[i]->setVisibilityFlags(mVisibilityFlags); parts[i]->getUserObjectBindings().setUserAny(Ogre::Any(group)); + parts[i]->setVisibilityFlags(mVisibilityFlags); + + bool transparent = false; + for(unsigned int j=0;!transparent && j < parts[i]->getNumSubEntities();++j) + { + Ogre::MaterialPtr mat = parts[i]->getSubEntity(j)->getMaterial(); + Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator(); + while(!transparent && techIt.hasMoreElements()) + { + Ogre::Technique* tech = techIt.getNext(); + Ogre::Technique::PassIterator passIt = tech->getPassIterator(); + while(!transparent && passIt.hasMoreElements()) + { + Ogre::Pass* pass = passIt.getNext(); + transparent = pass->isTransparent(); + } + } + } + parts[i]->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main); } if(entities.mSkelBase) { diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index 9aa65ac995..fb2b0e50a6 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -134,22 +134,21 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh, bool mBounds[ptr.getCell()].merge(bounds); bool transparent = false; - for(size_t i = 0;i < entities.mEntities.size();i++) + for(size_t i = 0;!transparent && i < entities.mEntities.size();i++) { Ogre::Entity *ent = entities.mEntities[i]; - for (unsigned int i=0; igetNumSubEntities(); ++i) + for(unsigned int i=0;!transparent && i < ent->getNumSubEntities(); ++i) { Ogre::MaterialPtr mat = ent->getSubEntity(i)->getMaterial(); Ogre::Material::TechniqueIterator techIt = mat->getTechniqueIterator(); - while (techIt.hasMoreElements()) + while(!transparent && techIt.hasMoreElements()) { Ogre::Technique* tech = techIt.getNext(); Ogre::Technique::PassIterator passIt = tech->getPassIterator(); - while (passIt.hasMoreElements()) + while(!transparent && passIt.hasMoreElements()) { Ogre::Pass* pass = passIt.getNext(); - if(pass->getSourceBlendFactor() != Ogre::SBF_ONE || pass->getDestBlendFactor() != Ogre::SBF_ZERO) - transparent = true; + transparent = pass->isTransparent(); } } } From 9810eafe230104ba4356bc5f53d6ee74bdaa3079 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 1 Mar 2013 22:27:53 +0100 Subject: [PATCH 61/65] Removing now unused oengine/imagerotate --- CMakeLists.txt | 1 - libs/openengine/ogre/imagerotate.cpp | 88 ---------------------------- libs/openengine/ogre/imagerotate.hpp | 27 --------- 3 files changed, 116 deletions(-) delete mode 100644 libs/openengine/ogre/imagerotate.cpp delete mode 100644 libs/openengine/ogre/imagerotate.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b976df57a..e583f23d44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,6 @@ set(LIBDIR ${CMAKE_SOURCE_DIR}/libs) set(OENGINE_OGRE ${LIBDIR}/openengine/ogre/renderer.cpp ${LIBDIR}/openengine/ogre/fader.cpp - ${LIBDIR}/openengine/ogre/imagerotate.cpp ${LIBDIR}/openengine/ogre/selectionbuffer.cpp ) set(OENGINE_GUI diff --git a/libs/openengine/ogre/imagerotate.cpp b/libs/openengine/ogre/imagerotate.cpp deleted file mode 100644 index 3dd5840785..0000000000 --- a/libs/openengine/ogre/imagerotate.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "imagerotate.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace Ogre; -using namespace OEngine::Render; - -void ImageRotate::rotate(const std::string& sourceImage, const std::string& destImage, const float angle) -{ - Root* root = Ogre::Root::getSingletonPtr(); - - std::string destImageRot = std::string(destImage) + std::string("_rot"); - - SceneManager* sceneMgr = root->createSceneManager(ST_GENERIC); - Camera* camera = sceneMgr->createCamera("ImageRotateCamera"); - - MaterialPtr material = MaterialManager::getSingleton().create("ImageRotateMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); - material->getTechnique(0)->getPass(0)->setLightingEnabled(false); - material->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false); - TextureUnitState* tus = material->getTechnique(0)->getPass(0)->createTextureUnitState(sourceImage); - Degree deg(angle); - tus->setTextureRotate(Radian(deg.valueRadians())); - tus->setTextureAddressingMode(TextureUnitState::TAM_BORDER); - tus->setTextureBorderColour(ColourValue(0, 0, 0, 0)); - - Rectangle2D* rect = new Rectangle2D(true); - rect->setCorners(-1.0, 1.0, 1.0, -1.0); - rect->setMaterial("ImageRotateMaterial"); - // Render the background before everything else - rect->setRenderQueueGroup(RENDER_QUEUE_BACKGROUND); - - // Use infinite AAB to always stay visible - AxisAlignedBox aabInf; - aabInf.setInfinite(); - rect->setBoundingBox(aabInf); - - // Attach background to the scene - SceneNode* node = sceneMgr->getRootSceneNode()->createChildSceneNode(); - node->attachObject(rect); - - // retrieve image width and height - TexturePtr sourceTexture = TextureManager::getSingleton().getByName(sourceImage); - unsigned int width = sourceTexture->getWidth(); - unsigned int height = sourceTexture->getHeight(); - - TexturePtr destTextureRot = TextureManager::getSingleton().createManual( - destImageRot, - ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - TEX_TYPE_2D, - width, height, - 0, - PF_FLOAT16_RGBA, - TU_RENDERTARGET); - - RenderTarget* rtt = destTextureRot->getBuffer()->getRenderTarget(); - rtt->setAutoUpdated(false); - Viewport* vp = rtt->addViewport(camera); - vp->setOverlaysEnabled(false); - vp->setShadowsEnabled(false); - vp->setBackgroundColour(ColourValue(0,0,0,0)); - - rtt->update(); - - //copy the rotated image to a static texture - TexturePtr destTexture = TextureManager::getSingleton().createManual( - destImage, - ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, - TEX_TYPE_2D, - width, height, - 0, - PF_FLOAT16_RGBA, - Ogre::TU_STATIC); - - destTexture->getBuffer()->blit(destTextureRot->getBuffer()); - - // remove all the junk we've created - TextureManager::getSingleton().remove(destImageRot); - MaterialManager::getSingleton().remove("ImageRotateMaterial"); - root->destroySceneManager(sceneMgr); - delete rect; -} diff --git a/libs/openengine/ogre/imagerotate.hpp b/libs/openengine/ogre/imagerotate.hpp deleted file mode 100644 index a3f6d662f3..0000000000 --- a/libs/openengine/ogre/imagerotate.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef OENGINE_OGRE_IMAGEROTATE_HPP -#define OENGINE_OGRE_IMAGEROTATE_HPP - -#include - -namespace OEngine -{ -namespace Render -{ - - /// Rotate an image by certain degrees and save as file, uses the GPU - /// Make sure Ogre Root is initialised before calling - class ImageRotate - { - public: - /** - * @param source image (file name - has to exist in an resource group) - * @param name of the destination texture to save to (in memory) - * @param angle in degrees to turn - */ - static void rotate(const std::string& sourceImage, const std::string& destImage, const float angle); - }; - -} -} - -#endif From ef1678e47eaf1974fd8322b8c1b70c6653965b15 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 1 Mar 2013 22:32:02 +0100 Subject: [PATCH 62/65] Oops, rotation center should be dynamic --- apps/openmw/mwgui/cursor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/cursor.cpp b/apps/openmw/mwgui/cursor.cpp index 852eea29a4..15f61d5b66 100644 --- a/apps/openmw/mwgui/cursor.cpp +++ b/apps/openmw/mwgui/cursor.cpp @@ -110,7 +110,7 @@ namespace MWGui mWidget->setImageTexture(texture); MyGUI::ISubWidget* main = mWidget->getSubWidgetMain(); MyGUI::RotatingSkin* rotatingSubskin = main->castType(); - rotatingSubskin->setCenter(MyGUI::IntPoint(16,16)); + rotatingSubskin->setCenter(MyGUI::IntPoint(mSize.width/2,mSize.height/2)); rotatingSubskin->setAngle(Ogre::Degree(rotation).valueRadians()); } From ccb7ed93b3d231c112b7ab7541178e19cb2adcf3 Mon Sep 17 00:00:00 2001 From: lazydev Date: Sat, 2 Mar 2013 03:54:25 +0400 Subject: [PATCH 63/65] fix for https://bugs.openmw.org/issues/593 --- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 6 +++- apps/openmw/mwdialogue/filter.cpp | 34 ++++++++++++++----- apps/openmw/mwdialogue/filter.hpp | 3 +- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index f548c46f75..43d201fbf3 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -251,8 +251,12 @@ namespace MWDialogue MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); - if (const ESM::DialInfo *info = filter.search (dialogue, true)) + std::vector infos; + filter.search (infos, dialogue, true, true); + if (!infos.empty()) { + const ESM::DialInfo* info = infos[rand() % infos.size()]; + parseText (info->mResponse); if (dialogue.mType==ESM::Dialogue::Persuasion) diff --git a/apps/openmw/mwdialogue/filter.cpp b/apps/openmw/mwdialogue/filter.cpp index 6f9d8b42fc..4391716fd6 100644 --- a/apps/openmw/mwdialogue/filter.cpp +++ b/apps/openmw/mwdialogue/filter.cpp @@ -559,8 +559,22 @@ MWDialogue::Filter::Filter (const MWWorld::Ptr& actor, int choice, bool talkedTo : mActor (actor), mChoice (choice), mTalkedToPlayer (talkedToPlayer) {} -const ESM::DialInfo *MWDialogue::Filter::search (const ESM::Dialogue& dialogue, const bool fallbackToInfoRefusal) const +const ESM::DialInfo* MWDialogue::Filter::search (const ESM::Dialogue& dialogue, const bool fallbackToInfoRefusal) const { + std::vector suitableInfos; + search(suitableInfos, dialogue, fallbackToInfoRefusal, false); + + if (suitableInfos.empty()) + return NULL; + else + return suitableInfos[0]; +} + +void MWDialogue::Filter::search (std::vector& suitableInfos, const ESM::Dialogue& dialogue, + const bool fallbackToInfoRefusal, bool searchAll) const +{ + suitableInfos.clear(); + bool infoRefusal = false; // Iterate over topic responses to find a matching one @@ -569,14 +583,17 @@ const ESM::DialInfo *MWDialogue::Filter::search (const ESM::Dialogue& dialogue, { if (testActor (*iter) && testPlayer (*iter) && testSelectStructs (*iter)) { - if (testDisposition (*iter)) - return &*iter; + if (testDisposition (*iter)) { + suitableInfos.push_back(&*iter); + if (!searchAll) + return; + } else infoRefusal = true; } } - if (infoRefusal && fallbackToInfoRefusal) + if (suitableInfos.empty() && infoRefusal && fallbackToInfoRefusal) { // No response is valid because of low NPC disposition, // search a response in the topic "Info Refusal" @@ -588,11 +605,12 @@ const ESM::DialInfo *MWDialogue::Filter::search (const ESM::Dialogue& dialogue, for (std::vector::const_iterator iter = infoRefusalDialogue.mInfo.begin(); iter!=infoRefusalDialogue.mInfo.end(); ++iter) - if (testActor (*iter) && testPlayer (*iter) && testSelectStructs (*iter) && testDisposition(*iter)) - return &*iter; + if (testActor (*iter) && testPlayer (*iter) && testSelectStructs (*iter) && testDisposition(*iter)) { + suitableInfos.push_back(&*iter); + if (!searchAll) + return; + } } - - return 0; } bool MWDialogue::Filter::responseAvailable (const ESM::Dialogue& dialogue) const diff --git a/apps/openmw/mwdialogue/filter.hpp b/apps/openmw/mwdialogue/filter.hpp index 707c0154b6..e1e22a51ca 100644 --- a/apps/openmw/mwdialogue/filter.hpp +++ b/apps/openmw/mwdialogue/filter.hpp @@ -51,7 +51,8 @@ namespace MWDialogue Filter (const MWWorld::Ptr& actor, int choice, bool talkedToPlayer); - const ESM::DialInfo *search (const ESM::Dialogue& dialogue, const bool fallbackToInfoRefusal) const; + void search (std::vector& suitableInfos, const ESM::Dialogue& dialogue, const bool fallbackToInfoRefusal, bool searchAll) const; + const ESM::DialInfo* search (const ESM::Dialogue& dialogue, const bool fallbackToInfoRefusal) const; ///< Get a matching response for the requested dialogue. /// Redirect to "Info Refusal" topic if a response fulfills all conditions but disposition. From e3fd4b842954e31e15e81cd71eb4ad2b5acca69f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 1 Mar 2013 17:57:34 -0800 Subject: [PATCH 64/65] Fix restoring the original texture name when the DDS check fails --- components/nifogre/ogre_nif_loader.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 0b53177e13..d33243dd47 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -621,7 +621,12 @@ static Ogre::String getMaterial(const Nif::NiTriShape *shape, const Ogre::String // if it turns out that the above wasn't true in all cases (not for vanilla, but maybe mods) // verify, and revert if false (this call succeeds quickly, but fails slowly) if(!Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(texName)) - texName = path + Misc::StringUtils::lowerCase(texName); + { + texName = st->filename; + Misc::StringUtils::toLower(texName); + if(texName.compare(0, sizeof(path)-1, path) != 0) + texName = path + texName; + } } } else warn("Found internal texture, ignoring."); From 0f4f91605a402f636e45ac81cd45708eab6fa121 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 2 Mar 2013 11:19:48 +0100 Subject: [PATCH 65/65] some cleanup --- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 7 ++++--- apps/openmw/mwdialogue/filter.cpp | 21 ++++++++++--------- apps/openmw/mwdialogue/filter.hpp | 6 +++++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 43d201fbf3..35f0c94937 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -2,6 +2,7 @@ #include "dialoguemanagerimp.hpp" #include +#include #include #include @@ -251,11 +252,11 @@ namespace MWDialogue MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); - std::vector infos; - filter.search (infos, dialogue, true, true); + std::vector infos = filter.list (dialogue, true, true); + if (!infos.empty()) { - const ESM::DialInfo* info = infos[rand() % infos.size()]; + const ESM::DialInfo* info = infos[std::rand() % infos.size()]; parseText (info->mResponse); diff --git a/apps/openmw/mwdialogue/filter.cpp b/apps/openmw/mwdialogue/filter.cpp index 4391716fd6..10740794ea 100644 --- a/apps/openmw/mwdialogue/filter.cpp +++ b/apps/openmw/mwdialogue/filter.cpp @@ -561,8 +561,7 @@ MWDialogue::Filter::Filter (const MWWorld::Ptr& actor, int choice, bool talkedTo const ESM::DialInfo* MWDialogue::Filter::search (const ESM::Dialogue& dialogue, const bool fallbackToInfoRefusal) const { - std::vector suitableInfos; - search(suitableInfos, dialogue, fallbackToInfoRefusal, false); + std::vector suitableInfos = list (dialogue, fallbackToInfoRefusal, false); if (suitableInfos.empty()) return NULL; @@ -570,10 +569,10 @@ const ESM::DialInfo* MWDialogue::Filter::search (const ESM::Dialogue& dialogue, return suitableInfos[0]; } -void MWDialogue::Filter::search (std::vector& suitableInfos, const ESM::Dialogue& dialogue, - const bool fallbackToInfoRefusal, bool searchAll) const +std::vector MWDialogue::Filter::list (const ESM::Dialogue& dialogue, + bool fallbackToInfoRefusal, bool searchAll) const { - suitableInfos.clear(); + std::vector infos; bool infoRefusal = false; @@ -584,16 +583,16 @@ void MWDialogue::Filter::search (std::vector& suitableInfo if (testActor (*iter) && testPlayer (*iter) && testSelectStructs (*iter)) { if (testDisposition (*iter)) { - suitableInfos.push_back(&*iter); + infos.push_back(&*iter); if (!searchAll) - return; + break; } else infoRefusal = true; } } - if (suitableInfos.empty() && infoRefusal && fallbackToInfoRefusal) + if (infos.empty() && infoRefusal && fallbackToInfoRefusal) { // No response is valid because of low NPC disposition, // search a response in the topic "Info Refusal" @@ -606,11 +605,13 @@ void MWDialogue::Filter::search (std::vector& suitableInfo for (std::vector::const_iterator iter = infoRefusalDialogue.mInfo.begin(); iter!=infoRefusalDialogue.mInfo.end(); ++iter) if (testActor (*iter) && testPlayer (*iter) && testSelectStructs (*iter) && testDisposition(*iter)) { - suitableInfos.push_back(&*iter); + infos.push_back(&*iter); if (!searchAll) - return; + break; } } + + return infos; } bool MWDialogue::Filter::responseAvailable (const ESM::Dialogue& dialogue) const diff --git a/apps/openmw/mwdialogue/filter.hpp b/apps/openmw/mwdialogue/filter.hpp index e1e22a51ca..069bf6353d 100644 --- a/apps/openmw/mwdialogue/filter.hpp +++ b/apps/openmw/mwdialogue/filter.hpp @@ -1,6 +1,8 @@ #ifndef GAME_MWDIALOGUE_FILTER_H #define GAME_MWDIALOGUE_FILTER_H +#include + #include "../mwworld/ptr.hpp" namespace ESM @@ -51,7 +53,9 @@ namespace MWDialogue Filter (const MWWorld::Ptr& actor, int choice, bool talkedToPlayer); - void search (std::vector& suitableInfos, const ESM::Dialogue& dialogue, const bool fallbackToInfoRefusal, bool searchAll) const; + std::vector list (const ESM::Dialogue& dialogue, + bool fallbackToInfoRefusal, bool searchAll) const; + const ESM::DialInfo* search (const ESM::Dialogue& dialogue, const bool fallbackToInfoRefusal) const; ///< Get a matching response for the requested dialogue. /// Redirect to "Info Refusal" topic if a response fulfills all conditions but disposition.