aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
Diffstat (limited to 'scumm')
-rw-r--r--scumm/intern.h1
-rw-r--r--scumm/script.cpp9
-rw-r--r--scumm/script_v8.cpp34
-rw-r--r--scumm/scummvm.cpp35
4 files changed, 57 insertions, 22 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index e85f6a6419..30ce168d00 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -408,6 +408,7 @@ protected:
/* Version 8 script opcodes */
void o8_mod();
+ void o8_breakHereVar();
void o8_wait();
void o8_dim();
diff --git a/scumm/script.cpp b/scumm/script.cpp
index 074c985d90..97b045b33f 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -247,8 +247,13 @@ void Scumm::getScriptBaseAddress()
case 3:
case WIO_ROOM: /* room script */
- _scriptOrgPointer = getResourceAddress(rtRoom, _roomResource);
- _lastCodePtr = &_baseRooms[_roomResource];
+ if (_features & GF_AFTER_V8) {
+ _scriptOrgPointer = getResourceAddress(rtRoomScripts, _roomResource);
+ _lastCodePtr = &res.address[rtRoomScripts][_roomResource];
+ } else {
+ _scriptOrgPointer = getResourceAddress(rtRoom, _roomResource);
+ _lastCodePtr = &_baseRooms[_roomResource];
+ }
break;
case WIO_GLOBAL: /* global script */
diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp
index 40d4ae1aed..bff070757f 100644
--- a/scumm/script_v8.cpp
+++ b/scumm/script_v8.cpp
@@ -169,7 +169,7 @@ void Scumm_v8::setupOpcodes()
OPCODE(o6_jump),
OPCODE(o6_breakHere),
/* 68 */
- OPCODE(o6_invalid),
+ OPCODE(o8_breakHereVar),
OPCODE(o8_wait),
OPCODE(o6_delay), // FIXME - is the delay period right?
OPCODE(o6_delayLonger), // FIXME - is the delay period right?
@@ -202,7 +202,7 @@ void Scumm_v8::setupOpcodes()
OPCODE(o6_stopObjectScript), // FIXME - is this right?
OPCODE(o6_cutscene),
OPCODE(o6_endCutscene),
- OPCODE(o6_invalid),
+ OPCODE(o6_freezeUnfreeze),
/* 84 */
OPCODE(o6_beginOverride),
OPCODE(o6_endOverride),
@@ -211,8 +211,8 @@ void Scumm_v8::setupOpcodes()
/* 88 */
OPCODE(o6_invalid),
OPCODE(o6_setClass),
- OPCODE(o6_invalid),
- OPCODE(o6_invalid),
+ OPCODE(o6_setState),
+ OPCODE(o6_setOwner),
/* 8C */
OPCODE(o6_invalid),
OPCODE(o6_invalid),
@@ -257,9 +257,9 @@ void Scumm_v8::setupOpcodes()
OPCODE(o8_actorOps),
OPCODE(o8_cameraOps),
OPCODE(o8_verbOps),
- OPCODE(o6_invalid),
+ OPCODE(o6_startSound),
/* B0 */
- OPCODE(o6_invalid),
+ OPCODE(o6_startMusic),
OPCODE(o6_stopSound),
OPCODE(o8_soundKludge),
OPCODE(o8_system),
@@ -528,6 +528,12 @@ void Scumm_v8::o8_mod()
push(pop() % a);
}
+void Scumm_v8::o8_breakHereVar()
+{
+ warning("o8_breakHereVar NYI");
+ o6_breakHere();
+}
+
void Scumm_v8::o8_wait()
{
// TODO
@@ -821,8 +827,14 @@ void Scumm_v8::o8_roomOps()
case 0x5A: // SO_ROOM_CYCLE_SPEED Set palette cycling speed
case 0x5B: // SO_ROOM_COPY_PALETTE Copy palette
case 0x5C: // SO_ROOM_NEW_PALETTE Create new palette
+ error("o8_roomOps: default case %d", subOp);
+ break;
case 0x5D: // SO_ROOM_SAVE_GAME Save game
+ warning("V8 Save game opcode not implemented");
+ break;
case 0x5E: // SO_ROOM_LOAD_GAME Load game
+ warning("V8 Load game opcode not implemented");
+ break;
case 0x5F: // SO_ROOM_SATURATION Set saturation of room colors
default:
error("o8_roomOps: default case %d", subOp);
@@ -1078,9 +1090,11 @@ void Scumm_v8::o8_verbOps()
void Scumm_v8::o8_soundKludge()
{
- // TODO
- int16 args[30];
+ int16 args[16];
getStackList(args, sizeof(args) / sizeof(args[0]));
+
+ // FIXME - is this right?
+ _sound->soundKludge(args);
}
void Scumm_v8::o8_system()
@@ -1108,13 +1122,13 @@ void Scumm_v8::o8_kludge()
// not used
break;
case 22:
- warning("o8_kludge: BannerSetBannerColor(%d, %d, %d, %d)", args[1], args[2], args[3], args[4]);
+// warning("o8_kludge: BannerSetBannerColor(%d, %d, %d, %d)", args[1], args[2], args[3], args[4]);
break;
case 29:
warning("o8_kludge: opcode 29 (%d, %d)", args[1], args[2]);
break;
case 108:
- warning("o8_kludge: PaletteBuildRedirection(%d, %d, %d, %d, %d, %d)", args[1], args[2], args[3], args[4], args[5], args[6]);
+// warning("o8_kludge: PaletteBuildRedirection(%d, %d, %d, %d, %d, %d)", args[1], args[2], args[3], args[4], args[5], args[6]);
break;
case 12:
case 13:
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 15abaea85c..b294bdae02 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -709,7 +709,7 @@ void Scumm::initRoomSubBlocks()
{
int i, offs;
byte *ptr;
- byte *roomptr, *searchptr;
+ byte *roomptr, *searchptr, *roomResPtr;
RoomHeader *rmhd;
_ENCD_offs = 0;
@@ -723,7 +723,10 @@ void Scumm::initRoomSubBlocks()
for (i = 1; i < _maxScaleTable; i++)
nukeResource(rtScaleTable, i);
- roomptr = getResourceAddress(rtRoom, _roomResource);
+ // Determine the room and room script base address
+ roomResPtr = roomptr = getResourceAddress(rtRoom, _roomResource);
+ if (_features & GF_AFTER_V8)
+ roomResPtr = getResourceAddress(rtRoomScripts, _roomResource);
rmhd = (RoomHeader *)findResourceData(MKID('RMHD'), roomptr);
@@ -748,17 +751,19 @@ void Scumm::initRoomSubBlocks()
findResource(MKID('IM00'),
findResource(MKID('RMIM'), roomptr)) - roomptr;
- ptr = findResourceData(MKID('EXCD'), roomptr);
+ // Look for an exit script
+ ptr = findResourceData(MKID('EXCD'), roomResPtr);
if (ptr) {
- _EXCD_offs = ptr - roomptr;
+ _EXCD_offs = ptr - roomResPtr;
#ifdef DUMP_SCRIPTS
dumpResource("exit-", _roomResource, ptr - _resourceHeaderSize);
#endif
}
- ptr = findResourceData(MKID('ENCD'), roomptr);
+ // Look for an entry script
+ ptr = findResourceData(MKID('ENCD'), roomResPtr);
if (ptr) {
- _ENCD_offs = ptr - roomptr;
+ _ENCD_offs = ptr - roomResPtr;
#ifdef DUMP_SCRIPTS
dumpResource("entry-", _roomResource, ptr - _resourceHeaderSize);
#endif
@@ -833,9 +838,19 @@ void Scumm::initRoomSubBlocks()
}
}
}
+
+
+ //
+ // Setup local script
+ //
memset(_localScriptList, 0, sizeof(_localScriptList));
- searchptr = roomptr = getResourceAddress(rtRoom, _roomResource);
+ // Determine the room script base address
+ roomResPtr = roomptr = getResourceAddress(rtRoom, _roomResource);
+ if (_features & GF_AFTER_V8)
+ roomResPtr = getResourceAddress(rtRoomScripts, _roomResource);
+ searchptr = roomResPtr;
+
if (_features & GF_SMALL_HEADER) {
while ((ptr = findResourceSmall(MKID('LSCR'), searchptr)) != NULL) {
int id = 0;
@@ -860,14 +875,14 @@ void Scumm::initRoomSubBlocks()
if (_features & GF_AFTER_V8) {
id = READ_LE_UINT32(ptr);
checkRange(NUM_LOCALSCRIPT + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d");
- _localScriptList[id - _numGlobalScripts] = ptr + 4 - roomptr;
+ _localScriptList[id - _numGlobalScripts] = ptr + 4 - roomResPtr;
} else if (_features & GF_AFTER_V7) {
id = READ_LE_UINT16(ptr);
checkRange(NUM_LOCALSCRIPT + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d");
- _localScriptList[id - _numGlobalScripts] = ptr + 2 - roomptr;
+ _localScriptList[id - _numGlobalScripts] = ptr + 2 - roomResPtr;
} else {
id = ptr[0];
- _localScriptList[id - _numGlobalScripts] = ptr + 1 - roomptr;
+ _localScriptList[id - _numGlobalScripts] = ptr + 1 - roomResPtr;
}
#ifdef DUMP_SCRIPTS
do {