aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debug.cpp2
-rw-r--r--object.cpp55
-rw-r--r--saveload.cpp4
-rw-r--r--script.cpp59
-rw-r--r--script_v1.cpp4
-rw-r--r--script_v2.cpp4
-rw-r--r--scumm.h20
-rw-r--r--scummvm.cpp19
-rw-r--r--sound.cpp6
-rw-r--r--verbs.cpp2
10 files changed, 98 insertions, 77 deletions
diff --git a/debug.cpp b/debug.cpp
index ed04faf699..fa2166131c 100644
--- a/debug.cpp
+++ b/debug.cpp
@@ -187,7 +187,7 @@ void ScummDebugger::printScripts() {
ss = &_s->vm.slot[i];
if (ss->number) {
printf("|%2d|%3d|%3d|%3d|%3d|%3d|%2d|%3d|%3d|\n",
- i, ss->number, ss->status, ss->type, ss->unk1, ss->unk2, ss->freezeCount, ss->cutsceneOverride, ss->unk5);
+ i, ss->number, ss->status, ss->where, ss->unk1, ss->unk2, ss->freezeCount, ss->cutsceneOverride, ss->unk5);
}
}
printf("+---------------------------------+\n");
diff --git a/object.cpp b/object.cpp
index 50eace4e25..a661a2095f 100644
--- a/object.cpp
+++ b/object.cpp
@@ -45,13 +45,13 @@ void Scumm::putClass(int obj, int cls, bool set) {
int Scumm::getOwner(int obj) {
checkRange(_numGlobalObjects-1, 0, obj, "Object %d out of range in getOwner");
- return _objectFlagTable[obj]&0xF;
+ return _objectFlagTable[obj]&OF_OWNER_MASK;
}
void Scumm::putOwner(int act, int owner) {
checkRange(_numGlobalObjects-1, 0, act, "Object %d out of range in putOwner");
checkRange(15, 0, owner, "Owner %d out of range in putOwner");
- _objectFlagTable[act] = (_objectFlagTable[act]&0xF0) | owner;
+ _objectFlagTable[act] = (_objectFlagTable[act]&~OF_OWNER_MASK) | owner;
}
int Scumm::getState(int act) {
@@ -62,13 +62,14 @@ int Scumm::getState(int act) {
void Scumm::putState(int act, int state) {
checkRange(_numGlobalObjects-1, 0, act, "Object %d out of range in putState");
checkRange(15, 0, state, "State %d out of range in putState");
- _objectFlagTable[act] = (_objectFlagTable[act]&0x0F) | (state<<4);
+ _objectFlagTable[act] = (_objectFlagTable[act]&~OF_STATE_MASK) |
+ (state<<OF_STATE_SHL);
}
int Scumm::getObjectIndex(int object) {
int i;
- if ((_objectFlagTable[object]&0xF)!=0xF) {
+ if ((_objectFlagTable[object]&OF_OWNER_MASK)!=OF_OWNER_ROOM) {
for (i=0; i<_maxInventoryItems; i++)
if (_inventory[i] == object)
return i;
@@ -86,22 +87,22 @@ int Scumm::whereIsObject(int object) {
int i;
if (object >= _numGlobalObjects)
- return -1;
+ return WIO_NOT_FOUND;
- if ((_objectFlagTable[object]&0xF)!=0xF) {
+ if ((_objectFlagTable[object]&OF_OWNER_MASK)!=OF_OWNER_ROOM) {
for (i=0; i<_maxInventoryItems; i++)
if (_inventory[i] == object)
- return 0;
- return -1;
+ return WIO_INVENTORY;
+ return WIO_NOT_FOUND;
}
for (i=_numObjectsInRoom; i>0; i--)
if (_objs[i].obj_nr == object) {
if (_objs[i].fl_object_index)
- return 4;
- return 1;
+ return WIO_FLOBJECT;
+ return WIO_ROOM;
}
- return -1;
+ return WIO_NOT_FOUND;
}
int Scumm::getObjectOrActorXY(int object) {
@@ -109,10 +110,10 @@ int Scumm::getObjectOrActorXY(int object) {
return getActorXYPos(derefActorSafe(object, "getObjectOrActorXY"));
}
switch(whereIsObject(object)) {
- case -1:
+ case WIO_NOT_FOUND:
return -1;
- case 0:
- return getActorXYPos(derefActorSafe(_objectFlagTable[object]&0xF,"getObjectOrActorXY(2)"));
+ case WIO_INVENTORY:
+ return getActorXYPos(derefActorSafe(_objectFlagTable[object]&OF_OWNER_MASK,"getObjectOrActorXY(2)"));
}
getObjectXYPos(object);
return 0;
@@ -208,7 +209,7 @@ int Scumm::findObject(int x, int y) {
return _objs[i].obj_nr;
break;
}
- } while ( (_objs[b].ownerstate&0xF0) == a);
+ } while ( (_objs[b].ownerstate&OF_STATE_MASK) == a);
}
return 0;
}
@@ -223,7 +224,7 @@ void Scumm::drawRoomObjects(int arg) {
do {
od = &_objs[num];
- if (!od->obj_nr || !(od->ownerstate&0xF0))
+ if (!od->obj_nr || !(od->ownerstate&OF_STATE_MASK))
continue;
do {
@@ -233,7 +234,7 @@ void Scumm::drawRoomObjects(int arg) {
break;
}
od = &_objs[od->parent];
- } while ((od->ownerstate & 0xF0)==a);
+ } while ((od->ownerstate & OF_STATE_MASK)==a);
} while (--num);
}
@@ -387,7 +388,7 @@ void Scumm::loadRoomObjects() {
if (cdhd->v6.flags == 0x80) {
od->parentstate = 1<<4;
} else {
- od->parentstate = (cdhd->v6.flags&0xF)<<4;
+ od->parentstate = (cdhd->v6.flags&0xF)<<OF_STATE_SHL;
}
od->parent = cdhd->v6.parent;
od->actordir = cdhd->v6.actordir;
@@ -399,7 +400,7 @@ void Scumm::loadRoomObjects() {
if (cdhd->v5.flags == 0x80) {
od->parentstate = 1<<4;
} else {
- od->parentstate = (cdhd->v5.flags&0xF)<<4;
+ od->parentstate = (cdhd->v5.flags&0xF)<<OF_STATE_SHL;
}
od->parent = cdhd->v5.parent;
od->walk_x = READ_LE_UINT16(&cdhd->v5.walk_x);
@@ -437,7 +438,7 @@ void Scumm::clearOwnerOf(int obj) {
stopObjectScript(obj);
- if (getOwner(obj)==0xF) {
+ if (getOwner(obj)==OF_OWNER_ROOM) {
i = 0;
do {
if (_objs[i].obj_nr==obj) {
@@ -453,7 +454,7 @@ void Scumm::clearOwnerOf(int obj) {
for (i=1; i<_maxInventoryItems; i++) {
if (_inventory[i] == obj) {
j = whereIsObject(obj);
- if (j==0) {
+ if (j==WIO_INVENTORY) {
nukeResource(rtInventory, i);
_inventory[i] = 0;
}
@@ -518,7 +519,7 @@ byte *Scumm::getObjOrActorName(int obj) {
uint32 Scumm::getOBCDOffs(int object) {
int i;
- if ((_objectFlagTable[object]&0xF)!=0xF)
+ if ((_objectFlagTable[object]&OF_OWNER_MASK)!=OF_OWNER_ROOM)
return 0;
for (i=_numObjectsInRoom; i>0; i--) {
if (_objs[i].obj_nr == object) {
@@ -533,7 +534,7 @@ uint32 Scumm::getOBCDOffs(int object) {
byte *Scumm::getObjectAddress(int obj) {
int i;
- if ((_objectFlagTable[obj]&0xF)!=0xF) {
+ if ((_objectFlagTable[obj]&OF_OWNER_MASK)!=OF_OWNER_ROOM) {
for(i=0; i<_maxInventoryItems; i++) {
if (_inventory[i] == obj)
return getResourceAddress(rtInventory, i);
@@ -563,7 +564,7 @@ void Scumm::addObjectToInventory(uint obj, uint room) {
CHECK_HEAP
- if (whereIsObject(obj)==4) {
+ if (whereIsObject(obj)==WIO_FLOBJECT) {
i = getObjectIndex(obj);
ptr = getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 64;
size = READ_BE_UINT32_UNALIGNED(ptr+4);
@@ -619,7 +620,7 @@ void Scumm::setOwnerOf(int obj, int owner) {
if (owner==0) {
clearOwnerOf(obj);
ss = &vm.slot[_currentScript];
- if (ss->type==0 && _inventory[ss->number]==obj) {
+ if (ss->where==WIO_INVENTORY && _inventory[ss->number]==obj) {
putOwner(obj, 0);
runHook(0);
stopObjectCode();
@@ -634,7 +635,7 @@ int Scumm::getObjX(int obj) {
if (obj <= _vars[VAR_NUM_ACTOR]) {
return derefActorSafe(obj,"getObjX")->x;
} else {
- if (whereIsObject(obj)==-1)
+ if (whereIsObject(obj)==WIO_NOT_FOUND)
return -1;
getObjectOrActorXY(obj);
return _xPos;
@@ -645,7 +646,7 @@ int Scumm::getObjY(int obj) {
if (obj <= _vars[VAR_NUM_ACTOR]) {
return derefActorSafe(obj,"getObjY")->y;
} else {
- if (whereIsObject(obj)==-1)
+ if (whereIsObject(obj)==WIO_NOT_FOUND)
return -1;
getObjectOrActorXY(obj);
return _yPos;
diff --git a/saveload.cpp b/saveload.cpp
index 446ec65f10..49c4cdd1e9 100644
--- a/saveload.cpp
+++ b/saveload.cpp
@@ -386,7 +386,7 @@ void Scumm::saveOrLoad(Serializer *s) {
MKLINE(ScriptSlot,number,sleUint16),
MKLINE(ScriptSlot,newfield,sleUint16),
MKLINE(ScriptSlot,status,sleByte),
- MKLINE(ScriptSlot,type,sleByte),
+ MKLINE(ScriptSlot,where,sleByte),
MKLINE(ScriptSlot,unk1,sleByte),
MKLINE(ScriptSlot,unk2,sleByte),
MKLINE(ScriptSlot,freezeCount,sleByte),
@@ -398,7 +398,7 @@ void Scumm::saveOrLoad(Serializer *s) {
const SaveLoadEntry nestedScriptEntries[] = {
MKLINE(NestedScript,number,sleUint16),
- MKLINE(NestedScript,type,sleByte),
+ MKLINE(NestedScript,where,sleByte),
MKLINE(NestedScript,slot,sleByte),
MKEND()
};
diff --git a/script.cpp b/script.cpp
index bb639c1a6b..eec8d2b4d8 100644
--- a/script.cpp
+++ b/script.cpp
@@ -45,13 +45,13 @@ void Scumm::runScript(int script, int a, int b, int16 *lvarptr) {
if (script < _numGlobalScripts) {
scriptPtr = getResourceAddress(rtScript, script);
scriptOffs = 8;
- scriptType = 2;
+ scriptType = WIO_GLOBAL;
} else {
scriptOffs = _localScriptList[script - _numGlobalScripts];
if (scriptOffs == 0)
error("Local script %d is not in room %d", script, _roomResource);
scriptOffs += 9;
- scriptType = 3;
+ scriptType = WIO_LOCAL;
}
slot = getScriptSlot();
@@ -60,7 +60,7 @@ void Scumm::runScript(int script, int a, int b, int16 *lvarptr) {
s->number = script;
s->offs = scriptOffs;
s->status = 2;
- s->type = scriptType;
+ s->where = scriptType;
s->unk1 = a;
s->unk2 = b;
s->freezeCount = 0;
@@ -81,7 +81,8 @@ void Scumm::stopScriptNr(int script) {
ss = &vm.slot[1];
for (i=1; i<NUM_SCRIPT_SLOT; i++,ss++) {
- if (script!=ss->number || ss->type!=2 && ss->type!=3 || ss->status==0)
+ if (script!=ss->number ||
+ ss->where!=WIO_GLOBAL && ss->where!=WIO_LOCAL || ss->status==0)
continue;
if (ss->cutsceneOverride)
@@ -99,10 +100,10 @@ void Scumm::stopScriptNr(int script) {
num = _numNestedScripts;
do {
- if (nest->number == script && (nest->type==2 || nest->type==3)) {
+ if (nest->number == script && (nest->where==WIO_GLOBAL || nest->where==WIO_LOCAL)) {
nest->number = 0xFF;
nest->slot = 0xFF;
- nest->type = 0xFF;
+ nest->where = 0xFF;
}
} while(nest++,--num);
}
@@ -118,7 +119,8 @@ void Scumm::stopObjectScript(int script) {
ss = &vm.slot[1];
for (i=1; i<NUM_SCRIPT_SLOT; i++,ss++) {
- if (script==ss->number && (ss->type==1 || ss->type==0 || ss->type==4) && ss->status!=0) {
+ if (script==ss->number && (ss->where==WIO_ROOM ||
+ ss->where==WIO_INVENTORY || ss->where==WIO_FLOBJECT) && ss->status!=0) {
if (ss->cutsceneOverride)
error("Object %d stopped with active cutscene/override", script);
ss->number = 0;
@@ -135,10 +137,12 @@ void Scumm::stopObjectScript(int script) {
num = _numNestedScripts;
do {
- if (nest->number == script && (nest->type==1 || nest->type==4 || nest->type==0)) {
+ if (nest->number == script &&
+ (nest->where==WIO_ROOM || nest->where==WIO_FLOBJECT ||
+ nest->where==WIO_INVENTORY)) {
nest->number = 0xFF;
nest->slot = 0xFF;
- nest->type = 0xFF;
+ nest->where = 0xFF;
}
} while(nest++,--num);
}
@@ -165,11 +169,11 @@ void Scumm::runScriptNested(int script) {
if (_currentScript==0xFF) {
nest->number = 0xFF;
- nest->type = 0xFF;
+ nest->where = 0xFF;
} else {
slot = &vm.slot[_currentScript];
nest->number = slot->number;
- nest->type = slot->type;
+ nest->where = slot->where;
nest->slot = _currentScript;
}
@@ -188,7 +192,7 @@ void Scumm::runScriptNested(int script) {
if (nest->number != 0xFF) {
slot = &vm.slot[nest->slot];
- if (slot->number == nest->number && slot->type==nest->type &&
+ if (slot->number == nest->number && slot->where==nest->where &&
slot->status != 0 && slot->freezeCount==0) {
_currentScript = nest->slot;
getScriptBaseAddress();
@@ -214,25 +218,25 @@ void Scumm::getScriptBaseAddress() {
return;
ss = &vm.slot[_currentScript];
- switch(ss->type) {
- case 0: /* inventory script **/
+ switch(ss->where) {
+ case WIO_INVENTORY: /* inventory script **/
index = getObjectIndex(ss->number);
_scriptOrgPointer = getResourceAddress(rtInventory, index);
_lastCodePtr = &_baseInventoryItems[index];
break;
case 3:
- case 1: /* room script */
+ case WIO_ROOM: /* room script */
_scriptOrgPointer = getResourceAddress(rtRoom, _roomResource);
_lastCodePtr = &_baseRooms[_roomResource];
break;
- case 2: /* global script */
+ case WIO_GLOBAL: /* global script */
_scriptOrgPointer = getResourceAddress(rtScript, ss->number);
_lastCodePtr = &_baseScripts[ss->number];
break;
- case 4: /* flobject script */
+ case WIO_FLOBJECT: /* flobject script */
index = getObjectIndex(ss->number);
_scriptOrgPointer = getResourceAddress(rtFlObject,_objs[index].fl_object_index);
_lastCodePtr = &_baseFLObject[ss->number];
@@ -419,7 +423,7 @@ void Scumm::stopObjectCode() {
ss = &vm.slot[_currentScript];
- if (ss->type!=2 && ss->type!=3) {
+ if (ss->where!=WIO_GLOBAL && ss->where!=WIO_LOCAL) {
if (ss->cutsceneOverride)
error("Object %d ending with active cutscene/override", ss->number);
@@ -515,7 +519,7 @@ void Scumm::runExitScript() {
int slot = getScriptSlot();
vm.slot[slot].status = 2;
vm.slot[slot].number = 10001;
- vm.slot[slot].type = 1;
+ vm.slot[slot].where = WIO_ROOM;
vm.slot[slot].offs = _EXCD_offs + 8;
vm.slot[slot].unk1 = 0;
vm.slot[slot].unk2 = 0;
@@ -533,7 +537,7 @@ void Scumm::runEntryScript() {
int slot = getScriptSlot();
vm.slot[slot].status = 2;
vm.slot[slot].number = 10002;
- vm.slot[slot].type = 1;
+ vm.slot[slot].where = WIO_ROOM;
vm.slot[slot].offs = _ENCD_offs + 8;
vm.slot[slot].unk1 = 0;
vm.slot[slot].unk2 = 0;
@@ -551,11 +555,11 @@ void Scumm::killScriptsAndResources() {
ss = &vm.slot[1];
for (i=1; i<NUM_SCRIPT_SLOT; i++,ss++) {
- if (ss->type==1 || ss->type==4) {
+ if (ss->where==WIO_ROOM || ss->where==WIO_FLOBJECT) {
if(ss->cutsceneOverride)
error("Object %d stopped with active cutscene/override in exit", ss->number);
ss->status = 0;
- } else if (ss->type==3) {
+ } else if (ss->where==WIO_LOCAL) {
if(ss->cutsceneOverride)
error("Script %d stopped with active cutscene/override in exit", ss->number);
ss->status = 0;
@@ -573,7 +577,7 @@ void Scumm::killScriptsAndResources() {
if (_newNames) {
for (i=0; i<50; i++) {
int j = _newNames[i];
- if (j && (getOwner(j)&0xF) == 0) {
+ if (j && (getOwner(j)&OF_OWNER_MASK) == 0) {
_newNames[i] = 0;
nukeResource(rtObjectName, i);
}
@@ -645,7 +649,7 @@ void Scumm::runVerbCode(int object, int entry, int a, int b, int16 *vars) {
where = whereIsObject(object);
- if (where == -1) {
+ if (where == WIO_NOT_FOUND) {
error("Code for object %d not in room %d", object, _roomResource);
}
@@ -659,7 +663,7 @@ void Scumm::runVerbCode(int object, int entry, int a, int b, int16 *vars) {
vm.slot[slot].number = object;
vm.slot[slot].offs = obcd + offs;
vm.slot[slot].status = 2;
- vm.slot[slot].type = where;
+ vm.slot[slot].where = where;
vm.slot[slot].unk1 = a;
vm.slot[slot].unk2 = b;
vm.slot[slot].freezeCount = 0;
@@ -685,7 +689,7 @@ int Scumm::getVerbEntrypoint(int obj, int entry) {
byte *objptr, *verbptr;
int verboffs;
- if (whereIsObject(obj)==-1)
+ if (whereIsObject(obj)==WIO_NOT_FOUND)
return 0;
objptr = getObjectAddress(obj);
@@ -822,7 +826,8 @@ int Scumm::getScriptRunning(int script) {
int i;
ScriptSlot *ss = vm.slot;
for (i=0; i<NUM_SCRIPT_SLOT; i++,ss++)
- if (ss->number==script && (ss->type==2 || ss->type==3) && ss->status)
+ if (ss->number==script && (ss->where==WIO_GLOBAL ||
+ ss->where==WIO_LOCAL) && ss->status)
return 1;
return 0;
}
diff --git a/script_v1.cpp b/script_v1.cpp
index 3852d6e698..910f10942a 100644
--- a/script_v1.cpp
+++ b/script_v1.cpp
@@ -1201,7 +1201,7 @@ void Scumm::o5_putActorAtObject() {
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_putActorAtObject");
obj = getVarOrDirectWord(0x40);
- if (whereIsObject(obj)!=-1)
+ if (whereIsObject(obj)!=WIO_NOT_FOUND)
getObjectXYPos(obj);
else {
_xPos = 240;
@@ -1884,7 +1884,7 @@ void Scumm::o5_walkActorToObject() {
a = derefActorSafe(getVarOrDirectByte(0x80), "o5_walkActorToObject");
obj = getVarOrDirectWord(0x40);
- if (whereIsObject(obj)!=-1) {
+ if (whereIsObject(obj)!=WIO_NOT_FOUND) {
getObjectXYPos(obj);
startWalkActor(a, _xPos, _yPos, _dir);
}
diff --git a/script_v2.cpp b/script_v2.cpp
index c4957b49bb..0f7403a9c9 100644
--- a/script_v2.cpp
+++ b/script_v2.cpp
@@ -852,7 +852,7 @@ void Scumm::o6_walkActorToObj() {
a = derefActorSafe(pop(), "o6_walkActorToObj");
if (obj >= 17) {
- if (whereIsObject(obj)==-1)
+ if (whereIsObject(obj)==WIO_NOT_FOUND)
return;
getObjectXYPos(obj);
startWalkActor(a, _xPos, _yPos, _dir);
@@ -909,7 +909,7 @@ void Scumm::o6_putActorAtObject() {
obj = pop();
a = derefActorSafe(pop(), "o6_putActorAtObject");
- if (whereIsObject(obj)!=-1) {
+ if (whereIsObject(obj)!=WIO_NOT_FOUND) {
getObjectXYPos(obj);
x = _xPos;
y = _yPos;
diff --git a/scumm.h b/scumm.h
index 2242128575..04db276adb 100644
--- a/scumm.h
+++ b/scumm.h
@@ -203,7 +203,7 @@ struct ScriptSlot {
uint16 number;
uint16 newfield;
byte status;
- byte type;
+ byte where;
byte unk1,unk2,freezeCount,didexec;
byte cutsceneOverride;
byte unk5;
@@ -211,7 +211,7 @@ struct ScriptSlot {
struct NestedScript {
uint16 number;
- uint8 type;
+ uint8 where;
uint8 slot;
};
@@ -320,9 +320,14 @@ enum ResTypes {
rtBox = 15,
rtObjectName = 16,
rtLast = 16,
-
rtNumTypes = 17,
+};
+enum {
+ OF_OWNER_MASK = 0x0F,
+ OF_STATE_MASK = 0xF0,
+ OF_OWNER_ROOM = 0x0F,
+ OF_STATE_SHL = 4
};
#define _maxRooms res.num[rtRoom]
@@ -603,6 +608,15 @@ enum GameId {
struct ScummDebugger;
struct Serializer;
+enum WhereIsObject {
+ WIO_NOT_FOUND = -1,
+ WIO_INVENTORY = 0,
+ WIO_ROOM = 1,
+ WIO_GLOBAL = 2,
+ WIO_LOCAL = 3,
+ WIO_FLOBJECT = 4,
+};
+
struct Scumm {
const char *_gameText;
byte _gameId;
diff --git a/scummvm.cpp b/scummvm.cpp
index 2c983c27d1..cbccfcafc4 100644
--- a/scummvm.cpp
+++ b/scummvm.cpp
@@ -169,7 +169,7 @@ void Scumm::initScummVars() {
_vars[VAR_FIXEDDISK] = checkFixedDisk();
_vars[VAR_SOUNDCARD] = _soundCardType;
_vars[VAR_VIDEOMODE] = 0x13;
- _vars[VAR_HEAPSPACE] = 600;
+ _vars[VAR_HEAPSPACE] = 630;
_vars[VAR_MOUSEPRESENT] = _mousePresent;
_vars[VAR_SOUNDPARAM] = _soundParam;
_vars[VAR_SOUNDPARAM2] = _soundParam2;
@@ -417,8 +417,8 @@ static const VersionSettings version_settings[] = {
{"monkey2", "Monkey Island 2: LeChuck's revenge", GID_MONKEY2, 5, 2, 2},
{"atlantis", "Indiana Jones 4 and the Fate of Atlantis", GID_INDY4, 5, 5, 0},
{"playfate", "Indiana Jones 4 and the Fate of Atlantis (Demo)", GID_INDY4, 5, 5, 0},
- {"tentacle", "Day Of The Tenctacle", GID_TENTACLE, 6, 4, 2},
- {"dottdemo", "Day Of The Tenctacle (Demo)", GID_TENTACLE, 6, 3, 2},
+ {"tentacle", "Day Of The Tentacle", GID_TENTACLE, 6, 4, 2},
+ {"dottdemo", "Day Of The Tentacle (Demo)", GID_TENTACLE, 6, 3, 2},
{"samnmax", "Sam & Max", GID_SAMNMAX, 6, 4, 2},
{"snmdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, 3, 0},
{NULL,NULL}
@@ -457,7 +457,7 @@ char *Scumm::getGameName() {
}
void Scumm::startScene(int room, Actor *a, int objectNr) {
- int i;
+ int i,where;
Actor *at;
CHECK_HEAP
@@ -470,11 +470,12 @@ void Scumm::startScene(int room, Actor *a, int objectNr) {
_newEffect = _switchRoomEffect;
if (_currentScript!=0xFF) {
- if (vm.slot[_currentScript].type==1 || vm.slot[_currentScript].type==4) {
+ if (vm.slot[_currentScript].where==WIO_ROOM ||
+ vm.slot[_currentScript].where==WIO_FLOBJECT) {
if(vm.slot[_currentScript].cutsceneOverride!=0)
error("Object %d stopped with active cutscene/override in exit", vm.slot[_currentScript].number);
_currentScript = 0xFF;
- } else if (vm.slot[_currentScript].type==3) {
+ } else if (vm.slot[_currentScript].where==WIO_LOCAL) {
if (vm.slot[_currentScript].cutsceneOverride!=0)
error("Script %d stopped with active cutscene/override in exit", vm.slot[_currentScript].number);
_currentScript = 0xFF;
@@ -543,9 +544,9 @@ void Scumm::startScene(int room, Actor *a, int objectNr) {
memset(actorDrawBits, 0, sizeof(actorDrawBits));
if (a) {
- if (whereIsObject(objectNr)!=1 &&
- whereIsObject(objectNr)!=4)
- error("startScene: Object %d is not in room %d", objectNr, _currentRoom);
+ where = whereIsObject(objectNr);
+ if (where != WIO_ROOM && where!=WIO_FLOBJECT)
+ error("startScene: Object %d is not in room %d", objectNr, _currentRoom);
getObjectXYPos(objectNr);
putActor(a, _xPos, _yPos, _currentRoom);
startAnimActor(a, 0x3E, _dir^1);
diff --git a/sound.cpp b/sound.cpp
index 3b654597cb..d4304d5f22 100644
--- a/sound.cpp
+++ b/sound.cpp
@@ -38,7 +38,7 @@ struct SoundEngine {
void Scumm::addSoundToQueue(int sound) {
_vars[VAR_LAST_SOUND] = sound;
- ensureResourceLoaded(4, sound);
+ ensureResourceLoaded(rtSound, sound);
addSoundToQueue2(sound);
}
@@ -201,7 +201,7 @@ int Scumm::isSoundRunning(int sound) {
if (isSoundInQueue(sound))
return 1;
- if (!isResourceLoaded(4, sound))
+ if (!isResourceLoaded(rtSound, sound))
return 0;
@@ -290,7 +290,7 @@ static const uint32 sound_tags[] = {
void Scumm::setupSound() {
SoundEngine *se = (SoundEngine*)_soundDriver;
if (se) {
- se->_base_sounds = res.address[4];
+ se->_base_sounds = res.address[rtSound];
}
_soundTagTable = (byte*)sound_tags;
_numSoundTags = 1;
diff --git a/verbs.cpp b/verbs.cpp
index 6c65606cf4..a4c742af37 100644
--- a/verbs.cpp
+++ b/verbs.cpp
@@ -250,7 +250,7 @@ void Scumm::setVerbObject(uint room, uint object, uint verb) {
ImageHeader *imhd;
RoomHeader *roomhdr;
- if (whereIsObject(object) == 4)
+ if (whereIsObject(object) == WIO_FLOBJECT)
error("Can't grab verb image from flobject");
ensureResourceLoaded(rtRoom,room);