aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMax Horn2010-02-13 17:44:19 +0000
committerMax Horn2010-02-13 17:44:19 +0000
commita82939c9bee20f2969f1006c1c9a836cea5c7903 (patch)
tree1d09caf84f1b1d7787b539952cd739f66383c68d /engines/sci/engine
parent721a57a66101d63bc05e294c24190ba66ccceb74 (diff)
downloadscummvm-rg350-a82939c9bee20f2969f1006c1c9a836cea5c7903.tar.gz
scummvm-rg350-a82939c9bee20f2969f1006c1c9a836cea5c7903.tar.bz2
scummvm-rg350-a82939c9bee20f2969f1006c1c9a836cea5c7903.zip
SCI: Get rid of EngineState::resMan
svn-id: r48048
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/game.cpp6
-rw-r--r--engines/sci/engine/kgraphics.cpp8
-rw-r--r--engines/sci/engine/kmenu.cpp2
-rw-r--r--engines/sci/engine/kscripts.cpp10
-rw-r--r--engines/sci/engine/ksound.cpp2
-rw-r--r--engines/sci/engine/kstring.cpp4
-rw-r--r--engines/sci/engine/message.cpp2
-rw-r--r--engines/sci/engine/savegame.cpp12
-rw-r--r--engines/sci/engine/state.cpp6
-rw-r--r--engines/sci/engine/state.h3
-rw-r--r--engines/sci/engine/vm.cpp2
11 files changed, 28 insertions, 29 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index b72322ada3..5b61fdd734 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -182,7 +182,7 @@ int game_init_sound(EngineState *s, int sound_flags, SciVersion soundVersion) {
sound_flags |= SFX_STATE_FLAG_MULTIPLAY;
s->sfx_init_flags = sound_flags;
- s->_sound.sfx_init(s->resMan, sound_flags, soundVersion);
+ s->_sound.sfx_init(g_sci->getResMan(), sound_flags, soundVersion);
return 0;
}
@@ -243,7 +243,7 @@ int game_init(EngineState *s) {
s->stack_base = stack->_entries;
s->stack_top = stack->_entries + stack->_capacity;
- if (!script_instantiate(s->resMan, s->_segMan, 0)) {
+ if (!script_instantiate(g_sci->getResMan(), s->_segMan, 0)) {
warning("game_init(): Could not instantiate script 0");
return 1;
}
@@ -274,7 +274,7 @@ int game_init(EngineState *s) {
// The first entry in the export table of script 0 points to the game object
s->_gameObj = s->_segMan->lookupScriptExport(0, 0);
uint32 gameFlags = 0; // unused
- s->_gameId = convertSierraGameId(s->_segMan->getObjectName(s->_gameObj), &gameFlags, s->resMan);
+ s->_gameId = convertSierraGameId(s->_segMan->getObjectName(s->_gameObj), &gameFlags, g_sci->getResMan());
debug(2, " \"%s\" at %04x:%04x", s->_gameId.c_str(), PRINT_REG(s->_gameObj));
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index f031b5130b..e82bf17182 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -234,9 +234,9 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
switch (argv[0].toSint16()) {
case K_GRAPH_GET_COLORS_NR:
- if (s->resMan->isAmiga32color())
+ if (g_sci->getResMan()->isAmiga32color())
return make_reg(0, 32);
- return make_reg(0, !s->resMan->isVGA() ? 16 : 256);
+ return make_reg(0, !g_sci->getResMan()->isVGA() ? 16 : 256);
break;
case K_GRAPH_DRAW_LINE:
@@ -245,7 +245,7 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
color = argv[5].toSint16();
// TODO: Find out why we get >15 for color in EGA
- if (!s->resMan->isVGA() && !s->resMan->isAmiga32color())
+ if (!g_sci->getResMan()->isVGA() && !g_sci->getResMan()->isAmiga32color())
color &= 0x0F;
g_sci->_gfxPaint16->kernelGraphDrawLine(Common::Point(x, y), Common::Point(x1, y1), color, priority, control);
@@ -552,7 +552,7 @@ reg_t kSetNowSeen(EngineState *s, int argc, reg_t *argv) {
reg_t kPalette(EngineState *s, int argc, reg_t *argv) {
// we are called on EGA/amiga games as well, this doesnt make sense.
// doing this would actually break the system EGA/amiga palette
- if (!s->resMan->isVGA())
+ if (!g_sci->getResMan()->isVGA())
return s->r_acc;
switch (argv[0].toUint16()) {
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index 4fca99b974..631deffe3a 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -71,7 +71,7 @@ reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv) {
reg_t textReference = argv[0];
Common::String text;
int16 colorPen = (argc > 1) ? argv[1].toSint16() : 0;
- int16 colorBack = (argc > 2) ? argv[2].toSint16() : s->resMan->isVGA() ? 255 : 15;
+ int16 colorBack = (argc > 2) ? argv[2].toSint16() : g_sci->getResMan()->isVGA() ? 255 : 15;
if (!textReference.isNull()) {
// Sometimes this is called without giving text, if thats the case dont process it
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 1fca13cb44..945a63459b 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -54,13 +54,13 @@ reg_t kLock(EngineState *s, int argc, reg_t *argv) {
switch (state) {
case 1 :
- s->resMan->findResource(id, 1);
+ g_sci->getResMan()->findResource(id, 1);
break;
case 0 :
- which = s->resMan->findResource(id, 0);
+ which = g_sci->getResMan()->findResource(id, 0);
if (which)
- s->resMan->unlockResource(which);
+ g_sci->getResMan()->unlockResource(which);
else {
if (id.type == kResourceTypeInvalid)
warning("[resMan] Attempt to unlock resource %i of invalid type %i", id.number, type);
@@ -101,10 +101,10 @@ reg_t kResCheck(EngineState *s, int argc, reg_t *argv) {
uint cond = argv[4].toUint16() & 0xff;
uint seq = argv[5].toUint16() & 0xff;
- res = s->resMan->testResource(ResourceId(restype, argv[1].toUint16(), noun, verb, cond, seq));
+ res = g_sci->getResMan()->testResource(ResourceId(restype, argv[1].toUint16(), noun, verb, cond, seq));
}
} else {
- res = s->resMan->testResource(ResourceId(restype, argv[1].toUint16()));
+ res = g_sci->getResMan()->testResource(ResourceId(restype, argv[1].toUint16()));
}
return make_reg(0, res != NULL);
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index 8106a19aec..21a22438d2 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -147,7 +147,7 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) {
int16 language = argv[1].toSint16();
if (language != -1)
- s->resMan->setAudioLanguage(language);
+ g_sci->getResMan()->setAudioLanguage(language);
return make_reg(0, s->getLanguage());
}
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index f3662da6fe..14b5ab6742 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -43,7 +43,7 @@ Common::String kernel_lookup_text(EngineState *s, reg_t address, int index) {
else {
int textlen;
int _index = index;
- textres = s->resMan->findResource(ResourceId(kResourceTypeText, address.offset), 0);
+ textres = g_sci->getResMan()->findResource(ResourceId(kResourceTypeText, address.offset), 0);
if (!textres) {
error("text.%03d not found", address.offset);
@@ -420,7 +420,7 @@ reg_t kStrLen(EngineState *s, int argc, reg_t *argv) {
reg_t kGetFarText(EngineState *s, int argc, reg_t *argv) {
- Resource *textres = s->resMan->findResource(ResourceId(kResourceTypeText, argv[0].toUint16()), 0);
+ Resource *textres = g_sci->getResMan()->findResource(ResourceId(kResourceTypeText, argv[0].toUint16()), 0);
char *seeker;
int counter = argv[1].toUint16();
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp
index 5d72248939..84029392d1 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -135,7 +135,7 @@ public:
};
bool MessageState::getRecord(CursorStack &stack, bool recurse, MessageRecord &record) {
- Resource *res = g_sci->getResourceManager()->findResource(ResourceId(kResourceTypeMessage, stack.getModule()), 0);
+ Resource *res = g_sci->getResMan()->findResource(ResourceId(kResourceTypeMessage, stack.getModule()), 0);
if (!res) {
warning("Failed to open message resource %d", stack.getModule());
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 23a97166fa..d579b29b9e 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -292,7 +292,7 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsSint32LE(Nodes_seg_id);
}
-static void sync_SegManagerPtr(Common::Serializer &s, ResourceManager *&resMan, SegManager *&obj) {
+static void sync_SegManagerPtr(Common::Serializer &s, SegManager *&obj) {
s.skip(1, VER(9), VER(9)); // obsolete: used to be a flag indicating if we got sci11 or not
if (s.isLoading())
@@ -380,7 +380,7 @@ void EngineState::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsSint16LE(picPortLeft);
}
- sync_SegManagerPtr(s, resMan, _segMan);
+ sync_SegManagerPtr(s, _segMan);
syncArray<Class>(s, _segMan->_classtable);
@@ -776,14 +776,14 @@ static void load_script(EngineState *s, Script *scr) {
scr->_buf = (byte *)malloc(scr->_bufSize);
assert(scr->_buf);
- Resource *script = s->resMan->findResource(ResourceId(kResourceTypeScript, scr->_nr), 0);
+ Resource *script = g_sci->getResMan()->findResource(ResourceId(kResourceTypeScript, scr->_nr), 0);
assert(script != 0);
assert(scr->_bufSize >= script->size);
memcpy(scr->_buf, script->data, script->size);
if (getSciVersion() >= SCI_VERSION_1_1) {
- Resource *heap = s->resMan->findResource(ResourceId(kResourceTypeHeap, scr->_nr), 0);
+ Resource *heap = g_sci->getResMan()->findResource(ResourceId(kResourceTypeHeap, scr->_nr), 0);
assert(heap != 0);
scr->_heapStart = scr->_buf + scr->_scriptSize;
@@ -887,7 +887,7 @@ static void reconstruct_sounds(EngineState *s) {
int oldstatus;
SongIterator::Message msg;
- base = ff = build_iterator(s->resMan, seeker->_resourceNum, it_type, seeker->_handle);
+ base = ff = build_iterator(g_sci->getResMan(), seeker->_resourceNum, it_type, seeker->_handle);
if (seeker->_restoreBehavior == RESTORE_BEHAVIOR_CONTINUE)
ff = new_fast_forward_iterator(base, seeker->_restoreTime);
ff->init();
@@ -943,7 +943,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
}
// Create a new EngineState object
- retval = new EngineState(s->resMan, s->_kernel, s->_voc, s->_segMan, s->_audio);
+ retval = new EngineState(s->_kernel, s->_voc, s->_segMan, s->_audio);
retval->_event = new SciEvent();
// Copy some old data
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index da670369e6..6599a8b287 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -33,8 +33,8 @@
namespace Sci {
-EngineState::EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SegManager *segMan, AudioPlayer *audio)
-: resMan(res), _kernel(kernel), _voc(voc), _segMan(segMan), _audio(audio), _dirseeker() {
+EngineState::EngineState(Kernel *kernel, Vocabulary *voc, SegManager *segMan, AudioPlayer *audio)
+: _kernel(kernel), _voc(voc), _segMan(segMan), _audio(audio), _dirseeker() {
#ifdef USE_OLD_MUSIC_FUNCTIONS
sfx_init_flags = 0;
@@ -142,7 +142,7 @@ Common::String EngineState::getLanguageString(const char *str, kLanguage lang) c
}
kLanguage EngineState::getLanguage() {
- kLanguage lang = (kLanguage)resMan->getAudioLanguage();
+ kLanguage lang = (kLanguage)g_sci->getResMan()->getAudioLanguage();
if (lang != K_LANG_NONE)
return lang;
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index 29de9174b4..afa3389464 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -110,13 +110,12 @@ public:
struct EngineState : public Common::Serializable {
public:
- EngineState(ResourceManager *res, Kernel *kernel, Vocabulary *voc, SegManager *segMan, AudioPlayer *audio);
+ EngineState(Kernel *kernel, Vocabulary *voc, SegManager *segMan, AudioPlayer *audio);
virtual ~EngineState();
virtual void saveLoadWithSerializer(Common::Serializer &ser);
public:
- ResourceManager *resMan; /**< The resource manager */
SegManager *_segMan; /**< The segment manager */
Kernel *_kernel;
Vocabulary *_voc;
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index aa7163929b..aac08c09e2 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -261,7 +261,7 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP
Script *scr = s->_segMan->getScriptIfLoaded(seg);
if (!scr || scr->isMarkedAsDeleted()) // Script not present yet?
- seg = script_instantiate(s->resMan, s->_segMan, script);
+ seg = script_instantiate(g_sci->getResMan(), s->_segMan, script);
const int temp = s->_segMan->validateExportFunc(pubfunct, seg);
if (!temp) {