aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/supernova/supernova.cpp12
-rw-r--r--engines/supernova/supernova.h4
2 files changed, 16 insertions, 0 deletions
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp
index 52bc379582..2e2957f0c4 100644
--- a/engines/supernova/supernova.cpp
+++ b/engines/supernova/supernova.cpp
@@ -355,6 +355,8 @@ void SupernovaEngine::removeMessage() {
void SupernovaEngine::renderText(const char *text, int x, int y, byte color) {
Graphics::Surface *screen = _system->lockScreen();
byte *cursor = static_cast<byte *>(screen->getBasePtr(x, y));
+ const byte *basePtr = cursor;
+
byte c;
while ((c = *text++) != '\0') {
if (c < 32) {
@@ -380,6 +382,16 @@ void SupernovaEngine::renderText(const char *text, int x, int y, byte color) {
}
}
_system->unlockScreen();
+
+ size_t numChars = cursor - basePtr;
+ size_t absPosition = y * kScreenWidth + x + numChars;
+ _textCursorX = absPosition % kScreenWidth;
+ _textCursorY = absPosition / kScreenWidth;
+ _textColor = color;
+}
+
+void SupernovaEngine::renderText(const char *text) {
+ renderText(text, _textCursorX, _textCursorY, _textColor);
}
void SupernovaEngine::renderBox(int x, int y, int width, int height, byte color) {
diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h
index d46da280fb..c1dc3013a7 100644
--- a/engines/supernova/supernova.h
+++ b/engines/supernova/supernova.h
@@ -91,6 +91,9 @@ public:
byte _brightness;
uint _delay;
bool _messageDisplayed;
+ int _textCursorX;
+ int _textCursorY;
+ int _textColor;
uint getDOSTicks();
void initData();
@@ -109,6 +112,7 @@ public:
void renderMessage(const char *text, MessagePosition position = kMessageNormal);
void removeMessage();
void renderText(const char *text, int x, int y, byte color);
+ void renderText(const char *text);
void renderBox(int x, int y, int width, int height, byte color);
void setColor63(byte value);
};