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) {
uint32 color, dataBit, data, shift, iteration;
uint32 color, dataBit, data, shift;
int32 iteration;
color = *src;
src++;

View file

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

View file

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

View file

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

View file

@ -772,7 +772,7 @@ void ScummEngine_v6he::o6_kernelSetFunctions() {
_skipDrawObject = 0;
break;
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;
}
}
@ -851,7 +851,7 @@ void ScummEngine_v6he::o6_kernelGetFunctions() {
push(retval);
break;
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_wordVarDec),
/* 58 */
OPCODE(o6_invalid),
OPCODE(o6_invalid),
OPCODE(o72_getTimer),
OPCODE(o72_setTimer),
OPCODE(o6_invalid),
OPCODE(o72_wordArrayDec),
/* 5C */
@ -303,7 +303,7 @@ void ScummEngine_v72he::setupOpcodes() {
/* CC */
OPCODE(o6_pickOneOfDefault),
OPCODE(o6_stampObject),
OPCODE(o6_invalid),
OPCODE(o72_unknownCE),
OPCODE(o6_invalid),
/* D0 */
OPCODE(o6_getDateTime),
@ -619,6 +619,24 @@ void ScummEngine_v72he::o72_objectY() {
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() {
int var = fetchScriptWord();
int base = pop();
@ -821,6 +839,15 @@ void ScummEngine_v72he::o72_dim2dimArray() {
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) {
int range = maxIdx - minIdx;
int count = range * 2;

View file

@ -707,7 +707,7 @@ void ScummEngine_v7he::o7_quitPauseRestart() {
warning("stub: o7_quitPauseRestart subOpcode %d", subOp);
break;
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);
int music_offs, total_size;
uint skip;
char buf[32];
File musicFile;
sprintf(buf, "%s.he4", _vm->getGameName());
if (musicFile.open(buf) == false) {
warning("playSound: Music file is not open");
@ -176,15 +178,30 @@ void Sound::playSound(int soundID, int offset) {
musicFile.seek(4, SEEK_SET);
total_size = musicFile.readUint32BE();
// Skip header junk
musicFile.seek(+20, SEEK_CUR);
musicFile.seek(+40, 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
uint skip = (soundID - 4001) * 25;
musicFile.seek(+skip, SEEK_CUR);
// Skip to offsets
musicFile.seek(+8, 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();
size = musicFile.readUint32LE();