aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/print.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2012-03-20 14:18:57 -0400
committerMatthew Hoops2012-03-20 14:49:16 -0400
commit71756bdf4eae5ba9cc3f329b85e894f04640aaef (patch)
tree40d464262da107ab5eed82f198685209161ebac1 /engines/dreamweb/print.cpp
parent03eba05b09e5c9e5a351f8111185934b92a3fed3 (diff)
parent3c3576a224b92c703b4e8ea20008ac8a069980dd (diff)
downloadscummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.tar.gz
scummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.tar.bz2
scummvm-rg350-71756bdf4eae5ba9cc3f329b85e894f04640aaef.zip
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'engines/dreamweb/print.cpp')
-rw-r--r--engines/dreamweb/print.cpp199
1 files changed, 134 insertions, 65 deletions
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index 0fd596ceac..a6b93a5590 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -22,9 +22,9 @@
#include "dreamweb/dreamweb.h"
-namespace DreamGen {
+namespace DreamWeb {
-void DreamBase::printBoth(const Frame *charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) {
+void DreamWebEngine::printBoth(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) {
uint16 newX = *x;
uint8 width, height;
printChar(charSet, &newX, y, c, nextChar, &width, &height);
@@ -32,7 +32,7 @@ void DreamBase::printBoth(const Frame *charSet, uint16 *x, uint16 y, uint8 c, ui
*x = newX;
}
-uint8 DreamBase::getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) {
+uint8 DreamWebEngine::getNextWord(const GraphicsFile &charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) {
*totalWidth = 0;
*charCount = 0;
while (true) {
@@ -47,17 +47,17 @@ uint8 DreamBase::getNextWord(const Frame *charSet, const uint8 *string, uint8 *t
*totalWidth += 6;
return 0;
}
- firstChar = engine->modifyChar(firstChar);
+ firstChar = modifyChar(firstChar);
if (firstChar != 255) {
uint8 secondChar = *string;
- uint8 width = charSet[firstChar - 32 + data.word(kCharshift)].width;
+ uint8 width = charSet._frames[firstChar - 32 + _charShift].width;
width = kernChars(firstChar, secondChar, width);
*totalWidth += width;
}
}
}
-void DreamBase::printChar(const Frame *charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
+void DreamWebEngine::printChar(const GraphicsFile &charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
if (c == 255)
return;
@@ -66,48 +66,47 @@ void DreamBase::printChar(const Frame *charSet, uint16* x, uint16 y, uint8 c, ui
width = &dummyWidth;
if (height == NULL)
height = &dummyHeight;
- if (data.byte(kForeignrelease))
+ if (_foreignRelease)
y -= 3;
- uint16 tmp = c - 32 + data.word(kCharshift);
+ uint16 tmp = c - 32 + _charShift;
showFrame(charSet, *x, y, tmp & 0x1ff, (tmp >> 8) & 0xfe, width, height);
- if (data.byte(kKerning), 0)
+ if (_kerning == 0)
*width = kernChars(c, nextChar, *width);
(*x) += *width;
}
-void DreamBase::printChar(const Frame *charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
+void DreamWebEngine::printChar(const GraphicsFile &charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
printChar(charSet, &x, y, c, nextChar, width, height);
}
-uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
- data.byte(kPointerframe) = 1;
- data.byte(kPointermode) = 3;
- const Frame* charSet = (const Frame *)getSegment(data.word(kCharset1)).ptr(0, 0);
+uint8 DreamWebEngine::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
+ _pointerFrame = 1;
+ _pointerMode = 3;
do {
uint16 offset = x;
- uint16 charCount = getNumber(charSet, string, maxWidth, centered, &offset);
+ uint16 charCount = getNumber(_charset1, string, maxWidth, centered, &offset);
do {
uint8 c0 = string[0];
uint8 c1 = string[1];
uint8 c2 = string[2];
- c0 = engine->modifyChar(c0);
- printBoth(charSet, &offset, y, c0, c1);
+ c0 = modifyChar(c0);
+ printBoth(_charset1, &offset, y, c0, c1);
if ((c1 == 0) || (c1 == ':')) {
return 0;
}
if (charCount != 1) {
- c1 = engine->modifyChar(c1);
- data.word(kCharshift) = 91;
+ c1 = modifyChar(c1);
+ _charShift = 91;
uint16 offset2 = offset;
- printBoth(charSet, &offset2, y, c1, c2);
- data.word(kCharshift) = 0;
+ printBoth(_charset1, &offset2, y, c1, c2);
+ _charShift = 0;
for (int i=0; i<2; ++i) {
uint16 mouseState = waitFrames();
- if (data.byte(kQuitrequested))
+ if (_quitRequested)
return 0;
if (mouseState == 0)
continue;
- if (mouseState != data.word(kOldbutton)) {
+ if (mouseState != _oldButton) {
return 1;
}
}
@@ -120,22 +119,13 @@ uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWid
} while (true);
}
-void DreamGenContext::printDirect() {
- uint16 y = bx;
- const uint8 *initialString = es.ptr(si, 0);
- const uint8 *string = initialString;
- al = DreamBase::printDirect(&string, di, &y, dl, (bool)(dl & 1));
- si += (string - initialString);
- bx = y;
-}
-
-uint8 DreamBase::printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
+uint8 DreamWebEngine::printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
return printDirect(&string, x, &y, maxWidth, centered);
}
-uint8 DreamBase::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) {
- data.word(kLastxpos) = x;
- const Frame *charSet = engine->currentCharset();
+uint8 DreamWebEngine::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) {
+ _lastXPos = x;
+ const GraphicsFile &charSet = *_currentCharset;
while (true) {
uint16 offset = x;
uint8 charCount = getNumber(charSet, *string, maxWidth, centered, &offset);
@@ -147,17 +137,17 @@ uint8 DreamBase::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 ma
if ((c == 0) || (c == ':')) {
return c;
}
- c = engine->modifyChar(c);
+ c = modifyChar(c);
uint8 width, height;
printChar(charSet, &i, *y, c, nextChar, &width, &height);
- data.word(kLastxpos) = i;
+ _lastXPos = i;
--charCount;
} while (charCount);
- *y += data.word(kLinespacing);
+ *y += _lineSpacing;
}
}
-uint8 DreamBase::getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
+uint8 DreamWebEngine::getNumber(const GraphicsFile &charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
uint8 totalWidth = 0;
uint8 charCount = 0;
while (true) {
@@ -196,7 +186,7 @@ uint8 DreamBase::getNumber(const Frame *charSet, const uint8 *string, uint16 max
}
}
-uint8 DreamBase::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) {
+uint8 DreamWebEngine::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) {
if ((firstChar == 'a') || (firstChar == 'u')) {
if ((secondChar == 'n') || (secondChar == 't') || (secondChar == 'r') || (secondChar == 'i') || (secondChar == 'l'))
return width-1;
@@ -204,31 +194,23 @@ uint8 DreamBase::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) {
return width;
}
-uint16 DreamBase::waitFrames() {
+uint16 DreamWebEngine::waitFrames() {
readMouse();
showPointer();
vSync();
dumpPointer();
delPointer();
- return data.word(kMousebutton);
+ return _mouseButton;
}
-void DreamGenContext::monPrint() {
- uint16 originalBx = bx;
- const char *string = (const char *)es.ptr(bx, 0);
- const char *nextString = monPrint(string);
- bx = originalBx + (nextString - string);
-}
-
-const char *DreamBase::monPrint(const char *string) {
- data.byte(kKerning) = 1;
- uint16 x = data.word(kMonadx);
- Frame *charset = engine->tempCharset();
+const char *DreamWebEngine::monPrint(const char *string) {
+ _kerning = 1;
+ uint16 x = _monAdX;
const char *iterator = string;
bool done = false;
while (!done) {
- uint16 count = getNumber(charset, (const uint8 *)iterator, 166, false, &x);
+ uint16 count = getNumber(_monitorCharset, (const uint8 *)iterator, 166, false, &x);
do {
char c = *iterator++;
if (c == ':')
@@ -238,29 +220,116 @@ const char *DreamBase::monPrint(const char *string) {
break;
}
if (c == '%') {
- data.byte(kLasttrigger) = *iterator;
+ _vars._lastTrigger = *iterator;
iterator += 2;
done = true;
break;
}
- c = engine->modifyChar(c);
- printChar(charset, &x, data.word(kMonady), c, 0, NULL, NULL);
- data.word(kCurslocx) = x;
- data.word(kCurslocy) = data.word(kMonady);
- data.word(kMaintimer) = 1;
+ c = modifyChar(c);
+ printChar(_monitorCharset, &x, _monAdY, c, 0, NULL, NULL);
+ _cursLocX = x;
+ _cursLocY = _monAdY;
+ _mainTimer = 1;
printCurs();
vSync();
lockMon();
delCurs();
} while (--count);
- x = data.word(kMonadx);
+ x = _monAdX;
scrollMonitor();
- data.word(kCurslocx) = data.word(kMonadx);
+ _cursLocX = _monAdX;
}
- data.byte(kKerning) = 0;
+ _kerning = 0;
return iterator;
}
-} // End of namespace DreamGen
+void DreamWebEngine::rollEndCreditsGameWon() {
+ playChannel0(16, 255);
+ _volume = 7;
+ _volumeTo = 0;
+ _volumeDirection = -1;
+
+ multiGet(_mapStore, 75, 20, 160, 160);
+
+ const uint8 *string = getTextInFile1(3);
+ const int linespacing = _lineSpacing;
+
+ for (int i = 0; i < 254; ++i) {
+ // Output the text, initially with an offset of 10 pixels,
+ // then move it up one pixel until we shifted it by a complete
+ // line of text.
+ for (int j = 0; j < linespacing; ++j) {
+ vSync();
+ multiPut(_mapStore, 75, 20, 160, 160);
+ vSync();
+
+ // Output up to 18 lines of text
+ uint16 y = 10 - j;
+ const uint8 *tmp_str = string;
+ for (int k = 0; k < 18; ++k) {
+ printDirect(&tmp_str, 75, &y, 160 + 1, true);
+ y += linespacing;
+ }
+
+ vSync();
+ multiDump(75, 20, 160, 160);
+ }
+
+ // Skip to the next text line
+ byte c;
+ do {
+ c = *string++;
+ } while (c != ':' && c != 0);
+ }
+
+ hangOn(100);
+ panelToMap();
+ fadeScreenUpHalf();
+}
+
+void DreamWebEngine::rollEndCreditsGameLost() {
+ multiGet(_mapStore, 25, 20, 160, 160);
+
+ const uint8 *string = getTextInFile1(49);
+ const int linespacing = _lineSpacing;
+
+ for (int i = 0; i < 80; ++i) {
+ // Output the text, initially with an offset of 10 pixels,
+ // then move it up one pixel until we shifted it by a complete
+ // line of text.
+ for (int j = 0; j < linespacing; ++j) {
+ vSync();
+ multiPut(_mapStore, 25, 20, 160, 160);
+ vSync();
+
+ // Output up to 18 lines of text
+ uint16 y = 10 - j;
+ const uint8 *tmp_str = string;
+ for (int k = 0; k < 18; ++k) {
+ printDirect(&tmp_str, 25, &y, 160 + 1, true);
+ y += linespacing;
+ }
+
+ vSync();
+ multiDump(25, 20, 160, 160);
+
+ if (_lastHardKey == 1)
+ return;
+ }
+
+ // Skip to the next text line
+ byte c;
+ do {
+ c = *string++;
+ } while (c != ':' && c != 0);
+
+ if (_lastHardKey == 1)
+ return;
+ }
+
+ hangOne(120);
+}
+
+} // End of namespace DreamWeb