Game::Game(SystemStub *stub, const char *dataPath, const char *savePath, const char *musicPath) : _fs(dataPath), _stub(stub), _dataPath(dataPath), _savePath(savePath), _musicPath(musicPath) { _state = _nextState = -1; _mixer = _stub->getMixer(); _stateSlot = 1; detectVersion(); }
void NWNEngine::init() { LoadProgress progress(21); progress.step("Detecting game version"); detectVersion(); progress.step("Loading user game config"); initConfig(); checkConfig(); if (EventMan.quitRequested()) return; progress.step("Declare string encodings"); declareEncodings(); initResources(progress); if (EventMan.quitRequested()) return; progress.step("Loading game cursors"); initCursors(); if (EventMan.quitRequested()) return; progress.step("Initializing internal game config"); initGameConfig(); progress.step("Starting script system"); _scriptFuncs = new ScriptFunctions(); progress.step("Successfully initialized the engine"); }
int main(int argc, char *argv[]) { const char *dataPath = "DATA"; const char *savePath = "."; for (int i = 1; i < argc; ++i) { bool opt = false; if (strlen(argv[i]) >= 2) { opt |= parseOption(argv[i], "datapath=", &dataPath); opt |= parseOption(argv[i], "savepath=", &savePath); } if (!opt) { printf(USAGE); return 0; } } Version ver = detectVersion(dataPath); g_debugMask = DBG_INFO; // DBG_CUT | DBG_VIDEO | DBG_RES | DBG_MENU | DBG_PGE | DBG_GAME | DBG_UNPACK | DBG_COL | DBG_MOD | DBG_SFX; SystemStub *stub = SystemStub_SDL_create(); Game *g = new Game(stub, dataPath, savePath, ver); g->run(); delete g; delete stub; return 0; }
Game::Game(SystemStub *stub, const char *dataPath, const char *savePath, const char *musicPath) : _fs(dataPath), _stub(stub), _dataPath(dataPath), _savePath(savePath), _musicPath(musicPath) { _mixer = new Mixer(_stub); _stateSlot = 1; detectVersion(); }
int main(int argc, char *argv[]) { const char *dataPath = "DATA"; const char *savePath = "."; const char *levelNum = "0"; char dataPathBuffer[256]; char savePathBuffer[256]; for (int i = 1; i < argc; ++i) { bool opt = false; if (strlen(argv[i]) >= 2) { opt |= parseOption(argv[i], "datapath=", &dataPath); opt |= parseOption(argv[i], "savepath=", &savePath); opt |= parseOption(argv[i], "levelnum=", &levelNum); } if (!opt) { printf(USAGE, argv[0]); return 0; } } #ifdef GCW0 debug(DBG_INFO,"Software version: %s",Game::_version); if(argc<=1){ debug(DBG_INFO, "No arguments given"); char basepath[256]; strcpy(basepath, getenv("HOME")); mkdir(basepath, 0777); strcat(basepath, "/.REminiscence"); strcpy(dataPathBuffer,basepath); strcpy(savePathBuffer,basepath); strcat(dataPathBuffer, "/data"); strcat(savePathBuffer, "/save"); //create directory if they do not exist... mkdir(basepath, 0777); mkdir(savePathBuffer, 0777); mkdir(dataPathBuffer, 0777); dataPath=dataPathBuffer; savePath=savePathBuffer; } #endif g_debugMask = DBG_INFO; // DBG_CUT | DBG_VIDEO | DBG_RES | DBG_MENU | DBG_PGE | DBG_GAME | DBG_UNPACK | DBG_COL | DBG_MOD | DBG_SFX | DBG_FILE; FileSystem fs(dataPath); SystemStub *stub = SystemStub_SDL_create(); const int version = detectVersion(&fs); if (version == -1) { #ifdef GCW0 //display an instruction screen stub->init("help", Video::GAMESCREEN_W, Video::GAMESCREEN_H,new Config()); stub->setPalette(_instr_data_pal,256); stub->copyRect(0, 0, Video::GAMESCREEN_W, Video::GAMESCREEN_H, _instr_data_map, 256); stub->updateScreen(0); while (!stub->_pi.quit) { stub->processEvents(); if (stub->_pi.enter) { stub->_pi.enter = false; break; } stub->sleep(100); } delete stub; #endif error("Unable to find data files, check that all required files are present"); return -1; } Language language = detectLanguage(&fs); Game *g = new Game(stub, &fs, savePath, atoi(levelNum), (ResourceType)version, language); g->run(); delete g; delete stub; return 0; }
QString GccToolChain::version() const { if (m_version.isEmpty()) m_version = detectVersion(); return m_version; }
void ProtocolConfig::setVersion(ClientOS_t os, ClientVersion_t version) { m_os = os; switch(version){ case CLIENT_VERSION_740: NativeGUIError("Support for this client version is only experimental.", "Warning"); m_clientVersion = CLIENT_VERSION_740; break; case CLIENT_VERSION_760: NativeGUIError("Support for this client version is only experimental.", "Warning"); m_clientVersion = CLIENT_VERSION_760; break; case CLIENT_VERSION_780: NativeGUIError("Support for this client version is only experimental.", "Warning"); m_clientVersion = CLIENT_VERSION_780; break; case CLIENT_VERSION_800: m_clientVersion = CLIENT_VERSION_800; break; case CLIENT_VERSION_810: m_clientVersion = CLIENT_VERSION_810; break; case CLIENT_VERSION_811: m_clientVersion = CLIENT_VERSION_811; break; case CLIENT_VERSION_820: m_clientVersion = CLIENT_VERSION_820; break; case CLIENT_VERSION_821: m_clientVersion = CLIENT_VERSION_821; break; case CLIENT_VERSION_822: m_clientVersion = CLIENT_VERSION_822; break; case CLIENT_VERSION_830: m_clientVersion = CLIENT_VERSION_830; break; case CLIENT_VERSION_831: m_clientVersion = CLIENT_VERSION_831; break; case CLIENT_VERSION_840: m_clientVersion = CLIENT_VERSION_840; break; case CLIENT_VERSION_841: m_clientVersion = CLIENT_VERSION_841; break; case CLIENT_VERSION_842: m_clientVersion = CLIENT_VERSION_842; break; case CLIENT_VERSION_850: m_clientVersion = CLIENT_VERSION_850; break; case CLIENT_VERSION_853: m_clientVersion = CLIENT_VERSION_853; break; case CLIENT_VERSION_854: m_clientVersion = CLIENT_VERSION_854; break; case CLIENT_VERSION_AUTO: m_clientVersion = detectVersion(); break; default: //ASSERT(0); NativeGUIError("This client version is not currently supported.", "Sorry"); return; } m_datSignature = this->readSignature("Tibia.dat"); m_sprSignature = this->readSignature("Tibia.spr"); m_picSignature = this->readSignature("Tibia.pic"); }