aboutsummaryrefslogtreecommitdiff
path: root/engines/lab/special.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lab/special.cpp')
-rw-r--r--engines/lab/special.cpp61
1 files changed, 31 insertions, 30 deletions
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 2f071dab35..c8cc616d30 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -54,7 +54,8 @@ void LabEngine::doNotes() {
TextFont *noteFont = _resource->getFont("P:Note.fon");
char *noteText = _resource->getText("Lab:Rooms/Notes");
- _graphics->flowText(noteFont, -2 + _utils->svgaCord(1), 0, 0, false, false, true, true, _utils->vgaScaleX(25) + _utils->svgaCord(15), _utils->vgaScaleY(50), _utils->vgaScaleX(295) - _utils->svgaCord(15), _utils->vgaScaleY(148), noteText);
+ Common::Rect textRect = Common::Rect(_utils->vgaScaleX(25) + _utils->svgaCord(15), _utils->vgaScaleY(50), _utils->vgaScaleX(295) - _utils->svgaCord(15), _utils->vgaScaleY(148));
+ _graphics->flowText(noteFont, -2 + _utils->svgaCord(1), 0, 0, false, false, true, true, textRect, noteText);
_graphics->setPalette(_anim->_diffPalette, 256);
_graphics->closeFont(noteFont);
delete[] noteText;
@@ -67,7 +68,9 @@ void LabEngine::doNotes() {
void LabEngine::doWestPaper() {
TextFont *paperFont = _resource->getFont("P:News22.fon");
char *paperText = _resource->getText("Lab:Rooms/Date");
- _graphics->flowText(paperFont, 0, 0, 0, false, true, false, true, _utils->vgaScaleX(57), _utils->vgaScaleY(77) + _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(91), paperText);
+
+ Common::Rect textRect = Common::Rect(_utils->vgaScaleX(57), _utils->vgaScaleY(77) + _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(91));
+ _graphics->flowText(paperFont, 0, 0, 0, false, true, false, true, textRect, paperText);
_graphics->closeFont(paperFont);
delete[] paperText;
@@ -75,13 +78,15 @@ void LabEngine::doWestPaper() {
paperText = _resource->getText("Lab:Rooms/Headline");
int fileLen = strlen(paperText) - 1;
- int charsPrinted = _graphics->flowText(paperFont, -8, 0, 0, false, true, false, true, _utils->vgaScaleX(57), _utils->vgaScaleY(86) - _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(118), paperText);
+ textRect = Common::Rect(_utils->vgaScaleX(57), _utils->vgaScaleY(86) - _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(118));
+ int charsPrinted = _graphics->flowText(paperFont, -8, 0, 0, false, true, false, true, textRect, paperText);
uint16 y;
if (charsPrinted < fileLen) {
y = 130 - _utils->svgaCord(5);
- _graphics->flowText(paperFont, -8 - _utils->svgaCord(1), 0, 0, false, true, false, true, _utils->vgaScaleX(57), _utils->vgaScaleY(86) - _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(132), paperText);
+ textRect = Common::Rect(_utils->vgaScaleX(57), _utils->vgaScaleY(86) - _utils->svgaCord(2), _utils->vgaScaleX(262), _utils->vgaScaleY(132));
+ _graphics->flowText(paperFont, -8 - _utils->svgaCord(1), 0, 0, false, true, false, true, textRect, paperText);
} else
y = 115 - _utils->svgaCord(5);
@@ -90,10 +95,10 @@ void LabEngine::doWestPaper() {
paperFont = _resource->getFont("P:Note.fon");
paperText = _resource->getText("Lab:Rooms/Col1");
- charsPrinted = _graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 45, y, 158, 148, paperText);
+ charsPrinted = _graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, Common::Rect(45, y, 158, 148), paperText);
delete[] paperText;
paperText = _resource->getText("Lab:Rooms/Col2");
- charsPrinted = _graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 162, y, 275, 148, paperText);
+ charsPrinted = _graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, Common::Rect(162, y, 275, 148), paperText);
delete[] paperText;
_graphics->closeFont(paperFont);
@@ -167,7 +172,7 @@ void LabEngine::drawJournalText() {
while (drawingToPage < _journalPage) {
_music->updateMusic();
curText = (char *)(_journalText + charsDrawn);
- charsDrawn += _graphics->flowTextScaled(_journalFont, -2, 2, 0, false, false, false, false, 52, 32, 152, 148, curText);
+ charsDrawn += _graphics->flowTextScaled(_journalFont, -2, 2, 0, false, false, false, false, Common::Rect(52, 32, 152, 148), curText);
_lastPage = (*curText == 0);
@@ -179,16 +184,16 @@ void LabEngine::drawJournalText() {
if (_journalPage <= 1) {
curText = _journalTextTitle;
- _graphics->flowTextToMem(_journalBackImage, _journalFont, -2, 2, 0, false, true, true, true, _utils->vgaScaleX(52), _utils->vgaScaleY(32), _utils->vgaScaleX(152), _utils->vgaScaleY(148), curText);
+ _graphics->flowTextToMem(_journalBackImage, _journalFont, -2, 2, 0, false, true, true, true, _utils->vgaRectScale(52, 32, 152, 148), curText);
} else {
curText = (char *)(_journalText + charsDrawn);
- charsDrawn += _graphics->flowTextToMem(_journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaScaleX(52), _utils->vgaScaleY(32), _utils->vgaScaleX(152), _utils->vgaScaleY(148), curText);
+ charsDrawn += _graphics->flowTextToMem(_journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(52, 32, 152, 148), curText);
}
_music->updateMusic();
curText = (char *)(_journalText + charsDrawn);
_lastPage = (*curText == 0);
- _graphics->flowTextToMem(_journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaScaleX(171), _utils->vgaScaleY(32), _utils->vgaScaleX(271), _utils->vgaScaleY(148), curText);
+ _graphics->flowTextToMem(_journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(171, 32, 271, 148), curText);
curText = (char *)(_journalText + charsDrawn);
_lastPage |= (*curText == 0);
@@ -331,7 +336,7 @@ void LabEngine::doJournal() {
/**
* Draws the text for the monitor.
*/
-void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive) {
+void LabEngine::drawMonText(char *text, TextFont *monitorFont, Common::Rect textRect, bool isinteractive) {
uint16 drawingToPage = 0, yspacing = 0;
int charsDrawn = 0;
char *curText = text;
@@ -346,7 +351,7 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16
text += 2;
uint16 fheight = _graphics->textHeight(monitorFont);
- x1 = _monitorButton->_width + _utils->vgaScaleX(3);
+ textRect.left = _monitorButton->_width + _utils->vgaScaleX(3);
_monitorButtonHeight = _monitorButton->_height + _utils->vgaScaleY(3);
if (_monitorButtonHeight > fheight)
@@ -355,22 +360,22 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16
_monitorButtonHeight = fheight;
_graphics->setPen(0);
- _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, y2);
+ _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, textRect.bottom);
for (uint16 i = 0; i < numlines; i++)
_monitorButton->drawImage(0, i * _monitorButtonHeight);
} else if (isinteractive) {
_graphics->setPen(0);
- _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, y2);
+ _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, textRect.bottom);
} else {
_graphics->setPen(0);
- _graphics->rectFill(x1, y1, x2, y2);
+ _graphics->rectFill(textRect);
}
while (drawingToPage < _monitorPage) {
_music->updateMusic();
curText = (char *)(text + charsDrawn);
- charsDrawn += _graphics->flowText(monitorFont, yspacing, 0, 0, false, false, false, false, x1, y1, x2, y2, curText);
+ charsDrawn += _graphics->flowText(monitorFont, yspacing, 0, 0, false, false, false, false, textRect, curText);
_lastPage = (*curText == 0);
if (_lastPage)
@@ -381,7 +386,7 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16
curText = (char *)(text + charsDrawn);
_lastPage = (*curText == 0);
- charsDrawn = _graphics->flowText(monitorFont, yspacing, 2, 0, false, false, false, true, x1, y1, x2, y2, curText);
+ charsDrawn = _graphics->flowText(monitorFont, yspacing, 2, 0, false, false, false, true, textRect, curText);
curText += charsDrawn;
_lastPage |= (*curText == 0);
@@ -391,7 +396,7 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16
/**
* Processes user input.
*/
-void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isInteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
+void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isInteractive, Common::Rect textRect) {
const char *startFileName = _monitorTextFilename;
CloseDataPtr startClosePtr = _closeDataPtr, lastClosePtr[10];
uint16 depth = 0;
@@ -415,7 +420,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isIntera
ntext = _resource->getText(_monitorTextFilename);
_graphics->fade(false, 0);
- drawMonText(ntext, monitorFont, x1, y1, x2, y2, isInteractive);
+ drawMonText(ntext, monitorFont, textRect, isInteractive);
_graphics->fade(true, 0);
delete[] ntext;
}
@@ -455,19 +460,19 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isIntera
}
} else if (_monitorPage > 0) {
_monitorPage = 0;
- drawMonText(ntext, monitorFont, x1, y1, x2, y2, isInteractive);
+ drawMonText(ntext, monitorFont, textRect, isInteractive);
}
} else if (mouseX < _utils->vgaScaleX(259)) {
return;
} else if (mouseX <= _utils->vgaScaleX(289)) {
if (!_lastPage) {
_monitorPage += 1;
- drawMonText(ntext, monitorFont, x1, y1, x2, y2, isInteractive);
+ drawMonText(ntext, monitorFont, textRect, isInteractive);
}
} else if (_monitorPage >= 1) {
// mouseX between 290 and 320 (scaled)
_monitorPage -= 1;
- drawMonText(ntext, monitorFont, x1, y1, x2, y2, isInteractive);
+ drawMonText(ntext, monitorFont, textRect, isInteractive);
}
} else if (isInteractive) {
CloseDataPtr tmpClosePtr = _closeDataPtr;
@@ -488,12 +493,8 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isIntera
/**
* Does what's necessary for the monitor.
*/
-void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
- x1 = _utils->vgaScaleX(x1);
- x2 = _utils->vgaScaleX(x2);
- y1 = _utils->vgaScaleY(y1);
- y2 = _utils->vgaScaleY(y2);
-
+void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive, Common::Rect textRect) {
+ Common::Rect scaledRect = _utils->vgaRectScale(textRect.left, textRect.top, textRect.right, textRect.bottom);
_monitorTextFilename = textfile;
_graphics->blackAllScreen();
@@ -514,10 +515,10 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive,
char *ntext = _resource->getText(textfile);
_graphics->loadBackPict(background, _highPalette);
- drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive);
+ drawMonText(ntext, monitorFont, scaledRect, isinteractive);
_event->mouseShow();
_graphics->fade(true, 0);
- processMonitor(ntext, monitorFont, isinteractive, x1, y1, x2, y2);
+ processMonitor(ntext, monitorFont, isinteractive, scaledRect);
_graphics->fade(false, 0);
_event->mouseHide();
delete[] ntext;