aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2015-12-05 22:20:26 +0200
committerWillem Jan Palenstijn2015-12-23 21:33:51 +0100
commit525db01913605f899107bc115fcde418023e700f (patch)
tree4887f66ee58dceda02d824020150e79c73546bf5
parentab1d9771d28cd70659505b900a07574e70113735 (diff)
downloadscummvm-rg350-525db01913605f899107bc115fcde418023e700f.tar.gz
scummvm-rg350-525db01913605f899107bc115fcde418023e700f.tar.bz2
scummvm-rg350-525db01913605f899107bc115fcde418023e700f.zip
LAB: Simplify several calls to flowText() and rectFill()
-rw-r--r--engines/lab/graphics.cpp21
-rw-r--r--engines/lab/graphics.h13
-rw-r--r--engines/lab/intro.cpp4
-rw-r--r--engines/lab/map.cpp8
-rw-r--r--engines/lab/special.cpp6
-rw-r--r--engines/lab/tilepuzzle.cpp2
6 files changed, 42 insertions, 12 deletions
diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp
index 88b53ce3b5..8aa5950f90 100644
--- a/engines/lab/graphics.cpp
+++ b/engines/lab/graphics.cpp
@@ -316,6 +316,19 @@ uint32 DisplayMan::flowText(void *font, /* the TextAttr pointer */
return (str - temp);
}
+uint32 DisplayMan::flowTextScaled(void *font, /* the TextAttr pointer */
+ int16 spacing, /* How much vertical spacing between the lines */
+ byte pencolor, /* pen number to use for text */
+ byte backpen, /* the background color */
+ bool fillback, /* Whether to fill the background */
+ bool centerh, /* Whether to center the text horizontally */
+ bool centerv, /* Whether to center the text vertically */
+ bool output, /* Whether to output any text */
+ uint16 x1, /* Cords */
+ uint16 y1, uint16 x2, uint16 y2, const char *str) {
+ return flowText(font, spacing, pencolor, backpen, fillback, centerh, centerv, output, VGAScaleX(x1), VGAScaleY(y1), VGAScaleX(x2), VGAScaleY(y2), str);
+}
+
/******************************************************************************/
/* Calls flowText, but flows it to memory. Same restrictions as flowText. */
/******************************************************************************/
@@ -347,7 +360,7 @@ uint32 DisplayMan::flowTextToMem(Image *destIm, void *font, /* the TextAttr
void DisplayMan::createBox(uint16 y2) {
setAPen(7); /* Message box area */
- rectFill(VGAScaleX(4), VGAScaleY(154), VGAScaleX(315), VGAScaleY(y2 - 2));
+ rectFillScaled(4, 154, 315, y2 - 2);
setAPen(0); /* Box around message area */
drawHLine(VGAScaleX(2), VGAScaleY(152), VGAScaleX(317));
@@ -375,7 +388,7 @@ int32 DisplayMan::longDrawMessage(const char *str) {
createBox(198);
_vm->_event->mouseShow();
- return flowText(_vm->_msgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str);
+ return flowTextScaled(_vm->_msgFont, 0, 1, 7, false, true, true, true, 6, 155, 313, 195, str);
}
void LabEngine::drawStaticMessage(byte index) {
@@ -977,6 +990,10 @@ void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
}
}
+void DisplayMan::rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
+ rectFill(VGAScaleX(x1), VGAScaleY(y1), VGAScaleX(x2), VGAScaleY(y2));
+}
+
/*****************************************************************************/
/* Draws a horizontal line. */
/*****************************************************************************/
diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h
index 63523cbf29..ba3e34c4e5 100644
--- a/engines/lab/graphics.h
+++ b/engines/lab/graphics.h
@@ -71,6 +71,7 @@ public:
void drawMessage(const char *str);
void setAPen(byte pennum);
void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2);
+ void rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2);
/* Window text stuff */
uint32 flowText(void *font, /* the TextAttr pointer */
int16 spacing, /* How much vertical spacing between the lines */
@@ -84,6 +85,18 @@ public:
uint16 x2, uint16 y2,
const char *text); /* The text itself */
+ uint32 flowTextScaled(void *font, /* the TextAttr pointer */
+ int16 spacing, /* How much vertical spacing between the lines */
+ byte pencolor, /* pen number to use for text */
+ byte backpen, /* the background color */
+ bool fillback, /* Whether to fill the background */
+ bool centerh, /* Whether to center the text horizontally */
+ bool centerv, /* Whether to center the text vertically */
+ bool output, /* Whether to output any text */
+ uint16 x1, uint16 y1, /* Cords */
+ uint16 x2, uint16 y2,
+ const char *text); /* The text itself */
+
uint32 flowTextToMem(Image *destIm,
void *font, /* the TextAttr pointer */
int16 spacing, /* How much vertical spacing between the lines */
diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp
index 52a46ebef7..47897a726f 100644
--- a/engines/lab/intro.cpp
+++ b/engines/lab/intro.cpp
@@ -105,9 +105,9 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
if (isScreen) {
_vm->_graphics->setAPen(7);
- _vm->_graphics->rectFill(_vm->_graphics->VGAScaleX(10), _vm->_graphics->VGAScaleY(10), _vm->_graphics->VGAScaleX(310), _vm->_graphics->VGAScaleY(190));
+ _vm->_graphics->rectFillScaled(10, 10, 310, 190);
- Drawn = _vm->_graphics->flowText(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, _vm->_graphics->VGAScaleX(14), _vm->_graphics->VGAScaleY(11), _vm->_graphics->VGAScaleX(306), _vm->_graphics->VGAScaleY(189), (char *)curText);
+ Drawn = _vm->_graphics->flowTextScaled(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, 14, 11, 306, 189, (char *)curText);
fade(true, 0);
} else {
Drawn = _vm->_graphics->longDrawMessage((char *)curText);
diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp
index 4df01eae36..51295a874d 100644
--- a/engines/lab/map.cpp
+++ b/engines/lab/map.cpp
@@ -565,10 +565,10 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou
}
if (sptr)
- _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _graphics->VGAScaleX(14), _graphics->VGAScaleY(75), _graphics->VGAScaleX(134), _graphics->VGAScaleY(97), sptr);
+ _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 75, 134, 97, sptr);
if ((sptr = _rooms[CurMsg]._roomMsg))
- _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _graphics->VGAScaleX(14), _graphics->VGAScaleY(148), _graphics->VGAScaleX(134), _graphics->VGAScaleY(186), sptr);
+ _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr);
if (fadein)
fade(true, 0);
@@ -722,8 +722,8 @@ void LabEngine::processMap(uint16 CurRoom) {
if ((sptr = _rooms[CurMsg]._roomMsg)) {
_event->mouseHide();
_graphics->setAPen(3);
- _graphics->rectFill(_graphics->VGAScaleX(13), _graphics->VGAScaleY(148), _graphics->VGAScaleX(135), _graphics->VGAScaleY(186));
- _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _graphics->VGAScaleX(14), _graphics->VGAScaleY(148), _graphics->VGAScaleX(134), _graphics->VGAScaleY(186), sptr);
+ _graphics->rectFillScaled(13, 148, 135, 186);
+ _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr);
if (Maps[OldMsg].PageNumber == CurFloor)
drawRoom(OldMsg, (bool)(OldMsg == CurRoom));
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 6c96d18213..76f9c1576a 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -143,10 +143,10 @@ void doWestPaper() {
paperFont = g_lab->_resource->getFont("P:Note.fon");
ntext = g_lab->_resource->getText("Lab:Rooms/Col1");
- CharsPrinted = g_lab->_graphics->flowText(paperFont, -4, 0, 0, false, false, false, true, g_lab->_graphics->VGAScaleX(45), g_lab->_graphics->VGAScaleY(y), g_lab->_graphics->VGAScaleX(158), g_lab->_graphics->VGAScaleY(148), ntext);
+ CharsPrinted = g_lab->_graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 45, y, 158, 148, ntext);
delete[] ntext;
ntext = g_lab->_resource->getText("Lab:Rooms/Col2");
- CharsPrinted = g_lab->_graphics->flowText(paperFont, -4, 0, 0, false, false, false, true, g_lab->_graphics->VGAScaleX(162), g_lab->_graphics->VGAScaleY(y), g_lab->_graphics->VGAScaleX(275), g_lab->_graphics->VGAScaleY(148), ntext);
+ CharsPrinted = g_lab->_graphics->flowTextScaled(paperFont, -4, 0, 0, false, false, false, true, 162, y, 275, 148, ntext);
delete[] ntext;
closeFont(paperFont);
@@ -236,7 +236,7 @@ static void drawJournalText() {
while (DrawingToPage < JPage) {
g_lab->_music->updateMusic();
CurText = (char *)(journaltext + CharsDrawn);
- CharsDrawn += g_lab->_graphics->flowText(journalFont, -2, 2, 0, false, false, false, false, g_lab->_graphics->VGAScaleX(52), g_lab->_graphics->VGAScaleY(32), g_lab->_graphics->VGAScaleX(152), g_lab->_graphics->VGAScaleY(148), CurText);
+ CharsDrawn += g_lab->_graphics->flowTextScaled(journalFont, -2, 2, 0, false, false, false, false, 52, 32, 152, 148, CurText);
lastpage = (*CurText == 0);
diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp
index a473b0eee8..137038fd75 100644
--- a/engines/lab/tilepuzzle.cpp
+++ b/engines/lab/tilepuzzle.cpp
@@ -212,7 +212,7 @@ void LabEngine::doTile(bool showsolution) {
cols = _graphics->VGAScaleX(105);
} else {
_graphics->setAPen(0);
- _graphics->rectFill(_graphics->VGAScaleX(97), _graphics->VGAScaleY(22), _graphics->VGAScaleX(220), _graphics->VGAScaleY(126));
+ _graphics->rectFillScaled(97, 22, 220, 126);
rowm = _graphics->VGAScaleY(25);
colm = _graphics->VGAScaleX(30);