LAB: Move fade functions to DisplayMan, some renaming

This commit is contained in:
Strangerke 2015-12-06 18:16:26 +01:00 committed by Willem Jan Palenstijn
parent 438e7a24f5
commit 785772e86f
11 changed files with 124 additions and 133 deletions

View file

@ -122,8 +122,8 @@ void LabEngine::freeScreens() {
for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) { for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) {
delete _invImages[imgIdx]; delete _invImages[imgIdx];
delete Images[imgIdx]; delete _numberImages[imgIdx];
_invImages[imgIdx] = Images[imgIdx] = nullptr; _invImages[imgIdx] = _numberImages[imgIdx] = nullptr;
} }
} }

View file

@ -53,6 +53,7 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) {
_displayBuffer = nullptr; _displayBuffer = nullptr;
_currentDisplayBuffer = nullptr; _currentDisplayBuffer = nullptr;
_tempScrollData = nullptr; _tempScrollData = nullptr;
FadePalette = nullptr;
_screenWidth = 0; _screenWidth = 0;
_screenHeight = 0; _screenHeight = 0;
@ -1164,4 +1165,36 @@ void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint1
rectFill(x1, y1, x2, y1 + dy - 1); rectFill(x1, y1, x2, y1 + dy - 1);
} }
/*****************************************************************************/
/* Does the fading of the Palette on the screen. */
/*****************************************************************************/
uint16 DisplayMan::fadeNumIn(uint16 num, uint16 res, uint16 counter) {
return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15));
}
uint16 DisplayMan::fadeNumOut(uint16 num, uint16 res, uint16 counter) {
return (num - ((((int32) counter) * ((int32)(num - res))) / 15));
}
void DisplayMan::fade(bool fadein, uint16 res) {
uint16 newpal[16];
for (uint16 i = 0; i < 16; i++) {
for (uint16 palIdx = 0; palIdx < 16; palIdx++) {
if (fadein)
newpal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) +
(0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) +
(0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i));
else
newpal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) +
(0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) +
(0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i));
}
g_lab->_graphics->setAmigaPal(newpal, 16);
g_lab->waitTOF();
g_lab->_music->updateMusic();
}
}
} // End of namespace Lab } // End of namespace Lab

View file

@ -41,6 +41,9 @@ class DisplayMan {
private: private:
LabEngine *_vm; LabEngine *_vm;
uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter);
uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter);
byte _curapen; byte _curapen;
byte *_curBitmap; byte *_curBitmap;
byte _curvgapal[256 * 3]; byte _curvgapal[256 * 3];
@ -125,6 +128,7 @@ public:
byte *getCurrentDrawingBuffer(); byte *getCurrentDrawingBuffer();
void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2); void scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2);
void fade(bool fadein, uint16 res);
bool _longWinInFront; bool _longWinInFront;
bool _lastMessageLong; bool _lastMessageLong;
@ -134,6 +138,7 @@ public:
byte *_displayBuffer; byte *_displayBuffer;
byte *_currentDisplayBuffer; byte *_currentDisplayBuffer;
bool _doNotDrawMessage; bool _doNotDrawMessage;
uint16 *FadePalette;
}; };
} // End of namespace Lab } // End of namespace Lab

View file

