aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Crossfield2014-12-07 19:53:27 +1100
committerRobert Crossfield2014-12-08 10:14:37 +1100
commitd83438225e40f513a43b2c9b5d9b71a3afbc375e (patch)
tree4ea5adbdb2972ffb7c62b43b852ebb1eb95401ee
parentf2511e5a9ecfebdf5c03319acb9466e070fa3d06 (diff)
downloadscummvm-rg350-d83438225e40f513a43b2c9b5d9b71a3afbc375e.tar.gz
scummvm-rg350-d83438225e40f513a43b2c9b5d9b71a3afbc375e.tar.bz2
scummvm-rg350-d83438225e40f513a43b2c9b5d9b71a3afbc375e.zip
SCUMM: Maniac V0: Add support for D64 Demo Disk, Cleanup duplicate 'Talk' array
-rw-r--r--devtools/scumm-md5.txt1
-rw-r--r--engines/scumm/actor.cpp102
-rw-r--r--engines/scumm/detection.cpp2
-rw-r--r--engines/scumm/detection_tables.h2
-rw-r--r--engines/scumm/file.cpp26
-rw-r--r--engines/scumm/resource_v2.cpp10
-rw-r--r--engines/scumm/script_v0.cpp15
-rw-r--r--engines/scumm/scumm-md5.h3
-rw-r--r--engines/scumm/scumm.cpp16
-rw-r--r--engines/scumm/scumm_v0.h3
-rw-r--r--engines/scumm/verbs.cpp55
11 files changed, 187 insertions, 48 deletions
diff --git a/devtools/scumm-md5.txt b/devtools/scumm-md5.txt
index 37d7e7a5e1..62925e98fa 100644
--- a/devtools/scumm-md5.txt
+++ b/devtools/scumm-md5.txt
@@ -52,6 +52,7 @@
maniac Maniac Mansion
2d624d1b214f7faf0094daea65c6d1a6 -1 en 2gs Apple II - -
+ 2cb46375dd5cdfd023e2f07e0a21b530 -1 en C64 C64 Demo - Robert Crossfield
eea4d9ac2fb6f145945a308e8866915b -1 en C64 C64 - -
439a7f4adf510489981ac52308e7d7a2 -1 de C64 C64 - -
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 59a1009789..d07f175c78 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -43,12 +43,60 @@ namespace Scumm {
byte Actor::kInvalidBox = 0;
-static const byte v0ActorTalkArray[0x19] = {
- 0x00, 0x06, 0x06, 0x06, 0x06,
- 0x06, 0x06, 0x00, 0x46, 0x06,
- 0x06, 0x06, 0x06, 0xFF, 0xFF,
- 0x06, 0xC0, 0x06, 0x06, 0x00,
- 0xC0, 0xC0, 0x00, 0x06, 0x06
+static const byte v0ActorDemoTalk[25] = {
+ 0x00,
+ 0x06, // Syd
+ 0x06, // Razor
+ 0x06, // Dave
+ 0x06, // Michael
+ 0x06, // Bernard
+ 0x06, // Wendy
+ 0x00, // Jeff
+ 0x46, // Radiation Suit
+ 0x06, // Dr Fred
+ 0x06, // Nurse Edna
+ 0x06, // Weird Ed
+ 0x06, // Dead Cousin Ted
+ 0xE2, // Purple Tentacle
+ 0xE2, // Green Tentacle
+ 0x06, // Meteor police
+ 0xC0, // Meteor
+ 0x06, // Mark Eteer
+ 0x06, // Talkshow Host
+ 0x00, // Plant
+ 0xC0, // Meteor Radiation
+ 0xC0, // Edsel (small, outro)
+ 0x00, // Meteor (small, intro)
+ 0x06, // Sandy (Lab)
+ 0x06, // Sandy (Cut-Scene)
+};
+
+static const byte v0ActorTalk[25] = {
+ 0x00,
+ 0x06, // Syd
+ 0x06, // Razor
+ 0x06, // Dave
+ 0x06, // Michael
+ 0x06, // Bernard
+ 0x06, // Wendy
+ 0x00, // Jeff
+ 0x46, // Radiation Suit
+ 0x06, // Dr Fred
+ 0x06, // Nurse Edna
+ 0x06, // Weird Ed
+ 0x06, // Dead Cousin Ted
+ 0xFF, // Purple Tentacle
+ 0xFF, // Green Tentacle
+ 0x06, // Meteor police
+ 0xC0, // Meteor
+ 0x06, // Mark Eteer
+ 0x06, // Talkshow Host
+ 0x00, // Plant
+ 0xC0, // Meteor Radiation
+ 0xC0, // Edsel (small, outro)
+ 0x00, // Meteor (small, intro)
+ 0x06, // Sandy (Lab)
+ 0x06, // Sandy (Cut-Scene)
};
static const byte v0WalkboxSlantedModifier[0x16] = {
@@ -210,6 +258,12 @@ void Actor_v0::initActor(int mode) {
_limbFrameRepeat[i] = 0;
_limb_flipped[i] = false;
}
+
+ if (_vm->_game.features & GF_DEMO) {
+ _sound[0] = v0ActorDemoTalk[_number];
+ } else {
+ _sound[0] = v0ActorTalk[_number];
+ }
}
void Actor::setBox(int box) {
@@ -1753,34 +1807,6 @@ void ScummEngine::showActors() {
}
}
-// bits 0..5: sound, bit 6: ???
-static const byte v0ActorSounds[24] = {
- 0x06, // Syd
- 0x06, // Razor
- 0x06, // Dave
- 0x06, // Michael
- 0x06, // Bernard
- 0x06, // Wendy
- 0x00, // Jeff
- 0x46, // Radiation Suit
- 0x06, // Dr Fred
- 0x06, // Nurse Edna
- 0x06, // Weird Ed
- 0x06, // Dead Cousin Ted
- 0xFF, // Purple Tentacle
- 0xFF, // Green Tentacle
- 0x06, // Meteor police
- 0xC0, // Meteor
- 0x06, // Mark Eteer
- 0x06, // Talkshow Host
- 0x00, // Plant
- 0xC0, // Meteor Radiation
- 0xC0, // Edsel (small, outro)
- 0x00, // Meteor (small, intro)
- 0x06, // Sandy (Lab)
- 0x06, // Sandy (Cut-Scene)
-};
-
/* Used in Scumm v5 only. Play sounds associated with actors */
void ScummEngine::playActorSounds() {
int i, j;
@@ -1790,7 +1816,7 @@ void ScummEngine::playActorSounds() {
if (_actors[i]->_cost.soundCounter && _actors[i]->isInCurrentRoom()) {
_currentScript = 0xFF;
if (_game.version == 0) {
- sound = v0ActorSounds[i - 1] & 0x3F;
+ sound = _actors[i]->_sound[0] & 0x3F;
} else {
sound = _actors[i]->_sound[0];
}
@@ -1950,7 +1976,7 @@ void ScummEngine::processActors() {
// Is this the correct location?
// 0x073C
- if (v0ActorTalkArray[a0->_number] & 0x3F)
+ if (a0->_sound[0] & 0x3F)
a0->_cost.soundPos = (a0->_cost.soundPos + 1) % 3;
}
}
@@ -2259,7 +2285,7 @@ void Actor::startAnimActor(int f) {
void Actor_v0::startAnimActor(int f) {
if (f == _talkStartFrame) {
- if (v0ActorTalkArray[_number] & 0x40)
+ if (_sound[0] & 0x40)
return;
_speaking = 1;
@@ -2365,7 +2391,7 @@ void Actor_v0::animateCostume() {
}
void Actor_v0::speakCheck() {
- if (v0ActorTalkArray[_number] & 0x80)
+ if (_sound[0] & 0x80)
return;
int cmd = newDirToOldDir(_facing);
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index c0db0d6d37..45647c9bed 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -323,6 +323,8 @@ static BaseScummFile *openDiskImage(const Common::FSNode &node, const GameFilena
gs.gameid = gfp->gameid;
gs.id = (Common::String(gfp->gameid) == "maniac" ? GID_MANIAC : GID_ZAK);
gs.platform = gfp->platform;
+ if (strcmp(gfp->pattern, "maniacdemo.d64") == 0)
+ gs.features |= GF_DEMO;
// determine second disk file name
Common::String disk2(disk1);
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index f72e552fa6..82a8b4452b 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -207,6 +207,7 @@ static const Engines::ObsoleteGameID obsoleteGameIDsTable[] = {
static const GameSettings gameVariantsTable[] = {
{"maniac", "Apple II", 0, GID_MANIAC, 0, 0, MDT_APPLEIIGS, 0, Common::kPlatformApple2GS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"maniac", "C64", 0, GID_MANIAC, 0, 0, MDT_C64, 0, Common::kPlatformC64, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI) },
+ {"maniac", "C64 Demo", 0, GID_MANIAC, 0, 0, MDT_C64, GF_DEMO, Common::kPlatformC64, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI) },
{"maniac", "V1", "v1", GID_MANIAC, 1, 0, MDT_PCSPK | MDT_PCJR, 0, Common::kPlatformDOS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"maniac", "V1 Demo", "v1", GID_MANIAC, 1, 0, MDT_PCSPK | MDT_PCJR, GF_DEMO, Common::kPlatformDOS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
{"maniac", "NES", 0, GID_MANIAC, 1, 0, MDT_NONE, 0, Common::kPlatformNES, GUIO3(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_NOASPECT)},
@@ -448,6 +449,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "maniac", "%02d.MAN", kGenRoomNum, UNK_LANG, UNK, "V1 Demo" },
{ "maniac", "maniac1.d64", kGenUnchanged, UNK_LANG, Common::kPlatformC64, "C64" }, // ... and maniac2.d64
{ "maniac", "maniac1.dsk", kGenUnchanged, UNK_LANG, Common::kPlatformApple2GS, "Apple II" }, // ... and maniac2.dsk
+ { "maniac", "maniacdemo.d64", kGenUnchanged, UNK_LANG, Common::kPlatformC64, "C64 Demo" },
{ "maniac", "Maniac Mansion (E).prg", kGenUnchanged, Common::EN_GRB, Common::kPlatformNES, "NES" },
{ "maniac", "Maniac Mansion (F).prg", kGenUnchanged, Common::FR_FRA, Common::kPlatformNES, "NES" },
{ "maniac", "Maniac Mansion (SW).prg", kGenUnchanged, Common::SE_SWE, Common::kPlatformNES, "NES" },
diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp
index 475ffa3238..7ead4c25b5 100644
--- a/engines/scumm/file.cpp
+++ b/engines/scumm/file.cpp
@@ -221,6 +221,15 @@ static const int maniacResourcesPerFile[55] = {
3, 10, 1, 0, 0
};
+static const int maniacDemoResourcesPerFile[55] = {
+ 0, 12, 0, 2, 1, 12, 1, 13, 6, 0,
+ 31, 0, 1, 0, 0, 0, 0, 1, 1, 1,
+ 0, 1, 0, 0, 2, 0, 0, 1, 0, 0,
+ 2, 7, 1, 11, 0, 0, 5, 1, 0, 0,
+ 1, 0, 1, 3, 4, 3, 1, 0, 0, 1,
+ 1, 2, 0, 0, 0
+};
+
static const int zakResourcesPerFile[59] = {
0, 29, 12, 14, 13, 4, 4, 10, 7, 4,
14, 19, 5, 4, 7, 6, 11, 9, 4, 4,
@@ -253,9 +262,17 @@ ScummDiskImage::ScummDiskImage(const char *disk1, const char *disk2, GameSetting
_numGlobalObjects = 256;
_numRooms = 55;
_numCostumes = 25;
- _numScripts = 160;
- _numSounds = 70;
- _resourcesPerFile = maniacResourcesPerFile;
+
+ if (_game.features & GF_DEMO) {
+ _numScripts = 55;
+ _numSounds = 40;
+ _resourcesPerFile = maniacDemoResourcesPerFile;
+ } else {
+ _numScripts = 160;
+ _numSounds = 70;
+ _resourcesPerFile = maniacResourcesPerFile;
+ }
+
} else {
_numGlobalObjects = 775;
_numRooms = 59;
@@ -327,6 +344,9 @@ bool ScummDiskImage::open(const Common::String &filename) {
extractIndex(0); // Fill in resource arrays
+ if (_game.features & GF_DEMO)
+ return true;
+
openDisk(2);
if (_game.platform == Common::kPlatformApple2GS) {
diff --git a/engines/scumm/resource_v2.cpp b/engines/scumm/resource_v2.cpp
index 7ccdfa4780..87dc132ff0 100644
--- a/engines/scumm/resource_v2.cpp
+++ b/engines/scumm/resource_v2.cpp
@@ -34,8 +34,14 @@ void ScummEngine_v2::readClassicIndexFile() {
_numGlobalObjects = 256;
_numRooms = 55;
_numCostumes = 25;
- _numScripts = 160;
- _numSounds = 70;
+ if (_game.features & GF_DEMO) {
+ _numScripts = 55;
+ _numSounds = 40;
+ } else {
+ _numScripts = 160;
+ _numSounds = 70;
+ }
+
} else if (_game.platform == Common::kPlatformNES) {
_numGlobalObjects = 775;
_numRooms = 55;
diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp
index 90291535fd..8d9d196b62 100644
--- a/engines/scumm/script_v0.cpp
+++ b/engines/scumm/script_v0.cpp
@@ -633,12 +633,21 @@ void ScummEngine_v0::setMode(byte mode) {
switch (_currentMode) {
case kModeCutscene:
+ if (_game.features & GF_DEMO) {
+ if (VAR(11) != 0)
+ _drawDemo = true;
+ }
_redrawSentenceLine = false;
// Note: do not change freeze state here
state = USERSTATE_SET_IFACE |
USERSTATE_SET_CURSOR;
+
break;
case kModeKeypad:
+ if (_game.features & GF_DEMO) {
+ if (VAR(11) != 0)
+ _drawDemo = true;
+ }
_redrawSentenceLine = false;
state = USERSTATE_SET_IFACE |
USERSTATE_SET_CURSOR | USERSTATE_CURSOR_ON |
@@ -646,6 +655,12 @@ void ScummEngine_v0::setMode(byte mode) {
break;
case kModeNormal:
case kModeNoNewKid:
+ if (_game.features & GF_DEMO) {
+ resetVerbs();
+ _activeVerb = kVerbWalkTo;
+ _redrawSentenceLine = true;
+ _drawDemo = false;
+ }
state = USERSTATE_SET_IFACE | USERSTATE_IFACE_ALL |
USERSTATE_SET_CURSOR | USERSTATE_CURSOR_ON |
USERSTATE_SET_FREEZE;
diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h
index 4a34894506..5be18fb990 100644
--- a/engines/scumm/scumm-md5.h
+++ b/engines/scumm/scumm-md5.h
@@ -1,5 +1,5 @@
/*
- This file was generated by the md5table tool on Sat Nov 29 19:54:41 2014
+ This file was generated by the md5table tool on Sun Dec 7 23:09:10 2014
DO NOT EDIT MANUALLY!
*/
@@ -135,6 +135,7 @@ static const MD5Table md5table[] = {
{ "2a446817ffcabfef8716e0c456ecaf81", "puttzoo", "", "Demo", -1, Common::DE_DEU, Common::kPlatformWindows },
{ "2a8658dbd13d84d1bce64a71a35995eb", "pajama2", "HE 99", "Demo", -1, Common::HE_ISR, Common::kPlatformWindows },
{ "2c04aacffb8428f30ccf4f734fbe3adc", "activity", "", "", -1, Common::EN_ANY, Common::kPlatformDOS },
+ { "2cb46375dd5cdfd023e2f07e0a21b530", "maniac", "C64", "Demo", -1, Common::EN_ANY, Common::kPlatformC64 },
{ "2ccd8891ce4d3f1a334d21bff6a88ca2", "monkey", "CD", "", 9455, Common::EN_ANY, Common::kPlatformMacintosh },
{ "2d1e891fe52df707c30185e52c50cd92", "monkey", "CD", "CD", 8955, Common::EN_ANY, Common::kPlatformDOS },
{ "2d388339d6050d8ccaa757b64633954e", "indyloom", "FM-TOWNS", "Demo", 7520, Common::EN_ANY, Common::kPlatformFMTowns },
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 475b146a7b..6040344c2c 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -716,7 +716,7 @@ ScummEngine_v2::ScummEngine_v2(OSystem *syst, const DetectorResult &dr)
ScummEngine_v0::ScummEngine_v0(OSystem *syst, const DetectorResult &dr)
: ScummEngine_v2(syst, dr) {
-
+ _drawDemo = false;
_currentMode = 0;
_currentLights = 0;
@@ -731,6 +731,9 @@ ScummEngine_v0::ScummEngine_v0(OSystem *syst, const DetectorResult &dr)
VAR_ACTIVE_OBJECT2 = 0xFF;
VAR_IS_SOUND_RUNNING = 0xFF;
VAR_ACTIVE_VERB = 0xFF;
+
+ if (strcmp(dr.fp.pattern, "maniacdemo.d64") == 0 )
+ _game.features |= GF_DEMO;
}
ScummEngine_v6::ScummEngine_v6(OSystem *syst, const DetectorResult &dr)
@@ -1091,8 +1094,13 @@ Common::Error ScummEngine::init() {
const char *tmpBuf1, *tmpBuf2;
assert(_game.id == GID_MANIAC || _game.id == GID_ZAK);
if (_game.id == GID_MANIAC) {
- tmpBuf1 = "maniac1.d64";
- tmpBuf2 = "maniac2.d64";
+ if (_game.features & GF_DEMO) {
+ tmpBuf1 = "maniacdemo.d64";
+ tmpBuf2 = "maniacdemo.d64";
+ } else {
+ tmpBuf1 = "maniac1.d64";
+ tmpBuf2 = "maniac2.d64";
+ }
} else {
tmpBuf1 = "zak1.d64";
tmpBuf2 = "zak2.d64";
@@ -2572,7 +2580,7 @@ void ScummEngine::runBootscript() {
int args[NUM_SCRIPT_LOCAL];
memset(args, 0, sizeof(args));
args[0] = _bootParam;
- if (_game.id == GID_MANIAC && (_game.features & GF_DEMO))
+ if (_game.id == GID_MANIAC && (_game.features & GF_DEMO) && (_game.platform != Common::kPlatformC64))
runScript(9, 0, 0, args);
else
runScript(1, 0, 0, args);
diff --git a/engines/scumm/scumm_v0.h b/engines/scumm/scumm_v0.h
index 83e0e32e15..e2f4a2ffbf 100644
--- a/engines/scumm/scumm_v0.h
+++ b/engines/scumm/scumm_v0.h
@@ -46,6 +46,7 @@ protected:
};
protected:
+ bool _drawDemo;
byte _currentMode;
byte _currentLights;
@@ -101,6 +102,8 @@ protected:
virtual void handleMouseOver(bool updateInventory);
int verbPrepIdType(int verbid);
void resetVerbs();
+ void verbDemoMode();
+ void verbDrawDemoString(int VerbDemoNumber);
void clearSentenceLine();
void flushSentenceLine();
diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index bf0a693467..fe936b550c 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -80,6 +80,19 @@ static const VerbSettings v0VerbTable_German[] = {
{kVerbWhatIs, 13, 2, "Was ist"}
};
+struct VerbDemo {
+ int color;
+ const char *str;
+};
+static VerbDemo v0DemoStr[] = {
+ {7, " MANIAC MANSION DEMO DISK "},
+ {5, " from Lucasfilm Games "},
+ {5, " Copyright = 1987 by Lucasfilm Ltd. "},
+ {5, " All Rights Reserved. "},
+ {0, " "},
+ {16, " Press F7 to return to menu. "}
+};
+
int ScummEngine_v0::verbPrepIdType(int verbid) {
switch (verbid) {
case kVerbUse: // depends on object1
@@ -93,6 +106,44 @@ int ScummEngine_v0::verbPrepIdType(int verbid) {
}
}
+void ScummEngine_v0::verbDemoMode() {
+ int i;
+
+ for (i = 1; i < 16; i++)
+ killVerb(i);
+
+ for (i = 0; i < 6; i++) {
+ verbDrawDemoString(i);
+ }
+}
+
+void ScummEngine_v0::verbDrawDemoString(int VerbDemoNumber) {
+ byte string[80];
+ const char *ptr = v0DemoStr[VerbDemoNumber].str;
+ int i = 0, len = 0;
+
+ // Maximum length of printable characters
+ int maxChars = 40;
+ while (*ptr) {
+ if (*ptr != '@')
+ len++;
+ if (len > maxChars) {
+ break;
+ }
+
+ string[i++] = *ptr++;
+
+ }
+ string[i] = 0;
+
+ _string[2].charset = 1;
+ _string[2].ypos = _virtscr[kVerbVirtScreen].topline + (8 * VerbDemoNumber);
+ _string[2].xpos = 0;
+ _string[2].right = _virtscr[kVerbVirtScreen].w - 1;
+ _string[2].color = v0DemoStr[VerbDemoNumber].color;
+ drawString(2, (byte *)string);
+}
+
void ScummEngine_v0::resetVerbs() {
VirtScreen *virt = &_virtscr[kVerbVirtScreen];
VerbSlot *vs;
@@ -854,6 +905,10 @@ void ScummEngine_v0::checkExecVerbs() {
}
}
}
+
+ if (_drawDemo && _game.features & GF_DEMO) {
+ verbDemoMode();
+ }
if (_redrawSentenceLine)
drawSentenceLine();