aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-12-23 17:21:09 +0000
committerMax Horn2002-12-23 17:21:09 +0000
commitb8240b253c8ede87d4148b26fafe5474c638c871 (patch)
tree9207d74f2217522f4686630f27441823d3dd6830
parenta7d0957dad42b094eab11335009391a1eb583a46 (diff)
downloadscummvm-rg350-b8240b253c8ede87d4148b26fafe5474c638c871.tar.gz
scummvm-rg350-b8240b253c8ede87d4148b26fafe5474c638c871.tar.bz2
scummvm-rg350-b8240b253c8ede87d4148b26fafe5474c638c871.zip
some flesh to the V8 bones
svn-id: r6073
-rw-r--r--scumm/intern.h2
-rw-r--r--scumm/resource.cpp2
-rw-r--r--scumm/script_v8.cpp89
3 files changed, 88 insertions, 5 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index 55ce15583f..a5a6847c5c 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -410,7 +410,7 @@ protected:
void o8_dim();
void o8_dim2();
- void o8_arrayAssign();
+ void o8_arrayOps();
void o8_printLine();
void o8_printCursor();
void o8_printDebug();
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index e762c8201d..f476882601 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -1656,8 +1656,6 @@ void Scumm::allocateArrays()
}
-
-
bool Scumm::isGlobInMemory(int type, int idx)
{
if (!validateResource("isGlobInMemory", type, idx))
diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp
index c4a2b4354c..0ad81344a9 100644
--- a/scumm/script_v8.cpp
+++ b/scumm/script_v8.cpp
@@ -183,7 +183,7 @@ void Scumm_v8::setupOpcodes()
/* 74 */
OPCODE(o8_dim2),
OPCODE(o6_wordArrayIndexedWrite),
- OPCODE(o8_arrayAssign),
+ OPCODE(o8_arrayOps),
OPCODE(o8_unknown),
/* 78 */
OPCODE(o8_unknown),
@@ -424,14 +424,60 @@ void Scumm_v8::o8_wait()
void Scumm_v8::o8_dim()
{
+ byte subOp = fetchScriptByte();
+ int array = fetchScriptWord();
+
+ switch (subOp) {
+ case 0x0A: // SO_ARRAY_SCUMMVAR
+ defineArray(array, 5, 0, pop());
+ break;
+ case 0x0B: // SO_ARRAY_STRING
+ defineArray(array, 4, 0, pop());
+ break;
+ case 0x0C: // SO_ARRAY_UNDIM
+ nukeArray(array);
+ break;
+ default:
+ error("o8_dim: default case %d", subOp);
+ }
}
void Scumm_v8::o8_dim2()
{
+ byte subOp = fetchScriptByte();
+ int array = fetchScriptWord(), a, b;
+
+ switch (subOp) {
+ case 0x0A: // SO_ARRAY_SCUMMVAR
+ b = pop();
+ a = pop();
+ defineArray(array, 5, a, b);
+ break;
+ case 0x0B: // SO_ARRAY_STRING
+ b = pop();
+ a = pop();
+ defineArray(array, 4, a, b);
+ break;
+ case 0x0C: // SO_ARRAY_UNDIM
+ nukeArray(array);
+ break;
+ default:
+ error("o8_dim2: default case %d", subOp);
+ }
}
-void Scumm_v8::o8_arrayAssign()
+void Scumm_v8::o8_arrayOps()
{
+ byte subOp = fetchScriptByte();
+ int array = fetchScriptWord();
+
+ switch (subOp) {
+ case 0x14: // SO_ASSIGN_STRING
+ case 0x15: // SO_ASSIGN_SCUMMVAR_LIST
+ case 0x16: // SO_ASSIGN_2DIM_LIST
+ default:
+ error("o8_arrayOps: default case %d (array %d)", subOp, array);
+ }
}
void Scumm_v8::o8_printLine()
@@ -478,25 +524,64 @@ void Scumm_v8::o8_resourceRoutines()
{
// TODO
byte subOp = fetchScriptByte();
+ int resid = pop();
+
switch (subOp) {
case 0x3C: // SO_HEAP_LOAD_CHARSET Load character set to heap
+ ensureResourceLoaded(rtCharset, resid); // FIXME - is this correct?
+ break;
case 0x3D: // SO_HEAP_LOAD_COSTUME Load costume to heap
+ ensureResourceLoaded(rtCostume, resid);
+ break;
case 0x3E: // SO_HEAP_LOAD_OBJECT Load object to heap
+ // TODO - is 'object' in COMI the same as FlObject in Sam&Max ?!?
+ break;
case 0x3F: // SO_HEAP_LOAD_ROOM Load room to heap
+ ensureResourceLoaded(rtRoom, resid);
+ break;
case 0x40: // SO_HEAP_LOAD_SCRIPT Load script to heap
+ ensureResourceLoaded(rtScript, resid);
+ break;
case 0x41: // SO_HEAP_LOAD_SOUND Load sound to heap
+ ensureResourceLoaded(rtSound, resid);
+ break;
+
case 0x42: // SO_HEAP_LOCK_COSTUME Lock costume in heap
+ lock(rtCostume, resid);
+ break;
case 0x43: // SO_HEAP_LOCK_ROOM Lock room in heap
+ lock(rtRoom, resid);
+ break;
case 0x44: // SO_HEAP_LOCK_SCRIPT Lock script in heap
+ lock(rtScript, resid);
+ break;
case 0x45: // SO_HEAP_LOCK_SOUND Lock sound in heap
+ lock(rtSound, resid);
+ break;
case 0x46: // SO_HEAP_UNLOCK_COSTUME Unlock costume
+ unlock(rtCostume, resid);
+ break;
case 0x47: // SO_HEAP_UNLOCK_ROOM Unlock room
+ unlock(rtRoom, resid);
+ break;
case 0x48: // SO_HEAP_UNLOCK_SCRIPT Unlock script
+ unlock(rtScript, resid);
+ break;
case 0x49: // SO_HEAP_UNLOCK_SOUND Unlock sound
+ unlock(rtSound, resid);
+ break;
case 0x4A: // SO_HEAP_NUKE_COSTUME Remove costume from heap
+ setResourceCounter(rtCostume, resid, 0x7F);
+ break;
case 0x4B: // SO_HEAP_NUKE_ROOM Remove room from heap
+ setResourceCounter(rtRoom, resid, 0x7F);
+ break;
case 0x4C: // SO_HEAP_NUKE_SCRIPT Remove script from heap
+ setResourceCounter(rtScript, resid, 0x7F);
+ break;
case 0x4D: // SO_HEAP_NUKE_SOUND Remove sound from heap
+ setResourceCounter(rtSound, resid, 0x7F);
+ break;
default:
error("o8_resourceRoutines: default case %d", subOp);
}