Redline/source/initexit.cpp
2016-04-04 17:08:47 +02:00

87 lines
1.9 KiB
C++
Executable File

//initexit.cpp
//Initialize everything for the game to run and dispose everything
//after the game has terminated
#include <stdio.h>
#include "fpu_exc.h"
#include "screen.h"
#include "fileio.h"
#include "textures.h"
#include "models.h"
#include "text.h"
#include "gamesound.h"
#include "random.h"
#include "controls.h"
#include "network.h"
#include "config.h"
#include "environment.h"
#include "interface.h"
#include "writeout.h"
#include "music.h"
#include "interfaceutil.h"
#include "gametime.h"
#include "error.h"
#include "gamesystem.h"
#include "initexit.h"
#include "tracker.h"
#include "transparency.h"
#include "log.h"
#include <AmbrosiaTools/stdtypes.h>
#include <AmbrosiaTools/file_tool.h>
#include "localtracker.h"
int IsInFront();
void CarSelectionDrawCar(tFileRef carRef,float time,int addOns,int color);
void Init()
{
SystemInit();
//EnableFPUExceptions();
FileInitIO();
ConfigInit();
InitTransparency();
LogInit();
NetworkInit();
TrackerStartVersionCheck();
ScreenInit();
InitLocalTracker();
InterfaceFadeInImageFromBlack(0.291,0.57,FileGetReference("ambrosia.pct"),0.6);
MusicInit();
float startTime=TimeGetSeconds();
ControlInit();
SoundInit();
LoadAllSounds();
RandomInit();
TextLoadFont(FileGetReference("test.font"));
LoadEnvironment(FileGetReference("showroom.senv"));
while(!(TimeGetSeconds()>startTime+1));
InterfaceFadeInImageFromImage(0.291,0.57,FileGetReference("ambrosia.pct"),1,1,FileGetReference("logo.pct"),1.0);
// TexturesSelectTex(FileGetReference("fence1.tif"));
// while(!(TimeGetSeconds()>startTime+3));
InterfaceInit();
if(gFileTampered)
{
InterfaceDisplayMessage(-1,"Data files corrupted.","Please re-install Redline.");
Exit();
}
FlushKeys();
}
void Exit()
{
SoundSilence();
MusicStopSong();
ControlExit();
NetworkStopAdvertising();
NetworkExit();
WriteOutFile(FileGetReference(kConfigFileName),gConfig,kParserTypeConfigDesc);
ScreenExit();
SystemExit();
ExitToShell();
}