mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
LAB: Call checkRoomMusic() when changing a room
This commit is contained in:
parent
374a76c89f
commit
b61ade788e
@ -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;
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user