aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2005-04-10 17:38:09 +0000
committerMax Horn2005-04-10 17:38:09 +0000
commit78f6b7a1d8f125e8d8dcd552fca515b610a3ede0 (patch)
treef079d8c348852b525174b68a09aaed20b6adaa17
parent8df392cabe96b76d93ef922fcccb79d38cb1d622 (diff)
downloadscummvm-rg350-78f6b7a1d8f125e8d8dcd552fca515b610a3ede0.tar.gz
scummvm-rg350-78f6b7a1d8f125e8d8dcd552fca515b610a3ede0.tar.bz2
scummvm-rg350-78f6b7a1d8f125e8d8dcd552fca515b610a3ede0.zip
cleanup
svn-id: r17525
-rw-r--r--scumm/resource.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 781195d43c..e032af215d 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -46,7 +46,7 @@ static const byte *findResourceSmall(uint32 tag, const byte *searchin);
/* Open a room */
-void ScummEngine::openRoom(int room) {
+void ScummEngine::openRoom(const int room) {
int room_offs;
bool result;
char buf[128];
@@ -68,6 +68,8 @@ void ScummEngine::openRoom(int room) {
return;
}
+ const int diskNumber = (room == 0 ? 0 : res.roomno[rtRoom][room]);
+
/* Either xxx.lfl or monkey.xxx file name */
while (1) {
room_offs = room ? res.roomoffs[rtRoom][room] : 0;
@@ -92,10 +94,10 @@ void ScummEngine::openRoom(int room) {
if (openResourceFile(buf, encByte)) {
return;
}
- askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
+ askForDisk(buf, diskNumber);
} else {
- sprintf(buf, "disk%.2d.lec", room == 0 ? 0 : res.roomno[rtRoom][room]);
+ sprintf(buf, "disk%.2d.lec", diskNumber);
encByte = 0x69;
}
} else {
@@ -121,15 +123,15 @@ void ScummEngine::openRoom(int room) {
} else if (_version >= 7) {
if (room > 0 && (_version == 8))
VAR(VAR_CURRENTDISK) = res.roomno[rtRoom][room];
- sprintf(buf, "%s.la%d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
+ sprintf(buf, "%s.la%d", _gameName.c_str(), diskNumber);
- sprintf(buf2, "%s.%.3d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
+ sprintf(buf2, "%s.%.3d", _gameName.c_str(), diskNumber);
} else if (_features & GF_HUMONGOUS) {
- sprintf(buf, "%s.he%.1d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
+ sprintf(buf, "%s.he%.1d", _gameName.c_str(), diskNumber);
} else {
- sprintf(buf, "%s.%.3d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
+ sprintf(buf, "%s.%.3d", _gameName.c_str(), diskNumber);
if (_gameId == GID_SAMNMAX)
- sprintf(buf2, "%s.sm%.1d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
+ sprintf(buf2, "%s.sm%.1d", _gameName.c_str(), diskNumber);
}
encByte = (_features & GF_USE_KEY) ? 0x69 : 0;
@@ -166,7 +168,7 @@ void ScummEngine::openRoom(int room) {
error("Room %d not in %s", room, buf);
return;
}
- askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
+ askForDisk(buf, diskNumber);
}
do {
@@ -174,7 +176,7 @@ void ScummEngine::openRoom(int room) {
encByte = 0;
if (openResourceFile(buf, encByte))
break;
- askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
+ askForDisk(buf, diskNumber);
} while (1);
deleteRoomOffsets();