nukeArrays still nuking wrong arrays.

Add some more differences in later HE versions.
Add HE opcodes changes.

svn-id: r15145
This commit is contained in:
Travis Howell 2004-09-17 05:43:37 +00:00
parent 9a65451109
commit d34da28ed9
8 changed files with 56 additions and 26 deletions

View File

@ -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();

View File

@ -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,12 +2338,15 @@ 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;
if (_gameId == GID_FREDDI4)
_numGlobalScripts = 2048;
else
_numGlobalScripts = 200;
} else if (_heversion >= 70 && blockSize > 38) { // sputm7.2

View File

@ -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++) {

View File

@ -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() {

View File

@ -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;

View File

@ -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() {

View File

@ -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},
// 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_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
{"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,
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,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
{"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) {

View File

@ -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