aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorGreg Frieger2009-02-28 21:59:49 +0000
committerGreg Frieger2009-02-28 21:59:49 +0000
commit61ab59138a1e1ba1bac9cdb0dbf3c5372667930d (patch)
tree2c9095b54e01b8e0761f70a6d63bf71638d07b6b /engines/sci
parent4f3a50913e3305d5e13986ada915451312cd3707 (diff)
downloadscummvm-rg350-61ab59138a1e1ba1bac9cdb0dbf3c5372667930d.tar.gz
scummvm-rg350-61ab59138a1e1ba1bac9cdb0dbf3c5372667930d.tar.bz2
scummvm-rg350-61ab59138a1e1ba1bac9cdb0dbf3c5372667930d.zip
resource_t struct replaced with stub Resource class for future objectifying. Also the crash when exiting SCI1 games was fixed
svn-id: r38982
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/game.cpp12
-rw-r--r--engines/sci/engine/kmenu.cpp2
-rw-r--r--engines/sci/engine/kscripts.cpp2
-rw-r--r--engines/sci/engine/ksound.cpp4
-rw-r--r--engines/sci/engine/kstring.cpp4
-rw-r--r--engines/sci/engine/message.cpp2
-rw-r--r--engines/sci/engine/message.h2
-rw-r--r--engines/sci/engine/savegame.cpp2
-rw-r--r--engines/sci/engine/scriptconsole.cpp6
-rw-r--r--engines/sci/engine/scriptdebug.cpp6
-rw-r--r--engines/sci/engine/seg_manager.cpp4
-rw-r--r--engines/sci/engine/vm.cpp8
-rw-r--r--engines/sci/gfx/resource/sci_resmgr.cpp10
-rw-r--r--engines/sci/scicore/decompress0.cpp2
-rw-r--r--engines/sci/scicore/decompress01.cpp2
-rw-r--r--engines/sci/scicore/decompress1.cpp2
-rw-r--r--engines/sci/scicore/decompress11.cpp2
-rw-r--r--engines/sci/scicore/resource.cpp76
-rw-r--r--engines/sci/scicore/resource.h96
-rw-r--r--engines/sci/scicore/resource_map.cpp19
-rw-r--r--engines/sci/scicore/resource_patch.cpp8
-rw-r--r--engines/sci/scicore/script.cpp2
-rw-r--r--engines/sci/scicore/vocab.cpp6
-rw-r--r--engines/sci/scicore/vocab_debug.cpp14
-rw-r--r--engines/sci/sfx/player/polled.cpp2
-rw-r--r--engines/sci/sfx/player/realtime.cpp6
26 files changed, 150 insertions, 151 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 9d5f20043b..3b53dcb659 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -119,7 +119,7 @@ static void _sci1_alloc_system_colors(EngineState *s) {
}
int _reset_graphics_input(EngineState *s) {
- resource_t *resource;
+ Resource *resource;
int font_nr;
gfx_color_t transparent;
sciprintf("Initializing graphics\n");
@@ -279,7 +279,7 @@ int game_init_sound(EngineState *s, int sound_flags) {
/* Maps a class ID to the script the corresponding class is contained in
Returns the script number suggested by vocab.996, or -1 if there's none */
-static int suggested_script(resource_t *res, unsigned int classId) {
+static int suggested_script(Resource *res, unsigned int classId) {
int offset;
if (!res || classId >= res->size >> 2)
@@ -307,7 +307,7 @@ int create_class_table_sci11(EngineState *s) {
char *seeker_ptr;
int classnr;
- resource_t *vocab996 = s->resmgr->findResource(sci_vocab, 996, 1);
+ Resource *vocab996 = s->resmgr->findResource(sci_vocab, 996, 1);
if (!vocab996)
s->classtable_size = 20;
@@ -317,7 +317,7 @@ int create_class_table_sci11(EngineState *s) {
s->classtable = (Class*)sci_calloc(sizeof(Class), s->classtable_size);
for (scriptnr = 0; scriptnr < 1000; scriptnr++) {
- resource_t *heap = s->resmgr->findResource(sci_heap, scriptnr, 0);
+ Resource *heap = s->resmgr->findResource(sci_heap, scriptnr, 0);
if (heap) {
int global_vars = getUInt16(heap->data + 2);
@@ -362,7 +362,7 @@ static int create_class_table_sci0(EngineState *s) {
int classnr;
int magic_offset; // For strange scripts in older SCI versions
- resource_t *vocab996 = s->resmgr->findResource(sci_vocab, 996, 1);
+ Resource *vocab996 = s->resmgr->findResource(sci_vocab, 996, 1);
if (!vocab996)
s->classtable_size = 20;
@@ -373,7 +373,7 @@ static int create_class_table_sci0(EngineState *s) {
for (scriptnr = 0; scriptnr < 1000; scriptnr++) {
int objtype = 0;
- resource_t *script = s->resmgr->findResource(sci_script, scriptnr, 0);
+ Resource *script = s->resmgr->findResource(sci_script, scriptnr, 0);
if (script) {
if (s->version < SCI_VERSION_FTU_NEW_SCRIPT_HEADER)
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index 71c02e172e..cce2eb4d25 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -203,7 +203,7 @@ void about_freesci(EngineState *s) {
int page;
gfxw_port_t *port;
int bodyfont, titlefont;
- resource_t *bodyfont_res = NULL;
+ Resource *bodyfont_res = NULL;
int i;
titlefont = s->titlebar_port->font_nr;
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index f334bfddf8..9517567e21 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -129,7 +129,7 @@ reg_t kLock(EngineState *s, int funct_nr, int argc, reg_t *argv) {
int resnr = UKPV(1);
int state = argc > 2 ? UKPV(2) : 1;
- resource_t *which;
+ Resource *which;
switch (state) {
case 1 :
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index 3aec1add7d..42d0da4056 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -93,7 +93,7 @@ namespace Sci {
static void script_set_priority(EngineState *s, reg_t obj, int priority) {
int song_nr = GET_SEL32V(obj, number);
- resource_t *song = s->resmgr->findResource(sci_sound, song_nr, 0);
+ Resource *song = s->resmgr->findResource(sci_sound, song_nr, 0);
int flags = GET_SEL32V(obj, flags);
if (priority == -1) {
@@ -110,7 +110,7 @@ static void script_set_priority(EngineState *s, reg_t obj, int priority) {
}
song_iterator_t *build_iterator(EngineState *s, int song_nr, int type, songit_id_t id) {
- resource_t *song = s->resmgr->findResource(sci_sound, song_nr, 0);
+ Resource *song = s->resmgr->findResource(sci_sound, song_nr, 0);
if (!song)
return NULL;
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index ad02576f99..ac113fa9a8 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -41,7 +41,7 @@ namespace Sci {
/* Returns the string the script intended to address */
char *kernel_lookup_text(EngineState *s, reg_t address, int index) {
char *seeker;
- resource_t *textres;
+ Resource *textres;
if (address.segment)
return (char *)kernel_dereference_bulk_pointer(s, address, 0);
@@ -709,7 +709,7 @@ reg_t kStrLen(EngineState *s, int funct_nr, int argc, reg_t *argv) {
reg_t kGetFarText(EngineState *s, int funct_nr, int argc, reg_t *argv) {
- resource_t *textres = s->resmgr->findResource(sci_text, UKPV(0), 0);
+ Resource *textres = s->resmgr->findResource(sci_text, UKPV(0), 0);
char *seeker;
int counter = UKPV(1);
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp
index 4be5f10042..32bd50401b 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -186,7 +186,7 @@ static MessageHandler fixed_handler = {
};
void message_state_initialize(ResourceManager *resmgr, MessageState *state) {
- //resource_t *tester = resmgr->findResource(sci_message, 0, 0);
+ //Resource *tester = resmgr->findResource(sci_message, 0, 0);
//int version;
//if (tester == NULL)
diff --git a/engines/sci/engine/message.h b/engines/sci/engine/message.h
index 86ac5c752e..609757d40f 100644
--- a/engines/sci/engine/message.h
+++ b/engines/sci/engine/message.h
@@ -64,7 +64,7 @@ struct MessageState {
int initialized;
MessageHandler *handler;
ResourceManager *resmgr;
- resource_t *current_res;
+ Resource *current_res;
int module;
int record_count;
byte *index_records;
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 3eaadf4c3b..dedcc84090 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -4942,7 +4942,7 @@ static int clone_entry_used(CloneTable *table, int n) {
}
static void load_script(EngineState *s, SegmentId seg) {
- resource_t *script, *heap = NULL;
+ Resource *script, *heap = NULL;
Script *scr = &(s->seg_manager->heap[seg]->data.script);
scr->buf = (byte *)malloc(scr->buf_size);
diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp
index a8c79bd962..f46c3ccf5c 100644
--- a/engines/sci/engine/scriptconsole.cpp
+++ b/engines/sci/engine/scriptconsole.cpp
@@ -913,7 +913,7 @@ static int c_size(EngineState *s) {
if (res == -1)
sciprintf("Resource type '%s' is not valid\n", cmd_params[0].str);
else {
- resource_t *resource = s->resmgr->findResource(res, cmd_params[1].val, 0);
+ Resource *resource = s->resmgr->findResource(res, cmd_params[1].val, 0);
if (resource) {
sciprintf("Size: %d\n", resource->size);
} else
@@ -929,7 +929,7 @@ static int c_dump(EngineState *s) {
if (res == -1)
sciprintf("Resource type '%s' is not valid\n", cmd_params[0].str);
else {
- resource_t *resource = s->resmgr->findResource(res, cmd_params[1].val, 0);
+ Resource *resource = s->resmgr->findResource(res, cmd_params[1].val, 0);
if (resource)
sci_hexdump(resource->data, resource->size, 0);
else
@@ -942,7 +942,7 @@ static int c_dump(EngineState *s) {
static int c_hexgrep(EngineState *s) {
int i, seeklen, resnr, restype, resmax;
unsigned char *seekstr = NULL;
- resource_t *script = NULL;
+ Resource *script = NULL;
char *dot = strchr(cmd_params[0].str, '.');
if (NULL == s) {
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 190a054e43..0accce7e94 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -245,7 +245,7 @@ static void sci01_song_header_dump(byte *data, int size) {
#undef SONGDATA
int c_sfx_01_header(EngineState *s) {
- resource_t *song = s->resmgr->findResource(sci_sound, cmd_params[0].val, 0);
+ Resource *song = s->resmgr->findResource(sci_sound, cmd_params[0].val, 0);
if (!song) {
sciprintf("Doesn't exist\n");
@@ -258,7 +258,7 @@ int c_sfx_01_header(EngineState *s) {
}
int c_sfx_01_track(EngineState *s) {
- resource_t *song = s->resmgr->findResource(sci_sound, cmd_params[0].val, 0);
+ Resource *song = s->resmgr->findResource(sci_sound, cmd_params[0].val, 0);
int offset = cmd_params[1].val;
@@ -2406,7 +2406,7 @@ int c_simkey(EngineState *s) {
}
static int c_is_sample(EngineState *s) {
- resource_t *song = s->resmgr->findResource(sci_sound, cmd_params[0].val, 0);
+ Resource *song = s->resmgr->findResource(sci_sound, cmd_params[0].val, 0);
song_iterator_t *songit;
sfx_pcm_feed_t *data;
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 949b04928b..57ba65573c 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -152,8 +152,8 @@ MemObject *SegManager::allocateScript(EngineState *s, int script_nr, int* seg_id
}
void SegManager::setScriptSize(MemObject *mem, EngineState *s, int script_nr) {
- resource_t *script = s->resmgr->findResource(sci_script, script_nr, 0);
- resource_t *heap = s->resmgr->findResource(sci_heap, script_nr, 0);
+ Resource *script = s->resmgr->findResource(sci_script, script_nr, 0);
+ Resource *heap = s->resmgr->findResource(sci_heap, script_nr, 0);
mem->data.script.script_size = script->size;
mem->data.script.heap_size = 0; // Set later
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index b35736cd4a..746df27b80 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1593,7 +1593,7 @@ SelectorType lookup_selector(EngineState *s, reg_t obj_location, Selector select
// Detects SCI versions by their different script header
void script_detect_versions(EngineState *s) {
int c;
- resource_t *script = {0};
+ Resource *script = {0};
if (s->resmgr->findResource(sci_heap, 0, 0)) {
version_require_later_than(s, SCI_VERSION(1, 001, 000));
@@ -1670,7 +1670,7 @@ reg_t script_lookup_export(EngineState *s, int script_nr, int export_index) {
#define INST_LOOKUP_CLASS(id) ((id == 0xffff)? NULL_REG : get_class_address(s, id, SCRIPT_GET_LOCK, reg))
-int script_instantiate_common(EngineState *s, int script_nr, resource_t **script, resource_t **heap, int *was_new) {
+int script_instantiate_common(EngineState *s, int script_nr, Resource **script, Resource **heap, int *was_new) {
int seg;
int seg_id;
int marked_for_deletion;
@@ -1740,7 +1740,7 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
int seg_id;
int relocation = -1;
int magic_pos_adder; // Usually 0; 2 for older SCI versions
- resource_t *script;
+ Resource *script;
int was_new;
seg_id = script_instantiate_common(s, script_nr, &script, NULL, &was_new);
@@ -1888,7 +1888,7 @@ int script_instantiate_sci0(EngineState *s, int script_nr) {
}
int script_instantiate_sci11(EngineState *s, int script_nr) {
- resource_t *script, *heap;
+ Resource *script, *heap;
int seg_id;
int heap_start;
reg_t reg;
diff --git a/engines/sci/gfx/resource/sci_resmgr.cpp b/engines/sci/gfx/resource/sci_resmgr.cpp
index b77ff26be1..b2d1c0b9bb 100644
--- a/engines/sci/gfx/resource/sci_resmgr.cpp
+++ b/engines/sci/gfx/resource/sci_resmgr.cpp
@@ -71,7 +71,7 @@ void gfxr_interpreter_clear_pic(int version, gfxr_pic_t *pic, void *internal) {
int gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic,
int flags, int default_palette, int nr, void *internal) {
ResourceManager *resmgr = (ResourceManager *)state->misc_payload;
- resource_t *res = resmgr->findResource(sci_pic, nr, 0);
+ Resource *res = resmgr->findResource(sci_pic, nr, 0);
int need_unscaled = unscaled_pic != NULL;
gfxr_pic0_params_t style, basic_style;
@@ -149,7 +149,7 @@ gfxr_view_t *gfxr_draw_view11(int id, byte *resource, int size);
gfxr_view_t *gfxr_interpreter_get_view(gfx_resstate_t *state, int nr, void *internal, int palette) {
ResourceManager *resmgr = (ResourceManager *) state->misc_payload;
- resource_t *res = resmgr->findResource(sci_view, nr, 0);
+ Resource *res = resmgr->findResource(sci_view, nr, 0);
int resid = GFXR_RES_ID(GFX_RESOURCE_TYPE_VIEW, nr);
gfxr_view_t *result = 0;
@@ -188,7 +188,7 @@ gfxr_view_t *gfxr_interpreter_get_view(gfx_resstate_t *state, int nr, void *inte
gfx_bitmap_font_t *gfxr_interpreter_get_font(gfx_resstate_t *state, int nr, void *internal) {
ResourceManager *resmgr = (ResourceManager *)state->misc_payload;
- resource_t *res = resmgr->findResource(sci_font, nr, 0);
+ Resource *res = resmgr->findResource(sci_font, nr, 0);
if (!res || !res->data)
return NULL;
@@ -197,7 +197,7 @@ gfx_bitmap_font_t *gfxr_interpreter_get_font(gfx_resstate_t *state, int nr, void
gfx_pixmap_t *gfxr_interpreter_get_cursor(gfx_resstate_t *state, int nr, void *internal) {
ResourceManager *resmgr = (ResourceManager *) state->misc_payload;
- resource_t *res = resmgr->findResource(sci_cursor, nr, 0);
+ Resource *res = resmgr->findResource(sci_cursor, nr, 0);
int resid = GFXR_RES_ID(GFX_RESOURCE_TYPE_CURSOR, nr);
if (!res || !res->data)
@@ -265,7 +265,7 @@ gfx_pixmap_color_t *gfxr_interpreter_get_static_palette(gfx_resstate_t *state, i
gfx_pixmap_color_t *gfxr_interpreter_get_palette(gfx_resstate_t *state, int version, int *colors_nr, void *internal, int nr) {
ResourceManager *resmgr = (ResourceManager *)state->misc_payload;
- resource_t *res;
+ Resource *res;
if (version < SCI_VERSION_01_VGA)
return NULL;
diff --git a/engines/sci/scicore/decompress0.cpp b/engines/sci/scicore/decompress0.cpp
index bed2fab7cb..6b3775ff5c 100644
--- a/engines/sci/scicore/decompress0.cpp
+++ b/engines/sci/scicore/decompress0.cpp
@@ -234,7 +234,7 @@ int sci0_get_compression_method(Common::ReadStream &stream) {
return compressionMethod;
}
-int decompress0(resource_t *result, Common::ReadStream &stream, int sci_version) {
+int decompress0(Resource *result, Common::ReadStream &stream, int sci_version) {
uint16 compressedLength;
uint16 compressionMethod;
uint8 *buffer;
diff --git a/engines/sci/scicore/decompress01.cpp b/engines/sci/scicore/decompress01.cpp
index effbec7e89..e74b85def7 100644
--- a/engines/sci/scicore/decompress01.cpp
+++ b/engines/sci/scicore/decompress01.cpp
@@ -490,7 +490,7 @@ byte *view_reorder(byte *inbuffer, int dsize) {
return outbuffer;
}
-int decompress01(resource_t *result, Common::ReadStream &stream, int sci_version) {
+int decompress01(Resource *result, Common::ReadStream &stream, int sci_version) {
uint16 compressedLength;
uint16 compressionMethod;
uint8 *buffer;
diff --git a/engines/sci/scicore/decompress1.cpp b/engines/sci/scicore/decompress1.cpp
index 327ba711dd..51b13e49a7 100644
--- a/engines/sci/scicore/decompress1.cpp
+++ b/engines/sci/scicore/decompress1.cpp
@@ -267,7 +267,7 @@ int decrypt4(uint8* dest, uint8* src, int length, int complength) {
void decryptinit3();
int decrypt3(uint8* dest, uint8* src, int length, int complength);
-int decompress1(resource_t *result, Common::ReadStream &stream, int sci_version) {
+int decompress1(Resource *result, Common::ReadStream &stream, int sci_version) {
uint16 compressedLength;
uint16 compressionMethod;
uint8 *buffer;
diff --git a/engines/sci/scicore/decompress11.cpp b/engines/sci/scicore/decompress11.cpp
index b7515d1aa2..39ff53c070 100644
--- a/engines/sci/scicore/decompress11.cpp
+++ b/engines/sci/scicore/decompress11.cpp
@@ -38,7 +38,7 @@ void decryptinit3();
int decrypt3(uint8* dest, uint8* src, int length, int complength);
int decrypt4(uint8* dest, uint8* src, int length, int complength);
-int decompress11(resource_t *result, Common::ReadStream &stream, int sci_version) {
+int decompress11(Resource *result, Common::ReadStream &stream, int sci_version) {
uint16 compressedLength;
uint16 compressionMethod;
uint8 *buffer;
diff --git a/engines/sci/scicore/resource.cpp b/engines/sci/scicore/resource.cpp
index 88efb1a4ce..f438212594 100644
--- a/engines/sci/scicore/resource.cpp
+++ b/engines/sci/scicore/resource.cpp
@@ -81,8 +81,8 @@ const char *sci_resource_type_suffixes[] = {"v56", "p56", "scr", "tex", "snd",
int resourcecmp(const void *first, const void *second);
-typedef int decomp_funct(resource_t *result, Common::ReadStream &stream, int sci_version);
-typedef void patch_sprintf_funct(char *string, resource_t *res);
+typedef int decomp_funct(Resource *result, Common::ReadStream &stream, int sci_version);
+typedef void patch_sprintf_funct(char *string, Resource *res);
static decomp_funct *decompressors[] = {
NULL,
@@ -110,21 +110,21 @@ static patch_sprintf_funct *patch_sprintfers[] = {
int resourcecmp(const void *first, const void *second) {
- if (((resource_t *)first)->type ==
- ((resource_t *)second)->type)
- return (((resource_t *)first)->number <
- ((resource_t *)second)->number) ? -1 :
- !(((resource_t *)first)->number ==
- ((resource_t *)second)->number);
+ if (((Resource *)first)->type ==
+ ((Resource *)second)->type)
+ return (((Resource *)first)->number <
+ ((Resource *)second)->number) ? -1 :
+ !(((Resource *)first)->number ==
+ ((Resource *)second)->number);
else
- return (((resource_t *)first)->type <
- ((resource_t *)second)->type) ? -1 : 1;
+ return (((Resource *)first)->type <
+ ((Resource *)second)->type) ? -1 : 1;
}
//-- Resmgr helper functions --
-void ResourceManager::addAltSource(resource_t *res, ResourceSource *source, unsigned int file_offset) {
+void ResourceManager::addAltSource(Resource *res, ResourceSource *source, unsigned int file_offset) {
resource_altsource_t *rsrc = (resource_altsource_t *)sci_malloc(sizeof(resource_altsource_t));
rsrc->next = res->alt_sources;
@@ -133,7 +133,7 @@ void ResourceManager::addAltSource(resource_t *res, ResourceSource *source, unsi
res->alt_sources = rsrc;
}
-resource_t *ResourceManager::findResourceUnsorted(resource_t *res, int res_nr, int type, int number) {
+Resource *ResourceManager::findResourceUnsorted(Resource *res, int res_nr, int type, int number) {
int i;
for (i = 0; i < res_nr; i++)
if (res[i].number == number && res[i].type == type)
@@ -203,7 +203,7 @@ ResourceSource *ResourceManager::getVolume(ResourceSource *map, int volume_nr) {
// Resource manager constructors and operations
-void ResourceManager::loadFromPatchFile(Common::File &file, resource_t *res, char *filename) {
+void ResourceManager::loadFromPatchFile(Common::File &file, Resource *res, char *filename) {
unsigned int really_read;
res->data = (unsigned char *)sci_malloc(res->size);
@@ -216,12 +216,12 @@ void ResourceManager::loadFromPatchFile(Common::File &file, resource_t *res, cha
res->status = SCI_STATUS_ALLOCATED;
}
-void ResourceManager::loadResource(resource_t *res, bool protect) {
+void ResourceManager::loadResource(Resource *res, bool protect) {
char filename[MAXPATHLEN];
Common::File file;
- resource_t backup;
+ Resource backup;
- memcpy(&backup, res, sizeof(resource_t));
+ memcpy(&backup, res, sizeof(Resource));
// First try lower-case name
if (res->source->source_type == RESSOURCE_TYPE_DIRECTORY) {
@@ -261,7 +261,7 @@ void ResourceManager::loadResource(resource_t *res, bool protect) {
error, sci_resource_types[res->type], res->number, sci_error_types[error]);
if (protect)
- memcpy(res, &backup, sizeof(resource_t));
+ memcpy(res, &backup, sizeof(Resource));
res->data = NULL;
res->status = SCI_STATUS_NOMALLOC;
@@ -271,11 +271,11 @@ void ResourceManager::loadResource(resource_t *res, bool protect) {
}
-resource_t *ResourceManager::testResource(int type, int number) {
- resource_t binseeker;
+Resource *ResourceManager::testResource(int type, int number) {
+ Resource binseeker;
binseeker.type = type;
binseeker.number = number;
- return (resource_t *)bsearch(&binseeker, _resources, _resourcesNr, sizeof(resource_t), resourcecmp);
+ return (Resource *)bsearch(&binseeker, _resources, _resourcesNr, sizeof(Resource), resourcecmp);
}
int sci0_get_compression_method(Common::ReadStream &stream);
@@ -284,7 +284,7 @@ int sci_test_view_type(ResourceManager *mgr) {
Common::File file;
char filename[MAXPATHLEN];
int compression;
- resource_t *res;
+ Resource *res;
int i;
mgr->sci_version = SCI_VERSION_AUTODETECT;
@@ -367,7 +367,7 @@ int ResourceManager::scanNewSources(int *detected_version, ResourceSource *sourc
int preset_version = sci_version;
int resource_error = 0;
int dummy = sci_version;
- //resource_t **concat_ptr = &(mgr->_resources[mgr->_resourcesNr - 1].next);
+ //Resource **concat_ptr = &(mgr->_resources[mgr->_resourcesNr - 1].next);
if (detected_version == NULL)
detected_version = &dummy;
@@ -404,7 +404,7 @@ int ResourceManager::scanNewSources(int *detected_version, ResourceSource *sourc
if (resource_error == SCI_ERROR_NO_RESOURCE_FILES_FOUND) {
// Initialize empty resource manager
mgr->_resourcesNr = 0;
- mgr->_resources = 0; // FIXME: Was = (resource_t*)sci_malloc(1);
+ mgr->_resources = 0; // FIXME: Was = (Resource*)sci_malloc(1);
resource_error = 0;
}
#endif
@@ -421,7 +421,7 @@ int ResourceManager::scanNewSources(int *detected_version, ResourceSource *sourc
if (resource_error == SCI_ERROR_NO_RESOURCE_FILES_FOUND) {
// Initialize empty resource manager
_resourcesNr = 0;
- _resources = 0; // FIXME: Was = (resource_t*)sci_malloc(1);
+ _resources = 0; // FIXME: Was = (Resource*)sci_malloc(1);
resource_error = 0;
}
}
@@ -431,7 +431,7 @@ int ResourceManager::scanNewSources(int *detected_version, ResourceSource *sourc
default:
break;
}
- qsort(_resources, _resourcesNr, sizeof(resource_t), resourcecmp); // Sort resources
+ qsort(_resources, _resourcesNr, sizeof(Resource), resourcecmp); // Sort resources
}
return resource_error;
}
@@ -474,7 +474,7 @@ ResourceManager::ResourceManager(int version, int maxMemory) {
// return NULL;
}
- qsort(_resources, _resourcesNr, sizeof(resource_t), resourcecmp); // Sort resources
+ qsort(_resources, _resourcesNr, sizeof(Resource), resourcecmp); // Sort resources
if (version == SCI_VERSION_AUTODETECT)
switch (resmap_version) {
@@ -515,7 +515,7 @@ ResourceManager::ResourceManager(int version, int maxMemory) {
sciprintf("Resmgr: Detected Jones/CD or similar\n");
break;
case SCI_VERSION_1: {
- resource_t *res = testResource(sci_script, 0);
+ Resource *res = testResource(sci_script, 0);
sci_version = version = SCI_VERSION_1_EARLY;
loadResource(res, true);
@@ -533,7 +533,7 @@ ResourceManager::ResourceManager(int version, int maxMemory) {
}
if (!resource_error) {
- qsort(_resources, _resourcesNr, sizeof(resource_t), resourcecmp); // Sort resources
+ qsort(_resources, _resourcesNr, sizeof(Resource), resourcecmp); // Sort resources
}
sci_version = version;
@@ -546,11 +546,11 @@ void ResourceManager::freeAltSources(resource_altsource_t *dynressrc) {
}
}
-void ResourceManager::freeResources(resource_t *resources, int _resourcesNr) {
+void ResourceManager::freeResources(Resource *resources, int _resourcesNr) {
int i;
for (i = 0; i < _resourcesNr; i++) {
- resource_t *res = resources + i;
+ Resource *res = resources + i;
// FIXME: alt_sources->next may point to an invalid memory location
freeAltSources(res->alt_sources);
@@ -568,13 +568,13 @@ ResourceManager::~ResourceManager() {
_resources = NULL;
}
-void ResourceManager::unalloc(resource_t *res) {
+void ResourceManager::unalloc(Resource *res) {
free(res->data);
res->data = NULL;
res->status = SCI_STATUS_NOMALLOC;
}
-void ResourceManager::removeFromLRU(resource_t *res) {
+void ResourceManager::removeFromLRU(Resource *res) {
if (res->status != SCI_STATUS_ENQUEUED) {
sciprintf("Resmgr: Oops: trying to remove resource that isn't enqueued\n");
return;
@@ -594,7 +594,7 @@ void ResourceManager::removeFromLRU(resource_t *res) {
res->status = SCI_STATUS_ALLOCATED;
}
-void ResourceManager::addToLRU(resource_t *res) {
+void ResourceManager::addToLRU(Resource *res) {
if (res->status != SCI_STATUS_ALLOCATED) {
sciprintf("Resmgr: Oops: trying to enqueue resource with state %d\n", res->status);
return;
@@ -622,7 +622,7 @@ void ResourceManager::addToLRU(resource_t *res) {
void ResourceManager::printLRU() {
int mem = 0;
int entries = 0;
- resource_t *res = lru_first;
+ Resource *res = lru_first;
while (res) {
fprintf(stderr, "\t%s.%03d: %d bytes\n",
@@ -639,7 +639,7 @@ void ResourceManager::printLRU() {
void ResourceManager::freeOldResources(int last_invulnerable) {
while (_maxMemory < _memoryLRU && (!last_invulnerable || lru_first != lru_last)) {
- resource_t *goner = lru_last;
+ Resource *goner = lru_last;
if (!goner) {
fprintf(stderr, "Internal error: mgr->lru_last is NULL!\n");
fprintf(stderr, "LRU-mem= %d\n", _memoryLRU);
@@ -655,8 +655,8 @@ void ResourceManager::freeOldResources(int last_invulnerable) {
}
}
-resource_t *ResourceManager::findResource(int type, int number, int lock) {
- resource_t *retval;
+Resource *ResourceManager::findResource(int type, int number, int lock) {
+ Resource *retval;
if (number >= sci_max_resource_nr[sci_version]) {
int modded_number = number % sci_max_resource_nr[sci_version];
@@ -702,7 +702,7 @@ resource_t *ResourceManager::findResource(int type, int number, int lock) {
}
}
-void ResourceManager::unlockResource(resource_t *res, int resnum, int restype) {
+void ResourceManager::unlockResource(Resource *res, int resnum, int restype) {
if (!res) {
if (restype >= ARRAYSIZE(sci_resource_types))
sciprintf("Resmgr: Warning: Attempt to unlock non-existant resource %03d.%03d!\n", restype, resnum);
diff --git a/engines/sci/scicore/resource.h b/engines/sci/scicore/resource.h
index e662e186d0..08a5f97001 100644
--- a/engines/sci/scicore/resource.h
+++ b/engines/sci/scicore/resource.h
@@ -83,7 +83,7 @@ namespace Sci {
#define SCI_VERSION_1 SCI_VERSION_1_EARLY
-enum ResourceType {
+enum ResSourceType {
RESSOURCE_TYPE_DIRECTORY = 0,
RESSOURCE_TYPE_VOLUME = 2,
RESSOURCE_TYPE_EXTERNAL_MAP = 3,
@@ -123,7 +123,7 @@ struct resource_index_struct {
typedef struct resource_index_struct resource_index_t;
struct ResourceSource {
- ResourceType source_type;
+ ResSourceType source_type;
bool scanned;
Common::String location_name; // FIXME: Replace by FSNode ?
Common::String location_dir_name; // FIXME: Get rid of this again, only a temporary HACK!
@@ -140,24 +140,22 @@ struct resource_altsource_t {
/** Struct for storing resources in memory */
-struct resource_t {
- unsigned char *data;
+class Resource {
+public:
+// NOTE : Currently all member data has the same name and public visibility
+// to let the rest of the engine compile without changes
+ unsigned char *data;
unsigned short number;
unsigned short type;
uint16 id; /* contains number and type */
-
unsigned int size;
-
unsigned int file_offset; /* Offset in file */
- ResourceSource *source;
-
unsigned char status;
unsigned short lockers; /* Number of places where this resource was locked */
-
- resource_t *next; /* Position marker for the LRU queue */
- resource_t *prev;
-
+ Resource *next; /* Position marker for the LRU queue */
+ Resource *prev;
+ ResourceSource *source;
resource_altsource_t *alt_sources; /* SLL of alternative resource data sources */
};
@@ -207,74 +205,74 @@ public:
/** @param type: The resource type to look for
* @param number: The resource number to search
* @param lock: non-zero iff the resource should be locked
- * @return (resource_t *): The resource, or NULL if it doesn't exist
+ * @return (Resource *): The resource, or NULL if it doesn't exist
* @note Locked resources are guaranteed not to have their contents freed until
* they are unlocked explicitly (by unlockResource).
*/
- resource_t *findResource(int type, int number, int lock);
+ Resource *findResource(int type, int number, int lock);
/* Unlocks a previously locked resource
- ** (resource_t *) res: The resource to free
+ ** (Resource *) res: The resource to free
** (int) type: Type of the resource to check (for error checking)
** (int) number: Number of the resource to check (ditto)
** Returns : (void)
*/
- void unlockResource(resource_t *res, int restype, int resnum);
+ void unlockResource(Resource *res, int restype, int resnum);
/* Tests whether a resource exists
** (int) type: Type of the resource to check
** (int) number: Number of the resource to check
- ** Returns : (resource_t *) non-NULL if the resource exists, NULL otherwise
+ ** Returns : (Resource *) non-NULL if the resource exists, NULL otherwise
** This function may often be much faster than finding the resource
** and should be preferred for simple tests.
** The resource object returned is, indeed, the resource in question, but
** it should be used with care, as it may be unallocated.
** Use scir_find_resource() if you want to use the data contained in the resource.
*/
- resource_t *testResource(int type, int number);
+ Resource *testResource(int type, int number);
protected:
int _maxMemory; /* Config option: Maximum total byte number allocated */
int _resourcesNr;
ResourceSource *_sources;
- resource_t *_resources;
+ Resource *_resources;
int _memoryLocked; // Amount of resource bytes in locked memory
int _memoryLRU; // Amount of resource bytes under LRU control
- resource_t *lru_first, *lru_last; // Pointers to the first and last LRU queue entries
+ Resource *lru_first, *lru_last; // Pointers to the first and last LRU queue entries
// LRU queue: lru_first points to the most recent entry
/* Frees a block of resources and associated data
- ** Parameters: (resource_t *) resources: The resources to free
+ ** Parameters: (Resource *) resources: The resources to free
** (int) _resourcesNr: Number of resources in the block
** Returns : (void)
*/
- void freeResources(resource_t *resources, int _resourcesNr);
- /* Finds a resource matching type.number in an unsorted resource_t block
+ void freeResources(Resource *resources, int _resourcesNr);
+ /* Finds a resource matching type.number in an unsorted Resource block
** To be used during initial resource loading, when the resource list
** may not have been sorted yet.
- ** Parameters: (resource_t *) res: Pointer to the block to search in
- ** (int) res_nr: Number of resource_t structs allocated and defined
+ ** Parameters: (Resource *) res: Pointer to the block to search in
+ ** (int) res_nr: Number of Resource structs allocated and defined
** in the block pointed to by res
** (int) type: Type of the resource to look for
** (int) number: Number of the resource to look for
- ** Returns : (resource_t) The matching resource entry, or NULL if not found
+ ** Returns : (Resource) The matching resource entry, or NULL if not found
*/
- resource_t *findResourceUnsorted(resource_t *res, int res_nr, int type, int number);
+ Resource *findResourceUnsorted(Resource *res, int res_nr, int type, int number);
/* Adds an alternative source to a resource
- ** Parameters: (resource_t *) res: The resource to add to
+ ** Parameters: (Resource *) res: The resource to add to
** (ResourceSource *) source: The source of the resource
** (unsigned int) file_offset: Offset in the file the resource
** is stored at
** Returns : (void)
*/
int addAppropriateSources();
- void addAltSource(resource_t *res, ResourceSource *source, unsigned int file_offset);
+ void addAltSource(Resource *res, ResourceSource *source, unsigned int file_offset);
void freeResourceSources(ResourceSource *rss);
void freeAltSources(resource_altsource_t *dynressrc);
- void loadResource(resource_t *res, bool protect);
- void loadFromPatchFile(Common::File &file, resource_t *res, char *filename);
+ void loadResource(Resource *res, bool protect);
+ void loadFromPatchFile(Common::File &file, Resource *res, char *filename);
void freeOldResources(int last_invulnerable);
- void unalloc(resource_t *res);
+ void unalloc(Resource *res);
/**--- Resource map decoding functions ---*/
@@ -292,7 +290,7 @@ protected:
int readResourceMapSCI1(ResourceSource *map, ResourceSource *vol, int *sci_version);
int isSCI10or11(int *types);
int detectOddSCI01(Common::File &file);
- int resReadEntry(ResourceSource *map, byte *buf, resource_t *res, int sci_version);
+ int resReadEntry(ResourceSource *map, byte *buf, Resource *res, int sci_version);
int resTypeSCI1(int ofs, int *types, int lastrt);
int parseHeaderSCI1(Common::ReadStream &stream, int *types, int *lastrt);
@@ -300,7 +298,7 @@ protected:
/* Reads SCI0 patch files from a local directory
** Parameters: (char *) path: (unused)
- ** (resource_t **) resources: Pointer to a pointer
+ ** (Resource **) resources: Pointer to a pointer
** that will be set to the
** location of the resources
** (in one large chunk)
@@ -312,7 +310,7 @@ protected:
/* Reads SCI1 patch files from a local directory
** Parameters: (char *) path: (unused)
- ** (resource_t **) resources: Pointer to a pointer
+ ** (Resource **) resources: Pointer to a pointer
** that will be set to the
** location of the resources
** (in one large chunk)
@@ -325,49 +323,49 @@ protected:
int resnumber);
void printLRU();
- void addToLRU(resource_t *res);
- void removeFromLRU(resource_t *res);
+ void addToLRU(Resource *res);
+ void removeFromLRU(Resource *res);
};
/* Prints the name of a matching patch to a string buffer
** Parameters: (char *) string: The buffer to print to
- ** (resource_t *) res: Resource containing the number and type of the
+ ** (Resource *) res: Resource containing the number and type of the
** resource whose name is to be print
** Returns : (void)
*/
- void sci0_sprintf_patch_file_name(char *string, resource_t *res);
+ void sci0_sprintf_patch_file_name(char *string, Resource *res);
/* Prints the name of a matching patch to a string buffer
** Parameters: (char *) string: The buffer to print to
- ** (resource_t *) res: Resource containing the number and type of the
+ ** (Resource *) res: Resource containing the number and type of the
** resource whose name is to be print
** Returns : (void)
*/
- void sci1_sprintf_patch_file_name(char *string, resource_t *res);
+ void sci1_sprintf_patch_file_name(char *string, Resource *res);
/**--- Decompression functions ---**/
- int decompress0(resource_t *result, Common::ReadStream &stream, int sci_version);
+ int decompress0(Resource *result, Common::ReadStream &stream, int sci_version);
/* Decrypts resource data and stores the result for SCI0-style compression.
- ** Parameters : result: The resource_t the decompressed data is stored in.
+ ** Parameters : result: The Resource the decompressed data is stored in.
** stream: Stream of the resource file
** sci_version : Actual SCI resource version
** Returns : (int) 0 on success, one of SCI_ERROR_* if a problem was
** encountered.
*/
- int decompress01(resource_t *result, Common::ReadStream &stream, int sci_version);
+ int decompress01(Resource *result, Common::ReadStream &stream, int sci_version);
/* Decrypts resource data and stores the result for SCI01-style compression.
- ** Parameters : result: The resource_t the decompressed data is stored in.
+ ** Parameters : result: The Resource the decompressed data is stored in.
** stream: Stream of the resource file
** sci_version : Actual SCI resource version
** Returns : (int) 0 on success, one of SCI_ERROR_* if a problem was
** encountered.
*/
- int decompress1(resource_t *result, Common::ReadStream &stream, int sci_version);
+ int decompress1(Resource *result, Common::ReadStream &stream, int sci_version);
/* Decrypts resource data and stores the result for SCI1.1-style compression.
- ** Parameters : result: The resource_t the decompressed data is stored in.
+ ** Parameters : result: The Resource the decompressed data is stored in.
** sci_version : Actual SCI resource version
** stream: Stream of the resource file
** Returns : (int) 0 on success, one of SCI_ERROR_* if a problem was
@@ -375,9 +373,9 @@ protected:
*/
- int decompress11(resource_t *result, Common::ReadStream &stream, int sci_version);
+ int decompress11(Resource *result, Common::ReadStream &stream, int sci_version);
/* Decrypts resource data and stores the result for SCI1.1-style compression.
- ** Parameters : result: The resource_t the decompressed data is stored in.
+ ** Parameters : result: The Resource the decompressed data is stored in.
** sci_version : Actual SCI resource version
** stream: Stream of the resource file
** Returns : (int) 0 on success, one of SCI_ERROR_* if a problem was
diff --git a/engines/sci/scicore/resource_map.cpp b/engines/sci/scicore/resource_map.cpp
index 650912a869..dc2ad4f8bb 100644
--- a/engines/sci/scicore/resource_map.cpp
+++ b/engines/sci/scicore/resource_map.cpp
@@ -119,7 +119,7 @@ int ResourceManager::detectOddSCI01(Common::File &file) {
return files_ok;
}
-int ResourceManager::resReadEntry(ResourceSource *map, byte *buf, resource_t *res, int sci_version) {
+int ResourceManager::resReadEntry(ResourceSource *map, byte *buf, Resource *res, int sci_version) {
res->id = buf[0] | (buf[1] << 8);
res->type = SCI0_RESID_GET_TYPE(buf);
res->number = SCI0_RESID_GET_NUMBER(buf);
@@ -200,7 +200,7 @@ int ResourceManager::parseHeaderSCI1(Common::ReadStream &stream, int *types, int
int ResourceManager::readResourceMapSCI0(ResourceSource *map, int *sci_version) {
int fsize;
Common::File file;
- resource_t *resources;
+ Resource *resources;
int resource_nr;
int resource_index = 0;
int resources_total_read = 0;
@@ -257,7 +257,7 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map, int *sci_version)
resource_nr = fsize / SCI0_RESMAP_ENTRIES_SIZE;
- resources = (resource_t *)sci_calloc(resource_nr, sizeof(resource_t));
+ resources = (Resource *)sci_calloc(resource_nr, sizeof(Resource));
// Sets valid default values for most entries
do {
@@ -330,7 +330,7 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map, int *sci_version)
}
if (resource_index < resource_nr)
- resources = (resource_t *)sci_realloc(resources, sizeof(resource_t) * resource_index);
+ resources = (Resource *)sci_realloc(resources, sizeof(Resource) * resource_index);
_resources = resources;
_resourcesNr = resource_index;
@@ -374,7 +374,7 @@ int ResourceManager::isSCI10or11(int *types) {
int ResourceManager::readResourceMapSCI1(ResourceSource *map, ResourceSource *vol, int *sci_version) {
int fsize;
Common::File file;
- resource_t *resources, *resource_start;
+ Resource *resources, *resource_start;
int resource_nr;
int resource_index = 0;
int ofs, header_size;
@@ -412,7 +412,8 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map, ResourceSource *vo
}
resource_nr = (fsize - types[0]) / entrysize;
- resource_start = resources = (resource_t*)sci_realloc(_resources, (_resourcesNr + resource_nr) * sizeof(resource_t));
+ resource_start = resources = (Resource*)sci_realloc(_resources, (_resourcesNr + resource_nr) * sizeof(Resource));
+ memset(resource_start + sizeof(Resource) * _resourcesNr, 0, resource_nr * sizeof(Resource));
resources += _resourcesNr;
i = 0;
@@ -425,7 +426,7 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map, ResourceSource *vo
for (i = 0; i < resource_nr; i++) {
int read_ok = file.read(&buf, entrysize);
int j;
- resource_t *res;
+ Resource *res;
int addto = resource_index;
int fresh = 1;
@@ -487,7 +488,7 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map, ResourceSource *vo
#ifdef TEST_RESOURCE_MAP
int main(int argc, char **argv) {
int resource_nr;
- resource_t *resources;
+ Resource *resources;
int notok = sci0_read_resource_map(".", &resources, &resource_nr);
if (notok) {
@@ -501,7 +502,7 @@ int main(int argc, char **argv) {
printf("Found %d resources:\n", resource_nr);
for (i = 0; i < resource_nr; i++) {
- resource_t *res = resources + i;
+ Resource *res = resources + i;
printf("#%04d:\tRESOURCE.%03d:%8d\t%s.%03d\n", i, res->file, res->file_offset,
sci_resource_types[res->type], res->number);
diff --git a/engines/sci/scicore/resource_patch.cpp b/engines/sci/scicore/resource_patch.cpp
index 5a02b82dcf..05d97f5e48 100644
--- a/engines/sci/scicore/resource_patch.cpp
+++ b/engines/sci/scicore/resource_patch.cpp
@@ -31,11 +31,11 @@
namespace Sci {
-void sci0_sprintf_patch_file_name(char *string, resource_t *res) {
+void sci0_sprintf_patch_file_name(char *string, Resource *res) {
sprintf(string, "%s.%03i", sci_resource_types[res->type], res->number);
}
-void sci1_sprintf_patch_file_name(char *string, resource_t *res) {
+void sci1_sprintf_patch_file_name(char *string, Resource *res) {
sprintf(string, "%d.%s", res->number, sci_resource_type_suffixes[res->type]);
}
@@ -52,7 +52,7 @@ void ResourceManager::process_patch(ResourceSource *source,
perror("""__FILE__"": (""__LINE__""): failed to open");
else {
uint8 filehdr[2];
- resource_t *newrsc = findResourceUnsorted(_resources, _resourcesNr, restype, resnumber);
+ Resource *newrsc = findResourceUnsorted(_resources, _resourcesNr, restype, resnumber);
int fsize = file.size();
if (fsize < 3) {
printf("File too small\n");
@@ -77,7 +77,7 @@ void ResourceManager::process_patch(ResourceSource *source,
if (!newrsc) {
// Completely new resource!
_resourcesNr++;
- _resources = (resource_t *)sci_realloc(_resources, _resourcesNr * sizeof(resource_t));
+ _resources = (Resource *)sci_realloc(_resources, _resourcesNr * sizeof(Resource));
newrsc = (_resources - 1) + _resourcesNr;
newrsc->alt_sources = NULL;
}
diff --git a/engines/sci/scicore/script.cpp b/engines/sci/scicore/script.cpp
index 09c66d1e63..ab8259c7ec 100644
--- a/engines/sci/scicore/script.cpp
+++ b/engines/sci/scicore/script.cpp
@@ -329,7 +329,7 @@ static void script_dump_class(char *data, int seeker, int objsize, const Common:
void script_dissect(ResourceManager *resmgr, int res_no, const Common::StringList &selectorNames) {
int objectctr[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
unsigned int _seeker = 0;
- resource_t *script = resmgr->findResource(sci_script, res_no, 0);
+ Resource *script = resmgr->findResource(sci_script, res_no, 0);
word_t **words;
int word_count;
diff --git a/engines/sci/scicore/vocab.cpp b/engines/sci/scicore/vocab.cpp
index 13f705a17f..e6d242328c 100644
--- a/engines/sci/scicore/vocab.cpp
+++ b/engines/sci/scicore/vocab.cpp
@@ -72,7 +72,7 @@ word_t **vocab_get_words(ResourceManager *resmgr, int *word_counter) {
char currentword[256] = ""; // They're not going to use words longer than 255 ;-)
int currentwordpos = 0;
- resource_t *resource;
+ Resource *resource;
// First try to load the SCI0 vocab resource.
resource = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB, 0);
@@ -179,7 +179,7 @@ static inline unsigned int inverse_16(unsigned int foo) {
suffix_t **vocab_get_suffices(ResourceManager *resmgr, int *suffices_nr) {
int counter = 0;
suffix_t **suffices;
- resource_t *resource = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_SUFFIX_VOCAB, 1);
+ Resource *resource = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_SUFFIX_VOCAB, 1);
unsigned int seeker = 1;
if (!resource) {
@@ -241,7 +241,7 @@ void vocab_free_branches(parse_tree_branch_t *parser_branches) {
}
parse_tree_branch_t *vocab_get_branches(ResourceManager * resmgr, int *branches_nr) {
- resource_t *resource = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_PARSE_TREE_BRANCHES, 0);
+ Resource *resource = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_PARSE_TREE_BRANCHES, 0);
parse_tree_branch_t *retval;
int i;
diff --git a/engines/sci/scicore/vocab_debug.cpp b/engines/sci/scicore/vocab_debug.cpp
index 6a9eb4183b..b5d8dd5d55 100644
--- a/engines/sci/scicore/vocab_debug.cpp
+++ b/engines/sci/scicore/vocab_debug.cpp
@@ -155,7 +155,7 @@ int getInt(unsigned char* d) {
}
int *vocabulary_get_classes(ResourceManager *resmgr, int* count) {
- resource_t* r;
+ Resource* r;
int *c;
unsigned int i;
@@ -172,7 +172,7 @@ int *vocabulary_get_classes(ResourceManager *resmgr, int* count) {
}
int vocabulary_get_class_count(ResourceManager *resmgr) {
- resource_t* r;
+ Resource* r;
if ((r = resmgr->findResource(sci_vocab, 996, 0)) == 0)
return 0;
@@ -183,7 +183,7 @@ int vocabulary_get_class_count(ResourceManager *resmgr) {
bool vocabulary_get_snames(ResourceManager *resmgr, sci_version_t version, Common::StringList &selectorNames) {
int count;
- resource_t *r = resmgr->findResource(sci_vocab, 997, 0);
+ Resource *r = resmgr->findResource(sci_vocab, 997, 0);
if (!r) // No such resource?
return false;
@@ -218,7 +218,7 @@ int vocabulary_lookup_sname(const Common::StringList &selectorNames, const char
opcode* vocabulary_get_opcodes(ResourceManager *resmgr) {
opcode* o;
int count, i = 0;
- resource_t* r = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_OPCODES, 0);
+ Resource* r = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_OPCODES, 0);
// if the resource couldn't be loaded, leave
if (r == NULL) {
@@ -263,7 +263,7 @@ void vocabulary_free_opcodes(opcode *opcodes) {
}
// Alternative kernel func names retriever. Required for KQ1/SCI (at least).
-static char **_vocabulary_get_knames0alt(int *names, resource_t *r) {
+static char **_vocabulary_get_knames0alt(int *names, Resource *r) {
unsigned int mallocsize = 32;
char **retval = (char **)sci_malloc(sizeof(char *) * mallocsize);
unsigned int i = 0, index = 0;
@@ -295,7 +295,7 @@ static char **_vocabulary_get_knames0alt(int *names, resource_t *r) {
static char **vocabulary_get_knames0(ResourceManager *resmgr, int* names) {
char** t;
int count, i, index = 2, empty_to_add = 1;
- resource_t *r = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_KNAMES, 0);
+ Resource *r = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_KNAMES, 0);
if (!r) { // No kernel name table found? Fall back to default table
t = (char **)sci_malloc((SCI0_KNAMES_DEFAULT_ENTRIES_NR + 1) * sizeof(char*));
@@ -345,7 +345,7 @@ static char **vocabulary_get_knames0(ResourceManager *resmgr, int* names) {
static char **vocabulary_get_knames1(ResourceManager *resmgr, int *count) {
char **t = NULL;
unsigned int size = 64, used = 0, pos = 0;
- resource_t *r = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_KNAMES, 0);
+ Resource *r = resmgr->findResource(sci_vocab, VOCAB_RESOURCE_KNAMES, 0);
while (pos < r->size) {
int len;
diff --git a/engines/sci/sfx/player/polled.cpp b/engines/sci/sfx/player/polled.cpp
index ff3feea6ed..2d9f4903e7 100644
--- a/engines/sci/sfx/player/polled.cpp
+++ b/engines/sci/sfx/player/polled.cpp
@@ -159,7 +159,7 @@ static int pp_set_option(char *name, char *value) {
}
static int pp_init(ResourceManager *resmgr, int expected_latency) {
- resource_t *res = NULL, *res2 = NULL;
+ Resource *res = NULL, *res2 = NULL;
if (!mixer)
return SFX_ERROR;
diff --git a/engines/sci/sfx/player/realtime.cpp b/engines/sci/sfx/player/realtime.cpp
index a4554eafff..59950bb9ad 100644
--- a/engines/sci/sfx/player/realtime.cpp
+++ b/engines/sci/sfx/player/realtime.cpp
@@ -128,8 +128,8 @@ static void rt_timer_callback(void) {
}
}
-static resource_t *find_patch(ResourceManager *resmgr, const char *seq_name, int patchfile) {
- resource_t *res = NULL;
+static Resource *find_patch(ResourceManager *resmgr, const char *seq_name, int patchfile) {
+ Resource *res = NULL;
if (patchfile != SFX_SEQ_PATCHFILE_NONE) {
res = resmgr->findResource(sci_patch, patchfile, 0);
@@ -149,7 +149,7 @@ static int rt_set_option(char *name, char *value) {
}
static int rt_init(ResourceManager *resmgr, int expected_latency) {
- resource_t *res = NULL, *res2 = NULL;
+ Resource *res = NULL, *res2 = NULL;
void *seq_dev = NULL;
seq = sfx_find_sequencer(NULL);