From 744f04bf5001bf4220ecec40adc299e00b5792a4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 11 Aug 2011 22:05:44 +1000 Subject: TSAGE: Implemented new Globals for Blue Force, and beginnings of implementation of Scene 100 (Title Screen) --- engines/tsage/blueforce_logic.cpp | 5 + engines/tsage/blueforce_scenes1.cpp | 195 ++++++++++++++++++++++++++++++++++++ engines/tsage/blueforce_scenes1.h | 73 ++++++++++++++ engines/tsage/events.cpp | 2 +- engines/tsage/globals.cpp | 12 +++ engines/tsage/globals.h | 15 +++ engines/tsage/module.mk | 1 + engines/tsage/scenes.cpp | 8 +- engines/tsage/staticres.cpp | 11 ++ engines/tsage/staticres.h | 12 +++ engines/tsage/tsage.cpp | 6 +- 11 files changed, 335 insertions(+), 5 deletions(-) create mode 100644 engines/tsage/blueforce_scenes1.cpp create mode 100644 engines/tsage/blueforce_scenes1.h (limited to 'engines/tsage') diff --git a/engines/tsage/blueforce_logic.cpp b/engines/tsage/blueforce_logic.cpp index 3cf31b0b0a..cad7609abc 100644 --- a/engines/tsage/blueforce_logic.cpp +++ b/engines/tsage/blueforce_logic.cpp @@ -22,6 +22,7 @@ #include "tsage/blueforce_logic.h" #include "tsage/blueforce_scenes0.h" +#include "tsage/blueforce_scenes1.h" #include "tsage/scenes.h" #include "tsage/tsage.h" #include "tsage/staticres.h" @@ -37,13 +38,17 @@ void BlueForceGame::start() { Scene *BlueForceGame::createScene(int sceneNumber) { switch (sceneNumber) { + /* Scene Group #0 */ case 20: // Tsunami Title Screen return new BF_Scene20(); case 50: case 60: error("Scene group 0 not implemented"); + /* Scene Group #1 */ case 100: + // Tsnunami Title Screen #2 + return new BF_Scene100(); case 109: case 110: case 114: diff --git a/engines/tsage/blueforce_scenes1.cpp b/engines/tsage/blueforce_scenes1.cpp new file mode 100644 index 0000000000..81f7d0ac76 --- /dev/null +++ b/engines/tsage/blueforce_scenes1.cpp @@ -0,0 +1,195 @@ +/* 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 "common/config-manager.h" +#include "tsage/blueforce_scenes1.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" +#include "tsage/globals.h" + +namespace tSage { + +/*-------------------------------------------------------------------------- + * Scene 100 - Tsunami Title Screen #2 + * + *--------------------------------------------------------------------------*/ + +void BF_Scene100::Action1::signal() { + static byte black[3] = { 0, 0, 0 }; + + switch (_actionIndex++) { + case 0: + _state = 0; + setDelay(6); + break; + case 1: { + Common::String msg1 = _resourceManager->getMessage(100, _state++); + if (!msg1.compareTo("LASTCREDIT")) { + Common::String msg2 = _resourceManager->getMessage(100, _state++); + setTextStrings(msg1, msg2, this); + } else { + setTextStrings(BF_NAME, BF_ALL_RIGHTS_RESERVED, this); + + Common::Point pt(_sceneText1._position.x, 80); + NpcMover *mover = new NpcMover(); + _sceneText1.addMover(mover, &pt, this); + } + break; + } + case 2: + setDelay(600); + break; + case 3: + BF_GLOBALS._sound1.fade(0, 10, 10, 1, this); + GLOBALS._scenePalette.addFader(black, 1, 2, NULL); + break; + case 4: + error("??exit"); + break; + } +} + +void BF_Scene100::Action1::setTextStrings(const Common::String &msg1, const Common::String &msg2, Action *action) { + // Set data for first text control + _sceneText1._fontNumber = 10; + _sceneText1._width = 160; + _sceneText1._textMode = ALIGN_RIGHT; + _sceneText1._color1 = _globals->_fontColors.background; + _sceneText1._color2 = _globals->_fontColors.foreground; + _sceneText1._color3 = _globals->_fontColors.background; + _sceneText1.setup(msg1); + _sceneText1.setFrame2(-1); + _sceneText1.setPosition(Common::Point( + (SCREEN_WIDTH - _sceneText1.getFrame().getBounds().width()) / 2, 202)); + _sceneText1._moveRate = 30; + _sceneText1._moveDiff.y = 1; + + // Set data for second text control + _sceneText2._fontNumber = 10; + _sceneText2._width = _sceneText1._width; + _sceneText2._textMode = _sceneText1._textMode; + _sceneText2._color1 = _globals->_fontColors.background; + _sceneText2._color2 = _globals->_fontColors.foreground; + _sceneText2._color3 = _globals->_fontColors.background; + _sceneText2.setup(msg1); + _sceneText2.setFrame2(-1); + GfxSurface textSurface = _sceneText2.getFrame(); + _sceneText2.setPosition(Common::Point((SCREEN_WIDTH - textSurface.getBounds().width()) / 2, 202)); + _sceneText2._moveRate = 30; + _sceneText2._moveDiff.y = 1; + + _textHeight = textSurface.getBounds().height(); + int yp = -(_textHeight * 2); + + Common::Point pt(_sceneText1._position.x, yp); + NpcMover *mover = new NpcMover(); + _sceneText1.addMover(mover, &pt, action); +} + +void BF_Scene100::Action2::signal() { + BF_Scene100 *scene = (BF_Scene100 *)_globals->_sceneManager._scene; + static byte black[3] = {0, 0, 0}; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._scenePalette.addFader(black, 1, -2, this); + break; + case 1: + setDelay(180); + break; + case 2: { + const char *SEEN_INTRO = "seen_intro"; + if (!ConfMan.hasKey(SEEN_INTRO) || !ConfMan.getBool(SEEN_INTRO)) { + // First time being played, so will need to show the intro + ConfMan.setBool(SEEN_INTRO, true); + ConfMan.flushToDisk(); + } else { + // Prompt user for whether to start play or watch introduction + _globals->_player.enableControl(); + + if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) { + // Signal to start the game + scene->_index = 190; + remove(); + return; + } + } + + // At this point the introduction needs to start + _globals->_scenePalette.addFader(black, 1, 2, this); + break; + } + case 3: + remove(); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +BF_Scene100::BF_Scene100(): Scene() { + _index = 0; +} + +void BF_Scene100::postInit(SceneObjectList *OwnerList) { + BF_GLOBALS._scenePalette.loadPalette(2); + BF_GLOBALS._v51C44 = 1; + Scene::postInit(); + BF_GLOBALS._v51C24 = 200; + + _globals->_player.enableControl(); + _globals->_player.hide(); + _globals->_player.disableControl(); + _index = 109; + + if (BF_GLOBALS._v4CEA2 < 6) { + // Title + loadScene(100); + BF_GLOBALS._sound1.play(2); + setAction(&_action2, this); + } else { + // Credits + loadScene(101); + BF_GLOBALS._sound1.play(118); + setAction(&_action1, this); + } + + loadScene(20); + setZoomPercents(60, 85, 200, 100); +} + +void BF_Scene100::signal() { + ++_sceneMode; + if (BF_GLOBALS._v4CEA2 < 6) { + BF_GLOBALS._scenePalette.clearListeners(); + BF_GLOBALS._scenePalette.loadPalette(100); + BF_GLOBALS._sceneManager.changeScene(_index); + } else { + if (_sceneMode > 1) + BF_GLOBALS._events.setCursor(CURSOR_ARROW); + + setAction(this, &_action1, this); + } +} + +} // End of namespace tSage diff --git a/engines/tsage/blueforce_scenes1.h b/engines/tsage/blueforce_scenes1.h new file mode 100644 index 0000000000..d9fcc486c6 --- /dev/null +++ b/engines/tsage/blueforce_scenes1.h @@ -0,0 +1,73 @@ +/* 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_SCENES1_H +#define TSAGE_BLUEFORCE_SCENES1_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_Scene100: public Scene { + /* Actions */ + class Action1: public ActionExt { + private: + void setTextStrings(const Common::String &msg1, const Common::String &msg2, Action *action); + public: + SceneText _sceneText1, _sceneText2; + int _textHeight; + + virtual Common::String getClassName() { return "BF100Action1"; } + virtual void synchronize(Serializer &s) { + ActionExt::synchronize(s); + s.syncAsSint16LE(_textHeight); + } + virtual void signal(); + }; + class Action2: public ActionExt { + public: + virtual Common::String getClassName() { return "BF100Action2"; } + virtual void signal(); + }; +public: + SequenceManager _sequenceManager; + Action1 _action1; + Action2 _action2; + ScenePalette _scenePalette; + SceneObjectExt2 _object1, _object2, _object3, _object4, _object5; + int _index; + + BF_Scene100(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +} // End of namespace tSage + +#endif diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 7aadf62b8d..59894f3300 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -155,7 +155,7 @@ void EventsClass::setCursor(CursorType cursorType) { // No cursor _globals->setFlag(122); - if (_vm->getFeatures() & GF_DEMO) { + if ((_vm->getFeatures() & GF_DEMO) || (_vm->getGameID() == GType_BlueForce)) { CursorMan.showMouse(false); return; } diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 34b26ec311..e5572d9058 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -166,5 +166,17 @@ void Globals::dispatchSounds() { Common::for_each(_sounds.begin(), _sounds.end(), Globals::dispatchSound); } +/*--------------------------------------------------------------------------*/ + +BlueForceGlobals::BlueForceGlobals(): Globals() { + _v51C24 = 0; + _v51C44 = 1; + _v4CEA2 = 0; +} + +void BlueForceGlobals::synchronize(Serializer &s) { + Globals::synchronize(s); + error("Sync variables"); +} } // end of namespace tSage diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 7cfec718e2..9d12669fa7 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -96,8 +96,23 @@ public: void dispatchSounds(); }; +class BlueForceGlobals: public Globals { +public: + ASound _sound1, _sound2, _sound3; + int _v4CEA2; + int _v51C44; + int _v51C24; + + BlueForceGlobals(); + virtual Common::String getClassName() { return "BFGlobals"; } + virtual void synchronize(Serializer &s); +}; + extern Globals *_globals; +#define GLOBALS (*_globals) +#define BF_GLOBALS (*((BlueForceGlobals *)_globals)) + // Note: Currently this can't be part of the _globals structure, since it needs to be constructed // prior to many of the fields in Globals execute their constructors extern ResourceManager *_resourceManager; diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk index 586699593d..7ac1795537 100644 --- a/engines/tsage/module.mk +++ b/engines/tsage/module.mk @@ -3,6 +3,7 @@ MODULE := engines/tsage MODULE_OBJS := \ blueforce_logic.o \ blueforce_scenes0.o \ + blueforce_scenes1.o \ converse.o \ core.o \ debugger.o \ diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 9a175ea08f..6a164a6b1e 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -28,9 +28,6 @@ namespace tSage { -// TODO: Doesn't seem to be ever set -const bool _v52C9F = false; - SceneManager::SceneManager() { _scene = NULL; _hasPalette = false; @@ -505,8 +502,13 @@ void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent } byte *Scene::preloadVisage(int resNum) { + // This isn't being used, since modern systems can load the data much quicker, and in any case + // visage data is specially loaded into the Visage class, and the resources discarded from memory. + return NULL; +/* assert(!_v52C9F); return _resourceManager->getResource(RES_VISAGE, resNum, 9999, false); +*/ } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp index 9f36268ce3..5d8f1b057f 100644 --- a/engines/tsage/staticres.cpp +++ b/engines/tsage/staticres.cpp @@ -118,4 +118,15 @@ const char *EXIT_BTN_STRING = "Exit"; const char *DEMO_BTN_STRING = "Demo"; const char *DEMO_RESUME_BTN_STRING = "Resume"; +// Blue Force general messages +const char *BF_NAME = "Blue Force"; +const char *BF_COPYRIGHT = " Copyright, 1993 Tsunami Media, Inc."; +const char *BF_ALL_RIGHTS_RESERVED = "All Rights Reserved"; +const char *BF_19840518 = "May 18, 1984"; +const char *BF_19840515 = "May 15, 1984"; +const char *BF_3_DAYS = "Three days later"; +const char *BF_11_YEARS = "Eleven years later."; +const char *BF_NEXT_DAY = "The Next Day"; +const char *BF_ACADEMY = "Here we are at the Academy"; + } // End of namespace tSage diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h index fa93511779..bac8976a14 100644 --- a/engines/tsage/staticres.h +++ b/engines/tsage/staticres.h @@ -86,6 +86,18 @@ extern const char *EXIT_BTN_STRING; extern const char *DEMO_BTN_STRING; extern const char *DEMO_RESUME_BTN_STRING; +// Blue Force messages +extern const char *BF_NAME; +extern const char *BF_COPYRIGHT; +extern const char *BF_ALL_RIGHTS_RESERVED; +extern const char *BF_19840518; +extern const char *BF_19840515; +extern const char *BF_3_DAYS; +extern const char *BF_11_YEARS; +extern const char *BF_NEXT_DAY; +extern const char *BF_ACADEMY; + + } // End of namespace tSage #endif diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 23a0193b7c..3332841188 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -68,18 +68,22 @@ void TSageEngine::initialize() { if (_vm->getFeatures() & GF_DEMO) { // Add the single library file associated with the demo _resourceManager->addLib(getPrimaryFilename()); + _globals = new Globals(); + } else if (_vm->getGameID() == GType_Ringworld) { _resourceManager->addLib("RING.RLB"); _resourceManager->addLib("TSAGE.RLB"); + _globals = new Globals(); + } else if (_vm->getGameID() == GType_BlueForce) { _resourceManager->addLib("BLUE.RLB"); if (_vm->getFeatures() & GF_FLOPPY) { _resourceManager->addLib("FILES.RLB"); _resourceManager->addLib("TSAGE.RLB"); } + _globals = new BlueForceGlobals(); } - _globals = new Globals(); _globals->gfxManager().setDefaults(); // Setup sound settings -- cgit v1.2.3