[Scummvm-git-logs] scummvm master -> bd56983b42f0424c2b5f7c6c066ba2d12b94b610
bgK
bastien.bouclet at gmail.com
Fri Jun 29 13:33:00 CEST 2018
This automated email contains information about 27 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1e9b58ab4b MOHAWK: RIVEN: Show main menu on ESC
0ca52f62a4 MOHAWK: RIVEN: Draw menu with TTF fonts
2e8d08c1d0 MOHAWK: RIVEN: Add a save button to the main menu
db359f0f0e MOHAWK: RIVEN: Fix crash for German Riven
23c889db44 MOHAWK: RIVEN: Localize menus
86e0089cc6 MOHAWK: RIVEN: Patch in the load menu for the game versions missing it
dc93e5bb6a MOHAWK: RIVEN: Add more options to the main menu
4b900cc432 MOHAWK: RIVEN: Remove the load/save/quit buttons from the options dialog
2f9c9a2c32 MOHAWK: RIVEN: Fix compilation without Riven
d848ebe85a MOHAWK: RIVEN: Fix loading and resuming from the main menu
a722fe1194 MOHAWK: RIVEN: Fix saving while in the menu
45ab57209f MOHAWK: RIVEN: Fix starting a new game with a game currently active
e7cb40dde5 MOHAWK: RIVEN: Use an in-game thumbnail when saving from the menu
6759346bb6 MOHAWK: RIVEN: Show confirmation dialogs on the main menu
be07d10c7a MOHAWK: Drop platform at Riven detection entries
09b94b1fc2 MOHAWK: RIVEN: Translated new menu entries
b26fe7de39 MOHAWK: RIVEN: Added Japanese font and menu translation
76f11cf025 GUI: Added font, used in Japanese Riven menus
2660211fd7 GUI: Added license for M+ fonts (PD)
24977b814c MOHAWK: RIVEN: Add detection for the 25th Anniversary version
cfa649d7ac MOHAWK: RIVEN: Restrict new menu to 25th Anniversary games
7884201b43 MOHAWK: RIVEN: Improve some of the main menu translations
52c89cb1e2 MOHAWK: RIVEN: Disable autosaving while the game is not started
318093b41c MOHAWK: Added file sizes to 25th Anniversary Riven entries
1f4d4b01ea MOHAWK: RIVEN: Removed hardcoded list of language prefixes.
573fa47f94 MOHAWK: RIVEN: Fix loading autosaves saved while on the main menu
bd56983b42 MOHAWK: RIVEN: Tweak a bit the main menu items
Commit: 1e9b58ab4bf864456de315c03c3cf3d0d2a81b2e
https://github.com/scummvm/scummvm/commit/1e9b58ab4bf864456de315c03c3cf3d0d2a81b2e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Show main menu on ESC
Changed paths:
engines/mohawk/riven.cpp
engines/mohawk/riven.h
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 648496b..1a2e0c3 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -73,6 +73,9 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio
_inventory = nullptr;
_lastSaveTime = 0;
+ _prevCard = -1;
+ _prevStack = -1;
+
DebugMan.addDebugChannel(kRivenDebugScript, "Script", "Track Script Execution");
DebugMan.addDebugChannel(kRivenDebugPatches, "Patches", "Track Script Patching");
@@ -284,6 +287,32 @@ void MohawkEngine_Riven::doFrame() {
}
}
break;
+ case Common::KEYCODE_ESCAPE:
+ if (!_scriptMan->hasQueuedScripts()) {
+ // Check if we haven't jumped to menu
+ if (_prevStack == -1) {
+ _prevStack = _stack->getId();
+ _prevCard = _card->getId();
+
+ // If we are already in menu, do not call again
+ if (_prevStack == kStackAspit && _prevCard == 1) {
+ _prevStack = -1;
+ _prevCard = -1;
+ break;
+ }
+
+ changeToStack(kStackAspit);
+ changeToCard(1);
+ } else {
+ changeToStack(_prevStack);
+ changeToCard(_prevCard);
+ _prevStack = -1;
+ _prevCard = -1;
+ }
+ } else {
+ _stack->onKeyPressed(event.kbd);
+ }
+ break;
default:
if (event.kbdRepeat) {
continue;
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 3dc19c7..1cddd32 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -120,6 +120,8 @@ private:
RivenCard *_card;
RivenStack *_stack;
+ int _prevCard, _prevStack;
+
bool _gameEnded;
uint32 _lastSaveTime;
Commit: 0ca52f62a4b475081f77eb933934c8f3448f33e2
https://github.com/scummvm/scummvm/commit/0ca52f62a4b475081f77eb933934c8f3448f33e2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Draw menu with TTF fonts
Changed paths:
engines/mohawk/riven_graphics.cpp
engines/mohawk/riven_graphics.h
engines/mohawk/riven_stacks/aspit.cpp
diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index e19a56d..cc5105b 100644
--- a/engines/mohawk/riven_graphics.cpp
+++ b/engines/mohawk/riven_graphics.cpp
@@ -366,6 +366,26 @@ void RivenGraphics::copyImageToScreen(uint16 image, uint32 left, uint32 top, uin
applyScreenUpdate();
}
+void RivenGraphics::copySurfaceToScreen(Graphics::Surface *src, uint32 x, uint32 y) {
+ beginScreenUpdate();
+
+ int w = src->w;
+ int h = src->h;
+
+ // Clip the width to fit on the screen. Fixes some images.
+ if (x + w > 608)
+ w = 608 - x;
+
+ if (y + h > 436)
+ h = 346 - y;
+
+ for (uint16 i = 0; i < h; i++)
+ memcpy(_mainScreen->getBasePtr(x, i + y), src->getBasePtr(0, i), w * src->format.bytesPerPixel);
+
+ _dirtyScreen = true;
+ applyScreenUpdate();
+}
+
void RivenGraphics::updateScreen() {
if (_dirtyScreen) {
// Copy to screen if there's no transition. Otherwise transition.
diff --git a/engines/mohawk/riven_graphics.h b/engines/mohawk/riven_graphics.h
index 7b831c5..69a3182 100644
--- a/engines/mohawk/riven_graphics.h
+++ b/engines/mohawk/riven_graphics.h
@@ -68,6 +68,8 @@ public:
void drawExtrasImage(uint16 id, const Common::Rect &dstRect);
void drawExtrasImageToScreen(uint16 id, const Common::Rect &rect);
+ void copySurfaceToScreen(Graphics::Surface *src, uint32 x, uint32 y);
+
/** Copy a rect from the system screen to the game screen */
void copySystemRectToScreen(const Common::Rect &rect);
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index 67b416c..1c6f330 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -31,6 +31,10 @@
#include "common/translation.h"
+#include "graphics/fonts/ttf.h"
+#include "graphics/font.h"
+#include "graphics/fontman.h"
+
#include "gui/message.h"
namespace Mohawk {
@@ -62,9 +66,52 @@ ASpit::ASpit(MohawkEngine_Riven *vm) :
REGISTER_COMMAND(ASpit, xaexittomain);
}
+static const char *menuItems[] = {
+ "SETUP",
+ "START NEW GAME",
+ "START SAVED GAME",
+ 0
+};
+
void ASpit::xastartupbtnhide(const ArgumentArray &args) {
// The original game hides the start/setup buttons depending on an ini entry.
// It's safe to ignore this command.
+
+ warning("xastartupbtnhide");
+
+ Graphics::Surface surface;
+ surface.create(115, 200, _vm->_gfx->getBackScreen()->format);
+ surface.fillRect(Common::Rect(0, 0, 115, 200), 0);
+
+ Common::File file;
+
+ const char *fontname = "FreeSans.ttf";
+ int fontHeight = 11;
+ const Graphics::Font *font = nullptr;
+
+ if (file.open(fontname)) {
+ font = Graphics::loadTTFFont(file, fontHeight);
+ }
+
+ if (!font) {
+ warning("Cannot load font %s directly", fontname);
+ font = FontMan.getFontByName(fontname);
+ }
+
+ if (!font) {
+ warning("Cannot load font %s", fontname);
+
+ font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
+ }
+
+ int y = 70;
+
+ for (const char **item = menuItems; *item; item++) {
+ font->drawString(&surface, *item, 0, y, surface.w, 0xffffff);
+ y += fontHeight * 2.5;
+ }
+
+ _vm->_gfx->copySurfaceToScreen(&surface, 485, 160);
}
void ASpit::xasetupcomplete(const ArgumentArray &args) {
Commit: 2e8d08c1d0d626b1dd9c69c951de07aec7fd4bb4
https://github.com/scummvm/scummvm/commit/2e8d08c1d0d626b1dd9c69c951de07aec7fd4bb4
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Add a save button to the main menu
Changed paths:
engines/mohawk/riven_card.cpp
engines/mohawk/riven_card.h
engines/mohawk/riven_stack.cpp
engines/mohawk/riven_stack.h
engines/mohawk/riven_stacks/aspit.cpp
engines/mohawk/riven_stacks/aspit.h
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index 031a881..d2f8d4f 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -25,6 +25,7 @@
#include "mohawk/cursors.h"
#include "mohawk/riven_graphics.h"
#include "mohawk/riven_stack.h"
+#include "mohawk/riven_stacks/aspit.h"
#include "mohawk/riven_video.h"
#include "mohawk/resource.h"
@@ -81,6 +82,7 @@ void RivenCard::applyPatches(uint16 id) {
}
applyPropertiesPatch22118(globalId);
+ applyPropertiesPatchE2E(globalId);
}
void RivenCard::applyPropertiesPatch8EB7(uint32 globalId) {
@@ -390,6 +392,50 @@ void RivenCard::applyPropertiesPatch22118(uint32 globalId) {
}
}
+void RivenCard::applyPropertiesPatchE2E(uint32 globalId) {
+ // The main menu in the Myst 25th anniversary version is patched to include new items:
+ // - Save game
+ if (globalId == 0xE2E) {
+ uint16 patchData[] = {
+ 24, // blstId
+ 0xFFFF, // name
+ 485, // left
+ 311, // top
+ 602, // right
+ 326, // bottom
+ 0, // u0
+ kRivenMainCursor, // cursor
+ 4, // index
+ 0xFFFF, // transition offset
+ 0, // flags
+ 2, // script count
+
+ kMouseDownScript, // script type
+ 1, // command count
+ kRivenCommandRunExternal, // command type
+ 2, // argument count
+ RivenStacks::ASpit::kExternalSaveGame, // external command name id
+ 0, // external argument count
+
+ kMouseInsideScript, // script type
+ 1, // command count
+ kRivenCommandChangeCursor, // command type
+ 1, // argument count
+ kRivenOpenHandCursor // cursor
+ };
+
+ // Script data is expected to be in big endian
+ for (uint i = 0; i < ARRAYSIZE(patchData); i++) {
+ patchData[i] = TO_BE_16(patchData[i]);
+ }
+
+ // Add the new hotspot to the existing ones
+ Common::MemoryReadStream patchStream((const byte *)(patchData), ARRAYSIZE(patchData) * sizeof(uint16));
+ RivenHotspot *newHotspot = new RivenHotspot(_vm, &patchStream);
+ _hotspots.push_back(newHotspot);
+ }
+}
+
void RivenCard::enter(bool unkMovies) {
setCurrentCardVariable();
diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h
index 2b6a8d4..f285ba1 100644
--- a/engines/mohawk/riven_card.h
+++ b/engines/mohawk/riven_card.h
@@ -192,6 +192,8 @@ private:
Common::Array<MLSTRecord> _movieList;
Common::Array<HotspotEnableRecord> _hotspotEnableList;
Common::Array<WaterEffectRecord> _waterEffectList;
+
+ void applyPropertiesPatchE2E(uint32 globalId);
};
struct MLSTRecord {
diff --git a/engines/mohawk/riven_stack.cpp b/engines/mohawk/riven_stack.cpp
index 7d3d105..2a9fb7f 100644
--- a/engines/mohawk/riven_stack.cpp
+++ b/engines/mohawk/riven_stack.cpp
@@ -101,6 +101,28 @@ int16 RivenStack::getIdFromName(RivenNameResource nameResource, const Common::St
}
}
+void RivenStack::registerName(RivenNameResource nameResource, uint16 nameId, const Common::String &name) {
+ switch (nameResource) {
+ case kVariableNames:
+ _varNames.registerName(nameId, name);
+ break;
+ case kExternalCommandNames:
+ _externalCommandNames.registerName(nameId, name);
+ break;
+ case kStackNames:
+ _stackNames.registerName(nameId, name);
+ break;
+ case kCardNames:
+ _cardNames.registerName(nameId, name);
+ break;
+ case kHotspotNames:
+ _hotspotNames.registerName(nameId, name);
+ break;
+ default:
+ error("Unknown name resource %d", nameResource);
+ }
+}
+
void RivenStack::loadCardIdMap() {
Common::SeekableReadStream *rmapStream = _vm->getResource(ID_RMAP, 1);
@@ -509,6 +531,16 @@ int16 RivenNameList::getNameId(const Common::String &name) const {
return -1;
}
+void RivenNameList::registerName(uint16 nameId, const Common::String &name) {
+ if (nameId >= _names.size()) {
+ _names.resize(nameId + 1);
+ }
+
+ _names[nameId] = name;
+
+ // We don't add the name to _index, getNameId does not work for names added this way
+}
+
namespace RivenStacks {
static const char *names[] = {
"<unknown>",
diff --git a/engines/mohawk/riven_stack.h b/engines/mohawk/riven_stack.h
index 2af63b2..8ab18a5 100644
--- a/engines/mohawk/riven_stack.h
+++ b/engines/mohawk/riven_stack.h
@@ -64,6 +64,14 @@ public:
*/
int16 getNameId(const Common::String &name) const;
+ /**
+ * Add a name id => name mapping
+ *
+ * The implementation of the method is currently limited and
+ * does not allow retrieving an id from the name.
+ */
+ void registerName(uint16 nameId, const Common::String &name);
+
private:
void loadResource(MohawkEngine_Riven *vm, uint16 id);
@@ -114,6 +122,9 @@ public:
*/
int16 getIdFromName(RivenNameResource nameResource, const Common::String &name) const;
+ /** Add a name id => name mapping in a name list */
+ void registerName(RivenNameResource nameResource, uint16 nameId, const Common::String &name);
+
/** Get the id of a card in the card from its global identifier */
uint16 getCardStackId(uint32 globalId) const;
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index 1c6f330..8932212 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -64,13 +64,16 @@ ASpit::ASpit(MohawkEngine_Riven *vm) :
REGISTER_COMMAND(ASpit, xaenablemenuintro);
REGISTER_COMMAND(ASpit, xademoquit);
REGISTER_COMMAND(ASpit, xaexittomain);
+
+ REGISTER_COMMAND(ASpit, xaSaveGame);
+ registerName(kExternalCommandNames, kExternalSaveGame, "xaSaveGame");
}
static const char *menuItems[] = {
"SETUP",
"START NEW GAME",
"START SAVED GAME",
- 0
+ "SAVE GAME"
};
void ASpit::xastartupbtnhide(const ArgumentArray &args) {
@@ -79,10 +82,6 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
warning("xastartupbtnhide");
- Graphics::Surface surface;
- surface.create(115, 200, _vm->_gfx->getBackScreen()->format);
- surface.fillRect(Common::Rect(0, 0, 115, 200), 0);
-
Common::File file;
const char *fontname = "FreeSans.ttf";
@@ -104,14 +103,31 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
}
- int y = 70;
+ struct MenuItem {
+ uint16 blstId;
+ };
- for (const char **item = menuItems; *item; item++) {
- font->drawString(&surface, *item, 0, y, surface.w, 0xffffff);
- y += fontHeight * 2.5;
- }
+ MenuItem items[] = {
+ { 22 },
+ { 16 },
+ { 23 },
+ { 24 }
+ };
+
+ for (uint i = 0; i < ARRAYSIZE(items); i++) {
+ RivenHotspot *hotspot = _vm->getCard()->getHotspotByBlstId(items[i].blstId);
+ Common::Rect hotspotRect = hotspot->getRect();
+
+ Graphics::Surface surface;
+ surface.create(hotspotRect.width(), hotspotRect.height(), _vm->_gfx->getBackScreen()->format);
+
+ uint32 textColor = surface.format.RGBToColor(164, 164, 164);
- _vm->_gfx->copySurfaceToScreen(&surface, 485, 160);
+ font->drawString(&surface, menuItems[i], 0, 0, surface.w, textColor);
+
+ _vm->_gfx->copySurfaceToScreen(&surface, hotspotRect.left, hotspotRect.top);
+ surface.free();
+ }
}
void ASpit::xasetupcomplete(const ArgumentArray &args) {
@@ -324,6 +340,11 @@ void ASpit::xarestoregame(const ArgumentArray &args) {
_vm->runLoadDialog();
}
+void ASpit::xaSaveGame(const ArgumentArray &args) {
+ // Launch the load game dialog
+ _vm->runSaveDialog();
+}
+
void ASpit::xadisablemenureturn(const ArgumentArray &args) {
// This function would normally enable the Windows menu item for
// returning to the main menu. Ctrl+r will do this instead.
diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h
index b2e5301d..75b9fd3 100644
--- a/engines/mohawk/riven_stacks/aspit.h
+++ b/engines/mohawk/riven_stacks/aspit.h
@@ -35,6 +35,10 @@ class ASpit : public RivenStack {
public:
ASpit(MohawkEngine_Riven *vm);
+ enum PatchedExternalCommandNameId {
+ kExternalSaveGame = 20
+ };
+
// External commands - Main Menu
void xastartupbtnhide(const ArgumentArray &args);
void xasetupcomplete(const ArgumentArray &args);
@@ -59,6 +63,9 @@ public:
// External commands - DVD-specific
void xarestoregame(const ArgumentArray &args);
+ // External commands - ScummVM 25th anniversary specific
+ void xaSaveGame(const ArgumentArray &args);
+
// External commands - Demo-specific
void xadisablemenureturn(const ArgumentArray &args);
void xaenablemenureturn(const ArgumentArray &args);
Commit: db359f0f0e496d3373b3b2f3a747aaabf5fc0498
https://github.com/scummvm/scummvm/commit/db359f0f0e496d3373b3b2f3a747aaabf5fc0498
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Fix crash for German Riven
Changed paths:
engines/mohawk/riven_stacks/aspit.cpp
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index 8932212..cba7d40 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -116,6 +116,12 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
for (uint i = 0; i < ARRAYSIZE(items); i++) {
RivenHotspot *hotspot = _vm->getCard()->getHotspotByBlstId(items[i].blstId);
+
+ if (!hotspot) {
+ warning("Missing hotspot %d", items[i].blstId);
+ continue;
+ }
+
Common::Rect hotspotRect = hotspot->getRect();
Graphics::Surface surface;
Commit: 23c889db4473815686cf5410662a0e32ae68abeb
https://github.com/scummvm/scummvm/commit/23c889db4473815686cf5410662a0e32ae68abeb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Localize menus
Changed paths:
engines/mohawk/riven_stacks/aspit.cpp
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index cba7d40..c4ae096 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -69,11 +69,19 @@ ASpit::ASpit(MohawkEngine_Riven *vm) :
registerName(kExternalCommandNames, kExternalSaveGame, "xaSaveGame");
}
-static const char *menuItems[] = {
- "SETUP",
- "START NEW GAME",
- "START SAVED GAME",
- "SAVE GAME"
+struct MenuItemText {
+ int language;
+ const char *items[4];
+} static const menuItems[] = {
+ { Common::EN_ANY, { "SETUP", "START NEW GAME", "START SAVED GAME", "SAVE GAME" } },
+ { Common::DE_DEU, { "SETUP", "SPIELEN", "SPIELSTAND LADEN", "SPIEL SPEICHERN" } },
+ { Common::ES_ESP, { "IMAGEN", "IR A RIVEN", "CARGAR JUEGO", "GUARDAR JUEGO" } },
+ { Common::FR_FRA, { "CONFIG", "JOUER RIVEN", "CHARGEMENT DU JEU", "JEU SAUVEGARDER" } },
+ { Common::IT_ITA, { "CONF.", "GIOCA", "CARICA GIOCO", "SALVA IL GIOCO" } },
+ { Common::RU_RUS, { "УСТАНОВКИ", "СТАРТ", "ПРОДОЛЖИТЬ ИГРУ", "СОХРАНИТЬ ИГРУ" } },
+ { Common::JA_JPN, { "SETUP", "PLAY RIVEN", "START SAVED GAME", "SAVE GAME" } },
+ { Common::PL_POL, { "USTAWIENIA", "GRAJ W RIVEN", "ZAŁADUJ GRĘ", "ZAPISZ GRĘ" } },
+ { -1, { 0 } }
};
void ASpit::xastartupbtnhide(const ArgumentArray &args) {
@@ -103,6 +111,19 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
}
+ int lang = -1;
+ for (int i = 0; menuItems[i].language != -1; i++) {
+ if (menuItems[i].language == _vm->getLanguage()) {
+ lang = i;
+ break;
+ }
+ }
+
+ if (lang == -1) {
+ warning("Unsupported menu language, falling back to English");
+ lang = 0;
+ }
+
struct MenuItem {
uint16 blstId;
};
@@ -129,7 +150,9 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
uint32 textColor = surface.format.RGBToColor(164, 164, 164);
- font->drawString(&surface, menuItems[i], 0, 0, surface.w, textColor);
+ Common::U32String str = Common::convertUtf8ToUtf32(menuItems[lang].items[i]);
+
+ font->drawString(&surface, str, 0, 0, surface.w, textColor);
_vm->_gfx->copySurfaceToScreen(&surface, hotspotRect.left, hotspotRect.top);
surface.free();
Commit: 86e0089cc6233964ca8ac858f627e0572078b199
https://github.com/scummvm/scummvm/commit/86e0089cc6233964ca8ac858f627e0572078b199
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Patch in the load menu for the game versions missing it
Changed paths:
engines/mohawk/riven_card.cpp
engines/mohawk/riven_card.h
engines/mohawk/riven_stacks/aspit.cpp
engines/mohawk/riven_stacks/aspit.h
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index d2f8d4f..ffbbc69 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -396,44 +396,63 @@ void RivenCard::applyPropertiesPatchE2E(uint32 globalId) {
// The main menu in the Myst 25th anniversary version is patched to include new items:
// - Save game
if (globalId == 0xE2E) {
- uint16 patchData[] = {
- 24, // blstId
- 0xFFFF, // name
- 485, // left
- 311, // top
- 602, // right
- 326, // bottom
- 0, // u0
- kRivenMainCursor, // cursor
- 4, // index
- 0xFFFF, // transition offset
- 0, // flags
- 2, // script count
-
- kMouseDownScript, // script type
- 1, // command count
- kRivenCommandRunExternal, // command type
- 2, // argument count
- RivenStacks::ASpit::kExternalSaveGame, // external command name id
- 0, // external argument count
-
- kMouseInsideScript, // script type
- 1, // command count
- kRivenCommandChangeCursor, // command type
- 1, // argument count
- kRivenOpenHandCursor // cursor
+ addMenuHotspot(23, Common::Rect(485, 283, 602, 300), 3, RivenStacks::ASpit::kExternalRestoreGame, "xarestoregame");
+ addMenuHotspot(24, Common::Rect(485, 311, 602, 326), 4, RivenStacks::ASpit::kExternalSaveGame, "xaSaveGame");
+ }
+}
+
+void RivenCard::addMenuHotspot(uint16 blstId, const Common::Rect &position, uint16 index,
+ uint16 externalCommandNameId, const char *externalCommandName) {
+ RivenHotspot *existingHotspot = getHotspotByBlstId(blstId);
+ if (existingHotspot) {
+ return; // Don't add the hotspot if it already exists
+ }
+
+ // Add the external command id => name mapping if it is missing
+ int16 existingCommandNameId = _vm->getStack()->getIdFromName(kExternalCommandNames, externalCommandName);
+ if (existingCommandNameId < 0) {
+ _vm->getStack()->registerName(kExternalCommandNames, externalCommandNameId, externalCommandName);
+ } else {
+ externalCommandNameId = existingCommandNameId;
+ }
+
+ uint16 patchData[] = {
+ blstId,
+ 0xFFFF, // name
+ (uint16) position.left,
+ (uint16) position.top,
+ (uint16) position.right,
+ (uint16) position.bottom,
+ 0, // u0
+ kRivenMainCursor, // cursor
+ index,
+ 0xFFFF, // transition offset
+ 0, // flags
+ 2, // script count
+
+ kMouseDownScript, // script type
+ 1, // command count
+ kRivenCommandRunExternal, // command type
+ 2, // argument count
+ externalCommandNameId,
+ 0, // external argument count
+
+ kMouseInsideScript, // script type
+ 1, // command count
+ kRivenCommandChangeCursor, // command type
+ 1, // argument count
+ kRivenOpenHandCursor // cursor
};
- // Script data is expected to be in big endian
- for (uint i = 0; i < ARRAYSIZE(patchData); i++) {
+ // Script data is expected to be in big endian
+ for (uint i = 0; i < ARRAYSIZE(patchData); i++) {
patchData[i] = TO_BE_16(patchData[i]);
}
- // Add the new hotspot to the existing ones
- Common::MemoryReadStream patchStream((const byte *)(patchData), ARRAYSIZE(patchData) * sizeof(uint16));
- RivenHotspot *newHotspot = new RivenHotspot(_vm, &patchStream);
- _hotspots.push_back(newHotspot);
- }
+ // Add the new hotspot to the existing ones
+ Common::MemoryReadStream patchStream((const byte *)(patchData), ARRAYSIZE(patchData) * sizeof(uint16));
+ RivenHotspot *newHotspot = new RivenHotspot(_vm, &patchStream);
+ _hotspots.push_back(newHotspot);
}
void RivenCard::enter(bool unkMovies) {
diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h
index f285ba1..acf20fa 100644
--- a/engines/mohawk/riven_card.h
+++ b/engines/mohawk/riven_card.h
@@ -152,11 +152,15 @@ private:
void loadCardHotspotEnableList(uint16 id);
void loadCardWaterEffectList(uint16 id);
void applyPatches(uint16 id);
+ void applyPropertiesPatchE2E(uint32 globalId);
void applyPropertiesPatch8EB7(uint32 globalId);
void applyPropertiesPatch2E76(uint32 globalId);
void applyPropertiesPatch22118(uint32 globalId);
void setCurrentCardVariable();
+ void addMenuHotspot(uint16 blstId, const Common::Rect &position, uint16 index,
+ uint16 externalCommandNameId, const char *externalCommandName);
+
RivenScriptPtr getScript(uint16 scriptType) const;
void defaultLoadScript();
@@ -193,7 +197,6 @@ private:
Common::Array<HotspotEnableRecord> _hotspotEnableList;
Common::Array<WaterEffectRecord> _waterEffectList;
- void applyPropertiesPatchE2E(uint32 globalId);
};
struct MLSTRecord {
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index c4ae096..de5747c 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -66,7 +66,6 @@ ASpit::ASpit(MohawkEngine_Riven *vm) :
REGISTER_COMMAND(ASpit, xaexittomain);
REGISTER_COMMAND(ASpit, xaSaveGame);
- registerName(kExternalCommandNames, kExternalSaveGame, "xaSaveGame");
}
struct MenuItemText {
diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h
index 75b9fd3..ba6f3c3 100644
--- a/engines/mohawk/riven_stacks/aspit.h
+++ b/engines/mohawk/riven_stacks/aspit.h
@@ -36,7 +36,8 @@ public:
ASpit(MohawkEngine_Riven *vm);
enum PatchedExternalCommandNameId {
- kExternalSaveGame = 20
+ kExternalSaveGame = 20,
+ kExternalRestoreGame = 21
};
// External commands - Main Menu
Commit: dc93e5bb6a220773add19bd0eb04f0ffca685279
https://github.com/scummvm/scummvm/commit/dc93e5bb6a220773add19bd0eb04f0ffca685279
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Add more options to the main menu
Changed paths:
engines/mohawk/riven.cpp
engines/mohawk/riven.h
engines/mohawk/riven_card.cpp
engines/mohawk/riven_card.h
engines/mohawk/riven_stacks/aspit.cpp
engines/mohawk/riven_stacks/aspit.h
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 1a2e0c3..7a8dcbe 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -243,19 +243,7 @@ void MohawkEngine_Riven::doFrame() {
pauseGame();
break;
case Common::KEYCODE_F5:
- runDialog(*_optionsDialog);
- if (_optionsDialog->getLoadSlot() >= 0)
- loadGameStateAndDisplayError(_optionsDialog->getLoadSlot());
- if (_optionsDialog->getSaveSlot() >= 0)
- saveGameStateAndDisplayError(_optionsDialog->getSaveSlot(), _optionsDialog->getSaveDescription());
-
- if (hasGameEnded()) {
- // Attempt to autosave before exiting
- tryAutoSaving();
- }
-
- _gfx->setTransitionMode((RivenTransitionMode) _vars["transitionmode"]);
- _card->initializeZipMode();
+ runOptionsDialog();
break;
case Common::KEYCODE_r:
// Return to the main menu in the demo on ctrl+r
@@ -703,6 +691,22 @@ void MohawkEngine_Riven::setGameEnded() {
_gameEnded = true;
}
+void MohawkEngine_Riven::runOptionsDialog() {
+ runDialog(*_optionsDialog);
+ if (_optionsDialog->getLoadSlot() >= 0)
+ loadGameStateAndDisplayError(_optionsDialog->getLoadSlot());
+ if (_optionsDialog->getSaveSlot() >= 0)
+ saveGameStateAndDisplayError(_optionsDialog->getSaveSlot(), _optionsDialog->getSaveDescription());
+
+ if (hasGameEnded()) {
+ // Attempt to autosave before exiting
+ tryAutoSaving();
+ }
+
+ _gfx->setTransitionMode((RivenTransitionMode) _vars["transitionmode"]);
+ _card->initializeZipMode();
+}
+
bool ZipMode::operator== (const ZipMode &z) const {
return z.name == name && z.id == id;
}
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 1cddd32..74cbcd1 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -151,6 +151,7 @@ public:
bool _activatedPLST;
bool _activatedSLST;
void delay(uint32 ms);
+ void runOptionsDialog();
// Save / Load
void runLoadDialog();
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index ffbbc69..304f596 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -396,15 +396,31 @@ void RivenCard::applyPropertiesPatchE2E(uint32 globalId) {
// The main menu in the Myst 25th anniversary version is patched to include new items:
// - Save game
if (globalId == 0xE2E) {
- addMenuHotspot(23, Common::Rect(485, 283, 602, 300), 3, RivenStacks::ASpit::kExternalRestoreGame, "xarestoregame");
- addMenuHotspot(24, Common::Rect(485, 311, 602, 326), 4, RivenStacks::ASpit::kExternalSaveGame, "xaSaveGame");
+ moveHotspot( 22, Common::Rect(485, 175, 602, 190)); // Setup
+ moveHotspot( 16, Common::Rect(485, 201, 602, 216)); // New game
+ addMenuHotspot(23, Common::Rect(485, 227, 602, 242), 3, RivenStacks::ASpit::kExternalRestoreGame, "xarestoregame");
+ addMenuHotspot(24, Common::Rect(485, 256, 602, 271), 4, RivenStacks::ASpit::kExternalSaveGame, "xaSaveGame");
+ addMenuHotspot(25, Common::Rect(485, 283, 602, 300), 5, RivenStacks::ASpit::kExternalResume, "xaResumeGame");
+ addMenuHotspot(26, Common::Rect(485, 309, 602, 326), 6, RivenStacks::ASpit::kExternalOptions, "xaOptions");
+ addMenuHotspot(27, Common::Rect(485, 335, 602, 352), 7, RivenStacks::ASpit::kExternalQuit, "xademoquit");
}
}
+void RivenCard::moveHotspot(uint16 blstId, const Common::Rect &position) {
+ RivenHotspot *hotspot = getHotspotByBlstId(blstId);
+ if (!hotspot) {
+ warning("Could not find hotspot with blstId %d", blstId);
+ return;
+ }
+
+ hotspot->setRect(position);
+}
+
void RivenCard::addMenuHotspot(uint16 blstId, const Common::Rect &position, uint16 index,
uint16 externalCommandNameId, const char *externalCommandName) {
RivenHotspot *existingHotspot = getHotspotByBlstId(blstId);
if (existingHotspot) {
+ moveHotspot(blstId, position);
return; // Don't add the hotspot if it already exists
}
diff --git a/engines/mohawk/riven_card.h b/engines/mohawk/riven_card.h
index acf20fa..5eae4c0 100644
--- a/engines/mohawk/riven_card.h
+++ b/engines/mohawk/riven_card.h
@@ -158,6 +158,7 @@ private:
void applyPropertiesPatch22118(uint32 globalId);
void setCurrentCardVariable();
+ void moveHotspot(uint16 blstId, const Common::Rect &position);
void addMenuHotspot(uint16 blstId, const Common::Rect &position, uint16 index,
uint16 externalCommandNameId, const char *externalCommandName);
@@ -196,7 +197,6 @@ private:
Common::Array<MLSTRecord> _movieList;
Common::Array<HotspotEnableRecord> _hotspotEnableList;
Common::Array<WaterEffectRecord> _waterEffectList;
-
};
struct MLSTRecord {
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index de5747c..ae346cd 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -66,20 +66,22 @@ ASpit::ASpit(MohawkEngine_Riven *vm) :
REGISTER_COMMAND(ASpit, xaexittomain);
REGISTER_COMMAND(ASpit, xaSaveGame);
+ REGISTER_COMMAND(ASpit, xaResumeGame);
+ REGISTER_COMMAND(ASpit, xaOptions);
}
struct MenuItemText {
int language;
- const char *items[4];
+ const char *items[7];
} static const menuItems[] = {
- { Common::EN_ANY, { "SETUP", "START NEW GAME", "START SAVED GAME", "SAVE GAME" } },
- { Common::DE_DEU, { "SETUP", "SPIELEN", "SPIELSTAND LADEN", "SPIEL SPEICHERN" } },
- { Common::ES_ESP, { "IMAGEN", "IR A RIVEN", "CARGAR JUEGO", "GUARDAR JUEGO" } },
- { Common::FR_FRA, { "CONFIG", "JOUER RIVEN", "CHARGEMENT DU JEU", "JEU SAUVEGARDER" } },
- { Common::IT_ITA, { "CONF.", "GIOCA", "CARICA GIOCO", "SALVA IL GIOCO" } },
- { Common::RU_RUS, { "УСТАНОВКИ", "СТАРТ", "ПРОДОЛЖИТЬ ИГРУ", "СОХРАНИТЬ ИГРУ" } },
- { Common::JA_JPN, { "SETUP", "PLAY RIVEN", "START SAVED GAME", "SAVE GAME" } },
- { Common::PL_POL, { "USTAWIENIA", "GRAJ W RIVEN", "ZAŁADUJ GRĘ", "ZAPISZ GRĘ" } },
+ { Common::EN_ANY, { "SETUP", "START NEW GAME", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::DE_DEU, { "SETUP", "SPIELEN", "SPIELSTAND LADEN", "SPIEL SPEICHERN", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::ES_ESP, { "IMAGEN", "IR A RIVEN", "CARGAR JUEGO", "GUARDAR JUEGO", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::FR_FRA, { "CONFIG", "JOUER RIVEN", "CHARGEMENT DU JEU", "JEU SAUVEGARDER", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::IT_ITA, { "CONF.", "GIOCA", "CARICA GIOCO", "SALVA IL GIOCO", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::RU_RUS, { "УСТАНОВКИ", "СТАРТ", "ПРОДОЛЖИТЬ ИГРУ", "СОХРАНИТЬ ИГРУ", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::JA_JPN, { "SETUP", "PLAY RIVEN", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::PL_POL, { "USTAWIENIA", "GRAJ W RIVEN", "ZAŁADUJ GRĘ", "ZAPISZ GRĘ", "RESUME", "OPTIONS", "QUIT" } },
{ -1, { 0 } }
};
@@ -87,8 +89,6 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
// The original game hides the start/setup buttons depending on an ini entry.
// It's safe to ignore this command.
- warning("xastartupbtnhide");
-
Common::File file;
const char *fontname = "FreeSans.ttf";
@@ -131,7 +131,10 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
{ 22 },
{ 16 },
{ 23 },
- { 24 }
+ { 24 },
+ { 25 },
+ { 26 },
+ { 27 }
};
for (uint i = 0; i < ARRAYSIZE(items); i++) {
@@ -373,6 +376,14 @@ void ASpit::xaSaveGame(const ArgumentArray &args) {
_vm->runSaveDialog();
}
+void ASpit::xaResumeGame(const ArgumentArray &args) {
+
+}
+
+void ASpit::xaOptions(const ArgumentArray &args) {
+ _vm->runOptionsDialog();
+}
+
void ASpit::xadisablemenureturn(const ArgumentArray &args) {
// This function would normally enable the Windows menu item for
// returning to the main menu. Ctrl+r will do this instead.
diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h
index ba6f3c3..3ab02d7 100644
--- a/engines/mohawk/riven_stacks/aspit.h
+++ b/engines/mohawk/riven_stacks/aspit.h
@@ -37,7 +37,11 @@ public:
enum PatchedExternalCommandNameId {
kExternalSaveGame = 20,
- kExternalRestoreGame = 21
+ kExternalRestoreGame = 21,
+ kExternalResume = 22,
+ kExternalOptions = 23,
+ kExternalQuit = 24
+
};
// External commands - Main Menu
@@ -66,6 +70,8 @@ public:
// External commands - ScummVM 25th anniversary specific
void xaSaveGame(const ArgumentArray &args);
+ void xaResumeGame(const ArgumentArray &args);
+ void xaOptions(const ArgumentArray &args);
// External commands - Demo-specific
void xadisablemenureturn(const ArgumentArray &args);
Commit: 4b900cc432cf1640d65a6f3b588d9582140ae824
https://github.com/scummvm/scummvm/commit/4b900cc432cf1640d65a6f3b588d9582140ae824
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Remove the load/save/quit buttons from the options dialog
Those features can now be accessed through the main menu
Changed paths:
engines/mohawk/dialogs.cpp
engines/mohawk/dialogs.h
engines/mohawk/riven.cpp
diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp
index 252ad2d..31997f4 100644
--- a/engines/mohawk/dialogs.cpp
+++ b/engines/mohawk/dialogs.cpp
@@ -95,56 +95,12 @@ enum {
MohawkOptionsDialog::MohawkOptionsDialog(MohawkEngine *vm) :
GUI::Dialog(0, 0, 360, 200),
- _vm(vm), _loadSlot(-1), _saveSlot(-1) {
- _loadButton = new GUI::ButtonWidget(this, 245, 25, 100, 25, _("~L~oad"), nullptr, kLoadCmd);
- _saveButton = new GUI::ButtonWidget(this, 245, 60, 100, 25, _("~S~ave"), nullptr, kSaveCmd);
- _quitButton = new GUI::ButtonWidget(this, 245, 95, 100, 25, _("~Q~uit"), nullptr, kQuitCmd);
-
+ _vm(vm) {
new GUI::ButtonWidget(this, 95, 160, 120, 25, _("~O~K"), nullptr, GUI::kOKCmd);
new GUI::ButtonWidget(this, 225, 160, 120, 25, _("~C~ancel"), nullptr, GUI::kCloseCmd);
-
- _loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), false);
- _saveDialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
}
MohawkOptionsDialog::~MohawkOptionsDialog() {
- delete _loadDialog;
- delete _saveDialog;
-}
-
-void MohawkOptionsDialog::open() {
- GUI::Dialog::open();
-
- _loadSlot = -1;
- _saveSlot = -1;
- _loadButton->setEnabled(_vm->canLoadGameStateCurrently());
- _saveButton->setEnabled(_vm->canSaveGameStateCurrently());
-}
-
-
-void MohawkOptionsDialog::save() {
- _saveSlot = _saveDialog->runModalWithCurrentTarget();
-
- if (_saveSlot >= 0) {
- _saveDescription = _saveDialog->getResultString();
- if (_saveDescription.empty()) {
- // If the user was lazy and entered no save name, come up with a default name.
- _saveDescription = _saveDialog->createDefaultSaveDescription(_saveSlot);
- }
-
- close();
- }
-}
-
-void MohawkOptionsDialog::load() {
- // Do not load the game state from insite the dialog loop to
- // avoid mouse cursor glitches (see bug #7164). Instead store
- // the slot to load and let the code exectuting the dialog do
- // the load after the dialog finished running.
- _loadSlot = _loadDialog->runModalWithCurrentTarget();
-
- if (_loadSlot >= 0)
- close();
}
void MohawkOptionsDialog::reflowLayout() {
@@ -161,12 +117,6 @@ void MohawkOptionsDialog::reflowLayout() {
void MohawkOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
- case kLoadCmd:
- load();
- break;
- case kSaveCmd:
- save();
- break;
case GUI::kCloseCmd:
close();
break;
@@ -184,7 +134,13 @@ MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) :
_vm(vm),
_canDropPage(false),
_canShowMap(false),
- _canReturnToMenu(false) {
+ _canReturnToMenu(false),
+ _loadSlot(-1),
+ _saveSlot(-1) {
+
+ _loadButton = new GUI::ButtonWidget(this, 245, 25, 100, 25, _("~L~oad"), nullptr, kLoadCmd);
+ _saveButton = new GUI::ButtonWidget(this, 245, 60, 100, 25, _("~S~ave"), nullptr, kSaveCmd);
+ _quitButton = new GUI::ButtonWidget(this, 245, 95, 100, 25, _("~Q~uit"), nullptr, kQuitCmd);
// I18N: Option for fast scene switching
_zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 220, 15, _("~Z~ip Mode Activated"), nullptr, kZipCmd);
@@ -203,9 +159,14 @@ MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) :
_returnToMenuButton = new GUI::ButtonWidget(this, 15, 95, 100, 25, _("Main Men~u~"), nullptr, kMenuCmd);
else
_returnToMenuButton = nullptr;
+
+ _loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"), false);
+ _saveDialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
}
MystOptionsDialog::~MystOptionsDialog() {
+ delete _loadDialog;
+ delete _saveDialog;
}
void MystOptionsDialog::open() {
@@ -235,10 +196,46 @@ void MystOptionsDialog::open() {
_saveButton->setVisible(false);
_quitButton->setVisible(false);
}
+
+ _loadSlot = -1;
+ _saveSlot = -1;
+ _loadButton->setEnabled(_vm->canLoadGameStateCurrently());
+ _saveButton->setEnabled(_vm->canSaveGameStateCurrently());
+}
+
+void MystOptionsDialog::save() {
+ _saveSlot = _saveDialog->runModalWithCurrentTarget();
+
+ if (_saveSlot >= 0) {
+ _saveDescription = _saveDialog->getResultString();
+ if (_saveDescription.empty()) {
+ // If the user was lazy and entered no save name, come up with a default name.
+ _saveDescription = _saveDialog->createDefaultSaveDescription(_saveSlot);
+ }
+
+ close();
+ }
+}
+
+void MystOptionsDialog::load() {
+ // Do not load the game state from insite the dialog loop to
+ // avoid mouse cursor glitches (see bug #7164). Instead store
+ // the slot to load and let the code exectuting the dialog do
+ // the load after the dialog finished running.
+ _loadSlot = _loadDialog->runModalWithCurrentTarget();
+
+ if (_loadSlot >= 0)
+ close();
}
void MystOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
+ case kLoadCmd:
+ load();
+ break;
+ case kSaveCmd:
+ save();
+ break;
case kDropCmd:
setResult(kActionDropPage);
close();
@@ -287,10 +284,10 @@ RivenOptionsDialog::RivenOptionsDialog(MohawkEngine_Riven* vm) :
MohawkOptionsDialog(vm),
_vm(vm) {
_zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 220, 15, _("~Z~ip Mode Activated"), nullptr, kZipCmd);
- _waterEffectCheckbox = new GUI::CheckboxWidget(this, 15, 30, 220, 15, _("~W~ater Effect Enabled"), nullptr, kWaterCmd);
+ _waterEffectCheckbox = new GUI::CheckboxWidget(this, 15, 35, 220, 15, _("~W~ater Effect Enabled"), nullptr, kWaterCmd);
- _transitionModeCaption = new GUI::StaticTextWidget(this, 15, 50, 90, 20, _("Transitions:"), Graphics::kTextAlignRight);
- _transitionModePopUp = new GUI::PopUpWidget(this, 115, 50, 120, 20);
+ _transitionModeCaption = new GUI::StaticTextWidget(this, 15, 60, 90, 20, _("Transitions:"), Graphics::kTextAlignRight);
+ _transitionModePopUp = new GUI::PopUpWidget(this, 115, 60, 120, 20);
_transitionModePopUp->appendEntry(_("Disabled"), kRivenTransitionModeDisabled);
_transitionModePopUp->appendEntry(_("Fastest"), kRivenTransitionModeFastest);
_transitionModePopUp->appendEntry(_("Normal"), kRivenTransitionModeNormal);
@@ -317,13 +314,6 @@ void RivenOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, u
setResult(1);
close();
break;
- case kQuitCmd: {
- Common::Event eventQ;
- eventQ.type = Common::EVENT_QUIT;
- g_system->getEventManager()->pushEvent(eventQ);
- close();
- break;
- }
default:
MohawkOptionsDialog::handleCommand(sender, cmd, data);
}
diff --git a/engines/mohawk/dialogs.h b/engines/mohawk/dialogs.h
index 567a0fc..71cf7a2 100644
--- a/engines/mohawk/dialogs.h
+++ b/engines/mohawk/dialogs.h
@@ -79,30 +79,11 @@ public:
explicit MohawkOptionsDialog(MohawkEngine *_vm);
~MohawkOptionsDialog() override;
- void open() override;
void reflowLayout() override;
void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
- int getLoadSlot() const { return _loadSlot; }
- int getSaveSlot() const { return _saveSlot; }
- Common::String getSaveDescription() const { return _saveDescription; }
-
-protected:
+private:
MohawkEngine *_vm;
-
- GUI::ButtonWidget *_loadButton;
- GUI::ButtonWidget *_saveButton;
- GUI::ButtonWidget *_quitButton;
-
- GUI::SaveLoadChooser *_loadDialog;
- GUI::SaveLoadChooser *_saveDialog;
-
- int _loadSlot;
- int _saveSlot;
- Common::String _saveDescription;
-
- void save();
- void load();
};
#endif
@@ -131,9 +112,27 @@ public:
void open() override;
void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
+ int getLoadSlot() const { return _loadSlot; }
+ int getSaveSlot() const { return _saveSlot; }
+ Common::String getSaveDescription() const { return _saveDescription; }
+
private:
+ void save();
+ void load();
+
MohawkEngine_Myst *_vm;
+ GUI::ButtonWidget *_loadButton;
+ GUI::ButtonWidget *_saveButton;
+ GUI::ButtonWidget *_quitButton;
+
+ GUI::SaveLoadChooser *_loadDialog;
+ GUI::SaveLoadChooser *_saveDialog;
+
+ int _loadSlot;
+ int _saveSlot;
+ Common::String _saveDescription;
+
bool _canDropPage;
bool _canShowMap;
bool _canReturnToMenu;
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 7a8dcbe..eaf0794 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -693,10 +693,6 @@ void MohawkEngine_Riven::setGameEnded() {
void MohawkEngine_Riven::runOptionsDialog() {
runDialog(*_optionsDialog);
- if (_optionsDialog->getLoadSlot() >= 0)
- loadGameStateAndDisplayError(_optionsDialog->getLoadSlot());
- if (_optionsDialog->getSaveSlot() >= 0)
- saveGameStateAndDisplayError(_optionsDialog->getSaveSlot(), _optionsDialog->getSaveDescription());
if (hasGameEnded()) {
// Attempt to autosave before exiting
Commit: 2f9c9a2c324b27e21f4bb249cc1a89c46f1e353c
https://github.com/scummvm/scummvm/commit/2f9c9a2c324b27e21f4bb249cc1a89c46f1e353c
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Fix compilation without Riven
Changed paths:
engines/mohawk/riven_stacks/aspit.cpp
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index ae346cd..9c8ffc2 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -92,12 +92,14 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
Common::File file;
const char *fontname = "FreeSans.ttf";
- int fontHeight = 11;
const Graphics::Font *font = nullptr;
+#if defined(USE_FREETYPE2)
+ int fontHeight = 11;
if (file.open(fontname)) {
font = Graphics::loadTTFFont(file, fontHeight);
}
+#endif
if (!font) {
warning("Cannot load font %s directly", fontname);
Commit: d848ebe85a2954263219ae64fd5183129dc74df6
https://github.com/scummvm/scummvm/commit/d848ebe85a2954263219ae64fd5183129dc74df6
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Fix loading and resuming from the main menu
Changed paths:
engines/mohawk/riven.cpp
engines/mohawk/riven.h
engines/mohawk/riven_stacks/aspit.cpp
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index eaf0794..69a06ac 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -279,23 +279,9 @@ void MohawkEngine_Riven::doFrame() {
if (!_scriptMan->hasQueuedScripts()) {
// Check if we haven't jumped to menu
if (_prevStack == -1) {
- _prevStack = _stack->getId();
- _prevCard = _card->getId();
-
- // If we are already in menu, do not call again
- if (_prevStack == kStackAspit && _prevCard == 1) {
- _prevStack = -1;
- _prevCard = -1;
- break;
- }
-
- changeToStack(kStackAspit);
- changeToCard(1);
+ goToMainMenu();
} else {
- changeToStack(_prevStack);
- changeToCard(_prevCard);
- _prevStack = -1;
- _prevCard = -1;
+ resumeFromMainMenu();
}
} else {
_stack->onKeyPressed(event.kbd);
@@ -340,6 +326,34 @@ void MohawkEngine_Riven::doFrame() {
_system->delayMillis(10);
}
+void MohawkEngine_Riven::goToMainMenu() {
+ _prevStack = _stack->getId();
+ _prevCard = _card->getId();
+
+ // If we are already in menu, do not call again
+ if (_prevStack == kStackAspit && _prevCard == 1) {
+ _prevStack = -1;
+ _prevCard = -1;
+ return;
+ }
+
+ changeToStack(kStackAspit);
+ changeToCard(1);
+}
+
+void MohawkEngine_Riven::resumeFromMainMenu() {
+ assert(_prevStack != -1);
+
+ changeToStack(_prevStack);
+ changeToCard(_prevCard);
+ _prevStack = -1;
+ _prevCard = -1;
+}
+
+bool MohawkEngine_Riven::isGameStarted() const {
+ return _stack->getId() != kStackAspit || _prevStack != -1;
+}
+
void MohawkEngine_Riven::pauseEngineIntern(bool pause) {
MohawkEngine::pauseEngineIntern(pause);
@@ -597,7 +611,14 @@ void MohawkEngine_Riven::runSaveDialog() {
}
Common::Error MohawkEngine_Riven::loadGameState(int slot) {
- return _saveLoad->loadGame(slot);
+ Common::Error loadError = _saveLoad->loadGame(slot);
+
+ if (loadError.getCode() == Common::kNoError) {
+ _prevStack = -1;
+ _prevCard = -1;
+ }
+
+ return loadError;
}
void MohawkEngine_Riven::loadGameStateAndDisplayError(int slot) {
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 74cbcd1..dd26f51 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -169,6 +169,11 @@ public:
* End the game gracefully
*/
void setGameEnded();
+
+ // Main menu handling
+ void goToMainMenu();
+ void resumeFromMainMenu();
+ bool isGameStarted() const;
};
} // End of namespace Mohawk
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index 9c8ffc2..b72ba01 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -127,16 +127,17 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
struct MenuItem {
uint16 blstId;
+ bool requiresStartedGame;
};
MenuItem items[] = {
- { 22 },
- { 16 },
- { 23 },
- { 24 },
- { 25 },
- { 26 },
- { 27 }
+ { 22, false }, // Setup
+ { 16, false }, // New game
+ { 23, false }, // Load game
+ { 24, true }, // Save game
+ { 25, true }, // Resume
+ { 26, false }, // Options
+ { 27, false } // Quit
};
for (uint i = 0; i < ARRAYSIZE(items); i++) {
@@ -147,12 +148,20 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
continue;
}
+ bool enabled = !items[i].requiresStartedGame || _vm->isGameStarted();
+ hotspot->enable(enabled);
+
Common::Rect hotspotRect = hotspot->getRect();
Graphics::Surface surface;
surface.create(hotspotRect.width(), hotspotRect.height(), _vm->_gfx->getBackScreen()->format);
- uint32 textColor = surface.format.RGBToColor(164, 164, 164);
+ uint32 textColor;
+ if (enabled) {
+ textColor = surface.format.RGBToColor(164, 164, 164);
+ } else {
+ textColor = surface.format.RGBToColor(96, 96, 96);
+ }
Common::U32String str = Common::convertUtf8ToUtf32(menuItems[lang].items[i]);
@@ -374,12 +383,11 @@ void ASpit::xarestoregame(const ArgumentArray &args) {
}
void ASpit::xaSaveGame(const ArgumentArray &args) {
- // Launch the load game dialog
_vm->runSaveDialog();
}
void ASpit::xaResumeGame(const ArgumentArray &args) {
-
+ _vm->resumeFromMainMenu();
}
void ASpit::xaOptions(const ArgumentArray &args) {
Commit: a722fe119429f9a8a2ad4078288a07418af20ec6
https://github.com/scummvm/scummvm/commit/a722fe119429f9a8a2ad4078288a07418af20ec6
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Fix saving while in the menu
Changed paths:
engines/mohawk/riven.cpp
engines/mohawk/riven.h
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 69a06ac..6e38612 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -73,8 +73,8 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio
_inventory = nullptr;
_lastSaveTime = 0;
- _prevCard = -1;
- _prevStack = -1;
+ _menuSavedCard = -1;
+ _menuSavedStack = -1;
DebugMan.addDebugChannel(kRivenDebugScript, "Script", "Track Script Execution");
DebugMan.addDebugChannel(kRivenDebugPatches, "Patches", "Track Script Patching");
@@ -278,7 +278,7 @@ void MohawkEngine_Riven::doFrame() {
case Common::KEYCODE_ESCAPE:
if (!_scriptMan->hasQueuedScripts()) {
// Check if we haven't jumped to menu
- if (_prevStack == -1) {
+ if (_menuSavedStack == -1) {
goToMainMenu();
} else {
resumeFromMainMenu();
@@ -327,13 +327,13 @@ void MohawkEngine_Riven::doFrame() {
}
void MohawkEngine_Riven::goToMainMenu() {
- _prevStack = _stack->getId();
- _prevCard = _card->getId();
+ _menuSavedStack = _stack->getId();
+ _menuSavedCard = _card->getId();
// If we are already in menu, do not call again
- if (_prevStack == kStackAspit && _prevCard == 1) {
- _prevStack = -1;
- _prevCard = -1;
+ if (_menuSavedStack == kStackAspit && _menuSavedCard == 1) {
+ _menuSavedStack = -1;
+ _menuSavedCard = -1;
return;
}
@@ -342,16 +342,16 @@ void MohawkEngine_Riven::goToMainMenu() {
}
void MohawkEngine_Riven::resumeFromMainMenu() {
- assert(_prevStack != -1);
+ assert(_menuSavedStack != -1);
- changeToStack(_prevStack);
- changeToCard(_prevCard);
- _prevStack = -1;
- _prevCard = -1;
+ changeToStack(_menuSavedStack);
+ changeToCard(_menuSavedCard);
+ _menuSavedStack = -1;
+ _menuSavedCard = -1;
}
bool MohawkEngine_Riven::isGameStarted() const {
- return _stack->getId() != kStackAspit || _prevStack != -1;
+ return _stack->getId() != kStackAspit || _menuSavedStack != -1;
}
void MohawkEngine_Riven::pauseEngineIntern(bool pause) {
@@ -614,8 +614,8 @@ Common::Error MohawkEngine_Riven::loadGameState(int slot) {
Common::Error loadError = _saveLoad->loadGame(slot);
if (loadError.getCode() == Common::kNoError) {
- _prevStack = -1;
- _prevCard = -1;
+ _menuSavedStack = -1;
+ _menuSavedCard = -1;
}
return loadError;
@@ -633,7 +633,19 @@ void MohawkEngine_Riven::loadGameStateAndDisplayError(int slot) {
}
Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &desc) {
- return _saveLoad->saveGame(slot, desc, false);
+ if (_menuSavedStack != -1) {
+ _vars["CurrentStackID"] = _menuSavedStack;
+ _vars["CurrentCardID"] = _menuSavedCard;
+ }
+
+ Common::Error error = _saveLoad->saveGame(slot, desc, false);
+
+ if (_menuSavedStack != -1) {
+ _vars["CurrentStackID"] = 1;
+ _vars["CurrentCardID"] = 1;
+ }
+
+ return error;
}
void MohawkEngine_Riven::saveGameStateAndDisplayError(int slot, const Common::String &desc) {
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index dd26f51..36bb200 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -120,7 +120,8 @@ private:
RivenCard *_card;
RivenStack *_stack;
- int _prevCard, _prevStack;
+ int _menuSavedCard;
+ int _menuSavedStack;
bool _gameEnded;
uint32 _lastSaveTime;
Commit: 45ab57209f965a4804286e072f181bf98b3af6b4
https://github.com/scummvm/scummvm/commit/45ab57209f965a4804286e072f181bf98b3af6b4
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Fix starting a new game with a game currently active
Changed paths:
engines/mohawk/riven.cpp
engines/mohawk/riven.h
engines/mohawk/riven_card.cpp
engines/mohawk/riven_scripts.cpp
engines/mohawk/riven_stacks/aspit.cpp
engines/mohawk/riven_stacks/aspit.h
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 6e38612..9b9080d 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -580,6 +580,17 @@ void MohawkEngine_Riven::delay(uint32 ms) {
}
}
+void MohawkEngine_Riven::startNewGame() {
+ // Clear all the state data
+ _menuSavedStack = -1;
+ _menuSavedCard = -1;
+
+ _vars.clear();
+ initVars();
+
+ _zipModeData.clear();
+}
+
void MohawkEngine_Riven::runLoadDialog() {
GUI::SaveLoadChooser slc(_("Load game:"), _("Load"), false);
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 36bb200..548ee6e 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -175,6 +175,7 @@ public:
void goToMainMenu();
void resumeFromMainMenu();
bool isGameStarted() const;
+ void startNewGame();
};
} // End of namespace Mohawk
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index 304f596..6ef833f 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -403,6 +403,7 @@ void RivenCard::applyPropertiesPatchE2E(uint32 globalId) {
addMenuHotspot(25, Common::Rect(485, 283, 602, 300), 5, RivenStacks::ASpit::kExternalResume, "xaResumeGame");
addMenuHotspot(26, Common::Rect(485, 309, 602, 326), 6, RivenStacks::ASpit::kExternalOptions, "xaOptions");
addMenuHotspot(27, Common::Rect(485, 335, 602, 352), 7, RivenStacks::ASpit::kExternalQuit, "xademoquit");
+ _vm->getStack()->registerName(kExternalCommandNames, RivenStacks::ASpit::kExternalNewGame, "xaNewGame");
}
}
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index c12989b..a2dd69d 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -27,6 +27,7 @@
#include "mohawk/riven_scripts.h"
#include "mohawk/riven_sound.h"
#include "mohawk/riven_stack.h"
+#include "mohawk/riven_stacks/aspit.h"
#include "mohawk/riven_video.h"
#include "common/memstream.h"
@@ -363,6 +364,19 @@ void RivenScript::applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId,
debugC(kRivenDebugPatches, "Applied incorrect steam sounds (1/2) to card %x", cardGlobalId);
}
+ // Override the main menu new game script to call an external command.
+ // This way we can reset all the state when starting a new game while a game is already started.
+ if (cardGlobalId == 0xE2E && scriptType == kMouseDownScript && hotspotId == 16) {
+ shouldApplyPatches = true;
+ _commands.clear();
+
+ RivenSimpleCommand::ArgumentArray arguments;
+ arguments.push_back(RivenStacks::ASpit::kExternalNewGame);
+ arguments.push_back(0);
+ _commands.push_back(RivenCommandPtr(new RivenSimpleCommand(vm, kRivenCommandRunExternal, arguments)));
+ debugC(kRivenDebugPatches, "Applied override new game script patch to card %x", cardGlobalId);
+ }
+
if (shouldApplyPatches) {
for (uint i = 0; i < _commands.size(); i++) {
_commands[i]->applyCardPatches(cardGlobalId, scriptType, hotspotId);
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index b72ba01..eb03ac8 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -68,6 +68,7 @@ ASpit::ASpit(MohawkEngine_Riven *vm) :
REGISTER_COMMAND(ASpit, xaSaveGame);
REGISTER_COMMAND(ASpit, xaResumeGame);
REGISTER_COMMAND(ASpit, xaOptions);
+ REGISTER_COMMAND(ASpit, xaNewGame);
}
struct MenuItemText {
@@ -394,6 +395,21 @@ void ASpit::xaOptions(const ArgumentArray &args) {
_vm->runOptionsDialog();
}
+void ASpit::xaNewGame(const ArgumentArray &args) {
+ _vm->startNewGame();
+
+ RivenScriptPtr script = _vm->_scriptMan->createScriptFromData(2,
+ kRivenCommandTransition, 1, kRivenTransitionBlend,
+ kRivenCommandChangeCard, 1, 2);
+
+ script->addCommand(RivenCommandPtr(new RivenStackChangeCommand(_vm, 0, 0x6E9A, false)));
+
+ script += _vm->_scriptMan->createScriptFromData(1,
+ kRivenCommandStopSound, 1, 2);
+
+ _vm->_scriptMan->runScript(script, false);
+}
+
void ASpit::xadisablemenureturn(const ArgumentArray &args) {
// This function would normally enable the Windows menu item for
// returning to the main menu. Ctrl+r will do this instead.
diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h
index 3ab02d7..2a6d88f 100644
--- a/engines/mohawk/riven_stacks/aspit.h
+++ b/engines/mohawk/riven_stacks/aspit.h
@@ -40,7 +40,8 @@ public:
kExternalRestoreGame = 21,
kExternalResume = 22,
kExternalOptions = 23,
- kExternalQuit = 24
+ kExternalQuit = 24,
+ kExternalNewGame = 25
};
@@ -72,6 +73,7 @@ public:
void xaSaveGame(const ArgumentArray &args);
void xaResumeGame(const ArgumentArray &args);
void xaOptions(const ArgumentArray &args);
+ void xaNewGame(const ArgumentArray &args);
// External commands - Demo-specific
void xadisablemenureturn(const ArgumentArray &args);
Commit: e7cb40dde57f5331db014eb61ff115baa7917148
https://github.com/scummvm/scummvm/commit/e7cb40dde57f5331db014eb61ff115baa7917148
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Use an in-game thumbnail when saving from the menu
Instead of a thumbnail of the menu itself.
Changed paths:
engines/mohawk/riven.cpp
engines/mohawk/riven.h
engines/mohawk/riven_saveload.cpp
engines/mohawk/riven_saveload.h
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 9b9080d..5faebf8 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -26,6 +26,7 @@
#include "common/keyboard.h"
#include "common/translation.h"
#include "common/system.h"
+#include "graphics/scaler.h"
#include "gui/saveload.h"
#include "gui/message.h"
@@ -337,6 +338,9 @@ void MohawkEngine_Riven::goToMainMenu() {
return;
}
+ _menuTumbnail.reset(new Graphics::Surface());
+ createThumbnailFromScreen(_menuTumbnail.get());
+
changeToStack(kStackAspit);
changeToCard(1);
}
@@ -348,6 +352,7 @@ void MohawkEngine_Riven::resumeFromMainMenu() {
changeToCard(_menuSavedCard);
_menuSavedStack = -1;
_menuSavedCard = -1;
+ _menuTumbnail.reset();
}
bool MohawkEngine_Riven::isGameStarted() const {
@@ -584,11 +589,14 @@ void MohawkEngine_Riven::startNewGame() {
// Clear all the state data
_menuSavedStack = -1;
_menuSavedCard = -1;
+ _menuTumbnail.reset();
_vars.clear();
initVars();
_zipModeData.clear();
+
+ setTotalPlayTime(0);
}
void MohawkEngine_Riven::runLoadDialog() {
@@ -627,6 +635,7 @@ Common::Error MohawkEngine_Riven::loadGameState(int slot) {
if (loadError.getCode() == Common::kNoError) {
_menuSavedStack = -1;
_menuSavedCard = -1;
+ _menuTumbnail.reset();
}
return loadError;
@@ -649,7 +658,8 @@ Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &
_vars["CurrentCardID"] = _menuSavedCard;
}
- Common::Error error = _saveLoad->saveGame(slot, desc, false);
+ const Graphics::Surface *thumbnail = _menuSavedStack != -1 ? _menuTumbnail.get() : nullptr;
+ Common::Error error = _saveLoad->saveGame(slot, desc, thumbnail, false);
if (_menuSavedStack != -1) {
_vars["CurrentStackID"] = 1;
@@ -681,7 +691,8 @@ void MohawkEngine_Riven::tryAutoSaving() {
return; // Can't autosave ever, try again after the next autosave delay
}
- Common::Error saveError = _saveLoad->saveGame(RivenSaveLoad::kAutoSaveSlot, "Autosave", true);
+ const Graphics::Surface *thumbnail = _menuSavedStack != -1 ? _menuTumbnail.get() : nullptr;
+ Common::Error saveError = _saveLoad->saveGame(RivenSaveLoad::kAutoSaveSlot, "Autosave", thumbnail, true);
if (saveError.getCode() != Common::kNoError)
warning("Attempt to autosave has failed.");
}
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 548ee6e..57a3d2b 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -31,6 +31,8 @@
#include "common/random.h"
#include "common/rect.h"
+#include "graphics/surface.h"
+
namespace Mohawk {
struct MohawkGameDescription;
@@ -122,6 +124,7 @@ private:
int _menuSavedCard;
int _menuSavedStack;
+ Common::ScopedPtr<Graphics::Surface, Graphics::SurfaceDeleter> _menuTumbnail;
bool _gameEnded;
uint32 _lastSaveTime;
diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp
index e8d29a0..7a156ad 100644
--- a/engines/mohawk/riven_saveload.cpp
+++ b/engines/mohawk/riven_saveload.cpp
@@ -413,10 +413,14 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genZIPSSection() {
return stream;
}
-Common::MemoryWriteStreamDynamic *RivenSaveLoad::genTHMBSection() const {
+Common::MemoryWriteStreamDynamic *RivenSaveLoad::genTHMBSection(const Graphics::Surface *thumbnail) const {
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
- Graphics::saveThumbnail(*stream);
+ if (thumbnail) {
+ Graphics::saveThumbnail(*stream, *thumbnail);
+ } else {
+ Graphics::saveThumbnail(*stream);
+ }
return stream;
}
@@ -442,7 +446,8 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genMETASection(const Common::St
return stream;
}
-Common::Error RivenSaveLoad::saveGame(const int slot, const Common::String &description, bool autoSave) {
+Common::Error RivenSaveLoad::saveGame(const int slot, const Common::String &description,
+ const Graphics::Surface *thumbnail, bool autoSave) {
// NOTE: This code is designed to only output a Mohawk archive
// for a Riven saved game. It's hardcoded to do this because
// (as of right now) this is the only place in the engine
@@ -460,7 +465,7 @@ Common::Error RivenSaveLoad::saveGame(const int slot, const Common::String &desc
Common::MemoryWriteStreamDynamic *metaSection = genMETASection(description, autoSave);
Common::MemoryWriteStreamDynamic *nameSection = genNAMESection();
- Common::MemoryWriteStreamDynamic *thmbSection = genTHMBSection();
+ Common::MemoryWriteStreamDynamic *thmbSection = genTHMBSection(thumbnail);
Common::MemoryWriteStreamDynamic *varsSection = genVARSSection();
Common::MemoryWriteStreamDynamic *versSection = genVERSSection();
Common::MemoryWriteStreamDynamic *zipsSection = genZIPSSection();
diff --git a/engines/mohawk/riven_saveload.h b/engines/mohawk/riven_saveload.h
index 1432505..1682db3 100644
--- a/engines/mohawk/riven_saveload.h
+++ b/engines/mohawk/riven_saveload.h
@@ -65,7 +65,8 @@ public:
~RivenSaveLoad();
Common::Error loadGame(const int slot);
- Common::Error saveGame(const int slot, const Common::String &description, bool autoSave);
+ Common::Error saveGame(const int slot, const Common::String &description,
+ const Graphics::Surface *thumbnail, bool autoSave);
bool isAutoSaveAllowed();
static void deleteSave(const int slot);
@@ -80,7 +81,7 @@ private:
Common::MemoryWriteStreamDynamic *genNAMESection();
Common::MemoryWriteStreamDynamic *genMETASection(const Common::String &desc, bool autoSave) const;
- Common::MemoryWriteStreamDynamic *genTHMBSection() const;
+ Common::MemoryWriteStreamDynamic *genTHMBSection(const Graphics::Surface *thumbnail) const;
Common::MemoryWriteStreamDynamic *genVARSSection();
Common::MemoryWriteStreamDynamic *genVERSSection();
Common::MemoryWriteStreamDynamic *genZIPSSection();
Commit: 6759346bb6a81d9dd71f75c2f96aaefd673981d0
https://github.com/scummvm/scummvm/commit/6759346bb6a81d9dd71f75c2f96aaefd673981d0
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Show confirmation dialogs on the main menu
Changed paths:
engines/mohawk/riven_stacks/aspit.cpp
engines/mohawk/riven_stacks/aspit.h
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index eb03ac8..7ae1c47 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -379,6 +379,11 @@ void ASpit::xatrapbookopen(const ArgumentArray &args) {
}
void ASpit::xarestoregame(const ArgumentArray &args) {
+ if (!showConfirmationDialog(_("Are you sure you want to load a saved game? All unsaved progress will be lost."),
+ _("Load game"), _("Cancel"))) {
+ return;
+ }
+
// Launch the load game dialog
_vm->runLoadDialog();
}
@@ -396,6 +401,11 @@ void ASpit::xaOptions(const ArgumentArray &args) {
}
void ASpit::xaNewGame(const ArgumentArray &args) {
+ if (!showConfirmationDialog(_("Are you sure you want to start a new game? All unsaved progress will be lost."),
+ _("New game"), _("Cancel"))) {
+ return;
+ }
+
_vm->startNewGame();
RivenScriptPtr script = _vm->_scriptMan->createScriptFromData(2,
@@ -410,6 +420,16 @@ void ASpit::xaNewGame(const ArgumentArray &args) {
_vm->_scriptMan->runScript(script, false);
}
+bool ASpit::showConfirmationDialog(const char *message, const char *confirmButton, const char *cancelButton) {
+ if (!_vm->isGameStarted()) {
+ return true;
+ }
+
+ GUI::MessageDialog dialog(message, confirmButton, cancelButton);
+
+ return dialog.runModal() !=0;
+}
+
void ASpit::xadisablemenureturn(const ArgumentArray &args) {
// This function would normally enable the Windows menu item for
// returning to the main menu. Ctrl+r will do this instead.
@@ -465,6 +485,11 @@ void ASpit::xaenablemenuintro(const ArgumentArray &args) {
}
void ASpit::xademoquit(const ArgumentArray &args) {
+ if (!showConfirmationDialog(_("Are you sure you want to quit? All unsaved progress will be lost."), _("Quit"),
+ _("Cancel"))) {
+ return;
+ }
+
// Exactly as it says on the tin. In the demo, this function quits.
_vm->setGameEnded();
}
diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h
index 2a6d88f..aa3c20f 100644
--- a/engines/mohawk/riven_stacks/aspit.h
+++ b/engines/mohawk/riven_stacks/aspit.h
@@ -89,6 +89,7 @@ private:
void cathBookDrawPage(uint32 page);
+ bool showConfirmationDialog(const char *message, const char *confirmButton, const char *cancelButton);
};
} // End of namespace RivenStacks
Commit: be07d10c7ae542d8e89474e30f92806bec191ad2
https://github.com/scummvm/scummvm/commit/be07d10c7ae542d8e89474e30f92806bec191ad2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: Drop platform at Riven detection entries
Since we do not distinguish between Win and Mac, we drop the platform
from the detection entries during the autodetection
Changed paths:
engines/mohawk/detection_tables.h
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index 0acfaf4..8644ba9 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -414,7 +414,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "71145fdecbd68a0cfc292c2fbddf8e08"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -432,7 +432,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "d8ccae34a0e3c709135a73f449b783be"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -450,7 +450,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "249e8c995d191b03ee94c892c0eac775"),
Common::ES_ESP,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -468,7 +468,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "aff2a384aaa9a0e0ec51010f708c5c04"),
Common::FR_FRA,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -486,7 +486,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "0e21e89df7788f32056b6521abf2e81a"),
Common::IT_ITA,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -503,7 +503,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1s("a_Data.MHK", "2a840ed74fe5dc3a388bced674d379d5", 12024358),
Common::RU_RUS,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -520,7 +520,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "59bd2e3ccbae2f1faa1b23a18dc316eb"),
Common::RU_RUS,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -539,7 +539,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1s("a_Data.MHK", "3a2b4764979dc007a0e6ded64e4b7889", 10014314),
Common::JA_JPN,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -557,7 +557,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "08fcaa5d5a2a01d7a5a6960f497212fe"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -575,7 +575,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "3370cd9a9696814365a2b7fd7a7b726e"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -593,7 +593,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "a5fe1c91a6033eb6ee54b287578b74b9"),
Common::DE_DEU,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -611,7 +611,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "733a710cf5f848b441ec72d988ab8a3d"),
Common::PL_POL,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -628,7 +628,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "b5f40e6e6b843bf3abea291faa0911f4"),
Common::RU_RUS,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_DROPPLATFORM,
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
@@ -646,7 +646,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("a_Data.MHK", "bae6b03bd8d6eb350d35fd13f0e3139f"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_DEMO,
+ (ADGF_DEMO | ADGF_DROPPLATFORM),
GUI_OPTIONS_RIVEN_DEMO
},
GType_RIVEN,
Commit: 09b94b1fc22b0aff719ab442db2900f655349d84
https://github.com/scummvm/scummvm/commit/09b94b1fc22b0aff719ab442db2900f655349d84
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Translated new menu entries
Changed paths:
engines/mohawk/riven_stacks/aspit.cpp
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index 7ae1c47..362f642 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -75,14 +75,14 @@ struct MenuItemText {
int language;
const char *items[7];
} static const menuItems[] = {
- { Common::EN_ANY, { "SETUP", "START NEW GAME", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
- { Common::DE_DEU, { "SETUP", "SPIELEN", "SPIELSTAND LADEN", "SPIEL SPEICHERN", "RESUME", "OPTIONS", "QUIT" } },
- { Common::ES_ESP, { "IMAGEN", "IR A RIVEN", "CARGAR JUEGO", "GUARDAR JUEGO", "RESUME", "OPTIONS", "QUIT" } },
- { Common::FR_FRA, { "CONFIG", "JOUER RIVEN", "CHARGEMENT DU JEU", "JEU SAUVEGARDER", "RESUME", "OPTIONS", "QUIT" } },
- { Common::IT_ITA, { "CONF.", "GIOCA", "CARICA GIOCO", "SALVA IL GIOCO", "RESUME", "OPTIONS", "QUIT" } },
- { Common::RU_RUS, { "УСТАНОВКИ", "СТАРТ", "ПРОДОЛЖИТЬ ИГРУ", "СОХРАНИТЬ ИГРУ", "RESUME", "OPTIONS", "QUIT" } },
- { Common::JA_JPN, { "SETUP", "PLAY RIVEN", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
- { Common::PL_POL, { "USTAWIENIA", "GRAJ W RIVEN", "ZAŁADUJ GRĘ", "ZAPISZ GRĘ", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::EN_ANY, { "SETUP", "START NEW GAME", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::DE_DEU, { "SETUP", "SPIELEN", "SPIELSTAND LADEN", "SPIEL SPEICHERN", "FORTSETZEN", "OPTIONEN", "AUSFAHRT" } },
+ { Common::ES_ESP, { "IMAGEN", "IR A RIVEN", "CARGAR JUEGO", "GUARDAR JUEGO", "CONTINUAR", "OPCIONES", "SALIDA" } },
+ { Common::FR_FRA, { "CONFIG", "JOUER RIVEN", "CHARGEMENT DU JEU", "JEU SAUVEGARDER", "CONTINUER", "OPTIONS", "SORTIE" } },
+ { Common::IT_ITA, { "CONF.", "GIOCA", "CARICA GIOCO", "SALVA IL GIOCO", "SEGUITARE", "OPZIONI", "USCITA" } },
+ { Common::RU_RUS, { "УСТАНОВКИ", "СТАРТ", "ПРОДОЛЖИТЬ ИГРУ", "СОХРАНИТЬ ИГРУ", "ПРОДОЛЖИТЬ", "ОПЦИИ", "ВЫЙТИ" } },
+ { Common::JA_JPN, { "SETUP", "PLAY RIVEN", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::PL_POL, { "USTAWIENIA", "GRAJ W RIVEN", "ZAŁADUJ GRĘ", "ZAPISZ GRĘ", "POWRÓT", "OPCJE", "WYJŚCIE" } },
{ -1, { 0 } }
};
Commit: b26fe7de39f844c229c8e6f3abdc19b9317de6b8
https://github.com/scummvm/scummvm/commit/b26fe7de39f844c229c8e6f3abdc19b9317de6b8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:54+02:00
Commit Message:
MOHAWK: RIVEN: Added Japanese font and menu translation
Changed paths:
engines/mohawk/riven_stacks/aspit.cpp
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index 362f642..3729a17 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -75,14 +75,14 @@ struct MenuItemText {
int language;
const char *items[7];
} static const menuItems[] = {
- { Common::EN_ANY, { "SETUP", "START NEW GAME", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
- { Common::DE_DEU, { "SETUP", "SPIELEN", "SPIELSTAND LADEN", "SPIEL SPEICHERN", "FORTSETZEN", "OPTIONEN", "AUSFAHRT" } },
- { Common::ES_ESP, { "IMAGEN", "IR A RIVEN", "CARGAR JUEGO", "GUARDAR JUEGO", "CONTINUAR", "OPCIONES", "SALIDA" } },
- { Common::FR_FRA, { "CONFIG", "JOUER RIVEN", "CHARGEMENT DU JEU", "JEU SAUVEGARDER", "CONTINUER", "OPTIONS", "SORTIE" } },
- { Common::IT_ITA, { "CONF.", "GIOCA", "CARICA GIOCO", "SALVA IL GIOCO", "SEGUITARE", "OPZIONI", "USCITA" } },
- { Common::RU_RUS, { "УСТАНОВКИ", "СТАРТ", "ПРОДОЛЖИТЬ ИГРУ", "СОХРАНИТЬ ИГРУ", "ПРОДОЛЖИТЬ", "ОПЦИИ", "ВЫЙТИ" } },
- { Common::JA_JPN, { "SETUP", "PLAY RIVEN", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
- { Common::PL_POL, { "USTAWIENIA", "GRAJ W RIVEN", "ZAŁADUJ GRĘ", "ZAPISZ GRĘ", "POWRÓT", "OPCJE", "WYJŚCIE" } },
+ { Common::EN_ANY, { "SETUP", "START NEW GAME", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::DE_DEU, { "SETUP", "SPIELEN", "SPIELSTAND LADEN", "SPIEL SPEICHERN", "FORTSETZEN", "OPTIONEN", "AUSFAHRT" } },
+ { Common::ES_ESP, { "IMAGEN", "IR A RIVEN", "CARGAR JUEGO", "GUARDAR JUEGO", "CONTINUAR", "OPCIONES", "SALIDA" } },
+ { Common::FR_FRA, { "CONFIG", "JOUER RIVEN", "CHARGEMENT DU JEU", "JEU SAUVEGARDER", "CONTINUER", "OPTIONS", "SORTIE" } },
+ { Common::IT_ITA, { "CONF.", "GIOCA", "CARICA GIOCO", "SALVA IL GIOCO", "SEGUITARE", "OPZIONI", "USCITA" } },
+ { Common::RU_RUS, { "УСТАНОВКИ", "СТАРТ", "ПРОДОЛЖИТЬ ИГРУ", "СОХРАНИТЬ ИГРУ", "ПРОДОЛЖИТЬ", "ОПЦИИ", "ВЫЙТИ" } },
+ { Common::JA_JPN, { "セットアップ", "RIVENを演奏する", "保存したゲームを開始する", "ゲームを保存する", "持続する", "オプション","やめる" } },
+ { Common::PL_POL, { "USTAWIENIA", "GRAJ W RIVEN", "ZAŁADUJ GRĘ", "ZAPISZ GRĘ", "POWRÓT", "OPCJE", "WYJŚCIE" } },
{ -1, { 0 } }
};
@@ -92,9 +92,15 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
Common::File file;
- const char *fontname = "FreeSans.ttf";
+ const char *fontname;
const Graphics::Font *font = nullptr;
+ if (_vm->getLanguage() != Common::JA_JPN)
+ fontname = "FreeSans.ttf";
+ else
+ fontname = "mplus-2c-regular.ttf";
+
+
#if defined(USE_FREETYPE2)
int fontHeight = 11;
if (file.open(fontname)) {
Commit: 76f11cf0250cca6aa83ed77d1301cbb8889272fd
https://github.com/scummvm/scummvm/commit/76f11cf0250cca6aa83ed77d1301cbb8889272fd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:55+02:00
Commit Message:
GUI: Added font, used in Japanese Riven menus
Changed paths:
A gui/themes/fonts/mplus-2c-regular.ttf
diff --git a/gui/themes/fonts/mplus-2c-regular.ttf b/gui/themes/fonts/mplus-2c-regular.ttf
new file mode 100644
index 0000000..716d000
Binary files /dev/null and b/gui/themes/fonts/mplus-2c-regular.ttf differ
Commit: 2660211fd79931f742ba00d72008bef0a1bc4999
https://github.com/scummvm/scummvm/commit/2660211fd79931f742ba00d72008bef0a1bc4999
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:55+02:00
Commit Message:
GUI: Added license for M+ fonts (PD)
Changed paths:
A gui/themes/fonts/LICENSE.mplus
diff --git a/gui/themes/fonts/LICENSE.mplus b/gui/themes/fonts/LICENSE.mplus
new file mode 100644
index 0000000..e8fa893
--- /dev/null
+++ b/gui/themes/fonts/LICENSE.mplus
@@ -0,0 +1,16 @@
+M+ FONTS Copyright (C) 2002-2017 M+ FONTS PROJECT
+
+-
+
+LICENSE_E
+
+
+
+
+These fonts are free software.
+Unlimited permission is granted to use, copy, and distribute them, with
+or without modification, either commercially or noncommercially.
+THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY.
+
+
+http://mplus-fonts.osdn.jp
Commit: 24977b814cbff4f75a133370506256e8c7c40631
https://github.com/scummvm/scummvm/commit/24977b814cbff4f75a133370506256e8c7c40631
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:55+02:00
Commit Message:
MOHAWK: RIVEN: Add detection for the 25th Anniversary version
Changed paths:
engines/mohawk/detection_tables.h
engines/mohawk/riven.cpp
engines/mohawk/riven.h
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index 8644ba9..213bbb0 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -636,6 +636,178 @@ static const MohawkGameDescription gameDescriptions[] = {
0,
},
+ // Riven: The Sequel to Myst - 25th anniversary
+ // English - Created by the ScummVM team
+ {
+ {
+ "riven",
+ "25th Anniversary",
+ {
+ // The french datafile is included in the list because
+ // in the 25th anniversary edition, all the files sit in the same
+ // package. All the detection entries need to have the same amount
+ // of files to show in the detection results.
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
+ { "a_data_french.mhk", 0, "ad7547ed7159a97be98a005f62862f85", -1},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_DROPPLATFORM,
+ GUI_OPTIONS_RIVEN
+ },
+ GType_RIVEN,
+ GF_DVD,
+ 0,
+ },
+
+ // Riven: The Sequel to Myst - 25th anniversary
+ // French - Created by the ScummVM team
+ {
+ {
+ "riven",
+ "25th Anniversary",
+ {
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
+ { "a_data_french.mhk", 0, "ad7547ed7159a97be98a005f62862f85", -1},
+ AD_LISTEND
+ },
+ Common::FR_FRA,
+ Common::kPlatformWindows,
+ ADGF_DROPPLATFORM,
+ GUI_OPTIONS_RIVEN
+ },
+ GType_RIVEN,
+ GF_DVD,
+ 0,
+ },
+
+ // Riven: The Sequel to Myst - 25th anniversary
+ // German - Created by the ScummVM team
+ {
+ {
+ "riven",
+ "25th Anniversary",
+ {
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
+ { "a_data_german.mhk", 0, "5ebd301bd4bf6fd7667c4a46eebf6532", -1},
+ AD_LISTEND
+ },
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_DROPPLATFORM,
+ GUI_OPTIONS_RIVEN
+ },
+ GType_RIVEN,
+ GF_DVD,
+ 0,
+ },
+
+ // Riven: The Sequel to Myst - 25th anniversary
+ // Italian - Created by the ScummVM team
+ {
+ {
+ "riven",
+ "25th Anniversary",
+ {
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
+ { "a_data_italian.mhk", 0, "9d53b178510ce90f10b32ad3ca967d38", -1},
+ AD_LISTEND
+ },
+ Common::IT_ITA,
+ Common::kPlatformWindows,
+ ADGF_DROPPLATFORM,
+ GUI_OPTIONS_RIVEN
+ },
+ GType_RIVEN,
+ GF_DVD,
+ 0,
+ },
+
+ // Riven: The Sequel to Myst - 25th anniversary
+ // Japanese - Created by the ScummVM team
+ {
+ {
+ "riven",
+ "25th Anniversary",
+ {
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
+ { "a_data_japanese.mhk", 0, "bf43cf8af21fefc5a02881f7cfb68f52", -1},
+ AD_LISTEND
+ },
+ Common::JA_JPN,
+ Common::kPlatformWindows,
+ ADGF_DROPPLATFORM,
+ GUI_OPTIONS_RIVEN
+ },
+ GType_RIVEN,
+ GF_DVD,
+ 0,
+ },
+
+ // Riven: The Sequel to Myst - 25th anniversary
+ // Polish - Created by the ScummVM team
+ {
+ {
+ "riven",
+ "25th Anniversary",
+ {
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
+ { "a_data_polish.mhk", 0, "5c7cd4b1a1a4c63cc670485816b0b5ec", -1},
+ AD_LISTEND
+ },
+ Common::PL_POL,
+ Common::kPlatformWindows,
+ ADGF_DROPPLATFORM,
+ GUI_OPTIONS_RIVEN
+ },
+ GType_RIVEN,
+ GF_DVD,
+ 0,
+ },
+
+ // Riven: The Sequel to Myst - 25th anniversary
+ // Russian - Created by the ScummVM team
+ {
+ {
+ "riven",
+ "25th Anniversary",
+ {
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
+ { "a_data_russian.mhk", 0, "76e12906637f5274bb6af8ab42871c25", -1},
+ AD_LISTEND
+ },
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_DROPPLATFORM,
+ GUI_OPTIONS_RIVEN
+ },
+ GType_RIVEN,
+ GF_DVD,
+ 0,
+ },
+
+ // Riven: The Sequel to Myst - 25th anniversary
+ // Spanish - Created by the ScummVM team
+ {
+ {
+ "riven",
+ "25th Anniversary",
+ {
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
+ { "a_data_spanish.mhk", 0, "6226a3e1748e64962971b2f6536ef283", -1},
+ AD_LISTEND
+ },
+ Common::ES_ESP,
+ Common::kPlatformWindows,
+ ADGF_DROPPLATFORM,
+ GUI_OPTIONS_RIVEN
+ },
+ GType_RIVEN,
+ GF_DVD,
+ 0,
+ },
+
// Riven: The Sequel to Myst
// Version ? (Demo, From "Prince of Persia Collector's Edition")
// From Clone2727
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 5faebf8..bbfd139 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -396,6 +396,16 @@ void MohawkEngine_Riven::changeToStack(uint16 stackId) {
// Get the prefix character for the destination stack
char prefix = RivenStacks::getName(stackId)[0];
+ // Load the localization override file if any
+ Common::String languageDatafile = getLanguageDatafile(prefix);
+ if (!languageDatafile.empty()) {
+ MohawkArchive *mhk = new MohawkArchive();
+ if (mhk->openFile(languageDatafile))
+ _mhk.push_back(mhk);
+ else
+ delete mhk;
+ }
+
// Load files that start with the prefix
const char **datafiles = listExpectedDatafiles();
for (int i = 0; datafiles[i] != nullptr; i++) {
@@ -492,6 +502,41 @@ bool MohawkEngine_Riven::checkDatafiles() {
return false;
}
+Common::String MohawkEngine_Riven::getLanguageDatafile(char prefix) const {
+ const char *language = nullptr;
+ switch (getLanguage()) {
+ case Common::FR_FRA:
+ language = "french";
+ break;
+ case Common::DE_DEU:
+ language = "german";
+ break;
+ case Common::IT_ITA:
+ language = "italian";
+ break;
+ case Common::JA_JPN:
+ language = "japanese";
+ break;
+ case Common::PL_POL:
+ language = "polish";
+ break;
+ case Common::RU_RUS:
+ language = "russian";
+ break;
+ case Common::ES_ESP:
+ language = "spanish";
+ break;
+ default:
+ break;
+ }
+
+ if (!language) {
+ return "";
+ }
+
+ return Common::String::format("%c_data_%s.mhk", prefix, language);
+}
+
RivenStack *MohawkEngine_Riven::constructStackById(uint16 id) {
switch (id) {
case kStackAspit:
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 57a3d2b..80ff6da 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -111,6 +111,7 @@ private:
// Datafiles
MohawkArchive *_extrasFile; // We need a separate handle for the extra data
const char **listExpectedDatafiles() const;
+ Common::String getLanguageDatafile(char prefix) const;
bool checkDatafiles();
RivenConsole *_console;
Commit: cfa649d7ac04ea087537f03da9a59b1c5aedcdb2
https://github.com/scummvm/scummvm/commit/cfa649d7ac04ea087537f03da9a59b1c5aedcdb2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:55+02:00
Commit Message:
MOHAWK: RIVEN: Restrict new menu to 25th Anniversary games
Changed paths:
engines/mohawk/detection_tables.h
engines/mohawk/mohawk.h
engines/mohawk/riven.cpp
engines/mohawk/riven_card.cpp
engines/mohawk/riven_scripts.cpp
engines/mohawk/riven_stacks/aspit.cpp
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index 213bbb0..0c3eceb 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -657,7 +657,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
- GF_DVD,
+ GF_DVD | GF_25TH,
0,
},
@@ -678,7 +678,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
- GF_DVD,
+ GF_DVD | GF_25TH,
0,
},
@@ -699,7 +699,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
- GF_DVD,
+ GF_DVD | GF_25TH,
0,
},
@@ -720,7 +720,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
- GF_DVD,
+ GF_DVD | GF_25TH,
0,
},
@@ -741,7 +741,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
- GF_DVD,
+ GF_DVD | GF_25TH,
0,
},
@@ -762,7 +762,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
- GF_DVD,
+ GF_DVD | GF_25TH,
0,
},
@@ -783,7 +783,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
- GF_DVD,
+ GF_DVD | GF_25TH,
0,
},
@@ -804,7 +804,7 @@ static const MohawkGameDescription gameDescriptions[] = {
GUI_OPTIONS_RIVEN
},
GType_RIVEN,
- GF_DVD,
+ GF_DVD | GF_25TH,
0,
},
diff --git a/engines/mohawk/mohawk.h b/engines/mohawk/mohawk.h
index 3a50a2a..ad4ff7b 100644
--- a/engines/mohawk/mohawk.h
+++ b/engines/mohawk/mohawk.h
@@ -58,11 +58,11 @@ enum MohawkGameType {
};
enum MohawkGameFeatures {
- GF_ME = (1 << 0), // Myst Masterpiece Edition
- GF_25TH = (1 << 1), // Myst Masterpiece Edition - 25th Anniversary
+ GF_ME = (1 << 0), // Myst Masterpiece Edition
+ GF_25TH = (1 << 1), // Myst and Riven 25th Anniversary
GF_DVD = (1 << 2),
GF_DEMO = (1 << 3),
- GF_LB_10 = (1 << 4) // very early Living Books 1.0 games
+ GF_LB_10 = (1 << 4) // very early Living Books 1.0 games
};
struct MohawkGameDescription;
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index bbfd139..a3a71f8 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -277,7 +277,7 @@ void MohawkEngine_Riven::doFrame() {
}
break;
case Common::KEYCODE_ESCAPE:
- if (!_scriptMan->hasQueuedScripts()) {
+ if (!_scriptMan->hasQueuedScripts() && getFeatures() & GF_25TH) {
// Check if we haven't jumped to menu
if (_menuSavedStack == -1) {
goToMainMenu();
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index 6ef833f..92ed379 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -393,6 +393,9 @@ void RivenCard::applyPropertiesPatch22118(uint32 globalId) {
}
void RivenCard::applyPropertiesPatchE2E(uint32 globalId) {
+ if (!(_vm->getFeatures() & GF_25TH))
+ return;
+
// The main menu in the Myst 25th anniversary version is patched to include new items:
// - Save game
if (globalId == 0xE2E) {
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index a2dd69d..3547302 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -366,7 +366,8 @@ void RivenScript::applyCardPatches(MohawkEngine_Riven *vm, uint32 cardGlobalId,
// Override the main menu new game script to call an external command.
// This way we can reset all the state when starting a new game while a game is already started.
- if (cardGlobalId == 0xE2E && scriptType == kMouseDownScript && hotspotId == 16) {
+ if (cardGlobalId == 0xE2E && scriptType == kMouseDownScript && hotspotId == 16
+ && (vm->getFeatures() & GF_25TH)) {
shouldApplyPatches = true;
_commands.clear();
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index 3729a17..b6cd17b 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -90,6 +90,9 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
// The original game hides the start/setup buttons depending on an ini entry.
// It's safe to ignore this command.
+ if (!(_vm->getFeatures() & GF_25TH))
+ return;
+
Common::File file;
const char *fontname;
Commit: 7884201b43f1eeae5def5d8d3371da586e7bc17e
https://github.com/scummvm/scummvm/commit/7884201b43f1eeae5def5d8d3371da586e7bc17e
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:55+02:00
Commit Message:
MOHAWK: RIVEN: Improve some of the main menu translations
Changed paths:
engines/mohawk/riven_stacks/aspit.cpp
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index b6cd17b..ee68587 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -75,14 +75,14 @@ struct MenuItemText {
int language;
const char *items[7];
} static const menuItems[] = {
- { Common::EN_ANY, { "SETUP", "START NEW GAME", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
- { Common::DE_DEU, { "SETUP", "SPIELEN", "SPIELSTAND LADEN", "SPIEL SPEICHERN", "FORTSETZEN", "OPTIONEN", "AUSFAHRT" } },
- { Common::ES_ESP, { "IMAGEN", "IR A RIVEN", "CARGAR JUEGO", "GUARDAR JUEGO", "CONTINUAR", "OPCIONES", "SALIDA" } },
- { Common::FR_FRA, { "CONFIG", "JOUER RIVEN", "CHARGEMENT DU JEU", "JEU SAUVEGARDER", "CONTINUER", "OPTIONS", "SORTIE" } },
- { Common::IT_ITA, { "CONF.", "GIOCA", "CARICA GIOCO", "SALVA IL GIOCO", "SEGUITARE", "OPZIONI", "USCITA" } },
- { Common::RU_RUS, { "УСТАНОВКИ", "СТАРТ", "ПРОДОЛЖИТЬ ИГРУ", "СОХРАНИТЬ ИГРУ", "ПРОДОЛЖИТЬ", "ОПЦИИ", "ВЫЙТИ" } },
- { Common::JA_JPN, { "セットアップ", "RIVENを演奏する", "保存したゲームを開始する", "ゲームを保存する", "持続する", "オプション","やめる" } },
- { Common::PL_POL, { "USTAWIENIA", "GRAJ W RIVEN", "ZAŁADUJ GRĘ", "ZAPISZ GRĘ", "POWRÓT", "OPCJE", "WYJŚCIE" } },
+ { Common::EN_ANY, { "SETUP", "START NEW GAME", "START SAVED GAME", "SAVE GAME", "RESUME", "OPTIONS", "QUIT" } },
+ { Common::DE_DEU, { "SETUP", "SPIELEN", "SPIELSTAND LADEN", "SPIEL SPEICHERN", "FORTSETZEN", "OPTIONEN", "BEENDEN" } },
+ { Common::ES_ESP, { "IMAGEN", "IR A RIVEN", "CARGAR JUEGO", "GUARDAR JUEGO", "CONTINUAR", "OPCIONES", "SALIR" } },
+ { Common::FR_FRA, { "CONFIG", "NOUVELLE PARTIE", "CHARGER", "ENREGISTRER", "REPRENDRE", "OPTIONS", "QUITTER" } },
+ { Common::IT_ITA, { "CONF.", "GIOCA", "CARICA GIOCO", "SALVA IL GIOCO", "SEGUITARE", "OPZIONI", "ECSI" } },
+ { Common::RU_RUS, { "УСТАНОВКИ", "СТАРТ", "ПРОДОЛЖИТЬ ИГРУ", "СОХРАНИТЬ ИГРУ", "ПРОДОЛЖИТЬ", "ОПЦИИ", "ВЫЙТИ" } },
+ { Common::JA_JPN, { "セットアップ", "RIVENを演奏する", "保存したゲームを開始する", "ゲームを保存する", "持続する", "オプション","やめる" } },
+ { Common::PL_POL, { "USTAWIENIA", "GRAJ W RIVEN", "ZAŁADUJ GRĘ", "ZAPISZ GRĘ", "POWRÓT", "OPCJE", "WYJŚCIE" } },
{ -1, { 0 } }
};
Commit: 52c89cb1e2bae4515f31ad894497c02c75820935
https://github.com/scummvm/scummvm/commit/52c89cb1e2bae4515f31ad894497c02c75820935
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:55+02:00
Commit Message:
MOHAWK: RIVEN: Disable autosaving while the game is not started
Changed paths:
engines/mohawk/riven.cpp
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index a3a71f8..4075f80 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -726,7 +726,7 @@ void MohawkEngine_Riven::saveGameStateAndDisplayError(int slot, const Common::St
}
void MohawkEngine_Riven::tryAutoSaving() {
- if (!canSaveGameStateCurrently()) {
+ if (!canSaveGameStateCurrently() || !isGameStarted()) {
return; // Can't save right now, try again on the next frame
}
Commit: 318093b41c5c613fbfe5cdf3b903fea26663d4a0
https://github.com/scummvm/scummvm/commit/318093b41c5c613fbfe5cdf3b903fea26663d4a0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:55+02:00
Commit Message:
MOHAWK: Added file sizes to 25th Anniversary Riven entries
Changed paths:
engines/mohawk/detection_tables.h
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index 0c3eceb..bd0a127 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -647,8 +647,8 @@ static const MohawkGameDescription gameDescriptions[] = {
// in the 25th anniversary edition, all the files sit in the same
// package. All the detection entries need to have the same amount
// of files to show in the detection results.
- { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
- { "a_data_french.mhk", 0, "ad7547ed7159a97be98a005f62862f85", -1},
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
+ { "a_data_french.mhk", 0, "ad7547ed7159a97be98a005f62862f85", 7088579 },
AD_LISTEND
},
Common::EN_ANY,
@@ -668,8 +668,8 @@ static const MohawkGameDescription gameDescriptions[] = {
"riven",
"25th Anniversary",
{
- { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
- { "a_data_french.mhk", 0, "ad7547ed7159a97be98a005f62862f85", -1},
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
+ { "a_data_french.mhk", 0, "ad7547ed7159a97be98a005f62862f85", 7088579 },
AD_LISTEND
},
Common::FR_FRA,
@@ -689,8 +689,8 @@ static const MohawkGameDescription gameDescriptions[] = {
"riven",
"25th Anniversary",
{
- { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
- { "a_data_german.mhk", 0, "5ebd301bd4bf6fd7667c4a46eebf6532", -1},
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
+ { "a_data_german.mhk", 0, "5ebd301bd4bf6fd7667c4a46eebf6532", 7098655 },
AD_LISTEND
},
Common::DE_DEU,
@@ -710,8 +710,8 @@ static const MohawkGameDescription gameDescriptions[] = {
"riven",
"25th Anniversary",
{
- { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
- { "a_data_italian.mhk", 0, "9d53b178510ce90f10b32ad3ca967d38", -1},
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
+ { "a_data_italian.mhk", 0, "9d53b178510ce90f10b32ad3ca967d38", 6677740 },
AD_LISTEND
},
Common::IT_ITA,
@@ -731,8 +731,8 @@ static const MohawkGameDescription gameDescriptions[] = {
"riven",
"25th Anniversary",
{
- { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
- { "a_data_japanese.mhk", 0, "bf43cf8af21fefc5a02881f7cfb68f52", -1},
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
+ { "a_data_japanese.mhk", 0, "bf43cf8af21fefc5a02881f7cfb68f52", 7237370 },
AD_LISTEND
},
Common::JA_JPN,
@@ -752,8 +752,8 @@ static const MohawkGameDescription gameDescriptions[] = {
"riven",
"25th Anniversary",
{
- { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
- { "a_data_polish.mhk", 0, "5c7cd4b1a1a4c63cc670485816b0b5ec", -1},
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
+ { "a_data_polish.mhk", 0, "5c7cd4b1a1a4c63cc670485816b0b5ec", 14588293 },
AD_LISTEND
},
Common::PL_POL,
@@ -773,8 +773,8 @@ static const MohawkGameDescription gameDescriptions[] = {
"riven",
"25th Anniversary",
{
- { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
- { "a_data_russian.mhk", 0, "76e12906637f5274bb6af8ab42871c25", -1},
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
+ { "a_data_russian.mhk", 0, "76e12906637f5274bb6af8ab42871c25", 14349136 },
AD_LISTEND
},
Common::RU_RUS,
@@ -794,8 +794,8 @@ static const MohawkGameDescription gameDescriptions[] = {
"riven",
"25th Anniversary",
{
- { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", -1},
- { "a_data_spanish.mhk", 0, "6226a3e1748e64962971b2f6536ef283", -1},
+ { "a_data.mhk", 0, "08fcaa5d5a2a01d7a5a6960f497212fe", 10218888 },
+ { "a_data_spanish.mhk", 0, "6226a3e1748e64962971b2f6536ef283", 8133297 },
AD_LISTEND
},
Common::ES_ESP,
Commit: 1f4d4b01eaeebecbb790b0e6a719577c14a9b470
https://github.com/scummvm/scummvm/commit/1f4d4b01eaeebecbb790b0e6a719577c14a9b470
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-06-29T13:31:55+02:00
Commit Message:
MOHAWK: RIVEN: Removed hardcoded list of language prefixes.
This will let to play with the prefixes without recompilation.
Changed paths:
engines/mohawk/detection.cpp
engines/mohawk/mohawk.h
engines/mohawk/riven.cpp
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp
index 58d1483..c185a63 100644
--- a/engines/mohawk/detection.cpp
+++ b/engines/mohawk/detection.cpp
@@ -46,14 +46,6 @@
namespace Mohawk {
-struct MohawkGameDescription {
- ADGameDescription desc;
-
- uint8 gameType;
- uint32 features;
- const char *appName;
-};
-
const char* MohawkEngine::getGameId() const {
return _gameDescription->desc.gameId;
}
diff --git a/engines/mohawk/mohawk.h b/engines/mohawk/mohawk.h
index ad4ff7b..d61512a 100644
--- a/engines/mohawk/mohawk.h
+++ b/engines/mohawk/mohawk.h
@@ -26,6 +26,7 @@
#include "common/scummsys.h"
#include "common/array.h"
+#include "engines/advancedDetector.h"
#include "engines/engine.h"
class OSystem;
@@ -65,12 +66,19 @@ enum MohawkGameFeatures {
GF_LB_10 = (1 << 4) // very early Living Books 1.0 games
};
-struct MohawkGameDescription;
class Sound;
class PauseDialog;
class Archive;
class CursorManager;
+struct MohawkGameDescription {
+ ADGameDescription desc;
+
+ uint8 gameType;
+ uint32 features;
+ const char *appName;
+};
+
class MohawkEngine : public ::Engine {
protected:
Common::Error run() override;
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 4075f80..252c994 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -503,38 +503,19 @@ bool MohawkEngine_Riven::checkDatafiles() {
}
Common::String MohawkEngine_Riven::getLanguageDatafile(char prefix) const {
- const char *language = nullptr;
- switch (getLanguage()) {
- case Common::FR_FRA:
- language = "french";
- break;
- case Common::DE_DEU:
- language = "german";
- break;
- case Common::IT_ITA:
- language = "italian";
- break;
- case Common::JA_JPN:
- language = "japanese";
- break;
- case Common::PL_POL:
- language = "polish";
- break;
- case Common::RU_RUS:
- language = "russian";
- break;
- case Common::ES_ESP:
- language = "spanish";
- break;
- default:
- break;
- }
-
- if (!language) {
+ if (!(getFeatures() & GF_25TH) || getLanguage() == Common::EN_ANY)
+ return "";
+
+ if (!Common::String(_gameDescription->desc.filesDescriptions[1].fileName).hasPrefix("a_data_")) {
+ warning("Malformed 25th Anniversary Riven entry");
+
return "";
}
- return Common::String::format("%c_data_%s.mhk", prefix, language);
+ const char *fname = _gameDescription->desc.filesDescriptions[1].fileName;
+ Common::String language(&fname[7], strlen(fname) - 7 - 4);
+
+ return Common::String::format("%c_data_%s.mhk", prefix, language.c_str());
}
RivenStack *MohawkEngine_Riven::constructStackById(uint16 id) {
Commit: 573fa47f948a4ce55cfbca4837eda9303cd43d93
https://github.com/scummvm/scummvm/commit/573fa47f948a4ce55cfbca4837eda9303cd43d93
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:55+02:00
Commit Message:
MOHAWK: RIVEN: Fix loading autosaves saved while on the main menu
Changed paths:
engines/mohawk/riven.cpp
engines/mohawk/riven.h
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 252c994..163785e 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -679,13 +679,17 @@ void MohawkEngine_Riven::loadGameStateAndDisplayError(int slot) {
}
Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &desc) {
+ return saveGameState(slot, desc, false);
+}
+
+Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String &desc, bool autosave) {
if (_menuSavedStack != -1) {
_vars["CurrentStackID"] = _menuSavedStack;
_vars["CurrentCardID"] = _menuSavedCard;
}
const Graphics::Surface *thumbnail = _menuSavedStack != -1 ? _menuTumbnail.get() : nullptr;
- Common::Error error = _saveLoad->saveGame(slot, desc, thumbnail, false);
+ Common::Error error = _saveLoad->saveGame(slot, desc, thumbnail, autosave);
if (_menuSavedStack != -1) {
_vars["CurrentStackID"] = 1;
@@ -717,8 +721,7 @@ void MohawkEngine_Riven::tryAutoSaving() {
return; // Can't autosave ever, try again after the next autosave delay
}
- const Graphics::Surface *thumbnail = _menuSavedStack != -1 ? _menuTumbnail.get() : nullptr;
- Common::Error saveError = _saveLoad->saveGame(RivenSaveLoad::kAutoSaveSlot, "Autosave", thumbnail, true);
+ Common::Error saveError = saveGameState(RivenSaveLoad::kAutoSaveSlot, "Autosave", true);
if (saveError.getCode() != Common::kNoError)
warning("Attempt to autosave has failed.");
}
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 80ff6da..e2a1162 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -163,6 +163,7 @@ public:
void runSaveDialog();
void tryAutoSaving();
void loadGameStateAndDisplayError(int slot);
+ Common::Error saveGameState(int slot, const Common::String &desc, bool autosave);
void saveGameStateAndDisplayError(int slot, const Common::String &desc);
/**
Commit: bd56983b42f0424c2b5f7c6c066ba2d12b94b610
https://github.com/scummvm/scummvm/commit/bd56983b42f0424c2b5f7c6c066ba2d12b94b610
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-06-29T13:31:55+02:00
Commit Message:
MOHAWK: RIVEN: Tweak a bit the main menu items
* Move the text to the left so the japanese version is not cut.
* Increase the size of the text so it looks better when scaled up.
Changed paths:
engines/mohawk/riven_card.cpp
engines/mohawk/riven_stacks/aspit.cpp
diff --git a/engines/mohawk/riven_card.cpp b/engines/mohawk/riven_card.cpp
index 92ed379..3612232 100644
--- a/engines/mohawk/riven_card.cpp
+++ b/engines/mohawk/riven_card.cpp
@@ -399,13 +399,13 @@ void RivenCard::applyPropertiesPatchE2E(uint32 globalId) {
// The main menu in the Myst 25th anniversary version is patched to include new items:
// - Save game
if (globalId == 0xE2E) {
- moveHotspot( 22, Common::Rect(485, 175, 602, 190)); // Setup
- moveHotspot( 16, Common::Rect(485, 201, 602, 216)); // New game
- addMenuHotspot(23, Common::Rect(485, 227, 602, 242), 3, RivenStacks::ASpit::kExternalRestoreGame, "xarestoregame");
- addMenuHotspot(24, Common::Rect(485, 256, 602, 271), 4, RivenStacks::ASpit::kExternalSaveGame, "xaSaveGame");
- addMenuHotspot(25, Common::Rect(485, 283, 602, 300), 5, RivenStacks::ASpit::kExternalResume, "xaResumeGame");
- addMenuHotspot(26, Common::Rect(485, 309, 602, 326), 6, RivenStacks::ASpit::kExternalOptions, "xaOptions");
- addMenuHotspot(27, Common::Rect(485, 335, 602, 352), 7, RivenStacks::ASpit::kExternalQuit, "xademoquit");
+ moveHotspot( 22, Common::Rect(470, 175, 602, 190)); // Setup
+ moveHotspot( 16, Common::Rect(470, 201, 602, 216)); // New game
+ addMenuHotspot(23, Common::Rect(470, 227, 602, 242), 3, RivenStacks::ASpit::kExternalRestoreGame, "xarestoregame");
+ addMenuHotspot(24, Common::Rect(470, 256, 602, 271), 4, RivenStacks::ASpit::kExternalSaveGame, "xaSaveGame");
+ addMenuHotspot(25, Common::Rect(470, 283, 602, 300), 5, RivenStacks::ASpit::kExternalResume, "xaResumeGame");
+ addMenuHotspot(26, Common::Rect(470, 309, 602, 326), 6, RivenStacks::ASpit::kExternalOptions, "xaOptions");
+ addMenuHotspot(27, Common::Rect(470, 335, 602, 352), 7, RivenStacks::ASpit::kExternalQuit, "xademoquit");
_vm->getStack()->registerName(kExternalCommandNames, RivenStacks::ASpit::kExternalNewGame, "xaNewGame");
}
}
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index ee68587..a94b454 100644
--- a/engines/mohawk/riven_stacks/aspit.cpp
+++ b/engines/mohawk/riven_stacks/aspit.cpp
@@ -98,14 +98,17 @@ void ASpit::xastartupbtnhide(const ArgumentArray &args) {
const char *fontname;
const Graphics::Font *font = nullptr;
- if (_vm->getLanguage() != Common::JA_JPN)
+ int fontHeight;
+ if (_vm->getLanguage() != Common::JA_JPN) {
fontname = "FreeSans.ttf";
- else
+ fontHeight = 12;
+ } else {
fontname = "mplus-2c-regular.ttf";
+ fontHeight = 11;
+ }
#if defined(USE_FREETYPE2)
- int fontHeight = 11;
if (file.open(fontname)) {
font = Graphics::loadTTFFont(file, fontHeight);
}
More information about the Scummvm-git-logs
mailing list