#include <ctype.h>
#include "defines.h"
#include "globals.h"
#include "setup.h"
#include "intro.h"
#include "title.h"
#include "gameloop.h"
#include "leveleditor.h"
#include "screen.h"
#include "worldmap.h"
#include "resources.h"
#include "texture.h"
#include "tile.h"
int main(int argc, char * argv[])
{
st_directory_setup();
parseargs(argc, argv);
st_audio_setup();
st_video_setup();
st_joystick_setup();
st_general_setup();
st_menu();
loadshared();
if (launch_leveleditor_mode && level_startup_file)
{
#ifndef NO_EDITOR
leveleditor(level_startup_file);
#endif
}
else if (level_startup_file)
{
GameSession session(level_startup_file, 1, ST_GL_LOAD_LEVEL_FILE);
session.run();
}
else
{
title();
}
clearscreen(0, 0, 0);
updatescreen();
unloadshared();
st_general_free();
TileManager::destroy_instance();
#ifdef DEBUG
Surface::debug_check();
#endif
st_shutdown();
return 0;
}