C4ID: centralize all still used ids

Günther Brammer 2010-12-05 00:36:07 +01:00
parent 5d7ad6d859
commit 2e612a6900
5 changed files with 6 additions and 28 deletions

View File

@ -51,17 +51,6 @@ void C4Weather::Init(bool fScenario)
Temperature=Climate;
// Wind
Wind=TargetWind=Game.C4S.Weather.Wind.Evaluate();
// Precipitation
if (!Game.C4S.Head.NoInitialize)
if (Game.C4S.Weather.Rain.Evaluate())
for (int32_t iClouds = Min(GBackWdt/500,5); iClouds>0; iClouds--)
{
volatile int iWidth = GBackWdt/15+Random(320);
volatile int iX = Random(GBackWdt);
LaunchCloud(iX,-1,iWidth,
Game.C4S.Weather.Rain.Evaluate(),
Game.C4S.Weather.Precipitation);
}
// gamma?
NoGamma=Game.C4S.Weather.NoGamma;
}
@ -127,18 +116,6 @@ void C4Weather::Default()
NoGamma=true;
}
bool C4Weather::LaunchCloud(int32_t iX, int32_t iY, int32_t iWidth, int32_t iStrength, const char *szPrecipitation)
{
if (::MaterialMap.Get(szPrecipitation)==MNone) return false;
C4Object *pObj;
if ((pObj=Game.CreateObject(C4ID("FXP1"),NULL,NO_OWNER,iX,iY)))
if (!!pObj->Call(PSF_Activate,&C4AulParSet(C4VInt(::MaterialMap.Get(szPrecipitation)),
C4VInt(iWidth),
C4VInt(iStrength))))
return true;
return false;
}
void C4Weather::SetWind(int32_t iWind)
{
Wind=BoundBy<int32_t>(iWind,-100,+100);

View File

@ -46,7 +46,6 @@ public:
int32_t GetTemperature();
int32_t GetSeason();
int32_t GetClimate();
bool LaunchCloud(int32_t iX, int32_t iY, int32_t iWidth, int32_t iStrength, const char *szPrecipitation);
void SetSeasonGamma(); // set gamma adjustment for season
void CompileFunc(StdCompiler *pComp);
};

View File

@ -51,6 +51,7 @@ const C4ID C4ID::Blast(std::string("FXB1"));
const C4ID C4ID::Melee(std::string("MELE"));
const C4ID C4ID::TeamworkMelee(std::string("MEL2"));
const C4ID C4ID::Rivalry(std::string("RVLR"));
const C4ID C4ID::Bubble(std::string("Fx_Bubble"));
C4ID::C4ID(const std::string &s) { assign(s); }

View File

@ -44,6 +44,8 @@ private:
static LookupTable lookup;
static NamesList names;
void assign(const std::string &s);
template<size_t N>
explicit C4ID(const char (&s)[N]) { assign(s); }
public:
static const C4ID None; // Invalid ID
static const C4ID Contents; // Not-ID for funny stuff
@ -64,14 +66,13 @@ public:
DEPRECATED static const C4ID Melee;
DEPRECATED static const C4ID TeamworkMelee;
DEPRECATED static const C4ID Rivalry;
DEPRECATED static const C4ID Bubble;
C4ID(): v(None.v) {}
C4ID(const C4ID &other): v(other.v) {}
C4ID &operator =(const C4ID &other) { v = other.v; return *this; }
explicit C4ID(const std::string &s);
template<size_t N>
DEPRECATED explicit C4ID(const char (&s)[N]) { assign(s); }
explicit C4ID(const StdStrBuf &s) { assign(s.getData()); }
explicit inline C4ID(Handle i): v(i)

View File

@ -831,9 +831,9 @@ void BubbleOut(int32_t tx, int32_t ty)
// User-defined smoke level
int32_t SmokeLevel = GetSmokeLevel();
// Enough bubbles out there already
if (::Objects.ObjectCount(C4ID("Fx_Bubble")) >= SmokeLevel) return;
if (::Objects.ObjectCount(C4ID::Bubble) >= SmokeLevel) return;
// Create bubble
Game.CreateObject(C4ID("Fx_Bubble"),NULL,NO_OWNER,tx,ty);
Game.CreateObject(C4ID::Bubble,NULL,NO_OWNER,tx,ty);
}
void Smoke(int32_t tx, int32_t ty, int32_t level, DWORD dwClr)