2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-10-27 12:55:48 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2014-02-18 01:34:17 +00:00
|
|
|
*
|
2006-10-27 12:55:48 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2014-02-18 01:34:17 +00:00
|
|
|
*
|
2006-10-27 12:55:48 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Video script opcodes for Simon1/Simon2
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
|
|
|
|
#include "agos/agos.h"
|
|
|
|
#include "agos/intern.h"
|
|
|
|
|
|
|
|
#include "common/system.h"
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
#include "graphics/surface.h"
|
2011-04-24 08:34:27 +00:00
|
|
|
#include "graphics/palette.h"
|
2007-06-21 03:14:20 +00:00
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
namespace AGOS {
|
|
|
|
|
2007-04-15 05:04:48 +00:00
|
|
|
void AGOSEngine_Waxworks::setupVideoOpcodes(VgaOpcodeProc *op) {
|
|
|
|
AGOSEngine_Elvira2::setupVideoOpcodes(op);
|
2006-10-27 12:55:48 +00:00
|
|
|
|
|
|
|
op[58] = &AGOSEngine::vc58_checkCodeWheel;
|
|
|
|
op[60] = &AGOSEngine::vc60_stopAnimation;
|
|
|
|
op[61] = &AGOSEngine::vc61;
|
|
|
|
op[62] = &AGOSEngine::vc62_fastFadeOut;
|
|
|
|
op[63] = &AGOSEngine::vc63_fastFadeIn;
|
|
|
|
}
|
|
|
|
|
2007-06-21 05:26:47 +00:00
|
|
|
void AGOSEngine::vcStopAnimation(uint16 zone, uint16 sprite) {
|
|
|
|
uint16 oldCurSpriteId, oldCurZoneNum;
|
2007-06-02 13:35:24 +00:00
|
|
|
VgaSprite *vsp;
|
|
|
|
VgaTimerEntry *vte;
|
|
|
|
const byte *vcPtrOrg;
|
|
|
|
|
2007-06-21 05:26:47 +00:00
|
|
|
oldCurSpriteId = _vgaCurSpriteId;
|
|
|
|
oldCurZoneNum = _vgaCurZoneNum;
|
2007-06-02 13:35:24 +00:00
|
|
|
vcPtrOrg = _vcPtr;
|
|
|
|
|
2007-06-21 05:26:47 +00:00
|
|
|
_vgaCurZoneNum = zone;
|
2007-06-02 13:35:24 +00:00
|
|
|
_vgaCurSpriteId = sprite;
|
|
|
|
|
|
|
|
vsp = findCurSprite();
|
|
|
|
if (vsp->id) {
|
|
|
|
vc25_halt_sprite();
|
|
|
|
|
|
|
|
vte = _vgaTimerList;
|
|
|
|
while (vte->delay) {
|
2009-02-07 01:11:51 +00:00
|
|
|
if (vte->id == _vgaCurSpriteId && vte->zoneNum == _vgaCurZoneNum) {
|
2007-06-02 13:35:24 +00:00
|
|
|
deleteVgaEvent(vte);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
vte++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-21 05:26:47 +00:00
|
|
|
_vgaCurZoneNum = oldCurZoneNum;
|
|
|
|
_vgaCurSpriteId = oldCurSpriteId;
|
2007-06-02 13:35:24 +00:00
|
|
|
_vcPtr = vcPtrOrg;
|
|
|
|
}
|
|
|
|
|
2007-06-21 05:26:47 +00:00
|
|
|
void AGOSEngine_Simon1::vcStopAnimation(uint16 zone, uint16 sprite) {
|
|
|
|
uint16 oldCurSpriteId, oldCurZoneNum;
|
2006-10-27 12:55:48 +00:00
|
|
|
VgaSleepStruct *vfs;
|
|
|
|
VgaSprite *vsp;
|
|
|
|
VgaTimerEntry *vte;
|
|
|
|
const byte *vcPtrOrg;
|
|
|
|
|
2007-06-21 05:26:47 +00:00
|
|
|
oldCurSpriteId = _vgaCurSpriteId;
|
|
|
|
oldCurZoneNum = _vgaCurZoneNum;
|
2006-10-27 12:55:48 +00:00
|
|
|
vcPtrOrg = _vcPtr;
|
|
|
|
|
2007-06-02 13:35:24 +00:00
|
|
|
_vgaCurZoneNum = zone;
|
2006-10-27 12:55:48 +00:00
|
|
|
_vgaCurSpriteId = sprite;
|
|
|
|
|
|
|
|
vfs = _waitSyncTable;
|
|
|
|
while (vfs->ident != 0) {
|
2009-02-07 01:11:51 +00:00
|
|
|
if (vfs->id == _vgaCurSpriteId && vfs->zoneNum == _vgaCurZoneNum) {
|
2006-10-27 12:55:48 +00:00
|
|
|
while (vfs->ident != 0) {
|
|
|
|
memcpy(vfs, vfs + 1, sizeof(VgaSleepStruct));
|
|
|
|
vfs++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
vfs++;
|
|
|
|
}
|
|
|
|
|
|
|
|
vsp = findCurSprite();
|
|
|
|
if (vsp->id) {
|
|
|
|
vc25_halt_sprite();
|
|
|
|
|
|
|
|
vte = _vgaTimerList;
|
2007-05-13 08:46:48 +00:00
|
|
|
while (vte->delay) {
|
2009-02-07 01:11:51 +00:00
|
|
|
if (vte->id == _vgaCurSpriteId && vte->zoneNum == _vgaCurZoneNum) {
|
2006-10-27 12:55:48 +00:00
|
|
|
deleteVgaEvent(vte);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
vte++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-21 05:26:47 +00:00
|
|
|
_vgaCurZoneNum = oldCurZoneNum;
|
|
|
|
_vgaCurSpriteId = oldCurSpriteId;
|
2006-10-27 12:55:48 +00:00
|
|
|
_vcPtr = vcPtrOrg;
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
2007-06-19 11:50:22 +00:00
|
|
|
zoneNum = sprite / 100;
|
2006-10-27 12:55:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
vcStopAnimation(zoneNum, sprite);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::vc61() {
|
|
|
|
uint16 a = vcReadNextWord();
|
|
|
|
byte *src, *dst, *dstPtr;
|
|
|
|
uint h, tmp;
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
Graphics::Surface *screen = _system->lockScreen();
|
2013-08-03 00:36:55 +00:00
|
|
|
dstPtr = (byte *)screen->getPixels();
|
2007-06-21 03:14:20 +00:00
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
if (a == 6) {
|
|
|
|
src = _curVgaFile2 + 800;
|
2009-07-08 01:07:41 +00:00
|
|
|
dst = dstPtr;
|
2009-07-06 06:21:59 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < _screenHeight; i++) {
|
|
|
|
memcpy(dst, src, _screenWidth);
|
|
|
|
src += 320;
|
|
|
|
dst += screen->pitch;
|
|
|
|
}
|
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
tmp = 4 - 1;
|
|
|
|
} else {
|
|
|
|
tmp = a - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
src = _curVgaFile2 + 3840 * 16 + 3360;
|
|
|
|
while (tmp--)
|
|
|
|
src += 1536 * 16 + 1712;
|
|
|
|
|
|
|
|
src += 800;
|
|
|
|
|
|
|
|
if (a != 5) {
|
2009-07-06 06:21:59 +00:00
|
|
|
dst = dstPtr + 23 * screen->pitch + 88;
|
2006-10-27 12:55:48 +00:00
|
|
|
for (h = 0; h < 177; h++) {
|
|
|
|
memcpy(dst, src, 144);
|
|
|
|
src += 144;
|
2009-07-06 06:21:59 +00:00
|
|
|
dst += screen->pitch;
|
2006-10-27 12:55:48 +00:00
|
|
|
}
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
if (a != 6) {
|
|
|
|
_system->unlockScreen();
|
2006-10-27 12:55:48 +00:00
|
|
|
return;
|
2007-06-21 03:14:20 +00:00
|
|
|
}
|
2006-10-27 12:55:48 +00:00
|
|
|
|
|
|
|
src = _curVgaFile2 + 9984 * 16 + 15344;
|
|
|
|
}
|
|
|
|
|
2009-07-06 06:21:59 +00:00
|
|
|
dst = dstPtr + 157 * screen->pitch + 56;
|
2006-10-27 12:55:48 +00:00
|
|
|
for (h = 0; h < 17; h++) {
|
|
|
|
memcpy(dst, src, 208);
|
|
|
|
src += 208;
|
2009-07-06 06:21:59 +00:00
|
|
|
dst += screen->pitch;
|
2006-10-27 12:55:48 +00:00
|
|
|
}
|
|
|
|
|
2007-06-21 03:14:20 +00:00
|
|
|
_system->unlockScreen();
|
|
|
|
|
2009-07-21 10:37:58 +00:00
|
|
|
if (a == 6)
|
|
|
|
fullFade();
|
2006-10-27 12:55:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::vc62_fastFadeOut() {
|
|
|
|
vc29_stopAllSounds();
|
|
|
|
|
|
|
|
if (!_fastFadeOutFlag) {
|
|
|
|
uint i, fadeSize, fadeCount;
|
|
|
|
|
|
|
|
_fastFadeCount = 256;
|
|
|
|
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
|
|
|
|
if (_windowNum == 4)
|
|
|
|
_fastFadeCount = 208;
|
|
|
|
}
|
|
|
|
|
2007-05-15 11:32:11 +00:00
|
|
|
if (getGameType() == GType_FF || getGameType() == GType_PP) {
|
2007-05-17 09:00:14 +00:00
|
|
|
if (getGameType() == GType_FF && getBitFlag(75)) {
|
2007-05-15 11:32:11 +00:00
|
|
|
fadeCount = 4;
|
|
|
|
fadeSize = 64;
|
|
|
|
} else {
|
|
|
|
fadeCount = 32;
|
|
|
|
fadeSize = 8;
|
|
|
|
}
|
2006-10-27 12:55:48 +00:00
|
|
|
} else {
|
2007-05-15 11:32:11 +00:00
|
|
|
fadeCount = 64;
|
|
|
|
fadeSize = 4;
|
2006-10-27 12:55:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = fadeCount; i != 0; --i) {
|
2009-07-21 10:37:58 +00:00
|
|
|
paletteFadeOut(_currentPalette, _fastFadeCount, fadeSize);
|
2011-02-07 17:52:38 +00:00
|
|
|
_system->getPaletteManager()->setPalette(_currentPalette, 0, _fastFadeCount);
|
2006-10-27 12:55:48 +00:00
|
|
|
delay(5);
|
|
|
|
}
|
|
|
|
|
2007-06-21 05:10:42 +00:00
|
|
|
if (getGameType() == GType_WW || getGameType() == GType_FF || getGameType() == GType_PP) {
|
|
|
|
clearSurfaces();
|
2006-10-27 12:55:48 +00:00
|
|
|
} else {
|
2007-05-13 08:46:48 +00:00
|
|
|
if (_windowNum != 4) {
|
2007-06-21 05:10:42 +00:00
|
|
|
clearSurfaces();
|
2007-05-13 08:46:48 +00:00
|
|
|
}
|
2006-10-27 12:55:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (getGameType() == GType_SIMON2) {
|
|
|
|
if (_nextMusicToPlay != -1)
|
|
|
|
loadMusic(_nextMusicToPlay);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::vc63_fastFadeIn() {
|
2009-02-07 04:32:33 +00:00
|
|
|
if (getGameType() == GType_FF) {
|
2006-10-27 12:55:48 +00:00
|
|
|
_fastFadeInFlag = 256;
|
|
|
|
} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
|
|
|
|
_fastFadeInFlag = 208;
|
|
|
|
if (_windowNum != 4) {
|
|
|
|
_fastFadeInFlag = 256;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_fastFadeOutFlag = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace AGOS
|