// Initialize physfs (this is a slightly modified version of
// PHYSFS_setSaneConfig
- const char* application = PACKAGE_NAME;
+ const char* application = "supertux2"; //instead of PACKAGE_NAME so we can coexist with MS1
const char* userdir = PHYSFS_getUserDir();
const char* dirsep = PHYSFS_getDirSeparator();
char* writedir = new char[strlen(userdir) + strlen(application) + 2];
try {
Console::instance = new Console();
-// srand(time(0)); // this breaks repeatability in random numbers
init_physfs(argv[0]);
init_sdl();
std::string dir = FileSystem::dirname(config->start_level);
PHYSFS_addToSearchPath(dir.c_str(), true);
- init_rand(); // play_demo sets seed, record_demo uses it
-
if(config->start_level.size() > 4 &&
- config->start_level.compare(config->start_level.size() - 5, 4, ".stwm") == 0) {
- main_loop->push_screen(new WorldMapNS::WorldMap(config->start_level));
+ config->start_level.compare(config->start_level.size() - 5, 5, ".stwm") == 0) {
+ init_rand();
+ main_loop->push_screen(new WorldMapNS::WorldMap(
+ FileSystem::basename(config->start_level)));
} else {
+ init_rand();//If level uses random eg. for
+ // rain particles before we do this:
std::auto_ptr<GameSession> session (
new GameSession(FileSystem::basename(config->start_level)));
+ config->random_seed =session->get_demo_random_seed(config->start_demo);
+ init_rand();//initialise generator with seed from session
+
if(config->start_demo != "")
session->play_demo(config->start_demo);
main_loop->push_screen(new TitleScreen());
}
+ //init_rand(); PAK: this call might subsume the above 3, but I'm chicken!
main_loop->run();
} catch(std::exception& e) {