[Scummvm-cvs-logs] scummvm master -> ad1aac46ceda6e9c01d3f71994fcdd9b4080d96d

bluegr bluegr at gmail.com
Thu Jan 14 22:43:24 CET 2016


This automated email contains information about 18 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
49a45a21ce LAB: The parameter of doMap() isn't needed
7aafcaca1a LAB: Move music reset code into a separate function
cb0f7e8a92 LAB: Cleanup and reorder the music code
463f889447 LAB: Rename the members of the CrumbData struct
cd2520b795 LAB: Get rid of setDirection()
241c9829f6 LAB: Rename doCloseup() to reflect its actual purpose
1d4a62a028 LAB: Properly update the screen in monitors
4f0985c2de LAB: Hide the mouse cursor while fading when closing the map
0f45658259 LAB: Fix accidental change to code style
816381bbfe LAB: Move frame waiting outside setAmigaPal()
ce5f8f32cb LAB: Clean up the event loops of special game screens
374a76c89f LAB: Use the sample speed value instead of a define for game music
b61ade788e LAB: Call checkRoomMusic() when changing a room
280bd0f7c2 LAB: Read the header of DIFF files when opening them
e8d1100fec LAB: Allow the game to be launched from the GAME folder
46fdd5e7a4 LAB: Clean up the trial warning handling code
924d43b7aa LAB: Better separation of the event and interface code
ad1aac46ce LAB: Remove superfluous calls to updateEvents()


Commit: 49a45a21cee8957853cd35e7ffd02fd29bb294a3
    https://github.com/scummvm/scummvm/commit/49a45a21cee8957853cd35e7ffd02fd29bb294a3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:27+02:00

Commit Message:
LAB: The parameter of doMap() isn't needed

Changed paths:
    engines/lab/engine.cpp
    engines/lab/lab.h
    engines/lab/map.cpp



diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 5dffa64..ec80f9c 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -279,7 +279,7 @@ bool LabEngine::doUse(uint16 curInv) {
 		_anim->stopDiff();
 		_curFileName = " ";
 		_closeDataPtr = nullptr;
-		doMap(_roomNum);
+		doMap();
 		_graphics->setPalette(initColors, 8);
 		_graphics->drawMessage("", false);
 		_graphics->drawPanel();
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 0e9cdd3..4aa4e66 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -282,7 +282,7 @@ private:
 	/**
 	 * Does the map processing.
 	 */
-	void doMap(uint16 curRoom);
+	void doMap();
 
 	/**
 	 * Does what's necessary for the monitor.
diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp
index 2b283ae..55e5f78 100644
--- a/engines/lab/map.cpp
+++ b/engines/lab/map.cpp
@@ -523,7 +523,7 @@ void LabEngine::processMap(uint16 curRoom) {
 	}
 }
 
-void LabEngine::doMap(uint16 curRoom) {
+void LabEngine::doMap() {
 	static uint16 amigaMapPalette[] = {
 		0x0BA8, 0x0C11, 0x0A74, 0x0076,
 		0x0A96, 0x0DCB, 0x0CCA, 0x0222,
@@ -537,10 +537,10 @@ void LabEngine::doMap(uint16 curRoom) {
 	loadMapData();
 	_graphics->blackAllScreen();
 	_event->attachButtonList(&_mapButtonList);
-	drawMap(curRoom, curRoom, _maps[curRoom]._pageNumber, true);
+	drawMap(_roomNum, _roomNum, _maps[_roomNum]._pageNumber, true);
 	_event->mouseShow();
 	_graphics->screenUpdate();
-	processMap(curRoom);
+	processMap(_roomNum);
 	_event->attachButtonList(nullptr);
 	_graphics->fade(false);
 	_graphics->blackAllScreen();


Commit: 7aafcaca1a5df7e63795e0e6e72f06452490992e
    https://github.com/scummvm/scummvm/commit/7aafcaca1a5df7e63795e0e6e72f06452490992e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:28+02:00

Commit Message:
LAB: Move music reset code into a separate function

Changed paths:
    engines/lab/engine.cpp
    engines/lab/intro.cpp
    engines/lab/music.cpp
    engines/lab/music.h
    engines/lab/processroom.cpp



diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index ec80f9c..91b02af 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -396,10 +396,7 @@ void LabEngine::mainGameLoop() {
 		loadGame(ConfMan.getInt("save_slot"));
 
 		// Since the intro hasn't been shown, init the background music here
-		if (getPlatform() != Common::kPlatformAmiga)
-			_music->changeMusic("Music:BackGrou", false, false);
-		else
-			_music->changeMusic("Music:BackGround", false, false);
+		_music->resetMusic(false);
 		_music->checkRoomMusic();
 	}
 
diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp
index b2a1b20..4988e76 100644
--- a/engines/lab/intro.cpp
+++ b/engines/lab/intro.cpp
@@ -238,11 +238,7 @@ void Intro::play() {
 	}
 
 	_vm->_graphics->blackAllScreen();
-	
-	if (_vm->getPlatform() != Common::kPlatformAmiga)
-		_vm->_music->changeMusic("Music:BackGrou", false, false);
-	else
-		_vm->_music->changeMusic("Music:BackGround", false, false);
+	_vm->_music->resetMusic(false);
 
 	if (_vm->getPlatform() == Common::kPlatformDOS)
 		nReadPict("TNDcycle.pic", true, true);
diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp
index 8045c51..9f9d8ea 100644
--- a/engines/lab/music.cpp
+++ b/engines/lab/music.cpp
@@ -104,16 +104,12 @@ void Music::checkRoomMusic() {
 	if ((_curRoomMusic == _vm->_roomNum) || !_musicFile)
 		return;
 
-	if (_vm->_roomNum == CLOWNROOM) {
+	if (_vm->_roomNum == CLOWNROOM)
 		changeMusic("Music:Laugh", true, false);
-	} else if (_vm->_roomNum == DIMROOM) {
+	else if (_vm->_roomNum == DIMROOM)
 		changeMusic("Music:Rm81", true, false);
-	} else if (_curRoomMusic == CLOWNROOM || _curRoomMusic == DIMROOM) {
-		if (_vm->getPlatform() != Common::kPlatformAmiga)
-			changeMusic("Music:Backgrou", false, true);
-		else
-			changeMusic("Music:Background", false, true);
-	}
+	else if (_curRoomMusic == CLOWNROOM || _curRoomMusic == DIMROOM)
+		resetMusic(true);
 
 	_curRoomMusic = _vm->_roomNum;
 }
@@ -175,4 +171,11 @@ void Music::readSound(bool waitTillFinished, bool loop, Common::File *file) {
 	}
 }
 
+void Music::resetMusic(bool seektoStoredPos) {
+	if (_vm->getPlatform() != Common::kPlatformAmiga)
+		changeMusic("Music:BackGrou", false, seektoStoredPos);
+	else
+		changeMusic("Music:BackGround", false, seektoStoredPos);
+}
+
 } // End of namespace Lab
diff --git a/engines/lab/music.h b/engines/lab/music.h
index 09bb969..45eb217 100644
--- a/engines/lab/music.h
+++ b/engines/lab/music.h
@@ -68,6 +68,8 @@ public:
 	 */
 	void changeMusic(const Common::String filename, bool storeCurPos, bool seektoStoredPos);
 
+	void resetMusic(bool seekToStoredPos);
+
 	/**
 	 * Checks the music that should be playing in a particular room.
 	 */
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index 491cdf3..bc09bf5 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -389,10 +389,7 @@ void LabEngine::doActions(const ActionList &actionList) {
 			break;
 
 		case kActionResetMusic:	// used in scene 45 (sheriff's office, after museum)
-			if (getPlatform() != Common::kPlatformAmiga)
-				_music->changeMusic("Music:BackGrou", false, true);
-			else
-				_music->changeMusic("Music:BackGround", false, true);
+			_music->resetMusic(true);
 			break;
 
 		case kActionFillMusic:


Commit: cb0f7e8a92f35b161f9f54f5d3e9705e9c9a1831
    https://github.com/scummvm/scummvm/commit/cb0f7e8a92f35b161f9f54f5d3e9705e9c9a1831
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:29+02:00

Commit Message:
LAB: Cleanup and reorder the music code

Changed paths:
    engines/lab/music.cpp
    engines/lab/music.h



diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp
index 9f9d8ea..396aacf 100644
--- a/engines/lab/music.cpp
+++ b/engines/lab/music.cpp
@@ -59,75 +59,15 @@ byte Music::getSoundFlags() {
 	return soundFlags;
 }
 
-void Music::changeMusic(const Common::String filename, bool storeCurPos, bool seektoStoredPos) {
-	if (storeCurPos)
-		_storedPos = _musicFile->pos();
-
-	stopSoundEffect();
-	freeMusic();
-	_musicFile = _vm->_resource->openDataFile(filename);
-	if (seektoStoredPos)
-		_musicFile->seek(_storedPos);
-
-	Audio::SeekableAudioStream *audioStream = Audio::makeRawStream(_musicFile, SAMPLESPEED, getSoundFlags());
-	_vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, new Audio::LoopingAudioStream(audioStream, 0));
-}
-
-void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile) {
+void Music::loadSoundEffect(const Common::String filename, bool loop, bool waitTillFinished) {
 	stopSoundEffect();
 
-	// NOTE: We need to use malloc(), cause this will be freed with free()
-	// by the music code
-	byte *soundData = (byte *)malloc(length);
-	dataFile->read(soundData, length);
-
-	Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)soundData, length, MAX<uint16>(sampleSpeed, 4000), getSoundFlags());
-	_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, new Audio::LoopingAudioStream(audioStream, (loop) ? 0 : 1));
-}
-
-void Music::stopSoundEffect() {
-	if (isSoundEffectActive())
-		_vm->_mixer->stopHandle(_sfxHandle);
-}
-
-bool Music::isSoundEffectActive() const {
-	return _vm->_mixer->isSoundHandleActive(_sfxHandle);
-}
-
-void Music::freeMusic() {
-	_vm->_mixer->stopHandle(_musicHandle);
-	_vm->_mixer->stopHandle(_sfxHandle);
-	_musicFile = nullptr;
-}
-
-void Music::checkRoomMusic() {
-	if ((_curRoomMusic == _vm->_roomNum) || !_musicFile)
-		return;
-
-	if (_vm->_roomNum == CLOWNROOM)
-		changeMusic("Music:Laugh", true, false);
-	else if (_vm->_roomNum == DIMROOM)
-		changeMusic("Music:Rm81", true, false);
-	else if (_curRoomMusic == CLOWNROOM || _curRoomMusic == DIMROOM)
-		resetMusic(true);
-
-	_curRoomMusic = _vm->_roomNum;
-}
-
-bool Music::loadSoundEffect(const Common::String filename, bool loop, bool waitTillFinished) {
 	Common::File *file = _vm->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F'));
-	stopSoundEffect();
-
 	if (!file)
-		return false;
+		return;
 
 	_vm->_anim->_doBlack = false;
-	readSound(waitTillFinished, loop, file);
-
-	return true;
-}
 
