aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/zvision/text/string_manager.cpp25
-rw-r--r--engines/zvision/text/string_manager.h4
2 files changed, 27 insertions, 2 deletions
diff --git a/engines/zvision/text/string_manager.cpp b/engines/zvision/text/string_manager.cpp
index cadfbf1f49..114f298505 100644
--- a/engines/zvision/text/string_manager.cpp
+++ b/engines/zvision/text/string_manager.cpp
@@ -22,6 +22,8 @@
#include "common/scummsys.h"
+#include "zvision/zvision.h"
+#include "zvision/core/search_manager.h"
#include "zvision/text/string_manager.h"
#include "zvision/fonts/truetype_font.h"
@@ -49,10 +51,25 @@ StringManager::~StringManager() {
void StringManager::initialize(ZVisionGameId gameId) {
if (gameId == GID_NEMESIS) {
// TODO: Check this hardcoded filename against all versions of Nemesis
- parseStrFile("nemesis.str");
+ loadStrFile("nemesis.str");
} else if (gameId == GID_GRANDINQUISITOR) {
// TODO: Check this hardcoded filename against all versions of Grand Inquisitor
- parseStrFile("inquis.str");
+ loadStrFile("inquis.str");
+ }
+}
+
+void StringManager::loadStrFile(const Common::String &fileName) {
+ Common::File file;
+ if (!_engine->getSearchManager()->openFile(file, fileName)) {
+ warning("%s does not exist. String parsing failed", fileName.c_str());
+ return;
+ }
+ uint lineNumber = 0;
+ while (!file.eos()) {
+ _lines[lineNumber] = readWideLine(file);
+
+ lineNumber++;
+ assert(lineNumber <= NUM_TEXT_LINES);
}
}
@@ -252,4 +269,8 @@ StringManager::TextStyle StringManager::getTextStyle(uint stringNumber) {
return _inGameText[stringNumber].fragments.front().style;
}
+const Common::String StringManager::getTextLine(uint stringNumber) {
+ return _lines[stringNumber];
+}
+
} // End of namespace ZVision
diff --git a/engines/zvision/text/string_manager.h b/engines/zvision/text/string_manager.h
index af8324b890..e226fbeae8 100644
--- a/engines/zvision/text/string_manager.h
+++ b/engines/zvision/text/string_manager.h
@@ -63,6 +63,8 @@ private:
private:
ZVision *_engine;
+ Common::String _lines[NUM_TEXT_LINES];
+
InGameText _inGameText[NUM_TEXT_LINES];
Common::HashMap<Common::String, TruetypeFont *> _fonts;
@@ -71,8 +73,10 @@ private:
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);