Redline/source/environment.cpp

28 lines
950 B
C++
Raw Permalink Normal View History

//environment.cpp
//load a new environment fiel from disk
//environments basically control the wheather and
//what background images to use and stuff like that
#include "fileio.h"
#include "environment.h"
#include "gamemem.h"
#include "parser.h"
#include "roads.h"
#include "textures.h"
#include "gameinitexit.h"
tEnvironment *gEnvironment;
#define kAirDensity 1.2929 //kg*m^-3
#define kGravitionalAcceleration 9.80665 //m*s^-2
void LoadEnvironment(int ref)
{
gEnvironment=(tEnvironment*)FileGetParsedDataPtr(ref,kParserTypeEnvironmentDesc,sizeof(tEnvironment));
gSurfaceTypes=(tSurfaceTypeList*)FileGetParsedDataPtr(gEnvironment->surfaceTypes,kParserTypeSurfaceTypeDesc,sizeof(tSurfaceTypeList));
if(gEnvironment->gravity==0)
gEnvironment->gravity=kGravitionalAcceleration;
if(gEnvironment->airDensity==0)
gEnvironment->airDensity=kAirDensity;
if(gEnvironment->hasAltEnv&&gMapInfo->useAltEnv)
LoadEnvironment(gEnvironment->altEnv);
}