Add some stubs for HE 7.2

Fix warning
Add music support for later HE 7.2 games

svn-id: r14761
This commit is contained in:
Travis Howell 2004-08-26 06:08:41 +00:00
parent 68d35856c0
commit 8e2e48e40c
8 changed files with 66 additions and 15 deletions

View file

@ -1337,7 +1337,8 @@ void Gdi::drawBMAPBg(const byte *ptr, VirtScreen *vs, int startstrip, int width)
} }
void Gdi::decompressBMAPbg(byte *dst, int screenwidth, int w, int height, const byte *src, int shr, int mask) { void Gdi::decompressBMAPbg(byte *dst, int screenwidth, int w, int height, const byte *src, int shr, int mask) {
uint32 color, dataBit, data, shift, iteration; uint32 color, dataBit, data, shift;
int32 iteration;
color = *src; color = *src;
src++; src++;

View file

@ -691,6 +691,8 @@ protected:
void o72_wordArrayInc(); void o72_wordArrayInc();
void o72_objectX(); void o72_objectX();
void o72_objectY(); void o72_objectY();
void o72_getTimer();
void o72_setTimer();
void o72_wordArrayDec(); void o72_wordArrayDec();
void o72_startScript(); void o72_startScript();
void o72_startObject(); void o72_startObject();
@ -700,6 +702,7 @@ protected:
void o72_arrayOps(); void o72_arrayOps();
void o72_dimArray(); void o72_dimArray();
void o72_dim2dimArray(); void o72_dim2dimArray();
void o72_unknownCE();
void o72_shuffle(); void o72_shuffle();
void o72_jumpToScript(); void o72_jumpToScript();
void o72_openFile(); void o72_openFile();

View file

@ -2411,7 +2411,6 @@ void ScummEngine::allocateArrays() {
_inventory = (uint16 *)calloc(_numInventory, sizeof(uint16)); _inventory = (uint16 *)calloc(_numInventory, sizeof(uint16));
_verbs = (VerbSlot *)calloc(_numVerbs, sizeof(VerbSlot)); _verbs = (VerbSlot *)calloc(_numVerbs, sizeof(VerbSlot));
_objs = (ObjectData *)calloc(_numLocalObjects, sizeof(ObjectData)); _objs = (ObjectData *)calloc(_numLocalObjects, sizeof(ObjectData));
debug(2, "Allocated %d space in numObjects", _numLocalObjects);
_scummVars = (int32 *)calloc(_numVariables, sizeof(int32)); _scummVars = (int32 *)calloc(_numVariables, sizeof(int32));
_bitVars = (byte *)calloc(_numBitVariables >> 3, 1); _bitVars = (byte *)calloc(_numBitVariables >> 3, 1);
_images = (uint16 *)calloc(_numImages, sizeof(uint16)); _images = (uint16 *)calloc(_numImages, sizeof(uint16));

View file

@ -477,6 +477,10 @@ int ScummEngine::fetchScriptWordSigned() {
} }
int ScummEngine::readVar(uint var) { int ScummEngine::readVar(uint var) {
// HACK Seems to variable difference
if (_gameId == GID_PAJAMA && var == 32770)
return 5;
int a; int a;
static byte copyprotbypassed; static byte copyprotbypassed;
if (!_copyProtection) if (!_copyProtection)

View file

@ -772,7 +772,7 @@ void ScummEngine_v6he::o6_kernelSetFunctions() {
_skipDrawObject = 0; _skipDrawObject = 0;
break; break;
default: default:
error("o6_kernelSetFunctions: default case %d (param count %d)", args[0], num); warning("o6_kernelSetFunctions: default case %d (param count %d)", args[0], num);
break; break;
} }
} }
@ -851,7 +851,7 @@ void ScummEngine_v6he::o6_kernelGetFunctions() {
push(retval); push(retval);
break; break;
default: default:
error("o6_kernelGetFunctions: default case %d", args[0]); warning("o6_kernelGetFunctions: default case %d", args[0]);
} }
} }

View file

