aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-09-02 12:02:37 +0000
committerFilippos Karapetis2009-09-02 12:02:37 +0000
commit1bbab8f1915eebdb18365c64ec64eec2a8770bb6 (patch)
treee7cbeca85155034e77ce1f1bbdbf645982b63182
parentb391f08b46c3f47e8631248fd70ee21ebe12b744 (diff)
downloadscummvm-rg350-1bbab8f1915eebdb18365c64ec64eec2a8770bb6.tar.gz
scummvm-rg350-1bbab8f1915eebdb18365c64ec64eec2a8770bb6.tar.bz2
scummvm-rg350-1bbab8f1915eebdb18365c64ec64eec2a8770bb6.zip
Some renaming:
getresourceManager -> getResourceManger resourceManager -> resMan segmentManager ->segMan svn-id: r43908
-rw-r--r--engines/sci/console.cpp118
-rw-r--r--engines/sci/detection.cpp20
-rw-r--r--engines/sci/engine/game.cpp50
-rw-r--r--engines/sci/engine/gc.cpp8
-rw-r--r--engines/sci/engine/kernel.cpp16
-rw-r--r--engines/sci/engine/kernel.h4
-rw-r--r--engines/sci/engine/kevent.cpp10
-rw-r--r--engines/sci/engine/kfile.cpp66
-rw-r--r--engines/sci/engine/kgraphics.cpp126
-rw-r--r--engines/sci/engine/klists.cpp18
-rw-r--r--engines/sci/engine/kmenu.cpp8
-rw-r--r--engines/sci/engine/kmisc.cpp18
-rw-r--r--engines/sci/engine/kmovement.cpp22
-rw-r--r--engines/sci/engine/kpathing.cpp18
-rw-r--r--engines/sci/engine/kscripts.cpp54
-rw-r--r--engines/sci/engine/ksound.cpp38
-rw-r--r--engines/sci/engine/kstring.cpp72
-rw-r--r--engines/sci/engine/memobj.h2
-rw-r--r--engines/sci/engine/message.cpp6
-rw-r--r--engines/sci/engine/message.h2
-rw-r--r--engines/sci/engine/savegame.cpp52
-rw-r--r--engines/sci/engine/script.cpp4
-rw-r--r--engines/sci/engine/scriptdebug.cpp12
-rw-r--r--engines/sci/engine/seg_manager.cpp38
-rw-r--r--engines/sci/engine/seg_manager.h12
-rw-r--r--engines/sci/engine/state.cpp26
-rw-r--r--engines/sci/engine/state.h4
-rw-r--r--engines/sci/engine/stringfrag.cpp30
-rw-r--r--engines/sci/engine/vm.cpp74
-rw-r--r--engines/sci/engine/vm.h4
-rw-r--r--engines/sci/gfx/gfx_resmgr.cpp48
-rw-r--r--engines/sci/gfx/gfx_resmgr.h6
-rw-r--r--engines/sci/gfx/menubar.cpp4
-rw-r--r--engines/sci/resource.cpp40
-rw-r--r--engines/sci/sci.cpp18
-rw-r--r--engines/sci/sci.h4
-rw-r--r--engines/sci/sfx/core.cpp22
-rw-r--r--engines/sci/sfx/core.h6
-rw-r--r--engines/sci/sfx/sci_midi.h2
-rw-r--r--engines/sci/sfx/softseq/adlib.cpp8
-rw-r--r--engines/sci/sfx/softseq/adlib.h2
-rw-r--r--engines/sci/sfx/softseq/pcjr.h2
-rw-r--r--engines/sci/vocabulary.cpp30
-rw-r--r--engines/sci/vocabulary.h4
44 files changed, 564 insertions, 564 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index da461970d5..74beb8a76b 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -374,7 +374,7 @@ bool Console::cmdGetVersion(int argc, const char **argv) {
bool Console::cmdOpcodes(int argc, const char **argv) {
// Load the opcode table from vocab.998 if it exists, to obtain the opcode names
- Resource* r = _vm->getresourceManager()->findResource(ResourceId(kResourceTypeVocab, 998), 0);
+ Resource* r = _vm->getResourceManager()->findResource(ResourceId(kResourceTypeVocab, 998), 0);
// If the resource couldn't be loaded, leave
if (!r) {
@@ -586,7 +586,7 @@ bool Console::cmdHexDump(int argc, const char **argv) {
if (res == kResourceTypeInvalid)
DebugPrintf("Resource type '%s' is not valid\n", argv[1]);
else {
- Resource *resource = _vm->getresourceManager()->findResource(ResourceId(res, resNum), 0);
+ Resource *resource = _vm->getResourceManager()->findResource(ResourceId(res, resNum), 0);
if (resource) {
Common::hexdump(resource->data, resource->size, 16, 0);
DebugPrintf("Resource %s.%03d has been dumped to standard output\n", argv[1], resNum);
@@ -642,7 +642,7 @@ bool Console::cmdResourceSize(int argc, const char **argv) {
if (res == kResourceTypeInvalid)
DebugPrintf("Resource type '%s' is not valid\n", argv[1]);
else {
- Resource *resource = _vm->getresourceManager()->findResource(ResourceId(res, resNum), 0);
+ Resource *resource = _vm->getResourceManager()->findResource(ResourceId(res, resNum), 0);
if (resource) {
DebugPrintf("Resource size: %d\n", resource->size);
} else {
@@ -712,7 +712,7 @@ bool Console::cmdHexgrep(int argc, const char **argv) {
}
for (; resNumber <= resMax; resNumber++) {
- if ((script = _vm->getresourceManager()->findResource(ResourceId(restype, resNumber), 0))) {
+ if ((script = _vm->getResourceManager()->findResource(ResourceId(restype, resNumber), 0))) {
unsigned int seeker = 0, seekerold = 0;
uint32 comppos = 0;
int output_script_name = 0;
@@ -767,7 +767,7 @@ bool Console::cmdList(int argc, const char **argv) {
number = atoi(argv[2]);
}
- Common::List<ResourceId> *resources = _vm->getresourceManager()->listResources(res, number);
+ Common::List<ResourceId> *resources = _vm->getResourceManager()->listResources(res, number);
sort(resources->begin(), resources->end(), ResourceIdLess());
Common::List<ResourceId>::iterator itr = resources->begin();
@@ -895,11 +895,11 @@ bool Console::cmdRestartGame(int argc, const char **argv) {
bool Console::cmdClassTable(int argc, const char **argv) {
DebugPrintf("Available classes:\n");
- for (uint i = 0; i < _vm->_gamestate->segmentManager->_classtable.size(); i++) {
- if (_vm->_gamestate->segmentManager->_classtable[i].reg.segment) {
+ for (uint i = 0; i < _vm->_gamestate->segMan->_classtable.size(); i++) {
+ if (_vm->_gamestate->segMan->_classtable[i].reg.segment) {
DebugPrintf(" Class 0x%x at %04x:%04x (script 0x%x)\n", i,
- PRINT_REG(_vm->_gamestate->segmentManager->_classtable[i].reg),
- _vm->_gamestate->segmentManager->_classtable[i].script);
+ PRINT_REG(_vm->_gamestate->segMan->_classtable[i].reg),
+ _vm->_gamestate->segMan->_classtable[i].script);
}
}
@@ -1313,8 +1313,8 @@ bool Console::cmdStatusBarColors(int argc, const char **argv) {
bool Console::cmdPrintSegmentTable(int argc, const char **argv) {
DebugPrintf("Segment table:\n");
- for (uint i = 0; i < _vm->_gamestate->segmentManager->_heap.size(); i++) {
- MemObject *mobj = _vm->_gamestate->segmentManager->_heap[i];
+ for (uint i = 0; i < _vm->_gamestate->segMan->_heap.size(); i++) {
+ MemObject *mobj = _vm->_gamestate->segMan->_heap[i];
if (mobj && mobj->getType()) {
DebugPrintf(" [%04x] ", i);
@@ -1375,10 +1375,10 @@ bool Console::cmdPrintSegmentTable(int argc, const char **argv) {
bool Console::segmentInfo(int nr) {
DebugPrintf("[%04x] ", nr);
- if ((nr < 0) || ((uint)nr >= _vm->_gamestate->segmentManager->_heap.size()) || !_vm->_gamestate->segmentManager->_heap[nr])
+ if ((nr < 0) || ((uint)nr >= _vm->_gamestate->segMan->_heap.size()) || !_vm->_gamestate->segMan->_heap[nr])
return false;
- MemObject *mobj = _vm->_gamestate->segmentManager->_heap[nr];
+ MemObject *mobj = _vm->_gamestate->segMan->_heap[nr];
switch (mobj->getType()) {
@@ -1401,10 +1401,10 @@ bool Console::segmentInfo(int nr) {
for (uint i = 0; i < scr->_objects.size(); i++) {
DebugPrintf(" ");
// Object header
- Object *obj = obj_get(_vm->_gamestate->segmentManager, scr->_objects[i].pos);
+ Object *obj = obj_get(_vm->_gamestate->segMan, scr->_objects[i].pos);
if (obj)
DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(scr->_objects[i].pos),
- obj_get_name(_vm->_gamestate->segmentManager,
+ obj_get_name(_vm->_gamestate->segMan,
scr->_objects[i].pos), obj->_variables.size(), obj->methods_nr);
}
}
@@ -1446,12 +1446,12 @@ bool Console::segmentInfo(int nr) {
reg_t objpos;
objpos.offset = i;
objpos.segment = nr;
- DebugPrintf(" [%04x] %s; copy of ", i, obj_get_name(_vm->_gamestate->segmentManager, objpos));
+ DebugPrintf(" [%04x] %s; copy of ", i, obj_get_name(_vm->_gamestate->segMan, objpos));
// Object header
- Object *obj = obj_get(_vm->_gamestate->segmentManager, ct->_table[i].pos);
+ Object *obj = obj_get(_vm->_gamestate->segMan, ct->_table[i].pos);
if (obj)
DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(ct->_table[i].pos),
- obj_get_name(_vm->_gamestate->segmentManager, ct->_table[i].pos),
+ obj_get_name(_vm->_gamestate->segMan, ct->_table[i].pos),
obj->_variables.size(), obj->methods_nr);
}
}
@@ -1518,7 +1518,7 @@ bool Console::cmdSegmentInfo(int argc, const char **argv) {
}
if (!scumm_stricmp(argv[1], "all")) {
- for (uint i = 0; i < _vm->_gamestate->segmentManager->_heap.size(); i++)
+ for (uint i = 0; i < _vm->_gamestate->segMan->_heap.size(); i++)
segmentInfo(i);
} else {
int nr = atoi(argv[1]);
@@ -1537,7 +1537,7 @@ bool Console::cmdKillSegment(int argc, const char **argv) {
return true;
}
- _vm->_gamestate->segmentManager->getScript(atoi(argv[1]))->setLockers(0);
+ _vm->_gamestate->segMan->getScript(atoi(argv[1]))->setLockers(0);
return true;
}
@@ -1642,14 +1642,14 @@ bool Console::cmdGCShowReachable(int argc, const char **argv) {
return true;
}
- MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->segmentManager, addr.segment);
+ MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->segMan, addr.segment);
if (!mobj) {
DebugPrintf("Unknown segment : %x\n", addr.segment);
return 1;
}
DebugPrintf("Reachable from %04x:%04x:\n", PRINT_REG(addr));
- mobj->listAllOutgoingReferences(addr, NULL, _print_address, _vm->_gamestate->resourceManager->sciVersion());
+ mobj->listAllOutgoingReferences(addr, NULL, _print_address, _vm->_gamestate->resMan->sciVersion());
return true;
}
@@ -1671,7 +1671,7 @@ bool Console::cmdGCShowFreeable(int argc, const char **argv) {
return true;
}
- MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->segmentManager, addr.segment);
+ MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->segMan, addr.segment);
if (!mobj) {
DebugPrintf("Unknown segment : %x\n", addr.segment);
return true;
@@ -1701,13 +1701,13 @@ bool Console::cmdGCNormalize(int argc, const char **argv) {
return true;
}
- MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->segmentManager, addr.segment);
+ MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->segMan, addr.segment);
if (!mobj) {
DebugPrintf("Unknown segment : %x\n", addr.segment);
return true;
}
- addr = mobj->findCanonicAddress(_vm->_gamestate->segmentManager, addr);
+ addr = mobj->findCanonicAddress(_vm->_gamestate->segMan, addr);
DebugPrintf(" %04x:%04x\n", PRINT_REG(addr));
return true;
@@ -1823,7 +1823,7 @@ bool Console::cmdValueType(int argc, const char **argv) {
return true;
}
- int t = determine_reg_type(_vm->_gamestate->segmentManager, val, true);
+ int t = determine_reg_type(_vm->_gamestate->segMan, val, true);
int invalid = t & KSIG_INVALID;
switch (t & ~KSIG_INVALID) {
@@ -1898,7 +1898,7 @@ bool Console::cmdViewReference(int argc, const char **argv) {
}
}
- int type_mask = determine_reg_type(_vm->_gamestate->segmentManager, reg, 1);
+ int type_mask = determine_reg_type(_vm->_gamestate->segMan, reg, 1);
int filter;
int found = 0;
@@ -1948,7 +1948,7 @@ bool Console::cmdViewReference(int argc, const char **argv) {
break;
case KSIG_REF: {
int size;
- unsigned char *block = _vm->_gamestate->segmentManager->dereference(reg, &size);
+ unsigned char *block = _vm->_gamestate->segMan->dereference(reg, &size);
DebugPrintf("raw data\n");
@@ -2054,7 +2054,7 @@ bool Console::cmdBacktrace(int argc, const char **argv) {
for (iter = _vm->_gamestate->_executionStack.begin();
iter != _vm->_gamestate->_executionStack.end(); ++iter, ++i) {
ExecStack &call = *iter;
- const char *objname = obj_get_name(_vm->_gamestate->segmentManager, call.sendp);
+ const char *objname = obj_get_name(_vm->_gamestate->segMan, call.sendp);
int paramc, totalparamc;
switch (call.type) {
@@ -2104,7 +2104,7 @@ bool Console::cmdBacktrace(int argc, const char **argv) {
printf(" argp:ST:%04x", (unsigned)(call.variables_argp - _vm->_gamestate->stack_base));
if (call.type == EXEC_STACK_TYPE_CALL)
- printf(" script: %d", (*(Script *)_vm->_gamestate->segmentManager->_heap[call.addr.pc.segment]).nr);
+ printf(" script: %d", (*(Script *)_vm->_gamestate->segMan->_heap[call.addr.pc.segment]).nr);
printf("\n");
}
@@ -2196,7 +2196,7 @@ bool Console::cmdDissassemble(int argc, const char **argv) {
return true;
}
- Object *obj = obj_get(_vm->_gamestate->segmentManager, objAddr);
+ Object *obj = obj_get(_vm->_gamestate->segMan, objAddr);
int selector_id = _vm->getKernel()->findSelector(argv[2]);
reg_t addr;
@@ -2210,7 +2210,7 @@ bool Console::cmdDissassemble(int argc, const char **argv) {
return true;
}
- if (lookup_selector(_vm->_gamestate->segmentManager, objAddr, selector_id, NULL, &addr) != kSelectorMethod) {
+ if (lookup_selector(_vm->_gamestate->segMan, objAddr, selector_id, NULL, &addr) != kSelectorMethod) {
DebugPrintf("Not a method.");
return true;
}
@@ -2245,7 +2245,7 @@ bool Console::cmdDissassembleAddress(int argc, const char **argv) {
return true;
}
- _vm->_gamestate->segmentManager->dereference(vpc, &size);
+ _vm->_gamestate->segMan->dereference(vpc, &size);
size += vpc.offset; // total segment size
for (int i = 2; i < argc; i++) {
@@ -2304,13 +2304,13 @@ bool Console::cmdSend(int argc, const char **argv) {
return true;
}
- o = obj_get(_vm->_gamestate->segmentManager, object);
+ o = obj_get(_vm->_gamestate->segMan, object);
if (o == NULL) {
DebugPrintf("Address \"%04x:%04x\" is not an object\n", PRINT_REG(object));
return true;
}
- SelectorType selector_type = lookup_selector(_vm->_gamestate->segmentManager, object, selector_id, 0, &fptr);
+ SelectorType selector_type = lookup_selector(_vm->_gamestate->segMan, object, selector_id, 0, &fptr);
if (selector_type == kSelectorNone) {
DebugPrintf("Object does not support selector: \"%s\"\n", selector_name);
@@ -2506,7 +2506,7 @@ bool Console::cmdIsSample(int argc, const char **argv) {
return true;
}
- Resource *song = _vm->getresourceManager()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0);
+ Resource *song = _vm->getResourceManager()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0);
SongIterator *songit;
Audio::AudioStream *data;
@@ -2544,7 +2544,7 @@ bool Console::cmdSfx01Header(int argc, const char **argv) {
return true;
}
- Resource *song = _vm->getresourceManager()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0);
+ Resource *song = _vm->getResourceManager()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0);
if (!song) {
DebugPrintf("Doesn't exist\n");
@@ -2709,7 +2709,7 @@ bool Console::cmdSfx01Track(int argc, const char **argv) {
return true;
}
- Resource *song = _vm->getresourceManager()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0);
+ Resource *song = _vm->getResourceManager()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0);
int offset = atoi(argv[2]);
@@ -2741,7 +2741,7 @@ bool Console::cmdStopSfx(int argc, const char **argv) {
}
int handle = id.segment << 16 | id.offset; // frobnicate handle
- SegManager *segManager = _vm->_gamestate->segmentManager; // for PUT_SEL32V
+ SegManager *segManager = _vm->_gamestate->segMan; // for PUT_SEL32V
if (id.segment) {
_vm->_gamestate->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
@@ -2844,7 +2844,7 @@ int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on
if (*endptr)
return 1;
- dest->segment = s->segmentManager->segGet(script_nr);
+ dest->segment = s->segMan->segGet(script_nr);
if (!dest->segment) {
return 1;
@@ -2880,8 +2880,8 @@ int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on
str_objname = str + 1;
// Now all values are available; iterate over all objects.
- for (i = 0; i < s->segmentManager->_heap.size(); i++) {
- MemObject *mobj = s->segmentManager->_heap[i];
+ for (i = 0; i < s->segMan->_heap.size(); i++) {
+ MemObject *mobj = s->segMan->_heap[i];
int idx = 0;
int max_index = 0;
@@ -2909,7 +2909,7 @@ int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on
}
if (valid) {
- const char *objname = obj_get_name(s->segmentManager, objpos);
+ const char *objname = obj_get_name(s->segMan, objpos);
if (!strcmp(objname, str_objname)) {
// Found a match!
if ((index < 0) && (times_found > 0)) {
@@ -2983,7 +2983,7 @@ void Console::printList(List *l) {
while (!pos.isNull()) {
Node *node;
- NodeTable *nt = (NodeTable *)GET_SEGMENT(*_vm->_gamestate->segmentManager, pos.segment, MEM_OBJ_NODES);
+ NodeTable *nt = (NodeTable *)GET_SEGMENT(*_vm->_gamestate->segMan, pos.segment, MEM_OBJ_NODES);
if (!nt || !nt->isValidEntry(pos.offset)) {
DebugPrintf(" WARNING: %04x:%04x: Doesn't contain list node!\n",
@@ -3010,7 +3010,7 @@ void Console::printList(List *l) {
}
int Console::printNode(reg_t addr) {
- MemObject *mobj = GET_SEGMENT(*_vm->_gamestate->segmentManager, addr.segment, MEM_OBJ_LISTS);
+ MemObject *mobj = GET_SEGMENT(*_vm->_gamestate->segMan, addr.segment, MEM_OBJ_LISTS);
if (mobj) {
ListTable *lt = (ListTable *)mobj;
@@ -3027,7 +3027,7 @@ int Console::printNode(reg_t addr) {
} else {
NodeTable *nt;
Node *node;
- mobj = GET_SEGMENT(*_vm->_gamestate->segmentManager, addr.segment, MEM_OBJ_NODES);
+ mobj = GET_SEGMENT(*_vm->_gamestate->segMan, addr.segment, MEM_OBJ_NODES);
if (!mobj) {
DebugPrintf("Segment #%04x is not a list or node segment\n", addr.segment);
@@ -3051,10 +3051,10 @@ int Console::printNode(reg_t addr) {
int Console::printObject(reg_t pos) {
EngineState *s = _vm->_gamestate; // for the several defines in this function
- Object *obj = obj_get(s->segmentManager, pos);
+ Object *obj = obj_get(s->segMan, pos);
Object *var_container = obj;
int i;
- SciVersion version = s->resourceManager->sciVersion(); // for the selector defines
+ SciVersion version = s->resMan->sciVersion(); // for the selector defines
if (!obj) {
DebugPrintf("[%04x:%04x]: Not an object.", PRINT_REG(pos));
@@ -3062,11 +3062,11 @@ int Console::printObject(reg_t pos) {
}
// Object header
- DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s->segmentManager, pos),
+ DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s->segMan, pos),
obj->_variables.size(), obj->methods_nr);
if (!(obj->_variables[SCRIPT_INFO_SELECTOR].offset & SCRIPT_INFO_CLASS))
- var_container = obj_get(s->segmentManager, obj->_variables[SCRIPT_SUPERCLASS_SELECTOR]);
+ var_container = obj_get(s->segMan, obj->_variables[SCRIPT_SUPERCLASS_SELECTOR]);
DebugPrintf(" -- member variables:\n");
for (i = 0; (uint)i < obj->_variables.size(); i++) {
printf(" ");
@@ -3078,9 +3078,9 @@ int Console::printObject(reg_t pos) {
reg_t val = obj->_variables[i];
DebugPrintf("%04x:%04x", PRINT_REG(val));
- Object *ref = obj_get(s->segmentManager, val);
+ Object *ref = obj_get(s->segMan, val);
if (ref)
- DebugPrintf(" (%s)", obj_get_name(s->segmentManager, val));
+ DebugPrintf(" (%s)", obj_get_name(s->segMan, val));
DebugPrintf("\n");
}
@@ -3089,8 +3089,8 @@ int Console::printObject(reg_t pos) {
reg_t fptr = VM_OBJECT_READ_FUNCTION(obj, i);
DebugPrintf(" [%03x] %s = %04x:%04x\n", VM_OBJECT_GET_FUNCSELECTOR(obj, i), selector_name(s, VM_OBJECT_GET_FUNCSELECTOR(obj, i)), PRINT_REG(fptr));
}
- if (s->segmentManager->_heap[pos.segment]->getType() == MEM_OBJ_SCRIPT)
- DebugPrintf("\nOwner script:\t%d\n", s->segmentManager->getScript(pos.segment)->nr);
+ if (s->segMan->_heap[pos.segment]->getType() == MEM_OBJ_SCRIPT)
+ DebugPrintf("\nOwner script:\t%d\n", s->segMan->getScript(pos.segment)->nr);
return 0;
}
@@ -3132,7 +3132,7 @@ static void viewobjinfo(EngineState *s, HeapPtr pos) {
int have_rects = 0;
Common::Rect nsrect, nsrect_clipped, brrect;
- if (lookup_selector(s->segmentManager, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL) == kSelectorVariable) {
+ if (lookup_selector(s->segMan, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL) == kSelectorVariable) {
GETRECT(nsLeft, nsRight, nsBottom, nsTop);
GETRECT(lsLeft, lsRight, lsBottom, lsTop);
GETRECT(brLeft, brRight, brBottom, brTop);
@@ -3210,10 +3210,10 @@ static int c_gfx_draw_viewobj(EngineState *s, const Common::Array<cmd_param_t> &
}
- is_view = (lookup_selector(s->segmentManager, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.x, NULL) == kSelectorVariable) &&
- (lookup_selector(s->segmentManager, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.brLeft, NULL) == kSelectorVariable) &&
- (lookup_selector(s->segmentManager, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.signal, NULL) == kSelectorVariable) &&
- (lookup_selector(s->segmentManager, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsTop, NULL) == kSelectorVariable);
+ is_view = (lookup_selector(s->segMan, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.x, NULL) == kSelectorVariable) &&
+ (lookup_selector(s->segMan, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.brLeft, NULL) == kSelectorVariable) &&
+ (lookup_selector(s->segMan, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.signal, NULL) == kSelectorVariable) &&
+ (lookup_selector(s->segMan, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsTop, NULL) == kSelectorVariable);
if (!is_view) {
printf("Not a dynamic View object.\n");
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 6e0754c8c4..a24a34b346 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -272,22 +272,22 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
return 0;
}
- ResourceManager *resourceManager = new ResourceManager(fslist);
- ViewType gameViews = resourceManager->getViewType();
+ ResourceManager *resMan = new ResourceManager(fslist);
+ ViewType gameViews = resMan->getViewType();
// Have we identified the game views? If not, stop here
if (gameViews == kViewUnknown) {
SearchMan.remove("SCI_detection");
- delete resourceManager;
+ delete resMan;
return (const ADGameDescription *)&s_fallbackDesc;
}
#ifndef ENABLE_SCI32
// Is SCI32 compiled in? If not, and this is a SCI32 game,
// stop here
- if (resourceManager->sciVersion() >= SCI_VERSION_2) {
+ if (resMan->sciVersion() >= SCI_VERSION_2) {
SearchMan.remove("SCI_detection");
- delete resourceManager;
+ delete resMan;
return (const ADGameDescription *)&s_fallbackDesc;
}
#endif
@@ -301,12 +301,12 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
s_fallbackDesc.desc.platform = Common::kPlatformAmiga;
// Determine the game id
- SegManager *segManager = new SegManager(resourceManager);
- if (!script_instantiate(resourceManager, segManager, 0)) {
+ SegManager *segManager = new SegManager(resMan);
+ if (!script_instantiate(resMan, segManager, 0)) {
warning("fallbackDetect(): Could not instantiate script 0");
SearchMan.remove("SCI_detection");
delete segManager;
- delete resourceManager;
+ delete resMan;
return 0;
}
reg_t game_obj = script_lookup_export(segManager, 0, 0);
@@ -324,7 +324,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
// (like, for example, Eco Quest 1 and all SCI1.1 games and newer, e.g. Freddy Pharkas).
// As far as we know, these games store the messages of each language in separate
// resources, and it's not possible to detect that easily
- Resource *text = resourceManager->findResource(ResourceId(kResourceTypeText, 0), 0);
+ Resource *text = resMan->findResource(ResourceId(kResourceTypeText, 0), 0);
uint seeker = 0;
if (text) {
while (seeker < text->size) {
@@ -336,7 +336,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
}
}
- delete resourceManager;
+ delete resMan;
// Distinguish demos from full versions
if (!strcmp(s_fallbackDesc.desc.gameid, "castlebrain") && !Common::File::exists("resource.002")) {
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 28d8ee5274..d00a3782a1 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -177,7 +177,7 @@ int _reset_graphics_input(EngineState *s) {
gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 };
debug(2, "Initializing graphics");
- if (s->resourceManager->getViewType() == kViewEga) {
+ if (s->resMan->getViewType() == kViewEga) {
for (int i = 0; i < 16; i++) {
gfxop_set_color(s->gfx_state, &(s->ega_colors[i]), gfx_sci0_image_colors[sci0_palette][i].r,
gfx_sci0_image_colors[sci0_palette][i].g, gfx_sci0_image_colors[sci0_palette][i].b, 0, -1, -1);
@@ -194,13 +194,13 @@ int _reset_graphics_input(EngineState *s) {
s->gfx_state->gfxResMan->setStaticPalette(gfxr_read_pal1_amiga(file));
file.close();
} else {
- resource = s->resourceManager->findResource(ResourceId(kResourceTypePalette, 999), 1);
+ resource = s->resMan->findResource(ResourceId(kResourceTypePalette, 999), 1);
if (resource) {
- if (s->resourceManager->sciVersion() < SCI_VERSION_1_1)
+ if (s->resMan->sciVersion() < SCI_VERSION_1_1)
s->gfx_state->gfxResMan->setStaticPalette(gfxr_read_pal1(999, resource->data, resource->size));
else
s->gfx_state->gfxResMan->setStaticPalette(gfxr_read_pal11(999, resource->data, resource->size));
- s->resourceManager->unlockResource(resource);
+ s->resMan->unlockResource(resource);
} else {
debug(2, "Couldn't find the default palette!");
}
@@ -226,7 +226,7 @@ int _reset_graphics_input(EngineState *s) {
font_nr = -1;
do {
- resource = s->resourceManager->testResource(ResourceId(kResourceTypeFont, ++font_nr));
+ resource = s->resMan->testResource(ResourceId(kResourceTypeFont, ++font_nr));
} while ((!resource) && (font_nr < 65536));
if (!resource) {
@@ -241,7 +241,7 @@ int _reset_graphics_input(EngineState *s) {
s->iconbar_port = new GfxPort(s->visual, gfx_rect(0, 0, 320, 200), s->ega_colors[0], transparent);
s->iconbar_port->_flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH;
- if (s->resourceManager->isVGA()) {
+ if (s->resMan->isVGA()) {
// This bit sets the foreground and background colors in VGA SCI games
gfx_color_t fgcolor;
gfx_color_t bgcolor;
@@ -311,11 +311,11 @@ static void _free_graphics_input(EngineState *s) {
}
int game_init_sound(EngineState *s, int sound_flags) {
- if (s->resourceManager->sciVersion() > SCI_VERSION_0_LATE)
+ if (s->resMan->sciVersion() > SCI_VERSION_0_LATE)
sound_flags |= SFX_STATE_FLAG_MULTIPLAY;
s->sfx_init_flags = sound_flags;
- s->_sound.sfx_init(s->resourceManager, sound_flags);
+ s->_sound.sfx_init(s->resMan, sound_flags);
return 0;
}
@@ -323,20 +323,20 @@ int game_init_sound(EngineState *s, int sound_flags) {
// Architectural stuff: Init/Unintialize engine
int script_init_engine(EngineState *s) {
s->kernel_opt_flags = 0;
- s->segmentManager = new SegManager(s->resourceManager);
+ s->segMan = new SegManager(s->resMan);
s->gc_countdown = GC_INTERVAL - 1;
- SegmentId script_000_segment = s->segmentManager->getSegment(0, SCRIPT_GET_LOCK);
+ SegmentId script_000_segment = s->segMan->getSegment(0, SCRIPT_GET_LOCK);
if (script_000_segment <= 0) {
debug(2, "Failed to instantiate script.000");
return 1;
}
- s->script_000 = s->segmentManager->getScript(script_000_segment);
+ s->script_000 = s->segMan->getScript(script_000_segment);
- s->sys_strings = s->segmentManager->allocateSysStrings(&s->sys_strings_segment);
- s->string_frag_segment = s->segmentManager->allocateStringFrags();
+ s->sys_strings = s->segMan->allocateSysStrings(&s->sys_strings_segment);
+ s->string_frag_segment = s->segMan->allocateStringFrags();
// Allocate static buffer for savegame and CWD directories
SystemString *str = &s->sys_strings->strings[SYS_STRING_SAVEDIR];
@@ -359,9 +359,9 @@ int script_init_engine(EngineState *s) {
s->have_bp = 0;
if (s->detectLofsType() == SCI_VERSION_1_MIDDLE)
- s->segmentManager->setExportWidth(1);
+ s->segMan->setExportWidth(1);
else
- s->segmentManager->setExportWidth(0);
+ s->segMan->setExportWidth(0);
debug(2, "Engine initialized");
@@ -384,8 +384,8 @@ void internal_stringfrag_strncpy(EngineState *s, reg_t *dest, reg_t *src, int le
void script_free_vm_memory(EngineState *s) {
debug(2, "Freeing VM memory");
- if (s->segmentManager)
- s->segmentManager->_classtable.clear();
+ if (s->segMan)
+ s->segMan->_classtable.clear();
// Close all opened file handles
s->_fileHandles.clear();
@@ -422,11 +422,11 @@ int game_init(EngineState *s) {
// FIXME Use new VM instantiation code all over the place
DataStack *stack;
- stack = s->segmentManager->allocateStack(VM_STACK_SIZE, &s->stack_segment);
+ stack = s->segMan->allocateStack(VM_STACK_SIZE, &s->stack_segment);
s->stack_base = stack->entries;
s->stack_top = s->stack_base + VM_STACK_SIZE;
- if (!script_instantiate(s->resourceManager, s->segmentManager, 0)) {
+ if (!script_instantiate(s->resMan, s->segMan, 0)) {
warning("game_init(): Could not instantiate script 0");
return 1;
}
@@ -442,7 +442,7 @@ int game_init(EngineState *s) {
s->successor = NULL; // No successor
s->_statusBarText.clear(); // Status bar is blank
s->status_bar_foreground = 0;
- s->status_bar_background = !s->resourceManager->isVGA() ? 15 : 255;
+ s->status_bar_background = !s->resMan->isVGA() ? 15 : 255;
SystemString *str = &s->sys_strings->strings[SYS_STRING_PARSER_BASE];
str->name = strdup("parser-base");
@@ -460,9 +460,9 @@ int game_init(EngineState *s) {
// script_dissect(0, s->_selectorNames);
// The first entry in the export table of script 0 points to the game object
- s->game_obj = script_lookup_export(s->segmentManager, 0, 0);
+ s->game_obj = script_lookup_export(s->segMan, 0, 0);
uint32 gameFlags = 0; // unused
- s->_gameName = convertSierraGameId(obj_get_name(s->segmentManager, s->game_obj), &gameFlags);
+ s->_gameName = convertSierraGameId(obj_get_name(s->segMan, s->game_obj), &gameFlags);
debug(2, " \"%s\" at %04x:%04x", s->_gameName.c_str(), PRINT_REG(s->game_obj));
@@ -490,9 +490,9 @@ int game_exit(EngineState *s) {
game_init_sound(s, SFX_STATE_FLAG_NOSOUND);
}
- s->segmentManager->_classtable.clear();
- delete s->segmentManager;
- s->segmentManager = 0;
+ s->segMan->_classtable.clear();
+ delete s->segMan;
+ s->segMan = 0;
s->_synonyms.clear();
diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp
index 88eee3e17b..5041416989 100644
--- a/engines/sci/engine/gc.cpp
+++ b/engines/sci/engine/gc.cpp
@@ -71,7 +71,7 @@ void add_outgoing_refs(void *refcon, reg_t addr) {
}
reg_t_hash_map *find_all_used_references(EngineState *s) {
- SegManager *sm = s->segmentManager;
+ SegManager *sm = s->segMan;
reg_t_hash_map *normal_map = NULL;
WorklistManager wm;
uint i;
@@ -102,7 +102,7 @@ reg_t_hash_map *find_all_used_references(EngineState *s) {
wm.push(es.objp);
wm.push(es.sendp);
if (es.type == EXEC_STACK_TYPE_VARSELECTOR)
- wm.push(*(es.getVarPointer(s->segmentManager)));
+ wm.push(*(es.getVarPointer(s->segMan)));
}
}
@@ -134,7 +134,7 @@ reg_t_hash_map *find_all_used_references(EngineState *s) {
if (reg.segment != s->stack_segment) { // No need to repeat this one
debugC(2, kDebugLevelGC, "[GC] Checking %04x:%04x\n", PRINT_REG(reg));
if (reg.segment < sm->_heap.size() && sm->_heap[reg.segment])
- sm->_heap[reg.segment]->listAllOutgoingReferences(reg, &wm, add_outgoing_refs, s->resourceManager->sciVersion());
+ sm->_heap[reg.segment]->listAllOutgoingReferences(reg, &wm, add_outgoing_refs, s->resMan->sciVersion());
}
}
@@ -172,7 +172,7 @@ void free_unless_used(void *refcon, reg_t addr) {
void run_gc(EngineState *s) {
uint seg_nr;
deallocator_t deallocator;
- SegManager *sm = s->segmentManager;
+ SegManager *sm = s->segMan;
#ifdef DEBUG_GC
debugC(2, kDebugLevelGC, "[GC] Running...\n");
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index a467f9c3ca..401cc92203 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -379,7 +379,7 @@ static const char *argtype_description[] = {
"Arithmetic"
};
-Kernel::Kernel(ResourceManager *resourceManager) : _resourceManager(resourceManager) {
+Kernel::Kernel(ResourceManager *resMan) : _resMan(resMan) {
memset(&_selectorMap, 0, sizeof(_selectorMap)); // FIXME: Remove this once/if we C++ify selector_map_t
loadSelectorNames();
@@ -394,7 +394,7 @@ Kernel::~Kernel() {
}
void Kernel::detectSciFeatures() {
- SciVersion version = _resourceManager->sciVersion();
+ SciVersion version = _resMan->sciVersion();
features = 0;
@@ -418,13 +418,13 @@ void Kernel::detectSciFeatures() {
}
void Kernel::loadSelectorNames() {
- Resource *r = _resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SELECTORS), 0);
- bool oldScriptHeader = (_resourceManager->sciVersion() == SCI_VERSION_0_EARLY);
+ Resource *r = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SELECTORS), 0);
+ bool oldScriptHeader = (_resMan->sciVersion() == SCI_VERSION_0_EARLY);
if (!r) { // No such resource?
// Check if we have a table for this game
// Some demos do not have a selector table
- Common::StringList staticSelectorTable = checkStaticSelectorNames(_resourceManager->sciVersion());
+ Common::StringList staticSelectorTable = checkStaticSelectorNames(_resMan->sciVersion());
if (staticSelectorTable.empty())
error("Kernel: Could not retrieve selector names");
@@ -752,7 +752,7 @@ reg_t *kernelDerefRegPtr(SegManager *segManager, reg_t pointer, int entries) {
void Kernel::setDefaultKernelNames() {
_kernelNames = Common::StringList(sci_default_knames, SCI_KNAMES_DEFAULT_ENTRIES_NR);
- switch (_resourceManager->sciVersion()) {
+ switch (_resMan->sciVersion()) {
case SCI_VERSION_0_EARLY:
case SCI_VERSION_0_LATE:
// Insert SCI0 file functions after SetCursor (0x28)
@@ -792,9 +792,9 @@ bool Kernel::loadKernelNames() {
_kernelNames.clear();
#ifdef ENABLE_SCI32
- if (_resourceManager->sciVersion() >= SCI_VERSION_2_1)
+ if (_resMan->sciVersion() >= SCI_VERSION_2_1)
setKernelNamesSci21();
- else if (_resourceManager->sciVersion() == SCI_VERSION_2)
+ else if (_resMan->sciVersion() == SCI_VERSION_2)
setKernelNamesSci2();
else
#endif
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 3474d034fb..4844f01a76 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -62,7 +62,7 @@ public:
/**
* Initializes the SCI kernel
*/
- Kernel(ResourceManager *resourceManager);
+ Kernel(ResourceManager *resMan);
~Kernel();
uint getSelectorNamesSize() const { return _selectorNames.size(); }
@@ -157,7 +157,7 @@ private:
*/
void mapFunctions();
- ResourceManager *_resourceManager;
+ ResourceManager *_resMan;
uint32 features;
// Kernel-related lists
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 86755c90fa..7bb9fdfa8c 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -40,8 +40,8 @@ reg_t kGetEvent(EngineState *s, int, int argc, reg_t *argv) {
reg_t obj = argv[1];
sci_event_t e;
int oldx, oldy;
- int modifier_mask = s->resourceManager->sciVersion() <= SCI_VERSION_01 ? SCI_EVM_ALL : SCI_EVM_NO_FOOLOCK;
- SegManager *segManager = s->segmentManager;
+ int modifier_mask = s->resMan->sciVersion() <= SCI_VERSION_01 ? SCI_EVM_ALL : SCI_EVM_NO_FOOLOCK;
+ SegManager *segManager = s->segMan;
// If there's a simkey pending, and the game wants a keyboard event, use the
// simkey instead of a normal event
@@ -153,7 +153,7 @@ reg_t kGetEvent(EngineState *s, int, int argc, reg_t *argv) {
reg_t kMapKeyToDir(EngineState *s, int, int argc, reg_t *argv) {
reg_t obj = argv[0];
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
if (GET_SEL32V(obj, type) == SCI_EVT_KEYBOARD) { // Keyboard
int mover = -1;
@@ -203,7 +203,7 @@ reg_t kMapKeyToDir(EngineState *s, int, int argc, reg_t *argv) {
reg_t kGlobalToLocal(EngineState *s, int, int argc, reg_t *argv) {
reg_t obj = argc ? argv[0] : NULL_REG; // Can this really happen? Lars
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
if (obj.segment) {
int x = GET_SEL32V(obj, x);
@@ -219,7 +219,7 @@ reg_t kGlobalToLocal(EngineState *s, int, int argc, reg_t *argv) {
reg_t kLocalToGlobal(EngineState *s, int, int argc, reg_t *argv) {
reg_t obj = argc ? argv[0] : NULL_REG; // Can this really happen? Lars
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
if (obj.segment) {
int x = GET_SEL32V(obj, x);
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 9db7a04a14..4159e75a74 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -197,7 +197,7 @@ void file_open(EngineState *s, const char *filename, int mode) {
}
reg_t kFOpen(EngineState *s, int, int argc, reg_t *argv) {
- char *name = kernelDerefString(s->segmentManager, argv[0]);
+ char *name = kernelDerefString(s->segMan, argv[0]);
int mode = argv[1].toUint16();
debug(3, "kFOpen(%s,0x%x)", name, mode);
@@ -250,7 +250,7 @@ void fwrite_wrapper(EngineState *s, int handle, char *data, int length) {
reg_t kFPuts(EngineState *s, int, int argc, reg_t *argv) {
int handle = argv[0].toUint16();
- char *data = kernelDerefString(s->segmentManager, argv[1]);
+ char *data = kernelDerefString(s->segMan, argv[1]);
fwrite_wrapper(s, handle, data, strlen(data));
return s->r_acc;
@@ -307,7 +307,7 @@ static void fseek_wrapper(EngineState *s, int handle, int offset, int whence) {
}
reg_t kFGets(EngineState *s, int, int argc, reg_t *argv) {
- char *dest = kernelDerefString(s->segmentManager, argv[0]);
+ char *dest = kernelDerefString(s->segMan, argv[0]);
int maxsize = argv[1].toUint16();
int handle = argv[2].toUint16();
@@ -320,7 +320,7 @@ reg_t kFGets(EngineState *s, int, int argc, reg_t *argv) {
* Writes the cwd to the supplied address and returns the address in acc.
*/
reg_t kGetCWD(EngineState *s, int, int argc, reg_t *argv) {
- char *targetaddr = kernelDerefString(s->segmentManager, argv[0]);
+ char *targetaddr = kernelDerefString(s->segMan, argv[0]);
// We do not let the scripts see the file system, instead pretending
// we are always in the same directory.
@@ -356,8 +356,8 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) {
switch (mode) {
case K_DEVICE_INFO_GET_DEVICE:
- input_s = kernelDerefString(s->segmentManager, argv[1]);
- output_s = kernelDerefString(s->segmentManager, argv[2]);
+ input_s = kernelDerefString(s->segMan, argv[1]);
+ output_s = kernelDerefString(s->segMan, argv[2]);
assert(input_s != output_s);
strcpy(output_s, "/");
@@ -365,15 +365,15 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) {
break;
case K_DEVICE_INFO_GET_CURRENT_DEVICE:
- output_s = kernelDerefString(s->segmentManager, argv[1]);
+ output_s = kernelDerefString(s->segMan, argv[1]);
strcpy(output_s, "/");
debug(3, "K_DEVICE_INFO_GET_CURRENT_DEVICE() -> %s", output_s);
break;
case K_DEVICE_INFO_PATHS_EQUAL: {
- char *path1_s = kernelDerefString(s->segmentManager, argv[1]);
- char *path2_s = kernelDerefString(s->segmentManager, argv[2]);
+ char *path1_s = kernelDerefString(s->segMan, argv[1]);
+ char *path2_s = kernelDerefString(s->segMan, argv[2]);
debug(3, "K_DEVICE_INFO_PATHS_EQUAL(%s,%s)", path1_s, path2_s);
return make_reg(0, Common::matchString(path2_s, path1_s, true));
@@ -381,7 +381,7 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) {
break;
case K_DEVICE_INFO_IS_FLOPPY:
- input_s = kernelDerefString(s->segmentManager, argv[1]);
+ input_s = kernelDerefString(s->segMan, argv[1]);
debug(3, "K_DEVICE_INFO_IS_FLOPPY(%s)", input_s);
return NULL_REG; /* Never */
@@ -390,8 +390,8 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) {
** for more information on our workaround for this.
*/
case K_DEVICE_INFO_GET_SAVECAT_NAME: {
- output_s = kernelDerefString(s->segmentManager, argv[1]);
- game_prefix = kernelDerefString(s->segmentManager, argv[2]);
+ output_s = kernelDerefString(s->segMan, argv[1]);
+ game_prefix = kernelDerefString(s->segMan, argv[2]);
sprintf(output_s, "__throwaway");
debug(3, "K_DEVICE_INFO_GET_SAVECAT_NAME(%s) -> %s", game_prefix, output_s);
@@ -399,8 +399,8 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) {
break;
case K_DEVICE_INFO_GET_SAVEFILE_NAME: {
- output_s = kernelDerefString(s->segmentManager, argv[1]);
- game_prefix = kernelDerefString(s->segmentManager, argv[2]);
+ output_s = kernelDerefString(s->segMan, argv[1]);
+ game_prefix = kernelDerefString(s->segMan, argv[2]);
int savegame_id = argv[3].toUint16();
sprintf(output_s, "__throwaway");
debug(3, "K_DEVICE_INFO_GET_SAVEFILE_NAME(%s,%d) -> %s", game_prefix, savegame_id, output_s);
@@ -428,7 +428,7 @@ reg_t kGetSaveDir(EngineState *s, int, int argc, reg_t *argv) {
}
reg_t kCheckFreeSpace(EngineState *s, int, int argc, reg_t *argv) {
- char *path = kernelDerefString(s->segmentManager, argv[0]);
+ char *path = kernelDerefString(s->segMan, argv[0]);
debug(3, "kCheckFreeSpace(%s)", path);
// We simply always pretend that there is enough space.
@@ -486,7 +486,7 @@ void listSavegames(Common::Array<SavegameDesc> &saves) {
}
reg_t kCheckSaveGame(EngineState *s, int, int argc, reg_t *argv) {
- char *game_id = kernelDerefString(s->segmentManager, argv[0]);
+ char *game_id = kernelDerefString(s->segMan, argv[0]);
int savedir_nr = argv[1].toUint16();
debug(3, "kCheckSaveGame(%s, %d)", game_id, savedir_nr);
@@ -522,10 +522,10 @@ reg_t kCheckSaveGame(EngineState *s, int, int argc, reg_t *argv) {
}
reg_t kGetSaveFiles(EngineState *s, int, int argc, reg_t *argv) {
- char *game_id = kernelDerefString(s->segmentManager, argv[0]);
- char *nametarget = kernelDerefString(s->segmentManager, argv[1]);
+ char *game_id = kernelDerefString(s->segMan, argv[0]);
+ char *nametarget = kernelDerefString(s->segMan, argv[1]);
reg_t nametarget_base = argv[1];
- reg_t *nameoffsets = kernelDerefRegPtr(s->segmentManager, argv[2], 0);
+ reg_t *nameoffsets = kernelDerefRegPtr(s->segMan, argv[2], 0);
debug(3, "kGetSaveFiles(%s,%s)", game_id, nametarget);
@@ -572,11 +572,11 @@ reg_t kGetSaveFiles(EngineState *s, int, int argc, reg_t *argv) {
}
reg_t kSaveGame(EngineState *s, int, int argc, reg_t *argv) {
- char *game_id = kernelDerefString(s->segmentManager, argv[0]);
+ char *game_id = kernelDerefString(s->segMan, argv[0]);
int savedir_nr = argv[1].toUint16();
int savedir_id; // Savegame ID, derived from savedir_nr and the savegame ID list
- char *game_description = kernelDerefString(s->segmentManager, argv[2]);
- char *version = argc > 3 ? strdup(kernelDerefString(s->segmentManager, argv[3])) : NULL;
+ char *game_description = kernelDerefString(s->segMan, argv[2]);
+ char *version = argc > 3 ? strdup(kernelDerefString(s->segMan, argv[3])) : NULL;
debug(3, "kSaveGame(%s,%d,%s,%s)", game_id, savedir_nr, game_description, version);
s->game_version = version;
@@ -645,7 +645,7 @@ reg_t kSaveGame(EngineState *s, int, int argc, reg_t *argv) {
}
reg_t kRestoreGame(EngineState *s, int, int argc, reg_t *argv) {
- char *game_id = kernelDerefString(s->segmentManager, argv[0]);
+ char *game_id = kernelDerefString(s->segMan, argv[0]);
int savedir_nr = argv[1].toUint16();
debug(3, "kRestoreGame(%s,%d)", game_id, savedir_nr);
@@ -684,7 +684,7 @@ reg_t kRestoreGame(EngineState *s, int, int argc, reg_t *argv) {
}
reg_t kValidPath(EngineState *s, int, int argc, reg_t *argv) {
- const char *path = kernelDerefString(s->segmentManager, argv[0]);
+ const char *path = kernelDerefString(s->segMan, argv[0]);
// FIXME: For now, we only accept the (fake) root dir "/" as a valid path.
s->r_acc = make_reg(0, 0 == strcmp(path, "/"));
@@ -735,7 +735,7 @@ void DirSeeker::nextFile() {
return;
}
- char *mem = kernelDerefString(_vm->segmentManager, _outbuffer);
+ char *mem = kernelDerefString(_vm->segMan, _outbuffer);
memset(mem, 0, 13);
// TODO: Transform the string back into a format usable by the SCI scripts.
@@ -756,7 +756,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) {
switch (func_nr) {
case K_FILEIO_OPEN : {
- char *name = kernelDerefString(s->segmentManager, argv[1]);
+ char *name = kernelDerefString(s->segMan, argv[1]);
int mode = argv[2].toUint16();
file_open(s, name, mode);
@@ -772,7 +772,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) {
}
case K_FILEIO_READ_RAW : {
int handle = argv[1].toUint16();
- char *dest = kernelDerefString(s->segmentManager, argv[2]);
+ char *dest = kernelDerefString(s->segMan, argv[2]);
int size = argv[3].toUint16();
debug(3, "K_FILEIO_READ_RAW(%d,%d)", handle, size);
@@ -781,7 +781,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) {
}
case K_FILEIO_WRITE_RAW : {
int handle = argv[1].toUint16();
- char *buf = kernelDerefString(s->segmentManager, argv[2]);
+ char *buf = kernelDerefString(s->segMan, argv[2]);
int size = argv[3].toUint16();
debug(3, "K_FILEIO_WRITE_RAW(%d,%d)", handle, size);
@@ -789,7 +789,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) {
break;
}
case K_FILEIO_UNLINK : {
- char *name = kernelDerefString(s->segmentManager, argv[1]);
+ char *name = kernelDerefString(s->segMan, argv[1]);
debug(3, "K_FILEIO_UNLINK(%s)", name);
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
@@ -800,7 +800,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) {
break;
}
case K_FILEIO_READ_STRING : {
- char *dest = kernelDerefString(s->segmentManager, argv[1]);
+ char *dest = kernelDerefString(s->segMan, argv[1]);
int size = argv[2].toUint16();
int handle = argv[3].toUint16();
debug(3, "K_FILEIO_READ_STRING(%d,%d)", handle, size);
@@ -811,7 +811,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) {
case K_FILEIO_WRITE_STRING : {
int handle = argv[1].toUint16();
int size = argv[3].toUint16();
- char *buf = kernelDerefCharPtr(s->segmentManager, argv[2], size);
+ char *buf = kernelDerefCharPtr(s->segMan, argv[2], size);
debug(3, "K_FILEIO_WRITE_STRING(%d,%d)", handle, size);
// FIXME: What is the difference between K_FILEIO_WRITE_STRING and
@@ -832,7 +832,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) {
break;
}
case K_FILEIO_FIND_FIRST : {
- char *mask = kernelDerefString(s->segmentManager, argv[1]);
+ char *mask = kernelDerefString(s->segMan, argv[1]);
reg_t buf = argv[2];
int attr = argv[3].toUint16(); // We won't use this, Win32 might, though...
debug(3, "K_FILEIO_FIND_FIRST(%s,0x%x)", mask, attr);
@@ -851,7 +851,7 @@ reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) {
break;
}
case K_FILEIO_FILE_EXISTS : {
- char *name = kernelDerefString(s->segmentManager, argv[1]);
+ char *name = kernelDerefString(s->segMan, argv[1]);
// Check for regular file
bool exists = Common::File::exists(name);
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 22500cc5f5..65ed3b7b4a 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -193,8 +193,8 @@ int _find_priority_band(EngineState *s, int nr) {
}
reg_t graph_save_box(EngineState *s, rect_t area) {
- reg_t handle = kalloc(s->segmentManager, "graph_save_box()", sizeof(gfxw_snapshot_t *));
- gfxw_snapshot_t **ptr = (gfxw_snapshot_t **)kmem(s->segmentManager, handle);
+ reg_t handle = kalloc(s->segMan, "graph_save_box()", sizeof(gfxw_snapshot_t *));
+ gfxw_snapshot_t **ptr = (gfxw_snapshot_t **)kmem(s->segMan, handle);
// FIXME: gfxw_make_snapshot returns a pointer. Now why do we store a
// pointer to real memory inside the SCI heap?
@@ -215,7 +215,7 @@ void graph_restore_box(EngineState *s, reg_t handle) {
return;
}
- ptr = (gfxw_snapshot_t **)kmem(s->segmentManager, handle);
+ ptr = (gfxw_snapshot_t **)kmem(s->segMan, handle);
if (!ptr) {
warning("Attempt to restore invalid handle %04x:%04x", PRINT_REG(handle));
@@ -255,11 +255,11 @@ void graph_restore_box(EngineState *s, reg_t handle) {
free(*ptr);
*ptr = NULL;
- kfree(s->segmentManager, handle);
+ kfree(s->segMan, handle);
}
PaletteEntry get_pic_color(EngineState *s, int color) {
- if (!s->resourceManager->isVGA())
+ if (!s->resMan->isVGA())
return s->ega_colors[color].visual;
if (color == -1 || color == 255) // -1 occurs in Eco Quest 1. Not sure if this is the best approach, but it seems to work
@@ -276,7 +276,7 @@ PaletteEntry get_pic_color(EngineState *s, int color) {
static gfx_color_t graph_map_color(EngineState *s, int color, int priority, int control) {
gfx_color_t retval;
- if (!s->resourceManager->isVGA()) {
+ if (!s->resMan->isVGA()) {
retval = s->ega_colors[(color >=0 && color < 16)? color : 0];
gfxop_set_color(s->gfx_state, &retval, (color < 0) ? -1 : retval.visual.r, retval.visual.g, retval.visual.b,
(color == -1) ? 255 : 0, priority, control);
@@ -488,7 +488,7 @@ reg_t kGraph(EngineState *s, int, int argc, reg_t *argv) {
case K_GRAPH_GET_COLORS_NR:
- return make_reg(0, !s->resourceManager->isVGA() ? 0x10 : 0x100);
+ return make_reg(0, !s->resMan->isVGA() ? 0x10 : 0x100);
break;
case K_GRAPH_DRAW_LINE: {
@@ -611,14 +611,14 @@ reg_t kGraph(EngineState *s, int, int argc, reg_t *argv) {
reg_t kTextSize(EngineState *s, int, int argc, reg_t *argv) {
int width, height;
- char *text = argv[1].segment ? (char *) kernelDerefBulkPtr(s->segmentManager, argv[1], 0) : NULL;
+ char *text = argv[1].segment ? (char *) kernelDerefBulkPtr(s->segMan, argv[1], 0) : NULL;
const char *sep = NULL;
- reg_t *dest = kernelDerefRegPtr(s->segmentManager, argv[0], 4);
+ reg_t *dest = kernelDerefRegPtr(s->segMan, argv[0], 4);
int maxwidth = (argc > 3) ? argv[3].toUint16() : 0;
int font_nr = argv[2].toUint16();
if ((argc > 4) && (argv[4].segment))
- sep = (const char *)kernelDerefBulkPtr(s->segmentManager, argv[4], 0);
+ sep = (const char *)kernelDerefBulkPtr(s->segMan, argv[4], 0);
if (maxwidth < 0)
maxwidth = 0;
@@ -673,12 +673,12 @@ reg_t kPriCoord(EngineState *s, int, int argc, reg_t *argv) {
}
void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
int view = GET_SEL32V(obj, view);
int signal = GET_SEL32V(obj, signal);
int loop;
int maxloops;
- bool oldScriptHeader = (s->resourceManager->sciVersion() == SCI_VERSION_0_EARLY);
+ bool oldScriptHeader = (s->resMan->sciVersion() == SCI_VERSION_0_EARLY);
if (signal & _K_VIEW_SIG_FLAG_DOESNT_TURN)
return;
@@ -731,7 +731,7 @@ reg_t kDirLoop(EngineState *s, int, int argc, reg_t *argv) {
static Common::Rect nsrect_clip(EngineState *s, int y, Common::Rect retval, int priority);
static int collides_with(EngineState *s, Common::Rect area, reg_t other_obj, int use_nsrect, int view_mask, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
int other_signal = GET_SEL32V(other_obj, signal);
int other_priority = GET_SEL32V(other_obj, priority);
int y = (int16)GET_SEL32V(other_obj, y);
@@ -771,7 +771,7 @@ static int collides_with(EngineState *s, Common::Rect area, reg_t other_obj, int
}
reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t obj = argv[0];
reg_t cliplist_ref = (argc > 1) ? argv[1] : NULL_REG;
List *cliplist = NULL;
@@ -817,7 +817,7 @@ reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) {
while (widget) {
if (widget->_ID && (widget->signal & _K_VIEW_SIG_FLAG_STOPUPD)
&& ((widget->_ID != obj.segment) || (widget->_subID != obj.offset))
- && is_object(s->segmentManager, make_reg(widget->_ID, widget->_subID)))
+ && is_object(s->segMan, make_reg(widget->_ID, widget->_subID)))
if (collides_with(s, abs_zone, make_reg(widget->_ID, widget->_subID), 1, GASEOUS_VIEW_MASK_ACTIVE, argc, argv))
return not_register(s, NULL_REG);
@@ -843,7 +843,7 @@ reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) {
reg_t other_obj = node->value;
debugC(2, kDebugLevelBresen, " comparing against %04x:%04x\n", PRINT_REG(other_obj));
- if (!is_object(s->segmentManager, other_obj)) {
+ if (!is_object(s->segMan, other_obj)) {
warning("CanBeHere() cliplist contains non-object %04x:%04x", PRINT_REG(other_obj));
} else if (other_obj != obj) { // Clipping against yourself is not recommended
@@ -926,7 +926,7 @@ reg_t kCelWide(EngineState *s, int, int argc, reg_t *argv) {
}
reg_t kNumLoops(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t obj = argv[0];
int view = GET_SEL32V(obj, view);
int loops_nr = gfxop_lookup_view_get_loops(s->gfx_state, view);
@@ -942,7 +942,7 @@ reg_t kNumLoops(EngineState *s, int, int argc, reg_t *argv) {
}
reg_t kNumCels(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t obj = argv[0];
int loop = GET_SEL32V(obj, loop);
int view = GET_SEL32V(obj, view);
@@ -1061,7 +1061,7 @@ reg_t kDrawPic(EngineState *s, int, int argc, reg_t *argv) {
}
Common::Rect set_base(EngineState *s, reg_t object) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
int x, y, original_y, z, ystep, xsize, ysize;
int xbase, ybase, xend, yend;
int view, loop, cel;
@@ -1124,10 +1124,10 @@ Common::Rect set_base(EngineState *s, reg_t object) {
}
void _k_base_setter(EngineState *s, reg_t object) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
Common::Rect absrect = set_base(s, object);
- if (lookup_selector(s->segmentManager, object, ((SciEngine*)g_engine)->getKernel()->_selectorMap.brLeft, NULL, NULL) != kSelectorVariable)
+ if (lookup_selector(s->segMan, object, ((SciEngine*)g_engine)->getKernel()->_selectorMap.brLeft, NULL, NULL) != kSelectorVariable)
return; // non-fatal
// Note: there was a check here for a very old version of SCI, which supposedly needed
@@ -1135,7 +1135,7 @@ void _k_base_setter(EngineState *s, reg_t object) {
// does not exist (earliest one was KQ4 SCI, version 0.000.274). This code is left here
// for reference only
#if 0
- if (s->resourceManager->sciVersion() <= SCI_VERSION_0)
+ if (s->resMan->sciVersion() <= SCI_VERSION_0)
--absrect.top; // Compensate for early SCI OB1 'bug'
#endif
@@ -1201,7 +1201,7 @@ static Common::Rect calculate_nsrect(EngineState *s, int x, int y, int view, int
}
Common::Rect get_nsrect(EngineState *s, reg_t object, byte clip) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
int x, y, z;
int view, loop, cel;
Common::Rect retval;
@@ -1231,10 +1231,10 @@ Common::Rect get_nsrect(EngineState *s, reg_t object, byte clip) {
}
static void _k_set_now_seen(EngineState *s, reg_t object) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
Common::Rect absrect = get_nsrect(s, object, 0);
- if (lookup_selector(s->segmentManager, object, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsTop, NULL, NULL) != kSelectorVariable) {
+ if (lookup_selector(s->segMan, object, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsTop, NULL, NULL) != kSelectorVariable) {
return;
} // This isn't fatal
@@ -1328,9 +1328,9 @@ reg_t kPalVary(EngineState *s, int, int argc, reg_t *argv) {
static void _k_draw_control(EngineState *s, reg_t obj, int inverse);
static void _k_disable_delete_for_now(EngineState *s, reg_t obj) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t text_pos = GET_SEL32(obj, text);
- char *text = text_pos.isNull() ? NULL : (char *)s->segmentManager->dereference(text_pos, NULL);
+ char *text = text_pos.isNull() ? NULL : (char *)s->segMan->dereference(text_pos, NULL);
int type = GET_SEL32V(obj, type);
int state = GET_SEL32V(obj, state);
@@ -1354,7 +1354,7 @@ static void _k_disable_delete_for_now(EngineState *s, reg_t obj) {
* that game - bringing the save/load dialog on a par with SCI0.
*/
if (type == K_CONTROL_BUTTON && text && (s->_gameName == "sq4") &&
- s->resourceManager->sciVersion() < SCI_VERSION_1_1 && !strcmp(text, " Delete ")) {
+ s->resMan->sciVersion() < SCI_VERSION_1_1 && !strcmp(text, " Delete ")) {
PUT_SEL32V(obj, state, (state | kControlStateDisabled) & ~kControlStateEnabled);
}
}
@@ -1399,7 +1399,7 @@ void update_cursor_limits(int *display_offset, int *cursor, int max_displayed) {
}
reg_t kEditControl(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t obj = argv[0];
reg_t event = argv[1];
@@ -1420,7 +1420,7 @@ reg_t kEditControl(EngineState *s, int, int argc, reg_t *argv) {
reg_t text_pos = GET_SEL32(obj, text);
int display_offset = 0;
- char *text = (char *)s->segmentManager->dereference(text_pos, NULL);
+ char *text = (char *)s->segMan->dereference(text_pos, NULL);
int textlen;
if (!text) {
@@ -1574,7 +1574,7 @@ reg_t kEditControl(EngineState *s, int, int argc, reg_t *argv) {
}
static void _k_draw_control(EngineState *s, reg_t obj, int inverse) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
int x = (int16)GET_SEL32V(obj, nsLeft);
int y = (int16)GET_SEL32V(obj, nsTop);
int xl = (int16)GET_SEL32V(obj, nsRight) - x;
@@ -1583,7 +1583,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, int inverse) {
int font_nr = GET_SEL32V(obj, font);
reg_t text_pos = GET_SEL32(obj, text);
- const char *text = text_pos.isNull() ? NULL : (char *)s->segmentManager->dereference(text_pos, NULL);
+ const char *text = text_pos.isNull() ? NULL : (char *)s->segMan->dereference(text_pos, NULL);
int view = GET_SEL32V(obj, view);
int cel = sign_extend_byte(GET_SEL32V(obj, cel));
int loop = sign_extend_byte(GET_SEL32V(obj, loop));
@@ -1705,10 +1705,10 @@ static void draw_rect_to_control_map(EngineState *s, Common::Rect abs_zone) {
static void draw_obj_to_control_map(EngineState *s, GfxDynView *view) {
reg_t obj = make_reg(view->_ID, view->_subID);
- if (!is_object(s->segmentManager, obj))
+ if (!is_object(s->segMan, obj))
warning("View %d does not contain valid object reference %04x:%04x", view->_ID, PRINT_REG(obj));
- reg_t* sp = view->signalp.getPointer(s->segmentManager);
+ reg_t* sp = view->signalp.getPointer(s->segMan);
if (!(sp && (sp->offset & _K_VIEW_SIG_FLAG_IGNORE_ACTOR))) {
Common::Rect abs_zone = get_nsrect(s, make_reg(view->_ID, view->_subID), 1);
draw_rect_to_control_map(s, abs_zone);
@@ -1716,7 +1716,7 @@ static void draw_obj_to_control_map(EngineState *s, GfxDynView *view) {
}
static void _k_view_list_do_postdraw(EngineState *s, GfxList *list) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
GfxDynView *widget = (GfxDynView *) list->_contents;
while (widget) {
@@ -1729,7 +1729,7 @@ static void _k_view_list_do_postdraw(EngineState *s, GfxList *list) {
* if ((widget->signal & (_K_VIEW_SIG_FLAG_PRIVATE | _K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)) == _K_VIEW_SIG_FLAG_PRIVATE) {
*/
if ((widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)) == 0) {
- int has_nsrect = lookup_selector(s->segmentManager, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL, NULL) == kSelectorVariable;
+ int has_nsrect = lookup_selector(s->segMan, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL, NULL) == kSelectorVariable;
if (has_nsrect) {
int temp;
@@ -1751,7 +1751,7 @@ static void _k_view_list_do_postdraw(EngineState *s, GfxList *list) {
}
#ifdef DEBUG_LSRECT
else
- fprintf(stderr, "Not lsRecting %04x:%04x because %d\n", PRINT_REG(obj), lookup_selector(s->segmentManager, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL, NULL));
+ fprintf(stderr, "Not lsRecting %04x:%04x because %d\n", PRINT_REG(obj), lookup_selector(s->segMan, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL, NULL));
#endif
if (widget->signal & _K_VIEW_SIG_FLAG_HIDDEN)
@@ -1761,7 +1761,7 @@ static void _k_view_list_do_postdraw(EngineState *s, GfxList *list) {
fprintf(stderr, "obj %04x:%04x has pflags %x\n", PRINT_REG(obj), (widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)));
#endif
- reg_t* sp = widget->signalp.getPointer(s->segmentManager);
+ reg_t* sp = widget->signalp.getPointer(s->segMan);
if (sp) {
*sp = make_reg(0, widget->signal & 0xffff); /* Write back signal */
}
@@ -1793,7 +1793,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in
// returns non-zero IFF views were dropped
int signal;
int dropped = 0;
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
_k_animate_ran = false;
@@ -1811,7 +1811,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in
reg_t obj = make_reg(widget->_ID, widget->_subID);
reg_t under_bits = NULL_REG;
- if (!is_object(s->segmentManager, obj)) {
+ if (!is_object(s->segMan, obj)) {
error("Non-object %04x:%04x present in view list during delete time", PRINT_REG(obj));
obj = NULL_REG;
} else {
@@ -1820,7 +1820,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in
reg_t mem_handle = *ubp;
if (mem_handle.segment) {
- if (!kfree(s->segmentManager, mem_handle)) {
+ if (!kfree(s->segMan, mem_handle)) {
*ubp = make_reg(0, widget->under_bits = 0);
} else {
warning("Treating viewobj %04x:%04x as no longer present", PRINT_REG(obj));
@@ -1882,7 +1882,7 @@ enum {
};
static GfxDynView *_k_make_dynview_obj(EngineState *s, reg_t obj, int options, int nr, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
short oldloop, oldcel;
int cel, loop, view_nr = (int16)GET_SEL32V(obj, view);
int palette;
@@ -1930,20 +1930,20 @@ static GfxDynView *_k_make_dynview_obj(EngineState *s, reg_t obj, int options, i
}
ObjVarRef under_bitsp;
- if (lookup_selector(s->segmentManager, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.underBits, &(under_bitsp), NULL) != kSelectorVariable) {
+ if (lookup_selector(s->segMan, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.underBits, &(under_bitsp), NULL) != kSelectorVariable) {
under_bitsp.obj = NULL_REG;
under_bits = NULL_REG;
debugC(2, kDebugLevelGraphics, "Object at %04x:%04x has no underBits\n", PRINT_REG(obj));
} else
- under_bits = *under_bitsp.getPointer(s->segmentManager);
+ under_bits = *under_bitsp.getPointer(s->segMan);
ObjVarRef signalp;
- if (lookup_selector(s->segmentManager, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.signal, &(signalp), NULL) != kSelectorVariable) {
+ if (lookup_selector(s->segMan, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.signal, &(signalp), NULL) != kSelectorVariable) {
signalp.obj = NULL_REG;
signal = 0;
debugC(2, kDebugLevelGraphics, "Object at %04x:%04x has no signal selector\n", PRINT_REG(obj));
} else {
- signal = signalp.getPointer(s->segmentManager)->offset;
+ signal = signalp.getPointer(s->segMan)->offset;
debugC(2, kDebugLevelGraphics, " with signal = %04x\n", signal);
}
@@ -1966,7 +1966,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list,
** number of list entries in *list_nr. Calls doit for each entry if cycle is set.
** argc, argv should be the same as in the calling kernel function.
*/
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
Node *node;
int sequence_nr = 0;
GfxDynView *widget;
@@ -2019,7 +2019,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list,
widget = (GfxDynView *)(*widget_list)->_contents;
while (widget) { // Read back widget values
- reg_t *sp = widget->signalp.getPointer(s->segmentManager);
+ reg_t *sp = widget->signalp.getPointer(s->segMan);
if (sp)
widget->signal = sp->offset;
@@ -2028,12 +2028,12 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list,
}
static void _k_prepare_view_list(EngineState *s, GfxList *list, int options) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
GfxDynView *view = (GfxDynView *) list->_contents;
while (view) {
reg_t obj = make_reg(view->_ID, view->_subID);
int priority, _priority;
- int has_nsrect = (view->_ID <= 0) ? 0 : lookup_selector(s->segmentManager, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL, NULL) == kSelectorVariable;
+ int has_nsrect = (view->_ID <= 0) ? 0 : lookup_selector(s->segMan, obj, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL, NULL) == kSelectorVariable;
int oldsignal = view->signal;
_k_set_now_seen(s, obj);
@@ -2248,7 +2248,7 @@ void _k_draw_view_list(EngineState *s, GfxList *list, int flags) {
widget = gfxw_picviewize_dynview(widget);
if (GFXW_IS_DYN_VIEW(widget) && widget->_ID) {
- uint16 signal = (flags & _K_DRAW_VIEW_LIST_USE_SIGNAL) ? widget->signalp.getPointer(s->segmentManager)->offset : 0;
+ uint16 signal = (flags & _K_DRAW_VIEW_LIST_USE_SIGNAL) ? widget->signalp.getPointer(s->segMan)->offset : 0;
if (signal & _K_VIEW_SIG_FLAG_HIDDEN)
gfxw_hide_widget(widget);
@@ -2268,7 +2268,7 @@ void _k_draw_view_list(EngineState *s, GfxList *list, int flags) {
else
gfxw_show_widget(widget);
- *widget->signalp.getPointer(s->segmentManager) = make_reg(0, signal); // Write the changes back
+ *widget->signalp.getPointer(s->segMan) = make_reg(0, signal); // Write the changes back
};
} // ...if we're drawing disposeables and this one is disposeable, or if we're drawing non-
@@ -2511,7 +2511,7 @@ reg_t kNewWindow(EngineState *s, int, int argc, reg_t *argv) {
int16 bgColor = (argc > 8 + argextra) ? argv[8 + argextra].toSint16() : 255;
if (bgColor >= 0) {
- if (!s->resourceManager->isVGA())
+ if (!s->resMan->isVGA())
bgcolor.visual = get_pic_color(s, MIN<int>(bgColor, 15));
else
bgcolor.visual = get_pic_color(s, bgColor);
@@ -2537,12 +2537,12 @@ reg_t kNewWindow(EngineState *s, int, int argc, reg_t *argv) {
black.alpha = 0;
black.control = -1;
black.priority = -1;
- lWhite.visual = get_pic_color(s, !s->resourceManager->isVGA() ? 15 : 255);
+ lWhite.visual = get_pic_color(s, !s->resMan->isVGA() ? 15 : 255);
lWhite.mask = GFX_MASK_VISUAL;
lWhite.alpha = 0;
lWhite.priority = -1;
lWhite.control = -1;
- const char *title = argv[4 + argextra].segment ? kernelDerefString(s->segmentManager, argv[4 + argextra]) : NULL;
+ const char *title = argv[4 + argextra].segment ? kernelDerefString(s->segMan, argv[4 + argextra]) : NULL;
window = sciw_new_window(s, gfx_rect(x, y, xl, yl), s->titlebar_port->_font, fgcolor, bgcolor,
s->titlebar_port->_font, lWhite, black, title ? s->strSplit(title, NULL).c_str() : NULL, flags);
@@ -3158,7 +3158,7 @@ reg_t kDisplay(EngineState *s, int, int argc, reg_t *argv) {
bg_color = port->_bgcolor;
// TODO: in SCI1VGA the default colors for text and background are #0 (black)
// SCI0 case should be checked
- if (s->resourceManager->isVGA()) {
+ if (s->resMan->isVGA()) {
// This priority check fixes the colors in the menus in KQ5
// TODO/FIXME: Is this correct?
if (color0.priority >= 0)
@@ -3169,7 +3169,7 @@ reg_t kDisplay(EngineState *s, int, int argc, reg_t *argv) {
if (textp.segment) {
argpt = 1;
- text = (char *)kernelDerefBulkPtr(s->segmentManager, textp, 0);
+ text = (char *)kernelDerefBulkPtr(s->segMan, textp, 0);
} else {
argpt = 2;
text = kernel_lookup_text(s, textp, index);
@@ -3200,10 +3200,10 @@ reg_t kDisplay(EngineState *s, int, int argc, reg_t *argv) {
temp = argv[argpt++].toSint16();
debugC(2, kDebugLevelGraphics, "Display: set_color(%d)\n", temp);
- if (!s->resourceManager->isVGA() && temp >= 0 && temp <= 15)
+ if (!s->resMan->isVGA() && temp >= 0 && temp <= 15)
color0 = (s->ega_colors[temp]);
else
- if (s->resourceManager->isVGA() && temp >= 0 && temp < 256) {
+ if (s->resMan->isVGA() && temp >= 0 && temp < 256) {
color0.visual = get_pic_color(s, temp);
color0.mask = GFX_MASK_VISUAL;
} else
@@ -3217,10 +3217,10 @@ reg_t kDisplay(EngineState *s, int, int argc, reg_t *argv) {
temp = argv[argpt++].toSint16();
debugC(2, kDebugLevelGraphics, "Display: set_bg_color(%d)\n", temp);
- if (!s->resourceManager->isVGA() && temp >= 0 && temp <= 15)
+ if (!s->resMan->isVGA() && temp >= 0 && temp <= 15)
bg_color = s->ega_colors[temp];
else
- if (s->resourceManager->isVGA() && temp >= 0 && temp <= 256) {
+ if (s->resMan->isVGA() && temp >= 0 && temp <= 256) {
bg_color.visual = get_pic_color(s, temp);
bg_color.mask = GFX_MASK_VISUAL;
} else
@@ -3337,7 +3337,7 @@ reg_t kDisplay(EngineState *s, int, int argc, reg_t *argv) {
}
static reg_t kShowMovie_Windows(EngineState *s, int argc, reg_t *argv) {
- const char *filename = kernelDerefString(s->segmentManager, argv[1]);
+ const char *filename = kernelDerefString(s->segMan, argv[1]);
Graphics::AVIPlayer *player = new Graphics::AVIPlayer(g_system);
@@ -3415,7 +3415,7 @@ static reg_t kShowMovie_Windows(EngineState *s, int argc, reg_t *argv) {
}
static reg_t kShowMovie_DOS(EngineState *s, int argc, reg_t *argv) {
- const char *filename = kernelDerefString(s->segmentManager, argv[0]);
+ const char *filename = kernelDerefString(s->segMan, argv[0]);
int delay = argv[1].toUint16(); // Time between frames in ticks
int frameNr = 0;
SeqDecoder seq;
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 340d576aaa..810eb3afc2 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -32,7 +32,7 @@ Node *lookup_node(EngineState *s, reg_t addr) {
if (!addr.offset && !addr.segment)
return NULL; // Non-error null
- MemObject *mobj = GET_SEGMENT(*s->segmentManager, addr.segment, MEM_OBJ_NODES);
+ MemObject *mobj = GET_SEGMENT(*s->segMan, addr.segment, MEM_OBJ_NODES);
if (!mobj) {
// FIXME: This occurs right at the beginning of SQ4, when walking north from the first screen. It doesn't
// seem to have any apparent ill-effects, though, so it's been changed to non-fatal, for now
@@ -52,7 +52,7 @@ Node *lookup_node(EngineState *s, reg_t addr) {
}
List *lookup_list(EngineState *s, reg_t addr) {
- MemObject *mobj = GET_SEGMENT(*s->segmentManager, addr.segment, MEM_OBJ_LISTS);
+ MemObject *mobj = GET_SEGMENT(*s->segMan, addr.segment, MEM_OBJ_LISTS);
if (!mobj) {
error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
@@ -135,7 +135,7 @@ int sane_listp(EngineState *s, reg_t addr) {
reg_t kNewList(EngineState *s, int, int argc, reg_t *argv) {
reg_t listbase;
List *l;
- l = s->segmentManager->alloc_List(&listbase);
+ l = s->segMan->alloc_List(&listbase);
l->first = l->last = NULL_REG;
debugC(2, kDebugLevelNodes, "New listbase at %04x:%04x\n", PRINT_REG(listbase));
@@ -159,19 +159,19 @@ reg_t kDisposeList(EngineState *s, int, int argc, reg_t *argv) {
while (!n_addr.isNull()) { // Free all nodes
Node *n = lookup_node(s, n_addr);
- s->segmentManager->free_Node(n_addr);
+ s->segMan->free_Node(n_addr);
n_addr = n->succ;
}
}
- s->segmentManager->free_list(argv[0]);
+ s->segMan->free_list(argv[0]);
*/
return s->r_acc;
}
reg_t _k_new_node(EngineState *s, reg_t value, reg_t key) {
reg_t nodebase;
- Node *n = s->segmentManager->alloc_Node(&nodebase);
+ Node *n = s->segMan->alloc_Node(&nodebase);
if (!n) {
error("[Kernel] Out of memory while creating a node");
@@ -401,7 +401,7 @@ reg_t kDeleteKey(EngineState *s, int, int argc, reg_t *argv) {
if (!n->succ.isNull())
lookup_node(s, n->succ)->pred = n->pred;
- //s->segmentManager->free_Node(node_pos);
+ //s->segMan->free_Node(node_pos);
return make_reg(0, 1); // Signal success
}
@@ -425,7 +425,7 @@ int sort_temp_cmp(const void *p1, const void *p2) {
}
reg_t kSort(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t source = argv[0];
reg_t dest = argv[1];
reg_t order_func = argv[2];
@@ -445,7 +445,7 @@ reg_t kSort(EngineState *s, int, int argc, reg_t *argv) {
return s->r_acc;
if (output_data.isNull()) {
- list = s->segmentManager->alloc_List(&output_data);
+ list = s->segMan->alloc_List(&output_data);
list->first = list->last = NULL_REG;
PUT_SEL32(dest, elements, output_data);
}
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index d98eac58c5..99c5ded1da 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -34,8 +34,8 @@
namespace Sci {
reg_t kAddMenu(EngineState *s, int, int argc, reg_t *argv) {
- char *name = kernelDerefString(s->segmentManager, argv[0]);
- char *contents = kernelDerefString(s->segmentManager, argv[1]);
+ char *name = kernelDerefString(s->segMan, argv[0]);
+ char *contents = kernelDerefString(s->segMan, argv[1]);
s->_menubar->addMenu(s->gfx_state, name,
contents, s->titlebar_port->_font, argv[1]);
@@ -78,7 +78,7 @@ reg_t kDrawStatus(EngineState *s, int, int argc, reg_t *argv) {
s->status_bar_background = bgcolor;
if (text.segment) {
- const char *tmp = strdup(kernelDerefString(s->segmentManager, text));
+ const char *tmp = strdup(kernelDerefString(s->segMan, text));
s->_statusBarText = tmp ? tmp : "";
}
@@ -124,7 +124,7 @@ static int _menu_go_down(Menubar *menubar, int menu_nr, int item_nr) {
reg_t kMenuSelect(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t event = argv[0];
/*int pause_sound = (argc > 1) ? argv[1].toUint16() : 1;*/ /* FIXME: Do this eventually */
bool claimed = false;
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 9225fec3d0..b52adba740 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -172,23 +172,23 @@ enum {
reg_t kMemory(EngineState *s, int, int argc, reg_t *argv) {
switch (argv[0].toUint16()) {
case K_MEMORY_ALLOCATE_CRITICAL :
- if (!s->segmentManager->allocDynmem(argv[1].toUint16(), "kMemory() critical", &s->r_acc)) {
+ if (!s->segMan->allocDynmem(argv[1].toUint16(), "kMemory() critical", &s->r_acc)) {
error("Critical heap allocation failed");
}
return s->r_acc;
break;
case K_MEMORY_ALLOCATE_NONCRITICAL :
- s->segmentManager->allocDynmem(argv[1].toUint16(), "kMemory() non-critical", &s->r_acc);
+ s->segMan->allocDynmem(argv[1].toUint16(), "kMemory() non-critical", &s->r_acc);
break;
case K_MEMORY_FREE :
- if (s->segmentManager->freeDynmem(argv[1])) {
+ if (s->segMan->freeDynmem(argv[1])) {
error("Attempt to kMemory::free() non-dynmem pointer %04x:%04x", PRINT_REG(argv[1]));
}
break;
case K_MEMORY_MEMCPY : {
int size = argv[3].toUint16();
- byte *dest = kernelDerefBulkPtr(s->segmentManager, argv[1], size);
- byte *src = kernelDerefBulkPtr(s->segmentManager, argv[2], size);
+ byte *dest = kernelDerefBulkPtr(s->segMan, argv[1], size);
+ byte *src = kernelDerefBulkPtr(s->segMan, argv[2], size);
if (dest && src)
memcpy(dest, src, size);
@@ -204,28 +204,28 @@ reg_t kMemory(EngineState *s, int, int argc, reg_t *argv) {
break;
}
case K_MEMORY_PEEK : {
- byte *ref = kernelDerefBulkPtr(s->segmentManager, argv[1], 2);
+ byte *ref = kernelDerefBulkPtr(s->segMan, argv[1], 2);
if (!ref) {
// This occurs in KQ5CD when interacting with certain objects
warning("Attempt to peek invalid memory at %04x:%04x", PRINT_REG(argv[1]));
return s->r_acc;
}
- if (s->segmentManager->_heap[argv[1].segment]->getType() == MEM_OBJ_LOCALS)
+ if (s->segMan->_heap[argv[1].segment]->getType() == MEM_OBJ_LOCALS)
return *((reg_t *) ref);
else
return make_reg(0, (int16)READ_LE_UINT16(ref));
break;
}
case K_MEMORY_POKE : {
- byte *ref = kernelDerefBulkPtr(s->segmentManager, argv[1], 2);
+ byte *ref = kernelDerefBulkPtr(s->segMan, argv[1], 2);
if (!ref) {
warning("Attempt to poke invalid memory at %04x:%04x", PRINT_REG(argv[1]));
return s->r_acc;
}
- if (s->segmentManager->_heap[argv[1].segment]->getType() == MEM_OBJ_LOCALS)
+ if (s->segMan->_heap[argv[1].segment]->getType() == MEM_OBJ_LOCALS)
*((reg_t *) ref) = argv[2];
else {
if (argv[2].segment) {
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index bd22527df2..a2a470b30f 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -68,7 +68,7 @@ Still, what we compute in the end is of course not a real velocity anymore, but
used in an iterative stepping algorithm
*/
reg_t kSetJump(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
// Input data
reg_t object = argv[0];
int dx = argv[1].toSint16();
@@ -219,7 +219,7 @@ static void initialize_bresen(SegManager *segManager, int argc, reg_t *argv, reg
}
reg_t kInitBresen(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t mover = argv[0];
reg_t client = GET_SEL32(mover, client);
@@ -227,7 +227,7 @@ reg_t kInitBresen(EngineState *s, int, int argc, reg_t *argv) {
int deltay = (int16)GET_SEL32V(mover, y) - (int16)GET_SEL32V(client, y);
int step_factor = (argc < 1) ? argv[1].toUint16() : 1;
- initialize_bresen(s->segmentManager, argc, argv, mover, step_factor, deltax, deltay);
+ initialize_bresen(s->segMan, argc, argv, mover, step_factor, deltax, deltay);
return s->r_acc;
}
@@ -259,7 +259,7 @@ static void bresenham_autodetect(EngineState *s) {
reg_t motion_class;
if (!parse_reg_t(s, "?Motion", &motion_class)) {
- Object *obj = obj_get(s->segmentManager, motion_class);
+ Object *obj = obj_get(s->segMan, motion_class);
reg_t fptr;
byte *buf;
@@ -269,14 +269,14 @@ static void bresenham_autodetect(EngineState *s) {
return;
}
- if (lookup_selector(s->segmentManager, motion_class, ((SciEngine*)g_engine)->getKernel()->_selectorMap.doit, NULL, &fptr) != kSelectorMethod) {
+ if (lookup_selector(s->segMan, motion_class, ((SciEngine*)g_engine)->getKernel()->_selectorMap.doit, NULL, &fptr) != kSelectorMethod) {
warning("bresenham_autodetect failed");
handle_movecnt = INCREMENT_MOVECNT; // Most games do this, so best guess
return;
}
- buf = s->segmentManager->getScript(fptr.segment)->buf + fptr.offset;
- handle_movecnt = (s->segmentManager->sciVersion() <= SCI_VERSION_01 || checksum_bytes(buf, 8) == 0x216) ? INCREMENT_MOVECNT : IGNORE_MOVECNT;
+ buf = s->segMan->getScript(fptr.segment)->buf + fptr.offset;
+ handle_movecnt = (s->segMan->sciVersion() <= SCI_VERSION_01 || checksum_bytes(buf, 8) == 0x216) ? INCREMENT_MOVECNT : IGNORE_MOVECNT;
printf("b-moveCnt action based on checksum: %s\n", handle_movecnt == IGNORE_MOVECNT ? "ignore" : "increment");
} else {
warning("bresenham_autodetect failed");
@@ -285,7 +285,7 @@ static void bresenham_autodetect(EngineState *s) {
}
reg_t kDoBresen(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t mover = argv[0];
reg_t client = GET_SEL32(mover, client);
@@ -296,7 +296,7 @@ reg_t kDoBresen(EngineState *s, int, int argc, reg_t *argv) {
int completed = 0;
int max_movcnt = GET_SEL32V(client, moveSpeed);
- if (s->resourceManager->sciVersion() > SCI_VERSION_01)
+ if (s->resMan->sciVersion() > SCI_VERSION_01)
signal &= ~_K_VIEW_SIG_FLAG_HIT_OBSTACLE;
if (handle_movecnt == UNINITIALIZED)
@@ -383,7 +383,7 @@ reg_t kDoBresen(EngineState *s, int, int argc, reg_t *argv) {
completed = 1;
}
- if (s->resourceManager->sciVersion() > SCI_VERSION_01)
+ if (s->resMan->sciVersion() > SCI_VERSION_01)
if (completed)
invoke_selector(INV_SEL(mover, moveDone, kStopOnInvalidSelector), 0);
@@ -395,7 +395,7 @@ int is_heap_object(EngineState *s, reg_t pos);
extern int get_angle(int xrel, int yrel);
reg_t kDoAvoider(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t avoider = argv[0];
reg_t client, looper, mover;
int angle;
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index a0585cef3c..8ec18c2893 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -359,7 +359,7 @@ static void draw_polygon(EngineState *s, reg_t polygon) {
int size = GET_SEL32(polygon, size).toUint16();
int type = GET_SEL32(polygon, type).toUint16();
Common::Point first, prev;
- const byte *list = kernelDerefBulkPtr(s->segmentManager, points, size * POLY_POINT_SIZE);
+ const byte *list = kernelDerefBulkPtr(s->segMan, points, size * POLY_POINT_SIZE);
int is_reg_t = polygon_is_reg_t(list, size);
int i;
@@ -443,7 +443,7 @@ static void print_input(EngineState *s, reg_t poly_list, Common::Point start, Co
node = lookup_node(s, list->first);
while (node) {
- print_polygon(s->segmentManager, node->value);
+ print_polygon(s->segMan, node->value);
node = lookup_node(s, node->succ);
}
}
@@ -1226,11 +1226,11 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) {
// Parameters: (EngineState *) s: The game state
// (reg_t) polygon: The SCI polygon to convert
// Returns : (Polygon *) The converted polygon
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
int i;
reg_t points = GET_SEL32(polygon, points);
int size = GET_SEL32(polygon, size).toUint16();
- const byte *list = kernelDerefBulkPtr(s->segmentManager, points, size * POLY_POINT_SIZE);
+ const byte *list = kernelDerefBulkPtr(s->segMan, points, size * POLY_POINT_SIZE);
Polygon *poly = new Polygon(GET_SEL32(polygon, type).toUint16());
int is_reg_t = polygon_is_reg_t(list, size);
@@ -1363,7 +1363,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
// (int) opt: Optimization level (0, 1 or 2)
// Returns : (PathfindingState *) On success a newly allocated pathfinding state,
// NULL otherwise
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
Polygon *polygon;
int err;
int count = 0;
@@ -1379,7 +1379,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
// Workaround for game bugs that put a polygon in the list more than once
while (dup != node) {
- if (polygons_equal(s->segmentManager, node->value, dup->value)) {
+ if (polygons_equal(s->segMan, node->value, dup->value)) {
warning("[avoidpath] Ignoring duplicate polygon");
break;
}
@@ -1590,7 +1590,7 @@ static reg_t output_path(PathfindingState *p, EngineState *s) {
if (unreachable) {
// If pathfinding failed we only return the path up to vertex_start
- oref = s->segmentManager->allocDynmem(POLY_POINT_SIZE * 3, AVOIDPATH_DYNMEM_STRING, &output);
+ oref = s->segMan->allocDynmem(POLY_POINT_SIZE * 3, AVOIDPATH_DYNMEM_STRING, &output);
if (p->_prependPoint)
POLY_SET_POINT(oref, 0, *p->_prependPoint);
@@ -1610,7 +1610,7 @@ static reg_t output_path(PathfindingState *p, EngineState *s) {
}
// Allocate memory for path, plus 3 extra for appended point, prepended point and sentinel
- oref = s->segmentManager->allocDynmem(POLY_POINT_SIZE * (path_len + 3), AVOIDPATH_DYNMEM_STRING, &output);
+ oref = s->segMan->allocDynmem(POLY_POINT_SIZE * (path_len + 3), AVOIDPATH_DYNMEM_STRING, &output);
int offset = 0;
@@ -1702,7 +1702,7 @@ reg_t kAvoidPath(EngineState *s, int, int argc, reg_t *argv) {
printf("[avoidpath] Error: pathfinding failed for following input:\n");
print_input(s, poly_list, start, end, opt);
printf("[avoidpath] Returning direct path from start point to end point\n");
- oref = s->segmentManager->allocDynmem(POLY_POINT_SIZE * 3,
+ oref = s->segMan->allocDynmem(POLY_POINT_SIZE * 3,
AVOIDPATH_DYNMEM_STRING, &output);
POLY_SET_POINT(oref, 0, start);
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index 85785820cb..bc0b7b41e5 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -68,7 +68,7 @@ int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvoc
stackframe[0] = make_reg(0, selector_id); // The selector we want to call
stackframe[1] = make_reg(0, argc); // Argument count
- slc_type = lookup_selector(s->segmentManager, object, selector_id, NULL, &address);
+ slc_type = lookup_selector(s->segMan, object, selector_id, NULL, &address);
if (slc_type == kSelectorNone) {
warning("Selector '%s' of object at %04x:%04x could not be invoked (%s L%d)",
@@ -119,7 +119,7 @@ reg_t kLoad(EngineState *s, int, int argc, reg_t *argv) {
// Request to dynamically allocate hunk memory for later use
if (restype == kResourceTypeMemory)
- return kalloc(s->segmentManager, "kLoad()", resnr);
+ return kalloc(s->segMan, "kLoad()", resnr);
return make_reg(0, ((restype << 11) | resnr)); // Return the resource identifier as handle
}
@@ -133,18 +133,18 @@ reg_t kLock(EngineState *s, int, int argc, reg_t *argv) {
switch (state) {
case 1 :
- s->resourceManager->findResource(id, 1);
+ s->resMan->findResource(id, 1);
break;
case 0 :
- which = s->resourceManager->findResource(id, 0);
+ which = s->resMan->findResource(id, 0);
if (which)
- s->resourceManager->unlockResource(which);
+ s->resMan->unlockResource(which);
else {
if (id.type == kResourceTypeInvalid)
- warning("[resourceManager] Attempt to unlock resource %i of invalid type %i", id.number, type);
+ warning("[resMan] Attempt to unlock resource %i of invalid type %i", id.number, type);
else
- warning("[resourceManager] Attempt to unlock non-existant resource %s", id.toString().c_str());
+ warning("[resMan] Attempt to unlock non-existant resource %s", id.toString().c_str());
}
break;
}
@@ -157,7 +157,7 @@ reg_t kUnLoad(EngineState *s, int, int argc, reg_t *argv) {
reg_t resnr = argv[1];
if (restype == kResourceTypeMemory)
- kfree(s->segmentManager, resnr);
+ kfree(s->segMan, resnr);
return s->r_acc;
}
@@ -173,10 +173,10 @@ reg_t kResCheck(EngineState *s, int, int argc, reg_t *argv) {
uint cond = argv[4].toUint16() & 0xff;
uint seq = argv[5].toUint16() & 0xff;
- res = s->resourceManager->testResource(ResourceId(restype, argv[1].toUint16(), noun, verb, cond, seq));
+ res = s->resMan->testResource(ResourceId(restype, argv[1].toUint16(), noun, verb, cond, seq));
}
} else {
- res = s->resourceManager->testResource(ResourceId(restype, argv[1].toUint16()));
+ res = s->resMan->testResource(ResourceId(restype, argv[1].toUint16()));
}
return make_reg(0, res != NULL);
@@ -184,7 +184,7 @@ reg_t kResCheck(EngineState *s, int, int argc, reg_t *argv) {
reg_t kClone(EngineState *s, int, int argc, reg_t *argv) {
reg_t parent_addr = argv[0];
- Object *parent_obj = obj_get(s->segmentManager, parent_addr);
+ Object *parent_obj = obj_get(s->segMan, parent_addr);
reg_t clone_addr;
Clone *clone_obj; // same as Object*
@@ -195,7 +195,7 @@ reg_t kClone(EngineState *s, int, int argc, reg_t *argv) {
debugC(2, kDebugLevelMemory, "Attempting to clone from %04x:%04x\n", PRINT_REG(parent_addr));
- clone_obj = s->segmentManager->alloc_Clone(&clone_addr);
+ clone_obj = s->segMan->alloc_Clone(&clone_addr);
if (!clone_obj) {
error("Cloning %04x:%04x failed-- internal error", PRINT_REG(parent_addr));
@@ -205,15 +205,15 @@ reg_t kClone(EngineState *s, int, int argc, reg_t *argv) {
*clone_obj = *parent_obj;
clone_obj->flags = 0;
- SciVersion version = s->resourceManager->sciVersion(); // for the selector defines
+ SciVersion version = s->resMan->sciVersion(); // for the selector defines
// Mark as clone
clone_obj->_variables[SCRIPT_INFO_SELECTOR].offset = SCRIPT_INFO_CLONE;
clone_obj->_variables[SCRIPT_SPECIES_SELECTOR] = clone_obj->pos;
if (IS_CLASS(parent_obj))
clone_obj->_variables[SCRIPT_SUPERCLASS_SELECTOR] = parent_obj->pos;
- s->segmentManager->getScript(parent_obj->pos.segment)->incrementLockers();
- s->segmentManager->getScript(clone_obj->pos.segment)->incrementLockers();
+ s->segMan->getScript(parent_obj->pos.segment)->incrementLockers();
+ s->segMan->getScript(clone_obj->pos.segment)->incrementLockers();
return clone_addr;
}
@@ -221,9 +221,9 @@ reg_t kClone(EngineState *s, int, int argc, reg_t *argv) {
extern void _k_view_list_mark_free(EngineState *s, reg_t off);
reg_t kDisposeClone(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t victim_addr = argv[0];
- Clone *victim_obj = obj_get(s->segmentManager, victim_addr);
+ Clone *victim_obj = obj_get(s->segMan, victim_addr);
uint16 underBits;
if (!victim_obj) {
@@ -232,7 +232,7 @@ reg_t kDisposeClone(EngineState *s, int, int argc, reg_t *argv) {
return s->r_acc;
}
- SciVersion version = s->resourceManager->sciVersion(); // for the selector defines
+ SciVersion version = s->resMan->sciVersion(); // for the selector defines
if (victim_obj->_variables[SCRIPT_INFO_SELECTOR].offset != SCRIPT_INFO_CLONE) {
//warning("Attempt to dispose something other than a clone at %04x", offset);
@@ -265,7 +265,7 @@ reg_t kScriptID(EngineState *s, int, int argc, reg_t *argv) {
int script = argv[0].toUint16();
int index = (argc > 1) ? argv[1].toUint16() : 0;
- SegmentId scriptid = s->segmentManager->getSegment(script, SCRIPT_GET_LOAD);
+ SegmentId scriptid = s->segMan->getSegment(script, SCRIPT_GET_LOAD);
Script *scr;
if (argv[0].segment)
@@ -274,7 +274,7 @@ reg_t kScriptID(EngineState *s, int, int argc, reg_t *argv) {
if (!scriptid)
return NULL_REG;
- scr = s->segmentManager->getScript(scriptid);
+ scr = s->segMan->getScript(scriptid);
if (!scr->exports_nr) {
// FIXME: Is this fatal? This occurs in SQ4CD
@@ -287,7 +287,7 @@ reg_t kScriptID(EngineState *s, int, int argc, reg_t *argv) {
return NULL_REG;
}
- return make_reg(scriptid, s->segmentManager->validateExportFunc(index, scriptid));
+ return make_reg(scriptid, s->segMan->validateExportFunc(index, scriptid));
}
reg_t kDisposeScript(EngineState *s, int, int argc, reg_t *argv) {
@@ -297,8 +297,8 @@ reg_t kDisposeScript(EngineState *s, int, int argc, reg_t *argv) {
if (argv[0].segment)
return s->r_acc;
- int id = s->segmentManager->segGet(script);
- Script *scr = s->segmentManager->getScriptIfLoaded(id);
+ int id = s->segMan->segGet(script);
+ Script *scr = s->segMan->getScriptIfLoaded(id);
if (scr) {
if (s->_executionStack.back().addr.pc.segment != id)
scr->setLockers(1);
@@ -310,7 +310,7 @@ reg_t kDisposeScript(EngineState *s, int, int argc, reg_t *argv) {
}
}
- script_uninstantiate(s->segmentManager, script);
+ script_uninstantiate(s->segMan, script);
s->_executionStackPosChanged = true;
if (argc != 2) {
@@ -323,8 +323,8 @@ reg_t kDisposeScript(EngineState *s, int, int argc, reg_t *argv) {
}
int is_heap_object(EngineState *s, reg_t pos) {
- Object *obj = obj_get(s->segmentManager, pos);
- return (obj != NULL && (!(obj->flags & OBJECT_FLAG_FREED)) && (!s->segmentManager->scriptIsMarkedAsDeleted(pos.segment)));
+ Object *obj = obj_get(s->segMan, pos);
+ return (obj != NULL && (!(obj->flags & OBJECT_FLAG_FREED)) && (!s->segMan->scriptIsMarkedAsDeleted(pos.segment)));
}
reg_t kIsObject(EngineState *s, int, int argc, reg_t *argv) {
@@ -338,7 +338,7 @@ reg_t kRespondsTo(EngineState *s, int, int argc, reg_t *argv) {
reg_t obj = argv[0];
int selector = argv[1].toUint16();
- return make_reg(0, is_heap_object(s, obj) && lookup_selector(s->segmentManager, obj, selector, NULL, NULL) != kSelectorNone);
+ return make_reg(0, is_heap_object(s, obj) && lookup_selector(s->segMan, obj, selector, NULL, NULL) != kSelectorNone);
}
} // End of namespace Sci
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index b1dae4d30c..219b844407 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -122,9 +122,9 @@ enum AudioSyncCommands {
static void script_set_priority(EngineState *s, reg_t obj, int priority) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
int song_nr = GET_SEL32V(obj, number);
- Resource *song = s->resourceManager->findResource(ResourceId(kResourceTypeSound, song_nr), 0);
+ Resource *song = s->resMan->findResource(ResourceId(kResourceTypeSound, song_nr), 0);
int flags = GET_SEL32V(obj, flags);
if (priority == -1) {
@@ -141,7 +141,7 @@ static void script_set_priority(EngineState *s, reg_t obj, int priority) {
}
SongIterator *build_iterator(EngineState *s, int song_nr, SongIteratorType type, songit_id_t id) {
- Resource *song = s->resourceManager->findResource(ResourceId(kResourceTypeSound, song_nr), 0);
+ Resource *song = s->resMan->findResource(ResourceId(kResourceTypeSound, song_nr), 0);
if (!song)
return NULL;
@@ -157,15 +157,15 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their
int result;
SongHandle handle;
int cue;
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
- if (s->resourceManager->sciVersion() > SCI_VERSION_01)
+ if (s->resMan->sciVersion() > SCI_VERSION_01)
return;
/* SCI1 and later explicitly poll for everything */
while ((result = s->_sound.sfx_poll(&handle, &cue))) {
reg_t obj = DEFROBNICATE_HANDLE(handle);
- if (!is_object(s->segmentManager, obj)) {
+ if (!is_object(s->segMan, obj)) {
warning("Non-object %04x:%04x received sound signal (%d/%d)", PRINT_REG(obj), result, cue);
return;
}
@@ -207,7 +207,7 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their
static reg_t kDoSoundSci0(EngineState *s, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t obj = (argc > 1) ? argv[1] : NULL_REG;
uint16 command = argv[0].toUint16();
SongHandle handle = FROBNICATE_HANDLE(obj);
@@ -387,7 +387,7 @@ static reg_t kDoSoundSci0(EngineState *s, int argc, reg_t *argv) {
static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
uint16 command = argv[0].toUint16();
reg_t obj = (argc > 1) ? argv[1] : NULL_REG;
SongHandle handle = FROBNICATE_HANDLE(obj);
@@ -510,7 +510,7 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) {
//int vol = GET_SEL32V(obj, vol);
//int pri = GET_SEL32V(obj, pri);
- if (obj.segment && (s->resourceManager->testResource(ResourceId(kResourceTypeSound, number)))) {
+ if (obj.segment && (s->resMan->testResource(ResourceId(kResourceTypeSound, number)))) {
debugC(2, kDebugLevelSound, "Initializing song number %d\n", number);
s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1,
handle), 0, handle, number);
@@ -678,7 +678,7 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) {
}
static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
uint16 command = argv[0].toUint16();
reg_t obj = (argc > 1) ? argv[1] : NULL_REG;
SongHandle handle = FROBNICATE_HANDLE(obj);
@@ -820,8 +820,8 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) {
// a relevant audio resource, play it, otherwise switch to synthesized
// effects. If the resource exists, play it using map 65535 (sound
// effects map)
- if (s->resourceManager->testResource(ResourceId(kResourceTypeAudio, number)) &&
- s->resourceManager->sciVersion() >= SCI_VERSION_1_1) {
+ if (s->resMan->testResource(ResourceId(kResourceTypeAudio, number)) &&
+ s->resMan->sciVersion() >= SCI_VERSION_1_1) {
// Found a relevant audio resource, play it
s->_sound.stopAudio();
warning("Initializing audio resource instead of requested sound resource %d\n", number);
@@ -829,7 +829,7 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) {
// Also create iterator, that will fire SI_FINISHED event, when the sound is done playing
s->_sound.sfx_add_song(build_timeriterator(s, sampleLen), 0, handle, number);
} else {
- if (!s->resourceManager->testResource(ResourceId(kResourceTypeSound, number))) {
+ if (!s->resMan->testResource(ResourceId(kResourceTypeSound, number))) {
warning("Could not open song number %d", number);
// Send a "stop handle" event so that the engine won't wait forever here
s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
@@ -863,7 +863,7 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) {
s->_sound.sfx_remove_song(handle);
}
- if (obj.segment && (s->resourceManager->testResource(ResourceId(kResourceTypeSound, number)))) {
+ if (obj.segment && (s->resMan->testResource(ResourceId(kResourceTypeSound, number)))) {
debugC(2, kDebugLevelSound, "Initializing song number %d\n", number);
s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1,
handle), 0, handle, number);
@@ -1056,7 +1056,7 @@ reg_t kDoAudio(EngineState *s, int, int argc, reg_t *argv) {
// In SCI1.1: tests for digital audio support
return make_reg(0, 1);
} else {
- s->resourceManager->setAudioLanguage(argv[1].toSint16());
+ s->resMan->setAudioLanguage(argv[1].toSint16());
}
break;
default:
@@ -1067,13 +1067,13 @@ reg_t kDoAudio(EngineState *s, int, int argc, reg_t *argv) {
}
reg_t kDoSync(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
switch (argv[0].toUint16()) {
case kSciAudioSyncStart: {
ResourceId id;
if (s->_sound._syncResource) {
- s->resourceManager->unlockResource(s->_sound._syncResource);
+ s->resMan->unlockResource(s->_sound._syncResource);
s->_sound._syncResource = NULL;
}
@@ -1088,7 +1088,7 @@ reg_t kDoSync(EngineState *s, int, int argc, reg_t *argv) {
return s->r_acc;
}
- s->_sound._syncResource = s->resourceManager->findResource(id, 1);
+ s->_sound._syncResource = s->resMan->findResource(id, 1);
if (s->_sound._syncResource) {
PUT_SEL32V(argv[1], syncCue, 0);
@@ -1120,7 +1120,7 @@ reg_t kDoSync(EngineState *s, int, int argc, reg_t *argv) {
}
case kSciAudioSyncStop:
if (s->_sound._syncResource) {
- s->resourceManager->unlockResource(s->_sound._syncResource);
+ s->resMan->unlockResource(s->_sound._syncResource);
s->_sound._syncResource = NULL;
}
break;
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 384d8a466d..3016012e35 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -44,11 +44,11 @@ char *kernel_lookup_text(EngineState *s, reg_t address, int index) {
Resource *textres;
if (address.segment)
- return (char *)kernelDerefBulkPtr(s->segmentManager, address, 0);
+ return (char *)kernelDerefBulkPtr(s->segMan, address, 0);
else {
int textlen;
int _index = index;
- textres = s->resourceManager->findResource(ResourceId(kResourceTypeText, address.offset), 0);
+ textres = s->resMan->findResource(ResourceId(kResourceTypeText, address.offset), 0);
if (!textres) {
error("text.%03d not found", address.offset);
@@ -79,7 +79,7 @@ char *kernel_lookup_text(EngineState *s, reg_t address, int index) {
reg_t kSaid(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t heap_said_block = argv[0];
byte *said_block;
int new_lastmatch;
@@ -87,7 +87,7 @@ reg_t kSaid(EngineState *s, int, int argc, reg_t *argv) {
if (!heap_said_block.segment)
return NULL_REG;
- said_block = (byte *) kernelDerefBulkPtr(s->segmentManager, heap_said_block, 0);
+ said_block = (byte *) kernelDerefBulkPtr(s->segMan, heap_said_block, 0);
if (!said_block) {
warning("Said on non-string, pointer %04x:%04x", PRINT_REG(heap_said_block));
@@ -129,7 +129,7 @@ reg_t kSaid(EngineState *s, int, int argc, reg_t *argv) {
reg_t kSetSynonyms(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t object = argv[0];
List *list;
Node *node;
@@ -146,15 +146,15 @@ reg_t kSetSynonyms(EngineState *s, int, int argc, reg_t *argv) {
int synonyms_nr = 0;
script = GET_SEL32V(objpos, number);
- seg = s->segmentManager->segGet(script);
+ seg = s->segMan->segGet(script);
if (seg >= 0)
- synonyms_nr = s->segmentManager->getScript(seg)->getSynonymsNr();
+ synonyms_nr = s->segMan->getScript(seg)->getSynonymsNr();
if (synonyms_nr) {
byte *synonyms;
- synonyms = s->segmentManager->getScript(seg)->getSynonyms();
+ synonyms = s->segMan->getScript(seg)->getSynonyms();
if (synonyms) {
debugC(2, kDebugLevelParser, "Setting %d synonyms for script.%d\n",
synonyms_nr, script);
@@ -187,9 +187,9 @@ reg_t kSetSynonyms(EngineState *s, int, int argc, reg_t *argv) {
reg_t kParse(EngineState *s, int, int argc, reg_t *argv) {
- SegManager *segManager = s->segmentManager;
+ SegManager *segManager = s->segMan;
reg_t stringpos = argv[0];
- char *string = kernelDerefString(s->segmentManager, stringpos);
+ char *string = kernelDerefString(s->segMan, stringpos);
char *error;
ResultWordList words;
reg_t event = argv[1];
@@ -242,7 +242,7 @@ reg_t kParse(EngineState *s, int, int argc, reg_t *argv) {
s->r_acc = make_reg(0, 0);
PUT_SEL32V(event, claimed, 1);
if (error) {
- char *pbase_str = kernelDerefString(s->segmentManager, s->parser_base);
+ char *pbase_str = kernelDerefString(s->segMan, s->parser_base);
strcpy(pbase_str, error);
debugC(2, kDebugLevelParser, "Word unknown: %s\n", error);
/* Issue warning: */
@@ -259,7 +259,7 @@ reg_t kParse(EngineState *s, int, int argc, reg_t *argv) {
reg_t kStrEnd(EngineState *s, int, int argc, reg_t *argv) {
reg_t address = argv[0];
- char *seeker = kernelDerefString(s->segmentManager, address);
+ char *seeker = kernelDerefString(s->segMan, address);
while (*seeker++)
++address.offset;
@@ -268,16 +268,16 @@ reg_t kStrEnd(EngineState *s, int, int argc, reg_t *argv) {
}
reg_t kStrCat(EngineState *s, int, int argc, reg_t *argv) {
- char *s1 = kernelDerefString(s->segmentManager, argv[0]);
- char *s2 = kernelDerefString(s->segmentManager, argv[1]);
+ char *s1 = kernelDerefString(s->segMan, argv[0]);
+ char *s2 = kernelDerefString(s->segMan, argv[1]);
strcat(s1, s2);
return argv[0];
}
reg_t kStrCmp(EngineState *s, int, int argc, reg_t *argv) {
- char *s1 = kernelDerefString(s->segmentManager, argv[0]);
- char *s2 = kernelDerefString(s->segmentManager, argv[1]);
+ char *s1 = kernelDerefString(s->segMan, argv[0]);
+ char *s2 = kernelDerefString(s->segMan, argv[1]);
if (argc > 2)
return make_reg(0, strncmp(s1, s2, argv[2].toUint16()));
@@ -287,8 +287,8 @@ reg_t kStrCmp(EngineState *s, int, int argc, reg_t *argv) {
reg_t kStrCpy(EngineState *s, int, int argc, reg_t *argv) {
- char *dest = (char *) kernelDerefBulkPtr(s->segmentManager, argv[0], 0);
- char *src = (char *) kernelDerefBulkPtr(s->segmentManager, argv[1], 0);
+ char *dest = (char *) kernelDerefBulkPtr(s->segMan, argv[0], 0);
+ char *src = (char *) kernelDerefBulkPtr(s->segMan, argv[1], 0);
if (!dest) {
warning("Attempt to strcpy TO invalid pointer %04x:%04x",
@@ -308,7 +308,7 @@ reg_t kStrCpy(EngineState *s, int, int argc, reg_t *argv) {
if (length >= 0)
strncpy(dest, src, length);
else {
- if (s->segmentManager->_heap[argv[0].segment]->getType() == MEM_OBJ_DYNMEM) {
+ if (s->segMan->_heap[argv[0].segment]->getType() == MEM_OBJ_DYNMEM) {
reg_t *srcp = (reg_t *) src;
int i;
@@ -352,7 +352,7 @@ static int is_print_str(const char *str) {
reg_t kStrAt(EngineState *s, int, int argc, reg_t *argv) {
- byte *dest = (byte *)kernelDerefBulkPtr(s->segmentManager, argv[0], 0);
+ byte *dest = (byte *)kernelDerefBulkPtr(s->segMan, argv[0], 0);
reg_t *dest2;
if (!dest) {
@@ -371,7 +371,7 @@ reg_t kStrAt(EngineState *s, int, int argc, reg_t *argv) {
if ((argc == 2) &&
/* Our pathfinder already works around the issue we're trying to fix */
- (strcmp(s->segmentManager->getDescription(argv[0]), AVOIDPATH_DYNMEM_STRING) != 0) &&
+ (strcmp(s->segMan->getDescription(argv[0]), AVOIDPATH_DYNMEM_STRING) != 0) &&
((strlen(dst) < 2) || (!lsl5PasswordWorkaround && !is_print_str(dst)))) {
// SQ4 array handling detected
#ifndef SCUMM_BIG_ENDIAN
@@ -394,7 +394,7 @@ reg_t kStrAt(EngineState *s, int, int argc, reg_t *argv) {
reg_t kReadNumber(EngineState *s, int, int argc, reg_t *argv) {
- char *source = kernelDerefString(s->segmentManager, argv[0]);
+ char *source = kernelDerefString(s->segMan, argv[0]);
while (isspace(*source))
source++; /* Skip whitespace */
@@ -420,7 +420,7 @@ reg_t kReadNumber(EngineState *s, int, int argc, reg_t *argv) {
reg_t kFormat(EngineState *s, int, int argc, reg_t *argv) {
int *arguments;
reg_t dest = argv[0];
- char *target = (char *) kernelDerefBulkPtr(s->segmentManager, dest, 0);
+ char *target = (char *) kernelDerefBulkPtr(s->segMan, dest, 0);
reg_t position = argv[1]; /* source */
int index = argv[2].toUint16();
char *source;
@@ -633,7 +633,7 @@ reg_t kFormat(EngineState *s, int, int argc, reg_t *argv) {
reg_t kStrLen(EngineState *s, int, int argc, reg_t *argv) {
- char *str = kernelDerefString(s->segmentManager, argv[0]);
+ char *str = kernelDerefString(s->segMan, argv[0]);
if (!str) {
warning("StrLen: invalid pointer %04x:%04x", PRINT_REG(argv[0]));
@@ -645,7 +645,7 @@ reg_t kStrLen(EngineState *s, int, int argc, reg_t *argv) {
reg_t kGetFarText(EngineState *s, int, int argc, reg_t *argv) {
- Resource *textres = s->resourceManager->findResource(ResourceId(kResourceTypeText, argv[0].toUint16()), 0);
+ Resource *textres = s->resMan->findResource(ResourceId(kResourceTypeText, argv[0].toUint16()), 0);
char *seeker;
int counter = argv[1].toUint16();
@@ -665,7 +665,7 @@ reg_t kGetFarText(EngineState *s, int, int argc, reg_t *argv) {
** resource.
*/
- strcpy(kernelDerefString(s->segmentManager, argv[2]), seeker); /* Copy the string and get return value */
+ strcpy(kernelDerefString(s->segMan, argv[2]), seeker); /* Copy the string and get return value */
return argv[2];
}
@@ -716,7 +716,7 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) {
reg_t retval;
if (func == K_MESSAGE_GET) {
- s->_msgState.loadRes(s->resourceManager, argv[1].toUint16(), true);
+ s->_msgState.loadRes(s->resMan, argv[1].toUint16(), true);
s->_msgState.findTuple(tuple);
if (isGetMessage)
@@ -740,7 +740,7 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) {
if (!bufferReg.isNull()) {
int len = str.size() + 1;
- buffer = kernelDerefCharPtr(s->segmentManager, bufferReg, len);
+ buffer = kernelDerefCharPtr(s->segMan, bufferReg, len);
if (buffer) {
strcpy(buffer, str.c_str());
@@ -748,7 +748,7 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) {
warning("Message: buffer %04x:%04x invalid or too small to hold the following text of %i bytes: '%s'", PRINT_REG(bufferReg), len, str.c_str());
// Set buffer to empty string if possible
- buffer = kernelDerefCharPtr(s->segmentManager, bufferReg, 1);
+ buffer = kernelDerefCharPtr(s->segMan, bufferReg, 1);
if (buffer)
*buffer = 0;
}
@@ -761,7 +761,7 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) {
case K_MESSAGE_SIZE: {
MessageState tempState;
- if (tempState.loadRes(s->resourceManager, argv[1].toUint16(), false) && tempState.findTuple(tuple) && tempState.getMessage())
+ if (tempState.loadRes(s->resMan, argv[1].toUint16(), false) && tempState.findTuple(tuple) && tempState.getMessage())
return make_reg(0, tempState.getText().size() + 1);
else
return NULL_REG;
@@ -771,7 +771,7 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) {
case K_MESSAGE_REFNOUN: {
MessageState tempState;
- if (tempState.loadRes(s->resourceManager, argv[1].toUint16(), false) && tempState.findTuple(tuple)) {
+ if (tempState.loadRes(s->resMan, argv[1].toUint16(), false) && tempState.findTuple(tuple)) {
MessageTuple t = tempState.getRefTuple();
switch (func) {
case K_MESSAGE_REFCOND:
@@ -788,7 +788,7 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) {
case K_MESSAGE_LASTMESSAGE: {
MessageTuple msg = s->_msgState.getLastTuple();
int module = s->_msgState.getLastModule();
- byte *buffer = kernelDerefBulkPtr(s->segmentManager, argv[1], 10);
+ byte *buffer = kernelDerefBulkPtr(s->segMan, argv[1], 10);
if (buffer) {
WRITE_LE_UINT16(buffer, module);
@@ -810,18 +810,18 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) {
}
reg_t kSetQuitStr(EngineState *s, int, int argc, reg_t *argv) {
- char *quitStr = kernelDerefString(s->segmentManager, argv[0]);
+ char *quitStr = kernelDerefString(s->segMan, argv[0]);
debug("Setting quit string to '%s'", quitStr);
return s->r_acc;
}
reg_t kStrSplit(EngineState *s, int, int argc, reg_t *argv) {
- const char *format = kernelDerefString(s->segmentManager, argv[1]);
- const char *sep = !argv[2].isNull() ? kernelDerefString(s->segmentManager, argv[2]) : NULL;
+ const char *format = kernelDerefString(s->segMan, argv[1]);
+ const char *sep = !argv[2].isNull() ? kernelDerefString(s->segMan, argv[2]) : NULL;
Common::String str = s->strSplit(format, sep);
// Make sure target buffer is large enough
- char *buf = kernelDerefCharPtr(s->segmentManager, argv[0], str.size() + 1);
+ char *buf = kernelDerefCharPtr(s->segMan, argv[0], str.size() + 1);
if (buf) {
strcpy(buf, str.c_str());
diff --git a/engines/sci/engine/memobj.h b/engines/sci/engine/memobj.h
index 52d0b7859e..7f03a648ac 100644
--- a/engines/sci/engine/memobj.h
+++ b/engines/sci/engine/memobj.h
@@ -52,7 +52,7 @@ enum MemObjectType {
struct MemObject : public Common::Serializable {
MemObjectType _type;
- int _segManagerId; /**< Internal value used by the segmentManager's hash map */
+ int _segManagerId; /**< Internal value used by the segMan's hash map */
typedef void (*NoteCallback)(void *param, reg_t addr); // FIXME: Bad choice of name
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp
index 67657aab25..0e040eff8b 100644
--- a/engines/sci/engine/message.cpp
+++ b/engines/sci/engine/message.cpp
@@ -222,7 +222,7 @@ int MessageState::getLength() {
return strlen(stringptr);
}
-int MessageState::loadRes(ResourceManager *resourceManager, int module, bool lock) {
+int MessageState::loadRes(ResourceManager *resMan, int module, bool lock) {
_cursorStack.clear();
if (_locked) {
@@ -233,11 +233,11 @@ int MessageState::loadRes(ResourceManager *resourceManager, int module, bool loc
}
// Otherwise, free the old resource
- resourceManager->unlockResource(_currentResource);
+ resMan->unlockResource(_currentResource);
_locked = false;
}
- _currentResource = resourceManager->findResource(ResourceId(kResourceTypeMessage, module), lock);
+ _currentResource = resMan->findResource(ResourceId(kResourceTypeMessage, module), lock);
if (_currentResource == NULL || _currentResource->data == NULL) {
warning("Message: failed to load %d.msg", module);
diff --git a/engines/sci/engine/message.h b/engines/sci/engine/message.h
index 7ab772aed5..0a1d1e909a 100644
--- a/engines/sci/engine/message.h
+++ b/engines/sci/engine/message.h
@@ -60,7 +60,7 @@ public:
int getLength();
MessageTuple &getLastTuple();
int getLastModule();
- int loadRes(ResourceManager *resourceManager, int module, bool lock);
+ int loadRes(ResourceManager *resMan, int module, bool lock);
private:
void initCursor();
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 2e06afa3cd..f57901a064 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -205,11 +205,11 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
}
static void sync_SegManagerPtr(Common::Serializer &s, SegManager *&obj) {
- ResourceManager *resourceManager = 0;
+ ResourceManager *resMan = 0;
if (s.isSaving()) {
assert(obj);
- resourceManager = obj->_resourceManager;
+ resMan = obj->_resMan;
}
s.skip(1); // obsolete: used to be a flag indicating if we got sci11 or not
@@ -217,7 +217,7 @@ static void sync_SegManagerPtr(Common::Serializer &s, SegManager *&obj) {
if (s.isLoading()) {
// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
delete obj;
- obj = new SegManager(resourceManager);
+ obj = new SegManager(resMan);
}
obj->saveLoadWithSerializer(s);
@@ -264,9 +264,9 @@ void EngineState::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsSint32LE(status_bar_foreground);
s.syncAsSint32LE(status_bar_background);
- sync_SegManagerPtr(s, segmentManager);
+ sync_SegManagerPtr(s, segMan);
- syncArray<Class>(s, segmentManager->_classtable);
+ syncArray<Class>(s, segMan->_classtable);
sync_sfx_state_t(s, _sound);
}
@@ -496,7 +496,7 @@ static SegmentId find_unique_seg_by_type(SegManager *self, int type) {
}
static byte *find_unique_script_block(EngineState *s, byte *buf, int type) {
- bool oldScriptHeader = (s->resourceManager->sciVersion() == SCI_VERSION_0_EARLY);
+ bool oldScriptHeader = (s->resMan->sciVersion() == SCI_VERSION_0_EARLY);
if (oldScriptHeader)
buf += 2;
@@ -517,8 +517,8 @@ static byte *find_unique_script_block(EngineState *s, byte *buf, int type) {
// FIXME: This should probably be turned into an EngineState method
static void reconstruct_stack(EngineState *retval) {
- SegmentId stack_seg = find_unique_seg_by_type(retval->segmentManager, MEM_OBJ_STACK);
- DataStack *stack = (DataStack *)(retval->segmentManager->_heap[stack_seg]);
+ SegmentId stack_seg = find_unique_seg_by_type(retval->segMan, MEM_OBJ_STACK);
+ DataStack *stack = (DataStack *)(retval->segMan->_heap[stack_seg]);
retval->stack_segment = stack_seg;
retval->stack_base = stack->entries;
@@ -539,18 +539,18 @@ static bool clone_entry_used(CloneTable *table, int n) {
static void load_script(EngineState *s, SegmentId seg) {
Resource *script, *heap = NULL;
- Script *scr = (Script *)(s->segmentManager->_heap[seg]);
+ Script *scr = (Script *)(s->segMan->_heap[seg]);
assert(scr);
scr->buf = (byte *)malloc(scr->buf_size);
assert(scr->buf);
- script = s->resourceManager->findResource(ResourceId(kResourceTypeScript, scr->nr), 0);
- if (s->resourceManager->sciVersion() >= SCI_VERSION_1_1)
- heap = s->resourceManager->findResource(ResourceId(kResourceTypeHeap, scr->nr), 0);
+ script = s->resMan->findResource(ResourceId(kResourceTypeScript, scr->nr), 0);
+ if (s->resMan->sciVersion() >= SCI_VERSION_1_1)
+ heap = s->resMan->findResource(ResourceId(kResourceTypeHeap, scr->nr), 0);
memcpy(scr->buf, script->data, script->size);
- if (s->resourceManager->sciVersion() == SCI_VERSION_1_1)
+ if (s->resMan->sciVersion() == SCI_VERSION_1_1)
memcpy(scr->buf + scr->script_size, heap->data, heap->size);
}
@@ -569,8 +569,8 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) {
// FIXME: Unify this code with script_instantiate_*
load_script(s, i);
- scr->locals_block = (scr->locals_segment == 0) ? NULL : (LocalVariables *)(s->segmentManager->_heap[scr->locals_segment]);
- if (s->resourceManager->sciVersion() == SCI_VERSION_1_1) {
+ scr->locals_block = (scr->locals_segment == 0) ? NULL : (LocalVariables *)(s->segMan->_heap[scr->locals_segment]);
+ if (s->resMan->sciVersion() == SCI_VERSION_1_1) {
scr->export_table = 0;
scr->synonyms = 0;
if (READ_LE_UINT16(scr->buf + 6) > 0) {
@@ -606,7 +606,7 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) {
for (j = 0; j < scr->_objects.size(); j++) {
byte *data = scr->buf + scr->_objects[j].pos.offset;
- if (s->resourceManager->sciVersion() == SCI_VERSION_1_1) {
+ if (s->resMan->sciVersion() == SCI_VERSION_1_1) {
uint16 *funct_area = (uint16 *) (scr->buf + READ_LE_UINT16( data + 6 ));
uint16 *prop_area = (uint16 *) (scr->buf + READ_LE_UINT16( data + 4 ));
@@ -616,7 +616,7 @@ static void reconstruct_scripts(EngineState *s, SegManager *self) {
int funct_area = READ_LE_UINT16( data + SCRIPT_FUNCTAREAPTR_OFFSET );
Object *base_obj;
- base_obj = obj_get(s->segmentManager, scr->_objects[j]._variables[SCRIPT_SPECIES_SELECTOR]);
+ base_obj = obj_get(s->segMan, scr->_objects[j]._variables[SCRIPT_SPECIES_SELECTOR]);
if (!base_obj) {
warning("Object without a base class: Script %d, index %d (reg address %04x:%04x",
@@ -700,7 +700,7 @@ static void reconstruct_sounds(EngineState *s) {
Song *seeker;
SongIteratorType it_type;
- if (s->resourceManager->sciVersion() > SCI_VERSION_01)
+ if (s->resMan->sciVersion() > SCI_VERSION_01)
it_type = SCI_SONG_ITERATOR_TYPE_SCI1;
else
it_type = SCI_SONG_ITERATOR_TYPE_SCI0;
@@ -764,7 +764,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
}
// FIXME: Do in-place loading at some point, instead of creating a new EngineState instance from scratch.
- retval = new EngineState(s->resourceManager, s->_flags);
+ retval = new EngineState(s->resMan, s->_flags);
// Copy some old data
retval->gfx_state = s->gfx_state;
@@ -785,20 +785,20 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
retval->old_screen = 0;
temp = retval->_sound._songlib;
- retval->_sound.sfx_init(retval->resourceManager, s->sfx_init_flags);
+ retval->_sound.sfx_init(retval->resMan, s->sfx_init_flags);
retval->sfx_init_flags = s->sfx_init_flags;
retval->_sound._songlib.freeSounds();
retval->_sound._songlib = temp;
_reset_graphics_input(retval);
reconstruct_stack(retval);
- reconstruct_scripts(retval, retval->segmentManager);
- reconstruct_clones(retval->segmentManager);
+ reconstruct_scripts(retval, retval->segMan);
+ reconstruct_clones(retval->segMan);
retval->game_obj = s->game_obj;
- retval->script_000 = retval->segmentManager->getScript(retval->segmentManager->getSegment(0, SCRIPT_GET_DONT_LOAD));
+ retval->script_000 = retval->segMan->getScript(retval->segMan->getSegment(0, SCRIPT_GET_DONT_LOAD));
retval->gc_countdown = GC_INTERVAL - 1;
- retval->sys_strings_segment = find_unique_seg_by_type(retval->segmentManager, MEM_OBJ_SYS_STRINGS);
- retval->sys_strings = (SystemStrings *)GET_SEGMENT(*retval->segmentManager, retval->sys_strings_segment, MEM_OBJ_SYS_STRINGS);
+ retval->sys_strings_segment = find_unique_seg_by_type(retval->segMan, MEM_OBJ_SYS_STRINGS);
+ retval->sys_strings = (SystemStrings *)GET_SEGMENT(*retval->segMan, retval->sys_strings_segment, MEM_OBJ_SYS_STRINGS);
// Restore system strings
SystemString *str;
@@ -835,7 +835,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
retval->successor = NULL;
retval->pic_priority_table = (int *)gfxop_get_pic_metainfo(retval->gfx_state);
- retval->_gameName = obj_get_name(retval->segmentManager, retval->game_obj);
+ retval->_gameName = obj_get_name(retval->segMan, retval->game_obj);
retval->_sound._it = NULL;
retval->_sound._flags = s->_sound._flags;
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 3a2d01f61f..f40df5595e 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -96,7 +96,7 @@ void script_adjust_opcode_formats(EngineState *s) {
}
#ifdef ENABLE_SCI32
- SciVersion version = s->resourceManager->sciVersion();
+ SciVersion version = s->resMan->sciVersion();
// In SCI32, some arguments are now words instead of bytes
if (version >= SCI_VERSION_2) {
@@ -337,7 +337,7 @@ void Kernel::dumpScriptClass(char *data, int seeker, int objsize) {
void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
int objectctr[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
unsigned int _seeker = 0;
- Resource *script = _resourceManager->findResource(ResourceId(kResourceTypeScript, scriptNumber), 0);
+ Resource *script = _resMan->findResource(ResourceId(kResourceTypeScript, scriptNumber), 0);
if (!script) {
warning("dissectScript(): Script not found!\n");
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index ba0570a879..43c07f3419 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -99,7 +99,7 @@ int propertyOffsetToId(SegManager *segManager, int prop_ofs, reg_t objp) {
// Disassembles one command from the heap, returns address of next command or 0 if a ret was encountered.
reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecode) {
- MemObject *mobj = GET_SEGMENT(*s->segmentManager, pos.segment, MEM_OBJ_SCRIPT);
+ MemObject *mobj = GET_SEGMENT(*s->segMan, pos.segment, MEM_OBJ_SCRIPT);
Script *script_entity = NULL;
byte *scr;
int scr_size;
@@ -257,7 +257,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod
if ((opcode == op_pTos) || (opcode == op_sTop) || (opcode == op_pToa) || (opcode == op_aTop) ||
(opcode == op_dpToa) || (opcode == op_ipToa) || (opcode == op_dpTos) || (opcode == op_ipTos)) {
int prop_ofs = scr[pos.offset + 1];
- int prop_id = propertyOffsetToId(s->segmentManager, prop_ofs, scriptState.xs->objp);
+ int prop_id = propertyOffsetToId(s->segMan, prop_ofs, scriptState.xs->objp);
printf(" (%s)", selector_name(s, prop_id));
}
@@ -269,7 +269,7 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod
if (opcode == op_callk) {
int stackframe = (scr[pos.offset + 2] >> 1) + (scriptState.restAdjust);
int argc = ((scriptState.xs->sp)[- stackframe - 1]).offset;
- bool oldScriptHeader = (s->segmentManager->sciVersion() == SCI_VERSION_0_EARLY);
+ bool oldScriptHeader = (s->segMan->sciVersion() == SCI_VERSION_0_EARLY);
if (!oldScriptHeader)
argc += (scriptState.restAdjust);
@@ -301,14 +301,14 @@ reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecod
selector = sb[- stackframe].offset;
- name = obj_get_name(s->segmentManager, called_obj_addr);
+ name = obj_get_name(s->segMan, called_obj_addr);
if (!name)
name = "<invalid>";
printf(" %s::%s[", name, (selector > kernel->getSelectorNamesSize()) ? "<invalid>" : selector_name(s, selector));
- switch (lookup_selector(s->segmentManager, called_obj_addr, selector, 0, &fun_ref)) {
+ switch (lookup_selector(s->segMan, called_obj_addr, selector, 0, &fun_ref)) {
case kSelectorMethod:
printf("FUNCT");
argc += restmod;
@@ -360,7 +360,7 @@ void script_debug(EngineState *s, bool bp) {
#endif
if (scriptState.seeking && !bp) { // Are we looking for something special?
- MemObject *mobj = GET_SEGMENT(*s->segmentManager, scriptState.xs->addr.pc.segment, MEM_OBJ_SCRIPT);
+ MemObject *mobj = GET_SEGMENT(*s->segMan, scriptState.xs->addr.pc.segment, MEM_OBJ_SCRIPT);
if (mobj) {
Script *scr = (Script *)mobj;
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index b1c355bbb9..24331b3e9c 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -48,11 +48,11 @@ namespace Sci {
//#define GC_DEBUG // Debug garbage collection
//#define GC_DEBUG_VERBOSE // Debug garbage verbosely
-#undef DEBUG_segmentManager // Define to turn on debugging
+#undef DEBUG_segMan // Define to turn on debugging
#define INVALID_SCRIPT_ID -1
-SegManager::SegManager(ResourceManager *resourceManager) {
+SegManager::SegManager(ResourceManager *resMan) {
id_seg_map = new IntMapper();
reserved_id = INVALID_SCRIPT_ID;
id_seg_map->checkKey(reserved_id, true); // reserve entry 0 for INVALID_SCRIPT_ID
@@ -66,7 +66,7 @@ SegManager::SegManager(ResourceManager *resourceManager) {
Hunks_seg_id = 0;
exports_wide = 0;
- _resourceManager = resourceManager;
+ _resMan = resMan;
int result = 0;
@@ -136,20 +136,20 @@ Script *SegManager::allocateScript(int script_nr, SegmentId *seg_id) {
}
void SegManager::setScriptSize(Script &scr, int script_nr) {
- Resource *script = _resourceManager->findResource(ResourceId(kResourceTypeScript, script_nr), 0);
- Resource *heap = _resourceManager->findResource(ResourceId(kResourceTypeHeap, script_nr), 0);
- bool oldScriptHeader = (_resourceManager->sciVersion() == SCI_VERSION_0_EARLY);
+ Resource *script = _resMan->findResource(ResourceId(kResourceTypeScript, script_nr), 0);
+ Resource *heap = _resMan->findResource(ResourceId(kResourceTypeHeap, script_nr), 0);
+ bool oldScriptHeader = (_resMan->sciVersion() == SCI_VERSION_0_EARLY);
scr.script_size = script->size;
scr.heap_size = 0; // Set later
- if (!script || (_resourceManager->sciVersion() >= SCI_VERSION_1_1 && !heap)) {
+ if (!script || (_resMan->sciVersion() >= SCI_VERSION_1_1 && !heap)) {
error("SegManager::setScriptSize: failed to load %s", !script ? "script" : "heap");
}
if (oldScriptHeader) {
scr.buf_size = script->size + READ_LE_UINT16(script->data) * 2;
//locals_size = READ_LE_UINT16(script->data) * 2;
- } else if (_resourceManager->sciVersion() < SCI_VERSION_1_1) {
+ } else if (_resMan->sciVersion() < SCI_VERSION_1_1) {
scr.buf_size = script->size;
} else {
scr.buf_size = script->size + heap->size;
@@ -177,7 +177,7 @@ int SegManager::initialiseScript(Script &scr, int script_nr) {
setScriptSize(scr, script_nr);
scr.buf = (byte *)malloc(scr.buf_size);
-#ifdef DEBUG_segmentManager
+#ifdef DEBUG_segMan
printf("scr.buf = %p ", scr.buf);
#endif
if (!scr.buf) {
@@ -199,7 +199,7 @@ int SegManager::initialiseScript(Script &scr, int script_nr) {
scr.obj_indices = new IntMapper();
- if (_resourceManager->sciVersion() >= SCI_VERSION_1_1)
+ if (_resMan->sciVersion() >= SCI_VERSION_1_1)
scr.heap_start = scr.buf + scr.script_size;
else
scr.heap_start = scr.buf;
@@ -327,7 +327,7 @@ int SegManager::relocateBlock(Common::Array<reg_t> &block, int block_location, S
return 0;
}
block[idx].segment = segment; // Perform relocation
- if (_resourceManager->sciVersion() >= SCI_VERSION_1_1)
+ if (_resMan->sciVersion() >= SCI_VERSION_1_1)
block[idx].offset += getScript(segment)->script_size;
return 1;
@@ -440,7 +440,7 @@ SegmentId SegManager::getSegment(int script_nr, SCRIPT_GET load) {
SegmentId segment;
if ((load & SCRIPT_GET_LOAD) == SCRIPT_GET_LOAD)
- script_instantiate(_resourceManager, this, script_nr);
+ script_instantiate(_resMan, this, script_nr);
segment = segGet(script_nr);
@@ -480,7 +480,7 @@ reg_t SegManager::get_class_address(int classnr, SCRIPT_GET lock, reg_t caller)
Object *SegManager::scriptObjInit0(reg_t obj_pos) {
Object *obj;
int id;
- SciVersion version = _resourceManager->sciVersion(); // for the offset defines
+ SciVersion version = _resMan->sciVersion(); // for the offset defines
unsigned int base = obj_pos.offset - SCRIPT_OBJECT_MAGIC_OFFSET;
reg_t temp;
@@ -589,7 +589,7 @@ Object *SegManager::scriptObjInit11(reg_t obj_pos) {
}
Object *SegManager::scriptObjInit(reg_t obj_pos) {
- if (_resourceManager->sciVersion() < SCI_VERSION_1_1)
+ if (_resMan->sciVersion() < SCI_VERSION_1_1)
return scriptObjInit0(obj_pos);
else
return scriptObjInit11(obj_pos);
@@ -633,7 +633,7 @@ void SegManager::scriptInitialiseLocals(reg_t location) {
VERIFY(location.offset + 1 < (uint16)scr->buf_size, "Locals beyond end of script\n");
- if (_resourceManager->sciVersion() >= SCI_VERSION_1_1)
+ if (_resMan->sciVersion() >= SCI_VERSION_1_1)
count = READ_LE_UINT16(scr->buf + location.offset - 2);
else
count = (READ_LE_UINT16(scr->buf + location.offset - 2) - 4) >> 1;
@@ -675,7 +675,7 @@ void SegManager::scriptRelocateExportsSci11(SegmentId seg) {
void SegManager::scriptInitialiseObjectsSci11(SegmentId seg) {
Script *scr = getScript(seg);
byte *seeker = scr->heap_start + 4 + READ_LE_UINT16(scr->heap_start + 2) * 2;
- SciVersion version = _resourceManager->sciVersion(); // for the selector defines
+ SciVersion version = _resMan->sciVersion(); // for the selector defines
while (READ_LE_UINT16(seeker) == SCRIPT_OBJECT_MAGIC_NUMBER) {
if (READ_LE_UINT16(seeker + 14) & SCRIPT_INFO_CLASS) {
@@ -706,7 +706,7 @@ void SegManager::scriptInitialiseObjectsSci11(SegmentId seg) {
#if 0
if (obj->_variables[5].offset != 0xffff) {
obj->_variables[5] = INST_LOOKUP_CLASS(obj->_variables[5].offset);
- base_obj = obj_get(s->segmentManager, obj->_variables[5]);
+ base_obj = obj_get(s->segMan, obj->_variables[5]);
obj->variable_names_nr = base_obj->variables_nr;
obj->base_obj = base_obj->base_obj;
}
@@ -912,7 +912,7 @@ int SegManager::freeDynmem(reg_t addr) {
}
int SegManager::createClassTable() {
- Resource *vocab996 = _resourceManager->findResource(ResourceId(kResourceTypeVocab, 996), 1);
+ Resource *vocab996 = _resMan->findResource(ResourceId(kResourceTypeVocab, 996), 1);
if (!vocab996)
error("SegManager: failed to open vocab 996");
@@ -927,7 +927,7 @@ int SegManager::createClassTable() {
_classtable[classNr].script = scriptNr;
}
- _resourceManager->unlockResource(vocab996);
+ _resMan->unlockResource(vocab996);
return 0;
}
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index 57a7bbe447..40d37d4c69 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef SCI_ENGINE_segmentManager_H
-#define SCI_ENGINE_segmentManager_H
+#ifndef SCI_ENGINE_segMan_H
+#define SCI_ENGINE_segMan_H
#include "common/scummsys.h"
#include "common/serializer.h"
@@ -58,7 +58,7 @@ public:
/**
* Initialize the segment manager
*/
- SegManager(ResourceManager *resourceManager);
+ SegManager(ResourceManager *resMan);
/**
* Deallocate all memory associated with the segment manager
@@ -340,7 +340,7 @@ public:
void scriptInitialiseObjectsSci11(SegmentId seg);
int initialiseScript(Script &scr, int script_nr);
- SciVersion sciVersion() { return _resourceManager->sciVersion(); }
+ SciVersion sciVersion() { return _resMan->sciVersion(); }
private:
IntMapper *id_seg_map; ///< id - script id; seg - index of heap
@@ -349,7 +349,7 @@ public: // TODO: make private
int reserved_id;
int exports_wide;
Common::Array<Class> _classtable; /**< Table of all classes */
- ResourceManager *_resourceManager;
+ ResourceManager *_resMan;
SegmentId Clones_seg_id; ///< ID of the (a) clones segment
SegmentId Lists_seg_id; ///< ID of the (a) list segment
@@ -385,4 +385,4 @@ private:
} // End of namespace Sci
-#endif // SCI_ENGINE_segmentManager
+#endif // SCI_ENGINE_segMan
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 32183ddd11..a4b92b5ff9 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -31,7 +31,7 @@
namespace Sci {
EngineState::EngineState(ResourceManager *res, uint32 flags)
-: resourceManager(res), _flags(flags), _dirseeker(this) {
+: resMan(res), _flags(flags), _dirseeker(this) {
widget_serial_counter = 0;
game_version = 0;
@@ -113,7 +113,7 @@ EngineState::EngineState(ResourceManager *res, uint32 flags)
game_obj = NULL_REG;
- segmentManager = 0;
+ segMan = 0;
gc_countdown = 0;
successor = 0;
@@ -186,7 +186,7 @@ kLanguage EngineState::getLanguage() {
kLanguage lang = K_LANG_ENGLISH;
if (((SciEngine*)g_engine)->getKernel()->_selectorMap.printLang != -1) {
- SegManager *segManager = this->segmentManager;
+ SegManager *segManager = this->segMan;
lang = (kLanguage)GET_SEL32V(this->game_obj, printLang);
@@ -231,7 +231,7 @@ kLanguage EngineState::getLanguage() {
}
Common::String EngineState::strSplit(const char *str, const char *sep) {
- SegManager *segManager = this->segmentManager;
+ SegManager *segManager = this->segMan;
kLanguage lang = getLanguage();
kLanguage subLang = K_LANG_NONE;
@@ -252,13 +252,13 @@ Common::String EngineState::strSplit(const char *str, const char *sep) {
int EngineState::methodChecksum(reg_t objAddress, Selector sel, int offset, uint size) const {
reg_t fptr;
- Object *obj = obj_get(segmentManager, objAddress);
- SelectorType selType = lookup_selector(this->segmentManager, objAddress, sel, NULL, &fptr);
+ Object *obj = obj_get(segMan, objAddress);
+ SelectorType selType = lookup_selector(this->segMan, objAddress, sel, NULL, &fptr);
if (!obj || (selType != kSelectorMethod))
return -1;
- Script *script = segmentManager->getScript(fptr.segment);
+ Script *script = segMan->getScript(fptr.segment);
if (!script->buf || (fptr.offset + offset < 0))
return -1;
@@ -303,9 +303,9 @@ SciVersion EngineState::detectDoSoundType() {
if (_doSoundType == SCI_VERSION_AUTODETECT) {
warning("DoSound detection failed, taking an educated guess");
- if (resourceManager->sciVersion() >= SCI_VERSION_1_MIDDLE)
+ if (resMan->sciVersion() >= SCI_VERSION_1_MIDDLE)
_doSoundType = SCI_VERSION_1_LATE;
- else if (resourceManager->sciVersion() > SCI_VERSION_01)
+ else if (resMan->sciVersion() > SCI_VERSION_01)
_doSoundType = SCI_VERSION_1_EARLY;
else
_doSoundType = SCI_VERSION_0_EARLY;
@@ -330,7 +330,7 @@ SciVersion EngineState::detectSetCursorType() {
} else {
warning("SetCursor detection failed, taking an educated guess");
- if (resourceManager->sciVersion() >= SCI_VERSION_1_1)
+ if (resMan->sciVersion() >= SCI_VERSION_1_1)
_setCursorType = SCI_VERSION_1_1;
else
_setCursorType = SCI_VERSION_0_EARLY;
@@ -344,7 +344,7 @@ SciVersion EngineState::detectSetCursorType() {
SciVersion EngineState::detectLofsType() {
if (_lofsType == SCI_VERSION_AUTODETECT) {
- SciVersion version = segmentManager->sciVersion(); // FIXME: for VM_OBJECT_READ_FUNCTION
+ SciVersion version = segMan->sciVersion(); // FIXME: for VM_OBJECT_READ_FUNCTION
// This detection only works (and is only needed) pre-SCI1.1
if (version >= SCI_VERSION_1_1) {
@@ -356,7 +356,7 @@ SciVersion EngineState::detectLofsType() {
Object *obj = NULL;
if (!parse_reg_t(this, "?Game", &gameClass))
- obj = obj_get(segmentManager, gameClass);
+ obj = obj_get(segMan, gameClass);
bool couldBeAbs = true;
bool couldBeRel = true;
@@ -366,7 +366,7 @@ SciVersion EngineState::detectLofsType() {
for (int m = 0; m < obj->methods_nr; m++) {
reg_t fptr = VM_OBJECT_READ_FUNCTION(obj, m);
- Script *script = segmentManager->getScript(fptr.segment);
+ Script *script = segMan->getScript(fptr.segment);
if ((script == NULL) || (script->buf == NULL))
continue;
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index c394e5d197..4a6553e65a 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -170,7 +170,7 @@ public:
public:
int widget_serial_counter; /**< Used for savegames */
- ResourceManager *resourceManager; /**< The resource manager */
+ ResourceManager *resMan; /**< The resource manager */
const uint32 _flags; /**< Specific game flags */
@@ -309,7 +309,7 @@ public:
reg_t game_obj; /**< Pointer to the game object */
- SegManager *segmentManager;
+ SegManager *segMan;
int gc_countdown; /**< Number of kernel calls until next gc */
MessageState _msgState;
diff --git a/engines/sci/engine/stringfrag.cpp b/engines/sci/engine/stringfrag.cpp
index 669aa43c48..0eb9546125 100644
--- a/engines/sci/engine/stringfrag.cpp
+++ b/engines/sci/engine/stringfrag.cpp
@@ -103,7 +103,7 @@ static int internal_is_valid_stringfrag(EngineState *s, reg_t *buffer) {
}
int is_valid_stringfrag(EngineState *s, reg_t pos) {
- reg_t *buffer = kernelDerefRegPtr(s->segmentManager, pos, 1);
+ reg_t *buffer = kernelDerefRegPtr(s->segMan, pos, 1);
return internal_is_valid_stringfrag(s, buffer);
}
@@ -138,7 +138,7 @@ static int internal_stringfrag_length(EngineState *s, reg_t *buffer) {
}
int stringfrag_length(EngineState *s, reg_t pos) {
- reg_t *buffer = kernelDerefRegPtr(s->segmentManager, pos, 1);
+ reg_t *buffer = kernelDerefRegPtr(s->segMan, pos, 1);
return internal_stringfrag_length(s, buffer);
}
@@ -169,7 +169,7 @@ static void internal_stringfrag_to_ascii(EngineState *s, reg_t *buffer) {
}
void stringfrag_to_ascii(EngineState *s, reg_t pos) {
- reg_t *buffer = kernelDerefRegPtr(s->segmentManager, pos, 1);
+ reg_t *buffer = kernelDerefRegPtr(s->segMan, pos, 1);
internal_stringfrag_to_ascii(s, buffer);
}
@@ -191,7 +191,7 @@ static void internal_ascii_to_stringfrag(EngineState *s, reg_t *buffer) {
}
void ascii_to_stringfrag(EngineState *s, reg_t pos) {
- reg_t *buffer = kernelDerefRegPtr(s->segmentManager, pos, 1);
+ reg_t *buffer = kernelDerefRegPtr(s->segMan, pos, 1);
internal_ascii_to_stringfrag(s, buffer);
}
@@ -214,7 +214,7 @@ static void internal_stringfrag_append_char(EngineState *s, reg_t *buffer, unsig
}
void stringfrag_append_char(EngineState *s, reg_t pos, unsigned char c) {
- reg_t *buffer = kernelDerefRegPtr(s->segmentManager, pos, 1);
+ reg_t *buffer = kernelDerefRegPtr(s->segMan, pos, 1);
internal_stringfrag_append_char(s, buffer, c);
}
@@ -311,7 +311,7 @@ static void internal_stringfrag_insert_char(EngineState *s, reg_t *buffer, int p
}
void stringfrag_insert_char(EngineState *s, reg_t pos, int p, unsigned char c) {
- reg_t *buffer = kernelDerefRegPtr(s->segmentManager, pos, 1);
+ reg_t *buffer = kernelDerefRegPtr(s->segMan, pos, 1);
internal_stringfrag_insert_char(s, buffer, p, c);
}
@@ -343,7 +343,7 @@ static void internal_stringfrag_delete_char(EngineState *s, reg_t *buffer, int p
}
void stringfrag_delete_char(EngineState *s, reg_t pos, int p) {
- reg_t *buffer = kernelDerefRegPtr(s->segmentManager, pos, 1);
+ reg_t *buffer = kernelDerefRegPtr(s->segMan, pos, 1);
internal_stringfrag_delete_char(s, buffer, p);
}
@@ -360,8 +360,8 @@ void internal_stringfrag_strcpy(EngineState *s, reg_t *dest, reg_t *src) {
}
void stringfrag_strcpy(EngineState *s, reg_t dest, reg_t src) {
- reg_t *destbuf = kernelDerefRegPtr(s->segmentManager, dest, 1);
- reg_t *srcbuf = kernelDerefRegPtr(s->segmentManager, src, 1);
+ reg_t *destbuf = kernelDerefRegPtr(s->segMan, dest, 1);
+ reg_t *srcbuf = kernelDerefRegPtr(s->segMan, src, 1);
internal_stringfrag_strcpy(s, destbuf, srcbuf);
}
@@ -388,8 +388,8 @@ void internal_stringfrag_strncpy(EngineState *s, reg_t *dest, reg_t *src, int le
}
void stringfrag_strncpy(EngineState *s, reg_t dest, reg_t src, int len) {
- reg_t *destbuf = kernelDerefRegPtr(s->segmentManager, dest, 1);
- reg_t *srcbuf = kernelDerefRegPtr(s->segmentManager, src, 1);
+ reg_t *destbuf = kernelDerefRegPtr(s->segMan, dest, 1);
+ reg_t *srcbuf = kernelDerefRegPtr(s->segMan, src, 1);
internal_stringfrag_strncpy(s, destbuf, srcbuf, len);
}
@@ -416,8 +416,8 @@ int internal_stringfrag_strcmp(EngineState *s, reg_t *s1, reg_t *s2) {
}
void stringfrag_strcmp(EngineState *s, reg_t s1, reg_t s2) {
- reg_t *s1buf = kernelDerefRegPtr(s->segmentManager, s1, 1);
- reg_t *s2buf = kernelDerefRegPtr(s->segmentManager, s2, 1);
+ reg_t *s1buf = kernelDerefRegPtr(s->segMan, s1, 1);
+ reg_t *s2buf = kernelDerefRegPtr(s->segMan, s2, 1);
internal_stringfrag_strcmp(s, s1buf, s2buf);
}
@@ -449,8 +449,8 @@ int internal_stringfrag_strncmp(EngineState *s, reg_t *s1, reg_t *s2, int len) {
}
void stringfrag_strncmp(EngineState *s, reg_t s1, reg_t s2, int len) {
- reg_t *s1buf = kernelDerefRegPtr(s->segmentManager, s1, 1);
- reg_t *s2buf = kernelDerefRegPtr(s->segmentManager, s2, 1);
+ reg_t *s1buf = kernelDerefRegPtr(s->segMan, s1, 1);
+ reg_t *s2buf = kernelDerefRegPtr(s->segMan, s2, 1);
internal_stringfrag_strncmp(s, s1buf, s2buf, len);
}
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 05b9c96c08..e331ec8b91 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -204,15 +204,15 @@ static void validate_write_var(reg_t *r, reg_t *stack_base, int type, int max, i
#define GET_OP_SIGNED_FLEX() ((opcode & 1)? GET_OP_SIGNED_BYTE() : GET_OP_SIGNED_WORD())
ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackPtr sp, reg_t calling_obj, uint16 argc, StackPtr argp) {
- int seg = s->segmentManager->segGet(script);
- Script *scr = s->segmentManager->getScriptIfLoaded(seg);
+ int seg = s->segMan->segGet(script);
+ Script *scr = s->segMan->getScriptIfLoaded(seg);
if (!scr) // Script not present yet?
- seg = script_instantiate(s->resourceManager, s->segmentManager, script);
+ seg = script_instantiate(s->resMan, s->segMan, script);
else
scr->unmarkDeleted();
- int temp = s->segmentManager->validateExportFunc(pubfunct, seg);
+ int temp = s->segMan->validateExportFunc(pubfunct, seg);
if (!temp) {
error("Request for invalid exported function 0x%x of script 0x%x", pubfunct, script);
return NULL;
@@ -248,10 +248,10 @@ static void _exec_varselectors(EngineState *s) {
ExecStack &xs = s->_executionStack.back();
// varselector access?
if (xs.argc) { // write?
- *(xs.getVarPointer(s->segmentManager)) = xs.variables_argp[1];
+ *(xs.getVarPointer(s->segMan)) = xs.variables_argp[1];
} else // No, read
- s->r_acc = *(xs.getVarPointer(s->segmentManager));
+ s->r_acc = *(xs.getVarPointer(s->segMan));
s->_executionStack.pop_back();
}
@@ -285,7 +285,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
Breakpoint *bp;
char method_name [256];
- sprintf(method_name, "%s::%s", obj_get_name(s->segmentManager, send_obj), ((SciEngine*)g_engine)->getKernel()->getSelectorName(selector).c_str());
+ sprintf(method_name, "%s::%s", obj_get_name(s->segMan, send_obj), ((SciEngine*)g_engine)->getKernel()->getSelectorName(selector).c_str());
bp = s->bp_list;
while (bp) {
@@ -310,7 +310,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
#endif // VM_DEBUG_SEND
ObjVarRef varp;
- switch (lookup_selector(s->segmentManager, send_obj, selector, &varp, &funcp)) {
+ switch (lookup_selector(s->segMan, send_obj, selector, &varp, &funcp)) {
case kSelectorNone:
error("Send to invalid selector 0x%x of object at %04x:%04x", 0xffff & selector, PRINT_REG(send_obj));
@@ -338,7 +338,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
#endif
{ // Argument is supplied -> Selector should be set
if (print_send_action) {
- reg_t oldReg = *varp.getPointer(s->segmentManager);
+ reg_t oldReg = *varp.getPointer(s->segMan);
reg_t newReg = argp[1];
printf("[write to selector: change %04x:%04x to %04x:%04x]\n", PRINT_REG(oldReg), PRINT_REG(newReg));
@@ -467,7 +467,7 @@ void vm_handle_fatal_error(EngineState *s, int line, const char *file) {
}
static reg_t pointer_add(EngineState *s, reg_t base, int offset) {
- MemObject *mobj = GET_SEGMENT_ANY(*s->segmentManager, base.segment);
+ MemObject *mobj = GET_SEGMENT_ANY(*s->segMan, base.segment);
if (!mobj) {
error("[VM] Error: Attempt to add %d to invalid pointer %04x:%04x", offset, PRINT_REG(base));
@@ -520,8 +520,8 @@ void run_vm(EngineState *s, int restoring) {
// Current execution data:
scriptState.xs = &(s->_executionStack.back());
ExecStack *xs_new = NULL;
- Object *obj = obj_get(s->segmentManager, scriptState.xs->objp);
- Script *local_script = s->segmentManager->getScriptIfLoaded(scriptState.xs->local_segment);
+ Object *obj = obj_get(s->segMan, scriptState.xs->objp);
+ Script *local_script = s->segMan->getScriptIfLoaded(scriptState.xs->local_segment);
int old_execution_stack_base = s->execution_stack_base;
// Used to detect the stack bottom, for "physical" returns
const byte *code_buf = NULL; // (Avoid spurious warning)
@@ -567,7 +567,7 @@ void run_vm(EngineState *s, int restoring) {
scriptState.xs = &(s->_executionStack.back());
s->_executionStackPosChanged = false;
- scr = s->segmentManager->getScriptIfLoaded(scriptState.xs->addr.pc.segment);
+ scr = s->segMan->getScriptIfLoaded(scriptState.xs->addr.pc.segment);
if (!scr) {
// No script? Implicit return via fake instruction buffer
warning("Running on non-existant script in segment %x", scriptState.xs->addr.pc.segment);
@@ -580,12 +580,12 @@ void run_vm(EngineState *s, int restoring) {
scr = NULL;
obj = NULL;
} else {
- obj = obj_get(s->segmentManager, scriptState.xs->objp);
+ obj = obj_get(s->segMan, scriptState.xs->objp);
code_buf = scr->buf;
#ifndef DISABLE_VALIDATIONS
code_buf_size = scr->buf_size;
#endif
- local_script = s->segmentManager->getScriptIfLoaded(scriptState.xs->local_segment);
+ local_script = s->segMan->getScriptIfLoaded(scriptState.xs->local_segment);
if (!local_script) {
warning("Could not find local script from segment %x", scriptState.xs->local_segment);
local_script = NULL;
@@ -919,7 +919,7 @@ void run_vm(EngineState *s, int restoring) {
scriptState.xs->sp -= (opparams[1] >> 1) + 1;
{
- bool oldScriptHeader = (s->segmentManager->sciVersion() == SCI_VERSION_0_EARLY);
+ bool oldScriptHeader = (s->segMan->sciVersion() == SCI_VERSION_0_EARLY);
if (!oldScriptHeader) {
scriptState.xs->sp -= scriptState.restAdjust;
s->restAdjust = 0; // We just used up the scriptState.restAdjust, remember?
@@ -930,13 +930,13 @@ void run_vm(EngineState *s, int restoring) {
error("Invalid kernel function 0x%x requested", opparams[0]);
} else {
int argc = ASSERT_ARITHMETIC(scriptState.xs->sp[0]);
- bool oldScriptHeader = (s->segmentManager->sciVersion() == SCI_VERSION_0_EARLY);
+ bool oldScriptHeader = (s->segMan->sciVersion() == SCI_VERSION_0_EARLY);
if (!oldScriptHeader)
argc += scriptState.restAdjust;
if (((SciEngine*)g_engine)->getKernel()->_kernelFuncs[opparams[0]].signature
- && !kernel_matches_signature(s->segmentManager,
+ && !kernel_matches_signature(s->segMan,
((SciEngine*)g_engine)->getKernel()->_kernelFuncs[opparams[0]].signature, argc,
scriptState.xs->sp + 1)) {
error("[VM] Invalid arguments to kernel call %x", opparams[0]);
@@ -1003,9 +1003,9 @@ void run_vm(EngineState *s, int restoring) {
if (old_xs->type == EXEC_STACK_TYPE_VARSELECTOR) {
// varselector access?
if (old_xs->argc) // write?
- *(old_xs->getVarPointer(s->segmentManager)) = old_xs->variables_argp[1];
+ *(old_xs->getVarPointer(s->segMan)) = old_xs->variables_argp[1];
else // No, read
- s->r_acc = *(old_xs->getVarPointer(s->segmentManager));
+ s->r_acc = *(old_xs->getVarPointer(s->segMan));
}
// Not reached the base, so let's do a soft return
@@ -1042,7 +1042,7 @@ void run_vm(EngineState *s, int restoring) {
break;
case 0x28: // class
- s->r_acc = s->segmentManager->get_class_address((unsigned)opparams[0], SCRIPT_GET_LOCK,
+ s->r_acc = s->segMan->get_class_address((unsigned)opparams[0], SCRIPT_GET_LOCK,
scriptState.xs->addr.pc);
break;
@@ -1062,7 +1062,7 @@ void run_vm(EngineState *s, int restoring) {
break;
case 0x2b: // super
- r_temp = s->segmentManager->get_class_address(opparams[0], SCRIPT_GET_LOAD, scriptState.xs->addr.pc);
+ r_temp = s->segMan->get_class_address(opparams[0], SCRIPT_GET_LOAD, scriptState.xs->addr.pc);
if (!r_temp.segment)
error("[VM]: Invalid superclass in object");
@@ -1513,19 +1513,19 @@ reg_t script_lookup_export(SegManager *segManager, int script_nr, int export_ind
#define INST_LOOKUP_CLASS(id) ((id == 0xffff)? NULL_REG : segManager->get_class_address(id, SCRIPT_GET_LOCK, reg))
-int script_instantiate_common(ResourceManager *resourceManager, SegManager *segManager, int script_nr, Resource **script, Resource **heap, int *was_new) {
+int script_instantiate_common(ResourceManager *resMan, SegManager *segManager, int script_nr, Resource **script, Resource **heap, int *was_new) {
int seg_id;
reg_t reg;
*was_new = 1;
- *script = resourceManager->findResource(ResourceId(kResourceTypeScript, script_nr), 0);
- if (resourceManager->sciVersion() >= SCI_VERSION_1_1)
- *heap = resourceManager->findResource(ResourceId(kResourceTypeHeap, script_nr), 0);
+ *script = resMan->findResource(ResourceId(kResourceTypeScript, script_nr), 0);
+ if (resMan->sciVersion() >= SCI_VERSION_1_1)
+ *heap = resMan->findResource(ResourceId(kResourceTypeHeap, script_nr), 0);
- if (!*script || (resourceManager->sciVersion() >= SCI_VERSION_1_1 && !heap)) {
+ if (!*script || (resMan->sciVersion() >= SCI_VERSION_1_1 && !heap)) {
warning("Script 0x%x requested but not found", script_nr);
- if (resourceManager->sciVersion() >= SCI_VERSION_1_1) {
+ if (resMan->sciVersion() >= SCI_VERSION_1_1) {
if (*heap)
warning("Inconsistency: heap resource WAS found");
else if (*script)
@@ -1567,7 +1567,7 @@ int script_instantiate_common(ResourceManager *resourceManager, SegManager *segM
return seg_id;
}
-int script_instantiate_sci0(ResourceManager *resourceManager, SegManager *segManager, int script_nr) {
+int script_instantiate_sci0(ResourceManager *resMan, SegManager *segManager, int script_nr) {
int objtype;
unsigned int objlength;
reg_t reg;
@@ -1576,10 +1576,10 @@ int script_instantiate_sci0(ResourceManager *resourceManager, SegManager *segMan
int magic_pos_adder; // Usually 0; 2 for older SCI versions
Resource *script;
int was_new;
- SciVersion version = resourceManager->sciVersion();
+ SciVersion version = resMan->sciVersion();
bool oldScriptHeader = (version == SCI_VERSION_0_EARLY);
- seg_id = script_instantiate_common(resourceManager, segManager, script_nr, &script, NULL, &was_new);
+ seg_id = script_instantiate_common(resMan, segManager, script_nr, &script, NULL, &was_new);
if (was_new)
return seg_id;
@@ -1731,14 +1731,14 @@ int script_instantiate_sci0(ResourceManager *resourceManager, SegManager *segMan
return reg.segment; // instantiation successful
}
-int script_instantiate_sci11(ResourceManager *resourceManager, SegManager *segManager, int script_nr) {
+int script_instantiate_sci11(ResourceManager *resMan, SegManager *segManager, int script_nr) {
Resource *script, *heap;
int seg_id;
int heap_start;
reg_t reg;
int was_new;
- seg_id = script_instantiate_common(resourceManager, segManager, script_nr, &script, &heap, &was_new);
+ seg_id = script_instantiate_common(resMan, segManager, script_nr, &script, &heap, &was_new);
if (was_new)
return seg_id;
@@ -1768,11 +1768,11 @@ int script_instantiate_sci11(ResourceManager *resourceManager, SegManager *segMa
return seg_id;
}
-int script_instantiate(ResourceManager *resourceManager, SegManager *segManager, int script_nr) {
- if (resourceManager->sciVersion() >= SCI_VERSION_1_1)
- return script_instantiate_sci11(resourceManager, segManager, script_nr);
+int script_instantiate(ResourceManager *resMan, SegManager *segManager, int script_nr) {
+ if (resMan->sciVersion() >= SCI_VERSION_1_1)
+ return script_instantiate_sci11(resMan, segManager, script_nr);
else
- return script_instantiate_sci0(resourceManager, segManager, script_nr);
+ return script_instantiate_sci0(resMan, segManager, script_nr);
}
void script_uninstantiate_sci0(SegManager *segManager, int script_nr, SegmentId seg) {
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 212b855b71..a459d7e083 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -479,12 +479,12 @@ reg_t script_lookup_export(SegManager *segManager, int script_nr, int export_ind
* increased. All scripts containing superclasses of this script are loaded
* recursively as well, unless 'recursive' is set to zero. The
* complementary function is "script_uninstantiate()" below.
- * @param[in] resourceManager The resource manager
+ * @param[in] resMan The resource manager
* @param[in] segManager The segment manager
* @param[in] script_nr The script number to load
* @return The script's segment ID or 0 if out of heap
*/
-int script_instantiate(ResourceManager *resourceManager, SegManager *segManager, int script_nr);
+int script_instantiate(ResourceManager *resMan, SegManager *segManager, int script_nr);
/**
* Decreases the numer of lockers of a script and unloads it if that number
diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp
index b6e13e2bd0..0307fec026 100644
--- a/engines/sci/gfx/gfx_resmgr.cpp
+++ b/engines/sci/gfx/gfx_resmgr.cpp
@@ -50,18 +50,18 @@ struct param_struct {
};
GfxResManager::GfxResManager(gfx_options_t *options, GfxDriver *driver, ResourceManager *resManager) :
- _options(options), _driver(driver), _resourceManager(resManager),
+ _options(options), _driver(driver), _resMan(resManager),
_lockCounter(0), _tagLockCounter(0), _staticPalette(0) {
gfxr_init_static_palette();
_portBounds = Common::Rect(0, 10, 320, 200); // default value, with a titlebar of 10px
- if (!_resourceManager->isVGA()) {
+ if (!_resMan->isVGA()) {
_staticPalette = gfx_sci0_pic_colors->getref();
- } else if (_resourceManager->sciVersion() == SCI_VERSION_1_1) {
+ } else if (_resMan->sciVersion() == SCI_VERSION_1_1) {
debugC(2, kDebugLevelGraphics, "Palettes are not yet supported in this SCI version\n");
#ifdef ENABLE_SCI32
- } else if (_resourceManager->sciVersion() >= SCI_VERSION_2) {
+ } else if (_resMan->sciVersion() >= SCI_VERSION_2) {
debugC(2, kDebugLevelGraphics, "Palettes are not yet supported in this SCI version\n");
#endif
} else {
@@ -77,7 +77,7 @@ GfxResManager::~GfxResManager() {
}
int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic, int flags, int default_palette, int nr) {
- Resource *res = _resourceManager->findResource(ResourceId(kResourceTypePic, nr), 0);
+ Resource *res = _resMan->findResource(ResourceId(kResourceTypePic, nr), 0);
int need_unscaled = unscaled_pic != NULL;
gfxr_pic0_params_t style, basic_style;
@@ -96,21 +96,21 @@ int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic
return GFX_ERROR;
if (need_unscaled) {
- if (_resourceManager->sciVersion() == SCI_VERSION_1_1)
+ if (_resMan->sciVersion() == SCI_VERSION_1_1)
gfxr_draw_pic11(unscaled_pic, flags, default_palette, res->size, res->data, &basic_style, res->id.number, _staticPalette, _portBounds);
else
- gfxr_draw_pic01(unscaled_pic, flags, default_palette, res->size, res->data, &basic_style, res->id.number, _resourceManager->getViewType(), _staticPalette, _portBounds);
+ gfxr_draw_pic01(unscaled_pic, flags, default_palette, res->size, res->data, &basic_style, res->id.number, _resMan->getViewType(), _staticPalette, _portBounds);
}
if (scaled_pic && scaled_pic->undithered_buffer)
memcpy(scaled_pic->visual_map->index_data, scaled_pic->undithered_buffer, scaled_pic->undithered_buffer_size);
- if (_resourceManager->sciVersion() == SCI_VERSION_1_1)
+ if (_resMan->sciVersion() == SCI_VERSION_1_1)
gfxr_draw_pic11(scaled_pic, flags, default_palette, res->size, res->data, &style, res->id.number, _staticPalette, _portBounds);
else
- gfxr_draw_pic01(scaled_pic, flags, default_palette, res->size, res->data, &style, res->id.number, _resourceManager->getViewType(), _staticPalette, _portBounds);
+ gfxr_draw_pic01(scaled_pic, flags, default_palette, res->size, res->data, &style, res->id.number, _resMan->getViewType(), _staticPalette, _portBounds);
- if (_resourceManager->sciVersion() <= SCI_VERSION_1_EGA) {
+ if (_resMan->sciVersion() <= SCI_VERSION_1_EGA) {
if (need_unscaled)
gfxr_remove_artifacts_pic0(scaled_pic, unscaled_pic);
@@ -146,7 +146,7 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) {
case GFX_RESOURCE_TYPE_PIC:
#ifdef CUSTOM_GRAPHICS_OPTIONS
- if (_resourceManager->isVGA())
+ if (_resMan->isVGA())
// NOTE: here, it is assumed that the upper port bound is always 10, but this doesn't seem to matter for the
// generated options hash anyway
return 10;
@@ -159,7 +159,7 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) {
(_options->pic0_brush_mode << 4) |
(_options->pic0_line_mode);
#else
- if (_resourceManager->isVGA())
+ if (_resMan->isVGA())
return 10;
else
#if 0
@@ -352,12 +352,12 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale
#ifdef CUSTOM_GRAPHICS_OPTIONS
if (_options->pic0_unscaled) {
need_unscaled = 0;
- pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resourceManager->isVGA());
+ pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resMan->isVGA());
} else
- pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resourceManager->isVGA());
+ pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resMan->isVGA());
#else
need_unscaled = 0;
- pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resourceManager->isVGA());
+ pic = gfxr_init_pic(_driver->getMode(), GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resMan->isVGA());
#endif
if (!pic) {
@@ -368,7 +368,7 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale
gfxr_clear_pic0(pic, SCI_TITLEBAR_SIZE);
if (need_unscaled) {
- unscaled_pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resourceManager->isVGA());
+ unscaled_pic = gfxr_init_pic(&mode_1x1_color_index, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num), _resMan->isVGA());
if (!unscaled_pic) {
error("Failed to allocate unscaled pic");
return NULL;
@@ -536,15 +536,15 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) {
res = resMap.contains(nr) ? resMap[nr] : NULL;
if (!res || res->mode != hash) {
- Resource *viewRes = _resourceManager->findResource(ResourceId(kResourceTypeView, nr), 0);
+ Resource *viewRes = _resMan->findResource(ResourceId(kResourceTypeView, nr), 0);
if (!viewRes || !viewRes->data)
return NULL;
int resid = GFXR_RES_ID(GFX_RESOURCE_TYPE_VIEW, nr);
- ViewType viewType = _resourceManager->getViewType();
+ ViewType viewType = _resMan->getViewType();
if (viewType == kViewEga) {
- int pal = (_resourceManager->sciVersion() <= SCI_VERSION_01) ? -1 : palette;
+ int pal = (_resMan->sciVersion() <= SCI_VERSION_01) ? -1 : palette;
view = getEGAView(resid, viewRes->data, viewRes->size, pal);
} else {
view = getVGAView(resid, viewRes->data, viewRes->size, viewType);
@@ -629,13 +629,13 @@ gfx_bitmap_font_t *GfxResManager::getFont(int num, bool scaled) {
// Workaround: lsl1sci mixes its own internal fonts with the global
// SCI ones, so we translate them here, by removing their extra bits
- if (!resMap.contains(num) && !_resourceManager->testResource(ResourceId(kResourceTypeFont, num)))
+ if (!resMap.contains(num) && !_resMan->testResource(ResourceId(kResourceTypeFont, num)))
num = num & 0x7ff;
res = resMap.contains(num) ? resMap[num] : NULL;
if (!res || res->mode != hash) {
- Resource *fontRes = _resourceManager->findResource(ResourceId(kResourceTypeFont, num), 0);
+ Resource *fontRes = _resMan->findResource(ResourceId(kResourceTypeFont, num), 0);
if (!fontRes || !fontRes->data)
return NULL;
@@ -672,17 +672,17 @@ gfx_pixmap_t *GfxResManager::getCursor(int num) {
res = resMap.contains(num) ? resMap[num] : NULL;
if (!res || res->mode != hash) {
- Resource *cursorRes = _resourceManager->findResource(ResourceId(kResourceTypeCursor, num), 0);
+ Resource *cursorRes = _resMan->findResource(ResourceId(kResourceTypeCursor, num), 0);
if (!cursorRes || !cursorRes->data)
return NULL;
- if (_resourceManager->sciVersion() >= SCI_VERSION_1_1) {
+ if (_resMan->sciVersion() >= SCI_VERSION_1_1) {
warning("[GFX] Attempt to retrieve cursor in SCI1.1 or later");
return NULL;
}
gfx_pixmap_t *cursor = gfxr_draw_cursor(GFXR_RES_ID(GFX_RESOURCE_TYPE_CURSOR, num),
- cursorRes->data, cursorRes->size, _resourceManager->sciVersion() > SCI_VERSION_01);
+ cursorRes->data, cursorRes->size, _resMan->sciVersion() > SCI_VERSION_01);
if (!cursor)
return NULL;
diff --git a/engines/sci/gfx/gfx_resmgr.h b/engines/sci/gfx/gfx_resmgr.h
index af34a42360..3b19fd4eed 100644
--- a/engines/sci/gfx/gfx_resmgr.h
+++ b/engines/sci/gfx/gfx_resmgr.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef SCI_GFX_GFX_resourceManager_H
-#define SCI_GFX_GFX_resourceManager_H
+#ifndef SCI_GFX_GFX_resMan_H
+#define SCI_GFX_GFX_resMan_H
// FIXME/TODO: The name "(Graphics) resource manager", and the associated
// filenames, are misleading. This should be renamed to "Graphics manager"
@@ -315,7 +315,7 @@ private:
Common::Rect _portBounds;
IntResMap _resourceMaps[GFX_RESOURCE_TYPES_NR];
- ResourceManager *_resourceManager;
+ ResourceManager *_resMan;
};
} // End of namespace Sci
diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp
index 058fe648d4..ab0b7d1375 100644
--- a/engines/sci/gfx/menubar.cpp
+++ b/engines/sci/gfx/menubar.cpp
@@ -294,7 +294,7 @@ int Menubar::setAttribute(EngineState *s, int menu_nr, int item_nr, int attribut
case MENU_ATTRIBUTE_SAID:
if (value.segment) {
item->_saidPos = value;
- memcpy(item->_said, kernelDerefBulkPtr(s->segmentManager, value, 0), MENU_SAID_SPEC_SIZE); // Copy Said spec
+ memcpy(item->_said, kernelDerefBulkPtr(s->segMan, value, 0), MENU_SAID_SPEC_SIZE); // Copy Said spec
item->_flags |= MENU_ATTRIBUTE_FLAGS_SAID;
} else
@@ -304,7 +304,7 @@ int Menubar::setAttribute(EngineState *s, int menu_nr, int item_nr, int attribut
case MENU_ATTRIBUTE_TEXT:
assert(value.segment);
- item->_text = kernelDerefString(s->segmentManager, value);
+ item->_text = kernelDerefString(s->segMan, value);
item->_textPos = value;
break;
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 332bfef161..e9f83fd29b 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -40,7 +40,7 @@ namespace Sci {
#undef SCI_REQUIRE_RESOURCE_FILES
-//#define SCI_VERBOSE_resourceManager 1
+//#define SCI_VERBOSE_resMan 1
static const char *sci_error_types[] = {
"No error",
@@ -103,7 +103,7 @@ void Resource::unalloc() {
status = kResStatusNoMalloc;
}
-//-- resourceManager helper functions --
+//-- resMan helper functions --
// Resource source list management
@@ -510,8 +510,8 @@ void ResourceManager::init() {
_mapVersion = _volVersion;
}
- debug("resourceManager: Detected resource map version %d: %s", _mapVersion, versionDescription(_mapVersion));
- debug("resourceManager: Detected volume version %d: %s", _volVersion, versionDescription(_volVersion));
+ debug("resMan: Detected resource map version %d: %s", _mapVersion, versionDescription(_mapVersion));
+ debug("resMan: Detected volume version %d: %s", _volVersion, versionDescription(_volVersion));
scanNewSources();
addInternalSources();
@@ -520,25 +520,25 @@ void ResourceManager::init() {
_sciVersion = detectSciVersion();
if (_sciVersion != SCI_VERSION_AUTODETECT)
- debug("resourceManager: Detected %s", ((SciEngine *)g_engine)->getSciVersionDesc(_sciVersion).c_str());
+ debug("resMan: Detected %s", ((SciEngine *)g_engine)->getSciVersionDesc(_sciVersion).c_str());
else
- warning("resourceManager: Couldn't determine SCI version");
+ warning("resMan: Couldn't determine SCI version");
switch (_viewType) {
case kViewEga:
- debug("resourceManager: Detected EGA graphic resources");
+ debug("resMan: Detected EGA graphic resources");
break;
case kViewVga:
- debug("resourceManager: Detected VGA graphic resources");
+ debug("resMan: Detected VGA graphic resources");
break;
case kViewVga11:
- debug("resourceManager: Detected SCI1.1 VGA graphic resources");
+ debug("resMan: Detected SCI1.1 VGA graphic resources");
break;
case kViewAmiga:
- debug("resourceManager: Detected Amiga graphic resources");
+ debug("resMan: Detected Amiga graphic resources");
break;
default:
- warning("resourceManager: Couldn't determine view type");
+ warning("resMan: Couldn't determine view type");
}
}
@@ -561,7 +561,7 @@ ResourceManager::~ResourceManager() {
void ResourceManager::removeFromLRU(Resource *res) {
if (res->status != kResStatusEnqueued) {
- warning("resourceManager: trying to remove resource that isn't enqueued");
+ warning("resMan: trying to remove resource that isn't enqueued");
return;
}
_LRU.remove(res);
@@ -571,12 +571,12 @@ void ResourceManager::removeFromLRU(Resource *res) {
void ResourceManager::addToLRU(Resource *res) {
if (res->status != kResStatusAllocated) {
- warning("resourceManager: trying to enqueue resource with state %d", res->status);
+ warning("resMan: trying to enqueue resource with state %d", res->status);
return;
}
_LRU.push_front(res);
_memoryLRU += res->size;
-#if SCI_VERBOSE_resourceManager
+#if SCI_VERBOSE_resMan
debug("Adding %s.%03d (%d bytes) to lru control: %d bytes total",
getResourceTypeName(res->type), res->number, res->size,
mgr->_memoryLRU);
@@ -607,8 +607,8 @@ void ResourceManager::freeOldResources() {
Resource *goner = *_LRU.reverse_begin();
removeFromLRU(goner);
goner->unalloc();
-#ifdef SCI_VERBOSE_resourceManager
- printf("resourceManager-debug: LRU: Freeing %s.%03d (%d bytes)\n", getResourceTypeName(goner->type), goner->number, goner->size);
+#ifdef SCI_VERBOSE_resMan
+ printf("resMan-debug: LRU: Freeing %s.%03d (%d bytes)\n", getResourceTypeName(goner->type), goner->number, goner->size);
#endif
}
}
@@ -656,7 +656,7 @@ Resource *ResourceManager::findResource(ResourceId id, bool lock) {
if (retval->data)
return retval;
else {
- warning("resourceManager: Failed to read %s", retval->id.toString().c_str());
+ warning("resMan: Failed to read %s", retval->id.toString().c_str());
return NULL;
}
}
@@ -665,7 +665,7 @@ void ResourceManager::unlockResource(Resource *res) {
assert(res);
if (res->status != kResStatusLocked) {
- warning("[resourceManager] Attempt to unlock unlocked resource %s", res->id.toString().c_str());
+ warning("[resMan] Attempt to unlock unlocked resource %s", res->id.toString().c_str());
return;
}
@@ -1579,7 +1579,7 @@ ViewType ResourceManager::detectViewType() {
}
}
- warning("resourceManager: Couldn't find any views");
+ warning("resMan: Couldn't find any views");
return kViewUnknown;
}
@@ -1685,7 +1685,7 @@ bool ResourceManager::hasOldScriptHeader() {
Resource *res = findResource(ResourceId(kResourceTypeScript, 0), 0);
if (!res) {
- warning("resourceManager: Failed to find script.000");
+ warning("resMan: Failed to find script.000");
return false;
}
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index c61f5509df..074c9d2568 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -93,7 +93,7 @@ SciEngine::~SciEngine() {
delete _kernel;
delete _vocabulary;
delete _console;
- delete _resourceManager;
+ delete _resMan;
}
Common::Error SciEngine::run() {
@@ -127,17 +127,17 @@ Common::Error SciEngine::run() {
const uint32 flags = getFlags();
- _resourceManager = new ResourceManager();
+ _resMan = new ResourceManager();
- if (!_resourceManager) {
+ if (!_resMan) {
printf("No resources found, aborting...\n");
return Common::kNoGameDataFoundError;
}
- _kernel = new Kernel(_resourceManager);
- _vocabulary = new Vocabulary(_resourceManager);
+ _kernel = new Kernel(_resMan);
+ _vocabulary = new Vocabulary(_resMan);
- _gamestate = new EngineState(_resourceManager, flags);
+ _gamestate = new EngineState(_resMan, flags);
if (script_init_engine(_gamestate))
return Common::kUnknownError;
@@ -190,7 +190,7 @@ Common::Error SciEngine::run() {
// Default config ends
#endif
- gfxop_init(_resourceManager->sciVersion(), &gfx_state, &gfx_options, _resourceManager, gfxmode, 1, 1);
+ gfxop_init(_resMan->sciVersion(), &gfx_state, &gfx_options, _resMan, gfxmode, 1, 1);
if (game_init_graphics(_gamestate)) { // Init interpreter graphics
warning("Game initialization failed: Error in GFX subsystem. Aborting...");
@@ -202,7 +202,7 @@ Common::Error SciEngine::run() {
return Common::kUnknownError;
}
- printf("Emulating SCI version %s\n", getSciVersionDesc(_resourceManager->sciVersion()).c_str());
+ printf("Emulating SCI version %s\n", getSciVersionDesc(_resMan->sciVersion()).c_str());
game_run(&_gamestate); // Run the game
@@ -241,7 +241,7 @@ const char* SciEngine::getGameID() const {
}
SciVersion SciEngine::getVersion() const {
- return _resourceManager->sciVersion();
+ return _resMan->sciVersion();
}
Common::Language SciEngine::getLanguage() const {
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 965be510e7..901136e750 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -112,7 +112,7 @@ public:
Common::Language getLanguage() const;
Common::Platform getPlatform() const;
uint32 getFlags() const;
- ResourceManager *getresourceManager() const { return _resourceManager; }
+ ResourceManager *getResourceManager() const { return _resMan; }
Kernel *getKernel() const { return _kernel; }
Vocabulary *getVocabulary() const { return _vocabulary; }
@@ -129,7 +129,7 @@ public:
private:
const SciGameDescription *_gameDescription;
- ResourceManager *_resourceManager;
+ ResourceManager *_resMan;
EngineState *_gamestate;
Kernel *_kernel;
Vocabulary *_vocabulary;
diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp
index bc5dd02878..38de9c3f93 100644
--- a/engines/sci/sfx/core.cpp
+++ b/engines/sci/sfx/core.cpp
@@ -87,12 +87,12 @@ public:
~SfxPlayer();
/* Initializes the player
- ** Parameters: (ResourceManager *) resourceManager: A resource manager for driver initialization
+ ** Parameters: (ResourceManager *) resMan: A resource manager for driver initialization
** (int) expected_latency: Expected delay in between calls to 'maintenance'
** (in microseconds)
** Returns : (int) Common::kNoError on success, Common::kUnknownError on failure
*/
- Common::Error init(ResourceManager *resourceManager, int expected_latency);
+ Common::Error init(ResourceManager *resMan, int expected_latency);
/* Adds an iterator to the song player
** Parameters: (songx_iterator_t *) it: The iterator to play
@@ -223,7 +223,7 @@ void SfxPlayer::player_timer_callback(void *refCon) {
/* API implementation */
-Common::Error SfxPlayer::init(ResourceManager *resourceManager, int expected_latency) {
+Common::Error SfxPlayer::init(ResourceManager *resMan, int expected_latency) {
MidiDriverType musicDriver = MidiDriver::detectMusicDriver(MDT_PCSPK | MDT_ADLIB);
switch(musicDriver) {
@@ -252,7 +252,7 @@ Common::Error SfxPlayer::init(ResourceManager *resourceManager, int expected_lat
_mutex = new Common::Mutex();
_mididrv->setTimerCallback(this, player_timer_callback);
- _mididrv->open(resourceManager);
+ _mididrv->open(resMan);
_mididrv->setVolume(_volume);
return Common::kNoError;
@@ -354,7 +354,7 @@ SfxState::SfxState() {
SfxState::~SfxState() {
if (_syncResource)
- _resourceManager->unlockResource(_syncResource);
+ _resMan->unlockResource(_syncResource);
}
@@ -639,7 +639,7 @@ static int sfx_play_iterator_pcm(SongIterator *it, SongHandle handle) {
#define DELAY (1000000 / SFX_TICKS_PER_SEC)
-void SfxState::sfx_init(ResourceManager *resourceManager, int flags) {
+void SfxState::sfx_init(ResourceManager *resMan, int flags) {
_songlib._lib = 0;
_song = NULL;
_flags = flags;
@@ -661,7 +661,7 @@ void SfxState::sfx_init(ResourceManager *resourceManager, int flags) {
/* Initialise player */
/*-------------------*/
- if (!resourceManager) {
+ if (!resMan) {
warning("[SFX] Warning: No resource manager present, cannot initialise player");
return;
}
@@ -673,13 +673,13 @@ void SfxState::sfx_init(ResourceManager *resourceManager, int flags) {
return;
}
- if (player->init(resourceManager, DELAY / 1000)) {
+ if (player->init(resMan, DELAY / 1000)) {
warning("[SFX] Song player reported error, disabled");
delete player;
player = NULL;
}
- _resourceManager = resourceManager;
+ _resMan = resMan;
}
void SfxState::sfx_exit() {
@@ -1137,13 +1137,13 @@ Audio::AudioStream* SfxState::getAudioStream(uint32 number, uint32 volume, int *
Sci::Resource* audioRes;
if (volume == 65535) {
- audioRes = _resourceManager->findResource(ResourceId(kResourceTypeAudio, number), false);
+ audioRes = _resMan->findResource(ResourceId(kResourceTypeAudio, number), false);
if (!audioRes) {
warning("Failed to find audio entry %i", number);
return NULL;
}
} else {
- audioRes = _resourceManager->findResource(ResourceId(kResourceTypeAudio36, volume, number), false);
+ audioRes = _resMan->findResource(ResourceId(kResourceTypeAudio36, volume, number), false);
if (!audioRes) {
warning("Failed to find audio entry (%i, %i, %i, %i, %i)", volume, (number >> 24) & 0xff,
(number >> 16) & 0xff, (number >> 8) & 0xff, number & 0xff);
diff --git a/engines/sci/sfx/core.h b/engines/sci/sfx/core.h
index fc480aa452..3cf958f073 100644
--- a/engines/sci/sfx/core.h
+++ b/engines/sci/sfx/core.h
@@ -52,7 +52,7 @@ public: // FIXME, make private
bool _suspended; /**< Whether we are suspended */
Resource *_syncResource; /**< Used by kDoSync for speech syncing in CD talkie games */
uint _syncOffset;
- ResourceManager *_resourceManager;
+ ResourceManager *_resMan;
public:
SfxState();
@@ -63,10 +63,10 @@ public:
/***********/
/* Initializes the sound engine
- ** Parameters: (ResourceManager *) resourceManager: Resource manager for initialization
+ ** Parameters: (ResourceManager *) resMan: Resource manager for initialization
** (int) flags: SFX_STATE_FLAG_*
*/
- void sfx_init(ResourceManager *resourceManager, int flags);
+ void sfx_init(ResourceManager *resMan, int flags);
/** Deinitializes the sound subsystem. */
void sfx_exit();
diff --git a/engines/sci/sfx/sci_midi.h b/engines/sci/sfx/sci_midi.h
index 7cff14bdb0..9facca27b8 100644
--- a/engines/sci/sfx/sci_midi.h
+++ b/engines/sci/sfx/sci_midi.h
@@ -67,7 +67,7 @@ protected:
MidiDriver *_driver;
public:
int open() { return open(NULL); }
- virtual int open(ResourceManager *resourceManager) { return _driver->open(); }
+ virtual int open(ResourceManager *resMan) { return _driver->open(); }
virtual void close() { _driver->close(); }
virtual void send(uint32 b) { _driver->send(b); }
uint32 getBaseTempo() { return _driver->getBaseTempo(); }
diff --git a/engines/sci/sfx/softseq/adlib.cpp b/engines/sci/sfx/softseq/adlib.cpp
index ba5d364cc5..c838fca00a 100644
--- a/engines/sci/sfx/softseq/adlib.cpp
+++ b/engines/sci/sfx/softseq/adlib.cpp
@@ -623,11 +623,11 @@ void MidiDriver_Adlib::loadResource(Resource *res) {
}
}
-int MidiPlayer_Adlib::open(ResourceManager *resourceManager) {
- assert(resourceManager != NULL);
+int MidiPlayer_Adlib::open(ResourceManager *resMan) {
+ assert(resMan != NULL);
// Load up the patch.003 file, parse out the instruments
- Resource *res = resourceManager->findResource(ResourceId(kResourceTypePatch, 3), 0);
+ Resource *res = resMan->findResource(ResourceId(kResourceTypePatch, 3), 0);
if (!res) {
warning("ADLIB: Failed to load patch.003");
@@ -641,7 +641,7 @@ int MidiPlayer_Adlib::open(ResourceManager *resourceManager) {
static_cast<MidiDriver_Adlib *>(_driver)->loadResource(res);
- return static_cast<MidiDriver_Adlib *>(_driver)->open(resourceManager->sciVersion() <= SCI_VERSION_0_LATE);
+ return static_cast<MidiDriver_Adlib *>(_driver)->open(resMan->sciVersion() <= SCI_VERSION_0_LATE);
}
} // End of namespace Sci
diff --git a/engines/sci/sfx/softseq/adlib.h b/engines/sci/sfx/softseq/adlib.h
index bf72c2e15a..3432816058 100644
--- a/engines/sci/sfx/softseq/adlib.h
+++ b/engines/sci/sfx/softseq/adlib.h
@@ -146,7 +146,7 @@ private:
class MidiPlayer_Adlib : public MidiPlayer {
public:
MidiPlayer_Adlib() { _driver = new MidiDriver_Adlib(g_system->getMixer()); }
- int open(ResourceManager *resourceManager);
+ int open(ResourceManager *resMan);
int getPlayMask() const { return 0x04; }
int getPolyphony() const { return MidiDriver_Adlib::kVoices; }
bool hasRhythmChannel() const { return false; }
diff --git a/engines/sci/sfx/softseq/pcjr.h b/engines/sci/sfx/softseq/pcjr.h
index 9a88812c94..d7d3469db9 100644
--- a/engines/sci/sfx/softseq/pcjr.h
+++ b/engines/sci/sfx/softseq/pcjr.h
@@ -67,7 +67,7 @@ private:
class MidiPlayer_PCJr : public MidiPlayer {
public:
MidiPlayer_PCJr() { _driver = new MidiDriver_PCJr(g_system->getMixer()); }
- int open(ResourceManager *resourceManager) { return static_cast<MidiDriver_PCJr *>(_driver)->open(getPolyphony()); }
+ int open(ResourceManager *resMan) { return static_cast<MidiDriver_PCJr *>(_driver)->open(getPolyphony()); }
int getPlayMask() const { return 0x10; }
int getPolyphony() const { return 3; }
bool hasRhythmChannel() const { return false; }
diff --git a/engines/sci/vocabulary.cpp b/engines/sci/vocabulary.cpp
index 1f69d6fb5d..4f518a2768 100644
--- a/engines/sci/vocabulary.cpp
+++ b/engines/sci/vocabulary.cpp
@@ -58,12 +58,12 @@ const char *class_names[] = {"",
""
};
-int *vocab_get_classes(ResourceManager *resourceManager, int* count) {
+int *vocab_get_classes(ResourceManager *resMan, int* count) {
Resource* r;
int *c;
unsigned int i;
- if ((r = resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_CLASSES), 0)) == NULL)
+ if ((r = resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_CLASSES), 0)) == NULL)
return 0;
c = (int *)malloc(sizeof(int) * r->size / 2);
@@ -75,10 +75,10 @@ int *vocab_get_classes(ResourceManager *resourceManager, int* count) {
return c;
}
-int vocab_get_class_count(ResourceManager *resourceManager) {
+int vocab_get_class_count(ResourceManager *resMan) {
Resource* r;
- if ((r = resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_CLASSES), 0)) == 0)
+ if ((r = resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_CLASSES), 0)) == 0)
return 0;
return r->size / 4;
@@ -86,13 +86,13 @@ int vocab_get_class_count(ResourceManager *resourceManager) {
#endif
-Vocabulary::Vocabulary(ResourceManager *resourceManager) : _resourceManager(resourceManager) {
+Vocabulary::Vocabulary(ResourceManager *resMan) : _resMan(resMan) {
_parserRules = NULL;
_vocabVersion = kVocabularySCI0;
debug(2, "Initializing vocabulary");
- if (_resourceManager->sciVersion() <= SCI_VERSION_1_EGA && loadParserWords()) {
+ if (_resMan->sciVersion() <= SCI_VERSION_1_EGA && loadParserWords()) {
loadSuffixes();
if (loadBranches())
// Now build a GNF grammar out of this
@@ -116,11 +116,11 @@ bool Vocabulary::loadParserWords() {
int currentwordpos = 0;
// First try to load the SCI0 vocab resource.
- Resource *resource = _resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB), 0);
+ Resource *resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_MAIN_VOCAB), 0);
if (!resource) {
warning("SCI0: Could not find a main vocabulary, trying SCI01");
- resource = _resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_MAIN_VOCAB), 0);
+ resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_MAIN_VOCAB), 0);
_vocabVersion = kVocabularySCI1;
}
@@ -199,9 +199,9 @@ bool Vocabulary::loadSuffixes() {
Resource* resource = NULL;
if (_vocabVersion == kVocabularySCI0)
- resource = _resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB), 1);
+ resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB), 1);
else
- resource = _resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB), 1);
+ resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB), 1);
if (!resource)
return false; // No vocabulary found
@@ -238,12 +238,12 @@ void Vocabulary::freeSuffixes() {
Resource* resource = NULL;
if (_vocabVersion == kVocabularySCI0)
- resource = _resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB), 0);
+ resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_SUFFIX_VOCAB), 0);
else
- resource = _resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB), 0);
+ resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_SUFFIX_VOCAB), 0);
if (resource)
- _resourceManager->unlockResource(resource);
+ _resMan->unlockResource(resource);
_parserSuffixes.clear();
}
@@ -252,9 +252,9 @@ bool Vocabulary::loadBranches() {
Resource *resource = NULL;
if (_vocabVersion == kVocabularySCI0)
- resource = _resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_PARSE_TREE_BRANCHES), 0);
+ resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI0_PARSE_TREE_BRANCHES), 0);
else
- resource = _resourceManager->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_PARSE_TREE_BRANCHES), 0);
+ resource = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SCI1_PARSE_TREE_BRANCHES), 0);
_parserBranches.clear();
diff --git a/engines/sci/vocabulary.h b/engines/sci/vocabulary.h
index d9d5989ee7..511c8d8223 100644
--- a/engines/sci/vocabulary.h
+++ b/engines/sci/vocabulary.h
@@ -176,7 +176,7 @@ enum VocabularyVersions {
class Vocabulary {
public:
- Vocabulary(ResourceManager *resourceManager);
+ Vocabulary(ResourceManager *resMan);
~Vocabulary();
/**
@@ -282,7 +282,7 @@ private:
*/
void freeRuleList(parse_rule_list_t *rule_list);
- ResourceManager *_resourceManager;
+ ResourceManager *_resMan;
VocabularyVersions _vocabVersion;
// Parser-related lists