aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2015-12-13 11:55:49 +0100
committerWillem Jan Palenstijn2015-12-23 21:34:01 +0100
commitaef304a83b15f5e829341f53b7af02099b2b32d3 (patch)
treedec56b14a60a90d35743c90289c35d905e120258
parentaad3b063b388e3d8cf4b4cc88bfc1d311d800c1b (diff)
downloadscummvm-rg350-aef304a83b15f5e829341f53b7af02099b2b32d3.tar.gz
scummvm-rg350-aef304a83b15f5e829341f53b7af02099b2b32d3.tar.bz2
scummvm-rg350-aef304a83b15f5e829341f53b7af02099b2b32d3.zip
LAB: Some renaming and refactoring in special.cpp
-rw-r--r--engines/lab/dispman.cpp14
-rw-r--r--engines/lab/dispman.h1
-rw-r--r--engines/lab/lab.cpp13
-rw-r--r--engines/lab/lab.h66
-rw-r--r--engines/lab/special.cpp207
5 files changed, 154 insertions, 147 deletions
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index d2f5f8d778..83022ba8dd 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -79,6 +79,20 @@ void DisplayMan::loadPict(const char *filename) {
delete bitmapFile;
}
+void DisplayMan::loadBackPict(const char *fileName, uint16 *highPal) {
+ FadePalette = highPal;
+ _vm->_anim->_noPalChange = true;
+ readPict(fileName, true);
+
+ for (uint16 i = 0; i < 16; i++) {
+ highPal[i] = ((_vm->_anim->_diffPalette[i * 3] >> 2) << 8) +
+ ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) +
+ ((_vm->_anim->_diffPalette[i * 3 + 2] >> 2));
+ }
+
+ _vm->_anim->_noPalChange = false;
+}
+
/**
* Reads in a picture into the display bitmap.
*/
diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h
index ad506c4cdf..58a517eb31 100644
--- a/engines/lab/dispman.h
+++ b/engines/lab/dispman.h
@@ -73,6 +73,7 @@ public:
virtual ~DisplayMan();
void loadPict(const char *filename);
+ void loadBackPict(const char *fileName, uint16 *highPal);
void readPict(const char *filename, bool playOnce, bool onlyDiffData = false, byte *memoryBuffer = nullptr, uint16 maxHeight = 0);
void freePict();
void doScrollBlack();
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index e33c443ee2..e7df814c5e 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -126,6 +126,19 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
_imgXMark = nullptr;
_maps = nullptr;
+ _blankJournal = nullptr;
+ _journalFont = nullptr;
+ _journalText = nullptr;
+ _journalTextTitle = nullptr;
+ _journalPage = 0;
+ _lastPage = false;
+ _monitorPage = 0;
+ _monitorTextFilename = "";
+ _monitorButton = nullptr;
+ _monitorGadgetHeight = 1;
+ for (int i = 0; i < 20; i++)
+ _highPalette[i] = 0;
+
//const Common::FSNode gameDataDir(ConfMan.get("path"));
//SearchMan.addSubDirectoryMatching(gameDataDir, "game");
//SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict");
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index b03b4b3605..08f7fc6174 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -37,6 +37,8 @@
#include "engines/engine.h"
+#include "lab/image.h"
+
struct ADGameDescription;
namespace Lab {
@@ -91,20 +93,28 @@ class LabEngine : public Engine {
private:
bool _interfaceOff;
bool _isCrumbWaiting;
+ bool _lastTooLong;
+ bool _lastPage;
bool _mainDisplay;
bool _noUpdateDiff;
bool _quitLab;
- bool _lastTooLong;
int _lastWaitTOFTicks;
uint16 _direction;
+ uint16 _highPalette[20];
+ uint16 _journalPage;
uint16 _maxRooms;
+ uint16 _monitorPage;
+ uint16 _monitorGadgetHeight;
uint32 _extraGameFeatures;
+ char *_journalText;
+ char *_journalTextTitle;
const char *_nextFileName;
const char *_newFileName;
+ const char *_monitorTextFilename;
CloseDataPtr _closeDataPtr;
GadgetList _journalGadgetList;
@@ -114,9 +124,15 @@ private:
Image *_imgMapEast, *_imgMapSouth, *_imgMapWest, *_imgXMark;
InventoryData *_inventory;
MapData *_maps;
+ byte *_blankJournal;
+ Image *_monitorButton;
+ TextFont *_journalFont;
Common::RandomSource _rnd;
+ Image journalBackImage;
+ Image ScreenImage;
+
public:
bool _alternate;
bool _droppingCrumbs;
@@ -176,62 +192,62 @@ public:
void waitTOF();
private:
+ bool checkConditions(int16 *condition);
Gadget *checkNumGadgetHit(GadgetList *gadgetList, uint16 key);
void decIncInv(uint16 *CurInv, bool dec);
+ void doActions(Action *actionList, CloseDataPtr *closePtrList);
+ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList);
+ bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults);
+ bool doCloseUp(CloseDataPtr closePtr);
+ bool doGoForward(CloseDataPtr *closePtrList);
void doJournal();
+ bool doMainView(CloseDataPtr *closePtrList);
void doMap(uint16 curRoom);
void doMonitor(char *background, char *textfile, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
void doNotes();
+ bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults);
+ bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList);
+ bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList);
+ bool doUse(uint16 curInv);
void doWestPaper();
void drawDirection(CloseDataPtr closePtr);
void drawJournal(uint16 wipenum, bool needFade);
+ void drawJournalText();
void drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fadeOut, bool fadeIn);
void drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16 y1, uint16 x2, uint16 y2, bool isinteractive);
+ void drawRoomMap(uint16 curRoom, bool drawMarkFl);
void drawRoomMessage(uint16 curInv, CloseDataPtr closePtr);
void drawStaticMessage(byte index);
void eatMessages();
+ CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataPtr closePtrList);
+ bool floorVisited(uint16 floorNum);
int followCrumbs();
void freeMapData();
+ void freeScreens();
bool fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos,
uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode);
- void interfaceOff();
- void interfaceOn();
- void loadJournalData();
- void loadMapData();
- void processJournal();
- void processMap(uint16 curRoom);
- void processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
-
-private:
- bool checkConditions(int16 *condition);
- void doActions(Action *actionList, CloseDataPtr *closePtrList);
- bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *closePtrList);
- bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults);
- bool doCloseUp(CloseDataPtr closePtr);
- bool doGoForward(CloseDataPtr *closePtrList);
- bool doMainView(CloseDataPtr *closePtrList);
- bool doOperateRuleSub(int16 itemNum, int16 roomNum, CloseDataPtr closePtr, CloseDataPtr *setCloseList, bool allowDefaults);
- bool doOperateRule(Common::Point pos, int16 ItemNum, CloseDataPtr *closePtrList);
- bool doTurn(uint16 from, uint16 to, CloseDataPtr *closePtrList);
- bool doUse(uint16 curInv);
- void drawRoomMap(uint16 curRoom, bool drawMarkFl);
- CloseDataPtr findClosePtrMatch(CloseDataPtr closePtr, CloseDataPtr closePtrList);
- bool floorVisited(uint16 floorNum);
- void freeScreens();
const char *getInvName(uint16 curInv);
uint16 getLowerFloor(uint16 floorNum);
CloseData *getObject(Common::Point pos, CloseDataPtr closePtr);
uint16 getUpperFloor(uint16 floorNum);
ViewData *getViewData(uint16 roomNum, uint16 direction);
+ void interfaceOff();
+ void interfaceOn();
+ void loadJournalData();
+ void loadMapData();
void mainGameLoop();
void mayShowCrumbIndicator();
void mayShowCrumbIndicatorOff();
void perFlipGadget(uint16 gadID);
uint16 processArrow(uint16 curDirection, uint16 arrow);
+ void processJournal();
+ void processMap(uint16 curRoom);
+ void processMonitor(char *ntext, TextFont *monitorFont, bool isinteractive, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
Common::Rect roomCoords(uint16 curRoom);
bool saveRestoreGame();
void setCurrentClose(Common::Point pos, CloseDataPtr *closePtrList, bool useAbsoluteCoords);
bool takeItem(uint16 x, uint16 y, CloseDataPtr *closePtrList);
+ void turnPage(bool fromLeft);
};
extern LabEngine *g_lab;
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 6289cf2583..90f20b720a 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -42,46 +42,12 @@
#include "lab/utils.h"
namespace Lab {
-
-static uint16 MonGadHeight = 1;
-static uint16 hipal[20];
-
-static TextFont *journalFont;
-static char *journaltext, *journaltexttitle;
-static uint16 JPage = 0;
-static bool lastpage = false;
-static Image JBackImage, ScreenImage;
-static byte *_blankJournal;
-static uint16 monitorPage;
-static const char *TextFileName;
-
-Image *MonButton;
-
-#define INCL(BITSET,BIT) ((BITSET) |= (BIT))
-#define SETBIT(BITSET,BITNUM) INCL(BITSET, (1 << (BITNUM)))
-#define INBIT(BITSET,BITNUM) ( ((1 << (BITNUM)) & (BITSET)) > 0 )
#define BRIDGE0 148
#define BRIDGE1 104
#define DIRTY 175
#define NONEWS 135
#define NOCLEAN 152
-
-static void loadBackPict(const char *fileName) {
- g_lab->_graphics->FadePalette = hipal;
-
- g_lab->_anim->_noPalChange = true;
- g_lab->_graphics->readPict(fileName, true);
-
- for (uint16 i = 0; i < 16; i++) {
- hipal[i] = ((g_lab->_anim->_diffPalette[i * 3] >> 2) << 8) +
- ((g_lab->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) +
- ((g_lab->_anim->_diffPalette[i * 3 + 2] >> 2));
- }
-
- g_lab->_anim->_noPalChange = false;
-}
-
/**
* Does the things to properly set up the detective notes.
*/
@@ -96,7 +62,6 @@ void LabEngine::doNotes() {
delete[] ntext;
}
-
/**
* Does the things to properly set up the old west newspaper. Assumes that
* OpenHiRes already called.
@@ -141,7 +106,7 @@ void LabEngine::doWestPaper() {
* Loads in the data for the journal.
*/
void LabEngine::loadJournalData() {
- journalFont = _resource->getFont("P:Journal.fon");
+ _journalFont = _resource->getFont("P:Journal.fon");
_music->updateMusic();
@@ -172,8 +137,8 @@ void LabEngine::loadJournalData() {
else if (bridge)
filename[11] = '1';
- journaltext = _resource->getText(filename);
- journaltexttitle = _resource->getText("Lab:Rooms/jt");
+ _journalText = _resource->getText(filename);
+ _journalTextTitle = _resource->getText("Lab:Rooms/jt");
Common::File *journalFile = _resource->openDataFile("P:JImage");
Utils *utils = _utils;
@@ -183,13 +148,13 @@ void LabEngine::loadJournalData() {
delete journalFile;
_anim->_noPalChange = true;
- JBackImage._imageData = new byte[_graphics->_screenWidth * _graphics->_screenHeight];
- _graphics->readPict("P:Journal.pic", true, false, JBackImage._imageData);
+ journalBackImage._imageData = new byte[_graphics->_screenWidth * _graphics->_screenHeight];
+ _graphics->readPict("P:Journal.pic", true, false, journalBackImage._imageData);
_anim->_noPalChange = false;
// Keep a copy of the blank journal
_blankJournal = new byte[_graphics->_screenWidth * _graphics->_screenHeight];
- memcpy(_blankJournal, JBackImage._imageData, _graphics->_screenWidth * _graphics->_screenHeight);
+ memcpy(_blankJournal, journalBackImage._imageData, _graphics->_screenWidth * _graphics->_screenHeight);
ScreenImage._imageData = _graphics->getCurrentDrawingBuffer();
}
@@ -197,58 +162,58 @@ void LabEngine::loadJournalData() {
/**
* Draws the text to the back journal screen to the appropriate Page number
*/
-static void drawJournalText() {
+void LabEngine::drawJournalText() {
uint16 drawingToPage = 1;
- int32 charsDrawn = 0L;
- char *curText = journaltext;
+ int32 charsDrawn = 0;
+ char *curText = _journalText;
- while (drawingToPage < JPage) {
- g_lab->_music->updateMusic();
- curText = (char *)(journaltext + charsDrawn);
- charsDrawn += g_lab->_graphics->flowTextScaled(journalFont, -2, 2, 0, false, false, false, false, 52, 32, 152, 148, curText);
+ 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);
- lastpage = (*curText == 0);
+ _lastPage = (*curText == 0);
- if (lastpage)
- JPage = (drawingToPage / 2) * 2;
+ if (_lastPage)
+ _journalPage = (drawingToPage / 2) * 2;
else
drawingToPage++;
}
- if (JPage <= 1) {
- curText = journaltexttitle;
- g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, true, true, true, g_lab->_utils->vgaScaleX(52), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(152), g_lab->_utils->vgaScaleY(148), curText);
+ 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);
} else {
- curText = (char *)(journaltext + charsDrawn);
- charsDrawn += g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_utils->vgaScaleX(52), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(152), g_lab->_utils->vgaScaleY(148), curText);
+ curText = (char *)(_journalText + charsDrawn);
+ charsDrawn += g_lab->_graphics->flowTextToMem(&journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaScaleX(52), _utils->vgaScaleY(32), _utils->vgaScaleX(152), _utils->vgaScaleY(148), curText);
}
- g_lab->_music->updateMusic();
- curText = (char *)(journaltext + charsDrawn);
- lastpage = (*curText == 0);
- g_lab->_graphics->flowTextToMem(&JBackImage, journalFont, -2, 2, 0, false, false, false, true, g_lab->_utils->vgaScaleX(171), g_lab->_utils->vgaScaleY(32), g_lab->_utils->vgaScaleX(271), g_lab->_utils->vgaScaleY(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);
- curText = (char *)(journaltext + charsDrawn);
- lastpage = lastpage || (*curText == 0);
+ curText = (char *)(_journalText + charsDrawn);
+ _lastPage = _lastPage || (*curText == 0);
}
/**
* Does the turn page wipe.
*/
-static void turnPage(bool fromLeft) {
+void LabEngine::turnPage(bool fromLeft) {
if (fromLeft) {
- for (int i = 0; i < g_lab->_graphics->_screenWidth; i += 8) {
- g_lab->_music->updateMusic();
- g_lab->waitTOF();
- ScreenImage._imageData = g_lab->_graphics->getCurrentDrawingBuffer();
- JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_graphics->_screenHeight, false);
+ for (int i = 0; i < _graphics->_screenWidth; i += 8) {
+ _music->updateMusic();
+ waitTOF();
+ ScreenImage._imageData = _graphics->getCurrentDrawingBuffer();
+ journalBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, _graphics->_screenHeight, false);
}
} else {
- for (int i = (g_lab->_graphics->_screenWidth - 8); i > 0; i -= 8) {
- g_lab->_music->updateMusic();
- g_lab->waitTOF();
- ScreenImage._imageData = g_lab->_graphics->getCurrentDrawingBuffer();
- JBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, g_lab->_graphics->_screenHeight, false);
+ for (int i = (_graphics->_screenWidth - 8); i > 0; i -= 8) {
+ _music->updateMusic();
+ waitTOF();
+ ScreenImage._imageData = _graphics->getCurrentDrawingBuffer();
+ journalBackImage.blitBitmap(i, 0, &ScreenImage, i, 0, 8, _graphics->_screenHeight, false);
}
}
}
@@ -260,24 +225,22 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) {
_event->mouseHide();
_music->updateMusic();
drawJournalText();
-
- // TODO: This is only called to set the palette correctly. Refactor, if possible
- loadBackPict("P:Journal.pic");
+ _graphics->loadBackPict("P:Journal.pic", _highPalette);
if (wipenum == 0)
- JBackImage.blitBitmap(0, 0, &ScreenImage, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight, false);
+ journalBackImage.blitBitmap(0, 0, &ScreenImage, 0, 0, _graphics->_screenWidth, _graphics->_screenHeight, false);
else
turnPage((bool)(wipenum == 1));
Gadget *backGadget = _event->getGadget(0);
Gadget *forwardGadget = _event->getGadget(2);
- if (JPage == 0)
+ if (_journalPage == 0)
disableGadget(backGadget, 15);
else
enableGadget(backGadget);
- if (lastpage)
+ if (_lastPage)
disableGadget(forwardGadget, 15);
else
enableGadget(forwardGadget);
@@ -286,7 +249,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) {
_graphics->fade(true, 0);
// Reset the journal background, so that all the text that has been blitted on it is erased
- memcpy(JBackImage._imageData, _blankJournal, _graphics->_screenWidth * _graphics->_screenHeight);
+ memcpy(journalBackImage._imageData, _blankJournal, _graphics->_screenWidth * _graphics->_screenHeight);
eatMessages();
_event->mouseShow();
@@ -313,15 +276,15 @@ void LabEngine::processJournal() {
return;
else if (msgClass == GADGETUP) {
if (gadID == 0) {
- if (JPage >= 2) {
- JPage -= 2;
+ if (_journalPage >= 2) {
+ _journalPage -= 2;
drawJournal(1, false);
}
} else if (gadID == 1) {
return;
} else if (gadID == 2) {
- if (!lastpage) {
- JPage += 2;
+ if (!_lastPage) {
+ _journalPage += 2;
drawJournal(2, false);
}
}
@@ -336,13 +299,13 @@ void LabEngine::processJournal() {
void LabEngine::doJournal() {
_graphics->blackAllScreen();
- lastpage = false;
+ _lastPage = false;
- JBackImage._width = _graphics->_screenWidth;
- JBackImage._height = _graphics->_screenHeight;
- JBackImage._imageData = NULL;
+ journalBackImage._width = _graphics->_screenWidth;
+ journalBackImage._height = _graphics->_screenHeight;
+ journalBackImage._imageData = NULL;
- ScreenImage = JBackImage;
+ ScreenImage = journalBackImage;
ScreenImage._imageData = _graphics->getCurrentDrawingBuffer();
_music->updateMusic();
@@ -357,9 +320,9 @@ void LabEngine::doJournal() {
_event->mouseHide();
delete[] _blankJournal;
- delete[] JBackImage._imageData;
+ delete[] journalBackImage._imageData;
freeButtonList(&_journalGadgetList);
- _graphics->closeFont(journalFont);
+ _graphics->closeFont(_journalFont);
ScreenImage._imageData = _graphics->getCurrentDrawingBuffer();
@@ -386,19 +349,19 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16
text += 2;
fheight = _graphics->textHeight(monitorFont);
- x1 = MonButton->_width + _utils->vgaScaleX(3);
- MonGadHeight = MonButton->_height + _utils->vgaScaleY(3);
+ x1 = _monitorButton->_width + _utils->vgaScaleX(3);
+ _monitorGadgetHeight = _monitorButton->_height + _utils->vgaScaleY(3);
- if (MonGadHeight > fheight)
- yspacing = MonGadHeight - fheight;
+ if (_monitorGadgetHeight > fheight)
+ yspacing = _monitorGadgetHeight - fheight;
else
- MonGadHeight = fheight;
+ _monitorGadgetHeight = fheight;
_graphics->setAPen(0);
_graphics->rectFill(0, 0, _graphics->_screenWidth - 1, y2);
for (uint16 i = 0; i < numlines; i++)
- MonButton->drawImage(0, i * MonGadHeight);
+ _monitorButton->drawImage(0, i * _monitorGadgetHeight);
} else if (isinteractive) {
_graphics->setAPen(0);
_graphics->rectFill(0, 0, _graphics->_screenWidth - 1, y2);
@@ -407,23 +370,23 @@ void LabEngine::drawMonText(char *text, TextFont *monitorFont, uint16 x1, uint16
_graphics->rectFill(x1, y1, x2, y2);
}
- while (drawingToPage < monitorPage) {
+ 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);
- lastpage = (*curText == 0);
+ _lastPage = (*curText == 0);
- if (lastpage)
- monitorPage = drawingToPage;
+ if (_lastPage)
+ _monitorPage = drawingToPage;
else
drawingToPage++;
}
curText = (char *)(text + charsDrawn);
- lastpage = (*curText == 0);
+ _lastPage = (*curText == 0);
charsDrawn = _graphics->flowText(monitorFont, yspacing, 2, 0, false, false, false, true, x1, y1, x2, y2, curText);
curText += charsDrawn;
- lastpage = lastpage || (*curText == 0);
+ _lastPage = _lastPage || (*curText == 0);
_event->mouseShow();
}
@@ -432,7 +395,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) {
- const char *test = " ", *startFileName = TextFileName;
+ const char *test = " ", *startFileName = _monitorTextFilename;
CloseDataPtr startClosePtr = _closeDataPtr, lastClosePtr[10];
uint16 depth = 0;
@@ -448,11 +411,11 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera
else
test = _closeDataPtr->_graphicName;
- if (strcmp(test, TextFileName)) {
- monitorPage = 0;
- TextFileName = test;
+ if (strcmp(test, _monitorTextFilename)) {
+ _monitorPage = 0;
+ _monitorTextFilename = test;
- ntext = _resource->getText(TextFileName);
+ ntext = _resource->getText(_monitorTextFilename);
_graphics->fade(false, 0);
drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive);
_graphics->fade(true, 0);
@@ -480,33 +443,33 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera
else if ((msgClass == MOUSEBUTTONS) && (IEQUALIFIER_LEFTBUTTON & qualifier)) {
if ((mouseY >= _utils->vgaScaleY(171)) && (mouseY <= _utils->vgaScaleY(200))) {
if ((mouseX >= _utils->vgaScaleX(259)) && (mouseX <= _utils->vgaScaleX(289))) {
- if (!lastpage) {
- monitorPage += 1;
+ if (!_lastPage) {
+ _monitorPage += 1;
drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive);
}
} else if ((mouseX >= _utils->vgaScaleX(0)) && (mouseX <= _utils->vgaScaleX(31))) {
return;
} else if ((mouseX >= _utils->vgaScaleX(290)) && (mouseX <= _utils->vgaScaleX(320))) {
- if (monitorPage >= 1) {
- monitorPage -= 1;
+ if (_monitorPage >= 1) {
+ _monitorPage -= 1;
drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive);
}
} else if ((mouseX >= _utils->vgaScaleX(31)) && (mouseX <= _utils->vgaScaleX(59))) {
if (isinteractive) {
- monitorPage = 0;
+ _monitorPage = 0;
if (depth) {
depth--;
_closeDataPtr = lastClosePtr[depth];
}
- } else if (monitorPage > 0) {
- monitorPage = 0;
+ } else if (_monitorPage > 0) {
+ _monitorPage = 0;
drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive);
}
}
} else if (isinteractive) {
CloseDataPtr tmpClosePtr = _closeDataPtr;
- mouseY = 64 + (mouseY / MonGadHeight) * 42;
+ mouseY = 64 + (mouseY / _monitorGadgetHeight) * 42;
mouseX = 101;
setCurrentClose(Common::Point(mouseX, mouseY), &_closeDataPtr, false);
@@ -531,7 +494,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive,
y1 = _utils->vgaScaleY(y1);
y2 = _utils->vgaScaleY(y2);
- TextFileName = textfile;
+ _monitorTextFilename = textfile;
_graphics->blackAllScreen();
_graphics->readPict("P:Mon/Monitor.1", true);
@@ -540,17 +503,17 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive,
_graphics->readPict("P:Mon/NWD3", true);
_graphics->blackAllScreen();
- monitorPage = 0;
- lastpage = false;
- _graphics->FadePalette = hipal;
+ _monitorPage = 0;
+ _lastPage = false;
+ _graphics->FadePalette = _highPalette;
TextFont *monitorFont = _resource->getFont("P:Map.fon");
Common::File *buttonFile = _resource->openDataFile("P:MonImage");
- MonButton = new Image(buttonFile);
+ _monitorButton = new Image(buttonFile);
delete buttonFile;
ntext = _resource->getText(textfile);
- loadBackPict(background);
+ _graphics->loadBackPict(background, _highPalette);
drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive);
_event->mouseShow();
_graphics->fade(true, 0);