if (!Storage::instance().exists(Util::getDataPath2())){
Global::debug(0) << "Cannot find data path '" << Util::getDataPath2().path() << "'! Either use the -d switch to specify the data directory or find the data directory and move it to that path" << endl;
return false;
}
/* do implementation specific setup */
System::initSystem(out);
dumb_register_stdfiles();
// Sound::initialize();
// Filesystem::initialize();
/*
Graphics::SCALE_X = GFX_X;
Graphics::SCALE_Y = GFX_Y;
*/
Configuration::loadConfigurations();
const int sx = Configuration::getScreenWidth();
const int sy = Configuration::getScreenHeight();
Graphics::Bitmap::setFakeGraphicsMode(sx, sy);
/* music */
atexit(&dumb_exit);
out << "Initialize random number generator" << endl;
/* initialize random number generator */
srand(time(NULL));
registerSignals();
#ifdef HAVE_NETWORKING
out << "Initialize network" << endl;
Network::init();
atexit(Network::closeAll);
#endif
/* this mutex is used to show the loading screen while the game loads */
/* for nacl which takes a while to run exists(), we just want
* to show some progress
*/
white.fill(Graphics::makeColor(128, 128, 128));
white.BlitToScreen();
if (!Storage::instance().exists(Util::getDataPath2())){
white.fill(Graphics::makeColor(255, 0, 0));
white.BlitToScreen();
Global::debug(0) << "Cannot find data path '" << Util::getDataPath2().path() << "'! Either use the -d switch to specify the data directory or find the data directory and move it to that path" << endl;
+ /* The program is probably going to exit immediately, so allow the user some time
+ * to see that the red screen occured.
+ */
Util::restSeconds(1);
return false;
} else {
white.fill(Graphics::makeColor(255, 255, 255));
white.BlitToScreen();
}
-#ifdef PS3
- // ps3JoystickHack();
-#endif
-
return true;
}
/* Restarts the timers */
void Global::setTicksPerSecond(int ticks){
if (ticks < 1){
ticks = 1;
}
if (ticks > 90){
ticks = 90;
}
if (ticks != TICS_PER_SECOND){
TICS_PER_SECOND = ticks;
System::closeTimers();
System::startTimers();
}
}
void Global::close(){
System::closeTimers();
}
diff --git a/util/init.h b/util/init.h
index 6a24f015..5bae4125 100644
--- a/util/init.h
+++ b/util/init.h
@@ -1,42 +1,61 @@
#ifndef _paintown_init_h
#define _paintown_init_h
/* global vars */
/*
#define GFX_X 640
#define GFX_Y 480
*/
namespace Global{
extern volatile int speed_counter4;
extern volatile unsigned int second_counter;
// extern const double LOGIC_MULTIPLIER;
extern int TICS_PER_SECOND;
extern const int WINDOWED;
extern const int FULLSCREEN;
extern bool rateLimit;
- /* pass WINDOWED or FULLSCREEN in. FIXME: replace with an enum */
- bool init(int gfx);
+ class InitConditions{
+ public:
+ InitConditions();
+
+ enum WindowMode{
+ Disabled,
+ Default,
+ Window,
+ Fullscreen
+ };
+
+ WindowMode graphics;
+ bool sound;
+ bool fullscreen;
+ bool networking;
+ };
+
+ bool init(const InitConditions & conditions);
void close();
- bool initNoGraphics();
+ // bool initNoGraphics();
+
+ /* Check for the data path */
+ bool dataCheck();
/* Returns a consistent number of ticks per second regardless of what