aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/game.cpp18
-rw-r--r--engines/sci/engine/kmenu.cpp2
-rw-r--r--engines/sci/engine/kscripts.cpp6
-rw-r--r--engines/sci/engine/ksound.cpp10
-rw-r--r--engines/sci/engine/kstring.cpp4
-rw-r--r--engines/sci/engine/message.cpp4
-rw-r--r--engines/sci/engine/savegame.cfsml4
-rw-r--r--engines/sci/engine/savegame.cpp4
-rw-r--r--engines/sci/engine/script.h2
-rw-r--r--engines/sci/engine/scriptconsole.cpp8
-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
13 files changed, 40 insertions, 40 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index fbccc9a7cc..9d5f20043b 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -142,7 +142,7 @@ int _reset_graphics_input(EngineState *s) {
file.close();
_sci1_alloc_system_colors(s);
} else {
- resource = scir_find_resource(s->resmgr, sci_palette, 999, 1);
+ resource = s->resmgr->findResource(sci_palette, 999, 1);
if (resource) {
if (s->version < SCI_VERSION(1, 001, 000))
s->gfx_state->resstate->static_palette = gfxr_read_pal1(999, &s->gfx_state->resstate->static_palette_entries,
@@ -151,7 +151,7 @@ int _reset_graphics_input(EngineState *s) {
s->gfx_state->resstate->static_palette = gfxr_read_pal11(999, &s->gfx_state->resstate->static_palette_entries,
resource->data, resource->size);
_sci1_alloc_system_colors(s);
- scir_unlock_resource(s->resmgr, resource, sci_palette, 999);
+ s->resmgr->unlockResource(resource, sci_palette, 999);
} else {
sciprintf("Couldn't find the default palette!\n");
}
@@ -184,7 +184,7 @@ int _reset_graphics_input(EngineState *s) {
font_nr = -1;
do {
- resource = scir_test_resource(s->resmgr, sci_font, ++font_nr);
+ resource = s->resmgr->testResource(sci_font, ++font_nr);
} while ((!resource) && (font_nr < sci_max_resource_nr[s->resmgr->sci_version]));
if (!resource) {
@@ -295,7 +295,7 @@ int test_cursor_style(EngineState *s) {
int ok = 0;
do {
- ok |= scir_test_resource(s->resmgr, sci_cursor, resource_nr++) != NULL;
+ ok |= s->resmgr->testResource(sci_cursor, resource_nr++) != NULL;
} while (resource_nr < 1000 && !ok);
return ok;
@@ -307,7 +307,7 @@ int create_class_table_sci11(EngineState *s) {
char *seeker_ptr;
int classnr;
- resource_t *vocab996 = scir_find_resource(s->resmgr, sci_vocab, 996, 1);
+ resource_t *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 = scir_find_resource(s->resmgr, sci_heap, scriptnr, 0);
+ resource_t *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 = scir_find_resource(s->resmgr, sci_vocab, 996, 1);
+ resource_t *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 = scir_find_resource(s->resmgr, sci_script, scriptnr, 0);
+ resource_t *script = s->resmgr->findResource(sci_script, scriptnr, 0);
if (script) {
if (s->version < SCI_VERSION_FTU_NEW_SCRIPT_HEADER)
@@ -435,7 +435,7 @@ static int create_class_table_sci0(EngineState *s) {
}
}
- scir_unlock_resource(s->resmgr, vocab996, sci_vocab, 996);
+ s->resmgr->unlockResource(vocab996, sci_vocab, 996);
vocab996 = NULL;
return 0;
}
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index faa4801ed9..71c02e172e 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -210,7 +210,7 @@ void about_freesci(EngineState *s) {
i = 999;
while (!bodyfont_res && (i > -1))
- bodyfont_res = scir_test_resource(s->resmgr, sci_font, i--);
+ bodyfont_res = s->resmgr->testResource(sci_font, i--);
if (i == -1) {
sciprintf("Sorry, couldn't find a font...\n");
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 805a979701..f334bfddf8 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -133,11 +133,11 @@ reg_t kLock(EngineState *s, int funct_nr, int argc, reg_t *argv) {
switch (state) {
case 1 :
- scir_find_resource(s->resmgr, restype, resnr, 1);
+ s->resmgr->findResource(restype, resnr, 1);
break;
case 0 :
- which = scir_find_resource(s->resmgr, restype, resnr, 0);
- scir_unlock_resource(s->resmgr, which, resnr, restype);
+ which = s->resmgr->findResource(restype, resnr, 0);
+ s->resmgr->unlockResource(which, resnr, restype);
break;
}
return s->r_acc;
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index 3a60f77fff..3aec1add7d 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 = scir_find_resource(s->resmgr, sci_sound, song_nr, 0);
+ resource_t *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 = scir_find_resource(s->resmgr, sci_sound, song_nr, 0);
+ resource_t *song = s->resmgr->findResource(sci_sound, song_nr, 0);
if (!song)
return NULL;
@@ -486,7 +486,7 @@ reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) {
//int vol = GET_SEL32V(obj, vol);
//int pri = GET_SEL32V(obj, pri);
- if (obj.segment && (scir_test_resource(s->resmgr, sci_sound, number))) {
+ if (obj.segment && (s->resmgr->testResource(sci_sound, number))) {
sciprintf("Initializing song number %d\n", number);
SCRIPT_ASSERT_ZERO(sfx_add_song(&s->sound,
build_iterator(s, number,
@@ -802,7 +802,7 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
if (!GET_SEL32V(obj, nodePtr) && obj.segment) {
- if (!scir_test_resource(s->resmgr, sci_sound, number)) {
+ if (!s->resmgr->testResource(sci_sound, number)) {
sciprintf("Could not open song number %d\n", number);
return NULL_REG;
}
@@ -839,7 +839,7 @@ reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) {
sfx_remove_song(&s->sound, handle);
}
- if (obj.segment && (scir_test_resource(s->resmgr, sci_sound, number))) {
+ if (obj.segment && (s->resmgr->testResource(sci_sound, number))) {
sciprintf("Initializing song number %d\n", number);
SCRIPT_ASSERT_ZERO(sfx_add_song(&s->sound,
build_iterator(s, number,
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index ee1d02616e..ad02576f99 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -48,7 +48,7 @@ char *kernel_lookup_text(EngineState *s, reg_t address, int index) {
else {
int textlen;
int _index = index;
- textres = scir_find_resource(s->resmgr, sci_text, address.offset, 0);
+ textres = s->resmgr->findResource(sci_text, address.offset, 0);
if (!textres) {
SCIkwarn(SCIkERROR, "text.%03d not found\n", address);
@@ -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 = scir_find_resource(s->resmgr, sci_text, UKPV(0), 0);
+ resource_t *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 a8f8eed6ec..4be5f10042 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -161,7 +161,7 @@ int message_state_load_res(MessageState *state, int module) {
return 1;
state->module = module;
- state->current_res = scir_find_resource(state->resmgr, sci_message, module, 0);
+ state->current_res = state->resmgr->findResource(sci_message, module, 0);
if (state->current_res == NULL || state->current_res->data == NULL) {
sciprintf("Message subsystem: Failed to load %d.MSG\n", module);
@@ -186,7 +186,7 @@ static MessageHandler fixed_handler = {
};
void message_state_initialize(ResourceManager *resmgr, MessageState *state) {
- //resource_t *tester = scir_find_resource(resmgr, sci_message, 0, 0);
+ //resource_t *tester = resmgr->findResource(sci_message, 0, 0);
//int version;
//if (tester == NULL)
diff --git a/engines/sci/engine/savegame.cfsml b/engines/sci/engine/savegame.cfsml
index 66eec5aed9..9d8833715e 100644
--- a/engines/sci/engine/savegame.cfsml
+++ b/engines/sci/engine/savegame.cfsml
@@ -851,9 +851,9 @@ static void load_script(EngineState *s, SegmentId seg) {
scr->buf = (byte *)malloc(scr->buf_size);
- script = scir_find_resource(s->resmgr, sci_script, scr->nr, 0);
+ script = s->resmgr->findResource(sci_script, scr->nr, 0);
if (s->version >= SCI_VERSION(1,001,000))
- heap = scir_find_resource(s->resmgr, sci_heap, scr->nr, 0);
+ heap = s->resmgr->findResource(sci_heap, scr->nr, 0);
switch (s->seg_manager->isSci1_1) {
case 0 :
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index c6d2086436..3eaadf4c3b 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -4947,9 +4947,9 @@ static void load_script(EngineState *s, SegmentId seg) {
scr->buf = (byte *)malloc(scr->buf_size);
- script = scir_find_resource(s->resmgr, sci_script, scr->nr, 0);
+ script = s->resmgr->findResource(sci_script, scr->nr, 0);
if (s->version >= SCI_VERSION(1,001,000))
- heap = scir_find_resource(s->resmgr, sci_heap, scr->nr, 0);
+ heap = s->resmgr->findResource(sci_heap, scr->nr, 0);
switch (s->seg_manager->isSci1_1) {
case 0 :
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index fcc2f843f9..2a882cbb19 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -31,7 +31,7 @@
namespace Sci {
struct EngineState;
-struct ResourceManager;
+class ResourceManager;
/*#define SCRIPT_DEBUG */
diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp
index 68146afc24..a8c79bd962 100644
--- a/engines/sci/engine/scriptconsole.cpp
+++ b/engines/sci/engine/scriptconsole.cpp
@@ -841,7 +841,7 @@ static int c_list(EngineState *s) {
sciprintf("Unknown resource type: '%s'\n", cmd_params[0].str);
else {
for (i = 0; i < sci_max_resource_nr[s->resmgr->sci_version]; i++)
- if (scir_test_resource(s->resmgr, res, i))
+ if (s->resmgr->testResource(res, i))
sciprintf("%s.%03d\n", sci_resource_types[res], i);
}
}
@@ -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 = scir_find_resource(s->resmgr, res, cmd_params[1].val, 0);
+ resource_t *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 = scir_find_resource(s->resmgr, res, cmd_params[1].val, 0);
+ resource_t *resource = s->resmgr->findResource(res, cmd_params[1].val, 0);
if (resource)
sci_hexdump(resource->data, resource->size, 0);
else
@@ -975,7 +975,7 @@ static int c_hexgrep(EngineState *s) {
}
for (; resnr <= resmax; resnr++)
- if ((script = scir_find_resource(s->resmgr, restype, resnr, 0))) {
+ if ((script = s->resmgr->findResource(restype, resnr, 0))) {
unsigned int seeker = 0, seekerold = 0;
int comppos = 0;
int output_script_name = 0;
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 9307bc0b09..190a054e43 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 = scir_find_resource(s->resmgr, sci_sound, cmd_params[0].val, 0);
+ resource_t *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 = scir_find_resource(s->resmgr, sci_sound, cmd_params[0].val, 0);
+ resource_t *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 = scir_find_resource(s->resmgr, sci_sound, cmd_params[0].val, 0);
+ resource_t *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 ec551fd672..949b04928b 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 = scir_find_resource(s->resmgr, sci_script, script_nr, 0);
- resource_t *heap = scir_find_resource(s->resmgr, sci_heap, script_nr, 0);
+ resource_t *script = s->resmgr->findResource(sci_script, script_nr, 0);
+ resource_t *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 16f33bb27f..b35736cd4a 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1595,13 +1595,13 @@ void script_detect_versions(EngineState *s) {
int c;
resource_t *script = {0};
- if (scir_find_resource(s->resmgr, sci_heap, 0, 0)) {
+ if (s->resmgr->findResource(sci_heap, 0, 0)) {
version_require_later_than(s, SCI_VERSION(1, 001, 000));
return;
}
for (c = 0; c < 1000; c++) {
- if ((script = scir_find_resource(s->resmgr, sci_script, c, 0))) {
+ if ((script = s->resmgr->findResource(sci_script, c, 0))) {
int id = getInt16(script->data);
@@ -1679,9 +1679,9 @@ int script_instantiate_common(EngineState *s, int script_nr, resource_t **script
*was_new = 1;
- *script = scir_find_resource(s->resmgr, sci_script, script_nr, 0);
+ *script = s->resmgr->findResource(sci_script, script_nr, 0);
if (s->version >= SCI_VERSION(1, 001, 000))
- *heap = scir_find_resource(s->resmgr, sci_heap, script_nr, 0);
+ *heap = s->resmgr->findResource(sci_heap, script_nr, 0);
if (!*script || (s->version >= SCI_VERSION(1, 001, 000) && !heap)) {
sciprintf("Script 0x%x requested but not found\n", script_nr);