tilesets can set default air unit heights
This commit is contained in:
parent
a8662c8b31
commit
1f96dae8c7
|
@ -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;
|
||||
|
|
|
@ -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<float>(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<float>(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<float>(height);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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( airHeight<Tileset::standardAirHeight){
|
||||
airHeight=standardAirHeight;
|
||||
}
|
||||
// airHeight should not be bigger than 3 x default
|
||||
if( airHeight>3*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__);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<float> 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];}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -89,7 +89,6 @@ private:
|
|||
|
||||
public:
|
||||
static const int generationArea= 100;
|
||||
static const float airHeight;
|
||||
static const int indirectSightRange= 5;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue