aboutsummaryrefslogtreecommitdiff
path: root/scumm/resource.cpp
diff options
context:
space:
mode:
authorMax Horn2003-05-08 15:48:50 +0000
committerMax Horn2003-05-08 15:48:50 +0000
commit98881c3a6a513c27a06e596c29e0b40b355844f6 (patch)
treea6ddbd3a2e3aa483bae3d82e63fa2ccb6fc40f13 /scumm/resource.cpp
parent6ab104cc3ca433b672318b3e9bde26f7e882940c (diff)
downloadscummvm-rg350-98881c3a6a513c27a06e596c29e0b40b355844f6.tar.gz
scummvm-rg350-98881c3a6a513c27a06e596c29e0b40b355844f6.tar.bz2
scummvm-rg350-98881c3a6a513c27a06e596c29e0b40b355844f6.zip
init all VAR_* variables to 0xFF; replaced access to _vars in the form _vars[VAR_*] by VARS(VAR_*) which performs a validity checK; renamed _vars to _scummVars to make sure I updated all places; fixed two places where V6 and newer games would access V5 vars (but there are still some left, it seems); checked VAR access for now only generates a warning
svn-id: r7393
Diffstat (limited to 'scumm/resource.cpp')
-rw-r--r--scumm/resource.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 1ca9b5e1e0..1e070eb601 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -77,8 +77,8 @@ void Scumm::openRoom(int room) {
if (!(_features & GF_SMALL_HEADER)) {
if (_features & GF_AFTER_V7) {
- if (room > 0)
- _vars[VAR_CURRENTDISK] = res.roomno[rtRoom][room];
+ if (room > 0 && (_features & GF_AFTER_V8))
+ VAR(VAR_CURRENTDISK) = res.roomno[rtRoom][room];
sprintf(buf, "%s.la%d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
sprintf(buf2, "%s.%.3d", _exe_name, room == 0 ? 0 : res.roomno[rtRoom][room]);
} else if (_features & GF_HUMONGOUS)
@@ -586,7 +586,7 @@ void Scumm::ensureResourceLoaded(int type, int i) {
if (!(_features & GF_AFTER_V7) && !(_features & GF_SMALL_HEADER))
if (type == rtRoom && i == _roomResource)
- _vars[VAR_ROOM_FLAG] = 1;
+ VAR(VAR_ROOM_FLAG) = 1;
}
int Scumm::loadResource(int type, int idx) {
@@ -1253,9 +1253,9 @@ byte *Scumm::getStringAddress(int i) {
byte *Scumm::getStringAddressVar(int i) {
byte *addr;
- addr = getResourceAddress(rtString, _vars[i]);
+ addr = getResourceAddress(rtString, _scummVars[i]);
if (addr == NULL)
- error("NULL string var %d slot %d", i, _vars[i]);
+ error("NULL string var %d slot %d", i, _scummVars[i]);
if (_features & GF_NEW_OPCODES)
return ((ArrayHeader *)addr)->data;
@@ -1745,7 +1745,7 @@ void Scumm::allocateArrays() {
_verbs = (VerbSlot *)calloc(_numVerbs, sizeof(VerbSlot));
_objs = (ObjectData *)calloc(_numLocalObjects, sizeof(ObjectData));
debug(2, "Allocated %d space in numObjects\n", _numLocalObjects);
- _vars = (int32 *)calloc(_numVariables, sizeof(int32));
+ _scummVars = (int32 *)calloc(_numVariables, sizeof(int32));
_bitVars = (byte *)calloc(_numBitVariables >> 3, 1);
allocResTypeData(rtCostume, (_features & GF_NEW_COSTUMES) ? MKID('AKOS') : MKID('COST'),