diff options
author | Filippos Karapetis | 2015-12-13 19:31:40 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-23 21:34:03 +0100 |
commit | 1524e20ef1f55d4af9ded4e599d3dda26f93e0b7 (patch) | |
tree | 20dced53a4866dd33f08f1f9b6248e0c1c6dc6f1 /engines/lab | |
parent | c883769adc7ca1dcf5c2157a6ea09238ead59a56 (diff) | |
download | scummvm-rg350-1524e20ef1f55d4af9ded4e599d3dda26f93e0b7.tar.gz scummvm-rg350-1524e20ef1f55d4af9ded4e599d3dda26f93e0b7.tar.bz2 scummvm-rg350-1524e20ef1f55d4af9ded4e599d3dda26f93e0b7.zip |
LAB: Simplify the room doors array
Diffstat (limited to 'engines/lab')
-rw-r--r-- | engines/lab/processroom.cpp | 12 | ||||
-rw-r--r-- | engines/lab/processroom.h | 5 | ||||
-rw-r--r-- | engines/lab/resource.cpp | 8 |
3 files changed, 6 insertions, 19 deletions
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 7b9e4132c9..c754d288b7 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -180,17 +180,7 @@ void LabEngine::drawDirection(CloseDataPtr closePtr) { */ uint16 LabEngine::processArrow(uint16 curDirection, uint16 arrow) { if (arrow == 1) { // Forward - uint16 room = 1; - - if (curDirection == NORTH) - room = _rooms[_roomNum]._northDoor; - else if (curDirection == SOUTH) - room = _rooms[_roomNum]._southDoor; - else if (curDirection == EAST) - room = _rooms[_roomNum]._eastDoor; - else if (curDirection == WEST) - room = _rooms[_roomNum]._westDoor; - + uint16 room = _rooms[_roomNum]._doors[curDirection]; if (room != 0) _roomNum = room; diff --git a/engines/lab/processroom.h b/engines/lab/processroom.h index 97c7cdce4f..1d3316ed7e 100644 --- a/engines/lab/processroom.h +++ b/engines/lab/processroom.h @@ -127,10 +127,7 @@ struct Rule { }; struct RoomData { - uint16 _northDoor; - uint16 _southDoor; - uint16 _eastDoor; - uint16 _westDoor; + uint16 _doors[4]; byte _transitionType; ViewData *_view[4]; RuleList *_rules; diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index 3f615c7a7a..cb29bc6407 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -98,10 +98,10 @@ bool Resource::readRoomData(const char *fileName) { memset(_vm->_rooms, 0, (_vm->_manyRooms + 1) * sizeof(RoomData)); for (uint16 i = 1; i <= _vm->_manyRooms; i++) { - _vm->_rooms[i]._northDoor = dataFile->readUint16LE(); - _vm->_rooms[i]._southDoor = dataFile->readUint16LE(); - _vm->_rooms[i]._eastDoor = dataFile->readUint16LE(); - _vm->_rooms[i]._westDoor = dataFile->readUint16LE(); + _vm->_rooms[i]._doors[NORTH] = dataFile->readUint16LE(); + _vm->_rooms[i]._doors[SOUTH] = dataFile->readUint16LE(); + _vm->_rooms[i]._doors[EAST] = dataFile->readUint16LE(); + _vm->_rooms[i]._doors[WEST] = dataFile->readUint16LE(); _vm->_rooms[i]._transitionType = dataFile->readByte(); _vm->_rooms[i]._view[NORTH] = nullptr; |