@ -33,8 +33,6 @@
#include "lab/anim.h" #include "lab/anim.h"
namespace Lab { namespace Lab {
extern uint16 *FadePalette;
Intro::Intro(LabEngine *vm) : _vm(vm) { Intro::Intro(LabEngine *vm) : _vm(vm) {
_quitIntro = false; _quitIntro = false;
} }
@ -101,14 +99,14 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
if (begin) if (begin)
begin = false; begin = false;
else if (isScreen) else if (isScreen)
fade(false, 0); _vm->_graphics->fade(false, 0);
if (isScreen) { if (isScreen) {
_vm->_graphics->setAPen(7); _vm->_graphics->setAPen(7);
_vm->_graphics->rectFillScaled(10, 10, 310, 190); _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); Drawn = _vm->_graphics->flowTextScaled(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, 14, 11, 306, 189, (char *)curText);
fade(true, 0); _vm->_graphics->fade(true, 0);
} else { } else {
Drawn = _vm->_graphics->longDrawMessage((char *)curText); Drawn = _vm->_graphics->longDrawMessage((char *)curText);
} }
@ -122,7 +120,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
if (_quitIntro) { if (_quitIntro) {
if (isScreen) if (isScreen)
fade(false, 0); _vm->_graphics->fade(false, 0);
delete[] textBuffer; delete[] textBuffer;
return; return;
@ -142,7 +140,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
if (secs > timeDelay) { if (secs > timeDelay) {
if (end) { if (end) {
if (isScreen) if (isScreen)
fade(false, 0); _vm->_graphics->fade(false, 0);
delete[] textBuffer; delete[] textBuffer;
return; return;
@ -162,7 +160,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
_quitIntro = true; _quitIntro = true;
if (isScreen) if (isScreen)
fade(false, 0); _vm->_graphics->fade(false, 0);
delete[] textBuffer; delete[] textBuffer;
return; return;
@ -172,7 +170,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
if (IEQUALIFIER_LEFTBUTTON & qualifier) { if (IEQUALIFIER_LEFTBUTTON & qualifier) {
if (end) { if (end) {
if (isScreen) if (isScreen)
fade(false, 0); _vm->_graphics->fade(false, 0);
delete[] textBuffer; delete[] textBuffer;
return; return;
@ -184,7 +182,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
if (_quitIntro) { if (_quitIntro) {
if (isScreen) if (isScreen)
fade(false, 0); _vm->_graphics->fade(false, 0);
delete[] textBuffer; delete[] textBuffer;
return; return;
@ -193,7 +191,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {
if (end) { if (end) {
if (isScreen) if (isScreen)
fade(false, 0); _vm->_graphics->fade(false, 0);
delete[] textBuffer; delete[] textBuffer;
return; return;
@ -273,7 +271,7 @@ void Intro::introSequence() {
nReadPict("TNDcycle2.pic", true); nReadPict("TNDcycle2.pic", true);
_vm->_anim->_noPalChange = false; _vm->_anim->_noPalChange = false;
FadePalette = palette; _vm->_graphics->FadePalette = palette;
for (uint16 i = 0; i < 16; i++) { for (uint16 i = 0; i < 16; i++) {
if (_quitIntro) if (_quitIntro)
@ -285,7 +283,7 @@ void Intro::introSequence() {
} }
_vm->_music->updateMusic(); _vm->_music->updateMusic();
fade(true, 0); _vm->_graphics->fade(true, 0);
for (int times = 0; times < 150; times++) { for (int times = 0; times < 150; times++) {
if (_quitIntro) if (_quitIntro)
@ -303,7 +301,7 @@ void Intro::introSequence() {
_vm->waitTOF(); _vm->waitTOF();
} }
fade(false, 0); _vm->_graphics->fade(false, 0);
_vm->_graphics->blackAllScreen(); _vm->_graphics->blackAllScreen();
_vm->_music->updateMusic(); _vm->_music->updateMusic();

View file

@ -95,9 +95,12 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
_invImages[i] = nullptr; _invImages[i] = nullptr;
Images[i] = nullptr; _numberImages[i] = nullptr;
} }
for (int i = 0; i < 16; i++)
_tiles[i] = nullptr;
_moveGadgetList = nullptr; _moveGadgetList = nullptr;
_invGadgetList = nullptr; _invGadgetList = nullptr;
_curFileName = nullptr; _curFileName = nullptr;
@ -128,7 +131,7 @@ LabEngine::~LabEngine() {
delete _graphics; delete _graphics;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
delete Tiles[i]; delete _tiles[i];
} }
Common::Error LabEngine::run() { Common::Error LabEngine::run() {

View file

@ -126,16 +126,16 @@ public:
Gadget *_invGadgetList; Gadget *_invGadgetList;
Image *_moveImages[20]; Image *_moveImages[20];
Image *_invImages[10]; Image *_invImages[10];
Image *Images[10]; Image *_numberImages[10];
uint16 CurTile[4][4]; uint16 _curTile[4][4];
byte combination[6]; byte _combination[6];
private: private:
int _lastWaitTOFTicks; int _lastWaitTOFTicks;
bool _lastTooLong; bool _lastTooLong;
CloseDataPtr _cptr; CloseDataPtr _cptr;
InventoryData *_inventory; InventoryData *_inventory;
Image *Tiles[16]; Image *_tiles[16];
private: private:
bool from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage * curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); bool from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage * curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode);

View file

@ -70,12 +70,6 @@ struct SaveGameHeader {
bool readMusic(const char *filename, bool waitTillFinished); bool readMusic(const char *filename, bool waitTillFinished);
/*---------------------------*/
/*-------- From Map.c -------*/
/*---------------------------*/
void fade(bool fadein, uint16 res);
/*--------------------------*/ /*--------------------------*/
/*----- From saveGame.c ----*/ /*----- From saveGame.c ----*/
/*--------------------------*/ /*--------------------------*/

View file

@ -56,8 +56,6 @@ static MapData *Maps;
extern char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZEFLOORS, *SURMAZEFLOORS, *CARNIVALFLOOR, *SURMAZEMSG; extern char *LOWERFLOORS, *MIDDLEFLOORS, *UPPERFLOORS, *MEDMAZEFLOORS, *HEDGEMAZEFLOORS, *SURMAZEFLOORS, *CARNIVALFLOOR, *SURMAZEMSG;
uint16 *FadePalette;
static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105}; static uint16 MapGadX[3] = {101, 55, 8}, MapGadY[3] = {105, 105, 105};
static Gadget downgadget = { 101, 105, 2, VKEY_DNARROW, 0L, NULL, NULL, NULL }, static Gadget downgadget = { 101, 105, 2, VKEY_DNARROW, 0L, NULL, NULL, NULL },
@ -66,14 +64,6 @@ static Gadget downgadget = { 101, 105, 2, VKEY_DNARROW, 0L, NULL, NULL, NULL },
static Gadget *MapGadgetList = &backgadget; static Gadget *MapGadgetList = &backgadget;
static uint16 AmigaMapPalette[] = {
0x0BA8, 0x0C11, 0x0A74, 0x0076,
0x0A96, 0x0DCB, 0x0CCA, 0x0222,
0x0444, 0x0555, 0x0777, 0x0999,
0x0AAA, 0x0ED0, 0x0EEE, 0x0694
};
#define LOWERFLOOR 1 #define LOWERFLOOR 1
#define MIDDLEFLOOR 2 #define MIDDLEFLOOR 2
#define UPPERFLOOR 3 #define UPPERFLOOR 3
@ -167,48 +157,11 @@ static bool loadMapData() {
return true; return true;
} }
static void freeMapData() { static void freeMapData() {
delete[] Maps; delete[] Maps;
Maps = NULL; Maps = NULL;
} }
static uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter) {
return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15));
}
static uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter) {
return (num - ((((int32) counter) * ((int32)(num - res))) / 15));
}
/*****************************************************************************/
/* Does the fading of the Palette on the screen. */
/*****************************************************************************/
void fade(bool fadein, uint16 res) {
uint16 newpal[16];
for (uint16 i = 0; i < 16; i++) {
for (uint16 palIdx = 0; palIdx < 16; palIdx++) {
if (fadein)
newpal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) +
(0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) +
(0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i));
else
newpal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) +
(0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) +
(0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i));
}
g_lab->_graphics->setAmigaPal(newpal, 16);
g_lab->waitTOF();
g_lab->_music->updateMusic();
}
}
/*****************************************************************************/ /*****************************************************************************/
/* Figures out what a room's coordinates should be. */ /* Figures out what a room's coordinates should be. */
/*****************************************************************************/ /*****************************************************************************/
@ -460,7 +413,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou
_event->mouseHide(); _event->mouseHide();
if (fadeout) if (fadeout)
fade(false, 0); _graphics->fade(false, 0);
_graphics->setAPen(0); _graphics->setAPen(0);
_graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1);
@ -523,7 +476,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou
_graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr); _graphics->flowTextScaled(_msgFont, 0, 5, 3, true, true, true, true, 14, 148, 134, 186, sptr);
if (fadein) if (fadein)
fade(true, 0); _graphics->fade(true, 0);
_event->mouseShow(); _event->mouseShow();
} }
@ -594,9 +547,9 @@ void LabEngine::processMap(uint16 CurRoom) {
getUpFloor(&CurFloor, &drawmap); getUpFloor(&CurFloor, &drawmap);
if (drawmap) { if (drawmap) {
fade(false, 0); _graphics->fade(false, 0);
drawMap(CurRoom, CurMsg, CurFloor, false, false); drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0); _graphics->fade(true, 0);
} else } else
CurFloor = OldFloor; CurFloor = OldFloor;
} else if (GadgetID == 2) { /* Down arrow */ } else if (GadgetID == 2) { /* Down arrow */
@ -604,9 +557,9 @@ void LabEngine::processMap(uint16 CurRoom) {
getDownFloor(&CurFloor, &drawmap); getDownFloor(&CurFloor, &drawmap);
if (drawmap) { if (drawmap) {
fade(false, 0); _graphics->fade(false, 0);
drawMap(CurRoom, CurMsg, CurFloor, false, false); drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0); _graphics->fade(true, 0);
} else } else
CurFloor = OldFloor; CurFloor = OldFloor;
} }
@ -618,9 +571,9 @@ void LabEngine::processMap(uint16 CurRoom) {
&& onFloor(SURMAZEFLOOR)) { && onFloor(SURMAZEFLOOR)) {
CurFloor = SURMAZEFLOOR; CurFloor = SURMAZEFLOOR;
fade(false, 0); _graphics->fade(false, 0);
drawMap(CurRoom, CurMsg, CurFloor, false, false); drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0); _graphics->fade(true, 0);
} }
else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71)) else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71))
@ -628,9 +581,9 @@ void LabEngine::processMap(uint16 CurRoom) {
&& onFloor(CARNIVAL)) { && onFloor(CARNIVAL)) {
CurFloor = CARNIVAL; CurFloor = CARNIVAL;
fade(false, 0); _graphics->fade(false, 0);
drawMap(CurRoom, CurMsg, CurFloor, false, false); drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0); _graphics->fade(true, 0);
} }
else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325)) else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325))
@ -638,9 +591,9 @@ void LabEngine::processMap(uint16 CurRoom) {
&& onFloor(MEDMAZEFLOOR)) { && onFloor(MEDMAZEFLOOR)) {
CurFloor = MEDMAZEFLOOR; CurFloor = MEDMAZEFLOOR;
fade(false, 0); _graphics->fade(false, 0);
drawMap(CurRoom, CurMsg, CurFloor, false, false); drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0); _graphics->fade(true, 0);
} }
else if ((CurFloor == UPPERFLOOR) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97)) else if ((CurFloor == UPPERFLOOR) && (MouseX >= mapScaleX(524)) && (MouseY >= mapScaleY(97))
@ -648,9 +601,9 @@ void LabEngine::processMap(uint16 CurRoom) {
&& onFloor(HEDGEMAZEFLOOR)) { && onFloor(HEDGEMAZEFLOOR)) {
CurFloor = HEDGEMAZEFLOOR; CurFloor = HEDGEMAZEFLOOR;
fade(false, 0); _graphics->fade(false, 0);
drawMap(CurRoom, CurMsg, CurFloor, false, false); drawMap(CurRoom, CurMsg, CurFloor, false, false);
fade(true, 0); _graphics->fade(true, 0);
} }
else if (MouseX > mapScaleX(314)) { else if (MouseX > mapScaleX(314)) {
@ -705,7 +658,14 @@ void LabEngine::processMap(uint16 CurRoom) {
/* Does the map processing. */ /* Does the map processing. */
/*****************************************************************************/ /*****************************************************************************/
void LabEngine::doMap(uint16 CurRoom) { void LabEngine::doMap(uint16 CurRoom) {
FadePalette = AmigaMapPalette; static uint16 AmigaMapPalette[] = {
0x0BA8, 0x0C11, 0x0A74, 0x0076,
0x0A96, 0x0DCB, 0x0CCA, 0x0222,
0x0444, 0x0555, 0x0777, 0x0999,
0x0AAA, 0x0ED0, 0x0EEE, 0x0694
};
_graphics->FadePalette = AmigaMapPalette;
_music->updateMusic(); _music->updateMusic();
loadMapData(); loadMapData();
@ -726,7 +686,7 @@ void LabEngine::doMap(uint16 CurRoom) {
_graphics->screenUpdate(); _graphics->screenUpdate();
processMap(CurRoom); processMap(CurRoom);
_event->attachGadgetList(NULL); _event->attachGadgetList(NULL);
fade(false, 0); _graphics->fade(false, 0);
_graphics->blackAllScreen(); _graphics->blackAllScreen();
_event->mouseHide(); _event->mouseHide();
_graphics->setAPen(0); _graphics->setAPen(0);

View file

@ -146,12 +146,12 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc)
// Combination lock and tile stuff // Combination lock and tile stuff
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
file->writeByte(g_lab->combination[i]); file->writeByte(g_lab->_combination[i]);
// Tiles // Tiles
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
file->writeUint16LE(g_lab->CurTile[i][j]); file->writeUint16LE(g_lab->_curTile[i][j]);
// Breadcrumbs // Breadcrumbs
for (i = 0; i < sizeof(g_lab->_breadCrumbs); i++) { for (i = 0; i < sizeof(g_lab->_breadCrumbs); i++) {
@ -196,12 +196,12 @@ bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) {
// Combination lock and tile stuff // Combination lock and tile stuff
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
g_lab->combination[i] = file->readByte(); g_lab->_combination[i] = file->readByte();
// Tiles // Tiles
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
g_lab->CurTile[i][j] = file->readUint16LE(); g_lab->_curTile[i][j] = file->readUint16LE();
// Breadcrumbs // Breadcrumbs
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {

View file

@ -60,8 +60,6 @@ static uint16 monitorPage;
static const char *TextFileName; static const char *TextFileName;
Image *MonButton; Image *MonButton;
extern uint16 *FadePalette;
extern BitMap *DispBitMap, *DrawBitMap; extern BitMap *DispBitMap, *DrawBitMap;
#define INCL(BITSET,BIT) ((BITSET) |= (BIT)) #define INCL(BITSET,BIT) ((BITSET) |= (BIT))
@ -78,7 +76,7 @@ extern BitMap *DispBitMap, *DrawBitMap;
static byte *loadBackPict(const char *fileName, bool tomem) { static byte *loadBackPict(const char *fileName, bool tomem) {
byte *res = nullptr; byte *res = nullptr;
FadePalette = hipal; g_lab->_graphics->FadePalette = hipal;
g_lab->_anim->_noPalChange = true; g_lab->_anim->_noPalChange = true;
if (tomem) if (tomem)
@ -316,7 +314,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) {
if (needFade) if (needFade)
fade(true, 0); _graphics->fade(true, 0);
g_lab->_anim->_noPalChange = true; g_lab->_anim->_noPalChange = true;
JBackImage._imageData = _graphics->readPictToMem("P:Journal.pic", _graphics->_screenWidth, _graphics->_screenHeight); JBackImage._imageData = _graphics->readPictToMem("P:Journal.pic", _graphics->_screenWidth, _graphics->_screenHeight);
@ -398,7 +396,7 @@ void LabEngine::doJournal() {
_event->mouseShow(); _event->mouseShow();
processJournal(); processJournal();
_event->attachGadgetList(NULL); _event->attachGadgetList(NULL);
fade(false, 0); _graphics->fade(false, 0);
_event->mouseHide(); _event->mouseHide();
ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); ScreenImage._imageData = _graphics->getCurrentDrawingBuffer();
@ -536,9 +534,9 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera
TextFileName = Test; TextFileName = Test;
ntext = g_lab->_resource->getText(TextFileName); ntext = g_lab->_resource->getText(TextFileName);
fade(false, 0); _graphics->fade(false, 0);
drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive);
fade(true, 0); _graphics->fade(true, 0);
delete[] ntext; delete[] ntext;
} }
} }
@ -624,7 +622,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive,
monitorPage = 0; monitorPage = 0;
lastpage = false; lastpage = false;
FadePalette = hipal; _graphics->FadePalette = hipal;
TextFont *monitorFont = _resource->getFont("P:Map.fon"); TextFont *monitorFont = _resource->getFont("P:Map.fon");
Common::File *buttonFile = g_lab->_resource->openDataFile("P:MonImage"); Common::File *buttonFile = g_lab->_resource->openDataFile("P:MonImage");
@ -635,9 +633,9 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive,
loadBackPict(background, false); loadBackPict(background, false);
drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive);
_event->mouseShow(); _event->mouseShow();
fade(true, 0); _graphics->fade(true, 0);
processMonitor(ntext, monitorFont, isinteractive, x1, y1, x2, y2); processMonitor(ntext, monitorFont, isinteractive, x1, y1, x2, y2);
fade(false, 0); _graphics->fade(false, 0);
_event->mouseHide(); _event->mouseHide();
delete[] ntext; delete[] ntext;
closeFont(monitorFont); closeFont(monitorFont);

View file

@ -51,15 +51,15 @@ const int COMBINATION_X[6] = { 45, 83, 129, 166, 211, 248 };
void LabEngine::initTilePuzzle() { void LabEngine::initTilePuzzle() {
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
Tiles[i] = nullptr; _tiles[i] = nullptr;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
CurTile[i][j] = INIT_TILE[i][j]; _curTile[i][j] = INIT_TILE[i][j];
} }
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
combination[i] = 0; _combination[i] = 0;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -106,33 +106,33 @@ void LabEngine::changeTile(uint16 col, uint16 row) {
int16 scrolltype = -1; int16 scrolltype = -1;
if (row > 0) { if (row > 0) {
if (CurTile[col] [row - 1] == 0) { if (_curTile[col] [row - 1] == 0) {
CurTile[col] [row - 1] = CurTile[col] [row]; _curTile[col] [row - 1] = _curTile[col] [row];
CurTile[col] [row] = 0; _curTile[col] [row] = 0;
scrolltype = DOWNSCROLL; scrolltype = DOWNSCROLL;
} }
} }
if (col > 0) { if (col > 0) {
if (CurTile[col - 1] [row] == 0) { if (_curTile[col - 1] [row] == 0) {
CurTile[col - 1] [row] = CurTile[col] [row]; _curTile[col - 1] [row] = _curTile[col] [row];
CurTile[col] [row] = 0; _curTile[col] [row] = 0;
scrolltype = RIGHTSCROLL; scrolltype = RIGHTSCROLL;
} }
} }
if (row < 3) { if (row < 3) {
if (CurTile[col] [row + 1] == 0) { if (_curTile[col] [row + 1] == 0) {
CurTile[col] [row + 1] = CurTile[col] [row]; _curTile[col] [row + 1] = _curTile[col] [row];
CurTile[col] [row] = 0; _curTile[col] [row] = 0;
scrolltype = UPSCROLL; scrolltype = UPSCROLL;
} }
} }
if (col < 3) { if (col < 3) {
if (CurTile[col + 1] [row] == 0) { if (_curTile[col + 1] [row] == 0) {
CurTile[col + 1] [row] = CurTile[col] [row]; _curTile[col + 1] [row] = _curTile[col] [row];
CurTile[col] [row] = 0; _curTile[col] [row] = 0;
scrolltype = LEFTSCROLL; scrolltype = LEFTSCROLL;
} }
} }
@ -152,7 +152,7 @@ void LabEngine::changeTile(uint16 col, uint16 row) {
while (row < 4) { while (row < 4) {
while (col < 4) { while (col < 4) {
check = check && (CurTile[row] [col] == SOLUTION[row] [col]); check = check && (_curTile[row] [col] == SOLUTION[row] [col]);
col++; col++;
} }
@ -226,10 +226,10 @@ void LabEngine::doTile(bool showsolution) {
if (showsolution) if (showsolution)
num = SOLUTION[col] [row]; num = SOLUTION[col] [row];
else else
num = CurTile[col] [row]; num = _curTile[col] [row];
if (showsolution || num) if (showsolution || num)
Tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm)); _tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm));
col++; col++;
} }
@ -254,7 +254,7 @@ void LabEngine::showTile(const char *filename, bool showsolution) {
Common::File *tileFile = tileFile = _resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile"); Common::File *tileFile = tileFile = _resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile");
for (uint16 curBit = start; curBit < 16; curBit++) for (uint16 curBit = start; curBit < 16; curBit++)
Tiles[curBit] = new Image(tileFile); _tiles[curBit] = new Image(tileFile);
delete tileFile; delete tileFile;
@ -312,18 +312,18 @@ void LabEngine::changeCombination(uint16 number) {
uint16 combnum; uint16 combnum;
bool unlocked = true; bool unlocked = true;
if (combination[number] < 9) if (_combination[number] < 9)
(combination[number])++; (_combination[number])++;
else else
combination[number] = 0; _combination[number] = 0;
combnum = combination[number]; combnum = _combination[number];
display._imageData = _graphics->getCurrentDrawingBuffer(); display._imageData = _graphics->getCurrentDrawingBuffer();
display._width = _graphics->_screenWidth; display._width = _graphics->_screenWidth;
display._height = _graphics->_screenHeight; display._height = _graphics->_screenHeight;
for (uint16 i = 1; i <= (Images[combnum]->_height / 2); i++) { for (uint16 i = 1; i <= (_numberImages[combnum]->_height / 2); i++) {
if (_isHiRes) { if (_isHiRes) {
if (i & 1) if (i & 1)
waitTOF(); waitTOF();
@ -331,12 +331,12 @@ void LabEngine::changeCombination(uint16 number) {
waitTOF(); waitTOF();
display._imageData = _graphics->getCurrentDrawingBuffer(); display._imageData = _graphics->getCurrentDrawingBuffer();
_graphics->scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (Images[combnum])->_width - 1, _graphics->VGAScaleY(65) + (Images[combnum])->_height); _graphics->scrollDisplayY(2, _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), _graphics->VGAScaleX(COMBINATION_X[number]) + (_numberImages[combnum])->_width - 1, _graphics->VGAScaleY(65) + (_numberImages[combnum])->_height);
Images[combnum]->blitBitmap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2, false); _numberImages[combnum]->blitBitmap(0, (_numberImages[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (_numberImages[combnum])->_width, 2, false);
} }
for (uint16 i = 0; i < 6; i++) for (uint16 i = 0; i < 6; i++)
unlocked = (combination[i] == solution[i]) && unlocked; unlocked = (_combination[i] == solution[i]) && unlocked;
if (unlocked) if (unlocked)
_conditions->inclElement(COMBINATIONUNLOCKED); _conditions->inclElement(COMBINATIONUNLOCKED);
@ -357,7 +357,7 @@ void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2
/*****************************************************************************/ /*****************************************************************************/
void LabEngine::doCombination() { void LabEngine::doCombination() {
for (uint16 i = 0; i <= 5; i++) for (uint16 i = 0; i <= 5; i++)
Images[combination[i]]->drawImage(_graphics->VGAScaleX(COMBINATION_X[i]), _graphics->VGAScaleY(65)); _numberImages[_combination[i]]->drawImage(_graphics->VGAScaleX(COMBINATION_X[i]), _graphics->VGAScaleY(65));
} }
/*****************************************************************************/ /*****************************************************************************/
@ -374,7 +374,7 @@ void LabEngine::showCombination(const char *filename) {
Common::File *numFile = _resource->openDataFile("P:Numbers"); Common::File *numFile = _resource->openDataFile("P:Numbers");
for (uint16 CurBit = 0; CurBit < 10; CurBit++) for (uint16 CurBit = 0; CurBit < 10; CurBit++)
Images[CurBit] = new Image(numFile); _numberImages[CurBit] = new Image(numFile);
delete numFile; delete numFile;