-void Music::readSound(bool waitTillFinished, bool loop, Common::File *file) {
 	uint32 magicBytes = file->readUint32LE();
 	if (magicBytes != 1219009121) {
 		warning("readSound: Bad signature, skipping");
@@ -136,11 +76,11 @@ void Music::readSound(bool waitTillFinished, bool loop, Common::File *file) {
 	uint32 soundTag = file->readUint32LE();
 	uint32 soundSize = file->readUint32LE();
 
-	if (soundTag == 0)
-		file->skip(soundSize);	// skip the header
-	else
+	if (soundTag != 0)
 		return;
 
+	file->skip(soundSize);	// skip the header
+
 	while (soundTag != 65535) {
 		_vm->updateEvents();
 		soundTag = file->readUint32LE();
@@ -159,18 +99,55 @@ void Music::readSound(bool waitTillFinished, bool loop, Common::File *file) {
 			uint16 sampleRate = file->readUint16LE();
 			file->skip(2);
 			playSoundEffect(sampleRate, soundSize, loop, file);
-		} else if (soundTag == 65535) {
+		}
+		else if (soundTag == 65535) {
 			if (waitTillFinished) {
 				while (isSoundEffectActive()) {
 					_vm->updateEvents();
 					_vm->waitTOF();
 				}
 			}
-		} else
+		}
+		else
 			file->skip(soundSize);
 	}
 }
 
+void Music::playSoundEffect(uint16 sampleSpeed, uint32 length, bool loop, Common::File *dataFile) {
+	stopSoundEffect();
+
+	// NOTE: We need to use malloc(), cause this will be freed with free()
+	// by the music code
+	byte *soundData = (byte *)malloc(length);
+	dataFile->read(soundData, length);
+
+	Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)soundData, length, MAX<uint16>(sampleSpeed, 4000), getSoundFlags());
+	_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, new Audio::LoopingAudioStream(audioStream, (loop) ? 0 : 1));
+}
+
+void Music::stopSoundEffect() {
+	if (isSoundEffectActive())
+		_vm->_mixer->stopHandle(_sfxHandle);
+}
+
+bool Music::isSoundEffectActive() const {
+	return _vm->_mixer->isSoundHandleActive(_sfxHandle);
+}
+
+void Music::changeMusic(const Common::String filename, bool storeCurPos, bool seektoStoredPos) {
+	if (storeCurPos)
+		_storedPos = _musicFile->pos();
+
+	stopSoundEffect();
+	freeMusic();
+	_musicFile = _vm->_resource->openDataFile(filename);
+	if (seektoStoredPos)
+		_musicFile->seek(_storedPos);
+
+	Audio::SeekableAudioStream *audioStream = Audio::makeRawStream(_musicFile, SAMPLESPEED, getSoundFlags());
+	_vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, new Audio::LoopingAudioStream(audioStream, 0));
+}
+
 void Music::resetMusic(bool seektoStoredPos) {
 	if (_vm->getPlatform() != Common::kPlatformAmiga)
 		changeMusic("Music:BackGrou", false, seektoStoredPos);
@@ -178,4 +155,24 @@ void Music::resetMusic(bool seektoStoredPos) {
 		changeMusic("Music:BackGround", false, seektoStoredPos);
 }
 
+void Music::checkRoomMusic() {
+	if ((_curRoomMusic == _vm->_roomNum) || !_musicFile)
+		return;
+
+	if (_vm->_roomNum == CLOWNROOM)
+		changeMusic("Music:Laugh", true, false);
+	else if (_vm->_roomNum == DIMROOM)
+		changeMusic("Music:Rm81", true, false);
+	else if (_curRoomMusic == CLOWNROOM || _curRoomMusic == DIMROOM)
+		resetMusic(true);
+
+	_curRoomMusic = _vm->_roomNum;
+}
+
+void Music::freeMusic() {
+	_vm->_mixer->stopHandle(_musicHandle);
+	_vm->_mixer->stopHandle(_sfxHandle);
+	_musicFile = nullptr;
+}
+
 } // End of namespace Lab
diff --git a/engines/lab/music.h b/engines/lab/music.h
index 45eb217..86ebeef 100644
--- a/engines/lab/music.h
+++ b/engines/lab/music.h
@@ -57,7 +57,6 @@ private:
 	Audio::SoundHandle _sfxHandle;
 
 private:
-	void readSound(bool waitTillFinished, bool loop, Common::File *file);
 	byte getSoundFlags();
 
 public:
@@ -86,7 +85,7 @@ public:
 	/**
 	 * Reads in a sound effect file.  Ignores any graphics.
 	 */
-	bool loadSoundEffect(const Common::String filename, bool loop, bool waitTillFinished);
+	void loadSoundEffect(const Common::String filename, bool loop, bool waitTillFinished);
 
 	void stopSoundEffect();
 };


Commit: 463f8894473d53e03f7556161bc14a40ada28730
    https://github.com/scummvm/scummvm/commit/463f8894473d53e03f7556161bc14a40ada28730
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:29+02:00

