Ticket #8925: common-load_v2.patch
File common-load_v2.patch, 15.6 KB (added by , 16 years ago) |
---|
-
engines/dialogs.cpp
34 34 #include "gui/about.h" 35 35 #include "gui/eval.h" 36 36 #include "gui/newgui.h" 37 #include "gui/launcher.h" 37 38 #include "gui/ListWidget.h" 38 39 #include "gui/theme.h" 39 40 … … 95 96 96 97 new GUI::ButtonWidget(this, "globalmain_resume", "Resume", kPlayCmd, 'P'); 97 98 98 // new GUI::ButtonWidget(this, "globalmain_load", "Load", kLoadCmd, 'L'); 99 // new GUI::ButtonWidget(this, "globalmain_save", "Save", kSaveCmd, 'S'); 99 _loadButton = new GUI::ButtonWidget(this, "globalmain_load", "Load", kLoadCmd, 'L'); 100 100 101 _saveButton = new GUI::ButtonWidget(this, "globalmain_save", "Save", kSaveCmd, 'S'); 102 101 103 new GUI::ButtonWidget(this, "globalmain_options", "Options", kOptionsCmd, 'O'); 102 104 103 105 new GUI::ButtonWidget(this, "globalmain_about", "About", kAboutCmd, 'A'); … … 111 113 112 114 _aboutDialog = new GUI::AboutDialog(); 113 115 _optionsDialog = new ConfigDialog(); 116 _loadDialog = new GUI::SaveLoadChooser("Load game:", "Load"); 114 117 } 115 118 116 119 MainMenuDialog::~MainMenuDialog() { 117 120 delete _aboutDialog; 118 121 delete _optionsDialog; 122 delete _loadDialog; 123 //delete _saveDialog; 119 124 } 120 125 121 126 void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { … … 123 128 case kPlayCmd: 124 129 close(); 125 130 break; 131 case kLoadCmd: 132 { 133 String gameId = ConfMan.get("gameid"); 134 135 const EnginePlugin *plugin = 0; 136 EngineMan.findGame(gameId, &plugin); 137 138 int slot = _loadDialog->runModal(plugin, ConfMan.getActiveDomainName()); 139 140 if (slot >= 0) { 141 _engine->loadGameState(slot); 142 close(); 143 } 144 145 } 146 break; 147 case kSaveCmd: 148 /* 149 String gameId = ConfMan.get("gameid"); 150 151 const EnginePlugin *plugin = 0; 152 EngineMan.findGame(gameId, &plugin); 153 154 int slot = _saveDialog->runModal(plugin, ConfMan.getActiveDomainName()); 155 156 if (slot >= 0) { 157 _engine->saveGameState(slot); 158 close(); 159 } 160 161 } 162 */ 163 break; 126 164 case kOptionsCmd: 127 165 _optionsDialog->runModal(); 128 166 break; … … 149 187 } 150 188 151 189 void MainMenuDialog::reflowLayout() { 190 // '1' - kSupportsListSaves, '8' - kSupportsLoading 191 _loadButton->setEnabled(_engine->hasFeature(1) && 192 _engine->hasFeature(8) && 193 _engine->canLoadGameState()); 194 // '1' - kSupportsListSaves, '9' - kSupportsSaving 195 _saveButton->setEnabled(_engine->hasFeature(1) && 196 _engine->hasFeature(9) && 197 _engine->canSaveGameState()); 198 152 199 #ifndef DISABLE_FANCY_THEMES 153 200 if (g_gui.evaluator()->getVar("global_logo.visible") == 1 && g_gui.theme()->supportsImages()) { 154 201 if (!_logo) -
engines/dialogs.h
27 27 28 28 #include "common/str.h" 29 29 #include "gui/dialog.h" 30 #include "gui/launcher.h" 30 31 #include "gui/options.h" 31 32 #include "gui/widget.h" 32 33 … … 56 57 57 58 GUI::GraphicsWidget *_logo; 58 59 GUI::ButtonWidget *_rtlButton; 60 GUI::ButtonWidget *_loadButton; 61 GUI::ButtonWidget *_saveButton; 59 62 GUI::Dialog *_aboutDialog; 60 63 GUI::Dialog *_optionsDialog; 64 GUI::SaveLoadChooser *_loadDialog; 61 65 62 66 }; 63 67 -
engines/engine.cpp
216 216 _mixer->pauseAll(pause); 217 217 } 218 218 219 int Engine::loadGameState(int slot) { 220 // Do nothing by default 221 return 0; 222 } 223 224 bool Engine::canLoadGameState() { 225 // Allow loading by default 226 return true; 227 } 228 229 int Engine::saveGameState(int slot) { 230 // Do nothing by default 231 return 0; 232 } 233 234 bool Engine::canSaveGameState() { 235 // Allow saving by default 236 return true; 237 } 238 239 void Engine::audioSettingsChanged() { 240 // Do nothing by default 241 } 242 219 243 void Engine::mainMenuDialog() { 220 244 if (!_mainMenuDialog) 221 245 _mainMenuDialog = new MainMenuDialog(this); -
engines/engine.h
164 164 * for details. 165 165 */ 166 166 virtual void pauseEngineIntern(bool pause); 167 168 /** Load a game state */ 169 virtual int loadGameState(int slot); 170 171 /** Indicates whether a game state can be loaded */ 172 virtual bool canLoadGameState(); 173 174 /** Save a game state */ 175 virtual int saveGameState(int slot); 176 177 /** Indicates whether a game state can be saved */ 178 virtual bool canSaveGameState(); 179 180 /** Called when the user changes volume settings from the GMM */ 181 virtual void audioSettingsChanged(); 167 182 }; 168 183 169 184 extern Engine *g_engine; -
engines/igor/igor.h
427 427 void dialogueReplyToQuestion(int x, int y, int r, int g, int b, int reply = 0); 428 428 429 429 void saveOrLoadGameState(TypeSerializer &typeSerializer); 430 voidloadGameState(int slot);431 voidsaveGameState(int slot);430 int loadGameState(int slot); 431 int saveGameState(int slot); 432 432 void generateGameStateFileName(int num, char *dst, int len) const; 433 433 434 434 MidiPlayer *_midiPlayer; -
engines/igor/saveload.cpp
156 156 } 157 157 } 158 158 159 voidIgorEngine::loadGameState(int slot) {159 int IgorEngine::loadGameState(int slot) { 160 160 char name[64]; 161 161 generateGameStateFileName(slot, name, 63); 162 162 Common::InSaveFile *isf = _saveFileMan->openForLoading(name); … … 175 175 } 176 176 debug(0, "Loaded state, current part %d", _currentPart); 177 177 } 178 179 return 0; // TODO: return success/failure 178 180 } 179 181 180 voidIgorEngine::saveGameState(int slot) {182 int IgorEngine::saveGameState(int slot) { 181 183 char name[64]; 182 184 generateGameStateFileName(slot, name, 63); 183 185 Common::OutSaveFile *osf = _saveFileMan->openForSaving(name); … … 187 189 saveOrLoadGameState(ts); 188 190 delete osf; 189 191 } 192 193 return 0; // TODO: return success/failure 190 194 } 191 195 192 196 void IgorEngine::generateGameStateFileName(int num, char *dst, int len) const { -
engines/metaengine.h
170 170 * the game till the save. 171 171 * This flag may only be set when 'kSupportsMetaInfos' is set. 172 172 */ 173 kSupportsSavePlayTime = 7 173 kSupportsSavePlayTime = 7, 174 175 /** Loading from the Common ScummVM options dialog in-game */ 176 kSupportsLoading = 8, 177 178 /** Saving from the Common ScummVM options dialog in-game */ 179 kSupportsSaving = 9 174 180 }; 175 181 176 182 /** -
engines/queen/queen.cpp
351 351 } 352 352 } 353 353 354 voidQueenEngine::loadGameState(int slot) {354 int QueenEngine::loadGameState(int slot) { 355 355 debug(3, "Loading game from slot %d", slot); 356 356 GameStateHeader header; 357 357 Common::InSaveFile *file = readGameStateHeader(slot, &header); … … 374 374 delete[] saveData; 375 375 delete file; 376 376 } 377 378 return 0; // TODO: return success/failure 377 379 } 378 380 379 381 Common::InSaveFile *QueenEngine::readGameStateHeader(int slot, GameStateHeader *gsh) { -
engines/queen/queen.h
108 108 109 109 bool canLoadOrSave() const; 110 110 void saveGameState(int slot, const char *desc); 111 voidloadGameState(int slot);111 int loadGameState(int slot); 112 112 void makeGameStateName(int slot, char *buf) const; 113 113 int getGameStateSlot(const char *filename) const; 114 114 void findGameStateDescriptions(char descriptions[100][32]); -
engines/saga/detection.cpp
32 32 #include "common/config-manager.h" 33 33 #include "common/advancedDetector.h" 34 34 35 #include "saga/animation.h" 35 36 #include "saga/displayinfo.h" 37 #include "saga/events.h" 36 38 #include "saga/rscfile.h" 37 39 #include "saga/interface.h" 38 40 #include "saga/scene.h" … … 158 160 (f == kSupportsRTL) || 159 161 (f == kSupportsListSaves) || 160 162 (f == kSupportsDirectLoad) || 161 (f == kSupportsDeleteSave); 163 (f == kSupportsDeleteSave) || 164 (f == kSupportsLoading) || 165 (f == kSupportsSaving); 162 166 } 163 167 164 168 bool SagaMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const { … … 238 242 return di.logicalHeight; 239 243 } 240 244 245 int SagaEngine::loadGameState(int slot) { 246 // Init the current chapter to 8 (character selection) for IHNM 247 if (getGameType() == GType_IHNM) 248 _scene->changeScene(-2, 0, kTransitionFade, 8); 249 250 // First scene sets up palette 251 _scene->changeScene(getStartSceneNumber(), 0, kTransitionNoFade); 252 _events->handleEvents(0); // Process immediate events 253 254 if (getGameType() != GType_IHNM) 255 _interface->setMode(kPanelMain); 256 else 257 _interface->setMode(kPanelChapterSelection); 258 259 load(calcSaveFileName((uint)slot)); 260 syncSoundSettings(); 261 262 return 0; // TODO: return success/failure 263 } 264 241 265 } // End of namespace Saga -
engines/saga/saga.cpp
532 532 _sound->setVolume(); 533 533 } 534 534 535 bool SagaEngine::canLoadGameState() { 536 return !this->_scene->isInIntro(); 537 } 538 539 bool SagaEngine::canSaveGameState() { 540 return !this->_scene->isInIntro(); 541 } 542 535 543 } // End of namespace Saga -
engines/saga/saga.h
651 651 const Common::Rect &getDisplayClip() const { return _displayClip;} 652 652 int getDisplayWidth() const; 653 653 int getDisplayHeight() const; 654 int loadGameState(int slot); 655 bool canLoadGameState(); 656 bool canSaveGameState(); 654 657 const GameDisplayInfo &getDisplayInfo(); 655 658 656 659 const char *getTextString(int textStringId); -
engines/touche/menu.cpp
331 331 break; 332 332 case kActionPerformSaveLoad: 333 333 if (menuData->mode == kMenuLoadStateMode) { 334 if (loadGameState(_saveLoadCurrentSlot) ) {334 if (loadGameState(_saveLoadCurrentSlot) == 0) { 335 335 menuData->quit = true; 336 336 } 337 337 } else if (menuData->mode == kMenuSaveStateMode) { -
engines/touche/saveload.cpp
340 340 return saveOk; 341 341 } 342 342 343 boolToucheEngine::loadGameState(int num) {343 int ToucheEngine::loadGameState(int num) { 344 344 bool loadOk = false; 345 345 char gameStateFileName[64]; 346 346 generateGameStateFileName(num, gameStateFileName, 63); … … 360 360 } 361 361 delete f; 362 362 } 363 return loadOk ;363 return loadOk ? 0 : 1; 364 364 } 365 365 366 366 void ToucheEngine::readGameStateDescription(int num, char *description, int len) { -
engines/touche/touche.h
496 496 void saveGameStateData(Common::WriteStream *stream); 497 497 void loadGameStateData(Common::ReadStream *stream); 498 498 bool saveGameState(int num, const char *description); 499 boolloadGameState(int num);499 int loadGameState(int num); 500 500 void readGameStateDescription(int num, char *description, int len); 501 501 void generateGameStateFileName(int num, char *dst, int len, bool prefixOnly = false) const; 502 502 int getGameStateFileSlot(const char *filename) const; -
gui/launcher.cpp
473 473 } 474 474 } 475 475 476 class SaveLoadChooser : public GUI::Dialog {477 typedef Common::String String;478 typedef Common::StringList StringList;479 protected:480 GUI::ListWidget *_list;481 GUI::ButtonWidget *_chooseButton;482 GUI::ButtonWidget *_deleteButton;483 GUI::GraphicsWidget *_gfxWidget;484 GUI::ContainerWidget *_container;485 GUI::StaticTextWidget *_date;486 GUI::StaticTextWidget *_time;487 GUI::StaticTextWidget *_playtime;488 489 const EnginePlugin *_plugin;490 bool _delSupport;491 bool _metaInfoSupport;492 bool _thumbnailSupport;493 bool _saveDateSupport;494 bool _playTimeSupport;495 String _target;496 SaveStateList _saveList;497 498 uint8 _fillR, _fillG, _fillB;499 500 void updateSaveList();501 void updateSelection(bool redraw);502 public:503 SaveLoadChooser(const String &title, const String &buttonLabel);504 ~SaveLoadChooser();505 506 virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);507 void setList(const StringList& list);508 int runModal(const EnginePlugin *plugin, const String &target);509 510 virtual void reflowLayout();511 512 virtual void close();513 };514 515 476 SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel) 516 477 : Dialog("scummsaveload"), _delSupport(0), _list(0), _chooseButton(0), _deleteButton(0), _gfxWidget(0) { 517 478 _delSupport = _metaInfoSupport = _thumbnailSupport = _saveDateSupport = _playTimeSupport = false; -
gui/launcher.h
27 27 28 28 #include "gui/dialog.h" 29 29 #include "engines/game.h" 30 #include "engines/metaengine.h" 30 31 #include "common/str.h" 31 32 32 33 namespace GUI { … … 79 80 void selectGame(const String &name); 80 81 }; 81 82 83 class SaveLoadChooser : public GUI::Dialog { 84 typedef Common::String String; 85 typedef Common::StringList StringList; 86 protected: 87 GUI::ListWidget *_list; 88 GUI::ButtonWidget *_chooseButton; 89 GUI::ButtonWidget *_deleteButton; 90 GUI::GraphicsWidget *_gfxWidget; 91 GUI::ContainerWidget *_container; 92 GUI::StaticTextWidget *_date; 93 GUI::StaticTextWidget *_time; 94 GUI::StaticTextWidget *_playtime; 95 96 const EnginePlugin *_plugin; 97 bool _delSupport; 98 bool _metaInfoSupport; 99 bool _thumbnailSupport; 100 bool _saveDateSupport; 101 bool _playTimeSupport; 102 String _target; 103 SaveStateList _saveList; 104 105 uint8 _fillR, _fillG, _fillB; 106 107 void updateSaveList(); 108 void updateSelection(bool redraw); 109 public: 110 SaveLoadChooser(const String &title, const String &buttonLabel); 111 ~SaveLoadChooser(); 112 113 virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); 114 void setList(const StringList& list); 115 int runModal(const EnginePlugin *plugin, const String &target); 116 117 virtual void reflowLayout(); 118 119 virtual void close(); 120 }; 121 82 122 } // End of namespace GUI 83 123 84 124 #endif -
gui/themes/modern.ini
273 273 globalmain_resume=globalmainHOffset gmY scummmainButtonWidth scummmainButtonHeight 274 274 gmY=(gmY + scummmainButtonHeight + scummmainVAddOff) 275 275 gmY=(gmY + scummmainVSpace) 276 globalmain_load=prev.x gmY prev.w prev.h 277 gmY=(gmY + scummmainButtonHeight + scummmainVAddOff) 278 globalmain_save=prev.x gmY prev.w prev.h 279 gmY=(gmY + scummmainButtonHeight + scummmainVAddOff) 276 280 globalmain_options=prev.x gmY prev.w prev.h 277 281 gmY=(gmY + scummmainButtonHeight + scummmainVAddOff) 278 282 globalmain_about=prev.x gmY prev.w prev.h