aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-05-18 21:03:57 +0000
committerMax Horn2003-05-18 21:03:57 +0000
commit7171c5bcd4063be192c94be93555b15f9eb59622 (patch)
tree5f9968fe95c51b83b69374488710a13010d45acb /scumm
parent6b7484f320ddcdf197c8b863bb60ef9aad8f72ae (diff)
downloadscummvm-rg350-7171c5bcd4063be192c94be93555b15f9eb59622.tar.gz
scummvm-rg350-7171c5bcd4063be192c94be93555b15f9eb59622.tar.bz2
scummvm-rg350-7171c5bcd4063be192c94be93555b15f9eb59622.zip
cleanup
svn-id: r7646
Diffstat (limited to 'scumm')
-rw-r--r--scumm/object.cpp2
-rw-r--r--scumm/resource.cpp2
-rw-r--r--scumm/script.cpp8
-rw-r--r--scumm/script_v6.cpp44
-rw-r--r--scumm/script_v8.cpp12
5 files changed, 34 insertions, 34 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index d4ca4eb2bf..b523b1b7ee 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -827,7 +827,7 @@ void Scumm::removeObjectFromRoom(int obj) {
void Scumm::addObjectToDrawQue(int object) {
_drawObjectQue[_drawObjectQueNr++] = object;
- if ((unsigned int)_drawObjectQueNr > sizeof(_drawObjectQue) / sizeof(_drawObjectQue[0]))
+ if ((unsigned int)_drawObjectQueNr > ARRAYSIZE(_drawObjectQue))
error("Draw Object Que overflow");
}
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 75f15a0406..4ef190c25c 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -522,7 +522,7 @@ void Scumm::readResTypeList(int id, uint32 tag, const char *name) {
void Scumm::allocResTypeData(int id, uint32 tag, int num, const char *name, int mode) {
debug(9, "allocResTypeData(%s/%s,%x,%d,%d)", resTypeFromId(id), name, FROM_LE_32(tag), num, mode);
- assert(id >= 0 && id < (int)(sizeof(res.mode) / sizeof(res.mode[0])));
+ assert(id >= 0 && id < (int)(ARRAYSIZE(res.mode)));
if (num >= 2000) {
error("Too many %ss (%d) in directory", name, num);
diff --git a/scumm/script.cpp b/scumm/script.cpp
index eee13ad4a8..4d92ee48f6 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -103,7 +103,7 @@ void Scumm::stopScriptNr(int script) {
if (_numNestedScripts == 0)
return;
- nest = &vm.nest[0];
+ nest = vm.nest;
num = _numNestedScripts;
do {
@@ -141,7 +141,7 @@ void Scumm::stopObjectScript(int script) {
if (_numNestedScripts == 0)
return;
- nest = &vm.nest[0];
+ nest = vm.nest;
num = _numNestedScripts;
do {
@@ -187,7 +187,7 @@ void Scumm::runScriptNested(int script) {
nest->slot = _currentScript;
}
- if (++_numNestedScripts > sizeof(vm.nest) / sizeof(vm.nest[0]))
+ if (++_numNestedScripts > ARRAYSIZE(vm.nest))
error("Too many nested scripts");
_currentScript = script;
@@ -1049,7 +1049,7 @@ void Scumm::cutscene(int *args) {
int scr = _currentScript;
vm.slot[scr].cutsceneOverride++;
- if (++vm.cutSceneStackPointer > sizeof(vm.cutSceneData) / sizeof(vm.cutSceneData[0]))
+ if (++vm.cutSceneStackPointer > ARRAYSIZE(vm.cutSceneData))
error("Cutscene stack overflow");
vm.cutSceneData[vm.cutSceneStackPointer] = args[0];
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index d931a29d83..9ffcb94a03 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -683,7 +683,7 @@ void Scumm_v6::o6_startScriptEx() {
int args[16];
int script, flags;
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
script = pop();
flags = pop();
runScript(script, flags & 1, flags & 2, args);
@@ -693,7 +693,7 @@ void Scumm_v6::o6_jumpToScript() {
int args[16];
int script, flags;
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
script = pop();
flags = pop();
stopObjectCode();
@@ -703,7 +703,7 @@ void Scumm_v6::o6_jumpToScript() {
void Scumm_v6::o6_startScript() {
int args[16];
int script;
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
script = pop();
runScript(script, 0, 0, args);
}
@@ -711,7 +711,7 @@ void Scumm_v6::o6_startScript() {
void Scumm_v6::o6_startScriptQuick() {
int args[16];
int script;
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
script = pop();
runScript(script, 0, 1, args);
}
@@ -720,7 +720,7 @@ void Scumm_v6::o6_startObjectEx() {
int args[16];
int script, entryp;
int flags;
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
entryp = pop();
script = pop();
flags = pop();
@@ -730,7 +730,7 @@ void Scumm_v6::o6_startObjectEx() {
void Scumm_v6::o6_startObjectQuick() {
int args[16];
int script, entryp;
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
entryp = pop();
script = pop();
runVerbCode(script, entryp, 0, 1, args);
@@ -764,7 +764,7 @@ void Scumm_v6::o6_endCutscene() {
void Scumm_v6::o6_cutscene() {
int args[16];
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
cutscene(args);
}
@@ -828,7 +828,7 @@ void Scumm_v6::o6_cursorCommand() {
initCharset(pop());
break;
case 0x9D: /* set charset colors */
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
for (i = 0; i < 16; i++)
_charsetColorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)args[i];
break;
@@ -854,7 +854,7 @@ void Scumm_v6::o6_ifClassOfIs() {
bool b;
int cond = 1;
- num = getStackList(args, sizeof(args) / sizeof(args[0]));
+ num = getStackList(args, ARRAYSIZE(args));
obj = pop();
while (--num >= 0) {
@@ -870,7 +870,7 @@ void Scumm_v6::o6_setClass() {
int args[16];
int num, obj, cls;
- num = getStackList(args, sizeof(args) / sizeof(args[0]));
+ num = getStackList(args, ARRAYSIZE(args));
obj = pop();
while (--num >= 0) {
@@ -1341,7 +1341,7 @@ void Scumm_v6::o6_setBoxFlags() {
int num, value;
value = pop();
- num = getStackList(table, sizeof(table) / sizeof(table[0]));
+ num = getStackList(table, ARRAYSIZE(table));
while (--num >= 0) {
setBoxFlags(table[num], value);
@@ -1612,7 +1612,7 @@ void Scumm_v6::o6_actorOps() {
a->setActorWalkSpeed(i, j);
break;
case 78: /* actor-sound */
- k = getStackList(args, sizeof(args) / sizeof(args[0]));
+ k = getStackList(args, ARRAYSIZE(args));
for (i = 0; i < k; i++)
a->sound[i] = args[i];
break;
@@ -1892,7 +1892,7 @@ void Scumm_v6::o6_pseudoRoom() {
int list[100];
int num, a, value;
- num = getStackList(list, sizeof(list) / sizeof(list[0]));
+ num = getStackList(list, ARRAYSIZE(list));
value = pop();
while (--num >= 0) {
@@ -1936,7 +1936,7 @@ void Scumm_v6::o6_arrayOps() {
break;
case 212:
b = pop();
- len = getStackList(list, sizeof(list) / sizeof(list[0]));
+ len = getStackList(list, ARRAYSIZE(list));
d = readVar(array);
if (d == 0)
error("Must DIM a two dimensional array before assigning");
@@ -2088,7 +2088,7 @@ void Scumm_v6::o6_wait() {
void Scumm_v6::o6_soundKludge() {
int list[16];
- int num = getStackList(list, sizeof(list) / sizeof(list[0]));
+ int num = getStackList(list, ARRAYSIZE(list));
_sound->soundKludge(list, num);
}
@@ -2098,7 +2098,7 @@ void Scumm_v6::o6_isAnyOf() {
int num;
int16 val;
- num = getStackList(list, sizeof(list) / sizeof(list[0]));
+ num = getStackList(list, ARRAYSIZE(list));
val = pop();
while (--num >= 0) {
@@ -2321,7 +2321,7 @@ void Scumm_v6::o6_drawBlastObject() {
int args[16];
int a, b, c, d, e;
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
e = pop();
d = pop();
c = pop();
@@ -2348,7 +2348,7 @@ void Scumm_v6::o6_kernelSetFunctions() {
int args[30];
Actor *a;
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
if (_features & GF_AFTER_V7) {
switch (args[0]) {
@@ -2656,7 +2656,7 @@ void Scumm_v6::o6_kernelGetFunctions() {
int i;
Actor *a;
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
switch (args[0]) {
case 113:
@@ -2767,7 +2767,7 @@ void Scumm_v6::o6_pickOneOf() {
int args[100];
int i, num;
- num = getStackList(args, sizeof(args) / sizeof(args[0]));
+ num = getStackList(args, ARRAYSIZE(args));
i = pop();
if (i < 0 || i >= num)
error("o6_pickOneOf: out of range");
@@ -2779,7 +2779,7 @@ void Scumm_v6::o6_pickOneOfDefault() {
int i, num, def;
def = pop();
- num = getStackList(args, sizeof(args) / sizeof(args[0]));
+ num = getStackList(args, ARRAYSIZE(args));
i = pop();
if (i < 0 || i >= num)
i = def;
@@ -2896,7 +2896,7 @@ void Scumm_v6::o6_pickVarRandom() {
int args[100];
int var_C, var_A;
- num = getStackList(args, sizeof(args) / sizeof(args[0]));
+ num = getStackList(args, ARRAYSIZE(args));
int value = fetchScriptWord();
if (readVar(value) == 0) {
diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp
index 7df6758823..b263cdeece 100644
--- a/scumm/script_v8.cpp
+++ b/scumm/script_v8.cpp
@@ -750,7 +750,7 @@ void Scumm_v8::o8_arrayOps() {
break;
case 0x15: // SO_ASSIGN_SCUMMVAR_LIST
b = pop();
- len = getStackList(list, sizeof(list) / sizeof(list[0]));
+ len = getStackList(list, ARRAYSIZE(list));
d = readVar(array);
if (d == 0) {
defineArray(array, 5, 0, b + len);
@@ -761,7 +761,7 @@ void Scumm_v8::o8_arrayOps() {
break;
case 0x16: // SO_ASSIGN_2DIM_LIST
b = pop();
- len = getStackList(list, sizeof(list) / sizeof(list[0]));
+ len = getStackList(list, ARRAYSIZE(list));
d = readVar(array);
if (d == 0)
error("Must DIM a two dimensional array before assigning");
@@ -838,7 +838,7 @@ void Scumm_v8::o8_cursorCommand() {
break;
}
case 0xE8: // SO_CHARSET_COLOR
- getStackList(args, sizeof(args) / sizeof(args[0]));
+ getStackList(args, ARRAYSIZE(args));
for (i = 0; i < 16; i++)
_charsetColorMap[i] = _charsetData[_string[1].t_charset][i] = (unsigned char)args[i];
break;
@@ -1318,7 +1318,7 @@ void Scumm_v8::o8_verbOps() {
void Scumm_v8::o8_soundKludge() {
int args[16];
- int num = getStackList(args, sizeof(args) / sizeof(args[0]));
+ int num = getStackList(args, ARRAYSIZE(args));
_sound->soundKludge(args, num);
}
@@ -1355,7 +1355,7 @@ void Scumm_v8::o8_kernelSetFunctions() {
// TODO
Actor *a;
int args[30];
- int len = getStackList(args, sizeof(args) / sizeof(args[0]));
+ int len = getStackList(args, ARRAYSIZE(args));
switch (args[0]) {
case 11: { // lockObject
@@ -1499,7 +1499,7 @@ void Scumm_v8::o8_kernelSetFunctions() {
void Scumm_v8::o8_kernelGetFunctions() {
// TODO
int args[30];
- int len = getStackList(args, sizeof(args) / sizeof(args[0]));
+ int len = getStackList(args, ARRAYSIZE(args));
switch (args[0]) {
case 0x73: // getWalkBoxAt