From bce47e7eb68d62476fd2fcd6cc4ec1bf33618d51 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Sat, 16 May 2009 05:34:16 +0000 Subject: Add initial support for DOS non-interactive demos of The Feeble Files. svn-id: r40619 --- engines/agos/feeble.cpp | 396 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 396 insertions(+) create mode 100644 engines/agos/feeble.cpp (limited to 'engines/agos/feeble.cpp') diff --git a/engines/agos/feeble.cpp b/engines/agos/feeble.cpp new file mode 100644 index 0000000000..90e4cbc003 --- /dev/null +++ b/engines/agos/feeble.cpp @@ -0,0 +1,396 @@ +/* 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. + * + * 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/config-manager.h" + +#include "agos/intern.h" +#include "agos/agos.h" + +namespace AGOS { + +AGOSEngine_Feeble::AGOSEngine_Feeble(OSystem *system) + : AGOSEngine_Simon2(system) { + + _interactiveVideo = 0; + _moviePlayer = 0; + _vgaCurSpritePriority = 0; +} + +AGOSEngine_Feeble::~AGOSEngine_Feeble() { + delete _moviePlayer; +} + +static const GameSpecificSettings feeblefiles_settings = { + "", // effects_filename + "VOICES", // speech_filename +}; + +void AGOSEngine_Feeble::setupGame() { + gss = &feeblefiles_settings; + _numVideoOpcodes = 85; + _vgaMemSize = 7500000; + _itemMemSize = 20000; + _tableMemSize = 200000; + _frameCount = 1; + _vgaBaseDelay = 5; + _vgaPeriod = 50; + _numBitArray1 = 16; + _numBitArray2 = 16; + _numBitArray3 = 16; + _numItemStore = 10; + _numTextBoxes = 40; + _numVars = 255; + + _numSpeech = 10000; + + AGOSEngine::setupGame(); +} + +void AGOSEngine_Feeble::runSubroutine101() { + if ((getPlatform() == Common::kPlatformAmiga || getPlatform() == Common::kPlatformMacintosh) && + getGameType() == GType_FF) { + playVideo("epic.dxa"); + } + + AGOSEngine::runSubroutine101(); +} + +void AGOSEngine_Feeble::playVideo(const char *filename, bool lastSceneUsed) { + if (shouldQuit()) + return; + + if (lastSceneUsed) + setBitFlag(41, true); + + _moviePlayer = makeMoviePlayer(this, filename); + assert(_moviePlayer); + + _moviePlayer->load(); + _moviePlayer->play(); + + delete _moviePlayer; + _moviePlayer = NULL; + + if (lastSceneUsed) + setBitFlag(41, false); +} + +void AGOSEngine_Feeble::stopInteractiveVideo() { + if (_interactiveVideo) { + _interactiveVideo = 0; + _moviePlayer->stopVideo(); + delete _moviePlayer; + _moviePlayer = NULL; + } +} + +AGOSEngine_FeebleDemo::AGOSEngine_FeebleDemo(OSystem *system) + : AGOSEngine_Feeble(system) { + + _filmMenuUsed = 0; +} + +Common::Error AGOSEngine_FeebleDemo::go() { + // Main menu + defineBox( 1, 80, 75, 81, 117, kBFBoxDead, 0, NULL); + defineBox( 2, 267, 21, 105, 97, kBFBoxDead, 0, NULL); + defineBox( 3, 456, 89, 125, 103, kBFBoxDead, 0, NULL); + defineBox( 4, 151, 225, 345, 41, kBFBoxDead, 0, NULL); + defineBox( 5, 169, 319, 109, 113, kBFBoxDead, 0, NULL); + defineBox( 6, 404, 308, 62, 117, kBFBoxDead, 0, NULL); + + // Film menu + defineBox(11, 28, 81, 123, 93, kBFBoxDead, 0, NULL); + defineBox(12, 182, 81, 123, 93, kBFBoxDead, 0, NULL); + defineBox(13, 335, 81, 123, 93, kBFBoxDead, 0, NULL); + defineBox(14, 488, 81, 123, 93, kBFBoxDead, 0, NULL); + defineBox(15, 28, 201, 123, 93, kBFBoxDead, 0, NULL); + defineBox(16, 182, 201, 123, 93, kBFBoxDead, 0, NULL); + defineBox(17, 335, 201, 123, 93, kBFBoxDead, 0, NULL); + defineBox(18, 488, 201, 123, 93, kBFBoxDead, 0, NULL); + defineBox(19, 255, 357, 135, 45, kBFBoxDead, 0, NULL); + + // Exit Menu + defineBox(21, 548, 421, 42, 21, kBFBoxDead, 0, NULL); + + // Text Window used by Feeble Files Data section + if (_language ==Common::DE_DEU) { + _textWindow = openWindow(322, 457, 196, 15, 1, 0, 255); + } else { + _textWindow = openWindow(444, 452, 196, 15, 1, 0, 255); + } + + playVideo("winasoft.smk"); + playVideo("fbigtalk.smk"); + + while (!shouldQuit()) + mainMenu(); + + return Common::kNoError; +} + +void AGOSEngine_FeebleDemo::exitMenu() { + for (int i = 1; i <= 20; i++) + disableBox(i); + + enableBox(21); + + playVideo("fhypno.smk"); + playVideo("fbye1.smk", true); + + HitArea *ha; + while (!shouldQuit()) { + _lastHitArea = NULL; + _lastHitArea3 = NULL; + + while (!shouldQuit()) { + if (_lastHitArea3 != 0) + break; + delay(1); + } + + ha = _lastHitArea; + + if (ha != NULL && ha->id == 21) + break; + } + + playVideo("fbye2.smk"); + quitGame(); + delay(0); +} + +void AGOSEngine_FeebleDemo::filmMenu() { + for (int i = 1; i <= 6; i++) + disableBox(i); + + for (int i = 11; i <= 19; i++) + enableBox(i); + + if (!_filmMenuUsed) { + playVideo("fclipsin.smk", true); + } else { + playVideo("fclipin2.smk", true); + } + + _filmMenuUsed = true; + + HitArea *ha; + while (!shouldQuit()) { + _lastHitArea = NULL; + _lastHitArea3 = NULL; + + while (!shouldQuit()) { + if (_lastHitArea3 != 0) + break; + handleWobble(); + delay(1); + } + + ha = _lastHitArea; + + if (ha == NULL) + continue; + + stopInteractiveVideo(); + + if (ha->id == 11) { + playVideo("fgo1.smk"); + playVideo("maze.smk"); + } else if (ha->id == 12) { + playVideo("fgo2.smk"); + playVideo("radioin.smk"); + } else if (ha->id == 13) { + playVideo("fgo3.smk"); + playVideo("pad.smk"); + } else if (ha->id == 14) { + playVideo("fgo4.smk"); + playVideo("bridge.smk"); + } else if (ha->id == 15) { + playVideo("fgo5.smk"); + playVideo("pilldie.smk"); + } else if (ha->id == 16) { + playVideo("fgo6.smk"); + playVideo("bikebust.smk"); + } else if (ha->id == 17) { + playVideo("fgo7.smk"); + playVideo("statue.smk"); + } else if (ha->id == 18) { + playVideo("fgo8.smk"); + playVideo("junkout.smk"); + } else if (ha->id == 19) { + playVideo("fgo9.smk"); + break; + } + + playVideo("fclipin2.smk", true); + } +} + +void AGOSEngine_FeebleDemo::handleText() { + if (_lastClickRem == _currentBox) + return; + + if (_currentBox && (_currentBox->id >= 1 && _currentBox->id <= 6)) { + // TODO: Add the subtitles for menu options + } + + _lastClickRem = _currentBox; +} + +void AGOSEngine_FeebleDemo::handleWobble() { + if (_lastClickRem == _currentBox) + return; + + stopInteractiveVideo(); + + if (_currentBox && (_currentBox->id >= 11 && _currentBox->id <= 19)) { + char filename[15]; + sprintf(filename, "wobble%d.smk", _currentBox->id - 10); + + startInteractiveVideo(filename); + } + + _lastClickRem = _currentBox; +} + +void AGOSEngine_FeebleDemo::mainMenu() { + for (int i = 1; i <= 6; i++) + enableBox(i); + + for (int i = 11; i <= 19; i++) + disableBox(i); + + playVideo("mmfadein.smk", true); + + startInteractiveVideo("mainmenu.smk"); + + HitArea *ha; + while (!shouldQuit()) { + _lastHitArea = NULL; + _lastHitArea3 = NULL; + + while (!shouldQuit()) { + if (_lastHitArea3 != 0) + break; + handleText(); + delay(1); + } + + ha = _lastHitArea; + + if (ha == NULL) { + } else if (ha->id >= 1 && ha->id <= 6) { + break; + } + } + + stopInteractiveVideo(); + + if (ha->id == 1) { + // Feeble Files Data + playVideo("ffade5.smk"); + playVideo("ftext0.smk"); + playVideo("ftext1.smk", true); + waitForSpace(); + playVideo("ftext2.smk", true); + waitForSpace(); + playVideo("ftext3.smk", true); + waitForSpace(); + playVideo("ftext4.smk", true); + waitForSpace(); + playVideo("ftext5.smk", true); + waitForSpace(); + } else if (ha->id == 2) { + // Opening Sequence + playVideo("ffade1.smk"); + playVideo("musosp1.smk"); + playVideo("newcred.smk"); + playVideo("fasall.smk"); + playVideo("mus5p2.smk"); + playVideo("coach.smk"); + playVideo("outmin.smk"); + } else if (ha->id == 3) { + // Technical Information + playVideo("ffade3.smk"); + playVideo("idfx4a.smk"); + playVideo("idfx4b.smk"); + playVideo("idfx4c.smk"); + playVideo("idfx4d.smk"); + playVideo("idfx4e.smk"); + playVideo("idfx4f.smk"); + playVideo("idfx4g.smk"); + } else if (ha->id == 4) { + // About AdventureSoft + playVideo("ffade2.smk"); + playVideo("fscene3b.smk"); + playVideo("fscene3a.smk"); + playVideo("fscene3c.smk"); + playVideo("fscene3g.smk"); + } else if (ha->id == 5) { + // Video Clips + playVideo("ffade4.smk"); + filmMenu(); + } else if (ha->id == 6) { + // Exit InfoDisk + playVideo("ffade6.smk"); + exitMenu(); + } +} + +void AGOSEngine_FeebleDemo::startInteractiveVideo(const char *filename) { + setBitFlag(40, true); + _interactiveVideo = MoviePlayer::TYPE_LOOPING; + _moviePlayer = makeMoviePlayer(this, filename); + assert(_moviePlayer); + _moviePlayer->load(); + _moviePlayer->play(); + setBitFlag(40, false); +} + +void AGOSEngine_FeebleDemo::waitForSpace() { + const char *message; + + if (_language == Common::DE_DEU) { + message = "Drcken Sie die , um fortzufahren..."; + } else { + message = "Press to continue..."; + } + + windowPutChar(_textWindow, 12); + for (; *message; message++) + windowPutChar(_textWindow, *message); + + mouseOff(); + while (!shouldQuit()) { + delay(1); + if (_keyPressed.keycode == Common::KEYCODE_SPACE) + break; + } + _keyPressed.reset(); + mouseOn(); +} + +} // End of namespace AGOS -- cgit v1.2.3