aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/riven_stacks
diff options
context:
space:
mode:
authorBastien Bouclet2018-06-17 14:44:31 +0200
committerBastien Bouclet2018-06-29 13:31:54 +0200
commit2e8d08c1d0d626b1dd9c69c951de07aec7fd4bb4 (patch)
tree9cef8c38650cd5605ac40cde4173e562ab890ebe /engines/mohawk/riven_stacks
parent0ca52f62a4b475081f77eb933934c8f3448f33e2 (diff)
downloadscummvm-rg350-2e8d08c1d0d626b1dd9c69c951de07aec7fd4bb4.tar.gz
scummvm-rg350-2e8d08c1d0d626b1dd9c69c951de07aec7fd4bb4.tar.bz2
scummvm-rg350-2e8d08c1d0d626b1dd9c69c951de07aec7fd4bb4.zip
MOHAWK: RIVEN: Add a save button to the main menu
Diffstat (limited to 'engines/mohawk/riven_stacks')
-rw-r--r--engines/mohawk/riven_stacks/aspit.cpp43
-rw-r--r--engines/mohawk/riven_stacks/aspit.h7
2 files changed, 39 insertions, 11 deletions
diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp
index 1c6f330b64..893221244c 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 b2e5301dad..75b9fd3e64 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);