[Scummvm-git-logs] scummvm master -> 3915be8ff1cbb0a5aa9a63cb443829578d97e745
lephilousophe
lephilousophe at users.noreply.github.com
Sat Jun 8 12:57:22 CEST 2019
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
89922138e2 CRYOMNI3D: Use CursorMan instead of using backend directly
deb92e13eb CRYOMNI3D: Use shouldAbort to prepare GMM in-game load
9fbaf9c739 CRYOMNI3D: Revamp loading and saving
70c7133e4b CRYOMNI3D: Improve compatibility with ScummVM global UI
3915be8ff1 CRYOMNI3D: Implement load/save in-game with GMM
Commit: 89922138e2f9f29b1265aabe6e250fa050411caa
https://github.com/scummvm/scummvm/commit/89922138e2f9f29b1265aabe6e250fa050411caa
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2019-06-08T12:43:22+02:00
Commit Message:
CRYOMNI3D: Use CursorMan instead of using backend directly
This avoids bugs when GMM is displayed.
It uses GMM like all dialogs in ScummVM and without CursorMan our cursor
get erased when GMM is closed.
Changed paths:
engines/cryomni3d/cryomni3d.cpp
engines/cryomni3d/cryomni3d.h
engines/cryomni3d/fixed_image.cpp
engines/cryomni3d/versailles/dialogs_manager.cpp
engines/cryomni3d/versailles/documentation.cpp
engines/cryomni3d/versailles/engine.cpp
engines/cryomni3d/versailles/menus.cpp
engines/cryomni3d/versailles/toolbar.cpp
diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp
index b7d3a9d..f27bffb 100644
--- a/engines/cryomni3d/cryomni3d.cpp
+++ b/engines/cryomni3d/cryomni3d.cpp
@@ -222,14 +222,14 @@ void CryOmni3DEngine::displayHLZ(const Common::String &filename) {
}
void CryOmni3DEngine::setCursor(const Graphics::Cursor &cursor) const {
- g_system->setMouseCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(),
- cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor());
+ CursorMan.replaceCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(),
+ cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor());
}
void CryOmni3DEngine::setCursor(uint cursorId) const {
const Graphics::Cursor &cursor = _sprites.getCursor(cursorId);
- g_system->setMouseCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(),
- cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor());
+ CursorMan.replaceCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(),
+ cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor());
}
bool CryOmni3DEngine::pollEvents() {
diff --git a/engines/cryomni3d/cryomni3d.h b/engines/cryomni3d/cryomni3d.h
index 003d508..aba69e7 100644
--- a/engines/cryomni3d/cryomni3d.h
+++ b/engines/cryomni3d/cryomni3d.h
@@ -33,6 +33,8 @@
#include "engines/engine.h"
+#include "graphics/cursorman.h"
+
#include "cryomni3d/font_manager.h"
#include "cryomni3d/objects.h"
#include "cryomni3d/sprites.h"
@@ -106,8 +108,10 @@ public:
Image::ImageDecoder *loadHLZ(const Common::String &filename);
void fillSurface(byte color);
+ /* We use CursorMan because it avoids problems with cursors in GMM */
void setCursor(const Graphics::Cursor &cursor) const;
void setCursor(uint cursorId) const;
+ bool showMouse(bool visible) { return CursorMan.showMouse(visible); }
typedef void (CryOmni3DEngine::*HNMCallback)(uint frameNum);
void playHNM(const Common::String &filename,
Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType,
diff --git a/engines/cryomni3d/fixed_image.cpp b/engines/cryomni3d/fixed_image.cpp
index f00b309..3e8428a 100644
--- a/engines/cryomni3d/fixed_image.cpp
+++ b/engines/cryomni3d/fixed_image.cpp
@@ -48,12 +48,12 @@ void ZonFixedImage::run(const CallbackFunctor *callback) {
_callback = callback;
- g_system->showMouse(true);
+ _engine.showMouse(true);
while (!_exit) {
(*_callback)(this);
}
_engine.waitMouseRelease();
- g_system->showMouse(false);
+ _engine.showMouse(false);
// Deselect object
_inventory.setSelectedObject(nullptr);
@@ -97,10 +97,10 @@ void ZonFixedImage::load(const Common::String &image, const char *zone) {
// WORKAROUND: Wait for release after displaying the fixed image to avoid handling events due to mouse being pressed
// There is this bug in game
// Don't display cursor to prevent displaying an invalid cursor
- g_system->showMouse(false);
+ _engine.showMouse(false);
g_system->updateScreen();
_engine.waitMouseRelease();
- g_system->showMouse(true);
+ _engine.showMouse(true);
}
void ZonFixedImage::display() const {
diff --git a/engines/cryomni3d/versailles/dialogs_manager.cpp b/engines/cryomni3d/versailles/dialogs_manager.cpp
index 2b9d38e..d49984a 100644
--- a/engines/cryomni3d/versailles/dialogs_manager.cpp
+++ b/engines/cryomni3d/versailles/dialogs_manager.cpp
@@ -42,12 +42,12 @@ bool Versailles_DialogsManager::play(const Common::String &sequence) {
_engine->setCursor(181);
// No need to adjust hide cursor counter, there isn't any in ScummVM
- bool cursorWasVisible = g_system->showMouse(true);
+ bool cursorWasVisible = _engine->showMouse(true);
bool slowStop = false;
bool didSth = DialogsManager::play(sequence, slowStop);
- g_system->showMouse(cursorWasVisible);
+ _engine->showMouse(cursorWasVisible);
if (didSth && slowStop) {
if (_engine->showSubtitles()) {
@@ -123,7 +123,7 @@ void Versailles_DialogsManager::playDialog(const Common::String &video, const Co
return;
}
- g_system->showMouse(false);
+ _engine->showMouse(false);
uint16 width = videoDecoder->getWidth();
uint16 height = videoDecoder->getHeight();
@@ -235,7 +235,7 @@ void Versailles_DialogsManager::playDialog(const Common::String &video, const Co
// It's intentional that _lastImage is set with the first video image
delete videoDecoder;
- g_system->showMouse(true);
+ _engine->showMouse(true);
}
void Versailles_DialogsManager::displayMessage(const Common::String &text) {
diff --git a/engines/cryomni3d/versailles/documentation.cpp b/engines/cryomni3d/versailles/documentation.cpp
index b830b0c..3846651 100644
--- a/engines/cryomni3d/versailles/documentation.cpp
+++ b/engines/cryomni3d/versailles/documentation.cpp
@@ -146,7 +146,7 @@ void Versailles_Documentation::init(const Sprites *sprites, FontManager *fontMan
}
void Versailles_Documentation::handleDocArea() {
- g_system->showMouse(false);
+ _engine->showMouse(false);
// Load all links lazily and free them at the end to not waste memory
// Maybe it's not really useful
@@ -173,7 +173,7 @@ void Versailles_Documentation::handleDocArea() {
_allLinks.clear();
- g_system->showMouse(true);
+ _engine->showMouse(true);
}
void Versailles_Documentation::handleDocInGame(const Common::String &record) {
@@ -184,7 +184,7 @@ void Versailles_Documentation::handleDocInGame(const Common::String &record) {
Common::String nextRecord;
MouseBoxes boxes(3);
- g_system->showMouse(false);
+ _engine->showMouse(false);
bool end = false;
while (!end) {
inGamePrepareRecord(docSurface, boxes);
@@ -212,7 +212,7 @@ void Versailles_Documentation::handleDocInGame(const Common::String &record) {
error("Invalid case %d when displaying doc record", action);
}
}
- g_system->showMouse(true);
+ _engine->showMouse(true);
}
Common::String Versailles_Documentation::docAreaHandleSummary() {
@@ -327,7 +327,7 @@ Common::String Versailles_Documentation::docAreaHandleSummary() {
imageDecoder->getPaletteColorCount());
_engine->setCursor(181);
- g_system->showMouse(true);
+ _engine->showMouse(true);
bool redraw = true;
uint hoveredBox = -1;
@@ -409,7 +409,7 @@ Common::String Versailles_Documentation::docAreaHandleSummary() {
}
}
- g_system->showMouse(false);
+ _engine->showMouse(false);
delete imageDecoder;
@@ -456,7 +456,7 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() {
479 - _sprites->getCursor(105).getHeight(), 640, 480);
_engine->setCursor(181);
- g_system->showMouse(true);
+ _engine->showMouse(true);
bool redraw = true;
uint hoveredBox = -1;
@@ -515,7 +515,7 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() {
}
}
- g_system->showMouse(false);
+ _engine->showMouse(false);
delete imageDecoder;
@@ -693,7 +693,7 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur
MouseBoxes &boxes, Common::String &nextRecord) {
// Hovering is only handled for timeline entries
_engine->setCursor(181);
- g_system->showMouse(true);
+ _engine->showMouse(true);
bool first = true;
bool redraw = true;
@@ -856,7 +856,7 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur
}
}
- g_system->showMouse(false);
+ _engine->showMouse(false);
_engine->setCursor(181);
return action;
}
@@ -954,7 +954,7 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
imageDecoder->getPaletteColorCount());
_engine->setCursor(181);
- g_system->showMouse(true);
+ _engine->showMouse(true);
bool redraw = true;
uint hoveredBox = -1;
@@ -1050,7 +1050,7 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
}
}
- g_system->showMouse(false);
+ _engine->showMouse(false);
delete imageDecoder;
@@ -1172,7 +1172,7 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() {
imageDecoder->getPaletteColorCount());
_engine->setCursor(181);
- g_system->showMouse(true);
+ _engine->showMouse(true);
bool redraw = true;
uint hoveredBox = -1;
@@ -1294,7 +1294,7 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() {
}
}
- g_system->showMouse(false);
+ _engine->showMouse(false);
delete imageDecoder;
@@ -1340,7 +1340,7 @@ void Versailles_Documentation::inGamePrepareRecord(Graphics::ManagedSurface &sur
uint Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurface &surface,
MouseBoxes &boxes, Common::String &nextRecord) {
_engine->setCursor(181);
- g_system->showMouse(true);
+ _engine->showMouse(true);
uint action = -1;
@@ -1383,7 +1383,7 @@ uint Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurface &surf
}
}
- g_system->showMouse(false);
+ _engine->showMouse(false);
_engine->setCursor(181);
return action;
}
diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp
index 6417a9b..321b71c 100644
--- a/engines/cryomni3d/versailles/engine.cpp
+++ b/engines/cryomni3d/versailles/engine.cpp
@@ -600,7 +600,7 @@ void CryOmni3DEngine_Versailles::playTransitionEndLevel(int level) {
fillSurface(0);
// In original game the HNM player just doesn't render the cursor
- bool cursorWasVisible = g_system->showMouse(false);
+ bool cursorWasVisible = showMouse(false);
// Videos are like music because if you mute music in game it will mute videos soundtracks
playHNM(video, Audio::Mixer::kMusicSoundType);
@@ -618,7 +618,7 @@ void CryOmni3DEngine_Versailles::playTransitionEndLevel(int level) {
}
// Display back cursor there once the palette has been zeroed
- g_system->showMouse(cursorWasVisible);
+ showMouse(cursorWasVisible);
fillSurface(0);
@@ -1115,7 +1115,7 @@ int CryOmni3DEngine_Versailles::handleWarp() {
bool firstDraw = true;
bool moving = true;
uint actionId;
- g_system->showMouse(true);
+ showMouse(true);
while (!leftButtonPressed && !exit) {
int xDelta = 0, yDelta = 0;
uint movingCursor = -1;
@@ -1200,7 +1200,7 @@ int CryOmni3DEngine_Versailles::handleWarp() {
// Slow down loop but after updating screen
g_system->delayMillis(10);
}
- g_system->showMouse(false);
+ showMouse(false);
return actionId;
}
@@ -1395,7 +1395,7 @@ void CryOmni3DEngine_Versailles::animateCursor(const Object *obj) {
return;
}
- bool cursorWasVisible = g_system->showMouse(true);
+ bool cursorWasVisible = showMouse(true);
for (uint i = 4; i > 0; i--) {
// Wait 100ms
@@ -1416,7 +1416,7 @@ void CryOmni3DEngine_Versailles::animateCursor(const Object *obj) {
g_system->updateScreen();
}
- g_system->showMouse(cursorWasVisible);
+ showMouse(cursorWasVisible);
}
void CryOmni3DEngine_Versailles::collectObject(Object *obj, const ZonFixedImage *fimg,
@@ -1468,7 +1468,7 @@ void CryOmni3DEngine_Versailles::displayObject(const Common::String &imgName,
setMousePos(Common::Point(320, 240)); // Center of screen
setCursor(181);
- bool cursorWasVisible = g_system->showMouse(true);
+ bool cursorWasVisible = showMouse(true);
bool exitImg = false;
while (!g_engine->shouldQuit() && !exitImg) {
@@ -1483,7 +1483,7 @@ void CryOmni3DEngine_Versailles::displayObject(const Common::String &imgName,
waitMouseRelease();
clearKeys();
- g_system->showMouse(cursorWasVisible);
+ showMouse(cursorWasVisible);
setMousePos(Common::Point(320, 240)); // Center of screen
}
@@ -1506,12 +1506,12 @@ void CryOmni3DEngine_Versailles::executeSeeAction(uint actionId) {
void CryOmni3DEngine_Versailles::executeSpeakAction(uint actionId) {
PlaceActionKey key(_currentPlaceId, actionId);
Common::HashMap<PlaceActionKey, Common::String>::iterator it = _whoSpeaksWhere.find(key);
- g_system->showMouse(true);
+ showMouse(true);
bool doneSth = false;
if (it != _whoSpeaksWhere.end()) {
doneSth = _dialogsMan.play(it->_value);
}
- g_system->showMouse(false);
+ showMouse(false);
_forcePaletteUpdate = true;
if (doneSth) {
setMousePos(Common::Point(320, 240)); // Center of screen
@@ -1570,7 +1570,7 @@ void CryOmni3DEngine_Versailles::playInGameVideo(const Common::String &filename,
if (restoreCursorPalette) {
// WORKAROUND: Don't mess with mouse when not restoring cursors palette
- g_system->showMouse(false);
+ showMouse(false);
}
lockPalette(0, 241);
// Videos are like music because if you mute music in game it will mute videos soundtracks
@@ -1582,7 +1582,7 @@ void CryOmni3DEngine_Versailles::playInGameVideo(const Common::String &filename,
// Restore cursors colors as 2 first ones may have been erased by the video
setPalette(&_cursorPalette[3 * 240], 240, 248);
// WORKAROUND: Don't mess with mouse when not restoring cursors palette
- g_system->showMouse(true);
+ showMouse(true);
}
}
diff --git a/engines/cryomni3d/versailles/menus.cpp b/engines/cryomni3d/versailles/menus.cpp
index 031739d..98d433a 100644
--- a/engines/cryomni3d/versailles/menus.cpp
+++ b/engines/cryomni3d/versailles/menus.cpp
@@ -96,7 +96,7 @@ uint CryOmni3DEngine_Versailles::displayOptions() {
optionsSurface.create(bgFrame->w, bgFrame->h, bgFrame->format);
setCursor(181);
- g_system->showMouse(true);
+ showMouse(true);
uint hoveredBox = -1;
uint selectedBox;
@@ -452,7 +452,7 @@ uint CryOmni3DEngine_Versailles::displayOptions() {
}
}
- g_system->showMouse(false);
+ showMouse(false);
if (selectedMsg == 42) {
_abortCommand = kAbortLoadGame;
@@ -570,7 +570,7 @@ uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFr
_fontManager.displayStr(164, 214, _messages[subtitleId]);
// Draw an empty screen before we list saves
- g_system->showMouse(false);
+ showMouse(false);
g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.w, surface.h);
g_system->updateScreen();
@@ -578,7 +578,7 @@ uint CryOmni3DEngine_Versailles::displayFilePicker(const Graphics::Surface *bgFr
getSavesList(_isVisiting, savesList);
Common::String saveNameBackup;
- g_system->showMouse(true);
+ showMouse(true);
MouseBoxes boxes(10); // 6 files + Yes/No/Up/Down buttons
@@ -962,7 +962,7 @@ void CryOmni3DEngine_Versailles::displayCredits() {
return;
}
- g_system->showMouse(false);
+ showMouse(false);
char line[256];
bool end = false;
@@ -1068,7 +1068,7 @@ void CryOmni3DEngine_Versailles::displayCredits() {
currentY += lineHeight;
}
}
- g_system->showMouse(true);
+ showMouse(true);
}
} // End of namespace Versailles
diff --git a/engines/cryomni3d/versailles/toolbar.cpp b/engines/cryomni3d/versailles/toolbar.cpp
index 23b94b8..a0d4d30 100644
--- a/engines/cryomni3d/versailles/toolbar.cpp
+++ b/engines/cryomni3d/versailles/toolbar.cpp
@@ -263,9 +263,9 @@ uint Toolbar::callbackViewObject(uint dragStatus) {
return 1;
case kDragStatus_Finished:
// Just clicked
- g_system->showMouse(false);
+ _engine->showMouse(false);
(*selectedObject->viewCallback())();
- g_system->showMouse(true);
+ _engine->showMouse(true);
_parentMustRedraw = true;
_shortExit = true;
return 1;
@@ -293,7 +293,7 @@ uint Toolbar::callbackOptions(uint dragStatus) {
_shortExit = true;
_engine->setMousePos(Common::Point(320, 240)); // Center of screen
// Displaying options hides the mouse
- g_system->showMouse(true);
+ _engine->showMouse(true);
return 0;
default:
return 0;
Commit: deb92e13ebe309fba67fab47eca003dcb0b06e97
https://github.com/scummvm/scummvm/commit/deb92e13ebe309fba67fab47eca003dcb0b06e97
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2019-06-08T12:43:22+02:00
Commit Message:
CRYOMNI3D: Use shouldAbort to prepare GMM in-game load
Changed paths:
engines/cryomni3d/cryomni3d.cpp
engines/cryomni3d/dialogs_manager.cpp
engines/cryomni3d/versailles/dialogs_manager.cpp
engines/cryomni3d/versailles/documentation.cpp
engines/cryomni3d/versailles/engine.cpp
engines/cryomni3d/versailles/engine.h
engines/cryomni3d/versailles/logic.cpp
engines/cryomni3d/versailles/menus.cpp
engines/cryomni3d/versailles/toolbar.cpp
diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp
index f27bffb..ee788d6 100644
--- a/engines/cryomni3d/cryomni3d.cpp
+++ b/engines/cryomni3d/cryomni3d.cpp
@@ -137,7 +137,7 @@ void CryOmni3DEngine::playHNM(const Common::String &filename, Audio::Mixer::Soun
bool skipVideo = false;
uint frameNum = 0;
- while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
+ while (!shouldAbort() && !videoDecoder->endOfVideo() && !skipVideo) {
if (videoDecoder->needsUpdate()) {
const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
@@ -208,7 +208,7 @@ void CryOmni3DEngine::displayHLZ(const Common::String &filename) {
g_system->updateScreen();
bool exitImg = false;
- while (!g_engine->shouldQuit() && !exitImg) {
+ while (!shouldAbort() && !exitImg) {
if (pollEvents()) {
if (checkKeysPressed(1, Common::KEYCODE_ESCAPE) || getCurrentMouseButton() == 1) {
exitImg = true;
@@ -309,7 +309,7 @@ void CryOmni3DEngine::setAutoRepeatClick(uint millis) {
}
void CryOmni3DEngine::waitMouseRelease() {
- while (getCurrentMouseButton() != 0 && !g_engine->shouldQuit()) {
+ while (getCurrentMouseButton() != 0 && !shouldAbort()) {
pollEvents();
g_system->updateScreen();
g_system->delayMillis(10);
@@ -396,7 +396,7 @@ void CryOmni3DEngine::fadeOutPalette() {
delta[i] = palWork[i] / 25;
}
- for (uint step = 0; step < 25 && !g_engine->shouldQuit(); step++) {
+ for (uint step = 0; step < 25 && !shouldAbort(); step++) {
for (uint i = 0; i < 256 * 3; i++) {
palWork[i] -= delta[i];
palOut[i] = palWork[i] >> 8;
@@ -427,7 +427,7 @@ void CryOmni3DEngine::fadeInPalette(const byte *palette) {
}
setBlackPalette();
- for (uint step = 0; step < 25 && !g_engine->shouldQuit(); step++) {
+ for (uint step = 0; step < 25 && !shouldAbort(); step++) {
for (uint i = 0; i < 256 * 3; i++) {
palWork[i] += delta[i];
palOut[i] = palWork[i] >> 8;
diff --git a/engines/cryomni3d/dialogs_manager.cpp b/engines/cryomni3d/dialogs_manager.cpp
index fc40b14..5f78d2c 100644
--- a/engines/cryomni3d/dialogs_manager.cpp
+++ b/engines/cryomni3d/dialogs_manager.cpp
@@ -323,7 +323,7 @@ bool DialogsManager::play(const Common::String &sequence, bool &slowStop) {
// We must give a subject
uint playerChoice = askPlayerQuestions(video, questions);
didSomething = true;
- // -1 when shouldQuit
+ // -1 when shouldAbort
if (playerChoice == -1u || playerChoice == eocInserted) {
break;
}
diff --git a/engines/cryomni3d/versailles/dialogs_manager.cpp b/engines/cryomni3d/versailles/dialogs_manager.cpp
index d49984a..b69dfc1 100644
--- a/engines/cryomni3d/versailles/dialogs_manager.cpp
+++ b/engines/cryomni3d/versailles/dialogs_manager.cpp
@@ -53,7 +53,7 @@ bool Versailles_DialogsManager::play(const Common::String &sequence) {
if (_engine->showSubtitles()) {
bool skip = false;
uint end = g_system->getMillis() + 2000;
- while (!g_engine->shouldQuit() && g_system->getMillis() < end && !skip) {
+ while (!_engine->shouldAbort() && g_system->getMillis() < end && !skip) {
g_system->updateScreen();
g_system->delayMillis(10);
if (_engine->pollEvents() &&
@@ -189,7 +189,7 @@ void Versailles_DialogsManager::playDialog(const Common::String &video, const Co
bool skipWait = false;
uint end = g_system->getMillis() + duration;
- while (!g_engine->shouldQuit() && g_system->getMillis() < end && !skipWait) {
+ while (!_engine->shouldAbort() && g_system->getMillis() < end && !skipWait) {
g_system->updateScreen();
g_system->delayMillis(10);
if (_engine->pollEvents() && _engine->checkKeysPressed(1, Common::KEYCODE_SPACE)) {
@@ -206,7 +206,7 @@ void Versailles_DialogsManager::playDialog(const Common::String &video, const Co
audioDecoder = nullptr;
bool skipVideo = false;
- while (!g_engine->shouldQuit() && _engine->_mixer->isSoundHandleActive(audioHandle) && !skipVideo) {
+ while (!_engine->shouldAbort() && _engine->_mixer->isSoundHandleActive(audioHandle) && !skipVideo) {
if (_engine->pollEvents() && _engine->checkKeysPressed(1, Common::KEYCODE_SPACE)) {
skipVideo = true;
}
@@ -311,7 +311,7 @@ uint Versailles_DialogsManager::askPlayerQuestions(const Common::String &video,
if (_engine->pollEvents()) {
_engine->clearKeys();
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
finished = true;
selectedQuestion = -1;
break;
diff --git a/engines/cryomni3d/versailles/documentation.cpp b/engines/cryomni3d/versailles/documentation.cpp
index 3846651..c0acbc8 100644
--- a/engines/cryomni3d/versailles/documentation.cpp
+++ b/engines/cryomni3d/versailles/documentation.cpp
@@ -404,7 +404,7 @@ Common::String Versailles_Documentation::docAreaHandleSummary() {
selectedBox = 7;
}
}
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
selectedBox = 7;
}
}
@@ -510,7 +510,7 @@ Common::String Versailles_Documentation::docAreaHandleTimeline() {
selectedBox = leaveBoxId;
}
}
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
selectedBox = leaveBoxId;
}
}
@@ -710,7 +710,7 @@ uint Versailles_Documentation::docAreaHandleRecord(Graphics::ManagedSurface &sur
if (_engine->pollEvents() || first) {
first = false;
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
// Fake the quit
action = 6;
}
@@ -1044,7 +1044,7 @@ Common::String Versailles_Documentation::docAreaHandleGeneralMap() {
if (_engine->checkKeysPressed(1, Common::KEYCODE_ESCAPE)) {
selectedBox = ARRAYSIZE(areas);
}
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
selectedBox = ARRAYSIZE(areas);
}
}
@@ -1288,7 +1288,7 @@ Common::String Versailles_Documentation::docAreaHandleCastleMap() {
if (_engine->checkKeysPressed(1, Common::KEYCODE_ESCAPE)) {
selectedBox = ARRAYSIZE(areas);
}
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
selectedBox = ARRAYSIZE(areas);
}
}
@@ -1351,9 +1351,9 @@ uint Versailles_Documentation::inGameHandleRecord(Graphics::ManagedSurface &surf
g_system->delayMillis(10);
if (_engine->pollEvents()) {
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
// Fake the quit
- action = 6;
+ action = 1;
}
Common::Point mouse = _engine->getMousePos();
if (_engine->getDragStatus() == kDragStatus_Pressed) {
@@ -1726,7 +1726,7 @@ uint Versailles_Documentation::handlePopupMenu(const Graphics::ManagedSurface
g_system->delayMillis(10);
if (_engine->pollEvents()) {
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
// Fake the quit
break;
}
diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp
index 321b71c..2e7373f 100644
--- a/engines/cryomni3d/versailles/engine.cpp
+++ b/engines/cryomni3d/versailles/engine.cpp
@@ -169,11 +169,11 @@ Common::Error CryOmni3DEngine_Versailles::run() {
#if !defined(DEBUG_FAST_START) || DEBUG_FAST_START<1
playTransitionEndLevel(-2);
- if (g_engine->shouldQuit()) {
+ if (shouldAbort()) {
return Common::kNoError;
}
playTransitionEndLevel(-1);
- if (g_engine->shouldQuit()) {
+ if (shouldAbort()) {
return Common::kNoError;
}
#endif
@@ -203,7 +203,7 @@ Common::Error CryOmni3DEngine_Versailles::run() {
// New game
#if !defined(DEBUG_FAST_START) || DEBUG_FAST_START<1
playTransitionEndLevel(0);
- if (g_engine->shouldQuit()) {
+ if (shouldAbort()) {
stopGame = true;
exitLoop = true;
break;
@@ -256,6 +256,16 @@ Common::Error CryOmni3DEngine_Versailles::run() {
return Common::kNoError;
}
+bool CryOmni3DEngine_Versailles::shouldAbort() {
+ if (g_engine->shouldQuit()) {
+ _abortCommand = kAbortQuit;
+ return true;
+ }
+ // If we are not playing _abortCommand isn't used
+ // Even GMM can't load game when not playing
+ return _isPlaying && _abortCommand != kAbortNoAbort;
+}
+
Common::String CryOmni3DEngine_Versailles::prepareFileName(const Common::String &baseName,
const char *const *extensions) const {
Common::String baseName_(baseName);
@@ -592,8 +602,7 @@ void CryOmni3DEngine_Versailles::playTransitionEndLevel(int level) {
}
fadeOutPalette();
- if (g_engine->shouldQuit()) {
- _abortCommand = kAbortQuit;
+ if (shouldAbort()) {
return;
}
@@ -606,14 +615,12 @@ void CryOmni3DEngine_Versailles::playTransitionEndLevel(int level) {
playHNM(video, Audio::Mixer::kMusicSoundType);
clearKeys();
- if (g_engine->shouldQuit()) {
- _abortCommand = kAbortQuit;
+ if (shouldAbort()) {
return;
}
fadeOutPalette();
- if (g_engine->shouldQuit()) {
- _abortCommand = kAbortQuit;
+ if (shouldAbort()) {
return;
}
@@ -1155,8 +1162,8 @@ int CryOmni3DEngine_Versailles::handleWarp() {
actionId = _currentPlace->hitTest(mouseRev);
exit = handleWarpMouse(&actionId, movingCursor);
- if (g_engine->shouldQuit()) {
- _abortCommand = kAbortQuit;
+ if (shouldAbort()) {
+ // We abort if we quit or if we load from GMM
exit = true;
}
if (exit) {
@@ -1225,7 +1232,7 @@ bool CryOmni3DEngine_Versailles::handleWarpMouse(uint *actionId,
bool mustRedraw = displayToolbar(original);
// Don't redraw if we abort game
- if (_abortCommand != kAbortNoAbort) {
+ if (shouldAbort()) {
return true;
}
if (mustRedraw) {
@@ -1239,7 +1246,7 @@ bool CryOmni3DEngine_Versailles::handleWarpMouse(uint *actionId,
if (countDown()) {
// Time has changed: need redraw
// Don't redraw if we abort game
- if (_abortCommand != kAbortNoAbort) {
+ if (shouldAbort()) {
return true;
}
@@ -1471,7 +1478,7 @@ void CryOmni3DEngine_Versailles::displayObject(const Common::String &imgName,
bool cursorWasVisible = showMouse(true);
bool exitImg = false;
- while (!g_engine->shouldQuit() && !exitImg) {
+ while (!shouldAbort() && !exitImg) {
if (pollEvents()) {
if (getCurrentMouseButton() == 1) {
exitImg = true;
diff --git a/engines/cryomni3d/versailles/engine.h b/engines/cryomni3d/versailles/engine.h
index 66f4663..369f69a 100644
--- a/engines/cryomni3d/versailles/engine.h
+++ b/engines/cryomni3d/versailles/engine.h
@@ -231,7 +231,7 @@ public:
virtual bool hasPlaceDocumentation() override;
virtual bool displayPlaceDocumentation() override;
virtual uint displayOptions() override;
- virtual bool shouldAbort() override { return g_engine->shouldQuit() || _abortCommand != kAbortNoAbort; }
+ virtual bool shouldAbort() override;
private:
void setupFonts();
diff --git a/engines/cryomni3d/versailles/logic.cpp b/engines/cryomni3d/versailles/logic.cpp
index 02592ee..48c919b 100644
--- a/engines/cryomni3d/versailles/logic.cpp
+++ b/engines/cryomni3d/versailles/logic.cpp
@@ -3090,7 +3090,7 @@ IMG_CB(88004b) {
break;
}
}
- if (!shouldQuit()) {
+ if (!shouldAbort()) {
// Close the toilets
playInGameVideo("31j32b");
// Force reload of the place
@@ -3163,7 +3163,7 @@ INIT_PLACE(1, 3) {
FILTER_EVENT(1, 3) {
if (*event == 11301) {
- while (!g_engine->shouldQuit() && _mixer->isSoundIDActive(SoundIds::kLeb001)) {
+ while (!shouldAbort() && _mixer->isSoundIDActive(SoundIds::kLeb001)) {
g_system->updateScreen();
g_system->delayMillis(10);
pollEvents();
diff --git a/engines/cryomni3d/versailles/menus.cpp b/engines/cryomni3d/versailles/menus.cpp
index 98d433a..305fe1c 100644
--- a/engines/cryomni3d/versailles/menus.cpp
+++ b/engines/cryomni3d/versailles/menus.cpp
@@ -105,7 +105,7 @@ uint CryOmni3DEngine_Versailles::displayOptions() {
bool resetScreen = true;
bool forceEvents = true;
- while (!g_engine->shouldQuit() && !end) {
+ while (!shouldAbort() && !end) {
if (resetScreen) {
setPalette(imageDecoder->getPalette(), imageDecoder->getPaletteStartIndex(),
imageDecoder->getPaletteColorCount());
@@ -465,10 +465,12 @@ uint CryOmni3DEngine_Versailles::displayOptions() {
} else if (selectedMsg == 27) {
_abortCommand = kAbortNewGame;
_isVisiting = false;
- } else if (g_engine->shouldQuit()) {
+ } else if (shouldAbort()) {
// Fake a quit
selectedMsg = 40;
- _abortCommand = kAbortQuit;
+ // shouldAbort called earlier has already set _abortCommand
+ // If GMM is called on main menu in game, return value is ignored so quit isn't important
+ // If GMM is called on main menu out of game, GMM can only quit game and don't load
}
ConfMan.flushToDisk();
@@ -1013,7 +1015,7 @@ void CryOmni3DEngine_Versailles::displayCredits() {
}
clearKeys();
}
- if (g_engine->shouldQuit()) {
+ if (shouldAbort()) {
skipScreen = true;
end = true;
}
diff --git a/engines/cryomni3d/versailles/toolbar.cpp b/engines/cryomni3d/versailles/toolbar.cpp
index a0d4d30..d302dce 100644
--- a/engines/cryomni3d/versailles/toolbar.cpp
+++ b/engines/cryomni3d/versailles/toolbar.cpp
@@ -428,7 +428,7 @@ bool Toolbar::displayToolbar(const Graphics::Surface *original) {
g_system->delayMillis(10);
_engine->pollEvents();
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
return false;
}
}
@@ -438,7 +438,7 @@ bool Toolbar::displayToolbar(const Graphics::Surface *original) {
_engine->waitMouseRelease();
handleToolbarEvents(original);
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
return false;
}
@@ -457,7 +457,7 @@ bool Toolbar::displayToolbar(const Graphics::Surface *original) {
g_system->delayMillis(10);
_engine->pollEvents();
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
return false;
}
}
@@ -495,7 +495,7 @@ void Toolbar::handleToolbarEvents(const Graphics::Surface *original) {
_mouse_in_view_object = false;
_engine->pollEvents();
- if (g_engine->shouldQuit()) {
+ if (_engine->shouldAbort()) {
exitToolbar = true;
break;
}
Commit: 9fbaf9c73919258e21e420393cf053f413d37856
https://github.com/scummvm/scummvm/commit/9fbaf9c73919258e21e420393cf053f413d37856
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2019-06-08T12:43:22+02:00
Commit Message:
CRYOMNI3D: Revamp loading and saving
Add support to manage saves from startup screen
Changed paths:
engines/cryomni3d/cryomni3d.h
engines/cryomni3d/detection.cpp
engines/cryomni3d/versailles/engine.cpp
engines/cryomni3d/versailles/saveload.cpp
diff --git a/engines/cryomni3d/cryomni3d.h b/engines/cryomni3d/cryomni3d.h
index aba69e7..df62764 100644
--- a/engines/cryomni3d/cryomni3d.h
+++ b/engines/cryomni3d/cryomni3d.h
@@ -99,8 +99,9 @@ public:
uint8 getGameType() const;
Common::Language getLanguage() const;
- bool hasFeature(EngineFeature f) const;
+ bool hasFeature(EngineFeature f) const override;
+ static const uint kSaveDescriptionLen = 20;
private:
void pauseEngineIntern(bool);
diff --git a/engines/cryomni3d/detection.cpp b/engines/cryomni3d/detection.cpp
index 00f8480..1de22f4 100644
--- a/engines/cryomni3d/detection.cpp
+++ b/engines/cryomni3d/detection.cpp
@@ -109,10 +109,8 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
virtual SaveStateList listSaves(const char *target) const;
- SaveStateList listSavesForPrefix(const char *prefix, const char *extension) const;
virtual int getMaximumSaveSlot() const { return 999; }
virtual void removeSaveState(const char *target, int slot) const;
- virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
};
bool CryOmni3DMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -120,50 +118,47 @@ bool CryOmni3DMetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsListSaves)
|| (f == kSupportsLoadingDuringStartup)
|| (f == kSupportsDeleteSave)
- || (f == kSavesSupportMetaInfo)
- || (f == kSavesSupportThumbnail)
- || (f == kSavesSupportCreationDate)
- || (f == kSavesSupportPlayTime);
-}
-
-SaveStateList CryOmni3DMetaEngine::listSavesForPrefix(const char *prefix,
- const char *extension) const {
- Common::String pattern = Common::String::format("%s-###.%s", prefix, extension);
- Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
- size_t prefixLen = strlen(prefix);
-
- SaveStateList saveList;
- for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end();
- ++filename) {
- // Extract the slot number from the filename
- char slot[4];
- slot[0] = (*filename)[prefixLen + 1];
- slot[1] = (*filename)[prefixLen + 2];
- slot[2] = (*filename)[prefixLen + 3];
- slot[3] = '\0';
-
- int slotNum = atoi(slot);
-
- saveList.push_back(SaveStateDescriptor(slotNum, ""));
- }
-
- Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
-
- return saveList;
+ || (f == kSimpleSavesNames);
}
SaveStateList CryOmni3DMetaEngine::listSaves(const char *target) const {
+ // Replicate constant here to shorten lines
+ static const uint kSaveDescriptionLen = CryOmni3D::CryOmni3DEngine::kSaveDescriptionLen;
SaveStateList saveList;
+ Common::SaveFileManager *saveMan = g_system->getSavefileManager();
+
+ char saveName[kSaveDescriptionLen + 1];
+ saveName[kSaveDescriptionLen] = '\0';
+ Common::String pattern = Common::String::format("%s.????", target);
+ Common::StringArray filenames = saveMan->listSavefiles(pattern);
+ sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+
+ int slotNum;
+
+ for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end();
+ ++file) {
+ // Obtain the last 4 digits of the filename, since they correspond to the save slot
+ slotNum = atoi(file->c_str() + file->size() - 4);
+
+ if (slotNum >= 1 && slotNum <= 99) {
+ Common::InSaveFile *in = saveMan->openForLoading(*file);
+ if (in) {
+ if (in->read(saveName, kSaveDescriptionLen) == kSaveDescriptionLen) {
+ saveList.push_back(SaveStateDescriptor(slotNum - 1, saveName));
+ }
+ delete in;
+ }
+ }
+ }
+
return saveList;
}
void CryOmni3DMetaEngine::removeSaveState(const char *target, int slot) const {
+ Common::String filename = Common::String::format("%s.%04d", target, slot + 1);
-}
-
-SaveStateDescriptor CryOmni3DMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
- return SaveStateDescriptor();
+ g_system->getSavefileManager()->removeSavefile(filename);
}
bool CryOmni3DMetaEngine::createInstance(OSystem *syst, Engine **engine,
diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp
index 2e7373f..c8a8b11 100644
--- a/engines/cryomni3d/versailles/engine.cpp
+++ b/engines/cryomni3d/versailles/engine.cpp
@@ -167,14 +167,19 @@ Common::Error CryOmni3DEngine_Versailles::run() {
_isPlaying = false;
_isVisiting = false;
+ int saveSlot = ConfMan.getInt("save_slot");
+
#if !defined(DEBUG_FAST_START) || DEBUG_FAST_START<1
- playTransitionEndLevel(-2);
- if (shouldAbort()) {
- return Common::kNoError;
- }
- playTransitionEndLevel(-1);
- if (shouldAbort()) {
- return Common::kNoError;
+ if (saveSlot == -1) {
+ // Don't play introduction if loading directly a game
+ playTransitionEndLevel(-2);
+ if (shouldAbort()) {
+ return Common::kNoError;
+ }
+ playTransitionEndLevel(-1);
+ if (shouldAbort()) {
+ return Common::kNoError;
+ }
}
#endif
@@ -182,11 +187,18 @@ Common::Error CryOmni3DEngine_Versailles::run() {
while (!stopGame) {
bool exitLoop = false;
uint nextStep = 0;
+ if (saveSlot > -1) {
+ nextStep = 28;
+ _loadedSave = saveSlot + 1;
+ // Called in options
+ syncOmni3DSettings();
+ } else {
#if defined(DEBUG_FAST_START) && DEBUG_FAST_START>=2
- nextStep = 27;
- // Called in options
- syncOmni3DSettings();
+ nextStep = 27;
+ // Called in options
+ syncOmni3DSettings();
#endif
+ }
setCursor(181);
while (!exitLoop) {
_isPlaying = false;
diff --git a/engines/cryomni3d/versailles/saveload.cpp b/engines/cryomni3d/versailles/saveload.cpp
index afade64..5aec69e 100644
--- a/engines/cryomni3d/versailles/saveload.cpp
+++ b/engines/cryomni3d/versailles/saveload.cpp
@@ -27,12 +27,9 @@
#include "cryomni3d/versailles/engine.h"
-#define DEBUG_SAVE
-
namespace CryOmni3D {
namespace Versailles {
-#define SAVE_DESCRIPTION_LEN 20
Common::String CryOmni3DEngine_Versailles::getSaveFileName(bool visit, uint saveNum) const {
return Common::String::format("%s%s.%04u", _targetName.c_str(), visit ? "_visit" : "", saveNum);
@@ -47,13 +44,11 @@ bool CryOmni3DEngine_Versailles::canVisit() const {
}
void CryOmni3DEngine_Versailles::getSavesList(bool visit, Common::StringArray &saveNames) {
- Common::SaveFileManager *saveMan = g_system->getSavefileManager();
-
- char saveName[SAVE_DESCRIPTION_LEN + 1];
- saveName[SAVE_DESCRIPTION_LEN] = '\0';
+ char saveName[kSaveDescriptionLen + 1];
+ saveName[kSaveDescriptionLen] = '\0';
Common::String pattern = Common::String::format("%s%s.????", _targetName.c_str(),
visit ? "_visit" : "");
- Common::StringArray filenames = saveMan->listSavefiles(pattern);
+ Common::StringArray filenames = _saveFileMan->listSavefiles(pattern);
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
saveNames.clear();
@@ -72,7 +67,7 @@ void CryOmni3DEngine_Versailles::getSavesList(bool visit, Common::StringArray &s
if (!visitFile.open("game0001.sav", visitsSearchSet)) {
error("Can't load visit file");
}
- visitFile.read(saveName, SAVE_DESCRIPTION_LEN);
+ visitFile.read(saveName, kSaveDescriptionLen);
saveNames.push_back(saveName);
} else {
warning("visiting mode but no bootstrap");
@@ -94,13 +89,9 @@ void CryOmni3DEngine_Versailles::getSavesList(bool visit, Common::StringArray &s
}
num++;
-#ifdef DEBUG_SAVE
- Common::InSaveFile *in = _saveFileMan->openRawFile(*file);
-#else
Common::InSaveFile *in = _saveFileMan->openForLoading(*file);
-#endif
if (in) {
- if (in->read(saveName, SAVE_DESCRIPTION_LEN) == SAVE_DESCRIPTION_LEN) {
+ if (in->read(saveName, kSaveDescriptionLen) == kSaveDescriptionLen) {
saveNames.push_back(saveName);
}
delete in;
@@ -123,13 +114,7 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, uint saveNum,
Common::OutSaveFile *out;
- if (!(out = _saveFileMan->openForSaving(saveFileName,
-#ifdef DEBUG_SAVE
- false
-#else
- true
-#endif
- ))) {
+ if (!(out = _saveFileMan->openForSaving(saveFileName))) {
return;
}
@@ -137,7 +122,7 @@ void CryOmni3DEngine_Versailles::saveGame(bool visit, uint saveNum,
syncCountdown();
// Write save name
- char saveNameC[SAVE_DESCRIPTION_LEN];
+ char saveNameC[kSaveDescriptionLen];
memset(saveNameC, 0, sizeof(saveNameC));
strncpy(saveNameC, saveName.c_str(), sizeof(saveNameC));
out->write(saveNameC, sizeof(saveNameC));
@@ -216,12 +201,7 @@ bool CryOmni3DEngine_Versailles::loadGame(bool visit, uint saveNum) {
in = visitFile;
} else {
Common::String saveFileName = getSaveFileName(visit, saveNum);
-
-#ifdef DEBUG_SAVE
- in = _saveFileMan->openRawFile(saveFileName);
-#else
in = _saveFileMan->openForLoading(saveFileName);
-#endif
}
if (!in || in->size() != 1260) {
@@ -231,7 +211,7 @@ bool CryOmni3DEngine_Versailles::loadGame(bool visit, uint saveNum) {
musicStop();
// Load save name but don't use it
- char saveNameC[SAVE_DESCRIPTION_LEN];
+ char saveNameC[kSaveDescriptionLen];
in->read(saveNameC, sizeof(saveNameC));
// dummy values
Commit: 70c7133e4b23adff5d630d4d2a37ac81ef070566
https://github.com/scummvm/scummvm/commit/70c7133e4b23adff5d630d4d2a37ac81ef070566
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2019-06-08T12:43:22+02:00
Commit Message:
CRYOMNI3D: Improve compatibility with ScummVM global UI
Changed paths:
engines/cryomni3d/detection.cpp
engines/cryomni3d/detection_tables.h
engines/cryomni3d/versailles/menus.cpp
diff --git a/engines/cryomni3d/detection.cpp b/engines/cryomni3d/detection.cpp
index 1de22f4..10a7b49 100644
--- a/engines/cryomni3d/detection.cpp
+++ b/engines/cryomni3d/detection.cpp
@@ -69,7 +69,9 @@ Common::Language CryOmni3DEngine::getLanguage() const {
}
bool CryOmni3DEngine::hasFeature(EngineFeature f) const {
- return false;
+ return
+ (f == kSupportsRTL)
+ || (f == kSupportsSubtitleOptions);
}
} // End of Namespace CryOmni3D
diff --git a/engines/cryomni3d/detection_tables.h b/engines/cryomni3d/detection_tables.h
index d791a34a..8d56594 100644
--- a/engines/cryomni3d/detection_tables.h
+++ b/engines/cryomni3d/detection_tables.h
@@ -22,9 +22,7 @@
namespace CryOmni3D {
-//#define GAMEOPTION_PLAY_MYST_FLYBY GUIO_GAMEOPTIONS1
-
-//#define GUI_OPTIONS_MYST GUIO3(GUIO_NOASPECT, GUIO_NOSUBTITLES, GUIO_NOMIDI)
+#define GUI_OPTIONS_VERSAILLES GUIO3(GUIO_NOMIDI, GUIO_NOSFX, GUIO_NOASPECT)
static const CryOmni3DGameDescription gameDescriptions[] = {
// Versailles 1685
@@ -38,7 +36,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- GUIO1(GUIO_NOASPECT)
+ GUI_OPTIONS_VERSAILLES
},
GType_VERSAILLES,
0,
@@ -56,7 +54,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- GUIO1(GUIO_NOASPECT)
+ GUI_OPTIONS_VERSAILLES
},
GType_VERSAILLES,
0,
@@ -74,7 +72,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformDOS,
ADGF_UNSTABLE,
- GUIO1(GUIO_NOASPECT)
+ GUI_OPTIONS_VERSAILLES
},
GType_VERSAILLES,
0,
@@ -92,7 +90,7 @@ static const CryOmni3DGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
- GUIO1(GUIO_NOASPECT)
+ GUI_OPTIONS_VERSAILLES
},
GType_VERSAILLES,
0,
@@ -115,7 +113,7 @@ static const CryOmni3DGameDescription fallbackDescs[] = {
Common::UNK_LANG,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- GUIO1(GUIO_NOASPECT)
+ GUI_OPTIONS_VERSAILLES
},
GType_VERSAILLES,
0,
diff --git a/engines/cryomni3d/versailles/menus.cpp b/engines/cryomni3d/versailles/menus.cpp
index 305fe1c..6da7a85 100644
--- a/engines/cryomni3d/versailles/menus.cpp
+++ b/engines/cryomni3d/versailles/menus.cpp
@@ -85,7 +85,7 @@ uint CryOmni3DEngine_Versailles::displayOptions() {
int drawState = 1;
uint volumeCursorMiddleY = _sprites.getCursor(102).getHeight() / 2;
- uint volume = CLIP(ConfMan.getInt("sfx_volume"), 0, 256);
+ uint volume = CLIP(ConfMan.getInt("music_volume"), 0, 256);
uint soundVolumeY = ((283 * (256 - volume)) >> 8) + 101;
byte volumeForeColor = 243;
@@ -251,13 +251,15 @@ uint CryOmni3DEngine_Versailles::displayOptions() {
volume = CLIP(((384 - soundVolumeY) << 8) / 283, 0u, 256u);
// Global setting
ConfMan.setInt("music_volume", volume);
+ // As we modify speech volume, let's unmute it
+ // Using in-game settings resets all scummvm specific settings
+ ConfMan.setBool("speech_mute", false);
ConfMan.setInt("speech_volume", volume);
- ConfMan.setInt("sfx_volume", volume);
syncSoundSettings();
}
} else if (getDragStatus() == 2 &&
!_mixer->hasActiveChannelOfType(Audio::Mixer::kMusicSoundType) &&
- _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) > 0) {
+ _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) > 0) {
// Finished dragging
_mixer->stopID(SoundIds::kOrgue);
do {
@@ -275,7 +277,7 @@ uint CryOmni3DEngine_Versailles::displayOptions() {
break;
}
- _mixer->playStream(Audio::Mixer::kSFXSoundType, nullptr, audioDecoder, SoundIds::kOrgue);
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, nullptr, audioDecoder, SoundIds::kOrgue);
// We lost ownership of the audioDecoder just set it to nullptr and don't use it
audioDecoder = nullptr;
} while (false);
Commit: 3915be8ff1cbb0a5aa9a63cb443829578d97e745
https://github.com/scummvm/scummvm/commit/3915be8ff1cbb0a5aa9a63cb443829578d97e745
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2019-06-08T12:43:22+02:00
Commit Message:
CRYOMNI3D: Implement load/save in-game with GMM
Changed paths:
engines/cryomni3d/cryomni3d.cpp
engines/cryomni3d/cryomni3d.h
engines/cryomni3d/fixed_image.cpp
engines/cryomni3d/versailles/engine.cpp
engines/cryomni3d/versailles/engine.h
engines/cryomni3d/versailles/saveload.cpp
diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp
index ee788d6..05d370c 100644
--- a/engines/cryomni3d/cryomni3d.cpp
+++ b/engines/cryomni3d/cryomni3d.cpp
@@ -42,7 +42,8 @@ namespace CryOmni3D {
CryOmni3DEngine::CryOmni3DEngine(OSystem *syst,
const CryOmni3DGameDescription *gamedesc) : Engine(syst), _gameDescription(gamedesc),
- _fontManager(), _sprites(), _dragStatus(kDragStatus_NoDrag), _autoRepeatNextEvent(-1u) {
+ _canLoadSave(false), _fontManager(), _sprites(), _dragStatus(kDragStatus_NoDrag),
+ _autoRepeatNextEvent(-1u) {
if (!_mixer->isReady()) {
error("Sound initialization failed");
}
diff --git a/engines/cryomni3d/cryomni3d.h b/engines/cryomni3d/cryomni3d.h
index df62764..d1855a8 100644
--- a/engines/cryomni3d/cryomni3d.h
+++ b/engines/cryomni3d/cryomni3d.h
@@ -100,7 +100,10 @@ public:
Common::Language getLanguage() const;
bool hasFeature(EngineFeature f) const override;
+ bool canLoadGameStateCurrently() override { return _canLoadSave; }
+ bool canSaveGameStateCurrently() override { return _canLoadSave; }
+ void setCanLoadSave(bool canLoadSave) { _canLoadSave = canLoadSave; }
static const uint kSaveDescriptionLen = 20;
private:
void pauseEngineIntern(bool);
@@ -157,6 +160,8 @@ protected:
void setBlackPalette();
protected:
+ bool _canLoadSave;
+
FontManager _fontManager;
Sprites _sprites;
Objects _objects;
diff --git a/engines/cryomni3d/fixed_image.cpp b/engines/cryomni3d/fixed_image.cpp
index 3e8428a..16a35f8 100644
--- a/engines/cryomni3d/fixed_image.cpp
+++ b/engines/cryomni3d/fixed_image.cpp
@@ -188,10 +188,15 @@ void ZonFixedImage::manage() {
_usedObject = nullptr;
_key.reset();
+ // As the game lets load/save from main menu displayed by cliking from the toolbar,
+ // it's safe to enable GMM Load/Save there
+ _engine.setCanLoadSave(true);
+
// Force poll events even when we must refresh the cursor
if (!_engine.pollEvents() && !_refreshCursor) {
g_system->updateScreen();
g_system->delayMillis(10);
+ _engine.setCanLoadSave(false);
return;
}
_refreshCursor = false;
@@ -202,9 +207,11 @@ void ZonFixedImage::manage() {
if (_key == Common::KEYCODE_ESCAPE) {
_exit = true;
+ _engine.setCanLoadSave(false);
return;
} else if (_engine.shouldAbort()) {
_exit = true;
+ _engine.setCanLoadSave(false);
return;
}
@@ -221,6 +228,7 @@ void ZonFixedImage::manage() {
}
// Return without any event to redo the loop and force refresh
_refreshCursor = true;
+ _engine.setCanLoadSave(false);
return;
}
@@ -268,6 +276,8 @@ void ZonFixedImage::manage() {
g_system->updateScreen();
g_system->delayMillis(10);
+
+ _engine.setCanLoadSave(false);
}
void ZonFixedImage::handleMouseZones(const Common::Array<Zone>::const_iterator ¤tZone) {
diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp
index c8a8b11..ab9318f 100644
--- a/engines/cryomni3d/versailles/engine.cpp
+++ b/engines/cryomni3d/versailles/engine.cpp
@@ -67,6 +67,12 @@ CryOmni3DEngine_Versailles::~CryOmni3DEngine_Versailles() {
delete _fixedImage;
}
+bool CryOmni3DEngine_Versailles::hasFeature(EngineFeature f) const {
+ return CryOmni3DEngine::hasFeature(f)
+ || (f == kSupportsSavingDuringRuntime)
+ || (f == kSupportsLoadingDuringRuntime);
+}
+
Common::Error CryOmni3DEngine_Versailles::run() {
CryOmni3DEngine::run();
@@ -1135,6 +1141,7 @@ int CryOmni3DEngine_Versailles::handleWarp() {
bool moving = true;
uint actionId;
showMouse(true);
+ _canLoadSave = true;
while (!leftButtonPressed && !exit) {
int xDelta = 0, yDelta = 0;
uint movingCursor = -1;
@@ -1219,6 +1226,7 @@ int CryOmni3DEngine_Versailles::handleWarp() {
// Slow down loop but after updating screen
g_system->delayMillis(10);
}
+ _canLoadSave = false;
showMouse(false);
return actionId;
}
diff --git a/engines/cryomni3d/versailles/engine.h b/engines/cryomni3d/versailles/engine.h
index 369f69a..83beddb 100644
--- a/engines/cryomni3d/versailles/engine.h
+++ b/engines/cryomni3d/versailles/engine.h
@@ -217,6 +217,10 @@ public:
CryOmni3DEngine_Versailles(OSystem *syst, const CryOmni3DGameDescription *gamedesc);
virtual ~CryOmni3DEngine_Versailles();
+ bool hasFeature(EngineFeature f) const override;
+ virtual Common::Error loadGameState(int slot) override;
+ virtual Common::Error saveGameState(int slot, const Common::String &desc) override;
+
Common::String prepareFileName(const Common::String &baseName, const char *extension) const {
const char *const extensions[] = { extension, nullptr };
return prepareFileName(baseName, extensions);
diff --git a/engines/cryomni3d/versailles/saveload.cpp b/engines/cryomni3d/versailles/saveload.cpp
index 5aec69e..2c14c3d 100644
--- a/engines/cryomni3d/versailles/saveload.cpp
+++ b/engines/cryomni3d/versailles/saveload.cpp
@@ -30,6 +30,16 @@
namespace CryOmni3D {
namespace Versailles {
+Common::Error CryOmni3DEngine_Versailles::loadGameState(int slot) {
+ _loadedSave = slot + 1;
+ _abortCommand = kAbortLoadGame;
+ return Common::kNoError;
+}
+
+Common::Error CryOmni3DEngine_Versailles::saveGameState(int slot, const Common::String &desc) {
+ saveGame(_isVisiting, slot + 1, desc);
+ return Common::kNoError;
+}
Common::String CryOmni3DEngine_Versailles::getSaveFileName(bool visit, uint saveNum) const {
return Common::String::format("%s%s.%04u", _targetName.c_str(), visit ? "_visit" : "", saveNum);
More information about the Scummvm-git-logs
mailing list