void AGOSEngine::vc68_ifGE() { uint16 a = vcReadNextWord(); uint16 b = vcReadNextWord(); if (vcReadVar(a) <= vcReadVar(b)) vcSkipNextInstruction(); }
void AGOSEngine::vc83_playSoundLoop() { uint16 sound = vcReadNextWord(); int16 vol = vcReadNextWord(); int16 pan = vcReadNextWord(); loadSound(sound, pan, vol, Sound::TYPE_SFX5); }
void AGOSEngine::vc66_ifEqual() { uint16 a = vcReadNextWord(); uint16 b = vcReadNextWord(); if (vcReadVar(a) != vcReadVar(b)) vcSkipNextInstruction(); }
void AGOSEngine::vc59_stopAnimations() { uint16 file = vcReadNextWord(); uint16 start = vcReadNextWord(); uint16 end = vcReadNextWord() + 1; do { vcStopAnimation(file, start); } while (++start != end); }
void AGOSEngine::vc80_setOverlayImage() { VgaSprite *vsp = findCurSprite(); vsp->image = vcReadVarOrWord(); vsp->x += vcReadNextWord(); vsp->y += vcReadNextWord(); vsp->flags = kDFOverlayed; _vgaSpriteChanged++; }
void AGOSEngine::vc61_setMaskImage() { VgaSprite *vsp = findCurSprite(); vsp->image = vcReadVarOrWord(); vsp->x += vcReadNextWord(); vsp->y += vcReadNextWord(); vsp->flags = kDFMasked | kDFSkipStoreBG; vsp->windowNum |= 0x8000; dirtyBackGround(); _vgaSpriteChanged++; }
void AGOSEngine::vc70_joinSeq() { // Simon2 uint16 track = vcReadNextWord(); uint16 loop = vcReadNextWord(); // Jamieson630: // This sets the "on end of track" action. // It specifies whether to loop the current // track and, if not, whether to switch to // a different track upon completion. if (track != 0xFFFF && track != 999) _midi->queueTrack(track, loop != 0); else _midi->setLoop(loop != 0); }
void AGOSEngine::vc77_setScaleYOffs() { VgaSprite *vsp = findCurSprite(); vsp->image = vcReadNextWord(); int16 y = vcReadNextWord(); uint16 var = vcReadNextWord(); vsp->y += getScale(vsp->y, y); _variableArrayPtr[var] = vsp->y; if (y != 0) checkScrollY(y, vsp->y); vsp->flags = kDFScaled; }
void AGOSEngine_Simon1::vc22_setPalette() { byte *offs, *palptr = 0, *src; uint16 a = 0, b, num, palSize = 0; a = vcReadNextWord(); b = vcReadNextWord(); if (getGameType() == GType_FF || getGameType() == GType_PP) { num = 256; palSize = 768; palptr = _displayPalette; } else { num = a == 0 ? 32 : 16; palSize = 96; palptr = &_displayPalette[(a * 64)]; } offs = _curVgaFile1 + 6; src = offs + b * palSize; do { palptr[0] = src[0] * 4; palptr[1] = src[1] * 4; palptr[2] = src[2] * 4; palptr[3] = 0; palptr += 4; src += 3; } while (--num); if (getFeatures() & GF_32COLOR) { // Custom palette used for verb area palptr = &_displayPalette[(13 * 64)]; for (uint8 c = 0; c < 32; c++) { palptr[0] = customPalette[c * 3 + 0]; palptr[1] = customPalette[c * 3 + 1]; palptr[2] = customPalette[c * 3 + 2]; palptr[3] = 0; palptr += 4; }; } _paletteFlag = 2; _vgaSpriteChanged++; }
void AGOSEngine::vc60_stopAnimation() { uint16 sprite, zoneNum; if (getGameType() == GType_PP) { zoneNum = vcReadNextWord(); sprite = vcReadVarOrWord(); } else if (getGameType() == GType_SIMON2 || getGameType() == GType_FF) { zoneNum = vcReadNextWord(); sprite = vcReadNextWord(); } else { sprite = vcReadNextWord(); zoneNum = sprite / 100; } vcStopAnimation(zoneNum, sprite); }
void AGOSEngine::vc46_setSpriteY() { VgaSprite *vsp = findCurSprite(); vsp->y = vcReadVar(vcReadNextWord()); vsp->windowNum |= 0x8000; dirtyBackGround(); _vgaSpriteChanged++; }
void AGOSEngine::vc61() { uint16 a = vcReadNextWord(); byte *src, *dst, *dstPtr; uint h, tmp; Graphics::Surface *screen = _system->lockScreen(); dstPtr = (byte *)screen->pixels; if (a == 6) { src = _curVgaFile2 + 800; dst = dstPtr; for (int i = 0; i < _screenHeight; i++) { memcpy(dst, src, _screenWidth); src += 320; dst += screen->pitch; } tmp = 4 - 1; } else { tmp = a - 1; } src = _curVgaFile2 + 3840 * 16 + 3360; while (tmp--) src += 1536 * 16 + 1712; src += 800; if (a != 5) { dst = dstPtr + 23 * screen->pitch + 88; for (h = 0; h < 177; h++) { memcpy(dst, src, 144); src += 144; dst += screen->pitch; } if (a != 6) { _system->unlockScreen(); return; } src = _curVgaFile2 + 9984 * 16 + 15344; } dst = dstPtr + 157 * screen->pitch + 56; for (h = 0; h < 17; h++) { memcpy(dst, src, 208); src += 208; dst += screen->pitch; } _system->unlockScreen(); if (a == 6) fullFade(); }
void AGOSEngine::vc17_setPathfinderItem() { uint16 a = vcReadNextWord(); _pathFindArray[a - 1] = (const uint16 *)_vcPtr; int end = (getGameType() == GType_FF || getGameType() == GType_PP) ? 9999 : 999; while (readUint16Wrapper(_vcPtr) != end) _vcPtr += 4; _vcPtr += 2; }
void AGOSEngine::vc58_changePriority() { uint16 sprite = _vgaCurSpriteId; uint16 file = _vgaCurZoneNum; const byte *vcPtrOrg; uint16 tmp; _vgaCurZoneNum = vcReadNextWord(); _vgaCurSpriteId = vcReadNextWord(); tmp = to16Wrapper(vcReadNextWord()); vcPtrOrg = _vcPtr; _vcPtr = (byte *)&tmp; vc23_setPriority(); _vcPtr = vcPtrOrg; _vgaCurSpriteId = sprite; _vgaCurZoneNum = file; }
void AGOSEngine::vc69_playSeq() { int16 track = vcReadNextWord(); int16 loop = vcReadNextWord(); // Jamieson630: // This is a "play track". The original // design stored the track to play if one was // already in progress, so that the next time a // "fill MIDI stream" event occurred, the MIDI // player would find the change and switch // tracks. We use a different architecture that // allows for an immediate response here, but // we'll simulate the variable changes so other // scripts don't get thrown off. // NOTE: This opcode looks very similar in function // to vc72(), except that vc72() may allow for // specifying a non-valid track number (999 or -1) // as a means of stopping what music is currently // playing. _midi->setLoop(loop != 0); _midi->startTrack(track); }
void AGOSEngine::vc82_getPathValue() { uint8 val; uint16 var = vcReadNextWord(); if (getGameType() == GType_FF && getBitFlag(82)) { val = _pathValues1[_GPVCount1++]; } else { val = _pathValues[_GPVCount++]; } vcWriteVar(var, val); }
void AGOSEngine::vc76_setScaleXOffs() { if (getGameType() == GType_PP && getBitFlag(120)) { VgaSprite *vsp1, *vsp2; uint16 old_file_1, tmp1, tmp2; old_file_1 = _vgaCurSpriteId; _vgaCurSpriteId = vcReadVar(vcReadNextWord()); vsp1 = findCurSprite(); _vgaCurSpriteId = vcReadVar(vcReadNextWord()); vsp2 = findCurSprite(); tmp1 = vsp1->x; tmp2 = vsp2->x; vsp1->x = tmp2; vsp2->x = tmp1; tmp1 = vsp1->y; tmp2 = vsp2->y; vsp1->y = tmp2; vsp2->y = tmp1; _vgaCurSpriteId = old_file_1; _vcPtr += 2; } else { VgaSprite *vsp = findCurSprite(); vsp->image = vcReadNextWord(); int16 x = vcReadNextWord(); uint16 var = vcReadNextWord(); vsp->x += getScale(vsp->y, x); _variableArrayPtr[var] = vsp->x; checkScrollX(x, vsp->x); vsp->flags = kDFScaled; } }
void AGOSEngine::vc72_segue() { // Jamieson630: // This is a "play or stop track". Note that // this opcode looks very similar in function // to vc69(), except that this opcode may allow // for specifying a track of 999 or -1 in order to // stop the music. We'll code it that way for now. // NOTE: It's possible that when "stopping" a track, // we're supposed to just go on to the next queued // track, if any. Must find out if there is ANY // case where this is used to stop a track in the // first place. int16 track = vcReadNextWord(); int16 loop = vcReadNextWord(); if (track == -1 || track == 999) { stopMusic(); } else { _midi->setLoop(loop != 0); _midi->startTrack(track); } }
void AGOSEngine::vc48_specialEffect() { uint16 num = vcReadNextWord(); vcReadNextWord(); if (getPlatform() == Common::kPlatformPC) { if (num == 1) { Graphics::Surface *screen = _system->lockScreen(); byte *dst = (byte *)screen->pixels; for (uint h = 0; h < _screenHeight; h++) { for (uint w = 0; w < _screenWidth; w++) { if (dst[w] == 15) dst[w] = 4; } dst += screen->pitch; } _system->unlockScreen(); } else if (num == 2) { const char *str = "There are gurgling noises from the sink."; for (; *str; str++) windowPutChar(_textWindow, *str); } } }
void AGOSEngine_PuzzlePack::startAnOverlayAnim() { VgaSprite *vsp = _vgaSprites; const byte *vcPtrOrg; uint16 a, sprite, file, tmp, zoneNum; int16 x; zoneNum = _variableArray[999]; _vcPtr += 4; a = vcReadNextWord(); _vcPtr += 6; while (vsp->id) vsp++; vsp->windowNum = 4; vsp->priority = 20; vsp->flags = 0; vsp->palette = 0; vsp->image = vcReadVar(vcReadVar(a)); x = vcReadVar(a) - 1300; if (x < 0) { x += 300; vsp->priority = 10; } vsp->y = x / 20 * 32; vsp->x = x % 20 * 32; vsp->id = vcReadVar(a); vsp->zoneNum = zoneNum; sprite = _vgaCurSpriteId; file = _vgaCurZoneNum; _vgaCurZoneNum = vsp->zoneNum; _vgaCurSpriteId = vsp->id; tmp = to16Wrapper(vsp->priority); vcPtrOrg = _vcPtr; _vcPtr = (byte *)&tmp; vc23_setPriority(); _vcPtr = vcPtrOrg; _vgaCurSpriteId = sprite; _vgaCurZoneNum = file; }
void AGOSEngine::vc50_setBox() { uint16 id, x, y, w, h, msg1, msg2, flags; const uint16 *vlut; id = vcReadNextWord(); vlut = &_videoWindows[vcReadNextWord() * 4]; x = vlut[0] * 16 + vcReadNextWord(); y = vlut[1] + vcReadNextWord(); h = vcReadNextWord(); w = vcReadNextWord(); msg1 = vcReadNextWord(); msg2 = vcReadNextWord(); flags = vcReadNextWord(); // Compressed string if (!(flags & kOBFUseMessageList)) { msg1 += 0x8000; } defineBox(id, x, y, h, w, msg1, msg2, flags); }
void AGOSEngine::vc73_setMark() { _marks |= (1 << vcReadNextWord()); }
void AGOSEngine::vc81_setRandom() { uint16 var = vcReadNextWord(); uint16 value = vcReadNextWord(); _variableArray[var] = _rnd.getRandomNumber(value - 1); }
void AGOSEngine::vc45_disableBox() { HitArea *ha = _hitAreas + vcReadNextWord(); ha->flags |= kOBFBoxDisabled; }
void AGOSEngine::vc46_maxBox() { HitArea *ha = _hitAreas + vcReadNextWord(); ha->id = 0xFFFF; }
void AGOSEngine::vc74_clearMark() { _marks &= ~(1 << vcReadNextWord()); }
void AGOSEngine::vc75_setScale() { _baseY = vcReadNextWord(); _scale = vcReadNextWord() / 1000000.0f; }
void AGOSEngine_Feeble::vc36_setWindowImage() { _displayFlag = 0; vcReadNextWord(); vcReadNextWord(); fillBackGroundFromFront(); }
void AGOSEngine::vc47_addToVar() { uint16 var = vcReadNextWord(); vcWriteVar(var, vcReadVar(var) + vcReadVar(vcReadNextWord())); }
void AGOSEngine::vc32_copyVar() { uint16 a = vcReadVar(vcReadNextWord()); vcWriteVar(vcReadNextWord(), a); }