aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2006-01-10 00:34:13 +0000
committerMax Horn2006-01-10 00:34:13 +0000
commit713a646409fed4ff46c61f1cc6417b5fe8d3d8c9 (patch)
tree9a52eac022fa8f55efd3d4959b37994096fe4dc7
parenta3f6c5d112cab5ef07deaab545ebfc647bd24ff7 (diff)
downloadscummvm-rg350-713a646409fed4ff46c61f1cc6417b5fe8d3d8c9.tar.gz
scummvm-rg350-713a646409fed4ff46c61f1cc6417b5fe8d3d8c9.tar.bz2
scummvm-rg350-713a646409fed4ff46c61f1cc6417b5fe8d3d8c9.zip
Cleanup; moving things around a bit
svn-id: r19961
-rw-r--r--scumm/gfx.cpp2
-rw-r--r--scumm/gfx.h8
-rw-r--r--scumm/script_v5.cpp2
-rw-r--r--scumm/string.cpp186
-rw-r--r--scumm/verbs.cpp2
5 files changed, 117 insertions, 83 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index b193b51df7..0f204bb81b 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -687,7 +687,7 @@ void ScummEngine::initBGBuffers(int height) {
// Resize main virtual screen in V7 games. This is necessary
// because in V7, rooms may be higher than one screen, so we have
// to accomodate for that.
- initVirtScreen(kMainVirtScreen, virtscr[0].topline, _screenWidth, height, 1, 1);
+ initVirtScreen(kMainVirtScreen, virtscr[0].topline, _screenWidth, height, true, true);
}
if (_heversion >= 70)
diff --git a/scumm/gfx.h b/scumm/gfx.h
index 5f55e16d95..ab1133ac4e 100644
--- a/scumm/gfx.h
+++ b/scumm/gfx.h
@@ -88,10 +88,6 @@ struct VirtScreen : Graphics::Surface {
/**
* Vertical position of the virtual screen. Tells how much the virtual
* screen is shifted along the y axis relative to the real screen.
- * If you wonder why there is no horizontal position: there is none,
- * because all virtual screens are always exactly as wide as the
- * real screen. This might change in the future to allow smooth
- * horizontal scrolling in V7-V8 games.
*/
uint16 topline;
@@ -103,8 +99,8 @@ struct VirtScreen : Graphics::Surface {
uint16 xstart;
/**
- * Flag indicating which tells whether this screen has a back buffer or
- * not. This is yet another feature which is only used by the main screen.
+ * Flag indicating whether this screen has a back buffer or not. This is
+ * yet another feature which is only used by the main screen.
* Strictly spoken one could remove this variable and replace checks
* on it with checks on backBuf. But since some code needs to temporarily
* disable the backBuf (so it can abuse drawBitmap; see drawVerbBitmap()
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index ce68d859e1..382d0f28f0 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -2818,7 +2818,7 @@ void ScummEngine_v5::o5_oldRoomEffect() {
int byte_2FCCF = 0;
// For now, we force a redraw of the screen background. This
- // Makes the Zak end credits work more or less correctly.
+ // way the Zak end credits seem to work mostly correct.
VirtScreen *vs = &virtscr[0];
restoreBG(Common::Rect(0,vs->topline, vs->w, vs->topline + vs->h));
vs->setDirtyRange(0, vs->h);
diff --git a/scumm/string.cpp b/scumm/string.cpp
index 04de8819c0..6dd02b4c23 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -36,6 +36,13 @@
namespace Scumm {
+
+
+#pragma mark -
+#pragma mark --- "High level" message code ---
+#pragma mark -
+
+
void ScummEngine::printString(int m, const byte *msg) {
switch (m) {
case 0:
@@ -95,6 +102,95 @@ void ScummEngine::showMessageDialog(const byte *msg) {
VAR(VAR_KEYPRESS) = runDialog(dialog);
}
+
+#pragma mark -
+#pragma mark --- V6 blast text queue code ---
+#pragma mark -
+
+
+void ScummEngine_v6::enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center) {
+ BlastText &bt = _blastTextQueue[_blastTextQueuePos++];
+ assert(_blastTextQueuePos <= ARRAYSIZE(_blastTextQueue));
+
+ convertMessageToString(text, bt.text, sizeof(bt.text));
+ bt.xpos = x;
+ bt.ypos = y;
+ bt.color = color;
+ bt.charset = charset;
+ bt.center = center;
+}
+
+void ScummEngine_v6::drawBlastTexts() {
+ byte *buf;
+ int c;
+ int i;
+
+ for (i = 0; i < _blastTextQueuePos; i++) {
+
+ buf = _blastTextQueue[i].text;
+
+ _charset->_top = _blastTextQueue[i].ypos + _screenTop;
+ _charset->_right = _screenWidth - 1;
+ _charset->_center = _blastTextQueue[i].center;
+ _charset->setColor(_blastTextQueue[i].color);
+ _charset->_disableOffsX = _charset->_firstChar = true;
+ _charset->setCurID(_blastTextQueue[i].charset);
+
+ do {
+ _charset->_left = _blastTextQueue[i].xpos;
+
+ // Center text if necessary
+ if (_charset->_center) {
+ _charset->_left -= _charset->getStringWidth(0, buf) / 2;
+ if (_charset->_left < 0)
+ _charset->_left = 0;
+ }
+
+ do {
+ c = *buf++;
+
+ // FIXME: This is a workaround for bugs #864030 and #1399843:
+ // In COMI, some text contains ASCII character 11 = 0xB. It's
+ // not quite clear what it is good for; so for now we just ignore
+ // it, which seems to match the original engine (BTW, traditionally,
+ // this is a 'vertical tab').
+ if (c == 0x0B)
+ continue;
+
+ if (c != 0 && c != 0xFF && c != '\n') {
+ if (c & 0x80 && _useCJKMode) {
+ if (_language == Common::JA_JPN && !checkSJISCode(c)) {
+ c = 0x20; //not in S-JIS
+ } else {
+ c += *buf++ * 256;
+ }
+ }
+ _charset->printChar(c, true);
+ }
+ } while (c && c != '\n');
+
+ _charset->_top += _charset->getFontHeight();
+ } while (c);
+
+ _blastTextQueue[i].rect = _charset->_str;
+ }
+}
+
+void ScummEngine_v6::removeBlastTexts() {
+ int i;
+
+ for (i = 0; i < _blastTextQueuePos; i++) {
+ restoreBG(_blastTextQueue[i].rect);
+ }
+ _blastTextQueuePos = 0;
+}
+
+
+#pragma mark -
+#pragma mark --- V7 subtitle queue code ---
+#pragma mark -
+
+
#ifndef DISABLE_SCUMM_7_8
void ScummEngine_v7::processSubtitleQueue() {
for (int i = 0; i < _subtitleQueuePos; ++i) {
@@ -135,6 +231,13 @@ void ScummEngine_v7::clearSubtitleQueue() {
}
#endif
+
+
+#pragma mark -
+#pragma mark --- Core message/subtitle code ---
+#pragma mark -
+
+
bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) {
uint32 talk_sound_a = 0;
uint32 talk_sound_b = 0;
@@ -817,6 +920,12 @@ int ScummEngine::convertStringMessage(byte *dst, int dstSize, int var) {
return 0;
}
+
+#pragma mark -
+#pragma mark --- Charset initialisation ---
+#pragma mark -
+
+
#ifndef DISABLE_HE
void ScummEngine_v80he::initCharset(int charsetno) {
ScummEngine::initCharset(charsetno);
@@ -843,82 +952,11 @@ void ScummEngine::initCharset(int charsetno) {
}
-void ScummEngine_v6::enqueueText(const byte *text, int x, int y, byte color, byte charset, bool center) {
- BlastText &bt = _blastTextQueue[_blastTextQueuePos++];
- assert(_blastTextQueuePos <= ARRAYSIZE(_blastTextQueue));
-
- convertMessageToString(text, bt.text, sizeof(bt.text));
- bt.xpos = x;
- bt.ypos = y;
- bt.color = color;
- bt.charset = charset;
- bt.center = center;
-}
-
-void ScummEngine_v6::drawBlastTexts() {
- byte *buf;
- int c;
- int i;
-
- for (i = 0; i < _blastTextQueuePos; i++) {
-
- buf = _blastTextQueue[i].text;
-
- _charset->_top = _blastTextQueue[i].ypos + _screenTop;
- _charset->_right = _screenWidth - 1;
- _charset->_center = _blastTextQueue[i].center;
- _charset->setColor(_blastTextQueue[i].color);
- _charset->_disableOffsX = _charset->_firstChar = true;
- _charset->setCurID(_blastTextQueue[i].charset);
-
- do {
- _charset->_left = _blastTextQueue[i].xpos;
-
- // Center text if necessary
- if (_charset->_center) {
- _charset->_left -= _charset->getStringWidth(0, buf) / 2;
- if (_charset->_left < 0)
- _charset->_left = 0;
- }
-
- do {
- c = *buf++;
-
- // FIXME: This is a workaround for bugs #864030 and #1399843:
- // In COMI, some text contains ASCII character 11 = 0xB. It's
- // not quite clear what it is good for; so for now we just ignore
- // it, which seems to match the original engine (BTW, traditionally,
- // this is a 'vertical tab').
- if (c == 0x0B)
- continue;
-
- if (c != 0 && c != 0xFF && c != '\n') {
- if (c & 0x80 && _useCJKMode) {
- if (_language == Common::JA_JPN && !checkSJISCode(c)) {
- c = 0x20; //not in S-JIS
- } else {
- c += *buf++ * 256;
- }
- }
- _charset->printChar(c, true);
- }
- } while (c && c != '\n');
-
- _charset->_top += _charset->getFontHeight();
- } while (c);
- _blastTextQueue[i].rect = _charset->_str;
- }
-}
-
-void ScummEngine_v6::removeBlastTexts() {
- int i;
+#pragma mark -
+#pragma mark --- Translation/localization code ---
+#pragma mark -
- for (i = 0; i < _blastTextQueuePos; i++) {
- restoreBG(_blastTextQueue[i].rect);
- }
- _blastTextQueuePos = 0;
-}
#ifndef DISABLE_SCUMM_7_8
static int indexCompare(const void *p1, const void *p2) {
diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp
index 278875cd57..d561ae6841 100644
--- a/scumm/verbs.cpp
+++ b/scumm/verbs.cpp
@@ -723,7 +723,7 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) {
gdi.disableZBuffer();
twobufs = vs->hasTwoBuffers;
- vs->hasTwoBuffers = 0;
+ vs->hasTwoBuffers = false;
xstrip = x / 8;
ydiff = y - vs->topline;