LAB: Move RoomNum to main engine class

This commit is contained in:
Strangerke 2015-11-30 01:42:12 +01:00 committed by Willem Jan Palenstijn
parent d0c6c73036
commit 6cee2eb2be
10 changed files with 69 additions and 69 deletions

View file

@ -53,7 +53,7 @@ extern bool DoBlack, waitForEffect, stopsound, DoNotDrawMessage, nopalchange;
extern RoomData *_rooms; extern RoomData *_rooms;
extern InventoryData *Inventory; extern InventoryData *Inventory;
extern uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; extern uint16 NumInv, ManyRooms, HighestCondition, Direction;
CloseDataPtr CPtr; CloseDataPtr CPtr;
CrumbData BreadCrumbs[MAX_CRUMBS]; CrumbData BreadCrumbs[MAX_CRUMBS];
@ -528,7 +528,7 @@ bool LabEngine::doUse(uint16 CurInv) {
stopDiff(); stopDiff();
CurFileName = " "; CurFileName = " ";
CPtr = NULL; CPtr = NULL;
doMap(RoomNum); doMap(_roomNum);
VGASetPal(initcolors, 8); VGASetPal(initcolors, 8);
drawMessage(NULL); drawMessage(NULL);
drawPanel(); drawPanel();
@ -647,7 +647,7 @@ void LabEngine::mainGameLoop() {
VGASetPal(initcolors, 8); VGASetPal(initcolors, 8);
CPtr = NULL; CPtr = NULL;
RoomNum = 1; _roomNum = 1;
Direction = NORTH; Direction = NORTH;
_resource->readRoomData("LAB:Doors"); _resource->readRoomData("LAB:Doors");
@ -693,7 +693,7 @@ void LabEngine::mainGameLoop() {
Test = getPictName(&CPtr); Test = getPictName(&CPtr);
if (noupdatediff) { if (noupdatediff) {
_roomsFound->inclElement(RoomNum); /* Potentially entered another room */ _roomsFound->inclElement(_roomNum); /* Potentially entered another room */
ForceDraw = (strcmp(Test, CurFileName) != 0) || ForceDraw; ForceDraw = (strcmp(Test, CurFileName) != 0) || ForceDraw;
noupdatediff = false; noupdatediff = false;
@ -702,7 +702,7 @@ void LabEngine::mainGameLoop() {
else if (strcmp(Test, CurFileName) != 0) { else if (strcmp(Test, CurFileName) != 0) {
interfaceOff(); interfaceOff();
_roomsFound->inclElement(RoomNum); /* Potentially entered another room */ _roomsFound->inclElement(_roomNum); /* Potentially entered another room */
CurFileName = Test; CurFileName = Test;
if (CPtr) { if (CPtr) {
@ -965,18 +965,18 @@ from_crumbs:
mayShowCrumbIndicator(); mayShowCrumbIndicator();
WSDL_UpdateScreen(); WSDL_UpdateScreen();
} else if (GadID == 7) { } else if (GadID == 7) {
OldRoomNum = RoomNum; OldRoomNum = _roomNum;
if (doGoForward(&CPtr)) { if (doGoForward(&CPtr)) {
if (OldRoomNum == RoomNum) if (OldRoomNum == _roomNum)
DoBlack = true; DoBlack = true;
} else { } else {
DoBlack = true; DoBlack = true;
processArrow(&Direction, GadID - 6); processArrow(&Direction, GadID - 6);
if (OldRoomNum != RoomNum) { if (OldRoomNum != _roomNum) {
drawStaticMessage(kTextGoForward); drawStaticMessage(kTextGoForward);
_roomsFound->inclElement(RoomNum); /* Potentially entered a new room */ _roomsFound->inclElement(_roomNum); /* Potentially entered a new room */
CurFileName = " "; CurFileName = " ";
ForceDraw = true; ForceDraw = true;
} else { } else {
@ -991,15 +991,15 @@ from_crumbs:
FollowingCrumbs = false; FollowingCrumbs = false;
} }
} else { } else {
if (RoomNum == OldRoomNum) { // didn't get there? if (_roomNum == OldRoomNum) { // didn't get there?
FollowingCrumbs = false; FollowingCrumbs = false;
} }
} }
} else if (DroppingCrumbs && OldRoomNum != RoomNum) { } else if (DroppingCrumbs && OldRoomNum != _roomNum) {
// If in surreal maze, turn off DroppingCrumbs. // If in surreal maze, turn off DroppingCrumbs.
// Note: These numbers were generated by parsing the // Note: These numbers were generated by parsing the
// "Maps" file, which is why they are hard-coded. Bleh! // "Maps" file, which is why they are hard-coded. Bleh!
if (RoomNum >= 245 && RoomNum <= 280) { if (_roomNum >= 245 && _roomNum <= 280) {
FollowingCrumbs = false; FollowingCrumbs = false;
DroppingCrumbs = false; DroppingCrumbs = false;
NumCrumbs = 0; NumCrumbs = 0;
@ -1007,7 +1007,7 @@ from_crumbs:
} else { } else {
bool intersect = false; bool intersect = false;
for (int idx = 0; idx < NumCrumbs; idx++) { for (int idx = 0; idx < NumCrumbs; idx++) {
if (BreadCrumbs[idx].RoomNum == RoomNum) { if (BreadCrumbs[idx].RoomNum == _roomNum) {
NumCrumbs = idx + 1; NumCrumbs = idx + 1;
BreadCrumbs[NumCrumbs].RoomNum = 0; BreadCrumbs[NumCrumbs].RoomNum = 0;
intersect = true; intersect = true;
@ -1020,7 +1020,7 @@ from_crumbs:
memcpy(&BreadCrumbs[0], &BreadCrumbs[1], NumCrumbs * sizeof BreadCrumbs[0]); memcpy(&BreadCrumbs[0], &BreadCrumbs[1], NumCrumbs * sizeof BreadCrumbs[0]);
} }
BreadCrumbs[NumCrumbs].RoomNum = RoomNum; BreadCrumbs[NumCrumbs].RoomNum = _roomNum;
BreadCrumbs[NumCrumbs++].Direction = Direction; BreadCrumbs[NumCrumbs++].Direction = Direction;
} }
} }
@ -1175,11 +1175,11 @@ from_crumbs:
eatMessages(); eatMessages();
if (ActionMode == 0) { /* Take something. */ if (ActionMode == 0) { /* Take something. */
if (doActionRule(Common::Point(curPos.x, curPos.y), ActionMode, RoomNum, &CPtr)) if (doActionRule(Common::Point(curPos.x, curPos.y), ActionMode, _roomNum, &CPtr))
CurFileName = NewFileName; CurFileName = NewFileName;
else if (takeItem(curPos.x, curPos.y, &CPtr)) else if (takeItem(curPos.x, curPos.y, &CPtr))
drawStaticMessage(kTextTakeItem); drawStaticMessage(kTextTakeItem);
else if (doActionRule(curPos, TAKEDEF - 1, RoomNum, &CPtr)) else if (doActionRule(curPos, TAKEDEF - 1, _roomNum, &CPtr))
CurFileName = NewFileName; CurFileName = NewFileName;
else if (doActionRule(curPos, TAKE - 1, 0, &CPtr)) else if (doActionRule(curPos, TAKE - 1, 0, &CPtr))
CurFileName = NewFileName; CurFileName = NewFileName;
@ -1188,7 +1188,7 @@ from_crumbs:
} else if ((ActionMode == 1) /* Manipulate an object */ || } else if ((ActionMode == 1) /* Manipulate an object */ ||
(ActionMode == 2) /* Open up a "door" */ || (ActionMode == 2) /* Open up a "door" */ ||
(ActionMode == 3)) { /* Close a "door" */ (ActionMode == 3)) { /* Close a "door" */
if (doActionRule(curPos, ActionMode, RoomNum, &CPtr)) if (doActionRule(curPos, ActionMode, _roomNum, &CPtr))
CurFileName = NewFileName; CurFileName = NewFileName;
else if (!doActionRule(curPos, ActionMode, 0, &CPtr)) { else if (!doActionRule(curPos, ActionMode, 0, &CPtr)) {
if (curPos.y < (VGAScaleY(149) + SVGACord(2))) if (curPos.y < (VGAScaleY(149) + SVGACord(2)))
@ -1224,7 +1224,7 @@ from_crumbs:
mayShowCrumbIndicator(); mayShowCrumbIndicator();
WSDL_UpdateScreen(); WSDL_UpdateScreen();
} else if (Class == DELTAMOVE) { } else if (Class == DELTAMOVE) {
VPtr = getViewData(RoomNum, Direction); VPtr = getViewData(_roomNum, Direction);
OldCPtr = VPtr->closeUps; OldCPtr = VPtr->closeUps;
if (HCPtr == NULL) { if (HCPtr == NULL) {
@ -1400,7 +1400,7 @@ int followCrumbs() {
BreadCrumbs[NumCrumbs--].RoomNum = 0; BreadCrumbs[NumCrumbs--].RoomNum = 0;
// Is the current crumb this room? If not, logic error. // Is the current crumb this room? If not, logic error.
if (RoomNum != BreadCrumbs[NumCrumbs].RoomNum) { if (g_lab->_roomNum != BreadCrumbs[NumCrumbs].RoomNum) {
NumCrumbs = 0; NumCrumbs = 0;
BreadCrumbs[0].RoomNum = 0; BreadCrumbs[0].RoomNum = 0;
DroppingCrumbs = false; DroppingCrumbs = false;

View file

@ -73,11 +73,13 @@ LabEngine::LabEngine(OSystem *syst, const ADGameDescription *gameDesc)
_nextKeyOut = 0; _nextKeyOut = 0;
_isHiRes = false; _isHiRes = false;
_roomNum = -1;
_event = nullptr; _event = nullptr;
_resource = nullptr; _resource = nullptr;
_music = nullptr; _music = nullptr;
//const Common::FSNode gameDataDir(ConfMan.get("path")); //const Common::FSNode gameDataDir(ConfMan.get("path"));
//SearchMan.addSubDirectoryMatching(gameDataDir, "game"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game");
//SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict"); //SearchMan.addSubDirectoryMatching(gameDataDir, "game/pict");

View file

@ -103,6 +103,7 @@ public:
Resource *_resource; Resource *_resource;
Music *_music; Music *_music;
int _roomNum;
byte *_currentDsplayBuffer; byte *_currentDsplayBuffer;
Common::Point _mousePos; Common::Point _mousePos;

View file

@ -256,8 +256,8 @@ bool saveRestoreGame();
/*----- From saveGame.c ----*/ /*----- From saveGame.c ----*/
/*--------------------------*/ /*--------------------------*/
bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Common::String desc); bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc);
bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot); bool loadGame(uint16 *Direction, uint16 *Quarters, int slot);
bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header); bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header);
/*--------------------------*/ /*--------------------------*/

View file

@ -43,8 +43,6 @@ namespace Lab {
#define CLOWNROOM 123 #define CLOWNROOM 123
#define DIMROOM 80 #define DIMROOM 80
extern uint16 RoomNum; // TODO: Move into a class
Music::Music(LabEngine *vm) : _vm(vm) { Music::Music(LabEngine *vm) : _vm(vm) {
_file = 0; _file = 0;
_tFile = 0; _tFile = 0;
@ -70,9 +68,9 @@ Music::Music(LabEngine *vm) : _vm(vm) {
/* it from the Audio device. */ /* it from the Audio device. */
/*****************************************************************************/ /*****************************************************************************/
void Music::updateMusic() { void Music::updateMusic() {
g_lab->WSDL_ProcessInput(0); _vm->WSDL_ProcessInput(0);
g_lab->_event->updateMouse(); _vm->_event->updateMouse();
if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) { if (_musicOn && getPlayingBufferCount() < MAXBUFFERS) {
// NOTE: We need to use malloc(), cause this will be freed with free() // NOTE: We need to use malloc(), cause this will be freed with free()
@ -89,7 +87,7 @@ void Music::updateMusic() {
} }
byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; byte soundFlags = Audio::FLAG_LITTLE_ENDIAN;
if (g_lab->getPlatform() == Common::kPlatformWindows) if (_vm->getPlatform() == Common::kPlatformWindows)
soundFlags |= Audio::FLAG_16BITS; soundFlags |= Audio::FLAG_16BITS;
else else
soundFlags |= Audio::FLAG_UNSIGNED; soundFlags |= Audio::FLAG_UNSIGNED;
@ -97,7 +95,7 @@ void Music::updateMusic() {
_queuingAudioStream->queueBuffer(musicBuffer, MUSICBUFSIZE, DisposeAfterUse::YES, soundFlags); _queuingAudioStream->queueBuffer(musicBuffer, MUSICBUFSIZE, DisposeAfterUse::YES, soundFlags);
if (startMusic) if (startMusic)
g_lab->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _queuingAudioStream); _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _queuingAudioStream);
} }
} }
@ -113,7 +111,7 @@ void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) {
SampleSpeed = 4000; SampleSpeed = 4000;
byte soundFlags = Audio::FLAG_LITTLE_ENDIAN; byte soundFlags = Audio::FLAG_LITTLE_ENDIAN;
if (g_lab->getPlatform() == Common::kPlatformWindows) if (_vm->getPlatform() == Common::kPlatformWindows)
soundFlags |= Audio::FLAG_16BITS; soundFlags |= Audio::FLAG_16BITS;
else else
soundFlags |= Audio::FLAG_UNSIGNED; soundFlags |= Audio::FLAG_UNSIGNED;
@ -121,16 +119,16 @@ void Music::playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data) {
Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO); Audio::SeekableAudioStream *audioStream = Audio::makeRawStream((const byte *)Data, Length, SampleSpeed, soundFlags, DisposeAfterUse::NO);
uint loops = (_loopSoundEffect) ? 0 : 1; uint loops = (_loopSoundEffect) ? 0 : 1;
Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops); Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, loops);
g_lab->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, loopingAudioStream);
} }
void Music::stopSoundEffect() { void Music::stopSoundEffect() {
if (isSoundEffectActive()) if (isSoundEffectActive())
g_lab->_mixer->stopHandle(_sfxHandle); _vm->_mixer->stopHandle(_sfxHandle);
} }
bool Music::isSoundEffectActive() const { bool Music::isSoundEffectActive() const {
return g_lab->_mixer->isSoundHandleActive(_sfxHandle); return _vm->_mixer->isSoundHandleActive(_sfxHandle);
} }
void Music::fillbuffer(byte *musicBuffer) { void Music::fillbuffer(byte *musicBuffer) {
@ -196,10 +194,10 @@ bool Music::initMusic() {
void Music::freeMusic() { void Music::freeMusic() {
_musicOn = false; _musicOn = false;
g_lab->_mixer->stopHandle(_musicHandle); _vm->_mixer->stopHandle(_musicHandle);
_queuingAudioStream = NULL; _queuingAudioStream = NULL;
g_lab->_mixer->stopHandle(_sfxHandle); _vm->_mixer->stopHandle(_sfxHandle);
delete _file; delete _file;
_file = NULL; _file = NULL;
@ -214,7 +212,7 @@ void Music::pauseBackMusic() {
_musicOn = false; _musicOn = false;
stopSoundEffect(); stopSoundEffect();
g_lab->_mixer->pauseHandle(_musicHandle, true); _vm->_mixer->pauseHandle(_musicHandle, true);
_musicPaused = true; _musicPaused = true;
} }
@ -228,7 +226,7 @@ void Music::resumeBackMusic() {
stopSoundEffect(); stopSoundEffect();
_musicOn = true; _musicOn = true;
g_lab->_mixer->pauseHandle(_musicHandle, false); _vm->_mixer->pauseHandle(_musicHandle, false);
updateMusic(); updateMusic();
_musicPaused = false; _musicPaused = false;
@ -255,17 +253,17 @@ void Music::setMusic(bool on) {
/* Checks the music that should be playing in a particular room. */ /* Checks the music that should be playing in a particular room. */
/******************************************************************************/ /******************************************************************************/
void Music::checkRoomMusic() { void Music::checkRoomMusic() {
if ((_lastMusicRoom == RoomNum) || !_musicOn) if ((_lastMusicRoom == _vm->_roomNum) || !_musicOn)
return; return;
if (RoomNum == CLOWNROOM) if (_vm->_roomNum == CLOWNROOM)
changeMusic("Music:Laugh"); changeMusic("Music:Laugh");
else if (RoomNum == DIMROOM) else if (_vm->_roomNum == DIMROOM)
changeMusic("Music:Rm81"); changeMusic("Music:Rm81");
else if (_doReset) else if (_doReset)
resetMusic(); resetMusic();
_lastMusicRoom = RoomNum; _lastMusicRoom = _vm->_roomNum;
} }
/*****************************************************************************/ /*****************************************************************************/

View file

@ -49,7 +49,6 @@ static TextFont bmf;
extern uint16 Direction; extern uint16 Direction;
extern CloseDataPtr CPtr; extern CloseDataPtr CPtr;
extern uint16 RoomNum;
/*****************************************************************************/ /*****************************************************************************/
/* Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets */ /* Converts an Amiga palette (up to 16 colors) to a VGA palette, then sets */

View file

@ -47,7 +47,7 @@ namespace Lab {
RoomData *_rooms; RoomData *_rooms;
InventoryData *Inventory; InventoryData *Inventory;
uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction; uint16 NumInv, ManyRooms, HighestCondition, Direction;
const char *NewFileName; const char *NewFileName;
extern bool DoNotDrawMessage, IsBM, noupdatediff, QuitLab, MusicOn, DoBlack, LongWinInFront; extern bool DoNotDrawMessage, IsBM, noupdatediff, QuitLab, MusicOn, DoBlack, LongWinInFront;
@ -124,7 +124,7 @@ static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr LCPtr) {
ViewData *VPtr; ViewData *VPtr;
if (LCPtr == NULL) { if (LCPtr == NULL) {
VPtr = getViewData(RoomNum, Direction); VPtr = getViewData(g_lab->_roomNum, Direction);
LCPtr = VPtr->closeUps; LCPtr = VPtr->closeUps;
} }
@ -173,7 +173,7 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) {
/* Returns the current picture name. */ /* Returns the current picture name. */
/*****************************************************************************/ /*****************************************************************************/
char *getPictName(CloseDataPtr *LCPtr) { char *getPictName(CloseDataPtr *LCPtr) {
ViewData *ViewPtr = getViewData(RoomNum, Direction); ViewData *ViewPtr = getViewData(g_lab->_roomNum, Direction);
if (*LCPtr != NULL) { if (*LCPtr != NULL) {
*LCPtr = findCPtrMatch(*LCPtr, ViewPtr->closeUps); *LCPtr = findCPtrMatch(*LCPtr, ViewPtr->closeUps);
@ -196,8 +196,8 @@ void LabEngine::drawDirection(CloseDataPtr LCPtr) {
Common::String message; Common::String message;
if (_rooms[RoomNum]._roomMsg) { if (_rooms[_roomNum]._roomMsg) {
message += _rooms[RoomNum]._roomMsg; message += _rooms[_roomNum]._roomMsg;
message += ", "; message += ", ";
} }
@ -221,18 +221,18 @@ bool processArrow(uint16 *direction, uint16 Arrow) {
if (Arrow == 1) { /* Forward */ if (Arrow == 1) { /* Forward */
if (*direction == NORTH) if (*direction == NORTH)
room = _rooms[RoomNum]._northDoor; room = _rooms[g_lab->_roomNum]._northDoor;
else if (*direction == SOUTH) else if (*direction == SOUTH)
room = _rooms[RoomNum]._southDoor; room = _rooms[g_lab->_roomNum]._southDoor;
else if (*direction == EAST) else if (*direction == EAST)
room = _rooms[RoomNum]._eastDoor; room = _rooms[g_lab->_roomNum]._eastDoor;
else if (*direction == WEST) else if (*direction == WEST)
room = _rooms[RoomNum]._westDoor; room = _rooms[g_lab->_roomNum]._westDoor;
if (room == 0) if (room == 0)
return false; return false;
else else
RoomNum = room; g_lab->_roomNum = room;
} else if (Arrow == 0) { /* Left */ } else if (Arrow == 0) { /* Left */
if (*direction == NORTH) if (*direction == NORTH)
*direction = WEST; *direction = WEST;
@ -265,7 +265,7 @@ void setCurClose(Common::Point pos, CloseDataPtr *cptr, bool useAbsoluteCoords)
uint16 x1, y1, x2, y2; uint16 x1, y1, x2, y2;
if (*cptr == NULL) { if (*cptr == NULL) {
VPtr = getViewData(RoomNum, Direction); VPtr = getViewData(g_lab->_roomNum, Direction);
LCPtr = VPtr->closeUps; LCPtr = VPtr->closeUps;
} else } else
LCPtr = (*cptr)->SubCloseUps; LCPtr = (*cptr)->SubCloseUps;
@ -300,7 +300,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) {
CloseDataPtr LCPtr; CloseDataPtr LCPtr;
if (*cptr == NULL) { if (*cptr == NULL) {
VPtr = getViewData(RoomNum, Direction); VPtr = getViewData(g_lab->_roomNum, Direction);
LCPtr = VPtr->closeUps; LCPtr = VPtr->closeUps;
} else if ((*cptr)->CloseUpType < 0) { } else if ((*cptr)->CloseUpType < 0) {
g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType)); g_lab->_conditions->inclElement(abs((*cptr)->CloseUpType));
@ -443,7 +443,7 @@ static void doActions(Action * APtr, CloseDataPtr *LCPtr) {
continue; continue;
} }
RoomNum = APtr->Param1; g_lab->_roomNum = APtr->Param1;
Direction = APtr->Param2 - 1; Direction = APtr->Param2 - 1;
*LCPtr = NULL; *LCPtr = NULL;
DoBlack = true; DoBlack = true;
@ -611,7 +611,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo
action++; action++;
if (LCPtr) { if (LCPtr) {
RuleList *rules = _rooms[RoomNum]._rules; RuleList *rules = _rooms[g_lab->_roomNum]._rules;
if ((rules == NULL) && (roomNum == 0)) { if ((rules == NULL) && (roomNum == 0)) {
g_lab->_resource->readViews(roomNum); g_lab->_resource->readViews(roomNum);
@ -700,13 +700,13 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) {
TLCPtr = getObject(x, y, *LCPtr); TLCPtr = getObject(x, y, *LCPtr);
if (doOperateRuleSub(ItemNum, RoomNum, TLCPtr, LCPtr, false)) if (doOperateRuleSub(ItemNum, g_lab->_roomNum, TLCPtr, LCPtr, false))
return true; return true;
else if (doOperateRuleSub(ItemNum, RoomNum, *LCPtr, LCPtr, false)) else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *LCPtr, LCPtr, false))
return true; return true;
else if (doOperateRuleSub(ItemNum, RoomNum, TLCPtr, LCPtr, true)) else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, TLCPtr, LCPtr, true))
return true; return true;
else if (doOperateRuleSub(ItemNum, RoomNum, *LCPtr, LCPtr, true)) else if (doOperateRuleSub(ItemNum, g_lab->_roomNum, *LCPtr, LCPtr, true))
return true; return true;
else { else {
NewFileName = CurFileName; NewFileName = CurFileName;
@ -728,7 +728,7 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) {
/* Goes thru the rules if the user tries to go forward. */ /* Goes thru the rules if the user tries to go forward. */
/*****************************************************************************/ /*****************************************************************************/
bool doGoForward(CloseDataPtr *LCPtr) { bool doGoForward(CloseDataPtr *LCPtr) {
RuleList *rules = _rooms[RoomNum]._rules; RuleList *rules = _rooms[g_lab->_roomNum]._rules;
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) {
@ -749,7 +749,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {
from++; from++;
to++; to++;
RuleList *rules = _rooms[RoomNum]._rules; RuleList *rules = _rooms[g_lab->_roomNum]._rules;
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if (((*rule)->RuleType == TURN) || if (((*rule)->RuleType == TURN) ||
@ -769,7 +769,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {
/* Goes thru the rules if the user tries to go to the main view */ /* Goes thru the rules if the user tries to go to the main view */
/*****************************************************************************/ /*****************************************************************************/
bool doMainView(CloseDataPtr *LCPtr) { bool doMainView(CloseDataPtr *LCPtr) {
RuleList *rules = _rooms[RoomNum]._rules; RuleList *rules = _rooms[g_lab->_roomNum]._rules;
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
if ((*rule)->RuleType == GOMAINVIEW) { if ((*rule)->RuleType == GOMAINVIEW) {
if (checkConditions((*rule)->Condition)) { if (checkConditions((*rule)->Condition)) {

View file

@ -132,7 +132,7 @@ bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &header) {
/*****************************************************************************/ /*****************************************************************************/
/* Writes the game out to disk. */ /* Writes the game out to disk. */
/*****************************************************************************/ /*****************************************************************************/
bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Common::String desc) { bool saveGame(uint16 Direction, uint16 Quarters, int slot, Common::String desc) {
uint16 i, j; uint16 i, j;
Common::String fileName = g_lab->generateSaveFileName(slot); Common::String fileName = g_lab->generateSaveFileName(slot);
Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); Common::SaveFileManager *saveFileManager = g_system->getSavefileManager();
@ -146,7 +146,7 @@ bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Commo
readPict(getPictName(&CPtr), true); readPict(getPictName(&CPtr), true);
writeSaveGameHeader(file, desc); writeSaveGameHeader(file, desc);
file->writeUint16LE(RoomNum); file->writeUint16LE(g_lab->_roomNum);
file->writeUint16LE(Direction); file->writeUint16LE(Direction);
file->writeUint16LE(Quarters); file->writeUint16LE(Quarters);
@ -185,7 +185,7 @@ bool saveGame(uint16 RoomNum, uint16 Direction, uint16 Quarters, int slot, Commo
/*****************************************************************************/ /*****************************************************************************/
/* Reads the game from disk. */ /* Reads the game from disk. */
/*****************************************************************************/ /*****************************************************************************/
bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot) { bool loadGame(uint16 *Direction, uint16 *Quarters, int slot) {
uint16 i, j; uint16 i, j;
Common::String fileName = g_lab->generateSaveFileName(slot); Common::String fileName = g_lab->generateSaveFileName(slot);
Common::SaveFileManager *saveFileManager = g_system->getSavefileManager(); Common::SaveFileManager *saveFileManager = g_system->getSavefileManager();
@ -196,7 +196,7 @@ bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot) {
SaveGameHeader header; SaveGameHeader header;
readSaveGameHeader(file, header); readSaveGameHeader(file, header);
*RoomNum = file->readUint16LE(); g_lab->_roomNum = file->readUint16LE();
*Direction = file->readUint16LE(); *Direction = file->readUint16LE();
*Quarters = file->readUint16LE(); *Quarters = file->readUint16LE();

View file

@ -90,7 +90,7 @@ extern BitMap *DispBitMap, *DrawBitMap;
extern char diffcmap[3 * 256]; extern char diffcmap[3 * 256];
extern CloseDataPtr CPtr; extern CloseDataPtr CPtr;
extern InventoryData *Inventory; extern InventoryData *Inventory;
extern uint16 RoomNum, Direction; extern uint16 Direction;
#define COMBINATIONUNLOCKED 130 #define COMBINATIONUNLOCKED 130
#define BRICKOPEN 115 #define BRICKOPEN 115
@ -828,14 +828,14 @@ bool saveRestoreGame() {
desc = dialog->createDefaultSaveDescription(slot); desc = dialog->createDefaultSaveDescription(slot);
} }
isOK = saveGame(RoomNum, Direction, Inventory[QUARTERNUM].Many, slot, desc); isOK = saveGame(Direction, Inventory[QUARTERNUM].Many, slot, desc);
} }
} else { } else {
// Restore // Restore
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false); GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
int slot = dialog->runModalWithCurrentTarget(); int slot = dialog->runModalWithCurrentTarget();
if (slot >= 0) { if (slot >= 0) {
isOK = loadGame(&RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), slot); isOK = loadGame(&Direction, &(Inventory[QUARTERNUM].Many), slot);
if (isOK) if (isOK)
g_lab->_music->resetMusic(); g_lab->_music->resetMusic();
} }

View file

@ -73,7 +73,7 @@ uint16 textHeight(struct TextFont *tf) {
/*****************************************************************************/ /*****************************************************************************/
/* Draws the text to the screen. */ /* Draws the text to the screen. */
/*****************************************************************************/ /*****************************************************************************/
void text(struct TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars) { void text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char *text, uint16 numchars) {
byte *VGATop, *VGACur, *VGATemp, *VGATempLine, *cdata; byte *VGATop, *VGACur, *VGATemp, *VGATempLine, *cdata;
uint32 RealOffset, SegmentOffset; uint32 RealOffset, SegmentOffset;
int32 templeft, LeftInSegment; int32 templeft, LeftInSegment;