aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/adl/adl_v2.h4
-rw-r--r--engines/adl/hires6.cpp33
-rw-r--r--engines/adl/hires6.h1
3 files changed, 36 insertions, 2 deletions
diff --git a/engines/adl/adl_v2.h b/engines/adl/adl_v2.h
index 947b0d8faf..60af4de484 100644
--- a/engines/adl/adl_v2.h
+++ b/engines/adl/adl_v2.h
@@ -45,8 +45,8 @@ protected:
virtual void setupOpcodeTables();
byte roomArg(byte room) const;
void advanceClock();
- void printString(const Common::String &str);
- Common::String loadMessage(uint idx) const;
+ virtual void printString(const Common::String &str);
+ virtual Common::String loadMessage(uint idx) const;
void drawItems();
void drawItem(Item &item, const Common::Point &pos);
void loadRoom(byte roomNr);
diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp
index e15cf43e5b..7ac953c19a 100644
--- a/engines/adl/hires6.cpp
+++ b/engines/adl/hires6.cpp
@@ -246,6 +246,39 @@ void HiRes6Engine::applyDataBlockOffset(byte &track, byte &sector) const {
++track;
}
+void HiRes6Engine::printString(const Common::String &str) {
+ Common::String s;
+ uint found = 0;
+
+ // This does not emulate the corner cases of the original, hence this check
+ if (getVar(27) > 1)
+ error("Invalid value %i encountered for variable 27", getVar(27));
+
+ for (uint i = 0; i < str.size(); ++i) {
+ if (str[i] == '%') {
+ ++found;
+ if (found == 3)
+ found = 0;
+ continue;
+ }
+
+ switch (found) {
+ case 0:
+ s += str[i];
+ break;
+ case 1:
+ if (getVar(27) == 0)
+ s += str[i];
+ break;
+ case 2:
+ if (getVar(27) == 1)
+ s += str[i];
+ }
+ }
+
+ AdlEngine_v2::printString(s);
+}
+
Engine *HiRes6Engine_create(OSystem *syst, const AdlGameDescription *gd) {
return new HiRes6Engine(syst, gd);
}
diff --git a/engines/adl/hires6.h b/engines/adl/hires6.h
index 395e85232f..a8450705c4 100644
--- a/engines/adl/hires6.h
+++ b/engines/adl/hires6.h
@@ -59,6 +59,7 @@ private:
void initState();
// AdlEngine_v2
+ void printString(const Common::String &str);
void applyDataBlockOffset(byte &track, byte &sector) const;
};