@ -156,8 +156,8 @@ void ScummEngine_v72he::setupOpcodes() {
OPCODE(o6_invalid), OPCODE(o6_invalid),
OPCODE(o6_wordVarDec), OPCODE(o6_wordVarDec),
/* 58 */ /* 58 */
OPCODE(o6_invalid), OPCODE(o72_getTimer),
OPCODE(o6_invalid), OPCODE(o72_setTimer),
OPCODE(o6_invalid), OPCODE(o6_invalid),
OPCODE(o72_wordArrayDec), OPCODE(o72_wordArrayDec),
/* 5C */ /* 5C */
@ -303,7 +303,7 @@ void ScummEngine_v72he::setupOpcodes() {
/* CC */ /* CC */
OPCODE(o6_pickOneOfDefault), OPCODE(o6_pickOneOfDefault),
OPCODE(o6_stampObject), OPCODE(o6_stampObject),
OPCODE(o6_invalid), OPCODE(o72_unknownCE),
OPCODE(o6_invalid), OPCODE(o6_invalid),
/* D0 */ /* D0 */
OPCODE(o6_getDateTime), OPCODE(o6_getDateTime),
@ -619,6 +619,24 @@ void ScummEngine_v72he::o72_objectY() {
push(_objs[objnum].y_pos); push(_objs[objnum].y_pos);
} }
void ScummEngine_v72he::o72_getTimer() {
int b = pop();
int a = fetchScriptByte();
warning("o72_getTimer stub (%d, %d)", b, a);
if (a == 10)
push(1);
else
push(0);
}
void ScummEngine_v72he::o72_setTimer() {
int b = pop();
int a = fetchScriptByte();
if (a != 158)
error("TIMER command %d?", a);
warning("o72_setTimer stub (%d, %d)", b, a);
}
void ScummEngine_v72he::o72_wordArrayDec() { void ScummEngine_v72he::o72_wordArrayDec() {
int var = fetchScriptWord(); int var = fetchScriptWord();
int base = pop(); int base = pop();
@ -821,6 +839,15 @@ void ScummEngine_v72he::o72_dim2dimArray() {
defineArray(fetchScriptWord(), data, 0, a, 0, b); defineArray(fetchScriptWord(), data, 0, a, 0, b);
} }
void ScummEngine_v72he::o72_unknownCE() {
int a = pop();
int b = pop();
int c = pop();
int d = pop();
warning("o72_unknownCE stub (%d, %d, %d, %d)", d, c, b, a);
push(4000);
}
void ScummEngine_v72he::shuffleArray(int num, int minIdx, int maxIdx) { void ScummEngine_v72he::shuffleArray(int num, int minIdx, int maxIdx) {
int range = maxIdx - minIdx; int range = maxIdx - minIdx;
int count = range * 2; int count = range * 2;

View file

@ -707,7 +707,7 @@ void ScummEngine_v7he::o7_quitPauseRestart() {
warning("stub: o7_quitPauseRestart subOpcode %d", subOp); warning("stub: o7_quitPauseRestart subOpcode %d", subOp);
break; break;
default: default:
error("o7_quitPauseRestart invalid case %d", subOp); warning("o7_quitPauseRestart invalid case %d", subOp);
} }
} }

View file

@ -166,8 +166,10 @@ 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;
char buf[32]; char buf[32];
File musicFile; File musicFile;
sprintf(buf, "%s.he4", _vm->getGameName()); sprintf(buf, "%s.he4", _vm->getGameName());
if (musicFile.open(buf) == false) { if (musicFile.open(buf) == false) {
warning("playSound: Music file is not open"); warning("playSound: Music file is not open");
@ -176,15 +178,30 @@ void Sound::playSound(int soundID, int offset) {
musicFile.seek(4, SEEK_SET); musicFile.seek(4, SEEK_SET);
total_size = musicFile.readUint32BE(); total_size = musicFile.readUint32BE();
// Skip header junk musicFile.seek(+40, SEEK_CUR);
musicFile.seek(+20, SEEK_CUR); if (musicFile.readUint32LE() == MKID('SGEN')) {
// Skip to correct music header
skip = (soundID - 4001) * 21;
musicFile.seek(+skip, SEEK_CUR);
// Skip to correct music header // Skip to offsets
uint skip = (soundID - 4001) * 25; musicFile.seek(+8, SEEK_CUR);
musicFile.seek(+skip, SEEK_CUR);
} else {
// Rewind
musicFile.seek(-44, SEEK_CUR);
// Skip header junk
musicFile.seek(+20, SEEK_CUR);
// Skip to correct music header
skip = (soundID - 4001) * 25;
musicFile.seek(+skip, SEEK_CUR);
// Skip to offsets
musicFile.seek(+21, SEEK_CUR);
}
// Skip to offsets
musicFile.seek(+21, SEEK_CUR);
music_offs = musicFile.readUint32LE(); music_offs = musicFile.readUint32LE();
size = musicFile.readUint32LE(); size = musicFile.readUint32LE();