void Processor::z_save() { bool success = false; if (zargc != 0) { // Open auxilary file frefid_t ref = glk_fileref_create_by_prompt(fileusage_Data | fileusage_BinaryMode, filemode_Write, 0); if (ref != nullptr) { // Write data strid_t f = glk_stream_open_file(ref, filemode_Write); glk_put_buffer_stream(f, (const char *)zmp + zargs[0], zargs[1]); glk_stream_close(f); success = true; } } else { success = saveGame().getCode() == Common::kNoError; } if (h_version <= V3) branch(success); else store(success); }
void GameStatePlay::checkSaveEvent() { if (mapr->save_game) { mapr->respawn_point = floor(pc->stats.pos); saveGame(); mapr->save_game = false; } }
void Game::handleKeys(SDL_Keycode key) { switch (key) { case SDLK_s: { if (stage < 10) { stage++; lastStageUp = 0; } break; } case SDLK_F3: saveGame(); break; case SDLK_l: case SDLK_F4: loadGame(); break; case SDLK_p: pause = !pause; break; case SDLK_DOWN: tempSpeedUp = true; break; case SDLK_UP: case SDLK_SPACE: brick->toRotate = true; break; case SDLK_LEFT: lastPressedKey = LEFT; break; case SDLK_RIGHT: lastPressedKey = RIGHT; break; } }
bool MainWindow::save() { if (m_currentFile.isEmpty()) return saveAs(); return saveGame(m_currentFile); }
bool StarTrekEngine::showSaveMenu() { GUI::SaveLoadChooser *dialog; Common::String desc; int slot; dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); slot = dialog->runModalWithCurrentTarget(); desc = dialog->getResultString(); if (desc.empty()) { // create our own description for the saved game, the user didnt enter it desc = dialog->createDefaultSaveDescription(slot); } if (desc.size() > 28) desc = Common::String(desc.c_str(), 28); delete dialog; if (slot < 0) return true; return saveGame(slot, desc); }
void GameStatePlay::checkCutscene() { if (!mapr->cutscene) return; GameStateCutscene *cutscene = new GameStateCutscene(NULL); if (!cutscene->load(mapr->cutscene_file)) { delete cutscene; mapr->cutscene = false; return; } // handle respawn point and set game play game_slot cutscene->game_slot = game_slot; if (mapr->teleportation) { if (mapr->teleport_mapname != "") mapr->respawn_map = mapr->teleport_mapname; mapr->respawn_point = mapr->teleport_destination; } else { mapr->respawn_point = floor(pc->stats.pos); } if (SAVE_ONLOAD) saveGame(); delete requestedGameState; requestedGameState = cutscene; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), currentColor(QColor("#000")), game(new GameWidget(this)) { ui->setupUi(this); QPixmap icon(16, 16); icon.fill(currentColor); ui->colorButton->setIcon( QIcon(icon) ); connect(ui->startButton, SIGNAL(clicked()), game,SLOT(startGame())); connect(ui->stopButton, SIGNAL(clicked()), game,SLOT(stopGame())); connect(ui->clearButton, SIGNAL(clicked()), game,SLOT(clear())); connect(ui->iterInterval, SIGNAL(valueChanged(int)), game, SLOT(setInterval(int))); connect(ui->cellsControl, SIGNAL(valueChanged(int)), game, SLOT(setCellNumber(int))); connect(ui->colorButton, SIGNAL(clicked()), this, SLOT(selectMasterColor())); connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(saveGame())); connect(ui->loadButton, SIGNAL(clicked()), this, SLOT(loadGame())); ui->mainLayout->setStretchFactor(ui->gameLayout, 8); ui->mainLayout->setStretchFactor(ui->setLayout, 2); ui->gameLayout->addWidget(game); }
void GameStatePlay::checkStash() { if (mapr->stash) { // If triggered, open the stash and inventory menus menu->closeAll(); menu->inv->visible = true; menu->stash->visible = true; mapr->stash = false; } else if (menu->stash->visible) { // Close stash if inventory is closed if (!menu->inv->visible) { menu->resetDrag(); menu->stash->visible = false; } // If the player walks away from the stash, close its menu float interact_distance = calcDist(pc->stats.pos, mapr->stash_pos); if (interact_distance > INTERACT_RANGE || !pc->stats.alive) { menu->resetDrag(); menu->stash->visible = false; } } // If the stash has been updated, save the game if (menu->stash->updated) { menu->stash->updated = false; saveGame(); } }
Common::Error AgiEngine::saveGameState(int slot, const Common::String &desc) { Common::String saveLoadSlot = getSavegameFilename(slot); if (saveGame(saveLoadSlot, desc) == errOK) return Common::kNoError; else return Common::kUnknownError; }
saveMenu() { int input; printf("*********** PIMP QUEST ***************\n"); printf("1. New Game\n"); printf("2. Load Previous Game\n"); printf("3. Save Game\n"); printf("Selection: "); scanf("%d", &input); switch (input) { case 1: system("cls"); newGame(); break; case 2: system("cls"); loadgame(); break; case 3: system("cls"); saveGame(); break; default: system("cls"); printf("Something happened that wasn't supposed to..exiting."); break; } }
void GameScreen::createActions() { quit = new QAction("Main Menu", this); connect(quit, SIGNAL(triggered()), this, SLOT(returnToMenu())); save = new QAction("Save and Quit", this); connect(save, SIGNAL(triggered()), dynamic_cast<startup*>(this->parent()), SLOT(saveGame())); }
bool LabEngine::saveRestoreGame() { bool isOK = false; // The original had one screen for saving/loading. We have two. // Ask the user which screen to use. GUI::MessageDialog saveOrLoad(_("Would you like to save or restore a game?"), _("Save"), _("Restore")); int choice = saveOrLoad.runModal(); if (choice == GUI::kMessageOK) { // Save GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); int slot = dialog->runModalWithCurrentTarget(); if (slot >= 0) { Common::String desc = dialog->getResultString(); if (desc.empty()) { // create our own description for the saved game, the user didn't enter it desc = dialog->createDefaultSaveDescription(slot); } isOK = saveGame(slot, desc); } delete dialog; } else { // Restore GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); int slot = dialog->runModalWithCurrentTarget(); if (slot >= 0) { isOK = loadGame(slot); } delete dialog; } return isOK; }
void game_hub::hubMenu() { bool hubMenu = true; while (hubMenu) { printf("Hub Menu\n"); printf("----------------------\n"); int menu_sel = getSel("1. Open Party Menu", "2. Manage Characters", "3. Save Game", "4. Cancel"); switch (menu_sel) { case 1://Open party menu { Team->partyMenu(); break; } case 2://Manage Characters { Team->managePlayers(); break; } case 3://Save Game { saveGame(); break; } case 4://Cancel { printf("Cancelling action...\n"); hubMenu = false; break; } } } }
Client::~Client() { if(gameInProgress) { saveGame(false); clearGameKeys(); } close(sd); }
/** * Saves the selected save. * @param action Pointer to an action. */ void ListSaveState::btnSaveGameClick(Action *) { if (_selectedRow != -1) { saveGame(); } }
int AgiEngine::saveGameSimple() { Common::String fileName = getSavegameFilename(0); int result = saveGame(fileName, "Default savegame"); if (result != errOK) messageBox("Error saving game."); return result; }
/** * Saves the selected save. * @param action Pointer to an action. */ void ListSaveState::edtSaveKeyPress(Action *action) { if (action->getDetails()->key.keysym.sym == SDLK_RETURN || action->getDetails()->key.keysym.sym == SDLK_KP_ENTER) { saveGame(); } }
static void saveGameInSlot() { saveGame(menu.index - 1); freeMessageQueue(); setInfoBoxMessage(60, 255, 255, 255, _("Game Saved")); pauseGame(); }
/* * Main function for handling the "save" command, for saving a game during the game stage. * * @return: -9 if an error occured during the saving of the file or if the specified name does not end with ".xml" * 0 otherwise */ int saveGameByCommand(char* command){ char path[1024]; if (sscanf(command, "save %1023s", path) != 1){ return -1; } if (!strstr(path, ".xml")){ return -9; } return saveGame(path); }
void Kolf::saveGameAs() { QString newfilename = KFileDialog::getSaveFileName(":savedkolf", "application/x-kolf", this, i18n("Pick Saved Game to Save To")); if (newfilename.isNull()) return; loadedGame = newfilename; saveGame(); }
void FastQSPWindow::saveGameDialog() { QString filename = QFileDialog::getSaveFileName( this, "Save Game", saveDir.absolutePath(), "QSP save-game (*.sav)"); if (!filename.isEmpty() && !filename.endsWith(QLatin1String(".sav"), Qt::CaseInsensitive)) filename += QLatin1String(".sav"); // New save system // qspJack->saveGameStatus(filename); saveGame(filename); }
Common::Error Sword2Engine::saveGameState(int slot, const char *desc) { uint32 saveVal = saveGame(slot, (const byte *)desc); if (saveVal == SR_OK) return Common::kNoError; else if (saveVal == SR_ERR_WRITEFAIL || saveVal == SR_ERR_FILEOPEN) return Common::kWritingFailed; else return Common::kUnknownError; }
void exitFunc(int value) { muteSND(); if (!autoSavingEnabled && numRamBanks && !gbsMode) { printMenuMessage("Saving SRAM..."); saveGame(); } printMessage[0] = '\0'; closeMenu(); selectRom(); }
virtual void doAction() { watch->stop(); Area area; area.add(background, false); saveGame(&area, game); gameArea->updateMouse(); gameArea->draw(); watch->start(); };
void MainLoop::saveUI(PModel& model, Model::GameType type, View::SplashType splashType) { ProgressMeter meter(1.0 / 62500); Square::progressMeter = &meter; view->displaySplash(meter, splashType); string path = getSavePath(model.get(), type); MEASURE(saveGame(model, path), "saving time"); view->clearSplash(); Square::progressMeter = nullptr; if (type == Model::GameType::RETIRED_KEEPER && options->getBoolValue(OptionId::ONLINE)) uploadFile(path); }
void setAutoSaveFunc(int value) { muteSND(); gameboySyncAutosave(); autoSavingEnabled = value; saveGame(); // Synchronizes save file with filesystem if (numRamBanks && !gbsMode && !autoSavingEnabled) enableMenuOption("Exit without saving"); else disableMenuOption("Exit without saving"); refreshSND(); }
void AGOSEngine_PuzzlePack::opp_saveUserGame() { // 132: save game if (_clockStopped != 0) _gameTime += getTime() - _clockStopped; _clockStopped = 0; if (!getBitFlag(110)) { // Swampy adventures saveGame(1, NULL); } //saveHiScores() }
void suspendFunc(int value) { muteSND(); if (!autoSavingEnabled) { printMenuMessage("Saving SRAM..."); saveGame(); } printMenuMessage("Saving state..."); saveState(-1); printMessage[0] = '\0'; closeMenu(); selectRom(); }
void CGEEngine::qGame() { debugC(1, kCGEDebugEngine, "CGEEngine::qGame()"); sceneDown(); _oldLev = _lev; // Write out the user's progress saveGame(0, Common::String("Automatic Savegame")); _vga->sunset(); _finis = true; }
/** * Check for cancel key to exit menus or exit the game. * Also check closing the game window entirely. */ void GameStatePlay::checkCancel() { // if user has clicked exit game from exit menu if (menu->requestingExit()) { if (SAVE_ONEXIT) saveGame(); snd->stopMusic(); delete requestedGameState; requestedGameState = new GameStateTitle(); } // if user closes the window if (inpt->done) { if (SAVE_ONEXIT) saveGame(); snd->stopMusic(); exitRequested = true; } }