More code/stubs for HE 7.2 games

Add another temp hack
Add id for water, uses more actors
Another small correction to music playback for HE 7.2 games

svn-id: r14764
This commit is contained in:
Travis Howell 2004-08-26 08:47:07 +00:00
parent 0e71cd9b58
commit b1d8b144ba
10 changed files with 83 additions and 35 deletions

View file

@ -59,6 +59,7 @@ enum AkosOpcodes {
AKC_SetVar = 0xC010, AKC_SetVar = 0xC010,
AKC_CmdQue3 = 0xC015, AKC_CmdQue3 = 0xC015,
AKC_ComplexChan = 0xC020, AKC_ComplexChan = 0xC020,
AKC_Unk2 = 0xC025,
AKC_Jump = 0xC030, AKC_Jump = 0xC030,
AKC_JumpIfSet = 0xC031, AKC_JumpIfSet = 0xC031,
AKC_AddVar = 0xC040, AKC_AddVar = 0xC040,
@ -1294,6 +1295,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const
case AKC_EndSeq: case AKC_EndSeq:
case AKC_ComplexChan: case AKC_ComplexChan:
case AKC_Unk1: case AKC_Unk1:
case AKC_Unk2:
break; break;
case AKC_Cmd3: case AKC_Cmd3:
@ -1322,7 +1324,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const
int code2 = aksq[curpos]; int code2 = aksq[curpos];
if (code2 & 0x80) if (code2 & 0x80)
code2 = (code2 << 8) | aksq[curpos + 1]; code2 = (code2 << 8) | aksq[curpos + 1];
assert((code2 & 0xC000) != 0xC000 || code2 == AKC_ComplexChan || code2 == AKC_Return || code2 == AKC_EndSeq || code2 == AKC_Unk1); assert((code2 & 0xC000) != 0xC000 || code2 == AKC_ComplexChan || code2 == AKC_Return || code2 == AKC_EndSeq || code2 == AKC_Unk1 || code2 == AKC_Unk2);
a->cost.curpos[chan] = curpos; a->cost.curpos[chan] = curpos;

View file

@ -678,8 +678,6 @@ protected:
int readFileToArray(int slot, int32 size); int readFileToArray(int slot, int32 size);
void writeFileFromArray(int slot, int resID); void writeFileFromArray(int slot, int resID);
void copyScriptString(byte *dst);
/* Version 7 script opcodes */ /* Version 7 script opcodes */
void o72_pushDWord(); void o72_pushDWord();
void o72_addMessageToStack(); void o72_addMessageToStack();
@ -715,6 +713,8 @@ protected:
void o72_stringLen(); void o72_stringLen();
void o72_readINI(); void o72_readINI();
void o72_unknownF4(); void o72_unknownF4();
void o72_unknownF8();
void o72_unknownF9();
void o72_unknownFA(); void o72_unknownFA();
void o72_unknownFB(); void o72_unknownFB();
void o72_unknownFC(); void o72_unknownFC();

View file

@ -478,9 +478,12 @@ int ScummEngine::fetchScriptWordSigned() {
int ScummEngine::readVar(uint var) { int ScummEngine::readVar(uint var) {
// HACK Seems to variable difference // HACK Seems to variable difference
// Correct values for now
if (_gameId == GID_PAJAMA && var == 32770) if (_gameId == GID_PAJAMA && var == 32770)
return 5; return 5;
else if (_gameId == GID_WATER && var == 32770)
return 23
;
int a; int a;
static byte copyprotbypassed; static byte copyprotbypassed;
if (!_copyProtection) if (!_copyProtection)
@ -1034,10 +1037,20 @@ bool ScummEngine::isRoomScriptRunning(int script) const {
return false; return false;
} }
void ScummEngine::copyScriptString(byte *dst) { void ScummEngine::copyScriptString(byte *dst, bool override) {
int len = resStrLen(_scriptPointer) + 1; int len, i = 0;
while (len--) if (_heversion >= 72 && (pop() == -1 || override)) {
*dst++ = fetchScriptByte(); printf("part one\n");
len = resStrLen(_stringBuffer) + 1;
while (len--)
*dst++ = _stringBuffer[i++];
} else {
printf("part two\n");
len = resStrLen(_scriptPointer) + 1;
while (len--)
*dst++ = fetchScriptByte();
}
} }
// //

View file

@ -1915,6 +1915,7 @@ void ScummEngine_v6::o6_verbOps() {
int slot, a, b; int slot, a, b;
VerbSlot *vs; VerbSlot *vs;
byte op; byte op;
byte name[200];
op = fetchScriptByte(); op = fetchScriptByte();
if (op == 196) { if (op == 196) {
@ -1936,7 +1937,8 @@ void ScummEngine_v6::o6_verbOps() {
} }
break; break;
case 125: // SO_VERB_NAME case 125: // SO_VERB_NAME
loadPtrToResource(rtVerb, slot, NULL); copyScriptString(name);
loadPtrToResource(rtVerb, slot, name);
vs->type = kTextVerbType; vs->type = kTextVerbType;
vs->imgindex = 0; vs->imgindex = 0;
break; break;

View file

@ -549,6 +549,7 @@ void ScummEngine_v6he::o6_actorOps() {
int i, j, k; int i, j, k;
int args[8]; int args[8];
byte b; byte b;
byte name[256];
b = fetchScriptByte(); b = fetchScriptByte();
if (b == 197) { if (b == 197) {
@ -620,7 +621,8 @@ void ScummEngine_v6he::o6_actorOps() {
a->talkColor = pop(); a->talkColor = pop();
break; break;
case 88: // SO_ACTOR_NAME case 88: // SO_ACTOR_NAME
loadPtrToResource(rtActorName, a->number, NULL); copyScriptString(name);
loadPtrToResource(rtActorName, a->number, name);
break; break;
case 89: // SO_INIT_ANIMATION case 89: // SO_INIT_ANIMATION
a->initFrame = pop(); a->initFrame = pop();
@ -999,7 +1001,8 @@ void ScummEngine_v6he::o6_openFile() {
void ScummEngine_v6he::o6_closeFile() { void ScummEngine_v6he::o6_closeFile() {
int slot = pop(); int slot = pop();
if (slot != -1) if (slot != -1)
_hFileTable[slot].close(); if (_hFileTable[slot].isOpen() == true)
_hFileTable[slot].close();
} }
void ScummEngine_v6he::o6_deleteFile() { void ScummEngine_v6he::o6_deleteFile() {

View file

@ -356,8 +356,8 @@ void ScummEngine_v72he::setupOpcodes() {
OPCODE(o6_invalid), OPCODE(o6_invalid),
OPCODE(o6_invalid), OPCODE(o6_invalid),
/* F8 */ /* F8 */
OPCODE(o6_invalid), OPCODE(o72_unknownF8),
OPCODE(o7_unknownF9), OPCODE(o72_unknownF9),
OPCODE(o72_unknownFA), OPCODE(o72_unknownFA),
OPCODE(o72_unknownFB), OPCODE(o72_unknownFB),
/* FC */ /* FC */
@ -513,21 +513,6 @@ void ScummEngine_v72he::readArrayFromIndexFile() {
} }
} }
void ScummEngine_v72he::copyScriptString(byte *dst) {
int a = pop();
int b = 0;
// FIXME Should only be -1
if (a == 1 || a == -1) {
int len = resStrLen(_stringBuffer) + 1;
while (len--)
*dst++ = _stringBuffer[b++];
} else {
int len = resStrLen(_scriptPointer) + 1;
while (len--)
*dst++ = fetchScriptByte();
}
}
void ScummEngine_v72he::o72_pushDWord() { void ScummEngine_v72he::o72_pushDWord() {
int a; int a;
if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) { if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) {
@ -743,7 +728,13 @@ void ScummEngine_v72he::o72_arrayOps() {
switch (subOp) { switch (subOp) {
case 7: // SO_ASSIGN_STRING case 7: // SO_ASSIGN_STRING
array = fetchScriptWord(); array = fetchScriptWord();
ah = defineArray(array, kStringArray, 0, 0, 0, 256); ah = defineArray(array, kStringArray, 0, 0, 0, 1024);
copyScriptString(ah->data);
break;
case 194: // SO_ASSIGN_STRING
array = fetchScriptWord();
len = getStackList(list, ARRAYSIZE(list));
ah = defineArray(array, kStringArray, 0, 0, 0, 1024);
copyScriptString(ah->data); copyScriptString(ah->data);
break; break;
case 208: // SO_ASSIGN_INT_LIST case 208: // SO_ASSIGN_INT_LIST
@ -887,7 +878,7 @@ void ScummEngine_v72he::o72_openFile() {
int mode, slot, l, r; int mode, slot, l, r;
byte filename[100]; byte filename[100];
copyScriptString(filename); copyScriptString(filename, true);
printf("File %s\n", filename); printf("File %s\n", filename);
for (r = strlen((char*)filename); r != 0; r--) { for (r = strlen((char*)filename); r != 0; r--) {
@ -916,6 +907,7 @@ void ScummEngine_v72he::o72_openFile() {
slot = -1; slot = -1;
} }
debug(1, "o72_openFile: slot %d, mode %d", slot, mode);
push(slot); push(slot);
} }
@ -962,6 +954,8 @@ void ScummEngine_v72he::o72_readFile() {
default: default:
error("default case %d", subOp); error("default case %d", subOp);
} }
debug(1, "o72_readFile: slot %d, subOp %d val %d", slot, subOp, val);
} }
void ScummEngine_v72he::writeFileFromArray(int slot, int resID) { void ScummEngine_v72he::writeFileFromArray(int slot, int resID) {
@ -1194,6 +1188,28 @@ void ScummEngine_v72he::o72_unknownFA() {
debug(1,"o72_unknownFA: (%d) %s", id, name); debug(1,"o72_unknownFA: (%d) %s", id, name);
} }
void ScummEngine_v72he::o72_unknownF8() {
int a = fetchScriptByte();
push(1);
warning("stub o72_unknownF8(%d)", a);
}
void ScummEngine_v72he::o72_unknownF9() {
// File related
int r;
byte filename[255];
copyScriptString(filename);
for (r = strlen((char*)filename); r != 0; r--) {
if (filename[r - 1] == '\\')
break;
}
warning("stub o72_unknownF9(\"%s\")", filename + r);
}
void ScummEngine_v72he::o72_unknownFB() { void ScummEngine_v72he::o72_unknownFB() {
byte b; byte b;
b = fetchScriptByte(); b = fetchScriptByte();

View file

@ -486,6 +486,12 @@ void ScummEngine_v7he::o7_startSound() {
op = fetchScriptByte(); op = fetchScriptByte();
switch (op) { switch (op) {
case 9:
_heSndLoop |= 4;
break;
case 164:
_heSndLoop |= 2;
break;
case 224: case 224:
_heSndSoundFreq = pop(); _heSndSoundFreq = pop();
break; break;

View file

@ -263,7 +263,7 @@ static const ScummGameSettings scumm_settings[] = {
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0}, GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
{"maze", "Freddi Fish and Luther's Maze Madness", GID_HEGAME, 6, 72, MDT_NONE, {"maze", "Freddi Fish and Luther's Maze Madness", GID_HEGAME, 6, 72, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0}, GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
{"water", "Freddi Fish and Luther's Water Worries", GID_HEGAME, 6, 72, MDT_NONE, {"water", "Freddi Fish and Luther's Water Worries", GID_WATER, 6, 72, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0}, GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
{"pjs-demo", "Pajama Sam 1: No Need to Hide When It's Dark Outside (Demo)", GID_PAJAMA, 6, 72, MDT_NONE, {"pjs-demo", "Pajama Sam 1: No Need to Hide When It's Dark Outside (Demo)", GID_PAJAMA, 6, 72, MDT_NONE,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0}, GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES, 0, 0},
@ -1082,6 +1082,8 @@ void ScummEngine::launch() {
_numActors = 25; _numActors = 25;
else if (_gameId == GID_PAJAMA) else if (_gameId == GID_PAJAMA)
_numActors = 62; _numActors = 62;
else if (_gameId == GID_WATER)
_numActors = 61;
else else
_numActors = 13; _numActors = 13;

View file

@ -257,7 +257,8 @@ enum ScummGameId {
GID_PUTTDEMO, GID_PUTTDEMO,
GID_FBEAR, GID_FBEAR,
GID_FUNPACK, GID_FUNPACK,
GID_PAJAMA GID_PAJAMA,
GID_WATER
}; };
#define _baseRooms res.address[rtRoom] #define _baseRooms res.address[rtRoom]
@ -623,7 +624,7 @@ protected:
void beginOverride(); void beginOverride();
void endOverride(); void endOverride();
void copyScriptString(byte *dst); void copyScriptString(byte *dst, bool override = false);
int resStrLen(const byte *src) const; int resStrLen(const byte *src) const;
void doSentence(int c, int b, int a); void doSentence(int c, int b, int a);

View file

@ -166,7 +166,7 @@ void Sound::playSound(int soundID, int offset) {
debugC(DEBUG_SOUND, "playSound #%d", soundID); debugC(DEBUG_SOUND, "playSound #%d", soundID);
int music_offs, total_size; int music_offs, total_size;
uint skip; uint skip = 0;
char buf[32]; char buf[32];
File musicFile; File musicFile;
@ -195,7 +195,10 @@ void Sound::playSound(int soundID, int offset) {
musicFile.seek(+20, SEEK_CUR); musicFile.seek(+20, SEEK_CUR);
// Skip to correct music header // Skip to correct music header
skip = (soundID - 4001) * 25; if (soundID >= 8000)
skip = (soundID - 8001) * 25;
else
skip = (soundID - 4001) * 25;
musicFile.seek(+skip, SEEK_CUR); musicFile.seek(+skip, SEEK_CUR);
// Skip to offsets // Skip to offsets