aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-01-02 23:24:50 -0800
committerPaul Gilbert2019-01-02 23:24:50 -0800
commitdf74a209ca8496f08283285337181ea73a69b78f (patch)
tree86b006c37b9e52d9893449dded6f9a4a3d5f8f86 /engines
parent85816c8a54d77423c6400e41da93f62fe1f948ff (diff)
downloadscummvm-rg350-df74a209ca8496f08283285337181ea73a69b78f.tar.gz
scummvm-rg350-df74a209ca8496f08283285337181ea73a69b78f.tar.bz2
scummvm-rg350-df74a209ca8496f08283285337181ea73a69b78f.zip
GLK: FROTZ: Keep mono & prop font sizes to be the same for v6 games
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/frotz/config.cpp1
-rw-r--r--engines/glk/frotz/frotz.h3
-rw-r--r--engines/glk/frotz/screen.cpp14
-rw-r--r--engines/glk/glk.cpp7
4 files changed, 22 insertions, 3 deletions
diff --git a/engines/glk/frotz/config.cpp b/engines/glk/frotz/config.cpp
index f98e1e83ab..ad0764a9ab 100644
--- a/engines/glk/frotz/config.cpp
+++ b/engines/glk/frotz/config.cpp
@@ -92,6 +92,7 @@ Header::Header() : h_version(0), h_config(0), h_release(0), h_resident_size(0),
}
void Header::loadHeader(Common::SeekableReadStream &f) {
+ f.seek(0);
h_version = f.readByte();
h_config = f.readByte();
diff --git a/engines/glk/frotz/frotz.h b/engines/glk/frotz/frotz.h
index d05971a540..b5de82d7f8 100644
--- a/engines/glk/frotz/frotz.h
+++ b/engines/glk/frotz/frotz.h
@@ -28,10 +28,13 @@
namespace Glk {
namespace Frotz {
+class FrotzScreen;
+
/**
* Frotz interpreter for Z-code games
*/
class Frotz : public Processor {
+ friend class FrotzScreen;
protected:
/**
* Create the screen class
diff --git a/engines/glk/frotz/screen.cpp b/engines/glk/frotz/screen.cpp
index d843528cc4..06b36167e8 100644
--- a/engines/glk/frotz/screen.cpp
+++ b/engines/glk/frotz/screen.cpp
@@ -21,6 +21,7 @@
*/
#include "glk/frotz/screen.h"
+#include "glk/frotz/frotz.h"
#include "glk/conf.h"
#include "common/file.h"
#include "graphics/fonts/ttf.h"
@@ -36,6 +37,17 @@ FrotzScreen::FrotzScreen() : Glk::Screen() {
}
void FrotzScreen::loadFonts(Common::Archive *archive) {
+ // Get the zmachine version. At this point the header isn't loaded, so we have to do it manually
+ g_vm->_gameFile.seek(0);
+ byte version = g_vm->_gameFile.readByte();
+
+ if (version == 6) {
+ // For graphical games, force both mono and proportinate fonts to be the same size.
+ // This simplifies calculation of pixels when setting window position and sizes
+ g_conf->_monoInfo._size = g_conf->_propInfo._size = MAX(g_conf->_monoInfo._size, g_conf->_propInfo._size);
+ }
+
+ // Load the basic fonts
Screen::loadFonts(archive);
// Add character graphics font
@@ -46,7 +58,7 @@ void FrotzScreen::loadFonts(Common::Archive *archive) {
Common::Point fontSize(_fonts[0]->getMaxCharWidth(), _fonts[0]->getFontHeight());
decoder.loadStream(f);
- _fonts.push_back(new Frotz::BitmapFont(*decoder.getSurface(), fontSize));
+ _fonts.push_back(new BitmapFont(*decoder.getSurface(), fontSize));
f.close();
// Add Runic font. It provides cleaner versions of the runic characters in the
diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp
index e7d10fa29d..f39ef6a98a 100644
--- a/engines/glk/glk.cpp
+++ b/engines/glk/glk.cpp
@@ -107,12 +107,11 @@ void GlkEngine::initGraphicsMode() {
}
Common::Error GlkEngine::run() {
+ // Open up the game file
Common::String filename = getFilename();
if (!Common::File::exists(filename))
return Common::kNoGameDataFoundError;
- initialize();
-
if (Blorb::isBlorb(filename)) {
// Blorb archive
_blorb = new Blorb(filename, getInterpreterType());
@@ -139,6 +138,10 @@ Common::Error GlkEngine::run() {
return Common::kNoGameDataFoundError;
}
+ // Perform initialization
+ initialize();
+
+ // Play the game
runGame();
return Common::kNoError;