aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2004-08-26 08:47:07 +0000
committerTravis Howell2004-08-26 08:47:07 +0000
commitb1d8b144bafb0bc26c9f0fa27044b0bed72838c2 (patch)
treedabe836497afe6a92ab31ecb9018ae4de65acc7a
parent0e71cd9b58b48bd44790f55105247c8dfeaf75ad (diff)
downloadscummvm-rg350-b1d8b144bafb0bc26c9f0fa27044b0bed72838c2.tar.gz
scummvm-rg350-b1d8b144bafb0bc26c9f0fa27044b0bed72838c2.tar.bz2
scummvm-rg350-b1d8b144bafb0bc26c9f0fa27044b0bed72838c2.zip
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
-rw-r--r--scumm/akos.cpp4
-rw-r--r--scumm/intern.h4
-rw-r--r--scumm/script.cpp23
-rw-r--r--scumm/script_v6.cpp4
-rw-r--r--scumm/script_v6he.cpp7
-rw-r--r--scumm/script_v72he.cpp54
-rw-r--r--scumm/script_v7he.cpp6
-rw-r--r--scumm/scumm.cpp4
-rw-r--r--scumm/scumm.h5
-rw-r--r--scumm/sound.cpp7
10 files changed, 83 insertions, 35 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index f677c8ba5b..d224ebed9b 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -59,6 +59,7 @@ enum AkosOpcodes {
AKC_SetVar = 0xC010,
AKC_CmdQue3 = 0xC015,
AKC_ComplexChan = 0xC020,
+ AKC_Unk2 = 0xC025,
AKC_Jump = 0xC030,
AKC_JumpIfSet = 0xC031,
AKC_AddVar = 0xC040,
@@ -1294,6 +1295,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const
case AKC_EndSeq:
case AKC_ComplexChan:
case AKC_Unk1:
+ case AKC_Unk2:
break;
case AKC_Cmd3:
@@ -1322,7 +1324,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const
int code2 = aksq[curpos];
if (code2 & 0x80)
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;
diff --git a/scumm/intern.h b/scumm/intern.h
index deeeea470f..655c624262 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -678,8 +678,6 @@ protected:
int readFileToArray(int slot, int32 size);
void writeFileFromArray(int slot, int resID);
- void copyScriptString(byte *dst);
-
/* Version 7 script opcodes */
void o72_pushDWord();
void o72_addMessageToStack();
@@ -715,6 +713,8 @@ protected:
void o72_stringLen();
void o72_readINI();
void o72_unknownF4();
+ void o72_unknownF8();
+ void o72_unknownF9();
void o72_unknownFA();
void o72_unknownFB();
void o72_unknownFC();
diff --git a/scumm/script.cpp b/scumm/script.cpp
index 3ae5b862f3..7ea65da2a8 100644
--- a/scumm/script.cpp
+++ b/scumm/script.cpp
@@ -478,9 +478,12 @@ int ScummEngine::fetchScriptWordSigned() {
int ScummEngine::readVar(uint var) {
// HACK Seems to variable difference
+ // Correct values for now
if (_gameId == GID_PAJAMA && var == 32770)
return 5;
-
+ else if (_gameId == GID_WATER && var == 32770)
+ return 23
+;
int a;
static byte copyprotbypassed;
if (!_copyProtection)
@@ -1034,10 +1037,20 @@ bool ScummEngine::isRoomScriptRunning(int script) const {
return false;
}
-void ScummEngine::copyScriptString(byte *dst) {
- int len = resStrLen(_scriptPointer) + 1;
- while (len--)
- *dst++ = fetchScriptByte();
+void ScummEngine::copyScriptString(byte *dst, bool override) {
+ int len, i = 0;
+ if (_heversion >= 72 && (pop() == -1 || override)) {
+ 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();
+ }
+
}
//
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index e93f3bb70e..ffb96a831a 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -1915,6 +1915,7 @@ void ScummEngine_v6::o6_verbOps() {
int slot, a, b;
VerbSlot *vs;
byte op;
+ byte name[200];
op = fetchScriptByte();
if (op == 196) {
@@ -1936,7 +1937,8 @@ void ScummEngine_v6::o6_verbOps() {
}
break;
case 125: // SO_VERB_NAME
- loadPtrToResource(rtVerb, slot, NULL);
+ copyScriptString(name);
+ loadPtrToResource(rtVerb, slot, name);
vs->type = kTextVerbType;
vs->imgindex = 0;
break;
diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp
index 0f0421d954..2866fe9465 100644
--- a/scumm/script_v6he.cpp
+++ b/scumm/script_v6he.cpp
@@ -549,6 +549,7 @@ void ScummEngine_v6he::o6_actorOps() {
int i, j, k;
int args[8];
byte b;
+ byte name[256];
b = fetchScriptByte();
if (b == 197) {
@@ -620,7 +621,8 @@ void ScummEngine_v6he::o6_actorOps() {
a->talkColor = pop();
break;
case 88: // SO_ACTOR_NAME
- loadPtrToResource(rtActorName, a->number, NULL);
+ copyScriptString(name);
+ loadPtrToResource(rtActorName, a->number, name);
break;
case 89: // SO_INIT_ANIMATION
a->initFrame = pop();
@@ -999,7 +1001,8 @@ void ScummEngine_v6he::o6_openFile() {
void ScummEngine_v6he::o6_closeFile() {
int slot = pop();
if (slot != -1)
- _hFileTable[slot].close();
+ if (_hFileTable[slot].isOpen() == true)
+ _hFileTable[slot].close();
}
void ScummEngine_v6he::o6_deleteFile() {
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp
index 39112daf7f..f6a10db432 100644
--- a/scumm/script_v72he.cpp
+++ b/scumm/script_v72he.cpp
@@ -356,8 +356,8 @@ void ScummEngine_v72he::setupOpcodes() {
OPCODE(o6_invalid),
OPCODE(o6_invalid),
/* F8 */
- OPCODE(o6_invalid),
- OPCODE(o7_unknownF9),
+ OPCODE(o72_unknownF8),
+ OPCODE(o72_unknownF9),
OPCODE(o72_unknownFA),
OPCODE(o72_unknownFB),
/* 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() {
int a;
if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) {
@@ -743,7 +728,13 @@ void ScummEngine_v72he::o72_arrayOps() {
switch (subOp) {
case 7: // SO_ASSIGN_STRING
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);
break;
case 208: // SO_ASSIGN_INT_LIST
@@ -887,7 +878,7 @@ void ScummEngine_v72he::o72_openFile() {
int mode, slot, l, r;
byte filename[100];
- copyScriptString(filename);
+ copyScriptString(filename, true);
printf("File %s\n", filename);
for (r = strlen((char*)filename); r != 0; r--) {
@@ -916,6 +907,7 @@ void ScummEngine_v72he::o72_openFile() {
slot = -1;
}
+ debug(1, "o72_openFile: slot %d, mode %d", slot, mode);
push(slot);
}
@@ -962,6 +954,8 @@ void ScummEngine_v72he::o72_readFile() {
default:
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) {
@@ -1194,6 +1188,28 @@ void ScummEngine_v72he::o72_unknownFA() {
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() {
byte b;
b = fetchScriptByte();
diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp
index d024c9d0fa..0d3720c073 100644
--- a/scumm/script_v7he.cpp
+++ b/scumm/script_v7he.cpp
@@ -486,6 +486,12 @@ void ScummEngine_v7he::o7_startSound() {
op = fetchScriptByte();
switch (op) {
+ case 9:
+ _heSndLoop |= 4;
+ break;
+ case 164:
+ _heSndLoop |= 2;
+ break;
case 224:
_heSndSoundFreq = pop();
break;
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp
index 1de096cae1..3558d86181 100644
--- a/scumm/scumm.cpp
+++ b/scumm/scumm.cpp
@@ -263,7 +263,7 @@ static const ScummGameSettings scumm_settings[] = {
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,
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},
{"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},
@@ -1082,6 +1082,8 @@ void ScummEngine::launch() {
_numActors = 25;
else if (_gameId == GID_PAJAMA)
_numActors = 62;
+ else if (_gameId == GID_WATER)
+ _numActors = 61;
else
_numActors = 13;
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 4f9d0c6e65..15ed727924 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -257,7 +257,8 @@ enum ScummGameId {
GID_PUTTDEMO,
GID_FBEAR,
GID_FUNPACK,
- GID_PAJAMA
+ GID_PAJAMA,
+ GID_WATER
};
#define _baseRooms res.address[rtRoom]
@@ -623,7 +624,7 @@ protected:
void beginOverride();
void endOverride();
- void copyScriptString(byte *dst);
+ void copyScriptString(byte *dst, bool override = false);
int resStrLen(const byte *src) const;
void doSentence(int c, int b, int a);
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 09aef4d84e..f70fb16034 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -166,7 +166,7 @@ void Sound::playSound(int soundID, int offset) {
debugC(DEBUG_SOUND, "playSound #%d", soundID);
int music_offs, total_size;
- uint skip;
+ uint skip = 0;
char buf[32];
File musicFile;
@@ -195,7 +195,10 @@ void Sound::playSound(int soundID, int offset) {
musicFile.seek(+20, SEEK_CUR);
// 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);
// Skip to offsets