void FastQSPWindow::startQuickloading() { builder.clear(); QString filename = gameDirectory + "save/quicksave.sav"; QSPOpenSavedGame(filename.toStdWString().c_str(), true, ignoreCRCAction->isChecked()); // New save system // qspJack.loadGameStatus(gameDirectory + "save/quicksave.json"); loadPage(); savestatus->setVisible(false); }
void QSPCallBacks::OpenGameStatus(QSPString file) { if (m_frame->IsQuit()) return; if (file.Str) { if (wxFileExists(wxString(file.Str, file.End))) QSPOpenSavedGame(file, QSP_FALSE); } else { wxFileDialog dialog(m_frame, _("Select saved game file"), wxEmptyString, wxEmptyString, _("Saved game files (*.sav)|*.sav"), wxFD_OPEN); m_frame->EnableControls(false); int res = dialog.ShowModal(); m_frame->EnableControls(true); if (res == wxID_OK) { wxString path(dialog.GetPath()); QSPOpenSavedGame(qspStringFromLen(path.c_str(), path.Length()), QSP_FALSE); } } }
void FastQSPWindow::loadGame(const QString &filename) { // qDebug() << "Loading game from" << filename; builder.clear(); // New save/load system // qspJack->loadGameStatus(filename); // loadPage(); if (!filename.isEmpty() && QSPOpenSavedGame(filename.toStdWString().c_str(), true, ignoreCRCAction->isChecked())) { loadPage(); } }
void *QSPThreadProc(void *ptr) { // (QSPEvent != QSP_EVT_EXIT) while (true) { //pthread_mutex_lock(&qsp_mutex); while (!qsp_events.empty()) { QspEvent ev = qsp_events.front(); switch (ev.type) { case QSP_EVT_EXIT: return 0; case QSP_EVT_OPENGAME: if (!QSPLoadGameWorld(ev.p_str.c_str())) ShowError(); else { chdir(GetQuestPath().c_str()); QSPRestartGame(QSP_TRUE); } break; case QSP_EVT_RESTART: if (!QSPRestartGame(QSP_TRUE)) ShowError(); break; case QSP_EVT_SAVEGAME: if (!QSPSaveGame((QSP_CHAR *) ev.p_str.c_str(), QSP_FALSE)) ShowError(); break; case QSP_EVT_OPENSAVEDGAME: if (!QSPOpenSavedGame((QSP_CHAR *) ev.p_str.c_str(), QSP_TRUE)) ShowError(); break; case QSP_EVT_EXECSTRING: if (!QSPExecString((const QSP_CHAR *)ev.p_str.c_str(), QSP_TRUE)) ShowError(); else if(ev.p_str.find("OPENQST")!=ev.p_str.npos){ chdir(GetQuestPath().c_str()); } break; case QSP_EVT_EXECSELACTION: if (!QSPExecuteSelActionCode(QSP_TRUE)) ShowError(); break; case QSP_EVT_SETOBJINDEX: if (!QSPSetSelObjectIndex(ev.p_int, QSP_TRUE)) ShowError(); break; case QSP_EVT_SETUSERINPUT: QSPSetInputStrText(ev.p_str.c_str()); break; case QSP_EVT_EXECUSERINPUT: if (!QSPExecUserInput(QSP_TRUE)) ShowError(); break; case QSP_EVT_DONEMENU: QSPSelectMenuItem(ev.p_int); break; default: usleep(500); } qsp_events.pop(); } QSPEventProcessed = true; //pthread_mutex_unlock(&qsp_mutex); usleep(500); } return 0; }