aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorEugene Sandulenko2018-06-15 00:48:00 +0200
committerBastien Bouclet2018-06-29 13:31:54 +0200
commit0ca52f62a4b475081f77eb933934c8f3448f33e2 (patch)
tree575770bfee6b8d5204f4085c8d6a6d52291373e0 /engines/mohawk
parent1e9b58ab4bf864456de315c03c3cf3d0d2a81b2e (diff)
downloadscummvm-rg350-0ca52f62a4b475081f77eb933934c8f3448f33e2.tar.gz
scummvm-rg350-0ca52f62a4b475081f77eb933934c8f3448f33e2.tar.bz2
scummvm-rg350-0ca52f62a4b475081f77eb933934c8f3448f33e2.zip
MOHAWK: RIVEN: Draw menu with TTF fonts
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/riven_graphics.cpp20
-rw-r--r--engines/mohawk/riven_graphics.h2
-rw-r--r--engines/mohawk/riven_stacks/aspit.cpp47
3 files changed, 69 insertions, 0 deletions
diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index e19a56da92..cc5105b15c 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 7b831c5609..69a3182783 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 67b416c9ca..1c6f330b64 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) {