aboutsummaryrefslogtreecommitdiff
path: root/engines/lab/intro.cpp
diff options
context:
space:
mode:
authorStrangerke2015-12-14 21:44:06 +0100
committerWillem Jan Palenstijn2015-12-23 21:34:05 +0100
commite0de03463e0c8145bd7700cd2f4955dfc0676967 (patch)
treef54f2d07c62dd19e28d7cbe6a98e241d4953e914 /engines/lab/intro.cpp
parent52d0243eff241d59397fe6237c1959e24d51dbb8 (diff)
downloadscummvm-rg350-e0de03463e0c8145bd7700cd2f4955dfc0676967.tar.gz
scummvm-rg350-e0de03463e0c8145bd7700cd2f4955dfc0676967.tar.bz2
scummvm-rg350-e0de03463e0c8145bd7700cd2f4955dfc0676967.zip
LAB: Use strlen to compute text length instead of a difference between start and end address. Some refactoring.
Diffstat (limited to 'engines/lab/intro.cpp')
-rw-r--r--engines/lab/intro.cpp42
1 files changed, 19 insertions, 23 deletions
diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp
index 5c1c837da5..c739389425 100644
--- a/engines/lab/intro.cpp
+++ b/engines/lab/intro.cpp
@@ -80,11 +80,9 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
return;
uint32 lastMillis = 0;
- IntuiMessage *msg;
- bool drawNextText = true, end = false, begin = true;
-
- int32 cls, code, Drawn;
- int16 qualifier;
+ bool drawNextText = true;
+ bool doneFl = false;
+ bool begin = true;
Common::File *textFile = _vm->_resource->openDataFile(path);
byte *textBuffer = new byte[textFile->size()];
@@ -99,19 +97,18 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
else if (isScreen)
_vm->_graphics->fade(false, 0);
+ int charDrawn = 0;
if (isScreen) {
_vm->_graphics->setAPen(7);
_vm->_graphics->rectFillScaled(10, 10, 310, 190);
- Drawn = _vm->_graphics->flowTextScaled(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, 14, 11, 306, 189, (char *)curText);
+ charDrawn = _vm->_graphics->flowTextScaled(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, 14, 11, 306, 189, (char *)curText);
_vm->_graphics->fade(true, 0);
- } else {
- Drawn = _vm->_graphics->longDrawMessage((char *)curText);
- }
-
- curText += Drawn;
+ } else
+ charDrawn = _vm->_graphics->longDrawMessage((char *)curText);
- end = (*curText == 0);
+ curText += charDrawn;
+ doneFl = (*curText == 0);
drawNextText = false;
introEatMessages();
@@ -127,7 +124,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
lastMillis = g_system->getMillis();
}
- msg = _vm->_event->getMsg();
+ IntuiMessage *msg = _vm->_event->getMsg();
if (msg == NULL) {
_vm->_music->updateMusic();
@@ -136,7 +133,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
uint32 elapsedSeconds = (g_system->getMillis() - lastMillis) / 1000;
if (elapsedSeconds > timeDelay) {
- if (end) {
+ if (doneFl) {
if (isScreen)
_vm->_graphics->fade(false, 0);
@@ -146,15 +143,14 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
drawNextText = true;
}
}
-
_vm->waitTOF();
} else {
- cls = msg->_msgClass;
- qualifier = msg->_qualifier;
- code = msg->_code;
+ uint32 msgClass = msg->_msgClass;
+ uint16 qualifier = msg->_qualifier;
+ uint16 code = msg->_code;
- if (((cls == MOUSEBUTTONS) && (IEQUALIFIER_RIGHTBUTTON & qualifier)) ||
- ((cls == RAWKEY) && (code == 27))) {
+ if (((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_RIGHTBUTTON & qualifier)) ||
+ ((msgClass == RAWKEY) && (code == 27))) {
_quitIntro = true;
if (isScreen)
@@ -162,9 +158,9 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
delete[] textBuffer;
return;
- } else if (cls == MOUSEBUTTONS) {
+ } else if (msgClass == MOUSEBUTTONS) {
if (IEQUALIFIER_LEFTBUTTON & qualifier) {
- if (end) {
+ if (doneFl) {
if (isScreen)
_vm->_graphics->fade(false, 0);
@@ -185,7 +181,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
}
}
- if (end) {
+ if (doneFl) {
if (isScreen)
_vm->_graphics->fade(false, 0);