From 0545622f5ad2749cd507fad326776dea54ad3645 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 20 Aug 2013 11:04:26 +0200 Subject: [PATCH 1/3] Fix werewolf state not getting completely reset when starting a new game --- apps/openmw/mwgui/windowmanagerimp.cpp | 3 +++ apps/openmw/mwworld/worldimp.cpp | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index c0a30206b..1cb1d80b0 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -248,6 +248,9 @@ namespace MWGui delete mCharGen; mCharGen = new CharacterCreation(); mGuiModes.clear(); + mHud->unsetSelectedWeapon(); + mHud->unsetSelectedSpell(); + unsetForceHide(GW_ALL); } else allow(GW_ALL); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index f0c55c43e..aceb9fe34 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -240,12 +240,13 @@ namespace MWWorld // Rebuild player setupPlayer(); MWWorld::Ptr player = mPlayer->getPlayer(); - renderPlayer(); - mRendering->resetCamera(); // removes NpcStats, ContainerStore etc player.getRefData().setCustomData(NULL); + renderPlayer(); + mRendering->resetCamera(); + // make sure to do this so that local scripts from items that were in the players inventory are removed mLocalScripts.clear(); From fa76d1631b35895d8b61034e789c714cd7abeb8c Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 20 Aug 2013 12:08:46 +0200 Subject: [PATCH 2/3] Some terrain fixes --- apps/openmw/mwrender/renderingmanager.cpp | 3 ++- apps/openmw/mwworld/worldimp.cpp | 9 +++------ components/terrain/quadtreenode.cpp | 4 ++-- components/terrain/storage.hpp | 2 ++ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 2d129a3fb..44f421a6e 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -1003,7 +1003,8 @@ void RenderingManager::resetCamera() float RenderingManager::getTerrainHeightAt(Ogre::Vector3 worldPos) { - assert(mTerrain); + if (!mTerrain || !mTerrain->getVisible()) + return -std::numeric_limits::max(); return mTerrain->getHeightAt(worldPos); } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index aceb9fe34..b44ca3069 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1027,13 +1027,10 @@ namespace MWWorld return; } - if (ptr.getCell()->isExterior()) - { - float terrainHeight = mRendering->getTerrainHeightAt(pos); + float terrainHeight = mRendering->getTerrainHeightAt(pos); - if (pos.z < terrainHeight) - pos.z = terrainHeight; - } + if (pos.z < terrainHeight) + pos.z = terrainHeight; ptr.getRefData().getPosition().pos[2] = pos.z + 20; // place slightly above. will snap down to ground with code below diff --git a/components/terrain/quadtreenode.cpp b/components/terrain/quadtreenode.cpp index ec6a670dc..7faf81a5c 100644 --- a/components/terrain/quadtreenode.cpp +++ b/components/terrain/quadtreenode.cpp @@ -46,12 +46,12 @@ namespace // Algorithm described by Hanan Samet - 'Neighbour Finding in Quadtrees' // http://www.cs.umd.edu/~hjs/pubs/SametPRIP81.pdf - Terrain::QuadTreeNode* searchNeighbourRecursive (Terrain::QuadTreeNode* currentNode, Terrain::Direction dir) + QuadTreeNode* searchNeighbourRecursive (QuadTreeNode* currentNode, Direction dir) { if (!currentNode->getParent()) return NULL; // Arrived at root node, the root node does not have neighbours - Terrain::QuadTreeNode* nextNode; + QuadTreeNode* nextNode; if (adjacent(currentNode->getDirection(), dir)) nextNode = searchNeighbourRecursive(currentNode->getParent(), dir); else diff --git a/components/terrain/storage.hpp b/components/terrain/storage.hpp index 419439e19..b82f6bbb6 100644 --- a/components/terrain/storage.hpp +++ b/components/terrain/storage.hpp @@ -14,6 +14,8 @@ namespace Terrain /// We keep storage of terrain data abstract here since we need different implementations for game and editor class Storage { + public: + virtual ~Storage() {} private: virtual ESM::Land* getLand (int cellX, int cellY) = 0; virtual const ESM::LandTexture* getLandTexture(int index, short plugin) = 0; From ecf7786d11eacb58a1b7029f29f4dbbbed6dfde0 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 20 Aug 2013 12:31:47 +0200 Subject: [PATCH 3/3] terrain_num_lights was removed --- apps/openmw/mwrender/renderingmanager.cpp | 1 - files/materials/terrain.shader | 7 ------- 2 files changed, 8 deletions(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 44f421a6e..1446f8aaa 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -145,7 +145,6 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b sh::Factory::getInstance ().setGlobalSetting ("fog", "true"); sh::Factory::getInstance ().setGlobalSetting ("num_lights", Settings::Manager::getString ("num lights", "Objects")); - sh::Factory::getInstance ().setGlobalSetting ("terrain_num_lights", Settings::Manager::getString ("num lights", "Terrain")); sh::Factory::getInstance ().setGlobalSetting ("simple_water", Settings::Manager::getBool("shader", "Water") ? "false" : "true"); sh::Factory::getInstance ().setGlobalSetting ("render_refraction", "false"); diff --git a/files/materials/terrain.shader b/files/materials/terrain.shader index 80837a2cb..2bff6d58f 100644 --- a/files/materials/terrain.shader +++ b/files/materials/terrain.shader @@ -200,13 +200,6 @@ @shPassthroughFragmentInputs - shUniform(float4, lightAmbient) @shAutoConstant(lightAmbient, ambient_light_colour) - @shForeach(@shGlobalSettingString(terrain_num_lights)) - shUniform(float4, lightPosObjSpace@shIterator) @shAutoConstant(lightPosObjSpace@shIterator, light_position, @shIterator) - shUniform(float4, lightAttenuation@shIterator) @shAutoConstant(lightAttenuation@shIterator, light_attenuation, @shIterator) - shUniform(float4, lightDiffuse@shIterator) @shAutoConstant(lightDiffuse@shIterator, light_diffuse_colour, @shIterator) - @shEndForeach - #if SHADOWS shSampler2D(shadowMap0) shUniform(float2, invShadowmapSize0) @shAutoConstant(invShadowmapSize0, inverse_texture_size, @shPropertyString(shadowtexture_offset))