Commit Message:
LAB: Rename the members of the CrumbData struct

This helps to distinguish them from the LabEngine variables

Changed paths:
    engines/lab/engine.cpp
    engines/lab/lab.cpp
    engines/lab/lab.h
    engines/lab/savegame.cpp



diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 91b02af..8f71dd1 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -603,7 +603,7 @@ bool LabEngine::processEvent(MessageClass tmpClass, uint16 code, uint16 qualifie
 bool LabEngine::processKey(IntuiMessage *curMsg, uint32 msgClass, uint16 &qualifier, Common::Point &curPos, uint16 &curInv, bool &forceDraw, uint16 code) {
 	if ((getPlatform() == Common::kPlatformWindows) && (code == Common::KEYCODE_b)) {
 		// Start bread crumbs
-		_breadCrumbs[0]._roomNum = 0;
+		_breadCrumbs[0]._crumbRoomNum = 0;
 		_numCrumbs = 0;
 		_droppingCrumbs = true;
 		mayShowCrumbIndicator();
@@ -631,7 +631,7 @@ bool LabEngine::processKey(IntuiMessage *curMsg, uint32 msgClass, uint16 &qualif
 					_graphics->screenUpdate();
 				}
 			} else {
-				_breadCrumbs[0]._roomNum = 0;
+				_breadCrumbs[0]._crumbRoomNum = 0;
 				_droppingCrumbs = false;
 
 				// Need to hide indicator!!!!
@@ -788,13 +788,13 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi
 				_followingCrumbs = false;
 				_droppingCrumbs = false;
 				_numCrumbs = 0;
-				_breadCrumbs[0]._roomNum = 0;
+				_breadCrumbs[0]._crumbRoomNum = 0;
 			} else {
 				bool intersect = false;
 				for (int idx = 0; idx < _numCrumbs; idx++) {
-					if (_breadCrumbs[idx]._roomNum == _roomNum) {
+					if (_breadCrumbs[idx]._crumbRoomNum == _roomNum) {
 						_numCrumbs = idx + 1;
-						_breadCrumbs[_numCrumbs]._roomNum = 0;
+						_breadCrumbs[_numCrumbs]._crumbRoomNum = 0;
 						intersect = true;
 					}
 				}
@@ -805,8 +805,8 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi
 						memcpy(&_breadCrumbs[0], &_breadCrumbs[1], _numCrumbs * sizeof _breadCrumbs[0]);
 					}
 
-					_breadCrumbs[_numCrumbs]._roomNum = _roomNum;
-					_breadCrumbs[_numCrumbs++]._direction = _direction;
+					_breadCrumbs[_numCrumbs]._crumbRoomNum = _roomNum;
+					_breadCrumbs[_numCrumbs++]._crumbDirection = _direction;
 				}
 			}
 		}
@@ -905,7 +905,7 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI
 		break;
 
 	case kButtonBreadCrumbs:
-		_breadCrumbs[0]._roomNum = 0;
+		_breadCrumbs[0]._crumbRoomNum = 0;
 		_numCrumbs = 0;
 		_droppingCrumbs = true;
 		mayShowCrumbIndicator();
