diff options
| author | Strangerke | 2015-12-06 18:16:26 +0100 | 
|---|---|---|
| committer | Willem Jan Palenstijn | 2015-12-23 21:33:52 +0100 | 
| commit | 785772e86f2f1a15a0f5154e25203b5b94e5087a (patch) | |
| tree | 446dc0de5bc82c722a6851a63e1b5c5fe437efed /engines/lab | |
| parent | 438e7a24f5f362c383269cca41ced901a98f284e (diff) | |
| download | scummvm-rg350-785772e86f2f1a15a0f5154e25203b5b94e5087a.tar.gz scummvm-rg350-785772e86f2f1a15a0f5154e25203b5b94e5087a.tar.bz2 scummvm-rg350-785772e86f2f1a15a0f5154e25203b5b94e5087a.zip  | |
LAB: Move fade functions to DisplayMan, some renaming
Diffstat (limited to 'engines/lab')
| -rw-r--r-- | engines/lab/engine.cpp | 4 | ||||
| -rw-r--r-- | engines/lab/graphics.cpp | 33 | ||||
| -rw-r--r-- | engines/lab/graphics.h | 5 | ||||
| -rw-r--r-- | engines/lab/intro.cpp | 24 | ||||
| -rw-r--r-- | engines/lab/lab.cpp | 7 | ||||
| -rw-r--r-- | engines/lab/lab.h | 8 | ||||
| -rw-r--r-- | engines/lab/labfun.h | 6 | ||||
| -rw-r--r-- | engines/lab/map.cpp | 86 | ||||
| -rw-r--r-- | engines/lab/savegame.cpp | 8 | ||||
| -rw-r--r-- | engines/lab/special.cpp | 18 | ||||
| -rw-r--r-- | engines/lab/tilepuzzle.cpp | 58 | 
11 files changed, 124 insertions, 133 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 158286fdfb..8af38d86b6 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -122,8 +122,8 @@ void LabEngine::freeScreens() {  	for (uint16 imgIdx = 0; imgIdx < 10; imgIdx++) {  		delete _invImages[imgIdx]; -		delete Images[imgIdx]; -		_invImages[imgIdx] = Images[imgIdx] = nullptr; +		delete _numberImages[imgIdx]; +		_invImages[imgIdx] = _numberImages[imgIdx] = nullptr;  	}  } diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp index babc5502dd..52f92e5b9e 100644 --- a/engines/lab/graphics.cpp +++ b/engines/lab/graphics.cpp @@ -53,6 +53,7 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) {  	_displayBuffer = nullptr;  	_currentDisplayBuffer = nullptr;  	_tempScrollData = nullptr; +	FadePalette = nullptr;  	_screenWidth = 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);  } +/*****************************************************************************/ +/* 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 diff --git a/engines/lab/graphics.h b/engines/lab/graphics.h index 979d73ff17..564f041607 100644 --- a/engines/lab/graphics.h +++ b/engines/lab/graphics.h @@ -41,6 +41,9 @@ class DisplayMan {  private:  	LabEngine *_vm; +	uint16 fadeNumIn(uint16 num, uint16 res, uint16 counter); +	uint16 fadeNumOut(uint16 num, uint16 res, uint16 counter); +  	byte _curapen;  	byte *_curBitmap;  	byte _curvgapal[256 * 3]; @@ -125,6 +128,7 @@ public:  	byte *getCurrentDrawingBuffer();  	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 fade(bool fadein, uint16 res);  	bool _longWinInFront;  	bool _lastMessageLong; @@ -134,6 +138,7 @@ public:  	byte *_displayBuffer;  	byte *_currentDisplayBuffer;  	bool _doNotDrawMessage; +	uint16 *FadePalette;  };  } // End of namespace Lab diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 0313733084..070b03fd3c 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -33,8 +33,6 @@  #include "lab/anim.h"  namespace Lab { -extern uint16 *FadePalette; -  Intro::Intro(LabEngine *vm) : _vm(vm) {  	_quitIntro = false;  } @@ -101,14 +99,14 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {  			if (begin)  				begin = false;  			else if (isScreen) -				fade(false, 0); +				_vm->_graphics->fade(false, 0);  			if (isScreen) {  				_vm->_graphics->setAPen(7);  				_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); -				fade(true, 0); +				_vm->_graphics->fade(true, 0);  			} else {  				Drawn = _vm->_graphics->longDrawMessage((char *)curText);  			} @@ -122,7 +120,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {  			if (_quitIntro) {  				if (isScreen) -					fade(false, 0); +					_vm->_graphics->fade(false, 0);  				delete[] textBuffer;  				return; @@ -142,7 +140,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {  			if (secs > timeDelay) {  				if (end) {  					if (isScreen) -						fade(false, 0); +						_vm->_graphics->fade(false, 0);  					delete[] textBuffer;  					return; @@ -162,7 +160,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {  				_quitIntro = true;  				if (isScreen) -					fade(false, 0); +					_vm->_graphics->fade(false, 0);  				delete[] textBuffer;  				return; @@ -172,7 +170,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {  				if (IEQUALIFIER_LEFTBUTTON & qualifier) {  					if (end) {  						if (isScreen) -							fade(false, 0); +							_vm->_graphics->fade(false, 0);  						delete[] textBuffer;  						return; @@ -184,7 +182,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {  				if (_quitIntro) {  					if (isScreen) -						fade(false, 0); +						_vm->_graphics->fade(false, 0);  					delete[] textBuffer;  					return; @@ -193,7 +191,7 @@ void Intro::doPictText(const char *filename, TextFont *msgFont, bool isScreen) {  			if (end) {  				if (isScreen) -					fade(false, 0); +					_vm->_graphics->fade(false, 0);  				delete[] textBuffer;  				return; @@ -273,7 +271,7 @@ void Intro::introSequence() {  		nReadPict("TNDcycle2.pic", true);  	_vm->_anim->_noPalChange = false; -	FadePalette = palette; +	_vm->_graphics->FadePalette = palette;  	for (uint16 i = 0; i < 16; i++) {  		if (_quitIntro) @@ -285,7 +283,7 @@ void Intro::introSequence() {  	}  	_vm->_music->updateMusic(); -	fade(true, 0); +	_vm->_graphics->fade(true, 0);  	for (int times = 0; times < 150; times++) {  		if (_quitIntro) @@ -303,7 +301,7 @@ void Intro::introSequence() {  		_vm->waitTOF();  	} -	fade(false, 0); +	_vm->_graphics->fade(false, 0);  	_vm->_graphics->blackAllScreen();  	_vm->_music->updateMusic(); diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp index f9de51b41f..5f2a4d5f10 100644 --- a/engines/lab/lab.cpp +++ b/engines/lab/lab.cpp @@ -95,9 +95,12 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)  	for (int i = 0; i < 10; i++) {  		_invImages[i] = nullptr; -		Images[i] = nullptr; +		_numberImages[i] = nullptr;  	} +	for (int i = 0; i < 16; i++) +		_tiles[i] = nullptr; +  	_moveGadgetList = nullptr;  	_invGadgetList = nullptr;  	_curFileName = nullptr; @@ -128,7 +131,7 @@ LabEngine::~LabEngine() {  	delete _graphics;  	for (int i = 0; i < 16; i++) -		delete Tiles[i]; +		delete _tiles[i];  }  Common::Error LabEngine::run() { diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 5675a0ccaf..384b5599ed 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -126,16 +126,16 @@ public:  	Gadget *_invGadgetList;  	Image *_moveImages[20];  	Image *_invImages[10]; -	Image *Images[10]; -	uint16 CurTile[4][4]; -	byte combination[6]; +	Image *_numberImages[10]; +	uint16 _curTile[4][4]; +	byte _combination[6];  private:  	int _lastWaitTOFTicks;  	bool _lastTooLong;  	CloseDataPtr _cptr;  	InventoryData *_inventory; -	Image *Tiles[16]; +	Image *_tiles[16];  private:  	bool from_crumbs(uint32 tmpClass, uint16 code, uint16 Qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage * curMsg, bool &forceDraw, uint16 gadgetId, uint16 &actionMode); diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h index d58b27ecc8..c56dbcdd5b 100644 --- a/engines/lab/labfun.h +++ b/engines/lab/labfun.h @@ -70,12 +70,6 @@ struct SaveGameHeader {  bool readMusic(const char *filename, bool waitTillFinished); -/*---------------------------*/ -/*-------- From Map.c -------*/ -/*---------------------------*/ - -void fade(bool fadein, uint16 res); -  /*--------------------------*/  /*----- From saveGame.c ----*/  /*--------------------------*/ diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 8281a498d2..218aae4213 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -56,8 +56,6 @@ static MapData *Maps;  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 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 uint16 AmigaMapPalette[] = { -	0x0BA8, 0x0C11, 0x0A74, 0x0076, -	0x0A96, 0x0DCB, 0x0CCA, 0x0222, -	0x0444, 0x0555, 0x0777, 0x0999, -	0x0AAA, 0x0ED0, 0x0EEE, 0x0694 -}; - -  #define LOWERFLOOR     1  #define MIDDLEFLOOR    2  #define UPPERFLOOR     3 @@ -167,48 +157,11 @@ static bool loadMapData() {  	return true;  } -  static void freeMapData() {  	delete[] Maps;  	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.                          */  /*****************************************************************************/ @@ -460,7 +413,7 @@ void LabEngine::drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeou  	_event->mouseHide();  	if (fadeout) -		fade(false, 0); +		_graphics->fade(false, 0);  	_graphics->setAPen(0);  	_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);  	if (fadein) -		fade(true, 0); +		_graphics->fade(true, 0);  	_event->mouseShow();  } @@ -594,9 +547,9 @@ void LabEngine::processMap(uint16 CurRoom) {  					getUpFloor(&CurFloor, &drawmap);  					if (drawmap) { -						fade(false, 0); +						_graphics->fade(false, 0);  						drawMap(CurRoom, CurMsg, CurFloor, false, false); -						fade(true, 0); +						_graphics->fade(true, 0);  					} else  						CurFloor = OldFloor;  				} else if (GadgetID == 2) { /* Down arrow */ @@ -604,9 +557,9 @@ void LabEngine::processMap(uint16 CurRoom) {  					getDownFloor(&CurFloor, &drawmap);  					if (drawmap) { -						fade(false, 0); +						_graphics->fade(false, 0);  						drawMap(CurRoom, CurMsg, CurFloor, false, false); -						fade(true, 0); +						_graphics->fade(true, 0);  					} else  						CurFloor = OldFloor;  				} @@ -618,9 +571,9 @@ void LabEngine::processMap(uint16 CurRoom) {  				        && onFloor(SURMAZEFLOOR)) {  					CurFloor = SURMAZEFLOOR; -					fade(false, 0); +					_graphics->fade(false, 0);  					drawMap(CurRoom, CurMsg, CurFloor, false, false); -					fade(true, 0); +					_graphics->fade(true, 0);  				}  				else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(358)) && (MouseY >= mapScaleY(71)) @@ -628,9 +581,9 @@ void LabEngine::processMap(uint16 CurRoom) {  				         && onFloor(CARNIVAL)) {  					CurFloor = CARNIVAL; -					fade(false, 0); +					_graphics->fade(false, 0);  					drawMap(CurRoom, CurMsg, CurFloor, false, false); -					fade(true, 0); +					_graphics->fade(true, 0);  				}  				else if ((CurFloor == MIDDLEFLOOR) && (MouseX >= mapScaleX(557)) && (MouseY >= mapScaleY(325)) @@ -638,9 +591,9 @@ void LabEngine::processMap(uint16 CurRoom) {  				         && onFloor(MEDMAZEFLOOR)) {  					CurFloor = MEDMAZEFLOOR; -					fade(false, 0); +					_graphics->fade(false, 0);  					drawMap(CurRoom, CurMsg, CurFloor, false, false); -					fade(true, 0); +					_graphics->fade(true, 0);  				}  				else if ((CurFloor == UPPERFLOOR) && (MouseX >= mapScaleX(524)) && (MouseY >=  mapScaleY(97)) @@ -648,9 +601,9 @@ void LabEngine::processMap(uint16 CurRoom) {  				         && onFloor(HEDGEMAZEFLOOR)) {  					CurFloor = HEDGEMAZEFLOOR; -					fade(false, 0); +					_graphics->fade(false, 0);  					drawMap(CurRoom, CurMsg, CurFloor, false, false); -					fade(true, 0); +					_graphics->fade(true, 0);  				}  				else if (MouseX > mapScaleX(314)) { @@ -705,7 +658,14 @@ void LabEngine::processMap(uint16 CurRoom) {  /* Does the map processing.                                                  */  /*****************************************************************************/  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();  	loadMapData(); @@ -726,7 +686,7 @@ void LabEngine::doMap(uint16 CurRoom) {  	_graphics->screenUpdate();  	processMap(CurRoom);  	_event->attachGadgetList(NULL); -	fade(false, 0); +	_graphics->fade(false, 0);  	_graphics->blackAllScreen();  	_event->mouseHide();  	_graphics->setAPen(0); diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp index cfb636fa58..133e4b1d70 100644 --- a/engines/lab/savegame.cpp +++ b/engines/lab/savegame.cpp @@ -146,12 +146,12 @@ bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc)  	// Combination lock and tile stuff  	for (i = 0; i < 6; i++) -		file->writeByte(g_lab->combination[i]); +		file->writeByte(g_lab->_combination[i]);  	// Tiles  	for (i = 0; i < 4; i++)  		for (j = 0; j < 4; j++) -			file->writeUint16LE(g_lab->CurTile[i][j]); +			file->writeUint16LE(g_lab->_curTile[i][j]);  	// Breadcrumbs  	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  	for (i = 0; i < 6; i++) -		g_lab->combination[i] = file->readByte(); +		g_lab->_combination[i] = file->readByte();  	// Tiles  	for (i = 0; i < 4; i++)  		for (j = 0; j < 4; j++) -			g_lab->CurTile[i][j] = file->readUint16LE(); +			g_lab->_curTile[i][j] = file->readUint16LE();  	// Breadcrumbs  	for (i = 0; i < 128; i++) { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 01b114fede..c4751ce9b6 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -60,8 +60,6 @@ static uint16 monitorPage;  static const char *TextFileName;  Image *MonButton; - -extern uint16 *FadePalette;  extern BitMap *DispBitMap, *DrawBitMap;  #define INCL(BITSET,BIT) ((BITSET) |= (BIT)) @@ -78,7 +76,7 @@ extern BitMap *DispBitMap, *DrawBitMap;  static byte *loadBackPict(const char *fileName, bool tomem) {  	byte *res = nullptr; -	FadePalette = hipal; +	g_lab->_graphics->FadePalette = hipal;  	g_lab->_anim->_noPalChange = true;  	if (tomem) @@ -316,7 +314,7 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) {  	if (needFade) -		fade(true, 0); +		_graphics->fade(true, 0);  	g_lab->_anim->_noPalChange = true;  	JBackImage._imageData = _graphics->readPictToMem("P:Journal.pic", _graphics->_screenWidth, _graphics->_screenHeight); @@ -398,7 +396,7 @@ void LabEngine::doJournal() {  	_event->mouseShow();  	processJournal();  	_event->attachGadgetList(NULL); -	fade(false, 0); +	_graphics->fade(false, 0);  	_event->mouseHide();  	ScreenImage._imageData = _graphics->getCurrentDrawingBuffer(); @@ -536,9 +534,9 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isintera  				TextFileName = Test;  				ntext = g_lab->_resource->getText(TextFileName); -				fade(false, 0); +				_graphics->fade(false, 0);  				drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive); -				fade(true, 0); +				_graphics->fade(true, 0);  				delete[] ntext;  			}  		} @@ -624,7 +622,7 @@ void LabEngine::doMonitor(char *background, char *textfile, bool isinteractive,  	monitorPage = 0;  	lastpage = false; -	FadePalette = hipal; +	_graphics->FadePalette = hipal;  	TextFont *monitorFont = _resource->getFont("P:Map.fon");  	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);  	drawMonText(ntext, monitorFont, x1, y1, x2, y2, isinteractive);  	_event->mouseShow(); -	fade(true, 0); +	_graphics->fade(true, 0);  	processMonitor(ntext, monitorFont, isinteractive, x1, y1, x2, y2); -	fade(false, 0); +	_graphics->fade(false, 0);  	_event->mouseHide();  	delete[] ntext;  	closeFont(monitorFont); diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index 1cee9d3fde..5ab0454086 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -51,15 +51,15 @@ const int COMBINATION_X[6] = { 45, 83, 129, 166, 211, 248 };  void LabEngine::initTilePuzzle() {  	for (int i = 0; i < 16; i++) -		Tiles[i] = nullptr; +		_tiles[i] = nullptr;  	for (int i = 0; i < 4; i++) {  		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++) -		combination[i] = 0; +		_combination[i] = 0;  }  /*****************************************************************************/ @@ -106,33 +106,33 @@ void LabEngine::changeTile(uint16 col, uint16 row) {  	int16 scrolltype = -1;  	if (row > 0) { -		if (CurTile[col] [row - 1] == 0) { -			CurTile[col] [row - 1] = CurTile[col] [row]; -			CurTile[col] [row] = 0; +		if (_curTile[col] [row - 1] == 0) { +			_curTile[col] [row - 1] = _curTile[col] [row]; +			_curTile[col] [row] = 0;  			scrolltype = DOWNSCROLL;  		}  	}  	if (col > 0) { -		if (CurTile[col - 1] [row] == 0) { -			CurTile[col - 1] [row] = CurTile[col] [row]; -			CurTile[col] [row] = 0; +		if (_curTile[col - 1] [row] == 0) { +			_curTile[col - 1] [row] = _curTile[col] [row]; +			_curTile[col] [row] = 0;  			scrolltype = RIGHTSCROLL;  		}  	}  	if (row < 3) { -		if (CurTile[col] [row + 1] == 0) { -			CurTile[col] [row + 1] = CurTile[col] [row]; -			CurTile[col] [row] = 0; +		if (_curTile[col] [row + 1] == 0) { +			_curTile[col] [row + 1] = _curTile[col] [row]; +			_curTile[col] [row] = 0;  			scrolltype = UPSCROLL;  		}  	}  	if (col < 3) { -		if (CurTile[col + 1] [row] == 0) { -			CurTile[col + 1] [row] = CurTile[col] [row]; -			CurTile[col] [row] = 0; +		if (_curTile[col + 1] [row] == 0) { +			_curTile[col + 1] [row] = _curTile[col] [row]; +			_curTile[col] [row] = 0;  			scrolltype = LEFTSCROLL;  		}  	} @@ -152,7 +152,7 @@ void LabEngine::changeTile(uint16 col, uint16 row) {  		while (row < 4) {  			while (col < 4) { -				check = check && (CurTile[row] [col] == SOLUTION[row] [col]); +				check = check && (_curTile[row] [col] == SOLUTION[row] [col]);  				col++;  			} @@ -226,10 +226,10 @@ void LabEngine::doTile(bool showsolution) {  			if (showsolution)  				num = SOLUTION[col] [row];  			else -				num = CurTile[col] [row]; +				num = _curTile[col] [row];  			if (showsolution || num) -				Tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm)); +				_tiles[num]->drawImage(cols + (col * colm), rows + (row * rowm));  			col++;  		} @@ -254,7 +254,7 @@ void LabEngine::showTile(const char *filename, bool showsolution) {  	Common::File *tileFile = tileFile = _resource->openDataFile(showsolution ? "P:TileSolution" : "P:Tile");  	for (uint16 curBit = start; curBit < 16; curBit++) -		Tiles[curBit] = new Image(tileFile); +		_tiles[curBit] = new Image(tileFile);  	delete tileFile; @@ -312,18 +312,18 @@ void LabEngine::changeCombination(uint16 number) {  	uint16 combnum;  	bool unlocked = true; -	if (combination[number] < 9) -		(combination[number])++; +	if (_combination[number] < 9) +		(_combination[number])++;  	else -		combination[number] = 0; +		_combination[number] = 0; -	combnum = combination[number]; +	combnum = _combination[number];  	display._imageData = _graphics->getCurrentDrawingBuffer();  	display._width     = _graphics->_screenWidth;  	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 (i & 1)  				waitTOF(); @@ -331,12 +331,12 @@ void LabEngine::changeCombination(uint16 number) {  			waitTOF();  		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); -		Images[combnum]->blitBitmap(0, (Images[combnum])->_height - (2 * i), &(display), _graphics->VGAScaleX(COMBINATION_X[number]), _graphics->VGAScaleY(65), (Images[combnum])->_width, 2, false); +		_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); +		_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++) -		unlocked = (combination[i] == solution[i]) && unlocked; +		unlocked = (_combination[i] == solution[i]) && unlocked;  	if (unlocked)  		_conditions->inclElement(COMBINATIONUNLOCKED); @@ -357,7 +357,7 @@ void LabEngine::scrollRaster(int16 dx, int16 dy, uint16 x1, uint16 y1, uint16 x2  /*****************************************************************************/  void LabEngine::doCombination() {  	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");  	for (uint16 CurBit = 0; CurBit < 10; CurBit++) -		Images[CurBit] = new Image(numFile); +		_numberImages[CurBit] = new Image(numFile);  	delete numFile;  | 
