aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/intern.h1
-rw-r--r--scumm/resource.cpp9
-rw-r--r--scumm/script.cpp4
-rw-r--r--scumm/script_v72he.cpp9
-rw-r--r--scumm/script_v80he.cpp19
-rw-r--r--scumm/script_v90he.cpp13
-rw-r--r--scumm/scumm.cpp20
-rw-r--r--scumm/scumm.h7
8 files changed, 56 insertions, 26 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index 9b2cf0ff3a..1b19675e54 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -795,6 +795,7 @@ protected:
/* HE version 80 script opcodes */
void o80_unknown45();
+ void o80_unknown48();
void o80_unknown49();
void o80_unknown4A();
void o80_readConfigFile();
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index fdae4520b6..821b339b3d 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -2309,7 +2309,7 @@ void ScummEngine::readMAXS(int blockSize) {
_numGlobalObjects = _fileHandle.readUint16LE();
_numImages = _fileHandle.readUint16LE();
_numSprites = _fileHandle.readUint16LE();
- _numLocalScriptOffsets = _fileHandle.readUint16LE();
+ _numLocalScripts = _fileHandle.readUint16LE();
_fileHandle.readUint16LE(); // heap related
_fileHandle.readUint16LE(); // _numPalettes?
_fileHandle.readUint16LE(); // _numSmacker?
@@ -2338,13 +2338,16 @@ void ScummEngine::readMAXS(int blockSize) {
_numGlobalObjects = _fileHandle.readUint16LE();
_numImages = _fileHandle.readUint16LE();
_numSprites = _fileHandle.readUint16LE();
- _numLocalScriptOffsets = _fileHandle.readUint16LE();
+ _numLocalScripts = _fileHandle.readUint16LE();
_fileHandle.readUint16LE(); // heap releated
_numNewNames = 10;
_objectRoomTable = (byte *)calloc(_numGlobalObjects, 1);
_numRoomVariables = 64;
- _numGlobalScripts = 200;
+ if (_gameId == GID_FREDDI4)
+ _numGlobalScripts = 2048;
+ else
+ _numGlobalScripts = 200;
} else if (_heversion >= 70 && blockSize > 38) { // sputm7.2
if (blockSize != 32 + 8)
diff --git a/scumm/script.cpp b/scumm/script.cpp
index a69b168ffc..9646cce2a3 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -354,8 +354,8 @@ void ScummEngine::nukeArrays(int script) {
if (_heversion < 60 || !script)
return;
- //FIXME Nukes wrong arrays in fbear
- if (_gameId == GID_FBEAR)
+ //FIXME Nukes wrong arrays in other
+ if (_gameId != GID_PUTTMOON)
return;
for (i = 1; i < _numArray; i++) {
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp
index b391f7760a..23ed33dbf0 100644
--- a/scumm/script_v72he.cpp
+++ b/scumm/script_v72he.cpp
@@ -770,9 +770,12 @@ void ScummEngine_v72he::o72_setTimer() {
}
void ScummEngine_v72he::o72_unknown5A() {
- int value = pop();
- push(4);
- debug(1,"o72_unknown5A stub (%d)", value);
+ // Seems to get length of sound already played
+ int snd = pop();
+ int r = _mixer->getChannelElapsedTime(_sound->_musicChannelHandle);
+
+ push(r * 10);
+ debug(1,"o72_unknown5A stub (%d)", snd);
}
void ScummEngine_v72he::o72_wordArrayDec() {
diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp
index 345ab72c51..b1cb185bed 100644
--- a/scumm/script_v80he.cpp
+++ b/scumm/script_v80he.cpp
@@ -135,7 +135,7 @@ void ScummEngine_v80he::setupOpcodes() {
OPCODE(o6_invalid),
OPCODE(o72_wordArrayWrite),
/* 48 */
- OPCODE(o6_invalid),
+ OPCODE(o80_unknown48),
OPCODE(o80_unknown49),
OPCODE(o80_unknown4A),
OPCODE(o72_wordArrayIndexedWrite),
@@ -401,6 +401,23 @@ void ScummEngine_v80he::o80_unknown45() {
debug(1,"o80_unknown45 stub (%d)",subOp);
}
+void ScummEngine_v80he::o80_unknown48() {
+ int id, len, val;
+ byte *addr;
+ char string[100];
+
+ id = pop();
+
+ addr = getStringAddress(id);
+ if (!addr)
+ error("o80_unknown48: Reference to zeroed array pointer (%d)", id);
+
+ len = resStrLen(getStringAddress(id)) + 1;
+ memcpy(string, addr, len);
+ val = atoi(string);
+ push(val);
+}
+
void ScummEngine_v80he::o80_unknown49() {
// Sound related
int result = 0;
diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp
index 7fa8e30b15..68fb511b0d 100644
--- a/scumm/script_v90he.cpp
+++ b/scumm/script_v90he.cpp
@@ -135,7 +135,7 @@ void ScummEngine_v90he::setupOpcodes() {
OPCODE(o6_invalid),
OPCODE(o72_wordArrayWrite),
/* 48 */
- OPCODE(o6_invalid),
+ OPCODE(o80_unknown48),
OPCODE(o80_unknown49),
OPCODE(o80_unknown4A),
OPCODE(o72_wordArrayIndexedWrite),
@@ -534,12 +534,17 @@ void ScummEngine_v90he::o90_unknown25() {
pop();
break;
case 15:
- if (_heversion >= 99) {
+ if (_heversion == 99) {
getStackList(args, ARRAYSIZE(args));
pop();
pop();
pop();
pop();
+ } else if (_heversion == 98) {
+ pop();
+ pop();
+ pop();
+ pop();
} else {
pop();
pop();
@@ -621,7 +626,7 @@ void ScummEngine_v90he::o90_unknown26() {
break;
case 23:
pop();
- if (_heversion >= 99)
+ if (_gameId == GID_FREDDI4 || _heversion >= 99)
pop();
break;
case 29:
@@ -883,8 +888,6 @@ void ScummEngine_v90he::o90_unknown37() {
}
defineArray(fetchScriptWord(), data, dim2start, dim2end, dim1start, dim1end);
-
- debug(1,"o90_unknown37 stub");
}
void ScummEngine_v90he::o90_unknown3A() {
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp
index f90a9b2442..1ffaa2a72b 100644
--- a/scumm/scumm.cpp
+++ b/scumm/scumm.cpp
@@ -311,6 +311,8 @@ static const ScummGameSettings scumm_settings[] = {
// Humongous Entertainment Scumm Version 9.8 ? Scummsys.98
// these and later games can easily be identified by the .(a) file instead of a .he1
// and INIB chunk in the .he0
+ {"smaller", "Pajama Sam's Lost & Found (Test)", GID_HEGAME, 6, 98, MDT_NONE,
+ GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
{"lost", "Pajama Sam's Lost & Found", GID_HEGAME, 6, 98, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
{"racedemo", "Putt-Putt Enters the Race (Demo)", GID_HEGAME, 6, 98, MDT_NONE,
@@ -320,14 +322,14 @@ static const ScummGameSettings scumm_settings[] = {
{"BluesABCTimeDemo", "Blue's ABC Time (Demo)", GID_HEGAME, 6, 98, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
- // Engine moved to c++
- // Humongous Entertainment Scumm Version 9.9 ? Scummsys.99
- {"smaller", "Pajama Sam's Lost & Found (Test)", GID_HEGAME, 6, 99, MDT_NONE,
- GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
- {"freddi4", "Freddi Fish 4: The Case of the Hogfish Rustlers of Briny Gulch", GID_HEGAME, 6, 99, MDT_NONE,
+ // Global scripts increased to 2048
+ {"freddi4", "Freddi Fish 4: The Case of the Hogfish Rustlers of Briny Gulch", GID_FREDDI4, 6, 98, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
- {"f4-demo", "Freddi Fish 4: The Case of the Hogfish Rustlers of Briny Gulch (Demo)", GID_HEGAME, 6, 99, MDT_NONE,
+ {"f4-demo", "Freddi Fish 4: The Case of the Hogfish Rustlers of Briny Gulch (Demo)", GID_FREDDI4, 6, 98, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
+
+ // Engine moved to c++
+ // Humongous Entertainment Scumm Version 9.9 ? Scummsys.99
{"circdemo", "Putt-Putt Joins the Circus (Demo)", GID_HEGAME, 6, 99, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
{"sf2-demo", "Spyfox 2: Some Assembly Required (Demo)", GID_HEGAME, 6, 99, MDT_NONE,
@@ -401,7 +403,7 @@ static const ScummGameSettings he_md5_settings[] = {
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
{"df047cc4792150f601290357566d36a6", "Freddi Fish 1: The Case of the Missing Kelp Seeds *updated)", GID_HEGAME, 6, 90, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
- {"92e7727e67f5cd979d8a1070e4eb8cb3", "Putt-Putt Saves the Zoo *updated)", GID_HEGAME, 6, 99, MDT_NONE,
+ {"92e7727e67f5cd979d8a1070e4eb8cb3", "Putt-Putt Saves the Zoo *updated)", GID_FREDDI4, 6, 98, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
{"0ab19be9e2a3f6938226638b2a3744fe", "Putt-Putt Travels Through Time (updated Demo)", GID_HEGAME, 6, 98, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
@@ -537,7 +539,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
_numActors = 0;
_numCostumes = 0;
_numImages = 0;
- _numLocalScriptOffsets = 0;
+ _numLocalScripts = 0;
_numSprites = 0;
_numTalkies = 0;
_audioNames = NULL;
@@ -2736,7 +2738,7 @@ void ScummEngine::initRoomSubBlocks() {
id = READ_LE_UINT32(ptr);
- checkRange(NUM_LOCALSCRIPT + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d");
+ checkRange(_numLocalScripts + _numGlobalScripts, _numGlobalScripts, id, "Invalid local script %d");
_localScriptList[id - _numGlobalScripts] = ptr + 4 - roomResPtr;
if (_dumpScripts) {
diff --git a/scumm/scumm.h b/scumm/scumm.h
index bfbdf8f2a0..7e27a2b002 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -257,7 +257,8 @@ enum ScummGameId {
GID_PUTTDEMO,
GID_PUTTMOON,
GID_FBEAR,
- GID_FUNPACK
+ GID_FUNPACK,
+ GID_FREDDI4
};
#define _baseRooms res.address[rtRoom]
@@ -490,9 +491,9 @@ protected:
int _numInventory;
int _numNewNames, _numGlobalScripts;
int _numActors, _numRoomVariables;
- int _numLocalScriptOffsets, _numSprites, _numTalkies;
+ int _numSprites, _numTalkies;
public:
- int _numImages, _numRooms, _numScripts, _numSounds; // Used by VARS in HE games
+ int _numLocalScripts, _numImages, _numRooms, _numScripts, _numSounds; // Used by HE games
int _numCostumes; // FIXME - should be protected, used by Actor::remapActorPalette
int _numCharsets; // FIXME - should be protected, used by CharsetRenderer