diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index fa82f86b..aec8ab5c 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -5232,10 +5232,10 @@ void Renderer::renderMorphEffects(){ Vec3f currVec= unit->getCurrVectorFlat(); currVec=Vec3f(currVec.x,currVec.y+0.3f,currVec.z); if(mType->getField() == fAir && unit->getType()->getField()== fLand) { - currVec=Vec3f(currVec.x,currVec.y+World::airHeight,currVec.z); + currVec=Vec3f(currVec.x,currVec.y+game->getWorld()->getTileset()->getAirHeight(),currVec.z); } if(mType->getField() == fLand && unit->getType()->getField()== fAir) { - currVec=Vec3f(currVec.x,currVec.y-World::airHeight,currVec.z); + currVec=Vec3f(currVec.x,currVec.y-game->getWorld()->getTileset()->getAirHeight(),currVec.z); } float color=frameCycle*0.4f/40; diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 1fd53e0b..9bb25494 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -3275,19 +3275,20 @@ float Unit::computeHeight(const Vec2i &pos) const { float height= map->getCell(pos)->getHeight(); if(currField == fAir) { - height += World::airHeight; + const float airHeight=game->getWorld()->getTileset()->getAirHeight(); + height += airHeight; height = truncateDecimal(height); Unit *unit = map->getCell(pos)->getUnit(fLand); - if(unit != NULL && unit->getType()->getHeight() > World::airHeight) { - height += (std::min((float)unit->getType()->getHeight(),World::airHeight * 3) - World::airHeight); + if(unit != NULL && unit->getType()->getHeight() > airHeight) { + height += (std::min((float)unit->getType()->getHeight(),Tileset::standardAirHeight * 3) - airHeight); height = truncateDecimal(height); } else { SurfaceCell *sc = map->getSurfaceCell(map->toSurfCoords(pos)); if(sc != NULL && sc->getObject() != NULL && sc->getObject()->getType() != NULL) { - if(sc->getObject()->getType()->getHeight() > World::airHeight) { - height += (std::min((float)sc->getObject()->getType()->getHeight(),World::airHeight * 3) - World::airHeight); + if(sc->getObject()->getType()->getHeight() > airHeight) { + height += (std::min((float)sc->getObject()->getType()->getHeight(),Tileset::standardAirHeight * 3) - airHeight); height = truncateDecimal(height); } } diff --git a/source/glest_game/world/tileset.cpp b/source/glest_game/world/tileset.cpp index 0bfdb87d..67270875 100644 --- a/source/glest_game/world/tileset.cpp +++ b/source/glest_game/world/tileset.cpp @@ -412,6 +412,22 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck //printf("==> Weather is: %d rnd = %f [sun: %f rainyProb: %f]",weather,rnd,sunnyProb,rainyProb); + //airHeight + if(parametersNode->hasChild("air-height")) { + const XmlNode *node= parametersNode->getChild("air-height"); + airHeight= node->getAttribute("value")->getFloatValue(); + // airHeight should not be lower than default + if( airHeight3*Tileset::standardAirHeight){ + airHeight=3*Tileset::standardAirHeight; + } + } + + + if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } diff --git a/source/glest_game/world/tileset.h b/source/glest_game/world/tileset.h index 1a9fa1e8..1c78b0c1 100644 --- a/source/glest_game/world/tileset.h +++ b/source/glest_game/world/tileset.h @@ -120,6 +120,7 @@ public: static const int surfCount= 6; static const int objCount= 10; static const int transitionVars= 2; //number or different transition textures + static const float standardAirHeight= 5.f; public: typedef vector SurfProbs; @@ -145,6 +146,7 @@ private: Vec3f sunLightColor; Vec3f moonLightColor; Weather weather; + float airHeight; AmbientSounds ambientSounds; Checksum checksumValue; @@ -159,6 +161,7 @@ public: fogMode = 0; fogDensity = 0.0f; weather= wSunny; + airHeight= standardAirHeight; for(int index = 0; index < surfCount; ++index) { partsArray[index] = 0; @@ -172,6 +175,7 @@ public: Checksum * getChecksumValue() { return &checksumValue; } //get + float getAirHeight()const {return airHeight;} const SurfaceAtlas *getSurfaceAtlas() const {return &surfaceAtlas;} ObjectType *getObjectType(int i) {return &objectTypes[i];} float getSurfProb(int surf, int var) const {return surfProbs[surf][var];} diff --git a/source/glest_game/world/world.cpp b/source/glest_game/world/world.cpp index 50ed2aa8..6095ba68 100644 --- a/source/glest_game/world/world.cpp +++ b/source/glest_game/world/world.cpp @@ -37,7 +37,6 @@ namespace Glest{ namespace Game{ // class World // ===================================================== -const float World::airHeight= 5.f; // This limit is to keep RAM use under control while offering better performance. int MaxExploredCellsLookupItemCache = 9500; time_t ExploredCellsLookupItem::lastDebug = 0; diff --git a/source/glest_game/world/world.h b/source/glest_game/world/world.h index bd121dcb..24b63133 100644 --- a/source/glest_game/world/world.h +++ b/source/glest_game/world/world.h @@ -89,7 +89,6 @@ private: public: static const int generationArea= 100; - static const float airHeight; static const int indirectSightRange= 5; private: