forked from Mirrors/openclonk
Move Game.Weather to ::Weather
parent
18167243b2
commit
46d0d93dfc
|
@ -29,7 +29,6 @@
|
|||
#include <C4GameParameters.h>
|
||||
#include <C4PlayerInfo.h>
|
||||
#include <C4RoundResults.h>
|
||||
#include <C4Weather.h>
|
||||
#include <C4GameObjects.h>
|
||||
#include <C4Scenario.h>
|
||||
#include <C4PlayerList.h>
|
||||
|
@ -74,7 +73,6 @@ class C4Game
|
|||
C4PlayerInfoList &PlayerInfos; // Shortcut
|
||||
C4PlayerInfoList &RestorePlayerInfos; // Shortcut
|
||||
C4RoundResults RoundResults;
|
||||
C4Weather Weather;
|
||||
C4GameObjects Objects;
|
||||
C4ObjectList BackObjects; // objects in background (C4D_Background)
|
||||
C4ObjectList ForeObjects; // objects in foreground (C4D_Foreground)
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#ifndef INC_C4Weather
|
||||
#define INC_C4Weather
|
||||
|
||||
#include <C4Wrappers.h>
|
||||
class C4Weather
|
||||
{
|
||||
public:
|
||||
|
@ -53,5 +54,11 @@ class C4Weather
|
|||
void SetSeasonGamma(); // set gamma adjustment for season
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
};
|
||||
extern C4Weather Weather;
|
||||
|
||||
inline int32_t GBackWind(int32_t x, int32_t y)
|
||||
{
|
||||
return GBackIFT(x, y) ? 0: ::Weather.Wind;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -211,11 +211,6 @@ inline bool GBackLiquid(int32_t x, int32_t y)
|
|||
return DensityLiquid(GBackDensity(x,y));
|
||||
}
|
||||
|
||||
inline int32_t GBackWind(int32_t x, int32_t y)
|
||||
{
|
||||
return GBackIFT(x, y) ? 0: Game.Weather.Wind;
|
||||
}
|
||||
|
||||
//==================================== StdCompiler =========================================
|
||||
|
||||
void StdCompilerWarnCallback(void *pData, const char *szPosition, const char *szError);
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include <C4RankSystem.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Weather.h>
|
||||
#endif
|
||||
|
||||
#include <StdFile.h>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <C4Stat.h>
|
||||
#include <C4MassMover.h>
|
||||
#include <C4PXS.h>
|
||||
#include <C4Weather.h>
|
||||
#endif
|
||||
|
||||
#include <StdPNG.h>
|
||||
|
@ -122,7 +123,7 @@ void C4Landscape::ExecuteScan()
|
|||
int32_t cy,mat;
|
||||
|
||||
// Check: Scan needed?
|
||||
const int32_t iTemperature = Game.Weather.GetTemperature();
|
||||
const int32_t iTemperature = ::Weather.GetTemperature();
|
||||
for(mat = 0; mat < ::MaterialMap.Num; mat++)
|
||||
if(MatCount[mat])
|
||||
if(::MaterialMap.Map[mat].BelowTempConvertTo &&
|
||||
|
@ -173,7 +174,7 @@ void C4Landscape::ExecuteScan()
|
|||
int32_t C4Landscape::DoScan(int32_t cx, int32_t cy, int32_t mat, int32_t dir)
|
||||
{
|
||||
int32_t conv_to_tex = 0;
|
||||
int32_t iTemperature = Game.Weather.GetTemperature();
|
||||
int32_t iTemperature = ::Weather.GetTemperature();
|
||||
// Check below conv
|
||||
if(::MaterialMap.Map[mat].BelowTempConvertDir == dir)
|
||||
if (::MaterialMap.Map[mat].BelowTempConvertTo)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <C4Physics.h>
|
||||
#include <C4Random.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Weather.h>
|
||||
#endif
|
||||
|
||||
static const FIXED WindDrift_Factor = itofix(1, 800);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <C4Game.h>
|
||||
#include <C4Components.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Weather.h>
|
||||
#endif
|
||||
|
||||
void C4ParticleDefCore::CompileFunc(StdCompiler * pComp)
|
||||
|
@ -591,7 +592,7 @@ bool fxSmokeExec(C4Particle *pPrt, C4Object *pTarget)
|
|||
// wind to float
|
||||
if (!(pPrt->b%12) || fBuilding)
|
||||
{
|
||||
pPrt->xdir=0.025f*Game.Weather.GetWind(int32_t(pPrt->x),int32_t(pPrt->y));
|
||||
pPrt->xdir=0.025f*::Weather.GetWind(int32_t(pPrt->x),int32_t(pPrt->y));
|
||||
if (pPrt->xdir<-2.0f) pPrt->xdir=-2.0f; else if (pPrt->xdir>2.0f) pPrt->xdir=2.0f;
|
||||
pPrt->xdir+=0.1f*SafeRandom(41)-2.0f;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <C4PXS.h>
|
||||
#include <C4MessageInput.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4Weather.h>
|
||||
#endif
|
||||
|
||||
//========================== Some Support Functions =======================================
|
||||
|
@ -3082,49 +3083,49 @@ static long FnSetCrewStatus(C4AulContext *cthr, long iPlr, bool fInCrew, C4Objec
|
|||
static long FnGetWind(C4AulContext *cthr, long x, long y, bool fGlobal)
|
||||
{
|
||||
// global wind
|
||||
if (fGlobal) return Game.Weather.Wind;
|
||||
if (fGlobal) return ::Weather.Wind;
|
||||
// local wind
|
||||
if (cthr->Obj) { x+=cthr->Obj->GetX(); y+=cthr->Obj->GetY(); }
|
||||
return Game.Weather.GetWind(x,y);
|
||||
return ::Weather.GetWind(x,y);
|
||||
}
|
||||
|
||||
static bool FnSetWind(C4AulContext *cthr, long iWind)
|
||||
{
|
||||
Game.Weather.SetWind(iWind);
|
||||
::Weather.SetWind(iWind);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool FnSetTemperature(C4AulContext *cthr, long iTemperature)
|
||||
{
|
||||
Game.Weather.SetTemperature(iTemperature);
|
||||
::Weather.SetTemperature(iTemperature);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static long FnGetTemperature(C4AulContext *cthr)
|
||||
{
|
||||
return Game.Weather.GetTemperature();
|
||||
return ::Weather.GetTemperature();
|
||||
}
|
||||
|
||||
static bool FnSetSeason(C4AulContext *cthr, long iSeason)
|
||||
{
|
||||
Game.Weather.SetSeason(iSeason);
|
||||
::Weather.SetSeason(iSeason);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static long FnGetSeason(C4AulContext *cthr)
|
||||
{
|
||||
return Game.Weather.GetSeason();
|
||||
return ::Weather.GetSeason();
|
||||
}
|
||||
|
||||
static bool FnSetClimate(C4AulContext *cthr, long iClimate)
|
||||
{
|
||||
Game.Weather.SetClimate(iClimate);
|
||||
::Weather.SetClimate(iClimate);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static long FnGetClimate(C4AulContext *cthr)
|
||||
{
|
||||
return Game.Weather.GetClimate();
|
||||
return ::Weather.GetClimate();
|
||||
}
|
||||
|
||||
static bool FnSetSkyFade(C4AulContext *cthr, long iFromRed, long iFromGreen, long iFromBlue, long iToRed, long iToGreen, long iToBlue)
|
||||
|
@ -3173,12 +3174,12 @@ static long FnLandscapeHeight(C4AulContext *cthr)
|
|||
|
||||
static long FnLaunchLightning(C4AulContext *cthr, long x, long y, long xdir, long xrange, long ydir, long yrange, bool fDoGamma)
|
||||
{
|
||||
return Game.Weather.LaunchLightning(x,y,xdir,xrange,ydir,yrange, fDoGamma);
|
||||
return ::Weather.LaunchLightning(x,y,xdir,xrange,ydir,yrange, fDoGamma);
|
||||
}
|
||||
|
||||
static long FnLaunchVolcano(C4AulContext *cthr, long x)
|
||||
{
|
||||
return Game.Weather.LaunchVolcano(
|
||||
return ::Weather.LaunchVolcano(
|
||||
::MaterialMap.Get("Lava"),
|
||||
x,GBackHgt-1,
|
||||
BoundBy(15*GBackHgt/500+Random(10),10,60));
|
||||
|
@ -3186,7 +3187,7 @@ static long FnLaunchVolcano(C4AulContext *cthr, long x)
|
|||
|
||||
static bool FnLaunchEarthquake(C4AulContext *cthr, long x, long y)
|
||||
{
|
||||
Game.Weather.LaunchEarthquake(x,y);
|
||||
::Weather.LaunchEarthquake(x,y);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <C4SurfaceFile.h>
|
||||
#include <C4Components.h>
|
||||
#include <C4Wrappers.h>
|
||||
#include <C4Weather.h>
|
||||
#endif
|
||||
|
||||
static BOOL SurfaceEnsureSize(C4Surface **ppSfc, int iMinWdt, int iMinHgt)
|
||||
|
@ -218,7 +219,7 @@ void C4Sky::Execute()
|
|||
if (x>=itofix(Width)) x-=itofix(Width);
|
||||
if (y>=itofix(Height)) y-=itofix(Height);
|
||||
// update speed
|
||||
if (ParallaxMode == C4SkyPM_Wind) xdir=FIXED100(Game.Weather.Wind);
|
||||
if (ParallaxMode == C4SkyPM_Wind) xdir=FIXED100(::Weather.Wind);
|
||||
}
|
||||
|
||||
void C4Sky::Draw(C4TargetFacet &cgo)
|
||||
|
|
|
@ -302,3 +302,5 @@ void C4Weather::CompileFunc(StdCompiler *pComp)
|
|||
}
|
||||
pComp->Value(mkNamingAdapt(mkArrayAdaptM(::GraphicsSystem.dwGamma), "Gamma", dwGammaDefaults));
|
||||
}
|
||||
|
||||
C4Weather Weather;
|
||||
|
|
Loading…
Reference in New Issue