NUM_ACTORS -> _numActors (for consistency)

svn-id: r7489
This commit is contained in:
Max Horn 2003-05-13 23:42:41 +00:00
parent 0ee0e7f634
commit 08f7ec192e
14 changed files with 48 additions and 48 deletions

View file

@ -773,7 +773,7 @@ void Scumm::showActors() {
int i; int i;
Actor *a; Actor *a;
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
a = derefActor(i); a = derefActor(i);
if (a->isInCurrentRoom()) if (a->isInCurrentRoom())
a->showActor(); a->showActor();
@ -784,7 +784,7 @@ void Scumm::walkActors() {
int i; int i;
Actor *a; Actor *a;
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
a = derefActor(i); a = derefActor(i);
if (a->isInCurrentRoom()) if (a->isInCurrentRoom())
// FIXME: really V3, or should it maybe be GF_SMALL_HEADER // FIXME: really V3, or should it maybe be GF_SMALL_HEADER
@ -800,12 +800,12 @@ void Scumm::playActorSounds() {
int i; int i;
Actor *a; Actor *a;
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
a = derefActor(i); a = derefActor(i);
if (a->cost.animCounter2 && a->isInCurrentRoom() && a->sound) { if (a->cost.animCounter2 && a->isInCurrentRoom() && a->sound) {
_currentScript = 0xFF; _currentScript = 0xFF;
_sound->addSoundToQueue(a->sound[0]); _sound->addSoundToQueue(a->sound[0]);
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
a = derefActor(i); a = derefActor(i);
a->cost.animCounter2 = 0; a->cost.animCounter2 = 0;
} }
@ -822,10 +822,10 @@ void Scumm::processActors() {
Actor **actors, *a, **ac, **ac2, *tmp, **end; Actor **actors, *a, **ac, **ac2, *tmp, **end;
int numactors = 0; int numactors = 0;
actors = new Actor * [NUM_ACTORS]; actors = new Actor * [_numActors];
// Make a list of all actors in this room // Make a list of all actors in this room
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
a = derefActor(i); a = derefActor(i);
if ((_features & GF_AFTER_V8) && a->layer < 0) if ((_features & GF_AFTER_V8) && a->layer < 0)
continue; continue;
@ -870,7 +870,7 @@ void Scumm::processUpperActors() {
Actor *a; Actor *a;
int i; int i;
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
a = derefActor(i); a = derefActor(i);
if (a->isInCurrentRoom() && a->costume && a->layer < 0) { if (a->isInCurrentRoom() && a->costume && a->layer < 0) {
CHECK_HEAP getMaskFromBox(a->walkbox); CHECK_HEAP getMaskFromBox(a->walkbox);
@ -1084,7 +1084,7 @@ void Scumm::setActorRedrawFlags(bool fg, bool bg) {
int i, j; int i, j;
if (_fullRedraw) { if (_fullRedraw) {
for (j = 1; j < NUM_ACTORS; j++) { for (j = 1; j < _numActors; j++) {
Actor *a = derefActor(j); Actor *a = derefActor(j);
a->needRedraw |= fg; a->needRedraw |= fg;
a->needBgReset |= bg; a->needBgReset |= bg;
@ -1093,7 +1093,7 @@ void Scumm::setActorRedrawFlags(bool fg, bool bg) {
for (i = 0; i < gdi._numStrips; i++) { for (i = 0; i < gdi._numStrips; i++) {
int strip = _screenStartStrip + i; int strip = _screenStartStrip + i;
if (testGfxAnyUsageBits(strip)) { if (testGfxAnyUsageBits(strip)) {
for (j = 1; j < NUM_ACTORS; j++) { for (j = 1; j < _numActors; j++) {
if (testGfxUsageBit(strip, j) && testGfxOtherUsageBits(strip, j)) { if (testGfxUsageBit(strip, j) && testGfxOtherUsageBits(strip, j)) {
Actor *a = derefActor(j); Actor *a = derefActor(j);
assert(a->number == j); assert(a->number == j);
@ -1111,7 +1111,7 @@ int Scumm::getActorFromPos(int x, int y) {
if (!testGfxAnyUsageBits(x >> 3)) if (!testGfxAnyUsageBits(x >> 3))
return 0; return 0;
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
Actor *a = derefActor(i); Actor *a = derefActor(i);
assert(a->number == i); assert(a->number == i);
if (testGfxUsageBit(x >> 3, i) && !getClass(i, 32) && y >= a->top && y <= a->bottom) { if (testGfxUsageBit(x >> 3, i) && !getClass(i, 32) && y >= a->top && y <= a->bottom) {
@ -1562,7 +1562,7 @@ void Scumm::resetActorBgs() {
for (i = 0; i < gdi._numStrips; i++) { for (i = 0; i < gdi._numStrips; i++) {
int strip = _screenStartStrip + i; int strip = _screenStartStrip + i;
for (j = 1; j < NUM_ACTORS; j++) { for (j = 1; j < _numActors; j++) {
a = derefActor(j); a = derefActor(j);
if (testGfxUsageBit(strip, j) && a->top != 0xFF && a->needBgReset) { if (testGfxUsageBit(strip, j) && a->top != 0xFF && a->needBgReset) {
clearGfxUsageBit(strip, j); clearGfxUsageBit(strip, j);
@ -1572,7 +1572,7 @@ void Scumm::resetActorBgs() {
} }
} }
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
a = derefActor(i); a = derefActor(i);
a->needBgReset = false; a->needBgReset = false;
} }

View file

@ -1414,7 +1414,7 @@ bool Scumm::isCostumeInUse(int cost) {
Actor *a; Actor *a;
if (_roomResource != 0) if (_roomResource != 0)
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
a = derefActor(i); a = derefActor(i);
if (a->isInCurrentRoom() && a->costume == cost) if (a->isInCurrentRoom() && a->costume == cost)
return true; return true;

View file

@ -343,7 +343,7 @@ void ScummDebugger::printActors(int act)
printf("+--------------------------------------------------------------------+\n"); printf("+--------------------------------------------------------------------+\n");
printf("|# |room| x | y |elev|cos|width|box|mov| zp|frame|scale|spd|dir|cls|\n"); printf("|# |room| x | y |elev|cos|width|box|mov| zp|frame|scale|spd|dir|cls|\n");
printf("+--+----+----+----+----+---+-----+---+---+---+-----+-----+---+---+---+\n"); printf("+--+----+----+----+----+---+-----+---+---+---+-----+-----+---+---+---+\n");
for (i = 1; i < _s->NUM_ACTORS; i++) { for (i = 1; i < _s->_numActors; i++) {
if (act == -1 || act == i) { if (act == -1 || act == i) {
a = &_s->_actors[i]; a = &_s->_actors[i];
if (a->visible) if (a->visible)

View file

@ -515,8 +515,8 @@ bool ScummDebugger::Cmd_Actor(int argc, const char **argv) {
} }
actnum = atoi(argv[1]); actnum = atoi(argv[1]);
if (actnum >= _s->NUM_ACTORS) { if (actnum >= _s->_numActors) {
Debug_Printf("Actor %d is out of range (range: 1 - %d)\n", actnum, _s->NUM_ACTORS); Debug_Printf("Actor %d is out of range (range: 1 - %d)\n", actnum, _s->_numActors);
return true; return true;
} }
@ -547,7 +547,7 @@ bool ScummDebugger::Cmd_PrintActor(int argc, const char **argv) {
Debug_Printf("+--------------------------------------------------------------------+\n"); Debug_Printf("+--------------------------------------------------------------------+\n");
Debug_Printf("|# |room| x | y |elev|cos|width|box|mov| zp|frame|scale|spd|dir|cls|\n"); Debug_Printf("|# |room| x | y |elev|cos|width|box|mov| zp|frame|scale|spd|dir|cls|\n");
Debug_Printf("+--+----+----+----+----+---+-----+---+---+---+-----+-----+---+---+---+\n"); Debug_Printf("+--+----+----+----+----+---+-----+---+---+---+-----+-----+---+---+---+\n");
for (i = 1; i < _s->NUM_ACTORS; i++) { for (i = 1; i < _s->_numActors; i++) {
a = &_s->_actors[i]; a = &_s->_actors[i];
if (a->visible) if (a->visible)
Debug_Printf("|%2d|%4d|%4d|%4d|%4d|%3d|%5d|%3d|%3d|%3d|%5d|%5d|%3d|%3d|$%02x|\n", Debug_Printf("|%2d|%4d|%4d|%4d|%4d|%3d|%5d|%3d|%3d|%3d|%5d|%5d|%3d|%3d|$%02x|\n",

View file

@ -2017,7 +2017,7 @@ void Scumm::setCameraFollows(Actor *a) {
if (t - _screenStartStrip < camera._leftTrigger || t - _screenStartStrip > camera._rightTrigger) if (t - _screenStartStrip < camera._leftTrigger || t - _screenStartStrip > camera._rightTrigger)
setCameraAt(a->x, 0); setCameraAt(a->x, 0);
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
a = derefActor(i); a = derefActor(i);
if (a->isInCurrentRoom()) if (a->isInCurrentRoom())
a->needRedraw = true; a->needRedraw = true;

View file

@ -69,7 +69,7 @@ void Scumm::putClass(int obj, int cls, bool set)
else else
_classData[obj] &= ~(1 << (cls - 1)); _classData[obj] &= ~(1 << (cls - 1));
if (1 <= obj && obj < NUM_ACTORS) { if (1 <= obj && obj < _numActors) {
_actors[obj].classChanged(cls, set); _actors[obj].classChanged(cls, set);
} }
} }
@ -149,7 +149,7 @@ int Scumm::whereIsObject(int object) {
} }
int Scumm::getObjectOrActorXY(int object, int &x, int &y) { int Scumm::getObjectOrActorXY(int object, int &x, int &y) {
if (object < NUM_ACTORS) { if (object < _numActors) {
Actor *act = derefActorSafe(object, "getObjectOrActorXY"); Actor *act = derefActorSafe(object, "getObjectOrActorXY");
if (!act) if (!act)
return 0; return 0;
@ -161,7 +161,7 @@ int Scumm::getObjectOrActorXY(int object, int &x, int &y) {
case WIO_NOT_FOUND: case WIO_NOT_FOUND:
return -1; return -1;
case WIO_INVENTORY: case WIO_INVENTORY:
if (_objectOwnerTable[object] < NUM_ACTORS) if (_objectOwnerTable[object] < _numActors)
return derefActorSafe(_objectOwnerTable[object], "getObjectOrActorXY(2)")->getActorXYPos(x, y); return derefActorSafe(_objectOwnerTable[object], "getObjectOrActorXY(2)")->getActorXYPos(x, y);
else else
return 0xFF; return 0xFF;
@ -218,10 +218,10 @@ int Scumm::getObjActToObjActDist(int a, int b) {
Actor *acta = NULL; Actor *acta = NULL;
Actor *actb = NULL; Actor *actb = NULL;
if (a < NUM_ACTORS) if (a < _numActors)
acta = derefActorSafe(a, "getObjActToObjActDist"); acta = derefActorSafe(a, "getObjActToObjActDist");
if (b < NUM_ACTORS) if (b < _numActors)
actb = derefActorSafe(b, "getObjActToObjActDist(2)"); actb = derefActorSafe(b, "getObjActToObjActDist(2)");
if (acta && actb && acta->getRoom() == actb->getRoom() && acta->getRoom() && !acta->isInCurrentRoom()) if (acta && actb && acta->getRoom() == actb->getRoom() && acta->getRoom() && !acta->isInCurrentRoom())
@ -833,7 +833,7 @@ byte *Scumm::getObjOrActorName(int obj) {
byte *objptr; byte *objptr;
int i; int i;
if (obj < NUM_ACTORS) if (obj < _numActors)
return derefActorSafe(obj, "getObjOrActorName")->getActorName(); return derefActorSafe(obj, "getObjOrActorName")->getActorName();
if (_features & GF_SMALL_HEADER) { if (_features & GF_SMALL_HEADER) {
@ -1131,7 +1131,7 @@ void Scumm::setOwnerOf(int obj, int owner) {
} }
int Scumm::getObjX(int obj) { int Scumm::getObjX(int obj) {
if (obj < NUM_ACTORS) { if (obj < _numActors) {
if (obj < 1) if (obj < 1)
return 0; /* fix for indy4's map */ return 0; /* fix for indy4's map */
return derefActorSafe(obj, "getObjX")->x; return derefActorSafe(obj, "getObjX")->x;
@ -1145,7 +1145,7 @@ int Scumm::getObjX(int obj) {
} }
int Scumm::getObjY(int obj) { int Scumm::getObjY(int obj) {
if (obj < NUM_ACTORS) { if (obj < _numActors) {
if (obj < 1) if (obj < 1)
return 0; /* fix for indy4's map */ return 0; /* fix for indy4's map */
return derefActorSafe(obj, "getObjY")->y; return derefActorSafe(obj, "getObjY")->y;
@ -1164,7 +1164,7 @@ int Scumm::getObjOldDir(int obj) {
int Scumm::getObjNewDir(int obj) { int Scumm::getObjNewDir(int obj) {
int dir; int dir;
if (obj < NUM_ACTORS) { if (obj < _numActors) {
dir = derefActorSafe(obj, "getObjNewDir")->facing; dir = derefActorSafe(obj, "getObjNewDir")->facing;
} else { } else {
int x, y; int x, y;
@ -1230,7 +1230,7 @@ int Scumm::getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e,
if (is_obj_1) { if (is_obj_1) {
if (getObjectOrActorXY(b, x, y) == -1) if (getObjectOrActorXY(b, x, y) == -1)
return -1; return -1;
if (b < NUM_ACTORS) if (b < _numActors)
i = derefActorSafe(b, "unkObjProc1")->scalex; i = derefActorSafe(b, "unkObjProc1")->scalex;
} else { } else {
x = b; x = b;
@ -1240,7 +1240,7 @@ int Scumm::getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e,
if (is_obj_2) { if (is_obj_2) {
if (getObjectOrActorXY(e, x2, y2) == -1) if (getObjectOrActorXY(e, x2, y2) == -1)
return -1; return -1;
if (e < NUM_ACTORS) if (e < _numActors)
j = derefActorSafe(e, "unkObjProc1(2)")->scalex; j = derefActorSafe(e, "unkObjProc1(2)")->scalex;
} else { } else {
x2 = e; x2 = e;

View file

@ -1753,7 +1753,7 @@ void Scumm::allocateArrays() {
allocResTypeData(rtInventory, MKID('NONE'), _numInventory, "inventory", 0); allocResTypeData(rtInventory, MKID('NONE'), _numInventory, "inventory", 0);
allocResTypeData(rtTemp, MKID('NONE'), 10, "temp", 0); allocResTypeData(rtTemp, MKID('NONE'), 10, "temp", 0);
allocResTypeData(rtScaleTable, MKID('NONE'), 5, "scale table", 0); allocResTypeData(rtScaleTable, MKID('NONE'), 5, "scale table", 0);
allocResTypeData(rtActorName, MKID('NONE'), NUM_ACTORS, "actor name", 0); allocResTypeData(rtActorName, MKID('NONE'), _numActors, "actor name", 0);
allocResTypeData(rtVerb, MKID('NONE'), _numVerbs, "verb", 0); allocResTypeData(rtVerb, MKID('NONE'), _numVerbs, "verb", 0);
allocResTypeData(rtString, MKID('NONE'), _numArray, "array", 0); allocResTypeData(rtString, MKID('NONE'), _numArray, "array", 0);
allocResTypeData(rtFlObject, MKID('NONE'), _numFlObject, "flobject", 0); allocResTypeData(rtFlObject, MKID('NONE'), _numFlObject, "flobject", 0);

View file

@ -607,7 +607,7 @@ void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion) {
if (!s->isSaving() && savegameVersion < VER_V14) if (!s->isSaving() && savegameVersion < VER_V14)
upgradeGfxUsageBits(); upgradeGfxUsageBits();
s->saveLoadArrayOf(_actors, NUM_ACTORS, sizeof(_actors[0]), actorEntries); s->saveLoadArrayOf(_actors, _numActors, sizeof(_actors[0]), actorEntries);
if (savegameVersion < VER_V9) if (savegameVersion < VER_V9)
s->saveLoadArrayOf(vm.slot, 25, sizeof(vm.slot[0]), scriptSlotEntries); s->saveLoadArrayOf(vm.slot, 25, sizeof(vm.slot[0]), scriptSlotEntries);

View file

@ -1115,7 +1115,7 @@ void Scumm_v2::o2_setObjectName() {
} while (a); } while (a);
work[i] = 0; work[i] = 0;
if (obj < NUM_ACTORS) if (obj < _numActors)
error("Can't set actor %d name with new-name-of", obj); error("Can't set actor %d name with new-name-of", obj);
name = getObjOrActorName(obj); name = getObjOrActorName(obj);

View file

@ -539,7 +539,7 @@ void Scumm_v5::o5_setClass() {
newClass = getVarOrDirectWord(0x80); newClass = getVarOrDirectWord(0x80);
if (newClass == 0) { if (newClass == 0) {
_classData[obj] = 0; _classData[obj] = 0;
if ((_features & GF_SMALL_HEADER) && obj <= NUM_ACTORS) { if ((_features & GF_SMALL_HEADER) && obj <= _numActors) {
Actor *a; Actor *a;
a = derefActorSafe(obj, "setClass"); a = derefActorSafe(obj, "setClass");
a->ignoreBoxes = 0; a->ignoreBoxes = 0;
@ -1924,7 +1924,7 @@ void Scumm_v5::o5_setObjectName() {
} }
work[i] = 0; work[i] = 0;
if (obj < NUM_ACTORS) if (obj < _numActors)
error("Can't set actor %d name with new-name-of", obj); error("Can't set actor %d name with new-name-of", obj);
if (!getOBCDFromObject(obj)) { if (!getOBCDFromObject(obj)) {

View file

@ -989,7 +989,7 @@ void Scumm_v6::o6_walkActorToObj() {
if (!a) if (!a)
return; return;
if (obj >= NUM_ACTORS) { if (obj >= _numActors) {
if (whereIsObject(obj) == WIO_NOT_FOUND) if (whereIsObject(obj) == WIO_NOT_FOUND)
return; return;
int y, dir; int y, dir;
@ -1296,7 +1296,7 @@ void Scumm_v6::o6_setObjectName() {
int obj = pop(); int obj = pop();
int i; int i;
if (obj < NUM_ACTORS) if (obj < _numActors)
error("Can't set actor %d name with new-name-of", obj); error("Can't set actor %d name with new-name-of", obj);
if (!(_features & GF_AFTER_V7) && !getOBCDFromObject(obj)) if (!(_features & GF_AFTER_V7) && !getOBCDFromObject(obj))

View file

@ -868,7 +868,7 @@ void Scumm_v8::o8_createBoxMatrix() {
createBoxMatrix(); createBoxMatrix();
for(i = 1; i < NUM_ACTORS; i++) { for(i = 1; i < _numActors; i++) {
a = &_actors[i]; a = &_actors[i];
if (a && a->isInCurrentRoom()) if (a && a->isInCurrentRoom())
a->adjustActorPos(); a->adjustActorPos();

View file

@ -379,7 +379,7 @@ public:
Gdi gdi; Gdi gdi;
protected: protected:
Actor *_actors; // Has NUM_ACTORS elements Actor *_actors; // Has _numActors elements
uint16 *_inventory; uint16 *_inventory;
byte *_arrays; byte *_arrays;
@ -411,7 +411,7 @@ protected:
int _numGlobalObjects, _numArray, _numVerbs, _numFlObject; int _numGlobalObjects, _numArray, _numVerbs, _numFlObject;
int _numInventory, _numRooms, _numScripts, _numSounds; int _numInventory, _numRooms, _numScripts, _numSounds;
int _numCharsets, _numNewNames, _numGlobalScripts; int _numCharsets, _numNewNames, _numGlobalScripts;
int NUM_ACTORS; int _numActors;
public: public:
int _numCostumes; // FIXME - should be protected, used by Actor::remapActorPalette int _numCostumes; // FIXME - should be protected, used by Actor::remapActorPalette

View file

@ -232,7 +232,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
_numCharsets = 0; _numCharsets = 0;
_numNewNames = 0; _numNewNames = 0;
_numGlobalScripts = 0; _numGlobalScripts = 0;
NUM_ACTORS = 0; _numActors = 0;
_numCostumes = 0; _numCostumes = 0;
_audioNames = NULL; _audioNames = NULL;
_numAudioNames = 0; _numAudioNames = 0;
@ -683,8 +683,8 @@ void Scumm::scummInit() {
setupCursor(); setupCursor();
// Allocate and Initialize actors // Allocate and Initialize actors
_actors = new Actor[NUM_ACTORS]; _actors = new Actor[_numActors];
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
a = derefActor(i); a = derefActor(i);
a->number = i; a->number = i;
a->initActorClass(this); a->initActorClass(this);
@ -1110,7 +1110,7 @@ void Scumm::startScene(int room, Actor * a, int objectNr) {
clearEnqueue(); clearEnqueue();
stopCycle(0); stopCycle(0);
for (i = 1; i < NUM_ACTORS; i++) { for (i = 1; i < _numActors; i++) {
at = derefActor(i); at = derefActor(i);
at->hideActor(); at->hideActor();
} }
@ -1886,7 +1886,7 @@ Actor *Scumm::derefActor(int id) {
} }
Actor *Scumm::derefActorSafe(int id, const char *errmsg) { Actor *Scumm::derefActorSafe(int id, const char *errmsg) {
if (id < 1 || id >= NUM_ACTORS) { if (id < 1 || id >= _numActors) {
debug(2, "Invalid actor %d in %s (script %d, opcode 0x%x) - This is potentially a BIG problem.", debug(2, "Invalid actor %d in %s (script %d, opcode 0x%x) - This is potentially a BIG problem.",
id, errmsg, vm.slot[_curExecScript].number, _opcode); id, errmsg, vm.slot[_curExecScript].number, _opcode);
return NULL; return NULL;
@ -2202,13 +2202,13 @@ void Scumm::launch() {
setupOpcodes(); setupOpcodes();
if (_features & GF_AFTER_V8) if (_features & GF_AFTER_V8)
NUM_ACTORS = 80; _numActors = 80;
else if ((_features & GF_AFTER_V7) || (_gameId == GID_SAMNMAX)) else if ((_features & GF_AFTER_V7) || (_gameId == GID_SAMNMAX))
NUM_ACTORS = 30; _numActors = 30;
else if (_gameId == GID_MANIAC) else if (_gameId == GID_MANIAC)
NUM_ACTORS = 24; // Temporary (?) hack to get to the character selection screen _numActors = 24;
else else
NUM_ACTORS = 13; _numActors = 13;
if (_features & GF_AFTER_V7) if (_features & GF_AFTER_V7)
OF_OWNER_ROOM = 0xFF; OF_OWNER_ROOM = 0xFF;