[Scummvm-git-logs] scummvm master -> d8d0d7a70536676116f6895239f3fb54f7a08a5a
OMGPizzaGuy
48367439+OMGPizzaGuy at users.noreply.github.com
Thu Feb 11 04:53:45 UTC 2021
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6228b1305a ULTIMA8: Remove duplicate check of font_override option
d8d0d7a705 ULTIMA8: Add gump flag to prevent saving instead of checking for modal gumps
Commit: 6228b1305a49ee366d8c498a55fe723163c54c27
https://github.com/scummvm/scummvm/commit/6228b1305a49ee366d8c498a55fe723163c54c27
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-10T22:48:17-06:00
Commit Message:
ULTIMA8: Remove duplicate check of font_override option
Changed paths:
engines/ultima/ultima8/games/game_data.cpp
diff --git a/engines/ultima/ultima8/games/game_data.cpp b/engines/ultima/ultima8/games/game_data.cpp
index 0f61e7fcf6..3bccae4a4a 100644
--- a/engines/ultima/ultima8/games/game_data.cpp
+++ b/engines/ultima/ultima8/games/game_data.cpp
@@ -398,9 +398,7 @@ void GameData::setupJPOverrides() {
}
}
- bool overridefonts = ConfMan.getBool("font_override");
- if (overridefonts)
- setupTTFOverrides("language", true);
+ setupTTFOverrides("language", true);
}
void GameData::setupTTFOverrides(const char *category, bool SJIS) {
Commit: d8d0d7a70536676116f6895239f3fb54f7a08a5a
https://github.com/scummvm/scummvm/commit/d8d0d7a70536676116f6895239f3fb54f7a08a5a
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-10T22:48:17-06:00
Commit Message:
ULTIMA8: Add gump flag to prevent saving instead of checking for modal gumps
Changed paths:
engines/ultima/ultima8/gumps/credits_gump.h
engines/ultima/ultima8/gumps/gump.h
engines/ultima/ultima8/gumps/modal_gump.h
engines/ultima/ultima8/gumps/movie_gump.h
engines/ultima/ultima8/gumps/remorse_menu_gump.cpp
engines/ultima/ultima8/gumps/shape_viewer_gump.h
engines/ultima/ultima8/gumps/u8_save_gump.cpp
engines/ultima/ultima8/gumps/weasel_gump.cpp
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/ultima8.h
diff --git a/engines/ultima/ultima8/gumps/credits_gump.h b/engines/ultima/ultima8/gumps/credits_gump.h
index 0809d8c633..dce9483b37 100644
--- a/engines/ultima/ultima8/gumps/credits_gump.h
+++ b/engines/ultima/ultima8/gumps/credits_gump.h
@@ -40,7 +40,7 @@ public:
CreditsGump();
CreditsGump(const Std::string &text, int parskip = 24,
- uint32 flags = 0, int32 layer = LAYER_MODAL);
+ uint32 flags = FLAG_PREVENT_SAVE, int32 layer = LAYER_MODAL);
~CreditsGump() override;
// Init the gump, call after construction
diff --git a/engines/ultima/ultima8/gumps/gump.h b/engines/ultima/ultima8/gumps/gump.h
index e54265c86a..1e35cbd183 100644
--- a/engines/ultima/ultima8/gumps/gump.h
+++ b/engines/ultima/ultima8/gumps/gump.h
@@ -424,18 +424,22 @@ public:
// Gump Flags
//
enum GumpFlags {
- FLAG_DRAGGABLE = 0x01, // When set, the gump can be dragged
- FLAG_HIDDEN = 0x02, // When set, the gump will not be drawn
- FLAG_CLOSING = 0x04, // When set, the gump is closing
- FLAG_CLOSE_AND_DEL = 0x08, // When set, the gump is closing and will be deleted
- FLAG_ITEM_DEPENDENT = 0x10, // When set, the gump will be deleted on MapChange
- FLAG_DONT_SAVE = 0x20, // When set, don't save this gump.
- // Be very careful with this one!
- FLAG_CORE_GUMP = 0x40, // core gump (only children are saved)
- FLAG_KEEP_VISIBLE = 0x80 // Keep this gump on-screen.
- // (only for ItemRelativeGumps)
+ FLAG_DRAGGABLE = 0x0001, // When set, the gump can be dragged
+ FLAG_HIDDEN = 0x0002, // When set, the gump will not be drawn
+ FLAG_CLOSING = 0x0004, // When set, the gump is closing
+ FLAG_CLOSE_AND_DEL = 0x0008, // When set, the gump is closing and will be deleted
+ FLAG_ITEM_DEPENDENT = 0x0010, // When set, the gump will be deleted on MapChange
+ FLAG_DONT_SAVE = 0x0020, // When set, don't save this gump. Be very careful with this one!
+ FLAG_CORE_GUMP = 0x0040, // core gump (only children are saved)
+ FLAG_KEEP_VISIBLE = 0x0080, // Keep this gump on-screen. (only for ItemRelativeGumps)
+ FLAG_PREVENT_SAVE = 0x0100 // When set, prevent game from saving
};
+ //! Does this gump have any of the given flags mask set
+ inline bool hasFlags(uint flags) const {
+ return (_flags & flags) != 0;
+ }
+
inline bool IsHidden() const {
return (_flags & FLAG_HIDDEN) || (_parent && _parent->IsHidden());
}
diff --git a/engines/ultima/ultima8/gumps/modal_gump.h b/engines/ultima/ultima8/gumps/modal_gump.h
index 6be2e3e0ca..2026f7f5ad 100644
--- a/engines/ultima/ultima8/gumps/modal_gump.h
+++ b/engines/ultima/ultima8/gumps/modal_gump.h
@@ -38,7 +38,7 @@ public:
ModalGump();
ModalGump(int x, int y, int width, int height, uint16 owner = 0,
- uint32 flags = 0, int32 layer = LAYER_MODAL);
+ uint32 flags = FLAG_PREVENT_SAVE, int32 layer = LAYER_MODAL);
~ModalGump() override;
diff --git a/engines/ultima/ultima8/gumps/movie_gump.h b/engines/ultima/ultima8/gumps/movie_gump.h
index dc23ea8aa0..4ca5188889 100644
--- a/engines/ultima/ultima8/gumps/movie_gump.h
+++ b/engines/ultima/ultima8/gumps/movie_gump.h
@@ -40,7 +40,7 @@ public:
MovieGump();
MovieGump(int width, int height, Common::SeekableReadStream *rs,
bool introMusicHack = false, const byte *overridePal = nullptr,
- uint32 flags = 0, int32 layer = LAYER_MODAL);
+ uint32 flags = FLAG_PREVENT_SAVE, int32 layer = LAYER_MODAL);
~MovieGump() override;
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/remorse_menu_gump.cpp b/engines/ultima/ultima8/gumps/remorse_menu_gump.cpp
index 4749f4efd0..f758ff47af 100644
--- a/engines/ultima/ultima8/gumps/remorse_menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/remorse_menu_gump.cpp
@@ -216,7 +216,7 @@ static void _openScummVmSaveLoad(bool isSave) {
delete dialog;
if (isSave)
- Ultima8Engine::get_instance()->saveGame(slot, desc, true);
+ Ultima8Engine::get_instance()->saveGame(slot, desc);
else
Ultima8Engine::get_instance()->loadGameState(slot);
}
diff --git a/engines/ultima/ultima8/gumps/shape_viewer_gump.h b/engines/ultima/ultima8/gumps/shape_viewer_gump.h
index c10498824a..89f4f4139c 100644
--- a/engines/ultima/ultima8/gumps/shape_viewer_gump.h
+++ b/engines/ultima/ultima8/gumps/shape_viewer_gump.h
@@ -43,7 +43,7 @@ public:
ShapeViewerGump();
ShapeViewerGump(int x, int y, int width, int height,
Std::vector<Std::pair<Std::string, ShapeArchive *> > &flexes,
- uint32 flags = 0, int32 layer = LAYER_MODAL);
+ uint32 flags = FLAG_PREVENT_SAVE, int32 layer = LAYER_MODAL);
~ShapeViewerGump() override;
void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override;
diff --git a/engines/ultima/ultima8/gumps/u8_save_gump.cpp b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
index f606b3f553..58b3c4ae1f 100644
--- a/engines/ultima/ultima8/gumps/u8_save_gump.cpp
+++ b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
@@ -271,7 +271,7 @@ bool U8SaveGump::savegame(int saveIndex, const Std::string &name) {
if (name.empty()) return false;
- Ultima8Engine::get_instance()->saveGame(saveIndex, name, true);
+ Ultima8Engine::get_instance()->saveGame(saveIndex, name);
return true;
}
@@ -314,17 +314,15 @@ void U8SaveGump::loadDescriptions() {
//static
Gump *U8SaveGump::showLoadSaveGump(Gump *parent, bool save) {
- if (save) {
- // can't save if game over
- // FIXME: this check should probably be in Game or GUIApp
- const MainActor *av = getMainActor();
- if (!av || av->hasActorFlags(Actor::ACT_DEAD))
- return nullptr;
+ if (!ConfMan.getBool("originalsaveload")) {
+ if (save)
+ Ultima8Engine::get_instance()->saveGameDialog();
+ else
+ Ultima8Engine::get_instance()->loadGameDialog();
+ return nullptr;
}
- if (!ConfMan.getBool("originalsaveload")) {
- // ScummVM save screen
- Ultima8Engine::get_instance()->scummVMSaveLoadDialog(save);
+ if (save && !Ultima8Engine::get_instance()->canSaveGameStateCurrently(false)) {
return nullptr;
}
diff --git a/engines/ultima/ultima8/gumps/weasel_gump.cpp b/engines/ultima/ultima8/gumps/weasel_gump.cpp
index afed4654aa..84b9c911f7 100644
--- a/engines/ultima/ultima8/gumps/weasel_gump.cpp
+++ b/engines/ultima/ultima8/gumps/weasel_gump.cpp
@@ -100,7 +100,7 @@ static const char *_getRandomMovie(const char **movies, int nmovies) {
bool WeaselGump::_playedIntroMovie = false;
WeaselGump::WeaselGump(uint16 level)
- : ModalGump(0, 0, 640, 480, 0, FLAG_DONT_SAVE), _credits(0),
+ : ModalGump(0, 0, 640, 480), _credits(0),
_level(level), _state(kWeaselStart), _curItem(0), _ammoMode(false),
_curItemCost(1), _curItemShape(0), _ui(nullptr), _movie(nullptr) {
Mouse *mouse = Mouse::get_instance();
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 1052587a74..ec34013c61 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -108,6 +108,8 @@ struct ProcessLoader {
}
};
+inline bool HasPreventSaveFlag(const Gump *g) { return g->hasFlags(Gump::FLAG_PREVENT_SAVE); }
+
Ultima8Engine::Ultima8Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
Shared::UltimaEngine(syst, gameDesc), CoreApp(gameDesc), _saveCount(0), _game(nullptr),
_kernel(nullptr), _objectManager(nullptr), _mouse(nullptr), _ucMachine(nullptr),
@@ -787,41 +789,17 @@ void Ultima8Engine::writeSaveInfo(Common::WriteStream *ws) {
_game->writeSaveInfo(ws);
}
-bool Ultima8Engine::scummVMSaveLoadDialog(bool isSave) {
- GUI::SaveLoadChooser *dialog;
- Common::String desc;
- int slot;
-
- if (isSave) {
- dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
-
- slot = dialog->runModalWithCurrentTarget();
- desc = dialog->getResultString();
-
- if (desc.empty()) {
- desc = dialog->createDefaultSaveDescription(slot);
- }
- } else {
- dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), false);
- slot = dialog->runModalWithCurrentTarget();
- }
-
- delete dialog;
-
- if (slot < 0)
+bool Ultima8Engine::canSaveGameStateCurrently(bool isAutosave) {
+ // Can't save when avatar in stasis during cutscenes
+ if (_avatarInStasis)
return false;
- if (isSave) {
- return saveGameState(slot, desc).getCode() == Common::kNoError;
- } else {
- return loadGameState(slot).getCode() == Common::kNoError;
+ // Check for gumps that prevent saving
+ if (_desktopGump->FindGump(&HasPreventSaveFlag, true))
+ {
+ return false;
}
-}
-bool Ultima8Engine::canSaveGameStateCurrently(bool isAutosave) {
- if (_desktopGump->FindGump<ModalGump>() || _avatarInStasis)
- // Can't save when a modal gump is open, or avatar in statsis during cutscenes
- return false;
if (dynamic_cast<StartU8Process *>(_kernel->getRunningProcess()))
// Don't save while starting up.
@@ -835,10 +813,10 @@ bool Ultima8Engine::canSaveGameStateCurrently(bool isAutosave) {
return true;
}
-bool Ultima8Engine::saveGame(int slot, const Std::string &desc, bool ignore_modals) {
- // Don't allow saving with Modals open
- if (!ignore_modals && _desktopGump->FindGump<ModalGump>()) {
- pout << "Can't save: modal gump open." << Std::endl;
+bool Ultima8Engine::saveGame(int slot, const Std::string &desc) {
+ // Check for gumps that prevent saving
+ if ( _desktopGump->FindGump(&HasPreventSaveFlag, true)) {
+ pout << "Can't save: open gump preventing save." << Std::endl;
return false;
}
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index 9660eb3d3f..d50e0a9d24 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -272,11 +272,6 @@ public:
*/
void syncSoundSettings() override;
- /**
- * Open the ScummVM save/load screens
- */
- bool scummVMSaveLoadDialog(bool isSave);
-
/**
* Returns true if a savegame can be loaded
*/
@@ -310,7 +305,7 @@ public:
//! save a game
//! \param filename the file to save to
//! \return true if succesful
- bool saveGame(int slot, const Std::string &desc, bool ignore_modals = false);
+ bool saveGame(int slot, const Std::string &desc);
//! start a new game
//! \return true if succesful.
More information about the Scummvm-git-logs
mailing list