aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/savegame.cfsml40
-rw-r--r--engines/sci/engine/savegame.cpp40
-rw-r--r--engines/sci/engine/scriptdebug.cpp2
-rw-r--r--engines/sci/gfx/menubar.cpp13
-rw-r--r--engines/sci/gfx/menubar.h2
-rw-r--r--engines/sci/sfx/songlib.cpp20
-rw-r--r--engines/sci/sfx/songlib.h18
7 files changed, 67 insertions, 68 deletions
diff --git a/engines/sci/engine/savegame.cfsml b/engines/sci/engine/savegame.cfsml
index 7e1e0e35be..1c2b0f3d2a 100644
--- a/engines/sci/engine/savegame.cfsml
+++ b/engines/sci/engine/savegame.cfsml
@@ -554,34 +554,34 @@ void write_MemObject(Common::WriteStream *fh, MemObject const *foo) {
switch (foo->type) {
case MEM_OBJ_SCRIPT:
%CFSMLWRITE Script &foo->data.script INTO fh;
- break;
+ break;
case MEM_OBJ_CLONES:
%CFSMLWRITE CloneTable &foo->data.clones INTO fh;
- break;
+ break;
case MEM_OBJ_LOCALS:
%CFSMLWRITE LocalVariables &foo->data.locals INTO fh;
- break;
+ break;
case MEM_OBJ_SYS_STRINGS:
%CFSMLWRITE SystemStrings &foo->data.sys_strings INTO fh;
- break;
+ break;
case MEM_OBJ_STACK:
%CFSMLWRITE int &foo->data.stack.nr INTO fh;
- break;
+ break;
case MEM_OBJ_HUNK:
break;
case MEM_OBJ_STRING_FRAG:
break;
case MEM_OBJ_LISTS:
%CFSMLWRITE ListTable &foo->data.lists INTO fh;
- break;
+ break;
case MEM_OBJ_NODES:
%CFSMLWRITE NodeTable &foo->data.nodes INTO fh;
- break;
+ break;
case MEM_OBJ_DYNMEM:
%CFSMLWRITE DynMem &foo->data.dynmem INTO fh;
- break;
+ break;
default:
- break;
+ break;
}
}
@@ -596,34 +596,34 @@ int read_MemObject(Common::SeekableReadStream *fh, MemObject *foo, const char *l
switch (foo->type) {
case MEM_OBJ_SCRIPT:
%CFSMLREAD Script &foo->data.script FROM fh ERRVAR *hiteof LINECOUNTER *line;
- break;
+ break;
case MEM_OBJ_CLONES:
%CFSMLREAD CloneTable &foo->data.clones FROM fh ERRVAR *hiteof LINECOUNTER *line;
- break;
+ break;
case MEM_OBJ_LOCALS:
%CFSMLREAD LocalVariables &foo->data.locals FROM fh ERRVAR *hiteof LINECOUNTER *line;
- break;
+ break;
case MEM_OBJ_SYS_STRINGS:
%CFSMLREAD SystemStrings &foo->data.sys_strings FROM fh ERRVAR *hiteof LINECOUNTER *line;
- break;
+ break;
case MEM_OBJ_LISTS:
%CFSMLREAD ListTable &foo->data.lists FROM fh ERRVAR *hiteof LINECOUNTER *line;
- break;
+ break;
case MEM_OBJ_NODES:
%CFSMLREAD NodeTable &foo->data.nodes FROM fh ERRVAR *hiteof LINECOUNTER *line;
- break;
+ break;
case MEM_OBJ_STACK:
%CFSMLREAD int &foo->data.stack.nr FROM fh ERRVAR *hiteof LINECOUNTER *line;
- foo->data.stack.entries = (reg_t *)sci_calloc(foo->data.stack.nr, sizeof(reg_t));
- break;
+ foo->data.stack.entries = (reg_t *)sci_calloc(foo->data.stack.nr, sizeof(reg_t));
+ break;
case MEM_OBJ_HUNK:
init_Hunk_table(&foo->data.hunks);
break;
- case MEM_OBJ_STRING_FRAG:
- break;
+ case MEM_OBJ_STRING_FRAG:
+ break;
case MEM_OBJ_DYNMEM:
%CFSMLREAD DynMem &foo->data.dynmem FROM fh ERRVAR *hiteof LINECOUNTER *line;
- break;
+ break;
default:
break;
}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index f922d8d2ac..b50289a6bd 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -4252,7 +4252,7 @@ void write_MemObject(Common::WriteStream *fh, MemObject const *foo) {
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
#line 557 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_CLONES:
#line 822 "engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
@@ -4260,7 +4260,7 @@ void write_MemObject(Common::WriteStream *fh, MemObject const *foo) {
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
#line 560 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_LOCALS:
#line 822 "engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
@@ -4268,7 +4268,7 @@ void write_MemObject(Common::WriteStream *fh, MemObject const *foo) {
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
#line 563 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_SYS_STRINGS:
#line 822 "engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
@@ -4276,7 +4276,7 @@ void write_MemObject(Common::WriteStream *fh, MemObject const *foo) {
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
#line 566 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_STACK:
#line 822 "engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
@@ -4284,7 +4284,7 @@ void write_MemObject(Common::WriteStream *fh, MemObject const *foo) {
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
#line 569 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_HUNK:
break;
case MEM_OBJ_STRING_FRAG:
@@ -4296,7 +4296,7 @@ void write_MemObject(Common::WriteStream *fh, MemObject const *foo) {
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
#line 576 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_NODES:
#line 822 "engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
@@ -4304,7 +4304,7 @@ void write_MemObject(Common::WriteStream *fh, MemObject const *foo) {
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
#line 579 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_DYNMEM:
#line 822 "engines/sci/engine/savegame.cfsml"
// Auto-generated CFSML data writer code
@@ -4312,9 +4312,9 @@ void write_MemObject(Common::WriteStream *fh, MemObject const *foo) {
WSprintf(fh, "\n");
// End of auto-generated CFSML data writer code
#line 582 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
default:
- break;
+ break;
}
}
@@ -4381,7 +4381,7 @@ int read_MemObject(Common::SeekableReadStream *fh, MemObject *foo, const char *l
}
// End of auto-generated CFSML data reader code
#line 599 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_CLONES:
// Auto-generated CFSML data reader code
#line 766 "engines/sci/engine/savegame.cfsml"
@@ -4410,7 +4410,7 @@ int read_MemObject(Common::SeekableReadStream *fh, MemObject *foo, const char *l
}
// End of auto-generated CFSML data reader code
#line 602 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_LOCALS:
// Auto-generated CFSML data reader code
#line 766 "engines/sci/engine/savegame.cfsml"
@@ -4439,7 +4439,7 @@ int read_MemObject(Common::SeekableReadStream *fh, MemObject *foo, const char *l
}
// End of auto-generated CFSML data reader code
#line 605 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_SYS_STRINGS:
// Auto-generated CFSML data reader code
#line 766 "engines/sci/engine/savegame.cfsml"
@@ -4468,7 +4468,7 @@ int read_MemObject(Common::SeekableReadStream *fh, MemObject *foo, const char *l
}
// End of auto-generated CFSML data reader code
#line 608 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_LISTS:
// Auto-generated CFSML data reader code
#line 766 "engines/sci/engine/savegame.cfsml"
@@ -4497,7 +4497,7 @@ int read_MemObject(Common::SeekableReadStream *fh, MemObject *foo, const char *l
}
// End of auto-generated CFSML data reader code
#line 611 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_NODES:
// Auto-generated CFSML data reader code
#line 766 "engines/sci/engine/savegame.cfsml"
@@ -4526,7 +4526,7 @@ int read_MemObject(Common::SeekableReadStream *fh, MemObject *foo, const char *l
}
// End of auto-generated CFSML data reader code
#line 614 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
case MEM_OBJ_STACK:
// Auto-generated CFSML data reader code
#line 766 "engines/sci/engine/savegame.cfsml"
@@ -4555,13 +4555,13 @@ int read_MemObject(Common::SeekableReadStream *fh, MemObject *foo, const char *l
}
// End of auto-generated CFSML data reader code
#line 617 "engines/sci/engine/savegame.cfsml"
- foo->data.stack.entries = (reg_t *)sci_calloc(foo->data.stack.nr, sizeof(reg_t));
- break;
+ foo->data.stack.entries = (reg_t *)sci_calloc(foo->data.stack.nr, sizeof(reg_t));
+ break;
case MEM_OBJ_HUNK:
init_Hunk_table(&foo->data.hunks);
break;
- case MEM_OBJ_STRING_FRAG:
- break;
+ case MEM_OBJ_STRING_FRAG:
+ break;
case MEM_OBJ_DYNMEM:
// Auto-generated CFSML data reader code
#line 766 "engines/sci/engine/savegame.cfsml"
@@ -4590,7 +4590,7 @@ int read_MemObject(Common::SeekableReadStream *fh, MemObject *foo, const char *l
}
// End of auto-generated CFSML data reader code
#line 626 "engines/sci/engine/savegame.cfsml"
- break;
+ break;
default:
break;
}
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 388ca6b585..10b8dbfa79 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -542,7 +542,7 @@ static int show_node(EngineState *s, reg_t addr) {
int objinfo(EngineState *s, reg_t pos);
-void song_lib_dump(songlib_t songlib, int line);
+void song_lib_dump(const songlib_t &songlib, int line);
static int c_songlib_print(EngineState *s) {
song_lib_dump(s->sound.songlib, __LINE__);
diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp
index a9e14bf55e..83067eeac7 100644
--- a/engines/sci/gfx/menubar.cpp
+++ b/engines/sci/gfx/menubar.cpp
@@ -53,10 +53,8 @@ void menubar_free(menubar_t *menubar) {
int j;
for (j = 0; j < menu->items_nr; j++) {
- if (menu->items[j].keytext)
- free(menu->items[j].keytext);
- if (menu->items[j].text)
- free(menu->items[j].text);
+ free(menu->items[j].keytext);
+ free(menu->items[j].text);
}
free(menu->items);
@@ -106,7 +104,8 @@ int _menubar_add_menu_item(gfx_state_t *state, menu_t *menu, int type, char *lef
if (right) {
gfxop_get_text_params(state, font, right, SIZE_INF, &width, &height, 0, NULL, NULL, NULL);
- total_left_size = MENU_BOX_CENTER_PADDING + (item->keytext_size = width);
+ item->keytext_size = width;
+ total_left_size = MENU_BOX_CENTER_PADDING + width;
}
item->enabled = 1;
@@ -323,8 +322,8 @@ int menubar_set_attribute(EngineState *s, int menu_nr, int item_nr, int attribut
break;
case MENU_ATTRIBUTE_KEY:
- if (item->keytext)
- free(item->keytext);
+ free(item->keytext);
+ item->keytext = 0;
if (value.segment) {
diff --git a/engines/sci/gfx/menubar.h b/engines/sci/gfx/menubar.h
index 2ccd6f8a5e..124344e539 100644
--- a/engines/sci/gfx/menubar.h
+++ b/engines/sci/gfx/menubar.h
@@ -88,7 +88,7 @@ struct EngineState;
struct menu_item_t {
int type; /* Normal or hbar */
char *keytext; /* right-centered part of the text (the key) */
- int keytext_size; /* Width of the right-centered text */
+ int keytext_size; // FIXME: Essentially unused
int flags;
byte said[MENU_SAID_SPEC_SIZE]; /* Said spec for this item */
diff --git a/engines/sci/sfx/songlib.cpp b/engines/sci/sfx/songlib.cpp
index 2161bee779..5831457acb 100644
--- a/engines/sci/sfx/songlib.cpp
+++ b/engines/sci/sfx/songlib.cpp
@@ -55,7 +55,7 @@ song_t *song_new(song_handle_t handle, SongIterator *it, int priority) {
return retval;
}
-void song_lib_add(songlib_t songlib, song_t *song) {
+void song_lib_add(const songlib_t &songlib, song_t *song) {
song_t **seeker = NULL;
int pri = song->priority;
@@ -94,13 +94,13 @@ void song_lib_init(songlib_t *songlib) {
songlib->_s = NULL;
}
-void song_lib_free(songlib_t songlib) {
+void song_lib_free(const songlib_t &songlib) {
_songfree_chain(*(songlib.lib));
*(songlib.lib) = NULL;
}
-song_t *song_lib_find(songlib_t songlib, song_handle_t handle) {
+song_t *song_lib_find(const songlib_t &songlib, song_handle_t handle) {
song_t *seeker = *(songlib.lib);
while (seeker) {
@@ -112,7 +112,7 @@ song_t *song_lib_find(songlib_t songlib, song_handle_t handle) {
return seeker;
}
-song_t *song_lib_find_next_active(songlib_t songlib, song_t *other) {
+song_t *song_lib_find_next_active(const songlib_t &songlib, song_t *other) {
song_t *seeker = other ? other->next : *(songlib.lib);
while (seeker) {
@@ -129,11 +129,11 @@ song_t *song_lib_find_next_active(songlib_t songlib, song_t *other) {
return seeker;
}
-song_t *song_lib_find_active(songlib_t songlib) {
+song_t *song_lib_find_active(const songlib_t &songlib) {
return song_lib_find_next_active(songlib, NULL);
}
-int song_lib_remove(songlib_t songlib, song_handle_t handle) {
+int song_lib_remove(const songlib_t &songlib, song_handle_t handle) {
int retval;
song_t *goner = *(songlib.lib);
@@ -163,7 +163,7 @@ int song_lib_remove(songlib_t songlib, song_handle_t handle) {
return retval;
}
-void song_lib_resort(songlib_t songlib, song_t *song) {
+void song_lib_resort(const songlib_t &songlib, song_t *song) {
if (*(songlib.lib) == song)
*(songlib.lib) = song->next;
else {
@@ -179,7 +179,7 @@ void song_lib_resort(songlib_t songlib, song_t *song) {
song_lib_add(songlib, song);
}
-int song_lib_count(songlib_t songlib) {
+int song_lib_count(const songlib_t &songlib) {
song_t *seeker = *(songlib.lib);
int retval = 0;
@@ -191,13 +191,13 @@ int song_lib_count(songlib_t songlib) {
return retval;
}
-void song_lib_set_restore_behavior(songlib_t songlib, song_handle_t handle, RESTORE_BEHAVIOR action) {
+void song_lib_set_restore_behavior(const songlib_t &songlib, song_handle_t handle, RESTORE_BEHAVIOR action) {
song_t *seeker = song_lib_find(songlib, handle);
seeker->restore_behavior = action;
}
-void song_lib_dump(songlib_t songlib, int line) {
+void song_lib_dump(const songlib_t &songlib, int line) {
song_t *seeker = *(songlib.lib);
fprintf(debug_stream, "L%d:", line);
diff --git a/engines/sci/sfx/songlib.h b/engines/sci/sfx/songlib.h
index efce1e17b0..b9849fbfe3 100644
--- a/engines/sci/sfx/songlib.h
+++ b/engines/sci/sfx/songlib.h
@@ -102,33 +102,33 @@ void song_lib_init(songlib_t *songlib);
** Returns : (void)
*/
-void song_lib_free(songlib_t songlib);
+void song_lib_free(const songlib_t &songlib);
/* Frees a song library
** Parameters: (songlib_t) songlib: The library to free
** Returns : (void)
*/
-void song_lib_add(songlib_t songlib, song_t *song);
+void song_lib_add(const songlib_t &songlib, song_t *song);
/* Adds a song to a song library.
** Parameters: (songlib_t) songlib: An existing sound library, or NULL
** (song_t *) song: The song to add
** Returns : (void)
*/
-song_t *song_lib_find(songlib_t songlib, song_handle_t handle);
+song_t *song_lib_find(const songlib_t &songlib, song_handle_t handle);
/* Looks up the song with the specified handle
** Parameters: (songlib_t) songlib: An existing sound library, may point to NULL
** (song_handle_t) handle: The sound handle to look for
** Returns : (song_t *) The song or NULL if it wasn't found
*/
-song_t *song_lib_find_active(songlib_t songlib);
+song_t *song_lib_find_active(const songlib_t &songlib);
/* Finds the first song playing with the highest priority
** Parameters: (songlib_t) songlib: An existing sound library
** Returns : (song_t *) The song that should be played next, or NULL if there is none
*/
-song_t *song_lib_find_next_active(songlib_t songlib, song_t *song);
+song_t *song_lib_find_next_active(const songlib_t &songlib, song_t *song);
/* Finds the next song playing with the highest priority
** Parameters: (songlib_t) songlib: The song library to operate on
** (song_t *) song: A song previously returned from the song library
@@ -139,27 +139,27 @@ song_t *song_lib_find_next_active(songlib_t songlib, song_t *song);
** being 'playable'.
*/
-int song_lib_remove(songlib_t songlib, song_handle_t handle);
+int song_lib_remove(const songlib_t &songlib, song_handle_t handle);
/* Removes a song from the library
** Parameters: (songlib_t) songlib: An existing sound library
** (song_handle_t) handle: Handle of the song to remove
** Returns : (int) The status of the song that was removed
*/
-void song_lib_resort(songlib_t songlib, song_t *song);
+void song_lib_resort(const songlib_t &songlib, song_t *song);
/* Removes a song from the library and sorts it in again; for use after renicing
** Parameters: (songlib_t) songlib: An existing sound library
** (song_t *) song: The song to work on
** Returns : (void)
*/
-int song_lib_count(songlib_t songlib);
+int song_lib_count(const songlib_t &songlib);
/* Counts the number of songs in a song library
** Parameters: (songlib_t) songlib: The library to count
** Returns : (int) The number of songs
*/
-void song_lib_set_restore_behavior(songlib_t songlib, song_handle_t handle,
+void song_lib_set_restore_behavior(const songlib_t &songlib, song_handle_t handle,
RESTORE_BEHAVIOR action);
/* Determines what should be done with the song "handle" when
** restoring it from a saved game.