static int dialog_savegame_save(gg_widget_t *widget, gg_widget_t *emitter, void *data, void *extra_data) { int save_good=TRUE; /* Close the dialogs.. */ gg_dialog_close(); gg_dialog_close(); if (!game_save( saveload_selected )) { write_save_xml( saveload_selected ); } else save_good=FALSE; #ifdef _arch_dreamcast if (dc_store_savegames()) save_good=FALSE; #endif if ( save_good ) show_message_dialog( "Save successful" ); else show_message_dialog( "Save failed" ); return 1; }
void TB_SaveSelect::Run_Input() { int start; if (justpushed(DOWNKEY)) { start = fCurSel; for(;;) { fCurSel++; if (fCurSel >= fNumFiles) fCurSel = 0; if (fSaving) break; if (fHaveProfile[fCurSel]) break; if (fCurSel == start) break; } sound(SND_MENU_MOVE); fPicXOffset = -24; } if (justpushed(UPKEY)) { start = fCurSel; for(;;) { fCurSel--; if (fCurSel < 0) fCurSel = fNumFiles - 1; if (fSaving) break; if (fHaveProfile[fCurSel]) break; if (fCurSel == start) break; } sound(SND_MENU_MOVE); fPicXOffset = -24; } if (buttonjustpushed()) { // when shown in a replay, the box is shown and everything just like what was done // originally, but we won't actually overwrite any save files. if (!Replay::IsPlaying()) { if (fSaving) game_save(fCurSel); settings->last_save_slot = fCurSel; settings_save(); // record new save/load slot } SetVisible(false); // when the script hit the <SVP, it froze itself in an artifical <WAI9999 // waiting for us to complete. Now unfreeze it so can say "Game saved.", // or for loading, just end. ScriptInstance *s = GetCurrentScriptInstance(); if (s) s->delaytimer = 0; } }
static RESULT cmd_save(const char** argv, int argc, GameContext* pContext, GameEventContext* pEvent) { if(get_game_status(pContext) == Status_None) { MSG_OUT("当前不在游戏中,不能保存进度!\n"); return R_E_STATUS; } if(argc != 2) { param_error(argv[0]); return R_E_PARAM; } game_save(pContext, argv[1]); return R_DEF; }
void parse_turn (int argc, char * arg1, char * arg2, gameType * game) { /* Decide on an action to take with player input: make a move, save a file or exit */ int a, b; char * fname; /* Save */ if (argc == 1) { /* Check filename given */ /*if (strlen(arg1) == 1) { sysMessage(9, game); }*/ /* Strip out first character for filename & save */ fname = (char *) malloc(strlen(arg1)); fname = strncpy(fname, &arg1[1], strlen(arg1) - 1); fname[strlen(arg1)] = '\0'; game_save(fname, game); free(fname); } /* Place piece */ else if (argc == 2) { /* Check positive integers given */ string_strip_nondigit(arg2); if (!( string_is_numeric(arg1) && string_is_numeric(arg2) )) { return; } /* Check integers did not overflow */ a = atoi(arg1); b = atoi(arg2); if ((a == INT_MAX) || (b == INT_MAX) || (a < 0) || (b < 0)) { return; } /* Perform the move */ player_try_move(a, b, game); } }
void def_save() { game_save(app_name,1,SV_ALL - SV_INFO - SV_STRUCT); }
void DrawDebug(void) { if (settings->enable_debug_keys) { // handle debug keys if (justpushed(DEBUG_GOD_KEY)) { game.debug.god ^= 1; sound(SND_MENU_SELECT); } if (justpushed(DEBUG_SAVE_KEY)) { game_save(settings->last_save_slot); sound(SND_SWITCH_WEAPON); console.Print("Game saved."); } if (justpushed(F6KEY)) { game.debug.DrawBoundingBoxes ^= 1; sound(SND_COMPUTER_BEEP); } if (justpushed(F9KEY)) { AddXP(1); } if (inputs[DEBUG_FLY_KEY]) { player->yinertia = -0x880; if (!player->hurt_time) player->hurt_time = 20; // make invincible } } /*if (game.debug.debugmode) { //debug("%d fps", game.debug.fps); if (game.debug.god) { //debug("<GOD MODE>"); player->weapons[player->curWeapon].level = 2; player->weapons[player->curWeapon].xp = player->weapons[player->curWeapon].max_xp[2]; player->weapons[player->curWeapon].ammo = player->weapons[player->curWeapon].maxammo; player->hp = player->maxHealth; } debug("%d,%d", (player->x>>CSF)/TILE_W, (player->y>>CSF)/TILE_H); debug("[%c%c%c%c]", player->blockl?'l':' ', player->blockr?'r':' ', player->blocku?'u':' ', player->blockd?'d':' '); //debug("%d", player->xinertia); //debug("%d", player->yinertia);*/ /* debug("Have Puppy: %d", game.flags[274]); debug("Kakeru: %d", game.flags[275]); debug("Runner Gone: %d", game.flags[276]); debug("No Shinobu: %d", game.flags[277]); debug("Door Open: %d", game.flags[278]); debug("Mick: %d", game.flags[279]); debug("Gave 1st: %d", game.flags[590]); debug("Gave 2nd: %d", game.flags[591]); debug("Gave 3rd: %d", game.flags[592]); debug("Gave 4th: %d", game.flags[593]); debug("Gave 5th: %d", game.flags[594]); debug("-"); { int i; for(i=0;i<player->ninventory;i++) debug("%d", player->inventory[i]); } */ //} debug_draw(); DrawDebugMarks(); }
int menu_save(SDL_Surface* destination, game *p_game){ game_save(p_game, "./res/scripts/save_1.xml"); return 1; }