2006-10-20 02:10:51 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
|
|
|
* Copyright (C) 2001-2006 The ScummVM project
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common/stdafx.h"
|
|
|
|
|
|
|
|
#include "agos/agos.h"
|
|
|
|
#include "agos/intern.h"
|
|
|
|
|
|
|
|
namespace AGOS {
|
|
|
|
|
|
|
|
void AGOSEngine::setupSimon2VideoOpcodes(VgaOpcodeProc *op) {
|
|
|
|
setupSimon1VideoOpcodes(op);
|
|
|
|
|
|
|
|
op[56] = &AGOSEngine::vc56_delayLong;
|
|
|
|
op[58] = &AGOSEngine::vc58_changePriority;
|
|
|
|
op[59] = &AGOSEngine::vc59_stopAnimations;
|
2006-10-27 12:55:48 +00:00
|
|
|
op[64] = &AGOSEngine::vc64_ifSpeech;
|
2006-10-20 02:10:51 +00:00
|
|
|
op[65] = &AGOSEngine::vc65_slowFadeIn;
|
2006-10-27 12:55:48 +00:00
|
|
|
op[66] = &AGOSEngine::vc66_ifEqual;
|
|
|
|
op[67] = &AGOSEngine::vc67_ifLE;
|
|
|
|
op[68] = &AGOSEngine::vc68_ifGE;
|
|
|
|
op[69] = &AGOSEngine::vc69_playSeq;
|
|
|
|
op[70] = &AGOSEngine::vc70_joinSeq;
|
|
|
|
op[71] = &AGOSEngine::vc71_ifSeqWaiting;
|
|
|
|
op[72] = &AGOSEngine::vc72_segue;
|
2006-10-20 02:10:51 +00:00
|
|
|
op[73] = &AGOSEngine::vc73_setMark;
|
|
|
|
op[74] = &AGOSEngine::vc74_clearMark;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::vc56_delayLong() {
|
|
|
|
uint16 num = vcReadVarOrWord() * _frameRate;
|
|
|
|
|
|
|
|
addVgaEvent(num + _vgaBaseDelay, _vcPtr, _vgaCurSpriteId, _vgaCurZoneNum);
|
|
|
|
_vcPtr = (byte *)&_vc_get_out_of_code;
|
|
|
|
}
|
|
|
|
|
|
|
|
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::vc59_stopAnimations() {
|
|
|
|
uint16 file = vcReadNextWord();
|
|
|
|
uint16 start = vcReadNextWord();
|
|
|
|
uint16 end = vcReadNextWord() + 1;
|
|
|
|
|
|
|
|
do {
|
2006-10-21 01:51:59 +00:00
|
|
|
vcStopAnimation(file, start);
|
2006-10-20 02:10:51 +00:00
|
|
|
} while (++start != end);
|
|
|
|
}
|
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
void AGOSEngine::vc64_ifSpeech() {
|
2006-10-20 02:10:51 +00:00
|
|
|
if ((getGameType() == GType_SIMON2 && _subtitles && _language != Common::HB_ISR) ||
|
|
|
|
!_sound->isVoiceActive()) {
|
|
|
|
vcSkipNextInstruction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::vc65_slowFadeIn() {
|
|
|
|
_fastFadeInFlag = 624;
|
|
|
|
_fastFadeCount = 208;
|
|
|
|
if (_windowNum != 4) {
|
|
|
|
_fastFadeInFlag = 768;
|
|
|
|
_fastFadeCount = 256;
|
|
|
|
}
|
|
|
|
_fastFadeInFlag |= 0x8000;
|
|
|
|
_fastFadeOutFlag = false;
|
|
|
|
}
|
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
void AGOSEngine::vc66_ifEqual() {
|
2006-10-20 02:10:51 +00:00
|
|
|
uint16 a = vcReadNextWord();
|
|
|
|
uint16 b = vcReadNextWord();
|
|
|
|
|
|
|
|
if (vcReadVar(a) != vcReadVar(b))
|
|
|
|
vcSkipNextInstruction();
|
|
|
|
}
|
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
void AGOSEngine::vc67_ifLE() {
|
2006-10-20 02:10:51 +00:00
|
|
|
uint16 a = vcReadNextWord();
|
|
|
|
uint16 b = vcReadNextWord();
|
|
|
|
|
|
|
|
if (vcReadVar(a) >= vcReadVar(b))
|
|
|
|
vcSkipNextInstruction();
|
|
|
|
}
|
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
void AGOSEngine::vc68_ifGE() {
|
2006-10-20 02:10:51 +00:00
|
|
|
uint16 a = vcReadNextWord();
|
|
|
|
uint16 b = vcReadNextWord();
|
|
|
|
|
|
|
|
if (vcReadVar(a) <= vcReadVar(b))
|
|
|
|
vcSkipNextInstruction();
|
|
|
|
}
|
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
void AGOSEngine::vc69_playSeq() {
|
2006-10-20 02:10:51 +00:00
|
|
|
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 occured, 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);
|
|
|
|
}
|
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
void AGOSEngine::vc70_joinSeq() {
|
2006-10-20 02:10:51 +00:00
|
|
|
// 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);
|
|
|
|
}
|
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
void AGOSEngine::vc71_ifSeqWaiting() {
|
2006-10-20 02:10:51 +00:00
|
|
|
// Jamieson630:
|
|
|
|
// This command skips the next instruction
|
|
|
|
// unless (1) there is a track playing, AND
|
|
|
|
// (2) there is a track queued to play after it.
|
|
|
|
if (!midi.isPlaying (true))
|
|
|
|
vcSkipNextInstruction();
|
|
|
|
}
|
|
|
|
|
2006-10-27 12:55:48 +00:00
|
|
|
void AGOSEngine::vc72_segue() {
|
2006-10-20 02:10:51 +00:00
|
|
|
// 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) {
|
|
|
|
midi.stop();
|
|
|
|
} else {
|
|
|
|
midi.setLoop (loop != 0);
|
|
|
|
midi.startTrack (track);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::vc73_setMark() {
|
|
|
|
_marks |= (1 << vcReadNextWord());
|
|
|
|
}
|
|
|
|
|
|
|
|
void AGOSEngine::vc74_clearMark() {
|
|
|
|
_marks &= ~(1 << vcReadNextWord());
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace AGOS
|