aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2015-12-24 15:26:17 +0100
committerWillem Jan Palenstijn2015-12-24 15:28:25 +0100
commit6ace70a625b76f0b2471b73d702649fbf0cfe7a0 (patch)
treecf7edd46aa086a3602c256a4d45844330150b7a1 /engines
parenta08dd694e56ee53f99faeb18e1ca7b442b8875ce (diff)
downloadscummvm-rg350-6ace70a625b76f0b2471b73d702649fbf0cfe7a0.tar.gz
scummvm-rg350-6ace70a625b76f0b2471b73d702649fbf0cfe7a0.tar.bz2
scummvm-rg350-6ace70a625b76f0b2471b73d702649fbf0cfe7a0.zip
LAB: Clarify and clean up drawJournalText
Diffstat (limited to 'engines')
-rw-r--r--engines/lab/special.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 9a631e4980..dd2ee1cf4e 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -145,34 +145,38 @@ void LabEngine::loadJournalData() {
void LabEngine::drawJournalText() {
uint16 drawingToPage = 1;
- int charsDrawn = 0;
const char *curText = _journalText.c_str();
+ assert((_journalPage & 1) == 0);
+
while (drawingToPage < _journalPage) {
updateMusicAndEvents();
- curText = _journalText.c_str() + charsDrawn;
- charsDrawn += _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, false, _utils->vgaRectScale(52, 32, 152, 148), curText);
+
+ // flowText without output
+ curText += _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, false, _utils->vgaRectScale(52, 32, 152, 148), curText);
_lastPage = (*curText == 0);
- if (_lastPage)
+ if (_lastPage) {
+ // Reset _journalPage to this page, in case it was set too high
_journalPage = (drawingToPage / 2) * 2;
- else
- drawingToPage++;
+ break;
+ }
+
+ drawingToPage++;
}
- if (_journalPage <= 1) {
- curText = _journalTextTitle.c_str();
- _graphics->flowText(_journalFont, -2, 2, 0, false, true, true, true, _utils->vgaRectScale(52, 32, 152, 148), curText, _journalBackImage);
+ if (_journalPage == 0) {
+ // draw title page centered
+ _graphics->flowText(_journalFont, -2, 2, 0, false, true, true, true, _utils->vgaRectScale(52, 32, 152, 148), _journalTextTitle.c_str(), _journalBackImage);
} else {
- curText = _journalText.c_str() + charsDrawn;
- charsDrawn += _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(52, 32, 152, 148), curText, _journalBackImage);
+ curText += _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(52, 32, 152, 148), curText, _journalBackImage);
}
updateMusicAndEvents();
- curText = _journalText.c_str() + charsDrawn;
+ curText += _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(171, 32, 271, 148), curText, _journalBackImage);
+
_lastPage = (*curText == 0);
- _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(171, 32, 271, 148), curText, _journalBackImage);
}
void LabEngine::turnPage(bool fromLeft) {