From 680ef797269c214ccd6fb471f6f82decf3add648 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 7 Aug 2011 23:14:09 +1000 Subject: TSAGE: Implemented title screen of Blue Force --- engines/tsage/blueforce_logic.cpp | 3 + engines/tsage/blueforce_scenes0.cpp | 196 ++++++++++++++++++++++++++++++++++++ engines/tsage/blueforce_scenes0.h | 56 +++++++++++ engines/tsage/module.mk | 1 + engines/tsage/scenes.cpp | 8 ++ engines/tsage/scenes.h | 1 + engines/tsage/sound.cpp | 21 ++++ engines/tsage/sound.h | 12 +++ 8 files changed, 298 insertions(+) create mode 100644 engines/tsage/blueforce_scenes0.cpp create mode 100644 engines/tsage/blueforce_scenes0.h (limited to 'engines') diff --git a/engines/tsage/blueforce_logic.cpp b/engines/tsage/blueforce_logic.cpp index d266d5e1d9..3cf31b0b0a 100644 --- a/engines/tsage/blueforce_logic.cpp +++ b/engines/tsage/blueforce_logic.cpp @@ -21,6 +21,7 @@ */ #include "tsage/blueforce_logic.h" +#include "tsage/blueforce_scenes0.h" #include "tsage/scenes.h" #include "tsage/tsage.h" #include "tsage/staticres.h" @@ -37,6 +38,8 @@ void BlueForceGame::start() { Scene *BlueForceGame::createScene(int sceneNumber) { switch (sceneNumber) { case 20: + // Tsunami Title Screen + return new BF_Scene20(); case 50: case 60: error("Scene group 0 not implemented"); diff --git a/engines/tsage/blueforce_scenes0.cpp b/engines/tsage/blueforce_scenes0.cpp new file mode 100644 index 0000000000..4a0259cb98 --- /dev/null +++ b/engines/tsage/blueforce_scenes0.cpp @@ -0,0 +1,196 @@ +/* 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. + * + */ + +#include "tsage/blueforce_scenes0.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" + +namespace tSage { + +/*-------------------------------------------------------------------------- + * Scene 20 - Tsunami Title Screen + * + *--------------------------------------------------------------------------*/ + +void BF_Scene20::Action1::signal() { + BF_Scene20 *scene = (BF_Scene20 *)_globals->_sceneManager._scene; + static byte black[3] = { 0, 0, 0 }; + + switch (_actionIndex++) { + case 0: + setDelay(2); + break; + case 1: + _sound.play(1); + _globals->_scenePalette.addRotation(64, 127, -1, 1, this); + break; + case 2: + scene->_object1.setVisage(22); + scene->_object1._strip = 1; + scene->_object1._frame = 1; + scene->_object1.changeZoom(100); + + scene->_object2.setVisage(22); + scene->_object2._strip = 2; + scene->_object2._frame = 1; + scene->_object2.changeZoom(100); + + scene->_object3.setVisage(22); + scene->_object3._strip = 3; + scene->_object3._frame = 1; + scene->_object3.changeZoom(100); + + scene->_object4.setVisage(22); + scene->_object4._strip = 4; + scene->_object4._frame = 1; + scene->_object4.changeZoom(100); + + scene->_object5.setVisage(22); + scene->_object5._strip = 5; + scene->_object5._frame = 1; + scene->_object5.changeZoom(100); + + scene->_object6.setVisage(22); + scene->_object6._strip = 6; + scene->_object6._frame = 1; + scene->_object6.changeZoom(100); + + scene->_object7.setVisage(22); + scene->_object7._strip = 7; + scene->_object7._frame = 1; + scene->_object7.changeZoom(100); + + scene->_object8.setVisage(22); + scene->_object8._strip = 8; + scene->_object8._frame = 1; + scene->_object8.changeZoom(100); + + setDelay(1); + break; + case 3: + _globals->_scenePalette.addFader(scene->_scenePalette._palette, 256, 8, this); + break; + case 4: + setDelay(60); + break; + case 5: + scene->_object2.animate(ANIM_MODE_5, NULL); + scene->_object3.animate(ANIM_MODE_5, NULL); + scene->_object4.animate(ANIM_MODE_5, NULL); + scene->_object5.animate(ANIM_MODE_5, NULL); + scene->_object6.animate(ANIM_MODE_5, NULL); + scene->_object7.animate(ANIM_MODE_5, this); + break; + case 6: + setDelay(120); + break; + case 7: + _globals->_scenePalette.addFader(black, 1, 5, this); + break; + case 8: + _globals->_sceneManager.changeScene(100); + remove(); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void BF_Scene20::postInit(SceneObjectList *OwnerList) { + loadScene(20); + Scene::postInit(); + setZoomPercents(60, 85, 200, 100); + + preloadVisage(21); + preloadVisage(22); + _scenePalette.loadPalette(1); + _scenePalette.loadPalette(22); + + _object1.postInit(); + _object1.setVisage(21); + _object1._strip = 1; + _object1._frame = 1; + _object1.animate(ANIM_MODE_NONE, NULL); + _object1.setPosition(Common::Point(62, 85)); + _object1.changeZoom(100); + + _object2.postInit(); + _object2.setVisage(21); + _object2._strip = 2; + _object2._frame = 1; + _object2.animate(ANIM_MODE_NONE, NULL); + _object2.setPosition(Common::Point(27, 94)); + _object2.changeZoom(100); + + _object3.postInit(); + _object3.setVisage(21); + _object3._strip = 2; + _object3._frame = 2; + _object3.animate(ANIM_MODE_NONE, NULL); + _object3.setPosition(Common::Point(68, 94)); + _object3.changeZoom(100); + + _object4.postInit(); + _object4.setVisage(21); + _object4._strip = 2; + _object4._frame = 3; + _object4.animate(ANIM_MODE_NONE, NULL); + _object4.setPosition(Common::Point(110, 94)); + _object4.changeZoom(100); + + _object5.postInit(); + _object5.setVisage(21); + _object5._strip = 2; + _object5._frame = 4; + _object5.animate(ANIM_MODE_NONE, NULL); + _object5.setPosition(Common::Point(154, 94)); + _object5.changeZoom(100); + + _object6.postInit(); + _object6.setVisage(21); + _object6._strip = 2; + _object6._frame = 5; + _object6.animate(ANIM_MODE_NONE, NULL); + _object6.setPosition(Common::Point(199, 94)); + _object6.changeZoom(100); + + _object7.postInit(); + _object7.setVisage(21); + _object7._strip = 2; + _object7._frame = 6; + _object7.animate(ANIM_MODE_NONE, NULL); + _object7.setPosition(Common::Point(244, 94)); + _object7.changeZoom(100); + + _object8.postInit(); + _object8.setVisage(21); + _object8._strip = 2; + _object8._frame = 7; + _object8.animate(ANIM_MODE_NONE, NULL); + _object8.setPosition(Common::Point(286, 94)); + _object8.changeZoom(100); + + setAction(&_action1); +} + +} // End of namespace tSage diff --git a/engines/tsage/blueforce_scenes0.h b/engines/tsage/blueforce_scenes0.h new file mode 100644 index 0000000000..06f7912959 --- /dev/null +++ b/engines/tsage/blueforce_scenes0.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TSAGE_BLUEFORCE_SCENES0_H +#define TSAGE_BLUEFORCE_SCENES0_H + +#include "common/scummsys.h" +#include "tsage/blueforce_logic.h" +#include "tsage/converse.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" +#include "tsage/sound.h" + +namespace tSage { + +class BF_Scene20 : public Scene { + /* Actions */ + class Action1 : public Action { + private: + ASoundExt _sound; + public: + virtual void signal(); + }; +public: + Action1 _action1; + ScenePalette _scenePalette; + SceneObject _object1, _object2, _object3, _object4; + SceneObject _object5, _object6, _object7, _object8; + + virtual void postInit(SceneObjectList *OwnerList = NULL); +}; + +} // End of namespace tSage + +#endif diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk index 4f76c107fe..586699593d 100644 --- a/engines/tsage/module.mk +++ b/engines/tsage/module.mk @@ -2,6 +2,7 @@ MODULE := engines/tsage MODULE_OBJS := \ blueforce_logic.o \ + blueforce_scenes0.o \ converse.o \ core.o \ debugger.o \ diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 3e23205633..9a175ea08f 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -28,6 +28,9 @@ namespace tSage { +// TODO: Doesn't seem to be ever set +const bool _v52C9F = false; + SceneManager::SceneManager() { _scene = NULL; _hasPalette = false; @@ -501,6 +504,11 @@ void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent _zoomPercents[yEnd++] = minPercent; } +byte *Scene::preloadVisage(int resNum) { + assert(!_v52C9F); + return _resourceManager->getResource(RES_VISAGE, resNum, 9999, false); +} + /*--------------------------------------------------------------------------*/ void Game::execute() { diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index 5845efaec9..665da585f8 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -67,6 +67,7 @@ public: void loadBackground(int xAmount, int yAmount); void refreshBackground(int xAmount, int yAmount); void loadSceneData(int sceneNum); + byte *preloadVisage(int resNum); }; class SceneManager : public GameHandler, public SaveListener { diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index b83b39dcf8..dd6ec69790 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -2455,6 +2455,27 @@ void ASound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFade _sound.fade(fadeDest, fadeSteps, fadeTicks, stopAfterFadeFlag); } +void ASound::fadeSound(int soundNum) { + play(soundNum, NULL, 0); + fade(127, 5, 1, false, NULL); +} + +/*--------------------------------------------------------------------------*/ + +ASoundExt::ASoundExt(): ASound() { + _soundNum = 0; +} + +void ASoundExt::synchronize(Serializer &s) { + ASound::synchronize(s); + s.syncAsSint16LE(_soundNum); +} + +void ASoundExt::signal() { + if (_soundNum != 0) { + fadeSound(_soundNum); + } +} /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index 46a29e57a4..2c9221c27a 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -398,8 +398,20 @@ public: int getVol() const { return _sound.getVol(); } void holdAt(int v) { _sound.holdAt(v); } void release() { _sound.release(); } + void fadeSound(int soundNum); }; +class ASoundExt: public ASound { +public: + int _soundNum; + + ASoundExt(); + virtual Common::String getClassName() { return "ASoundExt"; } + virtual void synchronize(Serializer &s); + virtual void signal(); +}; + + #define ADLIB_CHANNEL_COUNT 9 class AdlibSoundDriver: public SoundDriver, Audio::AudioStream { -- cgit v1.2.3