aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/zvision/core/menu.cpp4
-rw-r--r--engines/zvision/file/search_manager.cpp11
-rw-r--r--engines/zvision/file/zfs_archive.cpp3
-rw-r--r--engines/zvision/file/zfs_archive.h2
-rw-r--r--engines/zvision/graphics/cursors/cursor_manager.cpp6
-rw-r--r--engines/zvision/graphics/render_table.cpp3
-rw-r--r--engines/zvision/graphics/truetype_font.cpp76
-rw-r--r--engines/zvision/graphics/truetype_font.h39
-rw-r--r--engines/zvision/scripting/actions.cpp105
-rw-r--r--engines/zvision/scripting/actions.h5
-rw-r--r--engines/zvision/scripting/controls/input_control.cpp4
-rw-r--r--engines/zvision/scripting/controls/lever_control.cpp5
-rw-r--r--engines/zvision/scripting/controls/paint_control.cpp2
-rw-r--r--engines/zvision/scripting/controls/push_toggle_control.cpp1
-rw-r--r--engines/zvision/scripting/controls/save_control.cpp7
-rw-r--r--engines/zvision/scripting/controls/slot_control.cpp6
-rw-r--r--engines/zvision/scripting/puzzle.h2
-rw-r--r--engines/zvision/scripting/scr_file_handling.cpp2
-rw-r--r--engines/zvision/scripting/script_manager.cpp2
-rw-r--r--engines/zvision/scripting/sidefx/music_node.cpp45
-rw-r--r--engines/zvision/scripting/sidefx/music_node.h3
-rw-r--r--engines/zvision/scripting/sidefx/timer_node.cpp2
-rw-r--r--engines/zvision/sound/midi.cpp4
-rw-r--r--engines/zvision/sound/zork_raw.cpp22
-rw-r--r--engines/zvision/text/string_manager.cpp202
-rw-r--r--engines/zvision/text/string_manager.h25
-rw-r--r--engines/zvision/text/text.h4
-rw-r--r--engines/zvision/zvision.cpp6
28 files changed, 193 insertions, 405 deletions
diff --git a/engines/zvision/core/menu.cpp b/engines/zvision/core/menu.cpp
index c7898a4fbd..31e0d71370 100644
--- a/engines/zvision/core/menu.cpp
+++ b/engines/zvision/core/menu.cpp
@@ -58,6 +58,8 @@ MenuZGI::MenuZGI(ZVision *engine) :
scrollPos[1] = 0.0;
scrollPos[2] = 0.0;
mouseOnItem = -1;
+ redraw = false;
+ clean = false;
char buf[24];
for (int i = 1; i < 4; i++) {
@@ -557,6 +559,8 @@ MenuNemesis::MenuNemesis(ZVision *engine) :
scrolled = false;
scrollPos = 0.0;
mouseOnItem = -1;
+ redraw = false;
+ delay = 0;
char buf[24];
for (int i = 0; i < 4; i++)
diff --git a/engines/zvision/file/search_manager.cpp b/engines/zvision/file/search_manager.cpp
index 1a6a96ec6d..30c269c290 100644
--- a/engines/zvision/file/search_manager.cpp
+++ b/engines/zvision/file/search_manager.cpp
@@ -265,13 +265,14 @@ void SearchManager::addDir(const Common::String &name) {
void SearchManager::listDirRecursive(Common::List<Common::String> &_list, const Common::FSNode &fsNode, int depth) {
Common::FSList fsList;
- fsNode.getChildren(fsList);
+ if ( fsNode.getChildren(fsList) ) {
- _list.push_back(fsNode.getPath());
+ _list.push_back(fsNode.getPath());
- if (depth > 1)
- for (Common::FSList::const_iterator it = fsList.begin(); it != fsList.end(); ++it)
- listDirRecursive(_list, *it, depth - 1);
+ if (depth > 1)
+ for (Common::FSList::const_iterator it = fsList.begin(); it != fsList.end(); ++it)
+ listDirRecursive(_list, *it, depth - 1);
+ }
}
} // End of namespace ZVision
diff --git a/engines/zvision/file/zfs_archive.cpp b/engines/zvision/file/zfs_archive.cpp
index 9b55a366ed..3a385cd8fd 100644
--- a/engines/zvision/file/zfs_archive.cpp
+++ b/engines/zvision/file/zfs_archive.cpp
@@ -31,6 +31,7 @@ namespace ZVision {
ZfsArchive::ZfsArchive(const Common::String &fileName) : _fileName(fileName) {
Common::File zfsFile;
+ memset(&_header, 0, sizeof(_header));
if (!zfsFile.open(_fileName)) {
warning("ZFSArchive::ZFSArchive(): Could not find the archive file");
@@ -140,7 +141,7 @@ Common::SeekableReadStream *ZfsArchive::createReadStreamForMember(const Common::
byte *buffer = (byte *)malloc(entryHeader->size);
zfsArchive.read(buffer, entryHeader->size);
// Decrypt the data in place
- if (_header.xorKey != 0)
+ if (_header.xorKey[0] + _header.xorKey[1] + _header.xorKey[2] + _header.xorKey[3] != 0)
unXor(buffer, entryHeader->size, _header.xorKey);
return new Common::MemoryReadStream(buffer, entryHeader->size, DisposeAfterUse::YES);
diff --git a/engines/zvision/file/zfs_archive.h b/engines/zvision/file/zfs_archive.h
index 571591a6d1..fe0221416d 100644
--- a/engines/zvision/file/zfs_archive.h
+++ b/engines/zvision/file/zfs_archive.h
@@ -39,7 +39,7 @@ struct ZfsHeader {
uint32 maxNameLength;
uint32 filesPerBlock;
uint32 fileCount;
- byte xorKey[4];
+ uint8 xorKey[4];
uint32 fileSectionOffset;
};
diff --git a/engines/zvision/graphics/cursors/cursor_manager.cpp b/engines/zvision/graphics/cursors/cursor_manager.cpp
index a20deb26b5..92fd461c72 100644
--- a/engines/zvision/graphics/cursors/cursor_manager.cpp
+++ b/engines/zvision/graphics/cursors/cursor_manager.cpp
@@ -50,7 +50,8 @@ CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixel
_pixelFormat(pixelFormat),
_cursorIsPushed(false),
_item(0),
- _lastitem(0) {
+ _lastitem(0),
+ _currentCursor(CursorIndex_Idle) {
for (int i = 0; i < NUM_CURSORS; i++) {
if (_engine->getGameId() == GID_NEMESIS) {
Common::String name;
@@ -61,7 +62,8 @@ CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixel
} else if (_engine->getGameId() == GID_GRANDINQUISITOR) {
_cursors[i][0] = ZorkCursor(_engine, _zgiCursorFileNames[i]); // Up cursor
char buffer[25];
- strcpy(buffer, _zgiCursorFileNames[i]);
+ memset(buffer, 0, 25);
+ strncpy(buffer, _zgiCursorFileNames[i], 24);
buffer[3] += 2;
_cursors[i][1] = ZorkCursor(_engine, buffer); // Down cursor
}
diff --git a/engines/zvision/graphics/render_table.cpp b/engines/zvision/graphics/render_table.cpp
index 54faecfa8b..c30e0bd472 100644
--- a/engines/zvision/graphics/render_table.cpp
+++ b/engines/zvision/graphics/render_table.cpp
@@ -34,6 +34,9 @@ RenderTable::RenderTable(uint numColumns, uint numRows)
assert(numRows != 0 && numColumns != 0);
_internalBuffer = new Common::Point[numRows * numColumns];
+
+ memset(&_panoramaOptions, 0, sizeof(_panoramaOptions));
+ memset(&_tiltOptions, 0, sizeof(_tiltOptions));
}
RenderTable::~RenderTable() {
diff --git a/engines/zvision/graphics/truetype_font.cpp b/engines/zvision/graphics/truetype_font.cpp
index 1a0e92087c..2dbd7ca358 100644
--- a/engines/zvision/graphics/truetype_font.cpp
+++ b/engines/zvision/graphics/truetype_font.cpp
@@ -36,82 +36,6 @@
namespace ZVision {
-TruetypeFont::TruetypeFont(ZVision *engine, int32 fontHeight)
- : _engine(engine),
- _fontHeight(fontHeight),
- _font(0),
- _lineHeight(0),
- _maxCharWidth(0),
- _maxCharHeight(0) {
-}
-
-TruetypeFont::~TruetypeFont(void) {
- delete _font;
-}
-
-bool TruetypeFont::loadFile(const Common::String &filename) {
- Common::File file;
-
- bool fileOpened = false;
- if (!Common::File::exists(filename)) {
- debug("TTF font file %s was not found. Reverting to arial.ttf", filename.c_str());
- fileOpened = file.open("arial.ttf");
- } else {
- fileOpened = file.open(filename);
- }
-
- if (!fileOpened) {
- debug("TTF file could not be opened");
- return false;
- }
-
- _font = Graphics::loadTTFFont(file, _fontHeight);
- _lineHeight = _font->getFontHeight();
-
- return true;
-}
-
-Graphics::Surface *TruetypeFont::drawTextToSurface(const Common::String &text, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap) {
- if (text.equals("")) {
- return nullptr;
- }
-
- Graphics::Surface *surface = new Graphics::Surface();
-
- if (!wrap) {
- int width = MIN(_font->getStringWidth(text), maxWidth);
- surface->create(width, _lineHeight, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
- // TODO: Add better alpha support by getting the pixels from the backbuffer.
- // However doing that requires some kind of caching system so future text doesn't try to use this text as it's alpha background.
- surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), 0);
-
- _font->drawString(surface, text, 0, 0, maxWidth, textColor, align);
- return surface;
- }
-
- Common::Array<Common::String> lines;
- _font->wordWrapText(text, maxWidth, lines);
-
- while (maxHeight > 0 && (int)lines.size() * _lineHeight > maxHeight) {
- lines.pop_back();
- }
- if (lines.size() == 0) {
- delete surface;
- return nullptr;
- }
-
- surface->create(maxWidth, lines.size() * _lineHeight, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
- surface->fillRect(Common::Rect(0, 0, surface->w, surface->h), 0);
-
- int heightOffset = 0;
- for (Common::Array<Common::String>::iterator it = lines.begin(); it != lines.end(); it++) {
- _font->drawString(surface, *it, 0, 0 + heightOffset, maxWidth, textColor, align);
- heightOffset += _lineHeight;
- }
-
- return surface;
-}
-
StyledTTFont::StyledTTFont(ZVision *engine) {
_engine = engine;
_style = 0;
diff --git a/engines/zvision/graphics/truetype_font.h b/engines/zvision/graphics/truetype_font.h
index 30ef1c73a3..b5fac4af8a 100644
--- a/engines/zvision/graphics/truetype_font.h
+++ b/engines/zvision/graphics/truetype_font.h
@@ -36,45 +36,6 @@ namespace ZVision {
class ZVision;
-class TruetypeFont {
-public:
- TruetypeFont(ZVision *engine, int32 fontHeight);
- ~TruetypeFont();
-
-private:
- ZVision *_engine;
- Graphics::Font *_font;
- int _lineHeight;
-
- size_t _maxCharWidth;
- size_t _maxCharHeight;
-
-public:
- int32 _fontHeight;
-
-public:
- /**
- * Loads a .ttf file into memory. This must be called
- * before any calls to drawTextToSurface
- *
- * @param filename The file name of the .ttf file to load
- */
- bool loadFile(const Common::String &filename);
- /**
- * Renders the supplied text to a Surface using 0x0 as the
- * background color.
- *
- * @param text The to render
- * @param textColor The color to render the text with
- * @param maxWidth The max width the text should take up.
- * @param maxHeight The max height the text should take up.
- * @param align The alignment of the text within the bounds of maxWidth
- * @param wrap If true, any words extending past maxWidth will wrap to a new line. If false, ellipses will be rendered to show that the text didn't fit
- * @return A Surface containing the rendered text
- */
- Graphics::Surface *drawTextToSurface(const Common::String &text, uint16 textColor, int maxWidth, int maxHeight, Graphics::TextAlign align, bool wrap);
-};
-
// Styled TTF
class StyledTTFont {
public:
diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp
index d6883ed38f..0422a2c028 100644
--- a/engines/zvision/scripting/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -57,6 +57,9 @@ namespace ZVision {
ActionAdd::ActionAdd(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _key = 0;
+ _value = 0;
+
sscanf(line.c_str(), "%u,%d", &_key, &_value);
}
@@ -71,6 +74,8 @@ bool ActionAdd::execute() {
ActionAssign::ActionAssign(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _key = 0;
+
char buf[64];
memset(buf, 0, 64);
sscanf(line.c_str(), "%u, %s", &_key, buf);
@@ -93,6 +98,9 @@ bool ActionAssign::execute() {
ActionAttenuate::ActionAttenuate(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _key = 0;
+ _attenuation = 0;
+
sscanf(line.c_str(), "%u, %d", &_key, &_attenuation);
}
@@ -111,6 +119,12 @@ bool ActionAttenuate::execute() {
ActionChangeLocation::ActionChangeLocation(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _world = 'g';
+ _room = 'a';
+ _node = 'r';
+ _view = 'y';
+ _offset = 0;
+
sscanf(line.c_str(), "%c, %c, %c%c, %u", &_world, &_room, &_node, &_view, &_offset);
}
@@ -127,6 +141,14 @@ bool ActionChangeLocation::execute() {
ActionCrossfade::ActionCrossfade(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _keyOne = 0;
+ _keyTwo = 0;
+ _oneStartVolume = 0;
+ _twoStartVolume = 0;
+ _oneEndVolume = 0;
+ _twoEndVolume = 0;
+ _timeInMillis = 0;
+
sscanf(line.c_str(),
"%u %u %d %d %d %d %d",
&_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis);
@@ -195,6 +217,7 @@ bool ActionCursor::execute() {
ActionDelayRender::ActionDelayRender(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _framesToDelay = 0;
sscanf(line.c_str(), "%u", &_framesToDelay);
}
@@ -209,6 +232,8 @@ bool ActionDelayRender::execute() {
ActionDisableControl::ActionDisableControl(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _key = 0;
+
sscanf(line.c_str(), "%u", &_key);
}
@@ -223,6 +248,8 @@ bool ActionDisableControl::execute() {
ActionDisableVenus::ActionDisableVenus(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _key = 0;
+
sscanf(line.c_str(), "%d", &_key);
}
@@ -238,6 +265,9 @@ bool ActionDisableVenus::execute() {
ActionDisplayMessage::ActionDisplayMessage(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _control = 0;
+ _msgid = 0;
+
sscanf(line.c_str(), "%hd %hd", &_control, &_msgid);
}
@@ -270,6 +300,13 @@ bool ActionDissolve::execute() {
ActionDistort::ActionDistort(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _distSlot = 0;
+ _speed = 0;
+ _startAngle = 60.0;
+ _endAngle = 60.0;
+ _startLineScale = 1.0;
+ _endLineScale = 1.0;
+
sscanf(line.c_str(), "%hd %hd %f %f %f %f", &_distSlot, &_speed, &_startAngle, &_endAngle, &_startLineScale, &_endLineScale);
}
@@ -292,6 +329,8 @@ bool ActionDistort::execute() {
ActionEnableControl::ActionEnableControl(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _key = 0;
+
sscanf(line.c_str(), "%u", &_key);
}
@@ -320,6 +359,9 @@ bool ActionFlushMouseEvents::execute() {
ActionInventory::ActionInventory(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _type = -1;
+ _key = 0;
+
char buf[25];
sscanf(line.c_str(), "%25s %d", buf, &_key);
@@ -408,6 +450,8 @@ bool ActionKill::execute() {
ActionMenuBarEnable::ActionMenuBarEnable(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _menus = 0xFFFF;
+
sscanf(line.c_str(), "%hu", &_menus);
}
@@ -423,10 +467,12 @@ bool ActionMenuBarEnable::execute() {
ActionMusic::ActionMusic(ZVision *engine, int32 slotkey, const Common::String &line, bool global) :
ResultAction(engine, slotkey),
_volume(255),
+ _note(0),
+ _prog(0),
_universe(global) {
- uint type;
+ uint type = 0;
char fileNameBuffer[25];
- uint loop;
+ uint loop = 0;
uint volume = 255;
sscanf(line.c_str(), "%u %25s %u %u", &type, fileNameBuffer, &loop, &volume);
@@ -526,6 +572,9 @@ bool ActionPreferences::execute() {
ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _mask = 0;
+ _framerate = 0;
+
char fileName[25];
// The two %*u are always 0 and dont seem to have a use
@@ -562,6 +611,7 @@ bool ActionPreloadAnimation::execute() {
ActionUnloadAnimation::ActionUnloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _key = 0;
sscanf(line.c_str(), "%u", &_key);
}
@@ -581,6 +631,16 @@ bool ActionUnloadAnimation::execute() {
ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _x = 0;
+ _y = 0;
+ _x2 = 0;
+ _y2 = 0;
+ _start = 0;
+ _end = 0;
+ _loopCount = 0;
+ _mask = 0;
+ _framerate = 0;
+
char fileName[25];
// The two %*u are always 0 and dont seem to have a use
@@ -622,6 +682,15 @@ bool ActionPlayAnimation::execute() {
ActionPlayPreloadAnimation::ActionPlayPreloadAnimation(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _controlKey = 0;
+ _x1 = 0;
+ _y1 = 0;
+ _x2 = 0;
+ _y2 = 0;
+ _startFrame = 0;
+ _endFrame = 0;
+ _loopCount = 0;
+
sscanf(line.c_str(),
"%u %u %u %u %u %u %u %u",
&_controlKey, &_x1, &_y1, &_x2, &_y2, &_startFrame, &_endFrame, &_loopCount);
@@ -652,11 +721,15 @@ bool ActionQuit::execute() {
ActionRegion::ActionRegion(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _delay = 0;
+ _type = 0;
+ _unk1 = 0;
+ _unk2 = 0;
char art[64];
char custom[64];
- int32 x1, x2, y1, y2;
+ int32 x1 = 0, x2 = 0, y1 = 0, y2 = 0;
sscanf(line.c_str(), "%s %d %d %d %d %hu %hu %hu %hu %s", art, &x1, &y1, &x2, &y2, &_delay, &_type, &_unk1, &_unk2, custom);
_art = Common::String(art);
@@ -766,6 +839,9 @@ bool ActionRestoreGame::execute() {
ActionRotateTo::ActionRotateTo(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _time = 0;
+ _toPos = 0;
+
sscanf(line.c_str(), "%d, %d", &_toPos, &_time);
}
@@ -781,6 +857,9 @@ bool ActionRotateTo::execute() {
ActionSetPartialScreen::ActionSetPartialScreen(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _x = 0;
+ _y = 0;
+
char fileName[25];
int color;
@@ -845,6 +924,8 @@ bool ActionSetScreen::execute() {
ActionSetVenus::ActionSetVenus(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _key = 0;
+
sscanf(line.c_str(), "%d", &_key);
}
@@ -876,8 +957,14 @@ bool ActionStop::execute() {
ActionStreamVideo::ActionStreamVideo(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _x1 = 0;
+ _x2 = 0;
+ _y1 = 0;
+ _y2 = 0;
+ _flags = 0;
+
char fileName[25];
- uint skipline; //skipline - render video with skip every second line, not skippable.
+ uint skipline = 0; //skipline - render video with skip every second line, not skippable.
sscanf(line.c_str(), "%25s %u %u %u %u %u %u", fileName, &_x1, &_y1, &_x2, &_y2, &_flags, &skipline);
@@ -925,8 +1012,10 @@ bool ActionStreamVideo::execute() {
ActionSyncSound::ActionSyncSound(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _syncto = 0;
+
char fileName[25];
- int notUsed;
+ int notUsed = 0;
sscanf(line.c_str(), "%d %d %25s", &_syncto, &notUsed, fileName);
@@ -980,9 +1069,11 @@ bool ActionTimer::execute() {
ActionTtyText::ActionTtyText(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
+ _delay = 0;
+
char filename[64];
- int32 x1, y1, x2, y2;
- sscanf(line.c_str(), "%d %d %d %d %s %u", &x1, &y1, &x2, &y2, filename, &_delay);
+ int32 x1 = 0, y1 = 0, x2 = 0, y2 = 0;
+ sscanf(line.c_str(), "%d %d %d %d %64s %u", &x1, &y1, &x2, &y2, filename, &_delay);
_r = Common::Rect(x1, y1, x2, y2);
_filename = Common::String(filename);
}
diff --git a/engines/zvision/scripting/actions.h b/engines/zvision/scripting/actions.h
index f9e4ee8167..523890e9ac 100644
--- a/engines/zvision/scripting/actions.h
+++ b/engines/zvision/scripting/actions.h
@@ -239,7 +239,6 @@ public:
bool execute();
private:
- uint32 _key;
Common::String _fileName;
bool _loop;
byte _volume;
@@ -267,7 +266,6 @@ public:
bool execute();
private:
- uint32 _key;
Common::String _fileName;
uint32 _x;
uint32 _y;
@@ -304,7 +302,6 @@ public:
bool execute();
private:
- uint32 _key;
Common::String _fileName;
int32 _mask;
int32 _framerate;
@@ -357,7 +354,6 @@ public:
bool execute();
private:
- uint32 _key;
ValueSlot *_max;
};
@@ -454,7 +450,6 @@ public:
~ActionTimer();
bool execute();
private:
- uint32 _key;
ValueSlot *_time;
};
diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp
index 6959f9eca9..e75cc15743 100644
--- a/engines/zvision/scripting/controls/input_control.cpp
+++ b/engines/zvision/scripting/controls/input_control.cpp
@@ -46,7 +46,9 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre
_enterPressed(false),
_readOnly(false),
_txtWidth(0),
- _animation(NULL) {
+ _animation(NULL),
+ _frameDelay(0),
+ _frame(-1) {
// Loop until we find the closing brace
Common::String line = stream.readLine();
_engine->getScriptManager()->trimCommentsAndWhiteSpace(&line);
diff --git a/engines/zvision/scripting/controls/lever_control.cpp b/engines/zvision/scripting/controls/lever_control.cpp
index 71dd52f40f..8faa18357c 100644
--- a/engines/zvision/scripting/controls/lever_control.cpp
+++ b/engines/zvision/scripting/controls/lever_control.cpp
@@ -48,7 +48,10 @@ LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStre
_mouseIsCaptured(false),
_isReturning(false),
_accumulatedTime(0),
- _returnRoutesCurrentFrame(0) {
+ _returnRoutesCurrentFrame(0),
+ _animation(NULL),
+ _cursor(CursorIndex_Active),
+ _mirrored(false) {
// Loop until we find the closing brace
Common::String line = stream.readLine();
diff --git a/engines/zvision/scripting/controls/paint_control.cpp b/engines/zvision/scripting/controls/paint_control.cpp
index f06dee25ad..df06bb814e 100644
--- a/engines/zvision/scripting/controls/paint_control.cpp
+++ b/engines/zvision/scripting/controls/paint_control.cpp
@@ -69,7 +69,7 @@ PaintControl::PaintControl(ZVision *engine, uint32 key, Common::SeekableReadStre
} else if (param.matchString("eligible_objects", true)) {
char buf[256];
memset(buf, 0, 256);
- strcpy(buf, values.c_str());
+ strncpy(buf, values.c_str(), 255);
char *curpos = buf;
char *strend = buf + strlen(buf);
diff --git a/engines/zvision/scripting/controls/push_toggle_control.cpp b/engines/zvision/scripting/controls/push_toggle_control.cpp
index 3811498cd5..f51a28d644 100644
--- a/engines/zvision/scripting/controls/push_toggle_control.cpp
+++ b/engines/zvision/scripting/controls/push_toggle_control.cpp
@@ -35,6 +35,7 @@ namespace ZVision {
PushToggleControl::PushToggleControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream)
: Control(engine, key, CONTROL_PUSHTGL),
_countTo(2),
+ _cursor(CursorIndex_Active),
_event(Common::EVENT_LBUTTONUP) {
_hotspots.clear();
diff --git a/engines/zvision/scripting/controls/save_control.cpp b/engines/zvision/scripting/controls/save_control.cpp
index e27faa50b6..b35611feca 100644
--- a/engines/zvision/scripting/controls/save_control.cpp
+++ b/engines/zvision/scripting/controls/save_control.cpp
@@ -77,10 +77,11 @@ SaveControl::SaveControl(ZVision *engine, uint32 key, Common::SeekableReadStream
Common::SeekableReadStream *save = _engine->getSaveManager()->getSlotFile(iter->saveId);
if (save) {
SaveGameHeader header;
- _engine->getSaveManager()->readSaveGameHeader(save, header);
+ if (_engine->getSaveManager()->readSaveGameHeader(save, header)) {
+ inp->setText(header.saveName);
+ iter->exist = true;
+ }
delete save;
- inp->setText(header.saveName);
- iter->exist = true;
}
}
}
diff --git a/engines/zvision/scripting/controls/slot_control.cpp b/engines/zvision/scripting/controls/slot_control.cpp
index 292a2b4bc9..42b54a9ab5 100644
--- a/engines/zvision/scripting/controls/slot_control.cpp
+++ b/engines/zvision/scripting/controls/slot_control.cpp
@@ -34,7 +34,9 @@
namespace ZVision {
SlotControl::SlotControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream)
- : Control(engine, key, CONTROL_SLOT) {
+ : Control(engine, key, CONTROL_SLOT),
+ _cursor(CursorIndex_Active),
+ _distanceId('0') {
_renderedItem = 0;
_bkg = NULL;
@@ -74,7 +76,7 @@ SlotControl::SlotControl(ZVision *engine, uint32 key, Common::SeekableReadStream
} else if (param.matchString("eligible_objects", true)) {
char buf[256];
memset(buf, 0, 256);
- strcpy(buf, values.c_str());
+ strncpy(buf, values.c_str(), 255);
char *curpos = buf;
char *strend = buf + strlen(buf);
diff --git a/engines/zvision/scripting/puzzle.h b/engines/zvision/scripting/puzzle.h
index 4123880835..7d64357b0a 100644
--- a/engines/zvision/scripting/puzzle.h
+++ b/engines/zvision/scripting/puzzle.h
@@ -31,7 +31,7 @@
namespace ZVision {
struct Puzzle {
- Puzzle() : key(0) {}
+ Puzzle() : key(0), addedBySetState(false) {}
~Puzzle() {
for (Common::List<ResultAction *>::iterator iter = resultActions.begin(); iter != resultActions.end(); ++iter) {
diff --git a/engines/zvision/scripting/scr_file_handling.cpp b/engines/zvision/scripting/scr_file_handling.cpp
index 56d0c3bd7f..c117da5ec2 100644
--- a/engines/zvision/scripting/scr_file_handling.cpp
+++ b/engines/zvision/scripting/scr_file_handling.cpp
@@ -96,7 +96,7 @@ void ScriptManager::parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stre
trimCommentsAndWhiteSpace(&line);
}
- puzzle->addedBySetState = 0;
+ puzzle->addedBySetState = false;
}
bool ScriptManager::parseCriteria(Common::SeekableReadStream &stream, Common::List<Common::List<Puzzle::CriteriaEntry> > &criteriaList) const {
diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index 65077dfd12..4c1e69072d 100644
--- a/engines/zvision/scripting/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -97,7 +97,7 @@ bool ScriptManager::execScope(ScriptScope &scope) {
scope.scopeQueue->clear();
for (PuzzleList::iterator PuzzleIter = scope.puzzles.begin(); PuzzleIter != scope.puzzles.end(); ++PuzzleIter)
- (*PuzzleIter)->addedBySetState = 0;
+ (*PuzzleIter)->addedBySetState = false;
if (scope.procCount < 2 || getStateValue(StateKey_ExecScopeStyle)) {
for (PuzzleList::iterator PuzzleIter = scope.puzzles.begin(); PuzzleIter != scope.puzzles.end(); ++PuzzleIter)
diff --git a/engines/zvision/scripting/sidefx/music_node.cpp b/engines/zvision/scripting/sidefx/music_node.cpp
index c79dd0296d..56598189f6 100644
--- a/engines/zvision/scripting/sidefx/music_node.cpp
+++ b/engines/zvision/scripting/sidefx/music_node.cpp
@@ -47,6 +47,8 @@ MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool
_pantrack = false;
_pantrackPosition = 0;
_sub = NULL;
+ _stereo = false;
+ _loaded = false;
Audio::RewindableAudioStream *audioStream = NULL;
@@ -59,30 +61,35 @@ MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool
audioStream = makeRawZorkStream(filename, _engine);
}
- _stereo = audioStream->isStereo();
+ if (audioStream) {
+ _stereo = audioStream->isStereo();
- if (_loop) {
- Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES);
- _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_handle, loopingAudioStream, -1, _volume);
- } else {
- _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_handle, audioStream, -1, _volume);
- }
+ if (_loop) {
+ Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES);
+ _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_handle, loopingAudioStream, -1, _volume);
+ } else {
+ _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_handle, audioStream, -1, _volume);
+ }
- if (_key != StateKey_NotSet)
- _engine->getScriptManager()->setStateValue(_key, 1);
+ if (_key != StateKey_NotSet)
+ _engine->getScriptManager()->setStateValue(_key, 1);
+
+ // Change filename.raw into filename.sub
+ Common::String subname = filename;
+ subname.setChar('s', subname.size() - 3);
+ subname.setChar('u', subname.size() - 2);
+ subname.setChar('b', subname.size() - 1);
- // Change filename.raw into filename.sub
- Common::String subname = filename;
- subname.setChar('s', subname.size() - 3);
- subname.setChar('u', subname.size() - 2);
- subname.setChar('b', subname.size() - 1);
+ if (_engine->getSearchManager()->hasFile(subname))
+ _sub = new Subtitle(_engine, subname);
- if (_engine->getSearchManager()->hasFile(subname))
- _sub = new Subtitle(_engine, subname);
+ _loaded = true;
+ }
}
MusicNode::~MusicNode() {
- _engine->_mixer->stopHandle(_handle);
+ if (!_loaded)
+ _engine->_mixer->stopHandle(_handle);
if (_key != StateKey_NotSet)
_engine->getScriptManager()->setStateValue(_key, 2);
if (_sub)
@@ -110,7 +117,7 @@ void MusicNode::setFade(int32 time, uint8 target) {
}
bool MusicNode::process(uint32 deltaTimeInMillis) {
- if (! _engine->_mixer->isSoundHandleActive(_handle))
+ if (!_loaded || ! _engine->_mixer->isSoundHandleActive(_handle))
return stop();
else {
uint8 _newvol = _volume;
@@ -137,6 +144,8 @@ bool MusicNode::process(uint32 deltaTimeInMillis) {
}
void MusicNode::setVolume(uint8 newVolume) {
+ if (!_loaded)
+ return;
if (_pantrack) {
int curX = _engine->getScriptManager()->getStateValue(StateKey_ViewPos);
curX -= _pantrackPosition;
diff --git a/engines/zvision/scripting/sidefx/music_node.h b/engines/zvision/scripting/sidefx/music_node.h
index c89345f0d0..09bdc3707e 100644
--- a/engines/zvision/scripting/sidefx/music_node.h
+++ b/engines/zvision/scripting/sidefx/music_node.h
@@ -77,7 +77,6 @@ public:
void setFade(int32 time, uint8 target);
private:
- int32 _timeLeft;
bool _pantrack;
int32 _pantrackPosition;
int32 _attenuate;
@@ -89,6 +88,7 @@ private:
bool _stereo;
Audio::SoundHandle _handle;
Subtitle *_sub;
+ bool _loaded;
};
class MusicMidiNode : public MusicNodeBASE {
@@ -115,7 +115,6 @@ public:
private:
int8 _chan;
int8 _noteNumber;
- int8 _velocity;
int8 _pan;
int8 _volume;
int8 _prog;
diff --git a/engines/zvision/scripting/sidefx/timer_node.cpp b/engines/zvision/scripting/sidefx/timer_node.cpp
index abf2c90b04..170f6e7472 100644
--- a/engines/zvision/scripting/sidefx/timer_node.cpp
+++ b/engines/zvision/scripting/sidefx/timer_node.cpp
@@ -33,6 +33,8 @@ namespace ZVision {
TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds)
: SideFX(engine, key, SIDEFX_TIMER) {
+ _timeLeft = 0;
+
if (_engine->getGameId() == GID_NEMESIS)
_timeLeft = timeInSeconds * 1000;
else if (_engine->getGameId() == GID_GRANDINQUISITOR)
diff --git a/engines/zvision/sound/midi.cpp b/engines/zvision/sound/midi.cpp
index 920002c7c3..3dd66ff2d4 100644
--- a/engines/zvision/sound/midi.cpp
+++ b/engines/zvision/sound/midi.cpp
@@ -21,6 +21,7 @@
*/
#include "common/scummsys.h"
+#include "common/textconsole.h"
#include "zvision/sound/midi.h"
@@ -29,7 +30,8 @@ namespace ZVision {
MidiManager::MidiManager() {
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB);
_driver = MidiDriver::createMidi(dev);
- _driver->open();
+ if (_driver->open())
+ warning("Can't open MIDI, no MIDI output!");
}
MidiManager::~MidiManager() {
diff --git a/engines/zvision/sound/zork_raw.cpp b/engines/zvision/sound/zork_raw.cpp
index 78c851e132..8688039325 100644
--- a/engines/zvision/sound/zork_raw.cpp
+++ b/engines/zvision/sound/zork_raw.cpp
@@ -73,6 +73,9 @@ RawChunkStream::RawChunk RawChunkStream::readNextChunk(Common::SeekableReadStrea
tmp.size = 0;
tmp.data = NULL;
+ if (!stream)
+ return tmp;
+
if (stream && (stream->size() == 0 || stream->eos()))
return tmp;
@@ -261,30 +264,33 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath,
fileName.toLowercase();
- SoundParams soundParams = {};
+ const SoundParams *soundParams = NULL;
if (engine->getGameId() == GID_NEMESIS) {
for (int i = 0; i < 32; ++i) {
if (RawZorkStream::_zNemSoundParamLookupTable[i].identifier == (fileName[6]))
- soundParams = RawZorkStream::_zNemSoundParamLookupTable[i];
+ soundParams = &RawZorkStream::_zNemSoundParamLookupTable[i];
}
} else if (engine->getGameId() == GID_GRANDINQUISITOR) {
for (int i = 0; i < 24; ++i) {
if (RawZorkStream::_zgiSoundParamLookupTable[i].identifier == (fileName[7]))
- soundParams = RawZorkStream::_zgiSoundParamLookupTable[i];
+ soundParams = &RawZorkStream::_zgiSoundParamLookupTable[i];
}
}
- if (soundParams.packed) {
- return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams.rate, soundParams.stereo, DisposeAfterUse::YES);
+ if (soundParams == NULL)
+ return NULL;
+
+ if (soundParams->packed) {
+ return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams->rate, soundParams->stereo, DisposeAfterUse::YES);
} else {
byte flags = 0;
- if (soundParams.bits16)
+ if (soundParams->bits16)
flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
- if (soundParams.stereo)
+ if (soundParams->stereo)
flags |= Audio::FLAG_STEREO;
- return Audio::makeRawStream(file, soundParams.rate, flags, DisposeAfterUse::YES);
+ return Audio::makeRawStream(file, soundParams->rate, flags, DisposeAfterUse::YES);
}
}
diff --git a/engines/zvision/text/string_manager.cpp b/engines/zvision/text/string_manager.cpp
index d275bc8769..ec10b6220c 100644
--- a/engines/zvision/text/string_manager.cpp
+++ b/engines/zvision/text/string_manager.cpp
@@ -30,7 +30,7 @@
#include "zvision/zvision.h"
#include "zvision/file/search_manager.h"
#include "zvision/text/string_manager.h"
-#include "zvision/graphics/truetype_font.h"
+#include "zvision/text/text.h"
namespace ZVision {
@@ -39,9 +39,7 @@ StringManager::StringManager(ZVision *engine)
}
StringManager::~StringManager() {
- for (Common::HashMap<Common::String, TruetypeFont *>::iterator iter = _fonts.begin(); iter != _fonts.end(); ++iter) {
- delete iter->_value;
- }
+
}
void StringManager::initialize(ZVisionGameId gameId) {
@@ -69,202 +67,6 @@ void StringManager::loadStrFile(const Common::String &fileName) {
}
}
-void StringManager::parseStrFile(const Common::String &fileName) {
- Common::File file;
- if (!file.open(fileName)) {
- warning("%s does not exist. String parsing failed", fileName.c_str());
- return;
- }
-
- uint lineNumber = 0;
- while (!file.eos()) {
- _lastStyle.align = Graphics::kTextAlignLeft;
- _lastStyle.color = 0;
- _lastStyle.font = nullptr;
-
- Common::String asciiLine = readWideLine(file);
- if (asciiLine.empty()) {
- continue;
- }
-
- char tagString[150];
- uint tagStringCursor = 0;
- char textString[150];
- uint textStringCursor = 0;
- bool inTag = false;
-
- for (uint i = 0; i < asciiLine.size(); ++i) {
- switch (asciiLine[i]) {
- case '<':
- inTag = true;
- if (!_inGameText[lineNumber].fragments.empty()) {
- _inGameText[lineNumber].fragments.back().text = Common::String(textString, textStringCursor);
- textStringCursor = 0;
- }
- break;
- case '>':
- inTag = false;
- parseTag(Common::String(tagString, tagStringCursor), lineNumber);
- tagStringCursor = 0;
- break;
- default:
- if (inTag) {
- tagString[tagStringCursor] = asciiLine[i];
- tagStringCursor++;
- } else {
- textString[textStringCursor] = asciiLine[i];
- textStringCursor++;
- }
- break;
- }
- }
-
- if (textStringCursor > 0) {
- _inGameText[lineNumber].fragments.back().text = Common::String(textString, textStringCursor);
- }
-
- lineNumber++;
- assert(lineNumber <= NUM_TEXT_LINES);
- }
-}
-
-void StringManager::parseTag(const Common::String &tagString, uint lineNumber) {
- Common::StringTokenizer tokenizer(tagString);
-
- Common::String token = tokenizer.nextToken();
-
- Common::String fontName;
- bool bold = false;
- Graphics::TextAlign align = _lastStyle.align;
- int point = _lastStyle.font != nullptr ? _lastStyle.font->_fontHeight : 12;
- int red = 0;
- int green = 0;
- int blue = 0;
-
- while (!token.empty()) {
- if (token.matchString("font", true)) {
- fontName = tokenizer.nextToken();
- } else if (token.matchString("bold", true)) {
- token = tokenizer.nextToken();
- if (token.matchString("on", false)) {
- bold = true;
- }
- } else if (token.matchString("justify", true)) {
- token = tokenizer.nextToken();
- if (token.matchString("center", false)) {
- align = Graphics::kTextAlignCenter;
- } else if (token.matchString("right", false)) {
- align = Graphics::kTextAlignRight;
- }
- } else if (token.matchString("point", true)) {
- point = atoi(tokenizer.nextToken().c_str());
- } else if (token.matchString("red", true)) {
- red = atoi(tokenizer.nextToken().c_str());
- } else if (token.matchString("green", true)) {
- green = atoi(tokenizer.nextToken().c_str());
- } else if (token.matchString("blue", true)) {
- blue = atoi(tokenizer.nextToken().c_str());
- }
-
- token = tokenizer.nextToken();
- }
-
- TextFragment fragment;
-
- if (fontName.empty()) {
- fragment.style.font = _lastStyle.font;
- } else {
- Common::String newFontName;
- if (fontName.matchString("*times new roman*", true)) {
- if (bold) {
- newFontName = "timesbd.ttf";
- } else {
- newFontName = "times.ttf";
- }
- } else if (fontName.matchString("*courier new*", true)) {
- if (bold) {
- newFontName = "courbd.ttf";
- } else {
- newFontName = "cour.ttf";
- }
- } else if (fontName.matchString("*century schoolbook*", true)) {
- if (bold) {
- newFontName = "censcbkbd.ttf";
- } else {
- newFontName = "censcbk.ttf";
- }
- } else if (fontName.matchString("*garamond*", true)) {
- if (bold) {
- newFontName = "garabd.ttf";
- } else {
- newFontName = "gara.ttf";
- }
- } else {
- debug("Could not identify font: %s. Reverting to Arial", fontName.c_str());
- if (bold) {
- newFontName = "zorknorm.ttf";
- } else {
- newFontName = "arial.ttf";
- }
- }
-
- Common::String fontKey = Common::String::format("%s-%d", newFontName.c_str(), point);
- if (_fonts.contains(fontKey)) {
- fragment.style.font = _fonts[fontKey];
- } else {
- fragment.style.font = new TruetypeFont(_engine, point);
- fragment.style.font->loadFile(newFontName);
- _fonts[fontKey] = fragment.style.font;
- }
- }
-
- fragment.style.align = align;
- fragment.style.color = Graphics::ARGBToColor<Graphics::ColorMasks<565> >(0, red, green, blue);
- _inGameText[lineNumber].fragments.push_back(fragment);
-
- _lastStyle = fragment.style;
-}
-
-Common::String StringManager::readWideLine(Common::SeekableReadStream &stream) {
- Common::String asciiString;
-
- // Don't spam the user with warnings about UTF-16 support.
- // Just do one warning per String
- bool charOverflowWarning = false;
-
- uint16 value = stream.readUint16LE();
- while (!stream.eos()) {
- // Check for CRLF
- if (value == 0x0A0D) {
- // Read in the extra NULL char
- stream.readByte(); // \0
- // End of the line. Break
- break;
- }
-
- // Crush each octet pair to a single octet with a simple cast
- if (value > 255) {
- charOverflowWarning = true;
- value = '?';
- }
- char charValue = (char)value;
-
- asciiString += charValue;
-
- value = stream.readUint16LE();
- }
-
- if (charOverflowWarning) {
- warning("UTF-16 is not supported. Characters greater than 255 are replaced with '?'");
- }
-
- return asciiString;
-}
-
-StringManager::TextStyle StringManager::getTextStyle(uint stringNumber) {
- return _inGameText[stringNumber].fragments.front().style;
-}
-
const Common::String StringManager::getTextLine(uint stringNumber) {
return _lines[stringNumber];
}
diff --git a/engines/zvision/text/string_manager.h b/engines/zvision/text/string_manager.h
index 8d6fbe67a6..b77ad65040 100644
--- a/engines/zvision/text/string_manager.h
+++ b/engines/zvision/text/string_manager.h
@@ -40,17 +40,6 @@ public:
~StringManager();
public:
- struct TextStyle {
- TruetypeFont *font;
- uint16 color; // In RBG 565
- Graphics::TextAlign align;
- };
-
- struct TextFragment {
- TextStyle style;
- Common::String text;
- };
-
enum {
ZVISION_STR_SAVEEXIST = 23,
ZVISION_STR_SAVED = 4,
@@ -59,10 +48,6 @@ public:
};
private:
- struct InGameText {
- Common::List<TextFragment> fragments;
- };
-
enum {
NUM_TEXT_LINES = 56 // Max number of lines in a .str file. We hardcode this number because we know ZNem uses 42 strings and ZGI uses 56
};
@@ -71,22 +56,12 @@ private:
ZVision *_engine;
Common::String _lines[NUM_TEXT_LINES];
- InGameText _inGameText[NUM_TEXT_LINES];
- Common::HashMap<Common::String, TruetypeFont *> _fonts;
-
- TextStyle _lastStyle;
-
public:
void initialize(ZVisionGameId gameId);
- StringManager::TextStyle getTextStyle(uint stringNumber);
const Common::String getTextLine(uint stringNumber);
private:
void loadStrFile(const Common::String &fileName);
- void parseStrFile(const Common::String &fileName);
- void parseTag(const Common::String &tagString, uint lineNumber);
-
- static Common::String readWideLine(Common::SeekableReadStream &stream);
};
} // End of namespace ZVision
diff --git a/engines/zvision/text/text.h b/engines/zvision/text/text.h
index 01c3fd760c..ecec3ccde6 100644
--- a/engines/zvision/text/text.h
+++ b/engines/zvision/text/text.h
@@ -28,10 +28,6 @@
#include "zvision/graphics/truetype_font.h"
#include "zvision/zvision.h"
-namespace Graphics {
-class FontManager;
-}
-
namespace ZVision {
class ZVision;
diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp
index f9d6bb3e85..4e5307c182 100644
--- a/engines/zvision/zvision.cpp
+++ b/engines/zvision/zvision.cpp
@@ -90,6 +90,12 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc)
_stringManager(nullptr),
_cursorManager(nullptr),
_midiManager(nullptr),
+ _rnd(nullptr),
+ _console(nullptr),
+ _menu(nullptr),
+ _searchManager(nullptr),
+ _textRenderer(nullptr),
+ _halveDelay(false),
_audioId(0),
_rendDelay(2),
_kbdVelocity(0),