diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/actor.cpp | 6 | ||||
-rw-r--r-- | scumm/actor.h | 2 | ||||
-rw-r--r-- | scumm/intern.h | 9 | ||||
-rw-r--r-- | scumm/saveload.h | 2 | ||||
-rw-r--r-- | scumm/script.cpp | 17 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 13 | ||||
-rw-r--r-- | scumm/script_v6he.cpp | 35 | ||||
-rw-r--r-- | scumm/script_v72he.cpp | 460 | ||||
-rw-r--r-- | scumm/scumm.cpp | 31 | ||||
-rw-r--r-- | scumm/scumm.h | 4 | ||||
-rw-r--r-- | scumm/vars.cpp | 9 |
11 files changed, 498 insertions, 90 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 137a4553b1..354c762f49 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -1838,7 +1838,11 @@ const SaveLoadEntry *Actor::getSaveLoadEntries() { MKLINE(Actor, scalex, sleByte, VER(8)), MKLINE(Actor, scaley, sleByte, VER(8)), MKLINE(Actor, charset, sleByte, VER(8)), - MKARRAY(Actor, sound[0], sleByte, 8, VER(8)), + + // Actor sound grew from 8 to 32 bytes + MKARRAY_OLD(Actor, sound[0], sleByte, 8, VER(35), VER(36)), + MKARRAY(Actor, sound[0], sleByte, 32, VER(37)), + MKARRAY(Actor, animVariable[0], sleUint16, 8, VER(8)), MKLINE(Actor, targetFacing, sleUint16, VER(8)), MKLINE(Actor, moving, sleByte, VER(8)), diff --git a/scumm/actor.h b/scumm/actor.h index 68c2c9c055..56469d70a9 100644 --- a/scumm/actor.h +++ b/scumm/actor.h @@ -117,7 +117,7 @@ public: bool drawToBackBuf; bool talking; int8 layer; - uint16 sound[8]; + uint16 sound[32]; CostumeData cost; protected: byte palette[256]; diff --git a/scumm/intern.h b/scumm/intern.h index 72e098376b..199e105abc 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -574,8 +574,6 @@ protected: void seekFilePos(int slot, int offset, int mode); virtual void decodeParseString(int a, int b); - void decodeScriptString(byte *dst, bool scriptString = false); - /* Version 6 script opcodes */ void o6_setState(); void o6_roomOps(); @@ -702,6 +700,10 @@ protected: void flushWizBuffer(); void copyWizImage(uint8 *dst, const uint8 *src, int dstw, int dsth, int srcx, int srcy, int srcw, int srch, Common::Rect *pr); + virtual void decodeParseString(int a, int b); + void decodeScriptString(byte *dst, bool scriptString = false); + int copyScriptString(byte *dst); + /* Version 7 script opcodes */ void o72_pushDWord(); void o72_addMessageToStack(); @@ -727,6 +729,8 @@ protected: void o72_getArrayDimSize(); void o72_getNumFreeArrays(); void o72_pickupObject(); + void o72_actorOps(); + void o72_verbOps(); void o72_arrayOps(); void o72_dimArray(); void o72_dim2dimArray(); @@ -744,6 +748,7 @@ protected: void o72_unknownED(); void o72_unknownEF(); void o72_unknownF1(); + void o72_unknownF2(); void o72_readINI(); void o72_writeINI(); void o72_unknownF4(); diff --git a/scumm/saveload.h b/scumm/saveload.h index 7f11684c2f..aae7896408 100644 --- a/scumm/saveload.h +++ b/scumm/saveload.h @@ -32,7 +32,7 @@ namespace Scumm { // Can be useful for other ports too :) #define VER(x) x -#define CURRENT_VER 35 +#define CURRENT_VER 37 // To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types, // we use a small trick: instead of 0 we use 42. Why? Well, it seems newer GCC diff --git a/scumm/script.cpp b/scumm/script.cpp index 07d138d4b7..9e2716b801 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -1056,20 +1056,11 @@ bool ScummEngine::isRoomScriptRunning(int script) const { return false; } -int ScummEngine::copyScriptString(byte *dst, bool override) { - int len, i = 0; - if (_heversion >= 72 && (pop() == -1 || override)) { - len = resStrLen(_stringBuffer) + 1; - while (len--) - *dst++ = _stringBuffer[i++]; - } else { - len = resStrLen(_scriptPointer) + 1; - while (len--) - *dst++ = fetchScriptByte(); - } +void ScummEngine::copyScriptString(byte *dst) { + int len = resStrLen(_scriptPointer) + 1; + while (len--) + *dst++ = fetchScriptByte(); *dst = 0; - - return len; } // diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index e23c5e72f1..220899cae7 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -398,6 +398,9 @@ int ScummEngine_v6::popRoomAndObj(int *room) { } ArrayHeader *ScummEngine_v6::defineArray(int array, int type, int dim2, int dim1) { + if (_heversion >= 72) + error("Call to old defineArray"); + int id; int size; ArrayHeader *ah; @@ -503,6 +506,9 @@ ArrayHeader *ScummEngine_v6::getArray(int array) { } int ScummEngine_v6::readArray(int array, int idx, int base) { + if (_heversion >= 72) + error("Call to old readArray"); + ArrayHeader *ah = getArray(array); if (ah == NULL || ah->data == NULL) @@ -536,6 +542,9 @@ int ScummEngine_v6::readArray(int array, int idx, int base) { } void ScummEngine_v6::writeArray(int array, int idx, int base, int value) { + if (_heversion >= 72) + error("Call to old writeArray"); + ArrayHeader *ah = getArray(array); if (!ah) return; @@ -1910,7 +1919,6 @@ void ScummEngine_v6::o6_verbOps() { int slot, a, b; VerbSlot *vs; byte op; - byte name[200]; op = fetchScriptByte(); if (op == 196) { @@ -1932,8 +1940,7 @@ void ScummEngine_v6::o6_verbOps() { } break; case 125: // SO_VERB_NAME - copyScriptString(name); - loadPtrToResource(rtVerb, slot, name); + loadPtrToResource(rtVerb, slot, NULL); vs->type = kTextVerbType; vs->imgindex = 0; break; diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp index 6fa0003bc3..1b53af05c1 100644 --- a/scumm/script_v6he.cpp +++ b/scumm/script_v6he.cpp @@ -552,7 +552,6 @@ void ScummEngine_v6he::o6_actorOps() { int i, j, k; int args[8]; byte b; - byte name[256]; b = fetchScriptByte(); if (b == 197) { @@ -565,25 +564,12 @@ void ScummEngine_v6he::o6_actorOps() { return; switch (b) { - case 21: - // HE 7.3 (Pajama Sam onwards) - k = getStackList(args, ARRAYSIZE(args)); - break; case 30: // _heversion >= 70 _actorClipOverride.bottom = pop(); _actorClipOverride.right = pop(); _actorClipOverride.top = pop(); _actorClipOverride.left = pop(); - warning("o6_actorOps: stub case %d", b); - break; - case 64: - // _heversion >= 72 - _actorClipOverride.bottom = pop(); - _actorClipOverride.right = pop(); - _actorClipOverride.top = pop(); - _actorClipOverride.left = pop(); - warning("o6_actorOps: stub case %d", b); break; case 76: // SO_COSTUME a->setActorCostume(pop()); @@ -637,8 +623,7 @@ void ScummEngine_v6he::o6_actorOps() { a->talkColor = pop(); break; case 88: // SO_ACTOR_NAME - copyScriptString(name); - loadPtrToResource(rtActorName, a->number, name); + loadPtrToResource(rtActorName, a->number, NULL); break; case 89: // SO_INIT_ANIMATION a->initFrame = pop(); @@ -1252,7 +1237,6 @@ void ScummEngine_v6he::decodeParseString(int m, int n) { byte b; int i, color; int args[31]; - byte name[1024]; b = fetchScriptByte(); @@ -1304,23 +1288,6 @@ void ScummEngine_v6he::decodeParseString(int m, int n) { _scriptPointer += resStrLen(_scriptPointer) + 1; break; - case 194: // HE 7.2 - decodeScriptString(name, true); - switch (m) { - case 0: - actorTalk(name); - break; - case 1: - drawString(1, name); - break; - case 2: - unkMessage1(name); - break; - case 3: - unkMessage2(name); - break; - } - break; case 0xF9: color = pop(); if (color == 1) { diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 507855c5b6..4351f2df7f 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -242,8 +242,8 @@ void ScummEngine_v72he::setupOpcodes() { OPCODE(o7_resourceRoutines), /* 9C */ OPCODE(o6_roomOps), - OPCODE(o6_actorOps), - OPCODE(o6_verbOps), + OPCODE(o72_actorOps), + OPCODE(o72_verbOps), OPCODE(o6_getActorFromXY), /* A0 */ OPCODE(o6_findObject), @@ -348,7 +348,7 @@ void ScummEngine_v72he::setupOpcodes() { /* F0 */ OPCODE(o6_invalid), OPCODE(o72_unknownF1), - OPCODE(o6_invalid), + OPCODE(o72_unknownF2), OPCODE(o72_readINI), /* F4 */ OPCODE(o72_writeINI), @@ -383,8 +383,6 @@ static int arrayDataSizes[] = {0, 1, 4, 8, 8, 16, 32}; ScummEngine_v72he::ArrayHeader *ScummEngine_v72he::defineArray(int array, int type, int dim2start, int dim2end, int dim1start, int dim1end) { - debug(5,"defineArray (array %d, dim2start %d, dim2end %d dim1start %d dim1end %d", array, dim2start, dim2end, dim1start, dim1end); - int id; int size; ArrayHeader *ah; @@ -401,6 +399,8 @@ ScummEngine_v72he::ArrayHeader *ScummEngine_v72he::defineArray(int array, int ty id = findFreeArrayId(); + debug(5,"defineArray (array %d, dim2start %d, dim2end %d dim1start %d dim1end %d", id, dim2start, dim2end, dim1start, dim1end); + if (array & 0x80000000) { error("Can't define bit variable as array pointer"); } @@ -425,7 +425,7 @@ ScummEngine_v72he::ArrayHeader *ScummEngine_v72he::defineArray(int array, int ty } int ScummEngine_v72he::readArray(int array, int idx2, int idx1) { - debug(5, "readArray (array %d, idx2 %d, idx1 %d)", array, idx2, idx1); + debug(5, "readArray (array %d, idx2 %d, idx1 %d)", readVar(array), idx2, idx1); if (readVar(array) == 0) error("readArray: Reference to zeroed array pointer"); @@ -436,7 +436,7 @@ int ScummEngine_v72he::readArray(int array, int idx2, int idx1) { error("readArray: invalid array %d (%d)", array, readVar(array)); if (idx2 < (int)FROM_LE_32(ah->dim2start) || idx2 > (int)FROM_LE_32(ah->dim2end) || - idx1 < (int)FROM_LE_32(ah->dim2start) || idx1 > (int)FROM_LE_32(ah->dim1end)) { + idx1 < (int)FROM_LE_32(ah->dim1start) || idx1 > (int)FROM_LE_32(ah->dim1end)) { error("readArray: array %d out of bounds: [%d, %d] exceeds [%d..%d, %d..%d]", array, idx1, idx2, FROM_LE_32(ah->dim1start), FROM_LE_32(ah->dim1end), FROM_LE_32(ah->dim2start), FROM_LE_32(ah->dim2end)); @@ -461,7 +461,7 @@ int ScummEngine_v72he::readArray(int array, int idx2, int idx1) { } void ScummEngine_v72he::writeArray(int array, int idx2, int idx1, int value) { - debug(5, "writeArray (array %d, idx2 %d, idx1 %d, value %d)", array, idx2, idx1, value); + debug(5, "writeArray (array %d, idx2 %d, idx1 %d, value %d)", readVar(array), idx2, idx1, value); if (readVar(array) == 0) error("writeArray: Reference to zeroed array pointer"); @@ -513,7 +513,28 @@ void ScummEngine_v72he::readArrayFromIndexFile() { } } -void ScummEngine_v6he::decodeScriptString(byte *dst, bool scriptString) { +int ScummEngine_v72he::copyScriptString(byte *dst) { + int i = 0; + byte b; + + int array = pop(); + if (array == -1) { + int len = resStrLen(_stringBuffer) + 1; + while (len--) + *dst++ = _stringBuffer[i++]; + } else { + writeVar(0, array); + while (b = readArray(0, 0, i) != 0) { + *dst++ = b; + i++; + } + } + *dst = 0; + + return i; +} + +void ScummEngine_v72he::decodeScriptString(byte *dst, bool scriptString) { int args[31]; int num = 0, val = 0; int len; @@ -530,10 +551,6 @@ void ScummEngine_v6he::decodeScriptString(byte *dst, bool scriptString) { len = copyScriptString(name); } - //FIXME Bad pop/push somewhere ? - if (len == -1) - return; - while (len--) { chr = name[num++]; if (chr == 0x25) { @@ -835,6 +852,304 @@ void ScummEngine_v72he::o72_pickupObject() { runInventoryScript(obj); } +void ScummEngine_v72he::o72_actorOps() { + Actor *a; + int i, j, k; + int args[32]; + byte b; + byte name[256]; + + b = fetchScriptByte(); + if (b == 197) { + _curActor = pop(); + return; + } + + a = derefActorSafe(_curActor, "o6_actorOps"); + if (!a) + return; + + switch (b) { + case 21: + // HE 7.3 (Pajama Sam onwards) + k = getStackList(args, ARRAYSIZE(args)); + break; + case 64: + _actorClipOverride.bottom = pop(); + _actorClipOverride.right = pop(); + _actorClipOverride.top = pop(); + _actorClipOverride.left = pop(); + break; + case 76: // SO_COSTUME + a->setActorCostume(pop()); + break; + case 77: // SO_STEP_DIST + j = pop(); + i = pop(); + a->setActorWalkSpeed(i, j); + break; + case 78: // SO_SOUND + k = getStackList(args, ARRAYSIZE(args)); + for (i = 0; i < k; i++) + a->sound[i] = args[i]; + break; + case 79: // SO_WALK_ANIMATION + a->walkFrame = pop(); + break; + case 80: // SO_TALK_ANIMATION + a->talkStopFrame = pop(); + a->talkStartFrame = pop(); + break; + case 81: // SO_STAND_ANIMATION + a->standFrame = pop(); + break; + case 82: // SO_ANIMATION + // dummy case in scumm6 + pop(); + pop(); + pop(); + break; + case 83: // SO_DEFAULT + a->initActor(0); + break; + case 84: // SO_ELEVATION + a->setElevation(pop()); + break; + case 85: // SO_ANIMATION_DEFAULT + a->initFrame = 1; + a->walkFrame = 2; + a->standFrame = 3; + a->talkStartFrame = 4; + a->talkStopFrame = 5; + break; + case 86: // SO_PALETTE + j = pop(); + i = pop(); + checkRange(255, 0, i, "Illegal palette slot %d"); + a->remapActorPaletteColor(i, j); + break; + case 87: // SO_TALK_COLOR + a->talkColor = pop(); + break; + case 88: // SO_ACTOR_NAME + copyScriptString(name); + loadPtrToResource(rtActorName, a->number, name); + break; + case 89: // SO_INIT_ANIMATION + a->initFrame = pop(); + break; + case 91: // SO_ACTOR_WIDTH + a->width = pop(); + break; + case 92: // SO_SCALE + i = pop(); + a->setScale(i, i); + break; + case 93: // SO_NEVER_ZCLIP + a->forceClip = 0; + break; + case 94: // SO_ALWAYS_ZCLIP + a->forceClip = pop(); + break; + case 95: // SO_IGNORE_BOXES + a->ignoreBoxes = 1; + a->forceClip = 0; + if (a->isInCurrentRoom()) + a->putActor(a->_pos.x, a->_pos.y, a->room); + break; + case 96: // SO_FOLLOW_BOXES + a->ignoreBoxes = 0; + a->forceClip = 0; + if (a->isInCurrentRoom()) + a->putActor(a->_pos.x, a->_pos.y, a->room); + break; + case 97: // SO_ANIMATION_SPEED + a->setAnimSpeed(pop()); + break; + case 98: // SO_SHADOW + a->shadow_mode = pop(); + break; + case 99: // SO_TEXT_OFFSET + a->talkPosY = pop(); + a->talkPosX = pop(); + break; + case 156: // HE 7.2 + a->charset = pop(); + break; + case 198: // SO_ACTOR_VARIABLE + i = pop(); + a->setAnimVar(pop(), i); + break; + case 215: // SO_ACTOR_IGNORE_TURNS_ON + a->ignoreTurns = true; + break; + case 216: // SO_ACTOR_IGNORE_TURNS_OFF + a->ignoreTurns = false; + break; + case 217: // SO_ACTOR_NEW + a->initActor(2); + break; + case 218: + { + int top_actor = a->top; + int bottom_actor = a->bottom; + a->drawToBackBuf = true; + a->needRedraw = true; + a->drawActorCostume(); + a->drawToBackBuf = false; + a->needRedraw = true; + a->drawActorCostume(); + a->needRedraw = false; + + if (a->top > top_actor) + a->top = top_actor; + if (a->bottom < bottom_actor) + a->bottom = bottom_actor; + + } + break; + case 219: + a->drawToBackBuf = false; + a->needRedraw = true; + a->needBgReset = true; + break; + case 225: + { + byte string[128]; + copyScriptString(string); + int slot = pop(); + + int len = resStrLen(string) + 1; + addMessageToStack(string, _queueTalkString[slot], len); + + _queueTalkPosX[slot] = a->talkPosX; + _queueTalkPosY[slot] = a->talkPosY; + _queueTalkColor[slot] = a->talkColor; + break; + } + default: + error("o72_actorOps: default case %d", b); + } +} + +void ScummEngine_v72he::o72_verbOps() { + int slot, a, b; + VerbSlot *vs; + byte op; + byte name[200]; + + op = fetchScriptByte(); + if (op == 196) { + _curVerb = pop(); + _curVerbSlot = getVerbSlot(_curVerb, 0); + checkRange(_numVerbs - 1, 0, _curVerbSlot, "Illegal new verb slot %d"); + return; + } + vs = &_verbs[_curVerbSlot]; + slot = _curVerbSlot; + switch (op) { + case 124: // SO_VERB_IMAGE + a = pop(); + if (_curVerbSlot) { + setVerbObject(_roomResource, a, slot); + vs->type = kImageVerbType; + vs->imgindex = a; + } + break; + case 125: // SO_VERB_NAME + copyScriptString(name); + loadPtrToResource(rtVerb, slot, name); + vs->type = kTextVerbType; + vs->imgindex = 0; + break; + case 126: // SO_VERB_COLOR + vs->color = pop(); + break; + case 127: // SO_VERB_HICOLOR + vs->hicolor = pop(); + break; + case 128: // SO_VERB_AT + vs->curRect.top = pop(); + vs->curRect.left = pop(); + break; + case 129: // SO_VERB_ON + vs->curmode = 1; + break; + case 130: // SO_VERB_OFF + vs->curmode = 0; + break; + case 131: // SO_VERB_DELETE + slot = getVerbSlot(pop(), 0); + killVerb(slot); + break; + case 132: // SO_VERB_NEW + slot = getVerbSlot(_curVerb, 0); + if (slot == 0) { + for (slot = 1; slot < _numVerbs; slot++) { + if (_verbs[slot].verbid == 0) + break; + } + if (slot == _numVerbs) + error("Too many verbs"); + _curVerbSlot = slot; + } + vs = &_verbs[slot]; + vs->verbid = _curVerb; + vs->color = 2; + vs->hicolor = 0; + vs->dimcolor = 8; + vs->type = kTextVerbType; + vs->charset_nr = _string[0]._default.charset; + vs->curmode = 0; + vs->saveid = 0; + vs->key = 0; + vs->center = 0; + vs->imgindex = 0; + break; + case 133: // SO_VERB_DIMCOLOR + vs->dimcolor = pop(); + break; + case 134: // SO_VERB_DIM + vs->curmode = 2; + break; + case 135: // SO_VERB_KEY + vs->key = pop(); + break; + case 136: // SO_VERB_CENTER + vs->center = 1; + break; + case 137: // SO_VERB_NAME_STR + a = pop(); + if (a == 0) { + loadPtrToResource(rtVerb, slot, (const byte *)""); + } else { + loadPtrToResource(rtVerb, slot, getStringAddress(a)); + } + vs->type = kTextVerbType; + vs->imgindex = 0; + break; + case 139: // SO_VERB_IMAGE_IN_ROOM + b = pop(); + a = pop(); + + if (slot && a != vs->imgindex) { + setVerbObject(b, a, slot); + vs->type = kImageVerbType; + vs->imgindex = a; + } + break; + case 140: // SO_VERB_BAKCOLOR + vs->bkcolor = pop(); + break; + case 255: + drawVerb(slot, 0); + verbMouseOver(0); + break; + default: + error("o72_verbops: default case %d", op); + } +} + void ScummEngine_v72he::o72_arrayOps() { byte subOp = fetchScriptByte(); int array = fetchScriptWord(); @@ -1107,7 +1422,7 @@ void ScummEngine_v72he::o72_openFile() { byte filename[100]; mode = pop(); - copyScriptString(filename, true); + copyScriptString(filename); debug(1,"File %s", filename); for (r = strlen((char*)filename); r != 0; r--) { @@ -1312,6 +1627,7 @@ void ScummEngine_v72he::o72_pickVarRandom() { } void ScummEngine_v72he::o72_redimArray() { + printf("o72_redimArray\n"); int subcode, newX, newY; newY = pop(); newX = pop(); @@ -1439,6 +1755,13 @@ void ScummEngine_v72he::o72_unknownF1() { push(-1); } +void ScummEngine_v72he::o72_unknownF2() { + int a = pop(); + int b = pop(); + debug(1,"o7_unknownF2 stub (%d, %d)", b, a); + push(-1); +} + void ScummEngine_v72he::o72_readINI() { byte option[100]; int type, retval; @@ -1473,14 +1796,15 @@ void ScummEngine_v72he::o72_writeINI() { byte option[256], option2[1024]; type = fetchScriptByte(); - copyScriptString(option); switch (type) { case 6: // number value = pop(); - break; + copyScriptString(option); debug(1,"o72_writeINI: %s set to %d", option, value); + break; case 7: // string + copyScriptString(option); copyScriptString(option2); debug(1,"o72_writeINI: %s set to %s", option, option2); break; @@ -1561,9 +1885,9 @@ void ScummEngine_v72he::o72_unknownF8() { void ScummEngine_v72he::o72_unknownF9() { // File related - //byte filename[100]; - //copyScriptString(filename); - //debug(1,"o72_unknownF9: %s", filename); + byte filename[100]; + copyScriptString(filename); + debug(1,"o72_unknownF9: %s", filename); } void ScummEngine_v72he::o72_unknownFA() { @@ -1599,4 +1923,102 @@ void ScummEngine_v72he::o72_unknownFB() { debug(1, "o72_unknownFB stub"); } +void ScummEngine_v72he::decodeParseString(int m, int n) { + byte b; + int i, color; + int args[31]; + byte name[1024]; + + b = fetchScriptByte(); + + switch (b) { + case 65: // SO_AT + _string[m].ypos = pop(); + _string[m].xpos = pop(); + _string[m].overhead = false; + break; + case 66: // SO_COLOR + _string[m].color = pop(); + break; + case 67: // SO_CLIPPED + _string[m].right = pop(); + break; + case 69: // SO_CENTER + _string[m].center = true; + _string[m].overhead = false; + break; + case 71: // SO_LEFT + _string[m].center = false; + _string[m].overhead = false; + break; + case 72: // SO_OVERHEAD + _string[m].overhead = true; + _string[m].no_talk_anim = false; + break; + case 73: // SO_SAY_VOICE + error("decodeParseString: case 73"); + break; + case 74: // SO_MUMBLE + _string[m].no_talk_anim = true; + break; + case 75: // SO_TEXTSTRING + switch (m) { + case 0: + actorTalk(_scriptPointer); + break; + case 1: + drawString(1, _scriptPointer); + break; + case 2: + unkMessage1(_scriptPointer); + break; + case 3: + unkMessage2(_scriptPointer); + break; + } + _scriptPointer += resStrLen(_scriptPointer) + 1; + + break; + case 194: + decodeScriptString(name, true); + switch (m) { + case 0: + actorTalk(name); + break; + case 1: + drawString(1, name); + break; + case 2: + unkMessage1(name); + break; + case 3: + unkMessage2(name); + break; + } + break; + case 0xF9: + color = pop(); + if (color == 1) { + _string[m].color = pop(); + } else { + push(color); + getStackList(args, ARRAYSIZE(args)); + for (i = 0; i < 16; i++) + _charsetColorMap[i] = _charsetData[_string[1]._default.charset][i] = (unsigned char)args[i]; + _string[m].color = color; + } + break; + case 0xFE: + _string[m].loadDefault(); + if (n) + _actorToPrintStrFor = pop(); + break; + case 0xFF: + _string[m].saveDefault(); + break; + default: + error("decodeParseString: default case 0x%x", b); + } +} + } // End of namespace Scumm diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 3fd9ea8a79..1fb63414a9 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -812,6 +812,8 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS VAR_NUM_IMAGES = 0xFF; VAR_NUM_CHARSETS = 0xFF; VAR_NUM_GLOBAL_OBJS = 0xFF; + VAR_NUM_SOUND_CHANNELS = 0xFF; + VAR_WINDOWS_VERSION = 0xFF; // Use g_scumm from error() ONLY g_scumm = this; @@ -1394,20 +1396,21 @@ void ScummEngine::initScummVars() { } else if (_version >= 7) { VAR(VAR_V6_EMSSPACE) = 10000; VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1; - } else if (_heversion >= 71) { - // TODO - - // Set amount of sound channels - VAR(9) = 8; - if (_heversion >= 72) { - VAR(VAR_NUM_ROOMS) = _numRooms - 1; - VAR(VAR_NUM_SCRIPTS) = _numScripts - 1; - VAR(VAR_NUM_SOUNDS) = _numSounds - 1; - VAR(VAR_NUM_COSTUMES) = _numCostumes - 1; - VAR(VAR_NUM_IMAGES) = _numImages - 1; - VAR(VAR_NUM_CHARSETS) = _numCharsets - 1; - VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1; - } + } else if (_heversion >= 72) { + VAR(VAR_NUM_SOUND_CHANNELS) = 3; + + VAR(VAR_NUM_ROOMS) = _numRooms - 1; + VAR(VAR_NUM_SCRIPTS) = _numScripts - 1; + VAR(VAR_NUM_SOUNDS) = _numSounds - 1; + VAR(VAR_NUM_COSTUMES) = _numCostumes - 1; + VAR(VAR_NUM_IMAGES) = _numImages - 1; + VAR(VAR_NUM_CHARSETS) = _numCharsets - 1; + VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1; + + if (_heversion >= 80) + VAR(VAR_WINDOWS_VERSION) = 40; + } else if (_heversion >= 70) { + VAR(VAR_NUM_SOUND_CHANNELS) = 3; } else { VAR(VAR_CURRENTDRIVE) = 0; switch (_midiDriver) { diff --git a/scumm/scumm.h b/scumm/scumm.h index e70bea5247..6b54b1387c 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -623,7 +623,7 @@ protected: void beginOverride(); void endOverride(); - int copyScriptString(byte *dst, bool override = false); + void copyScriptString(byte *dst); int resStrLen(const byte *src) const; void doSentence(int c, int b, int a); @@ -1303,6 +1303,8 @@ public: byte VAR_NUM_IMAGES; byte VAR_NUM_CHARSETS; byte VAR_NUM_GLOBAL_OBJS; + byte VAR_NUM_SOUND_CHANNELS; + byte VAR_WINDOWS_VERSION; }; // This is a constant lookup table of reverse bit masks diff --git a/scumm/vars.cpp b/scumm/vars.cpp index 44a7ba9462..476863dad4 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -166,7 +166,10 @@ void ScummEngine_v6::setupScummVars() { VAR_V6_EMSSPACE = 76; VAR_RANDOM_NR = 118; - VAR_V6_SOUNDMODE = 9; + if (_heversion >= 70) + VAR_NUM_SOUND_CHANNELS = 9; + else + VAR_V6_SOUNDMODE = 9; VAR_TIMEDATE_YEAR = 119; VAR_TIMEDATE_MONTH = 129; @@ -229,6 +232,7 @@ void ScummEngine_v72he::setupScummVars() { VAR_SOUNDPARAM = 51; VAR_MUSIC_TIMER = 52; + VAR_NUM_SOUND_CHANNELS = 56; VAR_MEMORY_PERFORMANCE = 57; VAR_VIDEO_PERFORMANCE = 58; VAR_NEW_ROOM = 59; @@ -249,6 +253,9 @@ void ScummEngine_v72he::setupScummVars() { VAR_NUM_CHARSETS = 73; VAR_NUM_GLOBAL_OBJS = 74; + if (_heversion >= 80) { + VAR_WINDOWS_VERSION = 79; + } } void ScummEngine_v7::setupScummVars() { |