diff options
author | Kamil Zbróg | 2013-10-28 17:07:28 +0000 |
---|---|---|
committer | Kamil Zbróg | 2013-10-28 17:07:28 +0000 |
commit | 6734377e1bbb00403e11ef2194e890d8529e791b (patch) | |
tree | d2889578042cd056b9780f2b0b8be84dd106cf43 /engines | |
parent | 39265b7a4b3e39348165b126ae53c9d89ccf32a9 (diff) | |
parent | 5653a89e81d600b2388831cfe05c36d3068813b5 (diff) | |
download | scummvm-rg350-6734377e1bbb00403e11ef2194e890d8529e791b.tar.gz scummvm-rg350-6734377e1bbb00403e11ef2194e890d8529e791b.tar.bz2 scummvm-rg350-6734377e1bbb00403e11ef2194e890d8529e791b.zip |
Merge branch 'master' into prince
Diffstat (limited to 'engines')
69 files changed, 839 insertions, 264 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index ef30faa87c..4ddeedce94 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -48,6 +48,35 @@ const int32 Animation::kCatacombMap[8][8] = { AnimationType::AnimationType(Animation *anim) { _anim = anim; + + _yLength = 0; + for (int i = 0; i < 24; i++) { + _mani[i] = nullptr; + _sil[i] = nullptr; + } + _frameNum = 0; + _seq = 0; + _characterId = 0; + _count = 0; + _facingDir = kDirNone; + _stepNum = 0; + _x = 0; + _y = 0; + _moveX = 0; + _moveY = 0; + _quick = false; + _visible = false; + _homing = false; + _doCheck = false; + _homingX = 0; + _homingY = 0; + _speedX = 0; + _speedY = 0; + _vanishIfStill = false; + _callEachStepFl = false; + _eachStepProc = Animation::kProcNone; + _fgBubbleCol = kColorWhite; + _bgBubbleCol = kColorBlack; } /** @@ -370,6 +399,13 @@ Animation::Animation(AvalancheEngine *vm) { for (int16 i = 0; i < kSpriteNumbMax; i++) { _sprites[i] = new AnimationType(this); } + + _direction = kDirNone; + _oldDirection = kDirNone; + _arrowTriggered = false; + _geidaSpin = 0; + _geidaTime = 0; + _sayWhat = 0; } Animation::~Animation() { @@ -1202,6 +1238,8 @@ void Animation::animLink() { case kProcGeida : geidaProcs(i); break; + default: + break; } } } diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 33f6ab02a6..3223615985 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -97,7 +97,8 @@ public: static const byte kSpriteNumbMax = 5; // current max no. of sprites enum Proc { - kProcFollowAvvyY = 1, + kProcNone = 0, + kProcFollowAvvyY, kProcBackAndForth, kProcFaceAvvy, kProcArrow, diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 4f3868768a..9c83c2c9f5 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -41,17 +41,9 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription * TimeDate time; _system->getTimeAndDate(time); _rnd->setSeed(time.tm_sec + time.tm_min + time.tm_hour); - - // Needed because of Lucerna::load_also() - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) - _also[i][j] = nullptr; - } - - _totalTime = 0; _showDebugLines = false; - - memset(_fxPal, 0, 16 * 16 * 3); + + initVariables(); } AvalancheEngine::~AvalancheEngine() { @@ -82,6 +74,56 @@ AvalancheEngine::~AvalancheEngine() { } } +void AvalancheEngine::initVariables() { + // Needed because of Lucerna::load_also() + for (int i = 0; i < 31; i++) { + _also[i][0] = nullptr; + _also[i][1] = nullptr; + } + + _totalTime = 0; + + memset(_fxPal, 0, 16 * 16 * 3); + + for (int i = 0; i < 15; i++) { + _peds[i]._direction = kDirNone; + _peds[i]._x = 0; + _peds[i]._y = 0; + _magics[i]._operation = kMagicNothing; + _magics[i]._data = 0; + } + + for (int i = 0; i < 7; i++) { + _portals[i]._operation = kMagicNothing; + _portals[i]._data = 0; + } + + for (int i = 0; i < 30; i++) { + _fields[i]._x1 = 0; + _fields[i]._y1 = 0; + _fields[i]._x2 = 0; + _fields[i]._y2 = 0; + } + + _fieldNum = 0; + _cp = 0; + _ledStatus = 177; + _alive = false; + _subjectNum = 0; + _him = kPeoplePardon; + _her = kPeoplePardon; + _it = Parser::kPardon; + _roomTime = 0; + _doingSpriteRun = false; + _isLoaded = false; + _soundFx = true; + _spludwickAtHome = false; + _passedCwytalotInHerts = false; + _holdTheDawn = false; + _lastRoom = 0; + _lastRoomNotMap = 0; +} + Common::ErrorCode AvalancheEngine::initialize() { _graphics = new GraphicManager(this); _parser = new Parser(this); @@ -166,17 +208,17 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_arrowInTheDoor); if (sz.isSaving()) { - uint16 like2drinkSize = _favouriteDrink.size(); + uint16 like2drinkSize = _favoriteDrink.size(); sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { - char actChr = _favouriteDrink[i]; + char actChr = _favoriteDrink[i]; sz.syncAsByte(actChr); } - uint16 favourite_songSize = _favouriteSong.size(); - sz.syncAsUint16LE(favourite_songSize); - for (uint16 i = 0; i < favourite_songSize; i++) { - char actChr = _favouriteSong[i]; + uint16 favoriteSongSize = _favoriteSong.size(); + sz.syncAsUint16LE(favoriteSongSize); + for (uint16 i = 0; i < favoriteSongSize; i++) { + char actChr = _favoriteSong[i]; sz.syncAsByte(actChr); } @@ -194,23 +236,23 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(actChr); } } else { - if (!_favouriteDrink.empty()) - _favouriteDrink.clear(); + if (!_favoriteDrink.empty()) + _favoriteDrink.clear(); uint16 like2drinkSize = 0; char actChr = ' '; sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { sz.syncAsByte(actChr); - _favouriteDrink += actChr; + _favoriteDrink += actChr; } - if (!_favouriteSong.empty()) - _favouriteSong.clear(); + if (!_favoriteSong.empty()) + _favoriteSong.clear(); uint16 favourite_songSize = 0; sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { sz.syncAsByte(actChr); - _favouriteSong += actChr; + _favoriteSong += actChr; } if (!_worstPlaceOnEarth.empty()) diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index cc9a34d82b..3cc342ca8c 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -207,7 +207,7 @@ public: bool _standingOnDais; // In room 71, inside Cardiff Castle. bool _takenPen; // Have you taken the pen (in Cardiff?) bool _arrowInTheDoor; // Did the arrow hit the wall? - Common::String _favouriteDrink, _favouriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's + Common::String _favoriteDrink, _favoriteSong, _worstPlaceOnEarth, _spareEvening; // Personalisation str's uint32 _totalTime; // Your total time playing this game, in ticks. byte _jumpStatus; // Fixes how high you're jumping. bool _mushroomGrowing; // Is the mushroom growing in 42? @@ -316,6 +316,7 @@ private: Common::String readAlsoStringFromFile(Common::File &file); void runAvalot(); void init(); + void initVariables(); void setup(); void scram(Common::String &str); void unScramble(); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 8ef41a2c93..36ce16d09c 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -118,10 +118,13 @@ Room AvalancheEngine::_whereIs[29] = { Clock::Clock(AvalancheEngine *vm) { _vm = vm; + // Magic value to determine if we just created the instance _oldHour = _oldHourAngle = _oldMinute = 17717; + _hour = _minute = _second = 0; + _hourAngle = 0; } -void Clock::update() { // TODO: Move variables from Gyro to here (or at least somewhere nearby), rename them. +void Clock::update() { TimeDate t; _vm->_system->getTimeAndDate(t); _hour = t.tm_hour; @@ -177,7 +180,9 @@ void Clock::plotHands() { } void Clock::chime() { - if ((_oldHour == 17717) || (!_vm->_soundFx)) // Too high - must be first time around + // Too high - must be first time around + // Mute - skip the sound generation + if ((_oldHour == 17717) || (!_vm->_soundFx)) return; byte hour = _hour % 12; @@ -1229,7 +1234,7 @@ void AvalancheEngine::checkClick() { _parser->_thing += 49; _parser->_person = kPeoplePardon; } else { - _parser->_person = (People) _thinks; + _parser->_person = (People)_thinks; _parser->_thing = _parser->kPardon; } callVerb(kVerbCodeExam); @@ -1448,8 +1453,8 @@ void AvalancheEngine::resetVariables() { _standingOnDais = false; _takenPen = false; _arrowInTheDoor = false; - _favouriteDrink = ""; - _favouriteSong = ""; + _favoriteDrink = ""; + _favoriteSong = ""; _worstPlaceOnEarth = ""; _spareEvening = ""; _totalTime = 0; @@ -1502,7 +1507,7 @@ void AvalancheEngine::newGame() { _dialogs->setBubbleStateNatural(); _spareEvening = "answer a questionnaire"; - _favouriteDrink = "beer"; + _favoriteDrink = "beer"; _money = 30; // 2/6 _animation->setDirection(kDirStopped); _parser->_wearing = kObjectClothes; @@ -1564,10 +1569,12 @@ Common::String AvalancheEngine::getName(People whose) { static const char lasses[4][15] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; - if (whose < kPeopleArkata) + if (whose <= kPeopleJacques) return Common::String(lads[whose - kPeopleAvalot]); - else + else if ((whose >= kPeopleArkata) && (whose <= kPeopleWisewoman)) return Common::String(lasses[whose - kPeopleArkata]); + else + error("getName() - Unexpected character id %d", (byte) whose); } Common::String AvalancheEngine::getItem(byte which) { @@ -1674,6 +1681,9 @@ void AvalancheEngine::flipRoom(Room room, byte ped) { if (_room == kRoomLustiesRoom) _enterCatacombsFromLustiesRoom = true; + if (room > kRoomMap) + return; + enterRoom(room, ped); _animation->appearPed(0, ped - 1); _enterCatacombsFromLustiesRoom = false; diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp index c84c049c8f..4d71550213 100644 --- a/engines/avalanche/background.cpp +++ b/engines/avalanche/background.cpp @@ -37,6 +37,7 @@ const int16 Background::kOnDisk = -1; Background::Background(AvalancheEngine *vm) { _vm = vm; _spriteNum = 0; + _nextBell = 0; } Background::~Background() { diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index e5acd9cae2..4b6cacf569 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -59,6 +59,19 @@ const QuasipedType Dialogs::kQuasipeds[16] = { Dialogs::Dialogs(AvalancheEngine *vm) { _vm = vm; _noError = true; + + _aboutBox = false; + _talkX = 0; + _talkY = 0; + _maxLineNum = 0; + _scReturn = false; + _currentFont = kFontStyleRoman; + _param = 0; + _useIcon = 0; + _scrollBells = 0; + _underScroll = 0; + _shadowBoxX = 0; + _shadowBoxY = 0; } void Dialogs::init() { @@ -689,6 +702,7 @@ void Dialogs::displayText(Common::String text) { if (_param == 0) setBubbleStateNatural(); else if ((1 <= _param) && (_param <= 9)) { + assert(_param - 1 < _vm->_animation->kSpriteNumbMax); AnimationType *spr = _vm->_animation->_sprites[_param - 1]; if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid. _vm->errorLed(); @@ -699,6 +713,7 @@ void Dialogs::displayText(Common::String text) { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) + assert(_param - 10 < 16); PedType *quasiPed = &_vm->_peds[kQuasipeds[_param - 10]._whichPed]; _talkX = quasiPed->_x; _talkY = quasiPed->_y; // Position. @@ -729,10 +744,10 @@ void Dialogs::displayText(Common::String text) { } break; case 3: - displayText(_vm->_favouriteDrink + kControlToBuffer); + displayText(_vm->_favoriteDrink + kControlToBuffer); break; case 4: - displayText(_vm->_favouriteSong + kControlToBuffer); + displayText(_vm->_favoriteSong + kControlToBuffer); break; case 5: displayText(_vm->_worstPlaceOnEarth + kControlToBuffer); @@ -1164,7 +1179,9 @@ void Dialogs::sayThanks(byte thing) { Common::String tmpStr = personSpeaks(); tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", kControlSpeechBubble); displayText(tmpStr); - _vm->_objects[thing] = false; + + if (thing < kObjectNum) + _vm->_objects[thing] = false; } /** diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 25b01d65f3..d7c32cb1fc 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -49,6 +49,7 @@ const MouseHotspotType GraphicManager::kMouseHotSpots[9] = { GraphicManager::GraphicManager(AvalancheEngine *vm) { _vm = vm; + setDialogColor(kColorBlack, kColorWhite); } GraphicManager::~GraphicManager() { diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index bba8e862a9..7c37b79bc8 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -207,6 +207,11 @@ void MenuItem::parseKey(char c) { _menu->_vm->_sound->blip(); } +MenuBar::MenuBar() { + _menuNum = 0; + _menu = nullptr; +} + void MenuBar::init(Menu *menu) { _menu = menu; _menuNum = 0; @@ -261,6 +266,9 @@ Menu::Menu(AvalancheEngine *vm) { _vm = vm; _activeMenuItem.init(this); _menuBar.init(this); + + _menuActive = false; + _lastPerson = kPeopleNone; } void Menu::findWhatYouCanDoWithIt() { @@ -782,10 +790,12 @@ byte Menu::getNameChar(People whose) { static const char ladChar[] = "ASCDMTRwLfgeIyPu"; static const char lassChar[] = "kG\0xB1o"; - if (whose < kPeopleArkata) + if (whose <= kPeopleJacques) return ladChar[whose - kPeopleAvalot]; - else + else if ((whose >= kPeopleArkata) && (whose <= kPeopleWisewoman)) return lassChar[whose - kPeopleArkata]; + else + error("getName() - Unexpected character id %d", (byte) whose); } Common::String Menu::getThing(byte which) { diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h index a7ec8bf2db..b7674fbb9d 100644 --- a/engines/avalanche/menu.h +++ b/engines/avalanche/menu.h @@ -102,6 +102,7 @@ public: HeadType _menuItems[8]; byte _menuNum; + MenuBar(); void init(Menu *menu); void createMenuItem(char trig, Common::String title, char altTrig, MenuFunc setupFunc, MenuFunc chooseFunc); void draw(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index fc176c78b0..9b6b841c8a 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -37,6 +37,21 @@ const char *Parser::kVersionNum = "1.30"; Parser::Parser(AvalancheEngine *vm) { _vm = vm; + + _verb = kVerbCodePardon; + _thing = kPardon; + _person = kPeopleNone; + _polite = false; + _inputTextPos = 0; + _quote = false; + _cursorState = false; + _weirdWord = false; + _wearing = kNothing; + _thing2 = 0; + _sworeNum = 0; + _alcoholLevel = 0; + _playedNim = 0; + _boughtOnion = false; } void Parser::init() { @@ -692,13 +707,13 @@ void Parser::storeInterrogation(byte interrogation) { case 1: _inputText.toLowercase(); _vm->_dialogs->sayIt(_inputText); - _vm->_favouriteDrink = _inputText; + _vm->_favoriteDrink = _inputText; _vm->_cardiffQuestionNum = 2; break; case 2: properNouns(); _vm->_dialogs->sayIt(_inputText); - _vm->_favouriteSong = _inputText; + _vm->_favoriteSong = _inputText; _vm->_cardiffQuestionNum = 3; break; case 3: @@ -1013,12 +1028,15 @@ bool Parser::isHolding() { bool holdingResult = false; - if (_thing > 100) + if (_thing >= 100) _vm->_dialogs->displayText("Be reasonable!"); - else if (!_vm->_objects[_thing - 1]) - // Verbs that need "_thing" to be in the inventory. - _vm->_dialogs->displayText("You're not holding it, Avvy."); - else + else if (_thing <= kObjectNum) { + if (!_vm->_objects[_thing - 1]) + // Verbs that need "_thing" to be in the inventory. + _vm->_dialogs->displayText("You're not holding it, Avvy."); + else + holdingResult = true; + } else holdingResult = true; return holdingResult; @@ -1053,8 +1071,10 @@ void Parser::examine() { examineObject(); else if ((50 <= _thing) && (_thing <= 100)) { // Also _thing + int id = _thing - 50; + assert(id < 31); openBox(true); - _vm->_dialogs->displayText(*_vm->_also[_thing - 50][1]); + _vm->_dialogs->displayText(*_vm->_also[id][1]); openBox(false); } } @@ -2452,7 +2472,7 @@ void Parser::doVerb(VerbCode id) { } void Parser::resetVariables() { - _wearing = 0; + _wearing = kNothing; _sworeNum = 0; _alcoholLevel = 0; _playedNim = 0; diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 261e5ecefe..bdb5ab9bc1 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -66,7 +66,7 @@ public: Common::String _inputText; // Original name: current Common::String _inputTextBackup; byte _inputTextPos; // Original name: curpos - bool _quote; // 66 or 99 next? + bool _quote; bool _cursorState; bool _weirdWord; diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 10fa7f0a00..3a60c4ec1d 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -34,6 +34,8 @@ namespace Avalanche { Sequence::Sequence(AvalancheEngine *vm) { _vm = vm; + + resetVariables(); } void Sequence::resetVariables() { diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index 796764d0a9..fe72238a02 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -35,12 +35,17 @@ namespace Fullpipe { #define MSG_ENABLESAVES 5202 #define MSG_HMRKICK_METAL 4764 #define MSG_HMRKICK_STUCCO 4765 +#define MSG_INTR_ENDINTRO 5139 +#define MSG_INTR_GETUPMAN 5135 +#define MSG_INTR_SWITCHTO1 5145 +#define MSG_INTR_SWITCHTO2 5134 #define MSG_MANSHADOWSOFF 5196 #define MSG_MANSHADOWSON 5197 #define MSG_RESTARTGAME 4767 #define MSG_SC1_SHOWOSK 1019 #define MSG_SC1_SHOWOSK2 468 #define MSG_SC1_UTRUBACLICK 1100 +#define MV_IN1MAN_SLEEP 5111 #define MV_MAN_GOLADDER 451 #define MV_MAN_GOLADDER2 2844 #define MV_MAN_LOOKUP 4773 @@ -93,6 +98,9 @@ namespace Fullpipe { #define PIC_SC1_OSK 1018 #define PIC_SC1_OSK2 2932 #define PIC_SCD_SEL 734 +#define QU_IN2_DO 5144 +#define QU_INTR_FINISH 5138 +#define QU_INTR_GETUPMAN 5136 #define SC_1 301 #define SC_10 653 #define SC_11 654 @@ -147,6 +155,7 @@ namespace Fullpipe { #define SC_TITLES 5166 #define SND_CMN_031 3516 #define SND_CMN_070 5199 +#define ST_IN1MAN_SLEEP 5112 #define ST_LBN_0N 2832 #define ST_LBN_0P 2833 #define ST_LBN_1N 2753 diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index d58212dc29..cad1934c5f 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -344,6 +344,13 @@ void MessageQueue::deleteExCommandByIndex(uint idx, bool doFree) { delete *it; } +void MessageQueue::transferExCommands(MessageQueue *mq) { + while (mq->_exCommands.size()) { + _exCommands.push_back(mq->_exCommands.front()); + mq->_exCommands.pop_front(); + } +} + void MessageQueue::sendNextCommand() { if (_exCommands.size()) { if (!(_flags & 4) && (_flags & 1)) { @@ -749,4 +756,23 @@ void updateGlobalMessageQueue(int id, int objid) { } } +bool chainQueue(int queueId, int flags) { + MessageQueue *mq = g_fullpipe->_currentScene->getMessageQueueById(queueId); + + if (!mq) + return false; + + MessageQueue *nmq = new MessageQueue(mq, 0, 0); + + nmq->_flags |= flags; + + if (!mq->chain(0)) { + delete mq; + + return false; + } + + return true; +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index a3533e1bd2..3e0da292d5 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -123,6 +123,8 @@ class MessageQueue : public CObject { ExCommand *getExCommandByIndex(uint idx); void deleteExCommandByIndex(uint idx, bool doFree); + void transferExCommands(MessageQueue *mq); + void replaceKeyCode(int key1, int key2); bool chain(StaticANIObject *ani); @@ -171,6 +173,8 @@ void processMessages(); void updateGlobalMessageQueue(int id, int objid); void clearGlobalMessageQueueList1(); +bool chainQueue(int queueId, int flags); + } // End of namespace Fullpipe #endif /* FULLPIPE_MESSAGEQUEUE_H */ diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 26048ced13..85999bcadb 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -28,29 +28,6 @@ namespace Fullpipe { -bool BaseModalObject::handleMessage(ExCommand *message) { - warning("STUB: BaseModalObject::handleMessage()"); - - return true; -} - -bool BaseModalObject::init(int counterdiff) { - warning("STUB: BaseModalObject::init(%d)", counterdiff); - - return true; -} - -bool BaseModalObject::update() { - warning("STUB: BaseModalObject::update()"); - - return true; -} - -void BaseModalObject::saveload() { - warning("STUB: BaseModalObject::saveload()"); -} - - ModalIntro::ModalIntro() { _field_8 = 0; _countDown = 0; @@ -91,6 +68,22 @@ bool ModalIntro::handleMessage(ExCommand *message) { return true; } +bool ModalIntro::init(int counterdiff) { + warning("STUB: ModalIntro::init(%d)", counterdiff); + + return true; +} + +bool ModalIntro::update() { + warning("STUB: ModalIntro::update()"); + + return true; +} + +void ModalIntro::saveload() { + // No saveload +} + void FullpipeEngine::openMap() { warning("STUB: FullpipeEngine::openMap()"); } diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 7d98427e20..3562622bde 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -34,11 +34,10 @@ class BaseModalObject { BaseModalObject() : _parentObj(0) {} virtual ~BaseModalObject() {} - virtual bool handleMessage(ExCommand *message); - virtual bool init(int counterdiff); - virtual bool update(); - - void saveload(); + virtual bool handleMessage(ExCommand *message) = 0; + virtual bool init(int counterdiff) = 0; + virtual bool update() = 0; + virtual void saveload() = 0; }; class ModalIntro : public BaseModalObject { @@ -52,6 +51,9 @@ class ModalIntro : public BaseModalObject { ModalIntro(); virtual bool handleMessage(ExCommand *message); + virtual bool init(int counterdiff); + virtual bool update(); + virtual void saveload(); }; } // End of namespace Fullpipe diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index a6d32cfb48..aa7d02a405 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -357,6 +357,18 @@ double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzz return res; } +void MovGraph::calcNodeDistancesAndAngles() { + for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { + assert(((CObject *)*i)->_objtype == kObjTypeMovGraphLink); + + MovGraphLink *lnk = (MovGraphLink *)*i; + + lnk->_flags &= 0x7FFFFFFF; + + lnk->calcNodeDistanceAndAngle(); + } +} + int MovGraph2::getItemIndexByGameObjectId(int objectId) { for (uint i = 0; i < _items.size(); i++) if (_items[i]->_objectId == objectId) @@ -660,10 +672,45 @@ void MovGraph2::freeItems() { warning("STUB: MovGraph2::freeItems()"); } -MessageQueue *MovGraph2::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { - warning("STUB: MovGraph2::method34()"); +MessageQueue *MovGraph2::method34(StaticANIObject *ani, int xpos, int ypos, int fuzzyMatch, int staticsId) { + if (!ani->isIdle()) + return 0; + + if (ani->_flags & 0x100) + return 0; - return 0; + MessageQueue *mq = doWalkTo(ani, xpos, ypos, fuzzyMatch, staticsId); + + if (!mq) + return 0; + + if (ani->_movement) { + if (mq->getCount() <= 1 || mq->getExCommandByIndex(0)->_messageKind != 22) { + PicAniInfo picAniInfo; + + ani->getPicAniInfo(&picAniInfo); + ani->updateStepPos(); + MessageQueue *mq1 = doWalkTo(ani, xpos, ypos, fuzzyMatch, staticsId); + + ani->setPicAniInfo(&picAniInfo); + + if (mq1) { + delete mq; + + mq = mq1; + } + } else { + ani->_movement = 0; + } + } + + if (!mq->chain(ani)) { + delete mq; + + return 0; + } + + return mq; } MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int fuzzyMatch, int staticsId) { @@ -924,9 +971,17 @@ MovGraphNode *MovGraph2::findNode(int x, int y, int fuzzyMatch) { } int MovGraph2::getShortSide(MovGraphLink *lnk, int x, int y) { - warning("STUB: MovGraph2::getShortSide()"); + bool cond; - return 0; + if (lnk) + cond = abs(lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x) > abs(lnk->_movGraphNode2->_y - lnk->_movGraphNode1->_y); + else + cond = abs(x) > abs(y); + + if (cond) + return x <= 0; + else + return ((y > 0) + 2); } int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common::Rect *rect, Common::Point *point) { @@ -1124,9 +1179,22 @@ double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, } MovGraphNode *MovGraph::calcOffset(int ox, int oy) { - warning("STUB: MovGraph::calcOffset()"); + MovGraphNode *res = 0; + double mindist = 1.0e10; - return 0; + for (ObList::iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + assert(((CObject *)*i)->_objtype == kObjTypeMovGraphNode); + + MovGraphNode *node = (MovGraphNode *)*i; + + double dist = sqrt((double)((node->_x - oy) * (node->_x - oy) + (node->_x - ox) * (node->_x - ox))); + if (dist < mindist) { + mindist = dist; + res = node; + } + } + + return res; } void MGM::clear() { @@ -1227,6 +1295,16 @@ bool MovGraphLink::load(MfcArchive &file) { return true; } +void MovGraphLink::calcNodeDistanceAndAngle() { + if (_movGraphNode1) { + double dx = _movGraphNode2->_x - _movGraphNode1->_x; + double dy = _movGraphNode2->_y - _movGraphNode1->_y; + + _distance = sqrt(dy * dy + dx * dx); + _angle = atan2(dx, dy); + } +} + bool MovGraphNode::load(MfcArchive &file) { debug(5, "MovGraphNode::load()"); diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 85ad084f60..7da0c47fb2 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -206,6 +206,8 @@ class MovGraphLink : public CObject { public: MovGraphLink(); virtual bool load(MfcArchive &file); + + void calcNodeDistanceAndAngle(); }; struct MovGraphItem { @@ -255,6 +257,7 @@ class MovGraph : public MotionController { virtual int method50(); double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch); + void calcNodeDistancesAndAngles(); MovGraphNode *calcOffset(int ox, int oy); }; diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 40d9f21afb..1793ffdc3a 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -1422,8 +1422,57 @@ void sceneIntro_initScene(Scene *sc) { g_fullpipe->_modalObject = new ModalIntro; } -int sceneHandlerIntro(ExCommand *cmd) { - warning("STUB: sceneHandlerIntro()"); +void sceneHandlerIntro_part1() { + g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO1); + chainQueue(QU_INTR_FINISH, 0); +} + +void sceneHandlerIntro_part2() { + g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO2); + chainQueue(QU_IN2_DO, 0); +} + +int sceneHandlerIntro(ExCommand *ex) { + if (ex->_messageKind != 17) + return 0; + + switch (ex->_messageNum) { + case MSG_INTR_ENDINTRO: + g_vars->sceneIntro_playing = 0; + return 0; + + case MSG_INTR_SWITCHTO1: + sceneHandlerIntro_part1(); + return 0; + + case MSG_INTR_GETUPMAN: + g_vars->sceneIntro_needSleep = 0; + g_vars->sceneIntro_needGetup = 1; + return 0; + + case MSG_INTR_SWITCHTO2: + sceneHandlerIntro_part2(); + return 0; + + case 33: + // fall trhough + break; + + default: + return 0; + } + + if (g_vars->sceneIntro_needSleep) { + if (!g_vars->sceneIntro_aniin1man->_movement && g_vars->sceneIntro_aniin1man->_statics->_staticsId == ST_IN1MAN_SLEEP) + g_vars->sceneIntro_aniin1man->startAnim(MV_IN1MAN_SLEEP, 0, -1); + } else if (g_vars->sceneIntro_needGetup && !g_vars->sceneIntro_aniin1man->_movement && + g_vars->sceneIntro_aniin1man->_statics->_staticsId == ST_IN1MAN_SLEEP) { + g_vars->sceneIntro_needGetup = 0; + + chainQueue(QU_INTR_GETUPMAN, 0); + } + + g_fullpipe->startSceneTrack(); return 0; } diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 0e9daadd45..0599125269 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -73,6 +73,27 @@ Common::Point *StepArray::getCurrPoint(Common::Point *point) { return point; } +Common::Point *StepArray::getPoint(Common::Point *point, int index, int offset) { + if (index == -1) + index = _currPointIndex; + + if (index + offset > _maxPointIndex - 1) + offset = _maxPointIndex - index; + + point->x = 0; + point->y = 0; + + while (offset >= 1) { + point->x += _points[index]->x; + point->y += _points[index]->y; + + index++; + offset--; + } + + return point; +} + bool StepArray::gotoNextPoint() { if (_currPointIndex < _maxPointIndex) { _currPointIndex++; @@ -628,6 +649,19 @@ Common::Point *StaticANIObject::getCurrDimensions(Common::Point &p) { return &p; } +Common::Point *StaticANIObject::getSomeXY(Common::Point &p) { + if (_movement) { + _movement->getCurrDynamicPhaseXY(p); + + return &p; + } + + if (_statics) + _statics->getSomeXY(p); + + return &p; +} + void StaticANIObject::update(int counterdiff) { int mqid; @@ -744,6 +778,26 @@ void StaticANIObject::update(int counterdiff) { } } +void StaticANIObject::updateStepPos() { + Common::Point point; + + int ox = _movement->_ox; + int oy = _movement->_oy; + + _movement->calcSomeXY(point, 1); + int x = point.x; + int y = point.y; + + _stepArray.getPoint(&point, -1, _stepArray.getPointsCount()); + x += point.x; + y += point.y; + + _statics = _movement->_staticsObj2; + _movement = 0; + + setOXY(ox + x, oy + y); +} + void StaticANIObject::stopAnim_maybe() { debug(6, "StaticANIObject::stopAnim_maybe()"); diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index 2879edd8e1..49ebc8edf7 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -42,7 +42,10 @@ class StepArray : public CObject { void clear(); int getCurrPointIndex() { return _currPointIndex; } + int getPointsCount() { return _maxPointIndex; } + Common::Point *getCurrPoint(Common::Point *point); + Common::Point *getPoint(Common::Point *point, int index, int offset); bool gotoNextPoint(); }; @@ -201,6 +204,8 @@ class StaticANIObject : public GameObject { Movement *getMovementByName(char *name); Common::Point *getCurrDimensions(Common::Point &p); + Common::Point *getSomeXY(Common::Point &p); + void clearFlags(); void setFlags40(bool state); bool isIdle(); @@ -234,6 +239,7 @@ class StaticANIObject : public GameObject { MovTable *countMovements(); void setSpeed(int speed); + void updateStepPos(); void stopAnim_maybe(); MessageQueue *changeStatics1(int msgNum); diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 63f84d25e1..867bd4d7ae 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -454,9 +454,10 @@ void Timer::dispatch() { if (_endFrame) { uint32 frameNumber = BF_GLOBALS._events.getFrameNumber(); - if (frameNumber > _endFrame) + if (frameNumber > _endFrame) { // Timer has expired signal(); + } } } @@ -472,7 +473,8 @@ void Timer::set(uint32 delay, EventHandler *endHandler) { /*--------------------------------------------------------------------------*/ TimerExt::TimerExt(): Timer() { - _action = NULL; + _action = nullptr; + _newAction = nullptr; } void TimerExt::set(uint32 delay, EventHandler *endHandler, Action *newAction) { @@ -909,6 +911,7 @@ void PalettedScene::add2Faders(const byte *arrBufferRGB, int step, int paletteNu void PalettedScene::transition(const byte *arrBufferRGB, int percent, int paletteNum, Action *action, int fromColor1, int fromColor2, int toColor1, int toColor2, bool flag) { byte tmpPalette[768]; + memset(tmpPalette, 0, 768); _palette.loadPalette(paletteNum); _palette.loadPalette(2); diff --git a/engines/tsage/blue_force/blueforce_scenes0.cpp b/engines/tsage/blue_force/blueforce_scenes0.cpp index f1f00599e0..7c52d67f80 100644 --- a/engines/tsage/blue_force/blueforce_scenes0.cpp +++ b/engines/tsage/blue_force/blueforce_scenes0.cpp @@ -343,7 +343,7 @@ void Scene50::synchronize(Serializer &s) { void Scene50::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(); - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; T2_GLOBALS._uiElements._active = false; BF_GLOBALS._player.postInit(); BF_GLOBALS._player.setVisage(830); @@ -419,6 +419,8 @@ void Scene50::postInit(SceneObjectList *OwnerList) { tooltip = &_location8; xp = 75; break; + default: + error("Unexpected tooltip value %d", selectedTooltip); } _timer.set(240, this); diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp index 81e4af6e97..f343c9de96 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.cpp +++ b/engines/tsage/blue_force/blueforce_scenes3.cpp @@ -977,6 +977,11 @@ Scene315::Scene315() { _doorOpened = false; _invGreenCount = _bookGreenCount = 0; _invGangCount = _bookGangCount = 0; + + _field1390 = 0; + _stripNumber = 0; + _field1398 = 0; + _currentCursor = INV_NONE; } void Scene315::synchronize(Serializer &s) { @@ -1399,7 +1404,7 @@ bool Scene325::Item1::startAction(CursorType action, Event &event) { void Scene325::postInit(SceneObjectList *OwnerList) { SceneExt::postInit(); loadScene(325); - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; BF_GLOBALS.clearFlag(fCanDrawGun); if (BF_GLOBALS._dayNumber == 0) diff --git a/engines/tsage/blue_force/blueforce_scenes3.h b/engines/tsage/blue_force/blueforce_scenes3.h index ea9d5f7311..fdeabdaf5c 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.h +++ b/engines/tsage/blue_force/blueforce_scenes3.h @@ -210,7 +210,7 @@ public: WestExit _westExit; SouthWestExit _swExit; Action1 _action1; - int _field1390; + int _field1390; // Useless variable int _stripNumber; int _field1398; int _invGreenCount, _bookGreenCount, _invGangCount; diff --git a/engines/tsage/blue_force/blueforce_scenes4.cpp b/engines/tsage/blue_force/blueforce_scenes4.cpp index a10f311791..072761b5ac 100644 --- a/engines/tsage/blue_force/blueforce_scenes4.cpp +++ b/engines/tsage/blue_force/blueforce_scenes4.cpp @@ -39,7 +39,7 @@ namespace BlueForce { void Scene410::Action1::signal() { Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; - switch (scene->_field1FB6++) { + switch (scene->_action1Count++) { case 0: if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) { setDelay(3); @@ -136,7 +136,7 @@ void Scene410::Action5::signal() { switch (_actionIndex++) { case 0: - if (scene->_field1FC4 == 0) { + if (scene->_harrisonMovedFl == 0) { ADD_PLAYER_MOVER(114, 133); } else { ADD_PLAYER_MOVER(195, 139); @@ -167,7 +167,7 @@ void Scene410::Action6::signal() { switch (_actionIndex++) { case 0: - if (scene->_field1FC4 == 0) { + if (scene->_harrisonMovedFl == 0) { ADD_PLAYER_MOVER(114, 133); } else { ADD_PLAYER_MOVER(126, 99); @@ -243,7 +243,7 @@ bool Scene410::Motorcycle::startAction(CursorType action, Event &event) { } else if (BF_GLOBALS.getFlag(fSearchedTruck) && !BF_GLOBALS._sceneObjects->contains(&scene->_harrison)) { scene->_sceneMode = 4103; scene->signal(); - } else if (scene->_field1FBC != 0) { + } else if (scene->_cuffedDriverFl != 0) { SceneItem::display2(410, 12); } else { scene->_sceneMode = 4103; @@ -260,7 +260,7 @@ bool Scene410::TruckFront::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_USE: - if ((BF_GLOBALS._bookmark < bStoppedFrankie) && (!scene->_field1FBC || !scene->_field1FBA)) + if ((BF_GLOBALS._bookmark < bStoppedFrankie) && (!scene->_cuffedDriverFl || !scene->_field1FBA)) break; else if (BF_GLOBALS.getFlag(fSearchedTruck)) SceneItem::display2(410, 13); @@ -293,7 +293,7 @@ bool Scene410::Driver::startAction(CursorType action, Event &event) { } else { SceneItem::display2(410, 7); } - } else if (!scene->_field1FBC) { + } else if (!scene->_cuffedDriverFl) { SceneItem::display2(410, 7); } else if (!scene->_field1FC0) { scene->_sceneMode = 4124; @@ -309,13 +309,13 @@ bool Scene410::Driver::startAction(CursorType action, Event &event) { return true; case INV_HANDCUFFS: if (BF_GLOBALS.getFlag(fCalledBackup)) { - if ((scene->_talkCount < 5) || (scene->_field1FB6 < 1) || (scene->_field1FBC != 0)) + if ((scene->_talkCount < 5) || (scene->_action1Count < 1) || (scene->_cuffedDriverFl != 0)) break; BF_GLOBALS._player.disableControl(); scene->_sceneMode = 4123; scene->_stripManager.start(4125, scene); - scene->_field1FBC = 1; + scene->_cuffedDriverFl = 1; T2_GLOBALS._uiElements.addScore(30); } else { if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) { @@ -328,11 +328,11 @@ bool Scene410::Driver::startAction(CursorType action, Event &event) { case INV_TICKET_BOOK: if (!BF_GLOBALS.getFlag(fDriverOutOfTruck)) { return startAction(CURSOR_TALK, event); - } else if (!scene->_field1FC4) { + } else if (!scene->_harrisonMovedFl) { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 2; scene->setAction(&scene->_sequenceManager1, scene, 4120, &scene->_passenger, &BF_GLOBALS._player, NULL); - } else if ((scene->_field1FBC != 0) || (scene->_field1FC2 != 0)) { + } else if ((scene->_cuffedDriverFl != 0) || (scene->_field1FC2 != 0)) { break; } else { scene->_field1FC2 = 1; @@ -343,7 +343,7 @@ bool Scene410::Driver::startAction(CursorType action, Event &event) { } return true; case INV_MIRANDA_CARD: - if (scene->_field1FBC == 0) + if (scene->_cuffedDriverFl == 0) return false; if (BF_GLOBALS.getFlag(readFrankRights)) { @@ -455,7 +455,7 @@ bool Scene410::Harrison::startAction(CursorType action, Event &event) { SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 32, SET_EXT_BGCOLOR, 49, SET_EXT_FGCOLOR, 13, LIST_END); } - } else if ((scene->_field1FBA != 0) && (scene->_field1FBC != 0)) { + } else if ((scene->_field1FBA != 0) && (scene->_cuffedDriverFl != 0)) { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 4112; scene->_stripManager.start(4113, scene); @@ -476,13 +476,13 @@ bool Scene410::Harrison::startAction(CursorType action, Event &event) { BF_GLOBALS._walkRegions.enableRegion(22); scene->_sceneMode = 4122; scene->_stripManager.start(4112, scene); - } else if (scene->_field1FB6 < 1) { + } else if (scene->_action1Count < 1) { break; - } else if (scene->_field1FBC != 0) { + } else if (scene->_cuffedDriverFl != 0) { error("Error - want to cuff driver, but he's cuffed already"); } else { BF_GLOBALS._player.disableControl(); - scene->_field1FBC = 1; + scene->_cuffedDriverFl = 1; scene->_field1FC0 = 1; BF_GLOBALS._walkRegions.enableRegion(22); scene->_sceneMode = 4109; @@ -500,20 +500,20 @@ bool Scene410::Harrison::startAction(CursorType action, Event &event) { /*--------------------------------------------------------------------------*/ Scene410::Scene410(): SceneExt() { - _field1FB6 = _talkCount = _field1FBA = _field1FBC = 0; - _field1FBE = _field1FC0 = _field1FC2 = _field1FC4 = 0; + _action1Count = _talkCount = _field1FBA = _cuffedDriverFl = 0; + _field1FBE = _field1FC0 = _field1FC2 = _harrisonMovedFl = 0; } void Scene410::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_field1FB6); + s.syncAsSint16LE(_action1Count); s.syncAsSint16LE(_talkCount); s.syncAsSint16LE(_field1FBA); - s.syncAsSint16LE(_field1FBC); + s.syncAsSint16LE(_cuffedDriverFl); s.syncAsSint16LE(_field1FBE); s.syncAsSint16LE(_field1FC0); s.syncAsSint16LE(_field1FC2); - s.syncAsSint16LE(_field1FC4); + s.syncAsSint16LE(_harrisonMovedFl); } void Scene410::postInit(SceneObjectList *OwnerList) { @@ -593,7 +593,7 @@ void Scene410::postInit(SceneObjectList *OwnerList) { _patrolCar.fixPriority(148); _patrolCar.setPosition(Common::Point(39, 168)); - _field1FC4 = 1; + _harrisonMovedFl = 1; _sceneMode = 0; signal(); break; @@ -603,10 +603,10 @@ void Scene410::postInit(SceneObjectList *OwnerList) { _driver.remove(); _sceneMode = 0; } else { - _field1FC4 = BF_GLOBALS._v50CC8; + _harrisonMovedFl = BF_GLOBALS._scene410HarrisonMovedFl; _field1FBA = BF_GLOBALS._v50CC2; - _talkCount = BF_GLOBALS._v50CC6; - _field1FB6 = BF_GLOBALS._v50CC4; + _talkCount = BF_GLOBALS._scene410TalkCount; + _action1Count = BF_GLOBALS._scene410Action1Count; _passenger.setVisage(418); _passenger.setStrip(6); @@ -651,7 +651,7 @@ void Scene410::postInit(SceneObjectList *OwnerList) { _patrolCar.setDetails(410, 8, 9, 10, 1, (SceneItem *)NULL); _patrolCar.fixPriority(148); - if (_field1FC4) { + if (_harrisonMovedFl) { _harrison.setPosition(Common::Point(108, 112)); _patrolCar.fixPriority(148); _patrolCar.setPosition(Common::Point(39, 168)); @@ -664,7 +664,7 @@ void Scene410::postInit(SceneObjectList *OwnerList) { _sceneMode = 0; } - _field1FC4 = 1; + _harrisonMovedFl = 1; } break; case 50: @@ -686,10 +686,10 @@ void Scene410::signal() { BF_GLOBALS.set2Flags(f1097Frankie); BF_GLOBALS.clearFlag(f1097Marina); - BF_GLOBALS._v50CC8 = _field1FC4; + BF_GLOBALS._scene410HarrisonMovedFl = _harrisonMovedFl; BF_GLOBALS._v50CC2 = _field1FBA; - BF_GLOBALS._v50CC6 = _talkCount; - BF_GLOBALS._v50CC4 = _field1FB6; + BF_GLOBALS._scene410TalkCount = _talkCount; + BF_GLOBALS._scene410Action1Count = _action1Count; BF_GLOBALS._sceneManager.changeScene(60); break; case 2: @@ -760,7 +760,7 @@ void Scene410::signal() { break; case 4104: // After call for backup, patrol car is coming - _field1FC4 = 1; + _harrisonMovedFl = 1; BF_GLOBALS._player.disableControl(); _sceneMode = 0; setAction(&_sequenceManager1, this, 4104, &_patrolCar, &_harrison, NULL); diff --git a/engines/tsage/blue_force/blueforce_scenes4.h b/engines/tsage/blue_force/blueforce_scenes4.h index 937c015a4c..f46b2afdde 100644 --- a/engines/tsage/blue_force/blueforce_scenes4.h +++ b/engines/tsage/blue_force/blueforce_scenes4.h @@ -116,9 +116,10 @@ public: SpeakerDriver _driverSpeaker; SpeakerShooter _shooterSpeaker; ASoundExt _sound1; - int _field1FB6, _talkCount, _field1FBA; - int _field1FBC, _field1FBE; - int _field1FC0, _field1FC2, _field1FC4; + int _action1Count, _talkCount, _field1FBA; + int _cuffedDriverFl, _field1FBE; + int _field1FC0; // Useless variable + int _field1FC2, _harrisonMovedFl; Scene410(); virtual void postInit(SceneObjectList *OwnerList = NULL); diff --git a/engines/tsage/blue_force/blueforce_scenes5.cpp b/engines/tsage/blue_force/blueforce_scenes5.cpp index 0cf487daa9..1d23874533 100644 --- a/engines/tsage/blue_force/blueforce_scenes5.cpp +++ b/engines/tsage/blue_force/blueforce_scenes5.cpp @@ -1778,6 +1778,8 @@ void Scene570::IconManager::addItem(Icon *item) { Scene570::Icon::Icon(): NamedObject() { _iconId = _folderId = 0; + _parentFolderId = 0; + _mode = 0; } void Scene570::Icon::synchronize(Serializer &s) { diff --git a/engines/tsage/blue_force/blueforce_scenes5.h b/engines/tsage/blue_force/blueforce_scenes5.h index 56bf20c93b..ab78d02e11 100644 --- a/engines/tsage/blue_force/blueforce_scenes5.h +++ b/engines/tsage/blue_force/blueforce_scenes5.h @@ -257,7 +257,8 @@ class Scene570: public SceneExt { class Icon: public NamedObject { public: SceneText _sceneText; - int _iconId, _folderId, _parentFolderId, _mode; + int _iconId, _folderId, _parentFolderId; + int _mode; // Useless variable Common::String _text; Icon(); diff --git a/engines/tsage/blue_force/blueforce_scenes6.cpp b/engines/tsage/blue_force/blueforce_scenes6.cpp index 9467df7917..13334ece08 100644 --- a/engines/tsage/blue_force/blueforce_scenes6.cpp +++ b/engines/tsage/blue_force/blueforce_scenes6.cpp @@ -275,7 +275,7 @@ bool Scene666::Item1::startAction(CursorType action, Event &event) { void Scene666::postInit(SceneObjectList *OwnerList) { BF_GLOBALS._sound1.play(27); SceneExt::postInit(); - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; loadScene(999); BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0); diff --git a/engines/tsage/blue_force/blueforce_scenes9.cpp b/engines/tsage/blue_force/blueforce_scenes9.cpp index 52115b95fe..aa407282e2 100644 --- a/engines/tsage/blue_force/blueforce_scenes9.cpp +++ b/engines/tsage/blue_force/blueforce_scenes9.cpp @@ -1422,6 +1422,10 @@ void Scene910::Object13::setupBreaker(int x, int y, int mode, int8 frameNumber) BF_GLOBALS._sceneItems.push_front(this); } +Scene910::Object25::Object25() { + _field90 = _field92 = 0; +} + void Scene910::Object25::synchronize(Serializer &s) { NamedObject::synchronize(s); s.syncAsSint16LE(_field90); @@ -3577,7 +3581,7 @@ void Scene935::postInit(SceneObjectList *OwnerList) { PalettedScene::postInit(); loadScene(935); - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; BF_GLOBALS._player.disableControl(); _visualSpeaker._textMode = ALIGN_CENTER; _visualSpeaker._hideObjects = false; @@ -3812,7 +3816,7 @@ void Scene940::postInit(SceneObjectList *OwnerList) { BF_GLOBALS._sound1.play(115); BF_GLOBALS._dayNumber = 6; - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; T2_GLOBALS._uiElements._active = false; _gameTextSpeaker2._speakerName = "SENTTEXT"; diff --git a/engines/tsage/blue_force/blueforce_scenes9.h b/engines/tsage/blue_force/blueforce_scenes9.h index 74708b94de..8bf7f343a1 100644 --- a/engines/tsage/blue_force/blueforce_scenes9.h +++ b/engines/tsage/blue_force/blueforce_scenes9.h @@ -188,6 +188,7 @@ class Scene910: public PalettedScene { class Object25: public NamedObject { int _field90, _field92; public: + Object25(); void setupHiddenSwitch(int x, int y, int arg8, int argA); virtual void synchronize(Serializer &s); virtual bool startAction(CursorType action, Event &event); diff --git a/engines/tsage/blue_force/blueforce_speakers.cpp b/engines/tsage/blue_force/blueforce_speakers.cpp index 2a57616640..b15d2f4716 100644 --- a/engines/tsage/blue_force/blueforce_speakers.cpp +++ b/engines/tsage/blue_force/blueforce_speakers.cpp @@ -63,8 +63,8 @@ void VisualSpeaker::synchronize(Serializer &s) { s.syncAsSint16LE(_offsetPos.y); } -void VisualSpeaker::proc12(Action *action) { - Speaker::proc12(action); +void VisualSpeaker::startSpeaking(Action *action) { + Speaker::startSpeaking(action); _textPos = Common::Point(_offsetPos.x + BF_GLOBALS._sceneManager._scene->_sceneBounds.left, _offsetPos.y + BF_GLOBALS._sceneManager._scene->_sceneBounds.top); _numFrames = 0; diff --git a/engines/tsage/blue_force/blueforce_speakers.h b/engines/tsage/blue_force/blueforce_speakers.h index e406a50fbe..e9150df056 100644 --- a/engines/tsage/blue_force/blueforce_speakers.h +++ b/engines/tsage/blue_force/blueforce_speakers.h @@ -51,7 +51,7 @@ public: virtual Common::String getClassName() { return "VisualSpeaker"; } virtual void synchronize(Serializer &s); virtual void remove(); - virtual void proc12(Action *action); + virtual void startSpeaking(Action *action); virtual void setText(const Common::String &msg); }; diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 919ba9f69a..5a4310228d 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -934,7 +934,7 @@ void StripManager::signal() { g_globals->_sceneManager._scene->loadScene(_sceneNumber); } - _activeSpeaker->proc12(this); + _activeSpeaker->startSpeaking(this); } if (_callbackObject) { @@ -1088,7 +1088,7 @@ void Speaker::remove() { SceneObjectList::deactivate(); } -void Speaker::proc12(Action *action) { +void Speaker::startSpeaking(Action *action) { _action = action; if (_newSceneNumber != -1) { _oldSceneNumber = g_globals->_sceneManager._sceneNumber; diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index b1cbbeaf2b..7e57199d2f 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -91,7 +91,7 @@ public: virtual Common::String getClassName() { return "Speaker"; } virtual void synchronize(Serializer &s); virtual void remove(); - virtual void proc12(Action *action); + virtual void startSpeaking(Action *action); virtual void setText(const Common::String &msg); virtual void removeText(); virtual void proc16() {} diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index b7724f072c..b043df0c10 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -119,8 +119,11 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface _sounds.push_back(&_soundHandler); _sounds.push_back(&_sequenceManager._soundHandler); - _scrollFollower = NULL; - _inventory = NULL; + _scrollFollower = nullptr; + + _inventory = nullptr; + _game = nullptr; + _sceneHandler = nullptr; switch (g_vm->getGameID()) { case GType_Ringworld: @@ -145,6 +148,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface _sceneHandler = new Ringworld2::SceneHandlerExt(); break; } + } Globals::~Globals() { @@ -204,6 +208,11 @@ void Globals::dispatchSounds() { /*--------------------------------------------------------------------------*/ +TsAGE2Globals::TsAGE2Globals() { + _onSelectItem = NULL; + _interfaceY = 0; +} + void TsAGE2Globals::reset() { Globals::reset(); @@ -224,6 +233,32 @@ void TsAGE2Globals::synchronize(Serializer &s) { namespace BlueForce { BlueForceGlobals::BlueForceGlobals(): TsAGE2Globals() { + _hiddenDoorStatus = 0; + _nico910State = 0; + _v4CEE4 = 0; + _v4CEE6 = 0; + _v4CEE8 = 0; + _deziTopic = 0; + _deathReason = 0; + _driveFromScene = 300; + _driveToScene = 0; + _v501F8 = 0; + _v501FA = 0; + _v501FC = 0; + _v5020C = 0; + _v50696 = 0; + _subFlagBitArr1 = 0; + _subFlagBitArr2 = 0; + _v50CC2 = 0; + _scene410Action1Count = 0; + _scene410TalkCount = 0; + _scene410HarrisonMovedFl = 0; + _v51C42 = 0; + _v51C44 = 1; + _bookmark = bNone; + _mapLocationId = 1; + _clip1Bullets = 8; + _clip2Bullets = 8; } void BlueForceGlobals::synchronize(Serializer &s) { @@ -264,9 +299,9 @@ void BlueForceGlobals::synchronize(Serializer &s) { s.syncAsSint16LE(_subFlagBitArr1); s.syncAsSint16LE(_subFlagBitArr2); s.syncAsSint16LE(_v50CC2); - s.syncAsSint16LE(_v50CC4); - s.syncAsSint16LE(_v50CC6); - s.syncAsSint16LE(_v50CC8); + s.syncAsSint16LE(_scene410Action1Count); + s.syncAsSint16LE(_scene410TalkCount); + s.syncAsSint16LE(_scene410HarrisonMovedFl); s.syncAsSint16LE(_v51C42); s.syncAsSint16LE(_v51C44); s.syncAsSint16LE(_bookmark); @@ -335,9 +370,9 @@ void BlueForceGlobals::reset() { _subFlagBitArr1 = 0; _subFlagBitArr2 = 0; _v50CC2 = 0; - _v50CC4 = 0; - _v50CC6 = 0; - _v50CC8 = 0; + _scene410Action1Count = 0; + _scene410TalkCount = 0; + _scene410HarrisonMovedFl = 0; _v51C42 = 0; _v51C44 = 1; _clip1Bullets = 8; @@ -370,6 +405,32 @@ namespace Ringworld2 { Ringworld2Globals::Ringworld2Globals() { _scannerDialog = new ScannerDialog(); _speechSubtitles = SPEECH_TEXT; + + _v5657C = 0; + _stripModifier = 0; + _flubMazeArea = 1; + _flubMazeEntryDirection = 0; + _maze3800SceneNumb = 3800; + _landerSuitNumber = 2; + _desertStepsRemaining = 5; + _desertCorrectDirection = 0; + _desertPreviousDirection = 0; + _desertWrongDirCtr = -1; + _balloonAltitude = 5; + _scene1925CurrLevel = 0; + _walkwaySceneNumber = 0; + _v56AA0 = 0; + _scientistConvIndex = 0; + _v56AA6 = 1; + _v56AA7 = 1; + _v56AA8 = 1; + _v56AAB = 0; + _scene180Mode = -1; + _v57709 = 0; + _v5780C = 0; + _v5780E = 0; + _v57810 = 0; + _v57C2C = 0; } Ringworld2Globals::~Ringworld2Globals() { @@ -412,7 +473,7 @@ void Ringworld2Globals::reset() { _foodCount = 0; _rimLocation = 0; _rimTransportLocation = 0; - _v565AE = 0; + _stripModifier = 0; _spillLocation[0] = 0; _spillLocation[1] = 3; _spillLocation[R2_SEEKER] = 5; @@ -452,7 +513,7 @@ void Ringworld2Globals::reset() { _vampireData[16]._shotsRequired = 1; _vampireData[17]._shotsRequired = 1; - _v566A6 = 3800; + _maze3800SceneNumb = 3800; _landerSuitNumber = 2; _flubMazeArea = 1; _flubMazeEntryDirection = 0; @@ -526,7 +587,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { s.syncAsSint32LE(_rimLocation); s.syncAsSint16LE(_rimTransportLocation); s.syncAsSint16LE(_landerSuitNumber); - s.syncAsSint16LE(_v566A6); + s.syncAsSint16LE(_maze3800SceneNumb); s.syncAsSint16LE(_desertWrongDirCtr); s.syncAsSint16LE(_scene1925CurrLevel); // _v56A9C s.syncAsSint16LE(_walkwaySceneNumber); @@ -548,7 +609,7 @@ void Ringworld2Globals::synchronize(Serializer &s) { for (i = 0; i < MAX_CHARACTERS; ++i) s.syncAsByte(_scannerFrequencies[i]); - s.syncAsByte(_v565AE); + s.syncAsByte(_stripModifier); s.syncAsByte(_flubMazeArea); s.syncAsByte(_flubMazeEntryDirection); s.syncAsByte(_desertStepsRemaining); diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index ad47f7f620..e514a51120 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -110,7 +110,7 @@ public: int _interfaceY; ASoundExt _inventorySound; - TsAGE2Globals() { _onSelectItem = NULL; } + TsAGE2Globals(); virtual void reset(); virtual void synchronize(Serializer &s); }; @@ -208,19 +208,19 @@ public: int _deathReason; int _driveFromScene; int _driveToScene; - int _v501F8; - int _v501FA; - int _v501FC; - int _v5020C; - int _v50696; + int _v501F8; // Useless variable + int _v501FA; // Useless variable + int _v501FC; // Useless variable + int _v5020C; // Useless variable + int _v50696; // Useless variable uint8 _subFlagBitArr1; uint8 _subFlagBitArr2; int _v50CC2; - int _v50CC4; - int _v50CC6; - int _v50CC8; - int _v51C42; - int _v51C44; + int _scene410Action1Count; + int _scene410TalkCount; + int _scene410HarrisonMovedFl; + int _v51C42; // Useless variable + int _v51C44; // Useless variable Bookmark _bookmark; int _mapLocationId; int _clip1Bullets, _clip2Bullets; @@ -273,13 +273,13 @@ public: int _foodCount; int _rimLocation; int _rimTransportLocation; - int _v5657C; - byte _v565AE; + int _v5657C; // Useless variable + byte _stripModifier; byte _spillLocation[14]; VampireData _vampireData[18]; byte _flubMazeArea; byte _flubMazeEntryDirection; - int _v566A6; + int _maze3800SceneNumb; byte _landerSuitNumber; byte _desertStepsRemaining; byte _desertCorrectDirection; @@ -292,17 +292,16 @@ public: byte _v56AA0; byte _scientistConvIndex; Common::Point _ventCellPos; - int _v56AA4; byte _v56AA6; byte _v56AA7; byte _v56AA8; - int _v56AAB; + int _v56AAB; // Useless variable int _scene180Mode; // _v575f7 int _v57709; int _v5780C; int _v5780E; int _v57810; - int _v57C2C; + int _v57C2C; // Useless variable. Seems to be _speechSubtitles int _speechSubtitles; Common::Point _s1550PlayerArea[3]; // only used for Quinn and Seeker byte _scannerFrequencies[4]; diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 2395cc67ed..ee015e3315 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -591,20 +591,24 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi Graphics::Surface srcSurface = srcImage.lockSurface(); Graphics::Surface destSurface = lockSurface(); + // Get clipping area + Rect clipRect = !_clipRect.isEmpty() ? _clipRect : + Rect(0, 0, destSurface.w, destSurface.h); + // Adjust bounds to ensure destination will be on-screen int srcX = 0, srcY = 0; - if (destBounds.left < 0) { - srcX = -destBounds.left; - destBounds.left = 0; + if (destBounds.left < clipRect.left) { + srcX = clipRect.left - destBounds.left; + destBounds.left = clipRect.left; } - if (destBounds.top < 0) { - srcY = -destBounds.top; - destBounds.top = 0; + if (destBounds.top < clipRect.top) { + srcY = clipRect.top - destBounds.top; + destBounds.top = clipRect.top; } - if (destBounds.right > destSurface.w) - destBounds.right = destSurface.w; - if (destBounds.bottom > destSurface.h) - destBounds.bottom = destSurface.h; + if (destBounds.right > clipRect.right) + destBounds.right = clipRect.right; + if (destBounds.bottom > clipRect.bottom) + destBounds.bottom = clipRect.bottom; if (destBounds.isValidRect() && !((destBounds.right < 0) || (destBounds.bottom < 0) || (destBounds.left >= destSurface.w) || (destBounds.top >= destSurface.h))) { @@ -706,6 +710,11 @@ GfxElement::GfxElement() { _owner = NULL; _keycode = 0; _flags = 0; + + _fontNumber = 0; + _color1 = 0; + _color2 = 0; + _color3 = 0; } void GfxElement::setDefaults() { @@ -1363,6 +1372,8 @@ GfxFont::GfxFont() { _bpp = 0; _fontData = NULL; _fillFlag = false; + + _gfxManager = nullptr; } GfxFont::~GfxFont() { diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index 7239a99a68..8d9c4d31b1 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -88,6 +88,7 @@ private: public: Common::Point _centroid; int _transColor; + Rect _clipRect; public: GfxSurface(); GfxSurface(const GfxSurface &s); diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp index 0584570ac2..1e9d14cdcf 100644 --- a/engines/tsage/ringworld/ringworld_logic.cpp +++ b/engines/tsage/ringworld/ringworld_logic.cpp @@ -270,6 +270,11 @@ bool DisplayObject::performAction(int action) { SceneArea::SceneArea() { _savedArea = NULL; _pt.x = _pt.y = 0; + + _resNum = 0; + _rlbNum = 0; + _subNum = 0; + _actionId = 0; } SceneArea::~SceneArea() { diff --git a/engines/tsage/ringworld/ringworld_scenes5.cpp b/engines/tsage/ringworld/ringworld_scenes5.cpp index 004ccbbb6d..725370c8a4 100644 --- a/engines/tsage/ringworld/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld/ringworld_scenes5.cpp @@ -34,6 +34,9 @@ namespace Ringworld { * Scene 4000 - Village * *--------------------------------------------------------------------------*/ +Scene4000::Hotspot8::Hotspot8() : SceneObject() { + _ctr = 0; +} void Scene4000::Action1::signal() { // Quinn has the peg. Everybody enter the screen. diff --git a/engines/tsage/ringworld/ringworld_scenes5.h b/engines/tsage/ringworld/ringworld_scenes5.h index c93df2a1d8..2fe26d9712 100644 --- a/engines/tsage/ringworld/ringworld_scenes5.h +++ b/engines/tsage/ringworld/ringworld_scenes5.h @@ -99,6 +99,7 @@ class Scene4000 : public Scene { private: int _ctr; public: + Hotspot8(); virtual void synchronize(Serializer &s) { SceneObject::synchronize(s); s.syncAsUint16LE(_ctr); diff --git a/engines/tsage/ringworld/ringworld_scenes6.cpp b/engines/tsage/ringworld/ringworld_scenes6.cpp index 30a91b57aa..9c18830a30 100644 --- a/engines/tsage/ringworld/ringworld_scenes6.cpp +++ b/engines/tsage/ringworld/ringworld_scenes6.cpp @@ -2033,6 +2033,12 @@ void Scene5300::Hotspot8::doAction(int action) { Scene5300::Scene5300() : _hotspot3(0, CURSOR_LOOK, 5300, 3, CURSOR_USE, 5300, 16, LIST_END) { + _field1B0A = 1; +} + +void Scene5300::synchronize(Serializer &s) { + Scene::synchronize(s); + s.syncAsSint16LE(_field1B0A); } void Scene5300::postInit(SceneObjectList *OwnerList) { diff --git a/engines/tsage/ringworld/ringworld_scenes6.h b/engines/tsage/ringworld/ringworld_scenes6.h index bf353de415..8b08f3bf01 100644 --- a/engines/tsage/ringworld/ringworld_scenes6.h +++ b/engines/tsage/ringworld/ringworld_scenes6.h @@ -318,15 +318,14 @@ public: Hotspot6 _hotspot6; Hotspot7 _hotspot7; Hotspot8 _hotspot8; + + // Useless variable, but removing it would break the savegames. int _field1B0A; Scene5300(); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void signal(); - virtual void synchronize(Serializer &s) { - Scene::synchronize(s); - s.syncAsSint16LE(_field1B0A); - } + virtual void synchronize(Serializer &s); }; } // End of namespace Ringworld diff --git a/engines/tsage/ringworld/ringworld_scenes8.cpp b/engines/tsage/ringworld/ringworld_scenes8.cpp index 9cb85a6930..f9156479e5 100644 --- a/engines/tsage/ringworld/ringworld_scenes8.cpp +++ b/engines/tsage/ringworld/ringworld_scenes8.cpp @@ -30,6 +30,10 @@ namespace TsAGE { namespace Ringworld { +NamedHotspotMult::NamedHotspotMult() : SceneHotspot() { + _useLineNum = _lookLineNum = 0; +} + void NamedHotspotMult::synchronize(Serializer &s) { SceneHotspot::synchronize(s); s.syncAsSint16LE(_useLineNum); @@ -2533,6 +2537,10 @@ Scene7700::Scene7700() { _object5._state = 0; _object6._state = 0; _prof._state = 0; + + _seatCountLeft1 = 0; + _seatCountLeft2 = 0; + _seatCountRight = 0; } void Scene7700::synchronize(Serializer &s) { diff --git a/engines/tsage/ringworld/ringworld_scenes8.h b/engines/tsage/ringworld/ringworld_scenes8.h index b24f220f8c..fa441f87da 100644 --- a/engines/tsage/ringworld/ringworld_scenes8.h +++ b/engines/tsage/ringworld/ringworld_scenes8.h @@ -40,7 +40,7 @@ using namespace TsAGE; class NamedHotspotMult : public SceneHotspot { public: int _useLineNum, _lookLineNum; - NamedHotspotMult() : SceneHotspot() {} + NamedHotspotMult(); virtual Common::String getClassName() { return "NamedHotspotMult"; } virtual void synchronize(Serializer &s); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 8e5537f2d1..1d6b998dcb 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -342,6 +342,9 @@ SceneExt::SceneExt(): Scene() { _savedCanWalk = false; _preventSaving = false; + // Reset screen clipping area + R2_GLOBALS._screenSurface._clipRect = Rect(); + // WORKAROUND: In the original, playing animations don't reset the global _animationCtr // counter as scene changes unless the playing animation explicitly finishes. For now, // to make inter-scene debugging easier, I'm explicitly resetting the _animationCtr @@ -1352,6 +1355,7 @@ SceneArea::SceneArea(): SceneItem() { _insideArea = false; _savedCursorNum = CURSOR_NONE; _cursorState = 0; + _cursorNum = CURSOR_NONE; } void SceneArea::synchronize(Serializer &s) { @@ -1404,6 +1408,8 @@ void SceneArea::setDetails(const Rect &bounds, CursorType cursor) { SceneExit::SceneExit(): SceneArea() { _moving = false; _destPos = Common::Point(-1, -1); + + _sceneNumber = 0; } void SceneExit::synchronize(Serializer &s) { @@ -1721,6 +1727,12 @@ void AnimationSlice::load(Common::File &f) { AnimationSlices::AnimationSlices() { _pixelData = NULL; + + _dataSize = 0; + _dataSize2 = 0; + _slices->_sliceOffset = 0; + _slices->_drawMode = 0; + _slices->_secondaryIndex = 0; } AnimationSlices::~AnimationSlices() { @@ -1786,6 +1798,18 @@ AnimationPlayer::AnimationPlayer(): EventHandler() { _sliceHeight = 1; _field58 = 1; _endAction = NULL; + + _sliceCurrent = nullptr; + _sliceNext = nullptr; + _field38 = 0; + _objectMode = ANIMOBJMODE_1; + _dataNeeded = 0; + _playbackTick = 0; + _playbackTickPrior = 0; + _position = 0; + _nextSlicesPosition = 0; + _frameDelay = 0; + _gameFrame = 0; } AnimationPlayer::~AnimationPlayer() { @@ -2025,7 +2049,7 @@ void AnimationPlayer::drawFrame(int sliceIndex) { // Unlock the screen surface R2_GLOBALS._screenSurface.unlockSurface(); - if (_objectMode == 42) { + if (_objectMode == ANIMOBJMODE_42) { _screenBounds.expandPanes(); // Copy the drawn frame to the back surface @@ -2094,7 +2118,7 @@ void AnimationPlayer::close() { // Close the resource file _resourceFile.close(); - if (_objectMode != 42) { + if (_objectMode != ANIMOBJMODE_42) { // flip screen in original } @@ -2205,7 +2229,7 @@ void ModalWindow::process(Event &event) { } } -void ModalWindow::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { +void ModalWindow::setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY) { Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene; _object1.postInit(); @@ -2218,7 +2242,7 @@ void ModalWindow::proc12(int visage, int stripFrameNum, int frameNum, int posX, _insetCount = R2_GLOBALS._insetUp; } -void ModalWindow::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { +void ModalWindow::setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { _object1.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); } @@ -2477,15 +2501,15 @@ void ScannerDialog::remove() { ModalWindow::remove(); } -void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { +void ScannerDialog::setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY) { // Stop player moving if currently doing so if (R2_GLOBALS._player._mover) R2_GLOBALS._player.addMover(NULL); R2_GLOBALS._events.setCursor(CURSOR_USE); - ModalWindow::proc12(visage, stripFrameNum, frameNum, posX, posY); + ModalWindow::setup2(visage, stripFrameNum, frameNum, posX, posY); - proc13(100, -1, -1, -1); + setup3(100, -1, -1, -1); _talkButton.setup(1); _scanButton.setup(2); _slider.setup(R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex], 142, 124, 35, 5); diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 5c8af8d884..ff5bfc0b6f 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -461,8 +461,8 @@ public: virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "ModalWindow"; } virtual void process(Event &event); - virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); - virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); + virtual void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY); + virtual void setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum); }; class ScannerDialog: public ModalWindow { @@ -515,7 +515,7 @@ public: virtual Common::String getClassName() { return "ScannerDialog"; } virtual void remove(); - void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); + virtual void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY); }; } // End of namespace Ringworld2 diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 5e4b4e4191..d1d4fabb01 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -1425,6 +1425,7 @@ Scene160::Scene160(): SceneExt() { void Scene160::postInit(SceneObjectList *OwnerList) { loadScene(4001); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); R2_GLOBALS._player._uiEnabled = false; @@ -1605,6 +1606,7 @@ void Scene180::signal() { case 43: case 47: _field412 = 0; + R2_GLOBALS._screenSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0); _palette.loadPalette(0); _palette.loadPalette(9998); R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 8, this); @@ -1808,6 +1810,8 @@ void Scene180::signal() { // TODO: Figure out why end action on sounds aren't firing. For now, I'm // simply setting up a scene delay to ensure the signal() method gets // called again after a brief delay + _backSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0); + R2_GLOBALS._screenSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0); setSceneDelay(10); R2_GLOBALS._sound2.fadeOut2(NULL); R2_GLOBALS._sound1.fadeOut2(NULL /* this */); @@ -1871,13 +1875,21 @@ void Scene180::signal() { case 49: R2_GLOBALS._scene180Mode = 15; R2_GLOBALS._paneRefreshFlag[0] = 3; + + _backSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0); + R2_GLOBALS._screenSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0); + setSceneDelay(1); break; case 50: R2_GLOBALS._scene180Mode = 0; _field412 = 0; - R2_GLOBALS._sceneManager.changeScene(100); + + // WORKAROUND: The original changed to scene 100 here, Quinn's Bedroom, + // but instead we're changing to the previously unused scene 50, which shows + // a closeup of Quinn in the floatation bed first + R2_GLOBALS._sceneManager.changeScene(50); break; } } @@ -2344,8 +2356,9 @@ Scene205::Scene205(): SceneExt() { void Scene205::postInit(SceneObjectList *OwnerList) { loadScene(4000); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._player._uiEnabled = false; R2_GLOBALS._sound1.play(337); @@ -2606,11 +2619,11 @@ void Scene250::synchronize(Serializer &s) { void Scene250::postInit(SceneObjectList *OwnerList) { loadScene(250); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._player.postInit(); - R2_GLOBALS._uiElements._active = false; R2_GLOBALS._player.setVisage(10); R2_GLOBALS._player.hide(); R2_GLOBALS._player.enableControl(); @@ -6954,11 +6967,11 @@ Scene825::Scene825(): SceneExt() { void Scene825::postInit(SceneObjectList *OwnerList) { loadScene(825); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._player.postInit(); - R2_GLOBALS._uiElements._active = false; R2_GLOBALS._player._effect = 0; R2_GLOBALS._player.setVisage(10); R2_GLOBALS._player.hide(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 0932c70f04..a57395b9f6 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -479,9 +479,9 @@ void Scene1000::dispatch() { void Scene1010::postInit(SceneObjectList *OwnerList) { loadScene(1010); - SceneExt::postInit(); - R2_GLOBALS._interfaceY = 200; R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); + R2_GLOBALS._interfaceY = SCREEN_HEIGHT; setZoomPercents(100, 1, 160, 100); R2_GLOBALS._player.postInit(); @@ -540,14 +540,14 @@ void Scene1010::signal() { void Scene1020::postInit(SceneObjectList *OwnerList) { loadScene(1020); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); if (R2_GLOBALS._sceneManager._previousScene == 1010) _sceneBounds = Rect(160, 0, SCREEN_WIDTH + 160, 200); - R2_GLOBALS._interfaceY = 200; + R2_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._v558B6.set(160, 0, 160, 161); - R2_GLOBALS._uiElements._active = false; R2_GLOBALS._player.postInit(); if (R2_GLOBALS._sceneManager._previousScene == 1010) { @@ -694,13 +694,13 @@ bool Scene1100::Seeker::startAction(CursorType action, Event &event) { } else { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 55; - if (R2_GLOBALS._v565AE >= 3) { + if (R2_GLOBALS._stripModifier >= 3) { if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->_stripManager.start3(329, scene, R2_GLOBALS._stripManager_lookupList); else scene->_stripManager.start3(330, scene, R2_GLOBALS._stripManager_lookupList); } else { - ++R2_GLOBALS._v565AE; + ++R2_GLOBALS._stripModifier; R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->_stripManager.start3(304, scene, R2_GLOBALS._stripManager_lookupList); @@ -1482,8 +1482,8 @@ void Scene1200::LaserPanel::postInit(SceneObjectList *OwnerList) { scene->_field41A = 1; R2_GLOBALS._events.setCursor(CURSOR_USE); - proc12(1003, 1, 1, 100, 40); - proc13(1200, 11, -1, -1); + setup2(1003, 1, 1, 100, 40); + setup3(1200, 11, -1, -1); R2_GLOBALS._sound2.play(259); _jumper1.init(1); _jumper2.init(2); @@ -4307,12 +4307,12 @@ void Scene1337::postInit(SceneObjectList *OwnerList) { // In the original, may be found in subPostInit. // Without it, enableControl asserts loadScene(1330); + R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); // // Hide the user interface - R2_GLOBALS._uiElements._active = false; - BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._player.enableControl(); R2_GLOBALS._player._canWalk = false; @@ -7548,8 +7548,8 @@ void Scene1550::UnkArea1550::process(Event &event) { } } -void Scene1550::UnkArea1550::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { - // UnkArea1200::proc12(); +void Scene1550::UnkArea1550::setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY) { + // UnkArea1200::setup2(); Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene; _areaActor.postInit(); @@ -7562,7 +7562,7 @@ void Scene1550::UnkArea1550::proc12(int visage, int stripFrameNum, int frameNum, _field20 = R2_GLOBALS._insetUp; // - proc13(1550, 67, -1, -1); + setup3(1550, 67, -1, -1); _unkObj155031.postInit(); _unkObj155031._fieldA4 = 1; if (scene->_actor4._frame == 1) @@ -7585,7 +7585,7 @@ void Scene1550::UnkArea1550::proc12(int visage, int stripFrameNum, int frameNum, _unkObj155032.setDetails(1550, 69, -1, -1, 2, (SceneItem *) NULL); } -void Scene1550::UnkArea1550::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { +void Scene1550::UnkArea1550::setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { // Copy of Scene1200::LaserPanel::proc13 _areaActor.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); } @@ -7832,7 +7832,7 @@ void Scene1550::postInit(SceneObjectList *OwnerList) { switch (R2_GLOBALS._sceneManager._previousScene) { case 1530: - R2_GLOBALS._v565AE = 0; + R2_GLOBALS._stripModifier = 0; // No break on purpose case 300: // No break on purpose @@ -7915,7 +7915,7 @@ void Scene1550::signal() { // No break on purpose case 1563: R2_GLOBALS.clearFlag(20); - _unkArea1.proc12(1559, 1, 1, 160, 125); + _unkArea1.setup2(1559, 1, 1, 160, 125); R2_GLOBALS._player.enableControl(); _sceneMode = 0; break; @@ -8058,33 +8058,33 @@ void Scene1550::signal() { _sceneMode = 60; R2_GLOBALS._player.disableControl(); R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); - if (R2_GLOBALS._v565AE >= 3) { + if (R2_GLOBALS._stripModifier >= 3) { if (R2_GLOBALS._player._characterIndex == R2_QUINN) _stripManager.start(572, this); else _stripManager.start(573, this); } else { - ++R2_GLOBALS._v565AE; + ++R2_GLOBALS._stripModifier; if (R2_GLOBALS._player._characterIndex == R2_QUINN) - _stripManager.start(499 + R2_GLOBALS._v565AE, this); + _stripManager.start(499 + R2_GLOBALS._stripModifier, this); else - _stripManager.start(502 + R2_GLOBALS._v565AE, this); + _stripManager.start(502 + R2_GLOBALS._stripModifier, this); } } else { _sceneMode = 60; R2_GLOBALS._player.disableControl(); R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); - if (R2_GLOBALS._v565AE >= 4) { + if (R2_GLOBALS._stripModifier >= 4) { if (R2_GLOBALS._player._characterIndex == R2_QUINN) _stripManager.start(572, this); else _stripManager.start(573, this); } else { - ++R2_GLOBALS._v565AE; + ++R2_GLOBALS._stripModifier; if (R2_GLOBALS._player._characterIndex == R2_QUINN) - _stripManager.start(563 + R2_GLOBALS._v565AE, this); + _stripManager.start(563 + R2_GLOBALS._stripModifier, this); else - _stripManager.start(567 + R2_GLOBALS._v565AE, this); + _stripManager.start(567 + R2_GLOBALS._stripModifier, this); } } break; @@ -8116,7 +8116,7 @@ void Scene1550::signal() { case 1558: _actor13.fixPriority(124); _field415 = 1; - _unkArea1.proc12(1559, 1, 1, 160, 125); + _unkArea1.setup2(1559, 1, 1, 160, 125); R2_GLOBALS._player.enableControl(); break; case 1559: @@ -13662,24 +13662,24 @@ void Scene1950::KeypadWindow::remove() { } } -void Scene1950::KeypadWindow::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) { +void Scene1950::KeypadWindow::setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY) { Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene; if (R2_GLOBALS._player._mover) R2_GLOBALS._player.addMover(NULL); R2_GLOBALS._player._canWalk = false; - ModalWindow::proc12(visage, stripFrameNum, frameNum, posX, posY); + ModalWindow::setup2(visage, stripFrameNum, frameNum, posX, posY); _object1.fixPriority(248); scene->_eastExit._enabled = false; - proc13(1950, 27, 28, 27); + setup3(1950, 27, 28, 27); for (_buttonIndex = 0; _buttonIndex < 16; _buttonIndex++) _buttons[_buttonIndex].init(_buttonIndex); } -void Scene1950::KeypadWindow::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { +void Scene1950::KeypadWindow::setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum) { // Copy of Scene1200::LaserPanel::proc13() _areaActor.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL); } @@ -15288,7 +15288,7 @@ void Scene1950::signal() { // No break on purpose case 1963: R2_GLOBALS._player.enableControl(); - _KeypadWindow.proc12(1971, 1, 1, 160, 135); + _KeypadWindow.setup2(1971, 1, 1, 160, 135); break; case 1964: // No break on purpose diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index c0088236b4..15475f95b0 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -468,8 +468,8 @@ class Scene1550 : public SceneExt { virtual void remove(); virtual void process(Event &event); - virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); - virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); + virtual void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY); + virtual void setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum); }; class WorkingShip : public NamedHotspot { @@ -1134,8 +1134,8 @@ class Scene1950 : public SceneExt { KeypadWindow(); virtual void synchronize(Serializer &s); virtual void remove(); - virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); - virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum); + virtual void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY); + virtual void setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum); }; class Keypad : public NamedHotspot { diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 510855b162..17dca69c45 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -1944,14 +1944,14 @@ bool Scene2450::CareTaker::startAction(CursorType action, Event &event) { if (action == CURSOR_TALK) { R2_GLOBALS._player.disableControl(); - if (R2_GLOBALS._v565AE < 3) { - ++R2_GLOBALS._v565AE; + if (R2_GLOBALS._stripModifier < 3) { + ++R2_GLOBALS._stripModifier; scene->_sceneMode = 20; R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); if (R2_GLOBALS._player._characterIndex == R2_QUINN) - scene->_stripManager.start(699 + (R2_GLOBALS._v565AE * 2), scene); + scene->_stripManager.start(699 + (R2_GLOBALS._stripModifier * 2), scene); else - scene->_stripManager.start(700 + (R2_GLOBALS._v565AE * 2), scene); + scene->_stripManager.start(700 + (R2_GLOBALS._stripModifier * 2), scene); } return true; } else { @@ -2009,7 +2009,7 @@ void Scene2450::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.disableControl(); switch (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) { case 1900: - R2_GLOBALS._v565AE = 0; + R2_GLOBALS._stripModifier = 0; R2_GLOBALS._player._characterScene[R2_QUINN] = 2450; R2_GLOBALS._player._characterScene[R2_SEEKER] = 2450; R2_GLOBALS._player._oldCharacterScene[R2_QUINN] = 2450; @@ -2145,14 +2145,14 @@ void Scene2450::signal() { g_globals->_sceneManager.changeScene(2000); break; case 20: - if (R2_GLOBALS._v565AE == 3) { + if (R2_GLOBALS._stripModifier == 3) { R2_GLOBALS._player.disableControl(); - R2_GLOBALS._v565AE = 4; + R2_GLOBALS._stripModifier = 4; _sceneMode = 2454; setAction(&_sequenceManager, this, 2454, &_careTaker, NULL); } else { R2_GLOBALS._player.enableControl(CURSOR_TALK); - if (R2_GLOBALS._v565AE < 4) + if (R2_GLOBALS._stripModifier < 4) R2_GLOBALS._player._canWalk = false; } break; diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 5cca1ee483..1fe0150ff0 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -697,7 +697,7 @@ void Scene3150::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager, this, 3156, &R2_GLOBALS._player, &_guard, &_doorBars, &_foodTray, NULL); } else { - if (R2_GLOBALS._v56AA0 != 2) + if ((R2_GLOBALS._v56AA0 != 1) && (R2_GLOBALS._v56AA0 != 2)) ++R2_GLOBALS._v56AA0; R2_GLOBALS._player.setup(30, 3, 1); @@ -1661,8 +1661,8 @@ void Scene3275::signal() { void Scene3350::postInit(SceneObjectList *OwnerList) { loadScene(3350); - SceneExt::postInit(); R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); R2_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._sound2.play(310); @@ -3622,7 +3622,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) { loadScene(1050); R2_GLOBALS._uiElements._active = false; - R2_GLOBALS._interfaceY = 200; + R2_GLOBALS._interfaceY = SCREEN_HEIGHT; R2_GLOBALS._v5589E.set(0, 0, 320, 200); R2_GLOBALS._sound1.play(305); @@ -4941,8 +4941,8 @@ void Scene3600::dispatch() { void Scene3700::postInit(SceneObjectList *OwnerList) { loadScene(3700); - SceneExt::postInit(); R2_GLOBALS._uiElements._active = false; + SceneExt::postInit(); R2_GLOBALS._interfaceY = SCREEN_HEIGHT; _stripManager.setColors(60, 255); @@ -5185,7 +5185,7 @@ void Scene3800::initExits() { _southExit._moving = false; _westExit._moving = false; - loadScene(R2_GLOBALS._v566A6); + loadScene(R2_GLOBALS._maze3800SceneNumb); R2_GLOBALS._uiElements.draw(); } @@ -5322,30 +5322,30 @@ void Scene3800::postInit(SceneObjectList *OwnerList) { void Scene3800::signal() { switch (_sceneMode) { case 11: - R2_GLOBALS._v566A6 += 15; - if (R2_GLOBALS._v566A6 > 3815) - R2_GLOBALS._v566A6 -= 20; + R2_GLOBALS._maze3800SceneNumb += 15; + if (R2_GLOBALS._maze3800SceneNumb > 3815) + R2_GLOBALS._maze3800SceneNumb -= 20; initExits(); enterArea(); break; case 12: - R2_GLOBALS._v566A6 += 5; - if (R2_GLOBALS._v566A6 > 3815) - R2_GLOBALS._v566A6 = 3800; + R2_GLOBALS._maze3800SceneNumb += 5; + if (R2_GLOBALS._maze3800SceneNumb > 3815) + R2_GLOBALS._maze3800SceneNumb = 3800; initExits(); enterArea(); break; case 13: - R2_GLOBALS._v566A6 -= 15; - if (R2_GLOBALS._v566A6 < 3800) - R2_GLOBALS._v566A6 += 20; + R2_GLOBALS._maze3800SceneNumb -= 15; + if (R2_GLOBALS._maze3800SceneNumb < 3800) + R2_GLOBALS._maze3800SceneNumb += 20; initExits(); enterArea(); break; case 14: - R2_GLOBALS._v566A6 -= 5; - if (R2_GLOBALS._v566A6 < 3800) - R2_GLOBALS._v566A6 = 3815; + R2_GLOBALS._maze3800SceneNumb -= 5; + if (R2_GLOBALS._maze3800SceneNumb < 3800) + R2_GLOBALS._maze3800SceneNumb = 3815; initExits(); enterArea(); break; diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index 4be3212e77..fee97f2e25 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -42,6 +42,13 @@ VisualSpeaker::VisualSpeaker(): Speaker() { _color2 = 0; _displayMode = 0; _speakerMode = 0; + + _object2 = nullptr; + _fieldF8 = 0; + _soundId = 0; + _removeObject = false; + _numFrames = 0; + _voiceFrameNumber = 0; } void VisualSpeaker::remove() { @@ -76,7 +83,7 @@ void VisualSpeaker::signal() { _fieldF8 = 1; } - if ((R2_GLOBALS._speechSubtitles & SPEECH_TEXT) || _soundId) + if ((R2_GLOBALS._speechSubtitles & SPEECH_TEXT) || !_soundId) _sceneText.show(); if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && _soundId) { @@ -92,6 +99,7 @@ void VisualSpeaker::signal() { void VisualSpeaker::dispatch() { uint32 frameNumber = R2_GLOBALS._events.getFrameNumber(); + assert(_action); // Delay check for character animation if (_delayAmount) { @@ -132,6 +140,7 @@ void VisualSpeaker::dispatch() { _object1.setFrame(1); if (!(R2_GLOBALS._speechSubtitles & SPEECH_TEXT)) { + // Don't bother waiting for a mouse click to start the next speech segment _action->setDelay(1); } } @@ -244,8 +253,13 @@ void VisualSpeaker::setText(const Common::String &msg) { _sceneText.hide(); } else { if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && _soundId) { - if (!R2_GLOBALS._playStream.play(_soundId, NULL)) + if (!R2_GLOBALS._playStream.play(_soundId, NULL)) { + // Couldn't play voice, so fall back on showing text _sceneText.show(); + } else { + _numFrames = 2; + _soundId = 0; + } } } } @@ -3203,7 +3217,7 @@ void SpeakerDutyOfficer180::proc15() { _object1.animate(ANIM_MODE_2, NULL); break; case 1: - _action = NULL; + _action->_action = NULL; _object1.setup(76, 2, 1); _object1.animate(ANIM_MODE_5, this); break; diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp index dbc122e6e4..f9e84e8913 100644 --- a/engines/tsage/saveload.cpp +++ b/engines/tsage/saveload.cpp @@ -47,6 +47,8 @@ SavedObject::~SavedObject() { Saver::Saver() { _macroSaveFlag = false; _macroRestoreFlag = false; + + _factoryPtr = nullptr; } Saver::~Saver() { @@ -127,7 +129,6 @@ Common::Error Saver::save(int slot, const Common::String &saveName) { // Set fields _macroSaveFlag = true; - _saveSlot = slot; // Try and create the save file Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(g_vm->generateSaveName(slot)); @@ -177,7 +178,6 @@ Common::Error Saver::restore(int slot) { // Set fields _macroRestoreFlag = true; - _saveSlot = slot; _unresolvedPtrs.clear(); // Set up the serializer diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h index d43ef792bc..fc4e12cd08 100644 --- a/engines/tsage/saveload.h +++ b/engines/tsage/saveload.h @@ -212,7 +212,6 @@ private: bool _macroSaveFlag; bool _macroRestoreFlag; - int _saveSlot; void resolveLoadPointers(); public: diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 58bb8c4a44..1726d6ad20 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -43,6 +43,7 @@ SceneManager::SceneManager() { g_saver->addListener(this); _objectCount = 0; _loadMode = 0; + _sceneLoadCount = 0; } SceneManager::~SceneManager() { @@ -273,6 +274,11 @@ Scene::Scene() : _sceneBounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), _activeScreenNumber = 0; _oldSceneBounds = Rect(4000, 4000, 4100, 4100); Common::fill(&_zoomPercents[0], &_zoomPercents[256], 0); + + _field12 = 0; + _screenNumber = 0; + _fieldA = 0; + _fieldE = 0; } Scene::~Scene() { diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 844cfc1d4d..195ba5ca03 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -2540,6 +2540,11 @@ PlayStream::PlayStream(): EventHandler() { _index = NULL; _endAction = NULL; _audioStream = NULL; + + _resData._fileChunkSize = 0; + _resData._indexSize = 0; + _resData._chunkSize = 0; + _voiceNum = 0; } PlayStream::~PlayStream() { diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index 95d0337af3..5d0bc92c1f 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -98,7 +98,7 @@ public: virtual const GroupData *getGroupData() { return NULL; } // Method #3 virtual void installPatch(const byte *data, int size) {} // Method #4 virtual void poll() {} // Method #5 - virtual void proc12() {} // Method #6 + virtual void method6() {} // Method #6 virtual int setMasterVolume(int volume) { return 0; } // Method #7 virtual void proc16() {} // Method #8 virtual void proc18(int al, VoiceType voiceType) {} // Method #9 diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 87697f950b..9956d5c7fb 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -38,6 +38,7 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc) _gameDescription(gameDesc) { g_vm = this; DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging"); + _debugger = nullptr; if (g_vm->getFeatures() & GF_DEMO) _debugger = new DemoDebugger(); else if (g_vm->getGameID() == GType_Ringworld) @@ -103,7 +104,7 @@ void TSageEngine::initialize() { g_globals = new Ringworld2::Ringworld2Globals(); // Setup the user interface - T2_GLOBALS._uiElements.setup(Common::Point(0, UI_INTERFACE_Y - 2)); + T2_GLOBALS._uiElements.setup(Common::Point(0, UI_INTERFACE_Y)); // Reset all global variables R2_GLOBALS.reset(); diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp index 09cc2fd56d..c7053a073d 100644 --- a/engines/tsage/user_interface.cpp +++ b/engines/tsage/user_interface.cpp @@ -87,7 +87,7 @@ void UIQuestion::showDescription(CursorType cursor) { Ringworld2::SceneExt *scene = static_cast<Ringworld2::SceneExt *> (R2_GLOBALS._sceneManager._scene); if (!scene->_sceneAreas.contains(R2_GLOBALS._scannerDialog)) - R2_GLOBALS._scannerDialog->proc12(4, 1, 1, 160, 125); + R2_GLOBALS._scannerDialog->setup2(4, 1, 1, 160, 125); } else { // Show object description SceneItem::display2(3, (int)cursor); @@ -276,11 +276,29 @@ void UICollection::draw() { Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT), Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT)); + if (g_vm->getGameID() == GType_Ringworld2) + r2rDrawFrame(); + _clearScreen = 1; g_globals->_sceneManager._scene->_sceneBounds = savedBounds; } } +void UICollection::r2rDrawFrame() { + Visage visage; + visage.setVisage(2, 1); + GfxSurface vertLine = visage.getFrame(1); + GfxSurface horizLine = visage.getFrame(2); + + GLOBALS._screenSurface.copyFrom(horizLine, 0, 0); + GLOBALS._screenSurface.copyFrom(vertLine, 0, 3); + GLOBALS._screenSurface.copyFrom(vertLine, SCREEN_WIDTH - 4, 3); + + // Restrict drawing area to exclude the borders at the edge of the screen + R2_GLOBALS._screenSurface._clipRect = Rect(4, 4, SCREEN_WIDTH - 4, + SCREEN_HEIGHT - 4); +} + /*--------------------------------------------------------------------------*/ UIElements::UIElements(): UICollection() { @@ -289,6 +307,10 @@ UIElements::UIElements(): UICollection() { else _cursorVisage.setVisage(1, 5); g_saver->addLoadNotifier(&UIElements::loadNotifierProc); + + _slotStart = 0; + _scoreValue = 0; + _active = false; } void UIElements::synchronize(Serializer &s) { diff --git a/engines/tsage/user_interface.h b/engines/tsage/user_interface.h index d06dccd9a4..60cefc0751 100644 --- a/engines/tsage/user_interface.h +++ b/engines/tsage/user_interface.h @@ -95,6 +95,8 @@ public: }; class UICollection: public EventHandler { +private: + void r2rDrawFrame(); protected: void erase(); public: diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursor_manager.cpp index 595e7946dd..c411013150 100644 --- a/engines/zvision/cursor_manager.cpp +++ b/engines/zvision/cursor_manager.cpp @@ -102,6 +102,7 @@ void CursorManager::changeCursor(const Common::String &cursorName, bool pushed) char buffer[25]; strcpy(buffer, _zgiCursorFileNames[i]); buffer[3] += 2; + changeCursor(ZorkCursor(buffer)); } return; } diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 06e921dfa8..49664935e1 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -80,7 +80,7 @@ static const ZVisionGameDescription gameDescriptions[] = { 0, AD_ENTRY1s("SCRIPTS.ZFS", "81efd40ecc3d22531e211368b779f17f", 8336944), Common::EN_ANY, - Common::kPlatformDOS, + Common::kPlatformWindows, ADGF_NO_FLAGS, GUIO1(GUIO_NONE) }, diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 6d8ae6d5a7..3b178cde5d 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -51,7 +51,8 @@ namespace ZVision { ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), - _workingWindow((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2) + WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2) + WORKING_WINDOW_HEIGHT), + _workingWindow(gameDesc->gameId == GID_NEMESIS ? Common::Rect((WINDOW_WIDTH - ZNEM_WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - ZNEM_WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - ZNEM_WORKING_WINDOW_WIDTH) / 2) + ZNEM_WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - ZNEM_WORKING_WINDOW_HEIGHT) / 2) + ZNEM_WORKING_WINDOW_HEIGHT) : + Common::Rect((WINDOW_WIDTH - ZGI_WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - ZGI_WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - ZGI_WORKING_WINDOW_WIDTH) / 2) + ZGI_WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - ZGI_WORKING_WINDOW_HEIGHT) / 2) + ZGI_WORKING_WINDOW_HEIGHT)), _pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /*RGB 565*/ _desiredFrameTime(33), /* ~30 fps */ _clock(_system), diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 84784d9a89..d9810ffa4e 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -70,8 +70,14 @@ private: enum { WINDOW_WIDTH = 640, WINDOW_HEIGHT = 480, - WORKING_WINDOW_WIDTH = 512, - WORKING_WINDOW_HEIGHT = 320, + + //Zork nemesis working window sizes + ZNEM_WORKING_WINDOW_WIDTH = 512, + ZNEM_WORKING_WINDOW_HEIGHT = 320, + + //ZGI(and default) working window sizes + ZGI_WORKING_WINDOW_WIDTH = 640, + ZGI_WORKING_WINDOW_HEIGHT = 344, ROTATION_SCREEN_EDGE_OFFSET = 60, MAX_ROTATION_SPEED = 400 // Pixels per second |