Ticket #8925: common-load.patch
File common-load.patch, 10.4 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 _loadButton = new GUI::ButtonWidget(this, "globalmain_load", "Load", kLoadCmd, 'L'); 100 // '1' - kSupportsListSaves, '2' - kSupportsDirectLoad 101 _loadButton->setEnabled(_engine->hasFeature(1 & 2)); 99 102 // new GUI::ButtonWidget(this, "globalmain_save", "Save", kSaveCmd, 'S'); 100 103 101 104 new GUI::ButtonWidget(this, "globalmain_options", "Options", kOptionsCmd, 'O'); … … 111 114 112 115 _aboutDialog = new GUI::AboutDialog(); 113 116 _optionsDialog = new ConfigDialog(); 117 _loadDialog = new GUI::SaveLoadChooser("Load game:", "Load"); 114 118 } 115 119 116 120 MainMenuDialog::~MainMenuDialog() { 117 121 delete _aboutDialog; 118 122 delete _optionsDialog; 123 delete _loadDialog; 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; 126 147 case kOptionsCmd: 127 148 _optionsDialog->runModal(); 128 149 break; -
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; 59 61 GUI::Dialog *_aboutDialog; 60 62 GUI::Dialog *_optionsDialog; 63 GUI::SaveLoadChooser *_loadDialog; 61 64 62 65 }; 63 66 -
engines/engine.cpp
216 216 _mixer->pauseAll(pause); 217 217 } 218 218 219 bool Engine::loadGameState(int slot) { 220 // Do nothing by default 221 return false; 222 } 223 219 224 void Engine::mainMenuDialog() { 220 225 if (!_mainMenuDialog) 221 226 _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 bool loadGameState(int slot); 167 170 }; 168 171 169 172 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);430 bool loadGameState(int slot); 431 431 void saveGameState(int slot); 432 432 void generateGameStateFileName(int num, char *dst, int len) const; 433 433 -
engines/igor/saveload.cpp
156 156 } 157 157 } 158 158 159 voidIgorEngine::loadGameState(int slot) {159 bool 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 true; // TODO: return success/failure 178 180 } 179 181 180 182 void IgorEngine::saveGameState(int slot) { -
engines/queen/queen.cpp
351 351 } 352 352 } 353 353 354 voidQueenEngine::loadGameState(int slot) {354 bool 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 true; // 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 bool 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" … … 238 240 return di.logicalHeight; 239 241 } 240 242 243 bool SagaEngine::loadGameState(int slot) { 244 // FIXME: This doesn't work when called during the intro 245 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 true; // TODO: return success/failure 263 } 264 241 265 } // 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 bool loadGameState(int slot); 654 655 const GameDisplayInfo &getDisplayInfo(); 655 656 656 657 const char *getTextString(int textStringId); -
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) 276 278 globalmain_options=prev.x gmY prev.w prev.h 277 279 gmY=(gmY + scummmainButtonHeight + scummmainVAddOff) 278 280 globalmain_about=prev.x gmY prev.w prev.h