Skip to content

Commit

Permalink
sim: add a modinfo featureLOS.featureVisibility tag
Browse files Browse the repository at this point in the history
allowed values:
0 - no default LOS for features
1 - gaia features always visible
2 - allyteam/gaia features always visible
3 - all features always visible

default 3
  • Loading branch information
imbaczek committed Aug 27, 2009
1 parent 04f8efe commit af72410
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
15 changes: 13 additions & 2 deletions rts/Sim/Features/Feature.h
Expand Up @@ -11,6 +11,7 @@
#include "Rendering/UnitModels/3DModel.h"
#include "Matrix44f.h"
#include "Sim/Misc/LosHandler.h"
#include "Sim/Misc/ModInfo.h"

#define TREE_RADIUS 20

Expand Down Expand Up @@ -55,8 +56,18 @@ class CFeature: public CSolidObject, public boost::noncopyable

bool IsInLosForAllyTeam(int allyteam) const
{
return (this->allyteam == -1 || this->allyteam == allyteam
|| loshandler->InLos(this->pos, allyteam));
switch (modInfo.featureVisibility) {
case CModInfo::FEATURELOS_NONE:
default:
return loshandler->InLos(this->pos, allyteam);
case CModInfo::FEATURELOS_GAIAONLY:
return (this->allyteam == -1 || loshandler->InLos(this->pos, allyteam));
case CModInfo::FEATURELOS_GAIAALLIED:
return (this->allyteam == -1 || this->allyteam == allyteam
|| loshandler->InLos(this->pos, allyteam));
case CModInfo::FEATURELOS_ALL:
return true;
}
}

// should not be here
Expand Down
12 changes: 9 additions & 3 deletions rts/Sim/Misc/ModInfo.cpp
Expand Up @@ -101,14 +101,20 @@ void CModInfo::Init(const char* modname)
// experience
const LuaTable experienceTbl = root.SubTable("experience");
CUnit::SetExpMultiplier (experienceTbl.GetFloat("experienceMult", 1.0f));
CUnit::SetExpPowerScale (experienceTbl.GetFloat("powerScale", 1.0f));
CUnit::SetExpHealthScale(experienceTbl.GetFloat("healthScale", 0.7f));
CUnit::SetExpPowerScale (experienceTbl.GetFloat("powerScale", 1.0f));
CUnit::SetExpHealthScale(experienceTbl.GetFloat("healthScale", 0.7f));
CUnit::SetExpReloadScale(experienceTbl.GetFloat("reloadScale", 0.4f));

// flanking bonus
const LuaTable flankingBonusTbl = root.SubTable("flankingBonus");
flankingBonusModeDefault = flankingBonusTbl.GetInt("defaultMode", 1);


// feature visibility
const LuaTable featureLOS = root.SubTable("featureLOS");
featureVisibility = featureLOS.GetInt("featureVisibility", 3);
if (featureVisibility < 0 || featureVisibility > 3)
throw content_error("invalid modinfo: featureVisibility, valid range is 0..3");

// sensors
const LuaTable sensors = root.SubTable("sensors");
requireSonarUnderWater = sensors.GetBool("requireSonarUnderWater", true);
Expand Down
7 changes: 7 additions & 0 deletions rts/Sim/Misc/ModInfo.h
Expand Up @@ -92,6 +92,13 @@ class CModInfo
float airLosMul;
/// when underwater, units are not in LOS unless also in sonar
bool requireSonarUnderWater;

enum {
FEATURELOS_NONE = 0, FEATURELOS_GAIAONLY, FEATURELOS_GAIAALLIED, FEATURELOS_ALL,
};
/// feature visibility style: 0 - no LOS for features, 1 - gaia features visible
/// 2 - gaia/allied features visible, 3 - all features visible
int featureVisibility;
};

extern CModInfo modInfo;
Expand Down

0 comments on commit af72410

Please sign in to comment.