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/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 2d129a3fb..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"); @@ -1003,7 +1002,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 6cc957c66..474453c72 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(); @@ -1026,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; 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))