Add a few akos codes

Give unknown akos codes better names
Rename actor variable
Remove hack (Use multi-version flag instead)
Another sound correction for HE games.

svn-id: r14827
This commit is contained in:
Travis Howell 2004-08-29 11:27:16 +00:00
parent 3540014e45
commit cbf5a60bab
11 changed files with 72 additions and 34 deletions

View file

@ -57,7 +57,7 @@ Actor::Actor() {
walkbox = 0; walkbox = 0;
animProgress = 0; animProgress = 0;
skipLimb = false; skipLimb = false;
actorDrawVirScr = false; drawToBackBuf = false;
memset(animVariable, 0, sizeof(animVariable)); memset(animVariable, 0, sizeof(animVariable));
memset(palette, 0, sizeof(palette)); memset(palette, 0, sizeof(palette));
memset(sound, 0, sizeof(sound)); memset(sound, 0, sizeof(sound));
@ -129,6 +129,7 @@ void Actor::initActor(int mode) {
talkStopFrame = 5; talkStopFrame = 5;
} }
talking = false;
walkScript = 0; walkScript = 0;
talkScript = 0; talkScript = 0;
@ -1062,7 +1063,7 @@ void Actor::drawActorCostume() {
// If the actor is partially hidden, redraw it next frame. // If the actor is partially hidden, redraw it next frame.
// Only done for pre-AKOS, though. // Only done for pre-AKOS, though.
if (bcr->drawCostume(_vm->virtscr[0], cost, actorDrawVirScr) & 1) { if (bcr->drawCostume(_vm->virtscr[0], cost, drawToBackBuf) & 1) {
needRedraw = (_vm->_version <= 6); needRedraw = (_vm->_version <= 6);
} }
@ -1224,6 +1225,7 @@ void ScummEngine::actorTalk(const byte *msg) {
if ((_version <= 7 && !_keepText) || (_version == 8 && VAR(VAR_HAVE_MSG))) if ((_version <= 7 && !_keepText) || (_version == 8 && VAR(VAR_HAVE_MSG)))
stopTalk(); stopTalk();
setTalkingActor(a->number); setTalkingActor(a->number);
a->talking = true;
if (!_string[0].no_talk_anim) { if (!_string[0].no_talk_anim) {
a->runActorTalkScript(a->talkStartFrame); a->runActorTalkScript(a->talkStartFrame);
_useTalkAnims = true; _useTalkAnims = true;
@ -1287,6 +1289,7 @@ void ScummEngine::stopTalk() {
} }
if (_version <= 7 && !(_features & GF_HUMONGOUS)) if (_version <= 7 && !(_features & GF_HUMONGOUS))
setTalkingActor(0xFF); setTalkingActor(0xFF);
a->talking = false;
} }
if (_version == 8 || _features & GF_HUMONGOUS) if (_version == 8 || _features & GF_HUMONGOUS)
setTalkingActor(0); setTalkingActor(0);
@ -1828,7 +1831,7 @@ const SaveLoadEntry *Actor::getSaveLoadEntries() {
MKLINE(Actor, speedy, sleUint16, VER(8)), MKLINE(Actor, speedy, sleUint16, VER(8)),
MKLINE(Actor, cost.animCounter, sleUint16, VER(8)), MKLINE(Actor, cost.animCounter, sleUint16, VER(8)),
MKLINE(Actor, cost.soundCounter, sleByte, VER(8)), MKLINE(Actor, cost.soundCounter, sleByte, VER(8)),
MKLINE(Actor, actorDrawVirScr, sleByte, VER(32)), MKLINE(Actor, drawToBackBuf, sleByte, VER(32)),
MKLINE(Actor, flip, sleByte, VER(32)), MKLINE(Actor, flip, sleByte, VER(32)),
MKLINE(Actor, skipLimb, sleByte, VER(32)), MKLINE(Actor, skipLimb, sleByte, VER(32)),

View file

@ -109,7 +109,8 @@ public:
uint16 talkScript, walkScript; uint16 talkScript, walkScript;
bool ignoreTurns; bool ignoreTurns;
bool skipLimb; bool skipLimb;
bool actorDrawVirScr; bool drawToBackBuf;
bool talking;
int8 layer; int8 layer;
uint16 sound[8]; uint16 sound[8];
CostumeData cost; CostumeData cost;

View file

@ -59,7 +59,7 @@ enum AkosOpcodes {
AKC_SetVar = 0xC010, AKC_SetVar = 0xC010,
AKC_CmdQue3 = 0xC015, AKC_CmdQue3 = 0xC015,
AKC_ComplexChan = 0xC020, AKC_ComplexChan = 0xC020,
AKC_Unk3 = 0xC021, AKC_C021 = 0xC021,
AKC_ComplexChan2 = 0xC025, AKC_ComplexChan2 = 0xC025,
AKC_Jump = 0xC030, AKC_Jump = 0xC030,
AKC_JumpIfSet = 0xC031, AKC_JumpIfSet = 0xC031,
@ -88,7 +88,7 @@ enum AkosOpcodes {
AKC_Cmd3 = 0xC08B, AKC_Cmd3 = 0xC08B,
AKC_Ignore3 = 0xC08C, AKC_Ignore3 = 0xC08C,
AKC_Ignore2 = 0xC08D, AKC_Ignore2 = 0xC08D,
AKC_Unk1 = 0xC08E, AKC_C08E = 0xC08E,
AKC_SkipStart = 0xC090, AKC_SkipStart = 0xC090,
AKC_SkipE = 0xC090, AKC_SkipE = 0xC090,
AKC_SkipNE = 0xC091, AKC_SkipNE = 0xC091,
@ -97,7 +97,10 @@ enum AkosOpcodes {
AKC_SkipG = 0xC094, AKC_SkipG = 0xC094,
AKC_SkipGE = 0xC095, AKC_SkipGE = 0xC095,
AKC_ClearFlag = 0xC09F, AKC_ClearFlag = 0xC09F,
AKC_Unk4 = 0xC0A1, AKC_C0A0 = 0xC0A0,
AKC_C0A1 = 0xC0A1,
AKC_C0A2 = 0xC0A2,
AKC_C0A3 = 0xC0A3,
AKC_EndSeq = 0xC0FF AKC_EndSeq = 0xC0FF
}; };
@ -1137,6 +1140,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const
case AKC_StartAnim: case AKC_StartAnim:
case AKC_StartVarAnim: case AKC_StartVarAnim:
case AKC_CmdQue3: case AKC_CmdQue3:
case AKC_C0A3:
curpos += 3; curpos += 3;
break; break;
case AKC_SoundStuff: case AKC_SoundStuff:
@ -1170,7 +1174,9 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const
case AKC_Flip: case AKC_Flip:
case AKC_Jump: case AKC_Jump:
case AKC_StartAnimInActor: case AKC_StartAnimInActor:
case AKC_Unk4: case AKC_C0A0:
case AKC_C0A1:
case AKC_C0A2:
curpos += 4; curpos += 4;
break; break;
case AKC_ComplexChan2: case AKC_ComplexChan2:
@ -1184,7 +1190,7 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const
curpos += (aksq[curpos] & 0x80) ? 2 : 1; curpos += (aksq[curpos] & 0x80) ? 2 : 1;
} }
break; break;
case AKC_Unk3: case AKC_C021:
curpos += aksq[curpos + 2]; curpos += aksq[curpos + 2];
break; break;
default: default:
@ -1309,9 +1315,9 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const
case AKC_Return: case AKC_Return:
case AKC_EndSeq: case AKC_EndSeq:
case AKC_ComplexChan: case AKC_ComplexChan:
case AKC_Unk1: case AKC_C08E:
case AKC_ComplexChan2: case AKC_ComplexChan2:
case AKC_Unk3: case AKC_C021:
break; break;
case AKC_Cmd3: case AKC_Cmd3:
@ -1329,10 +1335,24 @@ bool ScummEngine::akos_increaseAnim(Actor *a, int chan, const byte *aksq, const
if (akos_compare(a->getAnimVar(GB(4)), GW(2), code - AKC_SkipStart) == 0) if (akos_compare(a->getAnimVar(GB(4)), GW(2), code - AKC_SkipStart) == 0)
flag_value = true; flag_value = true;
continue; continue;
case AKC_C0A0:
case AKC_Unk4: //akos_queCommand(8, a, GB(2), 0);
continue;
case AKC_C0A1:
if (a->talking) {
curpos = GUW(2); curpos = GUW(2);
break; break;
}
continue;
case AKC_C0A2:
if (!a->talking) {
curpos = GUW(2);
break;
}
continue;
case AKC_C0A3:
//akos_queCommand(8, a, a->getAnimVar(GB(2), 0);
continue;
default: default:
if ((code & 0xC000) == 0xC000) if ((code & 0xC000) == 0xC000)
error("Undefined uSweat token %X", code); error("Undefined uSweat token %X", code);
@ -1343,7 +1363,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 || code2 == AKC_ComplexChan2); assert((code2 & 0xC000) != 0xC000 || code2 == AKC_ComplexChan || code2 == AKC_Return || code2 == AKC_EndSeq || code2 == AKC_C08E || code2 == AKC_ComplexChan2);
a->cost.curpos[chan] = curpos; a->cost.curpos[chan] = curpos;

View file

@ -25,11 +25,11 @@
namespace Scumm { namespace Scumm {
byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, const CostumeData &cost, bool drawVirScr) { byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, const CostumeData &cost, bool drawToBackBuf) {
int i; int i;
byte result = 0; byte result = 0;
if (drawVirScr) if (drawToBackBuf)
_outptr = vs.getBackPixels(0, 0); _outptr = vs.getBackPixels(0, 0);
else else
_outptr = vs.getPixels(0, 0); _outptr = vs.getPixels(0, 0);

View file

@ -126,7 +126,7 @@ public:
virtual void setCostume(int costume) = 0; virtual void setCostume(int costume) = 0;
byte drawCostume(const VirtScreen &vs, const CostumeData &cost, bool actorDrawVirScr); byte drawCostume(const VirtScreen &vs, const CostumeData &cost, bool drawToBackBuf);
protected: protected:

View file

@ -715,6 +715,7 @@ protected:
void o72_readFile(); void o72_readFile();
void o72_writeFile(); void o72_writeFile();
void o72_findAllObjects(); void o72_findAllObjects();
void o72_deleteFile();
void o72_getPixel(); void o72_getPixel();
void o72_pickVarRandom(); void o72_pickVarRandom();
void o72_redimArray(); void o72_redimArray();

View file

@ -2240,9 +2240,6 @@ void ScummEngine::resourceStats() {
void ScummEngine::readMAXS(int blockSize) { void ScummEngine::readMAXS(int blockSize) {
debug(9, "readMAXS: MAXS has blocksize %d", blockSize); debug(9, "readMAXS: MAXS has blocksize %d", blockSize);
// FIXME: trying to detect multiple targets probably a better way to do this
if (_heversion >= 70 && blockSize > 38 && _heversion < 72)
_heversion = 72;
if (_version == 8) { // CMI if (_version == 8) { // CMI
_fileHandle.seek(50 + 50, SEEK_CUR); // 176 - 8 _fileHandle.seek(50 + 50, SEEK_CUR); // 176 - 8

View file

@ -2922,9 +2922,9 @@ void ScummEngine_v6::o6_stampObject() {
a->scalex = state; a->scalex = state;
a->scaley = state; a->scaley = state;
a->putActor(x, y, _currentRoom); a->putActor(x, y, _currentRoom);
a->actorDrawVirScr = true; a->drawToBackBuf = true;
a->drawActorCostume(); a->drawActorCostume();
a->actorDrawVirScr = false; a->drawToBackBuf = false;
a->drawActorCostume(); a->drawActorCostume();
return; return;
} }

View file

@ -693,10 +693,10 @@ void ScummEngine_v6he::o6_actorOps() {
{ {
int top_actor = a->top; int top_actor = a->top;
int bottom_actor = a->bottom; int bottom_actor = a->bottom;
a->actorDrawVirScr = true; a->drawToBackBuf = true;
a->needRedraw = true; a->needRedraw = true;
a->drawActorCostume(); a->drawActorCostume();
a->actorDrawVirScr = false; a->drawToBackBuf = false;
a->needRedraw = true; a->needRedraw = true;
a->drawActorCostume(); a->drawActorCostume();
a->needRedraw = false; a->needRedraw = false;
@ -709,7 +709,7 @@ void ScummEngine_v6he::o6_actorOps() {
} }
break; break;
case 219: case 219:
a->actorDrawVirScr = false; a->drawToBackBuf = false;
a->needRedraw = true; a->needRedraw = true;
a->needBgReset = true; a->needBgReset = true;
break; break;

View file

@ -323,7 +323,7 @@ void ScummEngine_v72he::setupOpcodes() {
/* DC */ /* DC */
OPCODE(o72_writeFile), OPCODE(o72_writeFile),
OPCODE(o72_findAllObjects), OPCODE(o72_findAllObjects),
OPCODE(o6_deleteFile), OPCODE(o72_deleteFile),
OPCODE(o6_rename), OPCODE(o6_rename),
/* E0 */ /* E0 */
OPCODE(o6_soundOps), OPCODE(o6_soundOps),
@ -1070,6 +1070,20 @@ void ScummEngine_v72he::o72_findAllObjects() {
push(readVar(0)); push(readVar(0));
} }
void ScummEngine_v72he::o72_deleteFile() {
int len, r;
byte filename[100];
copyScriptString(filename);
for (r = strlen((char*)filename); r != 0; r--) {
if (filename[r - 1] == '\\')
break;
}
debug(1, "stub o72_deleteFile(\"%s\")", filename + r);
}
void ScummEngine_v72he::o72_getPixel() { void ScummEngine_v72he::o72_getPixel() {
byte area; byte area;
int x = pop(); int x = pop();
@ -1118,6 +1132,10 @@ void ScummEngine_v72he::o72_pickVarRandom() {
num = readArray(value, 0, 0); num = readArray(value, 0, 0);
ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, num); ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, num);
// FIXME
if (!ah)
var_A = 0;
else
var_A = FROM_LE_32(ah->dim1end); var_A = FROM_LE_32(ah->dim1end);
if (var_A-1 <= num) { if (var_A-1 <= num) {

View file

@ -180,7 +180,7 @@ void Sound::playSound(int soundID, int offset) {
musicFile.seek(+40, SEEK_CUR); musicFile.seek(+40, SEEK_CUR);
if (musicFile.readUint32LE() == MKID('SGEN')) { if (musicFile.readUint32LE() == MKID('SGEN')) {
// TODO Work out skpi calcution // TODO Work out skip calcution
//skip = (soundID - 8001) * 21; //skip = (soundID - 8001) * 21;
musicFile.seek(+skip, SEEK_CUR); musicFile.seek(+skip, SEEK_CUR);
@ -191,8 +191,8 @@ void Sound::playSound(int soundID, int offset) {
// Rewind // Rewind
musicFile.seek(-44, SEEK_CUR); musicFile.seek(-44, SEEK_CUR);
// Skip header junk // Skip SGHD header (16)
musicFile.seek(+20, SEEK_CUR); musicFile.seek(+16, SEEK_CUR);
// Skip to correct music header // Skip to correct music header
if (soundID >= 8000) if (soundID >= 8000)
@ -201,8 +201,6 @@ void Sound::playSound(int soundID, int offset) {
skip = (soundID - 4001) * 25; skip = (soundID - 4001) * 25;
musicFile.seek(+skip, SEEK_CUR); musicFile.seek(+skip, SEEK_CUR);
// Skip to offsets
musicFile.seek(+21, SEEK_CUR);
} }