diff options
Diffstat (limited to 'engines/illusions/bbdou')
-rw-r--r-- | engines/illusions/bbdou/bbdou_credits.cpp | 246 | ||||
-rw-r--r-- | engines/illusions/bbdou/bbdou_credits.h | 84 | ||||
-rw-r--r-- | engines/illusions/bbdou/bbdou_credits_staticdata.cpp | 299 | ||||
-rw-r--r-- | engines/illusions/bbdou/bbdou_specialcode.cpp | 27 | ||||
-rw-r--r-- | engines/illusions/bbdou/bbdou_specialcode.h | 4 | ||||
-rw-r--r-- | engines/illusions/bbdou/scriptopcodes_bbdou.cpp | 3 |
6 files changed, 660 insertions, 3 deletions
diff --git a/engines/illusions/bbdou/bbdou_credits.cpp b/engines/illusions/bbdou/bbdou_credits.cpp new file mode 100644 index 0000000000..3b651292d7 --- /dev/null +++ b/engines/illusions/bbdou/bbdou_credits.cpp @@ -0,0 +1,246 @@ +/* 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 "illusions/bbdou/illusions_bbdou.h" +#include "illusions/bbdou/bbdou_credits.h" +#include "illusions/actor.h" +#include "illusions/dictionary.h" +#include "illusions/textdrawer.h" +#include "illusions/time.h" +#include "illusions/resources/scriptresource.h" + +namespace Illusions { + +BbdouCredits::BbdouCredits(IllusionsEngine_BBDOU *vm) + : _vm(vm) { +} + +BbdouCredits::~BbdouCredits() { +} + +void BbdouCredits::start(uint32 endSignalPropertyId, float speedModifier) { + _endSignalPropertyId = endSignalPropertyId; + _currFontId = 0x120004; + _currLineIndex = 1; + _split = false; + // convertTextData(); + initCreditsItems(); + createCreditsThread(speedModifier); +} + +void BbdouCredits::stop() { + freeCreditsItems(); +} + +void BbdouCredits::drawNextLine() { + uint leftIndex, rightIndex; + + if (!readNextLine(leftIndex, rightIndex)) { + _vm->_scriptResource->_properties.set(_endSignalPropertyId, true); + return; + } + + if (leftIndex) { + const char *leftText = getText(leftIndex); + if (leftText && strlen(leftText) != 0) { + uint32 objectId = getNextFreeObjectId(); + int alignment = rightIndex ? 1 : 2; + drawTextToControl(objectId, leftText, alignment); + } + } + + if (rightIndex) { + const char *rightText = getText(rightIndex); + if (rightText && strlen(rightText) != 0) { + uint32 objectId = getNextFreeObjectId(); + drawTextToControl(objectId, rightText, 4); + } + } + +} + +void charToWChar(const char *text, uint16 *wtext, uint size) { + while (*text != 0 && size > 1) { + *wtext++ = (byte)*text++; + /* + byte c = (byte)*text++; + if (c > 127) c = 32; + *wtext = c; + debug("%04X", *wtext); + ++wtext; + */ + --size; + } + *wtext++ = 0; +} + +void BbdouCredits::drawTextToControl(uint32 objectId, const char *text, uint alignment) { + uint16 wtext[128]; + charToWChar(text, wtext, ARRAYSIZE(wtext)); + + // TODO Extract to Actor class + Control *control = _vm->getObjectControl(objectId); + FontResource *font = _vm->_dict->findFont(_currFontId); + TextDrawer textDrawer; + WidthHeight dimensions; + uint16 *outText; + control->getActorFrameDimensions(dimensions); + control->fillActor(0); + textDrawer.wrapText(font, wtext, &dimensions, Common::Point(0, 0), alignment, outText); + textDrawer.drawText(_vm->_screen, control->_actor->_surface, 0, 0); + control->_actor->_flags |= 0x4000; + +} + +bool BbdouCredits::readNextLine(uint &leftIndex, uint &rightIndex) { + bool done = false; + int textLines = 0; + leftIndex = 0; + rightIndex = 0; + + do { + uint lineIndex = _currLineIndex++; + const char *text = getText(lineIndex); + if (text[0] == '@') { + const char *command = text + 1; + if (!strcmp(command, "end")) + done = true; + if (!strcmp(command, "bold")) + _currFontId = 0x120005; + else if (!strcmp(command, "normal")) + _currFontId = 0x120004; + else if (!strcmp(command, "center")) + _split = false; + else if (!strcmp(command, "split")) + _split = true; + else + done = true; + } else { + ++textLines; + if (!_split) { + leftIndex = lineIndex; + done = true; + } else if (textLines > 1) { + rightIndex = lineIndex; + done = true; + } else { + leftIndex = lineIndex; + } + } + } while (!done); + + return textLines > 0; +} + +void BbdouCredits::initCreditsItems() { + for (uint i = 0; i < kCreditsItemsCount; ++i) { + uint32 objectId = _vm->_controls->newTempObjectId(); + _vm->_controls->placeActor(0x00050188, Common::Point(320, 480), 0x00060BE1, objectId, 0); + Control *control = _vm->_dict->getObjectControl(objectId); + control->startSequenceActor(0x60BE2, 2, 0); + _items[i].isUsed = false; + _items[i].objectId = objectId; + } +} + +void BbdouCredits::freeCreditsItems() { + for (uint i = 0; i < kCreditsItemsCount; ++i) { + Control *control = _vm->_dict->getObjectControl(_items[i].objectId); + control->disappearActor(); + } +} + +uint32 BbdouCredits::getNextFreeObjectId() { + for (uint i = 0; i < kCreditsItemsCount; ++i) { + if (!_items[i].isUsed) { + _items[i].isUsed = true; + return _items[i].objectId; + } + } + return 0; +} + +void BbdouCredits::removeText(uint32 objectId) { + for (uint i = 0; i < kCreditsItemsCount; ++i) { + if (_items[i].objectId == objectId) { + _items[i].isUsed = false; + resetObjectPos(objectId); + } + } +} + +void BbdouCredits::resetObjectPos(uint32 objectId) { + Control *control = _vm->_dict->getObjectControl(objectId); + control->setActorPosition(Common::Point(320, 480)); +} + +void BbdouCredits::createCreditsThread(float speedModifier) { + uint32 tempThreadId = _vm->newTempThreadId(); + CreditsThread *creditsThread = new CreditsThread(_vm, this, tempThreadId, speedModifier); + _vm->_threads->startThread(creditsThread); +} + +void BbdouCredits::updateTexts(int yIncr) { + for (uint i = 0; i < kCreditsItemsCount; ++i) { + if (_items[i].isUsed) { + Control *control = _vm->_dict->getObjectControl(_items[i].objectId); + Common::Point pt = control->getActorPosition(); + pt.y += yIncr; + control->setActorPosition(pt); + if (pt.y <= 0) + removeText(_items[i].objectId); + } + } +} + +// CreditsThread + +CreditsThread::CreditsThread(IllusionsEngine_BBDOU *vm, BbdouCredits *credits, uint32 threadId, float speedModifier) + : Thread(vm, threadId, 0, 0), _speedModifier(speedModifier), _lastFraction(0.0), _credits(credits) { + _type = kTTSpecialThread; + _lastUpdateTime = getCurrentTime(); +} + +int CreditsThread::onUpdate() { + uint32 currTime = getCurrentTime(); + float fltDelta = (currTime - _lastUpdateTime) * _speedModifier + _lastFraction; + int delta = (int)fltDelta; + _lastFraction = fltDelta - delta; + if (delta != 0) + _credits->updateTexts(-delta); + _lastUpdateTime = currTime; + return 2; +} + +void CreditsThread::onNotify() { + _lastUpdateTime = getCurrentTime(); +} + +void CreditsThread::onResume() { + onNotify(); +} + +void CreditsThread::onTerminated() { + _credits->stop(); +} + +} // End of namespace Illusions diff --git a/engines/illusions/bbdou/bbdou_credits.h b/engines/illusions/bbdou/bbdou_credits.h new file mode 100644 index 0000000000..ebf4e5fbb2 --- /dev/null +++ b/engines/illusions/bbdou/bbdou_credits.h @@ -0,0 +1,84 @@ +/* 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 ILLUSIONS_BBDOU_BBDOU_CREDITS_H +#define ILLUSIONS_BBDOU_BBDOU_CREDITS_H + +#include "illusions/specialcode.h" +#include "illusions/thread.h" + +namespace Illusions { + +class IllusionsEngine_BBDOU; +class BbdouSpecialCode; +class Control; + +struct CreditsItem { + bool isUsed; + uint32 objectId; +}; + +const uint kCreditsItemsCount = 64; + +class BbdouCredits { +public: + BbdouCredits(IllusionsEngine_BBDOU *vm); + ~BbdouCredits(); + void start(uint32 endSignalPropertyId, float speedModifier); + void stop(); + void drawNextLine(); + void updateTexts(int yIncr); +protected: + IllusionsEngine_BBDOU *_vm; + uint32 _endSignalPropertyId; + uint32 _currFontId; + uint _currLineIndex; + bool _split; + CreditsItem _items[kCreditsItemsCount]; + const char *getText(uint index); + void drawTextToControl(uint32 objectId, const char *text, uint alignment); + bool readNextLine(uint &leftIndex, uint &rightIndex); + void initCreditsItems(); + void freeCreditsItems(); + uint32 getNextFreeObjectId(); + void removeText(uint32 objectId); + void resetObjectPos(uint32 objectId); + void createCreditsThread(float speedModifier); +}; + +class CreditsThread : public Thread { +public: + CreditsThread(IllusionsEngine_BBDOU *vm, BbdouCredits *credits, uint32 threadId, float speedModifier); + virtual int onUpdate(); + virtual void onNotify(); + virtual void onResume(); + virtual void onTerminated(); +public: + BbdouCredits *_credits; + float _speedModifier; + float _lastFraction; + uint32 _lastUpdateTime; +}; + +} // End of namespace Illusions + +#endif // ILLUSIONS_BBDOU_BBDOU_CREDITS_H diff --git a/engines/illusions/bbdou/bbdou_credits_staticdata.cpp b/engines/illusions/bbdou/bbdou_credits_staticdata.cpp new file mode 100644 index 0000000000..a00a86816e --- /dev/null +++ b/engines/illusions/bbdou/bbdou_credits_staticdata.cpp @@ -0,0 +1,299 @@ +/* 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 "illusions/bbdou/bbdou_credits.h" + +namespace Illusions { + +const char *kCreditsText[] = { + "@center", + "@normal", + "Directed by", + "@bold", + "Darren Bartlett", + "@normal", + "", + "Produced by", + "@bold", + "James C\xF6liz, Jr.", + "@normal", + "", + "Developed by", + "@bold", + "The Illusions Gaming Company", + "@normal", + "", + "@split", + "Creative Director", + "Darren Bartlett", + "Designer", + "Ryan Modjeski", + "Associate Designer", + "David Sirlin", + "", + "", + "Technical Director", + "James C\xF6liz, Jr.", + "Lead Programmer", + "Bill Fowler", + "Programmer", + "Chuck Woo", + "", + "", + "3D Artist", + "Eric Chyn", + "", + "Bill Eral", + "Production Artist", + "Jim Eral", + "Asst. Production Artist", + "Eli Remus", + "@center", + "", + "2D Animation by", + "@bold", + "LA West Productions", + "@normal", + "", + "@split", + "Director of Animation", + "Ivan Tomicic", + "Production Manager", + "Susan McGirr", + "Studio Supervisor", + "Danijel Tomicic", + "", + "", + "Lead Animator", + "Dario Pustaj", + "", + "Ivica Horvat", + "Animator", + "Kristijan Dulic", + "", + "Elvis Popovic", + "In-Between", + "Maja Surijak", + "", + "Zlatko Zlatunic", + "", + "", + "Lead Ink & Paint", + "Sasa Zec", + "Ink & Paint", + "Darko Dukaric", + "", + "Marcela Kumparic", + "", + "Vlado Lencur", + "", + "Jura Milinkovic", + "", + "Bernard Ojdanic", + "", + "Peggy Skrlec", + "@center", + "", + "3D Backgrounds by", + "@bold", + "LA West Productions", + "@normal", + "", + "@split", + "3D Artist", + "Daniela Tomicic", + "", + "Diana-Barbara Stepanic", + "@center", + "", + "2D Animation by", + "@bold", + "Six Foot Two Productions", + "@normal", + "", + "@split", + "Director of Animation", + "Tom Arndt", + "Producer", + "Suzanne D. Atherly", + "", + "", + "Character Animator", + "Robbin Atherly", + "", + "Alan Lau", + "", + "David Ball", + "", + "Jeff Nevins", + "", + "", + "Ink & Paint", + "Steve Bellin", + "", + "Corrine Wong", + "", + "Jeff Nevins", + "@center", + "", + "Written by", + "@bold", + "Bo Weinberg", + "@normal", + "", + "Principal Voice by", + "@bold", + "Mike Judge", + "@normal", + "", + "Secondary Voice Recorded at", + "@bold", + "Private Island Trax", + "@normal", + "", + "Secondary Voices by", + "Dean Julian", + "Mia Altieri", + "Nicole Schallig", + "Rick Calvert", + "John Campana", + "Alex Mebane", + "Denise Askew", + "Michael Jamal", + "", + "Studio Engineered by", + "Mark V", + "", + "Sound and Music by", + "@bold", + "Tommy Tallarico Studios", + "@normal", + "", + "@split", + "Sound Designer", + "Joey Kuras", + "Foley", + "Scott Barrett", + "@center", + "", + "Illusions is represented by", + "@bold", + "Interactive Studio Management", + "@normal", + "", + "Published by", + "@bold", + "GT Interactive Software", + "@normal", + "", + "@split", + "Producer", + "Nathan Rose", + "Assistant Producer", + "Jamal Jennings", + "Group Product Manager", + "Evan Stein", + "Product Manager", + "Robert J. Ricci", + "Senior Communications Manager", + "Alan Lewis", + "Director, Product Development Services" + "Mary Steer", + "Director, Creative Services", + "Leslie Mills", + "Creative Director", + "Vic Merritt", + "Art/Traffic Manager", + "Liz Fierro", + "Manual Editor", + "Peter Witcher", + "", + "", + "@center", + "", + "Licensed by", + "@bold", + "MTV Networks", + "@normal", + "", + "@split", + "MTV Executive Producer", + "Allie Eberhardt", + "MTV Producer", + "Tony Calandra", + "MTV Creative Consultants", + "Kristofor Brown", + "", + "David Felton", + "", + "Mike Judge", + "", + "Nick Litwinko", + "MTV Standards and Practices", + "Dr. Thomas Shea", + "MTV Legal Affairs", + "Beth Matthews", + "@center", + "", + "MTV would like to thank", + "Mary Frances Budig", + "George Eichen", + "Matt Farber", + "Rick Holzman", + "Jessica Jarrett", + "Mike Judge", + "Judith McGrath", + "David Milch", + "Abby Terkuhle", + "Van Toffler", + "Paige Wolfson", + "Marcia Zellers", + "", + "@bold", + "Special Thanks", + "@normal", + "Clyde Grossman", + "Hiromi Nobata", + "John Durentas", + "Jeff Teachworth", + "John Lawrence", + "Bill Hendrickson", + "Fred Schiller", + "Sam Fletcher", + "Elizabeth, Stephanie & Hannah", + "Sheila Mendoza", + "Yukari Yamano", + "Hang Yim, King Yip & Wayne", + "Li-Ming, Der-Lin & Fansy", + "Bobbi Eral", + "Miss Melissa", + "Yasmin, Aparna & Jenny", + "Tony the Cat", + "Sammy the Cat", + "@end" +}; + +const char *BbdouCredits::getText(uint index) { + return kCreditsText[index - 1]; +} + +} // End of namespace Illusions diff --git a/engines/illusions/bbdou/bbdou_specialcode.cpp b/engines/illusions/bbdou/bbdou_specialcode.cpp index f230a7c5cf..437c9025c1 100644 --- a/engines/illusions/bbdou/bbdou_specialcode.cpp +++ b/engines/illusions/bbdou/bbdou_specialcode.cpp @@ -24,6 +24,7 @@ #include "illusions/bbdou/bbdou_specialcode.h" #include "illusions/bbdou/bbdou_bubble.h" #include "illusions/bbdou/bbdou_inventory.h" +#include "illusions/bbdou/bbdou_credits.h" #include "illusions/bbdou/bbdou_cursor.h" #include "illusions/actor.h" #include "illusions/camera.h" @@ -107,7 +108,7 @@ void RadarMicrophoneThread::initZones() { // BbdouSpecialCode BbdouSpecialCode::BbdouSpecialCode(IllusionsEngine_BBDOU *vm) - : _vm(vm) { + : _vm(vm), _credits(0) { _bubble = new BbdouBubble(_vm, this); _cursor = new BbdouCursor(_vm, this); _inventory = new BbdouInventory(_vm, this); @@ -150,6 +151,7 @@ void BbdouSpecialCode::init() { SPECIAL(0x00160036, spcInitMenu); SPECIAL(0x00160037, spcIsCursorHoldingObjectId); SPECIAL(0x00160038, spcInitRadarMicrophone); + SPECIAL(0x00160039, spcCreditsCtl); SPECIAL(0x0016003A, spcSaladCtl); SPECIAL(0x0016003B, spcRunCause); } @@ -333,6 +335,27 @@ void BbdouSpecialCode::spcInitRadarMicrophone(OpCall &opCall) { _vm->_threads->startThread(radarMicrophoneThread); } +void BbdouSpecialCode::spcCreditsCtl(OpCall &opCall) { + ARG_UINT32(cmd); + switch (cmd) { + case 1: + { + ARG_UINT32(endSignalPropertyId); + _credits = new BbdouCredits(_vm); + _credits->start(endSignalPropertyId, 0.5); + } + break; + case 2: + _credits->drawNextLine(); + break; + case 3: + _credits->stop(); + delete _credits; + default: + break; + } +} + void BbdouSpecialCode::spcSaladCtl(OpCall &opCall) { ARG_UINT32(cmd); ARG_UINT32(sequenceId); @@ -352,7 +375,7 @@ void BbdouSpecialCode::spcRunCause(OpCall &opCall) { ARG_UINT32(objectId1); ARG_UINT32(objectId2); Control *cursorControl = _vm->getObjectControl(cursorObjectId); - debug("runCause(%08X, %08X, %08X)", verbId, objectId1, objectId2); + debug(0, "runCause(%08X, %08X, %08X)", verbId, objectId1, objectId2); runCause(cursorControl, _cursor->_data, verbId, objectId1, objectId2, 0); } diff --git a/engines/illusions/bbdou/bbdou_specialcode.h b/engines/illusions/bbdou/bbdou_specialcode.h index d117cd7231..973d4b40f8 100644 --- a/engines/illusions/bbdou/bbdou_specialcode.h +++ b/engines/illusions/bbdou/bbdou_specialcode.h @@ -31,6 +31,7 @@ namespace Illusions { class IllusionsEngine_BBDOU; class BbdouBubble; +class BbdouCredits; class BbdouCursor; class BbdouInventory; struct CursorData; @@ -101,6 +102,8 @@ public: BbdouCursor *_cursor; BbdouBubble *_bubble; BbdouInventory *_inventory; + + BbdouCredits *_credits; // Salad uint _saladCount; @@ -136,6 +139,7 @@ public: void spcInitMenu(OpCall &opCall); void spcIsCursorHoldingObjectId(OpCall &opCall); void spcInitRadarMicrophone(OpCall &opCall); + void spcCreditsCtl(OpCall &opCall); void spcSaladCtl(OpCall &opCall); void spcRunCause(OpCall &opCall); diff --git a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp index 6004f44160..1abcb69197 100644 --- a/engines/illusions/bbdou/scriptopcodes_bbdou.cpp +++ b/engines/illusions/bbdou/scriptopcodes_bbdou.cpp @@ -295,7 +295,8 @@ void ScriptOpcodes_BBDOU::opUnloadActiveScenes(ScriptThread *scriptThread, OpCal //uint32 dsceneId = 0x0001000C, dthreadId = 0x00020011;//Cafeteria //uint32 dsceneId = 0x0001000B, dthreadId = 0x00020010; //uint32 dsceneId = 0x0001001A, dthreadId = 0x0002001F; -uint32 dsceneId = 0x00010047, dthreadId = 0x0002005F; +//uint32 dsceneId = 0x00010047, dthreadId = 0x0002005F; +uint32 dsceneId = 0x0001007D, dthreadId = 0x000203B9; void ScriptOpcodes_BBDOU::opChangeScene(ScriptThread *scriptThread, OpCall &opCall) { ARG_SKIP(2); |