@@ -930,7 +930,7 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI
 				_graphics->drawPanel();
 				drawRoomMessage(curInv, _closeDataPtr);
 			} else {
-				_breadCrumbs[0]._roomNum = 0;
+				_breadCrumbs[0]._crumbRoomNum = 0;
 				_droppingCrumbs = false;
 
 				// Need to hide indicator!!!!
@@ -1056,12 +1056,12 @@ MainButton LabEngine::followCrumbs() {
 	}
 
 	if (!_isCrumbTurning)
-		_breadCrumbs[_numCrumbs--]._roomNum = 0;
+		_breadCrumbs[_numCrumbs--]._crumbRoomNum = 0;
 
 	// Is the current crumb this room? If not, logic error.
-	if (_roomNum != _breadCrumbs[_numCrumbs]._roomNum) {
+	if (_roomNum != _breadCrumbs[_numCrumbs]._crumbRoomNum) {
 		_numCrumbs = 0;
-		_breadCrumbs[0]._roomNum = 0;
+		_breadCrumbs[0]._crumbRoomNum = 0;
 		_droppingCrumbs = false;
 		_followingCrumbs = false;
 		return kButtonNone;
@@ -1069,11 +1069,11 @@ MainButton LabEngine::followCrumbs() {
 
 	Direction exitDir;
 	// which direction is last crumb
-	if (_breadCrumbs[_numCrumbs]._direction == kDirectionEast)
+	if (_breadCrumbs[_numCrumbs]._crumbDirection == kDirectionEast)
 		exitDir = kDirectionWest;
-	else if (_breadCrumbs[_numCrumbs]._direction == kDirectionWest)
+	else if (_breadCrumbs[_numCrumbs]._crumbDirection == kDirectionWest)
 		exitDir = kDirectionEast;
-	else if (_breadCrumbs[_numCrumbs]._direction == kDirectionNorth)
+	else if (_breadCrumbs[_numCrumbs]._crumbDirection == kDirectionNorth)
 		exitDir = kDirectionSouth;
 	else
 		exitDir = kDirectionNorth;
@@ -1082,7 +1082,7 @@ MainButton LabEngine::followCrumbs() {
 
 	if (_numCrumbs == 0) {
 		_isCrumbTurning = false;
-		_breadCrumbs[0]._roomNum = 0;
+		_breadCrumbs[0]._crumbRoomNum = 0;
 		_droppingCrumbs = false;
 		_followingCrumbs = false;
 	} else {
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index 03ef06e..0ecfc99 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -55,8 +55,8 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
 	_isHiRes = false;
 	_roomNum = -1;
 	for (int i = 0; i < MAX_CRUMBS; i++) {
-		_breadCrumbs[i]._roomNum = 0;
-		_breadCrumbs[i]._direction = kDirectionNorth;
+		_breadCrumbs[i]._crumbRoomNum = 0;
+		_breadCrumbs[i]._crumbDirection = kDirectionNorth;
 	}
 
 	_numCrumbs = 0;
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 4aa4e66..f171e33 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -81,8 +81,8 @@ enum GameFeatures {
 typedef Common::List<Button *> ButtonList;
 
 struct CrumbData {
-	uint16 _roomNum;
-	uint16 _direction;
+	uint16 _crumbRoomNum;
+	uint16 _crumbDirection;
 };
 
 #define MAX_CRUMBS          128
diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp
index d815929..c259740 100644
--- a/engines/lab/savegame.cpp
+++ b/engines/lab/savegame.cpp
@@ -149,8 +149,8 @@ bool LabEngine::saveGame(int slot, const Common::String desc) {
 
 	// Breadcrumbs
 	for (uint i = 0; i < MAX_CRUMBS; i++) {
-		file->writeUint16LE(_breadCrumbs[i]._roomNum);
-		file->writeUint16LE(_breadCrumbs[i]._direction);
+		file->writeUint16LE(_breadCrumbs[i]._crumbRoomNum);
+		file->writeUint16LE(_breadCrumbs[i]._crumbDirection);
 	}
 
 	file->flush();
@@ -186,15 +186,15 @@ bool LabEngine::loadGame(int slot) {
 
 	// Breadcrumbs
 	for (int i = 0; i < MAX_CRUMBS; i++) {
-		_breadCrumbs[i]._roomNum = file->readUint16LE();
-		_breadCrumbs[i]._direction = file->readUint16LE();
+		_breadCrumbs[i]._crumbRoomNum = file->readUint16LE();
+		_breadCrumbs[i]._crumbDirection = file->readUint16LE();
 	}
 
-	_droppingCrumbs = (_breadCrumbs[0]._roomNum != 0);
+	_droppingCrumbs = (_breadCrumbs[0]._crumbRoomNum != 0);
 	_followingCrumbs = false;
 
 	for (int i = 0; i < MAX_CRUMBS; i++) {
-		if (_breadCrumbs[i]._roomNum == 0)
+		if (_breadCrumbs[i]._crumbRoomNum == 0)
 			break;
 		_numCrumbs = i;
 	}


Commit: cd2520b79591aa957fd86b8de270e70776b341c4
    https://github.com/scummvm/scummvm/commit/cd2520b79591aa957fd86b8de270e70776b341c4
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:30+02:00

Commit Message:
LAB: Get rid of setDirection()

A leftover from code restructuring

Changed paths:
    engines/lab/lab.h
    engines/lab/savegame.cpp



diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index f171e33..90f5689 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -223,7 +223,6 @@ public:
 	 */
 	Common::String getPictName(bool useClose);
 	uint16 getQuarters();
-	void setDirection(uint16 direction) { _direction = direction; };
 	void setQuarters(uint16 quarters);
 	void updateEvents();
 	void waitTOF();
diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp
index c259740..1f11ba6 100644
--- a/engines/lab/savegame.cpp
+++ b/engines/lab/savegame.cpp
@@ -171,7 +171,7 @@ bool LabEngine::loadGame(int slot) {
 	SaveGameHeader header;
 	readSaveGameHeader(file, header);
 	_roomNum = file->readUint16LE();
-	setDirection(file->readUint16LE());
+	_direction = file->readUint16LE();
 	setQuarters(file->readUint16LE());
 
 	// Conditions


Commit: 241c9829f6d5aab5e790a71d30c5a8bca3fcf1e4
    https://github.com/scummvm/scummvm/commit/241c9829f6d5aab5e790a71d30c5a8bca3fcf1e4
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:30+02:00

Commit Message:
LAB: Rename doCloseup() to reflect its actual purpose

Changed paths:
    engines/lab/engine.cpp
    engines/lab/lab.h



diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 8f71dd1..6c05a7f 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -177,14 +177,14 @@ void LabEngine::eatMessages() {
 	} while (msg && !shouldQuit());
 }
 
-bool LabEngine::doCloseUp(const CloseData *closePtr) {
-	if (!closePtr)
-		return false;
+void LabEngine::handleMonitorCloseup() {
+	if (!_closeDataPtr)
+		return;
 
 	Common::Rect textRect(2, 2, 317, 165);
 	bool isInteractive = false;
 
-	switch (closePtr->_closeUpType) {
+	switch (_closeDataPtr->_closeUpType) {
 	case kMonitorMuseum:
 	case kMonitorLibrary:
 	case kMonitorWindow:
@@ -211,15 +211,17 @@ bool LabEngine::doCloseUp(const CloseData *closePtr) {
 		isInteractive = true;
 		break;
 	default:
-		return false;
+		return;
 	}
 
-	doMonitor(closePtr->_graphicName, closePtr->_message, isInteractive, textRect);
+	doMonitor(_closeDataPtr->_graphicName, _closeDataPtr->_message, isInteractive, textRect);
 
 	_curFileName = " ";
 	_graphics->drawPanel();
 
-	return true;
+	_closeDataPtr = nullptr;
+	mayShowCrumbIndicator();
+	_graphics->screenUpdate();
 }
 
 Common::String LabEngine::getInvName(uint16 curInv) {
@@ -414,12 +416,7 @@ void LabEngine::mainGameLoop() {
 				break;
 			}
 
-			// Sees what kind of close up we're in and does the appropriate stuff, if any.
-			if (doCloseUp(_closeDataPtr)) {
-				_closeDataPtr = nullptr;
-				mayShowCrumbIndicator();
-				_graphics->screenUpdate();
-			}
+			handleMonitorCloseup();
 
 			// Sets the current picture properly on the screen
 			if (_mainDisplay)
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index 90f5689..c3a5d8b 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -259,9 +259,9 @@ private:
 	bool doActionRuleSub(int16 action, int16 roomNum, const CloseData *closePtr, bool allowDefaults);
 
 	/**
-	 * Checks whether the close up is one of the special case closeups.
+	 * Handles monitor closeups
 	 */
-	bool doCloseUp(const CloseData *closePtr);
+	void handleMonitorCloseup();
 
 	/**
 	 * Goes through the rules if the user tries to go forward.


Commit: 1d4a62a02846fb34296e60c402ee2d282ad19496
    https://github.com/scummvm/scummvm/commit/1d4a62a02846fb34296e60c402ee2d282ad19496
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:31+02:00

Commit Message:
LAB: Properly update the screen in monitors

Changed paths:
    engines/lab/special.cpp



diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 48e32cb..d373f8a 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -364,17 +364,17 @@ void LabEngine::processMonitor(const Common::String &ntext, TextFont *monitorFon
 			}
 		}
 
-		// Make sure we check the music at least after every message
 		updateEvents();
+		_graphics->screenUpdate();
+		_system->delayMillis(10);
+
 		IntuiMessage *msg = _event->getMsg();
 		if (shouldQuit()) {
 			_quitLab = true;
 			return;
 		}
 
-		if (!msg)
-			updateEvents();
-		else {
+		if (msg) {
 			MessageClass msgClass  = msg->_msgClass;
 
 			if ((msgClass == kMessageRightClick) ||


Commit: 4f0985c2de41bb32dc46bbbc3ce920cb9c580311
    https://github.com/scummvm/scummvm/commit/4f0985c2de41bb32dc46bbbc3ce920cb9c580311
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:31+02:00

Commit Message:
LAB: Hide the mouse cursor while fading when closing the map

Changed paths:
    engines/lab/map.cpp



diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp
index 55e5f78..18c1b17 100644
--- a/engines/lab/map.cpp
+++ b/engines/lab/map.cpp
@@ -541,12 +541,13 @@ void LabEngine::doMap() {
 	_event->mouseShow();
 	_graphics->screenUpdate();
 	processMap(_roomNum);
+	_event->mouseHide();
 	_event->attachButtonList(nullptr);
 	_graphics->fade(false);
 	_graphics->blackAllScreen();
 	_graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0);
 	freeMapData();
-	_graphics->blackAllScreen();
+	_event->mouseShow();
 	_graphics->screenUpdate();
 }
 


Commit: 0f45658259db4209cbaddb697e6223d7adc59873
    https://github.com/scummvm/scummvm/commit/0f45658259db4209cbaddb697e6223d7adc59873
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:31+02:00

Commit Message:
LAB: Fix accidental change to code style

Changed paths:
    engines/lab/music.cpp



diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp
index 396aacf..0a23589 100644
--- a/engines/lab/music.cpp
+++ b/engines/lab/music.cpp
@@ -99,16 +99,14 @@ void Music::loadSoundEffect(const Common::String filename, bool loop, bool waitT
 			uint16 sampleRate = file->readUint16LE();
 			file->skip(2);
 			playSoundEffect(sampleRate, soundSize, loop, file);
-		}
-		else if (soundTag == 65535) {
+		} else if (soundTag == 65535) {
 			if (waitTillFinished) {
 				while (isSoundEffectActive()) {
 					_vm->updateEvents();
 					_vm->waitTOF();
 				}
 			}
-		}
-		else
+		} else
 			file->skip(soundSize);
 	}
 }


Commit: 816381bbfed1b8d8a3305506d5e007e7fc0969c2
    https://github.com/scummvm/scummvm/commit/816381bbfed1b8d8a3305506d5e007e7fc0969c2
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:32+02:00

Commit Message:
LAB: Move frame waiting outside setAmigaPal()

Changed paths:
    engines/lab/dispman.cpp
    engines/lab/intro.cpp



diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index 8be1772..e4bef24 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -437,7 +437,6 @@ void DisplayMan::setAmigaPal(uint16 *pal) {
 	}
 
 	writeColorRegs(vgaPal, 0, 16);
-	_vm->waitTOF();
 }
 
 void DisplayMan::writeColorRegs(byte *buf, uint16 first, uint16 numReg) {
@@ -933,18 +932,21 @@ void DisplayMan::fade(bool fadeIn) {
 	for (int i = 0; i < 16; i++) {
 		for (int palIdx = 0; palIdx < 16; palIdx++) {
 			if (fadeIn)
-				newPal[palIdx] = (0x00F & fadeNumIn(0x00F & _fadePalette[palIdx], 0, i)) +
-				(0x0F0 & fadeNumIn(0x0F0 & _fadePalette[palIdx], 0, i)) +
-				(0xF00 & fadeNumIn(0xF00 & _fadePalette[palIdx], 0, i));
+				newPal[palIdx] =
+					(0x00F & fadeNumIn(0x00F & _fadePalette[palIdx], 0, i)) +
+					(0x0F0 & fadeNumIn(0x0F0 & _fadePalette[palIdx], 0, i)) +
+					(0xF00 & fadeNumIn(0xF00 & _fadePalette[palIdx], 0, i));
 			else
-				newPal[palIdx] = (0x00F & fadeNumOut(0x00F & _fadePalette[palIdx], 0, i)) +
-				(0x0F0 & fadeNumOut(0x0F0 & _fadePalette[palIdx], 0, i)) +
-				(0xF00 & fadeNumOut(0xF00 & _fadePalette[palIdx], 0, i));
+				newPal[palIdx] =
+					(0x00F & fadeNumOut(0x00F & _fadePalette[palIdx], 0, i)) +
+					(0x0F0 & fadeNumOut(0x0F0 & _fadePalette[palIdx], 0, i)) +
+					(0xF00 & fadeNumOut(0xF00 & _fadePalette[palIdx], 0, i));
 		}
 
 		setAmigaPal(newPal);
-		_vm->waitTOF();
 		_vm->updateEvents();
+		_vm->waitTOF();
+		_vm->waitTOF();
 	}
 }
 
diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp
index 4988e76..01e8cac 100644
--- a/engines/lab/intro.cpp
+++ b/engines/lab/intro.cpp
@@ -273,6 +273,7 @@ void Intro::play() {
 
 		_vm->_graphics->setAmigaPal(palette);
 		_vm->waitTOF();
+		_vm->waitTOF();
 	}
 
 	if (!_quitIntro) {


Commit: ce5f8f32cbbf185046ce390c67fe3d6ccee00533
    https://github.com/scummvm/scummvm/commit/ce5f8f32cbbf185046ce390c67fe3d6ccee00533
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:32+02:00

Commit Message:
LAB: Clean up the event loops of special game screens

Changed paths:
    engines/lab/map.cpp
    engines/lab/special.cpp



diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp
index 18c1b17..27e80d6 100644
--- a/engines/lab/map.cpp
+++ b/engines/lab/map.cpp
@@ -386,14 +386,16 @@ void LabEngine::processMap(uint16 curRoom) {
 	uint16 curFloor = _maps[curRoom]._pageNumber;
 
 	while (1) {
-		// Make sure we check the music at least after every message
-		updateEvents();
 		IntuiMessage *msg = _event->getMsg();
 		if (shouldQuit()) {
 			_quitLab = true;
 			return;
 		}
 
+		updateEvents();
+		_graphics->screenUpdate();
+		_system->delayMillis(10);
+
 		if (!msg) {
 			updateEvents();
 
@@ -520,7 +522,7 @@ void LabEngine::processMap(uint16 curRoom) {
 
 			_graphics->screenUpdate();
 		}
-	}
+	}	// while
 }
 
 void LabEngine::doMap() {
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index d373f8a..b91ffb4 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -221,40 +221,41 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) {
 
 void LabEngine::processJournal() {
 	while (1) {
-		// Make sure we check the music at least after every message
-		updateEvents();
 		IntuiMessage *msg = _event->getMsg();
 		if (shouldQuit()) {
 			_quitLab = true;
 			return;
 		}
 
+		updateEvents();
+		_graphics->screenUpdate();
+		_system->delayMillis(10);
+
 		if (!msg)
-			updateEvents();
-		else {
-			MessageClass msgClass  = msg->_msgClass;
+			continue;
 
-			if ((msgClass == kMessageRightClick) ||
-				((msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE)))
+		MessageClass msgClass  = msg->_msgClass;
+
+		if ((msgClass == kMessageRightClick) ||
+			((msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE)))
+			return;
+		else if (msgClass == kMessageButtonUp) {
+			uint16 buttonId  = msg->_code;
+			if (buttonId == 0) {
+				if (_journalPage >= 2) {
+					_journalPage -= 2;
+					drawJournal(1, false);
+				}
+			} else if (buttonId == 1) {
 				return;
-			else if (msgClass == kMessageButtonUp) {
-				uint16 buttonId  = msg->_code;
-				if (buttonId == 0) {
-					if (_journalPage >= 2) {
-						_journalPage -= 2;
-						drawJournal(1, false);
-					}
-				} else if (buttonId == 1) {
-					return;
-				} else if (buttonId == 2) {
-					if (!_lastPage) {
-						_journalPage += 2;
-						drawJournal(2, false);
-					}
+			} else if (buttonId == 2) {
+				if (!_lastPage) {
+					_journalPage += 2;
+					drawJournal(2, false);
 				}
 			}
 		}
-	}
+	}	// while
 }
 
 void LabEngine::doJournal() {
@@ -364,74 +365,75 @@ void LabEngine::processMonitor(const Common::String &ntext, TextFont *monitorFon
 			}
 		}
 
-		updateEvents();
-		_graphics->screenUpdate();
-		_system->delayMillis(10);
-
 		IntuiMessage *msg = _event->getMsg();
 		if (shouldQuit()) {
 			_quitLab = true;
 			return;
 		}
 
-		if (msg) {
-			MessageClass msgClass  = msg->_msgClass;
+		updateEvents();
+		_graphics->screenUpdate();
+		_system->delayMillis(10);
 
-			if ((msgClass == kMessageRightClick) ||
-				  ((msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE)))
-				return;
+		if (!msg)
+			continue;
 
-			if (msgClass == kMessageLeftClick) {
-				int16 mouseX = msg->_mouse.x;
-				int16 mouseY = msg->_mouse.y;
+		MessageClass msgClass  = msg->_msgClass;
 
-				// Check if mouse was in button bar
-				if ((mouseY >= _utils->vgaScaleY(171)) && (mouseY <= _utils->vgaScaleY(200))) {
-					if (mouseX <= _utils->vgaScaleX(31)) {
-						// Exit button
-						return;
-					}
+		if ((msgClass == kMessageRightClick) ||
+				((msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE)))
+			return;
+
+		if (msgClass == kMessageLeftClick) {
+			int16 mouseX = msg->_mouse.x;
+			int16 mouseY = msg->_mouse.y;
+
+			// Check if mouse was in button bar
+			if ((mouseY >= _utils->vgaScaleY(171)) && (mouseY <= _utils->vgaScaleY(200))) {
+				if (mouseX <= _utils->vgaScaleX(31)) {
+					// Exit button
+					return;
+				}
 					
-					if (mouseX <= _utils->vgaScaleX(59)) {
-						// Back button
-						if (isInteractive) {
-							_monitorPage = 0;
-
-							if (depth) {
-								depth--;
-								_closeDataPtr = lastClosePtr[depth];
-							}
-						} else if (_monitorPage > 0) {
-							_monitorPage = 0;
-							drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
-						}
-					} else if (mouseX < _utils->vgaScaleX(259)) {
-						// empty region; ignore
-					} else if (mouseX <= _utils->vgaScaleX(289)) {
-						// Page down button
-						if (!_lastPage) {
-							_monitorPage += 1;
-							drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
+				if (mouseX <= _utils->vgaScaleX(59)) {
+					// Back button
+					if (isInteractive) {
+						_monitorPage = 0;
+
+						if (depth) {
+							depth--;
+							_closeDataPtr = lastClosePtr[depth];
 						}
-					} else if (_monitorPage >= 1) {
-						// Page up button
-						_monitorPage -= 1;
+					} else if (_monitorPage > 0) {
+						_monitorPage = 0;
 						drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
 					}
-				} else if (isInteractive) {
-					const CloseData *tmpClosePtr = _closeDataPtr;
-					mouseY = 64 + (mouseY / _monitorButtonHeight) * 42;
-					mouseX = 101;
-					setCurrentClose(Common::Point(mouseX, mouseY), &_closeDataPtr, false);
-
-					if (tmpClosePtr != _closeDataPtr) {
-						lastClosePtr[depth] = tmpClosePtr;
-						depth++;
+				} else if (mouseX < _utils->vgaScaleX(259)) {
+					// empty region; ignore
+				} else if (mouseX <= _utils->vgaScaleX(289)) {
+					// Page down button
+					if (!_lastPage) {
+						_monitorPage += 1;
+						drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
 					}
+				} else if (_monitorPage >= 1) {
+					// Page up button
+					_monitorPage -= 1;
+					drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
+				}
+			} else if (isInteractive) {
+				const CloseData *tmpClosePtr = _closeDataPtr;
+				mouseY = 64 + (mouseY / _monitorButtonHeight) * 42;
+				mouseX = 101;
+				setCurrentClose(Common::Point(mouseX, mouseY), &_closeDataPtr, false);
+
+				if (tmpClosePtr != _closeDataPtr) {
+					lastClosePtr[depth] = tmpClosePtr;
+					depth++;
 				}
 			}
 		}
-	}
+	}	// while
 }
 
 void LabEngine::doMonitor(const Common::String background, const Common::String textfile, bool isinteractive, Common::Rect textRect) {


Commit: 374a76c89f525910eb27f23518086481bee9aa66
    https://github.com/scummvm/scummvm/commit/374a76c89f525910eb27f23518086481bee9aa66
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:33+02:00

Commit Message:
LAB: Use the sample speed value instead of a define for game music

Changed paths:
    engines/lab/music.cpp



diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp
index 0a23589..afad7c5 100644
--- a/engines/lab/music.cpp
+++ b/engines/lab/music.cpp
@@ -39,7 +39,6 @@
 
 namespace Lab {
 
-#define SAMPLESPEED       15000
 #define CLOWNROOM           123
 #define DIMROOM              80
 
@@ -142,7 +141,7 @@ void Music::changeMusic(const Common::String filename, bool storeCurPos, bool se
 	if (seektoStoredPos)
 		_musicFile->seek(_storedPos);
 
-	Audio::SeekableAudioStream *audioStream = Audio::makeRawStream(_musicFile, SAMPLESPEED, getSoundFlags());
+	Audio::SeekableAudioStream *audioStream = Audio::makeRawStream(_musicFile, 15000, getSoundFlags());
 	_vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, new Audio::LoopingAudioStream(audioStream, 0));
 }
 


Commit: b61ade788e75f7c610f46333aefd4559ad6f28e1
    https://github.com/scummvm/scummvm/commit/b61ade788e75f7c610f46333aefd4559ad6f28e1
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:33+02:00

Commit Message:
LAB: Call checkRoomMusic() when changing a room

Changed paths:
    engines/lab/console.cpp
    engines/lab/engine.cpp
    engines/lab/music.cpp
    engines/lab/music.h
    engines/lab/processroom.cpp
    engines/lab/savegame.cpp



diff --git a/engines/lab/console.cpp b/engines/lab/console.cpp
index 217dc28..20b1f56 100644
--- a/engines/lab/console.cpp
+++ b/engines/lab/console.cpp
@@ -26,6 +26,7 @@
 #include "lab/console.h"
 #include "lab/dispman.h"
 #include "lab/eventman.h"
+#include "lab/music.h"
 #include "lab/processroom.h"
 #include "lab/resource.h"
 
@@ -49,6 +50,7 @@ bool Console::Cmd_Scene(int argc, const char **argv) {
 	}
 
 	_vm->_roomNum = atoi(argv[1]);
+	_vm->_music->checkRoomMusic(1, _vm->_roomNum);
 	_vm->_curFileName = " ";
 	_vm->_closeDataPtr = nullptr;
 	_vm->_mainDisplay = true;
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 6c05a7f..3585134 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -399,7 +399,6 @@ void LabEngine::mainGameLoop() {
 
 		// Since the intro hasn't been shown, init the background music here
 		_music->resetMusic(false);
-		_music->checkRoomMusic();
 	}
 
 	uint16 curInv = kItemMap;
@@ -480,7 +479,6 @@ void LabEngine::mainGameLoop() {
 		if (!curMsg) {
 			// Does music load and next animation frame when you've run out of messages
 			gotMessage = false;
-			_music->checkRoomMusic();
 			updateEvents();
 			_anim->diffNextFrame();
 
diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp
index afad7c5..b58d6dc 100644
--- a/engines/lab/music.cpp
+++ b/engines/lab/music.cpp
@@ -44,7 +44,6 @@ namespace Lab {
 
 Music::Music(LabEngine *vm) : _vm(vm) {
 	_musicFile = nullptr;
-	_curRoomMusic = 1;
 	_storedPos = 0;
 }
 
@@ -152,18 +151,13 @@ void Music::resetMusic(bool seektoStoredPos) {
 		changeMusic("Music:BackGround", false, seektoStoredPos);
 }
 
-void Music::checkRoomMusic() {
-	if ((_curRoomMusic == _vm->_roomNum) || !_musicFile)
-		return;
-
-	if (_vm->_roomNum == CLOWNROOM)
+void Music::checkRoomMusic(uint16 prevRoom, uint16 newRoom) {
+	if (newRoom == CLOWNROOM)
 		changeMusic("Music:Laugh", true, false);
-	else if (_vm->_roomNum == DIMROOM)
+	else if (newRoom == DIMROOM)
 		changeMusic("Music:Rm81", true, false);
-	else if (_curRoomMusic == CLOWNROOM || _curRoomMusic == DIMROOM)
+	else if (prevRoom == CLOWNROOM || prevRoom == DIMROOM)
 		resetMusic(true);
-
-	_curRoomMusic = _vm->_roomNum;
 }
 
 void Music::freeMusic() {
diff --git a/engines/lab/music.h b/engines/lab/music.h
index 86ebeef..472fe4f 100644
--- a/engines/lab/music.h
+++ b/engines/lab/music.h
@@ -50,7 +50,6 @@ private:
 	LabEngine *_vm;
 
 	Common::File *_musicFile;
-	uint16 _curRoomMusic;
 	uint32 _storedPos;
 
 	Audio::SoundHandle _musicHandle;
@@ -72,7 +71,7 @@ public:
 	/**
 	 * Checks the music that should be playing in a particular room.
 	 */
-	void checkRoomMusic();
+	void checkRoomMusic(uint16 prevRoom, uint16 newRoom);
 
 	/**
 	 * Frees up the music buffers and closes the file.
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index bc09bf5..f0d17bb 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -143,8 +143,10 @@ void LabEngine::drawDirection(const CloseData *closePtr) {
 uint16 LabEngine::processArrow(uint16 curDirection, uint16 arrow) {
 	if (arrow == 1) { // Forward
 		uint16 room = _rooms[_roomNum]._doors[curDirection];
-		if (room != 0)
+		if (room != 0) {
+			_music->checkRoomMusic(_roomNum, room);
 			_roomNum = room;
+		}
 
 		return curDirection;
 	} else if (arrow == 0) { // Left
@@ -327,6 +329,7 @@ void LabEngine::doActions(const ActionList &actionList) {
 				break;
 			}
 
+			_music->checkRoomMusic(_roomNum, action->_param1);
 			_roomNum   = action->_param1;
 			_direction = action->_param2 - 1;
 			_closeDataPtr = nullptr;
diff --git a/engines/lab/savegame.cpp b/engines/lab/savegame.cpp
index 1f11ba6..16c4044 100644
--- a/engines/lab/savegame.cpp
+++ b/engines/lab/savegame.cpp
@@ -171,6 +171,7 @@ bool LabEngine::loadGame(int slot) {
 	SaveGameHeader header;
 	readSaveGameHeader(file, header);
 	_roomNum = file->readUint16LE();
+	_music->checkRoomMusic(1, _roomNum);
 	_direction = file->readUint16LE();
 	setQuarters(file->readUint16LE());
 
@@ -233,8 +234,6 @@ bool LabEngine::saveRestoreGame() {
 		int slot = dialog->runModalWithCurrentTarget();
 		if (slot >= 0) {
 			isOK = loadGame(slot);
-			if (isOK)
-				_music->checkRoomMusic();
 		}
 		delete dialog;
 	}


Commit: 280bd0f7c2d426a1725118067db08ca2ca917e43
    https://github.com/scummvm/scummvm/commit/280bd0f7c2d426a1725118067db08ca2ca917e43
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:34+02:00

Commit Message:
LAB: Read the header of DIFF files when opening them

Changed paths:
    engines/lab/anim.cpp
    engines/lab/dispman.cpp



diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp
index 6e2f6fd..3da4519 100644
--- a/engines/lab/anim.cpp
+++ b/engines/lab/anim.cpp
@@ -286,10 +286,9 @@ void Anim::readDiff(Common::File *diffFile, bool playOnce, bool onlyDiffData) {
 	_diffFile = diffFile;
 
 	_continuous = false;
-	uint32 signature1 = _diffFile->readUint32BE();
-	uint32 signature2 = _diffFile->readUint32LE();
 
-	if ((signature1 != MKTAG('D', 'I', 'F', 'F')) || (signature2 != 1219009121)) {
+	uint32 magicBytes = _diffFile->readUint32LE();
+	if (magicBytes != 1219009121) {
 		_isPlaying = false;
 		return;
 	}
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index e4bef24..674549a 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -67,7 +67,7 @@ DisplayMan::~DisplayMan() {
 
 void DisplayMan::loadPict(const Common::String filename) {
 	freePict();
-	_curBitmap = _vm->_resource->openDataFile(filename);
+	_curBitmap = _vm->_resource->openDataFile(filename, MKTAG('D', 'I', 'F', 'F'));
 }
 
 void DisplayMan::loadBackPict(const Common::String fileName, uint16 *highPal) {


Commit: e8d1100fec554377d012da2d21eb88e19156274d
    https://github.com/scummvm/scummvm/commit/e8d1100fec554377d012da2d21eb88e19156274d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:34+02:00

Commit Message:
LAB: Allow the game to be launched from the GAME folder

The FONTS folder is pretty much useless, so if a user points ScummVM
to the GAME folder, handle the game files properly

Changed paths:
    engines/lab/lab.cpp
    engines/lab/resource.cpp



diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index 0ecfc99..048082c 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -28,6 +28,7 @@
  *
  */
 
+#include "common/config-manager.h"
 #include "common/debug-channels.h"
 #include "common/error.h"
 
@@ -129,6 +130,9 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
 	for (int i = 0; i < 20; i++)
 		_highPalette[i] = 0;
 	_introPlaying = false;
+
+	const Common::FSNode gameDataDir(ConfMan.get("path"));
+	SearchMan.addSubDirectoryMatching(gameDataDir, "game", 0, 4);
 }
 
 LabEngine::~LabEngine() {
@@ -172,7 +176,7 @@ Common::Error LabEngine::run() {
 		// Check if this is the Wyrmkeep trial
 		Common::File roomFile;
 		bool knownVersion = true;
-		bool roomFileOpened = roomFile.open("game/rooms/48");
+		bool roomFileOpened = roomFile.open("rooms/48");
 
 		if (!roomFileOpened)
 			knownVersion = false;
diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp
index 8883cef..23de58b 100644
--- a/engines/lab/resource.cpp
+++ b/engines/lab/resource.cpp
@@ -154,9 +154,9 @@ Common::String Resource::translateFileName(const Common::String filename) {
 
 	if (upperFilename.hasPrefix("P:") || upperFilename.hasPrefix("F:")) {
 		if (_vm->_isHiRes)
-			fileNameStrFinal = "GAME/SPICT/";
+			fileNameStrFinal = "SPICT/";
 		else
-			fileNameStrFinal = "GAME/PICT/";
+			fileNameStrFinal = "PICT/";
 
 		if (_vm->getPlatform() == Common::kPlatformAmiga) {
 			if (upperFilename.hasPrefix("P:")) {
@@ -167,13 +167,9 @@ Common::String Resource::translateFileName(const Common::String filename) {
 			}
 		}
 	} else if (upperFilename.hasPrefix("LAB:")) {
-		if (_vm->getPlatform() != Common::kPlatformAmiga)
-			fileNameStrFinal = "GAME/";
+		// Look inside the game folder
 	} else if (upperFilename.hasPrefix("MUSIC:")) {
-		if (_vm->getPlatform() != Common::kPlatformAmiga)
-			fileNameStrFinal = "GAME/MUSIC/";
-		else
-			fileNameStrFinal = "MUSIC/";
+		fileNameStrFinal = "MUSIC/";
 	}
 
 	if (upperFilename.contains(':')) {


Commit: 46fdd5e7a48e0312c3fb523058f98e1d11f068e5
    https://github.com/scummvm/scummvm/commit/46fdd5e7a48e0312c3fb523058f98e1d11f068e5
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:35+02:00

Commit Message:
LAB: Clean up the trial warning handling code

Changed paths:
    engines/lab/engine.cpp
    engines/lab/lab.cpp
    engines/lab/lab.h



diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 3585134..b0b7d38 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -30,6 +30,8 @@
 
 #include "common/config-manager.h"
 
+#include "gui/message.h"
+
 #include "lab/lab.h"
 #include "lab/anim.h"
 #include "lab/dispman.h"
@@ -100,6 +102,40 @@ static char initColors[] = { '\x00', '\x00', '\x00', '\x30',
 							 '\x24', '\x24', '\x2c', '\x2c',
 							 '\x2c', '\x08', '\x08', '\x08' };
 
+void LabEngine::handleTrialWarning() {
+	// Check if this is the Wyrmkeep trial
+	Common::File roomFile;
+	bool knownVersion = true;
+	bool roomFileOpened = roomFile.open("rooms/48");
+
+	if (!roomFileOpened)
+		knownVersion = false;
+	else if (roomFile.size() != 892)
+		knownVersion = false;
+	else {
+		roomFile.seek(352);
+		byte checkByte = roomFile.readByte();
+		if (checkByte == 0x00) {
+			// Full Windows version
+		}
+		else if (checkByte == 0x80) {
+			// Wyrmkeep trial version
+			_extraGameFeatures = GF_WINDOWS_TRIAL;
+
+			GUI::MessageDialog trialMessage("This is a trial Windows version of the game. To play the full version, you will need to use the original interpreter and purchase a key from Wyrmkeep");
+			trialMessage.runModal();
+		}
+		else {
+			knownVersion = false;
+		}
+
+		roomFile.close();
+	}
+
+	if (!knownVersion)
+		error("Unknown Windows version found, please report this version to the ScummVM team");
+}
+
 uint16 LabEngine::getQuarters() {
 	return _inventory[kItemQuarter]._quantity;
 }
@@ -1001,6 +1037,9 @@ void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &c
 }
 
 void LabEngine::go() {
+	if (getPlatform() == Common::kPlatformWindows)
+		handleTrialWarning();
+
 	_isHiRes = ((getFeatures() & GF_LOWRES) == 0);
 	_graphics->setUpScreens();
 
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index 048082c..4eb0e4d 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -33,7 +33,6 @@
 #include "common/error.h"
 
 #include "engines/util.h"
-#include "gui/message.h"
 
 #include "lab/lab.h"
 
@@ -172,40 +171,6 @@ Common::Error LabEngine::run() {
 	_console = new Console(this);
 	_journalBackImage = new Image(this);
 
-	if (getPlatform() == Common::kPlatformWindows) {
-		// Check if this is the Wyrmkeep trial
-		Common::File roomFile;
-		bool knownVersion = true;
-		bool roomFileOpened = roomFile.open("rooms/48");
-
-		if (!roomFileOpened)
-			knownVersion = false;
-		else if (roomFile.size() != 892)
-			knownVersion = false;
-		else {
-			roomFile.seek(352);
-			byte checkByte = roomFile.readByte();
-			if (checkByte == 0x00) {
-				// Full Windows version
-			} else if (checkByte == 0x80) {
-				// Wyrmkeep trial version
-				_extraGameFeatures = GF_WINDOWS_TRIAL;
-
-				GUI::MessageDialog trialMessage("This is a trial Windows version of the game. To play the full version, you will need to use the original interpreter and purchase a key from Wyrmkeep");
-				trialMessage.runModal();
-			} else {
-				knownVersion = false;
-			}
-
-			roomFile.close();
-
-			if (!knownVersion) {
-				warning("Unknown Windows version found, please report this version to the ScummVM team");
-				return Common::kNoGameDataFoundError;
-			}
-		}
-	}
-
 	go();
 
 	return Common::kNoError;
diff --git a/engines/lab/lab.h b/engines/lab/lab.h
index c3a5d8b..3951f45 100644
--- a/engines/lab/lab.h
+++ b/engines/lab/lab.h
@@ -487,7 +487,6 @@ private:
 	void processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonId, uint16 &actionMode);
 	void performAction(uint16 actionMode, Common::Point curPos, uint16 &curInv);
 
-private:
 	/**
 	 * Writes the game out to disk.
 	 */
@@ -498,6 +497,8 @@ private:
 	 */
 	bool loadGame(int slot);
 	void writeSaveGameHeader(Common::OutSaveFile *out, const Common::String &saveName);
+
+	void handleTrialWarning();
 };
 
 bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header);


Commit: 924d43b7aac241b9205af640b0a6788e4abc99bf
    https://github.com/scummvm/scummvm/commit/924d43b7aac241b9205af640b0a6788e4abc99bf
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:35+02:00

Commit Message:
LAB: Better separation of the event and interface code

Changed paths:
    engines/lab/eventman.cpp
    engines/lab/interface.cpp



diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp
index 969cb8d..60c56e0 100644
--- a/engines/lab/eventman.cpp
+++ b/engines/lab/eventman.cpp
@@ -72,35 +72,19 @@ EventManager::EventManager(LabEngine *vm) : _vm(vm) {
 	_keyPressed = Common::KEYCODE_INVALID;
 }
 
-Button *EventManager::checkButtonHit(ButtonList *buttonList, Common::Point pos) {
-	for (ButtonList::iterator buttonItr = buttonList->begin(); buttonItr != buttonList->end(); ++buttonItr) {
-		Button *button = *buttonItr;
-		Common::Rect buttonRect(button->_x, button->_y, button->_x + button->_image->_width - 1, button->_y + button->_image->_height - 1);
-
-		if (buttonRect.contains(pos) && button->_isEnabled) {
-			_hitButton = button;
-			return button;
-		}
-	}
+void EventManager::initMouse() {
+	CursorMan.pushCursor(mouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0);
+	CursorMan.showMouse(false);
 
-	return nullptr;
+	setMousePos(Common::Point(_vm->_graphics->_screenWidth / 2, _vm->_graphics->_screenHeight / 2));
 }
 
-void EventManager::attachButtonList(ButtonList *buttonList) {
-	if (_screenButtonList != buttonList)
-		_lastButtonHit = nullptr;
-
-	_screenButtonList = buttonList;
+void EventManager::mouseShow() {
+	CursorMan.showMouse(true);
 }
 
-Button *EventManager::getButton(uint16 id) {
-	for (ButtonList::iterator buttonItr = _screenButtonList->begin(); buttonItr != _screenButtonList->end(); ++buttonItr) {
-		Button *button = *buttonItr;
-		if (button->_buttonId == id)
-			return button;
-	}
-
-	return nullptr;
+void EventManager::mouseHide() {
+	CursorMan.showMouse(false);
 }
 
 void EventManager::updateMouse() {
@@ -116,21 +100,6 @@ void EventManager::updateMouse() {
 	_vm->_graphics->screenUpdate();
 }
 
-void EventManager::initMouse() {
-	CursorMan.pushCursor(mouseData, MOUSE_WIDTH, MOUSE_HEIGHT, 0, 0, 0);
-	CursorMan.showMouse(false);
-
-	setMousePos(Common::Point(_vm->_graphics->_screenWidth / 2, _vm->_graphics->_screenHeight / 2));
-}
-
-void EventManager::mouseShow() {
-	CursorMan.showMouse(true);
-}
-
-void EventManager::mouseHide() {
-	CursorMan.showMouse(false);
-}
-
 void EventManager::setMousePos(Common::Point pos) {
 	if (_vm->_isHiRes)
 		_vm->_system->warpMouse(pos.x, pos.y);
diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp
index 41a9047..b0a83a9 100644
--- a/engines/lab/interface.cpp
+++ b/engines/lab/interface.cpp
@@ -107,6 +107,37 @@ Button *EventManager::checkNumButtonHit(ButtonList *buttonList, Common::KeyCode
 	return nullptr;
 }
 
+Button *EventManager::checkButtonHit(ButtonList *buttonList, Common::Point pos) {
+	for (ButtonList::iterator buttonItr = buttonList->begin(); buttonItr != buttonList->end(); ++buttonItr) {
+		Button *button = *buttonItr;
+		Common::Rect buttonRect(button->_x, button->_y, button->_x + button->_image->_width - 1, button->_y + button->_image->_height - 1);
+
+		if (buttonRect.contains(pos) && button->_isEnabled) {
+			_hitButton = button;
+			return button;
+		}
+	}
+
+	return nullptr;
+}
+
+void EventManager::attachButtonList(ButtonList *buttonList) {
+	if (_screenButtonList != buttonList)
+		_lastButtonHit = nullptr;
+
+	_screenButtonList = buttonList;
+}
+
+Button *EventManager::getButton(uint16 id) {
+	for (ButtonList::iterator buttonItr = _screenButtonList->begin(); buttonItr != _screenButtonList->end(); ++buttonItr) {
+		Button *button = *buttonItr;
+		if (button->_buttonId == id)
+			return button;
+	}
+
+	return nullptr;
+}
+
 IntuiMessage *EventManager::getMsg() {
 	static IntuiMessage message;
 


Commit: ad1aac46ceda6e9c01d3f71994fcdd9b4080d96d
    https://github.com/scummvm/scummvm/commit/ad1aac46ceda6e9c01d3f71994fcdd9b4080d96d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2016-01-14T23:41:36+02:00

Commit Message:
LAB: Remove superfluous calls to updateEvents()

These are leftovers, as updateEvents() was called to fill in the music
buffer

Changed paths:
    engines/lab/dispman.cpp
    engines/lab/resource.cpp



diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index 674549a..49ed17b 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -87,7 +87,6 @@ void DisplayMan::loadBackPict(const Common::String fileName, uint16 *highPal) {
 void DisplayMan::readPict(const Common::String filename, bool playOnce, bool onlyDiffData, byte *memoryBuffer) {
 	_vm->_anim->stopDiff();
 	loadPict(filename);
-	_vm->updateEvents();
 	_vm->_anim->setOutputBuffer(memoryBuffer);
 	_vm->_anim->readDiff(_curBitmap, playOnce, onlyDiffData);
 }
diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp
index 23de58b..f16fd53 100644
--- a/engines/lab/resource.cpp
+++ b/engines/lab/resource.cpp
@@ -59,8 +59,6 @@ TextFont *Resource::getFont(const Common::String fileName) {
 	if (fileSize <= headerSize)
 		return nullptr;
 
-	_vm->updateEvents();
-
 	TextFont *textfont = new TextFont();
 	textfont->_dataLength = fileSize - headerSize;
 	textfont->_height = dataFile->readUint16LE();
@@ -77,8 +75,6 @@ TextFont *Resource::getFont(const Common::String fileName) {
 Common::String Resource::getText(const Common::String fileName) {
 	Common::File *dataFile = openDataFile(fileName);
 
-	_vm->updateEvents();
-
 	uint32 count = dataFile->size();
 	byte *buffer = new byte[count];
 	byte *text = buffer;
@@ -143,7 +139,6 @@ void Resource::readViews(uint16 roomNum) {
 	readView(dataFile, curRoom->_view[kDirectionWest]);
 	readRule(dataFile, curRoom->_rules);
 
-	_vm->updateEvents();
 	delete dataFile;
 }
 






More information about the Scummvm-git-logs mailing list