aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2009-05-18 08:28:04 +0000
committerFilippos Karapetis2009-05-18 08:28:04 +0000
commit1e547f320c83d276834a432572a8ac61ccfe4fc8 (patch)
tree08c5d10ae55423b49bed045c12b29b4de8aab1d6 /engines
parent1239949ef2acf3179ef76fac1850aaa19792ffd9 (diff)
downloadscummvm-rg350-1e547f320c83d276834a432572a8ac61ccfe4fc8.tar.gz
scummvm-rg350-1e547f320c83d276834a432572a8ac61ccfe4fc8.tar.bz2
scummvm-rg350-1e547f320c83d276834a432572a8ac61ccfe4fc8.zip
Removed the unused file and line parameters from the list and list node lookup functions, and removed the LOOKUP_LIST and LOOKUP_NODE defines. Also, disabled the unused LOOKUP_SPECIES define
svn-id: r40676
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kernel.h11
-rw-r--r--engines/sci/engine/kgraphics.cpp14
-rw-r--r--engines/sci/engine/klists.cpp66
-rw-r--r--engines/sci/engine/kpathing.cpp22
-rw-r--r--engines/sci/engine/kstring.cpp6
-rw-r--r--engines/sci/engine/scriptdebug.cpp5
6 files changed, 60 insertions, 64 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index e8d2e82caf..cb5fa36be1 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -236,25 +236,18 @@ void _k_dyn_view_list_accept_change(EngineState *s);
void process_sound_events(EngineState *s); /* Get all sound events, apply their changes to the heap */
-#define LOOKUP_NODE(addr) lookup_node(s, (addr), __FILE__, __LINE__)
-#define LOOKUP_LIST(addr) lookup_list(s, addr, __FILE__, __LINE__)
-
-Node *lookup_node(EngineState *s, reg_t addr, const char *file, int line);
+Node *lookup_node(EngineState *s, reg_t addr);
/* Resolves an address into a list node
** Parameters: (EngineState *) s: The state to operate on
** (reg_t) addr: The address to resolve
-** (const char *) file: The file the function was called from
-** (int) line: The line number the function was called from
** Returns : (Node *) The list node referenced, or NULL on error
*/
-List *lookup_list(EngineState *s, reg_t addr, const char *file, int line);
+List *lookup_list(EngineState *s, reg_t addr);
/* Resolves a list pointer to a list
** Parameters: (EngineState *) s: The state to operate on
** (reg_t) addr: The address to resolve
-** (const char *) file: The file the function was called from
-** (int) line: The line number the function was called from
** Returns : (List *) The list referenced, or NULL on error
*/
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index fe7508f49d..5158361dc6 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -817,10 +817,10 @@ reg_t kCanBeHere(EngineState *s, int funct_nr, int argc, reg_t * argv) {
}
if (cliplist_ref.segment)
- cliplist = LOOKUP_LIST(cliplist_ref);
+ cliplist = lookup_list(s, cliplist_ref);
if (cliplist) {
- Node *node = LOOKUP_NODE(cliplist->first);
+ Node *node = lookup_node(s, cliplist->first);
retval = 0; // Assume that we Can'tBeHere...
@@ -838,7 +838,7 @@ reg_t kCanBeHere(EngineState *s, int funct_nr, int argc, reg_t * argv) {
}
} // if (other_obj != obj)
- node = LOOKUP_NODE(node->succ); // move on
+ node = lookup_node(s, node->succ); // move on
}
}
@@ -1983,7 +1983,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list,
BREAKPOINT();
}
- node = LOOKUP_NODE(list->first);
+ node = lookup_node(s, list->first);
while (node) {
reg_t obj = node->value; // The object we're using
reg_t next_node;
@@ -2008,7 +2008,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list,
if (tempWidget)
GFX_ASSERT((*widget_list)->add(GFXWC(*widget_list), tempWidget));
- node = LOOKUP_NODE(next_node); // Next node
+ node = lookup_node(s, next_node); // Next node
}
widget = (GfxDynView *)(*widget_list)->_contents;
@@ -2312,7 +2312,7 @@ reg_t kAddToPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return s->r_acc;
}
- list = LOOKUP_LIST(list_ref);
+ list = lookup_list(s, list_ref);
pic_views = gfxw_new_list(s->picture_port->_bounds, 1);
@@ -2976,7 +2976,7 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
// after all, damage the cast list
if (cast_list_ref.segment) {
- cast_list = LOOKUP_LIST(cast_list_ref);
+ cast_list = lookup_list(s, cast_list_ref);
if (!cast_list)
return s->r_acc;
}
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 2aa6ea2f48..9069bcdff4 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -28,7 +28,7 @@
namespace Sci {
-Node *lookup_node(EngineState *s, reg_t addr, const char *file, int line) {
+Node *lookup_node(EngineState *s, reg_t addr) {
if (!addr.offset && !addr.segment)
return NULL; // Non-error null
@@ -53,7 +53,7 @@ Node *lookup_node(EngineState *s, reg_t addr, const char *file, int line) {
return &(nt->_table[addr.offset]);
}
-List *lookup_list(EngineState *s, reg_t addr, const char *file, int line) {
+List *lookup_list(EngineState *s, reg_t addr) {
MemObject *mobj = GET_SEGMENT(*s->seg_manager, addr.segment, MEM_OBJ_LISTS);
if (!mobj) {
@@ -85,7 +85,7 @@ static int sane_nodep(EngineState *s, reg_t addr) {
reg_t prev = addr;
do {
- Node *node = LOOKUP_NODE(addr);
+ Node *node = lookup_node(s, addr);
if (!node)
return 0;
@@ -102,7 +102,7 @@ static int sane_nodep(EngineState *s, reg_t addr) {
}
int sane_listp(EngineState *s, reg_t addr) {
- List *l = LOOKUP_LIST(addr);
+ List *l = lookup_list(s, addr);
int empties = 0;
if (IS_NULL_REG(l->first))
@@ -117,8 +117,8 @@ int sane_listp(EngineState *s, reg_t addr) {
if (!empties) {
Node *node_a, *node_z;
- node_a = LOOKUP_NODE(l->first);
- node_z = LOOKUP_NODE(l->last);
+ node_a = lookup_node(s, l->first);
+ node_z = lookup_node(s, l->last);
if (!node_a || !node_z)
return 0;
@@ -147,7 +147,7 @@ reg_t kNewList(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
reg_t kDisposeList(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- List *l = LOOKUP_LIST(argv[0]);
+ List *l = lookup_list(s, argv[0]);
if (!l) {
// FIXME: This should be an error, but it's turned to a warning for now
@@ -162,7 +162,7 @@ reg_t kDisposeList(EngineState *s, int funct_nr, int argc, reg_t *argv) {
reg_t n_addr = l->first;
while (!IS_NULL_REG(n_addr)) { // Free all nodes
- Node *n = LOOKUP_NODE(n_addr);
+ Node *n = lookup_node(s, n_addr);
s->seg_manager->free_Node(n_addr);
n_addr = n->succ;
}
@@ -200,7 +200,7 @@ reg_t kNewNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
reg_t kFirstNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (IS_NULL_REG(argv[0]))
return NULL_REG;
- List *l = LOOKUP_LIST(argv[0]);
+ List *l = lookup_list(s, argv[0]);
if (l && !sane_listp(s, argv[0]))
error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
@@ -212,7 +212,7 @@ reg_t kFirstNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
reg_t kLastNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- List *l = LOOKUP_LIST(argv[0]);
+ List *l = lookup_list(s, argv[0]);
if (l && !sane_listp(s, argv[0]))
error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
@@ -224,7 +224,7 @@ reg_t kLastNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
reg_t kEmptyList(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- List *l = LOOKUP_LIST(argv[0]);
+ List *l = lookup_list(s, argv[0]);
if (!l || !sane_listp(s, argv[0]))
error("List at "PREG" is invalid or not sane anymore!\n", PRINT_REG(argv[0]));
@@ -233,8 +233,8 @@ reg_t kEmptyList(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
void _k_add_to_front(EngineState *s, reg_t listbase, reg_t nodebase) {
- List *l = LOOKUP_LIST(listbase);
- Node *new_n = LOOKUP_NODE(nodebase);
+ List *l = lookup_list(s, listbase);
+ Node *new_n = lookup_node(s, nodebase);
SCIkdebug(SCIkNODES, "Adding node "PREG" to end of list "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase));
@@ -250,15 +250,15 @@ void _k_add_to_front(EngineState *s, reg_t listbase, reg_t nodebase) {
if (IS_NULL_REG(l->first))
l->last = nodebase;
else {
- Node *old_n = LOOKUP_NODE(l->first);
+ Node *old_n = lookup_node(s, l->first);
old_n->pred = nodebase;
}
l->first = nodebase;
}
void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) {
- List *l = LOOKUP_LIST(listbase);
- Node *new_n = LOOKUP_NODE(nodebase);
+ List *l = lookup_list(s, listbase);
+ Node *new_n = lookup_node(s, nodebase);
SCIkdebug(SCIkNODES, "Adding node "PREG" to end of list "PREG"\n", PRINT_REG(nodebase), PRINT_REG(listbase));
@@ -274,14 +274,14 @@ void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) {
if (IS_NULL_REG(l->last))
l->first = nodebase;
else {
- Node *old_n = LOOKUP_NODE(l->last);
+ Node *old_n = lookup_node(s, l->last);
old_n->succ = nodebase;
}
l->last = nodebase;
}
reg_t kNextNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- Node *n = LOOKUP_NODE(argv[0]);
+ Node *n = lookup_node(s, argv[0]);
if (!sane_nodep(s, argv[0])) {
error("List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
script_error_flag = script_debug_flag = 0;
@@ -292,7 +292,7 @@ reg_t kNextNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
reg_t kPrevNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- Node *n = LOOKUP_NODE(argv[0]);
+ Node *n = lookup_node(s, argv[0]);
if (!sane_nodep(s, argv[0]))
error("List node at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
@@ -300,7 +300,7 @@ reg_t kPrevNode(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
reg_t kNodeValue(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- Node *n = LOOKUP_NODE(argv[0]);
+ Node *n = lookup_node(s, argv[0]);
if (!sane_nodep(s, argv[0])) {
error("List node at "PREG" is not sane!\n", PRINT_REG(argv[0]));
script_debug_flag = script_error_flag = 0;
@@ -316,9 +316,9 @@ reg_t kAddToFront(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
reg_t kAddAfter(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- List *l = LOOKUP_LIST(argv[0]);
- Node *firstnode = IS_NULL_REG(argv[1]) ? NULL : LOOKUP_NODE(argv[1]);
- Node *newnode = LOOKUP_NODE(argv[2]);
+ List *l =lookup_list(s, argv[0]);
+ Node *firstnode = IS_NULL_REG(argv[1]) ? NULL : lookup_node(s, argv[1]);
+ Node *newnode = lookup_node(s, argv[2]);
if (!l || !sane_listp(s, argv[0]))
error("List at "PREG" is not sane anymore!\n", PRINT_REG(argv[0]));
@@ -345,7 +345,7 @@ reg_t kAddAfter(EngineState *s, int funct_nr, int argc, reg_t *argv) {
// Set new node as last list node
l->last = argv[2];
else
- LOOKUP_NODE(oldnext)->pred = argv[2];
+ lookup_node(s, oldnext)->pred = argv[2];
return s->r_acc;
} else { // !firstnode
@@ -370,12 +370,12 @@ reg_t kFindKey(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (!sane_listp(s, list_pos))
error("List at "PREG" is not sane anymore!\n", PRINT_REG(list_pos));
- node_pos = LOOKUP_LIST(list_pos)->first;
+ node_pos = lookup_list(s, list_pos)->first;
SCIkdebug(SCIkNODES, "First node at "PREG"\n", PRINT_REG(node_pos));
while (!IS_NULL_REG(node_pos)) {
- Node *n = LOOKUP_NODE(node_pos);
+ Node *n = lookup_node(s, node_pos);
if (REG_EQ(n->key, key)) {
SCIkdebug(SCIkNODES, " Found key at "PREG"\n", PRINT_REG(node_pos));
return node_pos;
@@ -392,21 +392,21 @@ reg_t kFindKey(EngineState *s, int funct_nr, int argc, reg_t *argv) {
reg_t kDeleteKey(EngineState *s, int funct_nr, int argc, reg_t *argv) {
reg_t node_pos = kFindKey(s, funct_nr, 2, argv);
Node *n;
- List *l = LOOKUP_LIST(argv[0]);
+ List *l = lookup_list(s, argv[0]);
if (IS_NULL_REG(node_pos))
return NULL_REG; // Signal falure
- n = LOOKUP_NODE(node_pos);
+ n = lookup_node(s, node_pos);
if (REG_EQ(l->first, node_pos))
l->first = n->succ;
if (REG_EQ(l->last, node_pos))
l->last = n->pred;
if (!IS_NULL_REG(n->pred))
- LOOKUP_NODE(n->pred)->succ = n->succ;
+ lookup_node(s, n->pred)->succ = n->succ;
if (!IS_NULL_REG(n->succ))
- LOOKUP_NODE(n->succ)->pred = n->pred;
+ lookup_node(s, n->succ)->pred = n->pred;
//s->seg_manager->free_Node(node_pos);
@@ -458,8 +458,8 @@ reg_t kSort(EngineState *s, int funct_nr, int argc, reg_t *argv) {
PUT_SEL32V(dest, size, input_size);
- list = LOOKUP_LIST(input_data);
- node = LOOKUP_NODE(list->first);
+ list = lookup_list(s, input_data);
+ node = lookup_node(s, list->first);
i = 0;
while (node) {
@@ -468,7 +468,7 @@ reg_t kSort(EngineState *s, int funct_nr, int argc, reg_t *argv) {
temp_array[i].value = node->value;
temp_array[i].order = s->r_acc;
i++;
- node = LOOKUP_NODE(node->succ);
+ node = lookup_node(s, node->succ);
}
qsort(temp_array, input_size, sizeof(sort_temp_t), sort_temp_cmp);
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index fc3b47f132..d4d6e96437 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -385,18 +385,18 @@ static void draw_input(EngineState *s, reg_t poly_list, Common::Point start, Com
if (!poly_list.segment)
return;
- list = LOOKUP_LIST(poly_list);
+ list = lookup_list(s, poly_list);
if (!list) {
warning("[avoidpath] Could not obtain polygon list");
return;
}
- node = LOOKUP_NODE(list->first);
+ node = lookup_node(s, list->first);
while (node) {
draw_polygon(s, node->value);
- node = LOOKUP_NODE(node->succ);
+ node = lookup_node(s, node->succ);
}
}
@@ -431,7 +431,7 @@ static void print_input(EngineState *s, reg_t poly_list, Common::Point start, Co
if (!poly_list.segment)
return;
- list = LOOKUP_LIST(poly_list);
+ list = lookup_list(s, poly_list);
if (!list) {
warning("[avoidpath] Could not obtain polygon list");
@@ -439,11 +439,11 @@ static void print_input(EngineState *s, reg_t poly_list, Common::Point start, Co
}
sciprintf("Polygons:\n");
- node = LOOKUP_NODE(list->first);
+ node = lookup_node(s, list->first);
while (node) {
print_polygon(s, node->value);
- node = LOOKUP_NODE(node->succ);
+ node = lookup_node(s, node->succ);
}
}
@@ -1367,11 +1367,11 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
// Convert all polygons
if (poly_list.segment) {
- List *list = LOOKUP_LIST(poly_list);
- Node *node = LOOKUP_NODE(list->first);
+ List *list = lookup_list(s, poly_list);
+ Node *node = lookup_node(s, list->first);
while (node) {
- Node *dup = LOOKUP_NODE(list->first);
+ Node *dup = lookup_node(s, list->first);
// Workaround for game bugs that put a polygon in the list more than once
while (dup != node) {
@@ -1379,7 +1379,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
warning("[avoidpath] Ignoring duplicate polygon");
break;
}
- dup = LOOKUP_NODE(dup->succ);
+ dup = lookup_node(s, dup->succ);
}
if (dup == node) {
@@ -1389,7 +1389,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
count += KP_UINT(GET_SEL32(node->value, size));
}
- node = LOOKUP_NODE(node->succ);
+ node = lookup_node(s, node->succ);
}
}
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 82b72e4a9e..9fadabb9fc 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -188,8 +188,8 @@ reg_t kSetSynonyms(EngineState *s, int funct_nr, int argc, reg_t *argv) {
s->_synonyms.clear();
- list = LOOKUP_LIST(GET_SEL32(object, elements));
- node = LOOKUP_NODE(list->first);
+ list = lookup_list(s, GET_SEL32(object, elements));
+ node = lookup_node(s, list->first);
while (node) {
reg_t objpos = node->value;
@@ -227,7 +227,7 @@ reg_t kSetSynonyms(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
- node = LOOKUP_NODE(node->succ);
+ node = lookup_node(s, node->succ);
}
SCIkdebug(SCIkPARSER, "A total of %d synonyms are active now.\n", s->_synonyms.size());
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 8773b2b9c8..9fa313238d 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -82,9 +82,12 @@ int _kdebug_cheap_soundcue_hack = -1;
char inputbuf[256] = "";
+#if 0
+// Unused
#define LOOKUP_SPECIES(species) (\
(species >= 1000) ? species : *(s->_classtable[species].scriptposp) \
+ s->_classtable[species].class_offset)
+#endif
const char *_debug_get_input_default() {
char newinpbuf[256];
@@ -573,7 +576,7 @@ static int c_vr(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
break;
case KSIG_LIST: {
- List *l = LOOKUP_LIST(reg);
+ List *l = lookup_list(s, reg);
sciprintf("list\n");